From d958e35477e0b8c24b735c8cdaa20ae92526702a Mon Sep 17 00:00:00 2001 From: Dylan McCurry Date: Mon, 28 Sep 2026 08:21:57 -0400 Subject: [PATCH 1/3] feat(diagram-core): upgrade pristine Archify to v3 Vendor the complete official v3.0.0 ZIP with a new pinned inventory and preserve the prior baseline. Adapt generated output metadata and Lifecycle final typography without changing upstream bytes or authored story contracts. Keep the 12px effective-text requirement and native route clearance. Refs #41 --- CHANGELOG.md | 13 + README.md | 2 +- docs/product-spec.md | 15 +- docs/renderer.md | 38 +- docs/story-preview.md | 3 + packages/cli/src/story-preview.test.ts | 2 +- packages/diagram-core/THIRD_PARTY_NOTICES.md | 15 +- packages/diagram-core/archify-integrity.json | 284 +- packages/diagram-core/archify-pin.json | 7 + .../integrity/archify-2.17.0-dev.1.json | 253 + packages/diagram-core/package.json | 1 + packages/diagram-core/src/index.ts | 19 +- packages/diagram-core/src/integrity.ts | 12 +- .../diagram-core/test/diagram-core.test.mjs | 33 +- packages/diagram-core/vendor/archify/PIN.json | 6 - packages/diagram-core/vendor/archify/SKILL.md | 110 + .../vendor/archify/assets/template.html | 5391 +++--- .../vendor/archify/bin/archify.mjs | 5270 +++++- .../vendor/archify/bin/finalize.mjs | 885 + .../vendor/archify/bin/open-artifact.mjs | 84 +- .../vendor/archify/bin/preview.mjs | 366 +- .../vendor/archify/bin/recover-output.mjs | 41 + .../vendor/archify/bin/visual-check.mjs | 2088 ++- .../archify/delta/architecture-delta.mjs | 146 +- .../archify/examples/agent-run.lifecycle.json | 55 + .../examples/agent-tool-call.workflow.json | 74 + .../async-job-roundtrip.sequence.json | 56 + .../brand-aware-delivery.architecture.json | 34 + .../examples/cache-miss-request.sequence.json | 77 + .../checkout-platform.base.architecture.json | 32 + .../checkout-platform.head.architecture.json | 32 + .../examples/dataflow-product-analytics.html | 13820 +++++++++++++++ .../deployment-release.lifecycle.json | 48 + .../examples/event-stream.dataflow.json | 52 + .../examples/holiday-planning.workflow.json | 143 + .../examples/incident-response.workflow.json | 59 + .../archify/examples/lifecycle-agent-run.html | 13765 +++++++++++++++ .../vendor/archify/examples/locales/de.json | 425 + .../vendor/archify/examples/locales/es.json | 440 + .../vendor/archify/examples/locales/fr.json | 425 + .../archify/examples/locales/fr.partial.json | 22 + .../vendor/archify/examples/locales/it.json | 425 + .../vendor/archify/examples/locales/ja.json | 425 + .../vendor/archify/examples/locales/ko.json | 440 + .../vendor/archify/examples/locales/pt.json | 425 + .../vendor/archify/examples/locales/ru.json | 425 + .../examples/product-analytics.dataflow.json | 71 + .../production-deployment.architecture.json | 51 + .../examples/release-delivery.workflow.json | 57 + .../examples/sequence-cache-miss-request.html | 13835 ++++++++++++++++ .../archify/examples/web-app-rendered.html | 13808 +++++++++++++++ .../examples/web-app.architecture.json | 41 + .../workflow-agent-tool-call-rendered.html | 13826 +++++++++++++++ .../vendor/archify/migrations/workflow-v2.mjs | 1 + .../diagram-core/vendor/archify/package.json | 26 +- .../vendor/archify/recipes/scenarios.mjs | 63 +- .../references/architecture-layout-repair.md | 18 + .../archify/references/authoring-contract.md | 238 +- .../archify/references/authoring-defaults.md | 41 + .../vendor/archify/references/brand-marks.md | 17 + .../archify/references/delivery-contract.md | 564 +- .../references/repository-authoring.md | 105 + .../archify/references/update-awareness.md | 9 + .../archify/references/viewer-runtime.md | 14 +- .../archify/renderers/architecture/labels.mjs | 215 + .../architecture/render-architecture.mjs | 723 +- .../renderers/architecture/routing.mjs | 1157 ++ .../archify/renderers/dataflow/README.md | 5 +- .../renderers/dataflow/render-dataflow.mjs | 93 +- .../archify/renderers/lifecycle/README.md | 102 +- .../renderers/lifecycle/grid-routing.mjs | 429 + .../renderers/lifecycle/render-lifecycle.mjs | 619 +- .../archify/renderers/sequence/README.md | 25 +- .../renderers/sequence/render-sequence.mjs | 156 +- .../renderers/shared/atomic-output.mjs | 1982 +++ .../archify/renderers/shared/brand-marks.mjs | 115 +- .../vendor/archify/renderers/shared/cli.mjs | 333 +- .../renderers/shared/desktop-readability.mjs | 106 + .../archify/renderers/shared/diagnostics.mjs | 63 +- .../renderers/shared/generated-validators.mjs | 125 +- .../archify/renderers/shared/geometry.mjs | 758 +- .../vendor/archify/renderers/shared/i18n.mjs | 268 +- .../renderers/shared/layout-report.mjs | 4 +- .../archify/renderers/shared/legend.mjs | 2 +- .../archify/renderers/shared/output-path.mjs | 558 +- .../renderers/shared/path-semantics.mjs | 1017 ++ .../renderers/shared/portable-path.mjs | 408 + .../renderers/shared/repository-evidence.mjs | 182 +- .../renderers/shared/repository-location.mjs | 1 + .../renderers/shared/route-quality.mjs | 614 + .../archify/renderers/shared/sidecar-path.mjs | 38 + .../archify/renderers/shared/spatial-grid.mjs | 66 + .../archify/renderers/shared/text-fit.mjs | 58 +- .../vendor/archify/renderers/shared/utils.mjs | 86 +- .../archify/renderers/workflow/README.md | 88 +- .../renderers/workflow/render-workflow.mjs | 4 +- .../renderers/workflow/workflow-compiler.mjs | 1669 +- .../vendor/archify/schemas/README.md | 81 +- .../archify/schemas/architecture.schema.json | 38 +- .../vendor/archify/schemas/common.schema.json | 68 +- .../archify/schemas/dataflow.schema.json | 15 +- .../archify/schemas/lifecycle.schema.json | 22 +- .../archify/schemas/sequence.schema.json | 15 +- .../archify/schemas/workflow.schema.json | 15 +- .../archify/scripts/check-render-output.mjs | 568 +- .../vendor/archify/scripts/check-update.mjs | 50 +- .../archify/scripts/generate-brand-marks.mjs | 141 - .../archify/scripts/generate-validators.mjs | 66 - .../vendor/archify/skill-release.json | 4 +- packages/site/tests/e2e/archify-story.spec.ts | 18 +- 110 files changed, 96627 insertions(+), 6111 deletions(-) create mode 100644 packages/diagram-core/archify-pin.json create mode 100644 packages/diagram-core/integrity/archify-2.17.0-dev.1.json delete mode 100644 packages/diagram-core/vendor/archify/PIN.json create mode 100644 packages/diagram-core/vendor/archify/SKILL.md create mode 100644 packages/diagram-core/vendor/archify/bin/finalize.mjs create mode 100644 packages/diagram-core/vendor/archify/bin/recover-output.mjs create mode 100644 packages/diagram-core/vendor/archify/examples/agent-run.lifecycle.json create mode 100644 packages/diagram-core/vendor/archify/examples/agent-tool-call.workflow.json create mode 100644 packages/diagram-core/vendor/archify/examples/async-job-roundtrip.sequence.json create mode 100644 packages/diagram-core/vendor/archify/examples/brand-aware-delivery.architecture.json create mode 100644 packages/diagram-core/vendor/archify/examples/cache-miss-request.sequence.json create mode 100644 packages/diagram-core/vendor/archify/examples/checkout-platform.base.architecture.json create mode 100644 packages/diagram-core/vendor/archify/examples/checkout-platform.head.architecture.json create mode 100644 packages/diagram-core/vendor/archify/examples/dataflow-product-analytics.html create mode 100644 packages/diagram-core/vendor/archify/examples/deployment-release.lifecycle.json create mode 100644 packages/diagram-core/vendor/archify/examples/event-stream.dataflow.json create mode 100644 packages/diagram-core/vendor/archify/examples/holiday-planning.workflow.json create mode 100644 packages/diagram-core/vendor/archify/examples/incident-response.workflow.json create mode 100644 packages/diagram-core/vendor/archify/examples/lifecycle-agent-run.html create mode 100644 packages/diagram-core/vendor/archify/examples/locales/de.json create mode 100644 packages/diagram-core/vendor/archify/examples/locales/es.json create mode 100644 packages/diagram-core/vendor/archify/examples/locales/fr.json create mode 100644 packages/diagram-core/vendor/archify/examples/locales/fr.partial.json create mode 100644 packages/diagram-core/vendor/archify/examples/locales/it.json create mode 100644 packages/diagram-core/vendor/archify/examples/locales/ja.json create mode 100644 packages/diagram-core/vendor/archify/examples/locales/ko.json create mode 100644 packages/diagram-core/vendor/archify/examples/locales/pt.json create mode 100644 packages/diagram-core/vendor/archify/examples/locales/ru.json create mode 100644 packages/diagram-core/vendor/archify/examples/product-analytics.dataflow.json create mode 100644 packages/diagram-core/vendor/archify/examples/production-deployment.architecture.json create mode 100644 packages/diagram-core/vendor/archify/examples/release-delivery.workflow.json create mode 100644 packages/diagram-core/vendor/archify/examples/sequence-cache-miss-request.html create mode 100644 packages/diagram-core/vendor/archify/examples/web-app-rendered.html create mode 100644 packages/diagram-core/vendor/archify/examples/web-app.architecture.json create mode 100644 packages/diagram-core/vendor/archify/examples/workflow-agent-tool-call-rendered.html create mode 100644 packages/diagram-core/vendor/archify/references/architecture-layout-repair.md create mode 100644 packages/diagram-core/vendor/archify/references/authoring-defaults.md create mode 100644 packages/diagram-core/vendor/archify/references/repository-authoring.md create mode 100644 packages/diagram-core/vendor/archify/references/update-awareness.md create mode 100644 packages/diagram-core/vendor/archify/renderers/architecture/labels.mjs create mode 100644 packages/diagram-core/vendor/archify/renderers/architecture/routing.mjs create mode 100644 packages/diagram-core/vendor/archify/renderers/lifecycle/grid-routing.mjs create mode 100644 packages/diagram-core/vendor/archify/renderers/shared/atomic-output.mjs create mode 100644 packages/diagram-core/vendor/archify/renderers/shared/path-semantics.mjs create mode 100644 packages/diagram-core/vendor/archify/renderers/shared/portable-path.mjs create mode 100644 packages/diagram-core/vendor/archify/renderers/shared/route-quality.mjs create mode 100644 packages/diagram-core/vendor/archify/renderers/shared/sidecar-path.mjs create mode 100644 packages/diagram-core/vendor/archify/renderers/shared/spatial-grid.mjs delete mode 100644 packages/diagram-core/vendor/archify/scripts/generate-brand-marks.mjs delete mode 100644 packages/diagram-core/vendor/archify/scripts/generate-validators.mjs diff --git a/CHANGELOG.md b/CHANGELOG.md index 61aacf2..3253e16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ does not currently publish versioned releases. ## Unreleased +### Renderer upgrade + +- Upgrade `@topo/diagram-core` to the complete pristine Archify 3.0.0 release + ZIP at `9286c3b9c2cef359e98586b420d769d87bcb163f`, with all 104 runtime files + verified, metadata outside the vendor tree, and the previous integrity + baseline preserved. Builds and runtime remain download-free. +- Supply v3 output-path metadata at the adapter boundary without rewriting + authored stories. Preserve compatible Lifecycle v1 inputs and the 12px + effective-text requirement through final-font sizing and native route gaps. +- Retain upstream MIT, third-party and font notices unchanged; no vendor patch, + npm renderer dependency, license-policy expansion or upstream-suite completion + is implied. Refs #41. + ### Added - Add default source-grounded Repository exploration through pinned Archify: diff --git a/README.md b/README.md index fb8ac79..a7667e4 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ everything a human adds is recorded as such. > **Status: Local preview.** The scan-to-site workflow, deterministic reports, > source-grounded stories, static analysis modules, optional AI commentary, and -> pinned Archify rendering are implemented. Topo is the storybook for +> pinned Archify 3.0.0 rendering are implemented. Topo is the storybook for > architects: the generated shell inventories every diagram while preserving > real Archify viewers. This is not yet a published npm CLI. diff --git a/docs/product-spec.md b/docs/product-spec.md index b4da50f..a549c99 100644 --- a/docs/product-spec.md +++ b/docs/product-spec.md @@ -78,8 +78,9 @@ scanning and structural validation. - A renderer can be replaced or added behind the adapter without changing story documents. Adapter tests check output and failure behavior, not internal call order. **AC-15** -- The current renderer pin is Archify `2.17.0-dev.1` at exact revision - `d673e8300df60a5c8166abe78787fdc78f6b8000`. +- The current renderer pin is Archify `3.0.0` at exact revision + `9286c3b9c2cef359e98586b420d769d87bcb163f`. The owner selected a pristine + checked-in copy of the official release ZIP, with no build-time download. - The wrapper owns catalogue navigation, deep links, and restored node focus. Archify owns diagram geometry, theme, presentation, zoom, evidence details, and canonical SVG/PNG export. **CON-08, AC-19** @@ -136,9 +137,9 @@ for this work. These clauses are requirements, not waivers: | Original clause | Current state | Required end state | | --- | --- | --- | | **AC-10, NFR-02** | The shipped license gate uses scoped handling for embedded font notices. Its literal allowlist does not contain `OFL-1.1`. This is a specification reconciliation gap, not evidence of a license violation or missing notices. | Decide how the original narrow `OFL-1.1` allowlist wording maps to the scoped implementation. Do not silently broaden license policy. | -| **AC-16** | The runtime package integrity-checks the 62 files it ships. | Also preserve and verify the exact pristine upstream inventory of 214 files at `d673e8300df60a5c8166abe78787fdc78f6b8000`. Drift must fail loudly without rewriting the historical baseline. | +| **AC-16** | The owner-approved v3 release ZIP supplies all 104 runtime files, each integrity-checked; the former 62-file runtime manifest remains preserved unchanged. | The approved v3 distribution replaces the old pin/inventory target. Keep the exact pristine runtime and fail loudly on drift. This is not a claim that the former 214-file upstream-source requirement was retroactively delivered. | | **AC-17** | Topocode smoke and regression tests exercise the integrated renderer. | Run the real upstream test suite that accompanies the pristine pin in Node.js 22/Linux CI. Do not replace it with an empty gate or Topocode-only smoke tests. | -| **AC-18, CON-07** | Required license and notice material is shipped with the runtime subset. | Retain upstream `LICENSE`, `THIRD_PARTY_NOTICES.md`, brand attribution, and trademark disclaimer verbatim. Contribute changes upstream first. If blocked, use an explicit listed patch set over the pristine copy. Each patch records whether it is still needed or has landed upstream. Never make silent in-place edits. | +| **AC-18, CON-07** | The full official v3 runtime and required license/notice material are retained verbatim, with no vendor patches. | Retain upstream `LICENSE`, `THIRD_PARTY_NOTICES.md`, brand attribution, and trademark disclaimer verbatim. Contribute changes upstream first. If blocked, use an explicit listed patch set over the pristine copy. Each patch records whether it is still needed or has landed upstream. Never make silent in-place edits. | The vendored package is a swappable seam, not a goal to maintain a divergent fork. If upstream publishes a usable package, `@topo/diagram-core` may become a @@ -169,18 +170,18 @@ This table preserves the disposition of every numbered original requirement. | **FR-06; AC-11** | Partly shipped: bounded catalogue configuration. Broader composition/extensibility and the required manual walkthrough remain unresolved above. | | **FR-07; AC-12** | Workflow shipped; the required manual agent-authoring walkthrough remains unresolved above. | | **FR-08; AC-02** | Shipped objective anchor failures; no heuristic staleness gate. | -| **FR-09; AC-04** | Shipped package boundary and exact revision pin. Full-copy obligations remain below. | +| **FR-09; AC-04** | Shipped package boundary and exact revision pin. The approved v3 release runtime is complete; upstream-suite integration remains below. | | **NFR-01; AC-09** | Shipped notices in generated and bundled output. | | **NFR-02; AC-10** | Unresolved wording-to-implementation reconciliation in #41. | | **NFR-03; AC-03** | Same-environment repeat-render equivalence shipped; required cross-machine reproducibility remains unverified above. | | **NFR-05** | Historical POC sizes remain evidence, not budgets or current performance claims. | | **NFR-06** | No extra accessibility, security, privacy, reliability, or operability target was agreed. Existing safeguards still apply. | | **CON-01** | Maintained: building Topocode and a consumer's deployment pipeline are separate systems. | -| **CON-02** | Maintained: exact vendored pin behind `@topo/diagram-core`; full-copy work remains in #41. | +| **CON-02** | Maintained: exact pristine v3 release ZIP behind `@topo/diagram-core`; unresolved upstream-suite/license commitments remain in #41. | | **CON-03; AC-14** | Shipped CI baseline; **AC-17** remains unresolved in #41. | | **CON-04; U-3** | Superseded: PR #71 removed the WebGL explorer. #70 supplies the bounded source-grounded Archify replacement in the same shell. | | **CON-05, CON-06** | Maintained platform and evidence-preservation constraints. | -| **CON-07; AC-16, AC-18** | Unresolved pristine-copy and explicit-patch obligations in #41. | +| **CON-07; AC-16, AC-18** | Approved v3 pristine runtime and verbatim notices shipped; historical baselines retained. Upstream-first and explicit-patch policy remains mandatory. | | **CON-08; AC-19** | Shipped wrapper-side links and focus restoration. | Other source clauses remain bounded as follows: dirty-tree behavior must keep diff --git a/docs/renderer.md b/docs/renderer.md index bd786de..ed75c39 100644 --- a/docs/renderer.md +++ b/docs/renderer.md @@ -1,7 +1,7 @@ # Rendering boundary Topo renders committed diagram stories through the pinned, integrity-checked -Archify runtime in `@topo/diagram-core`. Authored `.topo.json` documents remain +Archify 3.0.0 runtime in `@topo/diagram-core`. Authored `.topo.json` documents remain renderer-neutral; source anchors resolve before rendering, and failures do not publish partial output. @@ -12,6 +12,42 @@ theme, presentation, zoom, source/evidence details, and canonical SVG/PNG exports. The shell owns navigation, grouping, filtering, Git-backed sorting, responsive containment, and deep-link coordination around that iframe. +## Pinned distribution and upgrades + +The checked-in `packages/diagram-core/vendor/archify/` directory is the complete, +unmodified 104-file runtime from the official +[v3.0.0 release ZIP](https://github.com/tt-a1i/archify/releases/tag/v3.0.0), +at commit `9286c3b9c2cef359e98586b420d769d87bcb163f`. +`archify-pin.json` records its source and archive SHA-256; +`archify-integrity.json` verifies every path and file. Metadata stays outside +the upstream tree. Build and rendering require no runtime download or npm +package named `archify`. + +The prior 2.17.0-dev.1 runtime manifest is preserved unchanged under +`packages/diagram-core/integrity/`. A future upgrade needs its own reviewed +pin and inventory, not an integrity-baseline rewrite to bless local edits. +Keep upstream licenses, font notices, brand attribution and trademark +disclaimers verbatim. Proposed renderer changes go upstream first; any approved +local patch must be separately listed with its upstream status. This pin has +no vendor patches. + +The v3 adapter adds portable `meta.output` only to its generated renderer input; +authored Topocode stories retain their identity and schema. Lifecycle remains +on the compatible native v1 geometry: state widths and column clearance account +for final typography, preserving Topocode's 12px effective text requirement. +The v3 viewer's own guided/story-view and ordinary share-card removal does not +remove Topocode's authored-story catalogue or canonical SVG/PNG exports. + +Native `deliver` provenance receipts describe the raw native artifact. Topocode +then applies adapter typography/narrative changes and, for repository views, +shared-asset packaging. Those bytes must not be presented as the original +native artifact's hash or as a successful upstream `finalize` result. +Topocode validates its delivered behavior through the existing CLI/browser +regressions. The public release ZIP intentionally omits the upstream test +suite; integrating that suite remains separate work in #41. + +## Generated repository views + The default Repository canvas uses bounded generated Architecture views at `/repository//viewer.html` through the same package boundary. Its wrapper owns scanner/source evidence and navigation, including explicit dirty, diff --git a/docs/story-preview.md b/docs/story-preview.md index cf197f1..68ab17b 100644 --- a/docs/story-preview.md +++ b/docs/story-preview.md @@ -20,6 +20,9 @@ cannot satisfy the renderer's legible minimum still fails explicitly. Lifecycle state widths are derived from their authored titles, then all states are placed together within their semantic native lanes so a wide state cannot silently reuse a neighboring state's column. +The Archify 3.0.0 adapter retains native Lifecycle schema v1; it reserves the +native minimum route gap and sizes states for final 14.5px typography so the +adaptive viewer still meets Topocode's 12px effective on-screen text floor. The optional `classification` is `source-grounded` or `capability-demo`; omission retains the source-grounded behavior. Every source-grounded section diff --git a/packages/cli/src/story-preview.test.ts b/packages/cli/src/story-preview.test.ts index 984f585..b08eb23 100644 --- a/packages/cli/src/story-preview.test.ts +++ b/packages/cli/src/story-preview.test.ts @@ -401,7 +401,7 @@ describe("story preview", () => { const secondContents = await readFile(second.outputPath, "utf8"); expect(secondContents).toBe(firstContents); - expect(first.renderer).toEqual({ name: "archify", pin: "2.17.0-dev.1" }); + expect(first.renderer).toEqual({ name: "archify", pin: "3.0.0" }); expect(firstContents).toContain(" { const last = index === story.document.sections.length - 1; @@ -1246,7 +1248,7 @@ function lifecycleSpec(story: ResolvedStoryDocument): ArchifyLifecycle { (total, character) => total + (character.codePointAt(0)! > 0xff ? 2 : 1), 0, - ) * 6.2), + ) * lifecycleFontSize * 0.5 + 28), ), }; }); @@ -1281,7 +1283,7 @@ function lifecycleSpec(story: ResolvedStoryDocument): ArchifyLifecycle { const overlaps = drafts.slice(0, position).some((other, otherIndex) => { const otherCenter = centers[cols[otherIndex]!]!; const otherRight = otherCenter + other.width / 2; - return left - otherRight < 10; + return left - otherRight < 32; }); if (overlaps) continue; search( @@ -1384,6 +1386,13 @@ function commandError(error: unknown): Error { : new Error(`Archify rendering failed: ${String(error)}`); } +function serializeRendererInput(spec: { readonly meta: object }): string { + return `${JSON.stringify({ + ...spec, + meta: { ...spec.meta, output: "story.html" }, + }, null, 2)}\n`; +} + function improveStoryReadability( contents: string, family: @@ -1439,7 +1448,7 @@ svg text[data-node-label], svg text[font-size="10"][font-weight="600"], svg g[data-edge-from] > text { font-family: ui-sans-serif, system-ui, sans-serif; - font-size: 13px; + font-size: ${lifecycleFontSize}px; }`; const style = ``; @@ -1522,7 +1531,7 @@ export function* renderArchitectureStoryBatch( } const input = path.join(directory, `${index}.json`); const output = path.join(directory, `${index}.html`); - writeFileSync(input, JSON.stringify(archifySpec(story, options.sourceEvidence !== "wrapper"))); + writeFileSync(input, serializeRendererInput(archifySpec(story, options.sourceEvidence !== "wrapper"))); return { input, output, repository: story.repositoryRoot }; }); const manifest = path.join(directory, "batch.json"); @@ -1578,7 +1587,7 @@ export function renderStory(story: ResolvedStoryDocument): StoryArtifact { const inputPath = path.join(temporaryDirectory, "story.json"); const outputPath = path.join(temporaryDirectory, "story.html"); try { - writeFileSync(inputPath, `${JSON.stringify(spec, null, 2)}\n`); + writeFileSync(inputPath, serializeRendererInput(spec)); const args = [ archifyCli, "deliver", diff --git a/packages/diagram-core/src/integrity.ts b/packages/diagram-core/src/integrity.ts index 0922d77..e12a1a7 100644 --- a/packages/diagram-core/src/integrity.ts +++ b/packages/diagram-core/src/integrity.ts @@ -57,7 +57,7 @@ function readManifest(rootDirectory: string): IntegrityManifest { } function readPin(rootDirectory: string): ArchifyPin { - const pinPath = path.join(rootDirectory, "vendor", "archify", "PIN.json"); + const pinPath = path.join(rootDirectory, "archify-pin.json"); const parsed: unknown = JSON.parse(readFileSync(pinPath, "utf8")); if ( typeof parsed !== "object" || @@ -65,12 +65,11 @@ function readPin(rootDirectory: string): ArchifyPin { !("repo" in parsed) || parsed.repo !== "github.com/tt-a1i/archify" || !("revision" in parsed) || - parsed.revision !== "d673e8300df60a5c8166abe78787fdc78f6b8000" || + parsed.revision !== "9286c3b9c2cef359e98586b420d769d87bcb163f" || !("version" in parsed) || - parsed.version !== "2.17.0-dev.1" || + parsed.version !== "3.0.0" || !("archiveSha256" in parsed) || - typeof parsed.archiveSha256 !== "string" || - !SHA256.test(parsed.archiveSha256) + parsed.archiveSha256 !== "e30f65ddab8bbb0c467fa4be5bccf7e3853bd3ee86e8338f31e102037496be18" ) { throw new Error(`Invalid vendored Archify pin: ${pinPath}`); } @@ -87,6 +86,9 @@ function vendoredFiles(directory: string, rootDirectory: string): string[] { .sort((left, right) => left.name.localeCompare(right.name)) .flatMap((entry) => { const candidate = path.join(directory, entry.name); + if (!entry.isFile() && !entry.isDirectory()) { + throw new Error(`Vendored Archify integrity failure: unsupported file type at ${candidate}`); + } return entry.isDirectory() ? vendoredFiles(candidate, rootDirectory) : [path.relative(rootDirectory, candidate).split(path.sep).join("/")]; diff --git a/packages/diagram-core/test/diagram-core.test.mjs b/packages/diagram-core/test/diagram-core.test.mjs index 4b9a4be..6d0cdbc 100644 --- a/packages/diagram-core/test/diagram-core.test.mjs +++ b/packages/diagram-core/test/diagram-core.test.mjs @@ -5,6 +5,7 @@ import { mkdtemp, readFile, rm, + symlink, writeFile, } from "node:fs/promises"; import { tmpdir } from "node:os"; @@ -25,11 +26,13 @@ const execute = promisify(execFile); test("accepts the committed integrity baseline", () => { const integrity = verifyVendoredArchifyIntegrity(); - assert.equal(integrity.files, 62); + assert.equal(integrity.files, 104); assert.equal( integrity.revision, - "d673e8300df60a5c8166abe78787fdc78f6b8000", + "9286c3b9c2cef359e98586b420d769d87bcb163f", ); + assert.equal(integrity.version, "3.0.0"); + assert.equal(integrity.archiveSha256, "e30f65ddab8bbb0c467fa4be5bccf7e3853bd3ee86e8338f31e102037496be18"); }); test("renders a resolved story through the vendored Archify CLI", async (context) => { @@ -120,7 +123,7 @@ test("renders a resolved story through the vendored Archify CLI", async (context assert.match(artifact.contents, /Checkout service/); } assert.equal(first.renderer.name, "archify"); - assert.equal(first.renderer.pin, "2.17.0-dev.1"); + assert.equal(first.renderer.pin, "3.0.0"); assert.match(first.contents, / { path.join(packageRoot, "archify-integrity.json"), path.join(temporaryRoot, "archify-integrity.json"), ); + await cp( + path.join(packageRoot, "archify-pin.json"), + path.join(temporaryRoot, "archify-pin.json"), + ); await writeFile( path.join(temporaryRoot, "vendor", "archify", "LICENSE"), `${await readFile(path.join(packageRoot, "vendor", "archify", "LICENSE"), "utf8")}\ntampered\n`, @@ -191,3 +198,23 @@ test("rejects a tampered vendored Archify file", async (context) => { /integrity failure/, ); }); + +test("rejects inventory drift and symbolic links without rewriting the pin", async (context) => { + const root = await mkdtemp(path.join(tmpdir(), "topo-archify-inventory-")); + context.after(() => rm(root, { recursive: true, force: true })); + await cp(path.join(packageRoot, "vendor"), path.join(root, "vendor"), { recursive: true }); + for (const file of ["archify-pin.json", "archify-integrity.json"]) { + await cp(path.join(packageRoot, file), path.join(root, file)); + } + const baseline = await readFile(path.join(root, "archify-integrity.json"), "utf8"); + const extra = path.join(root, "vendor/archify/unexpected.txt"); + await writeFile(extra, "unexpected"); + assert.throws(() => verifyVendoredArchifyIntegrity(root), /file inventory differs/); + await rm(extra); + const license = path.join(root, "vendor/archify/LICENSE"); + await rm(license); + assert.throws(() => verifyVendoredArchifyIntegrity(root), /file inventory differs/); + await symlink(path.join(packageRoot, "vendor/archify/LICENSE"), license); + assert.throws(() => verifyVendoredArchifyIntegrity(root), /unsupported file type/); + assert.equal(await readFile(path.join(root, "archify-integrity.json"), "utf8"), baseline); +}); diff --git a/packages/diagram-core/vendor/archify/PIN.json b/packages/diagram-core/vendor/archify/PIN.json deleted file mode 100644 index 0c59cf5..0000000 --- a/packages/diagram-core/vendor/archify/PIN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "repo": "github.com/tt-a1i/archify", - "revision": "d673e8300df60a5c8166abe78787fdc78f6b8000", - "version": "2.17.0-dev.1", - "archiveSha256": "fc146338124af255e61373e5837bf9e4705d7256a47e0ce446453ebbe1a4d933" -} diff --git a/packages/diagram-core/vendor/archify/SKILL.md b/packages/diagram-core/vendor/archify/SKILL.md new file mode 100644 index 0000000..e831e97 --- /dev/null +++ b/packages/diagram-core/vendor/archify/SKILL.md @@ -0,0 +1,110 @@ +--- +name: archify +description: Create polished, validated architecture, workflow, sequence, data-flow, and lifecycle/state diagrams as explorable standalone HTML with inline SVG, dark/light themes, optional trace motion, and PNG/JPEG/WebP/SVG/WebM export. Accept plain-language requirements or pasted Mermaid flowchart, sequenceDiagram, and stateDiagram input; inspect repository evidence when the diagram must reflect real code. Use when the user asks to visualize system architecture, infrastructure, cloud/security/network topology, technical workflows, API call sequences, request lifecycles, data pipelines, ETL/ELT, data lineage, state machines, or to convert/beautify Mermaid. +license: MIT +metadata: + version: "3.0" + author: tt-a1i + based_on: Cocoon-AI/architecture-diagram-generator (MIT, v1.0) +--- + +# Archify + +Create an interactive HTML diagram from typed JSON. Static output is the default; enable motion only when requested. + +Run commands from your working directory. Unless the user names another location, give each new diagram request its own folder `.archify/--/` there (local time, chosen once when the request starts): keep `candidate.json` and `.html` in it, set `meta.output` to that relative HTML path, and reuse the folder for every repair rerun. A later request gets a new folder, so earlier versions stay intact. Replace `bin/archify.mjs` in the commands below with the installed package's absolute path, or its path relative to your working directory; input and output paths resolve from that working directory. + +For a real codebase, read [Repository authoring](references/repository-authoring.md) while tracing the requested behavior. A system description uses the steps below; an existing JSON uses the handoff path. + +## Existing candidate handoff + +When the user supplies a frozen candidate, run `finalize` first as one CLI invocation. Its passing receipt completes the automated gates; follow any visual review recommendation under Delivery before claiming visual quality. For repair, follow step 5. + +The optional update check never delays `finalize`; see Update awareness. + +## Fast authoring path + +Use this path for ordinary generation. Read branch references only when their stated trigger applies. + +1. Choose `architecture`, `workflow`, `sequence`, `dataflow`, or `lifecycle` from the question. +2. Use the exact schema and example paths in the Type router without listing their directories. Read [Authoring defaults](references/authoring-defaults.md) and the mode's example in a bounded batch separate from project documents and complete schemas so neither is truncated; recover any missing section before writing. For Architecture, use the matching showcase example. For Sequence, Dataflow, and Lifecycle, also read the mode and common schemas. Read the relevant schema definition before choosing any new field, enum, or constrained text, especially boundary kinds. Examples teach shape, not facts. Use fresh IDs, wording, and layout. Go directly to the candidate without preliminary help, doctor, starter validation, temporary diagrams, or output-path listing. Query brands only for an explicitly requested mark; read [Brand marks](references/brand-marks.md) for an unknown mark with a user-provided URL. +3. Once the requested scope and, for a real codebase, [source evidence](references/repository-authoring.md) are covered, write the complete candidate directly without planning coordinates in prose. Choose Architecture abstraction and connected placement using Authoring defaults before coordinates: show the main user journey and necessary branches, preserve control roles and behavior-changing conditions, and leave enough room for actual relationship labels. No node, relationship, source, view, card, or boundary count is a target or ceiling. Use automatic routes first; add explicit routing only for necessary branch, return, supplied geometry, or measured repair. Set `meta.quality_profile` to `"showcase"` unless the user requests dense `standard`. +4. Once the complete first candidate is written, run `finalize` directly. Its first gate is showcase validation; successful first drafts need no separate pre-validation. Keep the candidate unchanged while the command runs: + + ```bash + node bin/archify.mjs finalize --quality showcase --json + ``` + + For a repository-backed candidate, include evidence on the first draft and use the complete first command: `node bin/archify.mjs finalize --repo-root --quality showcase --json`. + + A passing receipt proves the included `validate`, `deliver`, strict `check`, and real-browser `browser-check` gates passed. Use its compact summary; run standalone commands only for a separate request or focused failure diagnosis. + +5. A non-zero exit is never success. Read compact stdout or `evidence.summaryReceipt`, then [repair the failed gate](references/delivery-contract.md#failed-finalize-and-candidate-repair), including its repair limit. Preserve requested meaning and source evidence. For several tangled Architecture routes, read [Architecture layout repair](references/architecture-layout-repair.md); for measured field or geometry failures, read [Authoring contract](references/authoring-contract.md). Edit the connected neighborhood and rerun the complete `finalize` command from step 4. + +## Update awareness + +After the first candidate exists, a harness with true parallel tool calls may run `scripts/check-update.mjs` once alongside `finalize`. Otherwise skip it without delaying delivery. + +- For `silent`, continue without mentioning the update check. +- For `update_available`, read `references/update-awareness.md`, follow it, then continue the requested task. + +Before the first candidate, use the authoring references and relevant repository source, not Archify implementation or tests. Inspect Archify implementation if diagnostics remain unactionable after focused repairs. + +## Type router + +| Type | Use for | Schema | Example | +|---|---|---|---| +| `architecture` | Components, services, cloud/security boundaries, infrastructure | `schemas/architecture.schema.json` | System descriptions, services, libraries, and CLI repos: `examples/web-app.architecture.json`; deployment repos: `examples/production-deployment.architecture.json` | +| `workflow` | Processes, approval gates, tool calls, runbooks, CI/CD | `schemas/workflow.schema.json` | `examples/agent-tool-call.workflow.json` | +| `sequence` | API call chains, request lifecycles, async traces, returns | `schemas/sequence.schema.json` | `examples/cache-miss-request.sequence.json` | +| `dataflow` | Pipelines, ETL/ELT, lineage, governance, consumers | `schemas/dataflow.schema.json` | `examples/product-analytics.dataflow.json` | +| `lifecycle` | State/status transitions, retries, waiting and terminal states | `schemas/lifecycle.schema.json` | `examples/deployment-release.lifecycle.json` | + +When ambiguous, run `node bin/archify.mjs guide "" --json`. Scenario proof examples are structural references, not facts to copy. + +## Mermaid input + +Read Mermaid for topology and meaning, then author fresh Archify JSON; do not mechanically render Mermaid styling. + +- `flowchart` / `graph` → `workflow`, or `architecture` for a component map. +- `sequenceDiagram` → `sequence`; participants become semantic participants and arrows become messages. +- `stateDiagram` → `lifecycle`; states and transitions retain meaning, not Mermaid style. + +## Delivery + +Use the `finalize` command above for the first candidate and after a repair. + +`finalize` stops at the first non-passing gate. Its compact stdout and `.finalize-summary.json` are ordinary evidence. A passing run creates no screenshots and reports `visualReview: "not-requested"`. + +When a passing Architecture receipt reports `visualReviewRecommendation.signals.resolvedCrossovers`, copy the candidate aside and apply the hints in one edit that changes only node positions and sizes: every node, relationship (including its `from` and `to`), label, and source stays as it was. Rerun the complete `finalize` once with `--out-dir /review-2`, because the previous HTML already owns its browser evidence. If that run fails or reports more crossings, restore the copy and finalize it with `--out-dir /review-3`. Do not start a second placement round. Hints about extra bends alone are optional. + +When `layoutReviewRecommendation.action` is `inspect-sequence-width`, follow [Sequence width review](references/delivery-contract.md#sequence-width-review) before handing off a newly authored Sequence. + +Perceptual review is optional for ordinary generation, including a newly positioned Architecture. Use [Optional capture evidence](references/delivery-contract.md#optional-capture-evidence), with `--out-dir /visual-check`, when the user requests visual review, during development audits, or for a concrete route/browser concern. `visualReviewRecommendation` is advisory. Inspect captures before claiming visual quality; otherwise report automated checks only. + +Read [Delivery contract](references/delivery-contract.md) for failed gates, standalone commands, provenance/recovery, repeated delivery, exports, or opening. Recovery follows `deliver` → strict provenance `check` → `browser-check`; captures require strict provenance. + +For workflow viewport overflow, read [Workflow viewport repair](references/authoring-contract.md#workflow-viewport-repair) before the next layout edit. + +Report artifact checks, browser evidence, captures, and actual perceptual review as distinct results. For an explicitly requested immediate preview or active desktop loop, see [Optional opening](references/delivery-contract.md#optional-opening). + +## Optional viewer capabilities + +`meta.animation: "trace"` is opt-in. + +Read `references/viewer-runtime.md` only when the user explicitly asks for Share Cards, Route/Reach cards, motion, deep links, presentation, search/focus, or another Viewer Runtime feature. + +## Setup and fallback + +No install is required inside the skill package. For setup diagnosis, verify with: + +```bash +node bin/archify.mjs doctor +node bin/archify.mjs demo +``` + +When shell access is unavailable, hand-place architecture SVG into `assets/template.html`, use CSS semantic classes rather than inline colors, and follow the visual review contract in `references/delivery-contract.md`. + +## Output + +Return the checked HTML as an absolute path, diagram type, validation summary, specification/artifact receipt, browser-evidence status, and truthful visual-review status. Do not claim success for a non-zero command or claim visual inspection you did not perform. diff --git a/packages/diagram-core/vendor/archify/assets/template.html b/packages/diagram-core/vendor/archify/assets/template.html index 2bf7157..4de631e 100644 --- a/packages/diagram-core/vendor/archify/assets/template.html +++ b/packages/diagram-core/vendor/archify/assets/template.html @@ -3,7 +3,8 @@ - + + [PROJECT NAME] Architecture Diagram + + + + + + + +
+ +
+
+
+

Product Analytics Data Flow

+
+
+ + + + +
+ + Product Analytics Data Flow + A data-flow diagram generated by Archify. + + + + + + + + + + + + + + + + + + + + + + + + + 01 / Sources + + + 02 / Ingest + + + 03 / Process + + + 04 / Store + + + 05 / Consume + + + + + + + + + + + + + + + + Web App · browser SDK · 01 / Sources · events + + + + Web App + browser SDK + events + + + + Mobile · iOS / Android · 01 / Sources · events + + + + Mobile + iOS / Android + events + + + + Edge API · collector · 02 / Ingest · TLS + + + + Edge API + collector + TLS + + + + Consent Gate · policy filter · 03 / Process · PII guard + + + + Consent Gate + policy filter + PII guard + + + + Event Stream · Kafka topic · 03 / Process · ordered + + + + Event Stream + Kafka topic + ordered + + + + PII Vault · encrypted · 04 / Store · restricted + + + + PII Vault + encrypted + restricted + + + + Warehouse · analytics tables · 04 / Store · curated + + + + Warehouse + analytics tables + curated + + + + Feature Store · daily batch · 04 / Store · derived + + + + Feature Store + daily batch + derived + + + + Dashboards · product metrics · 05 / Consume · SQL + + + + Dashboards + product metrics + SQL + + + + ML Model · ranking job · 05 / Consume · features + + + + ML Model + ranking job + features + + + + + + clickstream + user events + + + + app events + device events + + + + identity + consent + PII touch + + + + accepted events + append-only + + + + identity map + encrypted PII + + + + normalized facts + non-PII + + + + daily aggregates + batch + + + + metrics SQL + read-only + + + + feature vectors + derived + + + + restricted join + approved only + + + + + Legend + + + primary data + + + + policy / PII + + + + async batch + + + + data store + + + + data flow + + + +

+ + + + + + + + + +
+ + + +
+ + + + diff --git a/packages/diagram-core/vendor/archify/examples/deployment-release.lifecycle.json b/packages/diagram-core/vendor/archify/examples/deployment-release.lifecycle.json new file mode 100644 index 0000000..2967524 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/deployment-release.lifecycle.json @@ -0,0 +1,48 @@ +{ + "schema_version": 2, + "diagram_type": "lifecycle", + "meta": { + "title": "Deployment Release Lifecycle", + "output": "examples/deployment-release.html", + "animation": "trace", + "visual_preset": "signal-flow", + "quality_profile": "showcase" + }, + "lanes": [ + { "id": "main", "label": "Release phases" }, + { "id": "waiting", "label": "Approval + health wait" }, + { "id": "recovery", "label": "Rollback controller" }, + { "id": "terminal", "label": "Terminal exits" } + ], + "states": [ + { "id": "queued", "type": "start", "label": "Queued", "sublabel": "change accepted", "lane": "main", "col": 0, "step": "01", "tag": "pending" }, + { "id": "building", "type": "active", "label": "Building", "sublabel": "immutable image", "lane": "main", "col": 1, "step": "02", "tag": "running" }, + { "id": "verifying", "type": "decision", "label": "Verifying", "sublabel": "tests + policy", "lane": "main", "col": 2, "step": "03", "tag": "gate" }, + { "id": "ready", "type": "waiting", "label": "Ready", "sublabel": "promotion pending", "lane": "main", "col": 3, "step": "04", "tag": "approved" }, + { "id": "live", "type": "success", "label": "Live", "sublabel": "production healthy", "lane": "main", "col": 4, "step": "05", "tag": "success" }, + { "id": "approval", "type": "waiting", "label": "Needs Approval", "sublabel": "release owner", "lane": "waiting", "col": 2, "tag": "pause" }, + { "id": "rollback", "type": "active", "label": "Rolling Back", "sublabel": "last good image", "lane": "recovery", "col": 3, "tag": "automatic" }, + { "id": "paused", "type": "waiting", "label": "Health Paused", "sublabel": "SLO regression", "lane": "waiting", "col": 4, "tag": "observe" }, + { "id": "cancelled", "type": "failure", "label": "Cancelled", "sublabel": "approval denied", "lane": "terminal", "col": 2, "tag": "terminal" }, + { "id": "failed", "type": "failure", "label": "Failed", "sublabel": "rollback failed", "lane": "terminal", "col": 3, "tag": "terminal" }, + { "id": "rolled_back", "type": "success", "label": "Rolled Back", "sublabel": "service restored", "lane": "terminal", "col": 4, "tag": "terminal" } + ], + "transitions": [ + { "from": "queued", "to": "building" }, + { "from": "building", "to": "verifying" }, + { "from": "verifying", "to": "ready" }, + { "from": "ready", "to": "live" }, + { "from": "verifying", "to": "approval", "variant": "security", "label": "needs sign-off" }, + { "from": "approval", "to": "ready", "label": "approved" }, + { "from": "approval", "to": "cancelled", "variant": "security" }, + { "from": "ready", "to": "rollback", "variant": "security" }, + { "from": "rollback", "to": "failed", "variant": "security" }, + { "from": "live", "to": "paused", "variant": "dashed" }, + { "from": "paused", "to": "rolled_back", "variant": "emphasis" } + ], + "cards": [ + { "dot": "cyan", "title": "Promotion Rail", "items": ["The release object moves through five ordered phases", "Verification and approval remain distinct states", "Live means production health is currently proven"] }, + { "dot": "amber", "title": "Wait States", "items": ["Human approval can pause without consuming a worker", "A health regression pauses further rollout", "Every wait exposes the event required to continue"] }, + { "dot": "rose", "title": "Explicit Endings", "items": ["Denied approval ends as Cancelled", "Rollback controller failure ends as Failed", "Successful rollback is a terminal restored outcome"] } + ] +} diff --git a/packages/diagram-core/vendor/archify/examples/event-stream.dataflow.json b/packages/diagram-core/vendor/archify/examples/event-stream.dataflow.json new file mode 100644 index 0000000..3f653da --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/event-stream.dataflow.json @@ -0,0 +1,52 @@ +{ + "schema_version": 1, + "diagram_type": "dataflow", + "meta": { + "title": "Order Event-stream Topology", + "output": "examples/event-stream.html", + "viewBox": [1080, 780], + "animation": "trace", + "visual_preset": "signal-flow", + "quality_profile": "showcase" + }, + "stages": [ + { "label": "Producers" }, + { "label": "Transit" }, + { "label": "Processors" }, + { "label": "State + recovery" }, + { "label": "Consumers" } + ], + "nodes": [ + { "id": "checkout", "type": "frontend", "label": "Checkout API", "sublabel": "order producer", "stage": 0, "row": 0, "tag": "team commerce" }, + { "id": "billing", "type": "backend", "label": "Billing API", "sublabel": "payment producer", "stage": 0, "row": 2, "tag": "team money" }, + { "id": "orders", "type": "messagebus", "label": "orders.v1", "sublabel": "12 partitions", "stage": 1, "row": 0, "tag": "key: order_id" }, + { "id": "payments", "type": "messagebus", "label": "payments.v2", "sublabel": "8 partitions", "stage": 1, "row": 2, "tag": "key: order_id" }, + { "id": "validate", "type": "backend", "label": "Order Validate", "sublabel": "group fulfillment", "stage": 2, "row": 0, "tag": "ordered" }, + { "id": "enrich", "type": "backend", "label": "Payment Enrich", "sublabel": "group analytics", "stage": 2, "row": 2, "tag": "at-least-once" }, + { "id": "state", "type": "database", "label": "Order State", "sublabel": "materialized view", "stage": 3, "row": 1, "tag": "idempotent" }, + { "id": "dlq", "type": "messagebus", "label": "events.dlq", "sublabel": "poison events", "stage": 3, "row": 4, "tag": "7-day retention" }, + { "id": "fulfillment", "type": "backend", "label": "Fulfillment", "sublabel": "shipping workflow", "stage": 4, "row": 0, "tag": "consumer" }, + { "id": "analytics", "type": "database", "label": "Analytics", "sublabel": "streaming facts", "stage": 4, "row": 2, "tag": "consumer" }, + { "id": "replay", "type": "security", "label": "Replay Tool", "sublabel": "approved batch", "stage": 4, "row": 4, "tag": "operator gate" }, + { "id": "ops", "type": "external", "label": "On-call", "sublabel": "DLQ owner", "stage": 4, "row": 3, "yOffset": -18, "tag": "SRE" } + ], + "flows": [ + { "from": "checkout", "to": "orders", "label": "OrderPlaced", "classification": "schema v1", "variant": "emphasis", "route": "straight" }, + { "from": "billing", "to": "payments", "label": "PaymentCaptured", "classification": "schema v2", "variant": "emphasis", "route": "straight" }, + { "from": "orders", "to": "validate", "label": "ordered orders", "classification": "consumer group", "variant": "emphasis", "route": "straight" }, + { "from": "payments", "to": "enrich", "label": "payment facts", "classification": "at-least-once", "variant": "emphasis", "route": "straight" }, + { "from": "validate", "to": "state", "label": "valid order", "classification": "idempotent", "variant": "emphasis", "route": "vertical-channel" }, + { "from": "enrich", "to": "state", "label": "enriched payment", "classification": "idempotent", "variant": "default", "route": "vertical-channel" }, + { "from": "state", "to": "fulfillment", "label": "ready orders", "classification": "read model", "variant": "emphasis", "route": "vertical-channel" }, + { "from": "state", "to": "analytics", "label": "order facts", "classification": "non-PII", "variant": "default", "route": "vertical-channel" }, + { "from": "validate", "to": "dlq", "label": "invalid event", "classification": "dead letter", "variant": "security", "fromSide": "top", "toSide": "top", "via": [[530, 80], [20, 80], [20, 550], [745, 550]], "labelAt": [300, 550] }, + { "from": "enrich", "to": "dlq", "label": "poison event", "classification": "dead letter", "variant": "security", "route": "bottom-channel", "labelDy": 30 }, + { "from": "dlq", "to": "ops", "label": "failure sample", "classification": "restricted", "variant": "security", "route": "vertical-channel" }, + { "from": "dlq", "to": "replay", "label": "approved replay", "classification": "audited batch", "variant": "dashed", "route": "straight", "labelDy": 30 } + ], + "cards": [ + { "dot": "amber", "title": "Transit Contract", "items": ["Every event and topic is named", "Partition keys preserve per-order ordering", "Consumer groups expose processing ownership"] }, + { "dot": "emerald", "title": "State + Delivery", "items": ["Processors write an idempotent materialized view", "Fulfillment and analytics consume distinct assets", "At-least-once delivery never implies duplicate business effects"] }, + { "dot": "rose", "title": "Failure Ownership", "items": ["Poison events land in a retained dead-letter topic", "On-call inspects samples before replay", "Replay is gated, batched, and auditable"] } + ] +} diff --git a/packages/diagram-core/vendor/archify/examples/holiday-planning.workflow.json b/packages/diagram-core/vendor/archify/examples/holiday-planning.workflow.json new file mode 100644 index 0000000..60dd641 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/holiday-planning.workflow.json @@ -0,0 +1,143 @@ +{ + "schema_version": 2, + "diagram_type": "workflow", + "meta": { + "title": "2026年剩余假期安排", + "locale": "zh-CN", + "quality_profile": "showcase", + "legend": { + "entries": { + "backend": { + "label": "假期" + }, + "security": { + "label": "补班" + }, + "external": { + "label": "时间节点" + } + } + }, + "output": "holiday-planning.html" + }, + "lanes": [ + { + "id": "calendar", + "label": "时间线" + }, + { + "id": "makeup", + "label": "调休" + } + ], + "mainPath": [ + "today", + "mid_autumn", + "national_day", + "year_end" + ], + "nodes": [ + { + "id": "today", + "lane": "calendar", + "col": 0, + "type": "external", + "label": "今天 9月22日", + "sublabel": "周二 · 距中秋3天", + "icon": "clock" + }, + { + "id": "mid_autumn", + "lane": "calendar", + "col": 1, + "type": "backend", + "label": "中秋节", + "sublabel": "9月25日–27日 · 3天", + "tag": "无需调休", + "icon": "moon" + }, + { + "id": "national_day", + "lane": "calendar", + "col": 3, + "type": "backend", + "label": "国庆节", + "sublabel": "10月1日–7日 · 7天", + "tag": "连休", + "icon": "calendar" + }, + { + "id": "year_end", + "lane": "calendar", + "col": 5, + "type": "external", + "label": "此后至年底", + "sublabel": "无法定节假日", + "icon": "flag" + }, + { + "id": "makeup_work", + "lane": "makeup", + "col": 3, + "type": "security", + "label": "调休上班", + "sublabel": "10月10日(周六)", + "tag": "补班", + "icon": "briefcase" + } + ], + "edges": [ + { + "id": "to_mid_autumn", + "from": "today", + "to": "mid_autumn", + "label": "3天后连休" + }, + { + "id": "mid_to_national", + "from": "mid_autumn", + "to": "national_day", + "label": "节后上班3天" + }, + { + "id": "to_year_end", + "from": "national_day", + "to": "year_end", + "label": "假期结束" + }, + { + "id": "makeup_branch", + "from": "national_day", + "to": "makeup_work", + "label": "国庆调休", + "role": "branch", + "variant": "security" + } + ], + "cards": [ + { + "dot": "emerald", + "title": "中秋节", + "items": [ + "9月25日(周五)至27日(周日)放假,共3天", + "与周末自然相连,无需额外调休上班" + ] + }, + { + "dot": "amber", + "title": "国庆节", + "items": [ + "10月1日(周四)至7日(周三)放假调休,共7天", + "9月20日(周日)上班日已过", + "10月10日(周六)需补班" + ] + }, + { + "dot": "slate", + "title": "年底前", + "items": [ + "国庆假期结束后,到2026年底不再有法定节假日安排" + ] + } + ] +} diff --git a/packages/diagram-core/vendor/archify/examples/incident-response.workflow.json b/packages/diagram-core/vendor/archify/examples/incident-response.workflow.json new file mode 100644 index 0000000..dac074f --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/incident-response.workflow.json @@ -0,0 +1,59 @@ +{ + "schema_version": 1, + "diagram_type": "workflow", + "meta": { + "title": "Incident Response Runbook", + "output": "examples/incident-response.html", + "animation": "trace", + "visual_preset": "signal-flow", + "quality_profile": "showcase" + }, + "lanes": [ + { "id": "signals", "label": "Signals" }, + { "id": "responders", "label": "Incident Command" }, + { "id": "mitigation", "label": "Service Mitigation" }, + { "id": "recovery", "label": "Recovery Evidence" }, + { "id": "communication", "label": "Stakeholder Communication" }, + { "id": "exceptions", "label": "Escalation + Rollback", "variant": "exception" } + ], + "phases": [ + { "id": "detect", "label": "Detect", "fromCol": 0, "toCol": 1 }, + { "id": "respond", "label": "Triage + mitigate", "fromCol": 2, "toCol": 3, "variant": "emphasis" }, + { "id": "recover", "label": "Verify + close", "fromCol": 4, "toCol": 5, "variant": "dashed" } + ], + "groups": [ + { "id": "command", "label": "Incident command", "lane": "responders", "fromCol": 1, "toCol": 3, "variant": "emphasis" }, + { "id": "exception_actions", "label": "If impact persists", "lane": "exceptions", "fromCol": 3, "toCol": 5, "variant": "security" } + ], + "mainPath": ["alert", "page", "triage", "contain", "recover", "verify", "close"], + "nodes": [ + { "id": "alert", "lane": "signals", "col": 0, "type": "messagebus", "label": "SLO Alert", "sublabel": "burn rate" }, + { "id": "page", "lane": "responders", "col": 1, "width": 76, "type": "external", "label": "Page On-call", "sublabel": "acknowledge" }, + { "id": "triage", "lane": "responders", "col": 2, "width": 64, "type": "backend", "label": "Triage", "sublabel": "scope impact" }, + { "id": "declare", "lane": "responders", "col": 3, "type": "security", "label": "Declare", "sublabel": "assign commander", "tag": "SEV-1/2" }, + { "id": "contain", "lane": "mitigation", "col": 3, "width": 72, "type": "backend", "label": "Contain", "sublabel": "stop growth" }, + { "id": "recover", "lane": "mitigation", "col": 4, "width": 52, "type": "cloud", "label": "Recover", "sublabel": "restore" }, + { "id": "verify", "lane": "recovery", "col": 5, "type": "database", "label": "Verify", "sublabel": "SLO + traces", "tag": "15 min stable" }, + { "id": "close", "lane": "communication", "col": 5, "type": "external", "label": "Resolve", "sublabel": "final update" }, + { "id": "update", "lane": "communication", "col": 3, "type": "frontend", "label": "Status Update", "sublabel": "impact + ETA" }, + { "id": "escalate", "lane": "exceptions", "col": 3, "width": 72, "type": "security", "label": "Escalate", "sublabel": "specialist" }, + { "id": "rollback", "lane": "exceptions", "col": 5, "type": "messagebus", "label": "Rollback", "sublabel": "last good" } + ], + "edges": [ + { "from": "alert", "to": "page", "label": "page", "variant": "emphasis", "route": "drop", "fromSide": "bottom", "toSide": "top" }, + { "from": "page", "to": "triage", "route": "bottom-channel", "fromSide": "bottom", "toSide": "bottom" }, + { "from": "triage", "to": "contain", "variant": "emphasis", "route": "drop", "fromSide": "bottom", "toSide": "top" }, + { "from": "contain", "to": "recover", "route": "bottom-channel", "fromSide": "bottom", "toSide": "bottom" }, + { "from": "recover", "to": "verify", "variant": "emphasis", "route": "drop", "fromSide": "bottom", "toSide": "top" }, + { "from": "verify", "to": "close", "variant": "emphasis", "route": "drop", "fromSide": "bottom", "toSide": "top" }, + { "from": "triage", "to": "declare", "variant": "security" }, + { "from": "declare", "to": "update", "variant": "dashed", "fromSide": "top", "toSide": "left", "via": [[430, 16], [20, 16], [20, 615]] }, + { "from": "update", "to": "escalate", "variant": "security", "route": "drop", "fromSide": "bottom", "toSide": "top" }, + { "from": "verify", "to": "rollback", "variant": "security", "role": "error", "route": "outside-right", "fromSide": "right", "toSide": "right" } + ], + "cards": [ + { "dot": "rose", "title": "Ownership First", "items": ["A page is not an incident until someone owns command", "Severity and scope are explicit before mitigation spreads", "Escalation names the missing expertise"] }, + { "dot": "emerald", "title": "Recovery Is Evidence", "items": ["Mitigation can reduce impact without proving recovery", "SLOs and traces must stay healthy for a fixed window", "The final update follows verification, not optimism"] }, + { "dot": "cyan", "title": "Communication Contract", "items": ["Stakeholders receive impact, action, and next update time", "Rollback remains visible as a deliberate response", "Every branch has an owner and observable exit"] } + ] +} diff --git a/packages/diagram-core/vendor/archify/examples/lifecycle-agent-run.html b/packages/diagram-core/vendor/archify/examples/lifecycle-agent-run.html new file mode 100644 index 0000000..d8fd004 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/lifecycle-agent-run.html @@ -0,0 +1,13765 @@ + + + + + + + + Agent Run Lifecycle Diagram + + + + + + + + +
+ +
+
+
+

Agent Run Lifecycle

+
+
+ + + + +
+ + Agent Run Lifecycle + A lifecycle diagram generated by Archify. + + + + + + + + + + + + + + + + + + + + + + + + + 01 / Lifecycle phases + + 02 / Interruptions + Recovery loop + + 03 / Terminal exits + + + + + + + + + + + + + + + Queued · request accepted · Lifecycle phases · entry + + + + + 01 + Queued + request accepted + entry + + + + Planning · build task graph · Lifecycle phases · model + + + + 02 + Planning + build task graph + model + + + + Executing · tool calls · Lifecycle phases · work + + + + 03 + Executing + tool calls + work + + + + Reviewing · quality gate · Lifecycle phases · check + + + + 04 + Reviewing + quality gate + check + + + + Completed · final response · Lifecycle phases · done + + + + + 05 + Completed + final response + done + + + + Needs Approval · human gate · Interruptions · pause + + + + Needs Approval + human gate + pause + + + + Blocked · missing input · Interruptions · wait + + + + Blocked + missing input + wait + + + + Failed · recoverable error · Recovery loop · retryable + + + + Failed + recoverable error + retryable + + + + Cancelled · user stopped · Terminal exits · terminal + + + + + Cancelled + user stopped + terminal + + + + Expired · timeout · Terminal exits · terminal + + + + + Expired + timeout + terminal + + + + + + + + + + + + + Legend + + + initial state + + + + active + + + + waiting + + + + decision + + + + success + + + + failure / exit + + + + final state + + + +

+ + + + + + + + + +
+ + + +
+ + + + diff --git a/packages/diagram-core/vendor/archify/examples/locales/de.json b/packages/diagram-core/vendor/archify/examples/locales/de.json new file mode 100644 index 0000000..9fd47a5 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/locales/de.json @@ -0,0 +1,425 @@ +{ + "page.title": "{title} Diagramm", + "diagram.description.architecture": "Ein von Archify erstelltes Architekturdiagramm.", + "diagram.description.workflow": "Ein von Archify erstelltes Workflow-Diagramm.", + "diagram.description.sequence": "Ein von Archify erstelltes Sequenzdiagramm.", + "diagram.description.dataflow": "Ein von Archify erstelltes Datenfluss-Diagramm.", + "diagram.description.lifecycle": "Ein von Archify erstelltes Lifecycle-Diagramm.", + "node.focus": "{label} fokussieren", + "node.focus.detail": "{label} fokussieren, {detail}", + "node.context.architecture": "Architekturkomponente", + "node.context.workflow": "Workflow-Knoten", + "node.context.sequence": "Sequenzteilnehmer", + "node.context.dataflow": "Datenfluss-Knoten", + "node.context.lifecycle": "Lifecycle-Status", + "legend.title": "Legende", + "legend.architecture.frontend": "Frontend", + "legend.architecture.backend": "Backend", + "legend.architecture.database": "Datenbank", + "legend.architecture.cloud": "Cloud", + "legend.architecture.security": "Sicherheit", + "legend.architecture.messagebus": "Nachrichtenbus", + "legend.architecture.external": "Extern", + "legend.workflow.frontend": "Benutzeroberfläche", + "legend.workflow.backend": "Agentenlogik", + "legend.workflow.security": "Richtlinie", + "legend.workflow.messagebus": "Werkzeugaktion", + "legend.workflow.database": "Kontext / Trace", + "legend.workflow.cloud": "Cloud-Dienst", + "legend.workflow.external": "Externes System", + "legend.sequence.emphasis": "Hauptanfrage", + "legend.sequence.return": "Rückgabe", + "legend.sequence.security": "Sicherheit", + "legend.sequence.dashed": "asynchroner Trace", + "legend.sequence.default": "Nachricht", + "legend.dataflow.emphasis": "Primärdaten", + "legend.dataflow.security": "Richtlinie / PII", + "legend.dataflow.dashed": "asynchroner Batch", + "legend.dataflow.database": "Datenspeicher", + "legend.dataflow.default": "Datenfluss", + "legend.lifecycle.start": "Startzustand", + "legend.lifecycle.active": "aktiv", + "legend.lifecycle.waiting": "Wartend", + "legend.lifecycle.decision": "Entscheidung", + "legend.lifecycle.success": "Erfolg", + "legend.lifecycle.failure": "Fehler / Abbruch", + "legend.lifecycle.neutral": "neutral", + "legend.lifecycle.external": "extern", + "legend.lifecycle.final": "Endzustand", + "viewer.kind.frontend": "Frontend", + "viewer.kind.backend": "Backend", + "viewer.kind.database": "Datenbank", + "viewer.kind.cloud": "Cloud", + "viewer.kind.security": "Sicherheit", + "viewer.kind.messagebus": "Nachrichtenbus", + "viewer.kind.external": "Extern", + "viewer.kind.neutral": "Neutral", + "viewer.kind.node": "Knoten", + "viewer.kind.start": "Start", + "viewer.kind.active": "Aktiv", + "viewer.kind.waiting": "Wartend", + "viewer.kind.decision": "Entscheidung", + "viewer.kind.success": "Erfolg", + "viewer.kind.failure": "Fehler", + "viewer.toolbar.actions": "Diagrammaktionen", + "viewer.theme.toggle.title": "Design wechseln (T)", + "viewer.theme.toggle": "Farbdesign wechseln", + "viewer.theme.dark": "Dunkel", + "viewer.theme.light": "Hell", + "viewer.preset.choose.title": "Visuellen Stil wählen (S wechselt durch)", + "viewer.preset.choose": "Visuellen Stil wählen", + "viewer.preset.style": "Stil", + "viewer.preset.menu": "Visueller Stil", + "viewer.preset.identity": "Visuelle Identität", + "viewer.preset.cycles": "S wechselt durch", + "viewer.preset.classic": "Klassisch", + "viewer.preset.classic.short": "Klassisch", + "viewer.preset.classic.hint": "Stabiler technischer Standard", + "viewer.preset.flow": "Signalfluss", + "viewer.preset.flow.short": "Fluss", + "viewer.preset.flow.hint": "Bewegungsbetonte Präsentation", + "viewer.preset.blueprint": "Bauplan", + "viewer.preset.blueprint.hint": "Technisches Review", + "viewer.preset.editorial": "Editorial", + "viewer.preset.editorial.hint": "Für Veröffentlichungen und Launch-Notizen", + "viewer.preset.badge.signalFlow": "SIGNALFLUSS", + "viewer.preset.badge.blueprint": "BAUPLAN / REV. 01", + "viewer.preset.badge.editorial": "EDITORIAL / FELDNOTIZ", + "viewer.preset.badge.editorialPlate": "ARCHIFY / TAFEL 04", + "viewer.preset.current": "Visueller Stil: {style}. Visuellen Stil wählen", + "viewer.motion.live": "Live", + "viewer.motion.still": "Statisch", + "viewer.motion.pause": "Bewegung pausieren", + "viewer.motion.resume": "Bewegung fortsetzen", + "viewer.motion.reduced": "Bewegung wegen reduzierter Bewegungseinstellung pausiert", + "viewer.motion.hidden": "Bewegung pausiert, während diese Seite ausgeblendet ist", + "viewer.motion.yielding": "Bewegung pausieren; derzeit an {owner} abgegeben", + "viewer.motion.yielding.title": "Live-Vorschau aktiv · an {owner} abgegeben", + "viewer.owner.route": "Routensonde", + "viewer.owner.lens": "Semantische Linse", + "viewer.owner.relationship": "Beziehungsvorschau", + "viewer.owner.intent": "Intent Trace", + "viewer.owner.focus": "semantischer Fokus", + "viewer.owner.legend": "Legendenvorschau", + "viewer.owner.reader": "Leserinteraktion", + "viewer.present.enter": "Präsentationsmodus starten", + "viewer.present.enter.title": "Präsentationsmodus (F)", + "viewer.present.exit": "Präsentationsmodus beenden", + "viewer.present.exit.title": "Präsentationsmodus beenden (F oder Escape)", + "viewer.present.present": "Präsentieren", + "viewer.present.exit.label": "Beenden", + "viewer.export.button": "Exportieren", + "viewer.export.button.title": "Diagramm exportieren (E)", + "viewer.export.diagram": "Diagramm exportieren", + "viewer.export.menu": "Exportieren", + "viewer.export.subtitle": "Portable, saubere Ausgaben", + "viewer.export.share": "Teilen", + "viewer.export.shareCard": "Freigabekarte", + "viewer.export.routeShareCard": "Routen-Freigabekarte", + "viewer.export.reachShareCard": "Reichweiten-Freigabekarte", + "viewer.export.copyDiagram": "Diagramm kopieren", + "viewer.export.clipboardPng": "PNG in Zwischenablage", + "viewer.export.raster": "Rasterbilder", + "viewer.export.image": "Bild", + "viewer.export.lossless": "Verlustfreies Bild", + "viewer.export.compact": "Kompaktes Bild", + "viewer.export.modern": "Modernes Bild", + "viewer.export.vectorMotion": "Vektor und Bewegung", + "viewer.export.vectorMotion.heading": "Vektor & Bewegung", + "viewer.export.editable": "Editierbarer Vektor", + "viewer.export.motion6s": "6-Sekunden-Bewegung", + "viewer.export.unsupported": "Von diesem Browser nicht unterstützt", + "viewer.export.clipboardUnsupported": "Bild-Zwischenablage wird von diesem Browser nicht unterstützt", + "viewer.export.clipboardUnsupported.short": "Dieser Browser unterstützt keine Bild-Zwischenablage.", + "viewer.export.motionUnavailable": "Bewegungsaufnahme in diesem Browser nicht verfügbar", + "viewer.export.webmUnavailable": "WebM in diesem Browser nicht verfügbar", + "viewer.export.failed": "Export fehlgeschlagen: {message}", + "viewer.export.unknownVariant": "Unbekannter Freigabekarten-Typ: {variant}", + "viewer.export.routeRequired": "Route verfolgen, bevor eine Routen-Freigabekarte exportiert wird", + "viewer.export.reachRequired": "Verfasste Reichweite verfolgen, bevor eine Reichweiten-Freigabekarte exportiert wird", + "viewer.export.unknown": "unbekannt", + "viewer.export.routeFailed": "Export der Routen-Freigabekarte fehlgeschlagen: {message}", + "viewer.export.reachFailed": "Export der Reichweiten-Freigabekarte fehlgeschlagen: {message}", + "viewer.export.copyFailed": "Kopieren fehlgeschlagen: {message}", + "viewer.export.copiedPng": "PNG in Zwischenablage kopiert", + "viewer.export.downloadedRoute": "Routen-Freigabekarte heruntergeladen", + "viewer.export.downloadedReach": "Reichweiten-Freigabekarte heruntergeladen", + "viewer.export.downloadedWebm": "WebM heruntergeladen", + "viewer.export.recording": "6 Sekunden Bewegung werden aufgezeichnet …", + "viewer.export.card.routeSummary.one": "Route: {source} → {target} · {count} gerichteter Hop", + "viewer.export.card.routeSummary.other": "Route: {source} → {target} · {count} gerichtete Hops", + "viewer.export.card.reachSummary": "Verfasst {direction} von {origin} · {nodes} · {links} · max. {hops}", + "viewer.export.card.node.one": "{count} Knoten", + "viewer.export.card.node.other": "{count} Knoten", + "viewer.export.card.link.one": "{count} Verbindung", + "viewer.export.card.link.other": "{count} Verbindungen", + "viewer.export.card.hop.one": "{count} Hop", + "viewer.export.card.hop.other": "{count} Hops", + "viewer.export.card.routeBadge": "ARCHIFY · ROUTE · {hops}", + "viewer.export.card.reachBadge": "ARCHIFY · {direction} REICHWEITE", + "viewer.export.direction.upstream": "Vorgelagert", + "viewer.export.direction.downstream": "Nachgelagert", + "viewer.export.error.canvasUnavailable": "Canvas für {label} nicht verfügbar", + "viewer.export.error.contextUnavailable": "2D-Canvas-Kontext für {label} nicht verfügbar", + "viewer.export.error.toBlobUnavailable": "canvas.toBlob für {label} nicht verfügbar", + "viewer.export.error.toBlobNull": "canvas.toBlob lieferte keine Daten für {label}", + "viewer.export.error.variantsCombined": "Freigabekarten-Typen können nicht kombiniert werden", + "viewer.export.error.viewerState": "Beim Export der Freigabekarte konnte der temporäre Viewer-Zustand nicht entfernt werden", + "viewer.export.error.routeState": "Beim Export der Routenkarte konnte die aufgelöste Route nicht sicher erhalten werden", + "viewer.export.error.reachState": "Beim Export der Reichweitenkarte konnte die verfasste Reichweite nicht sicher erhalten werden", + "viewer.export.error.webmRequirements": "Der WebM-Bewegungsexport erfordert eine Trace-Animation und Browser-Unterstützung für MediaRecorder", + "viewer.export.error.mediaRecorder": "MediaRecorder fehlgeschlagen", + "viewer.export.error.emptyWebm": "MediaRecorder hat ein leeres WebM erzeugt", + "viewer.export.error.webmBackground": "SVG-Hintergrund konnte für den WebM-Export nicht geladen werden", + "viewer.guide.eyebrow": "Diagrammleitfaden", + "viewer.guide.close": "Diagrammleitfaden schließen", + "viewer.guide.inspecting": "Kompilierte Semantik wird geprüft", + "viewer.guide.actions": "Diagramm-Erkundungsaktionen", + "viewer.guide.find": "Beliebigen Knoten finden", + "viewer.guide.find.hint": "Labels, Zuständigkeiten, Arten und stabile IDs durchsuchen.", + "viewer.guide.route": "Eine Route verfolgen", + "viewer.guide.route.aria": "Eine gerichtete Route verfolgen", + "viewer.guide.route.hint": "Herausfinden, wie zwei semantische Knoten in verfasster Richtung verbunden sind.", + "viewer.guide.map": "Das gesamte System sehen", + "viewer.guide.map.hint": "Semantisches Radar mit Live-Ansicht und stabilen Knoten öffnen.", + "viewer.guide.lens": "Semantische Arten vergleichen", + "viewer.guide.lens.hint": "Rollen zählen, ihren Verkehr sichtbar machen und direkte verfasste Verbindungen vergleichen.", + "viewer.guide.present": "Präsentationsmodus starten", + "viewer.guide.present.hint": "Dem Live-Diagramm die gesamte Ansicht geben, ohne den Export zu verändern.", + "viewer.guide.shortcuts": "Weitere Tastenkombinationen", + "viewer.guide.shortcut.export": "Exportieren", + "viewer.guide.shortcut.theme": "Design", + "viewer.guide.shortcut.style": "Stil", + "viewer.guide.shortcut.reset": "Zurücksetzen", + "viewer.guide.shortcut.zoomIn": "Vergrößern", + "viewer.guide.shortcut.zoomOut": "Verkleinern", + "viewer.guide.shortcut.close": "Schließen", + "viewer.guide.facts": "{nodes} · {relationships}", + "viewer.guide.fact.node.one": "{count} semantischer Knoten", + "viewer.guide.fact.node.other": "{count} semantische Knoten", + "viewer.guide.fact.relationship.one": "{count} Beziehung", + "viewer.guide.fact.relationship.other": "{count} Beziehungen", + "viewer.guide.open": "Diagrammleitfaden öffnen", + "viewer.finder.title": "Knoten finden", + "viewer.finder.close": "Knotensuche schließen", + "viewer.finder.placeholder": "Labels oder IDs suchen", + "viewer.finder.search": "Diagrammknoten durchsuchen", + "viewer.finder.results": "Diagrammknoten", + "viewer.finder.empty": "Keine passenden Knoten", + "viewer.finder.result.focus": "{label} fokussieren", + "viewer.finder.result.routeStart": "{label} als Routenstart wählen", + "viewer.finder.result.routeTarget": "{label} als Routenziel wählen, {links}", + "viewer.finder.status.empty": "Keine passenden Knoten", + "viewer.finder.status.count.one": "{count} passender Knoten", + "viewer.finder.status.count.other": "{count} passende Knoten", + "viewer.finder.noun.nodes": "Knoten", + "viewer.finder.link.one": "{count} Verbindung", + "viewer.finder.link.other": "{count} Verbindungen", + "viewer.finder.result.focus.one": "{label} fokussieren, {count} zugehörige Verbindung", + "viewer.finder.result.focus.other": "{label} fokussieren, {count} zugehörige Verbindungen", + "viewer.finder.status.filtered": "{visible} von {available} {noun}", + "viewer.finder.status.all": "{available} {noun}", + "viewer.passport.eyebrow": "Semantischer Pass", + "viewer.passport.metadata": "Knoten-Metadaten", + "viewer.passport.evidence": "Verifizierter Quellnachweis", + "viewer.passport.verified": "Verifizierte Quelle", + "viewer.passport.verificationScope": "Verifiziert gegen lokales Git zur fixierten Revision. Remote-Zugriff wurde nicht geprüft.", + "viewer.passport.reach": "Verfasste Reichweite", + "viewer.passport.reach.trace": "Verfasste Erreichbarkeit verfolgen", + "viewer.passport.upstream": "Vorgelagert", + "viewer.passport.downstream": "Nachgelagert", + "viewer.passport.upstream.trace": "Vorgelagerte verfasste Erreichbarkeit verfolgen", + "viewer.passport.downstream.trace": "Nachgelagerte verfasste Erreichbarkeit verfolgen", + "viewer.passport.close": "Semantischen Pass schließen", + "viewer.passport.copy": "Link kopieren", + "viewer.passport.copy.focus": "Link zum fokussierten Knoten kopieren", + "viewer.passport.relations": "Beziehungen", + "viewer.passport.relations.show": "Verbundene Beziehungen anzeigen", + "viewer.passport.relations.hide": "Verbundene Beziehungen ausblenden", + "viewer.passport.relations.list": "Verbundene Beziehungen", + "viewer.passport.copyRelation": "Beziehung kopieren", + "viewer.passport.copyNode": "Knoten kopieren", + "viewer.passport.copyPinned": "Link zur angehefteten Beziehung kopieren", + "viewer.passport.copySource": "Link zum Quellknoten kopieren", + "viewer.passport.copy.focused.success": "Link des fokussierten Knotens kopiert", + "viewer.passport.copy.pinned.success": "Link der angehefteten Beziehung kopiert", + "viewer.passport.copy.focused.failed": "Link des fokussierten Knotens konnte nicht kopiert werden", + "viewer.passport.copy.pinned.failed": "Link der angehefteten Beziehung konnte nicht kopiert werden", + "viewer.passport.relationship.none": "Keine verbundenen Beziehungen", + "viewer.passport.relationship.count.one": "{count} Beziehung", + "viewer.passport.relationship.count.other": "{count} Beziehungen", + "viewer.passport.relationship.show.one": "{count} verbundene Beziehung anzeigen", + "viewer.passport.relationship.show.other": "{count} verbundene Beziehungen anzeigen", + "viewer.passport.relationship.summary": "{out} ausgehend · {in} eingehend{loops}", + "viewer.passport.relationship.loops": " · {count} Selbstschleife", + "viewer.passport.relationship.explorer": "Direkter Beziehungs-Explorer", + "viewer.passport.relationship.help": "Pfeiltasten zum Erkunden der Beziehungen verwenden. Enter oder Leertaste heftet Details an; Escape hebt die Auswahl auf.", + "viewer.passport.relationship.loopsBack": "schleift zurück", + "viewer.passport.relationship.connectsTo": "verbindet zu", + "viewer.passport.relationship.connectsFrom": "verbindet von", + "viewer.passport.relationship.pinned": "Angeheftete Beziehung · {from} → {to} · {label}", + "viewer.passport.relationship.inspect": "Beziehung {index} von {total} prüfen: {from} zu {to}, {label}. Enter für Details drücken.", + "viewer.passport.relationship.group.out": "Ausgehend", + "viewer.passport.relationship.group.in": "Eingehend", + "viewer.passport.relationship.group.loop": "Selbstschleifen", + "viewer.passport.relationship.row": "{group}: {relationship}, {neighbor}", + "viewer.passport.relationship.direction.out": "AUS →", + "viewer.passport.relationship.direction.in": "← EIN", + "viewer.passport.relationship.direction.loop": "SCHLEIFE", + "viewer.passport.sourceCount.one": "{count} verifizierte Quellenreferenz", + "viewer.passport.sourceCount.other": "{count} verifizierte Quellenreferenzen", + "viewer.passport.sourceMarker": "QUELLE", + "viewer.passport.beacon.one": "{count} verifizierte Quelle; diesen Knoten fokussieren, um sie zu prüfen", + "viewer.passport.beacon.other": "{count} verifizierte Quellen; diesen Knoten fokussieren, um sie zu prüfen", + "viewer.passport.repository.open": "Verifizierte Repository-Revision {revision} öffnen", + "viewer.passport.source.open": "Verifizierte Quelle {path} bei Revision {revision} öffnen", + "viewer.passport.source.openLink": "Öffnen ↗", + "viewer.passport.reach.upstream.one": "{count} vorgelagerten verfassten Knoten verfolgen", + "viewer.passport.reach.upstream.other": "{count} vorgelagerte verfasste Knoten verfolgen", + "viewer.passport.reach.downstream.one": "{count} nachgelagerten verfassten Knoten verfolgen", + "viewer.passport.reach.downstream.other": "{count} nachgelagerte verfasste Knoten verfolgen", + "viewer.passport.reach.noUpstream": "Keine vorgelagerten verfassten Knoten", + "viewer.passport.reach.noDownstream": "Keine nachgelagerten verfassten Knoten", + "viewer.passport.reach.status": "{direction} · {nodes} Knoten · {links} Verbindungen · max. {hops} Hops", + "viewer.route.eyebrow": "Routensonde", + "viewer.route.start": "Startknoten wählen", + "viewer.route.start.find": "Start finden", + "viewer.route.start.find.aria": "Einen Routenstart finden", + "viewer.route.copy": "Link kopieren", + "viewer.route.copy.aria": "Link zur verfolgten Route kopieren", + "viewer.route.clear": "Löschen", + "viewer.route.clear.aria": "Routensonde löschen", + "viewer.route.traced": "Verfolgte Route", + "viewer.route.pickTwo": "Zwei semantische Knoten im Diagramm auswählen", + "viewer.route.pickOne": "Einen semantischen Knoten im Diagramm auswählen", + "viewer.route.controls": "Routen-Verlaufssteuerung", + "viewer.route.previous": "Vorherige Routenposition", + "viewer.route.play": "Routenverlauf abspielen", + "viewer.route.pause": "Routenverlauf pausieren", + "viewer.route.replay": "Routenverlauf erneut abspielen", + "viewer.route.next": "Nächste Routenposition", + "viewer.route.journey": "Verlauf", + "viewer.route.pause.label": "Pausieren", + "viewer.route.replay.label": "Erneut abspielen", + "viewer.route.overview": "Übersicht", + "viewer.route.overview.aria": "Vollständige Routenübersicht anzeigen", + "viewer.route.instructions": "Quelle wählen, dann das Ziel. Die Richtung ist entscheidend.", + "viewer.route.destination": "Ziel ausgehend von {label} wählen", + "viewer.route.destination.find": "Ziel finden", + "viewer.route.destination.find.aria": "Ein erreichbares Routenziel finden", + "viewer.route.differentDestination": "Anderes Ziel wählen", + "viewer.route.distinct": "Eine Route benötigt zwei unterschiedliche semantische Knoten.", + "viewer.route.unreachable": "Keine gerichtete Route zu {label}", + "viewer.route.unreachable.detail": "{target} ist von {source} aus nicht erreichbar. Ein hervorgehobenes Ziel wählen.", + "viewer.route.start.instructions": "Quelle auswählen. Im nächsten Schritt werden nur gerichtete Ziele angezeigt.", + "viewer.route.copy.success": "Link zur verfolgten Route kopiert", + "viewer.route.copy.failed": "Link zur verfolgten Route konnte nicht kopiert werden", + "viewer.route.position": "Routenposition {index} von {total}: {label}", + "viewer.route.step": "Schritt {index} von {total} · {phase} · {label}", + "viewer.route.motionRequired": "Automatischer Verlauf erfordert Live-Bewegung", + "viewer.route.trigger.clear": "Verfolgte Route löschen", + "viewer.route.overview.status": "{nodes} · {hops} · kürzeste verfasste Route", + "viewer.route.overview.node.one": "{count} Knoten", + "viewer.route.overview.node.other": "{count} Knoten", + "viewer.route.overview.hop.one": "{count} gerichteter Hop", + "viewer.route.overview.hop.other": "{count} gerichtete Hops", + "viewer.route.phase.playing": "Läuft", + "viewer.route.phase.complete": "Abgeschlossen", + "viewer.route.phase.inspecting": "Wird geprüft", + "viewer.route.destination.count.one": "{count} gerichtetes Ziel verfügbar. Einen hervorgehobenen Knoten wählen.", + "viewer.route.destination.count.other": "{count} gerichtete Ziele verfügbar. Einen hervorgehobenen Knoten wählen.", + "viewer.route.noOutgoing": "Hier startet keine ausgehende Route. Löschen und eine andere Quelle wählen.", + "viewer.route.result.title": "{source} nach {target}", + "viewer.route.finder.source.title": "Routenstart wählen", + "viewer.route.finder.source.placeholder": "Routenquellen suchen", + "viewer.route.finder.source.empty": "Keine passenden Routenquellen", + "viewer.route.finder.source.results": "Knoten, die eine Route starten können", + "viewer.route.finder.source.noun": "Routenquellen", + "viewer.route.finder.source.badge": "Start", + "viewer.route.finder.target.title": "Ziel ausgehend von {label}", + "viewer.route.finder.target.placeholder": "Erreichbare Ziele suchen", + "viewer.route.finder.target.empty": "Keine passenden erreichbaren Ziele", + "viewer.route.finder.target.results": "Erreichbare Routenziele", + "viewer.route.finder.target.noun": "erreichbare Ziele", + "viewer.route.hop.one": "{count} Hop", + "viewer.route.hop.other": "{count} Hops", + "viewer.lens.eyebrow": "Semantische Linse", + "viewer.lens.title": "Systemrollen vergleichen", + "viewer.lens.close": "Semantische Linse schließen", + "viewer.lens.instruction": "Bis zu zwei semantische Arten wählen. Eine zeigt ihren echten Verkehr; zwei vergleichen nur direkte verfasste Beziehungen.", + "viewer.lens.kinds": "Semantische Arten", + "viewer.lens.choose": "Eine Art wählen, um ihre Knoten und berührenden Beziehungen zu prüfen.", + "viewer.lens.copy": "Link zur semantischen Linse kopieren", + "viewer.lens.clear": "Semantische Linse löschen", + "viewer.lens.open": "Semantische Linse öffnen", + "viewer.lens.openActive": "Aktive semantische Linse öffnen", + "viewer.lens.legend": "Semantische Legende", + "viewer.lens.legend.inspect.one": "{label} prüfen, {count} Knoten", + "viewer.lens.legend.inspect.other": "{label} prüfen, {count} Knoten", + "viewer.lens.kind.count.one": "{label}, {count} Knoten", + "viewer.lens.kind.count.other": "{label}, {count} Knoten", + "viewer.lens.compare.one": "{first} → {second}: {forward} · {second} → {first}: {reverse} · {count} direkte Beziehung", + "viewer.lens.compare.other": "{first} → {second}: {forward} · {second} → {first}: {reverse} · {count} direkte Beziehungen", + "viewer.lens.single": "{nodes} · {relationships} · verbundene Nachbarn bleiben sichtbar", + "viewer.lens.node.one": "{count} {label}-Knoten", + "viewer.lens.node.other": "{count} {label}-Knoten", + "viewer.lens.relationship.one": "{count} berührende Beziehung", + "viewer.lens.relationship.other": "{count} berührende Beziehungen", + "viewer.radar.title": "Semantisches Radar", + "viewer.radar.building": "Übersicht wird erstellt", + "viewer.radar.openFull": "Vollständiges semantisches Radar öffnen", + "viewer.radar.open": "Radar öffnen", + "viewer.radar.close": "Semantisches Radar schließen", + "viewer.radar.surface": "Diagrammübersicht. Auf einen Knoten klicken, um ihn zu fokussieren, oder mit den Pfeiltasten schwenken.", + "viewer.radar.click": "Knoten anklicken", + "viewer.radar.drag": "Ziehen zum Schwenken", + "viewer.radar.space": "Semantisches Radar benötigt mehr MAP-Platz.", + "viewer.radar.nodes": "Semantische Diagramm-Radarknoten", + "viewer.radar.focus": "{label} vom semantischen Radar fokussieren", + "viewer.radar.status": "{count} Knoten · {viewport}", + "viewer.radar.fullMap": "{count} Knoten · vollständige Karte", + "viewer.radar.compacted": "Radar verkleinert, um den semantischen Pass oder die MAP-Steuerung nicht zu verdecken.", + "viewer.radar.cancelWaiting": "Wartendes semantisches Radar auf mehr MAP-Platz abbrechen", + "viewer.radar.needsSpace": "Semantisches Radar benötigt mehr sichtbaren MAP-Platz", + "viewer.radar.viewport.full": "vollständige Karte", + "viewer.radar.viewport.width": "{percent}% Breite", + "viewer.radar.viewport.scale": "{percent}% Ansicht", + "viewer.nav.controls": "Diagrammansicht-Steuerung", + "viewer.nav.route": "Eine gerichtete Route verfolgen", + "viewer.nav.route.title": "Route verfolgen (R)", + "viewer.nav.route.short": "PFAD", + "viewer.nav.radar": "Semantisches Radar öffnen", + "viewer.nav.radar.title": "Semantisches Radar (M)", + "viewer.nav.radar.short": "KARTE", + "viewer.nav.lens": "Semantische Linse öffnen", + "viewer.nav.lens.title": "Semantische Linse (L)", + "viewer.nav.lens.short": "LINSE", + "viewer.nav.find": "Knoten finden", + "viewer.nav.find.title": "Knoten finden (/)", + "viewer.nav.guide": "Diagrammleitfaden öffnen", + "viewer.nav.guide.title": "Diagrammleitfaden (?)", + "viewer.nav.zoomOut": "Verkleinern", + "viewer.nav.zoomOut.title": "Verkleinern (-)", + "viewer.nav.reset": "Diagrammansicht zurücksetzen", + "viewer.nav.reset.title": "Ansicht zurücksetzen (0)", + "viewer.nav.read": "LESEN", + "viewer.nav.zoomIn": "Vergrößern", + "viewer.nav.zoomIn.title": "Vergrößern (+)", + "viewer.nav.camera": "{hint}. Diagrammansicht zurücksetzen", + "viewer.nav.camera.title": "{semantic}{hint} · Ansicht zurücksetzen (0)", + "viewer.nav.camera.semantic": "Semantische Kamera aktiv · ", + "viewer.nav.level.map": "KARTE", + "viewer.nav.level.read": "LESEN", + "viewer.nav.level.full": "VOLL", + "viewer.nav.level.auto": "AUTO", + "viewer.nav.detail.map": "Vergrößern, um Beziehungslabels und Knotenkontext anzuzeigen", + "viewer.nav.detail.read": "Erneut vergrößern, um Tags und Anmerkungen anzuzeigen", + "viewer.nav.detail.full": "Vollständige Diagrammdetails", + "viewer.intent.summary": "{label}. {out} ausgehend, {in} eingehend{loops}. {total} Verbindungen. Enter für Details drücken.", + "viewer.intent.loops": ", {count} Selbstschleife", + "viewer.common.copied": "Kopiert", + "viewer.common.copyFailed": "Kopieren fehlgeschlagen", + "viewer.common.copyLink": "Link kopieren", + "viewer.common.clear": "Löschen", + "viewer.common.close": "Schließen" +} diff --git a/packages/diagram-core/vendor/archify/examples/locales/es.json b/packages/diagram-core/vendor/archify/examples/locales/es.json new file mode 100644 index 0000000..4f20b09 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/locales/es.json @@ -0,0 +1,440 @@ +{ + "page.title": "{title} · Diagrama", + "diagram.description.architecture": "Un diagrama de arquitectura generado por Archify.", + "diagram.description.workflow": "Un diagrama de flujo de trabajo generado por Archify.", + "diagram.description.sequence": "Un diagrama de secuencia generado por Archify.", + "diagram.description.dataflow": "Un diagrama de flujo de datos generado por Archify.", + "diagram.description.lifecycle": "Un diagrama de ciclo de vida generado por Archify.", + "node.focus": "Enfocar {label}", + "node.focus.detail": "Enfocar {label}, {detail}", + "node.context.architecture": "Componente de arquitectura", + "node.context.workflow": "Nodo de flujo de trabajo", + "node.context.sequence": "Participante de secuencia", + "node.context.dataflow": "Nodo de flujo de datos", + "node.context.lifecycle": "Estado del ciclo de vida", + "legend.title": "Leyenda", + "legend.architecture.frontend": "Frontend", + "legend.architecture.backend": "Backend", + "legend.architecture.database": "Base de datos", + "legend.architecture.cloud": "Nube", + "legend.architecture.security": "Seguridad", + "legend.architecture.messagebus": "Bus de mensajes", + "legend.architecture.external": "Externo", + "legend.workflow.frontend": "Interfaz de usuario", + "legend.workflow.backend": "Lógica del agente", + "legend.workflow.security": "Política", + "legend.workflow.messagebus": "Acción de herramienta", + "legend.workflow.database": "Contexto / traza", + "legend.workflow.cloud": "Servicio en la nube", + "legend.workflow.external": "Sistema externo", + "legend.sequence.emphasis": "solicitud principal", + "legend.sequence.return": "respuesta", + "legend.sequence.security": "seguridad", + "legend.sequence.dashed": "traza asíncrona", + "legend.sequence.default": "mensaje", + "legend.dataflow.emphasis": "datos primarios", + "legend.dataflow.security": "política / PII", + "legend.dataflow.dashed": "lote asíncrono", + "legend.dataflow.database": "almacén de datos", + "legend.dataflow.default": "flujo de datos", + "legend.lifecycle.start": "estado inicial", + "legend.lifecycle.active": "activo", + "legend.lifecycle.waiting": "en espera", + "legend.lifecycle.decision": "decisión", + "legend.lifecycle.success": "éxito", + "legend.lifecycle.failure": "fallo / salida", + "legend.lifecycle.neutral": "neutral", + "legend.lifecycle.external": "externo", + "legend.lifecycle.final": "estado final", + "viewer.kind.frontend": "Frontend", + "viewer.kind.backend": "Backend", + "viewer.kind.database": "Base de datos", + "viewer.kind.cloud": "Nube", + "viewer.kind.security": "Seguridad", + "viewer.kind.messagebus": "Bus de mensajes", + "viewer.kind.external": "Externo", + "viewer.kind.neutral": "Neutral", + "viewer.kind.node": "Nodo", + "viewer.kind.start": "Inicio", + "viewer.kind.active": "Activo", + "viewer.kind.waiting": "En espera", + "viewer.kind.decision": "Decisión", + "viewer.kind.success": "Éxito", + "viewer.kind.failure": "Fallo", + "viewer.toolbar.actions": "Acciones del diagrama", + "viewer.theme.toggle.title": "Cambiar tema (T)", + "viewer.theme.toggle": "Cambiar tema de color", + "viewer.theme.dark": "Oscuro", + "viewer.theme.light": "Claro", + "viewer.preset.choose.title": "Elegir estilo visual (S alterna)", + "viewer.preset.choose": "Elegir estilo visual", + "viewer.preset.style": "Estilo", + "viewer.preset.menu": "Estilo visual", + "viewer.preset.identity": "Identidad visual", + "viewer.preset.cycles": "alterna", + "viewer.preset.classic": "Clásico", + "viewer.preset.classic.short": "Clásico", + "viewer.preset.classic.hint": "Predeterminado técnico estable", + "viewer.preset.flow": "Flujo de señal", + "viewer.preset.flow.short": "Flujo", + "viewer.preset.flow.hint": "Presentación con énfasis en el movimiento", + "viewer.preset.blueprint": "Plano", + "viewer.preset.blueprint.hint": "Revisión de ingeniería", + "viewer.preset.editorial": "Editorial", + "viewer.preset.editorial.hint": "Notas de publicación y lanzamiento", + "viewer.preset.badge.signalFlow": "FLUJO DE SEÑAL", + "viewer.preset.badge.blueprint": "PLANO / REV 01", + "viewer.preset.badge.editorial": "EDITORIAL / NOTA DE CAMPO", + "viewer.preset.badge.editorialPlate": "ARCHIFY / LÁMINA 04", + "viewer.preset.current": "Estilo visual: {style}. Elegir estilo visual", + "viewer.motion.live": "Activa", + "viewer.motion.still": "Fija", + "viewer.motion.pause": "Pausar animación", + "viewer.motion.resume": "Reanudar animación", + "viewer.motion.reduced": "Animación pausada por la preferencia de movimiento reducido", + "viewer.motion.hidden": "Animación pausada mientras esta página está oculta", + "viewer.motion.yielding": "Pausar animación; cediendo a {owner}", + "viewer.motion.yielding.title": "Vista previa en vivo activada · cediendo a {owner}", + "viewer.owner.route": "Sonda de ruta", + "viewer.owner.lens": "Lente semántico", + "viewer.owner.relationship": "Vista previa de relación", + "viewer.owner.intent": "Traza de intención", + "viewer.owner.focus": "enfoque semántico", + "viewer.owner.legend": "vista previa de la leyenda", + "viewer.owner.reader": "interacción del lector", + "viewer.present.enter": "Entrar al modo presentación", + "viewer.present.enter.title": "Modo presentación (F)", + "viewer.present.exit": "Salir del modo presentación", + "viewer.present.exit.title": "Salir del modo presentación (F o Escape)", + "viewer.present.present": "Presentar", + "viewer.present.exit.label": "Salir", + "viewer.export.button": "Exportar", + "viewer.export.button.title": "Exportar diagrama (E)", + "viewer.export.diagram": "Exportar diagrama", + "viewer.export.menu": "Exportar", + "viewer.export.subtitle": "Salidas portables y limpias", + "viewer.export.share": "Compartir", + "viewer.export.shareCard": "Tarjeta para compartir", + "viewer.export.routeShareCard": "Tarjeta de ruta para compartir", + "viewer.export.reachShareCard": "Tarjeta de alcance para compartir", + "viewer.export.copyDiagram": "Copiar diagrama", + "viewer.export.clipboardPng": "PNG al portapapeles", + "viewer.export.raster": "Imágenes rasterizadas", + "viewer.export.image": "Imagen", + "viewer.export.lossless": "Imagen sin pérdida", + "viewer.export.compact": "Imagen compacta", + "viewer.export.modern": "Imagen moderna", + "viewer.export.vectorMotion": "Vector y movimiento", + "viewer.export.vectorMotion.heading": "Vector y movimiento", + "viewer.export.editable": "Vector editable", + "viewer.export.svg.auto": "SVG · Auto", + "viewer.export.svg.auto.hint": "Coincide con el tema del host", + "viewer.export.svg.light": "SVG · Claro", + "viewer.export.svg.light.hint": "Siempre claro", + "viewer.export.svg.dark": "SVG · Oscuro", + "viewer.export.svg.dark.hint": "Siempre oscuro", + "viewer.export.motion6s": "Movimiento de 6 s", + "viewer.export.unsupported": "No compatible con este navegador", + "viewer.export.clipboardUnsupported": "Este navegador no admite escribir imágenes en el portapapeles", + "viewer.export.clipboardUnsupported.short": "Escritura de imágenes en el portapapeles no admitida en este navegador.", + "viewer.export.motionUnavailable": "Captura de movimiento no disponible en este navegador", + "viewer.export.webmUnavailable": "WebM no disponible en este navegador", + "viewer.export.failed": "Falló la exportación: {message}", + "viewer.export.unknownVariant": "Variante de tarjeta para compartir desconocida: {variant}", + "viewer.export.routeRequired": "Traza una ruta antes de exportar una tarjeta de ruta para compartir", + "viewer.export.reachRequired": "Traza el alcance definido antes de exportar una tarjeta de alcance para compartir", + "viewer.export.unknown": "desconocido", + "viewer.export.routeFailed": "Falló la exportación de la tarjeta de ruta para compartir: {message}", + "viewer.export.reachFailed": "Falló la exportación de la tarjeta de alcance para compartir: {message}", + "viewer.export.copyFailed": "Error al copiar: {message}", + "viewer.export.copiedPng": "PNG copiado al portapapeles", + "viewer.export.downloadedRoute": "Tarjeta de ruta para compartir descargada", + "viewer.export.downloadedReach": "Tarjeta de alcance para compartir descargada", + "viewer.export.downloadedWebm": "WebM descargado", + "viewer.export.recording": "Grabando 6 segundos de movimiento…", + "viewer.export.card.routeSummary.one": "Ruta: {source} → {target} · {count} paso", + "viewer.export.card.routeSummary.other": "Ruta: {source} → {target} · {count} pasos", + "viewer.export.card.reachSummary": "Alcance definido {direction} desde {origin} · {nodes} · {links} · máx {hops}", + "viewer.export.card.node.one": "{count} nodo", + "viewer.export.card.node.other": "{count} nodos", + "viewer.export.card.link.one": "{count} enlace", + "viewer.export.card.link.other": "{count} enlaces", + "viewer.export.card.hop.one": "{count} salto", + "viewer.export.card.hop.other": "{count} saltos", + "viewer.export.card.routeBadge": "ARCHIFY · RUTA · {hops}", + "viewer.export.card.reachBadge": "ARCHIFY · ALCANCE {direction}", + "viewer.export.direction.upstream": "Ascendente", + "viewer.export.direction.downstream": "Descendente", + "viewer.export.error.canvasUnavailable": "Lienzo no disponible para {label}", + "viewer.export.error.contextUnavailable": "Contexto de lienzo 2D no disponible para {label}", + "viewer.export.error.toBlobUnavailable": "canvas.toBlob no disponible para {label}", + "viewer.export.error.toBlobNull": "canvas.toBlob no devolvió datos para {label}", + "viewer.export.error.variantsCombined": "Las variantes de tarjeta para compartir no se pueden combinar", + "viewer.export.error.viewerState": "La exportación de la tarjeta para compartir no pudo quitar el estado temporal del visor", + "viewer.export.error.routeState": "La exportación de la tarjeta de ruta no pudo preservar la ruta resuelta de forma segura", + "viewer.export.error.reachState": "La exportación de la tarjeta de alcance no pudo preservar el alcance definido de forma segura", + "viewer.export.error.webmRequirements": "La exportación de movimiento WebM requiere una animación de traza y compatibilidad del navegador con MediaRecorder", + "viewer.export.error.mediaRecorder": "MediaRecorder falló", + "viewer.export.error.emptyWebm": "MediaRecorder produjo un WebM vacío", + "viewer.export.error.webmBackground": "No se pudo cargar el fondo SVG para la exportación WebM", + "viewer.guide.title": "Explorar este sistema", + "viewer.focus.selectedNodes": "{count} nodos seleccionados", + "viewer.guide.eyebrow": "Guía del diagrama", + "viewer.guide.close": "Cerrar la guía del diagrama", + "viewer.guide.inspecting": "Inspeccionando la semántica compilada", + "viewer.guide.actions": "Acciones de exploración del diagrama", + "viewer.guide.find": "Buscar cualquier nodo", + "viewer.guide.find.hint": "Busca por etiquetas, responsabilidades, tipos e IDs estables.", + "viewer.guide.route": "Trazar una ruta", + "viewer.guide.route.aria": "Trazar una ruta dirigida", + "viewer.guide.route.hint": "Pregunta cómo se conectan dos nodos semánticos en el sentido definido.", + "viewer.guide.map": "Ver todo el sistema", + "viewer.guide.map.hint": "Abre el Radar semántico con un viewport en vivo y nodos estables.", + "viewer.guide.lens": "Comparar tipos semánticos", + "viewer.guide.lens.hint": "Cuenta roles, revela su tráfico y compara enlaces directos definidos.", + "viewer.guide.present": "Entrar al modo presentación", + "viewer.guide.present.hint": "Dale al diagrama en vivo todo el viewport sin cambiar la exportación.", + "viewer.guide.shortcuts": "Atajos de teclado adicionales", + "viewer.guide.shortcut.export": "Exportar", + "viewer.guide.shortcut.theme": "Tema", + "viewer.guide.shortcut.style": "Estilo", + "viewer.guide.shortcut.reset": "Restablecer", + "viewer.guide.shortcut.zoomIn": "Acercar", + "viewer.guide.shortcut.zoomOut": "Alejar", + "viewer.guide.shortcut.close": "Cerrar", + "viewer.guide.facts": "{nodes} · {relationships}", + "viewer.guide.fact.node.one": "{count} nodo semántico", + "viewer.guide.fact.node.other": "{count} nodos semánticos", + "viewer.guide.fact.relationship.one": "{count} relación", + "viewer.guide.fact.relationship.other": "{count} relaciones", + "viewer.guide.open": "Abrir la guía del diagrama", + "viewer.finder.title": "Buscar un nodo", + "viewer.finder.close": "Cerrar el buscador de nodos", + "viewer.finder.placeholder": "Buscar etiquetas o IDs", + "viewer.finder.search": "Buscar nodos del diagrama", + "viewer.finder.results": "Nodos del diagrama", + "viewer.finder.empty": "No hay nodos coincidentes", + "viewer.finder.result.focus": "Enfocar {label}", + "viewer.finder.result.routeStart": "Elegir {label} como inicio de la ruta", + "viewer.finder.result.routeTarget": "Elegir {label} como destino de la ruta, {links}", + "viewer.finder.status.empty": "No hay nodos coincidentes", + "viewer.finder.status.count.one": "{count} nodo coincidente", + "viewer.finder.status.count.other": "{count} nodos coincidentes", + "viewer.finder.noun.nodes": "nodos", + "viewer.finder.link.one": "{count} enlace", + "viewer.finder.link.other": "{count} enlaces", + "viewer.finder.result.focus.one": "Enfocar {label}, {count} conexión relacionada", + "viewer.finder.result.focus.other": "Enfocar {label}, {count} conexiones relacionadas", + "viewer.finder.status.filtered": "{visible} de {available} {noun}", + "viewer.finder.status.all": "{available} {noun}", + "viewer.passport.eyebrow": "Pasaporte semántico", + "viewer.passport.metadata": "Metadatos del nodo", + "viewer.passport.evidence": "Evidencia de fuente verificada", + "viewer.passport.verified": "Fuente verificada", + "viewer.passport.verificationScope": "Verificado contra el Git local en la revisión fijada. No se ha comprobado el acceso remoto.", + "viewer.passport.reach": "Alcance definido", + "viewer.passport.reach.trace": "Trazar la alcanzabilidad definida", + "viewer.passport.upstream": "Ascendente", + "viewer.passport.downstream": "Descendente", + "viewer.passport.upstream.trace": "Trazar la alcanzabilidad definida ascendente", + "viewer.passport.downstream.trace": "Trazar la alcanzabilidad definida descendente", + "viewer.passport.close": "Cerrar el pasaporte semántico", + "viewer.passport.move": "Mover el pasaporte semántico. Arrastra, usa las flechas o pulsa Inicio para restablecer.", + "viewer.passport.copy": "Copiar enlace", + "viewer.passport.copy.focus": "Copiar enlace al nodo enfocado", + "viewer.passport.relations": "Relaciones", + "viewer.passport.relations.show": "Mostrar relaciones conectadas", + "viewer.passport.relations.hide": "Ocultar relaciones conectadas", + "viewer.passport.relations.list": "Relaciones conectadas", + "viewer.passport.copyRelation": "Copiar relación", + "viewer.passport.copyNode": "Copiar nodo", + "viewer.passport.copyPinned": "Copiar enlace a la relación fijada", + "viewer.passport.copySource": "Copiar enlace al nodo de origen", + "viewer.passport.copy.focused.success": "Enlace del nodo enfocado copiado", + "viewer.passport.copy.pinned.success": "Enlace de la relación fijada copiado", + "viewer.passport.copy.focused.failed": "No se pudo copiar el enlace del nodo enfocado", + "viewer.passport.copy.pinned.failed": "No se pudo copiar el enlace de la relación fijada", + "viewer.passport.relationship.none": "No hay relaciones conectadas", + "viewer.passport.relationship.count.one": "{count} relación", + "viewer.passport.relationship.count.other": "{count} relaciones", + "viewer.passport.relationship.show.one": "Mostrar {count} relación conectada", + "viewer.passport.relationship.show.other": "Mostrar {count} relaciones conectadas", + "viewer.passport.relationship.summary": "{out} salientes · {in} entrantes{loops}", + "viewer.passport.relationship.loops": " · {count} bucle", + "viewer.passport.relationship.explorer": "Explorador de relaciones directas", + "viewer.passport.relationship.help": "Usa las flechas para explorar las relaciones. Pulsa Enter o Espacio para fijar detalles; Escape las borra.", + "viewer.passport.relationship.loopsBack": "vuelve sobre sí mismo", + "viewer.passport.relationship.connectsTo": "conecta a", + "viewer.passport.relationship.connectsFrom": "conecta desde", + "viewer.passport.relationship.pinned": "Relación fijada · {from} → {to} · {label}", + "viewer.passport.relationship.inspect": "Inspeccionar relación {index} de {total}: {from} a {to}, {label}. Pulsa Enter para ver detalles.", + "viewer.passport.relationship.group.out": "Salientes", + "viewer.passport.relationship.group.in": "Entrantes", + "viewer.passport.relationship.group.loop": "Bucles propios", + "viewer.passport.relationship.row": "{group}: {relationship}, {neighbor}", + "viewer.passport.relationship.direction.out": "SAL →", + "viewer.passport.relationship.direction.in": "← ENT", + "viewer.passport.relationship.direction.loop": "BUCLE", + "viewer.passport.sourceCount.one": "{count} referencia de fuente verificada", + "viewer.passport.sourceCount.other": "{count} referencias de fuente verificadas", + "viewer.passport.sourceMarker": "SRC", + "viewer.passport.beacon.one": "{count} fuente verificada; enfoca este nodo para inspeccionar", + "viewer.passport.beacon.other": "{count} fuentes verificadas; enfoca este nodo para inspeccionar", + "viewer.passport.repository.open": "Abrir la revisión verificada del repositorio {revision}", + "viewer.passport.source.open": "Abrir la fuente verificada {path} en la revisión {revision}", + "viewer.passport.source.openLink": "Abrir ↗", + "viewer.passport.reach.upstream.one": "Trazar {count} nodo definido ascendente", + "viewer.passport.reach.upstream.other": "Trazar {count} nodos definidos ascendentes", + "viewer.passport.reach.downstream.one": "Trazar {count} nodo definido descendente", + "viewer.passport.reach.downstream.other": "Trazar {count} nodos definidos descendentes", + "viewer.passport.reach.noUpstream": "No hay nodos definidos ascendentes", + "viewer.passport.reach.noDownstream": "No hay nodos definidos descendentes", + "viewer.passport.reach.status": "{direction} · {nodes} nodos · {links} enlaces · máx {hops} saltos", + "viewer.route.eyebrow": "Ruta", + "viewer.route.start": "Haz clic donde empieza la ruta", + "viewer.route.start.find": "Buscar inicio", + "viewer.route.start.find.aria": "Buscar un inicio de ruta", + "viewer.route.copy": "Copiar enlace", + "viewer.route.copy.aria": "Copiar enlace a la ruta trazada", + "viewer.route.clear": "Borrar", + "viewer.route.clear.aria": "Borrar la sonda de ruta", + "viewer.route.traced": "Ruta", + "viewer.route.pickTwo": "Haz clic en dos nodos del diagrama", + "viewer.route.pickOne": "Haz clic en un nodo del diagrama", + "viewer.route.controls": "Controles del recorrido de la ruta", + "viewer.route.previous": "Posición anterior de la ruta", + "viewer.route.play": "Reproducir el recorrido de la ruta", + "viewer.route.pause": "Pausar el recorrido de la ruta", + "viewer.route.replay": "Repetir el recorrido de la ruta", + "viewer.route.next": "Posición siguiente de la ruta", + "viewer.route.journey": "Recorrido", + "viewer.route.pause.label": "Pausar", + "viewer.route.replay.label": "Repetir", + "viewer.route.overview": "Vista general", + "viewer.route.overview.aria": "Mostrar la vista general completa de la ruta", + "viewer.route.instructions": "Haz clic en un inicio y luego en un final. La ruta sigue las flechas.", + "viewer.route.destination": "¿Dónde termina la ruta desde {label}?", + "viewer.route.destination.find": "Buscar destino", + "viewer.route.destination.find.aria": "Buscar un destino de ruta alcanzable", + "viewer.route.differentDestination": "Elige un destino diferente", + "viewer.route.distinct": "Elige dos nodos distintos.", + "viewer.route.unreachable": "No se llega a {label} desde aquí", + "viewer.route.unreachable.detail": "No se llega a {target} desde {source} siguiendo las flechas. Elige un nodo resaltado.", + "viewer.route.start.instructions": "Luego elige el final. Solo se iluminan los nodos alcanzables.", + "viewer.route.copy.success": "Enlace de la ruta trazada copiado", + "viewer.route.copy.failed": "No se pudo copiar el enlace de la ruta trazada", + "viewer.route.position": "Posición de la ruta {index} de {total}: {label}", + "viewer.route.step": "Paso {index} de {total} · {phase} · {label}", + "viewer.route.motionRequired": "El recorrido automático requiere la animación Activa", + "viewer.route.trigger.clear": "Borrar la ruta trazada", + "viewer.route.overview.status": "{nodes} · {hops} · ruta más corta", + "viewer.route.overview.node.one": "{count} nodo", + "viewer.route.overview.node.other": "{count} nodos", + "viewer.route.overview.hop.one": "{count} paso", + "viewer.route.overview.hop.other": "{count} pasos", + "viewer.route.phase.playing": "Reproduciendo", + "viewer.route.phase.complete": "Completo", + "viewer.route.phase.inspecting": "Inspeccionando", + "viewer.route.destination.count.one": "{count} nodo alcanzable está resaltado. Haz clic en él.", + "viewer.route.destination.count.other": "{count} nodos alcanzables están resaltados. Haz clic en uno.", + "viewer.route.noOutgoing": "Ninguna flecha sale de este nodo. Bórralo y elige otro inicio.", + "viewer.route.result.title": "{source} a {target}", + "viewer.route.finder.source.title": "Elegir el inicio de la ruta", + "viewer.route.finder.source.placeholder": "Buscar orígenes de ruta", + "viewer.route.finder.source.empty": "No hay orígenes de ruta coincidentes", + "viewer.route.finder.source.results": "Nodos que pueden iniciar una ruta", + "viewer.route.finder.source.noun": "orígenes de ruta", + "viewer.route.finder.source.badge": "inicio", + "viewer.route.finder.target.title": "Destino desde {label}", + "viewer.route.finder.target.placeholder": "Buscar destinos alcanzables", + "viewer.route.finder.target.empty": "No hay destinos alcanzables coincidentes", + "viewer.route.finder.target.results": "Destinos de ruta alcanzables", + "viewer.route.finder.target.noun": "destinos alcanzables", + "viewer.route.hop.one": "{count} salto", + "viewer.route.hop.other": "{count} saltos", + "viewer.lens.eyebrow": "Lente semántico", + "viewer.lens.title": "Comparar roles del sistema", + "viewer.lens.close": "Cerrar el lente semántico", + "viewer.lens.instruction": "Elige hasta dos tipos semánticos. Uno revela su tráfico real; dos comparan solo las relaciones directas definidas.", + "viewer.lens.kinds": "Tipos semánticos", + "viewer.lens.choose": "Elige un tipo para inspeccionar sus nodos y las relaciones que lo tocan.", + "viewer.lens.copy": "Copiar enlace al lente semántico", + "viewer.lens.clear": "Borrar el lente semántico", + "viewer.lens.open": "Abrir el lente semántico", + "viewer.lens.openActive": "Abrir el lente semántico activo", + "viewer.lens.legend": "Leyenda semántica", + "viewer.lens.legend.inspect.one": "Inspeccionar {label}, {count} nodo", + "viewer.lens.legend.inspect.other": "Inspeccionar {label}, {count} nodos", + "viewer.lens.kind.count.one": "{label}, {count} nodo", + "viewer.lens.kind.count.other": "{label}, {count} nodos", + "viewer.lens.compare.one": "{first} → {second}: {forward} · {second} → {first}: {reverse} · {count} relación directa", + "viewer.lens.compare.other": "{first} → {second}: {forward} · {second} → {first}: {reverse} · {count} relaciones directas", + "viewer.lens.single": "{nodes} · {relationships} · los pares conectados permanecen visibles", + "viewer.lens.node.one": "{count} nodo {label}", + "viewer.lens.node.other": "{count} nodos {label}", + "viewer.lens.relationship.one": "{count} relación en contacto", + "viewer.lens.relationship.other": "{count} relaciones en contacto", + "viewer.radar.title": "Radar semántico", + "viewer.radar.building": "Construyendo la vista general", + "viewer.radar.openFull": "Abrir el radar semántico completo", + "viewer.radar.open": "Abrir el radar", + "viewer.radar.close": "Cerrar el radar semántico", + "viewer.radar.surface": "Vista general del diagrama. Haz clic en un nodo para enfocarlo, o usa las flechas para desplazarte.", + "viewer.radar.click": "Clic en el nodo", + "viewer.radar.drag": "Arrastra para desplazar", + "viewer.radar.space": "El radar semántico necesita más espacio de MAPA.", + "viewer.radar.nodes": "Nodos del radar del diagrama semántico", + "viewer.radar.focus": "Enfocar {label} desde el Radar semántico", + "viewer.radar.status": "{count} nodos · {viewport}", + "viewer.radar.fullMap": "{count} nodos · mapa completo", + "viewer.radar.compacted": "Radar compactado para no tapar el Pasaporte semántico ni los controles de MAPA.", + "viewer.radar.cancelWaiting": "Cancelar la espera del radar semántico por más espacio de MAPA", + "viewer.radar.needsSpace": "El radar semántico necesita más espacio de MAPA visible", + "viewer.radar.viewport.full": "mapa completo", + "viewer.radar.viewport.width": "{percent}% de ancho", + "viewer.radar.viewport.scale": "{percent}% del viewport", + "viewer.nav.controls": "Controles de vista del diagrama", + "viewer.nav.route": "Trazar una ruta dirigida", + "viewer.nav.route.title": "Trazar ruta (R)", + "viewer.nav.route.short": "RUTA", + "viewer.nav.radar": "Abrir el radar semántico", + "viewer.nav.radar.title": "Radar semántico (M)", + "viewer.nav.radar.short": "MAPA", + "viewer.nav.lens": "Abrir el lente semántico", + "viewer.nav.lens.title": "Lente semántico (L)", + "viewer.nav.lens.short": "LENTE", + "viewer.nav.find": "Buscar un nodo", + "viewer.nav.find.title": "Buscar un nodo (/)", + "viewer.outline.title": "Índice de nodos", + "viewer.rail.show": "Notas e índice", + "viewer.rail.controls": "Panel lateral", + "viewer.rail.collapse": "Contraer panel lateral", + "viewer.rail.bottom": "Mover el panel debajo", + "viewer.rail.right": "Mover el panel al lado", + "viewer.nav.guide": "Abrir la guía del diagrama", + "viewer.nav.guide.title": "Guía del diagrama (?)", + "viewer.nav.zoomOut": "Alejar", + "viewer.nav.zoomOut.title": "Alejar (-)", + "viewer.nav.reset": "Restablecer la vista del diagrama", + "viewer.nav.reset.title": "Restablecer vista (0)", + "viewer.nav.read": "LEER", + "viewer.nav.zoomIn": "Acercar", + "viewer.nav.zoomIn.title": "Acercar (+)", + "viewer.nav.camera": "{hint}. Restablecer la vista del diagrama", + "viewer.nav.camera.title": "{semantic}{hint} · restablecer vista (0)", + "viewer.nav.camera.semantic": "Cámara semántica activa · ", + "viewer.nav.level.map": "MAPA", + "viewer.nav.level.read": "LEER", + "viewer.nav.level.full": "COMPLETO", + "viewer.nav.level.auto": "AUTO", + "viewer.nav.detail.map": "Acerca para revelar las etiquetas de relación y el contexto de los nodos", + "viewer.nav.detail.read": "Acerca de nuevo para revelar etiquetas y anotaciones", + "viewer.nav.detail.full": "Detalle completo del diagrama", + "viewer.intent.summary": "{label}. {out} salientes, {in} entrantes{loops}. {total} conexiones. Pulsa Enter para ver detalles.", + "viewer.intent.loops": ", {count} bucle propio", + "viewer.common.copied": "Copiado", + "viewer.common.copyFailed": "Error al copiar", + "viewer.common.copyLink": "Copiar enlace", + "viewer.common.clear": "Borrar", + "viewer.common.close": "Cerrar" +} diff --git a/packages/diagram-core/vendor/archify/examples/locales/fr.json b/packages/diagram-core/vendor/archify/examples/locales/fr.json new file mode 100644 index 0000000..d9b1e8d --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/locales/fr.json @@ -0,0 +1,425 @@ +{ + "page.title": "Diagramme {title}", + "diagram.description.architecture": "Un diagramme d'architecture généré par Archify.", + "diagram.description.workflow": "Un diagramme de workflow généré par Archify.", + "diagram.description.sequence": "Un diagramme de séquence généré par Archify.", + "diagram.description.dataflow": "Un diagramme de flux de données généré par Archify.", + "diagram.description.lifecycle": "Un diagramme de cycle de vie généré par Archify.", + "node.focus": "Centrer sur {label}", + "node.focus.detail": "Centrer sur {label}, {detail}", + "node.context.architecture": "Composant d'architecture", + "node.context.workflow": "Nœud de workflow", + "node.context.sequence": "Participant de séquence", + "node.context.dataflow": "Nœud de flux de données", + "node.context.lifecycle": "État de cycle de vie", + "legend.title": "Légende", + "legend.architecture.frontend": "Frontend", + "legend.architecture.backend": "Backend", + "legend.architecture.database": "Base de données", + "legend.architecture.cloud": "Cloud", + "legend.architecture.security": "Sécurité", + "legend.architecture.messagebus": "Bus de messages", + "legend.architecture.external": "Externe", + "legend.workflow.frontend": "Interface utilisateur", + "legend.workflow.backend": "Logique de l'agent", + "legend.workflow.security": "Politique", + "legend.workflow.messagebus": "Action d'outil", + "legend.workflow.database": "Contexte / trace", + "legend.workflow.cloud": "Service cloud", + "legend.workflow.external": "Système externe", + "legend.sequence.emphasis": "requête principale", + "legend.sequence.return": "retour", + "legend.sequence.security": "sécurité", + "legend.sequence.dashed": "trace asynchrone", + "legend.sequence.default": "message", + "legend.dataflow.emphasis": "donnée principale", + "legend.dataflow.security": "politique / PII", + "legend.dataflow.dashed": "lot asynchrone", + "legend.dataflow.database": "entrepôt de données", + "legend.dataflow.default": "flux de données", + "legend.lifecycle.start": "état initial", + "legend.lifecycle.active": "actif", + "legend.lifecycle.waiting": "attente", + "legend.lifecycle.decision": "décision", + "legend.lifecycle.success": "succès", + "legend.lifecycle.failure": "échec / sortie", + "legend.lifecycle.neutral": "neutre", + "legend.lifecycle.external": "externe", + "legend.lifecycle.final": "état final", + "viewer.kind.frontend": "Frontend", + "viewer.kind.backend": "Backend", + "viewer.kind.database": "Base de données", + "viewer.kind.cloud": "Cloud", + "viewer.kind.security": "Sécurité", + "viewer.kind.messagebus": "Bus de messages", + "viewer.kind.external": "Externe", + "viewer.kind.neutral": "Neutre", + "viewer.kind.node": "Nœud", + "viewer.kind.start": "Début", + "viewer.kind.active": "Actif", + "viewer.kind.waiting": "En attente", + "viewer.kind.decision": "Décision", + "viewer.kind.success": "Succès", + "viewer.kind.failure": "Échec", + "viewer.toolbar.actions": "Actions du diagramme", + "viewer.theme.toggle.title": "Changer de thème (T)", + "viewer.theme.toggle": "Changer le thème de couleur", + "viewer.theme.dark": "Sombre", + "viewer.theme.light": "Clair", + "viewer.preset.choose.title": "Choisir le style visuel (S pour changer)", + "viewer.preset.choose": "Choisir le style visuel", + "viewer.preset.style": "Style", + "viewer.preset.menu": "Style visuel", + "viewer.preset.identity": "Identité visuelle", + "viewer.preset.cycles": "S pour changer", + "viewer.preset.classic": "Classic", + "viewer.preset.classic.short": "Classic", + "viewer.preset.classic.hint": "Style technique stable par défaut", + "viewer.preset.flow": "Flux de signal", + "viewer.preset.flow.short": "Flux", + "viewer.preset.flow.hint": "Présentation animée et dynamique", + "viewer.preset.blueprint": "Plan", + "viewer.preset.blueprint.hint": "Revue technique", + "viewer.preset.editorial": "Éditorial", + "viewer.preset.editorial.hint": "Notes de publication et de lancement", + "viewer.preset.badge.signalFlow": "FLUX DE SIGNAL", + "viewer.preset.badge.blueprint": "PLAN / RÉV. 01", + "viewer.preset.badge.editorial": "ÉDITORIAL / NOTE DE TERRAIN", + "viewer.preset.badge.editorialPlate": "ARCHIFY / PLANCHE 04", + "viewer.preset.current": "Style visuel : {style}. Choisir le style visuel", + "viewer.motion.live": "Animé", + "viewer.motion.still": "Statique", + "viewer.motion.pause": "Mettre l'animation en pause", + "viewer.motion.resume": "Reprendre l'animation", + "viewer.motion.reduced": "Animation suspendue en raison de la préférence de mouvement réduit", + "viewer.motion.hidden": "Animation suspendue pendant que la page est masquée", + "viewer.motion.yielding": "Mettre l'animation en pause ; cède actuellement la place à {owner}", + "viewer.motion.yielding.title": "Aperçu en direct activé · cède la place à {owner}", + "viewer.owner.route": "Sonde d'itinéraire", + "viewer.owner.lens": "Lentille sémantique", + "viewer.owner.relationship": "Aperçu de relation", + "viewer.owner.intent": "Trace d'intention", + "viewer.owner.focus": "le focus sémantique", + "viewer.owner.legend": "l'aperçu de la légende", + "viewer.owner.reader": "l'interaction du lecteur", + "viewer.present.enter": "Entrer en mode présentation", + "viewer.present.enter.title": "Mode présentation (F)", + "viewer.present.exit": "Quitter le mode présentation", + "viewer.present.exit.title": "Quitter le mode présentation (F ou Échap)", + "viewer.present.present": "Présenter", + "viewer.present.exit.label": "Quitter", + "viewer.export.button": "Exporter", + "viewer.export.button.title": "Exporter le diagramme (E)", + "viewer.export.diagram": "Exporter le diagramme", + "viewer.export.menu": "Exporter", + "viewer.export.subtitle": "Des exports portables et soignés", + "viewer.export.share": "Partager", + "viewer.export.shareCard": "Carte de partage", + "viewer.export.routeShareCard": "Carte de partage d'itinéraire", + "viewer.export.reachShareCard": "Carte de partage de portée", + "viewer.export.copyDiagram": "Copier le diagramme", + "viewer.export.clipboardPng": "PNG vers le presse-papiers", + "viewer.export.raster": "Images matricielles", + "viewer.export.image": "Image", + "viewer.export.lossless": "Image sans perte", + "viewer.export.compact": "Image compacte", + "viewer.export.modern": "Image au format moderne", + "viewer.export.vectorMotion": "Vecteur et animation", + "viewer.export.vectorMotion.heading": "Vecteur et animation", + "viewer.export.editable": "Vecteur modifiable", + "viewer.export.motion6s": "Animation de 6 s", + "viewer.export.unsupported": "Non pris en charge par ce navigateur", + "viewer.export.clipboardUnsupported": "L'écriture d'image dans le presse-papiers n'est pas prise en charge par ce navigateur", + "viewer.export.clipboardUnsupported.short": "L'écriture d'image dans le presse-papiers n'est pas prise en charge par ce navigateur.", + "viewer.export.motionUnavailable": "Capture d'animation indisponible dans ce navigateur", + "viewer.export.webmUnavailable": "WebM indisponible dans ce navigateur", + "viewer.export.failed": "Échec de l'export : {message}", + "viewer.export.unknownVariant": "Variante de carte de partage inconnue : {variant}", + "viewer.export.routeRequired": "Tracez un itinéraire avant d'exporter une carte de partage d'itinéraire", + "viewer.export.reachRequired": "Tracez une portée éditée avant d'exporter une carte de partage de portée", + "viewer.export.unknown": "inconnu", + "viewer.export.routeFailed": "Échec de l'export de la carte de partage d'itinéraire : {message}", + "viewer.export.reachFailed": "Échec de l'export de la carte de partage de portée : {message}", + "viewer.export.copyFailed": "Échec de la copie : {message}", + "viewer.export.copiedPng": "PNG copié dans le presse-papiers", + "viewer.export.downloadedRoute": "Carte de partage d'itinéraire téléchargée", + "viewer.export.downloadedReach": "Carte de partage de portée téléchargée", + "viewer.export.downloadedWebm": "WebM téléchargé", + "viewer.export.recording": "Enregistrement de 6 secondes d'animation…", + "viewer.export.card.routeSummary.one": "Itinéraire : {source} → {target} · {count} saut orienté", + "viewer.export.card.routeSummary.other": "Itinéraire : {source} → {target} · {count} sauts orientés", + "viewer.export.card.reachSummary": "Portée {direction} éditée depuis {origin} · {nodes} · {links} · max {hops}", + "viewer.export.card.node.one": "{count} nœud", + "viewer.export.card.node.other": "{count} nœuds", + "viewer.export.card.link.one": "{count} lien", + "viewer.export.card.link.other": "{count} liens", + "viewer.export.card.hop.one": "{count} saut", + "viewer.export.card.hop.other": "{count} sauts", + "viewer.export.card.routeBadge": "ARCHIFY · ITINÉRAIRE · {hops}", + "viewer.export.card.reachBadge": "ARCHIFY · PORTÉE {direction}", + "viewer.export.direction.upstream": "Amont", + "viewer.export.direction.downstream": "Aval", + "viewer.export.error.canvasUnavailable": "Canevas indisponible pour {label}", + "viewer.export.error.contextUnavailable": "Contexte de canevas 2D indisponible pour {label}", + "viewer.export.error.toBlobUnavailable": "canvas.toBlob indisponible pour {label}", + "viewer.export.error.toBlobNull": "canvas.toBlob n'a renvoyé aucune donnée pour {label}", + "viewer.export.error.variantsCombined": "Les variantes de carte de partage ne peuvent pas être combinées", + "viewer.export.error.viewerState": "L'export de la carte de partage n'a pas pu supprimer l'état temporaire du visualiseur", + "viewer.export.error.routeState": "L'export de la carte d'itinéraire n'a pas pu préserver l'itinéraire résolu en toute sécurité", + "viewer.export.error.reachState": "L'export de la carte de portée n'a pas pu préserver la portée éditée en toute sécurité", + "viewer.export.error.webmRequirements": "L'export d'animation WebM nécessite une animation de trace et la prise en charge de MediaRecorder par le navigateur", + "viewer.export.error.mediaRecorder": "Échec de MediaRecorder", + "viewer.export.error.emptyWebm": "MediaRecorder a produit un fichier WebM vide", + "viewer.export.error.webmBackground": "L'arrière-plan SVG n'a pas pu être chargé pour l'export WebM", + "viewer.guide.eyebrow": "Guide du diagramme", + "viewer.guide.close": "Fermer le guide du diagramme", + "viewer.guide.inspecting": "Inspection de la sémantique compilée", + "viewer.guide.actions": "Actions d'exploration du diagramme", + "viewer.guide.find": "Trouver un nœud", + "viewer.guide.find.hint": "Rechercher par libellés, responsabilités, types et identifiants stables.", + "viewer.guide.route": "Tracer un itinéraire", + "viewer.guide.route.aria": "Tracer un itinéraire orienté", + "viewer.guide.route.hint": "Découvrez comment deux nœuds sémantiques sont reliés dans le sens édité.", + "viewer.guide.map": "Voir tout le système", + "viewer.guide.map.hint": "Ouvrir le radar sémantique avec un viewport en direct et des nœuds stables.", + "viewer.guide.lens": "Comparer les types sémantiques", + "viewer.guide.lens.hint": "Comptez les rôles, révélez leur trafic et comparez les liens édités directs.", + "viewer.guide.present": "Entrer en mode présentation", + "viewer.guide.present.hint": "Donnez tout le viewport au diagramme en direct sans modifier l'export.", + "viewer.guide.shortcuts": "Raccourcis clavier supplémentaires", + "viewer.guide.shortcut.export": "Exporter", + "viewer.guide.shortcut.theme": "Thème", + "viewer.guide.shortcut.style": "Style", + "viewer.guide.shortcut.reset": "Réinitialiser", + "viewer.guide.shortcut.zoomIn": "Zoom avant", + "viewer.guide.shortcut.zoomOut": "Zoom arrière", + "viewer.guide.shortcut.close": "Fermer", + "viewer.guide.facts": "{nodes} · {relationships}", + "viewer.guide.fact.node.one": "{count} nœud sémantique", + "viewer.guide.fact.node.other": "{count} nœuds sémantiques", + "viewer.guide.fact.relationship.one": "{count} relation", + "viewer.guide.fact.relationship.other": "{count} relations", + "viewer.guide.open": "Ouvrir le guide du diagramme", + "viewer.finder.title": "Trouver un nœud", + "viewer.finder.close": "Fermer le chercheur de nœuds", + "viewer.finder.placeholder": "Rechercher par libellé ou identifiant", + "viewer.finder.search": "Rechercher les nœuds du diagramme", + "viewer.finder.results": "Nœuds du diagramme", + "viewer.finder.empty": "Aucun nœud correspondant", + "viewer.finder.result.focus": "Centrer sur {label}", + "viewer.finder.result.routeStart": "Choisir {label} comme point de départ de l'itinéraire", + "viewer.finder.result.routeTarget": "Choisir {label} comme destination de l'itinéraire, {links}", + "viewer.finder.status.empty": "Aucun nœud correspondant", + "viewer.finder.status.count.one": "{count} nœud correspondant", + "viewer.finder.status.count.other": "{count} nœuds correspondants", + "viewer.finder.noun.nodes": "nœuds", + "viewer.finder.link.one": "{count} lien", + "viewer.finder.link.other": "{count} liens", + "viewer.finder.result.focus.one": "Centrer sur {label}, {count} connexion associée", + "viewer.finder.result.focus.other": "Centrer sur {label}, {count} connexions associées", + "viewer.finder.status.filtered": "{visible} sur {available} {noun}", + "viewer.finder.status.all": "{available} {noun}", + "viewer.passport.eyebrow": "Passeport sémantique", + "viewer.passport.metadata": "Métadonnées du nœud", + "viewer.passport.evidence": "Preuve de source vérifiée", + "viewer.passport.verified": "Source vérifiée", + "viewer.passport.verificationScope": "Vérifié par rapport au Git local à la révision épinglée. L'accès distant n'a pas été vérifié.", + "viewer.passport.reach": "Portée éditée", + "viewer.passport.reach.trace": "Tracer l'accessibilité éditée", + "viewer.passport.upstream": "Amont", + "viewer.passport.downstream": "Aval", + "viewer.passport.upstream.trace": "Tracer l'accessibilité éditée en amont", + "viewer.passport.downstream.trace": "Tracer l'accessibilité éditée en aval", + "viewer.passport.close": "Fermer le passeport sémantique", + "viewer.passport.copy": "Copier le lien", + "viewer.passport.copy.focus": "Copier le lien du nœud centré", + "viewer.passport.relations": "Relations", + "viewer.passport.relations.show": "Afficher les relations connectées", + "viewer.passport.relations.hide": "Masquer les relations connectées", + "viewer.passport.relations.list": "Relations connectées", + "viewer.passport.copyRelation": "Copier la relation", + "viewer.passport.copyNode": "Copier le nœud", + "viewer.passport.copyPinned": "Copier le lien de la relation épinglée", + "viewer.passport.copySource": "Copier le lien du nœud source", + "viewer.passport.copy.focused.success": "Lien du nœud centré copié", + "viewer.passport.copy.pinned.success": "Lien de la relation épinglée copié", + "viewer.passport.copy.focused.failed": "Impossible de copier le lien du nœud centré", + "viewer.passport.copy.pinned.failed": "Impossible de copier le lien de la relation épinglée", + "viewer.passport.relationship.none": "Aucune relation connectée", + "viewer.passport.relationship.count.one": "{count} relation", + "viewer.passport.relationship.count.other": "{count} relations", + "viewer.passport.relationship.show.one": "Afficher {count} relation connectée", + "viewer.passport.relationship.show.other": "Afficher {count} relations connectées", + "viewer.passport.relationship.summary": "{out} sortantes · {in} entrantes{loops}", + "viewer.passport.relationship.loops": " · {count} boucle", + "viewer.passport.relationship.explorer": "Explorateur de relations directes", + "viewer.passport.relationship.help": "Utilisez les flèches pour explorer les relations. Appuyez sur Entrée ou Espace pour épingler les détails ; Échap efface.", + "viewer.passport.relationship.loopsBack": "boucle vers", + "viewer.passport.relationship.connectsTo": "se connecte à", + "viewer.passport.relationship.connectsFrom": "se connecte depuis", + "viewer.passport.relationship.pinned": "Relation épinglée · {from} → {to} · {label}", + "viewer.passport.relationship.inspect": "Inspecter la relation {index} sur {total} : {from} vers {to}, {label}. Appuyez sur Entrée pour les détails.", + "viewer.passport.relationship.group.out": "Sortantes", + "viewer.passport.relationship.group.in": "Entrantes", + "viewer.passport.relationship.group.loop": "Boucles propres", + "viewer.passport.relationship.row": "{group} : {relationship}, {neighbor}", + "viewer.passport.relationship.direction.out": "SORT →", + "viewer.passport.relationship.direction.in": "← ENTRE", + "viewer.passport.relationship.direction.loop": "BOUCLE", + "viewer.passport.sourceCount.one": "{count} référence de source vérifiée", + "viewer.passport.sourceCount.other": "{count} références de source vérifiées", + "viewer.passport.sourceMarker": "SOURCE", + "viewer.passport.beacon.one": "{count} source vérifiée ; centrez ce nœud pour l'inspecter", + "viewer.passport.beacon.other": "{count} sources vérifiées ; centrez ce nœud pour l'inspecter", + "viewer.passport.repository.open": "Ouvrir la révision {revision} du dépôt vérifié", + "viewer.passport.source.open": "Ouvrir la source vérifiée {path} à la révision {revision}", + "viewer.passport.source.openLink": "Ouvrir ↗", + "viewer.passport.reach.upstream.one": "Tracer {count} nœud édité en amont", + "viewer.passport.reach.upstream.other": "Tracer {count} nœuds édités en amont", + "viewer.passport.reach.downstream.one": "Tracer {count} nœud édité en aval", + "viewer.passport.reach.downstream.other": "Tracer {count} nœuds édités en aval", + "viewer.passport.reach.noUpstream": "Aucun nœud édité en amont", + "viewer.passport.reach.noDownstream": "Aucun nœud édité en aval", + "viewer.passport.reach.status": "{direction} · {nodes} nœuds · {links} liens · max {hops} sauts", + "viewer.route.eyebrow": "Sonde d'itinéraire", + "viewer.route.start": "Choisir un nœud de départ", + "viewer.route.start.find": "Trouver le départ", + "viewer.route.start.find.aria": "Trouver un départ d'itinéraire", + "viewer.route.copy": "Copier le lien", + "viewer.route.copy.aria": "Copier le lien de l'itinéraire tracé", + "viewer.route.clear": "Effacer", + "viewer.route.clear.aria": "Effacer la sonde d'itinéraire", + "viewer.route.traced": "Itinéraire tracé", + "viewer.route.pickTwo": "Choisissez deux nœuds sémantiques sur le diagramme", + "viewer.route.pickOne": "Choisissez un nœud sémantique sur le diagramme", + "viewer.route.controls": "Contrôles du parcours d'itinéraire", + "viewer.route.previous": "Position précédente de l'itinéraire", + "viewer.route.play": "Lire le parcours de l'itinéraire", + "viewer.route.pause": "Mettre le parcours de l'itinéraire en pause", + "viewer.route.replay": "Rejouer le parcours de l'itinéraire", + "viewer.route.next": "Position suivante de l'itinéraire", + "viewer.route.journey": "Parcours", + "viewer.route.pause.label": "Pause", + "viewer.route.replay.label": "Rejouer", + "viewer.route.overview": "Vue d'ensemble", + "viewer.route.overview.aria": "Afficher la vue d'ensemble complète de l'itinéraire", + "viewer.route.instructions": "Choisissez la source, puis la destination. Le sens compte.", + "viewer.route.destination": "Choisir une destination depuis {label}", + "viewer.route.destination.find": "Trouver une cible", + "viewer.route.destination.find.aria": "Trouver une destination d'itinéraire accessible", + "viewer.route.differentDestination": "Choisir une autre destination", + "viewer.route.distinct": "Un itinéraire nécessite deux nœuds sémantiques distincts.", + "viewer.route.unreachable": "Aucun itinéraire orienté vers {label}", + "viewer.route.unreachable.detail": "{target} n'est pas accessible depuis {source}. Choisissez une destination surlignée.", + "viewer.route.start.instructions": "Sélectionnez la source. L'étape suivante ne révélera que les destinations orientées.", + "viewer.route.copy.success": "Lien de l'itinéraire tracé copié", + "viewer.route.copy.failed": "Impossible de copier le lien de l'itinéraire tracé", + "viewer.route.position": "Position {index} sur {total} de l'itinéraire : {label}", + "viewer.route.step": "Étape {index} sur {total} · {phase} · {label}", + "viewer.route.motionRequired": "Le parcours automatique nécessite le mode Animé", + "viewer.route.trigger.clear": "Effacer l'itinéraire tracé", + "viewer.route.overview.status": "{nodes} · {hops} · itinéraire édité le plus court", + "viewer.route.overview.node.one": "{count} nœud", + "viewer.route.overview.node.other": "{count} nœuds", + "viewer.route.overview.hop.one": "{count} saut orienté", + "viewer.route.overview.hop.other": "{count} sauts orientés", + "viewer.route.phase.playing": "En lecture", + "viewer.route.phase.complete": "Terminé", + "viewer.route.phase.inspecting": "Inspection", + "viewer.route.destination.count.one": "{count} destination orientée disponible. Choisissez un nœud surligné.", + "viewer.route.destination.count.other": "{count} destinations orientées disponibles. Choisissez un nœud surligné.", + "viewer.route.noOutgoing": "Aucun itinéraire sortant ne débute ici. Effacez et choisissez une autre source.", + "viewer.route.result.title": "{source} vers {target}", + "viewer.route.finder.source.title": "Choisir le départ de l'itinéraire", + "viewer.route.finder.source.placeholder": "Rechercher des sources d'itinéraire", + "viewer.route.finder.source.empty": "Aucune source d'itinéraire correspondante", + "viewer.route.finder.source.results": "Nœuds pouvant débuter un itinéraire", + "viewer.route.finder.source.noun": "sources d'itinéraire", + "viewer.route.finder.source.badge": "départ", + "viewer.route.finder.target.title": "Destination depuis {label}", + "viewer.route.finder.target.placeholder": "Rechercher des destinations accessibles", + "viewer.route.finder.target.empty": "Aucune destination accessible correspondante", + "viewer.route.finder.target.results": "Destinations d'itinéraire accessibles", + "viewer.route.finder.target.noun": "destinations accessibles", + "viewer.route.hop.one": "{count} saut", + "viewer.route.hop.other": "{count} sauts", + "viewer.lens.eyebrow": "Lentille sémantique", + "viewer.lens.title": "Comparer les rôles du système", + "viewer.lens.close": "Fermer la lentille sémantique", + "viewer.lens.instruction": "Choisissez jusqu'à deux types sémantiques. Un seul révèle son trafic réel ; deux comparent uniquement les relations éditées directes.", + "viewer.lens.kinds": "Types sémantiques", + "viewer.lens.choose": "Choisissez un type pour inspecter ses nœuds et relations associées.", + "viewer.lens.copy": "Copier le lien de la lentille sémantique", + "viewer.lens.clear": "Effacer la lentille sémantique", + "viewer.lens.open": "Ouvrir la lentille sémantique", + "viewer.lens.openActive": "Ouvrir la lentille sémantique active", + "viewer.lens.legend": "Légende sémantique", + "viewer.lens.legend.inspect.one": "Inspecter {label}, {count} nœud", + "viewer.lens.legend.inspect.other": "Inspecter {label}, {count} nœuds", + "viewer.lens.kind.count.one": "{label}, {count} nœud", + "viewer.lens.kind.count.other": "{label}, {count} nœuds", + "viewer.lens.compare.one": "{first} → {second} : {forward} · {second} → {first} : {reverse} · {count} relation directe", + "viewer.lens.compare.other": "{first} → {second} : {forward} · {second} → {first} : {reverse} · {count} relations directes", + "viewer.lens.single": "{nodes} · {relationships} · les nœuds connectés restent visibles", + "viewer.lens.node.one": "{count} nœud {label}", + "viewer.lens.node.other": "{count} nœuds {label}", + "viewer.lens.relationship.one": "{count} relation associée", + "viewer.lens.relationship.other": "{count} relations associées", + "viewer.radar.title": "Radar sémantique", + "viewer.radar.building": "Construction de la vue d'ensemble", + "viewer.radar.openFull": "Ouvrir le radar sémantique complet", + "viewer.radar.open": "Ouvrir le radar", + "viewer.radar.close": "Fermer le radar sémantique", + "viewer.radar.surface": "Vue d'ensemble du diagramme. Cliquez sur un nœud pour le centrer, ou utilisez les flèches pour vous déplacer.", + "viewer.radar.click": "Cliquer sur le nœud", + "viewer.radar.drag": "Glisser pour se déplacer", + "viewer.radar.space": "Le radar sémantique a besoin de plus d'espace MAP.", + "viewer.radar.nodes": "Nœuds du radar du diagramme sémantique", + "viewer.radar.focus": "Centrer sur {label} depuis le radar sémantique", + "viewer.radar.status": "{count} nœuds · {viewport}", + "viewer.radar.fullMap": "{count} nœuds · carte complète", + "viewer.radar.compacted": "Radar compacté pour éviter de masquer le passeport sémantique ou les contrôles MAP.", + "viewer.radar.cancelWaiting": "Annuler l'attente du radar sémantique pour plus d'espace MAP", + "viewer.radar.needsSpace": "Le radar sémantique a besoin de plus d'espace MAP visible", + "viewer.radar.viewport.full": "carte complète", + "viewer.radar.viewport.width": "{percent} % de largeur", + "viewer.radar.viewport.scale": "{percent} % du viewport", + "viewer.nav.controls": "Contrôles de la vue du diagramme", + "viewer.nav.route": "Tracer un itinéraire orienté", + "viewer.nav.route.title": "Tracer l'itinéraire (R)", + "viewer.nav.route.short": "ROUTE", + "viewer.nav.radar": "Ouvrir le radar sémantique", + "viewer.nav.radar.title": "Radar sémantique (M)", + "viewer.nav.radar.short": "CARTE", + "viewer.nav.lens": "Ouvrir la lentille sémantique", + "viewer.nav.lens.title": "Lentille sémantique (L)", + "viewer.nav.lens.short": "LENTILLE", + "viewer.nav.find": "Trouver un nœud", + "viewer.nav.find.title": "Trouver un nœud (/)", + "viewer.nav.guide": "Ouvrir le guide du diagramme", + "viewer.nav.guide.title": "Guide du diagramme (?)", + "viewer.nav.zoomOut": "Zoom arrière", + "viewer.nav.zoomOut.title": "Zoom arrière (-)", + "viewer.nav.reset": "Réinitialiser la vue du diagramme", + "viewer.nav.reset.title": "Réinitialiser la vue (0)", + "viewer.nav.read": "LIRE", + "viewer.nav.zoomIn": "Zoom avant", + "viewer.nav.zoomIn.title": "Zoom avant (+)", + "viewer.nav.camera": "{hint}. Réinitialiser la vue du diagramme", + "viewer.nav.camera.title": "{semantic}{hint} · réinitialiser la vue (0)", + "viewer.nav.camera.semantic": "Caméra sémantique active · ", + "viewer.nav.level.map": "CARTE", + "viewer.nav.level.read": "LIRE", + "viewer.nav.level.full": "COMPLET", + "viewer.nav.level.auto": "AUTO", + "viewer.nav.detail.map": "Zoomez pour révéler les libellés des relations et le contexte des nœuds", + "viewer.nav.detail.read": "Zoomez à nouveau pour révéler les étiquettes et annotations", + "viewer.nav.detail.full": "Détail complet du diagramme", + "viewer.intent.summary": "{label}. {out} sortantes, {in} entrantes{loops}. {total} connexions. Appuyez sur Entrée pour les détails.", + "viewer.intent.loops": ", {count} boucle propre", + "viewer.common.copied": "Copié", + "viewer.common.copyFailed": "Échec de la copie", + "viewer.common.copyLink": "Copier le lien", + "viewer.common.clear": "Effacer", + "viewer.common.close": "Fermer" +} diff --git a/packages/diagram-core/vendor/archify/examples/locales/fr.partial.json b/packages/diagram-core/vendor/archify/examples/locales/fr.partial.json new file mode 100644 index 0000000..4a442c8 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/locales/fr.partial.json @@ -0,0 +1,22 @@ +{ + "page.title": "Diagramme {title}", + "diagram.description.architecture": "Un diagramme d'architecture généré par Archify.", + "legend.title": "Légende", + "node.focus": "Focus {label}", + "node.context.architecture": "Composant d'architecture", + "viewer.kind.frontend": "Frontend", + "viewer.kind.backend": "Backend", + "viewer.export.button": "Exporter", + "viewer.export.button.title": "Exporter le diagramme (E)", + "viewer.export.diagram": "Exporter le diagramme", + "viewer.finder.title": "Rechercher un nœud", + "viewer.route.eyebrow": "Sonde d'itinéraire", + "viewer.route.overview.node.one": "{count} nœud", + "viewer.route.overview.node.other": "{count} nœuds", + "viewer.guide.eyebrow": "Guide du diagramme", + "viewer.nav.controls": "Contrôles de vue du diagramme", + "viewer.theme.toggle": "Changer de thème", + "viewer.preset.classic": "Classique", + "viewer.common.close": "Fermer", + "viewer.common.copyLink": "Copier le lien" +} diff --git a/packages/diagram-core/vendor/archify/examples/locales/it.json b/packages/diagram-core/vendor/archify/examples/locales/it.json new file mode 100644 index 0000000..37fe4d1 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/locales/it.json @@ -0,0 +1,425 @@ +{ + "page.title": "{title} · Diagramma", + "diagram.description.architecture": "Un diagramma di architettura generato da Archify.", + "diagram.description.workflow": "Un diagramma di flusso di lavoro generato da Archify.", + "diagram.description.sequence": "Un diagramma di sequenza generato da Archify.", + "diagram.description.dataflow": "Un diagramma di flusso dati generato da Archify.", + "diagram.description.lifecycle": "Un diagramma di ciclo di vita generato da Archify.", + "node.focus": "Metti a fuoco {label}", + "node.focus.detail": "Metti a fuoco {label}, {detail}", + "node.context.architecture": "Componente di architettura", + "node.context.workflow": "Nodo del flusso di lavoro", + "node.context.sequence": "Partecipante alla sequenza", + "node.context.dataflow": "Nodo del flusso dati", + "node.context.lifecycle": "Stato del ciclo di vita", + "legend.title": "Legenda", + "legend.architecture.frontend": "Frontend", + "legend.architecture.backend": "Backend", + "legend.architecture.database": "Database", + "legend.architecture.cloud": "Cloud", + "legend.architecture.security": "Sicurezza", + "legend.architecture.messagebus": "Bus di messaggi", + "legend.architecture.external": "Esterno", + "legend.workflow.frontend": "Interfaccia utente", + "legend.workflow.backend": "Logica dell'agente", + "legend.workflow.security": "Criterio", + "legend.workflow.messagebus": "Azione dello strumento", + "legend.workflow.database": "Contesto / traccia", + "legend.workflow.cloud": "Servizio cloud", + "legend.workflow.external": "Sistema esterno", + "legend.sequence.emphasis": "richiesta principale", + "legend.sequence.return": "risposta", + "legend.sequence.security": "sicurezza", + "legend.sequence.dashed": "traccia asincrona", + "legend.sequence.default": "messaggio", + "legend.dataflow.emphasis": "dati primari", + "legend.dataflow.security": "criterio / PII", + "legend.dataflow.dashed": "batch asincrono", + "legend.dataflow.database": "archivio dati", + "legend.dataflow.default": "flusso dati", + "legend.lifecycle.start": "stato iniziale", + "legend.lifecycle.active": "attivo", + "legend.lifecycle.waiting": "attesa", + "legend.lifecycle.decision": "decisione", + "legend.lifecycle.success": "successo", + "legend.lifecycle.failure": "errore / uscita", + "legend.lifecycle.neutral": "neutro", + "legend.lifecycle.external": "esterno", + "legend.lifecycle.final": "stato finale", + "viewer.kind.frontend": "Frontend", + "viewer.kind.backend": "Backend", + "viewer.kind.database": "Database", + "viewer.kind.cloud": "Cloud", + "viewer.kind.security": "Sicurezza", + "viewer.kind.messagebus": "Bus di messaggi", + "viewer.kind.external": "Esterno", + "viewer.kind.neutral": "Neutro", + "viewer.kind.node": "Nodo", + "viewer.kind.start": "Inizio", + "viewer.kind.active": "Attivo", + "viewer.kind.waiting": "In attesa", + "viewer.kind.decision": "Decisione", + "viewer.kind.success": "Successo", + "viewer.kind.failure": "Errore", + "viewer.toolbar.actions": "Azioni del diagramma", + "viewer.theme.toggle.title": "Cambia tema (T)", + "viewer.theme.toggle": "Cambia tema colore", + "viewer.theme.dark": "Scuro", + "viewer.theme.light": "Chiaro", + "viewer.preset.choose.title": "Scegli lo stile visivo (S per scorrere)", + "viewer.preset.choose": "Scegli lo stile visivo", + "viewer.preset.style": "Stile", + "viewer.preset.menu": "Stile visivo", + "viewer.preset.identity": "Identità visiva", + "viewer.preset.cycles": "S per scorrere", + "viewer.preset.classic": "Classico", + "viewer.preset.classic.short": "Classico", + "viewer.preset.classic.hint": "Predefinito tecnico stabile", + "viewer.preset.flow": "Flusso di segnale", + "viewer.preset.flow.short": "Flusso", + "viewer.preset.flow.hint": "Presentazione dinamica", + "viewer.preset.blueprint": "Progetto", + "viewer.preset.blueprint.hint": "Revisione tecnica", + "viewer.preset.editorial": "Editoriale", + "viewer.preset.editorial.hint": "Note di pubblicazione e lancio", + "viewer.preset.badge.signalFlow": "FLUSSO DI SEGNALE", + "viewer.preset.badge.blueprint": "PROGETTO / REV. 01", + "viewer.preset.badge.editorial": "EDITORIALE / NOTA SUL CAMPO", + "viewer.preset.badge.editorialPlate": "ARCHIFY / TAVOLA 04", + "viewer.preset.current": "Stile visivo: {style}. Scegli lo stile visivo", + "viewer.motion.live": "Attiva", + "viewer.motion.still": "Statica", + "viewer.motion.pause": "Metti in pausa l'animazione", + "viewer.motion.resume": "Riprendi l'animazione", + "viewer.motion.reduced": "Animazione in pausa per preferenza di movimento ridotto", + "viewer.motion.hidden": "Animazione in pausa mentre la pagina è nascosta", + "viewer.motion.yielding": "Metti in pausa l'animazione; attualmente cede il posto a {owner}", + "viewer.motion.yielding.title": "Anteprima dinamica attiva · cede il posto a {owner}", + "viewer.owner.route": "Esplora percorso", + "viewer.owner.lens": "Lente semantica", + "viewer.owner.relationship": "Anteprima relazione", + "viewer.owner.intent": "Traccia intento", + "viewer.owner.focus": "focus semantico", + "viewer.owner.legend": "anteprima legenda", + "viewer.owner.reader": "interazione del lettore", + "viewer.present.enter": "Entra in modalità presentazione", + "viewer.present.enter.title": "Modalità presentazione (F)", + "viewer.present.exit": "Esci dalla modalità presentazione", + "viewer.present.exit.title": "Esci dalla modalità presentazione (F o Esc)", + "viewer.present.present": "Presenta", + "viewer.present.exit.label": "Esci", + "viewer.export.button": "Esporta", + "viewer.export.button.title": "Esporta diagramma (E)", + "viewer.export.diagram": "Esporta diagramma", + "viewer.export.menu": "Esporta", + "viewer.export.subtitle": "Output portatili e puliti", + "viewer.export.share": "Condividi", + "viewer.export.shareCard": "Scheda di condivisione", + "viewer.export.routeShareCard": "Scheda di condivisione del percorso", + "viewer.export.reachShareCard": "Scheda di condivisione della raggiungibilità", + "viewer.export.copyDiagram": "Copia diagramma", + "viewer.export.clipboardPng": "PNG negli appunti", + "viewer.export.raster": "Immagini raster", + "viewer.export.image": "Immagine", + "viewer.export.lossless": "Immagine senza perdita", + "viewer.export.compact": "Immagine compatta", + "viewer.export.modern": "Immagine moderna", + "viewer.export.vectorMotion": "Vettoriale e animazione", + "viewer.export.vectorMotion.heading": "Vettoriale e animazione", + "viewer.export.editable": "Vettoriale modificabile", + "viewer.export.motion6s": "Animazione di 6s", + "viewer.export.unsupported": "Non supportato da questo browser", + "viewer.export.clipboardUnsupported": "La scrittura di immagini negli appunti non è supportata da questo browser", + "viewer.export.clipboardUnsupported.short": "La scrittura di immagini negli appunti non è supportata in questo browser.", + "viewer.export.motionUnavailable": "Cattura dell'animazione non disponibile in questo browser", + "viewer.export.webmUnavailable": "WebM non disponibile in questo browser", + "viewer.export.failed": "Esportazione non riuscita: {message}", + "viewer.export.unknownVariant": "Variante scheda di condivisione sconosciuta: {variant}", + "viewer.export.routeRequired": "Traccia un percorso prima di esportare una scheda di condivisione del percorso", + "viewer.export.reachRequired": "Traccia la raggiungibilità prima di esportare una scheda di condivisione della raggiungibilità", + "viewer.export.unknown": "sconosciuto", + "viewer.export.routeFailed": "Esportazione della scheda di condivisione del percorso non riuscita: {message}", + "viewer.export.reachFailed": "Esportazione della scheda di condivisione della raggiungibilità non riuscita: {message}", + "viewer.export.copyFailed": "Copia non riuscita: {message}", + "viewer.export.copiedPng": "PNG copiato negli appunti", + "viewer.export.downloadedRoute": "Scheda di condivisione del percorso scaricata", + "viewer.export.downloadedReach": "Scheda di condivisione della raggiungibilità scaricata", + "viewer.export.downloadedWebm": "WebM scaricato", + "viewer.export.recording": "Registrazione di 6 secondi di animazione…", + "viewer.export.card.routeSummary.one": "Percorso: {source} → {target} · {count} salto diretto", + "viewer.export.card.routeSummary.other": "Percorso: {source} → {target} · {count} salti diretti", + "viewer.export.card.reachSummary": "{direction} generata da {origin} · {nodes} · {links} · max {hops}", + "viewer.export.card.node.one": "{count} nodo", + "viewer.export.card.node.other": "{count} nodi", + "viewer.export.card.link.one": "{count} collegamento", + "viewer.export.card.link.other": "{count} collegamenti", + "viewer.export.card.hop.one": "{count} salto", + "viewer.export.card.hop.other": "{count} salti", + "viewer.export.card.routeBadge": "ARCHIFY · PERCORSO · {hops}", + "viewer.export.card.reachBadge": "ARCHIFY · RAGGIUNGIBILITÀ {direction}", + "viewer.export.direction.upstream": "A monte", + "viewer.export.direction.downstream": "A valle", + "viewer.export.error.canvasUnavailable": "Canvas non disponibile per {label}", + "viewer.export.error.contextUnavailable": "Contesto canvas 2D non disponibile per {label}", + "viewer.export.error.toBlobUnavailable": "canvas.toBlob non disponibile per {label}", + "viewer.export.error.toBlobNull": "canvas.toBlob non ha restituito dati per {label}", + "viewer.export.error.variantsCombined": "Le varianti della scheda di condivisione non possono essere combinate", + "viewer.export.error.viewerState": "L'esportazione della scheda di condivisione non è riuscita a rimuovere lo stato temporaneo del visualizzatore", + "viewer.export.error.routeState": "L'esportazione della scheda del percorso non è riuscita a preservare in modo sicuro il percorso risolto", + "viewer.export.error.reachState": "L'esportazione della scheda di raggiungibilità non è riuscita a preservare in modo sicuro la raggiungibilità generata", + "viewer.export.error.webmRequirements": "L'esportazione dell'animazione WebM richiede un'animazione di traccia e il supporto MediaRecorder del browser", + "viewer.export.error.mediaRecorder": "MediaRecorder non riuscito", + "viewer.export.error.emptyWebm": "MediaRecorder ha prodotto un WebM vuoto", + "viewer.export.error.webmBackground": "Impossibile caricare lo sfondo SVG per l'esportazione WebM", + "viewer.guide.eyebrow": "Guida al diagramma", + "viewer.guide.close": "Chiudi la guida al diagramma", + "viewer.guide.inspecting": "Analisi della semantica compilata", + "viewer.guide.actions": "Azioni di esplorazione del diagramma", + "viewer.guide.find": "Trova un nodo qualsiasi", + "viewer.guide.find.hint": "Cerca etichette, responsabilità, tipi e ID stabili.", + "viewer.guide.route": "Traccia un percorso", + "viewer.guide.route.aria": "Traccia un percorso diretto", + "viewer.guide.route.hint": "Chiedi come si collegano due nodi semantici nella direzione generata.", + "viewer.guide.map": "Guarda l'intero sistema", + "viewer.guide.map.hint": "Apri il Radar semantico con un viewport dal vivo e nodi stabili.", + "viewer.guide.lens": "Confronta i tipi semantici", + "viewer.guide.lens.hint": "Conta i ruoli, mostra il loro traffico e confronta i collegamenti diretti generati.", + "viewer.guide.present": "Entra in modalità presentazione", + "viewer.guide.present.hint": "Assegna il viewport al diagramma dal vivo senza modificare l'esportazione.", + "viewer.guide.shortcuts": "Altre scorciatoie da tastiera", + "viewer.guide.shortcut.export": "Esporta", + "viewer.guide.shortcut.theme": "Tema", + "viewer.guide.shortcut.style": "Stile", + "viewer.guide.shortcut.reset": "Ripristina", + "viewer.guide.shortcut.zoomIn": "Zoom avanti", + "viewer.guide.shortcut.zoomOut": "Zoom indietro", + "viewer.guide.shortcut.close": "Chiudi", + "viewer.guide.facts": "{nodes} · {relationships}", + "viewer.guide.fact.node.one": "{count} nodo semantico", + "viewer.guide.fact.node.other": "{count} nodi semantici", + "viewer.guide.fact.relationship.one": "{count} relazione", + "viewer.guide.fact.relationship.other": "{count} relazioni", + "viewer.guide.open": "Apri la guida al diagramma", + "viewer.finder.title": "Trova un nodo", + "viewer.finder.close": "Chiudi il cercatore di nodi", + "viewer.finder.placeholder": "Cerca etichette o ID", + "viewer.finder.search": "Cerca nodi del diagramma", + "viewer.finder.results": "Nodi del diagramma", + "viewer.finder.empty": "Nessun nodo corrispondente", + "viewer.finder.result.focus": "Metti a fuoco {label}", + "viewer.finder.result.routeStart": "Scegli {label} come inizio del percorso", + "viewer.finder.result.routeTarget": "Scegli {label} come destinazione del percorso, {links}", + "viewer.finder.status.empty": "Nessun nodo corrispondente", + "viewer.finder.status.count.one": "{count} nodo corrispondente", + "viewer.finder.status.count.other": "{count} nodi corrispondenti", + "viewer.finder.noun.nodes": "nodi", + "viewer.finder.link.one": "{count} collegamento", + "viewer.finder.link.other": "{count} collegamenti", + "viewer.finder.result.focus.one": "Metti a fuoco {label}, {count} connessione correlata", + "viewer.finder.result.focus.other": "Metti a fuoco {label}, {count} connessioni correlate", + "viewer.finder.status.filtered": "{visible} di {available} {noun}", + "viewer.finder.status.all": "{available} {noun}", + "viewer.passport.eyebrow": "Passaporto semantico", + "viewer.passport.metadata": "Metadati del nodo", + "viewer.passport.evidence": "Fonte verificata", + "viewer.passport.verified": "Fonte verificata", + "viewer.passport.verificationScope": "Verificato rispetto al Git locale alla revisione fissata. L'accesso remoto non è stato verificato.", + "viewer.passport.reach": "Raggiungibilità generata", + "viewer.passport.reach.trace": "Traccia la raggiungibilità generata", + "viewer.passport.upstream": "A monte", + "viewer.passport.downstream": "A valle", + "viewer.passport.upstream.trace": "Traccia la raggiungibilità generata a monte", + "viewer.passport.downstream.trace": "Traccia la raggiungibilità generata a valle", + "viewer.passport.close": "Chiudi il passaporto semantico", + "viewer.passport.copy": "Copia link", + "viewer.passport.copy.focus": "Copia il link al nodo in focus", + "viewer.passport.relations": "Relazioni", + "viewer.passport.relations.show": "Mostra le relazioni collegate", + "viewer.passport.relations.hide": "Nascondi le relazioni collegate", + "viewer.passport.relations.list": "Relazioni collegate", + "viewer.passport.copyRelation": "Copia relazione", + "viewer.passport.copyNode": "Copia nodo", + "viewer.passport.copyPinned": "Copia il link alla relazione fissata", + "viewer.passport.copySource": "Copia il link al nodo di origine", + "viewer.passport.copy.focused.success": "Link del nodo in focus copiato", + "viewer.passport.copy.pinned.success": "Link della relazione fissata copiato", + "viewer.passport.copy.focused.failed": "Impossibile copiare il link del nodo in focus", + "viewer.passport.copy.pinned.failed": "Impossibile copiare il link della relazione fissata", + "viewer.passport.relationship.none": "Nessuna relazione collegata", + "viewer.passport.relationship.count.one": "{count} relazione", + "viewer.passport.relationship.count.other": "{count} relazioni", + "viewer.passport.relationship.show.one": "Mostra {count} relazione collegata", + "viewer.passport.relationship.show.other": "Mostra {count} relazioni collegate", + "viewer.passport.relationship.summary": "{out} in uscita · {in} in entrata{loops}", + "viewer.passport.relationship.loops": " · {count} autoanello", + "viewer.passport.relationship.explorer": "Esploratore delle relazioni dirette", + "viewer.passport.relationship.help": "Usa i tasti freccia per esplorare le relazioni. Premi Invio o Spazio per fissare i dettagli; Esc per annullare.", + "viewer.passport.relationship.loopsBack": "torna su se stesso", + "viewer.passport.relationship.connectsTo": "si collega a", + "viewer.passport.relationship.connectsFrom": "si collega da", + "viewer.passport.relationship.pinned": "Relazione fissata · {from} → {to} · {label}", + "viewer.passport.relationship.inspect": "Analizza la relazione {index} di {total}: da {from} a {to}, {label}. Premi Invio per i dettagli.", + "viewer.passport.relationship.group.out": "In uscita", + "viewer.passport.relationship.group.in": "In entrata", + "viewer.passport.relationship.group.loop": "Autoanelli", + "viewer.passport.relationship.row": "{group}: {relationship}, {neighbor}", + "viewer.passport.relationship.direction.out": "USCITA →", + "viewer.passport.relationship.direction.in": "← ENTRATA", + "viewer.passport.relationship.direction.loop": "ANELLO", + "viewer.passport.sourceCount.one": "{count} riferimento a fonte verificata", + "viewer.passport.sourceCount.other": "{count} riferimenti a fonti verificate", + "viewer.passport.sourceMarker": "FONTE", + "viewer.passport.beacon.one": "{count} fonte verificata; metti a fuoco questo nodo per analizzarla", + "viewer.passport.beacon.other": "{count} fonti verificate; metti a fuoco questo nodo per analizzarle", + "viewer.passport.repository.open": "Apri la revisione {revision} del repository verificato", + "viewer.passport.source.open": "Apri la fonte verificata {path} alla revisione {revision}", + "viewer.passport.source.openLink": "Apri ↗", + "viewer.passport.reach.upstream.one": "Traccia {count} nodo generato a monte", + "viewer.passport.reach.upstream.other": "Traccia {count} nodi generati a monte", + "viewer.passport.reach.downstream.one": "Traccia {count} nodo generato a valle", + "viewer.passport.reach.downstream.other": "Traccia {count} nodi generati a valle", + "viewer.passport.reach.noUpstream": "Nessun nodo generato a monte", + "viewer.passport.reach.noDownstream": "Nessun nodo generato a valle", + "viewer.passport.reach.status": "{direction} · {nodes} nodi · {links} collegamenti · max {hops} salti", + "viewer.route.eyebrow": "Esplora percorso", + "viewer.route.start": "Scegli un nodo di partenza", + "viewer.route.start.find": "Trova partenza", + "viewer.route.start.find.aria": "Trova una partenza del percorso", + "viewer.route.copy": "Copia link", + "viewer.route.copy.aria": "Copia il link al percorso tracciato", + "viewer.route.clear": "Cancella", + "viewer.route.clear.aria": "Cancella l'esplorazione del percorso", + "viewer.route.traced": "Percorso tracciato", + "viewer.route.pickTwo": "Scegli due nodi semantici sul diagramma", + "viewer.route.pickOne": "Scegli un nodo semantico sul diagramma", + "viewer.route.controls": "Controlli del tragitto del percorso", + "viewer.route.previous": "Posizione precedente nel percorso", + "viewer.route.play": "Riproduci il tragitto del percorso", + "viewer.route.pause": "Metti in pausa il tragitto del percorso", + "viewer.route.replay": "Riavvia il tragitto del percorso", + "viewer.route.next": "Posizione successiva nel percorso", + "viewer.route.journey": "Tragitto", + "viewer.route.pause.label": "Pausa", + "viewer.route.replay.label": "Riavvia", + "viewer.route.overview": "Panoramica", + "viewer.route.overview.aria": "Mostra la panoramica completa del percorso", + "viewer.route.instructions": "Scegli prima l'origine, poi la destinazione. La direzione è importante.", + "viewer.route.destination": "Scegli una destinazione da {label}", + "viewer.route.destination.find": "Trova destinazione", + "viewer.route.destination.find.aria": "Trova una destinazione raggiungibile del percorso", + "viewer.route.differentDestination": "Scegli una destinazione diversa", + "viewer.route.distinct": "Un percorso richiede due nodi semantici distinti.", + "viewer.route.unreachable": "Nessun percorso diretto verso {label}", + "viewer.route.unreachable.detail": "{target} non è raggiungibile da {source}. Scegli una destinazione evidenziata.", + "viewer.route.start.instructions": "Seleziona l'origine. Il passo successivo mostrerà solo le destinazioni dirette.", + "viewer.route.copy.success": "Link del percorso tracciato copiato", + "viewer.route.copy.failed": "Impossibile copiare il link del percorso tracciato", + "viewer.route.position": "Posizione {index} di {total} nel percorso: {label}", + "viewer.route.step": "Passo {index} di {total} · {phase} · {label}", + "viewer.route.motionRequired": "Il tragitto automatico richiede l'animazione attiva", + "viewer.route.trigger.clear": "Cancella il percorso tracciato", + "viewer.route.overview.status": "{nodes} · {hops} · percorso generato più breve", + "viewer.route.overview.node.one": "{count} nodo", + "viewer.route.overview.node.other": "{count} nodi", + "viewer.route.overview.hop.one": "{count} salto diretto", + "viewer.route.overview.hop.other": "{count} salti diretti", + "viewer.route.phase.playing": "In riproduzione", + "viewer.route.phase.complete": "Completato", + "viewer.route.phase.inspecting": "Analisi in corso", + "viewer.route.destination.count.one": "{count} destinazione diretta disponibile. Scegli un nodo evidenziato.", + "viewer.route.destination.count.other": "{count} destinazioni dirette disponibili. Scegli un nodo evidenziato.", + "viewer.route.noOutgoing": "Nessun percorso in uscita da qui. Cancella e scegli un'altra origine.", + "viewer.route.result.title": "{source} verso {target}", + "viewer.route.finder.source.title": "Scegli l'inizio del percorso", + "viewer.route.finder.source.placeholder": "Cerca origini del percorso", + "viewer.route.finder.source.empty": "Nessuna origine del percorso corrispondente", + "viewer.route.finder.source.results": "Nodi che possono avviare un percorso", + "viewer.route.finder.source.noun": "origini del percorso", + "viewer.route.finder.source.badge": "inizio", + "viewer.route.finder.target.title": "Destinazione da {label}", + "viewer.route.finder.target.placeholder": "Cerca destinazioni raggiungibili", + "viewer.route.finder.target.empty": "Nessuna destinazione raggiungibile corrispondente", + "viewer.route.finder.target.results": "Destinazioni raggiungibili del percorso", + "viewer.route.finder.target.noun": "destinazioni raggiungibili", + "viewer.route.hop.one": "{count} salto", + "viewer.route.hop.other": "{count} salti", + "viewer.lens.eyebrow": "Lente semantica", + "viewer.lens.title": "Confronta i ruoli del sistema", + "viewer.lens.close": "Chiudi la lente semantica", + "viewer.lens.instruction": "Scegli fino a due tipi semantici. Uno mostra il traffico reale; due confrontano solo le relazioni dirette generate.", + "viewer.lens.kinds": "Tipi semantici", + "viewer.lens.choose": "Scegli un tipo per analizzarne i nodi e le relazioni collegate.", + "viewer.lens.copy": "Copia il link alla lente semantica", + "viewer.lens.clear": "Cancella la lente semantica", + "viewer.lens.open": "Apri la lente semantica", + "viewer.lens.openActive": "Apri la lente semantica attiva", + "viewer.lens.legend": "Legenda semantica", + "viewer.lens.legend.inspect.one": "Analizza {label}, {count} nodo", + "viewer.lens.legend.inspect.other": "Analizza {label}, {count} nodi", + "viewer.lens.kind.count.one": "{label}, {count} nodo", + "viewer.lens.kind.count.other": "{label}, {count} nodi", + "viewer.lens.compare.one": "{first} → {second}: {forward} · {second} → {first}: {reverse} · {count} relazione diretta", + "viewer.lens.compare.other": "{first} → {second}: {forward} · {second} → {first}: {reverse} · {count} relazioni dirette", + "viewer.lens.single": "{nodes} · {relationships} · i nodi collegati restano visibili", + "viewer.lens.node.one": "{count} nodo {label}", + "viewer.lens.node.other": "{count} nodi {label}", + "viewer.lens.relationship.one": "{count} relazione a contatto", + "viewer.lens.relationship.other": "{count} relazioni a contatto", + "viewer.radar.title": "Radar semantico", + "viewer.radar.building": "Costruzione della panoramica", + "viewer.radar.openFull": "Apri il radar semantico completo", + "viewer.radar.open": "Apri radar", + "viewer.radar.close": "Chiudi il radar semantico", + "viewer.radar.surface": "Panoramica del diagramma. Clicca su un nodo per metterlo a fuoco, oppure usa i tasti freccia per scorrere.", + "viewer.radar.click": "Clicca sul nodo", + "viewer.radar.drag": "Trascina per scorrere", + "viewer.radar.space": "Il radar semantico richiede più spazio nella MAPPA.", + "viewer.radar.nodes": "Nodi del radar semantico del diagramma", + "viewer.radar.focus": "Metti a fuoco {label} dal radar semantico", + "viewer.radar.status": "{count} nodi · {viewport}", + "viewer.radar.fullMap": "{count} nodi · mappa completa", + "viewer.radar.compacted": "Radar compattato per evitare di coprire il passaporto semantico o i controlli della MAPPA.", + "viewer.radar.cancelWaiting": "Annulla l'attesa del radar semantico per più spazio nella MAPPA", + "viewer.radar.needsSpace": "Il radar semantico richiede più spazio visibile nella MAPPA", + "viewer.radar.viewport.full": "mappa completa", + "viewer.radar.viewport.width": "{percent}% di larghezza", + "viewer.radar.viewport.scale": "{percent}% del viewport", + "viewer.nav.controls": "Controlli della vista del diagramma", + "viewer.nav.route": "Traccia un percorso diretto", + "viewer.nav.route.title": "Traccia percorso (R)", + "viewer.nav.route.short": "PERCORSO", + "viewer.nav.radar": "Apri il radar semantico", + "viewer.nav.radar.title": "Radar semantico (M)", + "viewer.nav.radar.short": "MAPPA", + "viewer.nav.lens": "Apri la lente semantica", + "viewer.nav.lens.title": "Lente semantica (L)", + "viewer.nav.lens.short": "LENTE", + "viewer.nav.find": "Trova un nodo", + "viewer.nav.find.title": "Trova un nodo (/)", + "viewer.nav.guide": "Apri la guida al diagramma", + "viewer.nav.guide.title": "Guida al diagramma (?)", + "viewer.nav.zoomOut": "Zoom indietro", + "viewer.nav.zoomOut.title": "Zoom indietro (-)", + "viewer.nav.reset": "Ripristina la vista del diagramma", + "viewer.nav.reset.title": "Ripristina vista (0)", + "viewer.nav.read": "LEGGI", + "viewer.nav.zoomIn": "Zoom avanti", + "viewer.nav.zoomIn.title": "Zoom avanti (+)", + "viewer.nav.camera": "{hint}. Ripristina la vista del diagramma", + "viewer.nav.camera.title": "{semantic}{hint} · ripristina vista (0)", + "viewer.nav.camera.semantic": "Camera semantica attiva · ", + "viewer.nav.level.map": "MAPPA", + "viewer.nav.level.read": "LEGGI", + "viewer.nav.level.full": "COMPLETO", + "viewer.nav.level.auto": "AUTO", + "viewer.nav.detail.map": "Ingrandisci per mostrare le etichette delle relazioni e il contesto dei nodi", + "viewer.nav.detail.read": "Ingrandisci ancora per mostrare tag e annotazioni", + "viewer.nav.detail.full": "Dettaglio completo del diagramma", + "viewer.intent.summary": "{label}. {out} in uscita, {in} in entrata{loops}. {total} connessioni. Premi Invio per i dettagli.", + "viewer.intent.loops": ", {count} autoanello", + "viewer.common.copied": "Copiato", + "viewer.common.copyFailed": "Copia non riuscita", + "viewer.common.copyLink": "Copia link", + "viewer.common.clear": "Cancella", + "viewer.common.close": "Chiudi" +} diff --git a/packages/diagram-core/vendor/archify/examples/locales/ja.json b/packages/diagram-core/vendor/archify/examples/locales/ja.json new file mode 100644 index 0000000..e74d346 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/locales/ja.json @@ -0,0 +1,425 @@ +{ + "page.title": "{title} ダイアグラム", + "diagram.description.architecture": "Archifyで生成されたアーキテクチャ図です。", + "diagram.description.workflow": "Archifyで生成されたワークフロー図です。", + "diagram.description.sequence": "Archifyで生成されたシーケンス図です。", + "diagram.description.dataflow": "Archifyで生成されたデータフロー図です。", + "diagram.description.lifecycle": "Archifyで生成されたライフサイクル図です。", + "node.focus": "{label} にフォーカス", + "node.focus.detail": "{label} にフォーカス、{detail}", + "node.context.architecture": "アーキテクチャコンポーネント", + "node.context.workflow": "ワークフローノード", + "node.context.sequence": "シーケンス参加者", + "node.context.dataflow": "データフローノード", + "node.context.lifecycle": "ライフサイクル状態", + "legend.title": "凡例", + "legend.architecture.frontend": "フロントエンド", + "legend.architecture.backend": "バックエンド", + "legend.architecture.database": "データベース", + "legend.architecture.cloud": "クラウド", + "legend.architecture.security": "セキュリティ", + "legend.architecture.messagebus": "メッセージバス", + "legend.architecture.external": "外部", + "legend.workflow.frontend": "ユーザーUI", + "legend.workflow.backend": "エージェントロジック", + "legend.workflow.security": "ポリシー", + "legend.workflow.messagebus": "ツール実行", + "legend.workflow.database": "コンテキスト / トレース", + "legend.workflow.cloud": "クラウドサービス", + "legend.workflow.external": "外部システム", + "legend.sequence.emphasis": "主要リクエスト", + "legend.sequence.return": "戻り値", + "legend.sequence.security": "セキュリティ", + "legend.sequence.dashed": "非同期トレース", + "legend.sequence.default": "メッセージ", + "legend.dataflow.emphasis": "主要データ", + "legend.dataflow.security": "ポリシー / PII", + "legend.dataflow.dashed": "非同期バッチ", + "legend.dataflow.database": "データストア", + "legend.dataflow.default": "データフロー", + "legend.lifecycle.start": "初期状態", + "legend.lifecycle.active": "アクティブ", + "legend.lifecycle.waiting": "待機", + "legend.lifecycle.decision": "判断", + "legend.lifecycle.success": "成功", + "legend.lifecycle.failure": "失敗 / 終了", + "legend.lifecycle.neutral": "中立", + "legend.lifecycle.external": "外部", + "legend.lifecycle.final": "終了状態", + "viewer.kind.frontend": "フロントエンド", + "viewer.kind.backend": "バックエンド", + "viewer.kind.database": "データベース", + "viewer.kind.cloud": "クラウド", + "viewer.kind.security": "セキュリティ", + "viewer.kind.messagebus": "メッセージバス", + "viewer.kind.external": "外部", + "viewer.kind.neutral": "中立", + "viewer.kind.node": "ノード", + "viewer.kind.start": "開始", + "viewer.kind.active": "アクティブ", + "viewer.kind.waiting": "待機", + "viewer.kind.decision": "判断", + "viewer.kind.success": "成功", + "viewer.kind.failure": "失敗", + "viewer.toolbar.actions": "ダイアグラム操作", + "viewer.theme.toggle.title": "テーマ切替 (T)", + "viewer.theme.toggle": "カラーテーマを切替", + "viewer.theme.dark": "ダーク", + "viewer.theme.light": "ライト", + "viewer.preset.choose.title": "ビジュアルスタイルを選択 (Sで循環)", + "viewer.preset.choose": "ビジュアルスタイルを選択", + "viewer.preset.style": "スタイル", + "viewer.preset.menu": "ビジュアルスタイル", + "viewer.preset.identity": "ビジュアルアイデンティティ", + "viewer.preset.cycles": "Sで循環", + "viewer.preset.classic": "クラシック", + "viewer.preset.classic.short": "クラシック", + "viewer.preset.classic.hint": "安定した技術標準", + "viewer.preset.flow": "シグナルフロー", + "viewer.preset.flow.short": "フロー", + "viewer.preset.flow.hint": "動きを強調した表現", + "viewer.preset.blueprint": "ブループリント", + "viewer.preset.blueprint.hint": "エンジニアリングレビュー向け", + "viewer.preset.editorial": "エディトリアル", + "viewer.preset.editorial.hint": "発行・公開ノート向け", + "viewer.preset.badge.signalFlow": "シグナルフロー", + "viewer.preset.badge.blueprint": "ブループリント / 改訂01", + "viewer.preset.badge.editorial": "エディトリアル / フィールドノート", + "viewer.preset.badge.editorialPlate": "ARCHIFY / プレート04", + "viewer.preset.current": "ビジュアルスタイル: {style}。ビジュアルスタイルを選択", + "viewer.motion.live": "ライブ", + "viewer.motion.still": "静止", + "viewer.motion.pause": "動きを一時停止", + "viewer.motion.resume": "動きを再開", + "viewer.motion.reduced": "「視差効果を減らす」設定により動きを一時停止しました", + "viewer.motion.hidden": "このページが非表示のため動きを一時停止しました", + "viewer.motion.yielding": "動きを一時停止、現在 {owner} に譲っています", + "viewer.motion.yielding.title": "ライブプレビュー有効 · {owner} に譲っています", + "viewer.owner.route": "ルートプローブ", + "viewer.owner.lens": "セマンティックレンズ", + "viewer.owner.relationship": "関係性プレビュー", + "viewer.owner.intent": "インテントトレース", + "viewer.owner.focus": "セマンティックフォーカス", + "viewer.owner.legend": "凡例プレビュー", + "viewer.owner.reader": "読者の操作", + "viewer.present.enter": "プレゼンテーションステージに入る", + "viewer.present.enter.title": "プレゼンテーションステージ (F)", + "viewer.present.exit": "プレゼンテーションステージを終了", + "viewer.present.exit.title": "プレゼンテーションステージを終了 (F または Escape)", + "viewer.present.present": "プレゼンテーション", + "viewer.present.exit.label": "終了", + "viewer.export.button": "エクスポート", + "viewer.export.button.title": "ダイアグラムをエクスポート (E)", + "viewer.export.diagram": "ダイアグラムをエクスポート", + "viewer.export.menu": "エクスポート", + "viewer.export.subtitle": "持ち運びやすくクリーンな出力", + "viewer.export.share": "共有", + "viewer.export.shareCard": "シェアカード", + "viewer.export.routeShareCard": "ルートシェアカード", + "viewer.export.reachShareCard": "到達範囲シェアカード", + "viewer.export.copyDiagram": "ダイアグラムをコピー", + "viewer.export.clipboardPng": "PNGをクリップボードへ", + "viewer.export.raster": "ラスター画像", + "viewer.export.image": "画像", + "viewer.export.lossless": "無劣化画像", + "viewer.export.compact": "コンパクト画像", + "viewer.export.modern": "モダン画像", + "viewer.export.vectorMotion": "ベクターとモーション", + "viewer.export.vectorMotion.heading": "ベクター & モーション", + "viewer.export.editable": "編集可能なベクター", + "viewer.export.motion6s": "6秒のモーション", + "viewer.export.unsupported": "このブラウザではサポートされていません", + "viewer.export.clipboardUnsupported": "このブラウザはクリップボードへの画像書き込みに対応していません", + "viewer.export.clipboardUnsupported.short": "このブラウザはクリップボードへの画像書き込みに対応していません。", + "viewer.export.motionUnavailable": "このブラウザではモーションキャプチャを利用できません", + "viewer.export.webmUnavailable": "このブラウザではWebMを利用できません", + "viewer.export.failed": "エクスポートに失敗しました: {message}", + "viewer.export.unknownVariant": "不明なシェアカードの種類です: {variant}", + "viewer.export.routeRequired": "ルートシェアカードをエクスポートする前にルートをトレースしてください", + "viewer.export.reachRequired": "到達範囲シェアカードをエクスポートする前に編集済みの到達範囲をトレースしてください", + "viewer.export.unknown": "不明", + "viewer.export.routeFailed": "ルートシェアカードのエクスポートに失敗しました: {message}", + "viewer.export.reachFailed": "到達範囲シェアカードのエクスポートに失敗しました: {message}", + "viewer.export.copyFailed": "コピーに失敗しました: {message}", + "viewer.export.copiedPng": "PNGをクリップボードにコピーしました", + "viewer.export.downloadedRoute": "ルートシェアカードをダウンロードしました", + "viewer.export.downloadedReach": "到達範囲シェアカードをダウンロードしました", + "viewer.export.downloadedWebm": "WebMをダウンロードしました", + "viewer.export.recording": "6秒間のモーションを録画中…", + "viewer.export.card.routeSummary.one": "ルート: {source} → {target} · {count} 個の有向ホップ", + "viewer.export.card.routeSummary.other": "ルート: {source} → {target} · {count} 個の有向ホップ", + "viewer.export.card.reachSummary": "{origin} からの編集済み{direction} · {nodes} · {links} · 最大{hops}", + "viewer.export.card.node.one": "{count} 個のノード", + "viewer.export.card.node.other": "{count} 個のノード", + "viewer.export.card.link.one": "{count} 個の接続", + "viewer.export.card.link.other": "{count} 個の接続", + "viewer.export.card.hop.one": "{count} ホップ", + "viewer.export.card.hop.other": "{count} ホップ", + "viewer.export.card.routeBadge": "ARCHIFY · ROUTE · {hops}", + "viewer.export.card.reachBadge": "ARCHIFY · {direction} REACH", + "viewer.export.direction.upstream": "アップストリーム", + "viewer.export.direction.downstream": "ダウンストリーム", + "viewer.export.error.canvasUnavailable": "{label} のキャンバスを利用できません", + "viewer.export.error.contextUnavailable": "{label} の2Dキャンバスコンテキストを利用できません", + "viewer.export.error.toBlobUnavailable": "{label} でcanvas.toBlobを利用できません", + "viewer.export.error.toBlobNull": "{label} のcanvas.toBlobがデータを返しませんでした", + "viewer.export.error.variantsCombined": "シェアカードの種類は組み合わせられません", + "viewer.export.error.viewerState": "シェアカードのエクスポートで一時的なビューアー状態を削除できませんでした", + "viewer.export.error.routeState": "ルートカードのエクスポートで解決済みルートを安全に保持できませんでした", + "viewer.export.error.reachState": "到達範囲カードのエクスポートで編集済み到達範囲を安全に保持できませんでした", + "viewer.export.error.webmRequirements": "WebMモーションのエクスポートにはトレースアニメーションとブラウザのMediaRecorder対応が必要です", + "viewer.export.error.mediaRecorder": "MediaRecorderが失敗しました", + "viewer.export.error.emptyWebm": "MediaRecorderが空のWebMを生成しました", + "viewer.export.error.webmBackground": "WebMエクスポート用のSVG背景を読み込めませんでした", + "viewer.guide.eyebrow": "ダイアグラムガイド", + "viewer.guide.close": "ダイアグラムガイドを閉じる", + "viewer.guide.inspecting": "コンパイル済みセマンティクスを検査中", + "viewer.guide.actions": "ダイアグラム探索アクション", + "viewer.guide.find": "任意のノードを検索", + "viewer.guide.find.hint": "ラベル、役割、種類、固定IDで検索します。", + "viewer.guide.route": "ルートをトレース", + "viewer.guide.route.aria": "有向ルートをトレース", + "viewer.guide.route.hint": "2つのセマンティックノードが編集済みの方向でどう接続されているかを確認します。", + "viewer.guide.map": "システム全体を表示", + "viewer.guide.map.hint": "ライブビューポートと固定ノードを持つセマンティックレーダーを開きます。", + "viewer.guide.lens": "セマンティックな種類を比較", + "viewer.guide.lens.hint": "役割を数え、そのトラフィックを表示し、直接編集されたリンクを比較します。", + "viewer.guide.present": "プレゼンテーションステージに入る", + "viewer.guide.present.hint": "エクスポートを変更せずに、ライブダイアグラムにビューポート全体を割り当てます。", + "viewer.guide.shortcuts": "その他のキーボードショートカット", + "viewer.guide.shortcut.export": "エクスポート", + "viewer.guide.shortcut.theme": "テーマ", + "viewer.guide.shortcut.style": "スタイル", + "viewer.guide.shortcut.reset": "リセット", + "viewer.guide.shortcut.zoomIn": "拡大", + "viewer.guide.shortcut.zoomOut": "縮小", + "viewer.guide.shortcut.close": "閉じる", + "viewer.guide.facts": "{nodes} · {relationships}", + "viewer.guide.fact.node.one": "{count} 個のセマンティックノード", + "viewer.guide.fact.node.other": "{count} 個のセマンティックノード", + "viewer.guide.fact.relationship.one": "{count} 件の関係", + "viewer.guide.fact.relationship.other": "{count} 件の関係", + "viewer.guide.open": "ダイアグラムガイドを開く", + "viewer.finder.title": "ノードを検索", + "viewer.finder.close": "ノード検索を閉じる", + "viewer.finder.placeholder": "ラベルまたはIDで検索", + "viewer.finder.search": "ダイアグラムノードを検索", + "viewer.finder.results": "ダイアグラムノード", + "viewer.finder.empty": "一致するノードがありません", + "viewer.finder.result.focus": "{label} にフォーカス", + "viewer.finder.result.routeStart": "{label} をルートの起点として選択", + "viewer.finder.result.routeTarget": "{label} をルートの終点として選択、{links}", + "viewer.finder.status.empty": "一致するノードがありません", + "viewer.finder.status.count.one": "一致するノード {count} 個", + "viewer.finder.status.count.other": "一致するノード {count} 個", + "viewer.finder.noun.nodes": "ノード", + "viewer.finder.link.one": "{count} 件の接続", + "viewer.finder.link.other": "{count} 件の接続", + "viewer.finder.result.focus.one": "{label} にフォーカス、関連する接続 {count} 件", + "viewer.finder.result.focus.other": "{label} にフォーカス、関連する接続 {count} 件", + "viewer.finder.status.filtered": "{available} 件の{noun}中 {visible} 件", + "viewer.finder.status.all": "{available} 件の{noun}", + "viewer.passport.eyebrow": "セマンティックパスポート", + "viewer.passport.metadata": "ノードメタデータ", + "viewer.passport.evidence": "検証済みソースの根拠", + "viewer.passport.verified": "検証済みソース", + "viewer.passport.verificationScope": "固定されたリビジョン時点のローカルGitに対して検証済みです。リモートアクセスは確認していません。", + "viewer.passport.reach": "編集済みの到達範囲", + "viewer.passport.reach.trace": "編集済みの到達可能性をトレース", + "viewer.passport.upstream": "アップストリーム", + "viewer.passport.downstream": "ダウンストリーム", + "viewer.passport.upstream.trace": "アップストリームの編集済み到達可能性をトレース", + "viewer.passport.downstream.trace": "ダウンストリームの編集済み到達可能性をトレース", + "viewer.passport.close": "セマンティックパスポートを閉じる", + "viewer.passport.copy": "リンクをコピー", + "viewer.passport.copy.focus": "フォーカス中のノードへのリンクをコピー", + "viewer.passport.relations": "関係", + "viewer.passport.relations.show": "関連する関係を表示", + "viewer.passport.relations.hide": "関連する関係を非表示", + "viewer.passport.relations.list": "関連する関係", + "viewer.passport.copyRelation": "関係をコピー", + "viewer.passport.copyNode": "ノードをコピー", + "viewer.passport.copyPinned": "固定された関係へのリンクをコピー", + "viewer.passport.copySource": "ソースノードへのリンクをコピー", + "viewer.passport.copy.focused.success": "フォーカス中のノードのリンクをコピーしました", + "viewer.passport.copy.pinned.success": "固定された関係のリンクをコピーしました", + "viewer.passport.copy.focused.failed": "フォーカス中のノードのリンクをコピーできませんでした", + "viewer.passport.copy.pinned.failed": "固定された関係のリンクをコピーできませんでした", + "viewer.passport.relationship.none": "関連する関係がありません", + "viewer.passport.relationship.count.one": "{count} 件の関係", + "viewer.passport.relationship.count.other": "{count} 件の関係", + "viewer.passport.relationship.show.one": "関連する関係 {count} 件を表示", + "viewer.passport.relationship.show.other": "関連する関係 {count} 件を表示", + "viewer.passport.relationship.summary": "出向 {out} · 入向 {in}{loops}", + "viewer.passport.relationship.loops": " · 自己ループ {count} 件", + "viewer.passport.relationship.explorer": "直接関係エクスプローラー", + "viewer.passport.relationship.help": "矢印キーで関係を探索します。EnterまたはSpaceで詳細を固定し、Escapeで解除します。", + "viewer.passport.relationship.loopsBack": "ループして戻る", + "viewer.passport.relationship.connectsTo": "接続先", + "viewer.passport.relationship.connectsFrom": "接続元", + "viewer.passport.relationship.pinned": "固定された関係 · {from} → {to} · {label}", + "viewer.passport.relationship.inspect": "第 {index}/{total} 件の関係を検査: {from} から {to} へ、{label}。詳細はEnterを押してください。", + "viewer.passport.relationship.group.out": "出向", + "viewer.passport.relationship.group.in": "入向", + "viewer.passport.relationship.group.loop": "自己ループ", + "viewer.passport.relationship.row": "{group}: {relationship}、{neighbor}", + "viewer.passport.relationship.direction.out": "出 →", + "viewer.passport.relationship.direction.in": "← 入", + "viewer.passport.relationship.direction.loop": "ループ", + "viewer.passport.sourceCount.one": "検証済みソース参照 {count} 件", + "viewer.passport.sourceCount.other": "検証済みソース参照 {count} 件", + "viewer.passport.sourceMarker": "出典", + "viewer.passport.beacon.one": "検証済みソース {count} 件。このノードにフォーカスして確認", + "viewer.passport.beacon.other": "検証済みソース {count} 件。このノードにフォーカスして確認", + "viewer.passport.repository.open": "検証済みリポジトリのリビジョン {revision} を開く", + "viewer.passport.source.open": "リビジョン {revision} の検証済みソース {path} を開く", + "viewer.passport.source.openLink": "開く ↗", + "viewer.passport.reach.upstream.one": "アップストリームの編集済みノード {count} 件をトレース", + "viewer.passport.reach.upstream.other": "アップストリームの編集済みノード {count} 件をトレース", + "viewer.passport.reach.downstream.one": "ダウンストリームの編集済みノード {count} 件をトレース", + "viewer.passport.reach.downstream.other": "ダウンストリームの編集済みノード {count} 件をトレース", + "viewer.passport.reach.noUpstream": "アップストリームの編集済みノードがありません", + "viewer.passport.reach.noDownstream": "ダウンストリームの編集済みノードがありません", + "viewer.passport.reach.status": "{direction} · ノード {nodes} 件 · 接続 {links} 件 · 最大 {hops} ホップ", + "viewer.route.eyebrow": "ルートプローブ", + "viewer.route.start": "開始ノードを選択", + "viewer.route.start.find": "開始点を検索", + "viewer.route.start.find.aria": "ルートの開始点を検索", + "viewer.route.copy": "リンクをコピー", + "viewer.route.copy.aria": "トレース済みルートへのリンクをコピー", + "viewer.route.clear": "クリア", + "viewer.route.clear.aria": "ルートプローブをクリア", + "viewer.route.traced": "トレース済みルート", + "viewer.route.pickTwo": "ダイアグラム上で2つのセマンティックノードを選択してください", + "viewer.route.pickOne": "ダイアグラム上でセマンティックノードを1つ選択してください", + "viewer.route.controls": "ルートジャーニーのコントロール", + "viewer.route.previous": "前のルート位置", + "viewer.route.play": "ルートジャーニーを再生", + "viewer.route.pause": "ルートジャーニーを一時停止", + "viewer.route.replay": "ルートジャーニーをリプレイ", + "viewer.route.next": "次のルート位置", + "viewer.route.journey": "ジャーニー", + "viewer.route.pause.label": "一時停止", + "viewer.route.replay.label": "リプレイ", + "viewer.route.overview": "概要", + "viewer.route.overview.aria": "ルート全体の概要を表示", + "viewer.route.instructions": "起点を選択してから終点を選択してください。方向が重要です。", + "viewer.route.destination": "{label} からの終点を選択", + "viewer.route.destination.find": "終点を検索", + "viewer.route.destination.find.aria": "到達可能なルートの終点を検索", + "viewer.route.differentDestination": "別の終点を選択", + "viewer.route.distinct": "ルートには2つの異なるセマンティックノードが必要です。", + "viewer.route.unreachable": "{label} への有向ルートがありません", + "viewer.route.unreachable.detail": "{source} から {target} には到達できません。ハイライトされた終点を選択してください。", + "viewer.route.start.instructions": "起点を選択してください。次のステップでは有向の終点のみが表示されます。", + "viewer.route.copy.success": "トレース済みルートのリンクをコピーしました", + "viewer.route.copy.failed": "ルートのリンクをコピーできませんでした", + "viewer.route.position": "ルート位置 {index}/{total}: {label}", + "viewer.route.step": "ステップ {index}/{total} · {phase} · {label}", + "viewer.route.motionRequired": "自動ジャーニーにはライブモーションが必要です", + "viewer.route.trigger.clear": "トレース済みルートをクリア", + "viewer.route.overview.status": "{nodes} · {hops} · 最短の編集済みルート", + "viewer.route.overview.node.one": "{count} 個のノード", + "viewer.route.overview.node.other": "{count} 個のノード", + "viewer.route.overview.hop.one": "{count} 有向ホップ", + "viewer.route.overview.hop.other": "{count} 有向ホップ", + "viewer.route.phase.playing": "再生中", + "viewer.route.phase.complete": "完了", + "viewer.route.phase.inspecting": "検査中", + "viewer.route.destination.count.one": "利用可能な有向終点 {count} 件。ハイライトされたノードを選択してください。", + "viewer.route.destination.count.other": "利用可能な有向終点 {count} 件。ハイライトされたノードを選択してください。", + "viewer.route.noOutgoing": "ここから始まる出向ルートはありません。クリアして別の起点を選択してください。", + "viewer.route.result.title": "{source} から {target}", + "viewer.route.finder.source.title": "ルートの開始点を選択", + "viewer.route.finder.source.placeholder": "ルートの起点を検索", + "viewer.route.finder.source.empty": "一致するルートの起点がありません", + "viewer.route.finder.source.results": "ルートを開始できるノード", + "viewer.route.finder.source.noun": "ルートの起点", + "viewer.route.finder.source.badge": "起点", + "viewer.route.finder.target.title": "{label} からの終点", + "viewer.route.finder.target.placeholder": "到達可能な終点を検索", + "viewer.route.finder.target.empty": "一致する到達可能な終点がありません", + "viewer.route.finder.target.results": "到達可能なルートの終点", + "viewer.route.finder.target.noun": "到達可能な終点", + "viewer.route.hop.one": "{count} ホップ", + "viewer.route.hop.other": "{count} ホップ", + "viewer.lens.eyebrow": "セマンティックレンズ", + "viewer.lens.title": "システムの役割を比較", + "viewer.lens.close": "セマンティックレンズを閉じる", + "viewer.lens.instruction": "セマンティックな種類を最大2つ選択してください。1つ選ぶと実際のトラフィックが表示され、2つ選ぶと直接の編集済み関係のみを比較します。", + "viewer.lens.kinds": "セマンティックな種類", + "viewer.lens.choose": "種類を選択すると、そのノードと接する関係を検査できます。", + "viewer.lens.copy": "セマンティックレンズへのリンクをコピー", + "viewer.lens.clear": "セマンティックレンズをクリア", + "viewer.lens.open": "セマンティックレンズを開く", + "viewer.lens.openActive": "アクティブなセマンティックレンズを開く", + "viewer.lens.legend": "セマンティック凡例", + "viewer.lens.legend.inspect.one": "{label} を検査、{count} 個のノード", + "viewer.lens.legend.inspect.other": "{label} を検査、{count} 個のノード", + "viewer.lens.kind.count.one": "{label}、{count} 個のノード", + "viewer.lens.kind.count.other": "{label}、{count} 個のノード", + "viewer.lens.compare.one": "{first} → {second}: {forward} · {second} → {first}: {reverse} · 直接関係 {count} 件", + "viewer.lens.compare.other": "{first} → {second}: {forward} · {second} → {first}: {reverse} · 直接関係 {count} 件", + "viewer.lens.single": "{nodes} · {relationships} · 接続された周辺ノードは表示されたままです", + "viewer.lens.node.one": "{label} ノード {count} 個", + "viewer.lens.node.other": "{label} ノード {count} 個", + "viewer.lens.relationship.one": "接する関係 {count} 件", + "viewer.lens.relationship.other": "接する関係 {count} 件", + "viewer.radar.title": "セマンティックレーダー", + "viewer.radar.building": "概要を構築中", + "viewer.radar.openFull": "完全なセマンティックレーダーを開く", + "viewer.radar.open": "レーダーを開く", + "viewer.radar.close": "セマンティックレーダーを閉じる", + "viewer.radar.surface": "ダイアグラムの概要です。ノードをクリックしてフォーカスするか、矢印キーでパンできます。", + "viewer.radar.click": "ノードをクリック", + "viewer.radar.drag": "ドラッグしてパン", + "viewer.radar.space": "セマンティックレーダーにはさらにMAPスペースが必要です。", + "viewer.radar.nodes": "セマンティックダイアグラムのレーダーノード", + "viewer.radar.focus": "セマンティックレーダーから {label} にフォーカス", + "viewer.radar.status": "{count} 個のノード · {viewport}", + "viewer.radar.fullMap": "{count} 個のノード · 全体マップ", + "viewer.radar.compacted": "セマンティックパスポートやMAPコントロールを覆わないよう、レーダーを縮小しました。", + "viewer.radar.cancelWaiting": "MAPスペースの確保待ちのセマンティックレーダーをキャンセル", + "viewer.radar.needsSpace": "セマンティックレーダーには表示可能なMAPスペースがさらに必要です", + "viewer.radar.viewport.full": "全体マップ", + "viewer.radar.viewport.width": "幅 {percent}%", + "viewer.radar.viewport.scale": "ビューポート {percent}%", + "viewer.nav.controls": "ダイアグラム表示コントロール", + "viewer.nav.route": "有向ルートをトレース", + "viewer.nav.route.title": "ルートをトレース (R)", + "viewer.nav.route.short": "パス", + "viewer.nav.radar": "セマンティックレーダーを開く", + "viewer.nav.radar.title": "セマンティックレーダー (M)", + "viewer.nav.radar.short": "マップ", + "viewer.nav.lens": "セマンティックレンズを開く", + "viewer.nav.lens.title": "セマンティックレンズ (L)", + "viewer.nav.lens.short": "レンズ", + "viewer.nav.find": "ノードを検索", + "viewer.nav.find.title": "ノードを検索 (/)", + "viewer.nav.guide": "ダイアグラムガイドを開く", + "viewer.nav.guide.title": "ダイアグラムガイド (?)", + "viewer.nav.zoomOut": "縮小", + "viewer.nav.zoomOut.title": "縮小 (-)", + "viewer.nav.reset": "ダイアグラム表示をリセット", + "viewer.nav.reset.title": "表示をリセット (0)", + "viewer.nav.read": "閲覧", + "viewer.nav.zoomIn": "拡大", + "viewer.nav.zoomIn.title": "拡大 (+)", + "viewer.nav.camera": "{hint}。ダイアグラム表示をリセット", + "viewer.nav.camera.title": "{semantic}{hint} · 表示をリセット (0)", + "viewer.nav.camera.semantic": "セマンティックカメラ有効 · ", + "viewer.nav.level.map": "マップ", + "viewer.nav.level.read": "閲覧", + "viewer.nav.level.full": "全体", + "viewer.nav.level.auto": "自動", + "viewer.nav.detail.map": "拡大すると関係ラベルとノードのコンテキストが表示されます", + "viewer.nav.detail.read": "さらに拡大するとタグと注釈が表示されます", + "viewer.nav.detail.full": "ダイアグラムの完全な詳細", + "viewer.intent.summary": "{label}。出向 {out} 件、入向 {in} 件{loops}。合計 {total} 件の接続。詳細はEnterを押してください。", + "viewer.intent.loops": "、自己ループ {count} 件", + "viewer.common.copied": "コピーしました", + "viewer.common.copyFailed": "コピーに失敗しました", + "viewer.common.copyLink": "リンクをコピー", + "viewer.common.clear": "クリア", + "viewer.common.close": "閉じる" +} diff --git a/packages/diagram-core/vendor/archify/examples/locales/ko.json b/packages/diagram-core/vendor/archify/examples/locales/ko.json new file mode 100644 index 0000000..9ba33d6 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/locales/ko.json @@ -0,0 +1,440 @@ +{ + "page.title": "{title} 다이어그램", + "diagram.description.architecture": "Archify로 생성한 아키텍처 다이어그램입니다.", + "diagram.description.workflow": "Archify로 생성한 워크플로우 다이어그램입니다.", + "diagram.description.sequence": "Archify로 생성한 시퀀스 다이어그램입니다.", + "diagram.description.dataflow": "Archify로 생성한 데이터플로우 다이어그램입니다.", + "diagram.description.lifecycle": "Archify로 생성한 라이프사이클 다이어그램입니다.", + "node.focus": "{label} 포커스", + "node.focus.detail": "{label} 포커스, {detail}", + "node.context.architecture": "아키텍처 구성요소", + "node.context.workflow": "워크플로우 노드", + "node.context.sequence": "시퀀스 참가자", + "node.context.dataflow": "데이터플로우 노드", + "node.context.lifecycle": "라이프사이클 상태", + "legend.title": "범례", + "legend.architecture.frontend": "프런트엔드", + "legend.architecture.backend": "백엔드", + "legend.architecture.database": "데이터베이스", + "legend.architecture.cloud": "클라우드", + "legend.architecture.security": "보안", + "legend.architecture.messagebus": "메시지 버스", + "legend.architecture.external": "외부", + "legend.workflow.frontend": "사용자 UI", + "legend.workflow.backend": "Agent 로직", + "legend.workflow.security": "정책", + "legend.workflow.messagebus": "도구 실행", + "legend.workflow.database": "컨텍스트 / 추적", + "legend.workflow.cloud": "클라우드 서비스", + "legend.workflow.external": "외부 시스템", + "legend.sequence.emphasis": "주요 요청", + "legend.sequence.return": "반환", + "legend.sequence.security": "보안", + "legend.sequence.dashed": "비동기 추적", + "legend.sequence.default": "메시지", + "legend.dataflow.emphasis": "주요 데이터", + "legend.dataflow.security": "정책 / PII", + "legend.dataflow.dashed": "비동기 배치", + "legend.dataflow.database": "데이터 저장소", + "legend.dataflow.default": "데이터 흐름", + "legend.lifecycle.start": "초기 상태", + "legend.lifecycle.active": "활성", + "legend.lifecycle.waiting": "대기", + "legend.lifecycle.decision": "판단", + "legend.lifecycle.success": "성공", + "legend.lifecycle.failure": "실패 / 종료", + "legend.lifecycle.neutral": "중립 상태", + "legend.lifecycle.external": "외부 상태", + "legend.lifecycle.final": "종료 상태", + "viewer.kind.frontend": "프런트엔드", + "viewer.kind.backend": "백엔드", + "viewer.kind.database": "데이터베이스", + "viewer.kind.cloud": "클라우드", + "viewer.kind.security": "보안", + "viewer.kind.messagebus": "메시지 버스", + "viewer.kind.external": "외부", + "viewer.kind.neutral": "중립", + "viewer.kind.node": "노드", + "viewer.kind.start": "시작", + "viewer.kind.active": "활성", + "viewer.kind.waiting": "대기", + "viewer.kind.decision": "판단", + "viewer.kind.success": "성공", + "viewer.kind.failure": "실패", + "viewer.toolbar.actions": "다이어그램 동작", + "viewer.theme.toggle.title": "테마 전환 (T)", + "viewer.theme.toggle": "색상 테마 전환", + "viewer.theme.dark": "다크", + "viewer.theme.light": "라이트", + "viewer.preset.choose.title": "시각 스타일 선택 (S로 순환)", + "viewer.preset.choose": "시각 스타일 선택", + "viewer.preset.style": "스타일", + "viewer.preset.menu": "시각 스타일", + "viewer.preset.identity": "시각적 정체성", + "viewer.preset.cycles": "S로 순환", + "viewer.preset.classic": "클래식", + "viewer.preset.classic.short": "클래식", + "viewer.preset.classic.hint": "안정적인 기술 기본 스타일", + "viewer.preset.flow": "시그널 플로우", + "viewer.preset.flow.short": "플로우", + "viewer.preset.flow.hint": "동적 흐름을 강조하는 프레젠테이션", + "viewer.preset.blueprint": "블루프린트", + "viewer.preset.blueprint.hint": "엔지니어링 리뷰용", + "viewer.preset.editorial": "에디토리얼", + "viewer.preset.editorial.hint": "발행 및 출시 노트에 적합", + "viewer.preset.badge.signalFlow": "시그널 플로우", + "viewer.preset.badge.blueprint": "블루프린트 / 개정 01", + "viewer.preset.badge.editorial": "에디토리얼 / 현장 노트", + "viewer.preset.badge.editorialPlate": "ARCHIFY / 도판 04", + "viewer.preset.current": "현재 시각 스타일: {style}. 시각 스타일 선택", + "viewer.motion.live": "동적", + "viewer.motion.still": "정적", + "viewer.motion.pause": "동작 일시정지", + "viewer.motion.resume": "동작 재개", + "viewer.motion.reduced": "동작 최소화 설정으로 인해 동작이 일시정지되었습니다", + "viewer.motion.hidden": "페이지가 보이지 않는 동안 동작이 일시정지되었습니다", + "viewer.motion.yielding": "동작 일시정지; 현재 {owner}에 양보 중", + "viewer.motion.yielding.title": "실시간 미리보기 활성화 · {owner}에 양보 중", + "viewer.owner.route": "경로 탐색", + "viewer.owner.lens": "시맨틱 렌즈", + "viewer.owner.relationship": "관계 미리보기", + "viewer.owner.intent": "의도 추적", + "viewer.owner.focus": "시맨틱 포커스", + "viewer.owner.legend": "범례 미리보기", + "viewer.owner.reader": "읽는 이의 상호작용", + "viewer.present.enter": "프레젠테이션 모드 진입", + "viewer.present.enter.title": "프레젠테이션 모드 (F)", + "viewer.present.exit": "프레젠테이션 모드 종료", + "viewer.present.exit.title": "프레젠테이션 모드 종료 (F 또는 Escape)", + "viewer.present.present": "프레젠테이션", + "viewer.present.exit.label": "종료", + "viewer.export.button": "내보내기", + "viewer.export.button.title": "다이어그램 내보내기 (E)", + "viewer.export.diagram": "다이어그램 내보내기", + "viewer.export.menu": "내보내기", + "viewer.export.subtitle": "가볍고 깔끔한 출력물", + "viewer.export.share": "공유", + "viewer.export.shareCard": "공유 카드", + "viewer.export.routeShareCard": "경로 공유 카드", + "viewer.export.reachShareCard": "도달범위 공유 카드", + "viewer.export.copyDiagram": "다이어그램 복사", + "viewer.export.clipboardPng": "PNG를 클립보드로", + "viewer.export.raster": "래스터 이미지", + "viewer.export.image": "이미지", + "viewer.export.lossless": "무손실 이미지", + "viewer.export.compact": "압축 이미지", + "viewer.export.modern": "최신 이미지 포맷", + "viewer.export.vectorMotion": "벡터 및 동작", + "viewer.export.vectorMotion.heading": "벡터 및 동작", + "viewer.export.editable": "편집 가능한 벡터", + "viewer.export.motion6s": "6초 동작", + "viewer.export.unsupported": "이 브라우저에서 지원하지 않습니다", + "viewer.export.clipboardUnsupported": "이 브라우저는 이미지 클립보드 쓰기를 지원하지 않습니다", + "viewer.export.clipboardUnsupported.short": "이 브라우저는 이미지 클립보드 쓰기를 지원하지 않습니다.", + "viewer.export.motionUnavailable": "이 브라우저에서는 동작을 캡처할 수 없습니다", + "viewer.export.webmUnavailable": "이 브라우저에서는 WebM을 사용할 수 없습니다", + "viewer.export.failed": "내보내기 실패: {message}", + "viewer.export.unknownVariant": "알 수 없는 공유 카드 유형: {variant}", + "viewer.export.routeRequired": "경로 공유 카드를 내보내려면 먼저 경로를 추적하세요", + "viewer.export.reachRequired": "도달범위 공유 카드를 내보내려면 먼저 편집된 도달범위를 추적하세요", + "viewer.export.unknown": "알 수 없음", + "viewer.export.routeFailed": "경로 공유 카드 내보내기 실패: {message}", + "viewer.export.reachFailed": "도달범위 공유 카드 내보내기 실패: {message}", + "viewer.export.copyFailed": "복사 실패: {message}", + "viewer.export.copiedPng": "PNG를 클립보드에 복사했습니다", + "viewer.export.downloadedRoute": "경로 공유 카드를 다운로드했습니다", + "viewer.export.downloadedReach": "도달범위 공유 카드를 다운로드했습니다", + "viewer.export.downloadedWebm": "WebM을 다운로드했습니다", + "viewer.export.recording": "6초 분량 동작을 녹화 중…", + "viewer.export.card.routeSummary.one": "경로: {source} → {target} · 방향성 홉 {count}개", + "viewer.export.card.routeSummary.other": "경로: {source} → {target} · 방향성 홉 {count}개", + "viewer.export.card.reachSummary": "{origin}에서 시작한 편집된 {direction} · {nodes} · {links} · 최대 {hops}", + "viewer.export.card.node.one": "노드 {count}개", + "viewer.export.card.node.other": "노드 {count}개", + "viewer.export.card.link.one": "연결 {count}개", + "viewer.export.card.link.other": "연결 {count}개", + "viewer.export.card.hop.one": "홉 {count}개", + "viewer.export.card.hop.other": "홉 {count}개", + "viewer.export.card.routeBadge": "ARCHIFY · 경로 · {hops}", + "viewer.export.card.reachBadge": "ARCHIFY · {direction} 도달범위", + "viewer.export.direction.upstream": "업스트림", + "viewer.export.direction.downstream": "다운스트림", + "viewer.export.error.canvasUnavailable": "{label}에 캔버스를 사용할 수 없습니다", + "viewer.export.error.contextUnavailable": "{label}에 2D 캔버스 컨텍스트를 만들 수 없습니다", + "viewer.export.error.toBlobUnavailable": "{label}에서 canvas.toBlob을 사용할 수 없습니다", + "viewer.export.error.toBlobNull": "{label}의 canvas.toBlob이 데이터를 반환하지 않았습니다", + "viewer.export.error.variantsCombined": "공유 카드 유형을 함께 조합할 수 없습니다", + "viewer.export.error.viewerState": "공유 카드 내보내기가 임시 뷰어 상태를 제거하지 못했습니다", + "viewer.export.error.routeState": "경로 카드 내보내기가 해석된 경로를 안전하게 보존하지 못했습니다", + "viewer.export.error.reachState": "도달범위 카드 내보내기가 편집된 도달범위를 안전하게 보존하지 못했습니다", + "viewer.export.error.webmRequirements": "WebM 동작 내보내기는 추적 애니메이션과 브라우저의 MediaRecorder 지원이 필요합니다", + "viewer.export.error.mediaRecorder": "MediaRecorder 실패", + "viewer.export.error.emptyWebm": "MediaRecorder가 빈 WebM을 생성했습니다", + "viewer.export.error.webmBackground": "WebM 내보내기용 SVG 배경을 불러오지 못했습니다", + "viewer.guide.eyebrow": "다이어그램 가이드", + "viewer.guide.close": "다이어그램 가이드 닫기", + "viewer.guide.inspecting": "컴파일된 시맨틱 구조 검사 중", + "viewer.guide.actions": "다이어그램 탐색 동작", + "viewer.guide.find": "아무 노드나 찾기", + "viewer.guide.find.hint": "라벨, 역할, 유형, 고정 ID로 검색합니다.", + "viewer.guide.route": "경로 추적", + "viewer.guide.route.aria": "방향성 경로 추적", + "viewer.guide.route.hint": "두 시맨틱 노드가 편집된 방향으로 어떻게 연결되는지 확인합니다.", + "viewer.guide.map": "전체 시스템 보기", + "viewer.guide.map.hint": "실시간 뷰포트와 고정 노드가 있는 시맨틱 레이더를 엽니다.", + "viewer.guide.lens": "시맨틱 유형 비교", + "viewer.guide.lens.hint": "역할 수를 세고, 트래픽을 표시하고, 직접 편집된 연결을 비교합니다.", + "viewer.guide.present": "프레젠테이션 모드 진입", + "viewer.guide.present.hint": "내보내기는 그대로 두고 실시간 다이어그램에 뷰포트 전체를 할애합니다.", + "viewer.guide.shortcuts": "추가 키보드 단축키", + "viewer.guide.shortcut.export": "내보내기", + "viewer.guide.shortcut.theme": "테마", + "viewer.guide.shortcut.style": "스타일", + "viewer.guide.shortcut.reset": "초기화", + "viewer.guide.shortcut.zoomIn": "확대", + "viewer.guide.shortcut.zoomOut": "축소", + "viewer.guide.shortcut.close": "닫기", + "viewer.guide.facts": "{nodes} · {relationships}", + "viewer.guide.fact.node.one": "시맨틱 노드 {count}개", + "viewer.guide.fact.node.other": "시맨틱 노드 {count}개", + "viewer.guide.fact.relationship.one": "관계 {count}개", + "viewer.guide.fact.relationship.other": "관계 {count}개", + "viewer.guide.open": "다이어그램 가이드 열기", + "viewer.finder.title": "노드 찾기", + "viewer.finder.close": "노드 찾기 닫기", + "viewer.finder.placeholder": "라벨 또는 ID로 검색", + "viewer.finder.search": "다이어그램 노드 검색", + "viewer.finder.results": "다이어그램 노드", + "viewer.finder.empty": "일치하는 노드가 없습니다", + "viewer.finder.result.focus": "{label} 포커스", + "viewer.finder.result.routeStart": "{label}을(를) 경로 시작점으로 선택", + "viewer.finder.result.routeTarget": "{label}을(를) 경로 도착점으로 선택, {links}", + "viewer.finder.status.empty": "일치하는 노드가 없습니다", + "viewer.finder.status.count.one": "일치하는 노드 {count}개", + "viewer.finder.status.count.other": "일치하는 노드 {count}개", + "viewer.finder.noun.nodes": "노드", + "viewer.finder.link.one": "연결 {count}개", + "viewer.finder.link.other": "연결 {count}개", + "viewer.finder.result.focus.one": "{label} 포커스, 관련 연결 {count}개", + "viewer.finder.result.focus.other": "{label} 포커스, 관련 연결 {count}개", + "viewer.finder.status.filtered": "{noun} {available}개 중 {visible}개", + "viewer.finder.status.all": "{noun} {available}개", + "viewer.passport.eyebrow": "시맨틱 패스포트", + "viewer.passport.metadata": "노드 메타데이터", + "viewer.passport.evidence": "검증된 소스 근거", + "viewer.passport.verified": "검증된 소스", + "viewer.passport.verificationScope": "고정된 리비전 기준 로컬 Git으로 검증했습니다. 원격 접근 권한은 확인하지 않았습니다.", + "viewer.passport.reach": "편집된 도달범위", + "viewer.passport.reach.trace": "편집된 도달가능성 추적", + "viewer.passport.upstream": "업스트림", + "viewer.passport.downstream": "다운스트림", + "viewer.passport.upstream.trace": "업스트림 편집 도달가능성 추적", + "viewer.passport.downstream.trace": "다운스트림 편집 도달가능성 추적", + "viewer.passport.close": "시맨틱 패스포트 닫기", + "viewer.passport.copy": "링크 복사", + "viewer.passport.copy.focus": "포커스된 노드의 링크 복사", + "viewer.passport.relations": "관계", + "viewer.passport.relations.show": "연결된 관계 표시", + "viewer.passport.relations.hide": "연결된 관계 숨기기", + "viewer.passport.relations.list": "연결된 관계", + "viewer.passport.copyRelation": "관계 복사", + "viewer.passport.copyNode": "노드 복사", + "viewer.passport.copyPinned": "고정된 관계의 링크 복사", + "viewer.passport.copySource": "소스 노드의 링크 복사", + "viewer.passport.copy.focused.success": "포커스된 노드 링크를 복사했습니다", + "viewer.passport.copy.pinned.success": "고정된 관계 링크를 복사했습니다", + "viewer.passport.copy.focused.failed": "포커스된 노드 링크를 복사할 수 없습니다", + "viewer.passport.copy.pinned.failed": "고정된 관계 링크를 복사할 수 없습니다", + "viewer.passport.relationship.none": "연결된 관계가 없습니다", + "viewer.passport.relationship.count.one": "관계 {count}개", + "viewer.passport.relationship.count.other": "관계 {count}개", + "viewer.passport.relationship.show.one": "연결된 관계 {count}개 표시", + "viewer.passport.relationship.show.other": "연결된 관계 {count}개 표시", + "viewer.passport.relationship.summary": "출향 {out}개 · 입향 {in}개{loops}", + "viewer.passport.relationship.loops": " · 자기순환 {count}개", + "viewer.passport.relationship.explorer": "직접 관계 탐색기", + "viewer.passport.relationship.help": "방향키로 관계를 탐색하세요. Enter 또는 Space로 상세정보를 고정하고, Escape로 지웁니다.", + "viewer.passport.relationship.loopsBack": "되돌아옴", + "viewer.passport.relationship.connectsTo": "연결 대상", + "viewer.passport.relationship.connectsFrom": "연결 출처", + "viewer.passport.relationship.pinned": "고정된 관계 · {from} → {to} · {label}", + "viewer.passport.relationship.inspect": "{total}개 중 {index}번 관계 검사: {from}에서 {to}로, {label}. Enter로 상세정보 확인.", + "viewer.passport.relationship.group.out": "출향", + "viewer.passport.relationship.group.in": "입향", + "viewer.passport.relationship.group.loop": "자기순환", + "viewer.passport.relationship.row": "{group}: {relationship}, {neighbor}", + "viewer.passport.relationship.direction.out": "출 →", + "viewer.passport.relationship.direction.in": "← 입", + "viewer.passport.relationship.direction.loop": "순환", + "viewer.passport.sourceCount.one": "검증된 소스 참조 {count}개", + "viewer.passport.sourceCount.other": "검증된 소스 참조 {count}개", + "viewer.passport.sourceMarker": "출처", + "viewer.passport.beacon.one": "검증된 소스 {count}개; 이 노드를 포커스하여 확인", + "viewer.passport.beacon.other": "검증된 소스 {count}개; 이 노드를 포커스하여 확인", + "viewer.passport.repository.open": "검증된 저장소 리비전 {revision} 열기", + "viewer.passport.source.open": "리비전 {revision}의 검증된 소스 {path} 열기", + "viewer.passport.source.openLink": "열기 ↗", + "viewer.passport.reach.upstream.one": "업스트림 편집 노드 {count}개 추적", + "viewer.passport.reach.upstream.other": "업스트림 편집 노드 {count}개 추적", + "viewer.passport.reach.downstream.one": "다운스트림 편집 노드 {count}개 추적", + "viewer.passport.reach.downstream.other": "다운스트림 편집 노드 {count}개 추적", + "viewer.passport.reach.noUpstream": "업스트림 편집 노드가 없습니다", + "viewer.passport.reach.noDownstream": "다운스트림 편집 노드가 없습니다", + "viewer.passport.reach.status": "{direction} · 노드 {nodes}개 · 연결 {links}개 · 최대 {hops}홉", + "viewer.route.eyebrow": "경로 탐색", + "viewer.route.start": "시작 노드 선택", + "viewer.route.start.find": "시작점 찾기", + "viewer.route.start.find.aria": "경로 시작점 찾기", + "viewer.route.copy": "링크 복사", + "viewer.route.copy.aria": "추적된 경로의 링크 복사", + "viewer.route.clear": "지우기", + "viewer.route.clear.aria": "경로 탐색 지우기", + "viewer.route.traced": "추적된 경로", + "viewer.route.pickTwo": "다이어그램에서 시맨틱 노드 두 개를 선택하세요", + "viewer.route.pickOne": "다이어그램에서 시맨틱 노드 하나를 선택하세요", + "viewer.route.controls": "경로 이동 제어", + "viewer.route.previous": "이전 경로 위치", + "viewer.route.play": "경로 이동 재생", + "viewer.route.pause": "경로 이동 일시정지", + "viewer.route.replay": "경로 이동 다시 재생", + "viewer.route.next": "다음 경로 위치", + "viewer.route.journey": "이동 경로", + "viewer.route.pause.label": "일시정지", + "viewer.route.replay.label": "다시 재생", + "viewer.route.overview": "개요", + "viewer.route.overview.aria": "전체 경로 개요 표시", + "viewer.route.instructions": "출발지를 먼저 선택한 뒤 도착지를 선택하세요. 방향이 중요합니다.", + "viewer.route.destination": "{label}에서 출발할 도착지 선택", + "viewer.route.destination.find": "도착지 찾기", + "viewer.route.destination.find.aria": "도달 가능한 경로 도착지 찾기", + "viewer.route.differentDestination": "다른 도착지 선택", + "viewer.route.distinct": "경로에는 서로 다른 시맨틱 노드 두 개가 필요합니다.", + "viewer.route.unreachable": "{label}(으)로 가는 방향성 경로가 없습니다", + "viewer.route.unreachable.detail": "{source}에서 {target}에 도달할 수 없습니다. 강조 표시된 도착지를 선택하세요.", + "viewer.route.start.instructions": "출발지를 선택하세요. 다음 단계에서는 방향성으로 도달 가능한 도착지만 표시됩니다.", + "viewer.route.copy.success": "추적된 경로 링크를 복사했습니다", + "viewer.route.copy.failed": "경로 링크를 복사할 수 없습니다", + "viewer.route.position": "경로 위치 {total}개 중 {index}번: {label}", + "viewer.route.step": "{total}단계 중 {index}단계 · {phase} · {label}", + "viewer.route.motionRequired": "자동 이동에는 동적 모드가 필요합니다", + "viewer.route.trigger.clear": "추적된 경로 지우기", + "viewer.route.overview.status": "{nodes} · {hops} · 최단 편집 경로", + "viewer.route.overview.node.one": "노드 {count}개", + "viewer.route.overview.node.other": "노드 {count}개", + "viewer.route.overview.hop.one": "방향성 홉 {count}개", + "viewer.route.overview.hop.other": "방향성 홉 {count}개", + "viewer.route.phase.playing": "재생 중", + "viewer.route.phase.complete": "완료됨", + "viewer.route.phase.inspecting": "검사 중", + "viewer.route.destination.count.one": "방향성 도착지 {count}개 사용 가능. 강조 표시된 노드를 선택하세요.", + "viewer.route.destination.count.other": "방향성 도착지 {count}개 사용 가능. 강조 표시된 노드를 선택하세요.", + "viewer.route.noOutgoing": "여기서 시작하는 출향 경로가 없습니다. 지우고 다른 출발지를 선택하세요.", + "viewer.route.result.title": "{source}에서 {target}까지", + "viewer.route.finder.source.title": "경로 시작점 선택", + "viewer.route.finder.source.placeholder": "경로 출발지 검색", + "viewer.route.finder.source.empty": "일치하는 경로 출발지가 없습니다", + "viewer.route.finder.source.results": "경로를 시작할 수 있는 노드", + "viewer.route.finder.source.noun": "경로 출발지", + "viewer.route.finder.source.badge": "시작", + "viewer.route.finder.target.title": "{label}에서 출발할 도착지", + "viewer.route.finder.target.placeholder": "도달 가능한 도착지 검색", + "viewer.route.finder.target.empty": "일치하는 도달 가능한 도착지가 없습니다", + "viewer.route.finder.target.results": "도달 가능한 경로 도착지", + "viewer.route.finder.target.noun": "도달 가능한 도착지", + "viewer.route.hop.one": "홉 {count}개", + "viewer.route.hop.other": "홉 {count}개", + "viewer.lens.eyebrow": "시맨틱 렌즈", + "viewer.lens.title": "시스템 역할 비교", + "viewer.lens.close": "시맨틱 렌즈 닫기", + "viewer.lens.instruction": "시맨틱 유형을 최대 두 개까지 선택하세요. 하나를 선택하면 실제 트래픽을 표시하고, 두 개를 선택하면 직접 편집된 관계만 비교합니다.", + "viewer.lens.kinds": "시맨틱 유형", + "viewer.lens.choose": "유형을 선택해 해당 노드와 연결된 관계를 확인하세요.", + "viewer.lens.copy": "시맨틱 렌즈 링크 복사", + "viewer.lens.clear": "시맨틱 렌즈 지우기", + "viewer.lens.open": "시맨틱 렌즈 열기", + "viewer.lens.openActive": "활성 시맨틱 렌즈 열기", + "viewer.lens.legend": "시맨틱 범례", + "viewer.lens.legend.inspect.one": "{label} 검사, 노드 {count}개", + "viewer.lens.legend.inspect.other": "{label} 검사, 노드 {count}개", + "viewer.lens.kind.count.one": "{label}, 노드 {count}개", + "viewer.lens.kind.count.other": "{label}, 노드 {count}개", + "viewer.lens.compare.one": "{first} → {second}: {forward} · {second} → {first}: {reverse} · 직접 관계 {count}개", + "viewer.lens.compare.other": "{first} → {second}: {forward} · {second} → {first}: {reverse} · 직접 관계 {count}개", + "viewer.lens.single": "{nodes} · {relationships} · 연결된 주변 노드는 계속 표시됩니다", + "viewer.lens.node.one": "{label} 노드 {count}개", + "viewer.lens.node.other": "{label} 노드 {count}개", + "viewer.lens.relationship.one": "연결된 관계 {count}개", + "viewer.lens.relationship.other": "연결된 관계 {count}개", + "viewer.radar.title": "시맨틱 레이더", + "viewer.radar.building": "개요 구성 중", + "viewer.radar.openFull": "전체 시맨틱 레이더 열기", + "viewer.radar.open": "레이더 열기", + "viewer.radar.close": "시맨틱 레이더 닫기", + "viewer.radar.surface": "다이어그램 개요입니다. 노드를 클릭해 포커스하거나 방향키로 이동하세요.", + "viewer.radar.click": "노드 클릭", + "viewer.radar.drag": "드래그로 이동", + "viewer.radar.space": "시맨틱 레이더를 표시하려면 지도 공간이 더 필요합니다.", + "viewer.radar.nodes": "시맨틱 다이어그램 레이더 노드", + "viewer.radar.focus": "시맨틱 레이더에서 {label} 포커스", + "viewer.radar.status": "노드 {count}개 · {viewport}", + "viewer.radar.fullMap": "노드 {count}개 · 전체 지도", + "viewer.radar.compacted": "시맨틱 패스포트나 지도 컨트롤을 가리지 않도록 레이더를 축소했습니다.", + "viewer.radar.cancelWaiting": "지도 공간 확보를 기다리는 시맨틱 레이더 취소", + "viewer.radar.needsSpace": "시맨틱 레이더를 표시하려면 지도 공간이 더 필요합니다", + "viewer.radar.viewport.full": "전체 지도", + "viewer.radar.viewport.width": "너비 {percent}%", + "viewer.radar.viewport.scale": "뷰포트 {percent}%", + "viewer.nav.controls": "다이어그램 보기 제어", + "viewer.nav.route": "방향성 경로 추적", + "viewer.nav.route.title": "경로 추적 (R)", + "viewer.nav.route.short": "경로", + "viewer.nav.radar": "시맨틱 레이더 열기", + "viewer.nav.radar.title": "시맨틱 레이더 (M)", + "viewer.nav.radar.short": "지도", + "viewer.nav.lens": "시맨틱 렌즈 열기", + "viewer.nav.lens.title": "시맨틱 렌즈 (L)", + "viewer.nav.lens.short": "렌즈", + "viewer.nav.find": "노드 찾기", + "viewer.nav.find.title": "노드 찾기 (/)", + "viewer.nav.guide": "다이어그램 가이드 열기", + "viewer.nav.guide.title": "다이어그램 가이드 (?)", + "viewer.nav.zoomOut": "축소", + "viewer.nav.zoomOut.title": "축소 (-)", + "viewer.nav.reset": "다이어그램 보기 초기화", + "viewer.nav.reset.title": "보기 초기화 (0)", + "viewer.nav.read": "읽기", + "viewer.nav.zoomIn": "확대", + "viewer.nav.zoomIn.title": "확대 (+)", + "viewer.nav.camera": "{hint}. 다이어그램 보기 초기화", + "viewer.nav.camera.title": "{semantic}{hint} · 보기 초기화 (0)", + "viewer.nav.camera.semantic": "시맨틱 카메라 활성 · ", + "viewer.nav.level.map": "개요", + "viewer.nav.level.read": "읽기", + "viewer.nav.level.full": "전체", + "viewer.nav.level.auto": "자동", + "viewer.nav.detail.map": "확대하면 관계 라벨과 노드 컨텍스트가 표시됩니다", + "viewer.nav.detail.read": "다시 확대하면 태그와 주석이 표시됩니다", + "viewer.nav.detail.full": "다이어그램 전체 상세정보", + "viewer.intent.summary": "{label}. 출향 {out}개, 입향 {in}개{loops}. 연결 총 {total}개. Enter로 상세정보 확인.", + "viewer.intent.loops": ", 자기순환 {count}개", + "viewer.common.copied": "복사됨", + "viewer.common.copyFailed": "복사 실패", + "viewer.common.copyLink": "링크 복사", + "viewer.common.clear": "지우기", + "viewer.common.close": "닫기", + "viewer.export.svg.auto": "SVG · 자동", + "viewer.export.svg.auto.hint": "호스트 테마에 맞춤", + "viewer.export.svg.light": "SVG · 라이트", + "viewer.export.svg.light.hint": "항상 라이트 테마", + "viewer.export.svg.dark": "SVG · 다크", + "viewer.export.svg.dark.hint": "항상 다크 테마", + "viewer.guide.title": "이 시스템 살펴보기", + "viewer.focus.selectedNodes": "선택한 노드 {count}개", + "viewer.passport.move": "의미 정보 패널 이동. 드래그하거나 화살표 키를 사용하고, Home 키로 초기화하세요.", + "viewer.outline.title": "노드 목록", + "viewer.rail.show": "설명 및 목록", + "viewer.rail.controls": "측면 패널", + "viewer.rail.collapse": "측면 패널 접기", + "viewer.rail.bottom": "패널을 다이어그램 아래로 이동", + "viewer.rail.right": "패널을 다이어그램 옆으로 이동" +} diff --git a/packages/diagram-core/vendor/archify/examples/locales/pt.json b/packages/diagram-core/vendor/archify/examples/locales/pt.json new file mode 100644 index 0000000..e48a871 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/locales/pt.json @@ -0,0 +1,425 @@ +{ + "page.title": "Diagrama {title}", + "diagram.description.architecture": "Um diagrama de arquitetura gerado pelo Archify.", + "diagram.description.workflow": "Um diagrama de fluxo de trabalho gerado pelo Archify.", + "diagram.description.sequence": "Um diagrama de sequência gerado pelo Archify.", + "diagram.description.dataflow": "Um diagrama de fluxo de dados gerado pelo Archify.", + "diagram.description.lifecycle": "Um diagrama de ciclo de vida gerado pelo Archify.", + "node.focus": "Focar {label}", + "node.focus.detail": "Focar {label}, {detail}", + "node.context.architecture": "Componente de arquitetura", + "node.context.workflow": "Nó de fluxo de trabalho", + "node.context.sequence": "Participante da sequência", + "node.context.dataflow": "Nó de fluxo de dados", + "node.context.lifecycle": "Estado do ciclo de vida", + "legend.title": "Legenda", + "legend.architecture.frontend": "Frontend", + "legend.architecture.backend": "Backend", + "legend.architecture.database": "Banco de dados", + "legend.architecture.cloud": "Nuvem", + "legend.architecture.security": "Segurança", + "legend.architecture.messagebus": "Barramento de mensagens", + "legend.architecture.external": "Externo", + "legend.workflow.frontend": "UI do usuário", + "legend.workflow.backend": "Lógica do agente", + "legend.workflow.security": "Política", + "legend.workflow.messagebus": "Ação de ferramenta", + "legend.workflow.database": "Contexto / rastreamento", + "legend.workflow.cloud": "Serviço de nuvem", + "legend.workflow.external": "Sistema externo", + "legend.sequence.emphasis": "solicitação principal", + "legend.sequence.return": "retorno", + "legend.sequence.security": "segurança", + "legend.sequence.dashed": "rastreamento assíncrono", + "legend.sequence.default": "mensagem", + "legend.dataflow.emphasis": "dado principal", + "legend.dataflow.security": "política / PII", + "legend.dataflow.dashed": "lote assíncrono", + "legend.dataflow.database": "armazenamento de dados", + "legend.dataflow.default": "fluxo de dados", + "legend.lifecycle.start": "estado inicial", + "legend.lifecycle.active": "ativo", + "legend.lifecycle.waiting": "aguardando", + "legend.lifecycle.decision": "decisão", + "legend.lifecycle.success": "sucesso", + "legend.lifecycle.failure": "falha / saída", + "legend.lifecycle.neutral": "neutro", + "legend.lifecycle.external": "externo", + "legend.lifecycle.final": "estado final", + "viewer.kind.frontend": "Frontend", + "viewer.kind.backend": "Backend", + "viewer.kind.database": "Banco de dados", + "viewer.kind.cloud": "Nuvem", + "viewer.kind.security": "Segurança", + "viewer.kind.messagebus": "Barramento de mensagens", + "viewer.kind.external": "Externo", + "viewer.kind.neutral": "Neutro", + "viewer.kind.node": "Nó", + "viewer.kind.start": "Início", + "viewer.kind.active": "Ativo", + "viewer.kind.waiting": "Aguardando", + "viewer.kind.decision": "Decisão", + "viewer.kind.success": "Sucesso", + "viewer.kind.failure": "Falha", + "viewer.toolbar.actions": "Ações do diagrama", + "viewer.theme.toggle.title": "Alternar tema (T)", + "viewer.theme.toggle": "Alternar tema de cores", + "viewer.theme.dark": "Escuro", + "viewer.theme.light": "Claro", + "viewer.preset.choose.title": "Escolher estilo visual (S alterna)", + "viewer.preset.choose": "Escolher estilo visual", + "viewer.preset.style": "Estilo", + "viewer.preset.menu": "Estilo visual", + "viewer.preset.identity": "Identidade visual", + "viewer.preset.cycles": "S alterna", + "viewer.preset.classic": "Clássico", + "viewer.preset.classic.short": "Clássico", + "viewer.preset.classic.hint": "Padrão técnico estável", + "viewer.preset.flow": "Fluxo de Sinal", + "viewer.preset.flow.short": "Fluxo", + "viewer.preset.flow.hint": "Apresentação com foco em movimento", + "viewer.preset.blueprint": "Planta", + "viewer.preset.blueprint.hint": "Revisão de engenharia", + "viewer.preset.editorial": "Editorial", + "viewer.preset.editorial.hint": "Notas de publicação e lançamento", + "viewer.preset.badge.signalFlow": "FLUXO DE SINAL", + "viewer.preset.badge.blueprint": "PLANTA / REV 01", + "viewer.preset.badge.editorial": "EDITORIAL / NOTA DE CAMPO", + "viewer.preset.badge.editorialPlate": "ARCHIFY / PLACA 04", + "viewer.preset.current": "Estilo visual: {style}. Escolher estilo visual", + "viewer.motion.live": "Ao vivo", + "viewer.motion.still": "Estático", + "viewer.motion.pause": "Pausar movimento", + "viewer.motion.resume": "Retomar movimento", + "viewer.motion.reduced": "Movimento pausado pela preferência de movimento reduzido", + "viewer.motion.hidden": "Movimento pausado enquanto esta página está oculta", + "viewer.motion.yielding": "Pausar movimento; cedendo atualmente a {owner}", + "viewer.motion.yielding.title": "Pré-visualização ao vivo ativada · cedendo a {owner}", + "viewer.owner.route": "Sonda de Rota", + "viewer.owner.lens": "Lente Semântica", + "viewer.owner.relationship": "Pré-visualização de Relação", + "viewer.owner.intent": "Rastreamento de Intenção", + "viewer.owner.focus": "foco semântico", + "viewer.owner.legend": "pré-visualização da legenda", + "viewer.owner.reader": "interação do leitor", + "viewer.present.enter": "Entrar no palco de apresentação", + "viewer.present.enter.title": "Palco de apresentação (F)", + "viewer.present.exit": "Sair do palco de apresentação", + "viewer.present.exit.title": "Sair do palco de apresentação (F ou Escape)", + "viewer.present.present": "Apresentar", + "viewer.present.exit.label": "Sair", + "viewer.export.button": "Exportar", + "viewer.export.button.title": "Exportar diagrama (E)", + "viewer.export.diagram": "Exportar diagrama", + "viewer.export.menu": "Exportar", + "viewer.export.subtitle": "Saídas portáteis e limpas", + "viewer.export.share": "Compartilhar", + "viewer.export.shareCard": "Cartão de Compartilhamento", + "viewer.export.routeShareCard": "Cartão de Compartilhamento de Rota", + "viewer.export.reachShareCard": "Cartão de Compartilhamento de Alcance", + "viewer.export.copyDiagram": "Copiar diagrama", + "viewer.export.clipboardPng": "PNG para a área de transferência", + "viewer.export.raster": "Imagens raster", + "viewer.export.image": "Imagem", + "viewer.export.lossless": "Imagem sem perdas", + "viewer.export.compact": "Imagem compacta", + "viewer.export.modern": "Imagem moderna", + "viewer.export.vectorMotion": "Vetor e movimento", + "viewer.export.vectorMotion.heading": "Vetor e movimento", + "viewer.export.editable": "Vetor editável", + "viewer.export.motion6s": "Movimento de 6s", + "viewer.export.unsupported": "Não suportado por este navegador", + "viewer.export.clipboardUnsupported": "Este navegador não suporta gravação de imagem na área de transferência", + "viewer.export.clipboardUnsupported.short": "Gravação de imagem na área de transferência não suportada neste navegador.", + "viewer.export.motionUnavailable": "Captura de movimento indisponível neste navegador", + "viewer.export.webmUnavailable": "WebM indisponível neste navegador", + "viewer.export.failed": "Falha na exportação: {message}", + "viewer.export.unknownVariant": "Variante de Cartão de Compartilhamento desconhecida: {variant}", + "viewer.export.routeRequired": "Trace uma rota antes de exportar um Cartão de Compartilhamento de Rota", + "viewer.export.reachRequired": "Trace o alcance definido antes de exportar um Cartão de Compartilhamento de Alcance", + "viewer.export.unknown": "desconhecido", + "viewer.export.routeFailed": "Falha ao exportar o Cartão de Compartilhamento de Rota: {message}", + "viewer.export.reachFailed": "Falha ao exportar o Cartão de Compartilhamento de Alcance: {message}", + "viewer.export.copyFailed": "Falha ao copiar: {message}", + "viewer.export.copiedPng": "PNG copiado para a área de transferência", + "viewer.export.downloadedRoute": "Cartão de Compartilhamento de Rota baixado", + "viewer.export.downloadedReach": "Cartão de Compartilhamento de Alcance baixado", + "viewer.export.downloadedWebm": "WebM baixado", + "viewer.export.recording": "Gravando 6 segundos de movimento…", + "viewer.export.card.routeSummary.one": "Rota: {source} → {target} · {count} salto direcionado", + "viewer.export.card.routeSummary.other": "Rota: {source} → {target} · {count} saltos direcionados", + "viewer.export.card.reachSummary": "{direction} definido a partir de {origin} · {nodes} · {links} · máx {hops}", + "viewer.export.card.node.one": "{count} nó", + "viewer.export.card.node.other": "{count} nós", + "viewer.export.card.link.one": "{count} conexão", + "viewer.export.card.link.other": "{count} conexões", + "viewer.export.card.hop.one": "{count} salto", + "viewer.export.card.hop.other": "{count} saltos", + "viewer.export.card.routeBadge": "ARCHIFY · ROTA · {hops}", + "viewer.export.card.reachBadge": "ARCHIFY · ALCANCE {direction}", + "viewer.export.direction.upstream": "Upstream", + "viewer.export.direction.downstream": "Downstream", + "viewer.export.error.canvasUnavailable": "Canvas indisponível para {label}", + "viewer.export.error.contextUnavailable": "Contexto de canvas 2D indisponível para {label}", + "viewer.export.error.toBlobUnavailable": "canvas.toBlob indisponível para {label}", + "viewer.export.error.toBlobNull": "canvas.toBlob não retornou dados para {label}", + "viewer.export.error.variantsCombined": "As variantes do Cartão de Compartilhamento não podem ser combinadas", + "viewer.export.error.viewerState": "A exportação do Cartão de Compartilhamento não conseguiu remover o estado temporário do visualizador", + "viewer.export.error.routeState": "A exportação do Cartão de Rota não conseguiu preservar a rota resolvida com segurança", + "viewer.export.error.reachState": "A exportação do Cartão de Alcance não conseguiu preservar o alcance definido com segurança", + "viewer.export.error.webmRequirements": "A exportação de movimento em WebM requer uma animação de rastreamento e suporte a MediaRecorder no navegador", + "viewer.export.error.mediaRecorder": "Falha no MediaRecorder", + "viewer.export.error.emptyWebm": "O MediaRecorder produziu um WebM vazio", + "viewer.export.error.webmBackground": "Não foi possível carregar o plano de fundo SVG para a exportação em WebM", + "viewer.guide.eyebrow": "Guia do diagrama", + "viewer.guide.close": "Fechar guia do diagrama", + "viewer.guide.inspecting": "Inspecionando semântica compilada", + "viewer.guide.actions": "Ações de exploração do diagrama", + "viewer.guide.find": "Encontrar qualquer nó", + "viewer.guide.find.hint": "Pesquise rótulos, responsabilidades, tipos e IDs estáveis.", + "viewer.guide.route": "Traçar uma rota", + "viewer.guide.route.aria": "Traçar uma rota direcionada", + "viewer.guide.route.hint": "Descubra como dois nós semânticos se conectam na direção definida.", + "viewer.guide.map": "Ver o sistema inteiro", + "viewer.guide.map.hint": "Abra o Radar Semântico com uma janela de visualização ativa e nós estáveis.", + "viewer.guide.lens": "Comparar tipos semânticos", + "viewer.guide.lens.hint": "Conte papéis, revele seu tráfego e compare links diretos definidos.", + "viewer.guide.present": "Entrar no Palco de Apresentação", + "viewer.guide.present.hint": "Dê ao diagrama ao vivo a janela de visualização inteira sem alterar a exportação.", + "viewer.guide.shortcuts": "Atalhos de teclado adicionais", + "viewer.guide.shortcut.export": "Exportar", + "viewer.guide.shortcut.theme": "Tema", + "viewer.guide.shortcut.style": "Estilo", + "viewer.guide.shortcut.reset": "Redefinir", + "viewer.guide.shortcut.zoomIn": "Ampliar", + "viewer.guide.shortcut.zoomOut": "Reduzir", + "viewer.guide.shortcut.close": "Fechar", + "viewer.guide.facts": "{nodes} · {relationships}", + "viewer.guide.fact.node.one": "{count} nó semântico", + "viewer.guide.fact.node.other": "{count} nós semânticos", + "viewer.guide.fact.relationship.one": "{count} relação", + "viewer.guide.fact.relationship.other": "{count} relações", + "viewer.guide.open": "Abrir guia do diagrama", + "viewer.finder.title": "Encontrar um nó", + "viewer.finder.close": "Fechar buscador de nós", + "viewer.finder.placeholder": "Pesquisar rótulos ou IDs", + "viewer.finder.search": "Pesquisar nós do diagrama", + "viewer.finder.results": "Nós do diagrama", + "viewer.finder.empty": "Nenhum nó correspondente", + "viewer.finder.result.focus": "Focar {label}", + "viewer.finder.result.routeStart": "Escolher {label} como início da rota", + "viewer.finder.result.routeTarget": "Escolher {label} como destino da rota, {links}", + "viewer.finder.status.empty": "Nenhum nó correspondente", + "viewer.finder.status.count.one": "{count} nó correspondente", + "viewer.finder.status.count.other": "{count} nós correspondentes", + "viewer.finder.noun.nodes": "nós", + "viewer.finder.link.one": "{count} conexão", + "viewer.finder.link.other": "{count} conexões", + "viewer.finder.result.focus.one": "Focar {label}, {count} conexão relacionada", + "viewer.finder.result.focus.other": "Focar {label}, {count} conexões relacionadas", + "viewer.finder.status.filtered": "{visible} de {available} {noun}", + "viewer.finder.status.all": "{available} {noun}", + "viewer.passport.eyebrow": "Passaporte semântico", + "viewer.passport.metadata": "Metadados do nó", + "viewer.passport.evidence": "Evidência de origem verificada", + "viewer.passport.verified": "Origem verificada", + "viewer.passport.verificationScope": "Verificado com o Git local na revisão fixada. O acesso remoto não foi verificado.", + "viewer.passport.reach": "Alcance definido", + "viewer.passport.reach.trace": "Traçar alcançabilidade definida", + "viewer.passport.upstream": "Upstream", + "viewer.passport.downstream": "Downstream", + "viewer.passport.upstream.trace": "Traçar alcançabilidade definida upstream", + "viewer.passport.downstream.trace": "Traçar alcançabilidade definida downstream", + "viewer.passport.close": "Fechar passaporte semântico", + "viewer.passport.copy": "Copiar link", + "viewer.passport.copy.focus": "Copiar link do nó em foco", + "viewer.passport.relations": "Relações", + "viewer.passport.relations.show": "Mostrar relações conectadas", + "viewer.passport.relations.hide": "Ocultar relações conectadas", + "viewer.passport.relations.list": "Relações conectadas", + "viewer.passport.copyRelation": "Copiar relação", + "viewer.passport.copyNode": "Copiar nó", + "viewer.passport.copyPinned": "Copiar link da relação fixada", + "viewer.passport.copySource": "Copiar link do nó de origem", + "viewer.passport.copy.focused.success": "Link do nó em foco copiado", + "viewer.passport.copy.pinned.success": "Link da relação fixada copiado", + "viewer.passport.copy.focused.failed": "Não foi possível copiar o link do nó em foco", + "viewer.passport.copy.pinned.failed": "Não foi possível copiar o link da relação fixada", + "viewer.passport.relationship.none": "Nenhuma relação conectada", + "viewer.passport.relationship.count.one": "{count} relação", + "viewer.passport.relationship.count.other": "{count} relações", + "viewer.passport.relationship.show.one": "Mostrar {count} relação conectada", + "viewer.passport.relationship.show.other": "Mostrar {count} relações conectadas", + "viewer.passport.relationship.summary": "{out} de saída · {in} de entrada{loops}", + "viewer.passport.relationship.loops": " · {count} laço", + "viewer.passport.relationship.explorer": "Explorador de relações diretas", + "viewer.passport.relationship.help": "Use as setas para explorar relações. Pressione Enter ou Espaço para fixar detalhes; Escape limpa.", + "viewer.passport.relationship.loopsBack": "retorna em laço", + "viewer.passport.relationship.connectsTo": "conecta-se a", + "viewer.passport.relationship.connectsFrom": "conecta-se de", + "viewer.passport.relationship.pinned": "Relação fixada · {from} → {to} · {label}", + "viewer.passport.relationship.inspect": "Inspecionar relação {index} de {total}: {from} para {to}, {label}. Pressione Enter para detalhes.", + "viewer.passport.relationship.group.out": "Saída", + "viewer.passport.relationship.group.in": "Entrada", + "viewer.passport.relationship.group.loop": "Laços próprios", + "viewer.passport.relationship.row": "{group}: {relationship}, {neighbor}", + "viewer.passport.relationship.direction.out": "SAÍDA →", + "viewer.passport.relationship.direction.in": "← ENTRADA", + "viewer.passport.relationship.direction.loop": "LAÇO", + "viewer.passport.sourceCount.one": "{count} referência de origem verificada", + "viewer.passport.sourceCount.other": "{count} referências de origem verificadas", + "viewer.passport.sourceMarker": "ORIG", + "viewer.passport.beacon.one": "{count} origem verificada; foque este nó para inspecionar", + "viewer.passport.beacon.other": "{count} origens verificadas; foque este nó para inspecionar", + "viewer.passport.repository.open": "Abrir revisão verificada do repositório {revision}", + "viewer.passport.source.open": "Abrir origem verificada {path} na revisão {revision}", + "viewer.passport.source.openLink": "Abrir ↗", + "viewer.passport.reach.upstream.one": "Traçar {count} nó definido upstream", + "viewer.passport.reach.upstream.other": "Traçar {count} nós definidos upstream", + "viewer.passport.reach.downstream.one": "Traçar {count} nó definido downstream", + "viewer.passport.reach.downstream.other": "Traçar {count} nós definidos downstream", + "viewer.passport.reach.noUpstream": "Nenhum nó definido upstream", + "viewer.passport.reach.noDownstream": "Nenhum nó definido downstream", + "viewer.passport.reach.status": "{direction} · {nodes} nós · {links} conexões · máx {hops} saltos", + "viewer.route.eyebrow": "Sonda de rota", + "viewer.route.start": "Escolher um nó inicial", + "viewer.route.start.find": "Encontrar início", + "viewer.route.start.find.aria": "Encontrar um início de rota", + "viewer.route.copy": "Copiar link", + "viewer.route.copy.aria": "Copiar link da rota traçada", + "viewer.route.clear": "Limpar", + "viewer.route.clear.aria": "Limpar sonda de rota", + "viewer.route.traced": "Rota traçada", + "viewer.route.pickTwo": "Escolha dois nós semânticos no diagrama", + "viewer.route.pickOne": "Escolha um nó semântico no diagrama", + "viewer.route.controls": "Controles da jornada de rota", + "viewer.route.previous": "Posição anterior da rota", + "viewer.route.play": "Reproduzir jornada de rota", + "viewer.route.pause": "Pausar jornada de rota", + "viewer.route.replay": "Reproduzir jornada de rota novamente", + "viewer.route.next": "Próxima posição da rota", + "viewer.route.journey": "Jornada", + "viewer.route.pause.label": "Pausar", + "viewer.route.replay.label": "Repetir", + "viewer.route.overview": "Visão geral", + "viewer.route.overview.aria": "Mostrar visão geral completa da rota", + "viewer.route.instructions": "Escolha a origem e depois o destino. A direção importa.", + "viewer.route.destination": "Escolher um destino a partir de {label}", + "viewer.route.destination.find": "Encontrar destino", + "viewer.route.destination.find.aria": "Encontrar um destino de rota alcançável", + "viewer.route.differentDestination": "Escolher um destino diferente", + "viewer.route.distinct": "Uma rota precisa de dois nós semânticos distintos.", + "viewer.route.unreachable": "Nenhuma rota direcionada para {label}", + "viewer.route.unreachable.detail": "{target} não é alcançável a partir de {source}. Escolha um destino destacado.", + "viewer.route.start.instructions": "Selecione a origem. O próximo passo revelará apenas destinos direcionados.", + "viewer.route.copy.success": "Link da rota traçada copiado", + "viewer.route.copy.failed": "Não foi possível copiar o link da rota traçada", + "viewer.route.position": "Posição {index} de {total} na rota: {label}", + "viewer.route.step": "Passo {index} de {total} · {phase} · {label}", + "viewer.route.motionRequired": "A jornada automática requer movimento Ao vivo", + "viewer.route.trigger.clear": "Limpar rota traçada", + "viewer.route.overview.status": "{nodes} · {hops} · rota mais curta definida", + "viewer.route.overview.node.one": "{count} nó", + "viewer.route.overview.node.other": "{count} nós", + "viewer.route.overview.hop.one": "{count} salto direcionado", + "viewer.route.overview.hop.other": "{count} saltos direcionados", + "viewer.route.phase.playing": "Reproduzindo", + "viewer.route.phase.complete": "Concluído", + "viewer.route.phase.inspecting": "Inspecionando", + "viewer.route.destination.count.one": "{count} destino direcionado disponível. Escolha um nó destacado.", + "viewer.route.destination.count.other": "{count} destinos direcionados disponíveis. Escolha um nó destacado.", + "viewer.route.noOutgoing": "Nenhuma rota de saída começa aqui. Limpe e escolha outra origem.", + "viewer.route.result.title": "{source} até {target}", + "viewer.route.finder.source.title": "Escolher início da rota", + "viewer.route.finder.source.placeholder": "Pesquisar origens de rota", + "viewer.route.finder.source.empty": "Nenhuma origem de rota correspondente", + "viewer.route.finder.source.results": "Nós que podem iniciar uma rota", + "viewer.route.finder.source.noun": "origens de rota", + "viewer.route.finder.source.badge": "início", + "viewer.route.finder.target.title": "Destino a partir de {label}", + "viewer.route.finder.target.placeholder": "Pesquisar destinos alcançáveis", + "viewer.route.finder.target.empty": "Nenhum destino alcançável correspondente", + "viewer.route.finder.target.results": "Destinos de rota alcançáveis", + "viewer.route.finder.target.noun": "destinos alcançáveis", + "viewer.route.hop.one": "{count} salto", + "viewer.route.hop.other": "{count} saltos", + "viewer.lens.eyebrow": "Lente semântica", + "viewer.lens.title": "Comparar papéis do sistema", + "viewer.lens.close": "Fechar lente semântica", + "viewer.lens.instruction": "Escolha até dois tipos semânticos. Um revela seu tráfego real; dois comparam apenas relações diretas definidas.", + "viewer.lens.kinds": "Tipos semânticos", + "viewer.lens.choose": "Escolha um tipo para inspecionar seus nós e relações que o tocam.", + "viewer.lens.copy": "Copiar link da lente semântica", + "viewer.lens.clear": "Limpar lente semântica", + "viewer.lens.open": "Abrir lente semântica", + "viewer.lens.openActive": "Abrir lente semântica ativa", + "viewer.lens.legend": "Legenda semântica", + "viewer.lens.legend.inspect.one": "Inspecionar {label}, {count} nó", + "viewer.lens.legend.inspect.other": "Inspecionar {label}, {count} nós", + "viewer.lens.kind.count.one": "{label}, {count} nó", + "viewer.lens.kind.count.other": "{label}, {count} nós", + "viewer.lens.compare.one": "{first} → {second}: {forward} · {second} → {first}: {reverse} · {count} relação direta", + "viewer.lens.compare.other": "{first} → {second}: {forward} · {second} → {first}: {reverse} · {count} relações diretas", + "viewer.lens.single": "{nodes} · {relationships} · nós conectados permanecem visíveis", + "viewer.lens.node.one": "{count} nó {label}", + "viewer.lens.node.other": "{count} nós {label}", + "viewer.lens.relationship.one": "{count} relação que toca", + "viewer.lens.relationship.other": "{count} relações que tocam", + "viewer.radar.title": "Radar semântico", + "viewer.radar.building": "Construindo visão geral", + "viewer.radar.openFull": "Abrir radar semântico completo", + "viewer.radar.open": "Abrir radar", + "viewer.radar.close": "Fechar radar semântico", + "viewer.radar.surface": "Visão geral do diagrama. Clique em um nó para focá-lo, ou use as setas para navegar.", + "viewer.radar.click": "Clicar no nó", + "viewer.radar.drag": "Arrastar para navegar", + "viewer.radar.space": "O radar semântico precisa de mais espaço no MAPA.", + "viewer.radar.nodes": "Nós do radar do diagrama semântico", + "viewer.radar.focus": "Focar {label} a partir do Radar Semântico", + "viewer.radar.status": "{count} nós · {viewport}", + "viewer.radar.fullMap": "{count} nós · mapa completo", + "viewer.radar.compacted": "Radar compactado para não cobrir o Passaporte Semântico ou os controles do MAPA.", + "viewer.radar.cancelWaiting": "Cancelar radar semântico aguardando mais espaço no MAPA", + "viewer.radar.needsSpace": "O radar semântico precisa de mais espaço visível no MAPA", + "viewer.radar.viewport.full": "mapa completo", + "viewer.radar.viewport.width": "{percent}% de largura", + "viewer.radar.viewport.scale": "{percent}% da janela de visualização", + "viewer.nav.controls": "Controles de visualização do diagrama", + "viewer.nav.route": "Traçar uma rota direcionada", + "viewer.nav.route.title": "Traçar rota (R)", + "viewer.nav.route.short": "ROTA", + "viewer.nav.radar": "Abrir radar semântico", + "viewer.nav.radar.title": "Radar semântico (M)", + "viewer.nav.radar.short": "MAPA", + "viewer.nav.lens": "Abrir lente semântica", + "viewer.nav.lens.title": "Lente semântica (L)", + "viewer.nav.lens.short": "LENTE", + "viewer.nav.find": "Encontrar um nó", + "viewer.nav.find.title": "Encontrar um nó (/)", + "viewer.nav.guide": "Abrir guia do diagrama", + "viewer.nav.guide.title": "Guia do diagrama (?)", + "viewer.nav.zoomOut": "Reduzir", + "viewer.nav.zoomOut.title": "Reduzir (-)", + "viewer.nav.reset": "Redefinir visualização do diagrama", + "viewer.nav.reset.title": "Redefinir visualização (0)", + "viewer.nav.read": "LEITURA", + "viewer.nav.zoomIn": "Ampliar", + "viewer.nav.zoomIn.title": "Ampliar (+)", + "viewer.nav.camera": "{hint}. Redefinir visualização do diagrama", + "viewer.nav.camera.title": "{semantic}{hint} · redefinir visualização (0)", + "viewer.nav.camera.semantic": "Câmera semântica ativa · ", + "viewer.nav.level.map": "MAPA", + "viewer.nav.level.read": "LEITURA", + "viewer.nav.level.full": "COMPLETO", + "viewer.nav.level.auto": "AUTO", + "viewer.nav.detail.map": "Amplie para revelar rótulos de relações e contexto do nó", + "viewer.nav.detail.read": "Amplie novamente para revelar tags e anotações", + "viewer.nav.detail.full": "Detalhe completo do diagrama", + "viewer.intent.summary": "{label}. {out} de saída, {in} de entrada{loops}. {total} conexões. Pressione Enter para detalhes.", + "viewer.intent.loops": ", {count} laço próprio", + "viewer.common.copied": "Copiado", + "viewer.common.copyFailed": "Falha ao copiar", + "viewer.common.copyLink": "Copiar link", + "viewer.common.clear": "Limpar", + "viewer.common.close": "Fechar" +} diff --git a/packages/diagram-core/vendor/archify/examples/locales/ru.json b/packages/diagram-core/vendor/archify/examples/locales/ru.json new file mode 100644 index 0000000..d86e14f --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/locales/ru.json @@ -0,0 +1,425 @@ +{ + "page.title": "{title} — диаграмма", + "diagram.description.architecture": "Диаграмма архитектуры, созданная в Archify.", + "diagram.description.workflow": "Диаграмма рабочего процесса, созданная в Archify.", + "diagram.description.sequence": "Диаграмма последовательности, созданная в Archify.", + "diagram.description.dataflow": "Диаграмма потока данных, созданная в Archify.", + "diagram.description.lifecycle": "Диаграмма жизненного цикла, созданная в Archify.", + "node.focus": "Фокус: {label}", + "node.focus.detail": "Фокус: {label}, {detail}", + "node.context.architecture": "Компонент архитектуры", + "node.context.workflow": "Узел рабочего процесса", + "node.context.sequence": "Участник последовательности", + "node.context.dataflow": "Узел потока данных", + "node.context.lifecycle": "Состояние жизненного цикла", + "legend.title": "Легенда", + "legend.architecture.frontend": "Фронтенд", + "legend.architecture.backend": "Бэкенд", + "legend.architecture.database": "База данных", + "legend.architecture.cloud": "Облако", + "legend.architecture.security": "Безопасность", + "legend.architecture.messagebus": "Шина сообщений", + "legend.architecture.external": "Внешний", + "legend.workflow.frontend": "Интерфейс пользователя", + "legend.workflow.backend": "Логика агента", + "legend.workflow.security": "Политика", + "legend.workflow.messagebus": "Действие инструмента", + "legend.workflow.database": "Контекст / трассировка", + "legend.workflow.cloud": "Облачный сервис", + "legend.workflow.external": "Внешняя система", + "legend.sequence.emphasis": "основной запрос", + "legend.sequence.return": "возврат", + "legend.sequence.security": "безопасность", + "legend.sequence.dashed": "асинхронная трассировка", + "legend.sequence.default": "сообщение", + "legend.dataflow.emphasis": "основные данные", + "legend.dataflow.security": "политика / ПДн", + "legend.dataflow.dashed": "асинхронный пакет", + "legend.dataflow.database": "хранилище данных", + "legend.dataflow.default": "поток данных", + "legend.lifecycle.start": "начальное состояние", + "legend.lifecycle.active": "активно", + "legend.lifecycle.waiting": "ожидание", + "legend.lifecycle.decision": "решение", + "legend.lifecycle.success": "успех", + "legend.lifecycle.failure": "ошибка / выход", + "legend.lifecycle.neutral": "нейтральное", + "legend.lifecycle.external": "внешнее", + "legend.lifecycle.final": "конечное состояние", + "viewer.kind.frontend": "Фронтенд", + "viewer.kind.backend": "Бэкенд", + "viewer.kind.database": "База данных", + "viewer.kind.cloud": "Облако", + "viewer.kind.security": "Безопасность", + "viewer.kind.messagebus": "Шина сообщений", + "viewer.kind.external": "Внешний", + "viewer.kind.neutral": "Нейтральный", + "viewer.kind.node": "Узел", + "viewer.kind.start": "Начало", + "viewer.kind.active": "Активно", + "viewer.kind.waiting": "Ожидание", + "viewer.kind.decision": "Решение", + "viewer.kind.success": "Успех", + "viewer.kind.failure": "Ошибка", + "viewer.toolbar.actions": "Действия с диаграммой", + "viewer.theme.toggle.title": "Переключить тему (T)", + "viewer.theme.toggle": "Переключить цветовую тему", + "viewer.theme.dark": "Тёмная", + "viewer.theme.light": "Светлая", + "viewer.preset.choose.title": "Выбрать визуальный стиль (S — переключение)", + "viewer.preset.choose": "Выбрать визуальный стиль", + "viewer.preset.style": "Стиль", + "viewer.preset.menu": "Визуальный стиль", + "viewer.preset.identity": "Визуальная идентичность", + "viewer.preset.cycles": "S — переключение", + "viewer.preset.classic": "Классический", + "viewer.preset.classic.short": "Классика", + "viewer.preset.classic.hint": "Стабильный технический стиль по умолчанию", + "viewer.preset.flow": "Поток сигналов", + "viewer.preset.flow.short": "Поток", + "viewer.preset.flow.hint": "Презентация с акцентом на анимацию", + "viewer.preset.blueprint": "Чертёж", + "viewer.preset.blueprint.hint": "Для инженерного обзора", + "viewer.preset.editorial": "Редакционный", + "viewer.preset.editorial.hint": "Для публикаций и анонсов", + "viewer.preset.badge.signalFlow": "ПОТОК СИГНАЛОВ", + "viewer.preset.badge.blueprint": "ЧЕРТЁЖ / РЕД. 01", + "viewer.preset.badge.editorial": "РЕДАКЦИЯ / ЗАМЕТКА", + "viewer.preset.badge.editorialPlate": "ARCHIFY / ПЛАСТИНА 04", + "viewer.preset.current": "Визуальный стиль: {style}. Выбрать визуальный стиль", + "viewer.motion.live": "Динамика", + "viewer.motion.still": "Статика", + "viewer.motion.pause": "Приостановить анимацию", + "viewer.motion.resume": "Возобновить анимацию", + "viewer.motion.reduced": "Анимация приостановлена из-за настройки сниженного движения", + "viewer.motion.hidden": "Анимация приостановлена, пока страница скрыта", + "viewer.motion.yielding": "Приостановить анимацию; сейчас уступает место: {owner}", + "viewer.motion.yielding.title": "Динамический просмотр включён · уступает место: {owner}", + "viewer.owner.route": "Зонд маршрута", + "viewer.owner.lens": "Семантическая линза", + "viewer.owner.relationship": "Предпросмотр связи", + "viewer.owner.intent": "Трассировка намерения", + "viewer.owner.focus": "семантический фокус", + "viewer.owner.legend": "предпросмотр легенды", + "viewer.owner.reader": "взаимодействие читателя", + "viewer.present.enter": "Войти в режим презентации", + "viewer.present.enter.title": "Режим презентации (F)", + "viewer.present.exit": "Выйти из режима презентации", + "viewer.present.exit.title": "Выйти из режима презентации (F или Escape)", + "viewer.present.present": "Презентация", + "viewer.present.exit.label": "Выход", + "viewer.export.button": "Экспорт", + "viewer.export.button.title": "Экспортировать диаграмму (E)", + "viewer.export.diagram": "Экспортировать диаграмму", + "viewer.export.menu": "Экспорт", + "viewer.export.subtitle": "Портативные, аккуратные файлы", + "viewer.export.share": "Поделиться", + "viewer.export.shareCard": "Карточка для публикации", + "viewer.export.routeShareCard": "Карточка маршрута", + "viewer.export.reachShareCard": "Карточка достижимости", + "viewer.export.copyDiagram": "Копировать диаграмму", + "viewer.export.clipboardPng": "PNG в буфер обмена", + "viewer.export.raster": "Растровые изображения", + "viewer.export.image": "Изображение", + "viewer.export.lossless": "Изображение без потерь", + "viewer.export.compact": "Компактное изображение", + "viewer.export.modern": "Современный формат изображения", + "viewer.export.vectorMotion": "Вектор и анимация", + "viewer.export.vectorMotion.heading": "Вектор и анимация", + "viewer.export.editable": "Редактируемый вектор", + "viewer.export.motion6s": "Анимация 6 с", + "viewer.export.unsupported": "Не поддерживается этим браузером", + "viewer.export.clipboardUnsupported": "Этот браузер не поддерживает запись изображений в буфер обмена", + "viewer.export.clipboardUnsupported.short": "Запись изображений в буфер обмена не поддерживается в этом браузере.", + "viewer.export.motionUnavailable": "Запись анимации недоступна в этом браузере", + "viewer.export.webmUnavailable": "WebM недоступен в этом браузере", + "viewer.export.failed": "Ошибка экспорта: {message}", + "viewer.export.unknownVariant": "Неизвестный тип карточки: {variant}", + "viewer.export.routeRequired": "Постройте маршрут перед экспортом карточки маршрута", + "viewer.export.reachRequired": "Постройте заданную достижимость перед экспортом карточки достижимости", + "viewer.export.unknown": "неизвестно", + "viewer.export.routeFailed": "Не удалось экспортировать карточку маршрута: {message}", + "viewer.export.reachFailed": "Не удалось экспортировать карточку достижимости: {message}", + "viewer.export.copyFailed": "Не удалось скопировать: {message}", + "viewer.export.copiedPng": "PNG скопирован в буфер обмена", + "viewer.export.downloadedRoute": "Карточка маршрута загружена", + "viewer.export.downloadedReach": "Карточка достижимости загружена", + "viewer.export.downloadedWebm": "WebM загружен", + "viewer.export.recording": "Запись анимации, 6 секунд…", + "viewer.export.card.routeSummary.one": "Маршрут: {source} → {target} · {count} направленный переход", + "viewer.export.card.routeSummary.other": "Маршрут: {source} → {target} · {count} направленных переходов", + "viewer.export.card.reachSummary": "Заданная достижимость ({direction}) от {origin} · {nodes} · {links} · макс. {hops}", + "viewer.export.card.node.one": "{count} узел", + "viewer.export.card.node.other": "{count} узлов", + "viewer.export.card.link.one": "{count} связь", + "viewer.export.card.link.other": "{count} связей", + "viewer.export.card.hop.one": "{count} переход", + "viewer.export.card.hop.other": "{count} переходов", + "viewer.export.card.routeBadge": "ARCHIFY · МАРШРУТ · {hops}", + "viewer.export.card.reachBadge": "ARCHIFY · ДОСТИЖИМОСТЬ ({direction})", + "viewer.export.direction.upstream": "Восходящий", + "viewer.export.direction.downstream": "Нисходящий", + "viewer.export.error.canvasUnavailable": "Canvas недоступен для {label}", + "viewer.export.error.contextUnavailable": "2D-контекст canvas недоступен для {label}", + "viewer.export.error.toBlobUnavailable": "canvas.toBlob недоступен для {label}", + "viewer.export.error.toBlobNull": "canvas.toBlob не вернул данные для {label}", + "viewer.export.error.variantsCombined": "Типы карточек нельзя комбинировать", + "viewer.export.error.viewerState": "Не удалось удалить временное состояние просмотра при экспорте карточки", + "viewer.export.error.routeState": "Не удалось безопасно сохранить построенный маршрут при экспорте карточки", + "viewer.export.error.reachState": "Не удалось безопасно сохранить заданную достижимость при экспорте карточки", + "viewer.export.error.webmRequirements": "Экспорт анимации в WebM требует анимации трассировки и поддержки MediaRecorder в браузере", + "viewer.export.error.mediaRecorder": "Ошибка MediaRecorder", + "viewer.export.error.emptyWebm": "MediaRecorder создал пустой файл WebM", + "viewer.export.error.webmBackground": "Не удалось загрузить фон SVG для экспорта WebM", + "viewer.guide.eyebrow": "Гид по диаграмме", + "viewer.guide.close": "Закрыть гид по диаграмме", + "viewer.guide.inspecting": "Анализ скомпилированной семантики", + "viewer.guide.actions": "Действия для изучения диаграммы", + "viewer.guide.find": "Найти любой узел", + "viewer.guide.find.hint": "Поиск по меткам, ролям, типам и постоянным ID.", + "viewer.guide.route": "Построить маршрут", + "viewer.guide.route.aria": "Построить направленный маршрут", + "viewer.guide.route.hint": "Узнайте, как два семантических узла связаны в заданном направлении.", + "viewer.guide.map": "Просмотреть всю систему", + "viewer.guide.map.hint": "Откройте семантический радар с живым видом и постоянными узлами.", + "viewer.guide.lens": "Сравнить семантические типы", + "viewer.guide.lens.hint": "Подсчитайте роли, покажите их связи и сравните прямые заданные связи.", + "viewer.guide.present": "Войти в режим презентации", + "viewer.guide.present.hint": "Отдать весь экран живой диаграмме без изменения экспорта.", + "viewer.guide.shortcuts": "Дополнительные горячие клавиши", + "viewer.guide.shortcut.export": "Экспорт", + "viewer.guide.shortcut.theme": "Тема", + "viewer.guide.shortcut.style": "Стиль", + "viewer.guide.shortcut.reset": "Сброс", + "viewer.guide.shortcut.zoomIn": "Увеличить", + "viewer.guide.shortcut.zoomOut": "Уменьшить", + "viewer.guide.shortcut.close": "Закрыть", + "viewer.guide.facts": "{nodes} · {relationships}", + "viewer.guide.fact.node.one": "{count} семантический узел", + "viewer.guide.fact.node.other": "{count} семантических узлов", + "viewer.guide.fact.relationship.one": "{count} связь", + "viewer.guide.fact.relationship.other": "{count} связей", + "viewer.guide.open": "Открыть гид по диаграмме", + "viewer.finder.title": "Найти узел", + "viewer.finder.close": "Закрыть поиск узлов", + "viewer.finder.placeholder": "Поиск по меткам или ID", + "viewer.finder.search": "Поиск узлов диаграммы", + "viewer.finder.results": "Узлы диаграммы", + "viewer.finder.empty": "Совпадений не найдено", + "viewer.finder.result.focus": "Фокус: {label}", + "viewer.finder.result.routeStart": "Выбрать {label} как начало маршрута", + "viewer.finder.result.routeTarget": "Выбрать {label} как конец маршрута, {links}", + "viewer.finder.status.empty": "Совпадений не найдено", + "viewer.finder.status.count.one": "{count} совпадающий узел", + "viewer.finder.status.count.other": "{count} совпадающих узлов", + "viewer.finder.noun.nodes": "узлов", + "viewer.finder.link.one": "{count} связь", + "viewer.finder.link.other": "{count} связей", + "viewer.finder.result.focus.one": "Фокус: {label}, {count} связанное соединение", + "viewer.finder.result.focus.other": "Фокус: {label}, {count} связанных соединений", + "viewer.finder.status.filtered": "{visible} из {available} {noun}", + "viewer.finder.status.all": "{available} {noun}", + "viewer.passport.eyebrow": "Семантический паспорт", + "viewer.passport.metadata": "Метаданные узла", + "viewer.passport.evidence": "Проверенные источники", + "viewer.passport.verified": "Проверенный источник", + "viewer.passport.verificationScope": "Проверено по локальному Git на фиксированной ревизии. Удалённый доступ не проверялся.", + "viewer.passport.reach": "Заданная достижимость", + "viewer.passport.reach.trace": "Отследить заданную достижимость", + "viewer.passport.upstream": "Восходящий", + "viewer.passport.downstream": "Нисходящий", + "viewer.passport.upstream.trace": "Отследить восходящую заданную достижимость", + "viewer.passport.downstream.trace": "Отследить нисходящую заданную достижимость", + "viewer.passport.close": "Закрыть семантический паспорт", + "viewer.passport.copy": "Скопировать ссылку", + "viewer.passport.copy.focus": "Скопировать ссылку на выделенный узел", + "viewer.passport.relations": "Связи", + "viewer.passport.relations.show": "Показать связанные отношения", + "viewer.passport.relations.hide": "Скрыть связанные отношения", + "viewer.passport.relations.list": "Связанные отношения", + "viewer.passport.copyRelation": "Копировать связь", + "viewer.passport.copyNode": "Копировать узел", + "viewer.passport.copyPinned": "Скопировать ссылку на закреплённую связь", + "viewer.passport.copySource": "Скопировать ссылку на исходный узел", + "viewer.passport.copy.focused.success": "Ссылка на выделенный узел скопирована", + "viewer.passport.copy.pinned.success": "Ссылка на закреплённую связь скопирована", + "viewer.passport.copy.focused.failed": "Не удалось скопировать ссылку на выделенный узел", + "viewer.passport.copy.pinned.failed": "Не удалось скопировать ссылку на закреплённую связь", + "viewer.passport.relationship.none": "Нет связанных отношений", + "viewer.passport.relationship.count.one": "{count} связь", + "viewer.passport.relationship.count.other": "{count} связей", + "viewer.passport.relationship.show.one": "Показать {count} связанное отношение", + "viewer.passport.relationship.show.other": "Показать {count} связанных отношений", + "viewer.passport.relationship.summary": "{out} исходящих · {in} входящих{loops}", + "viewer.passport.relationship.loops": " · {count} петля", + "viewer.passport.relationship.explorer": "Обзор прямых связей", + "viewer.passport.relationship.help": "Используйте стрелки для просмотра связей. Enter или пробел — закрепить детали; Escape — очистить.", + "viewer.passport.relationship.loopsBack": "замыкается", + "viewer.passport.relationship.connectsTo": "соединяется с", + "viewer.passport.relationship.connectsFrom": "соединяется от", + "viewer.passport.relationship.pinned": "Закреплённая связь · {from} → {to} · {label}", + "viewer.passport.relationship.inspect": "Просмотр связи {index} из {total}: {from} → {to}, {label}. Enter — подробности.", + "viewer.passport.relationship.group.out": "Исходящие", + "viewer.passport.relationship.group.in": "Входящие", + "viewer.passport.relationship.group.loop": "Петли", + "viewer.passport.relationship.row": "{group}: {relationship}, {neighbor}", + "viewer.passport.relationship.direction.out": "ИСХ →", + "viewer.passport.relationship.direction.in": "← ВХ", + "viewer.passport.relationship.direction.loop": "ПЕТЛЯ", + "viewer.passport.sourceCount.one": "{count} проверенная ссылка на источник", + "viewer.passport.sourceCount.other": "{count} проверенных ссылок на источники", + "viewer.passport.sourceMarker": "ИСТ", + "viewer.passport.beacon.one": "{count} проверенный источник; выделите узел для просмотра", + "viewer.passport.beacon.other": "{count} проверенных источников; выделите узел для просмотра", + "viewer.passport.repository.open": "Открыть проверенную ревизию репозитория {revision}", + "viewer.passport.source.open": "Открыть проверенный источник {path} на ревизии {revision}", + "viewer.passport.source.openLink": "Открыть ↗", + "viewer.passport.reach.upstream.one": "Отследить {count} восходящий заданный узел", + "viewer.passport.reach.upstream.other": "Отследить {count} восходящих заданных узлов", + "viewer.passport.reach.downstream.one": "Отследить {count} нисходящий заданный узел", + "viewer.passport.reach.downstream.other": "Отследить {count} нисходящих заданных узлов", + "viewer.passport.reach.noUpstream": "Нет восходящих заданных узлов", + "viewer.passport.reach.noDownstream": "Нет нисходящих заданных узлов", + "viewer.passport.reach.status": "{direction} · узлов: {nodes} · связей: {links} · макс. переходов: {hops}", + "viewer.route.eyebrow": "Зонд маршрута", + "viewer.route.start": "Выбрать начальный узел", + "viewer.route.start.find": "Найти начало", + "viewer.route.start.find.aria": "Найти начало маршрута", + "viewer.route.copy": "Скопировать ссылку", + "viewer.route.copy.aria": "Скопировать ссылку на построенный маршрут", + "viewer.route.clear": "Очистить", + "viewer.route.clear.aria": "Очистить зонд маршрута", + "viewer.route.traced": "Построенный маршрут", + "viewer.route.pickTwo": "Выберите два семантических узла на диаграмме", + "viewer.route.pickOne": "Выберите семантический узел на диаграмме", + "viewer.route.controls": "Управление воспроизведением маршрута", + "viewer.route.previous": "Предыдущая позиция маршрута", + "viewer.route.play": "Воспроизвести маршрут", + "viewer.route.pause": "Приостановить маршрут", + "viewer.route.replay": "Повторить маршрут", + "viewer.route.next": "Следующая позиция маршрута", + "viewer.route.journey": "Путь", + "viewer.route.pause.label": "Пауза", + "viewer.route.replay.label": "Повтор", + "viewer.route.overview": "Обзор", + "viewer.route.overview.aria": "Показать полный обзор маршрута", + "viewer.route.instructions": "Сначала выберите источник, затем цель. Направление важно.", + "viewer.route.destination": "Выбрать цель от {label}", + "viewer.route.destination.find": "Найти цель", + "viewer.route.destination.find.aria": "Найти достижимую цель маршрута", + "viewer.route.differentDestination": "Выбрать другую цель", + "viewer.route.distinct": "Для маршрута нужны два разных семантических узла.", + "viewer.route.unreachable": "Нет направленного маршрута к {label}", + "viewer.route.unreachable.detail": "{target} недостижим из {source}. Выберите подсвеченную цель.", + "viewer.route.start.instructions": "Выберите источник. На следующем шаге будут показаны только направленно достижимые цели.", + "viewer.route.copy.success": "Ссылка на построенный маршрут скопирована", + "viewer.route.copy.failed": "Не удалось скопировать ссылку на маршрут", + "viewer.route.position": "Позиция маршрута {index} из {total}: {label}", + "viewer.route.step": "Шаг {index} из {total} · {phase} · {label}", + "viewer.route.motionRequired": "Автоматическое воспроизведение требует режима «Динамика»", + "viewer.route.trigger.clear": "Очистить построенный маршрут", + "viewer.route.overview.status": "{nodes} · {hops} · кратчайший заданный маршрут", + "viewer.route.overview.node.one": "{count} узел", + "viewer.route.overview.node.other": "{count} узлов", + "viewer.route.overview.hop.one": "{count} направленный переход", + "viewer.route.overview.hop.other": "{count} направленных переходов", + "viewer.route.phase.playing": "Воспроизведение", + "viewer.route.phase.complete": "Завершено", + "viewer.route.phase.inspecting": "Просмотр", + "viewer.route.destination.count.one": "Доступна {count} направленная цель. Выберите подсвеченный узел.", + "viewer.route.destination.count.other": "Доступно {count} направленных целей. Выберите подсвеченный узел.", + "viewer.route.noOutgoing": "Отсюда не начинается ни один исходящий маршрут. Очистите и выберите другой источник.", + "viewer.route.result.title": "{source} → {target}", + "viewer.route.finder.source.title": "Выбрать начало маршрута", + "viewer.route.finder.source.placeholder": "Поиск источников маршрута", + "viewer.route.finder.source.empty": "Совпадающих источников маршрута не найдено", + "viewer.route.finder.source.results": "Узлы, с которых можно начать маршрут", + "viewer.route.finder.source.noun": "источников маршрута", + "viewer.route.finder.source.badge": "начало", + "viewer.route.finder.target.title": "Цель от {label}", + "viewer.route.finder.target.placeholder": "Поиск достижимых целей", + "viewer.route.finder.target.empty": "Совпадающих достижимых целей не найдено", + "viewer.route.finder.target.results": "Достижимые цели маршрута", + "viewer.route.finder.target.noun": "достижимых целей", + "viewer.route.hop.one": "{count} переход", + "viewer.route.hop.other": "{count} переходов", + "viewer.lens.eyebrow": "Семантическая линза", + "viewer.lens.title": "Сравнить роли системы", + "viewer.lens.close": "Закрыть семантическую линзу", + "viewer.lens.instruction": "Выберите до двух семантических типов. Один тип показывает реальные связи; два — сравнивают только прямые заданные связи.", + "viewer.lens.kinds": "Семантические типы", + "viewer.lens.choose": "Выберите тип, чтобы просмотреть его узлы и смежные связи.", + "viewer.lens.copy": "Скопировать ссылку на семантическую линзу", + "viewer.lens.clear": "Очистить семантическую линзу", + "viewer.lens.open": "Открыть семантическую линзу", + "viewer.lens.openActive": "Открыть активную семантическую линзу", + "viewer.lens.legend": "Семантическая легенда", + "viewer.lens.legend.inspect.one": "Просмотр {label}, {count} узел", + "viewer.lens.legend.inspect.other": "Просмотр {label}, {count} узлов", + "viewer.lens.kind.count.one": "{label}, {count} узел", + "viewer.lens.kind.count.other": "{label}, {count} узлов", + "viewer.lens.compare.one": "{first} → {second}: {forward} · {second} → {first}: {reverse} · {count} прямая связь", + "viewer.lens.compare.other": "{first} → {second}: {forward} · {second} → {first}: {reverse} · {count} прямых связей", + "viewer.lens.single": "{nodes} · {relationships} · связанные узлы остаются видимыми", + "viewer.lens.node.one": "{count} узел типа {label}", + "viewer.lens.node.other": "{count} узлов типа {label}", + "viewer.lens.relationship.one": "{count} смежная связь", + "viewer.lens.relationship.other": "{count} смежных связей", + "viewer.radar.title": "Семантический радар", + "viewer.radar.building": "Построение обзора", + "viewer.radar.openFull": "Открыть полный семантический радар", + "viewer.radar.open": "Открыть радар", + "viewer.radar.close": "Закрыть семантический радар", + "viewer.radar.surface": "Обзор диаграммы. Щёлкните узел, чтобы выделить его, или используйте стрелки для панорамирования.", + "viewer.radar.click": "Щёлкнуть узел", + "viewer.radar.drag": "Перетащите для панорамирования", + "viewer.radar.space": "Семантическому радару нужно больше места на карте.", + "viewer.radar.nodes": "Узлы семантического радара диаграммы", + "viewer.radar.focus": "Фокус: {label} (из семантического радара)", + "viewer.radar.status": "Узлов: {count} · {viewport}", + "viewer.radar.fullMap": "Узлов: {count} · полная карта", + "viewer.radar.compacted": "Радар уменьшен, чтобы не перекрывать семантический паспорт или элементы управления картой.", + "viewer.radar.cancelWaiting": "Отменить ожидание семантическим радаром дополнительного места", + "viewer.radar.needsSpace": "Семантическому радару нужно больше видимого места на карте", + "viewer.radar.viewport.full": "полная карта", + "viewer.radar.viewport.width": "ширина {percent}%", + "viewer.radar.viewport.scale": "масштаб {percent}%", + "viewer.nav.controls": "Управление видом диаграммы", + "viewer.nav.route": "Построить направленный маршрут", + "viewer.nav.route.title": "Построить маршрут (R)", + "viewer.nav.route.short": "ПУТЬ", + "viewer.nav.radar": "Открыть семантический радар", + "viewer.nav.radar.title": "Семантический радар (M)", + "viewer.nav.radar.short": "КАРТА", + "viewer.nav.lens": "Открыть семантическую линзу", + "viewer.nav.lens.title": "Семантическая линза (L)", + "viewer.nav.lens.short": "ЛИНЗА", + "viewer.nav.find": "Найти узел", + "viewer.nav.find.title": "Найти узел (/)", + "viewer.nav.guide": "Открыть гид по диаграмме", + "viewer.nav.guide.title": "Гид по диаграмме (?)", + "viewer.nav.zoomOut": "Уменьшить", + "viewer.nav.zoomOut.title": "Уменьшить (-)", + "viewer.nav.reset": "Сбросить вид диаграммы", + "viewer.nav.reset.title": "Сбросить вид (0)", + "viewer.nav.read": "ЧТЕНИЕ", + "viewer.nav.zoomIn": "Увеличить", + "viewer.nav.zoomIn.title": "Увеличить (+)", + "viewer.nav.camera": "{hint}. Сбросить вид диаграммы", + "viewer.nav.camera.title": "{semantic}{hint} · сбросить вид (0)", + "viewer.nav.camera.semantic": "Семантическая камера активна · ", + "viewer.nav.level.map": "КАРТА", + "viewer.nav.level.read": "ЧТЕНИЕ", + "viewer.nav.level.full": "ПОЛНЫЙ", + "viewer.nav.level.auto": "АВТО", + "viewer.nav.detail.map": "Увеличьте, чтобы увидеть подписи связей и контекст узлов", + "viewer.nav.detail.read": "Увеличьте ещё, чтобы увидеть теги и аннотации", + "viewer.nav.detail.full": "Полная детализация диаграммы", + "viewer.intent.summary": "{label}. {out} исходящих, {in} входящих{loops}. Всего связей: {total}. Enter — подробности.", + "viewer.intent.loops": ", {count} петля", + "viewer.common.copied": "Скопировано", + "viewer.common.copyFailed": "Не удалось скопировать", + "viewer.common.copyLink": "Скопировать ссылку", + "viewer.common.clear": "Очистить", + "viewer.common.close": "Закрыть" +} diff --git a/packages/diagram-core/vendor/archify/examples/product-analytics.dataflow.json b/packages/diagram-core/vendor/archify/examples/product-analytics.dataflow.json new file mode 100644 index 0000000..6cc4db6 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/product-analytics.dataflow.json @@ -0,0 +1,71 @@ +{ + "schema_version": 1, + "diagram_type": "dataflow", + "meta": { + "title": "Product Analytics Data Flow", + "output": "examples/dataflow-product-analytics.html", + "viewBox": [1080, 520], + "animation": "trace", + "quality_profile": "showcase" + }, + "stages": [ + { "label": "Sources" }, + { "label": "Ingest" }, + { "label": "Process" }, + { "label": "Store" }, + { "label": "Consume" } + ], + "nodes": [ + { "id": "web", "type": "frontend", "label": "Web App", "sublabel": "browser SDK", "stage": 0, "row": 0, "tag": "events" }, + { "id": "mobile", "type": "frontend", "label": "Mobile", "sublabel": "iOS / Android", "stage": 0, "row": 2, "tag": "events" }, + { "id": "edge", "type": "cloud", "label": "Edge API", "sublabel": "collector", "stage": 1, "row": 1, "tag": "TLS" }, + { "id": "consent", "type": "security", "label": "Consent Gate", "sublabel": "policy filter", "stage": 2, "row": 0, "tag": "PII guard" }, + { "id": "stream", "type": "messagebus", "label": "Event Stream", "sublabel": "Kafka topic", "stage": 2, "row": 2, "tag": "ordered" }, + { "id": "pii", "type": "security", "label": "PII Vault", "sublabel": "encrypted", "stage": 3, "row": 0, "tag": "restricted" }, + { "id": "warehouse", "type": "database", "label": "Warehouse", "sublabel": "analytics tables", "stage": 3, "row": 1, "tag": "curated" }, + { "id": "features", "type": "database", "label": "Feature Store", "sublabel": "daily batch", "stage": 3, "row": 2, "tag": "derived" }, + { "id": "dashboard", "type": "backend", "label": "Dashboards", "sublabel": "product metrics", "stage": 4, "row": 0, "tag": "SQL" }, + { "id": "model", "type": "backend", "label": "ML Model", "sublabel": "ranking job", "stage": 4, "row": 2, "tag": "features" } + ], + "flows": [ + { "id": "web-clickstream", "from": "web", "to": "edge", "label": "clickstream", "classification": "user events", "variant": "emphasis", "fromSide": "right", "toSide": "left", "via": [[205, 157], [205, 271]], "labelAt": [204, 190] }, + { "id": "mobile-events", "from": "mobile", "to": "edge", "label": "app events", "classification": "device events", "variant": "default", "fromSide": "right", "toSide": "left", "via": [[222, 385], [222, 271]], "labelAt": [220, 342] }, + { "id": "consent-enrichment", "from": "edge", "to": "consent", "label": "identity + consent", "classification": "PII touch", "variant": "security", "fromSide": "top", "toSide": "left", "via": [[315, 112], [450, 112], [450, 157]], "labelAt": [382, 100] }, + { "id": "accepted-events", "from": "edge", "to": "stream", "label": "accepted events", "classification": "append-only", "variant": "emphasis", "fromSide": "right", "toSide": "left", "via": [[420, 271], [420, 385]], "labelAt": [438, 324] }, + { "id": "identity-map", "from": "consent", "to": "pii", "label": "identity map", "classification": "encrypted PII", "variant": "security", "route": "straight", "labelAt": [638, 144] }, + { "id": "normalized-facts", "from": "stream", "to": "warehouse", "label": "normalized facts", "classification": "non-PII", "variant": "emphasis", "fromSide": "right", "toSide": "left", "via": [[638, 385], [638, 271]], "labelAt": [638, 326] }, + { "id": "daily-aggregates", "from": "warehouse", "to": "features", "label": "daily aggregates", "classification": "batch", "variant": "dashed", "fromSide": "bottom", "toSide": "top", "route": "straight", "labelAt": [745, 326] }, + { "id": "metrics-query", "from": "warehouse", "to": "dashboard", "label": "metrics SQL", "classification": "read-only", "variant": "default", "fromSide": "right", "toSide": "bottom", "via": [[852, 271], [960, 271]], "labelAt": [876, 258] }, + { "id": "feature-vectors", "from": "features", "to": "model", "label": "feature vectors", "classification": "derived", "variant": "dashed", "route": "straight", "labelAt": [852, 372] }, + { "id": "restricted-join", "from": "pii", "to": "dashboard", "label": "restricted join", "classification": "approved only", "variant": "security", "route": "straight", "labelAt": [852, 144] } + ], + "cards": [ + { + "dot": "emerald", + "title": "Primary Data Path", + "items": [ + "Events move left to right through source, ingest, process, store, and consume stages", + "The hot path stays visually clear even with secondary batch flows", + "Labels name data assets instead of generic API verbs" + ] + }, + { + "dot": "rose", + "title": "Sensitive Boundary", + "items": [ + "Consent and PII paths are styled as security flows", + "PII lands in a restricted vault, separate from the analytics warehouse", + "Restricted joins are visible without implying default access" + ] + }, + { + "dot": "orange", + "title": "Derived Consumers", + "items": [ + "Dashboards read curated facts from the warehouse", + "Feature vectors are derived by batch from analytics tables", + "Consumption paths stay distinct from collection and consent handling" + ] + } + ] +} diff --git a/packages/diagram-core/vendor/archify/examples/production-deployment.architecture.json b/packages/diagram-core/vendor/archify/examples/production-deployment.architecture.json new file mode 100644 index 0000000..bbcf9bd --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/production-deployment.architecture.json @@ -0,0 +1,51 @@ +{ + "schema_version": 1, + "diagram_type": "architecture", + "meta": { + "title": "Production Deployment Ownership", + "output": "examples/production-deployment.html", + "visual_preset": "blueprint", + "animation": "trace", + "quality_profile": "showcase", + "engineering_profile": "deployment-ownership" + }, + "components": [ + { "id": "clients", "type": "external", "label": "Customers", "sublabel": "web + mobile", "pos": [38, 300], "size": [122, 60] }, + { "id": "edge", "type": "cloud", "label": "Global Edge", "sublabel": "CDN + WAF", "pos": [230, 300], "size": [126, 60], "tag": "edge team" }, + { "id": "gateway", "type": "security", "label": "API Gateway", "sublabel": "public :443", "pos": [430, 300], "size": [128, 60], "tag": "platform" }, + { "id": "api_a", "type": "backend", "label": "API Pods / AZ-a", "sublabel": "private subnet", "pos": [630, 195], "size": [136, 62], "tag": "app team" }, + { "id": "api_b", "type": "backend", "label": "API Pods / AZ-b", "sublabel": "private subnet", "pos": [630, 405], "size": [136, 62], "tag": "app team" }, + { "id": "redis", "type": "database", "label": "Redis", "sublabel": "multi-AZ cache", "pos": [840, 195], "size": [126, 62], "tag": "platform" }, + { "id": "postgres", "type": "database", "label": "PostgreSQL", "sublabel": "primary / encrypted", "pos": [840, 405], "size": [126, 62], "tag": "data team" }, + { "id": "events", "type": "messagebus", "label": "Event Bus", "sublabel": "orders.v1", "pos": [1040, 300], "size": [126, 60], "tag": "platform" }, + { "id": "worker", "type": "backend", "label": "Workers", "sublabel": "private workload", "pos": [1190, 300], "size": [126, 60], "tag": "app team" }, + { "id": "replica", "type": "database", "label": "DR Replica", "sublabel": "eu-west-1", "pos": [1040, 578], "size": [126, 62], "tag": "data team" }, + { "id": "audit", "type": "cloud", "label": "Audit Archive", "sublabel": "immutable objects", "pos": [1190, 450], "size": [126, 62], "tag": "security" }, + { "id": "observability", "type": "external", "label": "Observability", "sublabel": "metrics + traces", "pos": [1190, 85], "size": [126, 62], "tag": "SRE" } + ], + "boundaries": [ + { "kind": "region", "label": "AWS us-east-1 / production", "wraps": ["edge", "gateway", "api_a", "api_b", "redis", "postgres", "events", "worker", "audit"], "pad": 20 }, + { "kind": "security-group", "label": "private application network", "wraps": ["api_a", "api_b", "redis", "postgres", "events", "worker"], "pad": 14 }, + { "kind": "region", "label": "AWS eu-west-1 / disaster recovery", "wraps": ["replica"] }, + { "kind": "security-group", "label": "DR private subnet", "wraps": ["replica"], "pad": 14 } + ], + "connections": [ + { "from": "clients", "to": "edge", "label": "HTTPS", "variant": "emphasis" }, + { "from": "edge", "to": "gateway", "label": "mTLS", "variant": "security" }, + { "from": "gateway", "to": "api_a", "label": "VPC route", "variant": "emphasis", "route": "orthogonal-h", "labelAt": [594, 275] }, + { "from": "gateway", "to": "api_b", "label": "VPC route", "variant": "emphasis", "route": "orthogonal-h", "labelAt": [594, 385] }, + { "from": "api_a", "to": "redis", "label": "cache", "route": "straight" }, + { "from": "api_b", "to": "postgres", "label": "SQL", "route": "straight" }, + { "from": "api_a", "to": "events", "label": "publish", "variant": "dashed", "fromSide": "top", "toSide": "top", "via": [[698, 170], [1103, 170]] }, + { "from": "api_b", "to": "events", "variant": "dashed", "fromSide": "top", "toSide": "bottom", "via": [[698, 380], [1103, 380]] }, + { "from": "events", "to": "worker", "variant": "emphasis" }, + { "from": "postgres", "to": "replica", "label": "cross-region WAL", "variant": "security", "route": "orthogonal-v", "labelAt": [1003, 529] }, + { "from": "worker", "to": "audit", "label": "evidence", "variant": "dashed", "fromSide": "bottom", "toSide": "top", "labelDy": 58 }, + { "from": "worker", "to": "observability", "label": "OTLP", "variant": "dashed", "route": "orthogonal-v" } + ], + "cards": [ + { "dot": "cyan", "title": "Runtime Ownership", "items": ["Platform owns the edge, gateway, cache, and event bus", "Application teams own API pods and workers", "Data owns primary and disaster-recovery state"] }, + { "dot": "rose", "title": "Named Crossings", "items": ["Public HTTPS terminates at the managed edge", "mTLS crosses into the application network", "Cross-region WAL is explicit and encrypted"] }, + { "dot": "emerald", "title": "Operational Evidence", "items": ["Workers emit traces to SRE-owned observability", "Audit evidence lands in immutable storage", "Unknown placement should remain marked, never invented"] } + ] +} diff --git a/packages/diagram-core/vendor/archify/examples/release-delivery.workflow.json b/packages/diagram-core/vendor/archify/examples/release-delivery.workflow.json new file mode 100644 index 0000000..09dc8cc --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/release-delivery.workflow.json @@ -0,0 +1,57 @@ +{ + "schema_version": 1, + "diagram_type": "workflow", + "meta": { + "title": "Release Delivery Workflow", + "output": "examples/release-delivery.html", + "animation": "trace", + "quality_profile": "showcase" + }, + "lanes": [ + { "id": "dev", "label": "Developer" }, + { "id": "ci", "label": "Continuous Integration" }, + { "id": "approval", "label": "Release Governance" }, + { "id": "environment", "label": "Production Environment" }, + { "id": "communication", "label": "Release Communication" }, + { "id": "exceptions", "label": "Failure + Rollback", "variant": "exception" } + ], + "phases": [ + { "id": "change", "label": "Change", "fromCol": 0, "toCol": 1 }, + { "id": "verify", "label": "Build + verify", "fromCol": 2, "toCol": 3, "variant": "emphasis" }, + { "id": "promote", "label": "Promote + observe", "fromCol": 4, "toCol": 5, "variant": "dashed" } + ], + "groups": [ + { "id": "blocking_checks", "label": "Blocking checks", "lane": "ci", "fromCol": 2, "toCol": 3, "variant": "emphasis" }, + { "id": "rollback_work", "label": "Recovery path", "lane": "exceptions", "fromCol": 3, "toCol": 5, "variant": "security" } + ], + "mainPath": ["commit", "pull_request", "build", "checks", "approval", "deploy", "verify_prod", "announce"], + "nodes": [ + { "id": "commit", "lane": "dev", "col": 0, "type": "frontend", "label": "Commit", "sublabel": "signed change" }, + { "id": "pull_request", "lane": "dev", "col": 1, "type": "frontend", "label": "Pull Request", "sublabel": "reviewed diff" }, + { "id": "build", "lane": "ci", "col": 2, "type": "backend", "label": "Build", "sublabel": "locked inputs", "tag": "reproducible" }, + { "id": "checks", "lane": "ci", "col": 3, "type": "security", "label": "Quality Gates", "sublabel": "test + scan", "tag": "blocking" }, + { "id": "approval", "lane": "approval", "col": 4, "type": "security", "label": "Approve", "sublabel": "release owner", "tag": "human gate" }, + { "id": "deploy", "lane": "environment", "col": 4, "type": "cloud", "label": "Deploy", "sublabel": "canary 10%", "tag": "production" }, + { "id": "verify_prod", "lane": "environment", "col": 5, "type": "backend", "label": "Verify", "sublabel": "smoke + SLO" }, + { "id": "announce", "lane": "communication", "col": 5, "type": "external", "label": "Announce", "sublabel": "status + notes" }, + { "id": "failed", "lane": "exceptions", "col": 2, "type": "security", "label": "Stop Release", "sublabel": "gate failed" }, + { "id": "rollback", "lane": "exceptions", "col": 4, "width": 64, "type": "messagebus", "label": "Rollback", "sublabel": "last good image", "tag": "owner: on-call" } + ], + "edges": [ + { "from": "commit", "to": "pull_request" }, + { "from": "pull_request", "to": "build", "label": "merge", "variant": "emphasis", "route": "drop", "fromSide": "bottom", "toSide": "top" }, + { "from": "build", "to": "checks" }, + { "from": "checks", "to": "approval", "variant": "emphasis", "route": "drop", "fromSide": "bottom", "toSide": "top" }, + { "from": "approval", "to": "deploy", "variant": "security", "route": "drop", "fromSide": "bottom", "toSide": "top" }, + { "from": "deploy", "to": "verify_prod" }, + { "from": "verify_prod", "to": "announce", "label": "healthy", "variant": "emphasis", "route": "drop", "fromSide": "bottom", "toSide": "top" }, + { "from": "checks", "to": "failed", "label": "red", "variant": "security", "role": "error", "route": "drop", "fromSide": "bottom", "toSide": "top" }, + { "from": "verify_prod", "to": "rollback", "variant": "security", "role": "error", "route": "outside-right", "fromSide": "right", "toSide": "right" }, + { "from": "rollback", "to": "deploy", "label": "restore", "variant": "dashed", "role": "return", "route": "return-left", "fromSide": "left", "toSide": "left" } + ], + "cards": [ + { "dot": "emerald", "title": "One Happy Path", "items": ["Every change is reviewed before a reproducible build", "Blocking checks must be green before human approval", "Production is complete only after smoke and SLO verification"] }, + { "dot": "rose", "title": "Stop Conditions", "items": ["Test or security failure stops promotion", "Production health can reverse a release", "Rollback ownership is visible before an incident"] }, + { "dot": "cyan", "title": "Release Evidence", "items": ["Approval, immutable image, and check results are retained", "The release announcement follows verification", "The main path remains readable without hiding failure"] } + ] +} diff --git a/packages/diagram-core/vendor/archify/examples/sequence-cache-miss-request.html b/packages/diagram-core/vendor/archify/examples/sequence-cache-miss-request.html new file mode 100644 index 0000000..bfe2741 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/sequence-cache-miss-request.html @@ -0,0 +1,13835 @@ + + + + + + + + Cache Miss Request Sequence Diagram + + + + + + + + +
+ +
+
+
+

Cache Miss Request Sequence

+
+
+ + + + +
+ + Cache Miss Request Sequence + A sequence diagram generated by Archify. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + open page + + + + + + + + GET /dashboard + + + + + + + + verify JWT + + + + + + + + claims ok + + + + + + + + read cache + + + + + + + + miss + + + + + + + + query profile + metrics + + + + + + + + rows + + + + + + + + set cache + + + + + + + + emit trace + + + + + + + + 200 JSON + + + + + + + + render + + + + + + + Request + + + + Fallback + + + + Response + trace + + + + + User · browser session · Sequence participant + + + + User + browser session + + + + Web App · React UI · Sequence participant + + + + Web App + React UI + + + + API · request handler · Sequence participant + + + + API + request handler + + + + Auth · JWT verify · Sequence participant + + + + Auth + JWT verify + + + + Redis · cache · Sequence participant + + + + Redis + cache + + + + Postgres · source of truth · Sequence participant + + + + Postgres + source of truth + + + + Trace · async event · Sequence participant + + + + Trace + async event + + + + + Legend + + + main request + + + + return + + + + security + + + + async trace + + + + message + + + +

+ + + + + + + + + +
+ + + +
+ + + + diff --git a/packages/diagram-core/vendor/archify/examples/web-app-rendered.html b/packages/diagram-core/vendor/archify/examples/web-app-rendered.html new file mode 100644 index 0000000..5931dea --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/web-app-rendered.html @@ -0,0 +1,13808 @@ + + + + + + + + Sample Web App Diagram + + + + + + + + +
+ +
+
+
+

Sample Web App

+
+
+ + + + +
+ + Sample Web App + An architecture diagram generated by Archify. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Users · Browser / Mobile · Architecture component + + + + Users + Browser / Mobile + + + + Auth Provider · OAuth 2.0 · Architecture component · JWT + PKCE + + + + Auth Provider + OAuth 2.0 + JWT + PKCE + + + + CloudFront · CDN · AWS Region: us-west-2 + + + + CloudFront + CDN + + + + Load Balancer · HTTPS :443 · AWS Region: us-west-2 › sg-api :443/:8000 + + + + Load Balancer + HTTPS :443 + + + + API Server · FastAPI :8000 · AWS Region: us-west-2 › sg-api :443/:8000 + + + + API Server + FastAPI :8000 + + + + Redis · cache :6379 · AWS Region: us-west-2 + + + + Redis + cache :6379 + + + + PostgreSQL · primary :5432 · AWS Region: us-west-2 + + + + PostgreSQL + primary :5432 + + + + S3 · static assets · AWS Region: us-west-2 · OAI protected + + + + S3 + static assets + OAI protected + + + + SQS · job queue · AWS Region: us-west-2 + + + + SQS + job queue + + + + Worker · async jobs · AWS Region: us-west-2 + + + + Worker + async jobs + + + + + + HTTPS + + + + verify JWT + + + + + static + + + + + read-through + + + + SQL + + + + enqueue + + + + + + + AWS Region: us-west-2 + + + + + sg-api :443/:8000 + + + + + Legend + + + Backend + + + + Database + + + + Cloud + + + + Security + + + + Message bus + + + + External + + + +

+ + + + + + + + + +
+ + + +
+ + + + diff --git a/packages/diagram-core/vendor/archify/examples/web-app.architecture.json b/packages/diagram-core/vendor/archify/examples/web-app.architecture.json new file mode 100644 index 0000000..f370a41 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/web-app.architecture.json @@ -0,0 +1,41 @@ +{ + "schema_version": 1, + "diagram_type": "architecture", + "meta": { + "title": "Sample Web App", + "output": "web-app-rendered.html", + "quality_profile": "showcase" + }, + "components": [ + { "id": "users", "type": "external", "label": "Users", "sublabel": "Browser / Mobile", "pos": [40, 300], "size": [120, 60] }, + { "id": "auth", "type": "security", "label": "Auth Provider", "sublabel": "OAuth 2.0", "pos": [40, 110], "size": [120, 64], "tag": "JWT + PKCE" }, + { "id": "cdn", "type": "cloud", "label": "CloudFront", "sublabel": "CDN", "pos": [250, 300], "size": [130, 60] }, + { "id": "lb", "type": "cloud", "label": "Load Balancer", "sublabel": "HTTPS :443", "pos": [460, 300], "size": [130, 60] }, + { "id": "api", "type": "backend", "label": "API Server", "sublabel": "FastAPI :8000", "pos": [670, 300], "size": [130, 60] }, + { "id": "cache", "type": "database", "label": "Redis", "sublabel": "cache :6379", "pos": [670, 150], "size": [130, 60] }, + { "id": "db", "type": "database", "label": "PostgreSQL", "sublabel": "primary :5432", "pos": [880, 300], "size": [130, 60] }, + { "id": "s3", "type": "cloud", "label": "S3", "sublabel": "static assets", "pos": [250, 440], "size": [130, 60], "tag": "OAI protected" }, + { "id": "queue", "type": "messagebus", "label": "SQS", "sublabel": "job queue", "pos": [670, 440], "size": [130, 60] }, + { "id": "worker", "type": "backend", "label": "Worker", "sublabel": "async jobs", "pos": [880, 440], "size": [130, 60] } + ], + "boundaries": [ + { "kind": "region", "label": "AWS Region: us-west-2", "wraps": ["cdn", "lb", "api", "cache", "db", "s3", "queue", "worker"] }, + { "kind": "security-group", "label": "sg-api :443/:8000", "wraps": ["lb", "api"] } + ], + "connections": [ + { "id": "users-to-cdn", "from": "users", "to": "cdn", "label": "HTTPS", "variant": "emphasis" }, + { "id": "jwt-verification", "from": "auth", "to": "api", "label": "verify JWT", "variant": "security", "fromSide": "right", "toSide": "top", "via": [[620, 142], [620, 246], [735, 246]] }, + { "id": "cdn-to-lb", "from": "cdn", "to": "lb" }, + { "id": "static-assets", "from": "cdn", "to": "s3", "label": "static", "variant": "dashed", "fromSide": "bottom", "toSide": "top", "labelDy": 58 }, + { "id": "lb-to-api", "from": "lb", "to": "api" }, + { "id": "cache-read-through", "from": "api", "to": "cache", "label": "read-through", "fromSide": "top", "toSide": "bottom", "labelDy": -68 }, + { "id": "api-sql", "from": "api", "to": "db", "label": "SQL" }, + { "id": "enqueue-job", "from": "api", "to": "queue", "label": "enqueue", "variant": "dashed", "fromSide": "bottom", "toSide": "top", "labelDy": 58 }, + { "id": "queue-to-worker", "from": "queue", "to": "worker" } + ], + "cards": [ + { "dot": "cyan", "title": "Edge", "items": ["CloudFront CDN fronts all traffic", "S3 serves static assets via OAI"] }, + { "dot": "emerald", "title": "Application", "items": ["FastAPI behind an HTTPS load balancer", "Redis read-through cache", "Async work drained from SQS by a worker"] }, + { "dot": "rose", "title": "Security", "items": ["OAuth 2.0 with JWT + PKCE", "API + LB isolated in a security group"] } + ] +} diff --git a/packages/diagram-core/vendor/archify/examples/workflow-agent-tool-call-rendered.html b/packages/diagram-core/vendor/archify/examples/workflow-agent-tool-call-rendered.html new file mode 100644 index 0000000..2fa90c2 --- /dev/null +++ b/packages/diagram-core/vendor/archify/examples/workflow-agent-tool-call-rendered.html @@ -0,0 +1,13826 @@ + + + + + + + + Agent Tool Call Workflow Diagram + + + + + + + + +
+ +
+
+
+

Agent Tool Call Workflow

+
+
+ + + + +
+ + Agent Tool Call Workflow + A workflow diagram generated by Archify. + + + + + + + + + + + + + + + + + + + + + + + + + 01 / User Interface + + + 02 / Agent Runtime + + + + EX / Policy & Recovery + + + 04 / Tool Execution & Evidence + + + + + Intake + + + Plan + route + + + Execute + report + + + + Planning loop + + Human or policy stop + + Evidence path + + Tool work + + + + + + + + + + + + + + + + + User · asks for work · User Interface › Intake + + + + User + asks for work + + + + Chat Surface · thread + files · User Interface › Intake + + + + Chat Surface + thread + files + + + + Final Reply · answer + changes · User Interface › Execute + report + + + + Final Reply + answer + changes + + + + Agent Planner · plan next step · Agent Runtime › Planning loop › Plan + route · context aware + + + + Agent Planner + plan next step + context aware + + + + Tool Router · choose capability · Agent Runtime › Planning loop › Plan + route + + + + Tool Router + choose capability + + + + Approval Gate · scope + consent · Policy & Recovery › Human or policy stop › Plan + route · block risky ops + + + + Approval Gate + scope + consent + block risky ops + + + + Blocked · wait or reject · Policy & Recovery › Human or policy stop › Execute + report + + + + Blocked + wait or reject + + + + Retry Path · revise request · Policy & Recovery › Human or policy stop › Execute + report + + + + Retry Path + revise request + + + + Context Store · repo + memory · Tool Execution & Evidence › Evidence path › Intake + + + + Context Store + repo + memory + + + + Trace Log · events + output · Tool Execution & Evidence › Evidence path › Plan + route + + + + Trace Log + events + output + + + + Tool Call · shell / browser / MCP · Tool Execution & Evidence › Tool work › Execute + report · structured result + + + + Tool Call + shell / browser / MCP + structured result + + + + External API · network service · Tool Execution & Evidence › Tool work › Execute + report + + + + External API + network service + + + + + + needs approval? + + + + denied + + + + + + plan + + + + + record result + + + + + + + trace + memory + + + + + Legend + + + User UI + + + + Agent logic + + + + Policy + + + + Tool action + + + + Context / trace + + + + Cloud service + + + + External system + + + +

+ + + + + + + + + +
+ + + +
+ + + + diff --git a/packages/diagram-core/vendor/archify/migrations/workflow-v2.mjs b/packages/diagram-core/vendor/archify/migrations/workflow-v2.mjs index 85ba80c..e9731fc 100644 --- a/packages/diagram-core/vendor/archify/migrations/workflow-v2.mjs +++ b/packages/diagram-core/vendor/archify/migrations/workflow-v2.mjs @@ -46,6 +46,7 @@ function legacyLayoutProbe(workflow, qualityProfile) { diagram_type: 'workflow', meta: { title: workflow.meta.title, + output: workflow.meta.output, ...(workflow.meta.locale ? { locale: workflow.meta.locale } : {}), legend: { mode: 'hidden' }, }, diff --git a/packages/diagram-core/vendor/archify/package.json b/packages/diagram-core/vendor/archify/package.json index f88fef4..8b46369 100644 --- a/packages/diagram-core/vendor/archify/package.json +++ b/packages/diagram-core/vendor/archify/package.json @@ -1,6 +1,6 @@ { "name": "archify", - "version": "2.17.0-dev.1", + "version": "3.0.0", "private": true, "type": "module", "description": "JSON-IR diagram renderers (architecture / workflow / sequence / dataflow / lifecycle).", @@ -11,29 +11,7 @@ "engines": { "node": ">=18" }, - "scripts": { - "generate:viewer": "node ../scripts/generate-viewer.mjs", - "check:viewer": "node ../scripts/generate-viewer.mjs --check", - "generate:brand-marks": "node scripts/generate-brand-marks.mjs", - "check:brand-marks": "node scripts/generate-brand-marks.mjs --check", - "generate:validators": "node scripts/generate-validators.mjs", - "check:validators": "node scripts/generate-validators.mjs --check", - "check:release-identity": "node ../scripts/check-release-identity.mjs", - "build:gallery": "node ../scripts/build-gallery.mjs ../docs", - "build:guide": "node ../scripts/build-guide.mjs ../docs/guide.html", - "build:start": "node ../scripts/build-start.mjs ../docs/start.html", - "build:readme-showcase": "node ../scripts/build-readme-showcase.mjs", - "test:webm": "node test/webm-artifact.smoke.mjs && node --test test/site-language-integration.mjs", - "test": "npm run check:viewer && npm run check:brand-marks && npm run check:validators && npm run check:release-identity && node test/golden.mjs && node ../scripts/run-tests.mjs", - "render:examples": "node scripts/render-examples.mjs ../examples" - }, - "devDependencies": { - "ajv": "^8.17.1", - "parse5": "7.3.0", - "saxes": "6.0.0", - "simple-icons": "16.28.0" - }, "overrides": { - "fast-uri": "3.1.5" + "fast-uri": "^3.1.7" } } diff --git a/packages/diagram-core/vendor/archify/recipes/scenarios.mjs b/packages/diagram-core/vendor/archify/recipes/scenarios.mjs index 5076134..f8372b7 100644 --- a/packages/diagram-core/vendor/archify/recipes/scenarios.mjs +++ b/packages/diagram-core/vendor/archify/recipes/scenarios.mjs @@ -1,7 +1,7 @@ const RAW_RECIPES = [ { id: 'system-overview', type: 'architecture', proof: 'web-app', - presentation: { preset: 'classic', motion: 'static', views: 'optional' }, + presentation: { preset: 'classic', motion: 'static' }, start: { en: { descriptionPrompt: 'Use Archify to turn this plain-language system description into a high-level architecture diagram: [describe the users, core components, primary path, external dependencies, and boundaries]. No repository is required. Ask only for missing facts that would materially change the diagram, mark any remaining unknowns instead of inventing them, and keep one obvious primary path across 8–12 core components.' }, zh: { descriptionPrompt: '用 Archify 把下面这段自然语言系统描述画成高层架构图:[在这里描述用户、核心组件、主要路径、外部依赖和边界]。不需要代码库。只追问会实质影响图的缺失信息,其余不确定内容要标明而不是编造;保留 8–12 个核心组件和一条一眼可见的主路径。' }, @@ -26,7 +26,7 @@ const RAW_RECIPES = [ }, { id: 'deployment-ownership', type: 'architecture', proof: 'deployment-ownership', - presentation: { preset: 'blueprint', motion: 'trace', views: 'recommended' }, + presentation: { preset: 'blueprint', motion: 'trace' }, signals: [['deployment topology', 14], ['region', 7], ['vpc', 9], ['cluster', 6], ['availability zone', 8], ['ownership', 7], ['cloud deployment', 12], ['部署拓扑', 14], ['区域', 6], ['集群', 6], ['可用区', 8], ['资源归属', 9], ['跨区', 8]], en: { title: 'Deployment ownership', question: 'Where does each workload run, and what crosses a boundary?', @@ -47,7 +47,7 @@ const RAW_RECIPES = [ }, { id: 'agent-tool-call', type: 'workflow', proof: 'agent-tool-call', - presentation: { preset: 'signal-flow', motion: 'trace', views: 'recommended' }, + presentation: { preset: 'signal-flow', motion: 'trace' }, start: { en: { descriptionPrompt: 'Use Archify workflow mode to turn this description into a diagram: [paste the actors, main steps, decisions, approvals, and exception paths]. Use lanes for distinct owners, keep one unmistakable happy path, and mark missing ownership or unresolved branches instead of inventing them.' }, zh: { descriptionPrompt: '用 Archify 工作流模式把下面的描述画成图:[粘贴参与者、主要步骤、决策、审批和异常路径]。不同负责方使用独立泳道,保留一条明确的成功主路径,缺失的负责人或未定分支要标明而不是编造。' }, @@ -72,7 +72,7 @@ const RAW_RECIPES = [ }, { id: 'delivery-workflow', type: 'workflow', proof: 'delivery-workflow', - presentation: { preset: 'classic', motion: 'trace', views: 'optional' }, + presentation: { preset: 'classic', motion: 'trace' }, signals: [['ci/cd', 14], ['release workflow', 14], ['deployment pipeline', 11], ['pull request', 7], ['staging', 7], ['rollback', 8], ['发布流程', 14], ['流水线', 9], ['上线', 7], ['预发', 7], ['回滚', 8], ['审批发布', 10]], en: { title: 'Delivery workflow', question: 'How does a change move safely from commit to production?', @@ -93,7 +93,7 @@ const RAW_RECIPES = [ }, { id: 'incident-runbook', type: 'workflow', proof: 'incident-runbook', - presentation: { preset: 'signal-flow', motion: 'trace', views: 'recommended' }, + presentation: { preset: 'signal-flow', motion: 'trace' }, signals: [['incident response', 15], ['runbook', 12], ['outage', 9], ['triage', 8], ['mitigation', 8], ['escalation', 7], ['事故处置', 15], ['故障', 9], ['应急预案', 12], ['排障', 9], ['缓解', 7], ['升级响应', 8]], en: { title: 'Incident runbook', question: 'How do responders detect, triage, mitigate, verify, and escalate?', @@ -114,7 +114,7 @@ const RAW_RECIPES = [ }, { id: 'api-request', type: 'sequence', proof: 'cache-miss', - presentation: { preset: 'classic', motion: 'trace', views: 'optional' }, + presentation: { preset: 'classic', motion: 'trace' }, start: { en: { descriptionPrompt: 'Use Archify sequence mode to draw this interaction: [paste the participants, calls, returns, fallback, and asynchronous side effects]. Keep message order unambiguous, labels short, and unknown behavior explicit. No repository is required.' }, zh: { descriptionPrompt: '用 Archify 时序模式绘制下面的交互:[粘贴参与者、调用、返回、回退和异步副作用]。确保消息顺序无歧义、标签简短,并明确标注未知行为。不需要代码库。' }, @@ -139,7 +139,7 @@ const RAW_RECIPES = [ }, { id: 'async-roundtrip', type: 'sequence', proof: 'async-roundtrip', - presentation: { preset: 'signal-flow', motion: 'trace', views: 'recommended' }, + presentation: { preset: 'signal-flow', motion: 'trace' }, signals: [['async roundtrip', 14], ['webhook', 10], ['callback', 10], ['acknowledgement', 8], ['timeout', 7], ['retry message', 8], ['异步回调', 14], ['回调', 10], ['确认消息', 8], ['超时', 7], ['消息重试', 9], ['webhook', 10]], en: { title: 'Async roundtrip', question: 'What happens after the initial request returns?', @@ -160,7 +160,7 @@ const RAW_RECIPES = [ }, { id: 'data-lineage', type: 'dataflow', proof: 'product-analytics', - presentation: { preset: 'classic', motion: 'trace', views: 'recommended' }, + presentation: { preset: 'classic', motion: 'trace' }, signals: [['data lineage', 15], ['etl', 12], ['warehouse', 9], ['pii', 11], ['governance', 9], ['analytics pipeline', 12], ['数据血缘', 15], ['数据管道', 11], ['数仓', 9], ['治理', 9], ['隐私数据', 10], ['用户同意', 9]], en: { title: 'Data lineage', question: 'Where does data come from, how does it change, and who consumes it?', @@ -181,7 +181,7 @@ const RAW_RECIPES = [ }, { id: 'event-stream', type: 'dataflow', proof: 'event-stream', - presentation: { preset: 'signal-flow', motion: 'trace', views: 'recommended' }, + presentation: { preset: 'signal-flow', motion: 'trace' }, start: { en: { descriptionPrompt: 'Use Archify dataflow mode to map this data journey: [paste the sources, data assets, transforms, stores, boundaries, and consumers]. Label every flow, distinguish streaming from batch where relevant, and mark unknown classifications or ownership instead of inventing them.' }, zh: { descriptionPrompt: '用 Archify 数据流模式梳理下面的数据路径:[粘贴来源、数据资产、转换、存储、边界和消费者]。为每条数据流标注名称,在有意义时区分流式与批处理,未知的分类或归属要标明而不是编造。' }, @@ -206,7 +206,7 @@ const RAW_RECIPES = [ }, { id: 'object-lifecycle', type: 'lifecycle', proof: 'agent-run', - presentation: { preset: 'classic', motion: 'trace', views: 'optional' }, + presentation: { preset: 'classic', motion: 'trace' }, start: { en: { descriptionPrompt: 'Use Archify lifecycle mode to model this object: [paste its states, transition events, waits, retries, cancellation, and terminal outcomes]. Separate active, waiting, recoverable-failure, and terminal states, and never hide an ending. No repository is required.' }, zh: { descriptionPrompt: '用 Archify 生命周期模式建模这个对象:[粘贴它的状态、转换事件、等待、重试、取消和终态]。分开执行、等待、可恢复失败和终态,不要隐藏任何结束方式。不需要代码库。' }, @@ -231,7 +231,7 @@ const RAW_RECIPES = [ }, { id: 'deployment-lifecycle', type: 'lifecycle', proof: 'deployment-lifecycle', - presentation: { preset: 'signal-flow', motion: 'trace', views: 'recommended' }, + presentation: { preset: 'signal-flow', motion: 'trace' }, signals: [['deployment lifecycle', 15], ['release state', 10], ['promotion state', 9], ['approval status', 8], ['rollback state', 10], ['部署生命周期', 15], ['发布状态', 10], ['晋级', 7], ['审批状态', 8], ['回滚状态', 10]], en: { title: 'Deployment lifecycle', question: 'What state is a release in, and what can happen next?', @@ -250,6 +250,45 @@ const RAW_RECIPES = [ prompt: '用 Archify 生命周期模式建模部署对象。展示排队、构建、验证、等待审批、晋级、回滚以及所有终态,并标注允许每次状态转换的事件和守卫条件。', }, }, + { + id: 'layout-repair', type: 'architecture', proof: 'web-app', + presentation: { preset: 'classic', motion: 'static' }, + signals: [ + ['layout repair', 20], ['repair order', 20], ['fix order', 20], + ['viewport overflow', 20], ['overflow', 16], ['scrollheight', 16], ['scrollwidth', 16], + ['overlap', 16], ['label overlap', 20], ['edge through node', 20], ['crossing', 8], + ['via', 7], ['waypoint', 14], + ['布局修复', 20], ['修复顺序', 20], ['视口溢出', 20], ['溢出', 16], ['滚动高度', 16], ['滚动宽度', 16], + ['重叠', 16], ['标签重叠', 20], ['连线穿过节点', 20], ['连线穿节点', 20], ['交叉', 8], + ['途经点', 14], ['路径点', 14], ['拐点', 14], + ], + en: { + title: 'Layout repair', question: 'Why does the existing diagram overflow, overlap, or route through nodes, and what should be fixed first?', + summary: 'Repair an existing diagram in its current mode using validation diagnostics, explicit waypoint semantics, and a measured desktop viewport budget.', + useWhen: 'An existing architecture, workflow, sequence, dataflow, or lifecycle diagram needs layout repair; keep its diagram type and presentation settings.', + avoidWhen: 'The task is choosing a new diagram type. Do not change topology, delete meaningful labels, or hide overflow just to pass checks.', + include: [ + 'repair order: schema → overlap → direction → crossings → labels', + 'via contract: absolute [x, y] intermediate points; route = [start, ...via, end]', + 'desktop viewport budget for the complete page, including header and necessary cards', + 'validate after each edit, then inspect the final HTML in a browser', + ], + prompt: 'Use Archify to repair this existing diagram while preserving its diagram type, topology, meaningful labels, and presentation settings. Follow references/authoring-contract.md in this order: (1) schema and missing/invalid meta.quality_profile; (2) node overlap or out-of-range placement; (3) edge-through-node and endpoint-direction errors; (4) crossings, ambiguous corridors, border runs, excessive detours, and route rhythm; (5) labels: label-to-node, label-to-label, then label-to-route clearance. Run validate after every edit and use diagnostics[] code, subject, evidence, and supportedFixes; apply one diagnosed geometry control at a time. Where the current schema supports via, it is an ordered array of absolute SVG [x, y] intermediate points: the route is [start, ...via, end], with start/end supplied by the node anchors. Explicit via points override automatic routing; they are not offsets or a request for automatic obstacle avoidance. For an orthogonal repair, align adjacent points on the same x or y and make the first/final segment respect fromSide/toSide; use only controls supported by the current diagram mode. Follow references/delivery-contract.md for the viewport budget: check 1440×900, 1600×1000, 1920×1080, and 2048×1320; require document.documentElement.scrollWidth <= window.innerWidth. Prefer document.documentElement.scrollHeight <= window.innerHeight, but preserve a Reader-declared readable vertical page scroll when browser-check explicitly accepts it after reaching the projected-text floor. Budget the entire page, including header, diagram, and necessary cards. Repair every other overflow by removing only redundant content or compacting spacing first; do not hide overflow, clip content, introduce an internal diagram scroller, stretch the SVG, or shrink typography to force a pass. Let finalize run the required browser evidence; run perceptual visual review only when requested or escalated by the delivery contract.', + }, + zh: { + title: '布局修复', question: '现有图为什么仍然溢出、重叠或连线穿过节点,应该先修什么?', + summary: '保留现有图表模式,依据验证诊断、途经点语义和实测桌面视口预算修复布局。', + useWhen: '已有架构图、工作流、时序图、数据流或生命周期图需要修复布局;保留原来的图表类型和表现设置。', + avoidWhen: '任务是为新图选择类型时不要使用。不要为了通过检查改变拓扑、删除有意义的标签或隐藏溢出。', + include: [ + '修复顺序:schema → 重叠 → 方向 → 交叉 → 标签', + 'via 契约:绝对 [x, y] 中间点;路径 = [start, ...via, end]', + '包含标题和必要卡片的整页桌面视口预算', + '每次修改后 validate,最终在浏览器中检查 HTML', + ], + prompt: '用 Archify 修复这张现有图,保留图表类型、拓扑、有意义的标签和表现设置。遵循 references/authoring-contract.md 的顺序:(1) schema 错误及缺失或无效的 meta.quality_profile;(2) 节点重叠或越界;(3) 连线穿过节点及端点方向错误;(4) 交叉、含混的共享通道、贴边走线、过度绕行和转弯节奏;(5) 标签与节点、标签与标签、标签与连线的间距。每次修改后运行 validate,依据 diagnostics[] 的 code、subject、evidence 和 supportedFixes,每次只应用一项有诊断依据的几何控制。当前 schema 支持 via 时,它是按顺序排列的绝对 SVG [x, y] 中间点数组:路径为 [start, ...via, end],起终点由节点锚点提供。显式 via 会覆盖自动路由,不是偏移量,也不会请求自动绕障。修复正交走线时,相邻点应共享 x 或 y,首尾线段应遵守 fromSide/toSide;只使用当前模式支持的控制字段。视口预算遵循 references/delivery-contract.md:检查 1440×900、1600×1000、1920×1080 和 2048×1320,要求 document.documentElement.scrollWidth <= window.innerWidth。优先满足 document.documentElement.scrollHeight <= window.innerHeight;如果 browser-check 明确确认 Reader 已达到投影文字下限并接受可读的页面纵向滚动,则保留该滚动。预算覆盖整页,包括标题、主图和必要卡片。其他溢出先通过移除冗余内容或压缩间距修复,不得靠隐藏溢出、裁切、内部滚动区、拉伸 SVG 或缩小字体强行通过。让 finalize 执行必需的浏览器证据;只在用户要求或 delivery contract 规定的升级条件下进行感知视觉审阅。', + }, + }, ]; export const SCENARIO_RECIPES = Object.freeze(RAW_RECIPES.map((recipe) => Object.freeze({ @@ -370,7 +409,7 @@ export function formatScenarioRecommendation(result) { `${labels.use}: ${recipe.useWhen}`, `${labels.avoid}: ${recipe.avoidWhen}`, `${labels.include}: ${recipe.include.join(isZh ? '、' : '; ')}`, - `${labels.presentation}: ${recipe.presentation.preset} · ${recipe.presentation.motion} · views ${recipe.presentation.views}`, + `${labels.presentation}: ${recipe.presentation.preset} · ${recipe.presentation.motion}`, '', `${labels.prompt}:`, recipe.prompt, diff --git a/packages/diagram-core/vendor/archify/references/architecture-layout-repair.md b/packages/diagram-core/vendor/archify/references/architecture-layout-repair.md new file mode 100644 index 0000000..d7792cf --- /dev/null +++ b/packages/diagram-core/vendor/archify/references/architecture-layout-repair.md @@ -0,0 +1,18 @@ +# Architecture layout repair + +Use this after actual visual review finds several tangled routes. A successful machine receipt does not settle composition. Work on the existing candidate, retaining all required components, relationships, labels, evidence, boundaries, and node sizes. + +## Choose the repair scope + +If the main and secondary chains already read clearly, repair the isolated defect locally. If a main chain is blocked, several routes tangle, or a local fix moves the defect onto another route, reflow the connected scene in one edit. Preserve all semantics and user-fixed geometry; agent-generated positions and route controls may change. After moving nodes, remove stale generated route overrides so automatic routing can use the new placement. + +The receipt's `directCorridorBlockers`, when present, names nodes between an edge's aligned endpoints. This is geometric evidence, not proof that the edge is the main path or a new validation failure. Trace the reader's actual main path first. When a listed blocker interrupts that path, reposition the connected group instead of adding another detour. + +## One coherent repair + +1. Trace the affected relationships and their endpoints in the JSON. Before choosing coordinates, write the reader’s main path as an ordered list of existing edges, then identify shared state and real feedback cycles. Every neighboring pair in that main path must have the relationship being explained; place other components on branches beside their actual owner. Use `validate architecture --layout-json --repo-root ` once if the compact receipt and screenshot do not reveal the needed route or label geometry; omit `--repo-root` only for a design without repository evidence. Do not guess repeated waypoint coordinates. +2. Place those connected main-path neighbors in reading order. Put shared state between its readers/writers, on an adjacent row if necessary, so one writer does not need a line across the whole execution area. Arrange a feedback cycle in its actual edge order around an open rectangle, with other consumers beside their owner. For example, if the edges are `client → API → dispatcher → worker → collector → runner → dispatcher`, put the first four on the upper row, collector below worker, and runner below dispatcher: the return then uses the lower row and a short upward edge. This illustrates adjacency, not a graph or set of coordinates to copy; use only relationships present in the candidate. Preserve every edge and its actual direction. +3. Keep automatic endpoints for the new placement. Constrain a side only when a branch or return needs a specific corridor; check that corridor against every affected relationship, including storage branches. If that local constraint introduces another conflict, return to the connected placement instead of cycling through side combinations. Only use detailed `via` or label coordinates for a remaining measured defect. Keep external actors outside the resolved boundary rectangle, including its padding; not listing a node in `wraps` does not visually exclude it. Keep an internal relationship and its label inside the shared boundary unless crossing it conveys a real fact; do not imply an external hop merely to avoid another route. +4. When `composition/label-gap` reports a measured minimum, enlarge that clear gap or move the connected group onto another readable row. Keep the full label beside its own route; placing it in distant empty space does not repair the relationship. Compact unused gaps while preserving measured label space and the previous text size. Keep the main interaction and all required nodes readable in the default desktop view; do not trade crossings for a large blank canvas, tiny text, or a chain that doubles back without a semantic reason. + +Run the complete `finalize` once after the edit, then `visual-check` on the successful artifact and inspect its desktop captures. When replacing an already reviewed artifact, use one fresh `--out-dir` for both commands as described in [the delivery contract](delivery-contract.md#a-new-candidate-at-an-existing-output-path). Trace the main path, each secondary chain, and every affected arrow and label. A bounded second repair may address a remaining specific defect. If it still fails visual acceptance, retain the candidate and report the concrete gap; do not count it as a successful repair or continue blind coordinate changes. diff --git a/packages/diagram-core/vendor/archify/references/authoring-contract.md b/packages/diagram-core/vendor/archify/references/authoring-contract.md index 70fb158..623473f 100644 --- a/packages/diagram-core/vendor/archify/references/authoring-contract.md +++ b/packages/diagram-core/vendor/archify/references/authoring-contract.md @@ -2,6 +2,16 @@ Read this reference only after the Fast authoring path calls for more detail. The schemas and examples remain authoritative. +## Composition repair + +When correcting an authored overview's abstraction, map every affected role, relationship direction, protocol, boundary, condition, and source reference to its surviving node or relationship before regrouping. A startup citation does not prove a message protocol. Preserve each claim's inspected evidence. Keep user-supplied or agreed topology fixed; fewer routes alone do not justify merging. A boundary around one node requires an explicit isolation fact and must not merely repeat its label. + +## Label repair + +When a relationship label collides, move the label, adjust the route or spacing, then shorten the wording while preserving meaning. Omit wording only when both endpoints fully imply it and it conveys no protocol, action, direction, synchronous or asynchronous behavior, or cross-boundary mechanism. Spacing means clear gap rather than center distance; measured mask width takes precedence. The first-draft gap budget is in [Layout and routing](authoring-defaults.md#layout-and-routing). + +For a disproportionate sublabel, keep its exact role or protocol concise and place the supplementary fact in a note or card. Preserve every required responsibility, protocol, and boundary fact. Use the first-draft node-width budget in [Layout and routing](authoring-defaults.md#layout-and-routing). + ## Schema lookup Read both the mode schema and `schemas/common.schema.json`. The mode schemas use `$ref`, so the common file is where shared enums live. @@ -10,7 +20,7 @@ Read both the mode schema and `schemas/common.schema.json`. The mode schemas use - `variant`: `default`, `emphasis`, `security`, `dashed` - Relationship IDs use the shared identifier pattern and must be unique in their collection. -Do not invent fields. Use the nearest matching example for structure, then author fresh IDs, wording, facts, and layout. +Do not invent fields. Before writing any new field, enum, or constrained text, read its schema definition, including common `$ref` targets. In particular, check boundary kinds, repository identity, and source-reference shapes. An example demonstrates structure; it does not enumerate every valid value. Author fresh IDs, wording, facts, and layout. ## Workflow layout contracts @@ -21,6 +31,10 @@ edge labels are never deleted as a spacing repair. Do not change only [migration and layout-receipt contract](../renderers/workflow/README.md#migration-and-layout-receipt). The complete normative invariants live in the workflow renderer's [layout contracts](../renderers/workflow/README.md#layout-contracts). +For sequential stages stacked in one container, use one v2 lane and group, +omit `meta.viewBox`, and center nodes around the lane content with symmetric +`yOffset` values such as `-90 / 0 / 90`. Keep semantic edge labels and act on +compiler diagnostics. ## Legend contract @@ -46,27 +60,46 @@ them, or widen the viewBox using the emitted diagnostic. Choose one primary authored language. An explicit user choice wins; otherwise use the language of the request, or the conversation's dominant language when the request itself is language-neutral. Separately choose the Viewer locale. -For supported languages, always write the matching `meta.locale`: `"en"` for -English or `"zh-CN"` for Simplified Chinese. The renderer consumes the authored -locale without inferring language from diagram strings. Documents that omit it -remain valid and default to English. +Always write the matching `meta.locale` as a well-formed language tag: `"en"` +for English, `"zh-CN"` for Simplified Chinese, `"es"` for Spanish, or any +other tag for another language. The renderer consumes the authored locale without inferring language +from diagram strings. Documents that omit it remain valid and default to +English. `meta.locale` controls only renderer-owned reader surfaces: ``, the document-title suffix, default SVG description and focus labels, default legend labels, and fixed Viewer controls, statuses, accessibility names, and errors. It never translates authored content. Apply the primary language separately to titles, subtitles, node and relationship copy, boundaries, lanes, groups, -guided views, legend label overrides, and cards. A bilingual diagram still +legend label overrides, and cards. A bilingual diagram still chooses one primary locale for the Viewer; follow an explicit primary-language request, then prompt order or conversation dominance. -For a requested language outside `en` and `zh-CN`, do not write an unsupported -locale. Keep every reader-facing authored string in the requested language, -omit `meta.locale` so the renderer safely uses English, and explicitly tell the -user that fixed Viewer UI and `` remain English and the artifact is -not fully localized. The fallback applies only to renderer-owned surfaces; it -never permits authored copy to fall back to English. Do not silently substitute -`zh-CN` for another language or Chinese locale. +`en` and `zh-CN` are built-in Viewer catalogs and need nothing further. For +every other `meta.locale`, also set `meta.translations`: an object mapping the +renderer's canonical message keys (`catalogKeys()` in +`renderers/shared/i18n.mjs`) to translated strings whose `{placeholder}` tokens +match the English source exactly. Reuse suitable translations from `examples/locales/` or a previously reviewed +catalog; Spanish uses `examples/locales/es.json`. Translate missing keys or adapt terminology when the diagram needs it; +use the English source to check keys and placeholders. Example catalogs may +lag new Viewer keys; validation reports those gaps and uses English for them. A key that is missing, unrecognized, or has mismatched +placeholders falls back to its English string — `validate`/`render`/`deliver` +report the resulting coverage to stderr — rather than breaking the render or +silently shipping an untranslated string as if it were translated. + +For older dev inputs using only `meta.locale: "es"`, copy the Spanish catalog +into `meta.translations` before rendering again. Existing standalone HTML +keeps its embedded translations. + +For a requested language you cannot supply `meta.translations` for, do not +write a `meta.locale` with no built-in catalog and no translations. Keep every +reader-facing authored string in the requested language, omit `meta.locale` so +the renderer safely uses English, and explicitly tell the user that fixed +Viewer UI and `` remain English and the artifact is not fully localized. +The fallback applies only to renderer-owned surfaces; it never +permits authored copy to fall back to English. Do not silently substitute +`zh-CN` for another language or Chinese locale, and do not machine-translate +`meta.translations` values without disclosing that they are unreviewed. Keep exact product names, code identifiers, commands, protocols, API paths, and environment names intact. Those terms may remain English inside localized copy, @@ -103,16 +136,69 @@ in the generated viewer. ## Executable geometry rules -- Node anchors start at side midpoints. `left`/`right` change the horizontal endpoint; `top`/`bottom` change the vertical endpoint. For an automatic Architecture relationship, unobstructed facing ports whose axis offset is under 16px may share one horizontal or vertical axis when both endpoints retain the 16px corner gutter. If exactly one endpoint belongs to a spread group, only its unshared counterpart moves; relationships spread at both endpoints keep their distinct ports and outside bridge. +Generate one responsive artifact for laptops and external displays, preserving the authored SVG/viewBox, proportions, semantic geometry, and normal document flow. Use meaningful content rows and the Reader-declared readable page-scroll behavior when the complete diagram needs more height; viewport fitting does not authorize alternate topology or smaller typography. + +- Node anchors start at side midpoints. `left`/`right` change the horizontal endpoint; `top`/`bottom` change the vertical endpoint. For an automatic Architecture relationship, unobstructed facing ports whose axis offset is under 16px may share one horizontal or vertical axis when both endpoints retain the 16px corner gutter. If exactly one endpoint belongs to a spread group, only its unshared counterpart moves; relationships spread at both endpoints keep their distinct ports and outside bridge unless a reciprocal facing pair can jointly use separate straight lanes while preserving endpoint spacing, labels, and all surrounding route and obstacle clearances. - A side is a direction contract. The first and final route segment must be perpendicular and outward/inward in the named direction. +- In architecture, data-flow, and lifecycle diagrams, explicit `route: "straight"` requests one direct segment, which may be diagonal when endpoint sides are not pinned. The artifact checker preserves this intent; explicit sides, opaque-node clearance, and other quality gates still apply. `via` takes precedence and retains existing rules, including data-flow's requirement for orthogonal via segments. - Automatic Port Spread is a default renderer behavior for architecture, workflow, data-flow, and lifecycle diagrams. Shared automatic endpoints spread deterministically and symmetrically with a 16px corner gutter. It does not apply to sequence messages, single relationships, or explicit `via`, `channelX`, `channelY`, `labelAt`, or non-`auto` routes. - Showcase route rhythm: every nonzero segment must be at least 8px; every interior segment must be at least 16px. When spread ports are nearly parallel, the router uses a 24px endpoint stub and a 16px outside bridge instead of manufacturing a tiny dogleg. +- Showcase route compactness: an explicit Architecture route fails with `composition/excessive-route-detour` when its orthogonal length is at least 2.5 times an obstacle-aware legal route, adds at least 200px, and sends a control point at least 96px beyond the content envelope. The evidence records both lengths, ratio, excess, bounds, and excursion. Remove an unnecessary `via` or move the diagnosed corridor inward instead of enlarging the canvas. Related relationships that overlap on the same outer corridor by at least 32px are treated as an intentional bus and remain valid. - Shared endpoint corridors are allowed only when they remain semantically unambiguous. Unrelated collinear overlap of 8px or more fails showcase. - Container borders are intentional pass-through geometry, but a long edge running along a structural border is not. - An edge crossing an unrelated opaque node is always a hard failure, independent of quality profile. +### Explicit `via` coordinates + +Use the resolved departure anchor `S = [sx, sy]` and arrival anchor +`T = [tx, ty]`. Anchors start at side midpoints, but automatic routing and +Port Spread can move them as described above; do not assume an anchor copied +from an automatic route is the anchor of a newly authored explicit route. +Explicit `via` routes do not receive automatic Port Spread. + +For the first waypoint `F = via[0]` and last waypoint `L = via[via.length - 1]`, +use these alignments and directions (SVG y increases downward): + +| Side | Departure (`fromSide`): `S` → `F` | Arrival (`toSide`): `L` → `T` | +| --- | --- | --- | +| `top` | `F[0] === sx`, `F[1] < sy` | `L[0] === tx`, `L[1] < ty` | +| `bottom` | `F[0] === sx`, `F[1] > sy` | `L[0] === tx`, `L[1] > ty` | +| `left` | `F[1] === sy`, `F[0] < sx` | `L[1] === ty`, `L[0] < tx` | +| `right` | `F[1] === sy`, `F[0] > sx` | `L[1] === ty`, `L[0] > tx` | + +For example, given a bottom departure anchor `S = [180, 160]` and a left +arrival anchor `T = [360, 260]`, this relationship fragment leaves downward +and enters the target rightward: + +```json +{ + "from": "source", + "to": "target", + "fromSide": "bottom", + "toSide": "left", + "via": [[180, 200], [300, 200], [300, 260]] +} +``` + +The full path is `[180, 160] → [180, 200] → [300, 200] → [300, 260] → [360, 260]`. +Changing only the first waypoint to `[200, 200]` makes the departure diagonal; +changing it to `[180, 120]` keeps its x aligned but leaves upward through the +source instead of outward from its bottom. Both violate `fromSide: "bottom"` +and produce `clean-flow/endpoint-side-direction`. The example establishes +endpoint direction only: keep the full route clear of unrelated nodes and +apply the other geometry rules above. + ### Spacing and labels +In showcase Architecture, an unpinned connection label keeps its default position +when clear. If it collides, the renderer tries a bounded set of nearby positions +along the existing route, avoiding nodes, boundary titles, other labels and +other routes within the resolved canvas. Explicit `labelAt`, `labelDx`, `labelDy` +or `labelSegment` (including zero) disables this fallback. Routes and topology +stay unchanged; if no nearby position is clear, validation reports the original +collision. Inspect resolved labels with `--layout-json` before adding controls. +Standard placement retains its existing behavior. + Spacing recommendations mean clear gap between boxes, not center distance. A 200px center distance between 165px-wide nodes leaves only 35px of clear gap. For a relationship label, require: @@ -133,15 +219,47 @@ its endpoints fully imply it, explain why the wording is redundant; this is a semantic authoring choice, not a spacing repair. In workflow v2, let the compiler allocate its measured mask before applying a diagnosed `labelAt`, `labelDx`/`labelDy`, or `labelSegment`. Apply one diagnosed geometry control at -a time. +a time unless several edges share a constrained channel. In that case, plan the smallest coupled change from measured geometry and +validate it together. Architecture/workflow provide layout evidence through +`validate --layout-json`; for other types, use validation +diagnostics and the rendered SVG geometry. +Before adding manual routes, check whether unnecessary agent-added controls +disable automatic port spread; preserve user-required route intent. Use the +measured clearance rules above rather than guessing coordinates. + +### Repair evidence + +For architecture, `validate architecture --layout-json` exposes the +resolved component boxes, boundary frames, connection points, and label positions. +A measurable rejected layout also returns these fields, with `ok: false`, +`contract: "archify-architecture-layout-v1"`, diagnostics, and exit 1. This is +repair evidence, not artifact acceptance; it writes no HTML. Malformed input or +an implementation failure retains the ordinary failure receipt without layout. + +Use the measured failing side for `layout/boundary-out-of-bounds`. Left/top +negative coordinates need an inward move; increasing viewBox width/height only +addresses right/bottom overflow. Boundaries may wrap members across rows. Keep +real membership intact and recheck connected routes after moving members. + +Automatic architecture canvases include route points as well as nodes, frames, +and labels. An authored viewBox remains authoritative. In showcase, +`layout/route-out-of-bounds` identifies clipped route points; negative coordinates +need an inward route, while right/bottom overflow can also use a larger authored +canvas. Recheck desktop readability after enlarging a canvas. + +When several crossing/corridor diagnoses involve the same nodes, consider their +placement together before adding route controls. Apply one coherent repair and +validate it; independent label nudges cannot fix a shared layout bottleneck. +Compare diagnostics by code, subject, and stage instead of total count alone. ### Repair order 1. Fix missing/invalid `meta.quality_profile` and schema errors. 2. Fix node overlap or out-of-range placement. 3. Fix edge-through-node and endpoint-direction errors. -4. Fix crossings, ambiguous corridors, border runs, and route rhythm. +4. Fix crossings, ambiguous corridors, border runs, excessive detours, and route rhythm. 5. Fix label-to-node, label-to-label, then label-to-route clearance. +6. Fix labels that leave the canvas: move the label with `labelAt`/`labelDx`/`labelDy`/`labelSegment`, or widen `meta.viewBox`. Suggested `labelDx`/`labelDy` values replace the authored field; they are not added to it. Run `validate` after every edit. Consume `diagnostics[]` by stable `code`, exact `subject`, measured `evidence`, and `supportedFixes`. If the diagnostic gives `labelAt`, use that point instead of estimating another offset. @@ -149,7 +267,7 @@ Run `validate` after every edit. Consume `diagnostics[]` by stable `code`, exact ### Architecture -Use one left-to-right spine with short vertical branches. Prefer 6–12 primary components and group only real ownership, trust, process, or deployment boundaries. Boundaries do not replace relationships. +Choose overview or mechanism detail using [Composition and meaning](authoring-defaults.md#composition-and-meaning). Use one obvious primary reading path, which may step across meaningful rows when the requested topology needs room. Keep the overview readable at its chosen abstraction; expand implementation details when they answer the reader's question. Group only real ownership, trust, process, or deployment boundaries. Boundaries do not replace relationships. Grid placement is preferred when the schema supports it. Free positions are appropriate for a bounded exception, not for prose-level coordinate planning. Keep external actors outside the system boundary when that is factually true. @@ -161,6 +279,27 @@ legacy geometry compatibility. Keep the happy path monotonic, preserve semantic edge labels, and route retries and exception returns outside the main lane corridor. +#### Workflow viewport repair + +When `viewer/viewport-overflow` includes `workflowLanes`, inspect the tallest +rendered frames and their node span before changing the source. Measurements +are CSS pixels; space above/below nodes includes lane titles and routing, so it +is not a removable-space budget. Frame IDs identify rendered lane indices. + +Run `validate workflow --layout-json` and match those frames to +source lanes and nodes. Check whether many steps share the last logical column +and use large `yOffset` values. Readable-v2 currently reserves symmetric space +around offsets and shares the base content height between lanes, so increasing +one offset can enlarge otherwise sparse lanes. + +Where the source's ownership and explicit geometry permit, redistribute steps +across logical columns and meaningful lanes, keeping the main path monotonic. +Preserve every required node, relationship, label and semantic check. If ownership +or absolute pins prevent reflow, report that constraint instead of merging lanes +or moving pins automatically. Validate the changed JSON, deliver a fresh HTML, +then rerun browser checks and inspect the first screen; a static pass alone does +not settle viewport fit. These are repair directions, not guaranteed coordinates. + ### Sequence Participants are ordered by conversation role. Messages own their vertical order. Use return/async/security variants for meaning, not decoration; sequence does not use Automatic Port Spread. @@ -171,25 +310,43 @@ Stages express transformation or custody. Rows separate parallel streams. Label ### Lifecycle -Main phases use columns `0..4`; event and terminal bands use columns `0..2`. -Event/terminal column `N` aligns to the same x coordinate as main column -`N + 2`. A recoverable failure needs a real transition back to an active state. -A card or guided view saying “retry” is not topology. +Schema v2 (new diagrams): each populated lane is one row, `main` first, +`terminal` last, others in `lanes[]` order. `col` `0..4` is one shared x grid, +so a state placed in the column of the state it leaves gets a straight vertical +transition. Every transition, including the main path, is authored; there is no +implied rail. The renderer sizes the canvas, widens a column gap for a +same-row label, and routes automatic transitions orthogonally through row gaps. +Keep labels short: a gap carrying several parallel lines has little room. + +Schema v1 (legacy): main phases use columns `0..4`; event and terminal bands +use columns `0..2`, and event/terminal column `N` aligns with main column +`N + 2`. Every lane other than `main` and `terminal` shares one middle band; +states in the same column there need distinct `yOffset` values. + +In both versions a recoverable failure needs a real transition back to an +active state. A card saying “retry” is not topology. ## Repository evidence -When an architecture diagram must reflect real code, inspect repository -entrypoints, runtime boundaries, storage, transports, and deployment -configuration before authoring. Record only evidence you actually verified. -`--repo-root ` is architecture-only and is accepted by architecture -`render`, `validate`, `deliver`, `preview`, and `compare`; workflow, sequence, -dataflow, and lifecycle reject it. Never infer runtime causality from file -proximity or naming alone. +When the diagram must reflect real code, inspect repository entrypoints, +runtime boundaries, storage, transports, and deployment configuration before +authoring. Record only evidence you actually verified. `--repo-root ` is +accepted by `render`, `validate`, `deliver`, and `preview` for every diagram +type, by architecture `compare`, and by workflow `migrate`; every mode verifies `meta.repository` and +node `sources` the same way. Migrating a source-backed workflow requires the same +`--repo-root` so its candidate is verified before replacing the destination. +Never infer runtime causality from file proximity +or naming alone. Declare `meta.repository.url` and one full 40-character `revision`, then attach -`components[].sources` with repository-relative `path`, optional `line`, -`end_line`, and `label`. Verification reads blobs at that commit, independently -of working-tree edits. A matching local origin, available commit, bounded path, +`sources` to the mode's node collection (Architecture `components[]`, Workflow +and Data Flow `nodes[]`, Sequence `participants[]`, Lifecycle `states[]`) with +repository-relative `path`, optional `line`, `end_line`, and `label`. +Verification reads blobs at that commit, independently of working-tree edits. +Verification ignores local Git replacement refs, including those selected by +`GIT_REPLACE_REF_BASE`, and always reads the original objects at the pinned SHA. +It does not change repository configuration or delete replacement refs. +A matching local origin, available commit, bounded path, blob, and valid line range are required in every link mode. Verification is local and makes no remote requests; it establishes neither public availability nor the current reader's access rights. @@ -241,3 +398,22 @@ fail with a diagnostic rather than emitting a guessed link. ## Hand-placed fallback Use only when no renderer can run. Start from `assets/template.html`, keep semantic CSS classes, preserve the inline SVG/accessibility structure, and run the delivery visual checklist. Never introduce inline literal colors that break dark/light parity. + +## Node icons + +For domain-specific diagrams, set an optional `icon` on architecture components, +workflow/dataflow nodes, sequence participants, or lifecycle states. Choose +`calendar`, `clock`, `person`, `briefcase`, `flag`, or `moon` for everyday concepts; +the complete catalog (including existing technical and lifecycle symbols) is +`common.schema.json#/$defs/nodeIcon`. Use `icon: "none"` to hide the corner symbol. +Omitting `icon` keeps the type-based default. These inline SVG symbols are +renderer-owned and export with the diagram; URLs and raw SVG are not accepted. + +Icon selection changes only the corner symbol. The node's type still determines +color and semantic grouping; brand marks remain independent. For a holiday +workflow, pair `type: "backend", icon: "calendar"` with +`meta.legend.entries.backend.label: "假期"`, and use `icon: "briefcase"` plus +an appropriate legend label for make-up work. Keep the node label meaningful: +icons are decorative and are hidden from assistive technology. + +See [holiday planning](../examples/holiday-planning.workflow.json) for a complete workflow example. diff --git a/packages/diagram-core/vendor/archify/references/authoring-defaults.md b/packages/diagram-core/vendor/archify/references/authoring-defaults.md new file mode 100644 index 0000000..ea3b41a --- /dev/null +++ b/packages/diagram-core/vendor/archify/references/authoring-defaults.md @@ -0,0 +1,41 @@ +# Authoring defaults + +Read once before writing a fresh candidate. An existing frozen candidate going straight to `finalize` needs this only if repair changes its authorship. + +## Composition and meaning + +For Architecture, default to a system overview led by the main user journey unless the user asks for a narrower mechanism, module map, or deployment topology. Group cooperating roles in accurately named subsystems when that still explains the requested interaction. Separate roles when grouping would hide control ownership, a trust or persistence boundary, lifecycle behavior, or another distinction the reader asked about. Keep secondary and opt-in capabilities in concise sourced notes unless their path matters to the requested question. Name a deliberately narrower scope in the title. + +Preserve every requested responsibility, relationship direction, protocol, and behavior-changing condition. Show approval, authorization, and state-transition gates on the affected node or relationship; a card alone cannot qualify an otherwise unconditional arrow. Keep source evidence with each asserted claim. Boundaries express real isolation, ownership, runtime, or persistence facts. Cards answer additional reader questions; they do not replace required topology. There is no node, edge, source, card, or boundary quota. If an authored overview needs regrouping after failure, use [Composition repair](authoring-contract.md#composition-repair); user-supplied or agreed topology remains fixed. + +Relationship labels carry meaning. Give them clear space and preserve action, protocol, direction, async behavior, or cross-boundary meaning. A label may start absent only when both endpoints already fully imply it; a collision calls for spacing or routing repair. See [Label repair](authoring-contract.md#label-repair) when measured evidence reports a collision. + +## Layout and routing + +Place Architecture nodes by their actual connections before assigning coordinates; the router cannot rearrange boxes, so placement decides whether lines stay straight. Classify each relationship first, then place: + +- **Main path**: the reader's main journey, neighbors adjacent in reading order. Let a medium path step through meaningful rows instead of making a shallow horizontal strip. +- **Branch or store**: directly above or below the node that owns, reads, or writes it, centered on that node so the edge is one straight segment. Keep all stores and branches of one row on the same side of it. +- **Return** (back to an earlier main-path node): put its source on the side of the main path with no branches or stores, so it runs through an empty corridor instead of crossing them. +- **Second entrance** into a node that already has an incoming edge: place the new source so it reaches that node from another side, usually directly below or above it. +- **Fan-out**: a side with k relationships needs at least `32 + 14 × (k − 1)`px (four need 74px). Spread a hub's counterparts over two or three sides, or enlarge the hub. Center a parent on its children and align a child with its only parent. + +Before writing positions, trace each non-main relationship: its straight or one-bend corridor must not pass another node or cross another relationship. If it does, move the endpoint that is off the main path. Start the main actor and its first connected step together near the canvas origin; use content rows for vertical rhythm. Omit `meta.viewBox` for a fresh Architecture so the Reader measures intrinsic height. Keep supplied fixed geometry authoritative. + +Start with automatic routes and endpoint sides. Pin a side only for a necessary branch, return, or supplied geometry. Reserve `via`, `channelX`, `channelY`, and label coordinates for measured defects. Before writing positions, budget each labeled main-path edge at `6.5px × ASCII units + 21px` of clear gap, counting CJK as two units; use its own label length, not a row-wide fixed gap. Size Architecture sublabels for their preferred 9px text at `5.4px × text units + 8px`, with CJK counting twice; keep supporting copy concise without dropping required facts. Do not trade readability or meaning for fewer crossings. The [Geometry reference](authoring-contract.md#executable-geometry-rules) has measured spacing, port, canvas, and route rules for a diagnosed layout problem. + +## Evidence and schema + +For a real repository, follow [Repository authoring](repository-authoring.md) while inspecting source. Freeze its credential-free origin and 40-character commit in `meta.repository`, attach inspected repository-relative `sources` to each key semantic node, and pass `--repo-root` to the first `finalize`. Each reference proves only the fact visible at that location. Follow material relationships and conditions to their actual source; do not reuse a startup citation as protocol or persistence evidence. + +Examples show field shape, not legal values or source facts. Read the mode schema and shared definition before adding a field, enum, or constrained text. In particular, inspect Architecture boundary kinds. Keep longer evidence in a card while retaining the fact. See [Schema lookup](authoring-contract.md#schema-lookup) for details. + +## Presentation and modes + +Use one primary authored language from the user's choice or the request/conversation. Set `meta.locale` for built-in English (`en`) or Simplified Chinese (`zh-CN`); for other languages, including Spanish (`es`), supply `meta.translations` with reusable UI translations, or disclose the fixed Viewer UI and `` English fallback. Keep exact product, code, protocol, command, API, and environment names while localizing surrounding explanation. See [Language consistency](authoring-contract.md#language-consistency) for bilingual cases. + +Omit `meta.visual_preset` for classic, `meta.subtitle` for a title-only header, `meta.legend` for truthful auto, and `meta.engineering_profile` for an ordinary system overview. Explicit styles and a subtitle require a user request. Use legend or deployment ownership under the [legend](authoring-contract.md#legend-contract) or [engineering profile](authoring-contract.md#engineering-profile-default) contracts. Branding is optional and explicit when a node names a real product; [Brand marks](brand-marks.md) gives lookup and capture rules for that branch. Never let a badge replace semantic type, label, or relationship facts. Set required `meta.output` to a portable POSIX-relative `.html` path within the working directory; see [Output path contracts](delivery-contract.md#output-path-contracts) for native path exceptions. + +For new Workflow use schema v2, preserving v1 for a fixed legacy source; use its [layout contracts](../renderers/workflow/README.md#layout-contracts) when lane or group geometry needs detail. For Sequence start with fixed columns; use `spread` when a wide viewBox leaves unused horizontal space or meaningful labels need width. For new Lifecycle use schema v2: every lane is its own row (`main` first, `terminal` last) and `col` `0..4` is the same x in every row, so place an interruption or exit in the column of the state it leaves; author the main path as transitions, omit `viewBox`, and keep transition labels short; a recoverable failure needs a real transition back. Read [Mode placement](authoring-contract.md#mode-placement) when a mode-specific placement or viewport problem needs more detail. + +`finalize` performs the browser gate. Keep the complete drawing comfortably readable on desktop, with zero horizontal overflow. Use meaningful vertical rows and intrinsic-height page scroll when necessary. The 6px projected-text check is a failure floor; at 1440px, aim for ordinary context text around 7.5px or larger. See [Automated browser evidence](delivery-contract.md#automated-browser-evidence) when viewport evidence fails. diff --git a/packages/diagram-core/vendor/archify/references/brand-marks.md b/packages/diagram-core/vendor/archify/references/brand-marks.md index 5541178..ae054cd 100644 --- a/packages/diagram-core/vendor/archify/references/brand-marks.md +++ b/packages/diagram-core/vendor/archify/references/brand-marks.md @@ -48,6 +48,16 @@ does; `brand` explains whose product it is. URL or silently assign a visually similar company. Known-brand URLs resolve to the bundled vector instead of using the network. +For discovered icon `href` attributes, capture decodes the basic named references +`amp`, `quot`, `apos`, `lt`, `gt` (and their defined uppercase aliases), plus +decimal and hexadecimal numeric references, once before URL resolution. Thus +`/icon.png?v=1&size=32` requests `/icon.png?v=1&size=32`. URL percent escapes +remain intact; nested escapes are not decoded recursively. This bounded decoder +does not add a general HTML parser or support every named HTML entity. +HTML reads stop at an explicit head ending outside comments, raw-text elements +and quoted attributes, including when those tokens span network chunks. The +256 KiB head limit and capture deadline still apply; a larger body after the +head is not read for icon discovery. Unknown URL capture accepts only bounded raster image formats, blocks credentials, nonstandard public ports, and private or link-local destinations, uses bounded concurrency and one total deadline, and returns the captured @@ -55,6 +65,13 @@ content digest. Later render and validate operations require that exact digest; blocked, unavailable, changed, oversized, or unsafe content fails closed instead of silently changing the artifact. +Page, icon and redirect requests send `Accept-Encoding: identity`. Capture does +not decompress response bodies: a successful response declaring another content +coding is closed and rejected explicitly. This keeps the existing byte limits +and pinned digest tied to the unencoded representation. A later usable icon may +still succeed; otherwise an encoding error is retained instead of being hidden +by an unrelated favicon 404. + The final artifact never fetches a brand asset when opened. Preset vectors and digest-verified captured site icons remain embedded in SVG, PNG, WebP, JPEG, Share Card, and WebM exports. diff --git a/packages/diagram-core/vendor/archify/references/delivery-contract.md b/packages/diagram-core/vendor/archify/references/delivery-contract.md index 301d7df..1cde644 100644 --- a/packages/diagram-core/vendor/archify/references/delivery-contract.md +++ b/packages/diagram-core/vendor/archify/references/delivery-contract.md @@ -1,72 +1,515 @@ # Delivery contract +## Failed finalize and candidate repair + +`finalize` stops at the first non-passing gate. Use compact stdout or `evidence.summaryReceipt`; read its full sidecar only when the summary lacks evidence needed for a coherent repair. A receipt with four artifact checks is basic validation, not showcase acceptance: require all nine checks, zero composition errors, and zero warnings. Fix `meta.quality_profile` and schema errors before geometry. + +For a validation failure, edit the existing JSON in the connected neighborhood named by diagnostics before rerunning a command. Preserve requested semantics, meaningful labels, source evidence, and fixed or agreed topology. Several routes sharing nodes call for one placement repair; read [Architecture layout repair](architecture-layout-repair.md) for that case. Reflow a blocked main path rather than nudging unrelated labels. Keep unrelated geometry when its composition already reads clearly. Use `--layout-json` before editing only when compact evidence lacks needed measurements. Workflow v2 uses its stable compiler receipt, not solver internals, as authoring evidence. + +After the edit, rerun the complete `finalize` command with `--quality showcase` and, for repository-backed work, `--repo-root `. If the output path already has browser evidence from another candidate, use a fresh `--out-dir .review-` for both the new `finalize` and any `visual-check`. Omit an earlier `--candidate-sha256` after editing because it binds the previous candidate. Compare diagnostics by code, subject, stage, and evidence, never by declining error count alone. If an issue survives two focused repairs, inspect measured geometry or the relevant contract; after one evidence-based retry, report the concrete gap. + +Use standalone `validate` only for focused diagnosis, passing `--repo-root` for repository-backed work. Its passing receipt marks `candidateFrozen: true`; run `nextAction.arguments`, replacing only ``, without editing, revalidating, or rereading the candidate. Retry later environmental or evidence failures against those frozen bytes. A measured reason to edit creates a new candidate and calls for the complete `finalize` without the old hash. + ## Validate and deliver -Use `validate` after every candidate edit. CLI HTML output paths must end in `.html`, including after symbolic-link resolution. -Compare receipt paths must end in `.json`. Explicit CLI paths may be absolute or -outside the current working directory; authored `meta.output` remains confined -to that directory. A type mismatch fails before writing with +`render` and direct renderer entry points print classified authoring failures +to stderr as readable diagnostics and exit 1. Input read/JSON parse failures +use `input/read` or `input/json-parse`; output filesystem failures use +`output/write` and identify the output path. Schema and layout failures keep +their existing rule codes. Use the advertised `validate --json` or +`deliver --json` interface for a machine receipt; `render` has no `--json` flag. +Unexpected implementation failures retain debugging information in human +mode and remain `internal/unclassified` in machine receipts. + +Each delivered output has two artifact-specific metadata paths. When an output +stem is too long for those derived filenames, Archify shortens it and appends a +stable hash: + +- `.delivery.json` records the latest completed attempt. +- `.delivery-pending.json` is the recovery journal for an attempt + in progress. + +For a literal artifact stem that already matches Archify's reserved bounded-name +marker, a pre-namespace raw provenance sidecar remains a read fallback when the +encoded sidecar is absent. A pre-namespace raw pending journal is an independent +fail-closed barrier: it blocks checks and redelivery even when an encoded pending +journal also exists, and neither journal is silently replaced. + +One directory-wide `.archify-delivery-lock.json` serializes every delivery that +resolves into the same physical output directory. This deliberately prevents +case, Unicode-normalization, Windows short-name, and symbolic-link aliases from +creating independent owners for one filesystem location. The tradeoff is that +deliveries to different artifact names in one directory also run serially; +provenance and pending journals remain artifact-specific. + +For migration safety, Archify also detects and preserves a legacy +`.delivery-lock.json` beside the requested artifact. An existing +legacy entry is a fail-closed recovery barrier. While a new delivery owns the +directory mutex, it also holds temporary legacy-format fences for the requested +spelling and an existing artifact's physical target spelling. It acquires the +directory lock first, then all required compatibility fences before writing a +journal or artifact, and removes the directory lock before those fences during +release. This blocks an older Archify binary using +either known spelling from entering the delivery. A legacy fence whose raw +HEAD-era filename exceeds the host component limit is omitted because the old +binary could not create that lock or deliver that artifact on the host either. + +`deliver` acquires the lock by exclusive `open(..., "wx")` before creating or +replacing the recovery journal. A successful exclusive create yields an +internal opaque ownership capability bound to that attempt. Journal creation, +failed-provenance recording, pair commit, rollback, journal finalization, and +lock release each verify the current capability inside the operation that +would mutate shared state. A rejected contender does not create a journal or +write failed provenance. + +An existing directory or legacy lock is handled without automatic recovery: + +| Observed lock state | Required `deliver` result | +| --- | --- | +| No directory entry | Attempt exclusive creation; only its success grants ownership. | +| Valid schema-v1 lock whose PID is running, or whose death cannot be established | Exit 1 with `delivery/concurrent-attempt`; preserve every shared path. | +| Valid schema-v1 lock whose PID is known to have exited | Exit 1 with `delivery/lock-stale`; preserve the lock, artifact, journal, and current provenance exactly. | +| Unreadable, malformed, symlink, dangling symlink, directory, or other non-regular lock entry | Exit 1 with `delivery/lock-invalid`; preserve the entry and every other shared path. | +| An acquired capability no longer matches the current lock or journal | Exit 1 with `delivery/ownership-lost`; stop all shared-path mutation. | +| The matching owner cannot remove its lock | Exit 1 with `delivery/lock-release`; preserve the lock. | + +A `delivery/lock-stale` diagnostic identifies the absolute output and lock +paths plus the original PID and receipt ID. Recovery is deliberately explicit +and serial: stop all delivery attempts for that physical output directory, +confirm that no active delivery owns it and that the reported stale entry has +not been replaced, remove only the reported lock, then rerun `deliver`. Do not +remove an artifact, current provenance, or pending journal as part of +stale-lock recovery. + +The lock protocol targets Node.js 18 or later on a local filesystem with +cooperating Archify processes. PID, receipt, and file-identity comparisons are +defensive checks, not an atomic compare-and-swap. Compatibility fences cover +the requested spelling and an existing physical-target spelling; they cannot +enumerate arbitrary hard-link names or previously unknown filesystem aliases, +so mixed-version delivery through such aliases remains out of scope. This +contract does not claim distributed-lock correctness on NFS, SMB, or other +network filesystems, and it cannot prevent an external process that ignores +the protocol from replacing shared paths. + +Every no-clobber HTML publisher (`render`, `deliver`, `compare`, and `preview`) +captures the requested directory entry, canonical write slot, physical parent, +and existing target type, device/inode identity, and mode before staging, then +revalidates that snapshot immediately before replacement. An existing write +target must be a regular file with exactly one hard-link name. A target with +multiple hard-link names fails closed with `output/target-hardlinked`: replacing +the requested name cannot update unknown sibling names as one publication. +Hard links remain supported for read identity and input/alias collision checks; +they are unsupported only as write targets. A symbolic link to a single-link regular +file remains supported: publication preserves the symbolic-link entry and +applies the same protocol to its resolved target. Directory, FIFO, socket, +device, changing mode, new claimant, and indeterminate identity cases fail +before replacement. + +Publication is no-clobber and recoverable, not crash-atomic replacement of an +existing target. To avoid overwriting a claimant that appears after the last +identity check, Archify first retains the bound old file in a private recovery +backup, removes the public name through identity-bound quarantine, and then +creates the new public name with an exclusive hard link. A caught failure rolls +back when the public slot and recovery binding still permit it. A process +interruption between those namespace operations can instead leave the public +path absent while the verified previous bytes remain in an adjacent private +recovery backup. Single-artifact publication records the original slot/alias +identity and backup inode, mode, SHA-256, and byte count in private +`.archify-remove-*/publication-recovery-v1.json`, beside `previous`. To make a +specific interrupted publication visible again, stop concurrent writers and run: + +```bash +node bin/recover-output.mjs /absolute/path/to/.archify-remove- --json +``` + +This is explicit recovery, not a directory scanner. Before linking, the helper +checks for a changed parent or alias, an altered/hardlinked record or backup, +digest or inode mismatch, and any existing public target. It restores only by +no-clobber hard link, so a new claimant is preserved rather than overwritten; +it never recursively removes unknown entries. A completed recovery is +idempotent. The record is evidence to be independently verified, not an +authority to restore arbitrary private bytes: the helper accepts it only from +the recorded generated child of the original physical target parent, with the +same directory identity. Name the exact directory reported by the interrupted +process and inspect an uncertain record manually. A non-cooperating process can +still swap pathnames after those checks and before Node.js `linkSync`; Node does +not expose a descriptor-bound link operation. Post-link identity verification +then fails closed and retains recovery evidence, rather than claiming recovery +or deleting an uncertain name. If recovery itself is interrupted after the +link, the old public bytes and private backup can both remain; a later recovery +run preserves the public target and needs explicit operator resolution. The +record is fsynced before the old public name is retired on platforms supporting +directory sync, and the tested guarantee is recovery after a killed process; +this is not a claim of power-loss, storage-controller, NFS, or SMB durability. +Paired flows retain their backup in private transaction staging. For `deliver`, +the pending journal and lock keep strict checkers fail-closed. The portable +Node.js filesystem API has no pathname +compare-and-swap that both replaces an existing name atomically and refuses to +overwrite a late claimant: `rename` would close the visibility gap only by +overwriting that claimant. + +After ownership is established, `deliver` creates the journal before rendering +and keeps it through the recoverable HTML/sidecar pair commit. It removes the +journal only after that commit completes. A validation, render, or pair-commit +failure, or a process interruption, may therefore leave a journal. The journal +is a safety barrier: `check`, `browser-check`, and `visual-check` fail closed when any directory +entry exists at the journal or lock path, including an unreadable file, +symlink, or dangling symlink. Run deliveries targeting the same physical output +directory serially; one attempt must finish or be recovered before another +begins. + +A successful sidecar has `schemaVersion: 1`, `status: "current"`, +`command: "deliver"`, a unique `receiptId`, the diagram `type`, an absolute +`input` path, an absolute `output` path matching the inspected +artifact, and specification/artifact SHA-256 and byte counts. Checkers treat a +missing, malformed, unsupported, or inconsistent field as invalid. They also +reject a sidecar symlink, including a dangling one. A checker binds provenance +to the artifact bytes it actually checks and verifies that binding again before +reporting success; a concurrent byte change fails. The provenance directory +entry itself must be a single-link regular file: `deliver` and strict check fail +closed with `delivery/provenance-hardlink-unsupported` when it has another hard +link, without scanning for or guessing the sibling name. + +If a currently verified owner fails after an older HTML exists, Archify writes +a new `status: "failed"` sidecar and leaves the journal until recovery is +complete. An unreadable old HTML does not prevent that marker; its artifact hash +and byte count may be absent. If the sidecar is locked or otherwise unwritable, +Archify keeps the prior sidecar rather than deleting evidence, and the journal +prevents checkers from trusting it. A rejected concurrent, stale, or invalid +lock attempt does not write failed provenance. If ownership is lost, Archify +reports `delivery/ownership-lost`, does not overwrite or remove the successor's +artifact, provenance, journal, or lock, and does not claim recorded failed +provenance; a failure receipt may report `provenance: "unrecorded"`. If every +metadata path is unavailable, the same unrecorded status applies; no tool can +preserve that fact across processes. Restore metadata-path access and complete +a successful `deliver` before trusting the output. + +Artifacts with no sidecar, journal, or lock remain supported for backward +compatibility and for the lower-level `render` command. Their checker receipts +report `provenance: "unknown"`; use `--require-provenance` to turn that state +into a non-zero failure when the workflow requires a successfully delivered +artifact: + +```bash +node bin/archify.mjs check --require-provenance +node bin/archify.mjs browser-check --json --require-provenance +``` + +## Output path contracts + +Archify intentionally separates durable authored paths from command-line paths: + +- Required authored `meta.output` is a portable POSIX-relative path such as + `reports/diagram.html`. It uses `/`, ends in a non-empty `.html` basename, + and cannot contain an absolute or drive-relative prefix, URI, backslash, + empty or dot segment, control character, unpaired UTF-16 surrogate, Windows + alternate-data-stream separator or invalid filename character, trailing dot + or space, DOS device name, or a component over either the 255-byte UTF-8 or + 255-code-unit UTF-16 limit. It resolves from the current working directory + and must remain physically inside that directory, with an `.html` target, + after symbolic links are followed. The durable output/archive profile also + conservatively rejects a Windows 8.3 short-name shape such as `PROGRA~1`; + descriptive repo/Git POSIX paths use a separate profile and are exempt. +- Explicit CLI output arguments use the active host's native syntax. They may + be relative or absolute, use native separators, and resolve outside the + current working directory. On Windows, ordinary drive-absolute, UNC, and + relative paths (including ordinary `.` and `..` navigation) are supported. + A system-resolved 8.3 spelling of an existing file or directory is accepted + when Archify can prove its physical identity; this native alias support does + not relax the durable output/archive profile's 8.3-shaped-name rejection. + Extended-length paths are limited to raw backslash-only `\\?\C:\...` and + `\\?\UNC\server\share\...` forms without dot segments; device namespaces, + malformed roots, drive-relative paths such as `C:file.html`, current-drive + roots such as `\file.html`, alternate data streams, reserved device names, + invalid or trailing filename characters, and overlong components fail + closed. POSIX CLI paths retain POSIX filename rules rather than inheriting + Windows spelling restrictions. Every host rejects NUL, unpaired surrogates, + and components that exceed its supported bound. + +These contracts are not interchangeable: an explicit CLI output does not hide +an invalid durable `meta.output` (including a missing value), and `validate` +checks the authored output even when it does not publish to that path. A +workflow v1-to-v2 migration may explicitly receive a portable durable +replacement through `migrate workflow old.json new.json --to-schema 2 --output +reports/diagram.html`; that value is written only to its separate verified v2 +destination. This migration-candidate exception does not repair the source or +bypass any non-output schema or compiler error. For every other repair, add a +portable POSIX-relative `.html` path to `meta.output`; no schema-version change +is otherwise required. + +Run `finalize` directly on a complete first candidate and after every repair edit. Its embedded validation checks the candidate before delivery; use standalone `validate` only for focused diagnosis. After an edit, omit any earlier `--candidate-sha256`, which binds the previous candidate. CLI HTML output paths must end in +`.html`, including after symbolic-link resolution. Compare receipt paths must +end in `.json`. A type mismatch fails before writing with `output/cli-extension` or `output/cli-resolved-extension`. These checks prevent accidental file-type overwrites; they do not sandbox explicit CLI directories or prevent replacement of an existing artifact of the expected type. -Use final atomic delivery only after the candidate is frozen: +Use final verified delivery only after the candidate is frozen: ```bash node bin/archify.mjs deliver --quality showcase --json ``` -Deliver reads the specification once, writes those exact bytes to a private same-directory candidate snapshot, renders that snapshot, runs the complete artifact checker, and only replaces the target after all artifact checks pass. The JSON receipt includes SHA-256 and byte counts for both `specification` and `artifact`. Renderer, checker, receipt, or commit failure exits non-zero, removes private state, preserves the previous trusted artifact, and never invokes an opener. +Deliver reads the specification once, writes those exact bytes to a private same-directory candidate snapshot, renders that snapshot, runs the complete artifact checker, and only replaces the target after all artifact checks pass. The JSON receipt includes SHA-256 and byte counts for both `specification` and `artifact`. -Run `visual-check` only after `deliver` exits zero for the current candidate. If -delivery fails and the output path already exists, that path still names the -previous trusted artifact; running `visual-check` then would measure and capture -stale output, not the rejected candidate. Report the delivery diagnostics and -repair the source before collecting new visual evidence. +For the ordinary agent handoff path, prefer the finalizer: -The delivery interface exposes three separate claims: +```bash +node bin/archify.mjs finalize --quality showcase --json +``` + +`finalize` invokes verified `deliver` once, reuses its embedded showcase +validation result, then runs strict `check --require-provenance` and +`browser-check --require-provenance`. It stops at the first failed or skipped stage +and preserves that stage's full receipt. Its stdout is one compact JSON +object with gate statuses, bounded actionable diagnostics, artifact identity, +and evidence paths. The same compact object is written atomically to +`.finalize-summary.json`; use that file for normal failure repair. +Complete stage receipts and timings remain available for auditing in +`.finalize.json`. With `--out-dir`, both files are written there; +`--receipt ` overrides the full receipt path and derives a distinct +`-summary.json`. Read the full receipt only when the compact summary is +truncated and its shown subjects and evidence cannot identify a coherent local +repair, or when complete audit evidence was explicitly requested. The compact +receipt reports `visualReview: "not-requested"`; the automated gate does not create images or require a perceptual reviewer. A compact `visualReviewRecommendation` retains positive crossover and route-detour metrics from the strict check so the author can apply the review escalation below without reading the full receipt. A recommendation does not change the machine exit code or claim that review happened. Its `affectedRoutes` identifies crossing pairs and detours (up to eight of each, with a truncation flag); the full strict-check `composition.routeReview` retains all affected relationships. Use these IDs to trace the routes in the captured default viewport. Detours may include `directCorridorBlockers`, identifying nodes between aligned endpoints. These are geometric review clues, not new validation failures or inferred main-path semantics. For a blocked main path or several tangled routes, follow [Architecture layout repair](architecture-layout-repair.md) and reflow the connected scene before tuning individual sides or labels. Preserve every semantic fact; retain unrelated positions only when their surrounding composition is already accepted. + +For a measured automatic Architecture with a large unused leading area, the +compact receipt may include `layoutReviewRecommendation`. Its +`composition.leadingSpace` evidence accounts for nodes, boundary titles, +routes and labels. Check whether that space is intentional; if not, reposition +the connected scene while preserving meaning and user-fixed geometry, then +finalize again. This suggestion changes no gate or exit status and requires +no screenshot. A fixed canvas or uncertain measurement receives no suggestion. + +A passing finalizer receipt is sufficient evidence for all four gates. Merely +naming the gates or requiring each one to pass does not require replaying their +standalone commands. Replay an individual command only when the request +explicitly requires separate executions or focused failure diagnosis needs it. + +The individual commands remain authoritative and backward compatible. Use +them directly for focused diagnosis, recovery, or when only one gate is +required. A finalize failure does not relax any gate and does not turn a +preserved older artifact into a current successful delivery. + +`finalize` overlaps private Chrome startup with delivery and strict checking. +It loads the artifact only after those gates pass and current provenance is +verified. The browser gate retains every viewport, theme, and stability check; +the browser closes at completion or an earlier failure. Its full stage receipt +records `execution: "in-process"` and the equivalent standalone `command` for +replay. Use total finalize duration to compare performance because Chrome +startup overlaps the earlier stages. + +The pair commit is recoverable, not a claim that two filesystem paths change +atomically or are durable across power loss. Journal finalization is part of +that commit: a caught failure while verifying or removing the journal rolls +back the replaced files when possible and while ownership remains current. If +ownership is lost, the old attempt immediately stops renaming, rolling back, +finalizing the journal, recording failure provenance, or cleaning up shared +paths. Any private staging or recoverable backups remain available and are +identified by the failure diagnostic. If restoration fails for another reason, +the failure receipt likewise identifies retained backups for recovery. A +process interruption can leave the journal, backups, or private staging behind; +checkers then fail closed. Follow the reported recovery evidence before rerunning +`deliver` serially on the same output. A failed attempt exits non-zero and never invokes an opener; it never +authorizes visual evidence collection. + +If exclusive creation succeeds but lock initialization fails, Archify may +record failed provenance and remove the incomplete lock only while its +capability still identifies that exact entry. A replacement is preserved. +Filesystem and cleanup errors are reported separately from an active concurrent +delivery. An active, stale, unrecognized, or otherwise preserved lock +independently prevents checkers from accepting the prior artifact. Fix the +reported filesystem error before retrying, and use another physical output +directory if the lock path contains unrelated data. + +Lock release is part of delivery completion. If the artifact/provenance pair +has committed and the journal has finalized but the matching lock cannot be +removed, `deliver` exits 1 with `delivery/lock-release`, preserves the lock, +does not print a success receipt, and does not invoke an opener. The preserved +lock keeps strict checkers fail-closed. Only after pair commit, journal +finalization, and lock release all succeed may `deliver` exit zero, print its +success receipt, or run `--open`. + +Run strict `check` after `deliver` exits zero. Run `browser-check` or optional +`visual-check` only after that strict check exits zero. A failed marker, +recovery journal, or delivery lock makes every checker fail before accepting +the preserved HTML; report the diagnostics and complete a successful recovery +delivery before collecting new browser evidence. + +The delivery interface exposes four separate claims: 1. `deliver` proves deterministic artifact checks and byte identity. -2. `visual-check` collects automated browser evidence from the exact artifact. -3. Perceptual visual review records a human or image-capable reviewer's judgment. +2. `browser-check` collects required automated browser evidence from the exact artifact without capturing images. +3. `visual-check` optionally adds artifact-bound screenshots and a contact sheet. +4. Perceptual visual review records a human or image-capable reviewer's judgment. + +Passing one claim never implies the others. Never claim that the deterministic receipt includes browser or perceptual review evidence. + +## Recovering a failed comparison + +`compare` commits an HTML artifact and its JSON receipt as a pair. If that commit +fails, it attempts to restore the previous files. A complete rollback removes +the temporary directory as usual. -Passing one claim never implies either of the others. Never claim that the deterministic receipt includes visual review. It does not include browser evidence either. +If a previous file cannot be restored, compare exits non-zero with +`delta/commit-rollback-failed` and retains the recovery directory. In the JSON +failure receipt, `diagnostics[].evidence.recoveryDirectory` identifies that +directory and `recoveryFiles` lists `{ backup, target }` paths for the files whose +restoration failed. Human-readable diagnostics also print the recovery paths. + +Resolve the filesystem error, inspect the current targets, and restore each +listed backup to its corresponding target before retrying. Keep the recovery +directory until both previous files have been recovered and verified; it can +also contain rejected candidate files, which must not be mistaken for backups. +Successful comparisons and failures before commit retain their normal cleanup. ## Automated browser evidence -After delivery, inspect the exact trusted HTML without rerendering or modifying -it: +`finalize` runs the required browser gate against the exact trusted HTML without +rerendering or modifying it. For focused diagnosis, the equivalent standalone +command is: ```bash -node bin/archify.mjs visual-check --json +node bin/archify.mjs browser-check --json --require-provenance ``` The zero-dependency command uses Chrome/Chromium through the DevTools pipe. It measures light-theme containment at 1440×900, 1600×1000, 1920×1080, and -2048×1320, then captures light/dark screenshots at 1440×900 and 2048×1320. It -writes four PNG sidecars, one relative-path HTML contact sheet, and one JSON -receipt beside the artifact. The receipt binds the source artifact SHA-256 and -byte count, identifies `evidenceKind: "automated-browser"`, records READ plus -Still runtime state, and always reports `visualReview: "pending"`; automated -browser evidence cannot claim perceptual review. +2048×1320, and verifies the requested light theme at all four viewports, the dark +theme at both endpoints, and READ/Still runtime states. A requested theme that +resolves to a different theme fails with measured evidence. It creates one +`.browser-check.json` receipt and no screenshots or contact sheet. +Pass `--out-dir ` to place the receipt in a separate evidence directory. +The receipt binds the artifact SHA-256 and byte count, identifies +`evidenceKind: "automated-browser"`, and reports +`visualReview: "not-requested"`. + +Horizontal overflow always fails. Normal document-level vertical scrolling is +accepted only with a renderer-declared contract and measured readable text. +Automatic canvases declare `data-reader-fit="intrinsic-height"`; their adaptive +Reader must reach its readable width and expose `data-reader-overflow="authored"`. +Architecture with an explicit `meta.viewBox` instead declares +`data-diagram-type="architecture"` and `data-reader-fit="authored-height"`: +its SVG coordinates, aspect ratio and existing Reader width behavior stay +unchanged. Its full SVG must remain inside the diagram panel without internal +scrolling or clipping, and the document must permit vertical scrolling. +The receipt records `verticalScrollAccepted: true` and +`overflowDisposition: "readable-vertical-scroll"`. Missing or unknown declarations, +explicit viewBoxes in other modes, unreadable text, horizontal overflow, +clipping and Viewer chrome collisions remain failures. Do not add an internal +diagram scroller or hide overflow. + +`browser_evidence` in the handoff records only the outcome of this automated +command: + +- `passed` maps from exit 0 and receipt `status: "pass"` after every required measurement completes and passes. +- `failed` maps from exit 1 and receipt `status: "fail"` when the inspection finds a defect, the command fails, or a runtime error leaves the evidence incomplete. +- `skipped` maps only from exit 2 and receipt `status: "skipped"` when Chrome/Chromium is unavailable and the inspection does not run. -`browser_evidence` in the handoff records only the outcome of this automated command: +Runtime failures leave incomplete evidence and must not be normalized to +`skipped`. They do not invalidate an already successful deterministic delivery. +Retry an environmental failure in a browser-capable execution context when +practical. Keep the packaged transport unchanged unless the failure reproduces +through that seam in a capable environment. -- `passed` maps from exit 0 and receipt `status: "pass"` only after every required measurement and capture completes and passes. -- `failed` maps from exit 1 and receipt `status: "fail"` when the inspection finds a defect, the command fails, or a runtime/capture error leaves the evidence incomplete. -- `skipped` maps only from exit 2 and receipt `status: "skipped"` when Chrome/Chromium is unavailable and the inspection does not run. +A provenance failure exits before browser inspection and persists a failed +browser-check receipt bound to the attempted artifact. If the failure receipt +cannot be written, the diagnostic names that incomplete evidence. + +Both browser commands inspect the exact delivered HTML without modifying or rerendering it. + +## Sequence width review -Runtime or capture failures leave incomplete evidence and must not be normalized to `skipped`. Failed or skipped capture runs remove stale -image/contact-sheet sidecars rather than presenting prior evidence as current. -They do not invalidate an already successful deterministic delivery, and they -do not turn a perceptual visual review into passed or failed. Retry an -environmental failure through the supported command in a browser-capable -execution context when practical. Keep the packaged transport unchanged unless -the failure reproduces through that seam in a capable environment. +A passing `finalize` may report `layoutReviewRecommendation.action: "inspect-sequence-width"`. Its `evidence` measures the fixed participant columns' unused right-hand space after accounting for message labels, notes and segment titles. This advice adds no warning, failure, screenshot requirement or automatic geometry change. + +For a newly authored candidate with omitted `meta.column_fit` and no user-fixed column geometry, save the candidate, set only `meta.column_fit` to `"spread"`, and rerun the complete `finalize` once with `--out-dir /width-review`. Keep participant order, messages and their y positions, labels, notes, sources and canvas dimensions. If that attempt fails, restore the candidate and finalize it with `--out-dir /width-restore`; report the remaining layout suggestion rather than iterating. Preserve an explicitly fixed layout or a supplied legacy candidate and disclose the suggestion without changing it. This review is about horizontal composition; a passing receipt still does not claim perceptual approval. + +## Optional capture evidence + +`visual-check` remains backward compatible for a requested or escalated +perceptual review: + +```bash +node bin/archify.mjs visual-check --summary --require-provenance +``` + +`--summary` returns compact JSON with all diagnostics and absolute paths to the complete receipt, contact sheet, and every screenshot. For a chosen visual review, inspect the relevant captures; capture success is not perceptual approval. `--json` retains the full receipt output for existing consumers. Both modes run the same checks and keep the same exit status. If cleanup fails after publication, the summary retains the final failure diagnostics and `publication` recovery details; the linked receipt records the earlier committed evidence. + +It performs the same automated browser measurements, captures light/dark +screenshots at 1440×900 and 2048×1320, and writes four viewport PNG sidecars, +one relative-path HTML contact sheet, and one JSON receipt. `--out-dir ` moves all of these sidecars together. +Open the HTML contact sheet in a browser or inspect the viewport PNGs with an image reader. Its receipt reports `visualReview: "pending"` because captures do not themselves +make a perceptual judgment. Capture and provenance failures follow the ownership rules below. + +The receipt, contact sheet, and four PNGs form one owned evidence set. Before +capture, `visual-check` freezes every requested directory entry, its +canonical write slot and physical parent, and the target's absent/file state, +type, device/inode identity, and mode. Hard-linked evidence targets are not safe +write targets. All candidate files are created exclusively inside one random, +private staging directory beneath the physical evidence directory; the receipt +is published last. Each staged candidate must have exactly one hard-link name +before publication. The no-clobber publish link temporarily gives the staged +and final names a link count of two; unlinking the verified staged name must +leave the final entry with a link count of one. An unexpected external hard +link fails closed and its alias is never removed. + +Chrome inspects one identity- and content-checked copy of the captured artifact +in a private local temporary directory, so browser file loading does not depend +on UNC or long-path support. The six publication candidates remain on the +evidence volume. Both temporary directories are cleaned without recursively +deleting unknown contents; retained entries include their recovery locations. + +Immediately before committing anything, `visual-check` re-resolves and verifies +the complete six-path set. An absent-path claimant, existing-path replacement, +symbolic-link or dangling-link retarget, parent-topology change, hard link, or +indeterminate identity fails closed with `viewer/evidence-path-conflict`. The +claimant and every other final evidence path remain untouched. Cleanup removes +only this run's staged or published entries after rechecking their captured +identities; a changed or unknown entry is preserved. + +An existing visual evidence set is replaceable only when a regular +`visual-check` receipt proves ownership of the same artifact and evidence +directory, and its exact sidecar manifest matches every existing contact-sheet +or PNG byte count and SHA-256 digest. A missing, malformed, unknown, mismatched, +or incomplete ownership record never authorizes deletion. Failed and skipped +runs retire prior screenshots/contact sheets only as part of the same verified +transaction when that ownership proof succeeds; otherwise they preserve all +unknown evidence and report `viewer/evidence-path-conflict`. + +This rule also applies when Chrome is unavailable or provenance fails before +browser inspection: neither path may blindly delete stale-looking evidence. A +verified owned set may be recoverably retired before publishing a skipped or +failed receipt; unowned evidence remains intact. These outcomes do not invalidate an already +successful deterministic delivery and do not turn a perceptual visual review +into passed or failed. Retry an environmental failure through the supported +command in a browser-capable execution context when practical. Keep the +packaged transport unchanged unless the failure reproduces through that seam in +a capable environment. + +`browser-check` applies the same private-snapshot, identity, ownership, and no-clobber rules to its single JSON receipt. Its namespace is separate from `visual-check`, so a browser-only rerun cannot remove capture evidence. + +## A new candidate at an existing output path + +Browser evidence belongs to exact artifact bytes. After editing a candidate whose previous HTML already has browser evidence, choose a fresh evidence directory before running the next `finalize`; this preserves the old receipts and captures without an avoidable ownership-conflict retry: + +```bash +node bin/archify.mjs finalize architecture candidate.json diagram.html --quality showcase --repo-root --out-dir diagram.review-2 --json +node bin/archify.mjs visual-check diagram.html --out-dir diagram.review-2 --summary --require-provenance +``` + +Keep the requested HTML path stable. Use a new revision directory for each changed candidate, and retain the same directory for retries of unchanged bytes. For a diagram without repository evidence, omit `--repo-root`. Let the commands create their output directory. A prior validation failure that produced no HTML or browser evidence needs no new directory. Never remove unknown evidence to make a retry pass. ## Optional opening -Add `--open` only when the user wants an immediate local preview. It runs after that atomic commit, uses one argument-array OS opener with a five-second bound, and records `open.status`. Keep it off for CI, unattended agents, and non-interactive environments. Failure or unsupported opening does not invalidate delivery; its status proves only whether the local opener invocation succeeded. +Add `--open` only when the user wants an immediate local preview. It runs after +the verified pair commit has completed, its recovery journal has been removed, +and the delivery lock has been released successfully. It uses one argument-array +OS opener with a five-second bound on macOS and Linux, and a fifteen-second bound +for PowerShell startup on Windows. The receipt records `open.status`; failed or +unavailable launch attempts also include normalized `open.failure` details. +Keep it off for CI, unattended agents, and non-interactive environments. +Failure or unsupported opening does not invalidate delivery; its +status proves only whether the local opener invocation succeeded. ## Last-Good Live Preview @@ -80,25 +523,44 @@ Preview watches one explicit input on loopback, binds each stable digest to a pr The preview runtime ships inside the zero-dependency Skill ZIP and must work without `node_modules`. -Never start it by default. Do not use it for CI, unattended agents, remote sharing, or mobile use. `--no-open` is only for a user who will open the printed local URL or for loop testing. Stop it with Ctrl-C before handoff. Server state, port, source path, diagnostics, error text, and reload tokens must never enter the generated artifact or any export. +Never start it by default. Do not use it for CI, unattended agents, remote sharing, or mobile use. `--no-open` is only for a user who will open the printed local URL or for loop testing. Stop it with Ctrl-C before handoff. The first Ctrl-C drains the active delivery without publishing it; a second Ctrl-C forces shutdown of both delivery processes and HTTP connections, including incomplete requests. Shutdown preserves the last verified artifact and removes only staging files whose ownership can be verified. If delivery is interrupted before its receipt reaches Preview, unconfirmed files and recovery material may remain in the private staging directory; shutdown does not recursively delete unknown contents. Server state, port, source path, diagnostics, error text, and reload tokens must never enter the generated artifact or any export. + +## Perceptual review -## Perceptual delivery gate +The automated path ends with the deterministic browser gate and reports +`visual_review: not_requested`. Ordinary generation does not require screenshots +or an image-reading step, including newly authored or repositioned Architecture. +Perceptual review is optional; use it for an explicit request or a concrete visual +investigation. Possible reasons include: -Automated validation and browser evidence cannot prove visual polish. After deterministic delivery, inspect the actual HTML in a capable browser or render the evidence screenshots with an image reader. Check both themes when changed, the default READ view, line crossings/corridors, label masks, node/card fit, focus/search/passport closure, and export cleanliness. +- the compact finalizer includes `visualReviewRecommendation` for crossings or detours (advisory, not a delivery gate); +- the user explicitly requests an aesthetic or visual review; +- a template, renderer, or Viewer change needs visual regression evidence; +- a novel layout or browser diagnostic leaves low confidence; +- the run is selected for sampled audit or dogfood. -For the default standalone desktop viewer, measure 1440×900, 1600×1000, and 1920×1080. When the artifact is intended for a large desktop display, also measure 2048×1320. A first-screen pass requires `document.documentElement.scrollWidth <= window.innerWidth` and `scrollHeight <= window.innerHeight` at every checked size. At the largest checked viewport, inspect the rendered composition for a conspicuous empty lower band: the main panel and necessary conclusion cards should use the available height as a balanced whole, not collapse into a shallow strip. If a desktop viewport overflows, repair the authored composition by removing only genuinely redundant content or compacting spacing before shrinking nodes, labels, or the main panel. Do not hide overflow, clip content, introduce an internal diagram scroller, or reduce node/label typography to make the measurement pass. Narrow/mobile containment may retain vertical page scrolling. +For the default standalone desktop viewer, measure 1440×900, 1600×1000, 1920×1080, and 2048×1320. Require `document.documentElement.scrollWidth <= window.innerWidth` at every checked size. Prefer `scrollHeight <= window.innerHeight`; accept page-level vertical scrolling only through the Reader-declared readable exception defined above. At the largest checked viewport, inspect the rendered composition for a conspicuous empty lower band: the main panel and necessary conclusion cards should use the available height as a balanced whole, not collapse into a shallow strip. For unexpected overflow, repair the authored composition by removing only genuinely redundant content or compacting spacing before shrinking nodes, labels, or the main panel. Do not hide overflow, clip content, introduce an internal diagram scroller, or reduce node/label typography to make the measurement pass. Narrow/mobile containment may retain vertical page scrolling. -A manual browser record is supplementary to the automated status. Reproducing the same coverage requires all four exact viewport measurements, both endpoint themes, and an artifact-bound record of the inspected SHA-256 and byte count. It never changes `browser_evidence`: when Chrome/Chromium is unavailable, that status remains `skipped` even when the manual browser record is complete and `visual_review: passed`; an automated `failed` result likewise remains `failed`. An unconstrained browser glance can support perceptual review only. +For an escalation, run `visual-check` on the current finalized artifact, inspect +its contact sheet with a capable image reader or human, and check both endpoint +themes, the default READ view, line crossings/corridors, label masks, node/card +fit, focus/search/passport closure, and export cleanliness. This review is +supplementary and never changes `browser_evidence`. An unconstrained browser +glance can support perceptual review only. -Report exactly one truthful status: +Report one truthful optional-review status: +- `visual_review: not_requested` — no review trigger applies; this is not a visual acceptance claim. - `visual_review: passed` — only after inspecting the rendered artifact. -- `visual_review: skipped (image reader unavailable)` — when no capable visual surface exists. +- `visual_review: skipped (image reader unavailable)` — a requested or triggered review could not run. - `visual_review: failed` — with the concrete visible defect. -Use `correction_rounds: 0`, `correction_rounds: 1`, or `correction_rounds: 2`; never exceed a maximum of two focused correction rounds. Never report `visual_review: passed` without inspecting the artifact. - -If visual review changes the candidate, validation and delivery must run again because the prior frozen specification receipt is no longer current. +For an escalated review, use `correction_rounds: 0`, `correction_rounds: 1`, or +`correction_rounds: 2`; never exceed two focused correction rounds. When review +is not requested, use `correction_rounds: 0`. Never report +`visual_review: passed` without inspecting the artifact. If perceptual review +changes the candidate, rerun `finalize` because the previous specification and +artifact receipts are no longer current. ## Handoff receipt @@ -111,10 +573,16 @@ specification_sha256: artifact_sha256: validation: 9/9 showcase, 0 errors, 0 warnings browser_evidence: passed|failed|skipped -visual_review: passed|skipped (image reader unavailable)|failed +visual_review: not_requested|passed|skipped (image reader unavailable)|failed correction_rounds: 0|1|2 ``` -Derive `browser_evidence` only from the latest artifact-bound `visual-check` receipt. Record any manual browser work separately with its artifact binding, viewport/theme scope, and observations; never use it or `visual_review` to overwrite the automated status. +Derive `browser_evidence` only from the latest artifact-bound `browser-check` +receipt, normally the stage embedded by `finalize`. Record optional capture or +manual browser work separately with its artifact binding, viewport/theme scope, +and observations; never use it or `visual_review` to overwrite the automated +status. Opening, preview status, Share Cards, and other viewer exports are not validation claims. + +Finalize receipt publication uses the same identity-bound, no-clobber publisher and explicit recovery records described above. The full and summary receipts must be distinct from the candidate, artifact, delivery metadata, and browser receipt. Their targets must be absent or single-link regular files; symlink receipt entries and hardlinked targets fail closed. A later claimant or changed parent stops publication and remains untouched. Default receipt names share the physical artifact namespace and are bounded for the host filename limit. The two receipts are published individually, not as a crash-atomic pair; only a completed passing command is a successful handoff. diff --git a/packages/diagram-core/vendor/archify/references/repository-authoring.md b/packages/diagram-core/vendor/archify/references/repository-authoring.md new file mode 100644 index 0000000..b73033b --- /dev/null +++ b/packages/diagram-core/vendor/archify/references/repository-authoring.md @@ -0,0 +1,105 @@ +# Repository-backed architecture authoring + +Use this reference when a diagram must explain a real repository. The source is +the authority for responsibilities, calls, boundaries, and persistence. The +diagram is complete when the requested meaning is covered and every asserted +fact has supporting source evidence. + +## Explore on demand + +1. **Freeze identity.** From the target repository, record `git rev-parse + HEAD`, `git remote get-url origin`, and `git status --short`. Remove HTTP(S) + userinfo (including usernames, passwords, and tokens) before recording the + origin or placing it in the candidate. Preserve its transport, port, path and + `.git` suffix; do not rewrite an internal SSH origin as HTTPS. Pin the credential-free URL and + forty-character revision in `meta.repository`. Use `link_mode: "local-only"` + for an SSH origin, unsupported forge, intentionally local-only source links, + or a local fixture whose HTTPS URL is only a repository identity; retain the + URL and revision. Web links require a supported GitHub or Gitee HTTPS origin. If the + worktree is dirty, record the changed paths. Repository evidence is verified + against committed bytes at the pinned revision, not working-tree edits: + inspect a clean checkout at that revision for any cited changed path. Do not + present uncommitted bytes as evidence for `HEAD`; `local-only` does not record + a verifiable snapshot of those bytes. + +2. **Map the slice.** Use project instructions, manifests, entry points, + registrations, and deployment configuration to locate candidate runtime + units. Read the entry, configuration, and modules relevant to the request. + Follow imports and call sites + until the requested responsibility reaches its actual input, output, or + side effect. Read a small connected slice instead of scanning the repository + for a convenient label. + +3. **Trace ownership.** Derive runtime and I/O relationships from the observed + actor, operation, and target at their call sites; deployment and trust + relationships use the corresponding configuration or enforcement evidence. Distinguish the controller requesting + an operation from the runtime that executes it and the store receiving bytes. + For a file or database edge, the source must identify its actual reader or + writer; a responsibility statement such as “maintains tasks” does not prove + direct I/O. Keep these facts with the source locations while reading, without + a separate planning artifact. Choose which distinctions need separate + nodes using [Composition and meaning](authoring-defaults.md#composition-and-meaning); + discovering an implementation role does not automatically add it to the overview. + A configured provider, an injected adapter, a local stub, and a durable + service are different claims; label the one the source supports. + +4. **Record evidence while reading.** Keep exact repository-relative paths and + inclusive line ranges for each component and meaningful relationship. Follow + actual branches, retries, fallbacks, and error handling. A function that is + exported or configured but never called by the normal path is an optional + capability, not a required runtime edge. For a claim about authoritative + state change or control ownership, trace to the actual write or execution + site and the conditions that permit it; an upstream caller alone does not + establish those conditions. + +5. **Name uncertainty.** Write unresolved questions beside the claim they + affect: for example, “`writeFile` is called here; durability is unknown.” + Resolve a question by reading the next relevant source range or preserve it + as an explicit unknown. Never turn a label, package description, or config + value into an unobserved service or behavior. + +Stop exploring when every requested responsibility, relationship, and boundary +has supporting source entailment and the remaining unknowns cannot change that +coverage. There is no node, edge, citation, view, card, or boundary count to +hit. Do not add a summary step merely to signal completion. + +Batch independent relevant files when known. Each additional read should answer +an unresolved question that can change the diagram. Reuse concise facts and +their source ranges already verified in this task; across revisions, recheck +the affected entry points, configuration, dependencies, and evidence. + +## Choose an example by structure + +Select the main example in the [Type router](../SKILL.md#type-router) before +loading its content, using the request and repository metadata already needed +for source inspection. Selection fits the existing read batch and needs no extra +message, command, or repository-wide scan. For mixed or unclear tasks, use the +requested responsibilities and entry points as they become known in normal +inspection; keep their actual roles. Read another example when a necessary +capability remains unexplained. Examples teach shape, not facts: a library need +not acquire filesystem nodes, and finished showcases still follow the +first-draft automatic-routing rule. + +## Author from evidence + +Use the mode's complete JSON shape, including repository identity, +components, and connections; every repository-backed component needs supporting source +references, while boundaries or cards are added only when they +answer a real reader question. Let automatic routes and automatic +viewBox sizing work first. Keep the primary path readable, put exception paths +beside their owner, and leave filesystem stores outside a control boundary when +the source shows a separate responsibility. + +An existing example teaches field shape, not facts or arbitrary values. It does +not authorize a new boundary kind, a long note, a viewBox size, or a route +control. Consult the specific mode schema and `schemas/common.schema.json` +whether or not the selected example already contains the field; use the +schema's enum, length, identifier, and repository rules. Architecture +boundaries currently use `kind: "region"` or `kind: "security-group"`; source +references use `path`, `line`, and optional `end_line`. + +Repository-backed components need concise, truthful `sources` references. Preserve +control ownership when summarizing filesystem I/O: the code that reads or writes +a file owns that action, while a pure in-memory transform receives and returns +values. This fact-check does not require a separate overview node for every helper. Use the existing examples for valid field shape, then replace all +identifiers, wording, source paths, and claims with inspected repository facts. diff --git a/packages/diagram-core/vendor/archify/references/update-awareness.md b/packages/diagram-core/vendor/archify/references/update-awareness.md new file mode 100644 index 0000000..45d8458 --- /dev/null +++ b/packages/diagram-core/vendor/archify/references/update-awareness.md @@ -0,0 +1,9 @@ +# Update awareness + +Read this file only when `scripts/check-update.mjs` returns `update_available`. + +Show one compact notice in the user's conversation language with the installed version, latest version, the checker's fixed local summary, and official release-notes link. When `severity` is `security`, label it as a security update with restrained emphasis; this changes emphasis only, never user autonomy. Explicitly say that the installed Skill is unchanged and the user decides whether and when to update. + +You may translate the fixed local sentence. Never quote, summarize, or translate the remote manifest's summary. After the notice is visible, acknowledge its exact `eventKey` by running the same checker with `--ack ""`, then continue the user's original task. + +The notice is information, not permission. Keep the installed version unchanged. This workflow never downloads, installs, or executes an update, and silence is never consent. diff --git a/packages/diagram-core/vendor/archify/references/viewer-runtime.md b/packages/diagram-core/vendor/archify/references/viewer-runtime.md index 919b71b..afcd03d 100644 --- a/packages/diagram-core/vendor/archify/references/viewer-runtime.md +++ b/packages/diagram-core/vendor/archify/references/viewer-runtime.md @@ -5,7 +5,7 @@ Read this only when the user asks for a reader-facing capability. Ordinary gener ## Exploration - Diagram Guide lists current actions and shortcuts. -- Reading Depth starts at READ at the default 100% scale, reveals FULL detail at 175%, and falls back to MAP only below 100%. Focus, story, route, and semantic interactions reveal their exact facts at any scale. +- Reading Depth starts at READ at the default 100% scale, reveals FULL detail at 175%, and falls back to MAP only below 100%. Focus, route, and semantic interactions reveal their exact facts at any scale. - Semantic Lens summarizes selected node/relationship kinds without changing authored geometry. - Intent Trace previews a fine-pointer or keyboard target before committed focus. - Node Finder searches labels and stable IDs. @@ -14,23 +14,13 @@ Read this only when the user asks for a reader-facing capability. Ordinary gener - Direct Relationship Pin makes a unique compiled relationship operable while preserving the authored line and stable relationship identity. It must fail closed on conflicting source/target/label/ID metadata. - Route Probe resolves exactly two endpoints over authored directed relationships. It never infers a route from geometry. -## Guided views and story - -`meta.views` may define at most five curated chapters using stable node IDs. The Named Chapter Rail, Chapter Delta Preview, Story Beat Navigator, Story Follow Camera, Story Director Strip, Story Horizon, and Shareable Story Moment links all derive from that one authored array; none owns parallel topology or layout. - -Story transitions classify only the exact relationship between adjacent authored stops: forward, reverse, multiple, or grouped/no direct link. Never infer a transitive edge, verb, causality, or runtime behavior from proximity, kinds, or story order. Playback is reader-started, bounded, stale-safe, and motion-governed. - ## Motion and presentation `meta.animation: "trace"` enables a finite reader-controlled Live/Still trace. Static is the default. Still, reduced motion, page hiding, print, and canonical export preserve complete static meaning. Presentation Stage changes viewer chrome and framing, never authored geometry. This is not a mobile product feature; narrow layouts get containment only. ## Canonical exports -The export menu can copy/download full-diagram PNG, download JPEG/WebP, download a dual-theme SVG, and record a trace-enabled WebM. Viewer state—Guide, Lens, finder, focus, route, story, camera, radar, presentation, motion ownership, and temporary overlays—must be removed from canonical export. - -### Share Card - -The optional 1200×630 Share Card PNG is for README, release, social, or launch previews. It uses the current theme and visual preset, contains the complete canonical diagram without cropping, and never claims validation. Copy Share Card reuses the same canonical PNG when clipboard image writes are supported. +The export menu can copy/download full-diagram PNG, download JPEG/WebP, download a dual-theme SVG, and record a trace-enabled WebM. Viewer state—Guide, Lens, finder, focus, route, camera, radar, presentation, motion ownership, and temporary overlays—must be removed from canonical export. ### Route Share Card diff --git a/packages/diagram-core/vendor/archify/renderers/architecture/labels.mjs b/packages/diagram-core/vendor/archify/renderers/architecture/labels.mjs new file mode 100644 index 0000000..fa819d2 --- /dev/null +++ b/packages/diagram-core/vendor/archify/renderers/architecture/labels.mjs @@ -0,0 +1,215 @@ +import { normalizeRoutePoints, rectsOverlap, segmentRectClearanceWithin } from '../shared/geometry.mjs'; +import { createSpatialGrid } from '../shared/spatial-grid.mjs'; + +// A bounded fallback for an unpinned label whose usual position collides. +// It never routes an edge, moves a node, expands the canvas, or rewrites input. +export function placeAutomaticLabels({ + labels, routes, components, titles, viewBox, placementBottom = viewBox[1], fallbackRing = true, keepFallbackNearRoute = false, + gridSweep = false, +}) { + const placed = [...labels]; + const obstacles = [...components, ...titles]; + const segments = routes.flatMap(({ relationIndex, points }) => { + const normalized = normalizeRoutePoints(points); + return normalized.slice(1).map((end, index) => ({ relationIndex, start: normalized[index], end })); + }); + const inside = rect => ( + rect.x >= 0 && rect.y >= 0 + && rect.x + rect.width <= viewBox[0] && rect.y + rect.height <= viewBox[1] + ); + // The mask test asked every segment about every candidate position. Segments + // go into a uniform grid once, and a candidate only asks the cells it covers. + const SEGMENT_CELL = 120; + const segmentGrid = createSpatialGrid(SEGMENT_CELL); + for (const segment of segments) { + const [sx, sy] = segment.start; + const [ex, ey] = segment.end; + segmentGrid.insert({ + minX: Math.min(sx, ex), maxX: Math.max(sx, ex), + minY: Math.min(sy, ey), maxY: Math.max(sy, ey), + }, segment); + } + const segmentsNear = (rect, margin) => segmentGrid.query({ + minX: rect.x - margin, maxX: rect.x + rect.width + margin, + minY: rect.y - margin, maxY: rect.y + rect.height + margin, + }); + const masksRoute = rect => { + for (const segment of segmentsNear(rect, 4)) { + if (segment.relationIndex === rect.relationIndex) continue; + if (segmentRectClearanceWithin(segment, rect, 4) + 0.0001 < 4) return true; + } + return false; + }; + const overlapsLabel = (rect, index, gap = 0) => placed.some((other, otherIndex) => ( + otherIndex !== index && rectsOverlap(rect, other, gap) + )); + const clear = (rect, index) => ( + inside(rect) && rect.y + rect.height <= placementBottom + && !obstacles.some(obstacle => rectsOverlap(rect, obstacle, 2)) + && !overlapsLabel(rect, index, 2) && !masksRoute(rect) + ); + const rectAt = (label, lx, ly) => ({ + ...label, lx, ly, x: lx - label.width / 2, y: ly - 10, + }); + // An opted-in grid layout runs parallel lines through shared gaps. Rank + // every position along all of the label's own segments: beside the line + // first, then centred on its own line (the plate interrupts only that + // line), then stepping outward past neighbouring parallels. + const gridCandidates = (label) => { + const fractions = [0.5, 0.25, 0.75, 0.375, 0.625, 0.125, 0.875]; + const ranked = []; + // A close parallel of another relationship on one side (a reciprocal + // pair) makes a label on that side read as the neighbour's: prefer the + // far side. + const parallelOnLowSide = (a, b, axis) => { + const across = 1 - axis; + const [low, high] = [Math.min(a[axis], b[axis]), Math.max(a[axis], b[axis])]; + let nearest = null; + for (const other of segments) { + if (other.relationIndex === label.relationIndex) continue; + if (Math.abs(other.start[across] - other.end[across]) > 0.0001) continue; + const distance = other.start[across] - a[across]; + if (Math.abs(distance) < 0.0001 || Math.abs(distance) > 36) continue; + const overlap = Math.min(high, Math.max(other.start[axis], other.end[axis])) + - Math.max(low, Math.min(other.start[axis], other.end[axis])); + if (overlap <= 0) continue; + if (nearest === null || Math.abs(distance) < Math.abs(nearest)) nearest = distance; + } + return nearest !== null && nearest < 0; + }; + for (const { start: a, end: b } of segments.filter(segment => segment.relationIndex === label.relationIndex)) { + if (Math.abs(a[1] - b[1]) < 0.0001 && Math.abs(a[0] - b[0]) >= label.width + 16) { + const [above, below] = parallelOnLowSide(a, b, 0) ? [1, 0] : [0, 1]; + for (const fraction of fractions) { + const x = a[0] + (b[0] - a[0]) * fraction; + if (Math.min(Math.abs(x - a[0]), Math.abs(x - b[0])) < label.width / 2 + 6) continue; + ranked.push([above, x, a[1] - 10], [below, x, a[1] + 20], [2, x, a[1] + 3], [3, x, a[1] - 18], [3, x, a[1] + 28]); + } + } else if (Math.abs(a[0] - b[0]) < 0.0001 && Math.abs(a[1] - b[1]) >= label.height + 16) { + const leftFirst = !parallelOnLowSide(a, b, 1); + for (const fraction of fractions) { + const y = a[1] + (b[1] - a[1]) * fraction; + if (Math.min(Math.abs(y - a[1]), Math.abs(y - b[1])) < label.height / 2 + 6) continue; + ranked.push([2, a[0], y + 3]); + [6, 14, 22, 30, 38, 46, 54].forEach((offset, step) => { + const tier = step === 0 ? 0 : step === 1 ? 1 : 2 + step; + const left = [tier + (leftFirst ? 0 : 0.5), a[0] - label.width / 2 - offset, y + 3]; + const right = [tier + (leftFirst ? 0.5 : 0), a[0] + label.width / 2 + offset, y + 3]; + ranked.push(left, right); + }); + } + } + } + return ranked.map((entry, order) => [...entry, order]) + .sort((left, right) => left[0] - right[0] || left[3] - right[3]) + .map(([, lx, ly]) => [lx, ly]); + }; + + for (const [index, label] of placed.entries()) { + const relation = label.relation; + if (['labelAt', 'labelDx', 'labelDy', 'labelSegment'].some(key => relation[key] !== undefined)) continue; + // Match actual defect thresholds before searching; a valid placement is + // not a reason to restyle the diagram. New placements leave extra space. + // The grid ranking already starts from the preferred position, so it + // also re-ranks labels whose default spot is merely valid. + if (!gridSweep && inside(label) && !components.some(component => rectsOverlap(label, component, -2)) + && !titles.some(title => rectsOverlap(label, title)) + && !overlapsLabel(label, index) && !masksRoute(label)) continue; + if (gridSweep) { + // Callers measure the plate one pixel higher than rectAt; test with a + // pixel of slack so the chosen position also passes their clearance. + const replacement = gridCandidates(label).map(([lx, ly]) => rectAt(label, lx, ly)) + .find(rect => clear({ ...rect, x: rect.x - 1, y: rect.y - 1, width: rect.width + 2, height: rect.height + 2 }, index)); + if (replacement) { + placed[index] = replacement; + continue; + } + } + for (const segment of segments.filter(segment => segment.relationIndex === label.relationIndex)) { + const [a, b] = [segment.start, segment.end]; + let candidates = []; + if (Math.abs(a[1] - b[1]) < 0.0001 && Math.abs(a[0] - b[0]) >= label.width + 16) { + candidates = [0.5, 0.25, 0.75, 0.125, 0.875].flatMap(fraction => { + const x = a[0] + (b[0] - a[0]) * fraction; + if (Math.min(Math.abs(x - a[0]), Math.abs(x - b[0])) < 8) return []; + return [ + [x, a[1] - 10], + [x, a[1] + 20], + [x, a[1] - 18], + [x, a[1] + 28], + ]; + }); + } else if (Math.abs(a[0] - b[0]) < 0.0001 && Math.abs(a[1] - b[1]) >= label.height + 16) { + candidates = [0.5, 0.25, 0.75, 0.125, 0.875].flatMap(fraction => { + const y = a[1] + (b[1] - a[1]) * fraction; + if (Math.min(Math.abs(y - a[1]), Math.abs(y - b[1])) < 8) return []; + return [ + [a[0] - label.width / 2 - 6, y + 3], + [a[0] + label.width / 2 + 6, y + 3], + [a[0] - label.width / 2 - 14, y + 3], + [a[0] + label.width / 2 + 14, y + 3], + ]; + }); + } + const replacement = candidates.map(([lx, ly]) => rectAt(label, lx, ly)) + .find(rect => clear(rect, index)); + if (replacement) { + placed[index] = replacement; + break; + } + } + if (placed[index] !== label || !fallbackRing) continue; + + // Dense but valid topologies can leave every point directly beside the + // relationship occupied by another route. Search a small deterministic + // ring around the current anchor and the relationship's segment centres. + // A collision-free island above a node is not a readable edge label. + // Architecture opts into keeping the mask within two label heights of + // its own route; shared callers retain their existing policy. If no nearby + // slot fits, retain the collision so validation can request more space. + const ownSegments = segments.filter(segment => segment.relationIndex === label.relationIndex); + const baseAnchors = [ + [label.lx, label.ly], + ...ownSegments.map(segment => [ + (segment.start[0] + segment.end[0]) / 2, + (segment.start[1] + segment.end[1]) / 2, + ]), + ]; + const horizontalStep = label.width / 2 + 12; + const ringOffsets = [ + [0, -28], [0, 38], + [-horizontalStep, -28], [horizontalStep, -28], + [-horizontalStep, 38], [horizontalStep, 38], + [-(label.width + 20), -52], [label.width + 20, -52], + [-(label.width + 20), 62], [label.width + 20, 62], + [-(label.width + 20), -76], [label.width + 20, -76], + [-(label.width + 20), 86], [label.width + 20, 86], + ]; + const fallback = baseAnchors.flatMap(([baseX, baseY]) => ( + ringOffsets.map(([dx, dy]) => rectAt(label, baseX + dx, baseY + dy)) + )).find(rect => clear(rect, index) && (!keepFallbackNearRoute || ownSegments.some(segment => ( + segmentRectClearanceWithin(segment, rect, label.height * 2) <= label.height * 2 + )))); + if (fallback) placed[index] = fallback; + } + return placed; +} + +// The rect a single unpinned label would occupy given only its own route and +// the nodes: what the planner reserves before the remaining routes are laid. +// Only a placement beside the route itself is worth reserving; a label that +// would already need the fallback ring is left to the final placement pass. +export function reservedLabelRect({ + label, points, routes = [], labels = [], components, viewBox = [Infinity, Infinity], placementBottom = Infinity, +}) { + const [rect] = placeAutomaticLabels({ + labels: [{ ...label, relationIndex: -1 }, ...labels.map(other => ({ ...other, relationIndex: -2 }))], + routes: [{ relationIndex: -1, points }, ...routes], + components, + titles: [], + viewBox, + placementBottom, + fallbackRing: false, + }); + return components.some(component => rectsOverlap(rect, component, -2)) ? null : rect; +} diff --git a/packages/diagram-core/vendor/archify/renderers/architecture/render-architecture.mjs b/packages/diagram-core/vendor/archify/renderers/architecture/render-architecture.mjs index b21ac8e..0133350 100644 --- a/packages/diagram-core/vendor/archify/renderers/architecture/render-architecture.mjs +++ b/packages/diagram-core/vendor/archify/renderers/architecture/render-architecture.mjs @@ -3,43 +3,39 @@ import { fileURLToPath } from 'node:url'; import { esc, renderDefinitions, renderSemanticSigil, textUnits } from '../shared/utils.mjs'; import { animateAttr, focusEdgeAttrs, focusNodeAttrs, focusNodeTitle, loadDiagramWithBrandMarks, writeDiagram, svgAccessibleText, svgRootAttrs } from '../shared/cli.mjs'; import { componentBox, boundaryBox, connectionPath } from '../shared/layout-report.mjs'; -import { throwDiagnosticProblems } from '../shared/diagnostics.mjs'; +import { rendererFailure, throwDiagnosticProblems } from '../shared/diagnostics.mjs'; import { legendFootprint, relationshipLegendObstacles, resolveLegend, renderLegend as renderResolvedLegend } from '../shared/legend.mjs'; import { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth } from '../shared/text-fit.mjs'; import { brandLabelFitWidth, brandMetadataFor, brandTopRailProblem, renderBrandMark } from '../shared/brand-marks.mjs'; import { minimumReadableSourceTextPx } from '../shared/desktop-readability.mjs'; import { translateMessage as i18nText } from '../shared/i18n.mjs'; import { gridLayout, resolveComponentPos, validateGridPlacement } from './grid.mjs'; +import { createRouter } from './routing.mjs'; +import { placeAutomaticLabels, reservedLabelRect } from './labels.mjs'; +import { cleanRouteDetourProblems } from '../shared/route-quality.mjs'; import { asArray, isFinitePoint, rectsOverlap, - segmentIntersectsRect, cleanEndpointSideProblems, cleanFlowProblems, cleanCrossingProblems, cleanAmbiguousCorridorProblems, + collectArrowheadCollisions, cleanBorderRunProblems, cleanRouteRhythmProblems, cleanLabelRouteClearanceProblems, + cleanLabelCanvasContainmentProblems, suggestLabelObstacleFix, suggestComponentSeparation, - anchor, - automaticPortSpread, - automaticPortRhythmBridge, - defaultFromSide, - defaultToSide, - chosenSide, - routeHonorsEndpointSides, - normalizeRoutePoints, polylinePath, routePointsValue, - roundedPath, + authoredStraightRouteAttrs, labelPoint, componentFill, componentText, arrowClassMap, - variantAccent, + edgeLabelAccent, } from '../shared/geometry.mjs'; const componentTextFit = { @@ -111,10 +107,16 @@ for (const [index, c] of asArray(arch.components).entries()) { function boundaryRect(boundary) { const members = asArray(boundary.wraps).map((id) => components.get(id)).filter(Boolean); if (!members.length) return null; - const minX = Math.min(...members.map((m) => m.x)); - const minY = Math.min(...members.map((m) => m.y)); - const maxX = Math.max(...members.map((m) => m.x + m.width)); - const maxY = Math.max(...members.map((m) => m.y + m.height)); + let minX = Infinity; + let minY = Infinity; + let maxX = -Infinity; + let maxY = -Infinity; + for (const member of members) { + minX = Math.min(minX, member.x); + minY = Math.min(minY, member.y); + maxX = Math.max(maxX, member.x + member.width); + maxY = Math.max(maxY, member.y + member.height); + } const pad = boundary.pad ?? layout.boundaryPad; const topPad = Math.max( pad, @@ -148,17 +150,40 @@ const architectureLegendEntries = resolveLegend( new Set([...components.values()].map((component) => component.type)), ); -function autoViewBoxFor(candidateBoundaries) { - const maxX = Math.max( - 0, - ...[...components.values()].map((component) => component.x + component.width), - ...candidateBoundaries.map((boundary) => boundary.x + boundary.width), - ); - const maxY = Math.max( - 0, - ...[...components.values()].map((component) => component.y + component.height), - ...candidateBoundaries.map((boundary) => boundary.y + boundary.height), - ); +// One source for connection label geometry: the rect the containment rule +// measures is the rect the SVG mask draws, the auto canvas covers, the legend +// avoids, and the layout report publishes. +const resolvedLabelPoints = new Map(); +function connectionLabelBox(conn) { + if (!conn.label) return null; + return connectionLabelBoxAt(conn, resolvedLabelPoints.get(conn) || labelPoint(conn, pathFor(conn).points)); +} + +function connectionLabelBoxAt(conn, [lx, ly]) { + const width = Math.max(30, textUnits(conn.label) * 4.8 + 10); + return { x: lx - width / 2, y: ly - 10, width, height: 14, lx, ly }; +} + +function connectionLabelRects() { + const rects = []; + for (const [relationIndex, conn] of asArray(arch.connections).entries()) { + if (!components.has(conn.from) || !components.has(conn.to)) continue; + const box = connectionLabelBox(conn); + if (!box) continue; + rects.push({ relation: conn, relationIndex, label: conn.label, ...box }); + } + return rects; +} + +function autoViewBoxFor(candidateBoundaries, extraRects = []) { + let maxX = 0; + let maxY = 0; + for (const rects of [components.values(), candidateBoundaries, extraRects]) { + for (const rect of rects) { + maxX = Math.max(maxX, rect.x + rect.width); + maxY = Math.max(maxY, rect.y + rect.height); + } + } let width = Math.ceil(maxX + layout.margin); let footprint = legendFootprint(architectureLegendEntries, { width: Math.max(1, width - layout.margin * 2), @@ -179,7 +204,7 @@ function resolvedViewBoxWidth(candidateBoundaries) { if (Array.isArray(arch.meta?.viewBox) && Number.isFinite(arch.meta.viewBox[0])) { return arch.meta.viewBox[0]; } - return autoViewBoxFor(candidateBoundaries)[0]; + return autoViewBoxFor(candidateBoundaries, connectionGeometry)[0]; } function expandBoundaryForReadableTitle(boundary, minimumFontSize) { @@ -250,8 +275,9 @@ function layoutBoundaryTitles(rawBoundaries, minimumFontSize) { ...components.values(), ].filter((candidate) => horizontalOverlap(title, candidate) && rectsOverlap(title, candidate)); if (!blockers.length) break; - title.y = Math.min( - ...blockers.map((blocker) => blocker.y - layout.boundaryLabelRailGap - title.height), + title.y = blockers.reduce( + (min, blocker) => Math.min(min, blocker.y - layout.boundaryLabelRailGap - title.height), + Infinity, ); } placedTitles.push(title); @@ -276,7 +302,48 @@ function layoutBoundaryTitles(rawBoundaries, minimumFontSize) { }); } +// ---- Routing state ---------------------------------------------------------- +// Initialized before the boundary-title work below: connection label rects are +// part of the derived canvas, so the title convergence must measure the same +// width the diagram actually renders into (a title sized for a narrower canvas +// would fall below the desktop-readability floor once labels grow it). Routing +// reads components, connections and the member-derived boundary frames (so an +// automatic route never borrows a frame border as its corridor), never the +// title-expanded frames or the viewBox. const rawBoundaries = asArray(arch.boundaries).map(boundaryRect).filter(Boolean); +const { pathFor, connectionSides, connectionEndpointSide } = createRouter(components, arch.connections, { + distinctAutomaticPorts: true, + preferReadableRoutes: true, + frames: rawBoundaries.map((boundary) => ({ + ...boundary, + radius: boundary.kind === 'security-group' ? 8 : 12, + })), + labelRectFor: (conn, points, { routes, labels }) => (conn.label ? reservedLabelRect({ + label: { relation: conn, label: conn.label, ...connectionLabelBoxAt(conn, labelPoint(conn, points)) }, + points, + routes: routes.map((route, index) => ({ relationIndex: index, points: route })), + labels, + components: [...components.values()], + }) : null), +}); +function hasAutomaticRouteGeometry(connection) { + return !Array.isArray(connection?.via) + && (!connection?.route || connection.route === 'auto') + && connection?.channelX === undefined + && connection?.channelY === undefined; +} +// The auto canvas has to cover these rects; an authored viewBox is never +// resized to fit them — there the containment rule reports the clipping. +let connectionLabels = connectionLabelRects(); +// Unlabelled outer corridors are geometry too. Fitting only nodes and labels +// can clip a valid explicit via route while every browser overflow check passes. +const connectionGeometry = [ + ...connectionLabels, + ...asArray(arch.connections) + .filter((conn) => components.has(conn.from) && components.has(conn.to)) + .flatMap((conn) => pathFor(conn).points.map(([x, y]) => ({ x, y, width: 0, height: 0 }))), +]; + function resolveBoundaryTitles() { if (!enforcesBoundaryTitleComposition || rawBoundaries.length === 0) { return { @@ -330,12 +397,39 @@ function componentContext(component) { } // ---- Auto viewBox: fit all geometry + the measured resolved legend ---------- -const viewBox = arch.meta?.viewBox || autoViewBoxFor(boundaries); +// Connection labels are diagram content, so an auto canvas that stopped at the +// component/boundary bbox would clip them; the label rects join the fit here +// and in the title convergence above, which sizes fonts for this same width. +const viewBox = arch.meta?.viewBox || autoViewBoxFor(boundaries, connectionGeometry); const legendY = () => viewBox[1] - 16; +// Fit titles and canvas from the original geometry first. Fallback labels must +// fit inside that canvas, so moving a label cannot trigger title reflow or a +// canvas/label feedback loop. Keep standard and every authored label control. +if (arch.meta?.quality_profile === 'showcase') { + connectionLabels = placeAutomaticLabels({ + keepFallbackNearRoute: true, + labels: connectionLabels, + routes: asArray(arch.connections).flatMap((conn, relationIndex) => ( + components.has(conn.from) && components.has(conn.to) + ? [{ relationIndex, points: pathFor(conn).points }] : [] + )), + components: [...components.values()], + titles: boundaries.map(boundary => boundary.title), + viewBox, + // Leave the resolved legend band available; moving a label must not hide + // an otherwise visible legend. Existing labels keep their placement. + placementBottom: architectureLegendEntries.length + ? legendY() - 32 - legendFootprint(architectureLegendEntries, { width: viewBox[0] - layout.margin * 2 }).extraHeight + : viewBox[1], + }); + for (const rect of connectionLabels) resolvedLabelPoints.set(rect.relation, [rect.lx, rect.ly]); +} + // ---- Validation: mechanical correctness, never layout taste ----------------- function validateArchitecture() { const problems = []; + const diagnostics = []; if (resolvedBoundaryTitles.readabilityProblem) { problems.push(resolvedBoundaryTitles.readabilityProblem); } @@ -491,7 +585,36 @@ function validateArchitecture() { } for (const b of boundaries) { if (b.x < 0 || b.y < 0 || b.x + b.width > viewBox[0] || b.y + b.height > viewBox[1]) { - problems.push(`Boundary "${b.label}" extends outside the viewBox — its members sit too close to the canvas edge; add margin or enlarge meta.viewBox.`); + const overflow = { + left: Math.max(0, -b.x), + top: Math.max(0, -b.y), + right: Math.max(0, b.x + b.width - viewBox[0]), + bottom: Math.max(0, b.y + b.height - viewBox[1]), + }; + const sides = Object.entries(overflow).filter(([, pixels]) => pixels > 0) + .map(([side, pixels]) => `${side} by ${Math.ceil(pixels)}px`).join(', '); + const supportedFixes = []; + if (overflow.left || overflow.top) { + supportedFixes.push(`move the wrapped components right by at least ${Math.ceil(overflow.left)}px and down by at least ${Math.ceil(overflow.top)}px, then revalidate connected routes and the opposite canvas sides; enlarging meta.viewBox cannot fix left/top overflow`); + } + if (overflow.right || overflow.bottom) { + supportedFixes.push(`increase meta.viewBox to at least [${Math.ceil(Math.max(viewBox[0], b.x + b.width))}, ${Math.ceil(Math.max(viewBox[1], b.y + b.height))}] for right/bottom overflow, or move the wrapped components inward; revalidate desktop readability`); + } + const message = `Boundary "${b.label}" extends outside the viewBox (${sides}) — preserve wraps membership and repair the measured canvas side.`; + diagnostics.push({ + code: 'layout/boundary-out-of-bounds', + severity: 'error', + message, + subject: { diagramType: 'architecture', boundary: { kind: b.kind, label: b.label, wraps: b.wraps } }, + evidence: { + bounds: { x: b.x, y: b.y, width: b.width, height: b.height }, + viewBox: [...viewBox], + overflow, + members: asArray(b.wraps).map((id) => components.get(id)).filter(Boolean).map(componentBox), + }, + supportedFixes, + }); + problems.push(message); } } @@ -500,9 +623,33 @@ function validateArchitecture() { if (!components.has(conn.to)) problems.push(`Connection "${conn.label || conn.to}" references unknown target "${conn.to}".`); if (components.has(conn.from) && components.has(conn.to)) { const routed = pathFor(conn); + const outsidePoints = routed.points.filter(([x, y]) => x < 0 || y < 0 || x > viewBox[0] || y > viewBox[1]); + if (arch.meta?.quality_profile === 'showcase' && outsidePoints.length) { + const message = `Connection "${conn.id || `${conn.from}->${conn.to}`}" extends outside the viewBox — move the measured outside route points inward or enlarge an authored viewBox for right/bottom overflow.`; + diagnostics.push({ + code: 'layout/route-out-of-bounds', severity: 'error', message, + subject: { diagramType: 'architecture', collection: 'connections', index: asArray(arch.connections).indexOf(conn), ...(conn.id ? { id: conn.id } : {}), from: conn.from, to: conn.to }, + evidence: { viewBox: [...viewBox], outsidePoints, points: routed.points }, + supportedFixes: ['move negative route coordinates inside the canvas; for right/bottom overflow, enlarge meta.viewBox or reroute inward; preserve endpoints, direction and labels, then revalidate'], + }); + problems.push(message); + } const [start, end] = [routed.points[0], routed.points[routed.points.length - 1]]; const distance = Math.hypot(end[0] - start[0], end[1] - start[1]); - if (distance < 24) problems.push(`Connection "${conn.label || `${conn.from}->${conn.to}`}" is too short (${Math.round(distance)}px; minimum 24px) — place its components farther apart.`); + if (distance < 24 && conn.from === conn.to) { + // "Move the components apart" cannot be executed for a self-loop; the + // ports sit on one component and the sides decide how far apart. + const message = `Self-loop "${conn.id || conn.label || conn.from}" on component "${conn.from}" has its two ports only ${Math.round(distance)}px apart (minimum 24px) — remove fromSide/toSide so the renderer can choose the loop's sides, or set fromSide and toSide to different sides.`; + diagnostics.push({ + code: 'layout/self-loop-ports', severity: 'error', message, + subject: { diagramType: 'architecture', collection: 'connections', index: asArray(arch.connections).indexOf(conn), ...(conn.id ? { id: conn.id } : {}), from: conn.from, to: conn.to }, + evidence: { distancePx: Math.round(distance), minimumPx: 24, fromSide: connectionEndpointSide(conn, 'source'), toSide: connectionEndpointSide(conn, 'target'), points: routed.points }, + supportedFixes: ['remove fromSide/toSide from the self-loop', 'set fromSide and toSide to different sides of the component'], + }); + problems.push(message); + } else if (distance < 24) { + problems.push(`Connection "${conn.label || `${conn.from}->${conn.to}`}" is too short (${Math.round(distance)}px; minimum 24px) — place its components farther apart.`); + } } } @@ -532,6 +679,12 @@ function validateArchitecture() { diagramType: 'architecture', relationCollection: 'connections', profile: arch.meta?.quality_profile, + // Automatic architecture routes render with an opaque crossover halo. + // That makes a proper X visually unambiguous while explicit authored + // crossings remain a blocking composition error. + crossingResolved: (left, right) => ( + hasAutomaticRouteGeometry(left) && hasAutomaticRouteGeometry(right) + ), routeHint: 'adjust route/via or fromSide/toSide so the connections use separate corridors' })); problems.push(...cleanAmbiguousCorridorProblems({ @@ -541,8 +694,29 @@ function validateArchitecture() { diagramType: 'architecture', relationCollection: 'connections', profile: arch.meta?.quality_profile, - routeHint: 'adjust route/via or fromSide/toSide so unrelated connections do not visually merge' + includeSharedEndpoints: (left, right) => hasAutomaticRouteGeometry(left) && !left.labelAt + && hasAutomaticRouteGeometry(right) && !right.labelAt, + routeHint: 'adjust route/via or fromSide/toSide so distinct connections do not visually merge' })); + if ((process.env.ARCHIFY_QUALITY_PROFILE || arch.meta?.quality_profile) === 'showcase') { + const collisions = collectArrowheadCollisions({ + routedRelations: asArray(arch.connections) + .filter((conn) => components.has(conn.from) && components.has(conn.to) && hasAutomaticRouteGeometry(conn) && !conn.labelAt) + .map((relation) => ({ relation, points: pathFor(relation).points })), + }); + for (const hit of collisions) { + const left = hit.left.relation; + const right = hit.right.relation; + const message = `[composition/arrowhead-collision] automatic connections "${left.id || left.from}" and "${right.id || right.from}" into "${left.to}" have arrowheads ${hit.distance}px apart (minimum ${hit.minimum}px) — enlarge or reposition the destination, or choose separate toSide ports.`; + problems.push(message); + diagnostics.push({ + code: 'composition/arrowhead-collision', severity: 'error', message, + subject: { diagramType: 'architecture', collection: 'connections', id: left.id, from: left.from, to: left.to }, + evidence: { otherId: right.id, distancePx: hit.distance, minimumPx: hit.minimum, endpoints: [hit.left.tip, hit.right.tip] }, + supportedFixes: ['enlarge or reposition the destination', 'choose separate toSide ports'], + }); + } + } problems.push(...cleanBorderRunProblems({ relations: arch.connections, endpointIds: new Set(components.keys()), @@ -562,19 +736,41 @@ function validateArchitecture() { profile: arch.meta?.quality_profile, routeHint: 'move route/via points into a wider corridor or move the component so every turn has room to read' })); + problems.push(...cleanRouteDetourProblems({ + relations: arch.connections, + obstacles: components.values(), + contentRects: [...components.values(), ...boundaries], + endpointIds: new Set(components.keys()), + pathFor, + fromSideFor: (conn) => connectionEndpointSide(conn, 'source'), + toSideFor: (conn) => connectionEndpointSide(conn, 'target'), + diagramType: 'architecture', + relationCollection: 'connections', + profile: arch.meta?.quality_profile, + })); // Connection labels must not land on top of components. - const labelRects = []; - for (const [connectionIndex, conn] of asArray(arch.connections).entries()) { - if (!conn.label || !components.has(conn.from) || !components.has(conn.to)) continue; - const [lx, ly] = labelPoint(conn, pathFor(conn).points); - const w = Math.max(30, textUnits(conn.label) * 4.8 + 10); - labelRects.push({ relation: conn, relationIndex: connectionIndex, label: conn.label, x: lx - w / 2, y: ly - 10, width: w, height: 14, lx, ly }); - } + const labelRects = connectionLabels; for (const rect of labelRects) { - for (const c of components.values()) { - if (rectsOverlap(rect, c, -2)) { - problems.push(`Label "${rect.label}" overlaps component "${c.id}" — adjust labelDx/labelDy/labelSegment or set labelAt.\n${suggestLabelObstacleFix(rect, rect.lx, rect.ly, c)}`); + const blockedComponents = [...components.values()].filter(c => rectsOverlap(rect, c, -2)); + const labelPinned = ['labelAt', 'labelDx', 'labelDy', 'labelSegment'].some(key => rect.relation[key] !== undefined); + const points = pathFor(rect.relation).points; + const shortHorizontalGap = points.length === 2 && Math.abs(points[0][1] - points[1][1]) < 0.0001 + ? Math.abs(points[1][0] - points[0][0]) : null; + const requiredGap = Math.ceil(rect.width + 16); + if (arch.meta?.quality_profile === 'showcase' && !labelPinned && blockedComponents.length + && shortHorizontalGap != null && shortHorizontalGap < requiredGap) { + const message = `Label "${rect.label}" has only ${Math.round(shortHorizontalGap)}px between "${rect.relation.from}" and "${rect.relation.to}"; it needs at least ${requiredGap}px to stay beside its route — increase that clear gap or place the connected nodes on another readable row, preserving the label.`; + problems.push(message); + diagnostics.push({ + code: 'composition/label-gap', severity: 'error', message, + subject: { diagramType: 'architecture', collection: 'connections', id: rect.relation.id, from: rect.relation.from, to: rect.relation.to }, + evidence: { clearGapPx: shortHorizontalGap, minimumGapPx: requiredGap, labelWidthPx: rect.width, obstacles: blockedComponents.map(c => c.id) }, + supportedFixes: [`increase the clear gap between the connected nodes to at least ${requiredGap}px`, 'reposition the connected nodes together while preserving the full relationship label'], + }); + } else { + for (const c of blockedComponents) { + problems.push(`Label "${rect.label}" overlaps component "${c.id}" — adjust labelDx/labelDy/labelSegment or set labelAt.\n${suggestLabelObstacleFix(rect, rect.lx, rect.ly, c, 'component', viewBox, components.values())}`); } } if (enforcesBoundaryTitleComposition) { @@ -595,29 +791,34 @@ function validateArchitecture() { relationCollection: 'connections', profile: arch.meta?.quality_profile, })); + // See collectLabelCanvasOverflow in shared/geometry.mjs. An auto canvas now + // covers these rects, so this reports authored viewBoxes and the origin side, + // which growth cannot reach. + problems.push(...cleanLabelCanvasContainmentProblems({ + labels: labelRects, + viewBox, + diagramType: 'architecture', + relationCollection: 'connections', + profile: arch.meta?.quality_profile, + })); if (problems.length) { throwDiagnosticProblems('Architecture layout validation failed', problems, { subject: { diagramType: 'architecture' }, + diagnostics, }); } } function buildLayoutReport() { - const labels = []; - for (const conn of asArray(arch.connections)) { - if (!conn.label || !components.has(conn.from) || !components.has(conn.to)) continue; - const [lx, ly] = labelPoint(conn, pathFor(conn).points); - const w = Math.max(30, textUnits(conn.label) * 4.8 + 10); - labels.push({ - text: conn.label, - x: Math.round(lx - w / 2), - y: Math.round(ly - 10), - width: Math.round(w), - height: 14, - labelAt: [Math.round(lx), Math.round(ly)], - }); - } + const labels = connectionLabels.map((rect) => ({ + text: rect.label, + x: Math.round(rect.x), + y: Math.round(rect.y), + width: Math.round(rect.width), + height: 14, + labelAt: [Math.round(rect.lx), Math.round(rect.ly)], + })); return { ok: true, diagram_type: 'architecture', @@ -629,323 +830,13 @@ function buildLayoutReport() { .filter((conn) => components.has(conn.from) && components.has(conn.to)) .map((conn) => { const routed = pathFor(conn); - const labelAt = conn.label ? labelPoint(conn, routed.points) : null; + const labelAt = conn.label ? resolvedLabelPoints.get(conn) || labelPoint(conn, routed.points) : null; return connectionPath(conn, routed, labelAt); }), labels, }; } -// ---- Connection routing ------------------------------------------------------ -function routeClearsComponents(conn, points, clearance = 2) { - const endpointIds = new Set([conn.from, conn.to]); - for (const component of components.values()) { - if (endpointIds.has(component.id)) continue; - for (let index = 0; index < points.length - 1; index += 1) { - if (segmentIntersectsRect({ start: points[index], end: points[index + 1] }, component, clearance)) { - return false; - } - } - } - return true; -} - -function routeClearsEndpointComponents(points, from, to) { - const lastSegment = points.length - 2; - for (let index = 0; index <= lastSegment; index += 1) { - const segment = { start: points[index], end: points[index + 1] }; - if (index > 0 && segmentIntersectsRect(segment, from)) return false; - if (index < lastSegment && segmentIntersectsRect(segment, to)) return false; - } - return true; -} - -const OUTWARD_SIDE_VECTOR = { - left: [-1, 0], - right: [1, 0], - top: [0, -1], - bottom: [0, 1], -}; - -function outwardStub(point, side, distance = 24) { - const [dx, dy] = OUTWARD_SIDE_VECTOR[side] || [0, 0]; - return [point[0] + dx * distance, point[1] + dy * distance]; -} - -function collinearBacktrack(a, b, c) { - const first = [b[0] - a[0], b[1] - a[1]]; - const second = [c[0] - b[0], c[1] - b[1]]; - const cross = first[0] * second[1] - first[1] * second[0]; - const dot = first[0] * second[0] + first[1] * second[1]; - return Math.abs(cross) <= 0.0001 && dot < -0.0001; -} - -function sideAwareBridgeCandidates(start, end, fromSide, toSide) { - const startStub = outwardStub(start, fromSide); - const endStub = outwardStub(end, toSide); - const rawCandidates = []; - const minimumBridge = 16; - const verticalSides = new Set(['top', 'bottom']); - const horizontalSides = new Set(['left', 'right']); - - // Port spreading can leave parallel-side anchors only a few pixels apart. - // Route through a bounded outside channel so we keep both endpoint normals - // without introducing a tiny, noisy connector between the two stubs. - if (verticalSides.has(fromSide) && verticalSides.has(toSide) - && Math.abs(start[0] - end[0]) < minimumBridge) { - for (const channelX of [ - Math.max(start[0], end[0]) + minimumBridge, - Math.min(start[0], end[0]) - minimumBridge, - ]) { - rawCandidates.push([ - startStub, - [channelX, startStub[1]], - [channelX, endStub[1]], - endStub, - ]); - } - } - if (horizontalSides.has(fromSide) && horizontalSides.has(toSide) - && Math.abs(start[1] - end[1]) < minimumBridge) { - for (const channelY of [ - Math.max(start[1], end[1]) + minimumBridge, - Math.min(start[1], end[1]) - minimumBridge, - ]) { - rawCandidates.push([ - startStub, - [startStub[0], channelY], - [endStub[0], channelY], - endStub, - ]); - } - } - - rawCandidates.push( - [startStub, [endStub[0], startStub[1]], endStub], - [startStub, [startStub[0], endStub[1]], endStub], - ); - return rawCandidates.map((candidate) => normalizeRoutePoints([start, ...candidate, end])) - .filter((points) => points.length >= 2) - .filter((points) => !collinearBacktrack(points[0], points[1], points[2] || points[1])) - .filter((points) => !collinearBacktrack(points.at(-3) || points.at(-2), points.at(-2), points.at(-1))) - .filter((points) => routeHonorsEndpointSides(points, fromSide, toSide)) - .map((points) => points.slice(1, -1)); -} - -const AUTOMATIC_PORT_CORNER_GUTTER = 16; -const AUTOMATIC_PORT_ALIGNMENT_DELTA = 16; - -function portHasCornerClearance(rect, side, point) { - if (side === 'left' || side === 'right') { - const inset = Math.min(AUTOMATIC_PORT_CORNER_GUTTER, rect.height / 2); - return point[1] >= rect.y + inset && point[1] <= rect.y + rect.height - inset; - } - if (side === 'top' || side === 'bottom') { - const inset = Math.min(AUTOMATIC_PORT_CORNER_GUTTER, rect.width / 2); - return point[0] >= rect.x + inset && point[0] <= rect.x + rect.width - inset; - } - return false; -} - -function alignFacingPorts(conn, from, to, start, end, fromSide, toSide, ports) { - const hasExplicitGeometry = ( - conn.via - || (conn.route && conn.route !== 'auto') - || conn.channelX !== undefined - || conn.channelY !== undefined - || conn.labelAt - ); - const horizontallyFacing = ( - (fromSide === 'right' && toSide === 'left') - || (fromSide === 'left' && toSide === 'right') - ); - const verticallyFacing = ( - (fromSide === 'bottom' && toSide === 'top') - || (fromSide === 'top' && toSide === 'bottom') - ); - if (hasExplicitGeometry || (!horizontallyFacing && !verticallyFacing)) return { start, end }; - - const fromSpread = Boolean(ports?.from); - const toSpread = Boolean(ports?.to); - if (fromSpread && toSpread) return { start, end }; - const hasExplicitSides = ( - (conn.fromSide && conn.fromSide !== 'auto') - || (conn.toSide && conn.toSide !== 'auto') - ); - if (!fromSpread && !toSpread && hasExplicitSides) return { start, end }; - - const alignmentDelta = horizontallyFacing - ? Math.abs(start[1] - end[1]) - : Math.abs(start[0] - end[0]); - if (alignmentDelta >= AUTOMATIC_PORT_ALIGNMENT_DELTA) return { start, end }; - - // Keep the shared endpoint's distinct spread slot and move only the - // relationship's unshared endpoint onto that axis. With no spread endpoint, - // retain the existing least-movement choice between the two facing sides. - // If both endpoints are shared, preserve the outside bridge so no competing - // port is silently collapsed. - const alignEndToStart = horizontallyFacing - ? { start, end: [end[0], start[1]] } - : { start, end: [start[0], end[1]] }; - const alignStartToEnd = horizontallyFacing - ? { start: [start[0], end[1]], end } - : { start: [end[0], start[1]], end }; - const candidates = fromSpread - ? [alignEndToStart] - : toSpread - ? [alignStartToEnd] - : [alignEndToStart, alignStartToEnd]; - for (const candidate of candidates) { - const points = [candidate.start, candidate.end]; - if (portHasCornerClearance(from, fromSide, candidate.start) - && portHasCornerClearance(to, toSide, candidate.end) - && routeHonorsEndpointSides(points, fromSide, toSide) - && routeClearsEndpointComponents(points, from, to) - && routeClearsComponents(conn, points)) { - return candidate; - } - } - return { start, end }; -} - -function routeVia(conn, from, to, start, end, fromSide, toSide) { - if (conn.via) return conn.via; - switch (conn.route || 'auto') { - case 'straight': - return []; - case 'orthogonal-h': { - const midX = (start[0] + end[0]) / 2; - return [[midX, start[1]], [midX, end[1]]]; - } - case 'orthogonal-v': { - const midY = (start[1] + end[1]) / 2; - return [[start[0], midY], [end[0], midY]]; - } - case 'auto': - default: { - // Direct line unless the anchors are clearly orthogonal-friendly. - const deltaX = Math.abs(start[0] - end[0]); - const deltaY = Math.abs(start[1] - end[1]); - if ((deltaX < 4 || deltaY < 4) && routeHonorsEndpointSides([start, end], fromSide, toSide)) return []; - - const rhythmBridge = automaticPortRhythmBridge(start, end, fromSide, toSide, { - accept: (points) => ( - routeClearsEndpointComponents(points, from, to) - && routeClearsComponents(conn, points) - ), - }); - if (rhythmBridge) return rhythmBridge.slice(1, -1); - - // Automatic port spreading can leave otherwise aligned endpoints only a - // few pixels apart. A midpoint route would split that tiny difference - // into two unreadable endpoint stubs, so take a bounded outside channel - // when both anchors sit on parallel component sides. - const minimumStub = 8; - const fromVerticalSide = start[1] === from.y || start[1] === from.y + from.height; - const toVerticalSide = end[1] === to.y || end[1] === to.y + to.height; - if (fromVerticalSide && toVerticalSide && deltaX < minimumStub * 2) { - const outsideChannels = [ - Math.max(start[0], end[0]) + minimumStub * 2, - Math.min(start[0], end[0]) - minimumStub * 2, - ]; - for (const channelX of outsideChannels) { - const candidate = [[channelX, start[1]], [channelX, end[1]]]; - const points = [start, ...candidate, end]; - if (routeHonorsEndpointSides(points, fromSide, toSide) && routeClearsComponents(conn, points)) return candidate; - } - } - - const fromHorizontalSide = start[0] === from.x || start[0] === from.x + from.width; - const toHorizontalSide = end[0] === to.x || end[0] === to.x + to.width; - if (fromHorizontalSide && toHorizontalSide && deltaY < minimumStub * 2) { - const outsideChannels = [ - Math.max(start[1], end[1]) + minimumStub * 2, - Math.min(start[1], end[1]) - minimumStub * 2, - ]; - for (const channelY of outsideChannels) { - const candidate = [[start[0], channelY], [end[0], channelY]]; - const points = [start, ...candidate, end]; - if (routeHonorsEndpointSides(points, fromSide, toSide) && routeClearsComponents(conn, points)) return candidate; - } - } - - const midX = (start[0] + end[0]) / 2; - const horizontalFirst = [[midX, start[1]], [midX, end[1]]]; - const midY = (start[1] + end[1]) / 2; - const verticalFirst = [[start[0], midY], [end[0], midY]]; - const candidates = [horizontalFirst, verticalFirst]; - const sideSafe = candidates.filter((candidate) => ( - routeHonorsEndpointSides([start, ...candidate, end], fromSide, toSide) - )); - const sideAware = sideAwareBridgeCandidates(start, end, fromSide, toSide); - const nearParallelPorts = ( - ((fromSide === 'top' || fromSide === 'bottom') - && (toSide === 'top' || toSide === 'bottom') - && deltaX < minimumStub * 2) - || ((fromSide === 'left' || fromSide === 'right') - && (toSide === 'left' || toSide === 'right') - && deltaY < minimumStub * 2) - ); - const ordered = [ - ...(nearParallelPorts ? sideAware : sideSafe), - ...(nearParallelPorts ? sideSafe : sideAware), - ...candidates.filter((candidate) => !sideSafe.includes(candidate)), - ]; - for (const candidate of ordered) { - const points = [start, ...candidate, end]; - if (routeClearsEndpointComponents(points, from, to) && routeClearsComponents(conn, points)) return candidate; - } - - // Both bounded doglegs are blocked. Keep the best endpoint-safe route - // when one exists so the universal Clean Flow gate reports the actual - // obstacle; otherwise preserve the historical deterministic fallback - // and let the endpoint-direction gate explain the side mismatch. - return sideSafe[0] || sideAware[0] || horizontalFirst; - } - } -} - -const pathCache = new Map(); -const automaticPorts = automaticPortSpread(arch.connections, components); -function connectionSides(conn) { - const from = components.get(conn.from); - const to = components.get(conn.to); - return { - fromSide: chosenSide(conn.fromSide, defaultFromSide(from, to)), - toSide: chosenSide(conn.toSide, defaultToSide(from, to)), - }; -} - -function connectionEndpointSide(conn, endpoint) { - const field = endpoint === 'source' ? 'fromSide' : 'toSide'; - if (conn[field] && conn[field] !== 'auto') return conn[field]; - return connectionSides(conn)[field]; -} - -function pathFor(conn) { - if (pathCache.has(conn)) return pathCache.get(conn); - const from = components.get(conn.from); - const to = components.get(conn.to); - const ports = automaticPorts.get(conn); - const { fromSide, toSide } = connectionSides(conn); - const baseStart = ports?.from || anchor(from, fromSide); - const baseEnd = ports?.to || anchor(to, toSide); - const { start, end } = alignFacingPorts( - conn, - from, - to, - baseStart, - baseEnd, - fromSide, - toSide, - ports, - ); - const points = [start, ...routeVia(conn, from, to, start, end, fromSide, toSide), end]; - const routed = { d: roundedPath(points, 8), points }; - pathCache.set(conn, routed); - return routed; -} - // ---- Rendering --------------------------------------------------------------- function renderBoundaryFrame(b, index) { const cls = b.kind === 'security-group' ? 'c-security-group' : 'c-region'; @@ -965,16 +856,25 @@ function renderConnectionPath(conn, index) { const [cls, marker] = arrowClassMap[conn.variant || 'default'] || arrowClassMap.default; const routed = pathFor(conn); const strokeWidth = conn.width || (conn.variant === 'emphasis' ? 1.8 : 1.5); - return ` `; + const automaticRoute = hasAutomaticRouteGeometry(conn); + const underlay = automaticRoute + ? ` \n` + : ''; + const crossover = automaticRoute + ? ` data-composition-crossover="halo"${conn.labelAt ? '' : ' data-composition-independent="true"'}` : ''; + const edge = ` `; + if (!automaticRoute) return edge; + // The wrapper is presentation-only: viewer state remains on the one semantic + // edge, while CSS can keep its preceding mask underlay at the same opacity. + return ` \n${underlay}${edge.replace(/^ /, ' ')}\n `; } function renderConnectionLabel(conn, index) { - if (!conn.label) return ''; - const [lx, ly] = labelPoint(conn, pathFor(conn).points); - const w = Math.max(30, textUnits(conn.label) * 4.8 + 10); + const box = connectionLabelBox(conn); + if (!box) return ''; return ` - - ${esc(conn.label)} + + ${esc(conn.label)} `; } @@ -997,7 +897,7 @@ function renderComponent(c) { ${focusNodeTitle(c.label, passport)} - ${renderSemanticSigil(c.type, { x: c.x + 6, y: c.y + 6 })}${brand ? `\n ${brand}` : ''} + ${renderSemanticSigil(c.type, { icon: c.icon, x: c.x + 6, y: c.y + 6 })}${brand ? `\n ${brand}` : ''} ${esc(c.label)}${sub}${tag} `; } @@ -1006,18 +906,15 @@ function renderLegend() { const entries = architectureLegendEntries; const relationshipObstacles = relationshipLegendObstacles(arch.connections, { pointsFor: (connection) => pathFor(connection).points, - labelRectFor: (connection) => { - if (!connection.label) return null; - const [x, y] = labelPoint(connection, pathFor(connection).points); - const width = Math.max(30, textUnits(connection.label) * 4.8 + 10); - return { x: x - width / 2, y: y - 10, width, height: 14 }; - }, + labelRectFor: connectionLabelBox, }); - const contentBottom = Math.max( - 0, - ...[...components.values()].map((component) => component.y + component.height), - ...boundaries.map((boundary) => boundary.y + boundary.height), - ); + let contentBottom = 0; + for (const component of components.values()) { + contentBottom = Math.max(contentBottom, component.y + component.height); + } + for (const boundary of boundaries) { + contentBottom = Math.max(contentBottom, boundary.y + boundary.height); + } return renderResolvedLegend({ entries, locale: arch.meta.locale, @@ -1035,7 +932,20 @@ function renderLegend() { } function renderSvg() { - return ` + // An automatic architecture canvas is compiler-measured geometry. Let the + // Reader spend the real desktop height budget on it, including when an + // outer route makes the canvas taller than the ordinary wide-diagram + // threshold. Authored viewBoxes keep their geometry and existing Reader width policy; + // their declared height may use readable document scrolling without reflow. + const readerFit = arch.meta?.viewBox + ? ' data-diagram-type="architecture" data-reader-fit="authored-height"' + : ' data-reader-fit="intrinsic-height"'; + // A complete repository architecture is allowed to use normal page scroll; + // keep its common-desktop text at a comfortable reading size instead of + // shrinking a semantically rich graph to the universal emergency floor. + const readerMinimumText = arch.meta?.viewBox ? '' : ' data-reader-min-text="7.5"'; + const readerPrimaryText = arch.meta?.viewBox ? '' : ' data-reader-primary-text="14"'; + return ` ${svgAccessibleText(arch.meta, 'architecture')} ${renderDefinitions()} @@ -1062,17 +972,30 @@ ${renderLegend()} `; } -validateArchitecture(); if (layoutJsonMode) { - console.log(JSON.stringify(buildLayoutReport(), null, 2)); - process.exit(0); + try { + validateArchitecture(); + } catch (error) { + // A rejected layout is still useful repair evidence. Input/implementation + // failures must retain their existing failure boundary, not partial geometry. + if (!error.archifyDiagnostics?.length) throw error; + console.log(JSON.stringify({ + ...buildLayoutReport(), + ...rendererFailure(error), + contract: 'archify-architecture-layout-v1', + }, null, 2)); + process.exitCode = 1; + } + if (!process.exitCode) console.log(JSON.stringify(buildLayoutReport(), null, 2)); +} else { + validateArchitecture(); + writeDiagram({ + outPath, + template, + diagramType: 'architecture', + meta: arch.meta, + svg: renderSvg(), + cards: arch.cards, + sourceEvidence, + }); } -writeDiagram({ - outPath, - template, - diagramType: 'architecture', - meta: arch.meta, - svg: renderSvg(), - cards: arch.cards, - sourceEvidence, -}); diff --git a/packages/diagram-core/vendor/archify/renderers/architecture/routing.mjs b/packages/diagram-core/vendor/archify/renderers/architecture/routing.mjs new file mode 100644 index 0000000..f2de287 --- /dev/null +++ b/packages/diagram-core/vendor/archify/renderers/architecture/routing.mjs @@ -0,0 +1,1157 @@ +// Internal architecture router shared by rendering and geometry inspection. +// Create a new router when measured boxes or connections change: port spreading +// is computed once and route results are cached for this scene. + +import { + segmentIntersectsRect, + anchor, + automaticPortSpread, + automaticPortRhythmBridge, + defaultFromSide, + defaultToSide, + chosenSide, + properSegmentIntersection, + routeHonorsEndpointSides, + normalizeRoutePoints, + rectsOverlap, + roundedPath, + collectBorderRuns, + collectRouteRhythmIssues, + frameBorderSegments, +} from '../shared/geometry.mjs'; +import { shortestOrthogonalGridRoute } from '../shared/route-quality.mjs'; + +/** + * Router bound to one set of measured component boxes. + * + * @param {Map} components measured boxes by id + * @param {Array} connections the connection list to spread ports across + * @param {object} [options] + * @param {Array<{x,y,width,height,radius?}>} [options.frames] structural frames + * (boundaries) whose borders an automatic route may cross but never follow + * @param {number} [options.interiorSegmentPx] showcase floor for interior segments + * @param {number} [options.microSegmentPx] floor for any segment + * @param {(conn: object, points: number[][], context: {routes: number[][][], labels: object[]}) => object|null} [options.labelRectFor] + * default label rect of a routed relationship given the routes and label + * rects resolved so far; later automatic routes keep clear of it so a dense + * fan-out does not leave the label nowhere to go + */ +export function createRouter(components, connections = [], { + frames = [], + interiorSegmentPx = 16, + microSegmentPx = 8, + labelRectFor = null, + distinctAutomaticPorts = false, + preferReadableRoutes = false, +} = {}) { + const frameBorders = frames.flatMap((frame) => frameBorderSegments(frame)); + const LABEL_CLEARANCE = 4; + // Labels of already-routed relationships, reserved while planning the rest. + let reservedLabels = []; + let honourReservedLabels = true; + let allowGridSearch = true; + + function routeClearsReservedLabels(conn, points) { + if (!honourReservedLabels) return true; + for (const entry of reservedLabels) { + if (entry.conn === conn) continue; + for (let index = 0; index < points.length - 1; index += 1) { + if (segmentIntersectsRect({ start: points[index], end: points[index + 1] }, entry.rect, LABEL_CLEARANCE)) { + return false; + } + } + } + return true; + } + + // The grid search adds its own 2px component clearance; pre-expand so a + // reserved label keeps the same 4px clearance the placement pass demands. + function reservedLabelObstacles(gridClearance) { + if (!honourReservedLabels) return []; + const grow = LABEL_CLEARANCE - gridClearance; + return reservedLabels.map(({ rect }) => ({ + x: rect.x - grow, + y: rect.y - grow, + width: rect.width + grow * 2, + height: rect.height + grow * 2, + })); + } + + // Automatic routes are held to the same composition floors the showcase + // gate enforces afterwards. Accepting a route here that the gate rejects + // only hands the author a hand-routing repair the planner could have made. + function routeMeetsCompositionFloors(points) { + if (collectRouteRhythmIssues({ routedRelations: [{ points }], interiorSegmentPx, microSegmentPx }).length) { + return false; + } + return !frames.length || collectBorderRuns({ routedRelations: [{ points }], frames }).length === 0; + } + const planningMetrics = { + routeCount: 0, + explicitRouteCount: 0, + automaticRouteCount: 0, + gridSearchCount: 0, + gridRoutedCount: 0, + gridCandidateNodeCount: 0, + gridUsableNodeCount: 0, + gridEdgeCount: 0, + gridVisitedNodeCount: 0, + avoidedSegmentCount: 0, + conflictFallbackCount: 0, + maximumGridSearchCount: 64, + gridBudgetExhaustedCount: 0, + crossoverRoutedCount: 0, + readabilityCandidateCount: 0, + readabilityImprovedCount: 0, + reciprocalCandidateCount: 0, + reciprocalImprovedCount: 0, + gridAttempts: [], + }; + + // ---- Connection routing ------------------------------------------------------ + function routeClearsComponents(conn, points, clearance = 2) { + const endpointIds = new Set([conn.from, conn.to]); + for (const component of components.values()) { + if (endpointIds.has(component.id)) continue; + for (let index = 0; index < points.length - 1; index += 1) { + if (segmentIntersectsRect({ start: points[index], end: points[index + 1] }, component, clearance)) { + return false; + } + } + } + return routeClearsReservedLabels(conn, points); + } + + function routeClearsEndpointComponents(points, from, to) { + const lastSegment = points.length - 2; + for (let index = 0; index <= lastSegment; index += 1) { + const segment = { start: points[index], end: points[index + 1] }; + if (index > 0 && segmentIntersectsRect(segment, from)) return false; + if (index < lastSegment && segmentIntersectsRect(segment, to)) return false; + } + return true; + } + + function relationshipsShareEndpoint(left, right) { + return left.from === right.from + || left.from === right.to + || left.to === right.from + || left.to === right.to; + } + + function collinearOverlapLength(leftStart, leftEnd, rightStart, rightEnd) { + const epsilon = 0.0001; + if (Math.abs(leftStart[0] - leftEnd[0]) <= epsilon + && Math.abs(rightStart[0] - rightEnd[0]) <= epsilon + && Math.abs(leftStart[0] - rightStart[0]) <= epsilon) { + return Math.max(0, + Math.min(Math.max(leftStart[1], leftEnd[1]), Math.max(rightStart[1], rightEnd[1])) + - Math.max(Math.min(leftStart[1], leftEnd[1]), Math.min(rightStart[1], rightEnd[1]))); + } + if (Math.abs(leftStart[1] - leftEnd[1]) <= epsilon + && Math.abs(rightStart[1] - rightEnd[1]) <= epsilon + && Math.abs(leftStart[1] - rightStart[1]) <= epsilon) { + return Math.max(0, + Math.min(Math.max(leftStart[0], leftEnd[0]), Math.max(rightStart[0], rightEnd[0])) + - Math.max(Math.min(leftStart[0], leftEnd[0]), Math.min(rightStart[0], rightEnd[0]))); + } + return 0; + } + + function orthogonalTouchOnResolvedInterior(start, end, resolvedStart, resolvedEnd) { + const epsilon = 0.0001; + const candidateHorizontal = Math.abs(start[1] - end[1]) <= epsilon; + const candidateVertical = Math.abs(start[0] - end[0]) <= epsilon; + const resolvedHorizontal = Math.abs(resolvedStart[1] - resolvedEnd[1]) <= epsilon; + const resolvedVertical = Math.abs(resolvedStart[0] - resolvedEnd[0]) <= epsilon; + if (candidateHorizontal && resolvedVertical) { + const x = resolvedStart[0]; + const y = start[1]; + return x >= Math.min(start[0], end[0]) - epsilon + && x <= Math.max(start[0], end[0]) + epsilon + && y > Math.min(resolvedStart[1], resolvedEnd[1]) + epsilon + && y < Math.max(resolvedStart[1], resolvedEnd[1]) - epsilon; + } + if (candidateVertical && resolvedHorizontal) { + const x = start[0]; + const y = resolvedStart[1]; + return y >= Math.min(start[1], end[1]) - epsilon + && y <= Math.max(start[1], end[1]) + epsilon + && x > Math.min(resolvedStart[0], resolvedEnd[0]) + epsilon + && x < Math.max(resolvedStart[0], resolvedEnd[0]) - epsilon; + } + return false; + } + + function unrelatedResolvedRoutes(conn, resolvedRoutes) { + return resolvedRoutes.filter((entry) => !relationshipsShareEndpoint(conn, entry.conn)); + } + + function routeConflictsWithResolved(conn, points, resolvedRoutes) { + const unrelated = unrelatedResolvedRoutes(conn, resolvedRoutes); + for (const entry of unrelated) { + for (let left = 0; left < points.length - 1; left += 1) { + for (let right = 0; right < entry.points.length - 1; right += 1) { + if (properSegmentIntersection( + points[left], + points[left + 1], + entry.points[right], + entry.points[right + 1], + )) return true; + if (orthogonalTouchOnResolvedInterior( + points[left], + points[left + 1], + entry.points[right], + entry.points[right + 1], + )) return true; + if (collinearOverlapLength( + points[left], + points[left + 1], + entry.points[right], + entry.points[right + 1], + ) >= 8) return true; + } + } + } + return false; + } + + function routeOverlapsResolved(conn, points, resolvedRoutes) { + // A common destination does not make two independently labelled routes a + // bus. Keep their corridors distinct too; explicit routes bypass planning. + for (const entry of resolvedRoutes) { + if (relationshipsShareEndpoint(conn, entry.conn) + && (!distinctAutomaticPorts || hasAuthoredRouteGeometry(entry.conn) || entry.conn.labelAt || conn.labelAt)) continue; + for (let left = 0; left < points.length - 1; left += 1) { + for (let right = 0; right < entry.points.length - 1; right += 1) { + if (collinearOverlapLength( + points[left], + points[left + 1], + entry.points[right], + entry.points[right + 1], + ) >= 8) return true; + } + } + } + return false; + } + + const OUTWARD_SIDE_VECTOR = { + left: [-1, 0], + right: [1, 0], + top: [0, -1], + bottom: [0, 1], + }; + + function outwardStub(point, side, distance = 24) { + const [dx, dy] = OUTWARD_SIDE_VECTOR[side] || [0, 0]; + return [point[0] + dx * distance, point[1] + dy * distance]; + } + + function collinearBacktrack(a, b, c) { + const first = [b[0] - a[0], b[1] - a[1]]; + const second = [c[0] - b[0], c[1] - b[1]]; + const cross = first[0] * second[1] - first[1] * second[0]; + const dot = first[0] * second[0] + first[1] * second[1]; + return Math.abs(cross) <= 0.0001 && dot < -0.0001; + } + + function sideAwareBridgeCandidates(start, end, fromSide, toSide) { + const startStub = outwardStub(start, fromSide); + const endStub = outwardStub(end, toSide); + const rawCandidates = []; + const minimumBridge = 16; + const verticalSides = new Set(['top', 'bottom']); + const horizontalSides = new Set(['left', 'right']); + + // Port spreading can leave parallel-side anchors only a few pixels apart. + // Route through a bounded outside channel so we keep both endpoint normals + // without introducing a tiny, noisy connector between the two stubs. + if (verticalSides.has(fromSide) && verticalSides.has(toSide) + && Math.abs(start[0] - end[0]) < minimumBridge) { + for (const channelX of [ + Math.max(start[0], end[0]) + minimumBridge, + Math.min(start[0], end[0]) - minimumBridge, + ]) { + rawCandidates.push([ + startStub, + [channelX, startStub[1]], + [channelX, endStub[1]], + endStub, + ]); + } + } + if (horizontalSides.has(fromSide) && horizontalSides.has(toSide) + && Math.abs(start[1] - end[1]) < minimumBridge) { + for (const channelY of [ + Math.max(start[1], end[1]) + minimumBridge, + Math.min(start[1], end[1]) - minimumBridge, + ]) { + rawCandidates.push([ + startStub, + [startStub[0], channelY], + [endStub[0], channelY], + endStub, + ]); + } + } + + rawCandidates.push( + [startStub, [endStub[0], startStub[1]], endStub], + [startStub, [startStub[0], endStub[1]], endStub], + ); + return rawCandidates.map((candidate) => normalizeRoutePoints([start, ...candidate, end])) + .filter((points) => points.length >= 2) + .filter((points) => !collinearBacktrack(points[0], points[1], points[2] || points[1])) + .filter((points) => !collinearBacktrack(points.at(-3) || points.at(-2), points.at(-2), points.at(-1))) + .filter((points) => routeHonorsEndpointSides(points, fromSide, toSide)) + .map((points) => points.slice(1, -1)); + } + + const AUTOMATIC_PORT_CORNER_GUTTER = 16; + const AUTOMATIC_PORT_ALIGNMENT_DELTA = 16; + + function portHasCornerClearance(rect, side, point) { + if (side === 'left' || side === 'right') { + const inset = Math.min(AUTOMATIC_PORT_CORNER_GUTTER, rect.height / 2); + return point[1] >= rect.y + inset && point[1] <= rect.y + rect.height - inset; + } + if (side === 'top' || side === 'bottom') { + const inset = Math.min(AUTOMATIC_PORT_CORNER_GUTTER, rect.width / 2); + return point[0] >= rect.x + inset && point[0] <= rect.x + rect.width - inset; + } + return false; + } + + function alignFacingPorts(conn, from, to, start, end, fromSide, toSide, ports) { + const hasExplicitGeometry = ( + conn.via + || (conn.route && conn.route !== 'auto') + || conn.channelX !== undefined + || conn.channelY !== undefined + || conn.labelAt + ); + const horizontallyFacing = ( + (fromSide === 'right' && toSide === 'left') + || (fromSide === 'left' && toSide === 'right') + ); + const verticallyFacing = ( + (fromSide === 'bottom' && toSide === 'top') + || (fromSide === 'top' && toSide === 'bottom') + ); + if (hasExplicitGeometry || (!horizontallyFacing && !verticallyFacing)) return { start, end }; + + const fromSpread = Boolean(ports?.from); + const toSpread = Boolean(ports?.to); + if (fromSpread && toSpread) return { start, end }; + const hasExplicitSides = ( + (conn.fromSide && conn.fromSide !== 'auto') + || (conn.toSide && conn.toSide !== 'auto') + ); + if (!fromSpread && !toSpread && hasExplicitSides) return { start, end }; + + const alignmentDelta = horizontallyFacing + ? Math.abs(start[1] - end[1]) + : Math.abs(start[0] - end[0]); + if (alignmentDelta >= AUTOMATIC_PORT_ALIGNMENT_DELTA) return { start, end }; + + // Keep the shared endpoint's distinct spread slot and move only the + // relationship's unshared endpoint onto that axis. With no spread endpoint, + // retain the existing least-movement choice between the two facing sides. + // If both endpoints are shared, preserve the outside bridge so no competing + // port is silently collapsed. + const alignEndToStart = horizontallyFacing + ? { start, end: [end[0], start[1]] } + : { start, end: [start[0], end[1]] }; + const alignStartToEnd = horizontallyFacing + ? { start: [start[0], end[1]], end } + : { start: [end[0], start[1]], end }; + const candidates = fromSpread + ? [alignEndToStart] + : toSpread + ? [alignStartToEnd] + : [alignEndToStart, alignStartToEnd]; + for (const candidate of candidates) { + const points = [candidate.start, candidate.end]; + if (portHasCornerClearance(from, fromSide, candidate.start) + && portHasCornerClearance(to, toSide, candidate.end) + && routeHonorsEndpointSides(points, fromSide, toSide) + && routeClearsEndpointComponents(points, from, to) + && routeClearsComponents(conn, points)) { + return candidate; + } + } + return { start, end }; + } + + // A reciprocal pair is repaired jointly after planning, so crossings that + // involve it are not final yet; keep the established first choice there. + const reciprocal = (conn) => connections.some((other) => other.from === conn.to && other.to === conn.from); + function siblingCrossings(conn, points, resolvedRoutes) { + if (reciprocal(conn)) return 0; + return crossingCount(conn, points, resolvedRoutes.filter((entry) => !reciprocal(entry.conn))); + } + + function routeVia(conn, from, to, start, end, fromSide, toSide, resolvedRoutes = []) { + if (conn.via) return conn.via; + switch (conn.route || 'auto') { + case 'straight': + return []; + case 'orthogonal-h': { + const midX = (start[0] + end[0]) / 2; + return [[midX, start[1]], [midX, end[1]]]; + } + case 'orthogonal-v': { + const midY = (start[1] + end[1]) / 2; + return [[start[0], midY], [end[0], midY]]; + } + case 'auto': + default: { + // Direct line unless the anchors are clearly orthogonal-friendly. + const deltaX = Math.abs(start[0] - end[0]); + const deltaY = Math.abs(start[1] - end[1]); + if (deltaX < 4 || deltaY < 4) { + const direct = [start, end]; + if (routeHonorsEndpointSides(direct, fromSide, toSide) + && routeClearsEndpointComponents(direct, from, to) + && routeClearsComponents(conn, direct) + && routeMeetsCompositionFloors(direct) + && !routeConflictsWithResolved(conn, direct, resolvedRoutes)) return []; + } + + const rhythmBridge = automaticPortRhythmBridge(start, end, fromSide, toSide, { + accept: (points) => ( + routeClearsEndpointComponents(points, from, to) + && routeClearsComponents(conn, points) + && routeMeetsCompositionFloors(points) + && !routeConflictsWithResolved(conn, points, resolvedRoutes) + ), + }); + if (rhythmBridge) return rhythmBridge.slice(1, -1); + + // Automatic port spreading can leave otherwise aligned endpoints only a + // few pixels apart. A midpoint route would split that tiny difference + // into two unreadable endpoint stubs, so take a bounded outside channel + // when both anchors sit on parallel component sides. + const minimumStub = 8; + const fromVerticalSide = start[1] === from.y || start[1] === from.y + from.height; + const toVerticalSide = end[1] === to.y || end[1] === to.y + to.height; + if (fromVerticalSide && toVerticalSide && deltaX < minimumStub * 2) { + const outsideChannels = [ + Math.max(start[0], end[0]) + minimumStub * 2, + Math.min(start[0], end[0]) - minimumStub * 2, + ]; + for (const channelX of outsideChannels) { + const candidate = [[channelX, start[1]], [channelX, end[1]]]; + const points = [start, ...candidate, end]; + if (routeHonorsEndpointSides(points, fromSide, toSide) + && routeClearsComponents(conn, points) + && routeMeetsCompositionFloors(points) + && !routeConflictsWithResolved(conn, points, resolvedRoutes)) return candidate; + } + } + + const fromHorizontalSide = start[0] === from.x || start[0] === from.x + from.width; + const toHorizontalSide = end[0] === to.x || end[0] === to.x + to.width; + if (fromHorizontalSide && toHorizontalSide && deltaY < minimumStub * 2) { + const outsideChannels = [ + Math.max(start[1], end[1]) + minimumStub * 2, + Math.min(start[1], end[1]) - minimumStub * 2, + ]; + for (const channelY of outsideChannels) { + const candidate = [[start[0], channelY], [end[0], channelY]]; + const points = [start, ...candidate, end]; + if (routeHonorsEndpointSides(points, fromSide, toSide) + && routeClearsComponents(conn, points) + && routeMeetsCompositionFloors(points) + && !routeConflictsWithResolved(conn, points, resolvedRoutes)) return candidate; + } + } + + const midX = (start[0] + end[0]) / 2; + const horizontalFirst = [[midX, start[1]], [midX, end[1]]]; + const midY = (start[1] + end[1]) / 2; + const verticalFirst = [[start[0], midY], [end[0], midY]]; + const candidates = [horizontalFirst, verticalFirst]; + const sideSafe = candidates.filter((candidate) => ( + routeHonorsEndpointSides([start, ...candidate, end], fromSide, toSide) + )); + const sideAware = sideAwareBridgeCandidates(start, end, fromSide, toSide); + const nearParallelPorts = ( + ((fromSide === 'top' || fromSide === 'bottom') + && (toSide === 'top' || toSide === 'bottom') + && deltaX < minimumStub * 2) + || ((fromSide === 'left' || fromSide === 'right') + && (toSide === 'left' || toSide === 'right') + && deltaY < minimumStub * 2) + ); + const ordered = [ + ...(nearParallelPorts ? sideAware : sideSafe), + ...(nearParallelPorts ? sideSafe : sideAware), + ]; + for (const candidate of ordered) { + const points = [start, ...candidate, end]; + if (routeClearsEndpointComponents(points, from, to) + && routeClearsComponents(conn, points) + && routeMeetsCompositionFloors(points) + && !routeConflictsWithResolved(conn, points, resolvedRoutes) + && (!distinctAutomaticPorts || (!routeOverlapsResolved(conn, points, resolvedRoutes) + && !siblingCrossings(conn, points, resolvedRoutes)))) return candidate; + } + // Siblings fanning out from one side all want the same midpoint + // channel. Step outward through the corridor to a free parallel + // channel before searching. + if (distinctAutomaticPorts) { + const channels = (from, to, mid) => { + const [low, high] = [Math.min(from, to) + 24, Math.max(from, to) - 24]; + const values = []; + for (let offset = 16; mid - offset >= low || mid + offset <= high; offset += 16) { + values.push(...[mid + offset, mid - offset].filter((value) => value >= low && value <= high)); + } + return values; + }; + for (const candidate of [ + ...channels(start[0], end[0], midX).map((x) => [[x, start[1]], [x, end[1]]]), + ...channels(start[1], end[1], midY).map((y) => [[start[0], y], [end[0], y]]), + ]) { + const points = [start, ...candidate, end]; + if (routeHonorsEndpointSides(points, fromSide, toSide) + && routeClearsEndpointComponents(points, from, to) + && routeClearsComponents(conn, points) + && routeMeetsCompositionFloors(points) + && !routeConflictsWithResolved(conn, points, resolvedRoutes) + && !routeOverlapsResolved(conn, points, resolvedRoutes) + && !siblingCrossings(conn, points, resolvedRoutes)) return candidate; + } + } + + // Two-bend doglegs are deliberately cheap, but a real architecture can + // place adjacent components on both of those corridors. Search a + // bounded obstacle grid before falling back to a route that the Clean + // Flow gate already knows violates the inferred endpoint directions. + // This keeps ordinary multi-bend avoidance renderer-owned instead of + // forcing the author to hand-place via points. + // Alternative endpoint pairs are cheap probes, not another grid-search + // budget. A legal short bridge often beats the first grid detour. + if (!allowGridSearch) return sideSafe[0] || sideAware[0] || horizontalFirst; + if (planningMetrics.gridSearchCount >= planningMetrics.maximumGridSearchCount) { + planningMetrics.gridBudgetExhaustedCount += 1; + planningMetrics.conflictFallbackCount += 1; + return sideSafe[0] || sideAware[0] || horizontalFirst; + } + // First-draft architecture graphs are not always planar at their + // authored node positions. The renderer gives automatic crossings a + // visible halo, so the grid owns opaque-node avoidance and rejects + // ambiguous shared corridors without forcing the model to hand-route + // a sprawling perimeter detour. Cheap candidates above still prefer a + // genuinely crossing-free path whenever one is available. + const avoidedSegments = resolvedRoutes + .filter((entry) => distinctAutomaticPorts && relationshipsShareEndpoint(conn, entry.conn) + && !hasAuthoredRouteGeometry(entry.conn) && !entry.conn.labelAt && !conn.labelAt) + .flatMap((entry) => entry.points.slice(1).map((end, index) => ({ + start: entry.points[index], end, + }))); + const gridMetrics = {}; + planningMetrics.gridSearchCount += 1; + planningMetrics.avoidedSegmentCount += avoidedSegments.length; + const searched = shortestOrthogonalGridRoute({ + start, + end, + points: [start, end], + obstacles: [...components.values(), ...reservedLabelObstacles(2)], + fromSide, + toSide, + clearance: 2, + maximumObstacleCount: 80, + endpointStubPx: 24, + maximumGridNodes: 4096, + avoidedSegments, + allowAvoidedCrossings: true, + minimumAvoidedOverlapPx: 8, + routeSeparationPx: 8, + minimumSegmentPx: interiorSegmentPx, + borderSegments: frameBorders, + bendPenaltyPx: 48, + metrics: gridMetrics, + }); + planningMetrics.gridCandidateNodeCount += gridMetrics.candidateNodeCount || 0; + planningMetrics.gridUsableNodeCount += gridMetrics.usableNodeCount || 0; + planningMetrics.gridEdgeCount += gridMetrics.graphEdgeCount || 0; + planningMetrics.gridVisitedNodeCount += gridMetrics.visitedNodeCount || 0; + const clearsEndpoints = searched + ? routeClearsEndpointComponents(searched.points, from, to) : false; + const clearsComponents = searched + ? routeClearsComponents(conn, searched.points) : false; + const clearsRelationships = searched + ? !routeConflictsWithResolved(conn, searched.points, resolvedRoutes) : false; + const clearsSharedCorridors = searched + ? !routeOverlapsResolved(conn, searched.points, resolvedRoutes) : false; + const meetsFloors = searched ? routeMeetsCompositionFloors(searched.points) : false; + const accepted = Boolean( + searched && clearsEndpoints && clearsComponents && clearsSharedCorridors && meetsFloors, + ); + planningMetrics.gridAttempts.push({ + relationship: conn.id || `${conn.from}->${conn.to}`, + fromSide, + toSide, + inputAvoidedSegmentCount: avoidedSegments.length, + ...gridMetrics, + accepted, + ...(!accepted && searched ? { + rejectedBy: [ + ...(!clearsEndpoints ? ['endpoint-components'] : []), + ...(!clearsComponents ? ['components'] : []), + ...(!clearsSharedCorridors ? ['shared-corridor'] : []), + ...(!meetsFloors ? ['composition-floors'] : []), + ], + candidatePoints: searched.points, + } : {}), + }); + if (accepted) { + planningMetrics.gridRoutedCount += 1; + if (!clearsRelationships) planningMetrics.crossoverRoutedCount += 1; + return searched.points.slice(1, -1); + } + + // Both bounded doglegs are blocked. Keep the best endpoint-safe route + // when one exists so the universal Clean Flow gate reports the actual + // obstacle; otherwise preserve the historical deterministic fallback + // and let the endpoint-direction gate explain the side mismatch. + planningMetrics.conflictFallbackCount += 1; + return sideSafe[0] || sideAware[0] || horizontalFirst; + } + } + } + + // A node's neighbours laid out as one row below (or above) it read as a + // fan-out: reach them all through the same vertical side. Center-based + // inference alone sends the outer ones sideways around their siblings. + const neighbourRects = new Map(); + for (const conn of connections) { + const from = components.get(conn.from); + const to = components.get(conn.to); + if (!from || !to || from === to) continue; + for (const [node, other] of [[from, to], [to, from]]) { + neighbourRects.set(node.id, [...(neighbourRects.get(node.id) || []), other]); + } + } + function rowFanOutSides(from, to) { + if (!preferReadableRoutes) return null; + const verticalSides = (node, other) => { + const below = other.y >= node.y + node.height; + if (!below && other.y + other.height > node.y) return null; + if (['top', 'bottom'].includes(defaultFromSide(node, other))) return null; + const rowSibling = (neighbourRects.get(node.id) || []).some((sibling) => sibling !== other + && Math.abs(sibling.cy - other.cy) < 1 + && defaultFromSide(node, sibling) === (below ? 'bottom' : 'top')); + // Only when a node of that row blocks a sideways route to one of the + // neighbours on this side; otherwise side exits stay clear and keep the + // vertical side free. Decide per side so a row never mixes both styles. + const blocked = (target) => { + const [gapStart, gapEnd] = target.cx < node.cx + ? [target.x + target.width, node.x] : [node.x + node.width, target.x]; + return [...components.values()].some((rect) => rect !== node && rect !== target + && rect.y < target.y + target.height && rect.y + rect.height > target.y + && rect.x < gapEnd && rect.x + rect.width > gapStart); + }; + const sameSide = (neighbourRects.get(node.id) || []).filter((sibling) => Math.abs(sibling.cy - other.cy) < 1 + && defaultFromSide(node, sibling) === defaultFromSide(node, other)); + return rowSibling && sameSide.some(blocked) ? (below ? 'bottom' : 'top') : null; + }; + const opposite = { top: 'bottom', bottom: 'top' }; + const fromSide = verticalSides(from, to); + if (fromSide) return { fromSide, toSide: opposite[fromSide] }; + const toSide = verticalSides(to, from); + return toSide ? { fromSide: opposite[toSide], toSide } : null; + } + + const pathCache = new Map(); + const selectedSides = new Map(); + const stroke = (relation) => relation.width || (relation.variant === 'emphasis' ? 1.8 : 1.5); + const markerSpacing = (left, right) => 3.5 * (stroke(left) + stroke(right)); + const portSpacing = (left, right) => Math.max(14, markerSpacing(left, right) + 3.5); + const automaticPorts = automaticPortSpread(connections, components, { + sideFor: (relation, endpoint) => rowFanOutSides(components.get(relation.from), components.get(relation.to)) + ?.[endpoint === 'source' ? 'fromSide' : 'toSide'], + // Preserve the established initial placement for ordinary markers; only + // widen groups whose arrowheads cannot fit the legacy 14px slots. + ...(distinctAutomaticPorts ? { spacingFor: (left, right) => + markerSpacing(left, right) > 14 ? portSpacing(left, right) : 14 } : {}), + }); + const incidentEndpoints = new Map(); + for (const conn of connections) { + if (!components.has(conn.from) || !components.has(conn.to)) continue; + for (const [field, sideField] of [['from', 'fromSide'], ['to', 'toSide']]) { + const entries = incidentEndpoints.get(conn[field]) || []; + entries.push({ conn, field, sideField }); + incidentEndpoints.set(conn[field], entries); + } + } + function inferredConnectionSides(conn) { + const from = components.get(conn.from); + const to = components.get(conn.to); + const fanOut = rowFanOutSides(from, to); + return { + fromSide: chosenSide(conn.fromSide, fanOut?.fromSide || defaultFromSide(from, to)), + toSide: chosenSide(conn.toSide, fanOut?.toSide || defaultToSide(from, to)), + }; + } + + function connectionSides(conn) { + if (!routesPlanned && !routesPlanning) planRoutes(); + return selectedSides.get(conn) || inferredConnectionSides(conn); + } + + function connectionEndpointSide(conn, endpoint) { + const field = endpoint === 'source' ? 'fromSide' : 'toSide'; + if (conn[field] && conn[field] !== 'auto') return conn[field]; + return connectionSides(conn)[field]; + } + + function hasAuthoredRouteGeometry(conn) { + return Boolean( + conn?.via + || (conn?.route && conn.route !== 'auto') + || conn?.channelX !== undefined + || conn?.channelY !== undefined + ); + } + + function hasAuthoredLabelPlacement(conn) { + return ['labelAt', 'labelDx', 'labelDy', 'labelSegment'] + .some((field) => conn?.[field] !== undefined); + } + + // A route can change sides after the initial port spread. Reserve slots on + // the final side as well: falling back to its midpoint can put an arrow + // between two existing slots, or directly on another incoming arrow. + function automaticEndpoint(conn, endpoint, rect, side, inferredSide) { + const initial = side === inferredSide ? automaticPorts.get(conn)?.[endpoint] : null; + const preferred = initial || anchor(rect, side); + if (hasAuthoredRouteGeometry(conn) || conn.labelAt) return { point: preferred, spread: Boolean(initial) }; + const axis = side === 'left' || side === 'right' ? 1 : 0; + const occupied = []; + for (const { conn: other, field, sideField } of incidentEndpoints.get(rect.id) || []) { + if (other === conn || hasAuthoredRouteGeometry(other) || other.labelAt) continue; + const routed = pathCache.get(other); + const sides = selectedSides.get(other) || inferredConnectionSides(other); + if (sides[sideField] !== side) continue; + const point = routed + ? (field === 'from' ? routed.points[0] : routed.points.at(-1)) + : automaticPorts.get(other)?.[field] || anchor(rect, side); + occupied.push({ value: point[axis], spacing: portSpacing(conn, other) }); + } + if (!occupied.length) return { point: preferred, spread: Boolean(initial) }; + const candidates = [preferred[axis], ...occupied.flatMap(({ value, spacing }) => [value - spacing, value + spacing])] + .sort((a, b) => Math.abs(a - preferred[axis]) - Math.abs(b - preferred[axis]) || a - b); + for (const value of candidates) { + const point = [...preferred]; + point[axis] = value; + if (portHasCornerClearance(rect, side, point) + && occupied.every((other) => Math.abs(value - other.value) >= other.spacing - 0.0001)) { + return { point, spread: true }; + } + } + return { point: preferred, spread: true, crowded: true }; + } + + function connectionGeometry(conn, sides = inferredConnectionSides(conn)) { + const from = components.get(conn.from); + const to = components.get(conn.to); + const inferred = inferredConnectionSides(conn); + const { fromSide, toSide } = sides; + const legacyPorts = fromSide === inferred.fromSide && toSide === inferred.toSide ? automaticPorts.get(conn) : null; + const source = distinctAutomaticPorts + ? automaticEndpoint(conn, 'from', from, fromSide, inferred.fromSide) + : { point: legacyPorts?.from || anchor(from, fromSide), spread: Boolean(legacyPorts?.from) }; + const target = distinctAutomaticPorts + ? automaticEndpoint(conn, 'to', to, toSide, inferred.toSide) + : { point: legacyPorts?.to || anchor(to, toSide), spread: Boolean(legacyPorts?.to) }; + const ports = { from: source.spread, to: target.spread }; + const { start, end } = alignFacingPorts( + conn, + from, + to, + source.point, + target.point, + fromSide, + toSide, + ports, + ); + return { from, to, start, end, fromSide, toSide, crowded: source.crowded || target.crowded }; + } + + function routedForGeometry(conn, resolvedRoutes, geometry) { + const { from, to, start, end, fromSide, toSide } = geometry; + const authoredPoints = [ + start, + ...routeVia(conn, from, to, start, end, fromSide, toSide, resolvedRoutes), + end, + ]; + // Explicit waypoints are author-owned geometry. Keep even a collinear + // waypoint: it can intentionally split a route at a semantic touch point, + // and preserving it is part of the backwards-compatible authoring contract. + // Automatic routes remain normalized so the renderer does not emit noisy + // duplicate turns or zero-length segments. + const points = hasAuthoredRouteGeometry(conn) + ? authoredPoints + : normalizeRoutePoints(authoredPoints); + return { d: roundedPath(points, 8), points }; + } + + function cachePath(conn, routed, sides) { + pathCache.set(conn, routed); + selectedSides.set(conn, { fromSide: sides.fromSide, toSide: sides.toSide }); + return routed; + } + + const SIDE_ORDER = ['right', 'bottom', 'left', 'top']; + function candidateSidePairs(conn) { + const inferred = inferredConnectionSides(conn); + const authoredFrom = conn.fromSide && conn.fromSide !== 'auto' ? conn.fromSide : null; + const authoredTo = conn.toSide && conn.toSide !== 'auto' ? conn.toSide : null; + const fromOptions = authoredFrom + ? [authoredFrom] + : [inferred.fromSide, ...SIDE_ORDER.filter((side) => side !== inferred.fromSide)]; + const toOptions = authoredTo + ? [authoredTo] + : [inferred.toSide, ...SIDE_ORDER.filter((side) => side !== inferred.toSide)]; + return fromOptions.flatMap((fromSide) => toOptions.map((toSide) => ({ + fromSide, + toSide, + deviationCount: Number(fromSide !== inferred.fromSide) + Number(toSide !== inferred.toSide), + }))).sort((left, right) => { + if (left.deviationCount !== right.deviationCount) { + return left.deviationCount - right.deviationCount; + } + const leftGeometry = connectionGeometry(conn, left); + const rightGeometry = connectionGeometry(conn, right); + const leftDistance = Math.abs(leftGeometry.end[0] - leftGeometry.start[0]) + + Math.abs(leftGeometry.end[1] - leftGeometry.start[1]); + const rightDistance = Math.abs(rightGeometry.end[0] - rightGeometry.start[0]) + + Math.abs(rightGeometry.end[1] - rightGeometry.start[1]); + return leftDistance - rightDistance; + }); + } + + function routeIsClear(conn, routed, geometry, resolvedRoutes) { + return !geometry.crowded && routed.points.length >= 2 + && routeHonorsEndpointSides(routed.points, geometry.fromSide, geometry.toSide) + && routeClearsEndpointComponents(routed.points, geometry.from, geometry.to) + && routeClearsComponents(conn, routed.points) + && routeMeetsCompositionFloors(routed.points) + && !routeOverlapsResolved(conn, routed.points, resolvedRoutes); + } + + function crossingCount(conn, points, resolvedRoutes) { + return resolvedRoutes.reduce((total, entry) => total + Number( + !(relationshipsShareEndpoint(conn, entry.conn) + && (!distinctAutomaticPorts || hasAuthoredRouteGeometry(entry.conn) || entry.conn.labelAt || conn.labelAt)) + && points.slice(1).some((end, index) => entry.points.slice(1).some((otherEnd, otherIndex) => + properSegmentIntersection(points[index], end, entry.points[otherIndex], otherEnd))), + ), 0); + } + + function readabilityCost(conn, routed, resolvedRoutes) { + const points = routed.points; + const length = points.slice(1).reduce((total, point, index) => total + + Math.abs(point[0] - points[index][0]) + Math.abs(point[1] - points[index][1]), 0); + // A crossover is a reading cost even with a halo. Keep it finite: avoiding + // one crossing must not justify an arbitrarily long perimeter excursion. + return length + Math.max(0, points.length - 2) * 48 + crossingCount(conn, points, resolvedRoutes) * 160; + } + + function computePath(conn, resolvedRoutes) { + if (hasAuthoredRouteGeometry(conn)) { + const sides = inferredConnectionSides(conn); + return cachePath(conn, routedForGeometry( + conn, + resolvedRoutes, + connectionGeometry(conn, sides), + ), sides); + } + + let firstFallback = null; + const clearRoute = () => { + let firstClear = null; + for (const sides of candidateSidePairs(conn)) { + const geometry = connectionGeometry(conn, sides); + const routed = routedForGeometry(conn, resolvedRoutes, geometry); + if (!firstFallback) firstFallback = { routed, sides }; + if (routeIsClear(conn, routed, geometry, resolvedRoutes)) { + firstClear = { routed, sides }; + break; + } + } + return firstClear; + }; + const routeLength = ({ routed }) => routed.points.slice(1) + .reduce((total, point, index) => total + Math.abs(point[0] - routed.points[index][0]) + Math.abs(point[1] - routed.points[index][1]), 0); + + // Reserved labels are a preference, not an obstacle. A route that has no + // corridor around them, or that would have to detour far around them, + // takes the plain route instead and the label placement pass moves the + // label; only a modest extra length is worth keeping a label in place. + honourReservedLabels = true; + let chosen = clearRoute(); + if (reservedLabels.length) { + honourReservedLabels = false; + if (!chosen) chosen = clearRoute(); + else { + const direct = Math.abs(chosen.routed.points.at(-1)[0] - chosen.routed.points[0][0]) + + Math.abs(chosen.routed.points.at(-1)[1] - chosen.routed.points[0][1]); + if (routeLength(chosen) > direct * 1.25 + 64) { + const plain = clearRoute(); + if (plain && routeLength(plain) * 1.25 + 64 < routeLength(chosen)) chosen = plain; + } + } + honourReservedLabels = true; + } + if (chosen) return cachePath(conn, chosen.routed, chosen.sides); + return cachePath(conn, firstFallback.routed, firstFallback.sides); + } + + let routesPlanned = false; + let routesPlanning = false; + function planRoutes() { + if (routesPlanned || routesPlanning) return; + routesPlanning = true; + const indexed = connections + .map((conn, index) => ({ conn, index })) + .filter(({ conn }) => components.has(conn.from) && components.has(conn.to)); + const explicit = indexed.filter(({ conn }) => hasAuthoredRouteGeometry(conn)); + const automatic = indexed.filter(({ conn }) => !hasAuthoredRouteGeometry(conn)) + .sort((left, right) => { + const leftFrom = components.get(left.conn.from); + const leftTo = components.get(left.conn.to); + const rightFrom = components.get(right.conn.from); + const rightTo = components.get(right.conn.to); + const leftDistance = Math.abs(leftTo.cx - leftFrom.cx) + Math.abs(leftTo.cy - leftFrom.cy); + const rightDistance = Math.abs(rightTo.cx - rightFrom.cx) + Math.abs(rightTo.cy - rightFrom.cy); + return leftDistance - rightDistance || left.index - right.index; + }); + const resolvedRoutes = []; + reservedLabels = []; + for (const { conn } of [...explicit, ...automatic]) { + const routed = computePath(conn, resolvedRoutes); + resolvedRoutes.push({ conn, points: routed.points }); + const rect = labelRectFor?.(conn, routed.points, { + routes: resolvedRoutes.map((entry) => entry.points), + labels: reservedLabels.map((entry) => entry.rect), + }); + if (rect) reservedLabels.push({ conn, rect }); + } + // Improve against the complete set of routes, not only earlier edges. + // A greedy side change during the initial pass can steal a later edge's + // corridor. This bounded sweep only changes one route at a time, keeping + // every other route and label as an obstacle/reference. + if (preferReadableRoutes) { + const scenePoints = resolvedRoutes.flatMap((entry) => entry.points); + for (const rect of [...components.values(), ...frames, ...reservedLabels.map((entry) => entry.rect)]) { + scenePoints.push([rect.x, rect.y], [rect.x + rect.width, rect.y + rect.height]); + } + const bounds = { + left: Math.min(...scenePoints.map(([x]) => x)), right: Math.max(...scenePoints.map(([x]) => x)), + top: Math.min(...scenePoints.map(([, y]) => y)), bottom: Math.max(...scenePoints.map(([, y]) => y)), + }; + const withinScene = ([x, y]) => x >= bounds.left && x <= bounds.right && y >= bounds.top && y <= bounds.bottom; + const jointlyImproved = new Set(); + function improveReciprocalPairs() { + // A one-route sweep cannot repair reciprocal facing edges whose initial + // spread groups differ. Try both direct lanes together after final side + // geometry is known, leaving every other route and authored port in place. + const paired = new Set(); + for (const first of resolvedRoutes) { + const conn = first.conn; + if (paired.has(conn) || hasAuthoredRouteGeometry(conn) || hasAuthoredLabelPlacement(conn) + || (conn.fromSide && conn.fromSide !== 'auto') + || (conn.toSide && conn.toSide !== 'auto')) continue; + const second = resolvedRoutes.find((entry) => entry !== first + && entry.conn.from === conn.to && entry.conn.to === conn.from + && !hasAuthoredRouteGeometry(entry.conn) && !hasAuthoredLabelPlacement(entry.conn) + && (!entry.conn.fromSide || entry.conn.fromSide === 'auto') + && (!entry.conn.toSide || entry.conn.toSide === 'auto')); + if (!second) continue; + paired.add(conn); + paired.add(second.conn); + const firstSides = inferredConnectionSides(conn); + const secondSides = inferredConnectionSides(second.conn); + const horizontal = firstSides.fromSide === 'right' && firstSides.toSide === 'left' + && secondSides.fromSide === 'left' && secondSides.toSide === 'right'; + const horizontalReverse = firstSides.fromSide === 'left' && firstSides.toSide === 'right' + && secondSides.fromSide === 'right' && secondSides.toSide === 'left'; + const vertical = firstSides.fromSide === 'bottom' && firstSides.toSide === 'top' + && secondSides.fromSide === 'top' && secondSides.toSide === 'bottom'; + const verticalReverse = firstSides.fromSide === 'top' && firstSides.toSide === 'bottom' + && secondSides.fromSide === 'bottom' && secondSides.toSide === 'top'; + if (!horizontal && !horizontalReverse && !vertical && !verticalReverse) continue; + if (first.points.length <= 2 && second.points.length <= 2) continue; + const axis = horizontal || horizontalReverse ? 1 : 0; + const others = resolvedRoutes.filter((entry) => entry !== first && entry !== second); + const firstGeometry = connectionGeometry(conn, firstSides); + const secondGeometry = connectionGeometry(second.conn, secondSides); + if (firstGeometry.crowded || secondGeometry.crowded) continue; + const previousLabels = reservedLabels; + let improved = false; + reservedLabels = reservedLabels.filter((entry) => entry.conn !== conn && entry.conn !== second.conn); + try { + const lanes = (geometry) => [...new Set([geometry.start[axis], geometry.end[axis]])]; + const direct = (geometry, lane) => { + const start = [...geometry.start]; + const end = [...geometry.end]; + start[axis] = lane; + end[axis] = lane; + return { points: [start, end], d: roundedPath([start, end], 8) }; + }; + const endpointSlotsClear = (candidateRoutes) => { + const entries = [...others, ...candidateRoutes]; + for (const candidate of candidateRoutes) { + const sides = candidate.conn === conn ? firstSides : secondSides; + for (const [componentId, side, point] of [ + [candidate.conn.from, sides.fromSide, candidate.points[0]], + [candidate.conn.to, sides.toSide, candidate.points.at(-1)], + ]) { + const coordinate = side === 'left' || side === 'right' ? 1 : 0; + for (const other of entries) { + if (other.conn === candidate.conn) continue; + const otherSides = other.conn === conn ? firstSides + : other.conn === second.conn ? secondSides : selectedSides.get(other.conn); + for (const [otherId, otherSide, otherPoint] of [ + [other.conn.from, otherSides.fromSide, other.points[0]], + [other.conn.to, otherSides.toSide, other.points.at(-1)], + ]) { + if (componentId === otherId && side === otherSide + && Math.abs(point[coordinate] - otherPoint[coordinate]) + < portSpacing(candidate.conn, other.conn) - 0.0001) return false; + } + } + } + } + return true; + }; + const labelClears = (rect, owner, entries, labels) => { + if (!rect) return !owner.label; + if (!withinScene([rect.x, rect.y]) + || !withinScene([rect.x + rect.width, rect.y + rect.height]) + || labels.some((other) => rectsOverlap(rect, other.rect, 2))) return false; + return entries.every((entry) => entry.conn === owner || entry.points.slice(1).every((end, index) => + !segmentIntersectsRect({ start: entry.points[index], end }, rect, LABEL_CLEARANCE))); + }; + let best = null; + let bestCost = readabilityCost(conn, first, [...others, second]) + + readabilityCost(second.conn, second, [...others, first]); + for (const firstLane of lanes(firstGeometry)) { + for (const secondLane of lanes(secondGeometry)) { + planningMetrics.reciprocalCandidateCount += 1; + const firstRoute = { conn, ...direct(firstGeometry, firstLane) }; + const secondRoute = { conn: second.conn, ...direct(secondGeometry, secondLane) }; + const candidates = [firstRoute, secondRoute]; + if (!candidates.every((entry) => entry.points.every(withinScene))) continue; + if (!endpointSlotsClear(candidates)) continue; + if (!candidates.every((entry, index) => { + const geometry = entry.conn === conn ? firstGeometry : secondGeometry; + if (!portHasCornerClearance(geometry.from, geometry.fromSide, entry.points[0]) + || !portHasCornerClearance(geometry.to, geometry.toSide, entry.points.at(-1))) return false; + return routeIsClear(entry.conn, entry, geometry, [...others, candidates[1 - index]]); + })) continue; + const firstRect = labelRectFor?.(conn, firstRoute.points, { + routes: [...others.map((entry) => entry.points), ...candidates.map((entry) => entry.points)], + labels: reservedLabels.map((entry) => entry.rect), + }); + if (!labelClears(firstRect, conn, [...others, secondRoute], reservedLabels)) continue; + const secondRect = labelRectFor?.(second.conn, secondRoute.points, { + routes: [...others.map((entry) => entry.points), ...candidates.map((entry) => entry.points)], + labels: [...reservedLabels.map((entry) => entry.rect), ...(firstRect ? [firstRect] : [])], + }); + if (!labelClears(secondRect, second.conn, [...others, firstRoute], [ + ...reservedLabels, ...(firstRect ? [{ conn, rect: firstRect }] : []), + ])) continue; + const cost = readabilityCost(conn, firstRoute, [...others, secondRoute]) + + readabilityCost(second.conn, secondRoute, [...others, firstRoute]); + if (cost < bestCost) { + best = { firstRoute, secondRoute, firstRect, secondRect }; + bestCost = cost; + } + } + } + if (!best) continue; + cachePath(conn, best.firstRoute, firstSides); + cachePath(second.conn, best.secondRoute, secondSides); + first.points = best.firstRoute.points; + second.points = best.secondRoute.points; + planningMetrics.reciprocalImprovedCount += 1; + jointlyImproved.add(conn); + jointlyImproved.add(second.conn); + improved = true; + reservedLabels = [ + ...reservedLabels, + ...(best.firstRect ? [{ conn, rect: best.firstRect }] : []), + ...(best.secondRect ? [{ conn: second.conn, rect: best.secondRect }] : []), + ]; + } finally { + if (!improved) reservedLabels = previousLabels; + } + } + } + allowGridSearch = false; + try { + improveReciprocalPairs(); + for (const entry of resolvedRoutes) { + const { conn } = entry; + if (jointlyImproved.has(conn) || hasAuthoredRouteGeometry(conn) || conn.labelAt) continue; + const others = resolvedRoutes.filter((other) => other !== entry); + // Preserve uncomplicated routes and their established inferred sides. + // Spend the comparison budget where the complete scene has a reading + // cost: a crossover or more than two bends. + if (entry.points.length <= 4 && crossingCount(conn, entry.points, others) === 0) continue; + let best = null; + let bestCost = readabilityCost(conn, { points: entry.points }, others); + for (const sides of candidateSidePairs(conn)) { + const geometry = connectionGeometry(conn, sides); + const routed = routedForGeometry(conn, others, geometry); + planningMetrics.readabilityCandidateCount += 1; + if (!routed.points.every(withinScene) || !routeIsClear(conn, routed, geometry, others)) continue; + const cost = readabilityCost(conn, routed, others); + if (cost < bestCost) { + const rect = labelRectFor?.(conn, routed.points, { + routes: [...others.map((other) => other.points), routed.points], + labels: reservedLabels.filter((label) => label.conn !== conn).map((label) => label.rect), + }); + // A shorter route must not expand the canvas and shrink every + // label at the default viewport. Include its reserved label too. + if (rect && (!withinScene([rect.x, rect.y]) || !withinScene([rect.x + rect.width, rect.y + rect.height]))) continue; + best = { routed, sides, rect }; + bestCost = cost; + } + } + if (!best) continue; + cachePath(conn, best.routed, best.sides); + entry.points = best.routed.points; + planningMetrics.readabilityImprovedCount += 1; + reservedLabels = reservedLabels.filter((label) => label.conn !== conn); + if (best.rect) reservedLabels.push({ conn, rect: best.rect }); + } + } finally { + allowGridSearch = true; + } + } + planningMetrics.routeCount = resolvedRoutes.length; + planningMetrics.explicitRouteCount = explicit.length; + planningMetrics.automaticRouteCount = automatic.length; + routesPlanning = false; + routesPlanned = true; + } + + function pathFor(conn) { + planRoutes(); + if (pathCache.has(conn)) return pathCache.get(conn); + return computePath(conn, []); + } + + function routingMetrics() { + planRoutes(); + return { ...planningMetrics }; + } + + return { pathFor, connectionSides, connectionEndpointSide, routingMetrics }; +} diff --git a/packages/diagram-core/vendor/archify/renderers/dataflow/README.md b/packages/diagram-core/vendor/archify/renderers/dataflow/README.md index d5c43fc..108a4b1 100644 --- a/packages/diagram-core/vendor/archify/renderers/dataflow/README.md +++ b/packages/diagram-core/vendor/archify/renderers/dataflow/README.md @@ -10,8 +10,8 @@ node archify/renderers/dataflow/render-dataflow.mjs input.dataflow.json output.h The renderer validates input against `archify/schemas/dataflow.schema.json` with the bundled standalone validator. No dependency installation is required. -If `output.html` is omitted, the renderer uses `meta.output` from the JSON file -or falls back to `dataflow.html` in the current working directory. +If `output.html` is omitted, the renderer uses the required `meta.output` value +from the JSON file. ## Input @@ -23,6 +23,7 @@ Data-flow JSON files must set: "diagram_type": "dataflow", "meta": { "title": "Product Analytics Data Flow", + "output": "product-analytics-dataflow.html", "viewBox": [940, 720] }, "stages": [], diff --git a/packages/diagram-core/vendor/archify/renderers/dataflow/render-dataflow.mjs b/packages/diagram-core/vendor/archify/renderers/dataflow/render-dataflow.mjs index 3eda9d4..8907988 100644 --- a/packages/diagram-core/vendor/archify/renderers/dataflow/render-dataflow.mjs +++ b/packages/diagram-core/vendor/archify/renderers/dataflow/render-dataflow.mjs @@ -4,8 +4,8 @@ import { esc, renderDefinitions, renderSemanticSigil, textUnits } from '../share import { animateAttr, focusEdgeAttrs, focusNodeAttrs, focusNodeTitle, loadDiagramWithBrandMarks, writeDiagram, svgAccessibleText, svgRootAttrs } from '../shared/cli.mjs'; import { throwDiagnosticProblems } from '../shared/diagnostics.mjs'; import { resolveLegend, renderLegend as renderResolvedLegend } from '../shared/legend.mjs'; -import { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth } from '../shared/text-fit.mjs'; -import { brandLabelFitWidth, brandMetadataFor, brandTopRailProblem, renderBrandMark } from '../shared/brand-marks.mjs'; +import { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth, nodeLabelLayout } from '../shared/text-fit.mjs'; +import { brandLabelFitWidth, brandMarkFor, brandMetadataFor, brandTopRailProblem, renderBrandMark } from '../shared/brand-marks.mjs'; import { translateMessage as i18nText } from '../shared/i18n.mjs'; import { asArray, @@ -18,20 +18,22 @@ import { cleanBorderRunProblems, cleanRouteRhythmProblems, cleanLabelRouteClearanceProblems, + cleanLabelCanvasContainmentProblems, suggestLabelObstacleFix, suggestLabelPairFix, anchor, automaticPortSpread, - defaultFromSide, - defaultToSide, + legacyDefaultFromSide as defaultFromSide, + legacyDefaultToSide as defaultToSide, chosenSide, polylinePath, routePointsValue, + authoredStraightRouteAttrs, labelPoint, componentFill, componentText, arrowClassMap, - variantAccent + edgeLabelAccent } from '../shared/geometry.mjs'; const nodeTextFit = { @@ -42,7 +44,7 @@ const nodeTextFit = { }; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const { diagram: dataflow, template, outPath } = await loadDiagramWithBrandMarks({ +const { diagram: dataflow, template, outPath, sourceEvidence } = await loadDiagramWithBrandMarks({ rendererDir: __dirname, diagramType: 'dataflow', defaultExample: 'product-analytics.dataflow.json' @@ -259,7 +261,7 @@ function validateDataflow() { for (const rect of labelRects) { for (const node of nodes.values()) { if (rectsOverlap(rect, node, -2)) { - problems.push(`Label "${rect.label}" overlaps node "${node.id}" — adjust labelDx/labelDy/labelSegment or set labelAt.\n${suggestLabelObstacleFix(rect, rect.lx, rect.ly, node, 'node')}`); + problems.push(`Label "${rect.label}" overlaps node "${node.id}" — adjust labelDx/labelDy/labelSegment or set labelAt.\n${suggestLabelObstacleFix(rect, rect.lx, rect.ly, node, 'node', viewBox, nodes.values())}`); } } } @@ -280,6 +282,13 @@ function validateDataflow() { profile: dataflow.meta?.quality_profile, routeHint: 'adjust labelAt, labelDx, labelDy, or labelSegment; otherwise adjust the other flow route/via/channelX/channelY' })); + problems.push(...cleanLabelCanvasContainmentProblems({ + labels: labelRects, + viewBox, + diagramType: 'dataflow', + relationCollection: 'flows', + profile: dataflow.meta?.quality_profile, + })); const lastStageX = stageX(asArray(dataflow.stages).length - 1); if (lastStageX + layout.stageW / 2 > viewBox[0] - 24) { @@ -362,36 +371,83 @@ function pathFor(flow) { return routed; } +// Header measurement follows 276970789's #257, including the ordinal. +// Long titles wrap at the same legible floor instead of becoming invalid input. +function stageHeaderText(stage, index) { + return `${String(index + 1).padStart(2, '0')} / ${stage.label}`; +} + +function renderStageHeader(stage, index, cx) { + const text = stageHeaderText(stage, index); + const font = fittedNodeFontSize(text, layout.stageW, 9, 7); + const available = availableNodeTextWidth(layout.stageW); + const open = ``; + if (minimumNodeTextWidth(text, font) <= available) return `${open}${esc(text)}`; + const lines = []; + let line = ''; + // Prefer word boundaries; split oversized words and CJK by grapheme, without + // dropping whitespace or splitting a combining character/emoji sequence. + const segmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' }); + for (const word of text.match(/\s+|\S+/gu) || []) { + if (line && minimumNodeTextWidth(line + word, font) > available) { + lines.push(line); line = ''; + } + for (const { segment } of segmenter.segment(word)) { + if (line && minimumNodeTextWidth(line + segment, font) > available) { + lines.push(line); line = ''; + } + line += segment; + } + } + if (line) lines.push(line); + // Explicit node geometry is authoritative. Do not turn an old horizontal + // overflow into a new collision with nodes when the header area is packed. + const firstNodeY = Math.min(...[...nodes.values()].filter(node => node.stage === index).map(node => node.y), + viewBox[1] - layout.stageBottomPad); + const lastLineBottom = layout.stageY + 22 + (lines.length - 1) * (font + 4) + font * 0.3; + if (lastLineBottom > firstNodeY - 4) return `${open}${esc(text)}`; + const content = lines.length === 1 ? esc(text) : lines.map((line, i) => + `${esc(line)}`).join(''); + return `${open}${content}`; +} + function renderStage(stage, index) { const frame = compositionFrames[index]; const cx = stageX(index); return ` - ${String(index + 1).padStart(2, '0')} / ${esc(stage.label)}`; + ${renderStageHeader(stage, index, cx)}`; } function renderNode(node) { const fill = componentFill[node.type] || 'c-external'; const accent = componentText[node.type] || 't-muted'; const hasSub = node.sublabel != null && node.sublabel !== ''; + const labelFontSize = fittedNodeFontSize(node.label, brandLabelFitWidth(node, node.width), 10, 8); + const sublabelFontSize = fittedNodeFontSize(node.sublabel, node.width, nodeTextFit.sublabelPreferred, nodeTextFit.sublabelMinimum); + const tagFontSize = fittedNodeFontSize(node.tag, node.width, nodeTextFit.tagPreferred, nodeTextFit.tagMinimum); + const textRows = [{ text: node.label, font: labelFontSize, y: 21 }]; + if (hasSub) textRows.push({ text: node.sublabel, font: sublabelFontSize, y: 37 }); + if (node.tag) textRows.push({ text: node.tag, font: tagFontSize, y: node.height - 11 }); + const labelLayout = nodeLabelLayout({ width: node.width, height: node.height, rows: textRows, + brand: Boolean(brandMarkFor(node)), source: Boolean(sourceEvidence?.nodes?.[node.id]?.length) }); const sub = hasSub - ? `\n ${esc(node.sublabel)}` + ? `\n ${esc(node.sublabel)}` : ''; const tag = node.tag - ? `\n ${esc(node.tag)}` + ? `\n ${esc(node.tag)}` : ''; const stage = asArray(dataflow.stages)[node.stage]; const context = stage ? `${String(node.stage + 1).padStart(2, '0')} / ${stage.label}` : i18nText(dataflow.meta.locale, 'node.context.dataflow'); const brand = renderBrandMark(node, { x: node.x + node.width - 22, y: node.y + 6 }); - const labelFontSize = fittedNodeFontSize(node.label, brandLabelFitWidth(node, node.width), 10, 8); const passport = { kind: node.type, sublabel: node.sublabel, tag: node.tag, context, ...brandMetadataFor(node) }; return ` ${focusNodeTitle(node.label, passport)} - ${renderSemanticSigil(node.type, { x: node.x + 6, y: node.y + 6 })}${brand ? `\n ${brand}` : ''} - ${esc(node.label)}${sub}${tag} + ${renderSemanticSigil(node.type, { icon: node.icon, x: node.x + 6, y: node.y + labelLayout.sigilY, size: labelLayout.sigilSize })}${brand ? `\n ${brand}` : ''} + ${esc(node.label)}${sub}${tag} `; } @@ -399,7 +455,7 @@ function renderFlowPath(flow, index) { const [cls, marker] = arrowClassMap[flow.variant || 'default'] || arrowClassMap.default; const routed = pathFor(flow); const strokeWidth = flow.width || (flow.variant === 'emphasis' ? 1.8 : 1.4); - return ` `; + return ` `; } function renderFlowLabel(flow, index) { @@ -411,7 +467,7 @@ function renderFlowLabel(flow, index) { : ''; return ` - ${esc(flow.label)}${classification} + ${esc(flow.label)}${classification} `; } @@ -448,7 +504,11 @@ function renderLegend() { } function renderSvg() { - return ` + // Same default-canvas contract as lifecycle: 940x720 is below the 1.55 wide + // ratio, so without intrinsic-height the desktop Reader can neither narrow + // nor scroll it and every default dataflow fails the browser gate. + const readerFit = dataflow.meta?.viewBox ? '' : ' data-reader-fit="intrinsic-height"'; + return ` ${svgAccessibleText(dataflow.meta, 'dataflow')} ${renderDefinitions()} @@ -480,4 +540,5 @@ writeDiagram({ meta: dataflow.meta, svg: renderSvg(), cards: dataflow.cards, + sourceEvidence, }); diff --git a/packages/diagram-core/vendor/archify/renderers/lifecycle/README.md b/packages/diagram-core/vendor/archify/renderers/lifecycle/README.md index b66a7dd..8b8f4f8 100644 --- a/packages/diagram-core/vendor/archify/renderers/lifecycle/README.md +++ b/packages/diagram-core/vendor/archify/renderers/lifecycle/README.md @@ -10,8 +10,8 @@ node archify/renderers/lifecycle/render-lifecycle.mjs input.lifecycle.json outpu The renderer validates input against `archify/schemas/lifecycle.schema.json` with the bundled standalone validator. No dependency installation is required. -If `output.html` is omitted, the renderer uses `meta.output` from the JSON file -or falls back to `lifecycle.html` in the current working directory. +If `output.html` is omitted, the renderer uses the required `meta.output` value +from the JSON file. ## Input @@ -19,11 +19,11 @@ Lifecycle JSON files must set: ```json { - "schema_version": 1, + "schema_version": 2, "diagram_type": "lifecycle", "meta": { - "title": "Agent Run Lifecycle", - "viewBox": [980, 660] + "title": "Deployment Release Lifecycle", + "output": "deployment-release-lifecycle.html" }, "lanes": [], "states": [], @@ -32,12 +32,16 @@ Lifecycle JSON files must set: } ``` -Lane ids are semantic and reserved: a lane with id `main` is required and maps -to the top phase band; `terminal` maps to the bottom outcome band; every other -lane id (up to 4 lanes total) shares the single middle event band. The three -band headers render from your lane labels — the middle band joins the labels of -all event lanes with ` + `. A complete worked example lives at -`archify/examples/agent-run.lifecycle.json`. +`schema_version` is `1` or `2`; author new diagrams as `2`. Lane ids `main` +(required) and `terminal` are reserved in both versions. + +- **v2** renders one row per populated lane: `main` first, `terminal` last, + other lanes in `lanes[]` order, each titled in the left gutter. A complete + example lives at `archify/examples/deployment-release.lifecycle.json`. +- **v1** keeps the fixed three bands: `main` is the top phase band, + `terminal` the bottom outcome band, and every other lane shares the middle + event band, whose header joins their labels with ` + `. A complete example + lives at `archify/examples/agent-run.lifecycle.json`. The schema lives at: @@ -45,15 +49,55 @@ The schema lives at: archify/schemas/lifecycle.schema.json ``` -## Legend - -The default legend derives kinds from `states[].type`. Supported -`meta.legend.entries` keys, in stable order, are `start`, `active`, `waiting`, -`decision`, `success`, `failure`, `neutral`, and `external`. Labels and -visibility may be overridden through the shared legend contract; only kinds -backed by rendered states receive Semantic Legend controls. - -## Layout budget +## Legend and state marks + +State color follows `states[].type`: active and start are cyan, waiting amber, +decision purple, success green, failure rose, neutral and external slate. +Structure is drawn, not colored: every `start` state gets a UML initial marker +(a dot and arrow into its left side), and a state with no outgoing transition +gets a double border as a final state (in v1, a main state followed by +another main column is not final, because the implied rail continues). + +The default legend derives kinds from `states[].type`; the `start` entry shows +the initial marker, and a non-interactive `final` entry appears when a final +state exists. Supported `meta.legend.entries` keys, in stable order, are +`start`, `active`, `waiting`, `decision`, `success`, `failure`, `neutral`, and +`external`. Labels and visibility may be overridden through the shared legend +contract; only kinds backed by rendered states receive Semantic Legend +controls. + +State decorations share one top rail: the type sigil and `step` on the left, +the brand mark at the right corner, and the Viewer's runtime source badge just +left of the brand. Label layout reserves the badge's width whenever the state +has verified repository sources. + +## Layout budget (v2) + +| Item | Value | +|------|-------| +| Columns | `col` 0–4, one x grid shared by every row | +| Default state | 140×64 (text 11px label, 8px sublabel and tag) | +| Column gap | 64px, widened until a labelled same-row neighbour transition fits beside its line; all gaps shrink toward 44px when the canvas would exceed the desktop readability budget of the smallest state text | +| Row gap | at least 120px, opened further for the horizontal tracks its routes need | +| Canvas | sized from the rows, columns, and measured legend when `meta.viewBox` is omitted; an authored `viewBox` is honored and validated | + +Transitions without `via`, a channel, or a non-`auto` route use the v2 grid +router: neighbours in one row connect horizontally (a reciprocal pair runs as +two parallel lines), rows connect through the facing top/bottom sides with one +turn in a row gap, a state blocking a straight descent sends the route through +the empty corridor between columns, and an unlabelled route blocked in an +outer column loops around the outside of the grid. Each gap assigns tracks in +the order that minimizes crossings. There is no implied rail; a forward +transition between two `main` states without a `variant` renders as the +emphasized primary path. Showcase labels are ranked beside their line, then on +it, then outward past neighbouring parallels. + +Explicit `fromSide` / `toSide` values remain authoritative. Pins that match the +grid router's chosen sides keep its routes and adaptive row gaps. If an automatic +transition pins a different side, the scene uses the shared side-aware obstacle +planner, retaining the v2 state grid and shared port spreading. + +## Layout budget (v1) | Band | Lane id | Top y | Column centers | Default state | |------|---------|-------|----------------|---------------| @@ -81,16 +125,28 @@ furthest occupied phase column. Route presets for transitions: `straight`, `via` points, or the default `auto`. Multi-segment transitions get rounded corners; tune them with `cornerRadius` (default 10, `0` for sharp bends). +Transition `label` and `note` are independently optional. A non-empty `note` +renders even when `label` is omitted or empty, using its existing secondary +text style on a single row and retaining the note's fine-detail visibility. +With both fields present, the note stays below the label. Notes participate in +automatic label placement, route-space reservation, and label collision checks; +the existing `labelAt`, `labelDx`, `labelDy`, and +`labelSegment` controls also position a note-only text block. + ## Design Rules - Treat lifecycle diagrams as a phase map, not a dense state-transition graph. -- Put the primary lifecycle on one horizontal rail using the `main` lane. +- Put the primary lifecycle on one horizontal row using the `main` lane; in v2, + author each step of it as a transition. +- In v2, place an interruption, recovery, or exit in the column of the state it + leaves so its transition drops straight down. - Use `step` labels for ordered phases, such as `01`, `02`, and `03`. - Use lower lanes only for interruptions, recovery, and terminal exits. - Keep transition labels out of the main SVG unless the label is essential; prefer node labels, tags, legend entries, and summary cards. -- Avoid diagonal and crossing lines. Terminal exits should drop vertically from - their source event whenever possible. +- Prefer axis-aligned lines and avoid crossings. Terminal exits should drop + vertically from their source event whenever possible. Explicit `straight` + routes remain supported; see the [authored routing contract](../../references/authoring-contract.md#executable-geometry-rules). - Use `success` for completion, `failure` for failure/terminal exits, `waiting` for pauses, and `decision` for quality gates. diff --git a/packages/diagram-core/vendor/archify/renderers/lifecycle/grid-routing.mjs b/packages/diagram-core/vendor/archify/renderers/lifecycle/grid-routing.mjs new file mode 100644 index 0000000..788cabe --- /dev/null +++ b/packages/diagram-core/vendor/archify/renderers/lifecycle/grid-routing.mjs @@ -0,0 +1,429 @@ +// Orthogonal router for schema_version 2 lifecycle diagrams. +// +// v2 states sit on a fixed grid: one row per lane and a shared column pitch, +// with empty gaps between rows and between columns. That structure lets +// every automatic transition use a small, predictable set of shapes instead +// of a general obstacle search: +// - neighbours in one row connect with a horizontal line; +// - other states in one row connect through the gap above (below for the +// first row); +// - states in different rows leave through the facing top/bottom side, +// turn once in a row gap, and enter the target's facing side; when a +// state blocks the straight descent, the route steps sideways through the +// empty corridor between two columns. +// Ports on each side are spread in the order of where their routes head, and +// the horizontal runs in each gap get their own tracks, ordered to minimize +// crossings. Reciprocal pairs therefore render as two parallel lines. + +const PORT_GUTTER = 16; +const PORT_SPACING = 30; +const SNAP_LIMIT = 16; +const TRACK_TOP_CLEARANCE = 18; +const TRACK_BOTTOM_CLEARANCE = 18; +const PREFERRED_TRACK_SPACING = 22; +const MAX_TRACK_SPACING = 24; +const CORRIDOR_SPACING = 10; +const EXHAUSTIVE_TRACK_LIMIT = 7; + +const opposite = { top: 'bottom', bottom: 'top', left: 'right', right: 'left' }; + +function permutations(items) { + if (items.length <= 1) return [items]; + return items.flatMap((item, index) => permutations([...items.slice(0, index), ...items.slice(index + 1)]) + .map((rest) => [item, ...rest])); +} + +export function createLifecycleGridRouter(states, transitions, { rowOf, columnXs }) { + const byRow = new Map(); + for (const state of states.values()) { + const row = rowOf(state); + if (!Number.isInteger(row)) continue; + if (!byRow.has(row)) byRow.set(row, []); + byRow.get(row).push(state); + } + const rows = [...byRow.keys()].sort((a, b) => a - b); + const rowTop = new Map(rows.map((row) => [row, Math.min(...byRow.get(row).map((s) => s.y))])); + const rowBottom = new Map(rows.map((row) => [row, Math.max(...byRow.get(row).map((s) => s.y + s.height))])); + const nextRow = (row) => rows.find((candidate) => candidate > row); + const previousRow = (row) => [...rows].reverse().find((candidate) => candidate < row); + + // Gap g sits below row g. The gap under the last row borders the legend, + // so it only receives tracks when nothing else is possible. + function gapBand(row) { + const below = nextRow(row); + const top = rowBottom.get(row) + TRACK_TOP_CLEARANCE; + const bottom = below === undefined ? rowBottom.get(row) + 40 : rowTop.get(below) - TRACK_BOTTOM_CLEARANCE; + return [top, Math.max(top, bottom)]; + } + + function blocksVertical(x, fromRow, toRow, exclude) { + const [low, high] = fromRow < toRow ? [fromRow, toRow] : [toRow, fromRow]; + return [...states.values()].some((state) => { + if (exclude.has(state.id)) return false; + const row = rowOf(state); + return row > low && row < high && x >= state.x - 6 && x <= state.x + state.width + 6; + }); + } + + function blocksHorizontal(from, to) { + const row = rowOf(from); + const [left, right] = from.cx < to.cx ? [from, to] : [to, from]; + return byRow.get(row).some((state) => state !== left && state !== right + && state.x < right.x && state.x + state.width > left.x + left.width + && state.y < Math.max(left.y + left.height, right.y + right.height) + && state.y + state.height > Math.min(left.y, right.y)); + } + + // The empty corridors between neighbouring columns. + const corridorXs = columnXs.slice(1).map((x, index) => (x + columnXs[index]) / 2); + const allStates = [...states.values()]; + const leftmostX = Math.min(...allStates.map((state) => state.cx)); + const rightmostX = Math.max(...allStates.map((state) => state.cx)); + const gridLeft = Math.min(...allStates.map((state) => state.x)); + const gridRight = Math.max(...allStates.map((state) => state.x + state.width)); + // The initial-state marker occupies a start state's left side. + function loopBlocked(from, to, side) { + if (side !== 'left') return false; + const [low, high] = [Math.min(rowOf(from), rowOf(to)), Math.max(rowOf(from), rowOf(to))]; + return allStates.some((state) => state.type === 'start' && Math.abs(state.cx - from.cx) < 1 + && rowOf(state) >= low && rowOf(state) <= high); + } + + // Plan: sides, the gap each horizontal run uses, and where each end heads. + const plans = new Map(); + for (const transition of transitions) { + const from = states.get(transition.from); + const to = states.get(transition.to); + if (!from || !to || from === to) continue; + const fromRow = rowOf(from); + const toRow = rowOf(to); + if (!Number.isInteger(fromRow) || !Number.isInteger(toRow)) continue; + const exclude = new Set([from.id, to.id]); + if (fromRow === toRow) { + if (!blocksHorizontal(from, to)) { + const fromSide = to.cx > from.cx ? 'right' : 'left'; + plans.set(transition, { kind: 'horizontal', from, to, fromSide, toSide: opposite[fromSide] }); + } else { + const gapRow = previousRow(fromRow); + const useAbove = gapRow !== undefined; + const side = useAbove ? 'top' : 'bottom'; + plans.set(transition, { + kind: 'channel', from, to, fromSide: side, toSide: side, + runs: [{ gap: useAbove ? gapRow : fromRow, legs: useAbove ? ['down', 'down'] : ['up', 'up'] }], + }); + } + continue; + } + const down = toRow > fromRow; + const fromSide = down ? 'bottom' : 'top'; + const toSide = down ? 'top' : 'bottom'; + const gapNearTarget = down ? previousRow(toRow) : toRow; + const gapNearSource = down ? fromRow : previousRow(fromRow); + const legs = down ? ['up', 'down'] : ['down', 'up']; + if (!blocksVertical(from.cx, fromRow, toRow, exclude) && Math.abs(from.cx - to.cx) < 1) { + plans.set(transition, { kind: 'vertical', from, to, fromSide, toSide, runs: [{ gap: gapNearTarget, legs }] }); + } else if (!blocksVertical(from.cx, fromRow, toRow, exclude)) { + plans.set(transition, { kind: 'channel', from, to, fromSide, toSide, runs: [{ gap: gapNearTarget, legs }] }); + } else if (!blocksVertical(to.cx, fromRow, toRow, exclude)) { + plans.set(transition, { kind: 'channel', from, to, fromSide, toSide, runs: [{ gap: gapNearSource, legs }] }); + } else if (!transition.label && !transition.note + && Math.abs(from.cx - to.cx) < 1 && (from.cx <= leftmostX || from.cx >= rightmostX) + && !loopBlocked(from, to, from.cx <= leftmostX ? 'left' : 'right')) { + // A blocked edge column loops around the outside of the grid, like a + // bracket, instead of weaving through the rows' interior corridors. + // The margin has no room for a label, so only unlabeled edges loop. + const side = from.cx <= leftmostX ? 'left' : 'right'; + plans.set(transition, { kind: 'loop', from, to, fromSide: side, toSide: side, side }); + } else { + const middle = (from.cx + to.cx) / 2; + const corridor = corridorXs + .filter((x) => !blocksVertical(x, fromRow, toRow, new Set())) + .sort((a, b) => Math.abs(a - middle) - Math.abs(b - middle))[0]; + plans.set(transition, corridor === undefined + ? { kind: 'channel', from, to, fromSide, toSide, runs: [{ gap: gapNearTarget, legs }] } + : { + kind: 'corridor', from, to, fromSide, toSide, corridor, + runs: [{ gap: gapNearSource, legs }, { gap: gapNearTarget, legs }], + }); + } + } + + // Corridor offsets: routes sharing one corridor run side by side. + const corridorUse = new Map(); + for (const plan of plans.values()) { + if (plan.kind !== 'corridor') continue; + const list = corridorUse.get(plan.corridor) || []; + list.push(plan); + corridorUse.set(plan.corridor, list); + } + for (const [x, list] of corridorUse) { + list.sort((a, b) => a.from.cx - b.from.cx || a.to.cx - b.to.cx); + list.forEach((plan, index) => { plan.corridorX = x + (index - (list.length - 1) / 2) * CORRIDOR_SPACING; }); + } + // Outer loops nest: a longer span sits further out so loops never cross. + for (const side of ['left', 'right']) { + const loops = [...plans.values()].filter((plan) => plan.kind === 'loop' && plan.side === side) + .sort((a, b) => Math.abs(rowOf(a.from) - rowOf(a.to)) - Math.abs(rowOf(b.from) - rowOf(b.to))); + loops.forEach((plan, index) => { + plan.loopX = side === 'left' ? gridLeft - 18 - index * CORRIDOR_SPACING : gridRight + 18 + index * CORRIDOR_SPACING; + }); + } + + // Where each end heads after leaving its side, used to order the ports. + function headingFor(plan, end) { + const self = end === 'source' ? plan.from : plan.to; + const other = end === 'source' ? plan.to : plan.from; + if (plan.kind === 'horizontal' || plan.kind === 'loop') return other.cy; + if (plan.kind === 'corridor') return plan.corridorX; + return other === self ? self.cx : other.cx; + } + + const sideEnds = new Map(); + for (const [transition, plan] of plans) { + for (const end of ['source', 'target']) { + const state = end === 'source' ? plan.from : plan.to; + const side = end === 'source' ? plan.fromSide : plan.toSide; + const key = `${state.id}:${side}`; + if (!sideEnds.has(key)) sideEnds.set(key, { state, side, ends: [] }); + // Movers in the positive direction (right/down) take the first slot so + // both ends of a reciprocal pair line up. + const positive = plan.kind === 'horizontal' + ? plan.to.cx > plan.from.cx + : rowOf(plan.to) > rowOf(plan.from) || (rowOf(plan.to) === rowOf(plan.from) && plan.to.cx > plan.from.cx); + sideEnds.get(key).ends.push({ transition, end, heading: headingFor(plan, end), positive }); + } + } + + const ports = new Map(); + for (const { state, side, ends } of sideEnds.values()) { + ends.sort((a, b) => a.heading - b.heading || Number(b.positive) - Number(a.positive)); + const horizontalSide = side === 'top' || side === 'bottom'; + const length = horizontalSide ? state.width : state.height; + const gutter = Math.min(PORT_GUTTER, length / 4); + const spacing = ends.length > 1 ? Math.min(PORT_SPACING, (length - gutter * 2) / (ends.length - 1)) : 0; + ends.forEach((entry, index) => { + const offset = (index - (ends.length - 1) / 2) * spacing; + const point = horizontalSide + ? [state.cx + offset, side === 'top' ? state.y : state.y + state.height] + : [side === 'left' ? state.x : state.x + state.width, state.cy + offset]; + const record = ports.get(entry.transition) || {}; + record[entry.end] = point; + ports.set(entry.transition, record); + }); + } + + // Straight connections whose spread ports landed a few px apart would + // otherwise need a jog shorter than a readable turn: move one end onto the + // other's line when that side still has room there. + function sideRange(state, side) { + return side === 'top' || side === 'bottom' + ? [state.x + PORT_GUTTER / 2, state.x + state.width - PORT_GUTTER / 2] + : [state.y + PORT_GUTTER / 2, state.y + state.height - PORT_GUTTER / 2]; + } + function portsOnSide(state, side, except) { + return (sideEnds.get(`${state.id}:${side}`)?.ends || []) + .filter((entry) => entry.transition !== except) + .map((entry) => ports.get(entry.transition)[entry.end]); + } + for (const [transition, plan] of plans) { + const record = ports.get(transition); + const axis = plan.kind === 'horizontal' ? 1 : 0; + const delta = Math.abs(record.source[axis] - record.target[axis]); + if (delta < 0.5 || delta >= SNAP_LIMIT || !(plan.kind === 'horizontal' || plan.kind === 'vertical' || plan.kind === 'channel')) continue; + for (const [end, fixed] of [['target', 'source'], ['source', 'target']]) { + const state = end === 'source' ? plan.from : plan.to; + const side = end === 'source' ? plan.fromSide : plan.toSide; + const value = record[fixed][axis]; + const [low, high] = sideRange(state, side); + const crowded = portsOnSide(state, side, transition).some((point) => Math.abs(point[axis] - value) < 10); + if (value >= low && value <= high && !crowded) { + record[end] = axis ? [record[end][0], value] : [value, record[end][1]]; + break; + } + } + } + + // Horizontal runs per gap, then tracks ordered to minimize crossings. + const runsByGap = new Map(); + for (const [transition, plan] of plans) { + if (plan.kind === 'horizontal' || plan.kind === 'loop') continue; + const { source, target } = ports.get(transition); + plan.runs.forEach((run, index) => { + const x1 = index === 0 ? source[0] : plan.corridorX; + const x2 = plan.kind === 'corridor' && index === 0 ? plan.corridorX : target[0]; + if (plan.kind !== 'corridor' && Math.abs(x1 - x2) < 0.5) return; + const entry = { transition, index, x1, x2, legs: run.legs }; + if (!runsByGap.has(run.gap)) runsByGap.set(run.gap, []); + runsByGap.get(run.gap).push(entry); + }); + } + + const trackY = new Map(); + const trackCounts = new Map(); + for (const [gap, runs] of runsByGap) { + const [top, bottom] = gapBand(gap); + // Greedy interval colouring keeps unrelated runs on shared tracks only + // when they do not overlap. + const sorted = [...runs].sort((a, b) => Math.min(a.x1, a.x2) - Math.min(b.x1, b.x2)); + const classes = []; + for (const run of sorted) { + const low = Math.min(run.x1, run.x2) - 8; + const high = Math.max(run.x1, run.x2) + 8; + let target = classes.find((members) => members.every((other) => ( + high < Math.min(other.x1, other.x2) - 8 || low > Math.max(other.x1, other.x2) + 8 + ))); + if (!target || runs.length <= EXHAUSTIVE_TRACK_LIMIT) { + target = []; + classes.push(target); + } + target.push(run); + } + const count = classes.length; + trackCounts.set(gap, count); + // The renderer sizes each gap for its track count; a fixed canvas that + // cannot grow compresses the tracks rather than leaving the gap. + const spacing = count > 1 ? Math.min(MAX_TRACK_SPACING, (bottom - top) / (count - 1)) : 0; + const center = (top + bottom) / 2; + const ys = classes.map((_, index) => center + (index - (count - 1) / 2) * spacing); + const crossings = (order) => { + const y = new Map(); + order.forEach((members, index) => members.forEach((run) => y.set(run, ys[index]))); + let total = 0; + for (const a of runs) { + for (const b of runs) { + if (a === b || a.transition === b.transition) continue; + const [low, high] = [Math.min(a.x1, a.x2), Math.max(a.x1, a.x2)]; + for (const [x, leg] of [[b.x1, b.legs[0]], [b.x2, b.legs[1]]]) { + // An up leg and a down leg on one x overlap when the down leg + // starts above where the up leg ends: that merges two routes. + for (const [ax, aLeg] of [[a.x1, a.legs[0]], [a.x2, a.legs[1]]]) { + if (Math.abs(ax - x) < 1 && aLeg === 'up' && leg === 'down' && y.get(b) < y.get(a)) total += 100; + } + if (x <= low + 0.5 || x >= high - 0.5) continue; + if ((leg === 'up' && y.get(a) < y.get(b)) || (leg === 'down' && y.get(a) > y.get(b))) total += 1; + } + } + } + return total; + }; + let best = classes; + let bestScore = crossings(best); + if (count <= EXHAUSTIVE_TRACK_LIMIT) { + for (const order of permutations(classes).slice(1)) { + const score = crossings(order); + if (score < bestScore) { + best = order; + bestScore = score; + } + } + } else { + // Too many tracks to enumerate: swap pairs while that still helps. + for (let improved = true; improved;) { + improved = false; + for (let i = 0; i < count && !improved; i += 1) { + for (let j = i + 1; j < count && !improved; j += 1) { + const order = [...best]; + [order[i], order[j]] = [order[j], order[i]]; + const score = crossings(order); + if (score < bestScore) { + best = order; + bestScore = score; + improved = true; + } + } + } + } + } + best.forEach((members, index) => members.forEach((run) => trackY.set(`${gap}:${run.index}:${transitions.indexOf(run.transition)}`, ys[index]))); + } + + const pathCache = new Map(); + function pointsFor(transition) { + const plan = plans.get(transition); + if (!plan) { + // Self transitions and unknown endpoints are rejected by validation; + // a degenerate stub keeps that diagnostic reachable. + const state = states.get(transition.from) || states.get(transition.to); + const point = state ? [state.x + state.width, state.cy] : [0, 0]; + return [point, point]; + } + const { source, target } = ports.get(transition); + if (plan.kind === 'horizontal') { + if (Math.abs(source[1] - target[1]) < 0.5) return [source, target]; + const x = (source[0] + target[0]) / 2; + return [source, [x, source[1]], [x, target[1]], target]; + } + if (plan.kind === 'loop') return [source, [plan.loopX, source[1]], [plan.loopX, target[1]], target]; + const trackFor = (index) => trackY.get(`${plan.runs[index].gap}:${index}:${transitions.indexOf(transition)}`); + if (plan.kind === 'corridor') { + const y1 = trackFor(0); + const y2 = trackFor(1); + return [source, [source[0], y1], [plan.corridorX, y1], [plan.corridorX, y2], [target[0], y2], target]; + } + if (Math.abs(source[0] - target[0]) < 0.5) return [source, target]; + const y = trackFor(0); + return [source, [source[0], y], [target[0], y], target]; + } + + // Ports of two routes can still line up across a gap so their vertical + // runs share one line. Nudge a turning route's end sideways on its side. + for (const transition of plans.keys()) pathCache.set(transition, pointsFor(transition)); + const verticals = (points) => points.slice(1).flatMap((end, index) => { + const start = points[index]; + if (Math.abs(start[0] - end[0]) >= 0.5 || Math.abs(start[1] - end[1]) < 0.5) return []; + return [{ x: start[0], low: Math.min(start[1], end[1]), high: Math.max(start[1], end[1]), index, last: index === points.length - 2 }]; + }); + for (let round = 0; round < 12; round += 1) { + const entries = [...pathCache.entries()]; + let conflict = null; + for (let i = 0; i < entries.length && !conflict; i += 1) { + for (let j = i + 1; j < entries.length && !conflict; j += 1) { + for (const left of verticals(entries[i][1])) { + const right = verticals(entries[j][1]).find((other) => Math.abs(other.x - left.x) < 1 + && Math.min(other.high, left.high) - Math.max(other.low, left.low) > 0.5); + if (right) { + conflict = [[entries[i][0], left], [entries[j][0], right]]; + break; + } + } + } + } + if (!conflict) break; + let moved = false; + for (const [transition, segment] of conflict) { + const plan = plans.get(transition); + const end = segment.index === 0 ? 'source' : segment.last ? 'target' : null; + if (!end || pathCache.get(transition).length < 4 || !['channel', 'corridor'].includes(plan.kind)) continue; + const state = end === 'source' ? plan.from : plan.to; + const side = end === 'source' ? plan.fromSide : plan.toSide; + const record = ports.get(transition); + const [low, high] = sideRange(state, side); + const x = [12, -12, 20, -20].map((delta) => record[end][0] + delta).find((candidate) => ( + candidate >= low && candidate <= high + && !portsOnSide(state, side, transition).some((point) => Math.abs(point[0] - candidate) < 10) + )); + if (x === undefined) continue; + record[end] = [x, record[end][1]]; + pathCache.set(transition, pointsFor(transition)); + moved = true; + break; + } + if (!moved) break; + } + + return { + // Height a gap below `row` needs for its tracks at a readable spacing. + gapHeight(row) { + const count = trackCounts.get(row) || 0; + return TRACK_TOP_CLEARANCE + TRACK_BOTTOM_CLEARANCE + Math.max(0, count - 1) * PREFERRED_TRACK_SPACING; + }, + connectionSides(transition) { + const plan = plans.get(transition); + return plan ? { fromSide: plan.fromSide, toSide: plan.toSide } : { fromSide: 'right', toSide: 'right' }; + }, + pathFor(transition) { + if (!pathCache.has(transition)) pathCache.set(transition, pointsFor(transition)); + return pathCache.get(transition); + }, + }; +} diff --git a/packages/diagram-core/vendor/archify/renderers/lifecycle/render-lifecycle.mjs b/packages/diagram-core/vendor/archify/renderers/lifecycle/render-lifecycle.mjs index eb7922c..91904ad 100644 --- a/packages/diagram-core/vendor/archify/renderers/lifecycle/render-lifecycle.mjs +++ b/packages/diagram-core/vendor/archify/renderers/lifecycle/render-lifecycle.mjs @@ -2,11 +2,15 @@ import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { esc, renderDefinitions, renderSemanticSigil, textUnits } from '../shared/utils.mjs'; import { animateAttr, focusEdgeAttrs, focusNodeAttrs, focusNodeTitle, loadDiagramWithBrandMarks, writeDiagram, svgAccessibleText, svgRootAttrs } from '../shared/cli.mjs'; -import { throwDiagnosticProblems } from '../shared/diagnostics.mjs'; -import { resolveLegend, renderLegend as renderResolvedLegend } from '../shared/legend.mjs'; -import { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth } from '../shared/text-fit.mjs'; +import { recordDiagnostic, throwDiagnosticProblems } from '../shared/diagnostics.mjs'; +import { createRouter } from '../architecture/routing.mjs'; +import { createLifecycleGridRouter } from './grid-routing.mjs'; +import { placeAutomaticLabels, reservedLabelRect } from '../architecture/labels.mjs'; +import { legendFootprint, resolveLegend, renderLegend as renderResolvedLegend } from '../shared/legend.mjs'; +import { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth, nodeLabelLayout } from '../shared/text-fit.mjs'; import { brandLabelFitWidth, brandMarkFor, brandMetadataFor, brandTopRailProblem, renderBrandMark } from '../shared/brand-marks.mjs'; import { translateMessage as i18nText } from '../shared/i18n.mjs'; +import { DESKTOP_READER_DIAGRAM_WIDTH, MIN_PROJECTED_NODE_TEXT_PX } from '../shared/desktop-readability.mjs'; import { asArray, isFinitePoint, @@ -18,35 +22,57 @@ import { cleanBorderRunProblems, cleanRouteRhythmProblems, cleanLabelRouteClearanceProblems, + cleanLabelCanvasContainmentProblems, suggestLabelObstacleFix, suggestLabelPairFix, anchor, automaticPortSpread, - defaultFromSide, - defaultToSide, + legacyDefaultFromSide as defaultFromSide, + legacyDefaultToSide as defaultToSide, chosenSide, roundedPath, routePointsValue, + authoredStraightRouteAttrs, labelPoint, arrowClassMap, - variantAccent + edgeLabelAccent } from '../shared/geometry.mjs'; -const stateTextFit = { +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const { diagram: lifecycle, template, outPath, sourceEvidence } = await loadDiagramWithBrandMarks({ + rendererDir: __dirname, + diagramType: 'lifecycle', + defaultExample: 'agent-run.lifecycle.json' +}); + +// v2 sets state text one step larger; its canvas width is then budgeted +// from the smallest fitted text so the desktop Reader keeps it legible. +const stateTextFit = lifecycle.schema_version === 2 ? { + labelPreferred: 11, + labelMinimum: 9, + sublabelPreferred: 8, + sublabelMinimum: 7, + tagPreferred: 8, + tagMinimum: 7, + step: 8, +} : { + labelPreferred: 10, + labelMinimum: 8, sublabelPreferred: 7, sublabelMinimum: 6, tagPreferred: 7, tagMinimum: 6, + step: 7, }; -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const { diagram: lifecycle, template, outPath } = await loadDiagramWithBrandMarks({ - rendererDir: __dirname, - diagramType: 'lifecycle', - defaultExample: 'agent-run.lifecycle.json' -}); +// schema_version 2 replaces the three fixed bands (main/event/outcome, with +// non-main lanes sharing one band and lower columns offset by +2) with one +// row per populated lane on a shared 0..4 column grid. v1 keeps its exact +// state geometry; only presentation (colors, markers, legend, sigil side) +// is shared between versions. +const isV2 = lifecycle.schema_version === 2; +const authoredViewBox = lifecycle.meta?.viewBox; -const viewBox = lifecycle.meta?.viewBox || [980, 660]; const layout = { phaseY: 126, eventY: 278, @@ -62,12 +88,96 @@ const layout = { outcomeXs: [402, 556, 710] }; +const layoutV2 = { + stateW: 140, + stateH: 64, + marginX: 60, + minGap: 64, + floorGap: 44, + firstRowTop: 56, + rowPitch: 184, +}; + +function transitionLabelWidth(transition) { + const longestLine = Math.max(textUnits(transition.label), textUnits(transition.note || '')); + return Math.max(32, longestLine * 4.9 + 12); +} + +function stateFontSizes(state, width) { + return { + label: fittedNodeFontSize(state.label, brandLabelFitWidth(state, width), stateTextFit.labelPreferred, stateTextFit.labelMinimum), + sublabel: fittedNodeFontSize(state.sublabel, width, stateTextFit.sublabelPreferred, stateTextFit.sublabelMinimum), + tag: fittedNodeFontSize(state.tag, width, stateTextFit.tagPreferred, stateTextFit.tagMinimum), + }; +} + +// v2 column centers. A gap between two columns widens until the label of a +// same-row neighbour transition fits beside its line; the whole canvas then +// stays inside the desktop readability budget of its smallest state text. +const v2ColumnCenters = (() => { + if (!isV2) return []; + const authored = asArray(lifecycle.states); + const widths = [0, 1, 2, 3, 4].map((col) => Math.max( + layoutV2.stateW, ...authored.filter((state) => state.col === col).map((state) => state.width || 0), + )); + const cols = authored.map((state) => state.col).filter((col) => Number.isInteger(col) && col >= 0 && col <= 4); + const lastCol = cols.length ? Math.max(...cols) : 0; + const gaps = [0, 1, 2, 3].map(() => layoutV2.minGap); + const byId = new Map(authored.map((state) => [state.id, state])); + for (const transition of asArray(lifecycle.transitions)) { + const [from, to] = [byId.get(transition.from), byId.get(transition.to)]; + if (!(transition.label || transition.note) || !from || !to || from.lane !== to.lane + || !Number.isInteger(from.col) || !Number.isInteger(to.col) || Math.abs(from.col - to.col) !== 1) continue; + const gap = Math.min(from.col, to.col); + if (gap >= 0 && gap < 4) gaps[gap] = Math.max(gaps[gap], Math.ceil(transitionLabelWidth(transition) + 24)); + } + const smallestText = Math.min(stateTextFit.step, ...authored.flatMap((state) => ( + Object.values(stateFontSizes(state, state.width || layoutV2.stateW)) + ))); + const budget = Math.floor(DESKTOP_READER_DIAGRAM_WIDTH * smallestText / MIN_PROJECTED_NODE_TEXT_PX); + const fixed = layoutV2.marginX * 2 + widths.slice(0, lastCol + 1).reduce((sum, width) => sum + width, 0); + const used = gaps.slice(0, lastCol); + const excess = fixed + used.reduce((sum, gap) => sum + gap, 0) - budget; + const slack = used.reduce((sum, gap) => sum + gap - layoutV2.floorGap, 0); + if (excess > 0 && slack > 0) { + const ratio = Math.min(1, excess / slack); + for (let index = 0; index < used.length; index += 1) { + gaps[index] = Math.floor(gaps[index] - (gaps[index] - layoutV2.floorGap) * ratio); + } + } + const centers = []; + let x = layoutV2.marginX; + for (let col = 0; col <= 4; col += 1) { + centers.push(x + widths[col] / 2); + x += widths[col] + (gaps[col] ?? 0); + } + return centers; +})(); + +// Rows render in authored lane order with `main` first and `terminal` last; +// lanes without states get no row and no title. +function laneRowOrder() { + const lanes = asArray(lifecycle.lanes); + const populated = new Set(asArray(lifecycle.states).map((state) => state.lane)); + const ordered = []; + if (populated.has('main')) ordered.push('main'); + for (const lane of lanes) { + if (lane.id !== 'main' && lane.id !== 'terminal' && populated.has(lane.id)) ordered.push(lane.id); + } + if (populated.has('terminal')) ordered.push('terminal'); + return ordered; +} + +const v2RowTop = new Map(isV2 + ? laneRowOrder().map((laneId, index) => [laneId, layoutV2.firstRowTop + index * layoutV2.rowPitch]) + : []); + const typeClass = { start: 'c-frontend', - active: 'c-backend', + active: 'c-frontend', waiting: 'c-cloud', - decision: 'c-security', - success: 'c-database', + decision: 'c-database', + success: 'c-backend', failure: 'c-security', neutral: 'c-external', external: 'c-external' @@ -75,29 +185,18 @@ const typeClass = { const textClass = { start: 't-frontend', - active: 't-backend', + active: 't-frontend', waiting: 't-cloud', - decision: 't-security', - success: 't-database', + decision: 't-database', + success: 't-backend', failure: 't-security', neutral: 't-muted', external: 't-muted' }; -function legendY() { - return viewBox[1] - 36; -} - -// Keep the authored state-placement contract independent from the measured -// legend's lower baseline. Moving legend chrome must not admit new state -// geometry into the reserved outcome/legend band. -function lifecycleAreaBottom() { - return viewBox[1] - 122; -} - // Lane semantics are fixed: lane id "main" maps to the top phase band, lane id // "terminal" maps to the bottom outcome band, and every other lane shares the -// middle event band (separated visually via yOffset). +// middle event band (separated visually via yOffset). v1 only. function bandFor(lane) { if (lane === 'main') return 'phase'; if (lane === 'terminal') return 'outcome'; @@ -105,17 +204,28 @@ function bandFor(lane) { } function measureState(state) { - const isPhase = bandFor(state.lane) === 'phase'; - const isOutcome = bandFor(state.lane) === 'outcome'; - const width = state.width || (isPhase ? layout.phaseW : isOutcome ? layout.outcomeW : layout.eventW); - const height = state.height || (isPhase ? layout.phaseH : isOutcome ? layout.outcomeH : layout.eventH); - const xs = isPhase ? layout.phaseXs : isOutcome ? layout.outcomeXs : layout.eventXs; - const cx = xs[state.col] ?? xs[xs.length - 1]; - const y = ( - isPhase ? layout.phaseY : - isOutcome ? layout.outcomeY : - layout.eventY - ) + (state.yOffset || 0); + let width; + let height; + let cx; + let y; + if (isV2) { + width = state.width || layoutV2.stateW; + height = state.height || layoutV2.stateH; + cx = v2ColumnCenters[state.col] ?? NaN; + y = (v2RowTop.get(state.lane) ?? NaN) + (state.yOffset || 0); + } else { + const isPhase = bandFor(state.lane) === 'phase'; + const isOutcome = bandFor(state.lane) === 'outcome'; + width = state.width || (isPhase ? layout.phaseW : isOutcome ? layout.outcomeW : layout.eventW); + height = state.height || (isPhase ? layout.phaseH : isOutcome ? layout.outcomeH : layout.eventH); + const xs = isPhase ? layout.phaseXs : isOutcome ? layout.outcomeXs : layout.eventXs; + cx = xs[state.col] ?? xs[xs.length - 1]; + y = ( + isPhase ? layout.phaseY : + isOutcome ? layout.outcomeY : + layout.eventY + ) + (state.yOffset || 0); + } return { ...state, width, @@ -128,7 +238,105 @@ function measureState(state) { } const states = new Map(asArray(lifecycle.states).map((state) => [state.id, measureState(state)])); +const plannedTransitions = asArray(lifecycle.transitions).filter(plannerRouted); +const v2Rows = laneRowOrder(); +const v2RowOf = (state) => (v2Rows.includes(state.lane) ? v2Rows.indexOf(state.lane) : undefined); +let useGridRouter = isV2; +if (isV2) { + // Route once to learn how many horizontal tracks each row gap carries, + // then open every gap to fit them before the final routing pass. + const probe = createLifecycleGridRouter(states, plannedTransitions, { + rowOf: v2RowOf, columnXs: v2ColumnCenters, + }); + // Compatible pins keep the grid layout. A conflicting pin sends the whole + // scene to the side-aware planner so all edges still share port spreading + // and obstacle reservations. + useGridRouter = plannedTransitions.every(transition => { + const sides = probe.connectionSides(transition); + return ['fromSide', 'toSide'].every(key => !transition[key] || transition[key] === 'auto' || transition[key] === sides[key]); + }); + let top = layoutV2.firstRowTop; + v2Rows.forEach((laneId, index) => { + const rowHeight = Math.max(layoutV2.stateH, ...[...states.values()] + .filter((state) => state.lane === laneId) + .map((state) => state.y + state.height - v2RowTop.get(laneId))); + v2RowTop.set(laneId, top); + top += rowHeight + Math.max(layoutV2.rowPitch - layoutV2.stateH, useGridRouter ? probe.gapHeight(index) : 0); + }); + for (const state of asArray(lifecycle.states)) states.set(state.id, measureState(state)); +} const laneLabels = new Map(asArray(lifecycle.lanes).map((lane) => [lane.id, lane.label])); +const authoredOutgoing = new Set(asArray(lifecycle.transitions).map((transition) => transition.from)); + +// A state with no authored outgoing transition is terminal in the UML sense. +// v1 main states rely on the implied phase rail, so a main state is only final +// at the furthest occupied main column; every other v1 lane is explicit. +function isFinal(state) { + if (authoredOutgoing.has(state.id)) return false; + if (isV2) return true; + if (bandFor(state.lane) !== 'phase') return true; + const mainCols = [...states.values()].filter((s) => bandFor(s.lane) === 'phase').map((s) => s.col); + return state.col === Math.max(...mainCols); +} + +const LEGEND_CATALOG = [ + 'start', + 'active', + 'waiting', + 'decision', + 'success', + 'failure', + 'neutral', + 'external', +].map((kind) => ({ + kind, + label: i18nText(lifecycle.meta.locale, `legend.lifecycle.${kind}`), + swatchWidth: kind === 'start' ? 26 : undefined, +})); + +// Entries exist before the canvas so an auto-sized v2 viewBox can reserve the +// measured legend rows below the last row instead of painting over them. +// The structural `final` entry explains the double border; it follows the +// kind entries and disappears with them, so a hidden legend stays empty. +function legendCatalog() { + const presentKinds = new Set([...states.values()].map((state) => state.type)); + const entries = resolveLegend(lifecycle.meta?.legend, LEGEND_CATALOG, presentKinds); + if (!entries.length || ![...states.values()].some(isFinal)) return entries; + return [...entries, { + kind: 'final', + label: i18nText(lifecycle.meta.locale, 'legend.lifecycle.final'), + interactive: false, + present: true, + swatchWidth: 16, + }]; +} + +const resolvedLegendEntries = legendCatalog(); + +let viewBox; +if (isV2 && !authoredViewBox) { + const finite = [...states.values()]; + const maxRight = Math.max(0, ...finite.map((state) => state.cx + state.width / 2).filter(Number.isFinite)); + const width = Math.max(640, Math.ceil(maxRight + layoutV2.marginX)); + const footprint = legendFootprint(resolvedLegendEntries, { width: width - 80 }); + const statesBottom = Math.max(0, ...finite.map((state) => state.y + state.height).filter(Number.isFinite)); + viewBox = [width, Math.ceil(statesBottom + footprint.extraHeight + 96)]; +} else { + viewBox = authoredViewBox || [980, 660]; +} + +const legendExtraHeight = legendFootprint(resolvedLegendEntries, { width: viewBox[0] - 80 }).extraHeight; + +function legendY() { + return viewBox[1] - 36; +} + +// Keep the authored state-placement contract independent from the measured +// legend's lower baseline. Moving legend chrome must not admit new state +// geometry into the reserved outcome/legend band. +function lifecycleAreaBottom() { + return isV2 ? viewBox[1] - legendExtraHeight - 96 : viewBox[1] - 122; +} const stateSteps = new Map(); for (const [index, transition] of asArray(lifecycle.transitions).entries()) { if (!stateSteps.has(transition.from)) stateSteps.set(transition.from, index); @@ -144,14 +352,17 @@ function validateLifecycle() { // The three bands are fixed at y=112/264/436. Preserve the original // outcome/legend reserve even though measured legend rows now sit lower. - if (lifecycleAreaBottom() + 4 < 448) { + // v2 derives its canvas from rendered rows, so the floor does not apply. + if (!isV2 && lifecycleAreaBottom() + 4 < 448) { problems.push(`viewBox height ${viewBox[1]} is too short for the fixed band layout — set meta.viewBox[1] to at least 566.`); } const laneIds = new Set(asArray(lifecycle.lanes).map((lane) => lane.id)); if (laneIds.size !== asArray(lifecycle.lanes).length) problems.push('Lane ids must be unique.'); if (!laneIds.has('main')) { - problems.push('Lifecycle diagrams need a lane with id "main" (the phase rail). Lane ids "main" and "terminal" are reserved: "main" maps to the top phase band, "terminal" to the bottom outcome band, and all other lanes share the middle event band.'); + problems.push(isV2 + ? 'Lifecycle diagrams need a lane with id "main" (the first row). Lane ids "main" and "terminal" are reserved: "main" renders as the first row, "terminal" as the last, and every other lane in authored order.' + : 'Lifecycle diagrams need a lane with id "main" (the phase rail). Lane ids "main" and "terminal" are reserved: "main" maps to the top phase band, "terminal" to the bottom outcome band, and all other lanes share the middle event band.'); } for (const state of states.values()) { @@ -159,25 +370,32 @@ function validateLifecycle() { problems.push(`State "${state.id}" uses unknown lane "${state.lane}".`); continue; } - const band = bandFor(state.lane); - const maxCol = band === 'phase' - ? layout.phaseXs.length - : band === 'outcome' - ? layout.outcomeXs.length - : layout.eventXs.length; - if (!Number.isInteger(state.col) || state.col < 0 || state.col >= maxCol) { - problems.push(`State "${state.id}" uses invalid column ${state.col} — the ${band} band has integer columns 0..${maxCol - 1}.`); - continue; + if (isV2) { + if (!Number.isInteger(state.col) || state.col < 0 || state.col > 4) { + problems.push(`State "${state.id}" uses invalid column ${state.col} — every lifecycle row has integer columns 0..4.`); + continue; + } + } else { + const band = bandFor(state.lane); + const maxCol = band === 'phase' + ? layout.phaseXs.length + : band === 'outcome' + ? layout.outcomeXs.length + : layout.eventXs.length; + if (!Number.isInteger(state.col) || state.col < 0 || state.col >= maxCol) { + problems.push(`State "${state.id}" uses invalid column ${state.col} — the ${band} band has integer columns 0..${maxCol - 1}.`); + continue; + } } if (!isFinitePoint(state.x, state.y, state.cx, state.cy)) { problems.push(`State "${state.id}" produced non-finite coordinates — check col, width, height, and yOffset are numbers.`); continue; } - if (state.x < 32 || state.x + state.width > viewBox[0] - 32) { - problems.push(`State "${state.id}" exceeds the horizontal bounds of the diagram — reduce state.width or increase meta.viewBox[0].`); + if (state.x < (isV2 ? 28 : 32) || state.x + state.width > viewBox[0] - (isV2 ? 28 : 32)) { + problems.push(`State "${state.id}" exceeds the horizontal bounds of the diagram — reduce state.width${isV2 ? ', lower its col,' : ''} or increase meta.viewBox[0].`); } - if (state.y < 64 || state.y + state.height > lifecycleAreaBottom()) { - problems.push(`State "${state.id}" exceeds the vertical lifecycle area — keep y between 64 and ${lifecycleAreaBottom()} (adjust yOffset or increase meta.viewBox[1]).`); + if (state.y < (isV2 ? 44 : 64) || state.y + state.height > lifecycleAreaBottom()) { + problems.push(`State "${state.id}" exceeds the vertical lifecycle area — keep y between ${isV2 ? 44 : 64} and ${lifecycleAreaBottom()} (adjust yOffset or increase meta.viewBox[1]).`); } const estLabelW = textUnits(state.label) * 6.2; if (estLabelW > state.width + 6) { @@ -200,13 +418,15 @@ function validateLifecycle() { } } - // All non-main/non-terminal lanes share the same y band, so the overlap - // check must run across lanes — not per-lane. + // v1: all non-main/non-terminal lanes share the same y band, so the overlap + // check must run across lanes — not per-lane. v2 gives each lane its own + // row, so only same-row neighbours can collide, but the shared check still + // covers custom widths and yOffset nudges. const allStates = [...states.values()]; for (let i = 0; i < allStates.length; i += 1) { for (let j = i + 1; j < allStates.length; j += 1) { if (rectsOverlap(allStates[i], allStates[j], 10)) { - problems.push(`States "${allStates[i].id}" and "${allStates[j].id}" are less than 10px apart — move one to another col or separate them with yOffset (lanes other than "main"/"terminal" share one band).`); + problems.push(`States "${allStates[i].id}" and "${allStates[j].id}" are less than 10px apart — move one to another col or separate them with yOffset${isV2 ? '.' : ' (lanes other than "main"/"terminal" share one band).'}`); } } } @@ -253,6 +473,8 @@ function validateLifecycle() { diagramType: 'lifecycle', relationCollection: 'transitions', profile: lifecycle.meta?.quality_profile, + // Planner routes render with the opaque crossover halo, like architecture. + crossingResolved: (left, right) => plannerRouted(left) && plannerRouted(right), routeHint: 'adjust route/via or channelX/channelY so the transitions use separate lifecycle corridors' })); problems.push(...cleanAmbiguousCorridorProblems({ @@ -286,19 +508,26 @@ function validateLifecycle() { routeHint: 'move route/via or channel coordinates so each lifecycle turn has a readable run-up' })); - const labelRects = []; - for (const [transitionIndex, transition] of asArray(lifecycle.transitions).entries()) { - if (!transition.label || !states.has(transition.from) || !states.has(transition.to)) continue; - const [lx, ly] = labelPoint(transition, pathFor(transition).points); - const longestLine = Math.max(textUnits(transition.label), textUnits(transition.note || '')); - const width = Math.max(32, longestLine * 4.9 + 12); - const height = transition.note ? 27 : 16; - labelRects.push({ relation: transition, relationIndex: transitionIndex, label: transition.label, x: lx - width / 2, y: ly - 11, width, height, lx, ly }); + const labelRects = transitionLabelRects(); + if (lifecycle.meta?.quality_profile === 'showcase') { + for (const rect of labelRects) { + for (const title of bandGeometry()) { + if (!rectsOverlap(rect, title)) continue; + const message = `Transition ${rect.relationIndex} label "${rect.label}" overlaps lifecycle band title "${title.label}" — move the label with labelAt/labelDx/labelDy/labelSegment or provide more space.`; + recordDiagnostic({ + code: 'composition/label-band-title-overlap', severity: 'error', message, + subject: { diagramType: 'lifecycle', collection: 'transitions', index: rect.relationIndex, from: rect.relation.from, to: rect.relation.to }, + evidence: { labelRect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height }, bandTitle: title }, + supportedFixes: ['move the transition label with labelAt/labelDx/labelDy/labelSegment while preserving its text'], + }); + problems.push(message); + } + } } for (const rect of labelRects) { for (const state of states.values()) { if (rectsOverlap(rect, state, -2)) { - problems.push(`Label "${rect.label}" overlaps state "${state.id}" — adjust labelDx/labelDy/labelSegment or set labelAt.\n${suggestLabelObstacleFix(rect, rect.lx, rect.ly, state, 'state')}`); + problems.push(`Label "${rect.label}" overlaps state "${state.id}" — adjust labelDx/labelDy/labelSegment or set labelAt.\n${suggestLabelObstacleFix(rect, rect.lx, rect.ly, state, 'state', viewBox, states.values())}`); } } } @@ -318,6 +547,13 @@ function validateLifecycle() { relationCollection: 'transitions', profile: lifecycle.meta?.quality_profile, })); + problems.push(...cleanLabelCanvasContainmentProblems({ + labels: labelRects, + viewBox, + diagramType: 'lifecycle', + relationCollection: 'transitions', + profile: lifecycle.meta?.quality_profile, + })); if (problems.length) { throwDiagnosticProblems('Lifecycle layout validation failed', problems, { @@ -371,7 +607,36 @@ function routeVia(transition, from, to, start, end, fromSide, toSide) { const pathCache = new Map(); +// A transition without via, channel, or a lifecycle route preset is routed by +// the obstacle-aware planner shared with architecture, so a first draft that +// leaves routing to the renderer does not cross unrelated states or produce +// micro jogs. Authored via/route/channel geometry keeps the lifecycle presets. +function plannerRouted(transition) { + return !transition.via + && (!transition.route || transition.route === 'auto') + && transition.channelX === undefined + && transition.channelY === undefined; +} + +// v2 states sit on a fixed row/column grid, so automatic transitions use the +// dedicated orthogonal grid router; v1 keeps the shared obstacle planner. +const planner = useGridRouter ? createLifecycleGridRouter(states, plannedTransitions, { + rowOf: v2RowOf, + columnXs: v2ColumnCenters, +}) : createRouter(states, plannedTransitions, { + labelRectFor: (transition, points, { routes, labels }) => ((transition.label || transition.note) ? reservedLabelRect({ + label: { relation: transition, label: transition.label || transition.note, ...transitionLabelBoxAt(transition, labelPoint(transition, points)) }, + points, + routes: routes.map((route, index) => ({ relationIndex: index, points: route })), + labels, + components: [...states.values()], + viewBox, + placementBottom: lifecycleAreaBottom(), + }) : null), +}); + function transitionSides(transition) { + if (plannerRouted(transition)) return planner.connectionSides(transition); const from = states.get(transition.from); const to = states.get(transition.to); return { @@ -380,12 +645,20 @@ function transitionSides(transition) { }; } -const automaticPorts = automaticPortSpread(lifecycle.transitions, states, { - sideFor: (transition, endpoint) => transitionSides(transition)[endpoint === 'source' ? 'fromSide' : 'toSide'], -}); +const automaticPorts = automaticPortSpread( + asArray(lifecycle.transitions).filter((transition) => !plannerRouted(transition)), + states, + { sideFor: (transition, endpoint) => transitionSides(transition)[endpoint === 'source' ? 'fromSide' : 'toSide'] }, +); function pathFor(transition) { if (pathCache.has(transition)) return pathCache.get(transition); + if (plannerRouted(transition)) { + let routed = planner.pathFor(transition); + if (useGridRouter) routed = { d: roundedPath(routed, transition.cornerRadius ?? 10), points: routed }; + pathCache.set(transition, routed); + return routed; + } const from = states.get(transition.from); const to = states.get(transition.to); const ports = automaticPorts.get(transition); @@ -406,45 +679,116 @@ function pathFor(transition) { return routed; } -function bandTitles() { +const resolvedLabelPoints = new Map(); + +function transitionLabelBox(transition) { + return transitionLabelBoxAt( + transition, + resolvedLabelPoints.get(transition) || labelPoint(transition, pathFor(transition).points), + ); +} + +function transitionLabelBoxAt(transition, [lx, ly]) { + const width = transitionLabelWidth(transition); + const height = transition.label && transition.note ? 27 : 16; + return { x: lx - width / 2, y: ly - 11, width, height, lx, ly }; +} + +function transitionLabelRects() { + const rects = []; + for (const [relationIndex, transition] of asArray(lifecycle.transitions).entries()) { + if (!(transition.label || transition.note) || !states.has(transition.from) || !states.has(transition.to)) continue; + rects.push({ relation: transition, relationIndex, label: transition.label || transition.note, ...transitionLabelBox(transition) }); + } + return rects; +} + +// Showcase drafts leave label positions to the renderer too: move an unpinned +// label off other routes and states instead of reporting a clearance defect. +if (lifecycle.meta?.quality_profile === 'showcase') { + const placed = placeAutomaticLabels({ + labels: transitionLabelRects(), + routes: asArray(lifecycle.transitions).flatMap((transition, relationIndex) => ( + states.has(transition.from) && states.has(transition.to) + ? [{ relationIndex, points: pathFor(transition).points }] : [] + )), + components: [...states.values()], + titles: bandGeometry(), + viewBox, + placementBottom: lifecycleAreaBottom(), + keepFallbackNearRoute: isV2, + gridSweep: isV2, + }); + for (const rect of placed) resolvedLabelPoints.set(rect.relation, [rect.lx, rect.ly]); +} + +function bandGeometry() { + if (isV2) { + // One row header per rendered row, set vertically in the left gutter so + // routes entering a row never run through its title. + return laneRowOrder().map((laneId, index) => { + const cy = v2RowTop.get(laneId) + layoutV2.stateH / 2; + const label = laneLabels.get(laneId) || laneId; + const length = textUnits(label) * 6.2; + return { index, label, vertical: true, cx: 18, cy, x: 11, y: cy - length / 2, width: 14, height: length }; + }); + } const lanes = asArray(lifecycle.lanes); const mainLane = lanes.find((lane) => lane.id === 'main'); const terminalLane = lanes.find((lane) => lane.id === 'terminal'); const eventLanes = lanes.filter((lane) => lane.id !== 'main' && lane.id !== 'terminal'); + const populated = new Set([...states.values()].map((state) => bandFor(state.lane))); return [ mainLane?.label || 'Lifecycle phases', eventLanes.length ? eventLanes.map((lane) => lane.label).join(' + ') : 'Interruptions + recovery', terminalLane?.label || 'Outcomes' - ]; + ].map((title, index) => { + const baseline = [100, 252, 424][index]; + const label = `${String(index + 1).padStart(2, '0')} / ${title}`; + return { index, band: ['phase', 'event', 'outcome'][index], label, x: 72, y: baseline - 11, width: textUnits(label) * 6.2, height: 14, baseline }; + }).filter((band) => populated.has(band.band)); } function renderBands() { - const right = viewBox[0] - 72; - const titles = bandTitles(); - return ` - 01 / ${esc(titles[0])} - - 02 / ${esc(titles[1])} - - 03 / ${esc(titles[2])}`; + return bandGeometry().map((band) => (band.vertical + ? ` ${esc(band.label)}` + : ` + ${esc(band.label)}`)).join('\n'); } function renderState(state) { const fill = typeClass[state.type] || typeClass.neutral; const accent = textClass[state.type] || 't-muted'; const hasSub = state.sublabel != null && state.sublabel !== ''; + const { label: labelFontSize, sublabel: sublabelFontSize, tag: tagFontSize } = stateFontSizes(state, state.width); + const textRows = [{ text: state.label, font: labelFontSize, y: isV2 ? 23 : 21 }]; + if (hasSub) textRows.push({ text: state.sublabel, font: sublabelFontSize, y: isV2 ? 40 : 37 }); + if (state.tag) textRows.push({ text: state.tag, font: tagFontSize, y: state.height - (isV2 ? 12 : 11) }); + const hasBrand = Boolean(brandMarkFor(state)); + const hasSource = Boolean(sourceEvidence?.nodes?.[state.id]?.length); + const labelLayout = nodeLabelLayout({ width: state.width, height: state.height, rows: textRows, + brand: hasBrand, source: hasSource, side: 'left', step: state.step }); const sub = hasSub - ? `\n ${esc(state.sublabel)}` + ? `\n ${esc(state.sublabel)}` : ''; const tag = state.tag - ? `\n ${esc(state.tag)}` + ? `\n ${esc(state.tag)}` : ''; - const hasBrand = Boolean(brandMarkFor(state)); const step = state.step - ? `\n ${esc(state.step)}` + ? `\n ${esc(state.step)}` : ''; const brand = renderBrandMark(state, { x: state.x + state.width - 22, y: state.y + 6 }); - const labelFontSize = fittedNodeFontSize(state.label, brandLabelFitWidth(state, state.width), 10, 8); + // UML pseudo-state markers: start states get an initial dot + arrow into + // the left border; states with no authored outgoing transition get a double + // border. Both are decorations, not focus/relationship edges. + const initialMarker = state.type === 'start' + ? `\n ` + : ''; + const finalBorder = isFinal(state) + ? `\n ` + : ''; const passport = { kind: state.type, sublabel: state.sublabel, @@ -455,51 +799,75 @@ function renderState(state) { return ` ${focusNodeTitle(state.label, passport)} - - ${renderSemanticSigil(state.type, { x: hasBrand ? state.x + 6 : state.x + state.width - 17, y: state.y + 6 })}${brand ? `\n ${brand}` : ''}${step} - ${esc(state.label)}${sub}${tag} + ${finalBorder}${initialMarker} + ${renderSemanticSigil(state.type, { icon: state.icon, x: state.x + 6, y: state.y + labelLayout.sigilY, size: labelLayout.sigilSize })}${brand ? `\n ${brand}` : ''}${step} + ${esc(state.label)}${sub}${tag} `; } +// v2 replaces the implied phase rail with explicit topology: a forward +// transition between two main-lane states renders as the emphasized primary +// path unless the author chose another variant. +function effectiveVariant(transition) { + if (transition.variant) return transition.variant; + if (isV2) { + const from = states.get(transition.from); + const to = states.get(transition.to); + if (from?.lane === 'main' && to?.lane === 'main' && to.col > from.col) return 'emphasis'; + } + return 'default'; +} + function renderTransitionPath(transition, index) { - const [cls, marker] = arrowClassMap[transition.variant || 'default'] || arrowClassMap.default; + const variant = effectiveVariant(transition); + const [cls, marker] = arrowClassMap[variant] || arrowClassMap.default; const routed = pathFor(transition); - const strokeWidth = transition.width || (transition.variant === 'emphasis' ? 2 : 1.1); - return ` `; + const strokeWidth = transition.width || (variant === 'emphasis' ? (isV2 ? 1.6 : 2) : 1.1); + const automaticRoute = plannerRouted(transition); + const crossover = automaticRoute ? ' data-composition-crossover="halo"' : ''; + const edge = ` `; + if (!automaticRoute) return edge; + // Same presentation-only wrapper as architecture: the mask underlay lets two + // planner routes cross legibly while the viewer still sees one semantic edge. + const underlay = ` \n`; + return ` \n${underlay}${edge.replace(/^ /, ' ')}\n `; } function renderTransitionLabel(transition, index) { - if (!transition.label) return ''; - const routed = pathFor(transition); - const [lx, ly] = labelPoint(transition, routed.points); - const longestLine = Math.max(textUnits(transition.label), textUnits(transition.note || '')); - const labelW = Math.max(32, longestLine * 4.9 + 12); - const labelH = transition.note ? 27 : 16; + if (!(transition.label || transition.note)) return ''; + const { lx, ly, width: labelW, height: labelH } = transitionLabelBox(transition); + const label = transition.label + ? `\n ${esc(transition.label)}` + : ''; const note = transition.note - ? `\n ${esc(transition.note)}` + ? `\n ${esc(transition.note)}` : ''; - return ` - - ${esc(transition.label)}${note} + return ` + ${label}${note} `; } -const LEGEND_CATALOG = [ - 'start', - 'active', - 'waiting', - 'decision', - 'success', - 'failure', - 'neutral', - 'external', -].map((kind) => ({ kind, label: i18nText(lifecycle.meta.locale, `legend.lifecycle.${kind}`) })); +// UML initial pseudo-state: a filled dot and a short arrow ending at `tipX`. +function initialMarkerShape(dotX, tipX, y) { + return ``; +} + +function renderSwatch(entry) { + // `start` is structural, not a color: its swatch is the same initial + // pseudo-state marker drawn on the canvas. `final` is a non-interactive + // structural entry (a double-border rect) appended when a final state exists. + if (entry.kind === 'start') { + return initialMarkerShape(entry.x + 4.5, entry.x + 24, entry.baseline - 3.5); + } + if (entry.kind === 'final') { + return ``; + } + return ``; +} function renderLegend() { - const presentKinds = new Set([...states.values()].map((state) => state.type)); - const entries = resolveLegend(lifecycle.meta?.legend, LEGEND_CATALOG, presentKinds); return renderResolvedLegend({ - entries, + entries: resolvedLegendEntries, locale: lifecycle.meta.locale, layout: { x: 40, @@ -509,21 +877,29 @@ function renderLegend() { unfit: lifecycle.meta?.legend === undefined ? 'hide' : 'error', diagramType: 'lifecycle', }, - renderSwatch: (entry) => ``, + renderSwatch, }); } +// v1 only: the implied emphasis line behind main states. v2 topology is fully +// explicit, so the rail would double the authored forward transitions. function renderLifecycleRail() { + if (isV2) return ''; const mainCols = [...states.values()] .filter((state) => bandFor(state.lane) === 'phase') .map((state) => state.col); if (!mainCols.length) return ''; - const railEnd = layout.phaseXs[Math.max(...mainCols)] + 38; - return ` `; + const railEnd = layout.phaseXs[mainCols.reduce((max, col) => Math.max(max, col))] + 38; + return ` `; } function renderSvg() { - return ` + // A renderer-sized canvas declares the intrinsic-height fit exactly like + // architecture: the default 980x660 band layout is below the 1.55 wide + // ratio, so without this the desktop Reader could neither narrow it nor + // scroll it and every default lifecycle failed the browser gate. + const readerFit = lifecycle.meta?.viewBox ? '' : ' data-reader-fit="intrinsic-height"'; + return ` ${svgAccessibleText(lifecycle.meta, 'lifecycle')} ${renderDefinitions()} @@ -558,4 +934,5 @@ writeDiagram({ meta: lifecycle.meta, svg: renderSvg(), cards: lifecycle.cards, + sourceEvidence, }); diff --git a/packages/diagram-core/vendor/archify/renderers/sequence/README.md b/packages/diagram-core/vendor/archify/renderers/sequence/README.md index 82cfa16..8a25f1e 100644 --- a/packages/diagram-core/vendor/archify/renderers/sequence/README.md +++ b/packages/diagram-core/vendor/archify/renderers/sequence/README.md @@ -10,8 +10,8 @@ node archify/renderers/sequence/render-sequence.mjs input.sequence.json output.h The renderer validates input against `archify/schemas/sequence.schema.json` with the bundled standalone validator. No dependency installation is required. -If `output.html` is omitted, the renderer uses `meta.output` from the JSON file -or falls back to `sequence.html` in the current working directory. +If `output.html` is omitted, the renderer uses the required `meta.output` value +from the JSON file. ## Input @@ -23,6 +23,7 @@ Sequence JSON files must set: "diagram_type": "sequence", "meta": { "title": "Cache Miss Request Sequence", + "output": "cache-miss-request.html", "viewBox": [920, 760] }, "participants": [], @@ -52,20 +53,28 @@ order, are `emphasis`, `return`, `security`, `dashed`, and `default`. These are visual message keys, not Semantic Lens controls; label/visibility overrides do not create edge facts. +The legend sits below all timeline content: the last message and its note, +activation bars, and segment frames, with a 12px gap. Without `meta.viewBox` +the canvas grows to keep that gap. With an authored `viewBox` that is too short, +`showcase` fails with the exact height to set, and `standard` hides the implicit +legend rather than drawing it over content. Lifelines stop above the legend. +Message labels use their line's color; gray default and return lines keep the +muted text color. + ## Layout budget | Constant | Value | |----------|-------| -| viewBox | default `[920, 760]`; schema minimum `[480, 480]` | +| viewBox | default `[920, 760]`, taller when late content needs legend room; schema minimum `[480, 480]` | | Participant boxes | `fixed` (default): 86×54 at y 72; `spread`: viewBox-relative width from 86px up to 190px | | Participant columns | `fixed`: centers at x = 62 + index×108; `spread`: columns distribute across the available viewBox width | | Participant count | the last box must end at or before width − 40; layouts that cannot fit fail closed | -| Lifelines | from y 142 down to height − 65; band must be ≥120px tall | +| Lifelines | from y 142 down to height − 65 (drawn to just above the legend); band must be ≥120px tall | | Message `y` range | `[160, height − 83]` | | Message spacing | ≥28px vertical between messages that share horizontal space | | Arrow span | ≥60px horizontal between the two participants | | Segments | y pixel ranges with `to > from`, inside `[72, lifeline bottom + 20]` | -| Legend row | y = height − 54 | +| Legend | last row baseline at height − 54; extra rows wrap upward and stay 12px below the timeline content | `segments[].from/to` and `activations[].from/to` are y pixel coordinates, not participant ids; activations also require `to > from`. @@ -79,6 +88,12 @@ participant labels do not fit the fixed 86px boxes. Spread derives box width and column distance from the viewBox while preserving participant order, lifelines, and message semantics. +The artifact checker reports `composition.sequenceColumnSpace` from the rendered +participants, routes and text. A large unused right-hand region in a fixed layout +can produce an `inspect-sequence-width` recommendation in `finalize`; it is advice, +not a new warning or failure. See [Sequence width review](../../references/delivery-contract.md#sequence-width-review) +for the bounded authoring repair and explicit-fixed/legacy preservation rules. + ## Design Rules - Put participants across the top, ordered by the story the reader should diff --git a/packages/diagram-core/vendor/archify/renderers/sequence/render-sequence.mjs b/packages/diagram-core/vendor/archify/renderers/sequence/render-sequence.mjs index 1cfc032..808db62 100644 --- a/packages/diagram-core/vendor/archify/renderers/sequence/render-sequence.mjs +++ b/packages/diagram-core/vendor/archify/renderers/sequence/render-sequence.mjs @@ -3,8 +3,8 @@ import { fileURLToPath } from 'node:url'; import { esc, renderDefinitions, renderSemanticSigil, textUnits } from '../shared/utils.mjs'; import { animateAttr, focusEdgeAttrs, focusNodeAttrs, focusNodeTitle, loadDiagramWithBrandMarks, writeDiagram, svgAccessibleText, svgRootAttrs } from '../shared/cli.mjs'; import { throwDiagnosticProblems } from '../shared/diagnostics.mjs'; -import { resolveLegend, renderLegend as renderResolvedLegend } from '../shared/legend.mjs'; -import { componentFill, arrowClassMap, rectsOverlap, cleanFlowProblems, cleanCrossingProblems, cleanAmbiguousCorridorProblems, cleanBorderRunProblems, cleanRouteRhythmProblems, cleanLabelRouteClearanceProblems, routePointsValue, asArray, isFinitePoint } from '../shared/geometry.mjs'; +import { legendFootprint, measureLegend, resolveLegend, renderLegend as renderResolvedLegend } from '../shared/legend.mjs'; +import { componentFill, arrowClassMap, rectsOverlap, cleanFlowProblems, cleanCrossingProblems, cleanAmbiguousCorridorProblems, cleanBorderRunProblems, cleanRouteRhythmProblems, cleanLabelRouteClearanceProblems, cleanLabelCanvasContainmentProblems, routePointsValue, asArray, isFinitePoint, edgeLabelAccent } from '../shared/geometry.mjs'; import { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth } from '../shared/text-fit.mjs'; import { brandLabelFitWidth, brandMetadataFor, brandTopRailProblem, renderBrandMark } from '../shared/brand-marks.mjs'; import { translateMessage as i18nText } from '../shared/i18n.mjs'; @@ -15,13 +15,52 @@ const participantTextFit = { }; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const { diagram: sequence, template, outPath } = await loadDiagramWithBrandMarks({ +const { diagram: sequence, template, outPath, sourceEvidence } = await loadDiagramWithBrandMarks({ rendererDir: __dirname, diagramType: 'sequence', defaultExample: 'cache-miss-request.sequence.json' }); -const viewBox = sequence.meta?.viewBox || [920, 760]; +const LEGEND_CATALOG = [ + { kind: 'emphasis', className: 'a-emphasis', marker: 'arrowhead-emphasis', strokeWidth: 1.8 }, + { kind: 'return', className: 'a-default', marker: 'arrowhead', dash: '3,5' }, + { kind: 'security', className: 'a-security', marker: 'arrowhead-security' }, + { kind: 'dashed', className: 'a-dashed', marker: 'arrowhead-dashed' }, + { kind: 'default', className: 'a-default', marker: 'arrowhead' }, +].map((entry) => ({ + ...entry, + interactive: false, + swatchWidth: 34, + swatchGap: 9, + label: i18nText(sequence.meta.locale, `legend.sequence.${entry.kind}`), +})); + +function legendEntries() { + const presentKinds = new Set(asArray(sequence.messages).map((message) => message.variant || 'default')); + return resolveLegend(sequence.meta?.legend, LEGEND_CATALOG, presentKinds); +} + +// The legend sits below the timeline content: the last message and its note, +// activation bars, and segment frames. Its block starts LEGEND_CONTENT_GAP +// below that content; from the block top to the canvas bottom a one-row legend +// needs LEGEND_BLOCK_HEIGHT (title glyphs, row, and the 54px baseline inset). +const LEGEND_CONTENT_GAP = 12; +const LEGEND_BLOCK_HEIGHT = 86; +const contentBottom = Math.max( + 0, + ...asArray(sequence.messages).map((message) => message.y + (message.note ? 22 : 6)), + ...asArray(sequence.activations).map((activation) => activation.to), + ...asArray(sequence.segments).map((segment) => segment.to), +); +function legendRequiredHeight(width) { + const entries = legendEntries(); + if (!entries.length) return 0; + return Math.ceil(contentBottom + LEGEND_CONTENT_GAP + LEGEND_BLOCK_HEIGHT + + legendFootprint(entries, { width: width - 80 }).extraHeight); +} +// A renderer-sized canvas grows to keep the legend clear of late messages; +// an authored viewBox is honored and validated below. +const viewBox = sequence.meta?.viewBox || [920, Math.max(760, legendRequiredHeight(920))]; // The timeline scales with viewBox height: a taller viewBox gains message room, // a shorter one shrinks the readable band (validated below) instead of clipping. // `column_fit: "spread"` widens the lanes with the viewBox instead of keeping @@ -38,16 +77,24 @@ const colGap = columnFit === 'spread' && participantCount > 1 ? Math.max(108, (viewBox[0] - 40 - sideMargin - participantW) / (participantCount - 1)) : 108; +// Showcase is the fast-authoring default; standard retains legacy label geometry. +const readableMessages = sequence.meta?.quality_profile === 'showcase'; +const messageFontSize = readableMessages ? 11 : 9; +const messageUnitWidth = readableMessages ? 6.6 : 5.2; const layout = { topY: 72, participantW, - participantH: 54, + // Keep a separate top rail for the 11px semantic sigil and 16px brand mark. + // Literal labels retain their fitted font size and full authored wording. + participantH: 60, + participantLabelY: 36, + participantSublabelY: 50, lifelineTop: 142, lifelineBottom: viewBox[1] - 65, legendY: viewBox[1] - 54, leftX: columnFit === 'spread' ? sideMargin + participantW / 2 : sideMargin, colGap, - labelH: 16 + labelH: readableMessages ? 18 : 16 }; const participantBoxWidthNote = columnFit === 'spread' @@ -90,7 +137,7 @@ function messageGeometry(message) { function messageLabelBox(message, relationIndex = null) { const geometry = messageGeometry(message); if (!geometry) return null; - const width = Math.max(34, textUnits(message.label) * 5.2 + 12); + const width = Math.max(34, textUnits(message.label) * messageUnitWidth + 12); return { relation: message, relationIndex, @@ -275,6 +322,14 @@ function validateSequence() { profile: sequence.meta?.quality_profile, routeHint: 'spread the message y values, shorten the label, or reorder participants so the adjacent route stays visible' })); + problems.push(...cleanLabelCanvasContainmentProblems({ + labels: labelRects, + viewBox, + diagramType: 'sequence', + relationCollection: 'messages', + profile: sequence.meta?.quality_profile, + routeHint: 'shorten the label, reorder participants, or enlarge meta.viewBox', + })); for (const segment of asArray(sequence.segments)) { if (segment.to <= segment.from) { @@ -302,6 +357,14 @@ function validateSequence() { problems.push(`Participants exceed viewBox width — set meta.viewBox[0] to at least ${requiredWidth} or remove a participant.`); } + // Showcase must not silently drop the implicit legend because late content + // leaves no room for it; give the exact canvas height instead. + const legendHeight = legendRequiredHeight(viewBox[0]); + if (sequence.meta?.quality_profile === 'showcase' && sequence.meta?.legend === undefined + && legendHeight > viewBox[1] && !measureLegend(legendEntries(), legendLayout())) { + problems.push(`Sequence content ends at y=${contentBottom}, leaving no room for the legend below it — set meta.viewBox[1] to at least ${legendHeight} or omit meta.viewBox so the canvas grows.`); + } + if (problems.length) { throwDiagnosticProblems('Sequence layout validation failed', problems, { subject: { diagramType: 'sequence' }, @@ -313,7 +376,7 @@ function renderParticipant(participant) { const fill = componentFill[participant.type] || 'c-external'; const hasSub = participant.sublabel != null && participant.sublabel !== ''; const sub = hasSub - ? `\n ${esc(participant.sublabel)}` + ? `\n ${esc(participant.sublabel)}` : ''; const brand = renderBrandMark(participant, { x: participant.x + layout.participantW - 22, y: layout.topY + 6 }); const labelFontSize = fittedNodeFontSize(participant.label, brandLabelFitWidth(participant, layout.participantW), 11, 8); @@ -327,13 +390,20 @@ function renderParticipant(participant) { ${focusNodeTitle(participant.label, passport)} - ${renderSemanticSigil(participant.type, { x: participant.x + 6, y: layout.topY + 6 })}${brand ? `\n ${brand}` : ''} - ${esc(participant.label)}${sub} + ${renderSemanticSigil(participant.type, { icon: participant.icon, x: participant.x + 6, y: layout.topY + 6 })}${brand ? `\n ${brand}` : ''} + ${esc(participant.label)}${sub} `; } -function renderLifeline(participant) { - return ` `; +// Lifelines never enter the legend band. The legend is placed below all +// timeline content, so stopping above its title still reaches every message. +function lifelineEnd() { + const legend = measureLegend(legendEntries(), legendLayout()); + return legend?.titleY == null ? layout.lifelineBottom : Math.min(layout.lifelineBottom, legend.titleY - 22); +} + +function renderLifeline(participant, end) { + return ` `; } function renderSegment(segment, index) { @@ -361,17 +431,13 @@ function messageLabel(message, x1, x2) { const box = messageLabelBox(message); const center = box ? box.x + box.width / 2 : (x1 + x2) / 2; const y = message.y - 10; - const labelW = box?.width || Math.max(34, textUnits(message.label) * 5.2 + 12); - const accent = message.variant === 'security' - ? 't-security' - : message.variant === 'dashed' - ? 't-messagebus' - : message.variant === 'return' - ? 't-muted' - : 't-backend'; + const labelW = box?.width || Math.max(34, textUnits(message.label) * messageUnitWidth + 12); + // A colored line gets a label in the same color, as in the legend swatches. + // Gray lines (default and return) keep the readable muted text color. + const accent = ['emphasis', 'security', 'dashed'].includes(message.variant) ? edgeLabelAccent(message.variant) : 't-muted'; return ` - ${esc(message.label)} + ${esc(message.label)} `; } @@ -389,41 +455,36 @@ ${messageLabel(message, start, end)}${note} `; } -const LEGEND_CATALOG = [ - { kind: 'emphasis', className: 'a-emphasis', marker: 'arrowhead-emphasis', strokeWidth: 1.8 }, - { kind: 'return', className: 'a-default', marker: 'arrowhead', dash: '3,5' }, - { kind: 'security', className: 'a-security', marker: 'arrowhead-security' }, - { kind: 'dashed', className: 'a-dashed', marker: 'arrowhead-dashed' }, - { kind: 'default', className: 'a-default', marker: 'arrowhead' }, -].map((entry) => ({ - ...entry, - interactive: false, - swatchWidth: 34, - swatchGap: 9, - label: i18nText(sequence.meta.locale, `legend.sequence.${entry.kind}`), -})); + +function legendLayout() { + return { + x: 40, + baselineY: layout.legendY, + width: viewBox[0] - 80, + // The same content-based budget as legendRequiredHeight(): a wrapped + // legend may use any rows it needs as long as it stays below the content. + minTitleY: Math.max(layout.lifelineTop, contentBottom + LEGEND_CONTENT_GAP), + unfit: sequence.meta?.legend === undefined ? 'hide' : 'error', + diagramType: 'sequence', + }; +} function renderLegend() { - const presentKinds = new Set(asArray(sequence.messages).map((message) => message.variant || 'default')); - const entries = resolveLegend(sequence.meta?.legend, LEGEND_CATALOG, presentKinds); return renderResolvedLegend({ - entries, + entries: legendEntries(), locale: sequence.meta.locale, - layout: { - x: 40, - baselineY: layout.legendY, - width: viewBox[0] - 80, - minTitleY: layout.legendY - 30, - unfit: sequence.meta?.legend === undefined ? 'hide' : 'error', - diagramType: 'sequence', - }, + layout: legendLayout(), renderSwatch: (entry) => ``, }); } function renderSvg() { const participantList = [...participants.values()]; - return ` + // Same default-canvas contract as lifecycle: 920x760 is below the 1.55 wide + // ratio, so without intrinsic-height the desktop Reader can neither narrow + // nor scroll it and every default sequence fails the browser gate. + const readerFit = sequence.meta?.viewBox ? '' : ' data-reader-fit="intrinsic-height"'; + return ` ${svgAccessibleText(sequence.meta, 'sequence')} ${renderDefinitions()} @@ -434,7 +495,7 @@ ${renderDefinitions()} ${asArray(sequence.segments).map(renderSegment).join('\n\n')} -${participantList.map(renderLifeline).join('\n')} +${participantList.map((participant) => renderLifeline(participant, lifelineEnd())).join('\n')} ${asArray(sequence.activations).map(renderActivation).join('\n')} @@ -461,4 +522,5 @@ writeDiagram({ meta: sequence.meta, svg: renderSvg(), cards: sequence.cards, + sourceEvidence, }); diff --git a/packages/diagram-core/vendor/archify/renderers/shared/atomic-output.mjs b/packages/diagram-core/vendor/archify/renderers/shared/atomic-output.mjs new file mode 100644 index 0000000..8895d70 --- /dev/null +++ b/packages/diagram-core/vendor/archify/renderers/shared/atomic-output.mjs @@ -0,0 +1,1982 @@ +import { createHash, randomBytes } from 'node:crypto'; +import fs from 'node:fs'; +import path from 'node:path'; + +import { canonicalFuturePath } from './output-path.mjs'; + +function relation(status, code, details = {}) { + return { status, reason: { code, ...details } }; +} + +function filesystemFailure(code, error, details = {}) { + return relation('unknown', code, { + ...details, + ...(typeof error?.code === 'string' ? { systemCode: error.code } : {}), + ...(typeof error?.message === 'string' ? { message: error.message } : {}), + }); +} + +function entryType(metadata) { + if (metadata.isFile()) return 'file'; + if (metadata.isSymbolicLink()) return 'symbolic-link'; + if (metadata.isDirectory()) return 'directory'; + if (metadata.isFIFO()) return 'fifo'; + if (metadata.isSocket()) return 'socket'; + if (metadata.isBlockDevice()) return 'block-device'; + if (metadata.isCharacterDevice()) return 'character-device'; + return 'other'; +} + +// Windows lstat can fall back to directory enumeration when a file handle +// cannot be opened, and that fallback reports a synthetic link count of one. +// Treat handle-backed fstat as authoritative and fail closed when it cannot be +// reconciled with the no-follow path snapshots on either side of the open. +function captureRegularFileHandle(filePath, initial, subject) { + const pathKey = subject === 'target' + ? 'commitPath' + : subject === 'requested-entry' + ? 'requestedPath' + : 'candidatePath'; + if (initial.ino === 0n) { + return relation('unknown', `${subject}-identity-unavailable`, { [pathKey]: filePath }); + } + let descriptor; + let handle; + let current; + let closeError; + try { + const noFollow = process.platform === 'win32' ? 0 : (fs.constants.O_NOFOLLOW || 0); + const nonBlock = fs.constants.O_NONBLOCK || 0; + descriptor = fs.openSync(filePath, fs.constants.O_RDONLY | noFollow | nonBlock); + handle = fs.fstatSync(descriptor, { bigint: true }); + current = fs.lstatSync(filePath, { bigint: true }); + } catch (error) { + return filesystemFailure(`${subject}-handle-inspection-failed`, error, { + [pathKey]: filePath, + }); + } finally { + if (descriptor !== undefined) { + try { + fs.closeSync(descriptor); + } catch (error) { + closeError = error; + } + } + } + if (closeError) { + return filesystemFailure(`${subject}-handle-close-failed`, closeError, { + [pathKey]: filePath, + }); + } + if (!handle.isFile() || !current.isFile() + || handle.ino === 0n || current.ino === 0n + || handle.dev !== initial.dev || handle.ino !== initial.ino + || current.dev !== handle.dev || current.ino !== handle.ino) { + return relation('unknown', `${subject}-changed-during-inspection`, { + [pathKey]: filePath, + }); + } + if (handle.nlink === 0n) { + return relation('unknown', `${subject}-link-count-unavailable`, { + [pathKey]: filePath, + }); + } + if (handle.nlink !== 1n) { + return relation('unsupported', `${subject}-hardlinked`, { + [pathKey]: filePath, + links: handle.nlink.toString(), + }); + } + return { status: 'captured', metadata: handle }; +} + +const regularFileBindings = new WeakMap(); +const regularFileBindingGroups = new Map(); +const digestChunkBytes = 64 * 1024; +const removalCleanupSignal = new Int32Array(new SharedArrayBuffer(4)); +const removalCleanupAttempts = 10; +const publicationRecoveryRecordName = 'publication-recovery-v1.json'; +const publicationRecoveryRecordVersion = 1; +const publicationRecoveryRecordMaxBytes = 16 * 1024; + +export function removeEmptyDirectoryWithRetry(directory, { retry = true } = {}) { + const attempts = retry ? removalCleanupAttempts : 1; + let failure; + for (let attempt = 0; attempt < attempts; attempt += 1) { + try { + fs.rmdirSync(directory); + return; + } catch (error) { + failure = error; + // SMB can acknowledge unlink before a following directory removal sees + // the deleted entry disappear. Retrying rmdir is claimant-safe: a real + // entry keeps the directory non-empty and is never removed recursively. + if (error?.code !== 'ENOTEMPTY' || attempt === attempts - 1) break; + Atomics.wait( + removalCleanupSignal, + 0, + 0, + Math.min(5 * (2 ** attempt), 250), + ); + } + } + throw failure; +} + +function validExpectedLinks(value) { + return Number.isSafeInteger(value) && value > 0; +} + +function validateBindingExpectations(options) { + const hasSha256 = options.expectedSha256 !== undefined; + const hasBytes = options.expectedBytes !== undefined; + const expectedIdentity = options.expectedIdentity; + if (hasSha256 !== hasBytes + || (hasSha256 && !/^[a-f\d]{64}$/i.test(options.expectedSha256)) + || (hasBytes && (!Number.isSafeInteger(options.expectedBytes) || options.expectedBytes < 0)) + || (options.expectedMode !== undefined + && (!Number.isSafeInteger(options.expectedMode) + || options.expectedMode < 0 + || options.expectedMode > 0o777)) + || (expectedIdentity !== undefined + && (typeof expectedIdentity?.device !== 'bigint' + || typeof expectedIdentity?.inode !== 'bigint' + || expectedIdentity.inode === 0n)) + || typeof options.includeContent !== 'boolean' + || !validExpectedLinks(options.expectedLinks)) { + return relation('unknown', 'invalid-regular-file-binding-expectation'); + } + return null; +} + +function descriptorDigest(descriptor, expectedSize, subject, filePath, includeContent) { + if (expectedSize < 0n || expectedSize > BigInt(Number.MAX_SAFE_INTEGER)) { + return relation('unknown', `${subject}-size-unavailable`, { filePath }); + } + const expectedBytes = Number(expectedSize); + const digest = createHash('sha256'); + let capturedContent; + let chunk; + try { + capturedContent = includeContent ? Buffer.allocUnsafe(expectedBytes) : null; + chunk = capturedContent + || Buffer.allocUnsafe(Math.min(digestChunkBytes, Math.max(1, expectedBytes))); + } catch (error) { + return filesystemFailure(`${subject}-content-inspection-failed`, error, { filePath }); + } + let bytes = 0; + try { + while (bytes < expectedBytes) { + const offset = includeContent ? bytes : 0; + const read = fs.readSync( + descriptor, + chunk, + offset, + Math.min(digestChunkBytes, chunk.byteLength - offset, expectedBytes - bytes), + bytes, + ); + if (read === 0) break; + digest.update(chunk.subarray(offset, offset + read)); + bytes += read; + } + } catch (error) { + return filesystemFailure(`${subject}-content-inspection-failed`, error, { filePath }); + } + return { + status: 'inspected', + sha256: digest.digest('hex'), + bytes, + ...(includeContent ? { buffer: capturedContent.subarray(0, bytes) } : {}), + }; +} + +function sameHandleState(left, right) { + return left.dev === right.dev + && left.ino === right.ino + && left.nlink === right.nlink + && left.mode === right.mode + && left.size === right.size + && left.mtimeNs === right.mtimeNs + && left.ctimeNs === right.ctimeNs; +} + +function inspectRegularFileDescriptor({ + descriptor, + filePath, + identity, + subject, + expectedLinks, + phase, + includeContent = false, +}) { + let beforeHandle; + let beforePath; + let afterHandle; + let afterPath; + let content; + try { + beforeHandle = fs.fstatSync(descriptor, { bigint: true }); + beforePath = fs.lstatSync(filePath, { bigint: true }); + } catch (error) { + return filesystemFailure(`${subject}-handle-${phase}-failed`, error, { filePath }); + } + if (!beforeHandle.isFile() || !beforePath.isFile()) { + return relation('unsupported', `${subject}-not-regular-file`, { + filePath, + entryType: entryType(beforePath), + }); + } + if (beforeHandle.ino === 0n || beforePath.ino === 0n) { + return relation('unknown', `${subject}-identity-unavailable`, { filePath }); + } + if (beforeHandle.dev !== identity.device + || beforeHandle.ino !== identity.inode + || beforePath.dev !== beforeHandle.dev + || beforePath.ino !== beforeHandle.ino) { + return relation(phase === 'inspection' ? 'unknown' : 'different', + `${subject}-${phase === 'inspection' ? 'changed-during-inspection' : 'identity-changed'}`, + { filePath }); + } + if (beforeHandle.nlink === 0n) { + return relation('unknown', `${subject}-link-count-unavailable`, { filePath }); + } + if (beforeHandle.nlink !== BigInt(expectedLinks)) { + if (beforeHandle.nlink > BigInt(expectedLinks)) { + return relation('unsupported', `${subject}-hardlinked`, { + filePath, + links: beforeHandle.nlink.toString(), + }); + } + return relation('different', `${subject}-link-count-changed`, { + filePath, + expectedLinks, + currentLinks: beforeHandle.nlink.toString(), + }); + } + content = descriptorDigest( + descriptor, + beforeHandle.size, + subject, + filePath, + includeContent, + ); + if (content.status !== 'inspected') return content; + try { + afterHandle = fs.fstatSync(descriptor, { bigint: true }); + afterPath = fs.lstatSync(filePath, { bigint: true }); + } catch (error) { + return filesystemFailure(`${subject}-handle-${phase}-failed`, error, { filePath }); + } + if (!afterHandle.isFile() || !afterPath.isFile() + || afterHandle.ino === 0n || afterPath.ino === 0n + || afterHandle.dev !== identity.device || afterHandle.ino !== identity.inode + || afterPath.dev !== afterHandle.dev || afterPath.ino !== afterHandle.ino) { + return relation(phase === 'inspection' ? 'unknown' : 'different', + `${subject}-${phase === 'inspection' ? 'changed-during-inspection' : 'identity-changed'}`, + { filePath }); + } + if (!sameHandleState(beforeHandle, afterHandle)) { + return relation('unknown', `${subject}-changed-during-${phase}`, { filePath }); + } + if (content.bytes !== Number(afterHandle.size)) { + return relation('unknown', `${subject}-changed-during-${phase}`, { filePath }); + } + return { status: 'inspected', metadata: afterHandle, content }; +} + +function closeCapturedDescriptor(descriptor, subject, filePath) { + try { + fs.closeSync(descriptor); + return null; + } catch (error) { + return filesystemFailure(`${subject}-handle-close-failed`, error, { filePath }); + } +} + +/** + * Capture a regular file through an open descriptor. The opaque binding keeps + * the descriptor alive so callers can prove that the same inode, mode and + * bytes are still named by either the original path or a deliberate hard-link + * publication path. Callers must release every successfully captured binding. + */ +export function captureRegularFileBinding(filePath, { + subject = 'file', + expectedSha256, + expectedBytes, + expectedMode, + expectedIdentity, + expectedLinks = 1, + includeContent = false, +} = {}) { + const options = { + expectedSha256, + expectedBytes, + expectedMode, + expectedIdentity, + expectedLinks, + includeContent, + }; + const invalid = validateBindingExpectations(options); + if (invalid) return invalid; + const resolvedPath = path.resolve(filePath); + let initial; + try { + initial = fs.lstatSync(resolvedPath, { bigint: true }); + } catch (error) { + return filesystemFailure(`${subject}-inspection-failed`, error, { filePath: resolvedPath }); + } + const type = entryType(initial); + if (type !== 'file') { + return relation('unsupported', `${subject}-not-regular-file`, { + filePath: resolvedPath, + entryType: type, + }); + } + if (initial.ino === 0n) { + return relation('unknown', `${subject}-identity-unavailable`, { filePath: resolvedPath }); + } + + let descriptor; + try { + const noFollow = process.platform === 'win32' ? 0 : (fs.constants.O_NOFOLLOW || 0); + const nonBlock = fs.constants.O_NONBLOCK || 0; + descriptor = fs.openSync(resolvedPath, fs.constants.O_RDONLY | noFollow | nonBlock); + } catch (error) { + return filesystemFailure(`${subject}-handle-inspection-failed`, error, { filePath: resolvedPath }); + } + const identity = { device: initial.dev, inode: initial.ino }; + if (expectedIdentity !== undefined + && (identity.device !== expectedIdentity.device + || identity.inode !== expectedIdentity.inode)) { + const closeFailure = closeCapturedDescriptor(descriptor, subject, resolvedPath); + return closeFailure || relation('different', `${subject}-identity-changed`, { + filePath: resolvedPath, + }); + } + const inspected = inspectRegularFileDescriptor({ + descriptor, + filePath: resolvedPath, + identity, + subject, + expectedLinks, + phase: 'inspection', + includeContent, + }); + if (inspected.status !== 'inspected') { + const closeFailure = closeCapturedDescriptor(descriptor, subject, resolvedPath); + return closeFailure || inspected; + } + const mode = Number(inspected.metadata.mode & 0o777n); + if (expectedMode !== undefined && mode !== expectedMode) { + const closeFailure = closeCapturedDescriptor(descriptor, subject, resolvedPath); + return closeFailure || relation('different', `${subject}-mode-changed`, { + filePath: resolvedPath, + expectedMode, + currentMode: mode, + }); + } + if (expectedSha256 !== undefined + && (inspected.content.sha256.toLowerCase() !== expectedSha256.toLowerCase() + || inspected.content.bytes !== expectedBytes)) { + const closeFailure = closeCapturedDescriptor(descriptor, subject, resolvedPath); + return closeFailure || relation('different', `${subject}-content-changed`, { + filePath: resolvedPath, + expectedSha256, + currentSha256: inspected.content.sha256, + expectedBytes, + currentBytes: inspected.content.bytes, + }); + } + + const identityKey = `${identity.device}:${identity.inode}`; + let cleanupGroup = regularFileBindingGroups.get(identityKey); + if (!cleanupGroup) { + cleanupGroup = { identityKey, bindings: 0, deferredCleanupDirectories: new Set() }; + regularFileBindingGroups.set(identityKey, cleanupGroup); + } + cleanupGroup.bindings += 1; + const binding = Object.freeze({}); + regularFileBindings.set(binding, { + descriptor, + filePath: resolvedPath, + subject, + expectedLinks, + cleanupGroup, + identity, + mode, + sha256: inspected.content.sha256, + bytes: inspected.content.bytes, + }); + return { + status: 'captured', + binding, + identity: { ...identity, mode, links: inspected.metadata.nlink }, + content: { + sha256: inspected.content.sha256, + bytes: inspected.content.bytes, + ...(includeContent ? { buffer: inspected.content.buffer } : {}), + }, + mode, + }; +} + +/** Verify a captured descriptor against its original or an alternate linked path. */ +export function verifyRegularFileBinding(binding, { filePath, expectedLinks } = {}) { + const captured = regularFileBindings.get(binding); + if (!captured) return relation('unknown', 'regular-file-binding-unavailable'); + const links = expectedLinks ?? captured.expectedLinks; + if (!validExpectedLinks(links)) { + return relation('unknown', 'invalid-regular-file-binding-expectation'); + } + const verificationPath = path.resolve(filePath ?? captured.filePath); + const inspected = inspectRegularFileDescriptor({ + descriptor: captured.descriptor, + filePath: verificationPath, + identity: captured.identity, + subject: captured.subject, + expectedLinks: links, + phase: 'verification', + }); + if (inspected.status !== 'inspected') return inspected; + const mode = Number(inspected.metadata.mode & 0o777n); + if (mode !== captured.mode) { + return relation('different', `${captured.subject}-mode-changed`, { + filePath: verificationPath, + previousMode: captured.mode, + currentMode: mode, + }); + } + if (inspected.content.sha256 !== captured.sha256 + || inspected.content.bytes !== captured.bytes) { + return relation('different', `${captured.subject}-content-changed`, { + filePath: verificationPath, + previousSha256: captured.sha256, + currentSha256: inspected.content.sha256, + previousBytes: captured.bytes, + currentBytes: inspected.content.bytes, + }); + } + return relation('match', `${captured.subject}-binding-match`, { + filePath: verificationPath, + links, + }); +} + +/** Close and invalidate a captured regular-file binding. */ +export function releaseRegularFileBinding(binding) { + const captured = regularFileBindings.get(binding); + if (!captured) return relation('unknown', 'regular-file-binding-unavailable'); + regularFileBindings.delete(binding); + const failure = closeCapturedDescriptor( + captured.descriptor, + captured.subject, + captured.filePath, + ); + const { cleanupGroup } = captured; + cleanupGroup.bindings -= 1; + let cleanupFailure; + if (cleanupGroup.bindings === 0) { + regularFileBindingGroups.delete(cleanupGroup.identityKey); + // A staging registry and its publication transaction can bind the same + // inode independently. SMB may keep a retired name visible until every + // descriptor closes, so cleanup belongs to the inode's last binding. + for (const directory of cleanupGroup.deferredCleanupDirectories) { + const cleanup = removeEmptyQuarantine(directory, { retry: true }); + cleanupFailure ||= cleanup; + } + } + if (failure || cleanupFailure) return failure || cleanupFailure; + return relation('released', `${captured.subject}-binding-released`, { + filePath: captured.filePath, + }); +} + +function createRemovalQuarantine(parentPath) { + for (let attempt = 0; attempt < 8; attempt += 1) { + const directory = path.join( + parentPath, + `.archify-remove-${randomBytes(16).toString('hex')}`, + ); + try { + fs.mkdirSync(directory, { mode: 0o700 }); + return { status: 'created', directory }; + } catch (error) { + if (error?.code !== 'EEXIST') { + return filesystemFailure('removal-quarantine-create-failed', error, { + parentPath, + }); + } + } + } + return relation('unknown', 'removal-quarantine-name-exhausted', { parentPath }); +} + +function removeEmptyQuarantine(directory, { retry = false } = {}) { + let failure; + try { + removeEmptyDirectoryWithRetry(directory, { retry }); + return null; + } catch (error) { + failure = error; + } + return filesystemFailure('removal-quarantine-cleanup-failed', failure, { + recoveryDirectory: directory, + }); +} + +function deferEmptyQuarantineCleanup(binding, cleanup) { + if (cleanup?.reason?.code !== 'removal-quarantine-cleanup-failed' + || cleanup.reason.systemCode !== 'ENOTEMPTY') return false; + const captured = regularFileBindings.get(binding); + if (!captured) return false; + captured.cleanupGroup.deferredCleanupDirectories.add(cleanup.reason.recoveryDirectory); + return true; +} + +function removalRecovery(subject, code, filePath, quarantineDirectory, quarantineFile, error) { + return { + status: 'recovery-required', + reason: { + code: `${subject}-${code}`, + filePath, + ...(typeof error?.code === 'string' ? { systemCode: error.code } : {}), + ...(error?.message ? { message: error.message } : {}), + }, + recoveryDirectory: quarantineDirectory, + recoveryFile: quarantineFile, + target: filePath, + }; +} + +function decimal(value) { + return value.toString(); +} + +function parseDecimal(value) { + if (typeof value !== 'string' || !/^(?:0|[1-9]\d*)$/.test(value)) return null; + try { + return BigInt(value); + } catch { + return null; + } +} + +function parseSafeInteger(value) { + return Number.isSafeInteger(value) && value >= 0 ? value : null; +} + +function serializeRequestedEntry(entry) { + if (entry?.kind === 'absent') return { kind: 'absent' }; + if (entry?.kind !== 'existing' || typeof entry.entryType !== 'string' + || typeof entry.device !== 'bigint' || typeof entry.inode !== 'bigint') { + return null; + } + return { + kind: 'existing', + entryType: entry.entryType, + device: decimal(entry.device), + inode: decimal(entry.inode), + ...(entry.entryType === 'symbolic-link' ? { + changedAtNs: decimal(entry.changedAtNs), + createdAtNs: decimal(entry.createdAtNs), + } : {}), + }; +} + +function createPublicationRecoveryRecord(directory, snapshot, previous) { + const requestedEntry = serializeRequestedEntry(snapshot?.requestedEntry); + const slot = snapshot?.slot; + if (!requestedEntry || !slot || typeof snapshot?.requestedPath !== 'string' + || typeof snapshot?.requestedEntryPolicy !== 'string' + || typeof slot.commitPath !== 'string' || typeof slot.parentPath !== 'string' + || typeof slot.name !== 'string' || typeof slot.parentDevice !== 'bigint' + || typeof slot.parentInode !== 'bigint' || !previous?.identity + || !previous?.content || !Number.isSafeInteger(previous.mode)) { + return relation('unknown', 'publication-recovery-record-input-invalid'); + } + const recordPath = path.join(directory, publicationRecoveryRecordName); + let directoryMetadata; + let parentMetadata; + try { + directoryMetadata = fs.lstatSync(directory, { bigint: true }); + parentMetadata = fs.statSync(path.dirname(directory), { bigint: true }); + } catch (error) { + return filesystemFailure('publication-recovery-directory-inspection-failed', error, { + recoveryDirectory: directory, + }); + } + if (!directoryMetadata.isDirectory() || directoryMetadata.ino === 0n + || !parentMetadata.isDirectory() + || parentMetadata.dev !== slot.parentDevice || parentMetadata.ino !== slot.parentInode + || !/^\.archify-remove-[a-f\d]{32}$/.test(path.basename(directory))) { + return relation('unknown', 'publication-recovery-directory-invalid', { + recoveryDirectory: directory, + }); + } + const record = { + version: publicationRecoveryRecordVersion, + kind: 'archify-retired-output-recovery', + backup: { + name: 'previous', + sha256: previous.content.sha256, + bytes: previous.content.bytes, + mode: previous.mode, + device: decimal(previous.identity.device), + inode: decimal(previous.identity.inode), + }, + recovery: { + name: path.basename(directory), + device: decimal(directoryMetadata.dev), + inode: decimal(directoryMetadata.ino), + }, + target: { + requestedPath: snapshot.requestedPath, + requestedEntryPolicy: snapshot.requestedEntryPolicy, + requestedEntry, + commitPath: slot.commitPath, + parentPath: slot.parentPath, + parentDevice: decimal(slot.parentDevice), + parentInode: decimal(slot.parentInode), + name: slot.name, + }, + }; + const bytes = Buffer.from(`${JSON.stringify(record)}\n`); + let descriptor; + let writeFailure; + try { + descriptor = fs.openSync( + recordPath, + fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_EXCL, + 0o600, + ); + let offset = 0; + while (offset < bytes.byteLength) { + const wrote = fs.writeSync(descriptor, bytes, offset, bytes.byteLength - offset); + if (wrote <= 0) throw Object.assign(new Error('short recovery record write'), { code: 'EIO' }); + offset += wrote; + } + fs.fsyncSync(descriptor); + } catch (error) { + writeFailure = error; + } finally { + if (descriptor !== undefined) { + try { + fs.closeSync(descriptor); + } catch (error) { + writeFailure ||= error; + } + } + } + if (writeFailure) { + return filesystemFailure('publication-recovery-record-write-failed', writeFailure, { + recoveryDirectory: directory, + recoveryFile: recordPath, + }); + } + // POSIX requires the parent directory entry to be synced separately. Do not + // claim a kill-recovery record is durable where the platform cannot do that. + if (process.platform !== 'win32') { + let directoryDescriptor; + let directoryFailure; + try { + directoryDescriptor = fs.openSync(directory, fs.constants.O_RDONLY); + fs.fsyncSync(directoryDescriptor); + } catch (error) { + directoryFailure = error; + } finally { + if (directoryDescriptor !== undefined) { + try { + fs.closeSync(directoryDescriptor); + } catch (error) { + directoryFailure ||= error; + } + } + } + if (directoryFailure) { + return filesystemFailure('publication-recovery-record-directory-sync-failed', directoryFailure, { + recoveryDirectory: directory, + recoveryFile: recordPath, + }); + } + } + const captured = captureRegularFileBinding(recordPath, { + subject: 'publication-recovery-record', + expectedSha256: createHash('sha256').update(bytes).digest('hex'), + expectedBytes: bytes.byteLength, + // Windows reports a synthetic POSIX mode whose read bits cannot represent + // the private ACL established by the exclusive create above. + expectedMode: process.platform === 'win32' ? undefined : 0o600, + expectedLinks: 1, + }); + if (captured.status !== 'captured') { + return { + ...captured, + recoveryDirectory: directory, + recoveryFile: recordPath, + }; + } + return { + status: 'created', + recordPath, + binding: captured.binding, + }; +} + +function discardPublicationRecoveryRecord(record) { + if (!record?.binding || typeof record.recordPath !== 'string') return null; + let removed; + let released; + try { + removed = quarantineRemoveRegularFileBinding(record.binding, record.recordPath, { + subject: 'publication-recovery-record', + expectedLinks: 1, + }); + } finally { + released = releaseRegularFileBinding(record.binding); + } + if (released.status !== 'released') return released; + return removed.status === 'removed' ? null : removed; +} + +function releasePublicationRecoveryRecord(record) { + if (!record?.binding) return null; + const released = releaseRegularFileBinding(record.binding); + return released.status === 'released' ? null : released; +} + +/** + * Remove a public regular-file name without a verify-to-unlink race. The + * public entry is first moved into an unpredictable private directory and is + * deleted only after the caller's still-open binding proves that the moved + * inode, mode and bytes are the owned entry. If the move captured a successor, + * restore it with a no-clobber hard link or retain it as recovery material. + * The caller retains ownership of `binding` and must release it separately. + */ +export function quarantineRemoveRegularFileBinding(binding, filePath, { + subject = 'public-entry', + expectedLinks = 1, +} = {}) { + if (!validExpectedLinks(expectedLinks)) { + return relation('unknown', 'invalid-regular-file-binding-expectation'); + } + const resolvedPath = path.resolve(filePath); + const beforeMove = verifyRegularFileBinding(binding, { + filePath: resolvedPath, + expectedLinks, + }); + if (beforeMove.status !== 'match') return beforeMove; + + const quarantine = createRemovalQuarantine(path.dirname(resolvedPath)); + if (quarantine.status !== 'created') return quarantine; + const quarantineFile = path.join(quarantine.directory, path.basename(resolvedPath)); + const removeEmpty = () => removeEmptyQuarantine(quarantine.directory); + const removeEmptyAfterFileRemoval = () => { + const cleanup = removeEmpty(); + return cleanup && deferEmptyQuarantineCleanup(binding, cleanup) ? null : cleanup; + }; + + try { + fs.renameSync(resolvedPath, quarantineFile); + } catch (error) { + const cleanup = removeEmpty(); + return cleanup || filesystemFailure(`${subject}-quarantine-move-failed`, error, { + filePath: resolvedPath, + }); + } + + const moved = verifyRegularFileBinding(binding, { + filePath: quarantineFile, + expectedLinks, + }); + if (moved.status === 'match') { + try { + fs.unlinkSync(quarantineFile); + } catch (error) { + return removalRecovery( + subject, + 'quarantine-cleanup-failed', + resolvedPath, + quarantine.directory, + quarantineFile, + error, + ); + } + const cleanup = removeEmptyAfterFileRemoval(); + return cleanup || relation('removed', `${subject}-removed`, { filePath: resolvedPath }); + } + + let displaced; + try { + displaced = fs.lstatSync(quarantineFile, { bigint: true }); + } catch (error) { + return removalRecovery( + subject, + 'replacement-inspection-failed', + resolvedPath, + quarantine.directory, + quarantineFile, + error, + ); + } + if (displaced.ino === 0n || displaced.nlink === 0n) { + return removalRecovery( + subject, + 'replacement-identity-unavailable', + resolvedPath, + quarantine.directory, + quarantineFile, + ); + } + try { + fs.linkSync(quarantineFile, resolvedPath); + } catch (error) { + return removalRecovery( + subject, + error?.code === 'EEXIST' ? 'replacement-restore-blocked' : 'replacement-restore-failed', + resolvedPath, + quarantine.directory, + quarantineFile, + error, + ); + } + + let restored; + let retained; + try { + restored = fs.lstatSync(resolvedPath, { bigint: true }); + retained = fs.lstatSync(quarantineFile, { bigint: true }); + } catch (error) { + return removalRecovery( + subject, + 'replacement-restore-verification-failed', + resolvedPath, + quarantine.directory, + quarantineFile, + error, + ); + } + if (restored.dev !== displaced.dev || restored.ino !== displaced.ino + || retained.dev !== displaced.dev || retained.ino !== displaced.ino + || restored.nlink !== displaced.nlink + 1n + || retained.nlink !== displaced.nlink + 1n) { + return removalRecovery( + subject, + 'replacement-restore-identity-changed', + resolvedPath, + quarantine.directory, + quarantineFile, + ); + } + try { + fs.unlinkSync(quarantineFile); + } catch (error) { + return removalRecovery( + subject, + 'replacement-quarantine-cleanup-failed', + resolvedPath, + quarantine.directory, + quarantineFile, + error, + ); + } + try { + restored = fs.lstatSync(resolvedPath, { bigint: true }); + } catch (error) { + const cleanup = removeEmptyAfterFileRemoval(); + return cleanup || filesystemFailure( + `${subject}-replacement-final-verification-failed`, + error, + { filePath: resolvedPath }, + ); + } + if (restored.dev !== displaced.dev || restored.ino !== displaced.ino + || restored.nlink !== displaced.nlink) { + const cleanup = removeEmptyAfterFileRemoval(); + return cleanup || relation('different', `${subject}-replacement-final-identity-changed`, { + filePath: resolvedPath, + }); + } + const cleanup = removeEmptyAfterFileRemoval(); + return cleanup || relation('preserved', `${subject}-replacement-restored`, { + filePath: resolvedPath, + priorState: moved.reason, + }); +} + +/** + * Create a no-clobber hard-link backup of a bound public file, then remove the + * public name through the quarantine protocol above. The backup is reported as + * verified only after both names have been reconciled with the open binding. + */ +export function backupPublicRegularFileBinding(binding, filePath, backupPath, { + subject = 'public-entry', +} = {}) { + const resolvedPath = path.resolve(filePath); + const resolvedBackup = path.resolve(backupPath); + const beforeLink = verifyRegularFileBinding(binding, { + filePath: resolvedPath, + expectedLinks: 1, + }); + if (beforeLink.status !== 'match') { + return { ...beforeLink, backupCreated: false, backupVerified: false }; + } + try { + fs.linkSync(resolvedPath, resolvedBackup); + } catch (error) { + return { + ...filesystemFailure(`${subject}-backup-link-failed`, error, { + filePath: resolvedPath, + backupPath: resolvedBackup, + }), + backupCreated: false, + backupVerified: false, + }; + } + for (const linkedPath of [resolvedPath, resolvedBackup]) { + const linked = verifyRegularFileBinding(binding, { + filePath: linkedPath, + expectedLinks: 2, + }); + if (linked.status !== 'match') { + return { + status: 'recovery-required', + reason: { + code: `${subject}-backup-binding-mismatch`, + filePath: resolvedPath, + backupPath: resolvedBackup, + linkedState: linked.reason, + }, + recoveryDirectory: path.dirname(resolvedBackup), + recoveryFile: resolvedBackup, + target: resolvedPath, + backupCreated: true, + backupVerified: false, + }; + } + } + const removed = quarantineRemoveRegularFileBinding(binding, resolvedPath, { + subject, + expectedLinks: 2, + }); + if (removed.status !== 'removed') { + return { + ...removed, + backupPath: resolvedBackup, + backupCreated: true, + backupVerified: true, + }; + } + const finalized = verifyRegularFileBinding(binding, { + filePath: resolvedBackup, + expectedLinks: 1, + }); + if (finalized.status !== 'match') { + return { + status: 'recovery-required', + reason: { + code: `${subject}-backup-finalization-failed`, + filePath: resolvedPath, + backupPath: resolvedBackup, + backupState: finalized.reason, + }, + recoveryDirectory: path.dirname(resolvedBackup), + recoveryFile: resolvedBackup, + target: resolvedPath, + backupCreated: true, + backupVerified: false, + }; + } + return { + status: 'backed-up', + reason: { + code: `${subject}-backed-up`, + filePath: resolvedPath, + backupPath: resolvedBackup, + }, + backupPath: resolvedBackup, + backupCreated: true, + backupVerified: true, + }; +} + +/** + * Remove a hard-link name that this process just introduced while preserving + * the source claimant. This is the rollback path when a staged pathname was + * swapped after its expected binding was verified but before `linkSync` used + * that pathname. + */ +export function quarantineRemoveLinkedRegularFileAlias(sourcePath, aliasPath, { + subject = 'linked-claimant', +} = {}) { + const source = path.resolve(sourcePath); + const alias = path.resolve(aliasPath); + const captured = captureRegularFileBinding(source, { + subject, + expectedLinks: 2, + }); + if (captured.status !== 'captured') return captured; + let result; + let released; + try { + const aliasMatches = verifyRegularFileBinding(captured.binding, { + filePath: alias, + expectedLinks: 2, + }); + if (aliasMatches.status !== 'match') { + result = aliasMatches; + } else { + const removal = quarantineRemoveRegularFileBinding(captured.binding, alias, { + subject, + expectedLinks: 2, + }); + if (removal.status !== 'removed') { + result = removal; + } else { + const sourceRemains = verifyRegularFileBinding(captured.binding, { + filePath: source, + expectedLinks: 1, + }); + result = sourceRemains.status === 'match' ? removal : sourceRemains; + } + } + } finally { + released = releaseRegularFileBinding(captured.binding); + } + if (released.status !== 'released') { + return { + ...released, + removalStatus: result?.status, + ...(result?.recoveryDirectory ? { + recoveryDirectory: result.recoveryDirectory, + recoveryFile: result.recoveryFile, + target: result.target, + } : {}), + }; + } + return result; +} + +function removePublishedBindingName(binding, filePath, subject) { + for (const expectedLinks of [2, 1]) { + const matches = verifyRegularFileBinding(binding, { filePath, expectedLinks }); + if (matches.status === 'match') { + return quarantineRemoveRegularFileBinding(binding, filePath, { + subject, + expectedLinks, + }); + } + } + return relation('preserved', `${subject}-identity-changed`, { filePath }); +} + +function restorePublicationBackup(binding, backupPath, commitPath, subject) { + const backupMatches = verifyRegularFileBinding(binding, { + filePath: backupPath, + expectedLinks: 1, + }); + if (backupMatches.status !== 'match') return backupMatches; + try { + fs.linkSync(backupPath, commitPath); + } catch (error) { + return filesystemFailure( + error?.code === 'EEXIST' + ? `${subject}-restore-blocked` + : `${subject}-restore-failed`, + error, + { backupPath, commitPath }, + ); + } + for (const linkedPath of [backupPath, commitPath]) { + const linked = verifyRegularFileBinding(binding, { + filePath: linkedPath, + expectedLinks: 2, + }); + if (linked.status !== 'match') return linked; + } + const retired = quarantineRemoveRegularFileBinding(binding, backupPath, { + subject: `${subject}-backup`, + expectedLinks: 2, + }); + if (retired.status !== 'removed') return retired; + return verifyRegularFileBinding(binding, { + filePath: commitPath, + expectedLinks: 1, + }); +} + +/** + * Publish a captured candidate without ever replacing an unverified public + * entry. Existing output is retained through a bound private backup; the new + * name is created with a no-clobber hard link while the candidate descriptor + * remains open. Both the staged and public names are then verified through + * that descriptor before the staged name is retired via quarantine. + * Replacing an existing entry is recoverable but not crash-atomic: the public + * name is absent between retiring the verified previous name and linking the + * candidate. Portable Node.js exposes no replacement compare-and-swap that + * also preserves a late claimant. + * + * The caller owns `binding` and must release it after this function returns. + */ +export function publishRegularFileBinding(binding, candidatePath, snapshot, { + subject = 'candidate', +} = {}) { + const candidate = path.resolve(candidatePath); + const commitPath = snapshot?.slot?.commitPath; + if (typeof commitPath !== 'string') { + return relation('unknown', `${subject}-publication-snapshot-unavailable`); + } + + const beforePublish = verifyAtomicOutput(snapshot); + if (beforePublish.status !== 'match') return beforePublish; + const candidateMatches = verifyRegularFileBinding(binding, { + filePath: candidate, + expectedLinks: 1, + }); + if (candidateMatches.status !== 'match') return candidateMatches; + + let previousBinding; + let recoveryDirectory; + let backupPath; + let recoveryRecord; + let previousBackedUp = false; + const finishPrevious = () => { + if (!previousBinding) return null; + const released = releaseRegularFileBinding(previousBinding); + previousBinding = undefined; + return released.status === 'released' ? null : released; + }; + const cleanupRecoveryDirectory = () => { + if (!recoveryDirectory) return null; + const cleanup = removeEmptyQuarantine(recoveryDirectory); + if (!cleanup) recoveryDirectory = undefined; + return cleanup; + }; + const restorePrevious = () => { + if (!previousBinding || !previousBackedUp) return null; + return restorePublicationBackup( + previousBinding, + backupPath, + commitPath, + 'previous-output', + ); + }; + const rollback = (failure) => { + let publicRemoval = removePublishedBindingName( + binding, + commitPath, + `${subject}-publication`, + ); + if (publicRemoval.status === 'preserved') { + const claimantRemoval = quarantineRemoveLinkedRegularFileAlias( + candidate, + commitPath, + { subject: `${subject}-publication-claimant` }, + ); + if (claimantRemoval.status === 'removed') publicRemoval = claimantRemoval; + } + const restored = restorePrevious(); + const recordCleanup = restored?.status === 'match' + ? discardPublicationRecoveryRecord(recoveryRecord) + : releasePublicationRecoveryRecord(recoveryRecord); + recoveryRecord = undefined; + const released = finishPrevious(); + const directoryCleanup = cleanupRecoveryDirectory(); + return { + ...failure, + ...(publicRemoval.status !== 'removed' && publicRemoval.status !== 'absent' + ? { publicState: publicRemoval.reason } : {}), + ...(restored && restored.status !== 'match' ? { restoreState: restored.reason } : {}), + ...(recordCleanup ? { recoveryRecordState: recordCleanup.reason } : {}), + ...(released ? { releaseState: released.reason } : {}), + ...(directoryCleanup ? { + recoveryDirectory: directoryCleanup.reason?.recoveryDirectory || recoveryDirectory, + } : {}), + ...((restored && restored.status !== 'match') || recordCleanup || directoryCleanup + ? { recoveryFile: backupPath } : {}), + }; + }; + + if (snapshot.target.kind === 'file') { + const previous = captureRegularFileBinding(commitPath, { + subject: 'previous-output', + expectedIdentity: { + device: snapshot.target.device, + inode: snapshot.target.inode, + }, + expectedMode: snapshot.target.mode, + expectedLinks: 1, + }); + if (previous.status !== 'captured') return previous; + previousBinding = previous.binding; + const quarantine = createRemovalQuarantine(path.dirname(commitPath)); + if (quarantine.status !== 'created') { + const released = finishPrevious(); + return released || quarantine; + } + recoveryDirectory = quarantine.directory; + backupPath = path.join(recoveryDirectory, 'previous'); + const recovery = createPublicationRecoveryRecord(recoveryDirectory, snapshot, previous); + if (recovery.status !== 'created') { + const released = finishPrevious(); + const directoryCleanup = cleanupRecoveryDirectory(); + return { + ...recovery, + ...(recoveryDirectory ? { recoveryDirectory } : {}), + ...(released ? { releaseState: released.reason } : {}), + ...(directoryCleanup ? { directoryCleanupState: directoryCleanup.reason } : {}), + }; + } + recoveryRecord = recovery; + const backup = backupPublicRegularFileBinding( + previousBinding, + commitPath, + backupPath, + { subject: 'previous-output' }, + ); + previousBackedUp = backup.status === 'backed-up'; + if (!previousBackedUp) { + const recordCleanup = backup.backupCreated + ? releasePublicationRecoveryRecord(recoveryRecord) + : discardPublicationRecoveryRecord(recoveryRecord); + recoveryRecord = undefined; + const released = finishPrevious(); + const directoryCleanup = backup.backupCreated ? null : cleanupRecoveryDirectory(); + return { + ...backup, + ...(recordCleanup ? { recoveryRecordState: recordCleanup.reason } : {}), + ...(released ? { releaseState: released.reason } : {}), + ...(directoryCleanup ? { directoryCleanupState: directoryCleanup.reason } : {}), + }; + } + } + + try { + fs.linkSync(candidate, commitPath); + } catch (error) { + return rollback(filesystemFailure( + error?.code === 'EEXIST' + ? 'target-created-during-commit' + : `${subject}-publication-link-failed`, + error, + { candidatePath: candidate, commitPath }, + )); + } + + const published = verifyRegularFileBinding(binding, { + filePath: commitPath, + expectedLinks: 2, + }); + const staged = verifyRegularFileBinding(binding, { + filePath: candidate, + expectedLinks: 2, + }); + if (published.status !== 'match' || staged.status !== 'match') { + return rollback(relation('different', `${subject}-identity-changed`, { + candidatePath: candidate, + commitPath, + publishedState: published.reason, + stagedState: staged.reason, + })); + } + + const retired = quarantineRemoveRegularFileBinding(binding, candidate, { + subject: `${subject}-staging`, + expectedLinks: 2, + }); + if (retired.status !== 'removed' && retired.status !== 'preserved') { + return rollback(retired); + } + const final = verifyRegularFileBinding(binding, { + filePath: commitPath, + expectedLinks: 1, + }); + if (final.status !== 'match') return rollback(final); + + let cleanupWarning = retired.status === 'preserved' ? retired : undefined; + if (previousBinding) { + const backupRemoval = quarantineRemoveRegularFileBinding( + previousBinding, + backupPath, + { subject: 'previous-output-backup', expectedLinks: 1 }, + ); + if (backupRemoval.status !== 'removed') cleanupWarning = backupRemoval; + const recordCleanup = backupRemoval.status === 'removed' + ? discardPublicationRecoveryRecord(recoveryRecord) + : releasePublicationRecoveryRecord(recoveryRecord); + recoveryRecord = undefined; + cleanupWarning ||= recordCleanup; + } + const released = finishPrevious(); + const directoryCleanup = cleanupRecoveryDirectory(); + cleanupWarning ||= released || directoryCleanup; + const recoveryFile = cleanupWarning?.recoveryFile + || (retired.status === 'preserved' ? candidate : undefined) + || (recoveryDirectory ? backupPath : undefined); + return { + status: cleanupWarning ? 'committed-with-warning' : 'committed', + reason: { + code: `${subject}-published`, + candidatePath: candidate, + commitPath, + ...(retired.status === 'preserved' ? { stagedSuccessorPreserved: true } : {}), + }, + ...(cleanupWarning ? { + cleanupState: cleanupWarning.reason, + ...(recoveryDirectory ? { recoveryDirectory } : {}), + ...(recoveryFile ? { recoveryFile } : {}), + } : {}), + }; +} + +/** Remove only the directory entry that still names a caller-owned inode. */ +export function removeOwnedRegularFile(filePath, identity, { subject = 'candidate' } = {}) { + const resolvedPath = path.resolve(filePath); + let expectedLinks = 1; + let captured = captureRegularFileBinding(resolvedPath, { + subject, + expectedIdentity: identity, + expectedLinks, + }); + const reportedLinks = Number(captured.reason?.links); + if (captured.status === 'unsupported' + && captured.reason?.code === `${subject}-hardlinked` + && Number.isSafeInteger(reportedLinks) + && reportedLinks > 1) { + expectedLinks = reportedLinks; + captured = captureRegularFileBinding(resolvedPath, { + subject, + expectedIdentity: identity, + expectedLinks, + }); + } + if (captured.status !== 'captured') { + if (captured.reason?.systemCode === 'ENOENT') { + return relation('absent', `${subject}-already-absent`, { filePath: resolvedPath }); + } + if (captured.status === 'different' || captured.status === 'unsupported') { + return relation('preserved', `${subject}-identity-changed`, { + filePath: resolvedPath, + priorState: captured.reason, + }); + } + return captured; + } + + let removal; + let released; + try { + removal = quarantineRemoveRegularFileBinding(captured.binding, resolvedPath, { + subject, + expectedLinks, + }); + } finally { + released = releaseRegularFileBinding(captured.binding); + } + if (released.status !== 'released') { + return { + ...released, + removalStatus: removal?.status, + ...(removal?.recoveryDirectory ? { + recoveryDirectory: removal.recoveryDirectory, + recoveryFile: removal.recoveryFile, + target: removal.target, + } : {}), + }; + } + return removal; +} + +function captureWriteSlot(requestedPath) { + let commitPath; + try { + commitPath = canonicalFuturePath(requestedPath); + } catch (error) { + const diagnostic = error?.archifyDiagnostics?.[0]; + return relation('unknown', 'canonicalization-failed', { + ...(diagnostic?.code ? { diagnosticCode: diagnostic.code } : {}), + ...(diagnostic?.evidence?.relation ? { relation: diagnostic.evidence.relation } : {}), + }); + } + + const parentPath = path.dirname(commitPath); + let parent; + try { + parent = fs.statSync(parentPath, { bigint: true }); + } catch (error) { + return filesystemFailure('parent-inspection-failed', error, { commitPath, parentPath }); + } + if (!parent.isDirectory()) { + return relation('unknown', 'parent-not-directory', { commitPath, parentPath }); + } + if (parent.ino === 0n) { + return relation('unknown', 'parent-identity-unavailable', { commitPath, parentPath }); + } + return { + status: 'captured', + slot: { + commitPath, + parentPath, + name: path.basename(commitPath), + parentDevice: parent.dev, + parentInode: parent.ino, + }, + }; +} + +function captureTarget(commitPath) { + let metadata; + try { + // The canonical commit path names the directory entry that rename will + // replace. Never follow a link introduced after canonicalization. + metadata = fs.lstatSync(commitPath, { bigint: true }); + } catch (error) { + if (error.code === 'ENOENT') { + return { status: 'captured', target: { kind: 'absent' }, mode: null }; + } + return filesystemFailure('target-inspection-failed', error, { commitPath }); + } + + const type = entryType(metadata); + if (type !== 'file') { + return relation('unsupported', 'target-not-regular-file', { commitPath, entryType: type }); + } + const inspected = captureRegularFileHandle(commitPath, metadata, 'target'); + if (inspected.status !== 'captured') return inspected; + metadata = inspected.metadata; + return { + status: 'captured', + target: { + kind: 'file', + device: metadata.dev, + inode: metadata.ino, + mode: Number(metadata.mode & 0o777n), + }, + mode: Number(metadata.mode & 0o777n), + }; +} + +function captureRequestedEntry(requestedPath, policy) { + let metadata; + try { + metadata = fs.lstatSync(requestedPath, { bigint: true }); + } catch (error) { + if (error.code === 'ENOENT') { + return { status: 'captured', entry: { kind: 'absent' } }; + } + return filesystemFailure('requested-entry-inspection-failed', error, { requestedPath }); + } + const type = entryType(metadata); + if (policy === 'regular-or-absent' && type !== 'file') { + return relation('unsupported', type === 'symbolic-link' + ? 'requested-entry-symbolic-link' + : 'requested-entry-not-regular-file', { + requestedPath, + entryType: type, + }); + } + if (metadata.ino === 0n) { + return relation('unknown', 'requested-entry-identity-unavailable', { requestedPath }); + } + if (policy === 'regular-or-absent') { + const inspected = captureRegularFileHandle(requestedPath, metadata, 'requested-entry'); + if (inspected.status !== 'captured') return inspected; + metadata = inspected.metadata; + } + return { + status: 'captured', + entry: { + kind: 'existing', + entryType: type, + device: metadata.dev, + inode: metadata.ino, + // An unlinked symlink's inode can be reused immediately. Its target can + // stay the same while the requested directory entry is a new object. + // Reading the link only changes atime, so these no-follow timestamps + // distinguish that replacement without tracking target-file writes. + ...(type === 'symbolic-link' ? { + changedAtNs: metadata.ctimeNs, + createdAtNs: metadata.birthtimeNs, + } : {}), + }, + }; +} + +function requestedEntryMatches(left, right) { + if (left.kind !== right.kind) return false; + return left.kind === 'absent' + || (left.entryType === right.entryType + && left.device === right.device + && left.inode === right.inode + && (left.entryType !== 'symbolic-link' + || (left.changedAtNs === right.changedAtNs + && left.createdAtNs === right.createdAtNs))); +} + +/** + * Capture the physical directory-entry slot and target identity used by a + * verified publication. Hard links are intentionally unsupported: replacing + * one name cannot safely update its unknown sibling names. + * `regular-or-absent` additionally rejects requested-entry symlinks and special + * nodes for sidecars whose public name itself must never be followed. + */ +export function captureAtomicOutput(outputPath, { requestedEntryPolicy = 'followable-alias' } = {}) { + if (!['followable-alias', 'regular-or-absent'].includes(requestedEntryPolicy)) { + return relation('unknown', 'invalid-requested-entry-policy', { requestedEntryPolicy }); + } + const requestedPath = path.resolve(outputPath); + const requestedEntry = captureRequestedEntry(requestedPath, requestedEntryPolicy); + if (requestedEntry.status !== 'captured') return requestedEntry; + const slot = captureWriteSlot(requestedPath); + if (slot.status !== 'captured') return slot; + const target = captureTarget(slot.slot.commitPath); + if (target.status !== 'captured') return target; + const confirmedRequestedEntry = captureRequestedEntry(requestedPath, requestedEntryPolicy); + if (confirmedRequestedEntry.status !== 'captured') return confirmedRequestedEntry; + if (!requestedEntryMatches(confirmedRequestedEntry.entry, requestedEntry.entry)) { + return relation('unknown', 'requested-entry-changed-during-inspection', { requestedPath }); + } + return { + status: 'captured', + commitPath: slot.slot.commitPath, + mode: target.mode, + snapshot: { + requestedPath, + requestedEntryPolicy, + requestedEntry: requestedEntry.entry, + slot: slot.slot, + target: target.target, + }, + }; +} + +/** Re-resolve and verify the exact write slot plus its absent/file identity. */ +export function verifyAtomicOutput(snapshot) { + const currentRequestedEntry = captureRequestedEntry( + snapshot.requestedPath, + snapshot.requestedEntryPolicy || 'followable-alias', + ); + if (currentRequestedEntry.status !== 'captured') return currentRequestedEntry; + if (!requestedEntryMatches(currentRequestedEntry.entry, snapshot.requestedEntry)) { + return relation('different', 'requested-entry-changed', { + requestedPath: snapshot.requestedPath, + previousKind: snapshot.requestedEntry.kind === 'absent' + ? 'absent' + : snapshot.requestedEntry.entryType, + currentKind: currentRequestedEntry.entry.kind === 'absent' + ? 'absent' + : currentRequestedEntry.entry.entryType, + }); + } + const currentSlot = captureWriteSlot(snapshot.requestedPath); + if (currentSlot.status !== 'captured') return currentSlot; + const previousSlot = snapshot.slot; + if (currentSlot.slot.parentDevice !== previousSlot.parentDevice + || currentSlot.slot.parentInode !== previousSlot.parentInode + || currentSlot.slot.name !== previousSlot.name) { + return relation('different', 'write-slot-changed', { + previousCommitPath: previousSlot.commitPath, + currentCommitPath: currentSlot.slot.commitPath, + }); + } + + const currentTarget = captureTarget(previousSlot.commitPath); + if (currentTarget.status !== 'captured') return currentTarget; + const previousTarget = snapshot.target; + if (currentTarget.target.kind !== previousTarget.kind) { + return relation('different', 'target-existence-changed', { + commitPath: previousSlot.commitPath, + previousKind: previousTarget.kind, + currentKind: currentTarget.target.kind, + }); + } + if (previousTarget.kind === 'file' + && (currentTarget.target.device !== previousTarget.device + || currentTarget.target.inode !== previousTarget.inode)) { + return relation('different', 'target-identity-changed', { + commitPath: previousSlot.commitPath, + }); + } + if (previousTarget.kind === 'file' + && currentTarget.target.mode !== previousTarget.mode) { + return relation('different', 'target-mode-changed', { + commitPath: previousSlot.commitPath, + previousMode: previousTarget.mode, + currentMode: currentTarget.target.mode, + }); + } + return relation('match', 'atomic-output-match', { commitPath: previousSlot.commitPath }); +} + +function parsePublicationRecoveryRecord(buffer) { + if (!Buffer.isBuffer(buffer) || buffer.byteLength > publicationRecoveryRecordMaxBytes) { + return relation('unknown', 'publication-recovery-record-too-large'); + } + let parsed; + try { + parsed = JSON.parse(buffer.toString('utf8')); + } catch (error) { + return filesystemFailure('publication-recovery-record-invalid-json', error); + } + const backup = parsed?.backup; + const recovery = parsed?.recovery; + const target = parsed?.target; + const requestedEntry = target?.requestedEntry; + const validEntry = requestedEntry?.kind === 'absent' + || (requestedEntry?.kind === 'existing' + && typeof requestedEntry.entryType === 'string' + && parseDecimal(requestedEntry.device) !== null + && parseDecimal(requestedEntry.inode) !== null + && (requestedEntry.entryType !== 'symbolic-link' + || (parseDecimal(requestedEntry.changedAtNs) !== null + && parseDecimal(requestedEntry.createdAtNs) !== null))); + const valid = parsed?.version === publicationRecoveryRecordVersion + && parsed?.kind === 'archify-retired-output-recovery' + && backup?.name === 'previous' + && typeof backup.sha256 === 'string' && /^[a-f\d]{64}$/i.test(backup.sha256) + && parseSafeInteger(backup.bytes) !== null + && Number.isSafeInteger(backup.mode) && backup.mode >= 0 && backup.mode <= 0o777 + && parseDecimal(backup.device) !== null && parseDecimal(backup.inode) !== null + && typeof recovery?.name === 'string' && /^\.archify-remove-[a-f\d]{32}$/.test(recovery.name) + && parseDecimal(recovery.device) !== null + && parseDecimal(recovery.inode) !== null + && typeof target?.requestedPath === 'string' && path.isAbsolute(target.requestedPath) + && typeof target.requestedEntryPolicy === 'string' + && ['followable-alias', 'regular-or-absent'].includes(target.requestedEntryPolicy) + && validEntry + && typeof target.commitPath === 'string' && path.isAbsolute(target.commitPath) + && typeof target.parentPath === 'string' && path.isAbsolute(target.parentPath) + // path-contract-allow: lexical-capability -- A record must exactly decompose the captured canonical target spelling. + && typeof target.name === 'string' && target.name === path.basename(target.commitPath) + // path-contract-allow: lexical-capability -- A record must exactly decompose the captured canonical target spelling. + && target.parentPath === path.dirname(target.commitPath) + && parseDecimal(target.parentDevice) !== null && parseDecimal(target.parentInode) !== null; + if (!valid) return relation('unknown', 'publication-recovery-record-invalid'); + return { + status: 'parsed', + record: { + backup: { + ...backup, + device: parseDecimal(backup.device), + inode: parseDecimal(backup.inode), + }, + recovery: { + ...recovery, + device: parseDecimal(recovery.device), + inode: parseDecimal(recovery.inode), + }, + target: { + ...target, + parentDevice: parseDecimal(target.parentDevice), + parentInode: parseDecimal(target.parentInode), + requestedEntry: requestedEntry.kind === 'absent' ? requestedEntry : { + ...requestedEntry, + device: parseDecimal(requestedEntry.device), + inode: parseDecimal(requestedEntry.inode), + ...(requestedEntry.entryType === 'symbolic-link' ? { + changedAtNs: parseDecimal(requestedEntry.changedAtNs), + createdAtNs: parseDecimal(requestedEntry.createdAtNs), + } : {}), + }, + }, + }, + }; +} + +function verifyPublicationRecoveryDirectory(directory, metadata, record) { + let parentMetadata; + try { + parentMetadata = fs.statSync(path.dirname(directory), { bigint: true }); + } catch (error) { + return filesystemFailure('publication-recovery-parent-inspection-failed', error, { + recoveryDirectory: directory, + }); + } + // path-contract-allow: lexical-capability -- The generated private-directory component is an exact record-bound capability. + if (path.basename(directory) !== record.recovery.name + || !parentMetadata.isDirectory() + || parentMetadata.dev !== record.target.parentDevice + || parentMetadata.ino !== record.target.parentInode) { + return relation('different', 'publication-recovery-directory-not-target-child', { + recoveryDirectory: directory, + expectedParentPath: record.target.parentPath, + }); + } + if (metadata.dev !== record.recovery.device || metadata.ino !== record.recovery.inode) { + return relation('different', 'publication-recovery-directory-identity-changed', { + recoveryDirectory: directory, + }); + } + return relation('match', 'publication-recovery-directory-match', { + recoveryDirectory: directory, + }); +} + +function verifyRetiredPublicationSlot(record) { + const { target } = record; + const slot = captureWriteSlot(target.requestedPath); + if (slot.status !== 'captured') return slot; + // path-contract-allow: lexical-capability -- The recaptured canonical commit spelling must exactly match the recorded capability. + const commitPathChanged = slot.slot.commitPath !== target.commitPath; + // path-contract-allow: lexical-capability -- The recaptured canonical parent spelling must exactly match the recorded capability. + const parentPathChanged = slot.slot.parentPath !== target.parentPath; + if (commitPathChanged + || parentPathChanged + || slot.slot.name !== target.name + || slot.slot.parentDevice !== target.parentDevice + || slot.slot.parentInode !== target.parentInode) { + return relation('different', 'publication-recovery-slot-changed', { + requestedPath: target.requestedPath, + commitPath: target.commitPath, + }); + } + try { + fs.lstatSync(target.commitPath, { bigint: true }); + return relation('preserved', 'publication-recovery-target-present', { + commitPath: target.commitPath, + }); + } catch (error) { + if (error?.code !== 'ENOENT') { + return filesystemFailure('publication-recovery-target-inspection-failed', error, { + commitPath: target.commitPath, + }); + } + } + let requested; + try { + requested = fs.lstatSync(target.requestedPath, { bigint: true }); + } catch (error) { + if (error?.code !== 'ENOENT') { + return filesystemFailure('publication-recovery-requested-entry-inspection-failed', error, { + requestedPath: target.requestedPath, + }); + } + } + if (target.requestedEntry.kind === 'existing' + && target.requestedEntry.entryType === 'symbolic-link') { + if (!requested?.isSymbolicLink() + || requested.dev !== target.requestedEntry.device + || requested.ino !== target.requestedEntry.inode + || requested.ctimeNs !== target.requestedEntry.changedAtNs + || requested.birthtimeNs !== target.requestedEntry.createdAtNs) { + return relation('different', 'publication-recovery-requested-alias-changed', { + requestedPath: target.requestedPath, + }); + } + } else if (requested) { + return relation('different', 'publication-recovery-requested-entry-reclaimed', { + requestedPath: target.requestedPath, + }); + } + return relation('match', 'publication-recovery-slot-match', { + commitPath: target.commitPath, + }); +} + +function releaseRecoveryBindings(result, recordBinding, backupBinding) { + const failures = []; + if (backupBinding) { + const released = releaseRegularFileBinding(backupBinding); + if (released.status !== 'released') failures.push(released.reason); + } + if (recordBinding) { + const released = releaseRegularFileBinding(recordBinding); + if (released.status !== 'released') failures.push(released.reason); + } + if (failures.length === 0) return result; + return { + ...result, + status: 'recovery-required', + releaseState: failures, + }; +} + +/** + * Explicitly restore one retired output after a process crash. This is not a + * directory scanner: callers must name the private recovery directory they + * intend to recover. A record is only a claim; the restored byte stream must + * still match its recorded inode, mode, SHA-256 and size, the original parent + * slot and aliases must still resolve identically, and the public name must be + * absent. `linkSync` is deliberately no-clobber, so a later claimant wins. + */ +export function recoverRetiredPublication(recoveryDirectory) { + const directory = path.resolve(recoveryDirectory); + let directoryMetadata; + try { + directoryMetadata = fs.lstatSync(directory, { bigint: true }); + } catch (error) { + if (error?.code === 'ENOENT') { + return relation('absent', 'publication-recovery-already-complete', { recoveryDirectory: directory }); + } + return filesystemFailure('publication-recovery-directory-inspection-failed', error, { + recoveryDirectory: directory, + }); + } + if (!directoryMetadata.isDirectory()) { + return relation('unsupported', 'publication-recovery-directory-not-directory', { + recoveryDirectory: directory, + entryType: entryType(directoryMetadata), + }); + } + if (process.platform !== 'win32' && Number(directoryMetadata.mode & 0o077n) !== 0) { + return relation('unsupported', 'publication-recovery-directory-not-private', { + recoveryDirectory: directory, + }); + } + const recordPath = path.join(directory, publicationRecoveryRecordName); + let recordMetadata; + try { + recordMetadata = fs.lstatSync(recordPath, { bigint: true }); + } catch (error) { + return filesystemFailure('publication-recovery-record-inspection-failed', error, { + recoveryDirectory: directory, + recoveryFile: recordPath, + }); + } + if (!recordMetadata.isFile() || recordMetadata.nlink !== 1n + || recordMetadata.size > BigInt(publicationRecoveryRecordMaxBytes)) { + return relation('unsupported', 'publication-recovery-record-not-private-regular-file', { + recoveryDirectory: directory, + recoveryFile: recordPath, + }); + } + const capturedRecord = captureRegularFileBinding(recordPath, { + subject: 'publication-recovery-record', + expectedLinks: 1, + includeContent: true, + }); + if (capturedRecord.status !== 'captured') return capturedRecord; + const parsed = parsePublicationRecoveryRecord(capturedRecord.content.buffer); + if (parsed.status !== 'parsed') { + return releaseRecoveryBindings(parsed, capturedRecord.binding); + } + const recoveryDirectoryState = verifyPublicationRecoveryDirectory( + directory, + directoryMetadata, + parsed.record, + ); + if (recoveryDirectoryState.status !== 'match') { + return releaseRecoveryBindings({ + ...recoveryDirectoryState, + recoveryDirectory: directory, + recoveryFile: recordPath, + }, capturedRecord.binding); + } + const slot = verifyRetiredPublicationSlot(parsed.record); + if (slot.status !== 'match') { + return releaseRecoveryBindings({ + ...slot, + recoveryDirectory: directory, + recoveryFile: recordPath, + }, capturedRecord.binding); + } + const backupPath = path.join(directory, parsed.record.backup.name); + const capturedBackup = captureRegularFileBinding(backupPath, { + subject: 'publication-recovery-backup', + expectedSha256: parsed.record.backup.sha256, + expectedBytes: parsed.record.backup.bytes, + expectedMode: parsed.record.backup.mode, + expectedIdentity: { + device: parsed.record.backup.device, + inode: parsed.record.backup.inode, + }, + expectedLinks: 1, + }); + if (capturedBackup.status !== 'captured') { + return releaseRecoveryBindings({ + ...capturedBackup, + recoveryDirectory: directory, + recoveryFile: backupPath, + }, capturedRecord.binding); + } + // This second check narrows the remaining path-based link window. It cannot + // make `linkSync` descriptor-bound, but it avoids linking after an ordinary + // observed parent, alias, target, or backup change. + const beforeLinkSlot = verifyRetiredPublicationSlot(parsed.record); + const beforeLinkBackup = verifyRegularFileBinding(capturedBackup.binding, { + filePath: backupPath, + expectedLinks: 1, + }); + if (beforeLinkSlot.status !== 'match' || beforeLinkBackup.status !== 'match') { + return releaseRecoveryBindings({ + status: beforeLinkSlot.status === 'match' ? beforeLinkBackup.status : beforeLinkSlot.status, + reason: { + code: 'publication-recovery-pre-link-verification-failed', + slotState: beforeLinkSlot.reason, + backupState: beforeLinkBackup.reason, + }, + recoveryDirectory: directory, + recoveryFile: backupPath, + }, capturedRecord.binding, capturedBackup.binding); + } + try { + fs.linkSync(backupPath, parsed.record.target.commitPath); + } catch (error) { + return releaseRecoveryBindings(relation( + error?.code === 'EEXIST' ? 'preserved' : 'unknown', + error?.code === 'EEXIST' + ? 'publication-recovery-target-created' + : 'publication-recovery-link-failed', + { + recoveryDirectory: directory, + recoveryFile: backupPath, + commitPath: parsed.record.target.commitPath, + ...(typeof error?.code === 'string' ? { systemCode: error.code } : {}), + }, + ), capturedRecord.binding, capturedBackup.binding); + } + const publicState = verifyRegularFileBinding(capturedBackup.binding, { + filePath: parsed.record.target.commitPath, + expectedLinks: 2, + }); + const backupState = verifyRegularFileBinding(capturedBackup.binding, { + filePath: backupPath, + expectedLinks: 2, + }); + if (publicState.status !== 'match' || backupState.status !== 'match') { + // We may have introduced an alias to a pathname that was swapped after the + // pre-link checks. Remove only that alias when it is still a verified + // two-link pair; otherwise preserve every uncertain name for inspection. + const linkedAliasCleanup = quarantineRemoveLinkedRegularFileAlias( + backupPath, + parsed.record.target.commitPath, + { subject: 'publication-recovery-unverified-link' }, + ); + return releaseRecoveryBindings(relation('recovery-required', 'publication-recovery-link-verification-failed', { + recoveryDirectory: directory, + recoveryFile: backupPath, + commitPath: parsed.record.target.commitPath, + publicState: publicState.reason, + backupState: backupState.reason, + linkedAliasCleanup: linkedAliasCleanup.reason, + }), capturedRecord.binding, capturedBackup.binding); + } + const backupRemoval = quarantineRemoveRegularFileBinding(capturedBackup.binding, backupPath, { + subject: 'publication-recovery-backup', + expectedLinks: 2, + }); + if (backupRemoval.status !== 'removed') { + return releaseRecoveryBindings({ + ...backupRemoval, + status: 'recovered-with-warning', + recoveryDirectory: directory, + recoveryFile: backupPath, + target: parsed.record.target.commitPath, + }, capturedRecord.binding, capturedBackup.binding); + } + const recordCleanup = discardPublicationRecoveryRecord({ + recordPath, + binding: capturedRecord.binding, + }); + const directoryCleanup = removeEmptyQuarantine(directory); + const result = { + status: recordCleanup || directoryCleanup ? 'recovered-with-warning' : 'recovered', + reason: { + code: 'publication-recovery-restored', + recoveryDirectory: directory, + commitPath: parsed.record.target.commitPath, + }, + ...(recordCleanup ? { recoveryRecordState: recordCleanup.reason } : {}), + ...(directoryCleanup ? { directoryCleanupState: directoryCleanup.reason } : {}), + }; + return releaseRecoveryBindings(result, undefined, capturedBackup.binding); +} diff --git a/packages/diagram-core/vendor/archify/renderers/shared/brand-marks.mjs b/packages/diagram-core/vendor/archify/renderers/shared/brand-marks.mjs index 1e18e0b..5eb520e 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/brand-marks.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/brand-marks.mjs @@ -181,7 +181,7 @@ function requestPinned(url, accept, target, deadline) { const request = transport.request(url, { method: 'GET', signal: timeoutSignal(Math.max(1, Math.min(4500, deadline - Date.now()))), - headers: { accept, 'user-agent': USER_AGENT }, + headers: { accept, 'accept-encoding': 'identity', 'user-agent': USER_AGENT }, // Reuse the exact public address that passed validation. This closes the // DNS-rebinding gap between checking a hostname and opening its socket. lookup(_hostname, options, callback) { @@ -224,6 +224,13 @@ async function checkedFetch(input, accept, deadline) { response.body.resume(); throw new Error(`brand link returned HTTP ${response.status}`); } + // Raw HTTP responses are not decompressed. Check successful bodies before + // HTML discovery or image validation so byte limits and digests stay valid. + const contentEncoding = (response.headers.get('content-encoding') || '').trim().toLowerCase(); + if (contentEncoding && contentEncoding !== 'identity') { + response.body.destroy(); + throw new Error(`unsupported brand content encoding ${contentEncoding}`); + } return { response, finalUrl: current }; } throw new Error('brand link redirected too many times'); @@ -269,18 +276,118 @@ async function readLimited(response, maximum) { return Buffer.concat(chunks, total); } +// Read only the bounded head, independent of network chunk boundaries. Scan +// bytes once so many tiny chunks cannot cause repeated concatenation/rescanning. +// This is a boundary scanner, not a DOM parser: comments, quoted attributes and +// raw-text elements must not turn a literal into an early stop. +async function readHtmlHead(response, maximum) { + const chunks = response.body && typeof response.body[Symbol.asyncIterator] === 'function' + ? response.body : [await readLimited(response, maximum)]; + const buffer = Buffer.alloc(maximum); + let total = 0; + let tagStart = -1; + let quote = 0; + let comment = false; + let rawClosing = ''; + let matched = 0; + for await (const value of chunks) { + const chunk = Buffer.from(value); + const length = Math.min(chunk.length, maximum - total); + chunk.copy(buffer, total, 0, length); + for (let offset = 0; offset < length; offset++) { + const byte = chunk[offset]; + const position = total + offset; + if (comment) { + if (byte === 0x3e && buffer[position - 1] === 0x2d && buffer[position - 2] === 0x2d) comment = false; + continue; + } + if (rawClosing) { + const lower = byte >= 65 && byte <= 90 ? byte + 32 : byte; + if (matched === rawClosing.length && [9, 10, 12, 13, 32, 47, 62].includes(byte)) { + tagStart = position - matched; + rawClosing = ''; + matched = 0; + } else { + matched = lower === rawClosing.charCodeAt(matched) ? matched + 1 : (byte === 0x3c ? 1 : 0); + continue; + } + } + if (tagStart < 0) { + if (byte === 0x3c) tagStart = position; + continue; + } + if (position === tagStart + 1 && !((byte >= 65 && byte <= 90) || (byte >= 97 && byte <= 122) || [33, 47, 63].includes(byte))) { + tagStart = byte === 0x3c ? position : -1; + continue; + } + if (position === tagStart + 3 && buffer[tagStart + 1] === 0x21 && buffer[tagStart + 2] === 0x2d && byte === 0x2d) { + comment = true; + tagStart = -1; + continue; + } + if (quote) { + if (byte === quote) quote = 0; + continue; + } + if (byte === 0x22 || byte === 0x27) { + quote = byte; + continue; + } + if (byte === 0x3e) { + const tag = buffer.toString('utf8', tagStart, position + 1); + if (/^<\/head[\t\n\f\r ]*>$/i.test(tag)) { + response.body?.destroy?.(); + return buffer.toString('utf8', 0, position + 1); + } + const raw = /^<(script|style|title|textarea|xmp|iframe|noembed|noframes)(?=[\t\n\f\r />])/i.exec(tag); + if (raw) rawClosing = ` length) { + response.body?.destroy?.(); + throw new Error('brand asset is too large'); + } + } + return buffer.toString('utf8', 0, total); +} + function attribute(tag, name) { const match = tag.match(new RegExp(`\\b${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, 'i')); return match ? (match[1] ?? match[2] ?? match[3] ?? '') : ''; } +// HTML numeric references in the C1 range use the legacy Windows-1252 mapping. +// https://html.spec.whatwg.org/multipage/parsing.html#numeric-character-reference-end-state +const HTML_C1_REFERENCES = [ + 0x20ac, 0x81, 0x201a, 0x192, 0x201e, 0x2026, 0x2020, 0x2021, + 0x2c6, 0x2030, 0x160, 0x2039, 0x152, 0x8d, 0x17d, 0x8f, + 0x90, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x2dc, 0x2122, 0x161, 0x203a, 0x153, 0x9d, 0x17e, 0x178, +]; +const BASIC_HTML_REFERENCES = { amp: '&', quot: '"', apos: "'", lt: '<', gt: '>' }; + +function decodeIconHref(value) { + // Decode only after extracting the attribute, in one pass. Leave percent + // escapes to URL parsing and do not reinterpret decoded quotes as markup. + return value.replace(/&#(?:[xX]([0-9a-fA-F]+)|([0-9]+));?|&(amp|AMP|quot|QUOT|lt|LT|gt|GT)(?:;|(?![A-Za-z0-9=]))|&(apos);/g, + (_match, hex, decimal, named, apostrophe) => { + if (named || apostrophe) return BASIC_HTML_REFERENCES[(named || apostrophe).toLowerCase()]; + let point = Number.parseInt(hex || decimal, hex ? 16 : 10); + if (point === 0 || point > 0x10ffff || (point >= 0xd800 && point <= 0xdfff)) return '\uFFFD'; + if (point >= 0x80 && point <= 0x9f) point = HTML_C1_REFERENCES[point - 0x80]; + return String.fromCodePoint(point); + }); +} + function iconCandidates(html, pageUrl) { const candidates = []; for (const match of html.matchAll(/]*>/gi)) { const tag = match[0]; const rel = attribute(tag, 'rel').toLocaleLowerCase('en-US').split(/\s+/); if (!rel.some((value) => value === 'icon' || value === 'apple-touch-icon' || value === 'mask-icon')) continue; - const href = attribute(tag, 'href'); + const href = decodeIconHref(attribute(tag, 'href')); if (!href) continue; try { const url = new URL(href, pageUrl); @@ -378,7 +485,7 @@ async function captureRemoteBrand(value, deadline = Date.now() + captureTimeoutM page.response.body?.destroy?.(); return fallback('linked page is not HTML'); } - const html = (await readLimited(page.response, MAX_HTML_BYTES)).toString('utf8'); + const html = await readHtmlHead(page.response, MAX_HTML_BYTES); const iconErrors = []; for (const candidate of iconCandidates(html, page.finalUrl)) { try { @@ -399,7 +506,7 @@ async function captureRemoteBrand(value, deadline = Date.now() + captureTimeoutM // Try the next declared favicon before using the generic link mark. } } - const usefulError = iconErrors.find((error) => /unsupported brand image type/i.test(error?.message)) + const usefulError = iconErrors.find((error) => /unsupported brand (?:image type|content encoding)/i.test(error?.message)) || iconErrors.at(-1); return fallback(usefulError?.message || 'no usable site icon was found'); } catch (error) { diff --git a/packages/diagram-core/vendor/archify/renderers/shared/cli.mjs b/packages/diagram-core/vendor/archify/renderers/shared/cli.mjs index 32f6672..bc4a5e3 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/cli.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/cli.mjs @@ -1,28 +1,115 @@ +import { createHash } from 'node:crypto'; import fs from 'node:fs'; import path from 'node:path'; import { applyTemplate, renderCards, esc } from './utils.mjs'; import { validateSchema } from './validator.mjs'; import { verifyRepositoryEvidence } from './repository-evidence.mjs'; -import { installRendererDiagnosticBoundary, throwDiagnosticProblems } from './diagnostics.mjs'; +import { installRendererDiagnosticBoundary, throwDiagnosticError, throwDiagnosticProblems, recordDiagnostic } from './diagnostics.mjs'; import { validateEngineeringProfile } from './engineering-profiles.mjs'; -import { resolveOutputPath } from './output-path.mjs'; +import { + resolveOutputPath, + validateAuthoredOutputPath, +} from './output-path.mjs'; +import { + captureAtomicOutput, + captureRegularFileBinding, + publishRegularFileBinding, + releaseRegularFileBinding, + removeOwnedRegularFile, + verifyAtomicOutput, +} from './atomic-output.mjs'; +import { resolveLocale, translateMessage, registerLocale, SUPPORTED_LOCALES } from './i18n.mjs'; import { prepareDiagramBrandMarks } from './brand-marks.mjs'; -import { resolveLocale, translateMessage } from './i18n.mjs'; - -installRendererDiagnosticBoundary(); const outputPathGuards = new Map(); +let renderCandidateSequence = 0; + +// meta.locale is renderer-owned Viewer UI, not authored content. +// en and zh-CN ship as built-in catalogs. +// Any other tag needs meta.translations (validated against the English +// message-key set, layered over English per-key so partial/invalid entries +// never break rendering) or it falls back to the English Viewer chrome — +// the same "omit locale, disclose the fallback" contract as before, just +// resolved from data instead of a hard-coded enum. See i18n.mjs. +function applyLocaleTranslations(diagramType, diagram) { + const locale = diagram.meta?.locale; + if (!locale) return; + const translations = diagram.meta?.translations; + if (translations && Object.keys(translations).length) { + const report = registerLocale(locale, translations); + if (report.missingKeys.length || report.unknownKeys.length || report.placeholderMismatches.length) { + recordDiagnostic({ + code: 'i18n/translation-coverage', + severity: 'warning', + message: `meta.translations for locale ${JSON.stringify(locale)} covers ${report.coveredKeys}/${report.totalKeys} renderer-owned messages (${Math.round(report.coverage * 100)}%); uncovered keys fall back to English.`, + subject: { diagramType, path: '/meta/translations' }, + evidence: { + missingKeys: report.missingKeys.slice(0, 10), + missingKeysTotal: report.missingKeys.length, + unknownKeys: report.unknownKeys.slice(0, 10), + unknownKeysTotal: report.unknownKeys.length, + placeholderMismatches: report.placeholderMismatches.slice(0, 10), + placeholderMismatchesTotal: report.placeholderMismatches.length, + }, + supportedFixes: ['Add the missing keys to meta.translations.', 'Match each translation\'s {placeholders} to the English source string.'], + }); + // Coverage is a fact about this render, not just a diagnostic-mode + // artifact: print it to stderr unconditionally so `render`/`deliver`/ + // `validate` disclose the fallback even without ARCHIFY_DIAGNOSTIC_FORMAT. + console.warn(`archify: meta.translations for locale ${JSON.stringify(locale)} covers ${report.coveredKeys}/${report.totalKeys} renderer-owned messages (${Math.round(report.coverage * 100)}%); uncovered keys fall back to English.`); + } + } else if (!SUPPORTED_LOCALES.includes(locale)) { + recordDiagnostic({ + code: 'i18n/locale-fallback', + severity: 'warning', + message: `meta.locale ${JSON.stringify(locale)} has no built-in catalog and no meta.translations; the Viewer chrome and fall back to English.`, + subject: { diagramType, path: '/meta/locale' }, + supportedFixes: ['Supply meta.translations for this locale.', `Use a built-in locale: ${SUPPORTED_LOCALES.join(', ')}.`], + }); + console.warn(`archify: meta.locale ${JSON.stringify(locale)} has no built-in catalog and no meta.translations; the Viewer chrome and fall back to English.`); + } +} // Common CLI head: node render-.mjs [input.json] [output.html] // Keep this synchronous because callers also use it to establish the guarded // output path before testing a last-moment filesystem alias change. export function loadDiagram({ rendererDir, diagramType, defaultExample, argv = process.argv }) { + // Compilers also import this module for SVG helpers. Only CLI execution + // should install a process-level handler, before reading or validating input. + installRendererDiagnosticBoundary(); const skillRoot = path.resolve(rendererDir, '../..'); const inputPath = path.resolve(argv[2] || path.join(skillRoot, 'examples', defaultExample)); - const diagram = JSON.parse(fs.readFileSync(inputPath, 'utf8')); + let input; + try { + input = fs.readFileSync(inputPath, 'utf8'); + } catch (error) { + if (!isFilesystemError(error)) throw error; + const message = `Input could not be read: ${error.message}`; + throwDiagnosticError(message, [{ + code: 'input/read', message, + subject: { input: inputPath }, + evidence: { systemCode: error.code, reason: error.message }, + supportedFixes: ['provide one readable JSON input file'], + }]); + } + let diagram; + try { + diagram = JSON.parse(input); + } catch (error) { + if (!(error instanceof SyntaxError)) throw error; + const message = `Input JSON could not be parsed: ${error.message}`; + throwDiagnosticError(message, [{ + code: 'input/json-parse', message, + subject: { input: inputPath }, + evidence: { reason: error.message }, + supportedFixes: ['repair the JSON syntax and run validation again'], + }]); + } + const authoredOutput = diagram?.meta?.output; + if (authoredOutput !== undefined) validateAuthoredOutputPath(authoredOutput); validateSchema(diagramType, diagram); - validateGuidedViews(diagramType, diagram); - validateRelationshipIds(diagramType, diagram); + applyLocaleTranslations(diagramType, diagram); + validateCrossCollectionContracts(diagramType, diagram); validateEngineeringProfile(diagramType, diagram); const sourceEvidence = verifyRepositoryEvidence(diagramType, diagram, process.env.ARCHIFY_REPO_ROOT); const template = fs.readFileSync(path.join(skillRoot, 'assets/template.html'), 'utf8'); @@ -33,7 +120,12 @@ export function loadDiagram({ rendererDir, diagramType, defaultExample, argv = p inputPaths: [inputPath], cwd: process.cwd(), }; - const { outputPath: outPath } = resolveOutputPath(outputRequest); + let outPath; + try { + ({ outputPath: outPath } = resolveOutputPath(outputRequest)); + } catch (error) { + throwOutputError(error, path.resolve(outputRequest.requestedOutput || outputRequest.authoredOutput || outputRequest.defaultOutput)); + } outputPathGuards.set(outPath, outputRequest); return { diagram, template, outPath, sourceEvidence }; } @@ -49,23 +141,192 @@ export async function loadDiagramWithBrandMarks(options) { const START_TYPES = new Set(['architecture', 'workflow', 'sequence', 'dataflow', 'lifecycle']); +function isFilesystemError(error) { + return typeof error?.code === 'string' + && typeof error?.syscall === 'string' + && typeof error?.errno === 'number'; +} + +function throwOutputError(error, output) { + if (error?.archifyDiagnostics || !isFilesystemError(error)) throw error; + const message = `Output could not be written: ${error.message}`; + throwDiagnosticError(message, [{ + code: 'output/write', message, + subject: { output }, + evidence: { systemCode: error.code, reason: error.message }, + supportedFixes: ['choose a writable HTML file path and ensure its parent directories can be created'], + }]); +} + +function throwAtomicOutputFailure(result, output) { + const reason = result.reason || { code: 'unclassified' }; + const changed = result.status === 'different'; + const candidate = reason.code.startsWith('candidate-'); + const nonRegular = ['target-not-regular-file', 'candidate-not-regular-file'].includes(reason.code); + const hardlinked = ['target-hardlinked', 'candidate-hardlinked'].includes(reason.code); + const message = changed + ? 'Output target changed while the rendered artifact was being prepared.' + : nonRegular + ? candidate + ? 'Temporary output candidate is no longer a regular file.' + : 'Output already exists and is not a regular file.' + : hardlinked + ? candidate + ? 'Temporary output candidate has multiple hard-link names.' + : 'Output already exists through multiple hard-link names.' + : 'Output target stability could not be determined safely before commit.'; + throwDiagnosticError(message, [{ + code: changed + ? 'output/target-changed' + : nonRegular + ? 'output/target-not-regular-file' + : hardlinked + ? 'output/target-hardlinked' + : 'output/target-indeterminate', + message, + subject: { output }, + evidence: { relation: reason }, + supportedFixes: [hardlinked + ? 'choose a non-hardlinked output path; atomic replacement cannot update every hard-link name' + : 'retry after other processes stop replacing or redirecting the output path'], + }]); +} + +function stageRenderedHtml(outputPath, html, mode) { + for (let attempt = 0; attempt < 100; attempt += 1) { + renderCandidateSequence += 1; + const candidatePath = path.join( + path.dirname(outputPath), + `.archify-render-${process.pid}-${Date.now().toString(36)}-${renderCandidateSequence}.tmp`, + ); + let descriptor; + let identity; + try { + const noFollow = process.platform === 'win32' ? 0 : (fs.constants.O_NOFOLLOW || 0); + descriptor = fs.openSync( + candidatePath, + fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_EXCL | noFollow, + mode ?? 0o666, + ); + let metadata; + try { + metadata = fs.fstatSync(descriptor, { bigint: true }); + } catch (error) { + // A transient first inspection failure must not strand the exclusive + // candidate. A successful retry binds cleanup to the still-open file; + // if both inspections fail, preserving the unknown entry is safer. + try { + const retry = fs.fstatSync(descriptor, { bigint: true }); + if (retry.isFile() && retry.ino !== 0n) { + identity = { device: retry.dev, inode: retry.ino }; + } + } catch {} + throw error; + } + if (!metadata.isFile() || metadata.ino === 0n) { + throw new Error('Temporary render candidate identity could not be verified safely.'); + } + identity = { device: metadata.dev, inode: metadata.ino }; + fs.writeFileSync(descriptor, html); + // Creation modes are filtered through the process umask. An atomic + // replacement must retain the exact permissions of an existing target, + // while a brand-new target should keep normal umask behavior. + if (mode !== null) fs.fchmodSync(descriptor, mode); + fs.closeSync(descriptor); + descriptor = undefined; + return { candidatePath, identity }; + } catch (error) { + if (descriptor !== undefined) { + try { fs.closeSync(descriptor); } catch {} + } + if (error.code === 'EEXIST') continue; + if (identity) { + const cleanup = removeOwnedRegularFile(candidatePath, identity); + if (!['removed', 'absent', 'preserved'].includes(cleanup.status)) { + const cleanupError = new Error(`${error.message}; temporary render candidate cleanup also failed.`); + cleanupError.cause = error; + throw cleanupError; + } + } + throw error; + } + } + const error = new Error(`Could not reserve a temporary render candidate beside "${outputPath}".`); + error.code = 'EEXIST'; + error.errno = -17; + error.syscall = 'open'; + throw error; +} + // Common CLI tail: fill the template and write the standalone HTML file. export function writeDiagram({ outPath, template, diagramType, meta, svg, cards, sourceEvidence = null }) { if (!START_TYPES.has(diagramType)) throw new Error(`writeDiagram: unknown diagram type ${JSON.stringify(diagramType)}`); const outputGuard = outputPathGuards.get(outPath); - if (outputGuard) resolveOutputPath(outputGuard); - fs.mkdirSync(path.dirname(outPath), { recursive: true }); - fs.writeFileSync(outPath, applyTemplate(template, { + const html = applyTemplate(template, { title: meta.title, subtitle: meta.subtitle, svg, cards: renderCards(cards), locale: meta.locale, visualPreset: meta.visual_preset || 'classic', - guidedViews: meta.views || [], sourceEvidence, - })); - outputPathGuards.delete(outPath); + }); + let candidatePath; + let candidateIdentity; + let candidateBinding; + try { + fs.mkdirSync(path.dirname(outPath), { recursive: true }); + const outputCapture = captureAtomicOutput(outPath); + if (outputCapture.status !== 'captured') throwAtomicOutputFailure(outputCapture, outPath); + const beforeStage = verifyAtomicOutput(outputCapture.snapshot); + if (beforeStage.status !== 'match') throwAtomicOutputFailure(beforeStage, outPath); + ({ candidatePath, identity: candidateIdentity } = stageRenderedHtml( + outputCapture.commitPath, + html, + outputCapture.mode, + )); + + // The renderer may spend substantial time building HTML after loadDiagram + // establishes the guard. Re-run it after staging so a last-moment alias + // cannot redirect the commit onto an input file. + if (outputGuard) resolveOutputPath(outputGuard); + const candidateCapture = captureRegularFileBinding(candidatePath, { + subject: 'candidate', + expectedSha256: createHash('sha256').update(html).digest('hex'), + expectedBytes: Buffer.byteLength(html), + expectedIdentity: candidateIdentity, + ...(outputCapture.mode === null ? {} : { expectedMode: outputCapture.mode }), + }); + if (candidateCapture.status !== 'captured') throwAtomicOutputFailure(candidateCapture, outPath); + candidateBinding = candidateCapture.binding; + const beforeCommit = verifyAtomicOutput(outputCapture.snapshot); + if (beforeCommit.status !== 'match') throwAtomicOutputFailure(beforeCommit, outPath); + const publication = publishRegularFileBinding( + candidateBinding, + candidatePath, + outputCapture.snapshot, + { subject: 'candidate' }, + ); + if (!['committed', 'committed-with-warning'].includes(publication.status)) { + throwAtomicOutputFailure(publication, outPath); + } + const releasedCandidate = releaseRegularFileBinding(candidateBinding); + candidateBinding = undefined; + if (releasedCandidate.status !== 'released') throwAtomicOutputFailure(releasedCandidate, outPath); + candidatePath = undefined; + candidateIdentity = undefined; + } catch (error) { + throwOutputError(error, outPath); + } finally { + outputPathGuards.delete(outPath); + if (candidateBinding) releaseRegularFileBinding(candidateBinding); + if (candidatePath && candidateIdentity) { + const cleanup = removeOwnedRegularFile(candidatePath, candidateIdentity); + if (!['removed', 'absent', 'preserved'].includes(cleanup.status)) { + throwAtomicOutputFailure(cleanup, outPath); + } + } + } console.log(outPath); } @@ -111,48 +372,20 @@ export function validateRelationshipIds(diagramType, diagram) { } } -// JSON Schema keeps the view object bounded; this pass checks facts that span -// collections. Keeping it here makes the same contract apply to all five -// renderers, including the zero-install standalone-validator path. -export function validateGuidedViews(diagramType, diagram) { - const views = diagram.meta?.views; - if (!Array.isArray(views) || views.length === 0) return; - const collection = SEMANTIC_COLLECTIONS[diagramType]; - const semanticIds = new Set((diagram[collection] || []).map((item) => item.id)); - const seen = new Set(); - const problems = []; - - views.forEach((view, index) => { - if (seen.has(view.id)) problems.push(`/meta/views/${index}/id duplicates view id ${JSON.stringify(view.id)}`); - seen.add(view.id); - const seenFocus = new Set(); - (view.focus || []).forEach((id, focusIndex) => { - if (seenFocus.has(id)) { - problems.push(`/meta/views/${index}/focus/${focusIndex} duplicates semantic id ${JSON.stringify(id)}`); - } - seenFocus.add(id); - if (!semanticIds.has(id)) { - problems.push(`/meta/views/${index}/focus/${focusIndex} references unknown semantic id ${JSON.stringify(id)}`); - } - }); - }); - - if (problems.length) { - throwDiagnosticProblems('Guided view validation failed', problems, { - code: 'guided-view/invalid', - subject: { diagramType, collection: 'meta.views' }, - }); - } +// Share relationship-ID semantic checks between the loader +// and workflow compiler without performing filesystem operations (see #429). +export function validateCrossCollectionContracts(diagramType, diagram) { + validateRelationshipIds(diagramType, diagram); } // Accessible name for the generated diagram SVG. -export function svgRootAttrs(meta) { +export function svgRootAttrs(meta, explicitQualityProfile) { const animation = meta.animation === 'trace' ? ' data-animation="trace"' : ''; const preset = ` data-preset="${esc(meta.visual_preset || 'classic')}"`; const engineeringProfile = meta.engineering_profile ? ` data-engineering-profile="${esc(meta.engineering_profile)}"` : ''; - const requestedProfile = process.env.ARCHIFY_QUALITY_PROFILE || meta.quality_profile; + const requestedProfile = explicitQualityProfile || process.env.ARCHIFY_QUALITY_PROFILE || meta.quality_profile; const qualityProfile = requestedProfile === 'showcase' ? 'showcase' : 'standard'; const advisory = requestedProfile ? '' : ' data-quality-gates="advisory"'; return `role="img" lang="${esc(resolveLocale(meta.locale))}" aria-labelledby="archify-diagram-title archify-diagram-description"${animation}${preset}${engineeringProfile} data-quality-profile="${esc(qualityProfile)}"${advisory}`; @@ -170,7 +403,7 @@ export function animateAttr(meta, kind, step) { if (meta.animation !== 'trace') return ''; // Ambient trace must finish inside the fixed six-second WebM capture. The // cap affects visual delay only; authored order and semantic identity stay - // untouched in the JSON, DOM, Story, and relationship contracts. + // untouched in the JSON, DOM, and relationship contracts. const safeStep = Number.isFinite(step) && step >= 0 ? Math.min(12, Math.floor(step)) : 0; return ` data-animate="${kind}" style="--step:${safeStep}"`; } diff --git a/packages/diagram-core/vendor/archify/renderers/shared/desktop-readability.mjs b/packages/diagram-core/vendor/archify/renderers/shared/desktop-readability.mjs index 1a4c249..c3292c6 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/desktop-readability.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/desktop-readability.mjs @@ -3,6 +3,11 @@ export const DESKTOP_READER_MIN_WIDTH = 960; export const DESKTOP_READER_HORIZONTAL_CHROME = 30; export const DESKTOP_READER_DIAGRAM_WIDTH = DESKTOP_READER_MIN_WIDTH - DESKTOP_READER_HORIZONTAL_CHROME; export const MIN_PROJECTED_NODE_TEXT_PX = 6; +export const DECLARED_WIDE_READER_CONTRACT = 'declared-wide-v1'; +export const DECLARED_WIDE_READER_RATIO = 1.55; +export const DECLARED_WIDE_READER_MAX_WIDTH = 1920; +export const DECLARED_WIDE_REFERENCE_BODY_HORIZONTAL_PX = 64; +export const DECLARED_WIDE_REFERENCE_DIAGRAM_HORIZONTAL_PX = 30; export function projectedNodeTextPx(sourceFontPx, viewBoxWidth, diagramWidth = DESKTOP_READER_DIAGRAM_WIDTH) { if (![sourceFontPx, viewBoxWidth, diagramWidth].every(Number.isFinite) || viewBoxWidth <= 0 || diagramWidth <= 0) { @@ -24,3 +29,104 @@ export function minimumReadableSourceTextPx( } return minimumProjectedPx / Math.min(1, diagramWidth / viewBoxWidth); } + +// This is deliberately separate from the legacy 930px projection. Architecture +// boundary convergence depends on that legacy default, while only a recognized +// v2 wide Reader may use this declared-width proof. +export function declaredWideReadabilityBudget({ + viewBoxWidth, + viewBoxHeight, + minimumSourceTextPx, + requestedMinimumTextPx, + viewportWidth = DESKTOP_READABILITY_VIEWPORT.width, + bodyHorizontalPx = DECLARED_WIDE_REFERENCE_BODY_HORIZONTAL_PX, + diagramHorizontalPx = DECLARED_WIDE_REFERENCE_DIAGRAM_HORIZONTAL_PX, + minimumReaderWidth = DESKTOP_READER_MIN_WIDTH, + maximumReaderWidth = DECLARED_WIDE_READER_MAX_WIDTH, +} = {}) { + const values = [ + viewBoxWidth, viewBoxHeight, minimumSourceTextPx, requestedMinimumTextPx, + viewportWidth, bodyHorizontalPx, diagramHorizontalPx, minimumReaderWidth, maximumReaderWidth, + ]; + if (!values.every(Number.isFinite) || viewBoxWidth <= 0 || viewBoxHeight <= 0 + || minimumSourceTextPx <= 0 || requestedMinimumTextPx <= 0 || viewportWidth <= 0 + || bodyHorizontalPx < 0 || diagramHorizontalPx < 0 || minimumReaderWidth <= 0 + || maximumReaderWidth < minimumReaderWidth || viewBoxWidth / viewBoxHeight < DECLARED_WIDE_READER_RATIO) { + return null; + } + const requestedTargetPx = Math.max(MIN_PROJECTED_NODE_TEXT_PX, requestedMinimumTextPx); + const requestedScale = Math.min(1, requestedTargetPx / minimumSourceTextPx); + const desiredReaderWidth = Math.max(minimumReaderWidth, viewBoxWidth * requestedScale + diagramHorizontalPx); + const viewportCap = Math.max(0, viewportWidth - bodyHorizontalPx); + const cap = Math.min(maximumReaderWidth, viewportCap); + const actualReaderWidth = Math.min(desiredReaderWidth, cap); + const guaranteedSvgWidth = Math.max(0, actualReaderWidth - diagramHorizontalPx); + const projectedMinimumTextPx = projectedNodeTextPx(minimumSourceTextPx, viewBoxWidth, guaranteedSvgWidth); + const limit = actualReaderWidth < desiredReaderWidth + ? (viewportCap <= maximumReaderWidth ? 'viewport-cap' : 'reader-cap') + : 'source-size'; + return { + requestedTargetPx, + requestedScale, + desiredReaderWidth, + viewportCap, + maximumReaderWidth, + actualReaderWidth, + guaranteedSvgWidth, + projectedMinimumTextPx, + hardFloorPx: MIN_PROJECTED_NODE_TEXT_PX, + hardFloorMet: projectedMinimumTextPx >= MIN_PROJECTED_NODE_TEXT_PX, + requestedTargetMet: projectedMinimumTextPx >= requestedMinimumTextPx, + limit, + }; +} + +// Vertical chrome that always stacks with the SVG at the 1440x900 desktop +// viewport, measured from the delivered Viewer with the shortest one-line +// header and no cards: body padding 12, header 39, diagram padding/border 75. +// Cards are excluded so the prediction stays a lower bound. +export const DESKTOP_FIXED_VERTICAL_CHROME_PX = Object.freeze({ body: 12, header: 39, diagram: 75 }); + +// A canvas the Reader can neither narrow (viewBox ratio below the wide +// threshold) nor scroll readably (no intrinsic-height fit) renders at the full +// reader width, so its page height is a function of the viewBox alone. Returns +// null when the Reader has a way to fit the page; otherwise the certain +// overflow at 1440x900 before any cards are counted. +export function predictedFixedWidthOverflow({ + viewBoxWidth, + viewBoxHeight, + readerFit, + diagramType, + viewport = DESKTOP_READABILITY_VIEWPORT, + bodyHorizontalPx = DECLARED_WIDE_REFERENCE_BODY_HORIZONTAL_PX, + diagramHorizontalPx = DECLARED_WIDE_REFERENCE_DIAGRAM_HORIZONTAL_PX, + chrome = DESKTOP_FIXED_VERTICAL_CHROME_PX, +} = {}) { + if (![viewBoxWidth, viewBoxHeight].every(Number.isFinite) || viewBoxWidth <= 0 || viewBoxHeight <= 0) return null; + const ratio = viewBoxWidth / viewBoxHeight; + if (readerFit === 'intrinsic-height' + || (readerFit === 'authored-height' && diagramType === 'architecture') + || ratio >= DECLARED_WIDE_READER_RATIO) return null; + const svgWidthPx = viewport.width - bodyHorizontalPx - diagramHorizontalPx; + const svgHeightPx = Math.round(svgWidthPx * viewBoxHeight / viewBoxWidth); + const fixedChromePx = chrome.body + chrome.header + chrome.diagram; + const pageHeightPx = svgHeightPx + fixedChromePx; + if (pageHeightPx <= viewport.height) return null; + return { + viewportWidth: viewport.width, + viewportHeight: viewport.height, + ratio: Math.round(ratio * 100) / 100, + wideRatio: DECLARED_WIDE_READER_RATIO, + svgWidthPx, + svgHeightPx, + fixedChromePx, + pageHeightPx, + overflowPx: pageHeightPx - viewport.height, + }; +} + +export function describeFixedWidthOverflow(issue) { + const maximumViewBoxHeight = Math.floor(issue.viewBoxWidth / issue.wideRatio); + const wideViewBoxWidth = Math.ceil(issue.viewBoxHeight * issue.wideRatio); + return `Preserve every node, relationship, and label. This ${issue.viewBoxWidth}x${issue.viewBoxHeight} canvas (ratio ${issue.ratio}) declares no intrinsic-height fit and is below the ${issue.wideRatio} wide ratio, so the desktop Reader can neither narrow it nor accept vertical scroll: it renders ${issue.svgHeightPx}px tall at the full ${issue.svgWidthPx}px width and the page reaches ${issue.pageHeightPx}px before cards against ${issue.viewportHeight}px, a certain visual-check failure. Either compact vertical spacing so meta.viewBox height is at most ${maximumViewBoxHeight} at this width, or spread content sideways so the width is at least ${wideViewBoxWidth} at this height; for architecture, omitting meta.viewBox lets the renderer size the canvas and declare the fit.`; +} diff --git a/packages/diagram-core/vendor/archify/renderers/shared/diagnostics.mjs b/packages/diagram-core/vendor/archify/renderers/shared/diagnostics.mjs index 5d74de7..c725c62 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/diagnostics.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/diagnostics.mjs @@ -53,9 +53,10 @@ export function throwDiagnosticError(message, diagnostics) { throw error; } -export function throwDiagnosticProblems(prefix, problems, { code = 'layout/constraint', subject = {} } = {}) { +export function throwDiagnosticProblems(prefix, problems, { code = 'layout/constraint', subject = {}, diagnostics: details = [] } = {}) { const messages = (problems || []).map((problem) => String(problem)); - const diagnostics = messages.map((message) => normalizedDiagnostic({ + const byMessage = new Map(details.map((entry) => [entry.message, entry])); + const diagnostics = messages.map((message) => normalizedDiagnostic(byMessage.get(message) || { code, severity: 'error', message, @@ -68,26 +69,6 @@ export function throwDiagnosticProblems(prefix, problems, { code = 'layout/const function fallbackDiagnostic(error) { const input = process.argv[2] ? path.resolve(process.argv[2]) : undefined; - if (error instanceof SyntaxError) { - return normalizedDiagnostic({ - code: 'input/json-parse', - severity: 'error', - message: `Input JSON could not be parsed: ${error.message}`, - subject: { input }, - evidence: { reason: error.message }, - supportedFixes: ['repair the JSON syntax and run validation again'], - }); - } - if (error?.code === 'ENOENT' || error?.code === 'EACCES' || error?.code === 'EISDIR') { - return normalizedDiagnostic({ - code: 'input/read', - severity: 'error', - message: `Input could not be read: ${error.message}`, - subject: { input }, - evidence: { systemCode: error.code, reason: error.message }, - supportedFixes: ['provide one readable JSON input file'], - }); - } return normalizedDiagnostic({ code: 'internal/unclassified', severity: 'error', @@ -97,11 +78,14 @@ function fallbackDiagnostic(error) { supportedFixes: [], }); } -function rendererFailure(error) { +export function rendererFailure(error) { const attached = Array.isArray(error?.archifyDiagnostics) ? error.archifyDiagnostics.map(normalizedDiagnostic) : []; - const diagnostics = recorded.length ? recorded : (attached.length ? attached : [fallbackDiagnostic(error)]); + // Earlier diagnostics do not classify a later, unrelated implementation error. + const diagnostics = attached.length + ? (recorded.length ? recorded : attached) + : [fallbackDiagnostic(error)]; return { schemaVersion: 1, ok: false, @@ -111,6 +95,19 @@ function rendererFailure(error) { }; } +// Match the public CLI's text format without making its standalone doctor +// bootstrap depend on this renderer runtime being present. +function formatDiagnostics(error, diagnostics = []) { + if (!diagnostics.length) return error; + return [ + error, + ...diagnostics.map((entry) => { + const fix = entry.supportedFixes?.length ? ` Fix: ${entry.supportedFixes.join('; ')}.` : ''; + return `[${entry.code}] ${entry.message}${fix}`; + }), + ].join('\n'); +} + const readerSignal = new Int32Array(new SharedArrayBuffer(4)); function waitForReader() { @@ -124,8 +121,24 @@ function waitForReader() { } export function installRendererDiagnosticBoundary() { - if (!DIAGNOSTIC_MODE || globalThis[boundaryKey]) return; + if (globalThis[boundaryKey]) return; globalThis[boundaryKey] = true; + if (!DIAGNOSTIC_MODE) { + process.once('uncaughtException', (error) => { + // Only errors classified at their operation boundary are author-facing. + // Preserve Node's debugging information for unexpected implementation errors. + if (!error?.archifyDiagnostics?.length) { + // The once-listener is already removed. Rethrow outside the exception + // handler so Node retains its normal stack and exit code (not code 7). + process.nextTick(() => { throw error; }); + return; + } + const payload = `${formatDiagnostics(error.message, error.archifyDiagnostics)}\n`; + process.stderr.once('error', () => process.exit(1)); + process.stderr.write(payload, () => process.exit(1)); + }); + return; + } process.on('uncaughtException', (error) => { const payload = `${JSON.stringify(rendererFailure(error))}\n`; try { diff --git a/packages/diagram-core/vendor/archify/renderers/shared/generated-validators.mjs b/packages/diagram-core/vendor/archify/renderers/shared/generated-validators.mjs index 7e2558c..bd7b678 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/generated-validators.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/generated-validators.mjs @@ -1,5 +1,6 @@ // Generated by scripts/generate-validators.mjs. Do not edit by hand. -"use strict";export const workflow = validate20;const schema31 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://github.com/tt-a1i/archify/schemas/workflow.schema.json","title":"Archify Workflow Diagram","type":"object","additionalProperties":false,"required":["schema_version","diagram_type","meta","lanes","nodes","edges"],"properties":{"schema_version":{"enum":[1,2]},"diagram_type":{"const":"workflow"},"meta":{"type":"object","additionalProperties":false,"required":["title"],"properties":{"title":{"type":"string","minLength":1},"locale":{"$ref":"common.schema.json#/$defs/locale"},"subtitle":{"type":"string"},"output":{"type":"string"},"animation":{"enum":["trace","none"]},"visual_preset":{"enum":["classic","signal-flow","blueprint","editorial"]},"quality_profile":{"enum":["standard","showcase"]},"views":{"$ref":"common.schema.json#/$defs/guidedViews"},"legend":{"type":"object","additionalProperties":false,"properties":{"mode":{"$ref":"common.schema.json#/$defs/legendMode"},"entries":{"type":"object","additionalProperties":false,"properties":{"frontend":{"$ref":"common.schema.json#/$defs/legendEntry"},"backend":{"$ref":"common.schema.json#/$defs/legendEntry"},"database":{"$ref":"common.schema.json#/$defs/legendEntry"},"cloud":{"$ref":"common.schema.json#/$defs/legendEntry"},"security":{"$ref":"common.schema.json#/$defs/legendEntry"},"messagebus":{"$ref":"common.schema.json#/$defs/legendEntry"},"external":{"$ref":"common.schema.json#/$defs/legendEntry"}}}}},"viewBox":{"type":"array","prefixItems":[{"type":"number","minimum":700},{"type":"number","minimum":240}],"items":false,"minItems":2,"maxItems":2}}},"lanes":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["id","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"variant":{"enum":["normal","exception"]}}}},"phases":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","label","fromCol","toCol"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"fromCol":{"type":"integer","minimum":0,"maximum":5},"toCol":{"type":"integer","minimum":0,"maximum":5},"variant":{"enum":["default","emphasis","security","dashed"]}}}},"groups":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","label","lane","fromCol","toCol"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"lane":{"$ref":"common.schema.json#/$defs/id"},"fromCol":{"type":"integer","minimum":0,"maximum":5},"toCol":{"type":"integer","minimum":0,"maximum":5},"variant":{"enum":["default","emphasis","security","dashed"]}}}},"mainPath":{"type":"array","minItems":2,"items":{"$ref":"common.schema.json#/$defs/id"}},"semanticChecks":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"allowedRoots":{"type":"array","items":{"$ref":"common.schema.json#/$defs/id"}},"allowedTerminals":{"type":"array","items":{"$ref":"common.schema.json#/$defs/id"}},"requiredEdges":{"type":"array","items":{"$ref":"#/$defs/semanticRelation"}},"requiredPaths":{"type":"array","items":{"$ref":"#/$defs/semanticRelation"}}}},"nodes":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["id","lane","col","type","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"lane":{"$ref":"common.schema.json#/$defs/id"},"col":{"type":"integer","minimum":0,"maximum":5},"type":{"$ref":"common.schema.json#/$defs/componentType"},"label":{"type":"string","minLength":1},"sublabel":{"type":"string"},"tag":{"type":"string"},"brand":{"$ref":"common.schema.json#/$defs/brandMark"},"width":{"type":"number","minimum":32},"height":{"type":"number","minimum":32},"yOffset":{"type":"number"}}}},"edges":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string"},"variant":{"$ref":"common.schema.json#/$defs/variant"},"role":{"enum":["main","branch","async","return","error"]},"fromSide":{"$ref":"#/$defs/side"},"toSide":{"$ref":"#/$defs/side"},"route":{"enum":["auto","straight","drop","outside-right","return-left","bottom-channel","up-channel"]},"via":{"type":"array","items":{"$ref":"common.schema.json#/$defs/point"}},"labelAt":{"$ref":"common.schema.json#/$defs/point"},"labelDx":{"type":"number"},"labelDy":{"type":"number"},"labelSegment":{"type":"integer","minimum":0},"channelX":{"type":"number"},"channelY":{"type":"number"},"bias":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0.5}}}},"cards":{"$ref":"common.schema.json#/$defs/cards"}},"$defs":{"semanticRelation":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"}}},"side":{"enum":["left","right","top","bottom"]}}};const schema33 = {"enum":["en","zh-CN"]};const schema37 = {"enum":["auto","all","hidden"]};const schema38 = {"type":"object","additionalProperties":false,"minProperties":1,"properties":{"label":{"type":"string","minLength":1,"maxLength":80},"visible":{"type":"boolean"}}};const schema35 = {"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_-]*$"};const schema57 = {"enum":["frontend","backend","database","cloud","security","messagebus","external"]};const schema58 = {"oneOf":[{"type":"string","minLength":1,"maxLength":2048,"anyOf":[{"maxLength":80,"pattern":"^[^\\r\\n]+$"},{"pattern":"^https?://"}]},{"type":"object","additionalProperties":false,"required":["url","sha256"],"properties":{"url":{"type":"string","minLength":8,"maxLength":2048,"pattern":"^https?://"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"}}}]};const schema62 = {"enum":["default","emphasis","security","dashed"]};const schema63 = {"enum":["left","right","top","bottom"]};const schema65 = {"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2};const schema67 = {"type":"array","items":{"type":"object","additionalProperties":false,"required":["dot","title","items"],"properties":{"dot":{"enum":["cyan","emerald","violet","amber","rose","orange","slate"]},"title":{"type":"string","minLength":1},"items":{"type":"array","items":{"type":"string"}}}}};const func1 = Object.prototype.hasOwnProperty;const func3 = function ucs2length(str) { +import { validatePortablePath } from './portable-path.mjs'; +"use strict";const workflowSchema = validate20;const schema31 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://github.com/tt-a1i/archify/schemas/workflow.schema.json","title":"Archify Workflow Diagram","type":"object","additionalProperties":false,"required":["schema_version","diagram_type","meta","lanes","nodes","edges"],"properties":{"schema_version":{"enum":[1,2]},"diagram_type":{"const":"workflow"},"meta":{"type":"object","additionalProperties":false,"required":["title","output"],"properties":{"title":{"type":"string","minLength":1},"locale":{"$ref":"common.schema.json#/$defs/locale"},"translations":{"$ref":"common.schema.json#/$defs/translations"},"subtitle":{"type":"string"},"output":{"$ref":"common.schema.json#/$defs/portableOutputPath"},"animation":{"enum":["trace","none"]},"visual_preset":{"enum":["classic","signal-flow","blueprint","editorial"]},"quality_profile":{"enum":["standard","showcase"]},"repository":{"$ref":"common.schema.json#/$defs/repository"},"views":{"$ref":"common.schema.json#/$defs/guidedViews"},"legend":{"type":"object","additionalProperties":false,"properties":{"mode":{"$ref":"common.schema.json#/$defs/legendMode"},"entries":{"type":"object","additionalProperties":false,"properties":{"frontend":{"$ref":"common.schema.json#/$defs/legendEntry"},"backend":{"$ref":"common.schema.json#/$defs/legendEntry"},"database":{"$ref":"common.schema.json#/$defs/legendEntry"},"cloud":{"$ref":"common.schema.json#/$defs/legendEntry"},"security":{"$ref":"common.schema.json#/$defs/legendEntry"},"messagebus":{"$ref":"common.schema.json#/$defs/legendEntry"},"external":{"$ref":"common.schema.json#/$defs/legendEntry"}}}}},"viewBox":{"type":"array","prefixItems":[{"type":"number","minimum":700},{"type":"number","minimum":240}],"items":false,"minItems":2,"maxItems":2}}},"lanes":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["id","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"variant":{"enum":["normal","exception"]}}}},"phases":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","label","fromCol","toCol"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"fromCol":{"type":"integer","minimum":0,"maximum":5},"toCol":{"type":"integer","minimum":0,"maximum":5},"variant":{"enum":["default","emphasis","security","dashed"]}}}},"groups":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","label","lane","fromCol","toCol"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"lane":{"$ref":"common.schema.json#/$defs/id"},"fromCol":{"type":"integer","minimum":0,"maximum":5},"toCol":{"type":"integer","minimum":0,"maximum":5},"variant":{"enum":["default","emphasis","security","dashed"]}}}},"mainPath":{"type":"array","minItems":2,"items":{"$ref":"common.schema.json#/$defs/id"}},"semanticChecks":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"allowedRoots":{"type":"array","items":{"$ref":"common.schema.json#/$defs/id"}},"allowedTerminals":{"type":"array","items":{"$ref":"common.schema.json#/$defs/id"}},"requiredEdges":{"type":"array","items":{"$ref":"#/$defs/semanticRelation"}},"requiredPaths":{"type":"array","items":{"$ref":"#/$defs/semanticRelation"}}}},"nodes":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["id","lane","col","type","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"lane":{"$ref":"common.schema.json#/$defs/id"},"col":{"type":"integer","minimum":0,"maximum":5},"type":{"$ref":"common.schema.json#/$defs/componentType"},"label":{"type":"string","minLength":1},"sublabel":{"type":"string"},"tag":{"type":"string"},"icon":{"$ref":"common.schema.json#/$defs/nodeIcon"},"brand":{"$ref":"common.schema.json#/$defs/brandMark"},"sources":{"$ref":"common.schema.json#/$defs/sourceReferences"},"width":{"type":"number","minimum":32},"height":{"type":"number","minimum":32},"yOffset":{"type":"number"}}}},"edges":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string"},"variant":{"$ref":"common.schema.json#/$defs/variant"},"role":{"enum":["main","branch","async","return","error"]},"fromSide":{"$ref":"#/$defs/side"},"toSide":{"$ref":"#/$defs/side"},"route":{"enum":["auto","straight","drop","outside-right","return-left","bottom-channel","up-channel"]},"via":{"type":"array","items":{"$ref":"common.schema.json#/$defs/point"}},"labelAt":{"$ref":"common.schema.json#/$defs/point"},"labelDx":{"type":"number"},"labelDy":{"type":"number"},"labelSegment":{"type":"integer","minimum":0},"channelX":{"type":"number"},"channelY":{"type":"number"},"bias":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0.5}}}},"cards":{"$ref":"common.schema.json#/$defs/cards"}},"$defs":{"semanticRelation":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"}}},"side":{"enum":["left","right","top","bottom"]}}};const schema33 = {"type":"string","pattern":"^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$","maxLength":35};const schema34 = {"type":"object","propertyNames":{"pattern":"^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":400},"maxProperties":600};const schema35 = {"description":"A portable POSIX-relative HTML output path. It must be safe to interpret identically on every supported host filesystem.","type":"string","minLength":1,"pattern":"^[^/]+(?:/[^/]+)*$","allOf":[{"pattern":"(?:^|/)[^/]+[.][Hh][Tt][Mm][Ll]$"},{"not":{"pattern":"[\\\\<>:\"|?*\\u0000-\\u001F\\u007F-\\u009F]"}},{"not":{"pattern":"[\\uD800-\\uDFFF]"}},{"not":{"pattern":"(^|/)[.]{1,2}(/|$)"}},{"not":{"pattern":"[. ](/|$)"}},{"not":{"pattern":"(^|/)[^/]{256}"}},{"not":{"pattern":"(^|/)(?:[Cc][Oo][Nn]|[Pp][Rr][Nn]|[Aa][Uu][Xx]|[Nn][Uu][Ll]|[Cc][Oo][Nn][Ii][Nn][$]|[Cc][Oo][Nn][Oo][Uu][Tt][$]|[Cc][Oo][Mm][1-9¹²³]|[Ll][Pp][Tt][1-9¹²³])(?:[.]|/|$)"}},{"not":{"pattern":"(^|/)[^/]*~[1-9][0-9]*(?:[.]|/|$)"}}]};const schema36 = {"type":"object","additionalProperties":false,"required":["url","revision"],"properties":{"url":{"type":"string","minLength":1},"provider":{"enum":["github","gitee"]},"link_mode":{"enum":["web","local-only"]},"revision":{"type":"string","pattern":"^[a-fA-F0-9]{40}$"}}};const schema40 = {"enum":["auto","all","hidden"]};const schema41 = {"type":"object","additionalProperties":false,"minProperties":1,"properties":{"label":{"type":"string","minLength":1,"maxLength":80},"visible":{"type":"boolean"}}};const schema38 = {"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_-]*$"};const schema60 = {"enum":["frontend","backend","database","cloud","security","messagebus","external"]};const schema61 = {"description":"Decorative corner icon. Omit the icon field for the type default; none hides it. Does not change type, color, or legend grouping.","enum":["calendar","clock","person","briefcase","flag","moon","frontend","backend","database","cloud","security","messagebus","external","start","active","waiting","success","failure","neutral","none"]};const schema62 = {"oneOf":[{"type":"string","minLength":1,"maxLength":2048,"anyOf":[{"maxLength":80,"pattern":"^[^\\r\\n]+$"},{"pattern":"^https?://"}]},{"type":"object","additionalProperties":false,"required":["url","sha256"],"properties":{"url":{"type":"string","minLength":8,"maxLength":2048,"pattern":"^https?://"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"}}}]};const schema63 = {"type":"array","minItems":1,"maxItems":3,"items":{"type":"object","additionalProperties":false,"required":["path"],"properties":{"path":{"type":"string","minLength":1,"maxLength":240},"line":{"type":"integer","minimum":1},"end_line":{"type":"integer","minimum":1},"label":{"type":"string","minLength":1,"maxLength":48}}}};const schema67 = {"enum":["default","emphasis","security","dashed"]};const schema68 = {"enum":["left","right","top","bottom"]};const schema70 = {"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2};const schema72 = {"type":"array","items":{"type":"object","additionalProperties":false,"required":["dot","title","items"],"properties":{"dot":{"enum":["cyan","emerald","violet","amber","rose","orange","slate"]},"title":{"type":"string","minLength":1},"items":{"type":"array","items":{"type":"string"}}}}};const func1 = Object.prototype.hasOwnProperty;const func3 = function ucs2length(str) { const len = str.length; let length = 0; let pos = 0; @@ -10,4 +11,124 @@ && (str.charCodeAt(pos) & 0xfc00) === 0xdc00) pos += 1; } return length; -};const schema34 = {"type":"array","maxItems":5,"items":{"type":"object","additionalProperties":false,"required":["id","label","focus"],"properties":{"id":{"$ref":"#/$defs/id"},"label":{"type":"string","minLength":1,"maxLength":48},"focus":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/id"}},"note":{"type":"string","maxLength":140}}}};const pattern4 = new RegExp("^[a-zA-Z][a-zA-Z0-9_-]*$", "u");function validate22(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate22.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(Array.isArray(data)){if(data.length > 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate22.errors = vErrors;return errors === 0;}validate22.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};const schema52 = {"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"}}};function validate24(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate24.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.from === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.to === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}for(const key0 in data){if(!((key0 === "from") || (key0 === "to"))){const err2 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}if(data.from !== undefined){let data0 = data.from;if(typeof data0 === "string"){if(!pattern4.test(data0)){const err3 = {instancePath:instancePath+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}else {const err4 = {instancePath:instancePath+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.to !== undefined){let data1 = data.to;if(typeof data1 === "string"){if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}}else {const err7 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}validate24.errors = vErrors;return errors === 0;}validate24.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const pattern17 = new RegExp("^[^\\r\\n]+$", "u");const pattern18 = new RegExp("^https?://", "u");const pattern20 = new RegExp("^[a-f0-9]{64}$", "u");function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/workflow.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate20.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.lanes === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "lanes"},message:"must have required property '"+"lanes"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.nodes === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "nodes"},message:"must have required property '"+"nodes"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.edges === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "edges"},message:"must have required property '"+"edges"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!(func1.call(schema31.properties, key0))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema_version !== undefined){let data0 = data.schema_version;if(!((data0 === 1) || (data0 === 2))){const err7 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/enum",keyword:"enum",params:{allowedValues: schema31.properties.schema_version.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.diagram_type !== undefined){if("workflow" !== data.diagram_type){const err8 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "workflow"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}for(const key1 in data2){if(!(func1.call(schema31.properties.meta.properties, key1))){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err13 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err14 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err15 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err16 = {instancePath:instancePath+"/meta/animation",schemaPath:"#/properties/meta/properties/animation/enum",keyword:"enum",params:{allowedValues: schema31.properties.meta.properties.animation.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err17 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"#/properties/meta/properties/visual_preset/enum",keyword:"enum",params:{allowedValues: schema31.properties.meta.properties.visual_preset.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err18 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"#/properties/meta/properties/quality_profile/enum",keyword:"enum",params:{allowedValues: schema31.properties.meta.properties.quality_profile.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data2.views !== undefined){if(!(validate22(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate22.errors : vErrors.concat(validate22.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data11 = data2.legend;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){for(const key2 in data11){if(!((key2 === "mode") || (key2 === "entries"))){const err19 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data11.mode !== undefined){let data12 = data11.mode;if(!(((data12 === "auto") || (data12 === "all")) || (data12 === "hidden"))){const err20 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema37.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data11.entries !== undefined){let data13 = data11.entries;if(data13 && typeof data13 == "object" && !Array.isArray(data13)){for(const key3 in data13){if(!(((((((key3 === "frontend") || (key3 === "backend")) || (key3 === "database")) || (key3 === "cloud")) || (key3 === "security")) || (key3 === "messagebus")) || (key3 === "external"))){const err21 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data13.frontend !== undefined){let data14 = data13.frontend;if(data14 && typeof data14 == "object" && !Array.isArray(data14)){if(Object.keys(data14).length < 1){const err22 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}for(const key4 in data14){if(!((key4 === "label") || (key4 === "visible"))){const err23 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data14.label !== undefined){let data15 = data14.label;if(typeof data15 === "string"){if(func3(data15) > 80){const err24 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(func3(data15) < 1){const err25 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data14.visible !== undefined){if(typeof data14.visible !== "boolean"){const err27 = {instancePath:instancePath+"/meta/legend/entries/frontend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data13.backend !== undefined){let data17 = data13.backend;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(Object.keys(data17).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data17){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data17.label !== undefined){let data18 = data17.label;if(typeof data18 === "string"){if(func3(data18) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data18) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data17.visible !== undefined){if(typeof data17.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/backend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data13.database !== undefined){let data20 = data13.database;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){if(Object.keys(data20).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data20){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data20.label !== undefined){let data21 = data20.label;if(typeof data21 === "string"){if(func3(data21) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data21) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data20.visible !== undefined){if(typeof data20.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/database/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data13.cloud !== undefined){let data23 = data13.cloud;if(data23 && typeof data23 == "object" && !Array.isArray(data23)){if(Object.keys(data23).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data23){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data23.label !== undefined){let data24 = data23.label;if(typeof data24 === "string"){if(func3(data24) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data24) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data23.visible !== undefined){if(typeof data23.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/cloud/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data13.security !== undefined){let data26 = data13.security;if(data26 && typeof data26 == "object" && !Array.isArray(data26)){if(Object.keys(data26).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data26){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data26.label !== undefined){let data27 = data26.label;if(typeof data27 === "string"){if(func3(data27) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data27) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data26.visible !== undefined){if(typeof data26.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data13.messagebus !== undefined){let data29 = data13.messagebus;if(data29 && typeof data29 == "object" && !Array.isArray(data29)){if(Object.keys(data29).length < 1){const err57 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}for(const key9 in data29){if(!((key9 === "label") || (key9 === "visible"))){const err58 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data29.label !== undefined){let data30 = data29.label;if(typeof data30 === "string"){if(func3(data30) > 80){const err59 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(func3(data30) < 1){const err60 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}else {const err61 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data29.visible !== undefined){if(typeof data29.visible !== "boolean"){const err62 = {instancePath:instancePath+"/meta/legend/entries/messagebus/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data13.external !== undefined){let data32 = data13.external;if(data32 && typeof data32 == "object" && !Array.isArray(data32)){if(Object.keys(data32).length < 1){const err64 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}for(const key10 in data32){if(!((key10 === "label") || (key10 === "visible"))){const err65 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data32.label !== undefined){let data33 = data32.label;if(typeof data33 === "string"){if(func3(data33) > 80){const err66 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}if(func3(data33) < 1){const err67 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}else {const err68 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data32.visible !== undefined){if(typeof data32.visible !== "boolean"){const err69 = {instancePath:instancePath+"/meta/legend/entries/external/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}}else {const err71 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}}else {const err72 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data2.viewBox !== undefined){let data35 = data2.viewBox;if(Array.isArray(data35)){if(data35.length > 2){const err73 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(data35.length < 2){const err74 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}const len0 = data35.length;if(len0 > 0){let data36 = data35[0];if((typeof data36 == "number") && (isFinite(data36))){if(data36 < 700 || isNaN(data36)){const err75 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 700},message:"must be >= 700"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}else {const err76 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}if(len0 > 1){let data37 = data35[1];if((typeof data37 == "number") && (isFinite(data37))){if(data37 < 240 || isNaN(data37)){const err77 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 240},message:"must be >= 240"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}else {const err78 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}const len1 = data35.length;if(!(len1 <= 2)){const err79 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}else {const err80 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}}else {const err81 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}if(data.lanes !== undefined){let data38 = data.lanes;if(Array.isArray(data38)){if(data38.length < 1){const err82 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}const len2 = data38.length;for(let i0=0; i0 5 || isNaN(data47)){const err103 = {instancePath:instancePath+"/phases/" + i1+"/fromCol",schemaPath:"#/properties/phases/items/properties/fromCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}if(data47 < 0 || isNaN(data47)){const err104 = {instancePath:instancePath+"/phases/" + i1+"/fromCol",schemaPath:"#/properties/phases/items/properties/fromCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}}if(data44.toCol !== undefined){let data48 = data44.toCol;if(!(((typeof data48 == "number") && (!(data48 % 1) && !isNaN(data48))) && (isFinite(data48)))){const err105 = {instancePath:instancePath+"/phases/" + i1+"/toCol",schemaPath:"#/properties/phases/items/properties/toCol/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}if((typeof data48 == "number") && (isFinite(data48))){if(data48 > 5 || isNaN(data48)){const err106 = {instancePath:instancePath+"/phases/" + i1+"/toCol",schemaPath:"#/properties/phases/items/properties/toCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}if(data48 < 0 || isNaN(data48)){const err107 = {instancePath:instancePath+"/phases/" + i1+"/toCol",schemaPath:"#/properties/phases/items/properties/toCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}}if(data44.variant !== undefined){let data49 = data44.variant;if(!((((data49 === "default") || (data49 === "emphasis")) || (data49 === "security")) || (data49 === "dashed"))){const err108 = {instancePath:instancePath+"/phases/" + i1+"/variant",schemaPath:"#/properties/phases/items/properties/variant/enum",keyword:"enum",params:{allowedValues: schema31.properties.phases.items.properties.variant.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}}else {const err109 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}}else {const err110 = {instancePath:instancePath+"/phases",schemaPath:"#/properties/phases/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}if(data.groups !== undefined){let data50 = data.groups;if(Array.isArray(data50)){const len4 = data50.length;for(let i2=0; i2 5 || isNaN(data55)){const err124 = {instancePath:instancePath+"/groups/" + i2+"/fromCol",schemaPath:"#/properties/groups/items/properties/fromCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}if(data55 < 0 || isNaN(data55)){const err125 = {instancePath:instancePath+"/groups/" + i2+"/fromCol",schemaPath:"#/properties/groups/items/properties/fromCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}}if(data51.toCol !== undefined){let data56 = data51.toCol;if(!(((typeof data56 == "number") && (!(data56 % 1) && !isNaN(data56))) && (isFinite(data56)))){const err126 = {instancePath:instancePath+"/groups/" + i2+"/toCol",schemaPath:"#/properties/groups/items/properties/toCol/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}if((typeof data56 == "number") && (isFinite(data56))){if(data56 > 5 || isNaN(data56)){const err127 = {instancePath:instancePath+"/groups/" + i2+"/toCol",schemaPath:"#/properties/groups/items/properties/toCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}if(data56 < 0 || isNaN(data56)){const err128 = {instancePath:instancePath+"/groups/" + i2+"/toCol",schemaPath:"#/properties/groups/items/properties/toCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}}if(data51.variant !== undefined){let data57 = data51.variant;if(!((((data57 === "default") || (data57 === "emphasis")) || (data57 === "security")) || (data57 === "dashed"))){const err129 = {instancePath:instancePath+"/groups/" + i2+"/variant",schemaPath:"#/properties/groups/items/properties/variant/enum",keyword:"enum",params:{allowedValues: schema31.properties.groups.items.properties.variant.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}}}else {const err130 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}}else {const err131 = {instancePath:instancePath+"/groups",schemaPath:"#/properties/groups/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}if(data.mainPath !== undefined){let data58 = data.mainPath;if(Array.isArray(data58)){if(data58.length < 2){const err132 = {instancePath:instancePath+"/mainPath",schemaPath:"#/properties/mainPath/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}const len5 = data58.length;for(let i3=0; i3 5 || isNaN(data73)){const err159 = {instancePath:instancePath+"/nodes/" + i8+"/col",schemaPath:"#/properties/nodes/items/properties/col/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}if(data73 < 0 || isNaN(data73)){const err160 = {instancePath:instancePath+"/nodes/" + i8+"/col",schemaPath:"#/properties/nodes/items/properties/col/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}}}if(data70.type !== undefined){let data74 = data70.type;if(!(((((((data74 === "frontend") || (data74 === "backend")) || (data74 === "database")) || (data74 === "cloud")) || (data74 === "security")) || (data74 === "messagebus")) || (data74 === "external"))){const err161 = {instancePath:instancePath+"/nodes/" + i8+"/type",schemaPath:"common.schema.json#/$defs/componentType/enum",keyword:"enum",params:{allowedValues: schema57.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}}if(data70.label !== undefined){let data75 = data70.label;if(typeof data75 === "string"){if(func3(data75) < 1){const err162 = {instancePath:instancePath+"/nodes/" + i8+"/label",schemaPath:"#/properties/nodes/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}else {const err163 = {instancePath:instancePath+"/nodes/" + i8+"/label",schemaPath:"#/properties/nodes/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}if(data70.sublabel !== undefined){if(typeof data70.sublabel !== "string"){const err164 = {instancePath:instancePath+"/nodes/" + i8+"/sublabel",schemaPath:"#/properties/nodes/items/properties/sublabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}if(data70.tag !== undefined){if(typeof data70.tag !== "string"){const err165 = {instancePath:instancePath+"/nodes/" + i8+"/tag",schemaPath:"#/properties/nodes/items/properties/tag/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}if(data70.brand !== undefined){let data78 = data70.brand;const _errs180 = errors;let valid55 = false;let passing0 = null;const _errs181 = errors;const _errs183 = errors;let valid56 = false;const _errs184 = errors;if(typeof data78 === "string"){if(func3(data78) > 80){const err166 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}if(!pattern17.test(data78)){const err167 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}var _valid1 = _errs184 === errors;valid56 = valid56 || _valid1;const _errs185 = errors;if(typeof data78 === "string"){if(!pattern18.test(data78)){const err168 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}var _valid1 = _errs185 === errors;valid56 = valid56 || _valid1;if(!valid56){const err169 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}else {errors = _errs183;if(vErrors !== null){if(_errs183){vErrors.length = _errs183;}else {vErrors = null;}}}if(typeof data78 === "string"){if(func3(data78) > 2048){const err170 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}if(func3(data78) < 1){const err171 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}else {const err172 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}var _valid0 = _errs181 === errors;if(_valid0){valid55 = true;passing0 = 0;}const _errs186 = errors;if(data78 && typeof data78 == "object" && !Array.isArray(data78)){if(data78.url === undefined){const err173 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}if(data78.sha256 === undefined){const err174 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}for(const key16 in data78){if(!((key16 === "url") || (key16 === "sha256"))){const err175 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key16},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}if(data78.url !== undefined){let data79 = data78.url;if(typeof data79 === "string"){if(func3(data79) > 2048){const err176 = {instancePath:instancePath+"/nodes/" + i8+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}if(func3(data79) < 8){const err177 = {instancePath:instancePath+"/nodes/" + i8+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}if(!pattern18.test(data79)){const err178 = {instancePath:instancePath+"/nodes/" + i8+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}}else {const err179 = {instancePath:instancePath+"/nodes/" + i8+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}if(data78.sha256 !== undefined){let data80 = data78.sha256;if(typeof data80 === "string"){if(!pattern20.test(data80)){const err180 = {instancePath:instancePath+"/nodes/" + i8+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}else {const err181 = {instancePath:instancePath+"/nodes/" + i8+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}}}else {const err182 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}var _valid0 = _errs186 === errors;if(_valid0 && valid55){valid55 = false;passing0 = [passing0, 1];}else {if(_valid0){valid55 = true;passing0 = 1;}}if(!valid55){const err183 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}else {errors = _errs180;if(vErrors !== null){if(_errs180){vErrors.length = _errs180;}else {vErrors = null;}}}}if(data70.width !== undefined){let data81 = data70.width;if((typeof data81 == "number") && (isFinite(data81))){if(data81 < 32 || isNaN(data81)){const err184 = {instancePath:instancePath+"/nodes/" + i8+"/width",schemaPath:"#/properties/nodes/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 32},message:"must be >= 32"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}}else {const err185 = {instancePath:instancePath+"/nodes/" + i8+"/width",schemaPath:"#/properties/nodes/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}}if(data70.height !== undefined){let data82 = data70.height;if((typeof data82 == "number") && (isFinite(data82))){if(data82 < 32 || isNaN(data82)){const err186 = {instancePath:instancePath+"/nodes/" + i8+"/height",schemaPath:"#/properties/nodes/items/properties/height/minimum",keyword:"minimum",params:{comparison: ">=", limit: 32},message:"must be >= 32"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}}else {const err187 = {instancePath:instancePath+"/nodes/" + i8+"/height",schemaPath:"#/properties/nodes/items/properties/height/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}}if(data70.yOffset !== undefined){let data83 = data70.yOffset;if(!((typeof data83 == "number") && (isFinite(data83)))){const err188 = {instancePath:instancePath+"/nodes/" + i8+"/yOffset",schemaPath:"#/properties/nodes/items/properties/yOffset/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}}}else {const err189 = {instancePath:instancePath+"/nodes/" + i8,schemaPath:"#/properties/nodes/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}}else {const err190 = {instancePath:instancePath+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}}if(data.edges !== undefined){let data84 = data.edges;if(Array.isArray(data84)){const len11 = data84.length;for(let i9=0; i9 2){const err206 = {instancePath:instancePath+"/edges/" + i9+"/via/" + i10,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err206];}else {vErrors.push(err206);}errors++;}if(data96.length < 2){const err207 = {instancePath:instancePath+"/edges/" + i9+"/via/" + i10,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err207];}else {vErrors.push(err207);}errors++;}const len13 = data96.length;if(len13 > 0){let data97 = data96[0];if(!((typeof data97 == "number") && (isFinite(data97)))){const err208 = {instancePath:instancePath+"/edges/" + i9+"/via/" + i10+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err208];}else {vErrors.push(err208);}errors++;}}if(len13 > 1){let data98 = data96[1];if(!((typeof data98 == "number") && (isFinite(data98)))){const err209 = {instancePath:instancePath+"/edges/" + i9+"/via/" + i10+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err209];}else {vErrors.push(err209);}errors++;}}const len14 = data96.length;if(!(len14 <= 2)){const err210 = {instancePath:instancePath+"/edges/" + i9+"/via/" + i10,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}}else {const err211 = {instancePath:instancePath+"/edges/" + i9+"/via/" + i10,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err211];}else {vErrors.push(err211);}errors++;}}}else {const err212 = {instancePath:instancePath+"/edges/" + i9+"/via",schemaPath:"#/properties/edges/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}}if(data85.labelAt !== undefined){let data99 = data85.labelAt;if(Array.isArray(data99)){if(data99.length > 2){const err213 = {instancePath:instancePath+"/edges/" + i9+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err213];}else {vErrors.push(err213);}errors++;}if(data99.length < 2){const err214 = {instancePath:instancePath+"/edges/" + i9+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err214];}else {vErrors.push(err214);}errors++;}const len15 = data99.length;if(len15 > 0){let data100 = data99[0];if(!((typeof data100 == "number") && (isFinite(data100)))){const err215 = {instancePath:instancePath+"/edges/" + i9+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err215];}else {vErrors.push(err215);}errors++;}}if(len15 > 1){let data101 = data99[1];if(!((typeof data101 == "number") && (isFinite(data101)))){const err216 = {instancePath:instancePath+"/edges/" + i9+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}}const len16 = data99.length;if(!(len16 <= 2)){const err217 = {instancePath:instancePath+"/edges/" + i9+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}}else {const err218 = {instancePath:instancePath+"/edges/" + i9+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}}if(data85.labelDx !== undefined){let data102 = data85.labelDx;if(!((typeof data102 == "number") && (isFinite(data102)))){const err219 = {instancePath:instancePath+"/edges/" + i9+"/labelDx",schemaPath:"#/properties/edges/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}}if(data85.labelDy !== undefined){let data103 = data85.labelDy;if(!((typeof data103 == "number") && (isFinite(data103)))){const err220 = {instancePath:instancePath+"/edges/" + i9+"/labelDy",schemaPath:"#/properties/edges/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}}if(data85.labelSegment !== undefined){let data104 = data85.labelSegment;if(!(((typeof data104 == "number") && (!(data104 % 1) && !isNaN(data104))) && (isFinite(data104)))){const err221 = {instancePath:instancePath+"/edges/" + i9+"/labelSegment",schemaPath:"#/properties/edges/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err221];}else {vErrors.push(err221);}errors++;}if((typeof data104 == "number") && (isFinite(data104))){if(data104 < 0 || isNaN(data104)){const err222 = {instancePath:instancePath+"/edges/" + i9+"/labelSegment",schemaPath:"#/properties/edges/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err222];}else {vErrors.push(err222);}errors++;}}}if(data85.channelX !== undefined){let data105 = data85.channelX;if(!((typeof data105 == "number") && (isFinite(data105)))){const err223 = {instancePath:instancePath+"/edges/" + i9+"/channelX",schemaPath:"#/properties/edges/items/properties/channelX/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err223];}else {vErrors.push(err223);}errors++;}}if(data85.channelY !== undefined){let data106 = data85.channelY;if(!((typeof data106 == "number") && (isFinite(data106)))){const err224 = {instancePath:instancePath+"/edges/" + i9+"/channelY",schemaPath:"#/properties/edges/items/properties/channelY/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err224];}else {vErrors.push(err224);}errors++;}}if(data85.bias !== undefined){let data107 = data85.bias;if((typeof data107 == "number") && (isFinite(data107))){if(data107 > 1 || isNaN(data107)){const err225 = {instancePath:instancePath+"/edges/" + i9+"/bias",schemaPath:"#/properties/edges/items/properties/bias/maximum",keyword:"maximum",params:{comparison: "<=", limit: 1},message:"must be <= 1"};if(vErrors === null){vErrors = [err225];}else {vErrors.push(err225);}errors++;}if(data107 < 0 || isNaN(data107)){const err226 = {instancePath:instancePath+"/edges/" + i9+"/bias",schemaPath:"#/properties/edges/items/properties/bias/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}}else {const err227 = {instancePath:instancePath+"/edges/" + i9+"/bias",schemaPath:"#/properties/edges/items/properties/bias/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}}if(data85.width !== undefined){let data108 = data85.width;if((typeof data108 == "number") && (isFinite(data108))){if(data108 < 0.5 || isNaN(data108)){const err228 = {instancePath:instancePath+"/edges/" + i9+"/width",schemaPath:"#/properties/edges/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err228];}else {vErrors.push(err228);}errors++;}}else {const err229 = {instancePath:instancePath+"/edges/" + i9+"/width",schemaPath:"#/properties/edges/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err229];}else {vErrors.push(err229);}errors++;}}}else {const err230 = {instancePath:instancePath+"/edges/" + i9,schemaPath:"#/properties/edges/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err230];}else {vErrors.push(err230);}errors++;}}}else {const err231 = {instancePath:instancePath+"/edges",schemaPath:"#/properties/edges/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err231];}else {vErrors.push(err231);}errors++;}}if(data.cards !== undefined){let data109 = data.cards;if(Array.isArray(data109)){const len17 = data109.length;for(let i11=0; i11 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate28.errors = vErrors;return errors === 0;}validate28.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate27(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/sequence.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate27.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.participants === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "participants"},message:"must have required property '"+"participants"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.messages === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "messages"},message:"must have required property '"+"messages"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "participants")) || (key0 === "segments")) || (key0 === "messages")) || (key0 === "activations")) || (key0 === "cards"))){const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err6 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.diagram_type !== undefined){if("sequence" !== data.diagram_type){const err7 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "sequence"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err8 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}for(const key1 in data2){if(!(func1.call(schema68.properties.meta.properties, key1))){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err10 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err12 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err13 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err14 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err15 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema70.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err16 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema71.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err17 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema72.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.column_fit !== undefined){let data10 = data2.column_fit;if(!((data10 === "fixed") || (data10 === "spread"))){const err18 = {instancePath:instancePath+"/meta/column_fit",schemaPath:"#/properties/meta/properties/column_fit/enum",keyword:"enum",params:{allowedValues: schema68.properties.meta.properties.column_fit.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data2.views !== undefined){if(!(validate28(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate28.errors : vErrors.concat(validate28.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data12 = data2.legend;if(data12 && typeof data12 == "object" && !Array.isArray(data12)){for(const key2 in data12){if(!((key2 === "mode") || (key2 === "entries"))){const err19 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data12.mode !== undefined){let data13 = data12.mode;if(!(((data13 === "auto") || (data13 === "all")) || (data13 === "hidden"))){const err20 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema37.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data12.entries !== undefined){let data14 = data12.entries;if(data14 && typeof data14 == "object" && !Array.isArray(data14)){for(const key3 in data14){if(!(((((key3 === "default") || (key3 === "emphasis")) || (key3 === "security")) || (key3 === "dashed")) || (key3 === "return"))){const err21 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data14.default !== undefined){let data15 = data14.default;if(data15 && typeof data15 == "object" && !Array.isArray(data15)){if(Object.keys(data15).length < 1){const err22 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}for(const key4 in data15){if(!((key4 === "label") || (key4 === "visible"))){const err23 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data15.label !== undefined){let data16 = data15.label;if(typeof data16 === "string"){if(func3(data16) > 80){const err24 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(func3(data16) < 1){const err25 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data15.visible !== undefined){if(typeof data15.visible !== "boolean"){const err27 = {instancePath:instancePath+"/meta/legend/entries/default/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data14.emphasis !== undefined){let data18 = data14.emphasis;if(data18 && typeof data18 == "object" && !Array.isArray(data18)){if(Object.keys(data18).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data18){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data18.label !== undefined){let data19 = data18.label;if(typeof data19 === "string"){if(func3(data19) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data19) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data18.visible !== undefined){if(typeof data18.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/emphasis/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data14.security !== undefined){let data21 = data14.security;if(data21 && typeof data21 == "object" && !Array.isArray(data21)){if(Object.keys(data21).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data21){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data21.label !== undefined){let data22 = data21.label;if(typeof data22 === "string"){if(func3(data22) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data22) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data21.visible !== undefined){if(typeof data21.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data14.dashed !== undefined){let data24 = data14.dashed;if(data24 && typeof data24 == "object" && !Array.isArray(data24)){if(Object.keys(data24).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data24){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data24.label !== undefined){let data25 = data24.label;if(typeof data25 === "string"){if(func3(data25) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data25) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data24.visible !== undefined){if(typeof data24.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/dashed/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data14.return !== undefined){let data27 = data14.return;if(data27 && typeof data27 == "object" && !Array.isArray(data27)){if(Object.keys(data27).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/return",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data27){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/return",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data27.label !== undefined){let data28 = data27.label;if(typeof data28 === "string"){if(func3(data28) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/return/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data28) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/return/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/return/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data27.visible !== undefined){if(typeof data27.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/return/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/return",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}}else {const err57 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}}else {const err58 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data2.viewBox !== undefined){let data30 = data2.viewBox;if(Array.isArray(data30)){if(data30.length > 2){const err59 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(data30.length < 2){const err60 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}const len0 = data30.length;if(len0 > 0){let data31 = data30[0];if((typeof data31 == "number") && (isFinite(data31))){if(data31 < 480 || isNaN(data31)){const err61 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 480},message:"must be >= 480"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}else {const err62 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}if(len0 > 1){let data32 = data30[1];if((typeof data32 == "number") && (isFinite(data32))){if(data32 < 480 || isNaN(data32)){const err63 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 480},message:"must be >= 480"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}else {const err64 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}const len1 = data30.length;if(!(len1 <= 2)){const err65 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}else {const err66 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}}else {const err67 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data.participants !== undefined){let data33 = data.participants;if(Array.isArray(data33)){if(data33.length < 2){const err68 = {instancePath:instancePath+"/participants",schemaPath:"#/properties/participants/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}const len2 = data33.length;for(let i0=0; i0 80){const err79 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}if(!pattern17.test(data39)){const err80 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}var _valid1 = _errs97 === errors;valid27 = valid27 || _valid1;const _errs98 = errors;if(typeof data39 === "string"){if(!pattern18.test(data39)){const err81 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}var _valid1 = _errs98 === errors;valid27 = valid27 || _valid1;if(!valid27){const err82 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}else {errors = _errs96;if(vErrors !== null){if(_errs96){vErrors.length = _errs96;}else {vErrors = null;}}}if(typeof data39 === "string"){if(func3(data39) > 2048){const err83 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}if(func3(data39) < 1){const err84 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}else {const err85 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}var _valid0 = _errs94 === errors;if(_valid0){valid26 = true;passing0 = 0;}const _errs99 = errors;if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.url === undefined){const err86 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}if(data39.sha256 === undefined){const err87 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}for(const key10 in data39){if(!((key10 === "url") || (key10 === "sha256"))){const err88 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data39.url !== undefined){let data40 = data39.url;if(typeof data40 === "string"){if(func3(data40) > 2048){const err89 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if(func3(data40) < 8){const err90 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(!pattern18.test(data40)){const err91 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}else {const err92 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}if(data39.sha256 !== undefined){let data41 = data39.sha256;if(typeof data41 === "string"){if(!pattern20.test(data41)){const err93 = {instancePath:instancePath+"/participants/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}else {const err94 = {instancePath:instancePath+"/participants/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}}else {const err95 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}var _valid0 = _errs99 === errors;if(_valid0 && valid26){valid26 = false;passing0 = [passing0, 1];}else {if(_valid0){valid26 = true;passing0 = 1;}}if(!valid26){const err96 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}else {errors = _errs93;if(vErrors !== null){if(_errs93){vErrors.length = _errs93;}else {vErrors = null;}}}}}else {const err97 = {instancePath:instancePath+"/participants/" + i0,schemaPath:"#/properties/participants/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}}else {const err98 = {instancePath:instancePath+"/participants",schemaPath:"#/properties/participants/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}if(data.segments !== undefined){let data42 = data.segments;if(Array.isArray(data42)){const len3 = data42.length;for(let i1=0; i1=", limit: 160},message:"must be >= 160"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}}else {const err122 = {instancePath:instancePath+"/messages/" + i2+"/y",schemaPath:"#/properties/messages/items/properties/y/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}}if(data48.label !== undefined){let data53 = data48.label;if(typeof data53 === "string"){if(func3(data53) < 1){const err123 = {instancePath:instancePath+"/messages/" + i2+"/label",schemaPath:"#/properties/messages/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}else {const err124 = {instancePath:instancePath+"/messages/" + i2+"/label",schemaPath:"#/properties/messages/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}}if(data48.variant !== undefined){let data54 = data48.variant;if(!(((((data54 === "default") || (data54 === "emphasis")) || (data54 === "security")) || (data54 === "dashed")) || (data54 === "return"))){const err125 = {instancePath:instancePath+"/messages/" + i2+"/variant",schemaPath:"#/properties/messages/items/properties/variant/enum",keyword:"enum",params:{allowedValues: schema68.properties.messages.items.properties.variant.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}if(data48.note !== undefined){if(typeof data48.note !== "string"){const err126 = {instancePath:instancePath+"/messages/" + i2+"/note",schemaPath:"#/properties/messages/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}}else {const err127 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}}else {const err128 = {instancePath:instancePath+"/messages",schemaPath:"#/properties/messages/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}if(data.activations !== undefined){let data56 = data.activations;if(Array.isArray(data56)){const len5 = data56.length;for(let i3=0; i3 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate31.errors = vErrors;return errors === 0;}validate31.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate30(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/dataflow.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate30.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.stages === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "stages"},message:"must have required property '"+"stages"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.nodes === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "nodes"},message:"must have required property '"+"nodes"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.flows === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "flows"},message:"must have required property '"+"flows"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!(((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "stages")) || (key0 === "nodes")) || (key0 === "flows")) || (key0 === "cards"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err7 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.diagram_type !== undefined){if("dataflow" !== data.diagram_type){const err8 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "dataflow"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}for(const key1 in data2){if(!(func1.call(schema91.properties.meta.properties, key1))){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err13 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err14 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err15 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err16 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema70.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err17 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema71.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err18 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema72.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data2.views !== undefined){if(!(validate31(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate31.errors : vErrors.concat(validate31.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data11 = data2.legend;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){for(const key2 in data11){if(!((key2 === "mode") || (key2 === "entries"))){const err19 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data11.mode !== undefined){let data12 = data11.mode;if(!(((data12 === "auto") || (data12 === "all")) || (data12 === "hidden"))){const err20 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema37.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data11.entries !== undefined){let data13 = data11.entries;if(data13 && typeof data13 == "object" && !Array.isArray(data13)){for(const key3 in data13){if(!(((((key3 === "default") || (key3 === "emphasis")) || (key3 === "security")) || (key3 === "dashed")) || (key3 === "database"))){const err21 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data13.default !== undefined){let data14 = data13.default;if(data14 && typeof data14 == "object" && !Array.isArray(data14)){if(Object.keys(data14).length < 1){const err22 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}for(const key4 in data14){if(!((key4 === "label") || (key4 === "visible"))){const err23 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data14.label !== undefined){let data15 = data14.label;if(typeof data15 === "string"){if(func3(data15) > 80){const err24 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(func3(data15) < 1){const err25 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data14.visible !== undefined){if(typeof data14.visible !== "boolean"){const err27 = {instancePath:instancePath+"/meta/legend/entries/default/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data13.emphasis !== undefined){let data17 = data13.emphasis;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(Object.keys(data17).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data17){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data17.label !== undefined){let data18 = data17.label;if(typeof data18 === "string"){if(func3(data18) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data18) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data17.visible !== undefined){if(typeof data17.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/emphasis/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data13.security !== undefined){let data20 = data13.security;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){if(Object.keys(data20).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data20){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data20.label !== undefined){let data21 = data20.label;if(typeof data21 === "string"){if(func3(data21) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data21) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data20.visible !== undefined){if(typeof data20.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data13.dashed !== undefined){let data23 = data13.dashed;if(data23 && typeof data23 == "object" && !Array.isArray(data23)){if(Object.keys(data23).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data23){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data23.label !== undefined){let data24 = data23.label;if(typeof data24 === "string"){if(func3(data24) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data24) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data23.visible !== undefined){if(typeof data23.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/dashed/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data13.database !== undefined){let data26 = data13.database;if(data26 && typeof data26 == "object" && !Array.isArray(data26)){if(Object.keys(data26).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data26){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data26.label !== undefined){let data27 = data26.label;if(typeof data27 === "string"){if(func3(data27) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data27) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data26.visible !== undefined){if(typeof data26.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/database/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}}else {const err57 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}}else {const err58 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data2.viewBox !== undefined){let data29 = data2.viewBox;if(Array.isArray(data29)){if(data29.length > 2){const err59 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(data29.length < 2){const err60 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}const len0 = data29.length;if(len0 > 0){let data30 = data29[0];if((typeof data30 == "number") && (isFinite(data30))){if(data30 < 360 || isNaN(data30)){const err61 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 360},message:"must be >= 360"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}else {const err62 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}if(len0 > 1){let data31 = data29[1];if((typeof data31 == "number") && (isFinite(data31))){if(data31 < 360 || isNaN(data31)){const err63 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 360},message:"must be >= 360"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}else {const err64 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}const len1 = data29.length;if(!(len1 <= 2)){const err65 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}else {const err66 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}}else {const err67 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data.stages !== undefined){let data32 = data.stages;if(Array.isArray(data32)){if(data32.length > 5){const err68 = {instancePath:instancePath+"/stages",schemaPath:"#/properties/stages/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}if(data32.length < 2){const err69 = {instancePath:instancePath+"/stages",schemaPath:"#/properties/stages/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}const len2 = data32.length;for(let i0=0; i0 80){const err90 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(!pattern17.test(data42)){const err91 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}var _valid1 = _errs105 === errors;valid30 = valid30 || _valid1;const _errs106 = errors;if(typeof data42 === "string"){if(!pattern18.test(data42)){const err92 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}var _valid1 = _errs106 === errors;valid30 = valid30 || _valid1;if(!valid30){const err93 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}else {errors = _errs104;if(vErrors !== null){if(_errs104){vErrors.length = _errs104;}else {vErrors = null;}}}if(typeof data42 === "string"){if(func3(data42) > 2048){const err94 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}if(func3(data42) < 1){const err95 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}else {const err96 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}var _valid0 = _errs102 === errors;if(_valid0){valid29 = true;passing0 = 0;}const _errs107 = errors;if(data42 && typeof data42 == "object" && !Array.isArray(data42)){if(data42.url === undefined){const err97 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}if(data42.sha256 === undefined){const err98 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}for(const key11 in data42){if(!((key11 === "url") || (key11 === "sha256"))){const err99 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data42.url !== undefined){let data43 = data42.url;if(typeof data43 === "string"){if(func3(data43) > 2048){const err100 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}if(func3(data43) < 8){const err101 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}if(!pattern18.test(data43)){const err102 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}else {const err103 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}if(data42.sha256 !== undefined){let data44 = data42.sha256;if(typeof data44 === "string"){if(!pattern20.test(data44)){const err104 = {instancePath:instancePath+"/nodes/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}else {const err105 = {instancePath:instancePath+"/nodes/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}}else {const err106 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}var _valid0 = _errs107 === errors;if(_valid0 && valid29){valid29 = false;passing0 = [passing0, 1];}else {if(_valid0){valid29 = true;passing0 = 1;}}if(!valid29){const err107 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}else {errors = _errs101;if(vErrors !== null){if(_errs101){vErrors.length = _errs101;}else {vErrors = null;}}}}if(data36.stage !== undefined){let data45 = data36.stage;if(!(((typeof data45 == "number") && (!(data45 % 1) && !isNaN(data45))) && (isFinite(data45)))){const err108 = {instancePath:instancePath+"/nodes/" + i1+"/stage",schemaPath:"#/properties/nodes/items/properties/stage/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}if((typeof data45 == "number") && (isFinite(data45))){if(data45 < 0 || isNaN(data45)){const err109 = {instancePath:instancePath+"/nodes/" + i1+"/stage",schemaPath:"#/properties/nodes/items/properties/stage/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}}if(data36.row !== undefined){let data46 = data36.row;if(!(((typeof data46 == "number") && (!(data46 % 1) && !isNaN(data46))) && (isFinite(data46)))){const err110 = {instancePath:instancePath+"/nodes/" + i1+"/row",schemaPath:"#/properties/nodes/items/properties/row/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}if((typeof data46 == "number") && (isFinite(data46))){if(data46 < 0 || isNaN(data46)){const err111 = {instancePath:instancePath+"/nodes/" + i1+"/row",schemaPath:"#/properties/nodes/items/properties/row/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}}if(data36.width !== undefined){let data47 = data36.width;if((typeof data47 == "number") && (isFinite(data47))){if(data47 < 48 || isNaN(data47)){const err112 = {instancePath:instancePath+"/nodes/" + i1+"/width",schemaPath:"#/properties/nodes/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 48},message:"must be >= 48"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}else {const err113 = {instancePath:instancePath+"/nodes/" + i1+"/width",schemaPath:"#/properties/nodes/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}if(data36.height !== undefined){let data48 = data36.height;if((typeof data48 == "number") && (isFinite(data48))){if(data48 < 36 || isNaN(data48)){const err114 = {instancePath:instancePath+"/nodes/" + i1+"/height",schemaPath:"#/properties/nodes/items/properties/height/minimum",keyword:"minimum",params:{comparison: ">=", limit: 36},message:"must be >= 36"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}else {const err115 = {instancePath:instancePath+"/nodes/" + i1+"/height",schemaPath:"#/properties/nodes/items/properties/height/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}if(data36.yOffset !== undefined){let data49 = data36.yOffset;if(!((typeof data49 == "number") && (isFinite(data49)))){const err116 = {instancePath:instancePath+"/nodes/" + i1+"/yOffset",schemaPath:"#/properties/nodes/items/properties/yOffset/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}}else {const err117 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}}else {const err118 = {instancePath:instancePath+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}if(data.flows !== undefined){let data50 = data.flows;if(Array.isArray(data50)){const len4 = data50.length;for(let i2=0; i2 2){const err138 = {instancePath:instancePath+"/flows/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}if(data63.length < 2){const err139 = {instancePath:instancePath+"/flows/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}const len5 = data63.length;if(len5 > 0){let data64 = data63[0];if(!((typeof data64 == "number") && (isFinite(data64)))){const err140 = {instancePath:instancePath+"/flows/" + i2+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}if(len5 > 1){let data65 = data63[1];if(!((typeof data65 == "number") && (isFinite(data65)))){const err141 = {instancePath:instancePath+"/flows/" + i2+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}const len6 = data63.length;if(!(len6 <= 2)){const err142 = {instancePath:instancePath+"/flows/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}else {const err143 = {instancePath:instancePath+"/flows/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}if(data51.labelDx !== undefined){let data66 = data51.labelDx;if(!((typeof data66 == "number") && (isFinite(data66)))){const err144 = {instancePath:instancePath+"/flows/" + i2+"/labelDx",schemaPath:"#/properties/flows/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}if(data51.labelDy !== undefined){let data67 = data51.labelDy;if(!((typeof data67 == "number") && (isFinite(data67)))){const err145 = {instancePath:instancePath+"/flows/" + i2+"/labelDy",schemaPath:"#/properties/flows/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}if(data51.labelSegment !== undefined){let data68 = data51.labelSegment;if(!(((typeof data68 == "number") && (!(data68 % 1) && !isNaN(data68))) && (isFinite(data68)))){const err146 = {instancePath:instancePath+"/flows/" + i2+"/labelSegment",schemaPath:"#/properties/flows/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}if((typeof data68 == "number") && (isFinite(data68))){if(data68 < 0 || isNaN(data68)){const err147 = {instancePath:instancePath+"/flows/" + i2+"/labelSegment",schemaPath:"#/properties/flows/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}}}if(data51.via !== undefined){let data69 = data51.via;if(Array.isArray(data69)){const len7 = data69.length;for(let i3=0; i3 2){const err148 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}if(data70.length < 2){const err149 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}const len8 = data70.length;if(len8 > 0){let data71 = data70[0];if(!((typeof data71 == "number") && (isFinite(data71)))){const err150 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}if(len8 > 1){let data72 = data70[1];if(!((typeof data72 == "number") && (isFinite(data72)))){const err151 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}}const len9 = data70.length;if(!(len9 <= 2)){const err152 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}}else {const err153 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}}else {const err154 = {instancePath:instancePath+"/flows/" + i2+"/via",schemaPath:"#/properties/flows/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}if(data51.width !== undefined){let data73 = data51.width;if((typeof data73 == "number") && (isFinite(data73))){if(data73 < 0.5 || isNaN(data73)){const err155 = {instancePath:instancePath+"/flows/" + i2+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}}else {const err156 = {instancePath:instancePath+"/flows/" + i2+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}}}else {const err157 = {instancePath:instancePath+"/flows/" + i2,schemaPath:"#/properties/flows/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}}}else {const err158 = {instancePath:instancePath+"/flows",schemaPath:"#/properties/flows/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}}if(data.cards !== undefined){let data74 = data.cards;if(Array.isArray(data74)){const len10 = data74.length;for(let i4=0; i4 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate34.errors = vErrors;return errors === 0;}validate34.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate33(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/lifecycle.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate33.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.lanes === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "lanes"},message:"must have required property '"+"lanes"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.states === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "states"},message:"must have required property '"+"states"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.transitions === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "transitions"},message:"must have required property '"+"transitions"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!(((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "lanes")) || (key0 === "states")) || (key0 === "transitions")) || (key0 === "cards"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err7 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.diagram_type !== undefined){if("lifecycle" !== data.diagram_type){const err8 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "lifecycle"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}for(const key1 in data2){if(!(func1.call(schema118.properties.meta.properties, key1))){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err13 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err14 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err15 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err16 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema70.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err17 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema71.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err18 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema72.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data2.views !== undefined){if(!(validate34(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate34.errors : vErrors.concat(validate34.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data11 = data2.legend;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){for(const key2 in data11){if(!((key2 === "mode") || (key2 === "entries"))){const err19 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data11.mode !== undefined){let data12 = data11.mode;if(!(((data12 === "auto") || (data12 === "all")) || (data12 === "hidden"))){const err20 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema37.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data11.entries !== undefined){let data13 = data11.entries;if(data13 && typeof data13 == "object" && !Array.isArray(data13)){for(const key3 in data13){if(!((((((((key3 === "start") || (key3 === "active")) || (key3 === "waiting")) || (key3 === "decision")) || (key3 === "success")) || (key3 === "failure")) || (key3 === "neutral")) || (key3 === "external"))){const err21 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data13.start !== undefined){let data14 = data13.start;if(data14 && typeof data14 == "object" && !Array.isArray(data14)){if(Object.keys(data14).length < 1){const err22 = {instancePath:instancePath+"/meta/legend/entries/start",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}for(const key4 in data14){if(!((key4 === "label") || (key4 === "visible"))){const err23 = {instancePath:instancePath+"/meta/legend/entries/start",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data14.label !== undefined){let data15 = data14.label;if(typeof data15 === "string"){if(func3(data15) > 80){const err24 = {instancePath:instancePath+"/meta/legend/entries/start/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(func3(data15) < 1){const err25 = {instancePath:instancePath+"/meta/legend/entries/start/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/legend/entries/start/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data14.visible !== undefined){if(typeof data14.visible !== "boolean"){const err27 = {instancePath:instancePath+"/meta/legend/entries/start/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/meta/legend/entries/start",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data13.active !== undefined){let data17 = data13.active;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(Object.keys(data17).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/active",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data17){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/active",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data17.label !== undefined){let data18 = data17.label;if(typeof data18 === "string"){if(func3(data18) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/active/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data18) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/active/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/active/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data17.visible !== undefined){if(typeof data17.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/active/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/active",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data13.waiting !== undefined){let data20 = data13.waiting;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){if(Object.keys(data20).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/waiting",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data20){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/waiting",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data20.label !== undefined){let data21 = data20.label;if(typeof data21 === "string"){if(func3(data21) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/waiting/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data21) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/waiting/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/waiting/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data20.visible !== undefined){if(typeof data20.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/waiting/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/waiting",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data13.decision !== undefined){let data23 = data13.decision;if(data23 && typeof data23 == "object" && !Array.isArray(data23)){if(Object.keys(data23).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/decision",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data23){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/decision",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data23.label !== undefined){let data24 = data23.label;if(typeof data24 === "string"){if(func3(data24) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/decision/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data24) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/decision/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/decision/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data23.visible !== undefined){if(typeof data23.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/decision/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/decision",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data13.success !== undefined){let data26 = data13.success;if(data26 && typeof data26 == "object" && !Array.isArray(data26)){if(Object.keys(data26).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/success",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data26){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/success",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data26.label !== undefined){let data27 = data26.label;if(typeof data27 === "string"){if(func3(data27) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/success/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data27) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/success/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/success/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data26.visible !== undefined){if(typeof data26.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/success/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/success",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data13.failure !== undefined){let data29 = data13.failure;if(data29 && typeof data29 == "object" && !Array.isArray(data29)){if(Object.keys(data29).length < 1){const err57 = {instancePath:instancePath+"/meta/legend/entries/failure",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}for(const key9 in data29){if(!((key9 === "label") || (key9 === "visible"))){const err58 = {instancePath:instancePath+"/meta/legend/entries/failure",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data29.label !== undefined){let data30 = data29.label;if(typeof data30 === "string"){if(func3(data30) > 80){const err59 = {instancePath:instancePath+"/meta/legend/entries/failure/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(func3(data30) < 1){const err60 = {instancePath:instancePath+"/meta/legend/entries/failure/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}else {const err61 = {instancePath:instancePath+"/meta/legend/entries/failure/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data29.visible !== undefined){if(typeof data29.visible !== "boolean"){const err62 = {instancePath:instancePath+"/meta/legend/entries/failure/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/failure",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data13.neutral !== undefined){let data32 = data13.neutral;if(data32 && typeof data32 == "object" && !Array.isArray(data32)){if(Object.keys(data32).length < 1){const err64 = {instancePath:instancePath+"/meta/legend/entries/neutral",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}for(const key10 in data32){if(!((key10 === "label") || (key10 === "visible"))){const err65 = {instancePath:instancePath+"/meta/legend/entries/neutral",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data32.label !== undefined){let data33 = data32.label;if(typeof data33 === "string"){if(func3(data33) > 80){const err66 = {instancePath:instancePath+"/meta/legend/entries/neutral/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}if(func3(data33) < 1){const err67 = {instancePath:instancePath+"/meta/legend/entries/neutral/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}else {const err68 = {instancePath:instancePath+"/meta/legend/entries/neutral/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data32.visible !== undefined){if(typeof data32.visible !== "boolean"){const err69 = {instancePath:instancePath+"/meta/legend/entries/neutral/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/neutral",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}if(data13.external !== undefined){let data35 = data13.external;if(data35 && typeof data35 == "object" && !Array.isArray(data35)){if(Object.keys(data35).length < 1){const err71 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}for(const key11 in data35){if(!((key11 === "label") || (key11 === "visible"))){const err72 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data35.label !== undefined){let data36 = data35.label;if(typeof data36 === "string"){if(func3(data36) > 80){const err73 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(func3(data36) < 1){const err74 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}else {const err75 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data35.visible !== undefined){if(typeof data35.visible !== "boolean"){const err76 = {instancePath:instancePath+"/meta/legend/entries/external/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}}else {const err77 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}}else {const err78 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}}else {const err79 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}if(data2.viewBox !== undefined){let data38 = data2.viewBox;if(Array.isArray(data38)){if(data38.length > 2){const err80 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}if(data38.length < 2){const err81 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}const len0 = data38.length;if(len0 > 0){let data39 = data38[0];if((typeof data39 == "number") && (isFinite(data39))){if(data39 < 420 || isNaN(data39)){const err82 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 420},message:"must be >= 420"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}}else {const err83 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}if(len0 > 1){let data40 = data38[1];if((typeof data40 == "number") && (isFinite(data40))){if(data40 < 566 || isNaN(data40)){const err84 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 566},message:"must be >= 566"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}else {const err85 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}const len1 = data38.length;if(!(len1 <= 2)){const err86 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}else {const err87 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}}else {const err88 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data.lanes !== undefined){let data41 = data.lanes;if(Array.isArray(data41)){if(data41.length > 4){const err89 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/maxItems",keyword:"maxItems",params:{limit: 4},message:"must NOT have more than 4 items"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if(data41.length < 1){const err90 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}const len2 = data41.length;for(let i0=0; i0 80){const err114 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}if(!pattern17.test(data52)){const err115 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}var _valid1 = _errs131 === errors;valid36 = valid36 || _valid1;const _errs132 = errors;if(typeof data52 === "string"){if(!pattern18.test(data52)){const err116 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}var _valid1 = _errs132 === errors;valid36 = valid36 || _valid1;if(!valid36){const err117 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}else {errors = _errs130;if(vErrors !== null){if(_errs130){vErrors.length = _errs130;}else {vErrors = null;}}}if(typeof data52 === "string"){if(func3(data52) > 2048){const err118 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}if(func3(data52) < 1){const err119 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}else {const err120 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}var _valid0 = _errs128 === errors;if(_valid0){valid35 = true;passing0 = 0;}const _errs133 = errors;if(data52 && typeof data52 == "object" && !Array.isArray(data52)){if(data52.url === undefined){const err121 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}if(data52.sha256 === undefined){const err122 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}for(const key14 in data52){if(!((key14 === "url") || (key14 === "sha256"))){const err123 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}if(data52.url !== undefined){let data53 = data52.url;if(typeof data53 === "string"){if(func3(data53) > 2048){const err124 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}if(func3(data53) < 8){const err125 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}if(!pattern18.test(data53)){const err126 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}else {const err127 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}if(data52.sha256 !== undefined){let data54 = data52.sha256;if(typeof data54 === "string"){if(!pattern20.test(data54)){const err128 = {instancePath:instancePath+"/states/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}else {const err129 = {instancePath:instancePath+"/states/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}}}else {const err130 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}var _valid0 = _errs133 === errors;if(_valid0 && valid35){valid35 = false;passing0 = [passing0, 1];}else {if(_valid0){valid35 = true;passing0 = 1;}}if(!valid35){const err131 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}else {errors = _errs127;if(vErrors !== null){if(_errs127){vErrors.length = _errs127;}else {vErrors = null;}}}}if(data46.step !== undefined){if(typeof data46.step !== "string"){const err132 = {instancePath:instancePath+"/states/" + i1+"/step",schemaPath:"#/properties/states/items/properties/step/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}}if(data46.lane !== undefined){let data56 = data46.lane;if(typeof data56 === "string"){if(!pattern4.test(data56)){const err133 = {instancePath:instancePath+"/states/" + i1+"/lane",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}else {const err134 = {instancePath:instancePath+"/states/" + i1+"/lane",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}if(data46.col !== undefined){let data57 = data46.col;if(!(((typeof data57 == "number") && (!(data57 % 1) && !isNaN(data57))) && (isFinite(data57)))){const err135 = {instancePath:instancePath+"/states/" + i1+"/col",schemaPath:"#/properties/states/items/properties/col/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}if((typeof data57 == "number") && (isFinite(data57))){if(data57 > 4 || isNaN(data57)){const err136 = {instancePath:instancePath+"/states/" + i1+"/col",schemaPath:"#/properties/states/items/properties/col/maximum",keyword:"maximum",params:{comparison: "<=", limit: 4},message:"must be <= 4"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}if(data57 < 0 || isNaN(data57)){const err137 = {instancePath:instancePath+"/states/" + i1+"/col",schemaPath:"#/properties/states/items/properties/col/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}}if(data46.width !== undefined){let data58 = data46.width;if((typeof data58 == "number") && (isFinite(data58))){if(data58 < 48 || isNaN(data58)){const err138 = {instancePath:instancePath+"/states/" + i1+"/width",schemaPath:"#/properties/states/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 48},message:"must be >= 48"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}}else {const err139 = {instancePath:instancePath+"/states/" + i1+"/width",schemaPath:"#/properties/states/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}if(data46.height !== undefined){let data59 = data46.height;if((typeof data59 == "number") && (isFinite(data59))){if(data59 < 36 || isNaN(data59)){const err140 = {instancePath:instancePath+"/states/" + i1+"/height",schemaPath:"#/properties/states/items/properties/height/minimum",keyword:"minimum",params:{comparison: ">=", limit: 36},message:"must be >= 36"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}else {const err141 = {instancePath:instancePath+"/states/" + i1+"/height",schemaPath:"#/properties/states/items/properties/height/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}if(data46.yOffset !== undefined){let data60 = data46.yOffset;if(!((typeof data60 == "number") && (isFinite(data60)))){const err142 = {instancePath:instancePath+"/states/" + i1+"/yOffset",schemaPath:"#/properties/states/items/properties/yOffset/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}}else {const err143 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}}else {const err144 = {instancePath:instancePath+"/states",schemaPath:"#/properties/states/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}if(data.transitions !== undefined){let data61 = data.transitions;if(Array.isArray(data61)){const len4 = data61.length;for(let i2=0; i2=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}else {const err163 = {instancePath:instancePath+"/transitions/" + i2+"/cornerRadius",schemaPath:"#/properties/transitions/items/properties/cornerRadius/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}if(data62.labelAt !== undefined){let data75 = data62.labelAt;if(Array.isArray(data75)){if(data75.length > 2){const err164 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}if(data75.length < 2){const err165 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}const len5 = data75.length;if(len5 > 0){let data76 = data75[0];if(!((typeof data76 == "number") && (isFinite(data76)))){const err166 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}if(len5 > 1){let data77 = data75[1];if(!((typeof data77 == "number") && (isFinite(data77)))){const err167 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}const len6 = data75.length;if(!(len6 <= 2)){const err168 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}else {const err169 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}}if(data62.labelDx !== undefined){let data78 = data62.labelDx;if(!((typeof data78 == "number") && (isFinite(data78)))){const err170 = {instancePath:instancePath+"/transitions/" + i2+"/labelDx",schemaPath:"#/properties/transitions/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}}if(data62.labelDy !== undefined){let data79 = data62.labelDy;if(!((typeof data79 == "number") && (isFinite(data79)))){const err171 = {instancePath:instancePath+"/transitions/" + i2+"/labelDy",schemaPath:"#/properties/transitions/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}if(data62.labelSegment !== undefined){let data80 = data62.labelSegment;if(!(((typeof data80 == "number") && (!(data80 % 1) && !isNaN(data80))) && (isFinite(data80)))){const err172 = {instancePath:instancePath+"/transitions/" + i2+"/labelSegment",schemaPath:"#/properties/transitions/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}if((typeof data80 == "number") && (isFinite(data80))){if(data80 < 0 || isNaN(data80)){const err173 = {instancePath:instancePath+"/transitions/" + i2+"/labelSegment",schemaPath:"#/properties/transitions/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}}}if(data62.via !== undefined){let data81 = data62.via;if(Array.isArray(data81)){const len7 = data81.length;for(let i3=0; i3 2){const err174 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}if(data82.length < 2){const err175 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}const len8 = data82.length;if(len8 > 0){let data83 = data82[0];if(!((typeof data83 == "number") && (isFinite(data83)))){const err176 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}}if(len8 > 1){let data84 = data82[1];if(!((typeof data84 == "number") && (isFinite(data84)))){const err177 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}}const len9 = data82.length;if(!(len9 <= 2)){const err178 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}}else {const err179 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}}else {const err180 = {instancePath:instancePath+"/transitions/" + i2+"/via",schemaPath:"#/properties/transitions/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}if(data62.width !== undefined){let data85 = data62.width;if((typeof data85 == "number") && (isFinite(data85))){if(data85 < 0.5 || isNaN(data85)){const err181 = {instancePath:instancePath+"/transitions/" + i2+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}}else {const err182 = {instancePath:instancePath+"/transitions/" + i2+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}}}else {const err183 = {instancePath:instancePath+"/transitions/" + i2,schemaPath:"#/properties/transitions/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}}}else {const err184 = {instancePath:instancePath+"/transitions",schemaPath:"#/properties/transitions/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}}if(data.cards !== undefined){let data86 = data.cards;if(Array.isArray(data86)){const len10 = data86.length;for(let i4=0; i4 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate37.errors = vErrors;return errors === 0;}validate37.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate36(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/architecture.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate36.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.components === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "components"},message:"must have required property '"+"components"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "layout")) || (key0 === "components")) || (key0 === "boundaries")) || (key0 === "connections")) || (key0 === "cards"))){const err4 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err5 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.diagram_type !== undefined){if("architecture" !== data.diagram_type){const err6 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "architecture"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err7 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}for(const key1 in data2){if(!(func1.call(schema149.properties.meta.properties, key1))){const err8 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err9 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err11 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err12 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err13 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err14 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema70.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err15 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema71.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err16 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema72.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.engineering_profile !== undefined){if(!(data2.engineering_profile === "deployment-ownership")){const err17 = {instancePath:instancePath+"/meta/engineering_profile",schemaPath:"#/properties/meta/properties/engineering_profile/enum",keyword:"enum",params:{allowedValues: schema149.properties.meta.properties.engineering_profile.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.repository !== undefined){let data11 = data2.repository;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){if(data11.url === undefined){const err18 = {instancePath:instancePath+"/meta/repository",schemaPath:"#/properties/meta/properties/repository/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}if(data11.revision === undefined){const err19 = {instancePath:instancePath+"/meta/repository",schemaPath:"#/properties/meta/properties/repository/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}for(const key2 in data11){if(!((((key2 === "url") || (key2 === "provider")) || (key2 === "link_mode")) || (key2 === "revision"))){const err20 = {instancePath:instancePath+"/meta/repository",schemaPath:"#/properties/meta/properties/repository/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data11.url !== undefined){let data12 = data11.url;if(typeof data12 === "string"){if(func3(data12) < 1){const err21 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"#/properties/meta/properties/repository/properties/url/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"#/properties/meta/properties/repository/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data11.provider !== undefined){let data13 = data11.provider;if(!((data13 === "github") || (data13 === "gitee"))){const err23 = {instancePath:instancePath+"/meta/repository/provider",schemaPath:"#/properties/meta/properties/repository/properties/provider/enum",keyword:"enum",params:{allowedValues: schema149.properties.meta.properties.repository.properties.provider.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data11.link_mode !== undefined){let data14 = data11.link_mode;if(!((data14 === "web") || (data14 === "local-only"))){const err24 = {instancePath:instancePath+"/meta/repository/link_mode",schemaPath:"#/properties/meta/properties/repository/properties/link_mode/enum",keyword:"enum",params:{allowedValues: schema149.properties.meta.properties.repository.properties.link_mode.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data11.revision !== undefined){let data15 = data11.revision;if(typeof data15 === "string"){if(!pattern57.test(data15)){const err25 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"#/properties/meta/properties/repository/properties/revision/pattern",keyword:"pattern",params:{pattern: "^[a-fA-F0-9]{40}$"},message:"must match pattern \""+"^[a-fA-F0-9]{40}$"+"\""};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"#/properties/meta/properties/repository/properties/revision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}}else {const err27 = {instancePath:instancePath+"/meta/repository",schemaPath:"#/properties/meta/properties/repository/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}if(data2.views !== undefined){if(!(validate37(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate37.errors : vErrors.concat(validate37.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data17 = data2.legend;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){for(const key3 in data17){if(!((key3 === "mode") || (key3 === "entries"))){const err28 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data17.mode !== undefined){let data18 = data17.mode;if(!(((data18 === "auto") || (data18 === "all")) || (data18 === "hidden"))){const err29 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema37.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data17.entries !== undefined){let data19 = data17.entries;if(data19 && typeof data19 == "object" && !Array.isArray(data19)){for(const key4 in data19){if(!(((((((key4 === "frontend") || (key4 === "backend")) || (key4 === "database")) || (key4 === "cloud")) || (key4 === "security")) || (key4 === "messagebus")) || (key4 === "external"))){const err30 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data19.frontend !== undefined){let data20 = data19.frontend;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){if(Object.keys(data20).length < 1){const err31 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}for(const key5 in data20){if(!((key5 === "label") || (key5 === "visible"))){const err32 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}if(data20.label !== undefined){let data21 = data20.label;if(typeof data21 === "string"){if(func3(data21) > 80){const err33 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if(func3(data21) < 1){const err34 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data20.visible !== undefined){if(typeof data20.visible !== "boolean"){const err36 = {instancePath:instancePath+"/meta/legend/entries/frontend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}}else {const err37 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data19.backend !== undefined){let data23 = data19.backend;if(data23 && typeof data23 == "object" && !Array.isArray(data23)){if(Object.keys(data23).length < 1){const err38 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}for(const key6 in data23){if(!((key6 === "label") || (key6 === "visible"))){const err39 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}if(data23.label !== undefined){let data24 = data23.label;if(typeof data24 === "string"){if(func3(data24) > 80){const err40 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if(func3(data24) < 1){const err41 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data23.visible !== undefined){if(typeof data23.visible !== "boolean"){const err43 = {instancePath:instancePath+"/meta/legend/entries/backend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}}else {const err44 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data19.database !== undefined){let data26 = data19.database;if(data26 && typeof data26 == "object" && !Array.isArray(data26)){if(Object.keys(data26).length < 1){const err45 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}for(const key7 in data26){if(!((key7 === "label") || (key7 === "visible"))){const err46 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}if(data26.label !== undefined){let data27 = data26.label;if(typeof data27 === "string"){if(func3(data27) > 80){const err47 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}if(func3(data27) < 1){const err48 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data26.visible !== undefined){if(typeof data26.visible !== "boolean"){const err50 = {instancePath:instancePath+"/meta/legend/entries/database/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}}else {const err51 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data19.cloud !== undefined){let data29 = data19.cloud;if(data29 && typeof data29 == "object" && !Array.isArray(data29)){if(Object.keys(data29).length < 1){const err52 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}for(const key8 in data29){if(!((key8 === "label") || (key8 === "visible"))){const err53 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}if(data29.label !== undefined){let data30 = data29.label;if(typeof data30 === "string"){if(func3(data30) > 80){const err54 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}if(func3(data30) < 1){const err55 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data29.visible !== undefined){if(typeof data29.visible !== "boolean"){const err57 = {instancePath:instancePath+"/meta/legend/entries/cloud/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}}else {const err58 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data19.security !== undefined){let data32 = data19.security;if(data32 && typeof data32 == "object" && !Array.isArray(data32)){if(Object.keys(data32).length < 1){const err59 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}for(const key9 in data32){if(!((key9 === "label") || (key9 === "visible"))){const err60 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}if(data32.label !== undefined){let data33 = data32.label;if(typeof data33 === "string"){if(func3(data33) > 80){const err61 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}if(func3(data33) < 1){const err62 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data32.visible !== undefined){if(typeof data32.visible !== "boolean"){const err64 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}}else {const err65 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data19.messagebus !== undefined){let data35 = data19.messagebus;if(data35 && typeof data35 == "object" && !Array.isArray(data35)){if(Object.keys(data35).length < 1){const err66 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}for(const key10 in data35){if(!((key10 === "label") || (key10 === "visible"))){const err67 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data35.label !== undefined){let data36 = data35.label;if(typeof data36 === "string"){if(func3(data36) > 80){const err68 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}if(func3(data36) < 1){const err69 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}if(data35.visible !== undefined){if(typeof data35.visible !== "boolean"){const err71 = {instancePath:instancePath+"/meta/legend/entries/messagebus/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}}else {const err72 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data19.external !== undefined){let data38 = data19.external;if(data38 && typeof data38 == "object" && !Array.isArray(data38)){if(Object.keys(data38).length < 1){const err73 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}for(const key11 in data38){if(!((key11 === "label") || (key11 === "visible"))){const err74 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data38.label !== undefined){let data39 = data38.label;if(typeof data39 === "string"){if(func3(data39) > 80){const err75 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}if(func3(data39) < 1){const err76 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}else {const err77 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}if(data38.visible !== undefined){if(typeof data38.visible !== "boolean"){const err78 = {instancePath:instancePath+"/meta/legend/entries/external/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}}else {const err79 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}}else {const err80 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}}else {const err81 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}if(data2.viewBox !== undefined){let data41 = data2.viewBox;if(Array.isArray(data41)){if(data41.length > 2){const err82 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(data41.length < 2){const err83 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}const len0 = data41.length;if(len0 > 0){let data42 = data41[0];if((typeof data42 == "number") && (isFinite(data42))){if(data42 < 320 || isNaN(data42)){const err84 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 320},message:"must be >= 320"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}else {const err85 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}if(len0 > 1){let data43 = data41[1];if((typeof data43 == "number") && (isFinite(data43))){if(data43 < 240 || isNaN(data43)){const err86 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 240},message:"must be >= 240"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}else {const err87 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}const len1 = data41.length;if(!(len1 <= 2)){const err88 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}else {const err89 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}}}else {const err90 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}}if(data.layout !== undefined){let data44 = data.layout;if(data44 && typeof data44 == "object" && !Array.isArray(data44)){if(data44.mode === undefined){const err91 = {instancePath:instancePath+"/layout",schemaPath:"#/properties/layout/required",keyword:"required",params:{missingProperty: "mode"},message:"must have required property '"+"mode"+"'"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}for(const key12 in data44){if(!(((((((key12 === "mode") || (key12 === "origin")) || (key12 === "cols")) || (key12 === "gapX")) || (key12 === "gapY")) || (key12 === "cellW")) || (key12 === "cellH"))){const err92 = {instancePath:instancePath+"/layout",schemaPath:"#/properties/layout/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}if(data44.mode !== undefined){if(!(data44.mode === "grid")){const err93 = {instancePath:instancePath+"/layout/mode",schemaPath:"#/properties/layout/properties/mode/enum",keyword:"enum",params:{allowedValues: schema149.properties.layout.properties.mode.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}if(data44.origin !== undefined){let data46 = data44.origin;if(Array.isArray(data46)){if(data46.length > 2){const err94 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}if(data46.length < 2){const err95 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}const len2 = data46.length;if(len2 > 0){let data47 = data46[0];if(!((typeof data47 == "number") && (isFinite(data47)))){const err96 = {instancePath:instancePath+"/layout/origin/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}}if(len2 > 1){let data48 = data46[1];if(!((typeof data48 == "number") && (isFinite(data48)))){const err97 = {instancePath:instancePath+"/layout/origin/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}const len3 = data46.length;if(!(len3 <= 2)){const err98 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}else {const err99 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data44.cols !== undefined){let data49 = data44.cols;if(!(((typeof data49 == "number") && (!(data49 % 1) && !isNaN(data49))) && (isFinite(data49)))){const err100 = {instancePath:instancePath+"/layout/cols",schemaPath:"#/properties/layout/properties/cols/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}if((typeof data49 == "number") && (isFinite(data49))){if(data49 > 12 || isNaN(data49)){const err101 = {instancePath:instancePath+"/layout/cols",schemaPath:"#/properties/layout/properties/cols/maximum",keyword:"maximum",params:{comparison: "<=", limit: 12},message:"must be <= 12"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}if(data49 < 1 || isNaN(data49)){const err102 = {instancePath:instancePath+"/layout/cols",schemaPath:"#/properties/layout/properties/cols/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}}if(data44.gapX !== undefined){let data50 = data44.gapX;if((typeof data50 == "number") && (isFinite(data50))){if(data50 < 0 || isNaN(data50)){const err103 = {instancePath:instancePath+"/layout/gapX",schemaPath:"#/properties/layout/properties/gapX/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}else {const err104 = {instancePath:instancePath+"/layout/gapX",schemaPath:"#/properties/layout/properties/gapX/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}if(data44.gapY !== undefined){let data51 = data44.gapY;if((typeof data51 == "number") && (isFinite(data51))){if(data51 < 0 || isNaN(data51)){const err105 = {instancePath:instancePath+"/layout/gapY",schemaPath:"#/properties/layout/properties/gapY/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}else {const err106 = {instancePath:instancePath+"/layout/gapY",schemaPath:"#/properties/layout/properties/gapY/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}if(data44.cellW !== undefined){let data52 = data44.cellW;if((typeof data52 == "number") && (isFinite(data52))){if(data52 < 40 || isNaN(data52)){const err107 = {instancePath:instancePath+"/layout/cellW",schemaPath:"#/properties/layout/properties/cellW/minimum",keyword:"minimum",params:{comparison: ">=", limit: 40},message:"must be >= 40"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}else {const err108 = {instancePath:instancePath+"/layout/cellW",schemaPath:"#/properties/layout/properties/cellW/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}if(data44.cellH !== undefined){let data53 = data44.cellH;if((typeof data53 == "number") && (isFinite(data53))){if(data53 < 24 || isNaN(data53)){const err109 = {instancePath:instancePath+"/layout/cellH",schemaPath:"#/properties/layout/properties/cellH/minimum",keyword:"minimum",params:{comparison: ">=", limit: 24},message:"must be >= 24"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}else {const err110 = {instancePath:instancePath+"/layout/cellH",schemaPath:"#/properties/layout/properties/cellH/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}}else {const err111 = {instancePath:instancePath+"/layout",schemaPath:"#/properties/layout/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}if(data.components !== undefined){let data54 = data.components;if(Array.isArray(data54)){if(data54.length < 1){const err112 = {instancePath:instancePath+"/components",schemaPath:"#/properties/components/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}const len4 = data54.length;for(let i0=0; i0 80){const err124 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}if(!pattern17.test(data61)){const err125 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}var _valid1 = _errs145 === errors;valid35 = valid35 || _valid1;const _errs146 = errors;if(typeof data61 === "string"){if(!pattern18.test(data61)){const err126 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}var _valid1 = _errs146 === errors;valid35 = valid35 || _valid1;if(!valid35){const err127 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}else {errors = _errs144;if(vErrors !== null){if(_errs144){vErrors.length = _errs144;}else {vErrors = null;}}}if(typeof data61 === "string"){if(func3(data61) > 2048){const err128 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}if(func3(data61) < 1){const err129 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}}else {const err130 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}var _valid0 = _errs142 === errors;if(_valid0){valid34 = true;passing0 = 0;}const _errs147 = errors;if(data61 && typeof data61 == "object" && !Array.isArray(data61)){if(data61.url === undefined){const err131 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}if(data61.sha256 === undefined){const err132 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}for(const key14 in data61){if(!((key14 === "url") || (key14 === "sha256"))){const err133 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}if(data61.url !== undefined){let data62 = data61.url;if(typeof data62 === "string"){if(func3(data62) > 2048){const err134 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}if(func3(data62) < 8){const err135 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}if(!pattern18.test(data62)){const err136 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}}else {const err137 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}if(data61.sha256 !== undefined){let data63 = data61.sha256;if(typeof data63 === "string"){if(!pattern20.test(data63)){const err138 = {instancePath:instancePath+"/components/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}}else {const err139 = {instancePath:instancePath+"/components/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}}else {const err140 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}var _valid0 = _errs147 === errors;if(_valid0 && valid34){valid34 = false;passing0 = [passing0, 1];}else {if(_valid0){valid34 = true;passing0 = 1;}}if(!valid34){const err141 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}else {errors = _errs141;if(vErrors !== null){if(_errs141){vErrors.length = _errs141;}else {vErrors = null;}}}}if(data55.sources !== undefined){let data64 = data55.sources;if(Array.isArray(data64)){if(data64.length > 3){const err142 = {instancePath:instancePath+"/components/" + i0+"/sources",schemaPath:"#/properties/components/items/properties/sources/maxItems",keyword:"maxItems",params:{limit: 3},message:"must NOT have more than 3 items"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}if(data64.length < 1){const err143 = {instancePath:instancePath+"/components/" + i0+"/sources",schemaPath:"#/properties/components/items/properties/sources/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}const len5 = data64.length;for(let i1=0; i1 240){const err146 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/path",schemaPath:"#/properties/components/items/properties/sources/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}if(func3(data66) < 1){const err147 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/path",schemaPath:"#/properties/components/items/properties/sources/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}}else {const err148 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/path",schemaPath:"#/properties/components/items/properties/sources/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}if(data65.line !== undefined){let data67 = data65.line;if(!(((typeof data67 == "number") && (!(data67 % 1) && !isNaN(data67))) && (isFinite(data67)))){const err149 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/line",schemaPath:"#/properties/components/items/properties/sources/items/properties/line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}if((typeof data67 == "number") && (isFinite(data67))){if(data67 < 1 || isNaN(data67)){const err150 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/line",schemaPath:"#/properties/components/items/properties/sources/items/properties/line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}}if(data65.end_line !== undefined){let data68 = data65.end_line;if(!(((typeof data68 == "number") && (!(data68 % 1) && !isNaN(data68))) && (isFinite(data68)))){const err151 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/end_line",schemaPath:"#/properties/components/items/properties/sources/items/properties/end_line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}if((typeof data68 == "number") && (isFinite(data68))){if(data68 < 1 || isNaN(data68)){const err152 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/end_line",schemaPath:"#/properties/components/items/properties/sources/items/properties/end_line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}}}if(data65.label !== undefined){let data69 = data65.label;if(typeof data69 === "string"){if(func3(data69) > 48){const err153 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/label",schemaPath:"#/properties/components/items/properties/sources/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}if(func3(data69) < 1){const err154 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/label",schemaPath:"#/properties/components/items/properties/sources/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}else {const err155 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/label",schemaPath:"#/properties/components/items/properties/sources/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}}}else {const err156 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1,schemaPath:"#/properties/components/items/properties/sources/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}}}else {const err157 = {instancePath:instancePath+"/components/" + i0+"/sources",schemaPath:"#/properties/components/items/properties/sources/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}}if(data55.row !== undefined){let data70 = data55.row;if(!(((typeof data70 == "number") && (!(data70 % 1) && !isNaN(data70))) && (isFinite(data70)))){const err158 = {instancePath:instancePath+"/components/" + i0+"/row",schemaPath:"#/properties/components/items/properties/row/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}if((typeof data70 == "number") && (isFinite(data70))){if(data70 < 0 || isNaN(data70)){const err159 = {instancePath:instancePath+"/components/" + i0+"/row",schemaPath:"#/properties/components/items/properties/row/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}}}if(data55.col !== undefined){let data71 = data55.col;if(!(((typeof data71 == "number") && (!(data71 % 1) && !isNaN(data71))) && (isFinite(data71)))){const err160 = {instancePath:instancePath+"/components/" + i0+"/col",schemaPath:"#/properties/components/items/properties/col/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}if((typeof data71 == "number") && (isFinite(data71))){if(data71 < 0 || isNaN(data71)){const err161 = {instancePath:instancePath+"/components/" + i0+"/col",schemaPath:"#/properties/components/items/properties/col/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}}}if(data55.pos !== undefined){let data72 = data55.pos;if(Array.isArray(data72)){if(data72.length > 2){const err162 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}if(data72.length < 2){const err163 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}const len6 = data72.length;if(len6 > 0){let data73 = data72[0];if(!((typeof data73 == "number") && (isFinite(data73)))){const err164 = {instancePath:instancePath+"/components/" + i0+"/pos/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}if(len6 > 1){let data74 = data72[1];if(!((typeof data74 == "number") && (isFinite(data74)))){const err165 = {instancePath:instancePath+"/components/" + i0+"/pos/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}const len7 = data72.length;if(!(len7 <= 2)){const err166 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}else {const err167 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}if(data55.size !== undefined){let data75 = data55.size;if(Array.isArray(data75)){if(data75.length > 2){const err168 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}if(data75.length < 2){const err169 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}const len8 = data75.length;if(len8 > 0){let data76 = data75[0];if((typeof data76 == "number") && (isFinite(data76))){if(data76 <= 0 || isNaN(data76)){const err170 = {instancePath:instancePath+"/components/" + i0+"/size/0",schemaPath:"#/properties/components/items/properties/size/prefixItems/0/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison: ">", limit: 0},message:"must be > 0"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}}else {const err171 = {instancePath:instancePath+"/components/" + i0+"/size/0",schemaPath:"#/properties/components/items/properties/size/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}if(len8 > 1){let data77 = data75[1];if((typeof data77 == "number") && (isFinite(data77))){if(data77 <= 0 || isNaN(data77)){const err172 = {instancePath:instancePath+"/components/" + i0+"/size/1",schemaPath:"#/properties/components/items/properties/size/prefixItems/1/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison: ">", limit: 0},message:"must be > 0"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}}else {const err173 = {instancePath:instancePath+"/components/" + i0+"/size/1",schemaPath:"#/properties/components/items/properties/size/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}}const len9 = data75.length;if(!(len9 <= 2)){const err174 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}}else {const err175 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}}else {const err176 = {instancePath:instancePath+"/components/" + i0,schemaPath:"#/properties/components/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}}}else {const err177 = {instancePath:instancePath+"/components",schemaPath:"#/properties/components/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}}if(data.boundaries !== undefined){let data78 = data.boundaries;if(Array.isArray(data78)){const len10 = data78.length;for(let i2=0; i2=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}else {const err190 = {instancePath:instancePath+"/boundaries/" + i2+"/pad",schemaPath:"#/properties/boundaries/items/properties/pad/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}}}else {const err191 = {instancePath:instancePath+"/boundaries/" + i2,schemaPath:"#/properties/boundaries/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}}}else {const err192 = {instancePath:instancePath+"/boundaries",schemaPath:"#/properties/boundaries/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}}if(data.connections !== undefined){let data85 = data.connections;if(Array.isArray(data85)){const len12 = data85.length;for(let i4=0; i4 2){const err207 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err207];}else {vErrors.push(err207);}errors++;}if(data96.length < 2){const err208 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err208];}else {vErrors.push(err208);}errors++;}const len14 = data96.length;if(len14 > 0){let data97 = data96[0];if(!((typeof data97 == "number") && (isFinite(data97)))){const err209 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err209];}else {vErrors.push(err209);}errors++;}}if(len14 > 1){let data98 = data96[1];if(!((typeof data98 == "number") && (isFinite(data98)))){const err210 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}}const len15 = data96.length;if(!(len15 <= 2)){const err211 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err211];}else {vErrors.push(err211);}errors++;}}else {const err212 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}}}else {const err213 = {instancePath:instancePath+"/connections/" + i4+"/via",schemaPath:"#/properties/connections/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err213];}else {vErrors.push(err213);}errors++;}}if(data86.labelAt !== undefined){let data99 = data86.labelAt;if(Array.isArray(data99)){if(data99.length > 2){const err214 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err214];}else {vErrors.push(err214);}errors++;}if(data99.length < 2){const err215 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err215];}else {vErrors.push(err215);}errors++;}const len16 = data99.length;if(len16 > 0){let data100 = data99[0];if(!((typeof data100 == "number") && (isFinite(data100)))){const err216 = {instancePath:instancePath+"/connections/" + i4+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}}if(len16 > 1){let data101 = data99[1];if(!((typeof data101 == "number") && (isFinite(data101)))){const err217 = {instancePath:instancePath+"/connections/" + i4+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}}const len17 = data99.length;if(!(len17 <= 2)){const err218 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}}else {const err219 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}}if(data86.labelDx !== undefined){let data102 = data86.labelDx;if(!((typeof data102 == "number") && (isFinite(data102)))){const err220 = {instancePath:instancePath+"/connections/" + i4+"/labelDx",schemaPath:"#/properties/connections/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}}if(data86.labelDy !== undefined){let data103 = data86.labelDy;if(!((typeof data103 == "number") && (isFinite(data103)))){const err221 = {instancePath:instancePath+"/connections/" + i4+"/labelDy",schemaPath:"#/properties/connections/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err221];}else {vErrors.push(err221);}errors++;}}if(data86.labelSegment !== undefined){let data104 = data86.labelSegment;if(!(((typeof data104 == "number") && (!(data104 % 1) && !isNaN(data104))) && (isFinite(data104)))){const err222 = {instancePath:instancePath+"/connections/" + i4+"/labelSegment",schemaPath:"#/properties/connections/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err222];}else {vErrors.push(err222);}errors++;}if((typeof data104 == "number") && (isFinite(data104))){if(data104 < 0 || isNaN(data104)){const err223 = {instancePath:instancePath+"/connections/" + i4+"/labelSegment",schemaPath:"#/properties/connections/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err223];}else {vErrors.push(err223);}errors++;}}}if(data86.width !== undefined){let data105 = data86.width;if((typeof data105 == "number") && (isFinite(data105))){if(data105 < 0.5 || isNaN(data105)){const err224 = {instancePath:instancePath+"/connections/" + i4+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err224];}else {vErrors.push(err224);}errors++;}}else {const err225 = {instancePath:instancePath+"/connections/" + i4+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err225];}else {vErrors.push(err225);}errors++;}}}else {const err226 = {instancePath:instancePath+"/connections/" + i4,schemaPath:"#/properties/connections/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}}}else {const err227 = {instancePath:instancePath+"/connections",schemaPath:"#/properties/connections/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}}if(data.cards !== undefined){let data106 = data.cards;if(Array.isArray(data106)){const len18 = data106.length;for(let i6=0; i6:\"|?*\\u0000-\\u001F\\u007F-\\u009F]", "u");const pattern8 = new RegExp("[\\uD800-\\uDFFF]", "u");const pattern9 = new RegExp("(^|/)[.]{1,2}(/|$)", "u");const pattern10 = new RegExp("[. ](/|$)", "u");const pattern11 = new RegExp("(^|/)[^/]{256}", "u");const pattern12 = new RegExp("(^|/)(?:[Cc][Oo][Nn]|[Pp][Rr][Nn]|[Aa][Uu][Xx]|[Nn][Uu][Ll]|[Cc][Oo][Nn][Ii][Nn][$]|[Cc][Oo][Nn][Oo][Uu][Tt][$]|[Cc][Oo][Mm][1-9¹²³]|[Ll][Pp][Tt][1-9¹²³])(?:[.]|/|$)", "u");const pattern13 = new RegExp("(^|/)[^/]*~[1-9][0-9]*(?:[.]|/|$)", "u");const pattern14 = new RegExp("^[^/]+(?:/[^/]+)*$", "u");const pattern15 = new RegExp("^[a-fA-F0-9]{40}$", "u");const pattern16 = new RegExp("^[a-zA-Z][a-zA-Z0-9_-]*$", "u");const pattern29 = new RegExp("^[^\\r\\n]+$", "u");const pattern30 = new RegExp("^https?://", "u");const pattern32 = new RegExp("^[a-f0-9]{64}$", "u");const schema37 = {"type":"array","maxItems":5,"items":{"type":"object","additionalProperties":false,"required":["id","label","focus"],"properties":{"id":{"$ref":"#/$defs/id"},"label":{"type":"string","minLength":1,"maxLength":48},"focus":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/id"}},"note":{"type":"string","maxLength":140}}}};function validate22(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate22.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(Array.isArray(data)){if(data.length > 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate22.errors = vErrors;return errors === 0;}validate22.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};const schema55 = {"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"}}};function validate24(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate24.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.from === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.to === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}for(const key0 in data){if(!((key0 === "from") || (key0 === "to"))){const err2 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}if(data.from !== undefined){let data0 = data.from;if(typeof data0 === "string"){if(!pattern16.test(data0)){const err3 = {instancePath:instancePath+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}else {const err4 = {instancePath:instancePath+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.to !== undefined){let data1 = data.to;if(typeof data1 === "string"){if(!pattern16.test(data1)){const err5 = {instancePath:instancePath+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}}else {const err7 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}validate24.errors = vErrors;return errors === 0;}validate24.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/workflow.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate20.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.lanes === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "lanes"},message:"must have required property '"+"lanes"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.nodes === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "nodes"},message:"must have required property '"+"nodes"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.edges === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "edges"},message:"must have required property '"+"edges"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!(func1.call(schema31.properties, key0))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema_version !== undefined){let data0 = data.schema_version;if(!((data0 === 1) || (data0 === 2))){const err7 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/enum",keyword:"enum",params:{allowedValues: schema31.properties.schema_version.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.diagram_type !== undefined){if("workflow" !== data.diagram_type){const err8 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "workflow"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data2.output === undefined){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "output"},message:"must have required property '"+"output"+"'"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}for(const key1 in data2){if(!(func1.call(schema31.properties.meta.properties, key1))){const err11 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}else {const err13 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(typeof data4 === "string"){if(func3(data4) > 35){const err14 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/maxLength",keyword:"maxLength",params:{limit: 35},message:"must NOT have more than 35 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(!pattern4.test(data4)){const err15 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/pattern",keyword:"pattern",params:{pattern: "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"},message:"must match pattern \""+"^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"+"\""};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.translations !== undefined){let data5 = data2.translations;if(data5 && typeof data5 == "object" && !Array.isArray(data5)){if(Object.keys(data5).length > 600){const err17 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/maxProperties",keyword:"maxProperties",params:{limit: 600},message:"must NOT have more than 600 properties"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}for(const key2 in data5){const _errs15 = errors;if(typeof key2 === "string"){if(!pattern5.test(key2)){const err18 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/propertyNames/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"},message:"must match pattern \""+"^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"+"\"",propertyName:key2};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}var valid4 = _errs15 === errors;if(!valid4){const err19 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/propertyNames",keyword:"propertyNames",params:{propertyName: key2},message:"property name must be valid"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}for(const key3 in data5){let data6 = data5[key3];if(typeof data6 === "string"){if(func3(data6) > 400){const err20 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/maxLength",keyword:"maxLength",params:{limit: 400},message:"must NOT have more than 400 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(func3(data6) < 1){const err21 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}}else {const err23 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err24 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data2.output !== undefined){let data8 = data2.output;if(typeof data8 === "string"){if(!pattern6.test(data8)){const err25 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/0/pattern",keyword:"pattern",params:{pattern: "(?:^|/)[^/]+[.][Hh][Tt][Mm][Ll]$"},message:"must match pattern \""+"(?:^|/)[^/]+[.][Hh][Tt][Mm][Ll]$"+"\""};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}const _errs26 = errors;const _errs27 = errors;if(typeof data8 === "string"){if(!pattern7.test(data8)){const err26 = {};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}var valid8 = _errs27 === errors;if(valid8){const err27 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}else {errors = _errs26;if(vErrors !== null){if(_errs26){vErrors.length = _errs26;}else {vErrors = null;}}}const _errs29 = errors;const _errs30 = errors;if(typeof data8 === "string"){if(!pattern8.test(data8)){const err28 = {};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}var valid9 = _errs30 === errors;if(valid9){const err29 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/2/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}else {errors = _errs29;if(vErrors !== null){if(_errs29){vErrors.length = _errs29;}else {vErrors = null;}}}const _errs32 = errors;const _errs33 = errors;if(typeof data8 === "string"){if(!pattern9.test(data8)){const err30 = {};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}var valid10 = _errs33 === errors;if(valid10){const err31 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/3/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}else {errors = _errs32;if(vErrors !== null){if(_errs32){vErrors.length = _errs32;}else {vErrors = null;}}}const _errs35 = errors;const _errs36 = errors;if(typeof data8 === "string"){if(!pattern10.test(data8)){const err32 = {};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}var valid11 = _errs36 === errors;if(valid11){const err33 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/4/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}else {errors = _errs35;if(vErrors !== null){if(_errs35){vErrors.length = _errs35;}else {vErrors = null;}}}const _errs38 = errors;const _errs39 = errors;if(typeof data8 === "string"){if(!pattern11.test(data8)){const err34 = {};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}var valid12 = _errs39 === errors;if(valid12){const err35 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/5/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}else {errors = _errs38;if(vErrors !== null){if(_errs38){vErrors.length = _errs38;}else {vErrors = null;}}}const _errs41 = errors;const _errs42 = errors;if(typeof data8 === "string"){if(!pattern12.test(data8)){const err36 = {};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}var valid13 = _errs42 === errors;if(valid13){const err37 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/6/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}else {errors = _errs41;if(vErrors !== null){if(_errs41){vErrors.length = _errs41;}else {vErrors = null;}}}const _errs44 = errors;const _errs45 = errors;if(typeof data8 === "string"){if(!pattern13.test(data8)){const err38 = {};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}var valid14 = _errs45 === errors;if(valid14){const err39 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/7/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}else {errors = _errs44;if(vErrors !== null){if(_errs44){vErrors.length = _errs44;}else {vErrors = null;}}}if(typeof data8 === "string"){if(func3(data8) < 1){const err40 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if(!pattern14.test(data8)){const err41 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/pattern",keyword:"pattern",params:{pattern: "^[^/]+(?:/[^/]+)*$"},message:"must match pattern \""+"^[^/]+(?:/[^/]+)*$"+"\""};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}else {const err42 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data2.animation !== undefined){let data9 = data2.animation;if(!((data9 === "trace") || (data9 === "none"))){const err43 = {instancePath:instancePath+"/meta/animation",schemaPath:"#/properties/meta/properties/animation/enum",keyword:"enum",params:{allowedValues: schema31.properties.meta.properties.animation.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data2.visual_preset !== undefined){let data10 = data2.visual_preset;if(!((((data10 === "classic") || (data10 === "signal-flow")) || (data10 === "blueprint")) || (data10 === "editorial"))){const err44 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"#/properties/meta/properties/visual_preset/enum",keyword:"enum",params:{allowedValues: schema31.properties.meta.properties.visual_preset.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data2.quality_profile !== undefined){let data11 = data2.quality_profile;if(!((data11 === "standard") || (data11 === "showcase"))){const err45 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"#/properties/meta/properties/quality_profile/enum",keyword:"enum",params:{allowedValues: schema31.properties.meta.properties.quality_profile.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}if(data2.repository !== undefined){let data12 = data2.repository;if(data12 && typeof data12 == "object" && !Array.isArray(data12)){if(data12.url === undefined){const err46 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}if(data12.revision === undefined){const err47 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}for(const key4 in data12){if(!((((key4 === "url") || (key4 === "provider")) || (key4 === "link_mode")) || (key4 === "revision"))){const err48 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}if(data12.url !== undefined){let data13 = data12.url;if(typeof data13 === "string"){if(func3(data13) < 1){const err49 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"common.schema.json#/$defs/repository/properties/url/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}else {const err50 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"common.schema.json#/$defs/repository/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}if(data12.provider !== undefined){let data14 = data12.provider;if(!((data14 === "github") || (data14 === "gitee"))){const err51 = {instancePath:instancePath+"/meta/repository/provider",schemaPath:"common.schema.json#/$defs/repository/properties/provider/enum",keyword:"enum",params:{allowedValues: schema36.properties.provider.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data12.link_mode !== undefined){let data15 = data12.link_mode;if(!((data15 === "web") || (data15 === "local-only"))){const err52 = {instancePath:instancePath+"/meta/repository/link_mode",schemaPath:"common.schema.json#/$defs/repository/properties/link_mode/enum",keyword:"enum",params:{allowedValues: schema36.properties.link_mode.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}if(data12.revision !== undefined){let data16 = data12.revision;if(typeof data16 === "string"){if(!pattern15.test(data16)){const err53 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"common.schema.json#/$defs/repository/properties/revision/pattern",keyword:"pattern",params:{pattern: "^[a-fA-F0-9]{40}$"},message:"must match pattern \""+"^[a-fA-F0-9]{40}$"+"\""};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"common.schema.json#/$defs/repository/properties/revision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}}else {const err55 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data2.views !== undefined){if(!(validate22(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate22.errors : vErrors.concat(validate22.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data18 = data2.legend;if(data18 && typeof data18 == "object" && !Array.isArray(data18)){for(const key5 in data18){if(!((key5 === "mode") || (key5 === "entries"))){const err56 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data18.mode !== undefined){let data19 = data18.mode;if(!(((data19 === "auto") || (data19 === "all")) || (data19 === "hidden"))){const err57 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema40.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}if(data18.entries !== undefined){let data20 = data18.entries;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){for(const key6 in data20){if(!(((((((key6 === "frontend") || (key6 === "backend")) || (key6 === "database")) || (key6 === "cloud")) || (key6 === "security")) || (key6 === "messagebus")) || (key6 === "external"))){const err58 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data20.frontend !== undefined){let data21 = data20.frontend;if(data21 && typeof data21 == "object" && !Array.isArray(data21)){if(Object.keys(data21).length < 1){const err59 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}for(const key7 in data21){if(!((key7 === "label") || (key7 === "visible"))){const err60 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}if(data21.label !== undefined){let data22 = data21.label;if(typeof data22 === "string"){if(func3(data22) > 80){const err61 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}if(func3(data22) < 1){const err62 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data21.visible !== undefined){if(typeof data21.visible !== "boolean"){const err64 = {instancePath:instancePath+"/meta/legend/entries/frontend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}}else {const err65 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data20.backend !== undefined){let data24 = data20.backend;if(data24 && typeof data24 == "object" && !Array.isArray(data24)){if(Object.keys(data24).length < 1){const err66 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}for(const key8 in data24){if(!((key8 === "label") || (key8 === "visible"))){const err67 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data24.label !== undefined){let data25 = data24.label;if(typeof data25 === "string"){if(func3(data25) > 80){const err68 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}if(func3(data25) < 1){const err69 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}if(data24.visible !== undefined){if(typeof data24.visible !== "boolean"){const err71 = {instancePath:instancePath+"/meta/legend/entries/backend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}}else {const err72 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data20.database !== undefined){let data27 = data20.database;if(data27 && typeof data27 == "object" && !Array.isArray(data27)){if(Object.keys(data27).length < 1){const err73 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}for(const key9 in data27){if(!((key9 === "label") || (key9 === "visible"))){const err74 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data27.label !== undefined){let data28 = data27.label;if(typeof data28 === "string"){if(func3(data28) > 80){const err75 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}if(func3(data28) < 1){const err76 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}else {const err77 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}if(data27.visible !== undefined){if(typeof data27.visible !== "boolean"){const err78 = {instancePath:instancePath+"/meta/legend/entries/database/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}}else {const err79 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}if(data20.cloud !== undefined){let data30 = data20.cloud;if(data30 && typeof data30 == "object" && !Array.isArray(data30)){if(Object.keys(data30).length < 1){const err80 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}for(const key10 in data30){if(!((key10 === "label") || (key10 === "visible"))){const err81 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}if(data30.label !== undefined){let data31 = data30.label;if(typeof data31 === "string"){if(func3(data31) > 80){const err82 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(func3(data31) < 1){const err83 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}else {const err84 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data30.visible !== undefined){if(typeof data30.visible !== "boolean"){const err85 = {instancePath:instancePath+"/meta/legend/entries/cloud/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}}else {const err86 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}if(data20.security !== undefined){let data33 = data20.security;if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(Object.keys(data33).length < 1){const err87 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}for(const key11 in data33){if(!((key11 === "label") || (key11 === "visible"))){const err88 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data33.label !== undefined){let data34 = data33.label;if(typeof data34 === "string"){if(func3(data34) > 80){const err89 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if(func3(data34) < 1){const err90 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}}else {const err91 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}if(data33.visible !== undefined){if(typeof data33.visible !== "boolean"){const err92 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}}else {const err93 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}if(data20.messagebus !== undefined){let data36 = data20.messagebus;if(data36 && typeof data36 == "object" && !Array.isArray(data36)){if(Object.keys(data36).length < 1){const err94 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}for(const key12 in data36){if(!((key12 === "label") || (key12 === "visible"))){const err95 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}if(data36.label !== undefined){let data37 = data36.label;if(typeof data37 === "string"){if(func3(data37) > 80){const err96 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}if(func3(data37) < 1){const err97 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}else {const err98 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}if(data36.visible !== undefined){if(typeof data36.visible !== "boolean"){const err99 = {instancePath:instancePath+"/meta/legend/entries/messagebus/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}}else {const err100 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}if(data20.external !== undefined){let data39 = data20.external;if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(Object.keys(data39).length < 1){const err101 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}for(const key13 in data39){if(!((key13 === "label") || (key13 === "visible"))){const err102 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}if(data39.label !== undefined){let data40 = data39.label;if(typeof data40 === "string"){if(func3(data40) > 80){const err103 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}if(func3(data40) < 1){const err104 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}else {const err105 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}if(data39.visible !== undefined){if(typeof data39.visible !== "boolean"){const err106 = {instancePath:instancePath+"/meta/legend/entries/external/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}}else {const err107 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}}else {const err108 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}}else {const err109 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}if(data2.viewBox !== undefined){let data42 = data2.viewBox;if(Array.isArray(data42)){if(data42.length > 2){const err110 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}if(data42.length < 2){const err111 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}const len0 = data42.length;if(len0 > 0){let data43 = data42[0];if((typeof data43 == "number") && (isFinite(data43))){if(data43 < 700 || isNaN(data43)){const err112 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 700},message:"must be >= 700"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}else {const err113 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}if(len0 > 1){let data44 = data42[1];if((typeof data44 == "number") && (isFinite(data44))){if(data44 < 240 || isNaN(data44)){const err114 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 240},message:"must be >= 240"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}else {const err115 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}const len1 = data42.length;if(!(len1 <= 2)){const err116 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}else {const err117 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}}else {const err118 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}if(data.lanes !== undefined){let data45 = data.lanes;if(Array.isArray(data45)){if(data45.length < 1){const err119 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}const len2 = data45.length;for(let i0=0; i0 5 || isNaN(data54)){const err140 = {instancePath:instancePath+"/phases/" + i1+"/fromCol",schemaPath:"#/properties/phases/items/properties/fromCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}if(data54 < 0 || isNaN(data54)){const err141 = {instancePath:instancePath+"/phases/" + i1+"/fromCol",schemaPath:"#/properties/phases/items/properties/fromCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}}if(data51.toCol !== undefined){let data55 = data51.toCol;if(!(((typeof data55 == "number") && (!(data55 % 1) && !isNaN(data55))) && (isFinite(data55)))){const err142 = {instancePath:instancePath+"/phases/" + i1+"/toCol",schemaPath:"#/properties/phases/items/properties/toCol/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}if((typeof data55 == "number") && (isFinite(data55))){if(data55 > 5 || isNaN(data55)){const err143 = {instancePath:instancePath+"/phases/" + i1+"/toCol",schemaPath:"#/properties/phases/items/properties/toCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}if(data55 < 0 || isNaN(data55)){const err144 = {instancePath:instancePath+"/phases/" + i1+"/toCol",schemaPath:"#/properties/phases/items/properties/toCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}}if(data51.variant !== undefined){let data56 = data51.variant;if(!((((data56 === "default") || (data56 === "emphasis")) || (data56 === "security")) || (data56 === "dashed"))){const err145 = {instancePath:instancePath+"/phases/" + i1+"/variant",schemaPath:"#/properties/phases/items/properties/variant/enum",keyword:"enum",params:{allowedValues: schema31.properties.phases.items.properties.variant.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}}else {const err146 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}}}else {const err147 = {instancePath:instancePath+"/phases",schemaPath:"#/properties/phases/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}}if(data.groups !== undefined){let data57 = data.groups;if(Array.isArray(data57)){const len4 = data57.length;for(let i2=0; i2 5 || isNaN(data62)){const err161 = {instancePath:instancePath+"/groups/" + i2+"/fromCol",schemaPath:"#/properties/groups/items/properties/fromCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}if(data62 < 0 || isNaN(data62)){const err162 = {instancePath:instancePath+"/groups/" + i2+"/fromCol",schemaPath:"#/properties/groups/items/properties/fromCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}}if(data58.toCol !== undefined){let data63 = data58.toCol;if(!(((typeof data63 == "number") && (!(data63 % 1) && !isNaN(data63))) && (isFinite(data63)))){const err163 = {instancePath:instancePath+"/groups/" + i2+"/toCol",schemaPath:"#/properties/groups/items/properties/toCol/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}if((typeof data63 == "number") && (isFinite(data63))){if(data63 > 5 || isNaN(data63)){const err164 = {instancePath:instancePath+"/groups/" + i2+"/toCol",schemaPath:"#/properties/groups/items/properties/toCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}if(data63 < 0 || isNaN(data63)){const err165 = {instancePath:instancePath+"/groups/" + i2+"/toCol",schemaPath:"#/properties/groups/items/properties/toCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}}if(data58.variant !== undefined){let data64 = data58.variant;if(!((((data64 === "default") || (data64 === "emphasis")) || (data64 === "security")) || (data64 === "dashed"))){const err166 = {instancePath:instancePath+"/groups/" + i2+"/variant",schemaPath:"#/properties/groups/items/properties/variant/enum",keyword:"enum",params:{allowedValues: schema31.properties.groups.items.properties.variant.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}}else {const err167 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}}else {const err168 = {instancePath:instancePath+"/groups",schemaPath:"#/properties/groups/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}if(data.mainPath !== undefined){let data65 = data.mainPath;if(Array.isArray(data65)){if(data65.length < 2){const err169 = {instancePath:instancePath+"/mainPath",schemaPath:"#/properties/mainPath/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}const len5 = data65.length;for(let i3=0; i3 5 || isNaN(data80)){const err196 = {instancePath:instancePath+"/nodes/" + i8+"/col",schemaPath:"#/properties/nodes/items/properties/col/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}if(data80 < 0 || isNaN(data80)){const err197 = {instancePath:instancePath+"/nodes/" + i8+"/col",schemaPath:"#/properties/nodes/items/properties/col/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}}}if(data77.type !== undefined){let data81 = data77.type;if(!(((((((data81 === "frontend") || (data81 === "backend")) || (data81 === "database")) || (data81 === "cloud")) || (data81 === "security")) || (data81 === "messagebus")) || (data81 === "external"))){const err198 = {instancePath:instancePath+"/nodes/" + i8+"/type",schemaPath:"common.schema.json#/$defs/componentType/enum",keyword:"enum",params:{allowedValues: schema60.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}if(data77.label !== undefined){let data82 = data77.label;if(typeof data82 === "string"){if(func3(data82) < 1){const err199 = {instancePath:instancePath+"/nodes/" + i8+"/label",schemaPath:"#/properties/nodes/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}}else {const err200 = {instancePath:instancePath+"/nodes/" + i8+"/label",schemaPath:"#/properties/nodes/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err200];}else {vErrors.push(err200);}errors++;}}if(data77.sublabel !== undefined){if(typeof data77.sublabel !== "string"){const err201 = {instancePath:instancePath+"/nodes/" + i8+"/sublabel",schemaPath:"#/properties/nodes/items/properties/sublabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err201];}else {vErrors.push(err201);}errors++;}}if(data77.tag !== undefined){if(typeof data77.tag !== "string"){const err202 = {instancePath:instancePath+"/nodes/" + i8+"/tag",schemaPath:"#/properties/nodes/items/properties/tag/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err202];}else {vErrors.push(err202);}errors++;}}if(data77.icon !== undefined){let data85 = data77.icon;if(!((((((((((((((((((((data85 === "calendar") || (data85 === "clock")) || (data85 === "person")) || (data85 === "briefcase")) || (data85 === "flag")) || (data85 === "moon")) || (data85 === "frontend")) || (data85 === "backend")) || (data85 === "database")) || (data85 === "cloud")) || (data85 === "security")) || (data85 === "messagebus")) || (data85 === "external")) || (data85 === "start")) || (data85 === "active")) || (data85 === "waiting")) || (data85 === "success")) || (data85 === "failure")) || (data85 === "neutral")) || (data85 === "none"))){const err203 = {instancePath:instancePath+"/nodes/" + i8+"/icon",schemaPath:"common.schema.json#/$defs/nodeIcon/enum",keyword:"enum",params:{allowedValues: schema61.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err203];}else {vErrors.push(err203);}errors++;}}if(data77.brand !== undefined){let data86 = data77.brand;const _errs223 = errors;let valid70 = false;let passing0 = null;const _errs224 = errors;const _errs226 = errors;let valid71 = false;const _errs227 = errors;if(typeof data86 === "string"){if(func3(data86) > 80){const err204 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err204];}else {vErrors.push(err204);}errors++;}if(!pattern29.test(data86)){const err205 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err205];}else {vErrors.push(err205);}errors++;}}var _valid1 = _errs227 === errors;valid71 = valid71 || _valid1;const _errs228 = errors;if(typeof data86 === "string"){if(!pattern30.test(data86)){const err206 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err206];}else {vErrors.push(err206);}errors++;}}var _valid1 = _errs228 === errors;valid71 = valid71 || _valid1;if(!valid71){const err207 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err207];}else {vErrors.push(err207);}errors++;}else {errors = _errs226;if(vErrors !== null){if(_errs226){vErrors.length = _errs226;}else {vErrors = null;}}}if(typeof data86 === "string"){if(func3(data86) > 2048){const err208 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err208];}else {vErrors.push(err208);}errors++;}if(func3(data86) < 1){const err209 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err209];}else {vErrors.push(err209);}errors++;}}else {const err210 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}var _valid0 = _errs224 === errors;if(_valid0){valid70 = true;passing0 = 0;}const _errs229 = errors;if(data86 && typeof data86 == "object" && !Array.isArray(data86)){if(data86.url === undefined){const err211 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err211];}else {vErrors.push(err211);}errors++;}if(data86.sha256 === undefined){const err212 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}for(const key19 in data86){if(!((key19 === "url") || (key19 === "sha256"))){const err213 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key19},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err213];}else {vErrors.push(err213);}errors++;}}if(data86.url !== undefined){let data87 = data86.url;if(typeof data87 === "string"){if(func3(data87) > 2048){const err214 = {instancePath:instancePath+"/nodes/" + i8+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err214];}else {vErrors.push(err214);}errors++;}if(func3(data87) < 8){const err215 = {instancePath:instancePath+"/nodes/" + i8+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err215];}else {vErrors.push(err215);}errors++;}if(!pattern30.test(data87)){const err216 = {instancePath:instancePath+"/nodes/" + i8+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}}else {const err217 = {instancePath:instancePath+"/nodes/" + i8+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}}if(data86.sha256 !== undefined){let data88 = data86.sha256;if(typeof data88 === "string"){if(!pattern32.test(data88)){const err218 = {instancePath:instancePath+"/nodes/" + i8+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}}else {const err219 = {instancePath:instancePath+"/nodes/" + i8+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}}}else {const err220 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}var _valid0 = _errs229 === errors;if(_valid0 && valid70){valid70 = false;passing0 = [passing0, 1];}else {if(_valid0){valid70 = true;passing0 = 1;}}if(!valid70){const err221 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err221];}else {vErrors.push(err221);}errors++;}else {errors = _errs223;if(vErrors !== null){if(_errs223){vErrors.length = _errs223;}else {vErrors = null;}}}}if(data77.sources !== undefined){let data89 = data77.sources;if(Array.isArray(data89)){if(data89.length > 3){const err222 = {instancePath:instancePath+"/nodes/" + i8+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/maxItems",keyword:"maxItems",params:{limit: 3},message:"must NOT have more than 3 items"};if(vErrors === null){vErrors = [err222];}else {vErrors.push(err222);}errors++;}if(data89.length < 1){const err223 = {instancePath:instancePath+"/nodes/" + i8+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err223];}else {vErrors.push(err223);}errors++;}const len11 = data89.length;for(let i9=0; i9 240){const err226 = {instancePath:instancePath+"/nodes/" + i8+"/sources/" + i9+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}if(func3(data91) < 1){const err227 = {instancePath:instancePath+"/nodes/" + i8+"/sources/" + i9+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}}else {const err228 = {instancePath:instancePath+"/nodes/" + i8+"/sources/" + i9+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err228];}else {vErrors.push(err228);}errors++;}}if(data90.line !== undefined){let data92 = data90.line;if(!(((typeof data92 == "number") && (!(data92 % 1) && !isNaN(data92))) && (isFinite(data92)))){const err229 = {instancePath:instancePath+"/nodes/" + i8+"/sources/" + i9+"/line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err229];}else {vErrors.push(err229);}errors++;}if((typeof data92 == "number") && (isFinite(data92))){if(data92 < 1 || isNaN(data92)){const err230 = {instancePath:instancePath+"/nodes/" + i8+"/sources/" + i9+"/line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err230];}else {vErrors.push(err230);}errors++;}}}if(data90.end_line !== undefined){let data93 = data90.end_line;if(!(((typeof data93 == "number") && (!(data93 % 1) && !isNaN(data93))) && (isFinite(data93)))){const err231 = {instancePath:instancePath+"/nodes/" + i8+"/sources/" + i9+"/end_line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/end_line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err231];}else {vErrors.push(err231);}errors++;}if((typeof data93 == "number") && (isFinite(data93))){if(data93 < 1 || isNaN(data93)){const err232 = {instancePath:instancePath+"/nodes/" + i8+"/sources/" + i9+"/end_line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/end_line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err232];}else {vErrors.push(err232);}errors++;}}}if(data90.label !== undefined){let data94 = data90.label;if(typeof data94 === "string"){if(func3(data94) > 48){const err233 = {instancePath:instancePath+"/nodes/" + i8+"/sources/" + i9+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err233];}else {vErrors.push(err233);}errors++;}if(func3(data94) < 1){const err234 = {instancePath:instancePath+"/nodes/" + i8+"/sources/" + i9+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err234];}else {vErrors.push(err234);}errors++;}}else {const err235 = {instancePath:instancePath+"/nodes/" + i8+"/sources/" + i9+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err235];}else {vErrors.push(err235);}errors++;}}}else {const err236 = {instancePath:instancePath+"/nodes/" + i8+"/sources/" + i9,schemaPath:"common.schema.json#/$defs/sourceReferences/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err236];}else {vErrors.push(err236);}errors++;}}}else {const err237 = {instancePath:instancePath+"/nodes/" + i8+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err237];}else {vErrors.push(err237);}errors++;}}if(data77.width !== undefined){let data95 = data77.width;if((typeof data95 == "number") && (isFinite(data95))){if(data95 < 32 || isNaN(data95)){const err238 = {instancePath:instancePath+"/nodes/" + i8+"/width",schemaPath:"#/properties/nodes/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 32},message:"must be >= 32"};if(vErrors === null){vErrors = [err238];}else {vErrors.push(err238);}errors++;}}else {const err239 = {instancePath:instancePath+"/nodes/" + i8+"/width",schemaPath:"#/properties/nodes/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err239];}else {vErrors.push(err239);}errors++;}}if(data77.height !== undefined){let data96 = data77.height;if((typeof data96 == "number") && (isFinite(data96))){if(data96 < 32 || isNaN(data96)){const err240 = {instancePath:instancePath+"/nodes/" + i8+"/height",schemaPath:"#/properties/nodes/items/properties/height/minimum",keyword:"minimum",params:{comparison: ">=", limit: 32},message:"must be >= 32"};if(vErrors === null){vErrors = [err240];}else {vErrors.push(err240);}errors++;}}else {const err241 = {instancePath:instancePath+"/nodes/" + i8+"/height",schemaPath:"#/properties/nodes/items/properties/height/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err241];}else {vErrors.push(err241);}errors++;}}if(data77.yOffset !== undefined){let data97 = data77.yOffset;if(!((typeof data97 == "number") && (isFinite(data97)))){const err242 = {instancePath:instancePath+"/nodes/" + i8+"/yOffset",schemaPath:"#/properties/nodes/items/properties/yOffset/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err242];}else {vErrors.push(err242);}errors++;}}}else {const err243 = {instancePath:instancePath+"/nodes/" + i8,schemaPath:"#/properties/nodes/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err243];}else {vErrors.push(err243);}errors++;}}}else {const err244 = {instancePath:instancePath+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err244];}else {vErrors.push(err244);}errors++;}}if(data.edges !== undefined){let data98 = data.edges;if(Array.isArray(data98)){const len12 = data98.length;for(let i10=0; i10 2){const err260 = {instancePath:instancePath+"/edges/" + i10+"/via/" + i11,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err260];}else {vErrors.push(err260);}errors++;}if(data110.length < 2){const err261 = {instancePath:instancePath+"/edges/" + i10+"/via/" + i11,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err261];}else {vErrors.push(err261);}errors++;}const len14 = data110.length;if(len14 > 0){let data111 = data110[0];if(!((typeof data111 == "number") && (isFinite(data111)))){const err262 = {instancePath:instancePath+"/edges/" + i10+"/via/" + i11+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err262];}else {vErrors.push(err262);}errors++;}}if(len14 > 1){let data112 = data110[1];if(!((typeof data112 == "number") && (isFinite(data112)))){const err263 = {instancePath:instancePath+"/edges/" + i10+"/via/" + i11+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err263];}else {vErrors.push(err263);}errors++;}}const len15 = data110.length;if(!(len15 <= 2)){const err264 = {instancePath:instancePath+"/edges/" + i10+"/via/" + i11,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err264];}else {vErrors.push(err264);}errors++;}}else {const err265 = {instancePath:instancePath+"/edges/" + i10+"/via/" + i11,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err265];}else {vErrors.push(err265);}errors++;}}}else {const err266 = {instancePath:instancePath+"/edges/" + i10+"/via",schemaPath:"#/properties/edges/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err266];}else {vErrors.push(err266);}errors++;}}if(data99.labelAt !== undefined){let data113 = data99.labelAt;if(Array.isArray(data113)){if(data113.length > 2){const err267 = {instancePath:instancePath+"/edges/" + i10+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err267];}else {vErrors.push(err267);}errors++;}if(data113.length < 2){const err268 = {instancePath:instancePath+"/edges/" + i10+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err268];}else {vErrors.push(err268);}errors++;}const len16 = data113.length;if(len16 > 0){let data114 = data113[0];if(!((typeof data114 == "number") && (isFinite(data114)))){const err269 = {instancePath:instancePath+"/edges/" + i10+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err269];}else {vErrors.push(err269);}errors++;}}if(len16 > 1){let data115 = data113[1];if(!((typeof data115 == "number") && (isFinite(data115)))){const err270 = {instancePath:instancePath+"/edges/" + i10+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err270];}else {vErrors.push(err270);}errors++;}}const len17 = data113.length;if(!(len17 <= 2)){const err271 = {instancePath:instancePath+"/edges/" + i10+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err271];}else {vErrors.push(err271);}errors++;}}else {const err272 = {instancePath:instancePath+"/edges/" + i10+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err272];}else {vErrors.push(err272);}errors++;}}if(data99.labelDx !== undefined){let data116 = data99.labelDx;if(!((typeof data116 == "number") && (isFinite(data116)))){const err273 = {instancePath:instancePath+"/edges/" + i10+"/labelDx",schemaPath:"#/properties/edges/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err273];}else {vErrors.push(err273);}errors++;}}if(data99.labelDy !== undefined){let data117 = data99.labelDy;if(!((typeof data117 == "number") && (isFinite(data117)))){const err274 = {instancePath:instancePath+"/edges/" + i10+"/labelDy",schemaPath:"#/properties/edges/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err274];}else {vErrors.push(err274);}errors++;}}if(data99.labelSegment !== undefined){let data118 = data99.labelSegment;if(!(((typeof data118 == "number") && (!(data118 % 1) && !isNaN(data118))) && (isFinite(data118)))){const err275 = {instancePath:instancePath+"/edges/" + i10+"/labelSegment",schemaPath:"#/properties/edges/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err275];}else {vErrors.push(err275);}errors++;}if((typeof data118 == "number") && (isFinite(data118))){if(data118 < 0 || isNaN(data118)){const err276 = {instancePath:instancePath+"/edges/" + i10+"/labelSegment",schemaPath:"#/properties/edges/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err276];}else {vErrors.push(err276);}errors++;}}}if(data99.channelX !== undefined){let data119 = data99.channelX;if(!((typeof data119 == "number") && (isFinite(data119)))){const err277 = {instancePath:instancePath+"/edges/" + i10+"/channelX",schemaPath:"#/properties/edges/items/properties/channelX/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err277];}else {vErrors.push(err277);}errors++;}}if(data99.channelY !== undefined){let data120 = data99.channelY;if(!((typeof data120 == "number") && (isFinite(data120)))){const err278 = {instancePath:instancePath+"/edges/" + i10+"/channelY",schemaPath:"#/properties/edges/items/properties/channelY/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err278];}else {vErrors.push(err278);}errors++;}}if(data99.bias !== undefined){let data121 = data99.bias;if((typeof data121 == "number") && (isFinite(data121))){if(data121 > 1 || isNaN(data121)){const err279 = {instancePath:instancePath+"/edges/" + i10+"/bias",schemaPath:"#/properties/edges/items/properties/bias/maximum",keyword:"maximum",params:{comparison: "<=", limit: 1},message:"must be <= 1"};if(vErrors === null){vErrors = [err279];}else {vErrors.push(err279);}errors++;}if(data121 < 0 || isNaN(data121)){const err280 = {instancePath:instancePath+"/edges/" + i10+"/bias",schemaPath:"#/properties/edges/items/properties/bias/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err280];}else {vErrors.push(err280);}errors++;}}else {const err281 = {instancePath:instancePath+"/edges/" + i10+"/bias",schemaPath:"#/properties/edges/items/properties/bias/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err281];}else {vErrors.push(err281);}errors++;}}if(data99.width !== undefined){let data122 = data99.width;if((typeof data122 == "number") && (isFinite(data122))){if(data122 < 0.5 || isNaN(data122)){const err282 = {instancePath:instancePath+"/edges/" + i10+"/width",schemaPath:"#/properties/edges/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err282];}else {vErrors.push(err282);}errors++;}}else {const err283 = {instancePath:instancePath+"/edges/" + i10+"/width",schemaPath:"#/properties/edges/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err283];}else {vErrors.push(err283);}errors++;}}}else {const err284 = {instancePath:instancePath+"/edges/" + i10,schemaPath:"#/properties/edges/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err284];}else {vErrors.push(err284);}errors++;}}}else {const err285 = {instancePath:instancePath+"/edges",schemaPath:"#/properties/edges/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err285];}else {vErrors.push(err285);}errors++;}}if(data.cards !== undefined){let data123 = data.cards;if(Array.isArray(data123)){const len18 = data123.length;for(let i12=0; i12 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate28.errors = vErrors;return errors === 0;}validate28.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate27(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/sequence.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate27.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.participants === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "participants"},message:"must have required property '"+"participants"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.messages === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "messages"},message:"must have required property '"+"messages"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "participants")) || (key0 === "segments")) || (key0 === "messages")) || (key0 === "activations")) || (key0 === "cards"))){const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err6 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.diagram_type !== undefined){if("sequence" !== data.diagram_type){const err7 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "sequence"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err8 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data2.output === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "output"},message:"must have required property '"+"output"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}for(const key1 in data2){if(!(func1.call(schema73.properties.meta.properties, key1))){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(typeof data4 === "string"){if(func3(data4) > 35){const err13 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/maxLength",keyword:"maxLength",params:{limit: 35},message:"must NOT have more than 35 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(!pattern4.test(data4)){const err14 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/pattern",keyword:"pattern",params:{pattern: "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"},message:"must match pattern \""+"^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"+"\""};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.translations !== undefined){let data5 = data2.translations;if(data5 && typeof data5 == "object" && !Array.isArray(data5)){if(Object.keys(data5).length > 600){const err16 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/maxProperties",keyword:"maxProperties",params:{limit: 600},message:"must NOT have more than 600 properties"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}for(const key2 in data5){const _errs15 = errors;if(typeof key2 === "string"){if(!pattern5.test(key2)){const err17 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/propertyNames/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"},message:"must match pattern \""+"^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"+"\"",propertyName:key2};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}var valid4 = _errs15 === errors;if(!valid4){const err18 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/propertyNames",keyword:"propertyNames",params:{propertyName: key2},message:"property name must be valid"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}for(const key3 in data5){let data6 = data5[key3];if(typeof data6 === "string"){if(func3(data6) > 400){const err19 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/maxLength",keyword:"maxLength",params:{limit: 400},message:"must NOT have more than 400 characters"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(func3(data6) < 1){const err20 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}else {const err21 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}}else {const err22 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err23 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data2.output !== undefined){let data8 = data2.output;if(typeof data8 === "string"){if(!pattern6.test(data8)){const err24 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/0/pattern",keyword:"pattern",params:{pattern: "(?:^|/)[^/]+[.][Hh][Tt][Mm][Ll]$"},message:"must match pattern \""+"(?:^|/)[^/]+[.][Hh][Tt][Mm][Ll]$"+"\""};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}const _errs26 = errors;const _errs27 = errors;if(typeof data8 === "string"){if(!pattern7.test(data8)){const err25 = {};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}var valid8 = _errs27 === errors;if(valid8){const err26 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}else {errors = _errs26;if(vErrors !== null){if(_errs26){vErrors.length = _errs26;}else {vErrors = null;}}}const _errs29 = errors;const _errs30 = errors;if(typeof data8 === "string"){if(!pattern8.test(data8)){const err27 = {};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}var valid9 = _errs30 === errors;if(valid9){const err28 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/2/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}else {errors = _errs29;if(vErrors !== null){if(_errs29){vErrors.length = _errs29;}else {vErrors = null;}}}const _errs32 = errors;const _errs33 = errors;if(typeof data8 === "string"){if(!pattern9.test(data8)){const err29 = {};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}var valid10 = _errs33 === errors;if(valid10){const err30 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/3/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}else {errors = _errs32;if(vErrors !== null){if(_errs32){vErrors.length = _errs32;}else {vErrors = null;}}}const _errs35 = errors;const _errs36 = errors;if(typeof data8 === "string"){if(!pattern10.test(data8)){const err31 = {};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}var valid11 = _errs36 === errors;if(valid11){const err32 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/4/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}else {errors = _errs35;if(vErrors !== null){if(_errs35){vErrors.length = _errs35;}else {vErrors = null;}}}const _errs38 = errors;const _errs39 = errors;if(typeof data8 === "string"){if(!pattern11.test(data8)){const err33 = {};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}var valid12 = _errs39 === errors;if(valid12){const err34 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/5/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}else {errors = _errs38;if(vErrors !== null){if(_errs38){vErrors.length = _errs38;}else {vErrors = null;}}}const _errs41 = errors;const _errs42 = errors;if(typeof data8 === "string"){if(!pattern12.test(data8)){const err35 = {};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}var valid13 = _errs42 === errors;if(valid13){const err36 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/6/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}else {errors = _errs41;if(vErrors !== null){if(_errs41){vErrors.length = _errs41;}else {vErrors = null;}}}const _errs44 = errors;const _errs45 = errors;if(typeof data8 === "string"){if(!pattern13.test(data8)){const err37 = {};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}var valid14 = _errs45 === errors;if(valid14){const err38 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/7/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}else {errors = _errs44;if(vErrors !== null){if(_errs44){vErrors.length = _errs44;}else {vErrors = null;}}}if(typeof data8 === "string"){if(func3(data8) < 1){const err39 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}if(!pattern14.test(data8)){const err40 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/pattern",keyword:"pattern",params:{pattern: "^[^/]+(?:/[^/]+)*$"},message:"must match pattern \""+"^[^/]+(?:/[^/]+)*$"+"\""};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}else {const err41 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}if(data2.animation !== undefined){let data9 = data2.animation;if(!((data9 === "trace") || (data9 === "none"))){const err42 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema77.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data2.visual_preset !== undefined){let data10 = data2.visual_preset;if(!((((data10 === "classic") || (data10 === "signal-flow")) || (data10 === "blueprint")) || (data10 === "editorial"))){const err43 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema78.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data2.quality_profile !== undefined){let data11 = data2.quality_profile;if(!((data11 === "standard") || (data11 === "showcase"))){const err44 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema79.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data2.column_fit !== undefined){let data12 = data2.column_fit;if(!((data12 === "fixed") || (data12 === "spread"))){const err45 = {instancePath:instancePath+"/meta/column_fit",schemaPath:"#/properties/meta/properties/column_fit/enum",keyword:"enum",params:{allowedValues: schema73.properties.meta.properties.column_fit.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}if(data2.repository !== undefined){let data13 = data2.repository;if(data13 && typeof data13 == "object" && !Array.isArray(data13)){if(data13.url === undefined){const err46 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}if(data13.revision === undefined){const err47 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}for(const key4 in data13){if(!((((key4 === "url") || (key4 === "provider")) || (key4 === "link_mode")) || (key4 === "revision"))){const err48 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}if(data13.url !== undefined){let data14 = data13.url;if(typeof data14 === "string"){if(func3(data14) < 1){const err49 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"common.schema.json#/$defs/repository/properties/url/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}else {const err50 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"common.schema.json#/$defs/repository/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}if(data13.provider !== undefined){let data15 = data13.provider;if(!((data15 === "github") || (data15 === "gitee"))){const err51 = {instancePath:instancePath+"/meta/repository/provider",schemaPath:"common.schema.json#/$defs/repository/properties/provider/enum",keyword:"enum",params:{allowedValues: schema36.properties.provider.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data13.link_mode !== undefined){let data16 = data13.link_mode;if(!((data16 === "web") || (data16 === "local-only"))){const err52 = {instancePath:instancePath+"/meta/repository/link_mode",schemaPath:"common.schema.json#/$defs/repository/properties/link_mode/enum",keyword:"enum",params:{allowedValues: schema36.properties.link_mode.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}if(data13.revision !== undefined){let data17 = data13.revision;if(typeof data17 === "string"){if(!pattern15.test(data17)){const err53 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"common.schema.json#/$defs/repository/properties/revision/pattern",keyword:"pattern",params:{pattern: "^[a-fA-F0-9]{40}$"},message:"must match pattern \""+"^[a-fA-F0-9]{40}$"+"\""};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"common.schema.json#/$defs/repository/properties/revision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}}else {const err55 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data2.views !== undefined){if(!(validate28(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate28.errors : vErrors.concat(validate28.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data19 = data2.legend;if(data19 && typeof data19 == "object" && !Array.isArray(data19)){for(const key5 in data19){if(!((key5 === "mode") || (key5 === "entries"))){const err56 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data19.mode !== undefined){let data20 = data19.mode;if(!(((data20 === "auto") || (data20 === "all")) || (data20 === "hidden"))){const err57 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema40.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}if(data19.entries !== undefined){let data21 = data19.entries;if(data21 && typeof data21 == "object" && !Array.isArray(data21)){for(const key6 in data21){if(!(((((key6 === "default") || (key6 === "emphasis")) || (key6 === "security")) || (key6 === "dashed")) || (key6 === "return"))){const err58 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data21.default !== undefined){let data22 = data21.default;if(data22 && typeof data22 == "object" && !Array.isArray(data22)){if(Object.keys(data22).length < 1){const err59 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}for(const key7 in data22){if(!((key7 === "label") || (key7 === "visible"))){const err60 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}if(data22.label !== undefined){let data23 = data22.label;if(typeof data23 === "string"){if(func3(data23) > 80){const err61 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}if(func3(data23) < 1){const err62 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data22.visible !== undefined){if(typeof data22.visible !== "boolean"){const err64 = {instancePath:instancePath+"/meta/legend/entries/default/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}}else {const err65 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data21.emphasis !== undefined){let data25 = data21.emphasis;if(data25 && typeof data25 == "object" && !Array.isArray(data25)){if(Object.keys(data25).length < 1){const err66 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}for(const key8 in data25){if(!((key8 === "label") || (key8 === "visible"))){const err67 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data25.label !== undefined){let data26 = data25.label;if(typeof data26 === "string"){if(func3(data26) > 80){const err68 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}if(func3(data26) < 1){const err69 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}if(data25.visible !== undefined){if(typeof data25.visible !== "boolean"){const err71 = {instancePath:instancePath+"/meta/legend/entries/emphasis/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}}else {const err72 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data21.security !== undefined){let data28 = data21.security;if(data28 && typeof data28 == "object" && !Array.isArray(data28)){if(Object.keys(data28).length < 1){const err73 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}for(const key9 in data28){if(!((key9 === "label") || (key9 === "visible"))){const err74 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data28.label !== undefined){let data29 = data28.label;if(typeof data29 === "string"){if(func3(data29) > 80){const err75 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}if(func3(data29) < 1){const err76 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}else {const err77 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}if(data28.visible !== undefined){if(typeof data28.visible !== "boolean"){const err78 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}}else {const err79 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}if(data21.dashed !== undefined){let data31 = data21.dashed;if(data31 && typeof data31 == "object" && !Array.isArray(data31)){if(Object.keys(data31).length < 1){const err80 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}for(const key10 in data31){if(!((key10 === "label") || (key10 === "visible"))){const err81 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}if(data31.label !== undefined){let data32 = data31.label;if(typeof data32 === "string"){if(func3(data32) > 80){const err82 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(func3(data32) < 1){const err83 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}else {const err84 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data31.visible !== undefined){if(typeof data31.visible !== "boolean"){const err85 = {instancePath:instancePath+"/meta/legend/entries/dashed/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}}else {const err86 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}if(data21.return !== undefined){let data34 = data21.return;if(data34 && typeof data34 == "object" && !Array.isArray(data34)){if(Object.keys(data34).length < 1){const err87 = {instancePath:instancePath+"/meta/legend/entries/return",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}for(const key11 in data34){if(!((key11 === "label") || (key11 === "visible"))){const err88 = {instancePath:instancePath+"/meta/legend/entries/return",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data34.label !== undefined){let data35 = data34.label;if(typeof data35 === "string"){if(func3(data35) > 80){const err89 = {instancePath:instancePath+"/meta/legend/entries/return/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if(func3(data35) < 1){const err90 = {instancePath:instancePath+"/meta/legend/entries/return/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}}else {const err91 = {instancePath:instancePath+"/meta/legend/entries/return/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}if(data34.visible !== undefined){if(typeof data34.visible !== "boolean"){const err92 = {instancePath:instancePath+"/meta/legend/entries/return/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}}else {const err93 = {instancePath:instancePath+"/meta/legend/entries/return",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}}else {const err94 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}}else {const err95 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}if(data2.viewBox !== undefined){let data37 = data2.viewBox;if(Array.isArray(data37)){if(data37.length > 2){const err96 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}if(data37.length < 2){const err97 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}const len0 = data37.length;if(len0 > 0){let data38 = data37[0];if((typeof data38 == "number") && (isFinite(data38))){if(data38 < 480 || isNaN(data38)){const err98 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 480},message:"must be >= 480"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}else {const err99 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(len0 > 1){let data39 = data37[1];if((typeof data39 == "number") && (isFinite(data39))){if(data39 < 480 || isNaN(data39)){const err100 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 480},message:"must be >= 480"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}else {const err101 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}const len1 = data37.length;if(!(len1 <= 2)){const err102 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}else {const err103 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}}else {const err104 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}if(data.participants !== undefined){let data40 = data.participants;if(Array.isArray(data40)){if(data40.length < 2){const err105 = {instancePath:instancePath+"/participants",schemaPath:"#/properties/participants/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}const len2 = data40.length;for(let i0=0; i0 80){const err117 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}if(!pattern29.test(data47)){const err118 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}var _valid1 = _errs140 === errors;valid42 = valid42 || _valid1;const _errs141 = errors;if(typeof data47 === "string"){if(!pattern30.test(data47)){const err119 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}var _valid1 = _errs141 === errors;valid42 = valid42 || _valid1;if(!valid42){const err120 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}else {errors = _errs139;if(vErrors !== null){if(_errs139){vErrors.length = _errs139;}else {vErrors = null;}}}if(typeof data47 === "string"){if(func3(data47) > 2048){const err121 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}if(func3(data47) < 1){const err122 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}}else {const err123 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}var _valid0 = _errs137 === errors;if(_valid0){valid41 = true;passing0 = 0;}const _errs142 = errors;if(data47 && typeof data47 == "object" && !Array.isArray(data47)){if(data47.url === undefined){const err124 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}if(data47.sha256 === undefined){const err125 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}for(const key13 in data47){if(!((key13 === "url") || (key13 === "sha256"))){const err126 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}if(data47.url !== undefined){let data48 = data47.url;if(typeof data48 === "string"){if(func3(data48) > 2048){const err127 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}if(func3(data48) < 8){const err128 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}if(!pattern30.test(data48)){const err129 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}}else {const err130 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}if(data47.sha256 !== undefined){let data49 = data47.sha256;if(typeof data49 === "string"){if(!pattern32.test(data49)){const err131 = {instancePath:instancePath+"/participants/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}else {const err132 = {instancePath:instancePath+"/participants/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}}}else {const err133 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}var _valid0 = _errs142 === errors;if(_valid0 && valid41){valid41 = false;passing0 = [passing0, 1];}else {if(_valid0){valid41 = true;passing0 = 1;}}if(!valid41){const err134 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}else {errors = _errs136;if(vErrors !== null){if(_errs136){vErrors.length = _errs136;}else {vErrors = null;}}}}if(data41.sources !== undefined){let data50 = data41.sources;if(Array.isArray(data50)){if(data50.length > 3){const err135 = {instancePath:instancePath+"/participants/" + i0+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/maxItems",keyword:"maxItems",params:{limit: 3},message:"must NOT have more than 3 items"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}if(data50.length < 1){const err136 = {instancePath:instancePath+"/participants/" + i0+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}const len3 = data50.length;for(let i1=0; i1 240){const err139 = {instancePath:instancePath+"/participants/" + i0+"/sources/" + i1+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}if(func3(data52) < 1){const err140 = {instancePath:instancePath+"/participants/" + i0+"/sources/" + i1+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}else {const err141 = {instancePath:instancePath+"/participants/" + i0+"/sources/" + i1+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}if(data51.line !== undefined){let data53 = data51.line;if(!(((typeof data53 == "number") && (!(data53 % 1) && !isNaN(data53))) && (isFinite(data53)))){const err142 = {instancePath:instancePath+"/participants/" + i0+"/sources/" + i1+"/line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}if((typeof data53 == "number") && (isFinite(data53))){if(data53 < 1 || isNaN(data53)){const err143 = {instancePath:instancePath+"/participants/" + i0+"/sources/" + i1+"/line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}}if(data51.end_line !== undefined){let data54 = data51.end_line;if(!(((typeof data54 == "number") && (!(data54 % 1) && !isNaN(data54))) && (isFinite(data54)))){const err144 = {instancePath:instancePath+"/participants/" + i0+"/sources/" + i1+"/end_line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/end_line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}if((typeof data54 == "number") && (isFinite(data54))){if(data54 < 1 || isNaN(data54)){const err145 = {instancePath:instancePath+"/participants/" + i0+"/sources/" + i1+"/end_line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/end_line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}}if(data51.label !== undefined){let data55 = data51.label;if(typeof data55 === "string"){if(func3(data55) > 48){const err146 = {instancePath:instancePath+"/participants/" + i0+"/sources/" + i1+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}if(func3(data55) < 1){const err147 = {instancePath:instancePath+"/participants/" + i0+"/sources/" + i1+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}}else {const err148 = {instancePath:instancePath+"/participants/" + i0+"/sources/" + i1+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}}else {const err149 = {instancePath:instancePath+"/participants/" + i0+"/sources/" + i1,schemaPath:"common.schema.json#/$defs/sourceReferences/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}}}else {const err150 = {instancePath:instancePath+"/participants/" + i0+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}}else {const err151 = {instancePath:instancePath+"/participants/" + i0,schemaPath:"#/properties/participants/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}}}else {const err152 = {instancePath:instancePath+"/participants",schemaPath:"#/properties/participants/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}}if(data.segments !== undefined){let data56 = data.segments;if(Array.isArray(data56)){const len4 = data56.length;for(let i2=0; i2=", limit: 160},message:"must be >= 160"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}else {const err176 = {instancePath:instancePath+"/messages/" + i3+"/y",schemaPath:"#/properties/messages/items/properties/y/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}}if(data62.label !== undefined){let data67 = data62.label;if(typeof data67 === "string"){if(func3(data67) < 1){const err177 = {instancePath:instancePath+"/messages/" + i3+"/label",schemaPath:"#/properties/messages/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}}else {const err178 = {instancePath:instancePath+"/messages/" + i3+"/label",schemaPath:"#/properties/messages/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}}if(data62.variant !== undefined){let data68 = data62.variant;if(!(((((data68 === "default") || (data68 === "emphasis")) || (data68 === "security")) || (data68 === "dashed")) || (data68 === "return"))){const err179 = {instancePath:instancePath+"/messages/" + i3+"/variant",schemaPath:"#/properties/messages/items/properties/variant/enum",keyword:"enum",params:{allowedValues: schema73.properties.messages.items.properties.variant.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}if(data62.note !== undefined){if(typeof data62.note !== "string"){const err180 = {instancePath:instancePath+"/messages/" + i3+"/note",schemaPath:"#/properties/messages/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}}else {const err181 = {instancePath:instancePath+"/messages/" + i3,schemaPath:"#/properties/messages/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}}}else {const err182 = {instancePath:instancePath+"/messages",schemaPath:"#/properties/messages/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}}if(data.activations !== undefined){let data70 = data.activations;if(Array.isArray(data70)){const len6 = data70.length;for(let i4=0; i4 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate31.errors = vErrors;return errors === 0;}validate31.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate30(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/dataflow.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate30.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.stages === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "stages"},message:"must have required property '"+"stages"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.nodes === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "nodes"},message:"must have required property '"+"nodes"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.flows === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "flows"},message:"must have required property '"+"flows"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!(((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "stages")) || (key0 === "nodes")) || (key0 === "flows")) || (key0 === "cards"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err7 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.diagram_type !== undefined){if("dataflow" !== data.diagram_type){const err8 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "dataflow"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data2.output === undefined){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "output"},message:"must have required property '"+"output"+"'"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}for(const key1 in data2){if(!(func1.call(schema101.properties.meta.properties, key1))){const err11 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}else {const err13 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(typeof data4 === "string"){if(func3(data4) > 35){const err14 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/maxLength",keyword:"maxLength",params:{limit: 35},message:"must NOT have more than 35 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(!pattern4.test(data4)){const err15 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/pattern",keyword:"pattern",params:{pattern: "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"},message:"must match pattern \""+"^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"+"\""};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.translations !== undefined){let data5 = data2.translations;if(data5 && typeof data5 == "object" && !Array.isArray(data5)){if(Object.keys(data5).length > 600){const err17 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/maxProperties",keyword:"maxProperties",params:{limit: 600},message:"must NOT have more than 600 properties"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}for(const key2 in data5){const _errs15 = errors;if(typeof key2 === "string"){if(!pattern5.test(key2)){const err18 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/propertyNames/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"},message:"must match pattern \""+"^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"+"\"",propertyName:key2};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}var valid4 = _errs15 === errors;if(!valid4){const err19 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/propertyNames",keyword:"propertyNames",params:{propertyName: key2},message:"property name must be valid"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}for(const key3 in data5){let data6 = data5[key3];if(typeof data6 === "string"){if(func3(data6) > 400){const err20 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/maxLength",keyword:"maxLength",params:{limit: 400},message:"must NOT have more than 400 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(func3(data6) < 1){const err21 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}}else {const err23 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err24 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data2.output !== undefined){let data8 = data2.output;if(typeof data8 === "string"){if(!pattern6.test(data8)){const err25 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/0/pattern",keyword:"pattern",params:{pattern: "(?:^|/)[^/]+[.][Hh][Tt][Mm][Ll]$"},message:"must match pattern \""+"(?:^|/)[^/]+[.][Hh][Tt][Mm][Ll]$"+"\""};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}const _errs26 = errors;const _errs27 = errors;if(typeof data8 === "string"){if(!pattern7.test(data8)){const err26 = {};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}var valid8 = _errs27 === errors;if(valid8){const err27 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}else {errors = _errs26;if(vErrors !== null){if(_errs26){vErrors.length = _errs26;}else {vErrors = null;}}}const _errs29 = errors;const _errs30 = errors;if(typeof data8 === "string"){if(!pattern8.test(data8)){const err28 = {};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}var valid9 = _errs30 === errors;if(valid9){const err29 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/2/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}else {errors = _errs29;if(vErrors !== null){if(_errs29){vErrors.length = _errs29;}else {vErrors = null;}}}const _errs32 = errors;const _errs33 = errors;if(typeof data8 === "string"){if(!pattern9.test(data8)){const err30 = {};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}var valid10 = _errs33 === errors;if(valid10){const err31 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/3/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}else {errors = _errs32;if(vErrors !== null){if(_errs32){vErrors.length = _errs32;}else {vErrors = null;}}}const _errs35 = errors;const _errs36 = errors;if(typeof data8 === "string"){if(!pattern10.test(data8)){const err32 = {};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}var valid11 = _errs36 === errors;if(valid11){const err33 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/4/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}else {errors = _errs35;if(vErrors !== null){if(_errs35){vErrors.length = _errs35;}else {vErrors = null;}}}const _errs38 = errors;const _errs39 = errors;if(typeof data8 === "string"){if(!pattern11.test(data8)){const err34 = {};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}var valid12 = _errs39 === errors;if(valid12){const err35 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/5/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}else {errors = _errs38;if(vErrors !== null){if(_errs38){vErrors.length = _errs38;}else {vErrors = null;}}}const _errs41 = errors;const _errs42 = errors;if(typeof data8 === "string"){if(!pattern12.test(data8)){const err36 = {};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}var valid13 = _errs42 === errors;if(valid13){const err37 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/6/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}else {errors = _errs41;if(vErrors !== null){if(_errs41){vErrors.length = _errs41;}else {vErrors = null;}}}const _errs44 = errors;const _errs45 = errors;if(typeof data8 === "string"){if(!pattern13.test(data8)){const err38 = {};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}var valid14 = _errs45 === errors;if(valid14){const err39 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/7/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}else {errors = _errs44;if(vErrors !== null){if(_errs44){vErrors.length = _errs44;}else {vErrors = null;}}}if(typeof data8 === "string"){if(func3(data8) < 1){const err40 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if(!pattern14.test(data8)){const err41 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/pattern",keyword:"pattern",params:{pattern: "^[^/]+(?:/[^/]+)*$"},message:"must match pattern \""+"^[^/]+(?:/[^/]+)*$"+"\""};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}else {const err42 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data2.animation !== undefined){let data9 = data2.animation;if(!((data9 === "trace") || (data9 === "none"))){const err43 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema77.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data2.visual_preset !== undefined){let data10 = data2.visual_preset;if(!((((data10 === "classic") || (data10 === "signal-flow")) || (data10 === "blueprint")) || (data10 === "editorial"))){const err44 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema78.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data2.quality_profile !== undefined){let data11 = data2.quality_profile;if(!((data11 === "standard") || (data11 === "showcase"))){const err45 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema79.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}if(data2.repository !== undefined){let data12 = data2.repository;if(data12 && typeof data12 == "object" && !Array.isArray(data12)){if(data12.url === undefined){const err46 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}if(data12.revision === undefined){const err47 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}for(const key4 in data12){if(!((((key4 === "url") || (key4 === "provider")) || (key4 === "link_mode")) || (key4 === "revision"))){const err48 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}if(data12.url !== undefined){let data13 = data12.url;if(typeof data13 === "string"){if(func3(data13) < 1){const err49 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"common.schema.json#/$defs/repository/properties/url/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}else {const err50 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"common.schema.json#/$defs/repository/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}if(data12.provider !== undefined){let data14 = data12.provider;if(!((data14 === "github") || (data14 === "gitee"))){const err51 = {instancePath:instancePath+"/meta/repository/provider",schemaPath:"common.schema.json#/$defs/repository/properties/provider/enum",keyword:"enum",params:{allowedValues: schema36.properties.provider.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data12.link_mode !== undefined){let data15 = data12.link_mode;if(!((data15 === "web") || (data15 === "local-only"))){const err52 = {instancePath:instancePath+"/meta/repository/link_mode",schemaPath:"common.schema.json#/$defs/repository/properties/link_mode/enum",keyword:"enum",params:{allowedValues: schema36.properties.link_mode.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}if(data12.revision !== undefined){let data16 = data12.revision;if(typeof data16 === "string"){if(!pattern15.test(data16)){const err53 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"common.schema.json#/$defs/repository/properties/revision/pattern",keyword:"pattern",params:{pattern: "^[a-fA-F0-9]{40}$"},message:"must match pattern \""+"^[a-fA-F0-9]{40}$"+"\""};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"common.schema.json#/$defs/repository/properties/revision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}}else {const err55 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data2.views !== undefined){if(!(validate31(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate31.errors : vErrors.concat(validate31.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data18 = data2.legend;if(data18 && typeof data18 == "object" && !Array.isArray(data18)){for(const key5 in data18){if(!((key5 === "mode") || (key5 === "entries"))){const err56 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data18.mode !== undefined){let data19 = data18.mode;if(!(((data19 === "auto") || (data19 === "all")) || (data19 === "hidden"))){const err57 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema40.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}if(data18.entries !== undefined){let data20 = data18.entries;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){for(const key6 in data20){if(!(((((key6 === "default") || (key6 === "emphasis")) || (key6 === "security")) || (key6 === "dashed")) || (key6 === "database"))){const err58 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data20.default !== undefined){let data21 = data20.default;if(data21 && typeof data21 == "object" && !Array.isArray(data21)){if(Object.keys(data21).length < 1){const err59 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}for(const key7 in data21){if(!((key7 === "label") || (key7 === "visible"))){const err60 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}if(data21.label !== undefined){let data22 = data21.label;if(typeof data22 === "string"){if(func3(data22) > 80){const err61 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}if(func3(data22) < 1){const err62 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data21.visible !== undefined){if(typeof data21.visible !== "boolean"){const err64 = {instancePath:instancePath+"/meta/legend/entries/default/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}}else {const err65 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data20.emphasis !== undefined){let data24 = data20.emphasis;if(data24 && typeof data24 == "object" && !Array.isArray(data24)){if(Object.keys(data24).length < 1){const err66 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}for(const key8 in data24){if(!((key8 === "label") || (key8 === "visible"))){const err67 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data24.label !== undefined){let data25 = data24.label;if(typeof data25 === "string"){if(func3(data25) > 80){const err68 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}if(func3(data25) < 1){const err69 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}if(data24.visible !== undefined){if(typeof data24.visible !== "boolean"){const err71 = {instancePath:instancePath+"/meta/legend/entries/emphasis/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}}else {const err72 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data20.security !== undefined){let data27 = data20.security;if(data27 && typeof data27 == "object" && !Array.isArray(data27)){if(Object.keys(data27).length < 1){const err73 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}for(const key9 in data27){if(!((key9 === "label") || (key9 === "visible"))){const err74 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data27.label !== undefined){let data28 = data27.label;if(typeof data28 === "string"){if(func3(data28) > 80){const err75 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}if(func3(data28) < 1){const err76 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}else {const err77 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}if(data27.visible !== undefined){if(typeof data27.visible !== "boolean"){const err78 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}}else {const err79 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}if(data20.dashed !== undefined){let data30 = data20.dashed;if(data30 && typeof data30 == "object" && !Array.isArray(data30)){if(Object.keys(data30).length < 1){const err80 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}for(const key10 in data30){if(!((key10 === "label") || (key10 === "visible"))){const err81 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}if(data30.label !== undefined){let data31 = data30.label;if(typeof data31 === "string"){if(func3(data31) > 80){const err82 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(func3(data31) < 1){const err83 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}else {const err84 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data30.visible !== undefined){if(typeof data30.visible !== "boolean"){const err85 = {instancePath:instancePath+"/meta/legend/entries/dashed/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}}else {const err86 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}if(data20.database !== undefined){let data33 = data20.database;if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(Object.keys(data33).length < 1){const err87 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}for(const key11 in data33){if(!((key11 === "label") || (key11 === "visible"))){const err88 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data33.label !== undefined){let data34 = data33.label;if(typeof data34 === "string"){if(func3(data34) > 80){const err89 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if(func3(data34) < 1){const err90 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}}else {const err91 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}if(data33.visible !== undefined){if(typeof data33.visible !== "boolean"){const err92 = {instancePath:instancePath+"/meta/legend/entries/database/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}}else {const err93 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}}else {const err94 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}}else {const err95 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}if(data2.viewBox !== undefined){let data36 = data2.viewBox;if(Array.isArray(data36)){if(data36.length > 2){const err96 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}if(data36.length < 2){const err97 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}const len0 = data36.length;if(len0 > 0){let data37 = data36[0];if((typeof data37 == "number") && (isFinite(data37))){if(data37 < 360 || isNaN(data37)){const err98 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 360},message:"must be >= 360"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}else {const err99 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(len0 > 1){let data38 = data36[1];if((typeof data38 == "number") && (isFinite(data38))){if(data38 < 360 || isNaN(data38)){const err100 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 360},message:"must be >= 360"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}else {const err101 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}const len1 = data36.length;if(!(len1 <= 2)){const err102 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}else {const err103 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}}else {const err104 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}if(data.stages !== undefined){let data39 = data.stages;if(Array.isArray(data39)){if(data39.length > 5){const err105 = {instancePath:instancePath+"/stages",schemaPath:"#/properties/stages/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}if(data39.length < 2){const err106 = {instancePath:instancePath+"/stages",schemaPath:"#/properties/stages/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}const len2 = data39.length;for(let i0=0; i0 80){const err128 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}if(!pattern29.test(data50)){const err129 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}}var _valid1 = _errs148 === errors;valid45 = valid45 || _valid1;const _errs149 = errors;if(typeof data50 === "string"){if(!pattern30.test(data50)){const err130 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}var _valid1 = _errs149 === errors;valid45 = valid45 || _valid1;if(!valid45){const err131 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}else {errors = _errs147;if(vErrors !== null){if(_errs147){vErrors.length = _errs147;}else {vErrors = null;}}}if(typeof data50 === "string"){if(func3(data50) > 2048){const err132 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}if(func3(data50) < 1){const err133 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}else {const err134 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}var _valid0 = _errs145 === errors;if(_valid0){valid44 = true;passing0 = 0;}const _errs150 = errors;if(data50 && typeof data50 == "object" && !Array.isArray(data50)){if(data50.url === undefined){const err135 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}if(data50.sha256 === undefined){const err136 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}for(const key14 in data50){if(!((key14 === "url") || (key14 === "sha256"))){const err137 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}if(data50.url !== undefined){let data51 = data50.url;if(typeof data51 === "string"){if(func3(data51) > 2048){const err138 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}if(func3(data51) < 8){const err139 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}if(!pattern30.test(data51)){const err140 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}else {const err141 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}if(data50.sha256 !== undefined){let data52 = data50.sha256;if(typeof data52 === "string"){if(!pattern32.test(data52)){const err142 = {instancePath:instancePath+"/nodes/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}else {const err143 = {instancePath:instancePath+"/nodes/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}}else {const err144 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}var _valid0 = _errs150 === errors;if(_valid0 && valid44){valid44 = false;passing0 = [passing0, 1];}else {if(_valid0){valid44 = true;passing0 = 1;}}if(!valid44){const err145 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}else {errors = _errs144;if(vErrors !== null){if(_errs144){vErrors.length = _errs144;}else {vErrors = null;}}}}if(data43.sources !== undefined){let data53 = data43.sources;if(Array.isArray(data53)){if(data53.length > 3){const err146 = {instancePath:instancePath+"/nodes/" + i1+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/maxItems",keyword:"maxItems",params:{limit: 3},message:"must NOT have more than 3 items"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}if(data53.length < 1){const err147 = {instancePath:instancePath+"/nodes/" + i1+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}const len4 = data53.length;for(let i2=0; i2 240){const err150 = {instancePath:instancePath+"/nodes/" + i1+"/sources/" + i2+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}if(func3(data55) < 1){const err151 = {instancePath:instancePath+"/nodes/" + i1+"/sources/" + i2+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}}else {const err152 = {instancePath:instancePath+"/nodes/" + i1+"/sources/" + i2+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}}if(data54.line !== undefined){let data56 = data54.line;if(!(((typeof data56 == "number") && (!(data56 % 1) && !isNaN(data56))) && (isFinite(data56)))){const err153 = {instancePath:instancePath+"/nodes/" + i1+"/sources/" + i2+"/line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}if((typeof data56 == "number") && (isFinite(data56))){if(data56 < 1 || isNaN(data56)){const err154 = {instancePath:instancePath+"/nodes/" + i1+"/sources/" + i2+"/line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}}if(data54.end_line !== undefined){let data57 = data54.end_line;if(!(((typeof data57 == "number") && (!(data57 % 1) && !isNaN(data57))) && (isFinite(data57)))){const err155 = {instancePath:instancePath+"/nodes/" + i1+"/sources/" + i2+"/end_line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/end_line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}if((typeof data57 == "number") && (isFinite(data57))){if(data57 < 1 || isNaN(data57)){const err156 = {instancePath:instancePath+"/nodes/" + i1+"/sources/" + i2+"/end_line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/end_line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}}}if(data54.label !== undefined){let data58 = data54.label;if(typeof data58 === "string"){if(func3(data58) > 48){const err157 = {instancePath:instancePath+"/nodes/" + i1+"/sources/" + i2+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}if(func3(data58) < 1){const err158 = {instancePath:instancePath+"/nodes/" + i1+"/sources/" + i2+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}}else {const err159 = {instancePath:instancePath+"/nodes/" + i1+"/sources/" + i2+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}}}else {const err160 = {instancePath:instancePath+"/nodes/" + i1+"/sources/" + i2,schemaPath:"common.schema.json#/$defs/sourceReferences/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}}}else {const err161 = {instancePath:instancePath+"/nodes/" + i1+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}}if(data43.stage !== undefined){let data59 = data43.stage;if(!(((typeof data59 == "number") && (!(data59 % 1) && !isNaN(data59))) && (isFinite(data59)))){const err162 = {instancePath:instancePath+"/nodes/" + i1+"/stage",schemaPath:"#/properties/nodes/items/properties/stage/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}if((typeof data59 == "number") && (isFinite(data59))){if(data59 < 0 || isNaN(data59)){const err163 = {instancePath:instancePath+"/nodes/" + i1+"/stage",schemaPath:"#/properties/nodes/items/properties/stage/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}}if(data43.row !== undefined){let data60 = data43.row;if(!(((typeof data60 == "number") && (!(data60 % 1) && !isNaN(data60))) && (isFinite(data60)))){const err164 = {instancePath:instancePath+"/nodes/" + i1+"/row",schemaPath:"#/properties/nodes/items/properties/row/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}if((typeof data60 == "number") && (isFinite(data60))){if(data60 < 0 || isNaN(data60)){const err165 = {instancePath:instancePath+"/nodes/" + i1+"/row",schemaPath:"#/properties/nodes/items/properties/row/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}}if(data43.width !== undefined){let data61 = data43.width;if((typeof data61 == "number") && (isFinite(data61))){if(data61 < 48 || isNaN(data61)){const err166 = {instancePath:instancePath+"/nodes/" + i1+"/width",schemaPath:"#/properties/nodes/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 48},message:"must be >= 48"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}else {const err167 = {instancePath:instancePath+"/nodes/" + i1+"/width",schemaPath:"#/properties/nodes/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}if(data43.height !== undefined){let data62 = data43.height;if((typeof data62 == "number") && (isFinite(data62))){if(data62 < 36 || isNaN(data62)){const err168 = {instancePath:instancePath+"/nodes/" + i1+"/height",schemaPath:"#/properties/nodes/items/properties/height/minimum",keyword:"minimum",params:{comparison: ">=", limit: 36},message:"must be >= 36"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}else {const err169 = {instancePath:instancePath+"/nodes/" + i1+"/height",schemaPath:"#/properties/nodes/items/properties/height/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}}if(data43.yOffset !== undefined){let data63 = data43.yOffset;if(!((typeof data63 == "number") && (isFinite(data63)))){const err170 = {instancePath:instancePath+"/nodes/" + i1+"/yOffset",schemaPath:"#/properties/nodes/items/properties/yOffset/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}}}else {const err171 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}}else {const err172 = {instancePath:instancePath+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}}if(data.flows !== undefined){let data64 = data.flows;if(Array.isArray(data64)){const len5 = data64.length;for(let i3=0; i3 2){const err192 = {instancePath:instancePath+"/flows/" + i3+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}if(data77.length < 2){const err193 = {instancePath:instancePath+"/flows/" + i3+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}const len6 = data77.length;if(len6 > 0){let data78 = data77[0];if(!((typeof data78 == "number") && (isFinite(data78)))){const err194 = {instancePath:instancePath+"/flows/" + i3+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}if(len6 > 1){let data79 = data77[1];if(!((typeof data79 == "number") && (isFinite(data79)))){const err195 = {instancePath:instancePath+"/flows/" + i3+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}const len7 = data77.length;if(!(len7 <= 2)){const err196 = {instancePath:instancePath+"/flows/" + i3+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}}else {const err197 = {instancePath:instancePath+"/flows/" + i3+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}}if(data65.labelDx !== undefined){let data80 = data65.labelDx;if(!((typeof data80 == "number") && (isFinite(data80)))){const err198 = {instancePath:instancePath+"/flows/" + i3+"/labelDx",schemaPath:"#/properties/flows/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}if(data65.labelDy !== undefined){let data81 = data65.labelDy;if(!((typeof data81 == "number") && (isFinite(data81)))){const err199 = {instancePath:instancePath+"/flows/" + i3+"/labelDy",schemaPath:"#/properties/flows/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}}if(data65.labelSegment !== undefined){let data82 = data65.labelSegment;if(!(((typeof data82 == "number") && (!(data82 % 1) && !isNaN(data82))) && (isFinite(data82)))){const err200 = {instancePath:instancePath+"/flows/" + i3+"/labelSegment",schemaPath:"#/properties/flows/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err200];}else {vErrors.push(err200);}errors++;}if((typeof data82 == "number") && (isFinite(data82))){if(data82 < 0 || isNaN(data82)){const err201 = {instancePath:instancePath+"/flows/" + i3+"/labelSegment",schemaPath:"#/properties/flows/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err201];}else {vErrors.push(err201);}errors++;}}}if(data65.via !== undefined){let data83 = data65.via;if(Array.isArray(data83)){const len8 = data83.length;for(let i4=0; i4 2){const err202 = {instancePath:instancePath+"/flows/" + i3+"/via/" + i4,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err202];}else {vErrors.push(err202);}errors++;}if(data84.length < 2){const err203 = {instancePath:instancePath+"/flows/" + i3+"/via/" + i4,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err203];}else {vErrors.push(err203);}errors++;}const len9 = data84.length;if(len9 > 0){let data85 = data84[0];if(!((typeof data85 == "number") && (isFinite(data85)))){const err204 = {instancePath:instancePath+"/flows/" + i3+"/via/" + i4+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err204];}else {vErrors.push(err204);}errors++;}}if(len9 > 1){let data86 = data84[1];if(!((typeof data86 == "number") && (isFinite(data86)))){const err205 = {instancePath:instancePath+"/flows/" + i3+"/via/" + i4+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err205];}else {vErrors.push(err205);}errors++;}}const len10 = data84.length;if(!(len10 <= 2)){const err206 = {instancePath:instancePath+"/flows/" + i3+"/via/" + i4,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err206];}else {vErrors.push(err206);}errors++;}}else {const err207 = {instancePath:instancePath+"/flows/" + i3+"/via/" + i4,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err207];}else {vErrors.push(err207);}errors++;}}}else {const err208 = {instancePath:instancePath+"/flows/" + i3+"/via",schemaPath:"#/properties/flows/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err208];}else {vErrors.push(err208);}errors++;}}if(data65.width !== undefined){let data87 = data65.width;if((typeof data87 == "number") && (isFinite(data87))){if(data87 < 0.5 || isNaN(data87)){const err209 = {instancePath:instancePath+"/flows/" + i3+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err209];}else {vErrors.push(err209);}errors++;}}else {const err210 = {instancePath:instancePath+"/flows/" + i3+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}}}else {const err211 = {instancePath:instancePath+"/flows/" + i3,schemaPath:"#/properties/flows/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err211];}else {vErrors.push(err211);}errors++;}}}else {const err212 = {instancePath:instancePath+"/flows",schemaPath:"#/properties/flows/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}}if(data.cards !== undefined){let data88 = data.cards;if(Array.isArray(data88)){const len11 = data88.length;for(let i5=0; i5 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate34.errors = vErrors;return errors === 0;}validate34.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate33(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/lifecycle.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate33.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.lanes === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "lanes"},message:"must have required property '"+"lanes"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.states === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "states"},message:"must have required property '"+"states"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.transitions === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "transitions"},message:"must have required property '"+"transitions"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!(((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "lanes")) || (key0 === "states")) || (key0 === "transitions")) || (key0 === "cards"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema_version !== undefined){let data0 = data.schema_version;if(!((data0 === 1) || (data0 === 2))){const err7 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/enum",keyword:"enum",params:{allowedValues: schema133.properties.schema_version.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.diagram_type !== undefined){if("lifecycle" !== data.diagram_type){const err8 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "lifecycle"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data2.output === undefined){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "output"},message:"must have required property '"+"output"+"'"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}for(const key1 in data2){if(!(func1.call(schema133.properties.meta.properties, key1))){const err11 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}else {const err13 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(typeof data4 === "string"){if(func3(data4) > 35){const err14 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/maxLength",keyword:"maxLength",params:{limit: 35},message:"must NOT have more than 35 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(!pattern4.test(data4)){const err15 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/pattern",keyword:"pattern",params:{pattern: "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"},message:"must match pattern \""+"^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"+"\""};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.translations !== undefined){let data5 = data2.translations;if(data5 && typeof data5 == "object" && !Array.isArray(data5)){if(Object.keys(data5).length > 600){const err17 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/maxProperties",keyword:"maxProperties",params:{limit: 600},message:"must NOT have more than 600 properties"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}for(const key2 in data5){const _errs15 = errors;if(typeof key2 === "string"){if(!pattern5.test(key2)){const err18 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/propertyNames/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"},message:"must match pattern \""+"^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"+"\"",propertyName:key2};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}var valid4 = _errs15 === errors;if(!valid4){const err19 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/propertyNames",keyword:"propertyNames",params:{propertyName: key2},message:"property name must be valid"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}for(const key3 in data5){let data6 = data5[key3];if(typeof data6 === "string"){if(func3(data6) > 400){const err20 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/maxLength",keyword:"maxLength",params:{limit: 400},message:"must NOT have more than 400 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(func3(data6) < 1){const err21 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}}else {const err23 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err24 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data2.output !== undefined){let data8 = data2.output;if(typeof data8 === "string"){if(!pattern6.test(data8)){const err25 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/0/pattern",keyword:"pattern",params:{pattern: "(?:^|/)[^/]+[.][Hh][Tt][Mm][Ll]$"},message:"must match pattern \""+"(?:^|/)[^/]+[.][Hh][Tt][Mm][Ll]$"+"\""};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}const _errs26 = errors;const _errs27 = errors;if(typeof data8 === "string"){if(!pattern7.test(data8)){const err26 = {};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}var valid8 = _errs27 === errors;if(valid8){const err27 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}else {errors = _errs26;if(vErrors !== null){if(_errs26){vErrors.length = _errs26;}else {vErrors = null;}}}const _errs29 = errors;const _errs30 = errors;if(typeof data8 === "string"){if(!pattern8.test(data8)){const err28 = {};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}var valid9 = _errs30 === errors;if(valid9){const err29 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/2/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}else {errors = _errs29;if(vErrors !== null){if(_errs29){vErrors.length = _errs29;}else {vErrors = null;}}}const _errs32 = errors;const _errs33 = errors;if(typeof data8 === "string"){if(!pattern9.test(data8)){const err30 = {};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}var valid10 = _errs33 === errors;if(valid10){const err31 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/3/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}else {errors = _errs32;if(vErrors !== null){if(_errs32){vErrors.length = _errs32;}else {vErrors = null;}}}const _errs35 = errors;const _errs36 = errors;if(typeof data8 === "string"){if(!pattern10.test(data8)){const err32 = {};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}var valid11 = _errs36 === errors;if(valid11){const err33 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/4/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}else {errors = _errs35;if(vErrors !== null){if(_errs35){vErrors.length = _errs35;}else {vErrors = null;}}}const _errs38 = errors;const _errs39 = errors;if(typeof data8 === "string"){if(!pattern11.test(data8)){const err34 = {};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}var valid12 = _errs39 === errors;if(valid12){const err35 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/5/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}else {errors = _errs38;if(vErrors !== null){if(_errs38){vErrors.length = _errs38;}else {vErrors = null;}}}const _errs41 = errors;const _errs42 = errors;if(typeof data8 === "string"){if(!pattern12.test(data8)){const err36 = {};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}var valid13 = _errs42 === errors;if(valid13){const err37 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/6/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}else {errors = _errs41;if(vErrors !== null){if(_errs41){vErrors.length = _errs41;}else {vErrors = null;}}}const _errs44 = errors;const _errs45 = errors;if(typeof data8 === "string"){if(!pattern13.test(data8)){const err38 = {};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}var valid14 = _errs45 === errors;if(valid14){const err39 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/7/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}else {errors = _errs44;if(vErrors !== null){if(_errs44){vErrors.length = _errs44;}else {vErrors = null;}}}if(typeof data8 === "string"){if(func3(data8) < 1){const err40 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if(!pattern14.test(data8)){const err41 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/pattern",keyword:"pattern",params:{pattern: "^[^/]+(?:/[^/]+)*$"},message:"must match pattern \""+"^[^/]+(?:/[^/]+)*$"+"\""};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}else {const err42 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data2.animation !== undefined){let data9 = data2.animation;if(!((data9 === "trace") || (data9 === "none"))){const err43 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema77.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data2.visual_preset !== undefined){let data10 = data2.visual_preset;if(!((((data10 === "classic") || (data10 === "signal-flow")) || (data10 === "blueprint")) || (data10 === "editorial"))){const err44 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema78.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data2.quality_profile !== undefined){let data11 = data2.quality_profile;if(!((data11 === "standard") || (data11 === "showcase"))){const err45 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema79.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}if(data2.repository !== undefined){let data12 = data2.repository;if(data12 && typeof data12 == "object" && !Array.isArray(data12)){if(data12.url === undefined){const err46 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}if(data12.revision === undefined){const err47 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}for(const key4 in data12){if(!((((key4 === "url") || (key4 === "provider")) || (key4 === "link_mode")) || (key4 === "revision"))){const err48 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}if(data12.url !== undefined){let data13 = data12.url;if(typeof data13 === "string"){if(func3(data13) < 1){const err49 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"common.schema.json#/$defs/repository/properties/url/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}else {const err50 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"common.schema.json#/$defs/repository/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}if(data12.provider !== undefined){let data14 = data12.provider;if(!((data14 === "github") || (data14 === "gitee"))){const err51 = {instancePath:instancePath+"/meta/repository/provider",schemaPath:"common.schema.json#/$defs/repository/properties/provider/enum",keyword:"enum",params:{allowedValues: schema36.properties.provider.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data12.link_mode !== undefined){let data15 = data12.link_mode;if(!((data15 === "web") || (data15 === "local-only"))){const err52 = {instancePath:instancePath+"/meta/repository/link_mode",schemaPath:"common.schema.json#/$defs/repository/properties/link_mode/enum",keyword:"enum",params:{allowedValues: schema36.properties.link_mode.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}if(data12.revision !== undefined){let data16 = data12.revision;if(typeof data16 === "string"){if(!pattern15.test(data16)){const err53 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"common.schema.json#/$defs/repository/properties/revision/pattern",keyword:"pattern",params:{pattern: "^[a-fA-F0-9]{40}$"},message:"must match pattern \""+"^[a-fA-F0-9]{40}$"+"\""};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"common.schema.json#/$defs/repository/properties/revision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}}else {const err55 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data2.views !== undefined){if(!(validate34(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate34.errors : vErrors.concat(validate34.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data18 = data2.legend;if(data18 && typeof data18 == "object" && !Array.isArray(data18)){for(const key5 in data18){if(!((key5 === "mode") || (key5 === "entries"))){const err56 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data18.mode !== undefined){let data19 = data18.mode;if(!(((data19 === "auto") || (data19 === "all")) || (data19 === "hidden"))){const err57 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema40.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}if(data18.entries !== undefined){let data20 = data18.entries;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){for(const key6 in data20){if(!((((((((key6 === "start") || (key6 === "active")) || (key6 === "waiting")) || (key6 === "decision")) || (key6 === "success")) || (key6 === "failure")) || (key6 === "neutral")) || (key6 === "external"))){const err58 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data20.start !== undefined){let data21 = data20.start;if(data21 && typeof data21 == "object" && !Array.isArray(data21)){if(Object.keys(data21).length < 1){const err59 = {instancePath:instancePath+"/meta/legend/entries/start",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}for(const key7 in data21){if(!((key7 === "label") || (key7 === "visible"))){const err60 = {instancePath:instancePath+"/meta/legend/entries/start",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}if(data21.label !== undefined){let data22 = data21.label;if(typeof data22 === "string"){if(func3(data22) > 80){const err61 = {instancePath:instancePath+"/meta/legend/entries/start/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}if(func3(data22) < 1){const err62 = {instancePath:instancePath+"/meta/legend/entries/start/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/start/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data21.visible !== undefined){if(typeof data21.visible !== "boolean"){const err64 = {instancePath:instancePath+"/meta/legend/entries/start/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}}else {const err65 = {instancePath:instancePath+"/meta/legend/entries/start",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data20.active !== undefined){let data24 = data20.active;if(data24 && typeof data24 == "object" && !Array.isArray(data24)){if(Object.keys(data24).length < 1){const err66 = {instancePath:instancePath+"/meta/legend/entries/active",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}for(const key8 in data24){if(!((key8 === "label") || (key8 === "visible"))){const err67 = {instancePath:instancePath+"/meta/legend/entries/active",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data24.label !== undefined){let data25 = data24.label;if(typeof data25 === "string"){if(func3(data25) > 80){const err68 = {instancePath:instancePath+"/meta/legend/entries/active/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}if(func3(data25) < 1){const err69 = {instancePath:instancePath+"/meta/legend/entries/active/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/active/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}if(data24.visible !== undefined){if(typeof data24.visible !== "boolean"){const err71 = {instancePath:instancePath+"/meta/legend/entries/active/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}}else {const err72 = {instancePath:instancePath+"/meta/legend/entries/active",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data20.waiting !== undefined){let data27 = data20.waiting;if(data27 && typeof data27 == "object" && !Array.isArray(data27)){if(Object.keys(data27).length < 1){const err73 = {instancePath:instancePath+"/meta/legend/entries/waiting",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}for(const key9 in data27){if(!((key9 === "label") || (key9 === "visible"))){const err74 = {instancePath:instancePath+"/meta/legend/entries/waiting",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data27.label !== undefined){let data28 = data27.label;if(typeof data28 === "string"){if(func3(data28) > 80){const err75 = {instancePath:instancePath+"/meta/legend/entries/waiting/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}if(func3(data28) < 1){const err76 = {instancePath:instancePath+"/meta/legend/entries/waiting/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}else {const err77 = {instancePath:instancePath+"/meta/legend/entries/waiting/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}if(data27.visible !== undefined){if(typeof data27.visible !== "boolean"){const err78 = {instancePath:instancePath+"/meta/legend/entries/waiting/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}}else {const err79 = {instancePath:instancePath+"/meta/legend/entries/waiting",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}if(data20.decision !== undefined){let data30 = data20.decision;if(data30 && typeof data30 == "object" && !Array.isArray(data30)){if(Object.keys(data30).length < 1){const err80 = {instancePath:instancePath+"/meta/legend/entries/decision",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}for(const key10 in data30){if(!((key10 === "label") || (key10 === "visible"))){const err81 = {instancePath:instancePath+"/meta/legend/entries/decision",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}if(data30.label !== undefined){let data31 = data30.label;if(typeof data31 === "string"){if(func3(data31) > 80){const err82 = {instancePath:instancePath+"/meta/legend/entries/decision/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(func3(data31) < 1){const err83 = {instancePath:instancePath+"/meta/legend/entries/decision/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}else {const err84 = {instancePath:instancePath+"/meta/legend/entries/decision/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data30.visible !== undefined){if(typeof data30.visible !== "boolean"){const err85 = {instancePath:instancePath+"/meta/legend/entries/decision/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}}else {const err86 = {instancePath:instancePath+"/meta/legend/entries/decision",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}if(data20.success !== undefined){let data33 = data20.success;if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(Object.keys(data33).length < 1){const err87 = {instancePath:instancePath+"/meta/legend/entries/success",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}for(const key11 in data33){if(!((key11 === "label") || (key11 === "visible"))){const err88 = {instancePath:instancePath+"/meta/legend/entries/success",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data33.label !== undefined){let data34 = data33.label;if(typeof data34 === "string"){if(func3(data34) > 80){const err89 = {instancePath:instancePath+"/meta/legend/entries/success/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if(func3(data34) < 1){const err90 = {instancePath:instancePath+"/meta/legend/entries/success/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}}else {const err91 = {instancePath:instancePath+"/meta/legend/entries/success/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}if(data33.visible !== undefined){if(typeof data33.visible !== "boolean"){const err92 = {instancePath:instancePath+"/meta/legend/entries/success/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}}else {const err93 = {instancePath:instancePath+"/meta/legend/entries/success",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}if(data20.failure !== undefined){let data36 = data20.failure;if(data36 && typeof data36 == "object" && !Array.isArray(data36)){if(Object.keys(data36).length < 1){const err94 = {instancePath:instancePath+"/meta/legend/entries/failure",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}for(const key12 in data36){if(!((key12 === "label") || (key12 === "visible"))){const err95 = {instancePath:instancePath+"/meta/legend/entries/failure",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}if(data36.label !== undefined){let data37 = data36.label;if(typeof data37 === "string"){if(func3(data37) > 80){const err96 = {instancePath:instancePath+"/meta/legend/entries/failure/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}if(func3(data37) < 1){const err97 = {instancePath:instancePath+"/meta/legend/entries/failure/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}else {const err98 = {instancePath:instancePath+"/meta/legend/entries/failure/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}if(data36.visible !== undefined){if(typeof data36.visible !== "boolean"){const err99 = {instancePath:instancePath+"/meta/legend/entries/failure/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}}else {const err100 = {instancePath:instancePath+"/meta/legend/entries/failure",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}if(data20.neutral !== undefined){let data39 = data20.neutral;if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(Object.keys(data39).length < 1){const err101 = {instancePath:instancePath+"/meta/legend/entries/neutral",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}for(const key13 in data39){if(!((key13 === "label") || (key13 === "visible"))){const err102 = {instancePath:instancePath+"/meta/legend/entries/neutral",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}if(data39.label !== undefined){let data40 = data39.label;if(typeof data40 === "string"){if(func3(data40) > 80){const err103 = {instancePath:instancePath+"/meta/legend/entries/neutral/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}if(func3(data40) < 1){const err104 = {instancePath:instancePath+"/meta/legend/entries/neutral/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}else {const err105 = {instancePath:instancePath+"/meta/legend/entries/neutral/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}if(data39.visible !== undefined){if(typeof data39.visible !== "boolean"){const err106 = {instancePath:instancePath+"/meta/legend/entries/neutral/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}}else {const err107 = {instancePath:instancePath+"/meta/legend/entries/neutral",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}if(data20.external !== undefined){let data42 = data20.external;if(data42 && typeof data42 == "object" && !Array.isArray(data42)){if(Object.keys(data42).length < 1){const err108 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}for(const key14 in data42){if(!((key14 === "label") || (key14 === "visible"))){const err109 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}if(data42.label !== undefined){let data43 = data42.label;if(typeof data43 === "string"){if(func3(data43) > 80){const err110 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}if(func3(data43) < 1){const err111 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}else {const err112 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}if(data42.visible !== undefined){if(typeof data42.visible !== "boolean"){const err113 = {instancePath:instancePath+"/meta/legend/entries/external/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}}else {const err114 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}}else {const err115 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}}else {const err116 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}if(data2.viewBox !== undefined){let data45 = data2.viewBox;if(Array.isArray(data45)){if(data45.length > 2){const err117 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}if(data45.length < 2){const err118 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}const len0 = data45.length;if(len0 > 0){let data46 = data45[0];if((typeof data46 == "number") && (isFinite(data46))){if(data46 < 420 || isNaN(data46)){const err119 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 420},message:"must be >= 420"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}else {const err120 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}}if(len0 > 1){let data47 = data45[1];if((typeof data47 == "number") && (isFinite(data47))){if(data47 < 300 || isNaN(data47)){const err121 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 300},message:"must be >= 300"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}}else {const err122 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}}const len1 = data45.length;if(!(len1 <= 2)){const err123 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}else {const err124 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}}}else {const err125 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}if(data.lanes !== undefined){let data48 = data.lanes;if(Array.isArray(data48)){if(data48.length > 4){const err126 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/maxItems",keyword:"maxItems",params:{limit: 4},message:"must NOT have more than 4 items"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}if(data48.length < 1){const err127 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}const len2 = data48.length;for(let i0=0; i0 80){const err152 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}if(!pattern29.test(data60)){const err153 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}var _valid1 = _errs174 === errors;valid51 = valid51 || _valid1;const _errs175 = errors;if(typeof data60 === "string"){if(!pattern30.test(data60)){const err154 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}var _valid1 = _errs175 === errors;valid51 = valid51 || _valid1;if(!valid51){const err155 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}else {errors = _errs173;if(vErrors !== null){if(_errs173){vErrors.length = _errs173;}else {vErrors = null;}}}if(typeof data60 === "string"){if(func3(data60) > 2048){const err156 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}if(func3(data60) < 1){const err157 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}}else {const err158 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}var _valid0 = _errs171 === errors;if(_valid0){valid50 = true;passing0 = 0;}const _errs176 = errors;if(data60 && typeof data60 == "object" && !Array.isArray(data60)){if(data60.url === undefined){const err159 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}if(data60.sha256 === undefined){const err160 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}for(const key17 in data60){if(!((key17 === "url") || (key17 === "sha256"))){const err161 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key17},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}}if(data60.url !== undefined){let data61 = data60.url;if(typeof data61 === "string"){if(func3(data61) > 2048){const err162 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}if(func3(data61) < 8){const err163 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}if(!pattern30.test(data61)){const err164 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}else {const err165 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}if(data60.sha256 !== undefined){let data62 = data60.sha256;if(typeof data62 === "string"){if(!pattern32.test(data62)){const err166 = {instancePath:instancePath+"/states/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}else {const err167 = {instancePath:instancePath+"/states/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}}else {const err168 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}var _valid0 = _errs176 === errors;if(_valid0 && valid50){valid50 = false;passing0 = [passing0, 1];}else {if(_valid0){valid50 = true;passing0 = 1;}}if(!valid50){const err169 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}else {errors = _errs170;if(vErrors !== null){if(_errs170){vErrors.length = _errs170;}else {vErrors = null;}}}}if(data53.sources !== undefined){let data63 = data53.sources;if(Array.isArray(data63)){if(data63.length > 3){const err170 = {instancePath:instancePath+"/states/" + i1+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/maxItems",keyword:"maxItems",params:{limit: 3},message:"must NOT have more than 3 items"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}if(data63.length < 1){const err171 = {instancePath:instancePath+"/states/" + i1+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}const len4 = data63.length;for(let i2=0; i2 240){const err174 = {instancePath:instancePath+"/states/" + i1+"/sources/" + i2+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}if(func3(data65) < 1){const err175 = {instancePath:instancePath+"/states/" + i1+"/sources/" + i2+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}else {const err176 = {instancePath:instancePath+"/states/" + i1+"/sources/" + i2+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}}if(data64.line !== undefined){let data66 = data64.line;if(!(((typeof data66 == "number") && (!(data66 % 1) && !isNaN(data66))) && (isFinite(data66)))){const err177 = {instancePath:instancePath+"/states/" + i1+"/sources/" + i2+"/line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}if((typeof data66 == "number") && (isFinite(data66))){if(data66 < 1 || isNaN(data66)){const err178 = {instancePath:instancePath+"/states/" + i1+"/sources/" + i2+"/line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}}}if(data64.end_line !== undefined){let data67 = data64.end_line;if(!(((typeof data67 == "number") && (!(data67 % 1) && !isNaN(data67))) && (isFinite(data67)))){const err179 = {instancePath:instancePath+"/states/" + i1+"/sources/" + i2+"/end_line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/end_line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}if((typeof data67 == "number") && (isFinite(data67))){if(data67 < 1 || isNaN(data67)){const err180 = {instancePath:instancePath+"/states/" + i1+"/sources/" + i2+"/end_line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/end_line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}}if(data64.label !== undefined){let data68 = data64.label;if(typeof data68 === "string"){if(func3(data68) > 48){const err181 = {instancePath:instancePath+"/states/" + i1+"/sources/" + i2+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}if(func3(data68) < 1){const err182 = {instancePath:instancePath+"/states/" + i1+"/sources/" + i2+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}}else {const err183 = {instancePath:instancePath+"/states/" + i1+"/sources/" + i2+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}}}else {const err184 = {instancePath:instancePath+"/states/" + i1+"/sources/" + i2,schemaPath:"common.schema.json#/$defs/sourceReferences/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}}}else {const err185 = {instancePath:instancePath+"/states/" + i1+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}}if(data53.step !== undefined){if(typeof data53.step !== "string"){const err186 = {instancePath:instancePath+"/states/" + i1+"/step",schemaPath:"#/properties/states/items/properties/step/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}}if(data53.lane !== undefined){let data70 = data53.lane;if(typeof data70 === "string"){if(!pattern16.test(data70)){const err187 = {instancePath:instancePath+"/states/" + i1+"/lane",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}}else {const err188 = {instancePath:instancePath+"/states/" + i1+"/lane",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}}if(data53.col !== undefined){let data71 = data53.col;if(!(((typeof data71 == "number") && (!(data71 % 1) && !isNaN(data71))) && (isFinite(data71)))){const err189 = {instancePath:instancePath+"/states/" + i1+"/col",schemaPath:"#/properties/states/items/properties/col/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}if((typeof data71 == "number") && (isFinite(data71))){if(data71 > 4 || isNaN(data71)){const err190 = {instancePath:instancePath+"/states/" + i1+"/col",schemaPath:"#/properties/states/items/properties/col/maximum",keyword:"maximum",params:{comparison: "<=", limit: 4},message:"must be <= 4"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}if(data71 < 0 || isNaN(data71)){const err191 = {instancePath:instancePath+"/states/" + i1+"/col",schemaPath:"#/properties/states/items/properties/col/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}}}if(data53.width !== undefined){let data72 = data53.width;if((typeof data72 == "number") && (isFinite(data72))){if(data72 < 48 || isNaN(data72)){const err192 = {instancePath:instancePath+"/states/" + i1+"/width",schemaPath:"#/properties/states/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 48},message:"must be >= 48"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}}else {const err193 = {instancePath:instancePath+"/states/" + i1+"/width",schemaPath:"#/properties/states/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}}if(data53.height !== undefined){let data73 = data53.height;if((typeof data73 == "number") && (isFinite(data73))){if(data73 < 36 || isNaN(data73)){const err194 = {instancePath:instancePath+"/states/" + i1+"/height",schemaPath:"#/properties/states/items/properties/height/minimum",keyword:"minimum",params:{comparison: ">=", limit: 36},message:"must be >= 36"};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}else {const err195 = {instancePath:instancePath+"/states/" + i1+"/height",schemaPath:"#/properties/states/items/properties/height/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}if(data53.yOffset !== undefined){let data74 = data53.yOffset;if(!((typeof data74 == "number") && (isFinite(data74)))){const err196 = {instancePath:instancePath+"/states/" + i1+"/yOffset",schemaPath:"#/properties/states/items/properties/yOffset/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}}}else {const err197 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}}}else {const err198 = {instancePath:instancePath+"/states",schemaPath:"#/properties/states/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}if(data.transitions !== undefined){let data75 = data.transitions;if(Array.isArray(data75)){const len5 = data75.length;for(let i3=0; i3=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}}else {const err217 = {instancePath:instancePath+"/transitions/" + i3+"/cornerRadius",schemaPath:"#/properties/transitions/items/properties/cornerRadius/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}}if(data76.labelAt !== undefined){let data89 = data76.labelAt;if(Array.isArray(data89)){if(data89.length > 2){const err218 = {instancePath:instancePath+"/transitions/" + i3+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}if(data89.length < 2){const err219 = {instancePath:instancePath+"/transitions/" + i3+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}const len6 = data89.length;if(len6 > 0){let data90 = data89[0];if(!((typeof data90 == "number") && (isFinite(data90)))){const err220 = {instancePath:instancePath+"/transitions/" + i3+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}}if(len6 > 1){let data91 = data89[1];if(!((typeof data91 == "number") && (isFinite(data91)))){const err221 = {instancePath:instancePath+"/transitions/" + i3+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err221];}else {vErrors.push(err221);}errors++;}}const len7 = data89.length;if(!(len7 <= 2)){const err222 = {instancePath:instancePath+"/transitions/" + i3+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err222];}else {vErrors.push(err222);}errors++;}}else {const err223 = {instancePath:instancePath+"/transitions/" + i3+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err223];}else {vErrors.push(err223);}errors++;}}if(data76.labelDx !== undefined){let data92 = data76.labelDx;if(!((typeof data92 == "number") && (isFinite(data92)))){const err224 = {instancePath:instancePath+"/transitions/" + i3+"/labelDx",schemaPath:"#/properties/transitions/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err224];}else {vErrors.push(err224);}errors++;}}if(data76.labelDy !== undefined){let data93 = data76.labelDy;if(!((typeof data93 == "number") && (isFinite(data93)))){const err225 = {instancePath:instancePath+"/transitions/" + i3+"/labelDy",schemaPath:"#/properties/transitions/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err225];}else {vErrors.push(err225);}errors++;}}if(data76.labelSegment !== undefined){let data94 = data76.labelSegment;if(!(((typeof data94 == "number") && (!(data94 % 1) && !isNaN(data94))) && (isFinite(data94)))){const err226 = {instancePath:instancePath+"/transitions/" + i3+"/labelSegment",schemaPath:"#/properties/transitions/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}if((typeof data94 == "number") && (isFinite(data94))){if(data94 < 0 || isNaN(data94)){const err227 = {instancePath:instancePath+"/transitions/" + i3+"/labelSegment",schemaPath:"#/properties/transitions/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}}}if(data76.via !== undefined){let data95 = data76.via;if(Array.isArray(data95)){const len8 = data95.length;for(let i4=0; i4 2){const err228 = {instancePath:instancePath+"/transitions/" + i3+"/via/" + i4,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err228];}else {vErrors.push(err228);}errors++;}if(data96.length < 2){const err229 = {instancePath:instancePath+"/transitions/" + i3+"/via/" + i4,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err229];}else {vErrors.push(err229);}errors++;}const len9 = data96.length;if(len9 > 0){let data97 = data96[0];if(!((typeof data97 == "number") && (isFinite(data97)))){const err230 = {instancePath:instancePath+"/transitions/" + i3+"/via/" + i4+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err230];}else {vErrors.push(err230);}errors++;}}if(len9 > 1){let data98 = data96[1];if(!((typeof data98 == "number") && (isFinite(data98)))){const err231 = {instancePath:instancePath+"/transitions/" + i3+"/via/" + i4+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err231];}else {vErrors.push(err231);}errors++;}}const len10 = data96.length;if(!(len10 <= 2)){const err232 = {instancePath:instancePath+"/transitions/" + i3+"/via/" + i4,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err232];}else {vErrors.push(err232);}errors++;}}else {const err233 = {instancePath:instancePath+"/transitions/" + i3+"/via/" + i4,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err233];}else {vErrors.push(err233);}errors++;}}}else {const err234 = {instancePath:instancePath+"/transitions/" + i3+"/via",schemaPath:"#/properties/transitions/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err234];}else {vErrors.push(err234);}errors++;}}if(data76.width !== undefined){let data99 = data76.width;if((typeof data99 == "number") && (isFinite(data99))){if(data99 < 0.5 || isNaN(data99)){const err235 = {instancePath:instancePath+"/transitions/" + i3+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err235];}else {vErrors.push(err235);}errors++;}}else {const err236 = {instancePath:instancePath+"/transitions/" + i3+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err236];}else {vErrors.push(err236);}errors++;}}}else {const err237 = {instancePath:instancePath+"/transitions/" + i3,schemaPath:"#/properties/transitions/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err237];}else {vErrors.push(err237);}errors++;}}}else {const err238 = {instancePath:instancePath+"/transitions",schemaPath:"#/properties/transitions/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err238];}else {vErrors.push(err238);}errors++;}}if(data.cards !== undefined){let data100 = data.cards;if(Array.isArray(data100)){const len11 = data100.length;for(let i5=0; i5 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate37.errors = vErrors;return errors === 0;}validate37.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate36(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/architecture.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate36.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.components === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "components"},message:"must have required property '"+"components"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "layout")) || (key0 === "components")) || (key0 === "boundaries")) || (key0 === "connections")) || (key0 === "cards"))){const err4 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err5 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.diagram_type !== undefined){if("architecture" !== data.diagram_type){const err6 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "architecture"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err7 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data2.output === undefined){const err8 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "output"},message:"must have required property '"+"output"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}for(const key1 in data2){if(!(func1.call(schema169.properties.meta.properties, key1))){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err10 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(typeof data4 === "string"){if(func3(data4) > 35){const err12 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/maxLength",keyword:"maxLength",params:{limit: 35},message:"must NOT have more than 35 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(!pattern4.test(data4)){const err13 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/pattern",keyword:"pattern",params:{pattern: "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"},message:"must match pattern \""+"^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"+"\""};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}else {const err14 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.translations !== undefined){let data5 = data2.translations;if(data5 && typeof data5 == "object" && !Array.isArray(data5)){if(Object.keys(data5).length > 600){const err15 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/maxProperties",keyword:"maxProperties",params:{limit: 600},message:"must NOT have more than 600 properties"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}for(const key2 in data5){const _errs15 = errors;if(typeof key2 === "string"){if(!pattern5.test(key2)){const err16 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/propertyNames/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"},message:"must match pattern \""+"^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"+"\"",propertyName:key2};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}var valid4 = _errs15 === errors;if(!valid4){const err17 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/propertyNames",keyword:"propertyNames",params:{propertyName: key2},message:"property name must be valid"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}for(const key3 in data5){let data6 = data5[key3];if(typeof data6 === "string"){if(func3(data6) > 400){const err18 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/maxLength",keyword:"maxLength",params:{limit: 400},message:"must NOT have more than 400 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}if(func3(data6) < 1){const err19 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}else {const err20 = {instancePath:instancePath+"/meta/translations/" + key3.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"common.schema.json#/$defs/translations/additionalProperties/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}}else {const err21 = {instancePath:instancePath+"/meta/translations",schemaPath:"common.schema.json#/$defs/translations/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err22 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data2.output !== undefined){let data8 = data2.output;if(typeof data8 === "string"){if(!pattern6.test(data8)){const err23 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/0/pattern",keyword:"pattern",params:{pattern: "(?:^|/)[^/]+[.][Hh][Tt][Mm][Ll]$"},message:"must match pattern \""+"(?:^|/)[^/]+[.][Hh][Tt][Mm][Ll]$"+"\""};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}const _errs26 = errors;const _errs27 = errors;if(typeof data8 === "string"){if(!pattern7.test(data8)){const err24 = {};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}var valid8 = _errs27 === errors;if(valid8){const err25 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/1/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}else {errors = _errs26;if(vErrors !== null){if(_errs26){vErrors.length = _errs26;}else {vErrors = null;}}}const _errs29 = errors;const _errs30 = errors;if(typeof data8 === "string"){if(!pattern8.test(data8)){const err26 = {};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}var valid9 = _errs30 === errors;if(valid9){const err27 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/2/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}else {errors = _errs29;if(vErrors !== null){if(_errs29){vErrors.length = _errs29;}else {vErrors = null;}}}const _errs32 = errors;const _errs33 = errors;if(typeof data8 === "string"){if(!pattern9.test(data8)){const err28 = {};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}var valid10 = _errs33 === errors;if(valid10){const err29 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/3/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}else {errors = _errs32;if(vErrors !== null){if(_errs32){vErrors.length = _errs32;}else {vErrors = null;}}}const _errs35 = errors;const _errs36 = errors;if(typeof data8 === "string"){if(!pattern10.test(data8)){const err30 = {};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}var valid11 = _errs36 === errors;if(valid11){const err31 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/4/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}else {errors = _errs35;if(vErrors !== null){if(_errs35){vErrors.length = _errs35;}else {vErrors = null;}}}const _errs38 = errors;const _errs39 = errors;if(typeof data8 === "string"){if(!pattern11.test(data8)){const err32 = {};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}var valid12 = _errs39 === errors;if(valid12){const err33 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/5/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}else {errors = _errs38;if(vErrors !== null){if(_errs38){vErrors.length = _errs38;}else {vErrors = null;}}}const _errs41 = errors;const _errs42 = errors;if(typeof data8 === "string"){if(!pattern12.test(data8)){const err34 = {};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}var valid13 = _errs42 === errors;if(valid13){const err35 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/6/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}else {errors = _errs41;if(vErrors !== null){if(_errs41){vErrors.length = _errs41;}else {vErrors = null;}}}const _errs44 = errors;const _errs45 = errors;if(typeof data8 === "string"){if(!pattern13.test(data8)){const err36 = {};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}var valid14 = _errs45 === errors;if(valid14){const err37 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/allOf/7/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}else {errors = _errs44;if(vErrors !== null){if(_errs44){vErrors.length = _errs44;}else {vErrors = null;}}}if(typeof data8 === "string"){if(func3(data8) < 1){const err38 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(!pattern14.test(data8)){const err39 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/pattern",keyword:"pattern",params:{pattern: "^[^/]+(?:/[^/]+)*$"},message:"must match pattern \""+"^[^/]+(?:/[^/]+)*$"+"\""};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/output",schemaPath:"common.schema.json#/$defs/portableOutputPath/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data2.animation !== undefined){let data9 = data2.animation;if(!((data9 === "trace") || (data9 === "none"))){const err41 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema77.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}if(data2.visual_preset !== undefined){let data10 = data2.visual_preset;if(!((((data10 === "classic") || (data10 === "signal-flow")) || (data10 === "blueprint")) || (data10 === "editorial"))){const err42 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema78.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data2.quality_profile !== undefined){let data11 = data2.quality_profile;if(!((data11 === "standard") || (data11 === "showcase"))){const err43 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema79.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data2.engineering_profile !== undefined){if(!(data2.engineering_profile === "deployment-ownership")){const err44 = {instancePath:instancePath+"/meta/engineering_profile",schemaPath:"#/properties/meta/properties/engineering_profile/enum",keyword:"enum",params:{allowedValues: schema169.properties.meta.properties.engineering_profile.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data2.repository !== undefined){let data13 = data2.repository;if(data13 && typeof data13 == "object" && !Array.isArray(data13)){if(data13.url === undefined){const err45 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(data13.revision === undefined){const err46 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}for(const key4 in data13){if(!((((key4 === "url") || (key4 === "provider")) || (key4 === "link_mode")) || (key4 === "revision"))){const err47 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data13.url !== undefined){let data14 = data13.url;if(typeof data14 === "string"){if(func3(data14) < 1){const err48 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"common.schema.json#/$defs/repository/properties/url/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}else {const err49 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"common.schema.json#/$defs/repository/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data13.provider !== undefined){let data15 = data13.provider;if(!((data15 === "github") || (data15 === "gitee"))){const err50 = {instancePath:instancePath+"/meta/repository/provider",schemaPath:"common.schema.json#/$defs/repository/properties/provider/enum",keyword:"enum",params:{allowedValues: schema36.properties.provider.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}if(data13.link_mode !== undefined){let data16 = data13.link_mode;if(!((data16 === "web") || (data16 === "local-only"))){const err51 = {instancePath:instancePath+"/meta/repository/link_mode",schemaPath:"common.schema.json#/$defs/repository/properties/link_mode/enum",keyword:"enum",params:{allowedValues: schema36.properties.link_mode.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data13.revision !== undefined){let data17 = data13.revision;if(typeof data17 === "string"){if(!pattern15.test(data17)){const err52 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"common.schema.json#/$defs/repository/properties/revision/pattern",keyword:"pattern",params:{pattern: "^[a-fA-F0-9]{40}$"},message:"must match pattern \""+"^[a-fA-F0-9]{40}$"+"\""};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}else {const err53 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"common.schema.json#/$defs/repository/properties/revision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}}else {const err54 = {instancePath:instancePath+"/meta/repository",schemaPath:"common.schema.json#/$defs/repository/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data2.views !== undefined){if(!(validate37(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate37.errors : vErrors.concat(validate37.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data19 = data2.legend;if(data19 && typeof data19 == "object" && !Array.isArray(data19)){for(const key5 in data19){if(!((key5 === "mode") || (key5 === "entries"))){const err55 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data19.mode !== undefined){let data20 = data19.mode;if(!(((data20 === "auto") || (data20 === "all")) || (data20 === "hidden"))){const err56 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema40.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data19.entries !== undefined){let data21 = data19.entries;if(data21 && typeof data21 == "object" && !Array.isArray(data21)){for(const key6 in data21){if(!(((((((key6 === "frontend") || (key6 === "backend")) || (key6 === "database")) || (key6 === "cloud")) || (key6 === "security")) || (key6 === "messagebus")) || (key6 === "external"))){const err57 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}if(data21.frontend !== undefined){let data22 = data21.frontend;if(data22 && typeof data22 == "object" && !Array.isArray(data22)){if(Object.keys(data22).length < 1){const err58 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}for(const key7 in data22){if(!((key7 === "label") || (key7 === "visible"))){const err59 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}}if(data22.label !== undefined){let data23 = data22.label;if(typeof data23 === "string"){if(func3(data23) > 80){const err60 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}if(func3(data23) < 1){const err61 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}else {const err62 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}if(data22.visible !== undefined){if(typeof data22.visible !== "boolean"){const err63 = {instancePath:instancePath+"/meta/legend/entries/frontend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}}else {const err64 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}if(data21.backend !== undefined){let data25 = data21.backend;if(data25 && typeof data25 == "object" && !Array.isArray(data25)){if(Object.keys(data25).length < 1){const err65 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}for(const key8 in data25){if(!((key8 === "label") || (key8 === "visible"))){const err66 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}if(data25.label !== undefined){let data26 = data25.label;if(typeof data26 === "string"){if(func3(data26) > 80){const err67 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}if(func3(data26) < 1){const err68 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}else {const err69 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}if(data25.visible !== undefined){if(typeof data25.visible !== "boolean"){const err70 = {instancePath:instancePath+"/meta/legend/entries/backend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}}else {const err71 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}if(data21.database !== undefined){let data28 = data21.database;if(data28 && typeof data28 == "object" && !Array.isArray(data28)){if(Object.keys(data28).length < 1){const err72 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}for(const key9 in data28){if(!((key9 === "label") || (key9 === "visible"))){const err73 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}}if(data28.label !== undefined){let data29 = data28.label;if(typeof data29 === "string"){if(func3(data29) > 80){const err74 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}if(func3(data29) < 1){const err75 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}else {const err76 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}if(data28.visible !== undefined){if(typeof data28.visible !== "boolean"){const err77 = {instancePath:instancePath+"/meta/legend/entries/database/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}}else {const err78 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}if(data21.cloud !== undefined){let data31 = data21.cloud;if(data31 && typeof data31 == "object" && !Array.isArray(data31)){if(Object.keys(data31).length < 1){const err79 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}for(const key10 in data31){if(!((key10 === "label") || (key10 === "visible"))){const err80 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}if(data31.label !== undefined){let data32 = data31.label;if(typeof data32 === "string"){if(func3(data32) > 80){const err81 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}if(func3(data32) < 1){const err82 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}}else {const err83 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}if(data31.visible !== undefined){if(typeof data31.visible !== "boolean"){const err84 = {instancePath:instancePath+"/meta/legend/entries/cloud/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}}else {const err85 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}if(data21.security !== undefined){let data34 = data21.security;if(data34 && typeof data34 == "object" && !Array.isArray(data34)){if(Object.keys(data34).length < 1){const err86 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}for(const key11 in data34){if(!((key11 === "label") || (key11 === "visible"))){const err87 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}if(data34.label !== undefined){let data35 = data34.label;if(typeof data35 === "string"){if(func3(data35) > 80){const err88 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}if(func3(data35) < 1){const err89 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}}else {const err90 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}}if(data34.visible !== undefined){if(typeof data34.visible !== "boolean"){const err91 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}}else {const err92 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}if(data21.messagebus !== undefined){let data37 = data21.messagebus;if(data37 && typeof data37 == "object" && !Array.isArray(data37)){if(Object.keys(data37).length < 1){const err93 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}for(const key12 in data37){if(!((key12 === "label") || (key12 === "visible"))){const err94 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}if(data37.label !== undefined){let data38 = data37.label;if(typeof data38 === "string"){if(func3(data38) > 80){const err95 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}if(func3(data38) < 1){const err96 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}}else {const err97 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}if(data37.visible !== undefined){if(typeof data37.visible !== "boolean"){const err98 = {instancePath:instancePath+"/meta/legend/entries/messagebus/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}}else {const err99 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data21.external !== undefined){let data40 = data21.external;if(data40 && typeof data40 == "object" && !Array.isArray(data40)){if(Object.keys(data40).length < 1){const err100 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}for(const key13 in data40){if(!((key13 === "label") || (key13 === "visible"))){const err101 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}if(data40.label !== undefined){let data41 = data40.label;if(typeof data41 === "string"){if(func3(data41) > 80){const err102 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}if(func3(data41) < 1){const err103 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}else {const err104 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}if(data40.visible !== undefined){if(typeof data40.visible !== "boolean"){const err105 = {instancePath:instancePath+"/meta/legend/entries/external/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}}else {const err106 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}}else {const err107 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}}else {const err108 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}if(data2.viewBox !== undefined){let data43 = data2.viewBox;if(Array.isArray(data43)){if(data43.length > 2){const err109 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}if(data43.length < 2){const err110 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}const len0 = data43.length;if(len0 > 0){let data44 = data43[0];if((typeof data44 == "number") && (isFinite(data44))){if(data44 < 320 || isNaN(data44)){const err111 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 320},message:"must be >= 320"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}else {const err112 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}if(len0 > 1){let data45 = data43[1];if((typeof data45 == "number") && (isFinite(data45))){if(data45 < 240 || isNaN(data45)){const err113 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 240},message:"must be >= 240"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}else {const err114 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}const len1 = data43.length;if(!(len1 <= 2)){const err115 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}else {const err116 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}}else {const err117 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}if(data.layout !== undefined){let data46 = data.layout;if(data46 && typeof data46 == "object" && !Array.isArray(data46)){if(data46.mode === undefined){const err118 = {instancePath:instancePath+"/layout",schemaPath:"#/properties/layout/required",keyword:"required",params:{missingProperty: "mode"},message:"must have required property '"+"mode"+"'"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}for(const key14 in data46){if(!(((((((key14 === "mode") || (key14 === "origin")) || (key14 === "cols")) || (key14 === "gapX")) || (key14 === "gapY")) || (key14 === "cellW")) || (key14 === "cellH"))){const err119 = {instancePath:instancePath+"/layout",schemaPath:"#/properties/layout/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}if(data46.mode !== undefined){if(!(data46.mode === "grid")){const err120 = {instancePath:instancePath+"/layout/mode",schemaPath:"#/properties/layout/properties/mode/enum",keyword:"enum",params:{allowedValues: schema169.properties.layout.properties.mode.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}}if(data46.origin !== undefined){let data48 = data46.origin;if(Array.isArray(data48)){if(data48.length > 2){const err121 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}if(data48.length < 2){const err122 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}const len2 = data48.length;if(len2 > 0){let data49 = data48[0];if(!((typeof data49 == "number") && (isFinite(data49)))){const err123 = {instancePath:instancePath+"/layout/origin/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}if(len2 > 1){let data50 = data48[1];if(!((typeof data50 == "number") && (isFinite(data50)))){const err124 = {instancePath:instancePath+"/layout/origin/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}}const len3 = data48.length;if(!(len3 <= 2)){const err125 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}else {const err126 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}if(data46.cols !== undefined){let data51 = data46.cols;if(!(((typeof data51 == "number") && (!(data51 % 1) && !isNaN(data51))) && (isFinite(data51)))){const err127 = {instancePath:instancePath+"/layout/cols",schemaPath:"#/properties/layout/properties/cols/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}if((typeof data51 == "number") && (isFinite(data51))){if(data51 > 12 || isNaN(data51)){const err128 = {instancePath:instancePath+"/layout/cols",schemaPath:"#/properties/layout/properties/cols/maximum",keyword:"maximum",params:{comparison: "<=", limit: 12},message:"must be <= 12"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}if(data51 < 1 || isNaN(data51)){const err129 = {instancePath:instancePath+"/layout/cols",schemaPath:"#/properties/layout/properties/cols/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}}}if(data46.gapX !== undefined){let data52 = data46.gapX;if((typeof data52 == "number") && (isFinite(data52))){if(data52 < 0 || isNaN(data52)){const err130 = {instancePath:instancePath+"/layout/gapX",schemaPath:"#/properties/layout/properties/gapX/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}else {const err131 = {instancePath:instancePath+"/layout/gapX",schemaPath:"#/properties/layout/properties/gapX/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}if(data46.gapY !== undefined){let data53 = data46.gapY;if((typeof data53 == "number") && (isFinite(data53))){if(data53 < 0 || isNaN(data53)){const err132 = {instancePath:instancePath+"/layout/gapY",schemaPath:"#/properties/layout/properties/gapY/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}}else {const err133 = {instancePath:instancePath+"/layout/gapY",schemaPath:"#/properties/layout/properties/gapY/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}if(data46.cellW !== undefined){let data54 = data46.cellW;if((typeof data54 == "number") && (isFinite(data54))){if(data54 < 40 || isNaN(data54)){const err134 = {instancePath:instancePath+"/layout/cellW",schemaPath:"#/properties/layout/properties/cellW/minimum",keyword:"minimum",params:{comparison: ">=", limit: 40},message:"must be >= 40"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}else {const err135 = {instancePath:instancePath+"/layout/cellW",schemaPath:"#/properties/layout/properties/cellW/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}}if(data46.cellH !== undefined){let data55 = data46.cellH;if((typeof data55 == "number") && (isFinite(data55))){if(data55 < 24 || isNaN(data55)){const err136 = {instancePath:instancePath+"/layout/cellH",schemaPath:"#/properties/layout/properties/cellH/minimum",keyword:"minimum",params:{comparison: ">=", limit: 24},message:"must be >= 24"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}}else {const err137 = {instancePath:instancePath+"/layout/cellH",schemaPath:"#/properties/layout/properties/cellH/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}}else {const err138 = {instancePath:instancePath+"/layout",schemaPath:"#/properties/layout/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}}if(data.components !== undefined){let data56 = data.components;if(Array.isArray(data56)){if(data56.length < 1){const err139 = {instancePath:instancePath+"/components",schemaPath:"#/properties/components/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}const len4 = data56.length;for(let i0=0; i0 80){const err152 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}if(!pattern29.test(data64)){const err153 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}var _valid1 = _errs179 === errors;valid49 = valid49 || _valid1;const _errs180 = errors;if(typeof data64 === "string"){if(!pattern30.test(data64)){const err154 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}var _valid1 = _errs180 === errors;valid49 = valid49 || _valid1;if(!valid49){const err155 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}else {errors = _errs178;if(vErrors !== null){if(_errs178){vErrors.length = _errs178;}else {vErrors = null;}}}if(typeof data64 === "string"){if(func3(data64) > 2048){const err156 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}if(func3(data64) < 1){const err157 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}}else {const err158 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}var _valid0 = _errs176 === errors;if(_valid0){valid48 = true;passing0 = 0;}const _errs181 = errors;if(data64 && typeof data64 == "object" && !Array.isArray(data64)){if(data64.url === undefined){const err159 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}if(data64.sha256 === undefined){const err160 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}for(const key16 in data64){if(!((key16 === "url") || (key16 === "sha256"))){const err161 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key16},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}}if(data64.url !== undefined){let data65 = data64.url;if(typeof data65 === "string"){if(func3(data65) > 2048){const err162 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}if(func3(data65) < 8){const err163 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}if(!pattern30.test(data65)){const err164 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}else {const err165 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}if(data64.sha256 !== undefined){let data66 = data64.sha256;if(typeof data66 === "string"){if(!pattern32.test(data66)){const err166 = {instancePath:instancePath+"/components/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}else {const err167 = {instancePath:instancePath+"/components/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}}else {const err168 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}var _valid0 = _errs181 === errors;if(_valid0 && valid48){valid48 = false;passing0 = [passing0, 1];}else {if(_valid0){valid48 = true;passing0 = 1;}}if(!valid48){const err169 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}else {errors = _errs175;if(vErrors !== null){if(_errs175){vErrors.length = _errs175;}else {vErrors = null;}}}}if(data57.sources !== undefined){let data67 = data57.sources;if(Array.isArray(data67)){if(data67.length > 3){const err170 = {instancePath:instancePath+"/components/" + i0+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/maxItems",keyword:"maxItems",params:{limit: 3},message:"must NOT have more than 3 items"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}if(data67.length < 1){const err171 = {instancePath:instancePath+"/components/" + i0+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}const len5 = data67.length;for(let i1=0; i1 240){const err174 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}if(func3(data69) < 1){const err175 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}else {const err176 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/path",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}}if(data68.line !== undefined){let data70 = data68.line;if(!(((typeof data70 == "number") && (!(data70 % 1) && !isNaN(data70))) && (isFinite(data70)))){const err177 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}if((typeof data70 == "number") && (isFinite(data70))){if(data70 < 1 || isNaN(data70)){const err178 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}}}if(data68.end_line !== undefined){let data71 = data68.end_line;if(!(((typeof data71 == "number") && (!(data71 % 1) && !isNaN(data71))) && (isFinite(data71)))){const err179 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/end_line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/end_line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}if((typeof data71 == "number") && (isFinite(data71))){if(data71 < 1 || isNaN(data71)){const err180 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/end_line",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/end_line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}}if(data68.label !== undefined){let data72 = data68.label;if(typeof data72 === "string"){if(func3(data72) > 48){const err181 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}if(func3(data72) < 1){const err182 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}}else {const err183 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/label",schemaPath:"common.schema.json#/$defs/sourceReferences/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}}}else {const err184 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1,schemaPath:"common.schema.json#/$defs/sourceReferences/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}}}else {const err185 = {instancePath:instancePath+"/components/" + i0+"/sources",schemaPath:"common.schema.json#/$defs/sourceReferences/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}}if(data57.row !== undefined){let data73 = data57.row;if(!(((typeof data73 == "number") && (!(data73 % 1) && !isNaN(data73))) && (isFinite(data73)))){const err186 = {instancePath:instancePath+"/components/" + i0+"/row",schemaPath:"#/properties/components/items/properties/row/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}if((typeof data73 == "number") && (isFinite(data73))){if(data73 < 0 || isNaN(data73)){const err187 = {instancePath:instancePath+"/components/" + i0+"/row",schemaPath:"#/properties/components/items/properties/row/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}}}if(data57.col !== undefined){let data74 = data57.col;if(!(((typeof data74 == "number") && (!(data74 % 1) && !isNaN(data74))) && (isFinite(data74)))){const err188 = {instancePath:instancePath+"/components/" + i0+"/col",schemaPath:"#/properties/components/items/properties/col/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}if((typeof data74 == "number") && (isFinite(data74))){if(data74 < 0 || isNaN(data74)){const err189 = {instancePath:instancePath+"/components/" + i0+"/col",schemaPath:"#/properties/components/items/properties/col/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}}if(data57.pos !== undefined){let data75 = data57.pos;if(Array.isArray(data75)){if(data75.length > 2){const err190 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}if(data75.length < 2){const err191 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}const len6 = data75.length;if(len6 > 0){let data76 = data75[0];if(!((typeof data76 == "number") && (isFinite(data76)))){const err192 = {instancePath:instancePath+"/components/" + i0+"/pos/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}}if(len6 > 1){let data77 = data75[1];if(!((typeof data77 == "number") && (isFinite(data77)))){const err193 = {instancePath:instancePath+"/components/" + i0+"/pos/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}}const len7 = data75.length;if(!(len7 <= 2)){const err194 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}else {const err195 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}if(data57.size !== undefined){let data78 = data57.size;if(Array.isArray(data78)){if(data78.length > 2){const err196 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}if(data78.length < 2){const err197 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}const len8 = data78.length;if(len8 > 0){let data79 = data78[0];if((typeof data79 == "number") && (isFinite(data79))){if(data79 <= 0 || isNaN(data79)){const err198 = {instancePath:instancePath+"/components/" + i0+"/size/0",schemaPath:"#/properties/components/items/properties/size/prefixItems/0/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison: ">", limit: 0},message:"must be > 0"};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}else {const err199 = {instancePath:instancePath+"/components/" + i0+"/size/0",schemaPath:"#/properties/components/items/properties/size/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}}if(len8 > 1){let data80 = data78[1];if((typeof data80 == "number") && (isFinite(data80))){if(data80 <= 0 || isNaN(data80)){const err200 = {instancePath:instancePath+"/components/" + i0+"/size/1",schemaPath:"#/properties/components/items/properties/size/prefixItems/1/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison: ">", limit: 0},message:"must be > 0"};if(vErrors === null){vErrors = [err200];}else {vErrors.push(err200);}errors++;}}else {const err201 = {instancePath:instancePath+"/components/" + i0+"/size/1",schemaPath:"#/properties/components/items/properties/size/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err201];}else {vErrors.push(err201);}errors++;}}const len9 = data78.length;if(!(len9 <= 2)){const err202 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err202];}else {vErrors.push(err202);}errors++;}}else {const err203 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err203];}else {vErrors.push(err203);}errors++;}}}else {const err204 = {instancePath:instancePath+"/components/" + i0,schemaPath:"#/properties/components/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err204];}else {vErrors.push(err204);}errors++;}}}else {const err205 = {instancePath:instancePath+"/components",schemaPath:"#/properties/components/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err205];}else {vErrors.push(err205);}errors++;}}if(data.boundaries !== undefined){let data81 = data.boundaries;if(Array.isArray(data81)){const len10 = data81.length;for(let i2=0; i2=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}}else {const err218 = {instancePath:instancePath+"/boundaries/" + i2+"/pad",schemaPath:"#/properties/boundaries/items/properties/pad/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}}}else {const err219 = {instancePath:instancePath+"/boundaries/" + i2,schemaPath:"#/properties/boundaries/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}}}else {const err220 = {instancePath:instancePath+"/boundaries",schemaPath:"#/properties/boundaries/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}}if(data.connections !== undefined){let data88 = data.connections;if(Array.isArray(data88)){const len12 = data88.length;for(let i4=0; i4 2){const err235 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err235];}else {vErrors.push(err235);}errors++;}if(data99.length < 2){const err236 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err236];}else {vErrors.push(err236);}errors++;}const len14 = data99.length;if(len14 > 0){let data100 = data99[0];if(!((typeof data100 == "number") && (isFinite(data100)))){const err237 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err237];}else {vErrors.push(err237);}errors++;}}if(len14 > 1){let data101 = data99[1];if(!((typeof data101 == "number") && (isFinite(data101)))){const err238 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err238];}else {vErrors.push(err238);}errors++;}}const len15 = data99.length;if(!(len15 <= 2)){const err239 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err239];}else {vErrors.push(err239);}errors++;}}else {const err240 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err240];}else {vErrors.push(err240);}errors++;}}}else {const err241 = {instancePath:instancePath+"/connections/" + i4+"/via",schemaPath:"#/properties/connections/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err241];}else {vErrors.push(err241);}errors++;}}if(data89.labelAt !== undefined){let data102 = data89.labelAt;if(Array.isArray(data102)){if(data102.length > 2){const err242 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err242];}else {vErrors.push(err242);}errors++;}if(data102.length < 2){const err243 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err243];}else {vErrors.push(err243);}errors++;}const len16 = data102.length;if(len16 > 0){let data103 = data102[0];if(!((typeof data103 == "number") && (isFinite(data103)))){const err244 = {instancePath:instancePath+"/connections/" + i4+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err244];}else {vErrors.push(err244);}errors++;}}if(len16 > 1){let data104 = data102[1];if(!((typeof data104 == "number") && (isFinite(data104)))){const err245 = {instancePath:instancePath+"/connections/" + i4+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err245];}else {vErrors.push(err245);}errors++;}}const len17 = data102.length;if(!(len17 <= 2)){const err246 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err246];}else {vErrors.push(err246);}errors++;}}else {const err247 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err247];}else {vErrors.push(err247);}errors++;}}if(data89.labelDx !== undefined){let data105 = data89.labelDx;if(!((typeof data105 == "number") && (isFinite(data105)))){const err248 = {instancePath:instancePath+"/connections/" + i4+"/labelDx",schemaPath:"#/properties/connections/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err248];}else {vErrors.push(err248);}errors++;}}if(data89.labelDy !== undefined){let data106 = data89.labelDy;if(!((typeof data106 == "number") && (isFinite(data106)))){const err249 = {instancePath:instancePath+"/connections/" + i4+"/labelDy",schemaPath:"#/properties/connections/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err249];}else {vErrors.push(err249);}errors++;}}if(data89.labelSegment !== undefined){let data107 = data89.labelSegment;if(!(((typeof data107 == "number") && (!(data107 % 1) && !isNaN(data107))) && (isFinite(data107)))){const err250 = {instancePath:instancePath+"/connections/" + i4+"/labelSegment",schemaPath:"#/properties/connections/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err250];}else {vErrors.push(err250);}errors++;}if((typeof data107 == "number") && (isFinite(data107))){if(data107 < 0 || isNaN(data107)){const err251 = {instancePath:instancePath+"/connections/" + i4+"/labelSegment",schemaPath:"#/properties/connections/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err251];}else {vErrors.push(err251);}errors++;}}}if(data89.width !== undefined){let data108 = data89.width;if((typeof data108 == "number") && (isFinite(data108))){if(data108 < 0.5 || isNaN(data108)){const err252 = {instancePath:instancePath+"/connections/" + i4+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err252];}else {vErrors.push(err252);}errors++;}}else {const err253 = {instancePath:instancePath+"/connections/" + i4+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err253];}else {vErrors.push(err253);}errors++;}}}else {const err254 = {instancePath:instancePath+"/connections/" + i4,schemaPath:"#/properties/connections/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err254];}else {vErrors.push(err254);}errors++;}}}else {const err255 = {instancePath:instancePath+"/connections",schemaPath:"#/properties/connections/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err255];}else {vErrors.push(err255);}errors++;}}if(data.cards !== undefined){let data109 = data.cards;if(Array.isArray(data109)){const len18 = data109.length;for(let i6=0; i6 Number.isFinite(c)); } +// Separation the layout solver guarantees and separation this check re-derives +// travel through different arithmetic, so a pair the solver placed at exactly +// its minimum can land a few ulps short of this comparison. In #583 the CLI's +// own receipt has the pair `793.6 + 160 + 8` read as 2**-43 past a5's left edge +// at 961.5999999999999 — one ulp at that magnitude. 0.0001 is the numeric +// tolerance the route and layout geometry in this file already compares with. +const NUMERIC_CLEARANCE_PX = 0.0001; + export function rectsOverlap(a, b, gap = 0) { // Non-finite geometry means "unknown", not "overlapping". Every comparison // below is false for NaN, so without this guard the negation reports a @@ -27,10 +35,10 @@ export function rectsOverlap(a, b, gap = 0) { return false; } return !( - a.x + a.width + gap <= b.x || - b.x + b.width + gap <= a.x || - a.y + a.height + gap <= b.y || - b.y + b.height + gap <= a.y + a.x + a.width + gap <= b.x + NUMERIC_CLEARANCE_PX || + b.x + b.width + gap <= a.x + NUMERIC_CLEARANCE_PX || + a.y + a.height + gap <= b.y + NUMERIC_CLEARANCE_PX || + b.y + b.height + gap <= a.y + NUMERIC_CLEARANCE_PX ); } @@ -55,21 +63,39 @@ export function segmentRectClearance(segment, rect) { if (!segment || !rect) return null; const { start, end } = segment; if (!Array.isArray(start) || !Array.isArray(end) || start.length !== 2 || end.length !== 2) return null; - if (!isFinitePoint(...start, ...end, rect.x, rect.y, rect.width, rect.height)) return null; + if (!isFinitePoint(start[0], start[1], end[0], end[1], rect.x, rect.y, rect.width, rect.height)) return null; if (rect.width < 0 || rect.height < 0) return null; if (segmentIntersectsRect(segment, rect)) return 0; - const corners = [ - [rect.x, rect.y], - [rect.x + rect.width, rect.y], - [rect.x + rect.width, rect.y + rect.height], - [rect.x, rect.y + rect.height], - ]; - return Math.min( - pointRectDistance(start, rect), - pointRectDistance(end, rect), - ...corners.map((corner) => pointSegmentDistance(corner, start, end)), - ); + const right = rect.x + rect.width; + const bottom = rect.y + rect.height; + let clearance = Math.min(pointRectDistance(start, rect), pointRectDistance(end, rect)); + const corners = [rect.x, rect.y, right, rect.y, right, bottom, rect.x, bottom]; + for (let index = 0; index < 8; index += 2) { + const distance = pointSegmentDistanceXY(corners[index], corners[index + 1], start, end); + if (distance < clearance) clearance = distance; + } + return clearance; +} + +// The same clearance, but the caller already knows the threshold it compares +// against: when an axis gap alone proves the distance cannot be smaller, the +// exact distance is never computed and Infinity is returned. +export function segmentRectClearanceWithin(segment, rect, limit) { + if (!segment || !rect) return segmentRectClearance(segment, rect); + const { start, end } = segment; + if (!Array.isArray(start) || !Array.isArray(end) || start.length !== 2 || end.length !== 2) return null; + if (!isFinitePoint(start[0], start[1], end[0], end[1], rect.x, rect.y, rect.width, rect.height)) return null; + if (rect.width < 0 || rect.height < 0) return null; + if (segmentIntersectsRect(segment, rect)) return 0; + const minX = Math.min(start[0], end[0]); + const maxX = Math.max(start[0], end[0]); + const minY = Math.min(start[1], end[1]); + const maxY = Math.max(start[1], end[1]); + const gapX = Math.max(rect.x - maxX, minX - (rect.x + rect.width)); + const gapY = Math.max(rect.y - maxY, minY - (rect.y + rect.height)); + if (Math.max(gapX, gapY) > limit) return Number.POSITIVE_INFINITY; + return segmentRectClearance(segment, rect); } export function segmentRectIntersectionLength(segment, rect) { @@ -104,8 +130,82 @@ export function segmentRectIntersectionLength(segment, rect) { return length * Math.max(0, leave - enter); } +const ROUTE_INDEX_CELL_SIZE = 128; +const ROUTE_INDEX_MAX_CELLS_PER_ROUTE = 256; + +function routeBounds(route) { + let x1 = Infinity; + let y1 = Infinity; + let x2 = -Infinity; + let y2 = -Infinity; + for (const [x, y] of route.points) { + x1 = Math.min(x1, x); + y1 = Math.min(y1, y); + x2 = Math.max(x2, x); + y2 = Math.max(y2, y); + } + return { x1, y1, x2, y2 }; +} + +function createRouteCandidateIndex(routes) { + const cells = new Map(); + const globalRouteIndexes = []; + + routes.forEach((route, routeIndex) => { + const bounds = routeBounds(route); + const x1 = Math.floor(bounds.x1 / ROUTE_INDEX_CELL_SIZE); + const y1 = Math.floor(bounds.y1 / ROUTE_INDEX_CELL_SIZE); + const x2 = Math.floor(bounds.x2 / ROUTE_INDEX_CELL_SIZE); + const y2 = Math.floor(bounds.y2 / ROUTE_INDEX_CELL_SIZE); + if (![x1, y1, x2, y2].every(Number.isSafeInteger)) { + globalRouteIndexes.push(routeIndex); + return; + } + const cellCount = (x2 - x1 + 1) * (y2 - y1 + 1); + + // Very long routes are cheaper to test once per label than to duplicate + // across a large part of the index. + if (!Number.isSafeInteger(cellCount) || cellCount > ROUTE_INDEX_MAX_CELLS_PER_ROUTE) { + globalRouteIndexes.push(routeIndex); + return; + } + for (let y = y1; y <= y2; y += 1) { + for (let x = x1; x <= x2; x += 1) { + const key = `${x}:${y}`; + const bucket = cells.get(key); + if (bucket) bucket.push(routeIndex); + else cells.set(key, [routeIndex]); + } + } + }); + + return function candidates(rect, threshold) { + const x1 = Math.floor((rect.x - threshold) / ROUTE_INDEX_CELL_SIZE); + const y1 = Math.floor((rect.y - threshold) / ROUTE_INDEX_CELL_SIZE); + const x2 = Math.floor((rect.x + rect.width + threshold) / ROUTE_INDEX_CELL_SIZE); + const y2 = Math.floor((rect.y + rect.height + threshold) / ROUTE_INDEX_CELL_SIZE); + const cellCount = (x2 - x1 + 1) * (y2 - y1 + 1); + + // A huge threshold offers no selectivity and can overflow cell iteration. + if (![x1, y1, x2, y2].every(Number.isSafeInteger) + || !Number.isSafeInteger(cellCount) + || cellCount > Math.max(64, cells.size * 4)) return routes; + + const routeIndexes = new Set(globalRouteIndexes); + for (let y = y1; y <= y2; y += 1) { + for (let x = x1; x <= x2; x += 1) { + for (const routeIndex of cells.get(`${x}:${y}`) || []) routeIndexes.add(routeIndex); + } + } + return [...routeIndexes] + .sort((left, right) => left - right) + .map((routeIndex) => routes[routeIndex]); + }; +} + export function collectLabelRouteClearance({ labels, routedRelations, threshold }) { if (!Number.isFinite(threshold) || threshold < 0) return []; + if (threshold === 0) return []; const routeCandidates = asArray(routedRelations).map((entry, fallbackIndex) => { const relation = entry?.relation || entry; const points = normalizeRoutePoints(entry?.points || relation?.routePoints); @@ -125,6 +225,7 @@ export function collectLabelRouteClearance({ labels, routedRelations, threshold }); const hits = []; const seenLabels = new Set(); + const candidateRoutes = createRouteCandidateIndex(routes); for (const [fallbackIndex, label] of asArray(labels).entries()) { const rect = label?.rect || label; @@ -133,7 +234,7 @@ export function collectLabelRouteClearance({ labels, routedRelations, threshold const labelIdentity = relationshipIdentity(label?.relation, relationIndex); if (seenLabels.has(labelIdentity)) continue; seenLabels.add(labelIdentity); - for (const route of routes) { + for (const route of candidateRoutes(rect, threshold)) { if (relationIndex === route.relationIndex || sameRelationship(label?.relation, route.relation)) continue; let nearest = null; for (let segmentIndex = 0; segmentIndex < route.points.length - 1; segmentIndex += 1) { @@ -167,6 +268,15 @@ export function collectLabelRouteClearance({ labels, routedRelations, threshold return hits; } +export function minimumLabelRouteClearance(measurements) { + if (!asArray(measurements).length) return null; + const minimum = measurements.reduce( + (value, hit) => Math.min(value, hit.clearance), + Infinity, + ); + return Math.round(minimum * 10) / 10; +} + function relationshipIdentity(relation, relationIndex) { if (relation?.key !== undefined) return `key:${relation.key}`; if (relation?.id) return `id:${relation.from || ''}\u0000${relation.to || ''}\u0000${relation.id}`; @@ -191,6 +301,20 @@ function relationshipSubject(diagramType, relationCollection, relationIndex, rel }; } +const AUTHORED_PLAN_KEYS = ['route', 'via', 'channelX', 'channelY', 'fromSide', 'toSide', 'bias', 'labelAt', 'labelDx', 'labelDy', 'labelSegment']; + +// Re-planning advice only applies when the failing relation actually carries +// authored controls; telling an author to remove controls that do not exist +// just sends them hunting for a field that was never written. +function rePlanHint(relations, fallback) { + const controls = new Set(); + for (const relation of asArray(relations)) { + for (const key of AUTHORED_PLAN_KEYS) if (relation?.[key] !== undefined) controls.add(key); + } + if (!controls.size) return fallback; + return `if the authored ${[...controls].join('/')} are not required by the user, remove them so the renderer can re-plan; otherwise preserve that intent and ${fallback}`; +} + const ENDPOINT_SIDE_RULES = { left: { axis: 'horizontal', @@ -254,7 +378,6 @@ export function routeHonorsEndpointSides(points, fromSide, toSide) { return !endpointSideIssue(points, 'source', fromSide) && !endpointSideIssue(points, 'target', toSide); } - // Explicit fromSide/toSide are authored geometry, so a tangent or backwards // endpoint segment changes their meaning. Fail this universally instead of // leaving a malformed arrow for visual review to discover. Named routes and @@ -376,7 +499,8 @@ export function cleanFlowProblems({ const from = points[hitSegment].map(Math.round).join(', '); const to = points[hitSegment + 1].map(Math.round).join(', '); const relationId = relation.id ? ` id "${relation.id}"` : ''; - const message = `[clean-flow/edge-through-node] ${diagramType} ${relationCollection}[${relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" crosses ${obstacleKind} "${obstacle.id}" (unrelated to this relationship) on segment ${hitSegment} [${from}] -> [${to}] (${clearance}px clearance) — ${routeHint}.`; + const hint = rePlanHint([relation], routeHint); + const message = `[clean-flow/edge-through-node] ${diagramType} ${relationCollection}[${relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" crosses ${obstacleKind} "${obstacle.id}" (unrelated to this relationship) on segment ${hitSegment} [${from}] -> [${to}] (${clearance}px clearance) — ${hint}.`; recordDiagnostic({ code: 'clean-flow/edge-through-node', severity: 'error', @@ -390,7 +514,7 @@ export function cleanFlowProblems({ to: points[hitSegment + 1], clearancePx: clearance, }, - supportedFixes: [routeHint], + supportedFixes: [hint], }); problems.push(message); } @@ -477,10 +601,9 @@ function pointLiesOnSegment(point, start, end) { && point[1] <= Math.max(start[1], end[1]) + epsilon; } -// Reject only a proper interior X between relationships that share no semantic -// endpoint. Endpoint touches, branch/merge ports, and collinear shared -// corridors are intentionally outside this contract because geometry alone -// cannot tell whether those are authored junctions. +// Authored shared endpoints retain their junction interpretation by default. +// Renderers can opt their automatic routes into proper interior X checks; +// endpoint touches and collinear trunks still are not proper crossings. export function cleanCrossingProblems({ relations, endpointIds, @@ -490,9 +613,14 @@ export function cleanCrossingProblems({ profile = 'standard', profileIsAuthoritative = false, mergeForwardCollinearWaypoints = false, + includeSharedEndpoints = () => false, + crossingResolved = () => false, + warnInStandard = false, + onDiagnostic = recordDiagnostic, routeHint = 'adjust route/via or channel coordinates so the relationships use separate corridors' }) { - if (qualityProfileForGate(profile, profileIsAuthoritative) !== 'showcase') return []; + const severity = qualityProfileForGate(profile, profileIsAuthoritative) === 'showcase' ? 'error' : 'warning'; + if (severity === 'warning' && !warnInStandard) return []; const routed = asArray(relations).map((relation, index) => { if (!relation || !endpointIds.has(relation.from) || !endpointIds.has(relation.to)) return null; const points = pathFor(relation)?.points; @@ -513,7 +641,8 @@ export function cleanCrossingProblems({ const left = routed[leftIndex]; for (let rightIndex = leftIndex + 1; rightIndex < routed.length; rightIndex += 1) { const right = routed[rightIndex]; - if ([left.relation.from, left.relation.to].some((id) => id === right.relation.from || id === right.relation.to)) continue; + if ([left.relation.from, left.relation.to].some((id) => id === right.relation.from || id === right.relation.to) + && !includeSharedEndpoints(left.relation, right.relation)) continue; let hit = null; for (const leftSegment of left.analysisSegments) { @@ -536,16 +665,18 @@ export function cleanCrossingProblems({ } } if (!hit) continue; + if (crossingResolved(left.relation, right.relation, hit)) continue; const describe = ({ relation, index }) => { const id = relation.id ? ` id "${relation.id}"` : ''; return `${relationCollection}[${index}]${id} "${relation.from}" -> "${relation.to}"`; }; const point = hit.point.map((value) => Math.round(value * 10) / 10).join(', '); - const message = `[composition/proper-crossing] showcase ${diagramType} ${describe(left)} crosses ${describe(right)} at [${point}] (segments ${hit.leftSegment} and ${hit.rightSegment}) — ${routeHint}.`; - recordDiagnostic({ + const hint = rePlanHint([left.relation, right.relation], routeHint); + const message = `[composition/proper-crossing] ${severity === 'error' ? 'showcase' : 'standard'} ${diagramType} ${describe(left)} crosses ${describe(right)} at [${point}] (segments ${hit.leftSegment} and ${hit.rightSegment}) — ${hint}.`; + onDiagnostic({ code: 'composition/proper-crossing', - severity: 'error', + severity, message, subject: relationshipSubject(diagramType, relationCollection, left.index, left.relation), evidence: { @@ -554,9 +685,9 @@ export function cleanCrossingProblems({ segmentIndex: hit.leftSegment, otherSegmentIndex: hit.rightSegment, }, - supportedFixes: [routeHint], + supportedFixes: [hint], }); - problems.push(message); + if (severity === 'error') problems.push(message); } } return problems; @@ -564,12 +695,20 @@ export function cleanCrossingProblems({ // Two unrelated relationships that occupy the same visible corridor can read // as one authored branch or merge even when neither relationship crosses a -// node or forms a proper X. Keep shared semantic endpoints exempt: their -// initial/final fan-out is real topology. Tiny overlaps below the route rhythm +// node or forms a proper X. Keep authored shared endpoints exempt by default; +// automatic architecture routes opt in because they promise separate ports. +// Workflow v2 opts into shared-endpoint checks with a bounded terminal-trunk +// exception. Other callers keep their existing authored-junction contract. +// The counterflow-only opt-in serves older workflow exports without a root +// readable-v2 contract; full shared-endpoint checking takes precedence. +// Tiny overlaps below the route rhythm // floor are ignored to avoid turning sub-pixel rounding into a quality debt. export function collectAmbiguousCorridors({ routedRelations, minOverlapPx = 8, + includeSharedEndpoints = () => false, + includeSharedEndpointCounterflow = () => false, + allowShortWorkflowTrunks = false, }) { const routed = asArray(routedRelations).map((entry, fallbackIndex) => { const relation = entry?.relation; @@ -588,7 +727,9 @@ export function collectAmbiguousCorridors({ const left = routed[leftIndex]; for (let rightIndex = leftIndex + 1; rightIndex < routed.length; rightIndex += 1) { const right = routed[rightIndex]; - if ([left.relation.from, left.relation.to].some((id) => id === right.relation.from || id === right.relation.to)) continue; + const sharedEndpoint = [left.relation.from, left.relation.to].some((id) => id === right.relation.from || id === right.relation.to); + const counterflowOnly = sharedEndpoint && !includeSharedEndpoints(left.relation, right.relation); + if (counterflowOnly && !includeSharedEndpointCounterflow(left.relation, right.relation)) continue; let longest = null; for (let leftSegment = 0; leftSegment < left.points.length - 1; leftSegment += 1) { @@ -600,6 +741,12 @@ export function collectAmbiguousCorridors({ right.points[rightSegment + 1], ); if (!overlap || overlap.length + 0.0001 < minOverlapPx) continue; + if (allowShortWorkflowTrunks && shortWorkflowTrunk(left, right, leftSegment, rightSegment, overlap.length)) continue; + if (counterflowOnly) { + const leftDelta = left.points[leftSegment + 1].map((value, axis) => value - left.points[leftSegment][axis]); + const rightDelta = right.points[rightSegment + 1].map((value, axis) => value - right.points[rightSegment][axis]); + if (leftDelta[0] * rightDelta[0] + leftDelta[1] * rightDelta[1] >= 0) continue; + } if (!longest || overlap.length > longest.overlapLength + 0.0001) { longest = { left, @@ -619,6 +766,58 @@ export function collectAmbiguousCorridors({ return hits; } +function shortWorkflowTrunk(left, right, leftSegment, rightSegment, length) { + if (length > 24 + 0.0001) return false; + const a = left.relation, b = right.relation; + const variant = (edge) => edge.variant || 'default'; + const width = (edge) => edge.width || (variant(edge) === 'emphasis' ? 1.8 : 1.4); + if (variant(a) !== variant(b) || width(a) !== width(b) || (a.role || '') !== (b.role || '')) return false; + const same = (p, q) => Math.abs(p[0] - q[0]) < 0.0001 && Math.abs(p[1] - q[1]) < 0.0001; + const source = a.from === b.from && leftSegment === 0 && rightSegment === 0 + && same(left.points[0], right.points[0]); + const target = a.to === b.to && leftSegment === left.points.length - 2 && rightSegment === right.points.length - 2 + && same(left.points.at(-1), right.points.at(-1)); + if (!source && !target) return false; + const p = left.points[leftSegment], q = left.points[leftSegment + 1]; + const r = right.points[rightSegment], s = right.points[rightSegment + 1]; + return (q[0] - p[0]) * (s[0] - r[0]) + (q[1] - p[1]) * (s[1] - r[1]) > 0; +} + +// Bundled arrow markers are 7 stroke-widths across the direction of travel. +// Callers select the automatic routes they own; explicit junctions are preserved. +export function collectArrowheadCollisions({ routedRelations, allowShortWorkflowTrunks = false }) { + const incoming = new Map(); + const hits = []; + for (const entry of asArray(routedRelations)) { + const points = normalizeRoutePoints(entry.points); + if (points.length < 2 || !entry.relation?.to) continue; + const tip = points.at(-1); + const previous = points.at(-2); + const vertical = Math.abs(tip[0] - previous[0]) < 0.0001; + const axis = vertical ? 0 : 1; + const direction = Math.sign(tip[1 - axis] - previous[1 - axis]); + const halfWidth = 3.5 * (entry.relation.width || (entry.relation.variant === 'emphasis' ? 1.8 : 1.5)); + const key = `${entry.relation.to}\u0000${axis}\u0000${direction}`; + const siblings = incoming.get(key) || []; + const current = { ...entry, tip, halfWidth }; + for (const sibling of siblings) { + if (Math.abs(tip[1 - axis] - sibling.tip[1 - axis]) > 0.0001) continue; + const distance = Math.abs(tip[axis] - sibling.tip[axis]); + const minimum = halfWidth + sibling.halfWidth; + if (allowShortWorkflowTrunks) { + const left = { ...sibling, points: normalizeRoutePoints(sibling.points) }; + const right = { ...entry, points }; + const overlap = collinearAxisOverlap(left.points.at(-2), left.points.at(-1), points.at(-2), tip); + if (overlap && shortWorkflowTrunk(left, right, left.points.length - 2, points.length - 2, overlap.length)) continue; + } + if (distance < minimum - 0.0001) hits.push({ left: sibling, right: current, distance, minimum }); + } + siblings.push(current); + incoming.set(key, siblings); + } + return hits; +} + export function cleanAmbiguousCorridorProblems({ relations, endpointIds, @@ -629,11 +828,16 @@ export function cleanAmbiguousCorridorProblems({ profileIsAuthoritative = false, routeHint = 'adjust route/via or channel coordinates so the relationships use separate corridors', minOverlapPx = 8, + includeSharedEndpoints = () => false, + includeSharedEndpointCounterflow = () => false, + allowShortWorkflowTrunks = false, + onDiagnostic = recordDiagnostic, }) { - if (qualityProfileForGate(profile, profileIsAuthoritative) !== 'showcase') return []; + const severity = qualityProfileForGate(profile, profileIsAuthoritative) === 'showcase' ? 'error' : 'warning'; + if (severity === 'warning' && !allowShortWorkflowTrunks) return []; const routedRelations = collectEligibleRoutedRelations({ relations, endpointIds, pathFor }); - return collectAmbiguousCorridors({ routedRelations, minOverlapPx }).map((hit) => { + return collectAmbiguousCorridors({ routedRelations, minOverlapPx, includeSharedEndpoints, includeSharedEndpointCounterflow, allowShortWorkflowTrunks }).map((hit) => { const describe = ({ relation, relationIndex }) => { const id = relation.id ? ` id "${relation.id}"` : ''; return `${relationCollection}[${relationIndex}]${id} "${relation.from}" -> "${relation.to}"`; @@ -641,10 +845,11 @@ export function cleanAmbiguousCorridorProblems({ const length = Math.round(hit.overlapLength * 10) / 10; const from = hit.overlapStart.map((value) => Math.round(value * 10) / 10).join(', '); const to = hit.overlapEnd.map((value) => Math.round(value * 10) / 10).join(', '); - const message = `[composition/ambiguous-corridor] showcase ${diagramType} ${describe(hit.left)} shares a ${length}px corridor with ${describe(hit.right)} at [${from}] -> [${to}] (segments ${hit.leftSegment} and ${hit.rightSegment}; minimum ${minOverlapPx}px) — ${routeHint}.`; - recordDiagnostic({ + const hint = rePlanHint([hit.left.relation, hit.right.relation], routeHint); + const message = `[composition/ambiguous-corridor] ${severity === 'error' ? 'showcase' : 'standard'} ${diagramType} ${describe(hit.left)} shares a ${length}px corridor with ${describe(hit.right)} at [${from}] -> [${to}] (segments ${hit.leftSegment} and ${hit.rightSegment}; minimum ${minOverlapPx}px) — ${hint}.`; + onDiagnostic({ code: 'composition/ambiguous-corridor', - severity: 'error', + severity, message, subject: relationshipSubject(diagramType, relationCollection, hit.left.relationIndex, hit.left.relation), evidence: { @@ -656,10 +861,10 @@ export function cleanAmbiguousCorridorProblems({ segmentIndex: hit.leftSegment, otherSegmentIndex: hit.rightSegment, }, - supportedFixes: [routeHint], + supportedFixes: [hint], }); - return message; - }); + return severity === 'error' ? message : null; + }).filter(Boolean); } // Relationship paths may cross a structural frame, but they must not borrow a @@ -701,7 +906,7 @@ export function collectBorderRuns({ routedRelations, frames }) { frame, frameIndex, side: border.side, - segmentIndex: Math.min(...overlaps.map((overlap) => overlap.segmentIndex)), + segmentIndex: overlaps.reduce((min, overlap) => Math.min(min, overlap.segmentIndex), Infinity), overlapLength: merged.reduce((total, overlap) => total + overlap.length, 0), overlapStart: longest.start, overlapEnd: longest.end, @@ -733,7 +938,8 @@ export function cleanBorderRunProblems({ const length = Math.round(hit.overlapLength * 10) / 10; const from = hit.overlapStart.map((value) => Math.round(value * 10) / 10).join(', '); const to = hit.overlapEnd.map((value) => Math.round(value * 10) / 10).join(', '); - const message = `[composition/container-border-run] ${diagramType} ${relationCollection}[${hit.relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" follows ${frameKind} "${frameIdentity}" ${hit.side} border for ${length}px on segment ${hit.segmentIndex} [${from}] -> [${to}] — ${routeHint}.`; + const hint = rePlanHint([relation], routeHint); + const message = `[composition/container-border-run] ${diagramType} ${relationCollection}[${hit.relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" follows ${frameKind} "${frameIdentity}" ${hit.side} border for ${length}px on segment ${hit.segmentIndex} [${from}] -> [${to}] — ${hint}.`; recordDiagnostic({ code: 'composition/container-border-run', severity: 'error', @@ -749,7 +955,7 @@ export function cleanBorderRunProblems({ from: hit.overlapStart, to: hit.overlapEnd, }, - supportedFixes: [routeHint], + supportedFixes: [hint], }); return message; }); @@ -878,7 +1084,8 @@ export function cleanRouteRhythmProblems({ const rule = hit.code === 'composition/micro-segment' ? `is below the ${microSegmentPx}px micro-segment floor` : `is below the ${interiorSegmentPx}px interior-segment floor`; - const message = `[${hit.code}] showcase ${diagramType} ${relationCollection}[${hit.relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" has a ${length}px ${hit.position} segment ${hit.segmentIndex} [${from}] -> [${to}] that ${rule} — ${routeHint}.`; + const hint = rePlanHint([relation], routeHint); + const message = `[${hit.code}] showcase ${diagramType} ${relationCollection}[${hit.relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" has a ${length}px ${hit.position} segment ${hit.segmentIndex} [${from}] -> [${to}] that ${rule} — ${hint}.`; recordDiagnostic({ code: hit.code, severity: 'error', @@ -892,7 +1099,7 @@ export function cleanRouteRhythmProblems({ from: hit.start, to: hit.end, }, - supportedFixes: [routeHint], + supportedFixes: [hint], }); return message; }); @@ -921,7 +1128,8 @@ export function cleanLabelRouteClearanceProblems({ const clearance = Math.round(hit.clearance * 10) / 10; const from = hit.start.map((value) => Math.round(value * 10) / 10).join(', '); const to = hit.end.map((value) => Math.round(value * 10) / 10).join(', '); - const message = `[composition/label-route-clearance] showcase ${diagramType} label "${hit.label?.label || hit.labelRelation?.label || ''}" on ${describe(hit.labelRelation, hit.labelRelationIndex)} is ${clearance}px from ${describe(hit.otherRelation, hit.otherRelationIndex)} segment ${hit.segmentIndex} [${from}] -> [${to}] (label rect ${formatRect(hit.rect)}; minimum ${threshold}px) — ${routeHint}.`; + const hint = rePlanHint([hit.labelRelation, hit.otherRelation], routeHint); + const message = `[composition/label-route-clearance] showcase ${diagramType} label "${hit.label?.label || hit.labelRelation?.label || ''}" on ${describe(hit.labelRelation, hit.labelRelationIndex)} is ${clearance}px from ${describe(hit.otherRelation, hit.otherRelationIndex)} segment ${hit.segmentIndex} [${from}] -> [${to}] (label rect ${formatRect(hit.rect)}; minimum ${threshold}px) — ${hint}.`; recordDiagnostic({ code: 'composition/label-route-clearance', severity: 'error', @@ -937,7 +1145,113 @@ export function cleanLabelRouteClearanceProblems({ from: hit.start, to: hit.end, }, - supportedFixes: [routeHint], + supportedFixes: [hint], + }); + return message; + }); +} + +// How far [start, start + size) leaves [0, extent), per end of one axis. This +// is the single definition of "inside the canvas" that both the containment +// rule and the repair hints measure against; an unknown extent bounds nothing. +function axisCanvasOverflow(start, size, extent, origin = 0) { + if (!Number.isFinite(extent)) return { start: 0, end: 0 }; + return { start: origin - start, end: start + size - (origin + extent) }; +} + +// THE CANVAS CONTAINMENT RATIONALE (referenced from the other call sites). +// +// The SVG canvas clips whatever leaves the viewBox, so an edge label that +// overhangs an edge ships as truncated text while every post-render check on +// the emitted markup still passes: clipped text is still well-formed markup. +// Renderers with a fixed canvas already bound their nodes, lanes, and legends +// against it; edge label rects were the exception. +// +// Not applied to readable-v2 workflows: that compiler grows its canvas around +// pinned label rects and rejects an authored viewBox that cannot hold the +// result, so the only gap growth cannot close is the origin its own rule +// already guards. Architecture's auto canvas grows the same way, which leaves +// this rule reporting authored viewBoxes and the origin side. +// +// Showcase only: a standard document authored before the rule exists may +// overhang by a few pixels, and failing it there would break compatibility +// instead of repairing a diagram. +export function collectLabelCanvasOverflow({ labels, viewBox, tolerance = 0.5 }) { + // Renderers author origin-zero canvases (meta.viewBox is [width, height] by + // schema), but `check` re-measures foreign artifacts whose SVG viewBox may + // carry a legal non-zero min-x/min-y; those pass all four numbers. + const box = asArray(viewBox); + const [originX, originY, canvasWidth, canvasHeight] = box.length === 4 ? box : [0, 0, box[0], box[1]]; + if (!isFinitePoint(originX, originY, canvasWidth, canvasHeight)) return []; + const hits = []; + for (const [fallbackIndex, label] of asArray(labels).entries()) { + const rect = label?.rect || label; + if (!rect || !isFinitePoint(rect.x, rect.y, rect.width, rect.height)) continue; + // `check` parses foreign markup, so a malformed negative-size rect is + // skipped like the other label collectors do — its flipped interval would + // otherwise read as contained. + if (rect.width < 0 || rect.height < 0) continue; + const horizontal = axisCanvasOverflow(rect.x, rect.width, canvasWidth, originX); + const vertical = axisCanvasOverflow(rect.y, rect.height, canvasHeight, originY); + const overflow = { + left: horizontal.start, + right: horizontal.end, + top: vertical.start, + bottom: vertical.end, + }; + const sides = Object.keys(overflow).filter((side) => overflow[side] > tolerance); + if (!sides.length) continue; + hits.push({ + label, + relation: label?.relation, + relationIndex: Number.isInteger(label?.relationIndex) ? label.relationIndex : fallbackIndex, + rect, + viewBox: [canvasWidth, canvasHeight], + viewBoxOrigin: [originX, originY], + sides, + overflowPx: Object.fromEntries(sides.map((side) => [side, Math.round(overflow[side] * 10) / 10])), + tolerance, + }); + } + return hits; +} + +export function describeLabelCanvasOverflow(hit) { + return hit.sides.map((side) => `${side} edge by ${hit.overflowPx[side]}px`).join(' and '); +} + +export function cleanLabelCanvasContainmentProblems({ + labels, + viewBox, + diagramType, + relationCollection, + profile, + profileIsAuthoritative = false, + routeHint = 'adjust labelAt, labelDx, labelDy, or labelSegment; otherwise enlarge meta.viewBox', + // Label widths are estimated from the text, not measured, so sub-pixel + // overhang is rounding noise rather than a visible truncation. + tolerance = 0.5, +}) { + if (qualityProfileForGate(profile, profileIsAuthoritative) !== 'showcase') return []; + return collectLabelCanvasOverflow({ labels, viewBox, tolerance }).map((hit) => { + const relation = hit.relation; + const relationId = relation?.id ? ` id "${relation.id}"` : ''; + const labelText = hit.label?.label || relation?.label || ''; + const hint = rePlanHint([relation], routeHint); + const message = `[composition/label-canvas-containment] showcase ${diagramType} label "${labelText}" on ${relationCollection}[${hit.relationIndex}]${relationId} "${relation?.from}" -> "${relation?.to}" extends past the ${describeLabelCanvasOverflow(hit)} (label rect ${formatRect(hit.rect)}; viewBox ${hit.viewBox[0]}x${hit.viewBox[1]}) — ${hint}.`; + recordDiagnostic({ + code: 'composition/label-canvas-containment', + severity: 'error', + message, + subject: relationshipSubject(diagramType, relationCollection, hit.relationIndex, relation), + evidence: { + label: labelText, + labelRect: { x: hit.rect.x, y: hit.rect.y, width: hit.rect.width, height: hit.rect.height }, + viewBox: hit.viewBox, + overflowPx: hit.overflowPx, + tolerancePx: hit.tolerance, + }, + supportedFixes: [hint], }); return message; }); @@ -963,18 +1277,54 @@ function segmentPosition(index, segmentCount) { return 'interior'; } +// Normalizing a route is pure, and the same route array is normalized again by +// every predicate that inspects it. Keyed by the array itself, so a rebuilt +// route simply gets a new entry. The result's outer array is frozen. Callers +// must also treat input arrays and their coordinate pairs as immutable, since +// edits in place cannot invalidate this identity-based cache. +const NORMALIZED_ROUTE_POINTS = new WeakMap(); + +// Assembling a route from an anchor, corridor points and an anchor is the same +// normalization without the intermediate array, and the result is seeded in the +// cache so later predicates do not normalize it again. +export function joinRoutePoints(start, via, end) { + const normalized = []; + const accept = (point) => { + if (!Array.isArray(point) || point.length !== 2 || !isFinitePoint(point[0], point[1])) return; + const previous = normalized.at(-1); + if (previous + && Math.abs(point[0] - previous[0]) <= 0.0001 + && Math.abs(point[1] - previous[1]) <= 0.0001) return; + while (normalized.length >= 2 && collinearForward(normalized.at(-2), normalized.at(-1), point)) normalized.pop(); + normalized.push(point); + }; + accept(start); + for (const point of Array.isArray(via) ? via : []) accept(point); + accept(end); + Object.freeze(normalized); + NORMALIZED_ROUTE_POINTS.set(normalized, normalized); + return normalized; +} + export function normalizeRoutePoints(points) { - const finite = asArray(points).filter((point) => Array.isArray(point) && point.length === 2 && isFinitePoint(...point)); - const deduped = []; - for (const point of finite) { - const previous = deduped.at(-1); - if (!previous || Math.abs(point[0] - previous[0]) > 0.0001 || Math.abs(point[1] - previous[1]) > 0.0001) deduped.push(point); + if (Array.isArray(points)) { + const cached = NORMALIZED_ROUTE_POINTS.get(points); + if (cached) return cached; } const normalized = []; - for (const point of deduped) { + for (const point of Array.isArray(points) ? points : []) { + if (!Array.isArray(point) || point.length !== 2 || !isFinitePoint(point[0], point[1])) continue; + const previous = normalized.at(-1); + if (previous + && Math.abs(point[0] - previous[0]) <= 0.0001 + && Math.abs(point[1] - previous[1]) <= 0.0001) continue; while (normalized.length >= 2 && collinearForward(normalized.at(-2), normalized.at(-1), point)) normalized.pop(); normalized.push(point); } + if (Array.isArray(points)) { + Object.freeze(normalized); + NORMALIZED_ROUTE_POINTS.set(points, normalized); + } return normalized; } @@ -984,13 +1334,17 @@ function pointRectDistance(point, rect) { return Math.hypot(dx, dy); } -function pointSegmentDistance(point, start, end) { +function pointSegmentDistanceXY(px, py, start, end) { const dx = end[0] - start[0]; const dy = end[1] - start[1]; const lengthSquared = dx * dx + dy * dy; - if (lengthSquared <= 0.0000001) return Math.hypot(point[0] - start[0], point[1] - start[1]); - const projection = Math.max(0, Math.min(1, ((point[0] - start[0]) * dx + (point[1] - start[1]) * dy) / lengthSquared)); - return Math.hypot(point[0] - (start[0] + projection * dx), point[1] - (start[1] + projection * dy)); + if (lengthSquared <= 0.0000001) return Math.hypot(px - start[0], py - start[1]); + const t = Math.max(0, Math.min(1, ((px - start[0]) * dx + (py - start[1]) * dy) / lengthSquared)); + return Math.hypot(px - (start[0] + t * dx), py - (start[1] + t * dy)); +} + +function pointSegmentDistance(point, start, end) { + return pointSegmentDistanceXY(point[0], point[1], start, end); } function collinearForward(a, b, c) { @@ -998,7 +1352,7 @@ function collinearForward(a, b, c) { return (b[0] - a[0]) * (c[0] - b[0]) + (b[1] - a[1]) * (c[1] - b[1]) >= -0.0001; } -function frameBorderSegments(frame) { +export function frameBorderSegments(frame) { if (!frame || typeof frame !== 'object') return []; if (frame.shape === 'line') { const start = frame.start || [frame.x1, frame.y1]; @@ -1062,7 +1416,7 @@ function collinearAxisOverlap(a, b, c, d) { }; } -function properSegmentIntersection(a, b, c, d) { +export function properSegmentIntersection(a, b, c, d) { const abC = crossProduct(a, b, c); const abD = crossProduct(a, b, d); const cdA = crossProduct(c, d, a); @@ -1154,48 +1508,65 @@ export function automaticPortRhythmBridge( const toVector = PORT_OUTWARD_VECTOR[toSide]; if (!fromVector || !toVector) return null; - const startStub = [ - start[0] + fromVector[0] * endpointStubPx, - start[1] + fromVector[1] * endpointStubPx, - ]; - const endStub = [ - end[0] + toVector[0] * endpointStubPx, - end[1] + toVector[1] * endpointStubPx, - ]; + const opposedFacingGap = ( + (fromSide === 'right' && toSide === 'left' && end[0] > start[0]) + || (fromSide === 'left' && toSide === 'right' && start[0] > end[0]) + ) ? Math.abs(end[0] - start[0]) : ( + (fromSide === 'bottom' && toSide === 'top' && end[1] > start[1]) + || (fromSide === 'top' && toSide === 'bottom' && start[1] > end[1]) + ) ? Math.abs(end[1] - start[1]) : null; + const boundedStubPx = opposedFacingGap != null + && opposedFacingGap - endpointStubPx * 2 < interiorSegmentPx + ? Math.max(8, Math.min(endpointStubPx, (opposedFacingGap - interiorSegmentPx) / 2)) + : null; + const stubDistances = [endpointStubPx]; + if (boundedStubPx != null && boundedStubPx >= 8 && boundedStubPx !== endpointStubPx) { + stubDistances.push(boundedStubPx); + } const candidates = []; const verticalSides = new Set(['top', 'bottom']); const horizontalSides = new Set(['left', 'right']); - if (verticalSides.has(fromSide) && verticalSides.has(toSide) - && Math.abs(start[0] - end[0]) < interiorSegmentPx) { - for (const channelX of [ - Math.max(start[0], end[0]) + interiorSegmentPx, - Math.min(start[0], end[0]) - interiorSegmentPx, - ]) { - candidates.push([ - start, - startStub, - [channelX, startStub[1]], - [channelX, endStub[1]], - endStub, - end, - ]); + for (const stubPx of stubDistances) { + const startStub = [ + start[0] + fromVector[0] * stubPx, + start[1] + fromVector[1] * stubPx, + ]; + const endStub = [ + end[0] + toVector[0] * stubPx, + end[1] + toVector[1] * stubPx, + ]; + if (verticalSides.has(fromSide) && verticalSides.has(toSide) + && Math.abs(start[0] - end[0]) < interiorSegmentPx) { + for (const channelX of [ + Math.max(start[0], end[0]) + interiorSegmentPx, + Math.min(start[0], end[0]) - interiorSegmentPx, + ]) { + candidates.push([ + start, + startStub, + [channelX, startStub[1]], + [channelX, endStub[1]], + endStub, + end, + ]); + } } - } - if (horizontalSides.has(fromSide) && horizontalSides.has(toSide) - && Math.abs(start[1] - end[1]) < interiorSegmentPx) { - for (const channelY of [ - Math.max(start[1], end[1]) + interiorSegmentPx, - Math.min(start[1], end[1]) - interiorSegmentPx, - ]) { - candidates.push([ - start, - startStub, - [startStub[0], channelY], - [endStub[0], channelY], - endStub, - end, - ]); + if (horizontalSides.has(fromSide) && horizontalSides.has(toSide) + && Math.abs(start[1] - end[1]) < interiorSegmentPx) { + for (const channelY of [ + Math.max(start[1], end[1]) + interiorSegmentPx, + Math.min(start[1], end[1]) - interiorSegmentPx, + ]) { + candidates.push([ + start, + startStub, + [startStub[0], channelY], + [endStub[0], channelY], + endStub, + end, + ]); + } } } @@ -1211,7 +1582,7 @@ export function automaticPortRhythmBridge( // Keep conservative auto-routed fan-out/fan-in relationships visually // distinct without changing authored route controls. The returned map only // contains endpoints that belong to a shared automatic midpoint anchor. -export function automaticPortSpread(relations, boxes, { gutter = 16, maxSpacing = 14, sideFor } = {}) { +export function automaticPortSpread(relations, boxes, { gutter = 16, maxSpacing = 14, sideFor, spacingFor } = {}) { const groups = new Map(); const spread = new Map(); @@ -1257,8 +1628,22 @@ export function automaticPortSpread(relations, boxes, { gutter = 16, maxSpacing const spacing = Math.min(maxSpacing, usable / (items.length - 1)); if (!(spacing > 0)) continue; + // Width-aware callers reserve the whole group together. Moving a single + // port around the legacy 14px slots can wrongly report a full side while + // its still-unrouted neighbours could have fitted farther apart. + let offsets; + if (spacingFor) { + const gaps = items.slice(1).map((item, index) => Math.max(maxSpacing, + spacingFor(items[index].relation, item.relation))); + const span = gaps.reduce((sum, gap) => sum + gap, 0); + if (span <= usable && gaps.some((gap) => gap > maxSpacing)) { + let offset = -span / 2; + offsets = [offset, ...gaps.map((gap) => (offset += gap))]; + } + } + for (const [index, item] of items.entries()) { - const offset = (index - (items.length - 1) / 2) * spacing; + const offset = offsets?.[index] ?? (index - (items.length - 1) / 2) * spacing; const point = anchor(item.rect, item.side); if (verticalSide) point[1] += offset; else point[0] += offset; @@ -1271,14 +1656,37 @@ export function automaticPortSpread(relations, boxes, { gutter = 16, maxSpacing return spread; } +// A centre delta on the horizontal axis does not by itself mean the route +// leaves sideways: a hub above an offset spoke has both a horizontal and a +// larger vertical delta, and the router draws the vertical dogleg. Compare the +// deltas so the inferred side matches the axis the route actually uses. Equal +// deltas select horizontal sides; dx === 0 preserves the previous vertical +// result, while a vertical-dominant nonzero dx selects vertical sides. export function defaultFromSide(from, to) { + const dx = to.cx - from.cx; + const dy = to.cy - from.cy; + if (dx !== 0 && Math.abs(dx) >= Math.abs(dy)) return dx < 0 ? 'left' : 'right'; + return dy > 0 ? 'bottom' : 'top'; +} + +export function defaultToSide(from, to) { + const dx = to.cx - from.cx; + const dy = to.cy - from.cy; + if (dx !== 0 && Math.abs(dx) >= Math.abs(dy)) return dx < 0 ? 'right' : 'left'; + return dy > 0 ? 'top' : 'bottom'; +} + +// Non-architecture renderers retain their established horizontal-first +// endpoint contract. Architecture opts into dominant-axis inference above so +// a vertical hub-and-spoke route can use perpendicular automatic ports. +export function legacyDefaultFromSide(from, to) { if (to.cx < from.cx) return 'left'; if (to.cx > from.cx) return 'right'; if (to.cy > from.cy) return 'bottom'; return 'top'; } -export function defaultToSide(from, to) { +export function legacyDefaultToSide(from, to) { if (to.cx < from.cx) return 'right'; if (to.cx > from.cx) return 'left'; if (to.cy > from.cy) return 'top'; @@ -1300,6 +1708,16 @@ export function routePointsValue(points) { .join(';'); } +// Only a direct, explicitly authored diagonal needs an artifact-check exception. +// Nonempty via takes precedence; empty via adds no intermediate geometry. +export function authoredStraightRouteAttrs(relation, points) { + if (relation.route !== 'straight' || relation.via?.length || points.length !== 2) return ''; + const [start, end] = points; + return Math.abs(start[0] - end[0]) > 0.01 && Math.abs(start[1] - end[1]) > 0.01 + ? ' data-composition-route="straight"' + : ''; +} + export function roundedPath(points, radius) { if (points.length < 3 || radius <= 0) { return polylinePath(points); @@ -1370,38 +1788,138 @@ export const arrowClassMap = { dashed: ['a-dashed', 'arrowhead-dashed'] }; -// Label accent per edge variant. Workflow colors dashed (async trace) labels -// like the trace store it points at; the other renderers use the bus color. -export function variantAccent(variant, { dashed = 't-messagebus' } = {}) { +// Structural phase/group accents retain their existing semantic colors. +export function variantAccent(variant) { + return variant === 'security' ? 't-security' + : variant === 'emphasis' ? 't-backend' + : variant === 'dashed' ? 't-messagebus' : 't-muted'; +} + +// Relationship labels use the same theme token as their path. Keep this map +// edge-specific: node-kind text colors only coincide with some path colors in +// the classic preset and must not define the relationship's visual meaning. +export function edgeLabelAccent(variant) { return variant === 'security' - ? 't-security' + ? 't-edge-security' : variant === 'emphasis' - ? 't-backend' + ? 't-edge-emphasis' : variant === 'dashed' - ? dashed - : 't-muted'; + ? 't-edge-dashed' + : 't-edge-default'; } export function formatRect(r) { return `[${Math.round(r.x)}, ${Math.round(r.y)}, ${Math.round(r.width)}, ${Math.round(r.height)}]`; } -function formatDelta(n) { - const v = Math.round(n); - return v >= 0 ? `+${v}` : String(v); +function formatValue(n) { + return String(Math.round(n)); } -/** Actionable hint when an edge label rect hits a node/component box (#7). */ -export function suggestLabelObstacleFix(labelRect, lx, ly, obstacle, obstacleKind = 'component') { - const lxR = Math.round(lx); - const lyR = Math.round(ly); - const belowY = Math.round(obstacle.y + obstacle.height + 14); - const aboveY = Math.round(obstacle.y - 4); - return [ +// A label anchor is the text origin, so keeping a suggestion on the canvas +// means moving the whole rect: offset is `rect - anchor` on that axis. +function anchorFitsCanvas(anchorValue, offset, size, extent) { + const overflow = axisCanvasOverflow(anchorValue + offset, size, extent); + return overflow.start <= 0 && overflow.end <= 0; +} + +// Suggestions are emitted as integers, so the real-valued bounds are tightened +// inward with ceil/floor first: every integer between them keeps the whole rect +// on the canvas, which a bound like 616.7 would not. Returns null when the rect +// is wider than the canvas and no anchor can contain it. +function clampAnchorToCanvas(anchorValue, offset, size, extent) { + const rounded = Math.round(anchorValue); + if (!Number.isFinite(extent)) return rounded; + const min = Math.ceil(-offset); + const max = Math.floor(extent - size - offset); + return max < min ? null : Math.min(Math.max(rounded, min), max); +} + +/** + * Actionable hint when an edge label rect hits a node/component box (#7). + * Every suggested value is a replacement for the authored field, not an + * increment, and has to survive being applied to the document: + * - the absolute form is nudged along x so the rect stays on the canvas, and a + * vertical placement that cannot fit is dropped rather than clamped, since + * clamping it back would push the label onto the obstacle it must clear; + * - the relative form is offered only when labelDx/labelDy actually move this + * label (labelPoint returns an authored labelAt as-is) and only when the + * replacements, computed from the document's own labelDx/labelDy, land the + * rect inside the canvas. + * The authored values therefore come from `labelRect.relation`, the authored + * relationship the renderer already attaches to every label record. + * `obstacles` is every box the callers' own overlap loop tests (defaults to + * the named obstacle alone): a placement that merely traded the named obstacle + * for its neighbor would fail the same rule again when applied. + */ +export function suggestLabelObstacleFix(labelRect, lx, ly, obstacle, obstacleKind = 'component', viewBox, obstacles) { + // Renderer canvases are origin-zero [width, height] by schema, but read a + // 4-number [min-x, min-y, width, height] the same way the containment + // collector does — degraded no-ajv runs must not clamp against the origin + // pair as if it were the canvas size. + const box = asArray(viewBox); + const [canvasWidth, canvasHeight] = box.length === 4 ? box.slice(2) : box; + const xOffset = labelRect.x - lx; + const yOffset = labelRect.y - ly; + const anchorX = clampAnchorToCanvas(lx, xOffset, labelRect.width, canvasWidth); + // The placement anchors are derived from the label's own rect, not from the + // obstacle alone: an obstacle-only "above" anchor assumes the 14px + // single-line rect and lands a 27px two-line rect (dataflow classification, + // lifecycle note) back on the obstacle it must clear. The overlap filter + // uses the callers' own detection call, so a surviving hint cannot re-raise + // the problem it repairs. + const blockers = obstacles ? [...obstacles] : [obstacle]; + const placements = [ + { name: 'below', y: Math.round(obstacle.y + obstacle.height + 4 - yOffset) }, + { name: 'above', y: Math.round(obstacle.y - 4 - labelRect.height - yOffset) }, + ].filter(({ y }) => anchorX !== null + && anchorFitsCanvas(y, yOffset, labelRect.height, canvasHeight) + && blockers.every((blocker) => !rectsOverlap( + { x: anchorX + xOffset, y: y + yOffset, width: labelRect.width, height: labelRect.height }, + blocker, + -2, + ))); + const lines = [ ` label rect: ${formatRect(labelRect)}`, ` ${obstacleKind} "${obstacle.id}" rect: ${formatRect(obstacle)}`, - ` Suggested fix: labelAt [${lxR}, ${belowY}] or labelDy ${formatDelta(belowY - lyR)} (below); or labelAt [${lxR}, ${aboveY}] or labelDy ${formatDelta(aboveY - lyR)} (above)`, - ].join('\n'); + ]; + if (!placements.length) { + // Only the vertical slots beside the named obstacle were tried, so an + // unclaimed spot elsewhere may still exist — never assert that none does. + lines.push(anchorX === null + ? ` Suggested fix: the ${Math.round(labelRect.width)}px label rect cannot fit the ${canvasWidth}x${canvasHeight} viewBox at any anchor — shorten the label or enlarge meta.viewBox` + : ` Suggested fix: no placement directly above or below "${obstacle.id}" stays clear inside the ${canvasWidth}x${canvasHeight} viewBox — move the label to an open area with labelAt, shorten the label, move the ${obstacleKind}, or enlarge meta.viewBox`); + return lines.join('\n'); + } + const authored = labelRect.relation || {}; + const authoredDx = Number.isFinite(authored.labelDx) ? authored.labelDx : 0; + const authoredDy = Number.isFinite(authored.labelDy) ? authored.labelDy : 0; + const relativeHint = (y) => { + if (Array.isArray(authored.labelAt)) return null; + // Both replacements are measured from the automatic label point that the + // authored offsets are applied to, and against the unrounded anchor: a + // rounded base would shift the applied label by up to a pixel. + const dx = Math.round(authoredDx + anchorX - lx); + const dy = Math.round(authoredDy + y - ly); + // labelDx is authored as a number, so an authored fraction must not read as + // a needed nudge once the replacement is rounded to an integer. + const movesX = Math.abs(dx - authoredDx) >= 0.5; + const landsAtX = lx - authoredDx + (movesX ? dx : authoredDx); + const landsAtY = ly - authoredDy + dy; + if (!anchorFitsCanvas(landsAtX, xOffset, labelRect.width, canvasWidth)) return null; + if (!anchorFitsCanvas(landsAtY, yOffset, labelRect.height, canvasHeight)) return null; + return movesX + ? `set labelDx ${formatValue(dx)} with labelDy ${formatValue(dy)}` + : `set labelDy ${formatValue(dy)}`; + }; + const hint = placements + .map(({ name, y }) => { + const relative = relativeHint(y); + return `set labelAt [${anchorX}, ${y}]${relative ? ` or ${relative}` : ''} (${name})`; + }) + .join('; or '); + lines.push(` Suggested fix: ${hint}`); + return lines.join('\n'); } /** Hint when two edge labels collide. */ diff --git a/packages/diagram-core/vendor/archify/renderers/shared/i18n.mjs b/packages/diagram-core/vendor/archify/renderers/shared/i18n.mjs index 28e9d02..09f3879 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/i18n.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/i18n.mjs @@ -8,7 +8,7 @@ export function escapeHtml(value) { } // One catalog feeds renderer-time SVG/HTML copy and the selected runtime -// catalog embedded in each standalone artifact. Keeping every locale in one +// catalog embedded in each standalone artifact. Keeping both built-in locales in one // tuple makes missing translations impossible to hide behind an English // fallback during development. const MESSAGE_PAIRS = { @@ -41,24 +41,25 @@ const MESSAGE_PAIRS = { 'legend.workflow.database': ['Context / trace', '上下文 / 追踪'], 'legend.workflow.cloud': ['Cloud service', '云服务'], 'legend.workflow.external': ['External system', '外部系统'], - 'legend.sequence.emphasis': ['request', '请求'], + 'legend.sequence.emphasis': ['main request', '主路径请求'], 'legend.sequence.return': ['return', '返回'], 'legend.sequence.security': ['security', '安全'], 'legend.sequence.dashed': ['async trace', '异步追踪'], - 'legend.sequence.default': ['default message', '默认消息'], + 'legend.sequence.default': ['message', '普通消息'], 'legend.dataflow.emphasis': ['primary data', '主要数据'], 'legend.dataflow.security': ['policy / PII', '策略 / PII'], 'legend.dataflow.dashed': ['async batch', '异步批处理'], 'legend.dataflow.database': ['data store', '数据存储'], 'legend.dataflow.default': ['data flow', '数据流'], - 'legend.lifecycle.start': ['start', '开始'], - 'legend.lifecycle.active': ['active state', '活动状态'], + 'legend.lifecycle.start': ['initial state', '起点'], + 'legend.lifecycle.active': ['active', '进行中'], 'legend.lifecycle.waiting': ['waiting', '等待'], 'legend.lifecycle.decision': ['decision', '决策'], - 'legend.lifecycle.success': ['terminal success', '成功终态'], + 'legend.lifecycle.success': ['success', '成功'], 'legend.lifecycle.failure': ['failure / exit', '失败 / 退出'], 'legend.lifecycle.neutral': ['neutral', '中性状态'], 'legend.lifecycle.external': ['external', '外部状态'], + 'legend.lifecycle.final': ['final state', '终态'], 'viewer.kind.frontend': ['Frontend', '前端'], 'viewer.kind.backend': ['Backend', '后端'], @@ -86,7 +87,7 @@ const MESSAGE_PAIRS = { 'viewer.preset.style': ['Style', '风格'], 'viewer.preset.menu': ['Visual style', '视觉风格'], 'viewer.preset.identity': ['Visual identity', '视觉表达'], - 'viewer.preset.cycles': ['S cycles', 'S 循环切换'], + 'viewer.preset.cycles': ['to cycle', '循环切换'], 'viewer.preset.classic': ['Classic', '经典'], 'viewer.preset.classic.short': ['Classic', '经典'], 'viewer.preset.classic.hint': ['Stable technical default', '稳定的技术默认风格'], @@ -110,10 +111,6 @@ const MESSAGE_PAIRS = { 'viewer.motion.hidden': ['Motion paused while this page is hidden', '页面不可见时已暂停动效'], 'viewer.motion.yielding': ['Pause motion; currently yielding to {owner}', '暂停动效;当前让位于{owner}'], 'viewer.motion.yielding.title': ['Live preview enabled · yielding to {owner}', '动态预览已启用 · 正在让位于{owner}'], - 'viewer.owner.story': ['the guided story', '引导故事'], - 'viewer.owner.chapter': ['the active chapter', '当前章节'], - 'viewer.owner.chapterPreview': ['the chapter delta preview', '章节差异预览'], - 'viewer.owner.handoff': ['the chapter handoff', '章节交接'], 'viewer.owner.route': ['Route Probe', '路径探测'], 'viewer.owner.lens': ['Semantic Lens', '语义透镜'], 'viewer.owner.relationship': ['Relationship Preview', '关系预览'], @@ -137,7 +134,6 @@ const MESSAGE_PAIRS = { 'viewer.export.shareCard': ['Share Card', '分享卡片'], 'viewer.export.routeShareCard': ['Route Share Card', '路径分享卡片'], 'viewer.export.reachShareCard': ['Reach Share Card', '可达范围分享卡片'], - 'viewer.export.copyShareCard': ['Copy Share Card', '复制分享卡片'], 'viewer.export.copyDiagram': ['Copy diagram', '复制图表'], 'viewer.export.clipboardPng': ['PNG to clipboard', '复制 PNG 到剪贴板'], 'viewer.export.raster': ['Raster images', '位图'], @@ -148,10 +144,15 @@ const MESSAGE_PAIRS = { 'viewer.export.vectorMotion': ['Vector and motion', '矢量与动效'], 'viewer.export.vectorMotion.heading': ['Vector & motion', '矢量与动效'], 'viewer.export.editable': ['Editable vector', '可编辑矢量图'], + 'viewer.export.svg.auto': ['SVG · Auto', 'SVG · 自动'], + 'viewer.export.svg.auto.hint': ['Matches host theme', '匹配宿主主题'], + 'viewer.export.svg.light': ['SVG · Light', 'SVG · 浅色'], + 'viewer.export.svg.light.hint': ['Always light', '始终浅色'], + 'viewer.export.svg.dark': ['SVG · Dark', 'SVG · 深色'], + 'viewer.export.svg.dark.hint': ['Always dark', '始终深色'], 'viewer.export.motion6s': ['6s motion', '6 秒动效'], 'viewer.export.unsupported': ['Not supported by this browser', '当前浏览器不支持'], 'viewer.export.clipboardUnsupported': ['Clipboard image write not supported by this browser', '当前浏览器不支持写入图片剪贴板'], - 'viewer.export.clipboardUnsupported.period': ['Clipboard image write not supported by this browser.', '当前浏览器不支持写入图片剪贴板。'], 'viewer.export.clipboardUnsupported.short': ['Clipboard image write not supported in this browser.', '此浏览器不支持写入图片剪贴板。'], 'viewer.export.motionUnavailable': ['Motion capture unavailable in this browser', '当前浏览器无法录制动效'], 'viewer.export.webmUnavailable': ['WebM unavailable in this browser', '当前浏览器不支持 WebM'], @@ -164,14 +165,12 @@ const MESSAGE_PAIRS = { 'viewer.export.reachFailed': ['Reach Share Card export failed: {message}', '可达范围分享卡片导出失败:{message}'], 'viewer.export.copyFailed': ['Copy failed: {message}', '复制失败:{message}'], 'viewer.export.copiedPng': ['Copied PNG to clipboard', '已将 PNG 复制到剪贴板'], - 'viewer.export.copiedShare': ['Copied Share Card', '已复制分享卡片'], - 'viewer.export.downloadedShare': ['Downloaded Share Card', '已下载分享卡片'], 'viewer.export.downloadedRoute': ['Downloaded Route Share Card', '已下载路径分享卡片'], 'viewer.export.downloadedReach': ['Downloaded Reach Share Card', '已下载可达范围分享卡片'], 'viewer.export.downloadedWebm': ['Downloaded WebM', '已下载 WebM'], 'viewer.export.recording': ['Recording 6 seconds of motion…', '正在录制 6 秒动效…'], - 'viewer.export.card.routeSummary.one': ['Route: {source} → {target} · {count} directed hop', '路径:{source} → {target} · {count} 个有向跳转'], - 'viewer.export.card.routeSummary.other': ['Route: {source} → {target} · {count} directed hops', '路径:{source} → {target} · {count} 个有向跳转'], + 'viewer.export.card.routeSummary.one': ['Path: {source} → {target} · {count} step', '路径:{source} → {target} · {count} 步'], + 'viewer.export.card.routeSummary.other': ['Path: {source} → {target} · {count} steps', '路径:{source} → {target} · {count} 步'], 'viewer.export.card.reachSummary': ['Authored {direction} from {origin} · {nodes} · {links} · max {hops}', '从{origin}开始的编写{direction} · {nodes} · {links} · 最深 {hops}'], 'viewer.export.card.node.one': ['{count} node', '{count} 个节点'], 'viewer.export.card.node.other': ['{count} nodes', '{count} 个节点'], @@ -181,7 +180,6 @@ const MESSAGE_PAIRS = { 'viewer.export.card.hop.other': ['{count} hops', '{count} 跳'], 'viewer.export.card.routeBadge': ['ARCHIFY · ROUTE · {hops}', 'ARCHIFY · 路径 · {hops}'], 'viewer.export.card.reachBadge': ['ARCHIFY · {direction} REACH', 'ARCHIFY · {direction}可达范围'], - 'viewer.export.card.defaultBadge': ['ARCHIFY · {preset} · {theme}', 'ARCHIFY · {preset} · {theme}'], 'viewer.export.direction.upstream': ['Upstream', '上游'], 'viewer.export.direction.downstream': ['Downstream', '下游'], 'viewer.export.error.canvasUnavailable': ['Canvas unavailable for {label}', '无法为{label}使用画布'], @@ -197,86 +195,8 @@ const MESSAGE_PAIRS = { 'viewer.export.error.emptyWebm': ['MediaRecorder produced an empty WebM', 'MediaRecorder 生成了空的 WebM'], 'viewer.export.error.webmBackground': ['SVG background could not be loaded for WebM export', '无法为 WebM 导出加载 SVG 背景'], - 'viewer.guided.region': ['Guided diagram views', '图表引导视图'], - 'viewer.guided.previous': ['Previous guided view', '上一个引导视图'], - 'viewer.guided.previous.title': ['Previous guided view ([)', '上一个引导视图([)'], - 'viewer.guided.next': ['Next guided view', '下一个引导视图'], - 'viewer.guided.next.title': ['Next guided view (])', '下一个引导视图(])'], - 'viewer.guided.views': ['Guided views', '引导视图'], - 'viewer.guided.explore': ['Explore this system', '探索此系统'], - 'viewer.guided.intro': ['Step through curated paths without changing the source diagram.', '沿精选路径逐步查看,而不改变源图表。'], - 'viewer.guided.trail': ['Story trail', '故事轨迹'], - 'viewer.guided.beat': ['Beat', '节点'], - 'viewer.guided.nextBeat': ['Next', '下一步'], - 'viewer.guided.play': ['Play guided story', '播放引导故事'], - 'viewer.guided.play.title': ['Play guided story (P)', '播放引导故事(P)'], - 'viewer.guided.pause': ['Pause guided story', '暂停引导故事'], - 'viewer.guided.pause.title': ['Pause guided story (P)', '暂停引导故事(P)'], - 'viewer.guided.replay': ['Replay guided story', '重播引导故事'], - 'viewer.guided.replay.title': ['Replay guided story (P)', '重播引导故事(P)'], - 'viewer.guided.playStory': ['Play story', '播放故事'], - 'viewer.guided.pauseStory': ['Pause', '暂停'], - 'viewer.guided.replayStory': ['Replay story', '重播故事'], - 'viewer.guided.motionUnavailable': ['Story playback unavailable while motion is Still', '静态模式下无法播放故事'], - 'viewer.guided.enableMotion': ['Switch motion to Live to play the guided story', '切换为动态模式以播放引导故事'], - 'viewer.guided.selectBeatLink': ['Select a Story Beat to copy its exact link', '选择故事节点以复制其精确链接'], - 'viewer.guided.copyMoment': ['Copy moment', '复制此刻'], - 'viewer.guided.momentCopied': ['Moment link copied', '已复制时刻链接'], - 'viewer.guided.momentCopyFailed': ['Could not copy story moment link', '无法复制故事时刻链接'], - 'viewer.guided.copied': ['Copied', '已复制'], - 'viewer.guided.copyFailed': ['Copy failed', '复制失败'], - 'viewer.guided.showAll': ['Show all', '显示全部'], - 'viewer.guided.showAll.aria': ['Show entire diagram', '显示完整图表'], - 'viewer.guided.chapters': ['Story chapters', '故事章节'], - 'viewer.guided.storyTrail': ['Story trail for {label}: {count} beats', '{label}的故事轨迹:{count} 个节点'], - 'viewer.guided.chapter.open': ['Open chapter {index} of {total}: {label}, {count} stops', '打开第 {index}/{total} 章:{label},{count} 个停靠点'], - 'viewer.guided.chapter.current': ['Current chapter {index} of {total}: {label}, {count} stops', '当前第 {index}/{total} 章:{label},{count} 个停靠点'], - 'viewer.guided.chapter.selectedNodes': ['{count} selected nodes', '已选择 {count} 个节点'], - 'viewer.guided.chapter.stops': ['{count} stops', '{count} 个停靠点'], - 'viewer.guided.chapter.stop.one': ['{count} stop', '{count} 个停靠点'], - 'viewer.guided.chapter.stop.other': ['{count} stops', '{count} 个停靠点'], - 'viewer.guided.chapter.current.title': ['{label} — current chapter, {count} stops', '{label} — 当前章节,{count} 个停靠点'], - 'viewer.guided.chapter.delta.expanded': ['{stay} stay, {enter} enter, {leave} leave', '{stay} 个保留,{enter} 个进入,{leave} 个离开'], - 'viewer.guided.chapter.delta.aria': ['Open chapter {index} of {total}: {label}. Chapter focus delta: {delta}', '打开第 {index}/{total} 章:{label}。章节聚焦差异:{delta}'], - 'viewer.guided.chapter.delta.title': ['{label} — {delta} chapter focus', '{label} — 章节聚焦 {delta}'], - 'viewer.guided.handoff': ['{from} → {to} · via {label}', '{from} → {to} · 经由{label}'], - 'viewer.guided.share.chapter': ['Chapter {index} / {total}', '章节 {index} / {total}'], - 'viewer.guided.share.initial': ['Chapter 01 / 01', '章节 01 / 01'], - 'viewer.guided.share.default': ['Guided chapter', '引导章节'], - 'viewer.guided.state.ready': ['Ready', '就绪'], - 'viewer.guided.state.playing': ['Playing', '播放中'], - 'viewer.guided.state.settled': ['Settled', '已完成'], - 'viewer.guided.state.paused': ['Paused', '已暂停'], - 'viewer.guided.state.pinned': ['Pinned', '已固定'], - 'viewer.guided.state.still': ['Still', '静态'], - 'viewer.guided.share.step': ['Step {index} / {total} · {label}', '步骤 {index} / {total} · {label}'], - 'viewer.guided.share.staticMoment': ['{step} · Static moment', '{step} · 静态时刻'], - 'viewer.guided.share.complete': ['{count} steps complete · {note}', '{count} 个步骤已完成 · {note}'], - 'viewer.guided.share.settled': ['Path settled for reading.', '路径已稳定,可供阅读。'], - 'viewer.guided.share.staticPath': ['{count} steps · Static path', '{count} 个步骤 · 静态路径'], - 'viewer.guided.share.ready': ['{count} steps · Ready', '{count} 个步骤 · 就绪'], - 'viewer.guided.share.aria': ['{state} chapter {index} of {total}: {label}. {beat}. {route}', '{state},第 {index}/{total} 章:{label}。{beat}。{route}'], - 'viewer.guided.beat.start': ['Beat {index} / {total} · {label} · starting point', '节点 {index} / {total} · {label} · 起点'], - 'viewer.guided.beat.forward': ['Beat {index} / {total} · {from} → {to}', '节点 {index} / {total} · {from} → {to}'], - 'viewer.guided.beat.reverse': ['Beat {index} / {total} · {from} → {to} · reverse authored link', '节点 {index} / {total} · {from} → {to} · 反向编写连接'], - 'viewer.guided.beat.multiple': ['Beat {index} / {total} · {from} ⇄ {to} · {count} authored links', '节点 {index} / {total} · {from} ⇄ {to} · {count} 条编写连接'], - 'viewer.guided.beat.group': ['Beat {index} / {total} · {from} · {to} · grouped · no direct link', '节点 {index} / {total} · {from} · {to} · 分组 · 无直接连接'], - 'viewer.guided.beat.aria.prefix': ['Story beat {index} of {total}: {label}. ', '故事节点 {index}/{total}:{label}。'], - 'viewer.guided.beat.aria.start': ['Starting point.', '起点。'], - 'viewer.guided.beat.aria.forward': ['From {from} through one authored forward relationship.', '从{from}经一条正向编写关系到达。'], - 'viewer.guided.beat.aria.reverse': ['From {from}; the authored relationship points from {to} to {from}.', '从{from}出发;编写关系实际由{to}指向{from}。'], - 'viewer.guided.beat.aria.multiple': ['From {from} through {count} authored relationships; shown without arbitrary motion.', '从{from}经 {count} 条编写关系到达;不使用任意动效。'], - 'viewer.guided.beat.aria.group': ['Grouped from {from} with no direct authored relationship.', '与{from}分组展示,没有直接编写关系。'], - 'viewer.guided.caption.start': ['Starting point', '起点'], - 'viewer.guided.caption.grouped': ['Grouped transition · no direct authored link', '分组过渡 · 无直接编写连接'], - 'viewer.guided.caption.more': [' +{count} more', ' +另外 {count} 条'], - 'viewer.guided.caption.reverse': ['Reverse authored relationship', '反向编写关系'], - 'viewer.guided.caption.relationships': ['{count} authored relationships', '{count} 条编写关系'], - 'viewer.guided.caption.relationship': ['Authored relationship', '编写关系'], - 'viewer.guided.caption.direction': ['authored direction: {from} → {to}', '编写方向:{from} → {to}'], - 'viewer.guided.caption.starting': ['Authored starting point', '编写起点'], - 'viewer.guided.beatLink': ['Copy link to current story moment: Beat {index} of {total}: {label}', '复制当前故事时刻链接:第 {index}/{total} 个节点:{label}'], - 'viewer.guided.noStory': ['This diagram has no authored guided story.', '此图表没有编写引导故事。'], + 'viewer.guide.title': ['Explore this system', '探索此系统'], + 'viewer.focus.selectedNodes': ['{count} selected nodes', '已选择 {count} 个节点'], 'viewer.guide.eyebrow': ['Diagram guide', '图表指南'], 'viewer.guide.close': ['Close diagram guide', '关闭图表指南'], @@ -291,8 +211,6 @@ const MESSAGE_PAIRS = { 'viewer.guide.map.hint': ['Open Semantic Radar with a live viewport and stable nodes.', '打开带实时视口和稳定节点的语义雷达。'], 'viewer.guide.lens': ['Compare semantic kinds', '比较语义类型'], 'viewer.guide.lens.hint': ['Count roles, reveal their traffic, and compare direct authored links.', '统计角色、显示流量并比较直接编写的连接。'], - 'viewer.guide.story': ['Play the guided story', '播放引导故事'], - 'viewer.guide.story.hint': ['Walk the authored chapters and real relationships.', '浏览已编写的章节和真实关系。'], 'viewer.guide.present': ['Enter Presentation Stage', '进入演示模式'], 'viewer.guide.present.hint': ['Give the live diagram the viewport without changing export.', '让实时图表占满视口,同时不改变导出。'], 'viewer.guide.shortcuts': ['Additional keyboard shortcuts', '其他键盘快捷键'], @@ -303,18 +221,12 @@ const MESSAGE_PAIRS = { 'viewer.guide.shortcut.zoomIn': ['Zoom in', '放大'], 'viewer.guide.shortcut.zoomOut': ['Zoom out', '缩小'], 'viewer.guide.shortcut.close': ['Close', '关闭'], - 'viewer.guide.facts': ['{nodes} · {relationships} · {views}', '{nodes} · {relationships} · {views}'], + 'viewer.guide.facts': ['{nodes} · {relationships}', '{nodes} · {relationships}'], 'viewer.guide.fact.node.one': ['{count} semantic node', '{count} 个语义节点'], 'viewer.guide.fact.node.other': ['{count} semantic nodes', '{count} 个语义节点'], 'viewer.guide.fact.relationship.one': ['{count} relationship', '{count} 条关系'], 'viewer.guide.fact.relationship.other': ['{count} relationships', '{count} 条关系'], - 'viewer.guide.fact.view.one': ['{count} guided view', '{count} 个引导视图'], - 'viewer.guide.fact.view.other': ['{count} guided views', '{count} 个引导视图'], - 'viewer.guide.story.available.one': ['Walk {count} authored chapter and its real relationships.', '浏览 {count} 个已编写章节及其真实关系。'], - 'viewer.guide.story.available.other': ['Walk {count} authored chapters and their real relationships.', '浏览 {count} 个已编写章节及其真实关系。'], - 'viewer.guide.story.unavailable': ['No authored guided story in this diagram.', '此图表没有编写引导故事。'], 'viewer.guide.open': ['Open diagram guide', '打开图表指南'], - 'viewer.guide.noStory': ['This diagram has no authored guided story.', '此图表没有编写引导故事。'], 'viewer.finder.title': ['Find a node', '查找节点'], 'viewer.finder.close': ['Close node finder', '关闭节点查找器'], @@ -348,6 +260,7 @@ const MESSAGE_PAIRS = { 'viewer.passport.upstream.trace': ['Trace upstream authored reachability', '追踪上游编写可达性'], 'viewer.passport.downstream.trace': ['Trace downstream authored reachability', '追踪下游编写可达性'], 'viewer.passport.close': ['Close semantic passport', '关闭语义护照'], + 'viewer.passport.move': ['Move semantic passport. Drag, use arrow keys, or press Home to reset.', '移动语义护照。可拖动、使用方向键移动,或按 Home 恢复自动位置。'], 'viewer.passport.copy': ['Copy link', '复制链接'], 'viewer.passport.copy.focus': ['Copy link to focused node', '复制聚焦节点的链接'], 'viewer.passport.relations': ['Relations', '关系'], @@ -399,17 +312,17 @@ const MESSAGE_PAIRS = { 'viewer.passport.reach.noDownstream': ['No downstream authored nodes', '没有下游编写节点'], 'viewer.passport.reach.status': ['{direction} · {nodes} nodes · {links} links · max {hops} hops', '{direction} · {nodes} 个节点 · {links} 条连接 · 最深 {hops} 跳'], - 'viewer.route.eyebrow': ['Route probe', '路径探测'], - 'viewer.route.start': ['Choose a start node', '选择起点节点'], + 'viewer.route.eyebrow': ['Path', '路径'], + 'viewer.route.start': ['Click where the path starts', '点击路径的起点'], 'viewer.route.start.find': ['Find start', '查找起点'], 'viewer.route.start.find.aria': ['Find a route start', '查找路径起点'], 'viewer.route.copy': ['Copy link', '复制链接'], 'viewer.route.copy.aria': ['Copy link to traced route', '复制已追踪路径的链接'], 'viewer.route.clear': ['Clear', '清除'], 'viewer.route.clear.aria': ['Clear route probe', '清除路径探测'], - 'viewer.route.traced': ['Traced route', '已追踪路径'], - 'viewer.route.pickTwo': ['Pick two semantic nodes on the diagram', '在图表中选择两个语义节点'], - 'viewer.route.pickOne': ['Pick a semantic node on the diagram', '在图表中选择一个语义节点'], + 'viewer.route.traced': ['Path', '路径'], + 'viewer.route.pickTwo': ['Click two nodes on the diagram', '在图上点两个节点'], + 'viewer.route.pickOne': ['Click a node on the diagram', '在图上点一个节点'], 'viewer.route.controls': ['Route journey controls', '路径旅程控制'], 'viewer.route.previous': ['Previous route position', '上一个路径位置'], 'viewer.route.play': ['Play route journey', '播放路径旅程'], @@ -421,32 +334,32 @@ const MESSAGE_PAIRS = { 'viewer.route.replay.label': ['Replay', '重播'], 'viewer.route.overview': ['Overview', '总览'], 'viewer.route.overview.aria': ['Show complete route overview', '显示完整路径总览'], - 'viewer.route.instructions': ['Choose the source, then the destination. Direction matters.', '先选择来源,再选择目标;方向很重要。'], - 'viewer.route.destination': ['Choose a destination from {label}', '选择从{label}出发的目标'], + 'viewer.route.instructions': ['Click a start, then an end. Paths follow the arrows.', '先点起点,再点终点,沿箭头方向找路。'], + 'viewer.route.destination': ['Where does the path from {label} end?', '从{label}出发,走到哪里?'], 'viewer.route.destination.find': ['Find target', '查找目标'], 'viewer.route.destination.find.aria': ['Find a reachable route destination', '查找可达的路径目标'], 'viewer.route.differentDestination': ['Choose a different destination', '选择其他目标'], - 'viewer.route.distinct': ['A route needs two distinct semantic nodes.', '一条路径需要两个不同的语义节点。'], - 'viewer.route.unreachable': ['No directed route to {label}', '没有通往{label}的有向路径'], - 'viewer.route.unreachable.detail': ['{target} is not reachable from {source}. Pick a highlighted destination.', '从{source}无法到达{target}。请选择高亮的目标。'], - 'viewer.route.start.instructions': ['Select the source. The next step will reveal only directed destinations.', '选择来源。下一步只会显示有向可达的目标。'], + 'viewer.route.distinct': ['Pick two different nodes.', '请选两个不同的节点。'], + 'viewer.route.unreachable': ['Cannot reach {label} from here', '走不到{label}'], + 'viewer.route.unreachable.detail': ['{target} cannot be reached from {source} along the arrows. Pick a highlighted node.', '沿箭头方向,从{source}走不到{target}。请选一个高亮节点。'], + 'viewer.route.start.instructions': ['Next, pick the end. Only nodes you can reach will light up.', '接着选终点,能走到的节点会亮起。'], 'viewer.route.copy.success': ['Traced route link copied', '已复制路径链接'], 'viewer.route.copy.failed': ['Could not copy traced route link', '无法复制路径链接'], 'viewer.route.position': ['Route position {index} of {total}: {label}', '路径位置 {index}/{total}:{label}'], 'viewer.route.step': ['Step {index} of {total} · {phase} · {label}', '第 {index}/{total} 步 · {phase} · {label}'], 'viewer.route.motionRequired': ['Automatic journey requires Live motion', '自动旅程需要动态模式'], 'viewer.route.trigger.clear': ['Clear traced route', '清除已追踪路径'], - 'viewer.route.overview.status': ['{nodes} · {hops} · shortest authored route', '{nodes} · {hops} · 最短编写路径'], + 'viewer.route.overview.status': ['{nodes} · {hops} · shortest path', '{nodes} · {hops} · 最短路径'], 'viewer.route.overview.node.one': ['{count} node', '{count} 个节点'], 'viewer.route.overview.node.other': ['{count} nodes', '{count} 个节点'], - 'viewer.route.overview.hop.one': ['{count} directed hop', '{count} 个有向跳转'], - 'viewer.route.overview.hop.other': ['{count} directed hops', '{count} 个有向跳转'], + 'viewer.route.overview.hop.one': ['{count} step', '{count} 步'], + 'viewer.route.overview.hop.other': ['{count} steps', '{count} 步'], 'viewer.route.phase.playing': ['Playing', '播放中'], 'viewer.route.phase.complete': ['Complete', '已完成'], 'viewer.route.phase.inspecting': ['Inspecting', '检查中'], - 'viewer.route.destination.count.one': ['{count} directed destination available. Pick a highlighted node.', '有 {count} 个有向目标可用。请选择高亮节点。'], - 'viewer.route.destination.count.other': ['{count} directed destinations available. Pick a highlighted node.', '有 {count} 个有向目标可用。请选择高亮节点。'], - 'viewer.route.noOutgoing': ['No outgoing route starts here. Clear and choose another source.', '此处没有可用的出向路径。请清除后选择其他来源。'], + 'viewer.route.destination.count.one': ['{count} reachable node is highlighted. Click it.', '有 {count} 个能走到的节点已高亮,点一下。'], + 'viewer.route.destination.count.other': ['{count} reachable nodes are highlighted. Click one.', '有 {count} 个能走到的节点已高亮,点一个。'], + 'viewer.route.noOutgoing': ['No arrows lead out of this node. Clear it and pick another start.', '这个节点没有向外的箭头。清除后换一个起点。'], 'viewer.route.result.title': ['{source} to {target}', '{source} 到 {target}'], 'viewer.route.finder.source.title': ['Choose route start', '选择路径起点'], 'viewer.route.finder.source.placeholder': ['Search route sources', '搜索路径来源'], @@ -517,6 +430,12 @@ const MESSAGE_PAIRS = { 'viewer.nav.lens.short': ['LENS', '透镜'], 'viewer.nav.find': ['Find a node', '查找节点'], 'viewer.nav.find.title': ['Find a node (/)', '查找节点(/)'], + 'viewer.outline.title': ['Node index', '节点索引'], + 'viewer.rail.show': ['Notes & index', '要点与索引'], + 'viewer.rail.controls': ['Side panel', '侧栏'], + 'viewer.rail.collapse': ['Collapse side panel', '收起侧栏'], + 'viewer.rail.bottom': ['Move panel below the diagram', '移到图下方'], + 'viewer.rail.right': ['Move panel beside the diagram', '移到图右侧'], 'viewer.nav.guide': ['Open diagram guide', '打开图表指南'], 'viewer.nav.guide.title': ['Diagram guide (?)', '图表指南(?)'], 'viewer.nav.zoomOut': ['Zoom out', '缩小'], @@ -553,13 +472,101 @@ for (const [key, messages] of Object.entries(MESSAGE_PAIRS)) { } } -const CATALOGS = Object.fromEntries(SUPPORTED_LOCALES.map((locale, index) => [ +const BUILTIN_CATALOGS = Object.fromEntries(SUPPORTED_LOCALES.map((locale, index) => [ locale, Object.fromEntries(Object.entries(MESSAGE_PAIRS).map(([key, pair]) => [key, pair[index]])), ])); +const EN = BUILTIN_CATALOGS.en; + +const CANONICAL_KEYS = Object.keys(EN); +const PLACEHOLDER_PATTERN = /\{([a-zA-Z0-9_]+)\}/g; + +function extractPlaceholders(message) { + return new Set([...String(message).matchAll(PLACEHOLDER_PATTERN)].map((match) => match[1])); +} + +const CANONICAL_PLACEHOLDERS = Object.fromEntries( + CANONICAL_KEYS.map((key) => [key, extractPlaceholders(EN[key])]), +); + +function placeholdersMatch(expected, actual) { + if (expected.size !== actual.size) return false; + for (const token of expected) if (!actual.has(token)) return false; + return true; +} + +// Runtime catalogs registered by registerLocale(), keyed by whatever locale +// tag the caller supplied (e.g. an agent-authored 'fr'). Kept separate from +// BUILTIN_CATALOGS so a caller can never accidentally shadow a shipped +// catalog with a partial one. +const RUNTIME_CATALOGS = new Map(); + +function catalogFor(locale) { + return RUNTIME_CATALOGS.get(locale) || BUILTIN_CATALOGS[locale]; +} + +// Validates caller-supplied translation data against the canonical (English) +// message-key set. Pure and side-effect free: registerLocale() calls this +// and additionally builds/installs the resolved catalog. +export function validateTranslations(translations = {}) { + const supplied = Object.keys(translations || {}); + const suppliedSet = new Set(supplied); + const missingKeys = CANONICAL_KEYS.filter((key) => !suppliedSet.has(key)); + const unknownKeys = supplied.filter((key) => !Object.hasOwn(CANONICAL_PLACEHOLDERS, key)); + const placeholderMismatches = []; + const usableKeys = []; + for (const key of supplied) { + if (!Object.hasOwn(CANONICAL_PLACEHOLDERS, key)) continue; + const value = translations[key]; + if (typeof value !== 'string' || value.length === 0) { + placeholderMismatches.push({ key, expected: [...CANONICAL_PLACEHOLDERS[key]].sort(), actual: null }); + continue; + } + const actual = extractPlaceholders(value); + if (placeholdersMatch(CANONICAL_PLACEHOLDERS[key], actual)) { + usableKeys.push(key); + } else { + placeholderMismatches.push({ + key, + expected: [...CANONICAL_PLACEHOLDERS[key]].sort(), + actual: [...actual].sort(), + }); + } + } + return { + totalKeys: CANONICAL_KEYS.length, + coveredKeys: usableKeys.length, + coverage: CANONICAL_KEYS.length ? usableKeys.length / CANONICAL_KEYS.length : 1, + missingKeys, + unknownKeys, + placeholderMismatches, + }; +} + +// Registers a fully-resolved catalog for an arbitrary locale tag, built by +// layering validated translations over the English base. A key that is +// missing, non-string, or whose interpolation placeholders don't match the +// canonical set falls back to its English string — partial or malformed +// translation data can never break rendering. Returns the same coverage +// report validateTranslations() would, for the caller to surface as an +// explicit fallback/coverage diagnostic before rendering. +export function registerLocale(locale, translations = {}) { + const report = validateTranslations(translations); + const catalog = { ...EN }; + for (const key of CANONICAL_KEYS) { + const value = translations?.[key]; + if (typeof value !== 'string' || value.length === 0) continue; + if (placeholdersMatch(CANONICAL_PLACEHOLDERS[key], extractPlaceholders(value))) { + catalog[key] = value; + } + } + RUNTIME_CATALOGS.set(locale, catalog); + return { locale, ...report }; +} + export function resolveLocale(locale) { - return SUPPORTED_LOCALES.includes(locale) ? locale : DEFAULT_LOCALE; + return catalogFor(locale) ? locale : DEFAULT_LOCALE; } export function formatMessage(template, values = {}) { @@ -570,10 +577,11 @@ export function formatMessage(template, values = {}) { export function translateMessage(locale, key, values = {}) { const resolved = resolveLocale(locale); - if (!Object.hasOwn(CATALOGS[resolved], key)) { + const catalog = catalogFor(resolved); + if (!Object.hasOwn(catalog, key)) { throw new Error(`Missing Archify i18n message ${JSON.stringify(key)} for ${resolved}`); } - return formatMessage(CATALOGS[resolved][key], values); + return formatMessage(catalog[key], values); } export function translateCount(locale, key, count, values = {}) { @@ -583,7 +591,7 @@ export function translateCount(locale, key, count, values = {}) { export function viewerCatalog(locale) { const resolved = resolveLocale(locale); - return Object.fromEntries(Object.entries(CATALOGS[resolved]).filter(([key]) => key.startsWith('viewer.'))); + return Object.fromEntries(Object.entries(catalogFor(resolved)).filter(([key]) => key.startsWith('viewer.'))); } export function localizeTemplate(template, locale) { @@ -591,5 +599,5 @@ export function localizeTemplate(template, locale) { } export function catalogKeys() { - return Object.keys(MESSAGE_PAIRS); + return [...CANONICAL_KEYS]; } diff --git a/packages/diagram-core/vendor/archify/renderers/shared/layout-report.mjs b/packages/diagram-core/vendor/archify/renderers/shared/layout-report.mjs index 3128a65..0993272 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/layout-report.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/layout-report.mjs @@ -34,7 +34,9 @@ export function connectionPath(conn, routed, labelAt) { label: conn.label ?? null, variant: conn.variant ?? 'default', route: conn.route ?? 'auto', - points: routed.points.map(([x, y]) => [Math.round(x), Math.round(y)]), + // These points are repair inputs: rounding a fractional port makes a + // reused waypoint diagonal relative to the actual endpoint. + points: routed.points.map(([x, y]) => [x, y]), ...(labelAt ? { labelAt: labelAt.map(Math.round) } : {}), }; } diff --git a/packages/diagram-core/vendor/archify/renderers/shared/legend.mjs b/packages/diagram-core/vendor/archify/renderers/shared/legend.mjs index e9e80d6..5879de5 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/legend.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/legend.mjs @@ -96,7 +96,7 @@ export function legendFootprint(entries, { measured, rows, rowCount: rows.length, - minWidth: Math.max(...measured.map((entry) => entry.width)), + minWidth: measured.reduce((width, entry) => Math.max(width, entry.width), 0), extraHeight: (rows.length - 1) * lineGap, }; } diff --git a/packages/diagram-core/vendor/archify/renderers/shared/output-path.mjs b/packages/diagram-core/vendor/archify/renderers/shared/output-path.mjs index e8e480a..372249d 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/output-path.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/output-path.mjs @@ -1,236 +1,359 @@ -import fs from 'node:fs'; import path from 'node:path'; +import { + containedBy, + isValidWindowsSmbShareName, + isWindowsIpcShare, + resolvePhysicalLocation, + sameLocation, +} from './path-semantics.mjs'; +import { PortablePathError, validatePortablePath } from './portable-path.mjs'; -const MAX_SYMLINK_DEPTH = 64; -const directorySemanticsCache = new Map(); -let semanticsProbeSequence = 0; - -function splitAbsolute(absolutePath) { - const root = path.parse(absolutePath).root; - return { - root, - segments: absolutePath.slice(root.length).split(path.sep).filter(Boolean), - }; -} - -function canonicalize(targetPath, depth) { - const absolutePath = path.resolve(targetPath); - const { root, segments } = splitAbsolute(absolutePath); - let current = root; - - for (let index = 0; index < segments.length; index += 1) { - const candidate = path.join(current, segments[index]); - let stat; - try { - stat = fs.lstatSync(candidate); - } catch (error) { - if (error.code === 'ENOENT' || error.code === 'ENOTDIR') { - return path.resolve(current, ...segments.slice(index)); - } - throw error; - } - - if (stat.isSymbolicLink()) { - if (depth >= MAX_SYMLINK_DEPTH) { - const error = new Error(`Could not resolve path because a symbolic-link cycle includes "${candidate}".`); - error.code = 'ELOOP'; - error.path = candidate; - throw error; - } - const link = fs.readlinkSync(candidate); - const linkTarget = path.isAbsolute(link) ? link : path.resolve(path.dirname(candidate), link); - return canonicalize(path.join(linkTarget, ...segments.slice(index + 1)), depth + 1); - } - - current = fs.realpathSync.native(candidate); +export function canonicalFuturePath(targetPath) { + const resolution = resolvePhysicalLocation(targetPath); + if (resolution.status === 'resolved') { + if (resolution.location.kind === 'existing') return resolution.location.path; + return path.join( + resolution.location.ancestorPath, + ...resolution.location.unresolved, + ); } - - return path.normalize(current); + const output = path.resolve(targetPath); + if (resolution.reason.code === 'symlink-cycle') { + throw new OutputPathError(`Output path contains a symbolic-link cycle: "${output}".`, { + code: 'output/symlink-cycle', + message: 'Output path could not be resolved because it contains a symbolic-link cycle.', + subject: { output }, + evidence: { relation: resolution.reason }, + supportedFixes: ['remove the symbolic-link cycle or choose an output path outside it'], + }); + } + throw new OutputPathError('Output path could not be resolved safely.', { + code: 'output/path-resolution-indeterminate', + message: 'Output path could not be resolved safely for the requested filesystem location.', + subject: { output }, + evidence: { relation: resolution.reason }, + supportedFixes: ['use an ordinary local filesystem path that can be resolved safely, then retry'], + }); } -export function canonicalFuturePath(targetPath) { - try { - return canonicalize(targetPath, 0); - } catch (error) { - if (error?.code !== 'ELOOP') throw error; - const output = path.resolve(targetPath); +export function pathsAlias(leftPath, rightPath) { + const relation = sameLocation(leftPath, rightPath); + if (relation.status === 'match') return true; + if (relation.status === 'different') return false; + if (relation.reason.code === 'ancestor-not-directory') return false; + if (relation.reason.code === 'symlink-cycle') { + const output = path.resolve(relation.reason.side === 'right' ? rightPath : leftPath); throw new OutputPathError(`Output path contains a symbolic-link cycle: "${output}".`, { code: 'output/symlink-cycle', message: 'Output path could not be resolved because it contains a symbolic-link cycle.', subject: { output }, - evidence: { - systemCode: 'ELOOP', - ...(error.path ? { cycleAt: path.resolve(error.path) } : {}), - }, + evidence: { relation: relation.reason }, supportedFixes: ['remove the symbolic-link cycle or choose an output path outside it'], }); } + throw new OutputPathError('Path identity could not be determined safely.', { + code: 'output/path-identity-indeterminate', + message: 'Path identity could not be determined safely for the requested filesystem location.', + subject: { left: path.resolve(leftPath), right: path.resolve(rightPath) }, + evidence: { relation: relation.reason }, + supportedFixes: ['use ordinary local filesystem paths whose identity can be verified, then retry'], + }); } -function hasFileIdentity(stat) { - return stat.ino !== 0 && stat.ino !== 0n; +function pathIsInside(directoryPath, targetPath) { + const relation = containedBy(directoryPath, targetPath); + if (relation.status === 'match') return true; + if (relation.status === 'different') return false; + throw new OutputPathError('Output containment could not be determined safely.', { + code: 'output/containment-indeterminate', + message: 'Output containment could not be determined safely for the requested filesystem location.', + subject: { output: path.resolve(targetPath), cwd: path.resolve(directoryPath) }, + evidence: { relation: relation.reason }, + supportedFixes: ['use an output beneath an ordinary local directory whose identity can be verified'], + }); } -function sameFileIdentity(left, right) { - return hasFileIdentity(left) - && hasFileIdentity(right) - && left.dev === right.dev - && left.ino === right.ino; +function authoredOutputDiagnostic(error, rawOutput) { + const absolute = error?.reason === 'absolute'; + const code = absolute ? 'output/meta-absolute' : 'output/meta-path-syntax'; + const message = absolute + ? 'meta.output must be a relative path resolved from the current working directory.' + : 'meta.output must be a portable POSIX-relative path.'; + return { + code, + message, + subject: { output: rawOutput, path: '/meta/output' }, + evidence: { + reason: error?.reason || 'invalid', + ...(error?.segmentIndex !== undefined ? { segmentIndex: error.segmentIndex } : {}), + ...(error?.segment !== undefined ? { segment: error.segment } : {}), + ...(error?.utf8Bytes !== undefined ? { utf8Bytes: error.utf8Bytes } : {}), + ...(error?.utf16CodeUnits !== undefined ? { utf16CodeUnits: error.utf16CodeUnits } : {}), + ...(error?.limit !== undefined ? { limit: error.limit } : {}), + }, + supportedFixes: ['set meta.output to a portable relative .html path such as reports/diagram.html'], + }; } -function nearestExistingDirectory(targetPath) { - let directory = path.dirname(targetPath); - while (true) { - try { - const stat = fs.statSync(directory); - if (stat.isDirectory()) { - return { - path: fs.realpathSync.native(directory), - stat, - }; - } - } catch (error) { - if (error.code !== 'ENOENT' && error.code !== 'ENOTDIR') return null; - } - const parent = path.dirname(directory); - if (parent === directory) return null; - directory = parent; +function nativeOutputDiagnostic(rawOutput, reason, details = {}) { + return { + code: 'output/native-path-syntax', + message: 'The output path is not a valid native filesystem path on this host.', + subject: { output: rawOutput }, + evidence: { reason, ...details }, + supportedFixes: ['choose an ordinary filesystem path without device names, alternate data streams, trailing dots or spaces, or overlong components'], + }; +} + +function throwNativeOutputDiagnostic(rawOutput, reason, details = {}) { + const diagnostic = nativeOutputDiagnostic(rawOutput, reason, details); + throw new OutputPathError(diagnostic.message, diagnostic); +} + +function windowsExtendedTailComponents(rawOutput, tail) { + const authoredComponents = tail.split('\\'); + // Preserve one trailing separator for directory arguments, but never repair + // an empty component inside the raw extended namespace. + if (authoredComponents.slice(0, -1).some((component) => component.length === 0)) { + throwNativeOutputDiagnostic(rawOutput, 'windows-extended-root'); } + return authoredComponents.filter(Boolean); } -function directoryIdentityKey(directory) { - if (!hasFileIdentity(directory.stat)) return null; - return `${directory.stat.dev}:${directory.stat.ino}`; +function rejectWindowsIpcShare(rawOutput, share) { + if (isWindowsIpcShare(share)) { + throwNativeOutputDiagnostic(rawOutput, 'windows-ipc-namespace', { share }); + } } -function probeNamesAlias(directoryPath, authoredName, lookupName) { - let fileDescriptor; - let created = false; - let result = null; - let cleaned = true; - const authoredPath = path.join(directoryPath, authoredName); - const lookupPath = path.join(directoryPath, lookupName); +function validateWindowsNativeComponent( + rawOutput, + component, + componentIndex, + { allowReservedName = false } = {}, +) { try { - fileDescriptor = fs.openSync(authoredPath, 'wx', 0o600); - created = true; - fs.closeSync(fileDescriptor); - fileDescriptor = undefined; - - let authored; - let lookup; - try { - authored = fs.statSync(authoredPath); - lookup = fs.statSync(lookupPath); - } catch (error) { - if (error.code === 'ENOENT') result = false; - } - if (authored && lookup) { - if (sameFileIdentity(authored, lookup)) { - result = true; - } else { - try { - result = fs.realpathSync.native(authoredPath) === fs.realpathSync.native(lookupPath); - } catch { - result = null; - } - } - } - } catch { - result = null; - } finally { - if (fileDescriptor !== undefined) { - try { - fs.closeSync(fileDescriptor); - } catch { - cleaned = false; - } - } - if (created) { - try { - fs.unlinkSync(authoredPath); - } catch { - cleaned = false; - } + // Prefix the component so a colon is classified as an ADS separator, + // rather than allowing the generic URI detector to claim it first. + validatePortablePath(`native/${component}`, { profile: 'output' }); + } catch (error) { + if (!(error instanceof PortablePathError)) throw error; + if (allowReservedName && error.reason === 'windows-reserved-name') return; + // Native Windows arguments may intentionally name an existing 8.3 alias. + // Portable authored/archive paths reject that ambiguous spelling, while + // native resolution lets the filesystem prove the existing target. + if (error.reason === 'windows-short-name') { + if (component.length <= 255) return; + throwNativeOutputDiagnostic(rawOutput, 'component-too-long', { + component, + componentIndex, + utf16CodeUnits: component.length, + limit: 255, + }); } + // Native Windows filesystems bound components in UTF-16 code units. The + // stricter UTF-8 bound belongs to portable authored/archive names only. + if (error.reason === 'component-too-long' && error.utf16CodeUnits <= 255) return; + throwNativeOutputDiagnostic(rawOutput, error.reason, { + component, + componentIndex, + ...(error.character !== undefined ? { character: error.character } : {}), + ...(error.utf8Bytes !== undefined ? { utf8Bytes: error.utf8Bytes } : {}), + ...(error.utf16CodeUnits !== undefined ? { utf16CodeUnits: error.utf16CodeUnits } : {}), + ...(error.limit !== undefined ? { limit: error.limit } : {}), + }); } - return cleaned ? result : null; } -function probeDirectorySemantics(directory) { - const cacheKey = directoryIdentityKey(directory); - if (cacheKey && directorySemanticsCache.has(cacheKey)) { - return directorySemanticsCache.get(cacheKey); +function validateWindowsUncRootComponents(rawOutput, server, share) { + rejectWindowsIpcShare(rawOutput, share); + if (!isValidWindowsSmbShareName(share)) { + throwNativeOutputDiagnostic(rawOutput, 'windows-unc-share-name', { + share, + utf16CodeUnits: share.length, + limit: 80, + }); } + // UNC servers and shares are root components, not DOS file names. Keep the + // server's ordinary native syntax checks while allowing names such as CON. + validateWindowsNativeComponent(rawOutput, server, 0, { allowReservedName: true }); +} - semanticsProbeSequence += 1; - const suffix = `${process.pid}-${Date.now().toString(36)}-${semanticsProbeSequence}`; - const caseAuthored = `.archify-Case-Probe-${suffix}`; - const normalizationAuthored = `.archify-norm-\u00e9-probe-${suffix}`; - const semantics = { - caseInsensitive: probeNamesAlias( - directory.path, - caseAuthored, - caseAuthored.toLowerCase(), - ), - normalizationInsensitive: probeNamesAlias( - directory.path, - normalizationAuthored, - normalizationAuthored.normalize('NFD'), - ), - }; - if ( - cacheKey - && semantics.caseInsensitive !== null - && semantics.normalizationInsensitive !== null - ) { - directorySemanticsCache.set(cacheKey, semantics); +function windowsExtendedPathComponents(rawOutput) { + // The extended-length namespace deliberately bypasses Win32 normalization. + // Inspect its original spelling so a dot segment cannot retarget a UNC share. + if (rawOutput.includes('/')) { + throwNativeOutputDiagnostic(rawOutput, 'windows-extended-separator', { character: '/' }); + } + if (/^\\\\\?\\(?:GLOBALROOT|Device)(?:\\|$)/iu.test(rawOutput)) { + throwNativeOutputDiagnostic(rawOutput, 'windows-device-namespace'); } - return semantics; -} -function sameDirectory(left, right) { - return left.path === right.path || sameFileIdentity(left.stat, right.stat); -} + const drive = rawOutput.match(/^\\\\\?\\[A-Za-z]:\\/u); + if (drive) { + return windowsExtendedTailComponents(rawOutput, rawOutput.slice(drive[0].length)); + } -function futurePathsAlias(leftPath, rightPath) { - const left = canonicalFuturePath(leftPath); - const right = canonicalFuturePath(rightPath); - if (left === right) return true; + const uncPrefix = rawOutput.match(/^\\\\\?\\UNC\\/iu); + if (uncPrefix) { + const authoredTail = rawOutput.slice(uncPrefix[0].length); + const components = authoredTail.split('\\'); + if (components.length < 2 || components[0].length === 0 || components[1].length === 0) { + throwNativeOutputDiagnostic(rawOutput, 'windows-extended-root'); + } + validateWindowsUncRootComponents(rawOutput, components[0], components[1]); + return windowsExtendedTailComponents(rawOutput, components.slice(2).join('\\')); + } + + throwNativeOutputDiagnostic(rawOutput, 'windows-extended-root'); +} - const leftDirectory = nearestExistingDirectory(left); - const rightDirectory = nearestExistingDirectory(right); - if (!leftDirectory || !rightDirectory || !sameDirectory(leftDirectory, rightDirectory)) { - return false; +function validateWindowsRawUncRoot(rawOutput) { + if (!/^[\\/]{2}/u.test(rawOutput) || /^[\\/]{2}[.?][\\/]/u.test(rawOutput)) return; + // Validate the raw server/share boundary before win32.normalize can collapse + // an empty share or mix the two UNC separator spellings. + const unc = rawOutput.match(/^([\\/])\1([^\\/]+)\1([^\\/]+)(?:[\\/]|$)/u); + if (!unc) { + throwNativeOutputDiagnostic(rawOutput, 'windows-unc-root'); } + validateWindowsUncRootComponents(rawOutput, unc[2], unc[3]); +} - const semantics = probeDirectorySemantics(leftDirectory); - let comparableLeft = path.relative(leftDirectory.path, left); - let comparableRight = path.relative(rightDirectory.path, right); - if (semantics.normalizationInsensitive !== false) { - comparableLeft = comparableLeft.normalize('NFC'); - comparableRight = comparableRight.normalize('NFC'); +function windowsPathComponents(rawOutput, normalized) { + const authoredUncPrefix = /^[\\/]{2}/u.test(rawOutput); + if (/^\\\\\.\\/u.test(normalized)) { + throwNativeOutputDiagnostic(rawOutput, 'windows-device-namespace'); } - if (semantics.caseInsensitive !== false) { - comparableLeft = comparableLeft.toLowerCase(); - comparableRight = comparableRight.toLowerCase(); + if (/^\\\\\?\\/u.test(normalized)) { + throwNativeOutputDiagnostic(rawOutput, 'windows-extended-root'); } - return comparableLeft === comparableRight; + if (normalized.startsWith('\\\\')) { + const unc = normalized.match(/^\\\\([^\\]+)\\([^\\]+)(?:\\|$)/u); + if (!unc) throwNativeOutputDiagnostic(rawOutput, 'windows-unc-root'); + return normalized.slice(unc[0].length).split('\\').filter(Boolean); + } + if (authoredUncPrefix) throwNativeOutputDiagnostic(rawOutput, 'windows-unc-root'); + if (normalized.startsWith('\\')) { + throwNativeOutputDiagnostic(rawOutput, 'current-drive-rooted'); + } + const root = path.win32.parse(normalized).root; + return normalized + .slice(root.length) + .split(/[\\/]+/u) + // normalize() retains leading navigation for a relative path. Those dot + // segments are path syntax, not filename components subject to name rules. + .filter((component) => component && component !== '.' && component !== '..'); } -export function pathsAlias(leftPath, rightPath) { - if (futurePathsAlias(leftPath, rightPath)) return true; - try { - const left = fs.statSync(leftPath); - const right = fs.statSync(rightPath); - return sameFileIdentity(left, right); - } catch { - return false; +/** + * Validate command-line/default output paths using the active host's native + * syntax. Unlike authored portable paths, absolute paths and native separators + * remain supported. File outputs reject a trailing separator before native + * resolution can erase it; directory callers must opt in explicitly. The + * component bound also protects derived sidecars from failing after an + * operation has already started mutating the destination. + */ +export function validateNativeOutputPath( + rawOutput, + { platform = process.platform, kind = 'file' } = {}, +) { + if (kind !== 'file' && kind !== 'directory') { + throw new TypeError(`Unsupported native output path kind: ${JSON.stringify(kind)}`); + } + if (typeof rawOutput !== 'string' || rawOutput.length === 0) { + throwNativeOutputDiagnostic(rawOutput, 'empty'); + } + if (rawOutput.includes('\0')) throwNativeOutputDiagnostic(rawOutput, 'nul-character'); + if (/[\uD800-\uDFFF]/u.test(rawOutput)) { + throwNativeOutputDiagnostic(rawOutput, 'unpaired-surrogate'); + } + const hasTrailingSeparator = platform === 'win32' + ? /[\\/]$/u.test(rawOutput) + : rawOutput.endsWith(path.posix.sep); + if (kind === 'file' && hasTrailingSeparator) { + throwNativeOutputDiagnostic(rawOutput, 'trailing-separator', { kind }); + } + + let normalized; + let components; + if (platform === 'win32') { + if (/^[A-Za-z]:(?:$|[^\\/])/u.test(rawOutput)) { + throwNativeOutputDiagnostic(rawOutput, 'drive-relative'); + } + const extendedPrefix = rawOutput.startsWith('\\\\?\\'); + if (extendedPrefix) { + components = windowsExtendedPathComponents(rawOutput); + } else { + validateWindowsRawUncRoot(rawOutput); + normalized = path.win32.normalize(rawOutput); + components = windowsPathComponents(rawOutput, normalized); + } + for (const [componentIndex, component] of components.entries()) { + validateWindowsNativeComponent(rawOutput, component, componentIndex); + } + } else { + normalized = path.resolve(rawOutput); + const root = path.parse(normalized).root; + components = normalized.slice(root.length).split(path.sep).filter(Boolean); + for (const [componentIndex, component] of components.entries()) { + const utf8Bytes = Buffer.byteLength(component, 'utf8'); + if (utf8Bytes > 255) { + throwNativeOutputDiagnostic(rawOutput, 'component-too-long', { + component, + componentIndex, + utf8Bytes, + limit: 255, + }); + } + } } + return rawOutput; } -function pathIsInside(directoryPath, targetPath) { - const relative = path.relative(canonicalFuturePath(directoryPath), canonicalFuturePath(targetPath)); - return relative === '' || (!path.isAbsolute(relative) && relative !== '..' && !relative.startsWith(`..${path.sep}`)); +/** Validate a CLI directory argument before native resolution can normalize away its raw syntax. */ +export function resolveNativeOutputDirectory( + rawDirectory, + { platform = process.platform, cwd = process.cwd() } = {}, +) { + validateNativeOutputPath(rawDirectory, { platform, kind: 'directory' }); + const pathApi = platform === 'win32' ? path.win32 : path.posix; + return pathApi.resolve(cwd, rawDirectory); +} + +export function validateAuthoredOutputPath(rawOutput, { cwd = process.cwd() } = {}) { + try { + validatePortablePath(rawOutput, { profile: 'output' }); + } catch (error) { + if (!(error instanceof PortablePathError)) throw error; + const diagnostic = authoredOutputDiagnostic(error, rawOutput); + throw new OutputPathError(diagnostic.message, diagnostic); + } + if (path.posix.extname(rawOutput).toLowerCase() !== '.html') { + throw new OutputPathError('meta.output must target an .html file.', { + code: 'output/meta-extension', + message: 'meta.output must target an .html file.', + subject: { output: rawOutput, path: '/meta/output' }, + supportedFixes: ['change meta.output to a portable path ending in .html'], + }); + } + const outputPath = path.resolve(cwd, rawOutput); + if (path.extname(canonicalFuturePath(outputPath)).toLowerCase() !== '.html') { + throw new OutputPathError('meta.output must resolve to an .html file.', { + code: 'output/meta-resolved-extension', + message: 'meta.output must resolve to an .html file after symbolic links are followed.', + subject: { output: rawOutput }, + supportedFixes: ['remove the symbolic-link alias or point it to an .html target inside the current working directory'], + }); + } + if (!pathIsInside(cwd, outputPath)) { + throw new OutputPathError('meta.output must stay inside the current working directory.', { + code: 'output/meta-outside-cwd', + message: 'meta.output must stay inside the current working directory after symbolic links are resolved.', + subject: { output: rawOutput, cwd: path.resolve(cwd) }, + supportedFixes: ['set meta.output to a relative .html path inside the current working directory'], + }); + } + return rawOutput; } export class OutputPathError extends Error { @@ -256,46 +379,17 @@ export function resolveOutputPath({ otherOutputPaths = [], cwd = process.cwd(), requiredExtension = '.html', + platform = process.platform, }) { - const rawOutput = requestedOutput || authoredOutput || defaultOutput; - const source = requestedOutput ? 'cli' : (authoredOutput ? 'meta' : 'default'); - if ( - source === 'meta' - && (path.isAbsolute(rawOutput) || path.posix.isAbsolute(rawOutput) || path.win32.isAbsolute(rawOutput)) - ) { - throw new OutputPathError('meta.output must be a relative path.', { - code: 'output/meta-absolute', - message: 'meta.output must be a relative path resolved from the current working directory.', - subject: { output: rawOutput }, - supportedFixes: ['set meta.output to a relative .html path inside the current working directory'], - }); - } - if (source === 'meta' && path.extname(rawOutput).toLowerCase() !== '.html') { - throw new OutputPathError('meta.output must target an .html file.', { - code: 'output/meta-extension', - message: 'meta.output must target an .html file.', - subject: { output: rawOutput }, - supportedFixes: ['change meta.output to a path ending in .html'], - }); - } + if (authoredOutput !== undefined) validateAuthoredOutputPath(authoredOutput, { cwd }); + const source = requestedOutput !== undefined + ? 'cli' + : (authoredOutput !== undefined ? 'meta' : 'default'); + const rawOutput = source === 'cli' + ? requestedOutput + : (source === 'meta' ? authoredOutput : defaultOutput); + if (source !== 'meta') validateNativeOutputPath(rawOutput, { platform, kind: 'file' }); const outputPath = path.resolve(cwd, rawOutput); - if (source === 'meta' && path.extname(canonicalFuturePath(outputPath)).toLowerCase() !== '.html') { - throw new OutputPathError('meta.output must resolve to an .html file.', { - code: 'output/meta-resolved-extension', - message: 'meta.output must resolve to an .html file after symbolic links are followed.', - subject: { output: rawOutput }, - supportedFixes: ['remove the symbolic-link alias or point it to an .html target inside the current working directory'], - }); - } - if (source === 'meta' && !pathIsInside(cwd, outputPath)) { - throw new OutputPathError('meta.output must stay inside the current working directory.', { - code: 'output/meta-outside-cwd', - message: 'meta.output must stay inside the current working directory after symbolic links are resolved.', - subject: { output: rawOutput, cwd: path.resolve(cwd) }, - supportedFixes: ['set meta.output to a relative .html path inside the current working directory'], - }); - } - for (const inputPath of inputPaths) { if (!pathsAlias(outputPath, inputPath)) continue; throw new OutputPathError(`Output must not replace ${inputDescription}.`, { @@ -319,7 +413,13 @@ export function resolveOutputPath({ // Alias checks above retain priority when a target would overwrite an input. if (source === 'cli') { const resolvedOutput = canonicalFuturePath(outputPath); - const authoredMatches = path.extname(rawOutput).toLowerCase() === requiredExtension; + const authoredExtension = path.extname(rawOutput).toLowerCase(); + const existingWindowsHtmlAlias = platform === 'win32' + && requiredExtension === '.html' + && authoredExtension === '.htm' + && path.extname(resolvedOutput).toLowerCase() === requiredExtension + && pathsAlias(outputPath, resolvedOutput); + const authoredMatches = authoredExtension === requiredExtension || existingWindowsHtmlAlias; const resolvedMatches = path.extname(resolvedOutput).toLowerCase() === requiredExtension; if (!authoredMatches || !resolvedMatches) { const message = `CLI output must ${authoredMatches ? 'resolve to' : 'target'} a ${requiredExtension} file.`; diff --git a/packages/diagram-core/vendor/archify/renderers/shared/path-semantics.mjs b/packages/diagram-core/vendor/archify/renderers/shared/path-semantics.mjs new file mode 100644 index 0000000..59dc039 --- /dev/null +++ b/packages/diagram-core/vendor/archify/renderers/shared/path-semantics.mjs @@ -0,0 +1,1017 @@ +import crypto from 'node:crypto'; +import fs from 'node:fs'; +import path from 'node:path'; + +const MAX_SYMLINK_DEPTH = 64; +const RECENT_PROBE_NAME_LIMIT = 128; +const recentProbeNames = new Set(); +const WINDOWS_SMB_SHARE_FORBIDDEN = /[\u0000-\u001F"\/\\[\]:|<>+=;,?*]/u; + +export function isWindowsIpcShare(share) { + return /^(?:IPC\$|pipe|mailslot)$/iu.test(share); +} + +export function isValidWindowsSmbShareName(share) { + return typeof share === 'string' + && share.length > 0 + && share.length <= 80 + && !WINDOWS_SMB_SHARE_FORBIDDEN.test(share) + && !/[ .]$/u.test(share); +} + +function result(status, code, details = {}) { + return { + status, + reason: { + code, + ...details, + }, + }; +} + +function unknown(code, details = {}) { + return result('unknown', code, details); +} + +function systemFailure(code, error, details = {}) { + return unknown(code, { + ...details, + ...(typeof error?.code === 'string' ? { systemCode: error.code } : {}), + ...(typeof error?.recoveryPath === 'string' ? { recoveryPath: error.recoveryPath } : {}), + ...(typeof error?.restoredAtTarget === 'boolean' + ? { restoredAtTarget: error.restoredAtTarget } + : {}), + }); +} + +function hostPath() { + return process.platform === 'win32' ? path.win32 : path.posix; +} + +function absolutePath(input, side, basePath = process.cwd()) { + if (typeof input !== 'string' || input.length === 0) { + return { + ok: false, + failure: unknown('invalid-path', { side }), + }; + } + + try { + const pathApi = hostPath(); + if (pathApi.isAbsolute(input)) return { ok: true, path: input }; + if (pathApi.parse(input).root) { + return { + ok: false, + failure: unknown('drive-relative-path', { side }), + }; + } + const separator = basePath.endsWith(pathApi.sep) ? '' : pathApi.sep; + return { ok: true, path: `${basePath}${separator}${input}` }; + } catch (error) { + return { + ok: false, + failure: systemFailure('invalid-path', error, { side }), + }; + } +} + +function rootFailure(code, side) { + return { + ok: false, + failure: unknown(code, { side }), + }; +} + +function splitWindowsExtendedTail(tail, side, { internalRelativeLinkTarget = false } = {}) { + const authoredSegments = tail.split('\\'); + // A single final separator is harmless, while an internal empty segment + // would require normalizing a raw extended path before it reaches Windows. + if (!internalRelativeLinkTarget + && authoredSegments.slice(0, -1).some((component) => component.length === 0)) { + return rootFailure('windows-root-invalid', side); + } + const segments = authoredSegments.filter(Boolean); + if (!internalRelativeLinkTarget + && segments.some((component) => component === '.' || component === '..')) { + return rootFailure('windows-root-invalid', side); + } + return { ok: true, segments }; +} + +function splitWindowsAbsolute(absolute, side, { internalRelativeLinkTarget = false } = {}) { + if (/^[\\/]{2}\.[\\/]/u.test(absolute)) { + return rootFailure('windows-namespace-unsupported', side); + } + if (/^[\\/]{2}\?[\\/]/u.test(absolute) && !absolute.startsWith('\\\\?\\')) { + return rootFailure('windows-namespace-unsupported', side); + } + + if (absolute.startsWith('\\\\?\\')) { + if (absolute.includes('/')) return rootFailure('windows-root-invalid', side); + if ( + /^\\\\\?\\(?:GLOBALROOT|Device)(?:\\|$)/iu.test(absolute) + || /^\\\\\?\\Volume\{/iu.test(absolute) + ) { + return rootFailure('windows-namespace-unsupported', side); + } + + const extendedUnc = absolute.match(/^(\\\\\?\\UNC\\([^\\]+)\\([^\\]+))(?:\\(.*))?$/iu); + if (extendedUnc) { + if (isWindowsIpcShare(extendedUnc[3])) { + return rootFailure('windows-namespace-unsupported', side); + } + if (!isValidWindowsSmbShareName(extendedUnc[3])) { + return rootFailure('windows-root-invalid', side); + } + if ([extendedUnc[2], extendedUnc[3]].some((component) => component === '.' || component === '..')) { + return rootFailure('windows-root-invalid', side); + } + const tail = splitWindowsExtendedTail( + extendedUnc[4] || '', + side, + { internalRelativeLinkTarget }, + ); + if (!tail.ok) return tail; + return { + ok: true, + root: `${extendedUnc[1]}\\`, + segments: tail.segments, + }; + } + + const extendedDrive = absolute.match(/^(\\\\\?\\[A-Za-z]:\\)(.*)$/u); + if (extendedDrive) { + const tail = splitWindowsExtendedTail( + extendedDrive[2], + side, + { internalRelativeLinkTarget }, + ); + if (!tail.ok) return tail; + return { + ok: true, + root: extendedDrive[1], + segments: tail.segments, + }; + } + return rootFailure('windows-root-invalid', side); + } + + const unc = absolute.match(/^[\\/]{2}([^\\/]+)[\\/]([^\\/]+)(?:[\\/](.*))?$/u); + if (unc) { + if (isWindowsIpcShare(unc[2])) { + return rootFailure('windows-namespace-unsupported', side); + } + if (!isValidWindowsSmbShareName(unc[2])) { + return rootFailure('windows-root-invalid', side); + } + if ([unc[1], unc[2]].some((component) => component === '.' || component === '..')) { + return rootFailure('windows-root-invalid', side); + } + return { + ok: true, + root: `\\\\${unc[1]}\\${unc[2]}\\`, + segments: (unc[3] || '').split(/[\\/]+/u).filter(Boolean), + }; + } + + const drive = absolute.match(/^([A-Za-z]:)[\\/](.*)$/u); + if (drive) { + return { + ok: true, + root: `${drive[1]}\\`, + segments: drive[2].split(/[\\/]+/u).filter(Boolean), + }; + } + return rootFailure('windows-root-invalid', side); +} + +function splitAbsolute(absolute, side, options) { + if (process.platform === 'win32') return splitWindowsAbsolute(absolute, side, options); + const root = path.posix.parse(absolute).root; + return { + ok: true, + root, + segments: absolute.slice(root.length).split(/\/+/u).filter(Boolean), + }; +} + +function statBigInt(targetPath) { + return fs.statSync(targetPath, { bigint: true }); +} + +function ordinaryWindowsRoot(extendedRoot) { + const drive = extendedRoot.match(/^\\\\\?\\([A-Za-z]:\\)$/u); + if (drive) return drive[1]; + + const unc = extendedRoot.match(/^\\\\\?\\UNC\\([^\\]+)\\([^\\]+)\\$/iu); + return unc ? `\\\\${unc[1]}\\${unc[2]}\\` : null; +} + +function hasStableIdentity(stat) { + return typeof stat?.dev === 'bigint' + && typeof stat?.ino === 'bigint' + && stat.ino !== 0n; +} + +function compareKnownEntries(left, right, operation) { + if (hasStableIdentity(left.stat) && hasStableIdentity(right.stat)) { + const matches = left.stat.dev === right.stat.dev && left.stat.ino === right.stat.ino; + return result(matches ? 'match' : 'different', matches ? 'file-identity-match' : 'file-identity-different', { + operation, + method: 'bigint-stat', + }); + } + + // path-contract-allow: lexical-capability -- Canonical paths are compared inside the identity primitive. + if (left.realPath === right.realPath) { + return result('match', 'native-realpath-match', { + operation, + method: 'native-realpath', + }); + } + + return unknown('file-identity-unavailable', { + operation, + method: 'bigint-stat-and-native-realpath', + }); +} + +function rememberProbeName(name) { + recentProbeNames.add(name); + if (recentProbeNames.size > RECENT_PROBE_NAME_LIMIT) { + recentProbeNames.delete(recentProbeNames.values().next().value); + } +} + +function probeInterference(message, code = 'ARCHIFY_PROBE_IDENTITY_CHANGED', details = {}) { + const error = new Error(message); + error.code = code; + Object.assign(error, details); + return error; +} + +function sameStableIdentity(left, right) { + return hasStableIdentity(left) + && hasStableIdentity(right) + && left.dev === right.dev + && left.ino === right.ino; +} + +function preserveQuarantinedReplacement(quarantinePath, targetPath) { + try { + fs.linkSync(quarantinePath, targetPath); + return { restoredAtTarget: true }; + } catch { + // Preserve the quarantined entry when the original name was concurrently + // occupied or the host cannot create a hard link. Never overwrite either. + return { restoredAtTarget: false }; + } +} + +function removeOwnedProbe(targetPath, expectedStat) { + let currentStat; + try { + currentStat = fs.lstatSync(targetPath, { bigint: true }); + } catch (error) { + if (error?.code === 'ENOENT') { + return probeInterference('filesystem probe disappeared before cleanup', 'ARCHIFY_PROBE_MISSING'); + } + return error; + } + if (!sameStableIdentity(expectedStat, currentStat)) { + return probeInterference('filesystem probe identity changed before cleanup'); + } + + const quarantineName = `.archify-path-semantics-cleanup-${process.pid}-${crypto.randomBytes(10).toString('hex')}`; + const quarantinePath = path.join(path.dirname(targetPath), quarantineName); + rememberProbeName(quarantineName); + try { + // Move the checked name into a fresh, unpublished quarantine namespace. + // A replacement introduced after the check is moved rather than deleted. + fs.renameSync(targetPath, quarantinePath); + } catch (error) { + return error; + } + + let quarantineStat; + try { + quarantineStat = fs.lstatSync(quarantinePath, { bigint: true }); + } catch (error) { + error.recoveryPath = quarantinePath; + error.restoredAtTarget = false; + return error; + } + if (!sameStableIdentity(expectedStat, quarantineStat)) { + const recovery = preserveQuarantinedReplacement(quarantinePath, targetPath); + return probeInterference( + 'filesystem probe identity changed during cleanup', + 'ARCHIFY_PROBE_IDENTITY_CHANGED', + { recoveryPath: quarantinePath, ...recovery }, + ); + } + + try { + // The quarantine spelling did not exist before the atomic rename and is + // never returned to callers. Legitimate target-path replacements therefore + // remain outside the only namespace we unlink. + fs.unlinkSync(quarantinePath); + return null; + } catch (error) { + error.recoveryPath = quarantinePath; + error.restoredAtTarget = false; + return error; + } +} + +function resolvePlan({ root, segments }, side, depth) { + if (depth > MAX_SYMLINK_DEPTH) { + return { + ok: false, + failure: unknown('symlink-cycle', { side }), + }; + } + + let current; + let currentStat; + try { + current = fs.realpathSync.native(root); + } catch (error) { + // Node on Windows can report EISDIR while resolving a valid extended + // filesystem root (for example \\?\C:\). The namespace was already + // validated by splitWindowsAbsolute, so retain its exact spelling for + // traversal. + if (process.platform === 'win32' + && error?.code === 'EISDIR' + && ordinaryWindowsRoot(root)) { + current = root; + } else { + return { + ok: false, + failure: systemFailure('root-resolution-failed', error, { side }), + }; + } + } + + try { + currentStat = statBigInt(current); + } catch (error) { + // The same Node/Windows edge can occur during stat after realpath succeeds. + // A drive or share root is short enough for its ordinary spelling, while + // `current` remains namespaced so descendants keep long-path semantics. + const ordinaryRoot = process.platform === 'win32' + && error?.code === 'EISDIR' + ? ordinaryWindowsRoot(root) + : null; + if (ordinaryRoot && ordinaryRoot !== current) { + try { + currentStat = statBigInt(ordinaryRoot); + } catch (statError) { + return { + ok: false, + failure: systemFailure('root-resolution-failed', statError, { side }), + }; + } + } else { + return { + ok: false, + failure: systemFailure('root-resolution-failed', error, { side }), + }; + } + } + + for (let index = 0; index < segments.length; index += 1) { + const segment = segments[index]; + if (segment === '.') continue; + if (segment === '..') { + if (!currentStat.isDirectory()) { + return { + ok: false, + failure: unknown('ancestor-not-directory', { side, segmentIndex: index }), + }; + } + try { + current = fs.realpathSync.native(hostPath().dirname(current)); + currentStat = statBigInt(current); + } catch (error) { + return { + ok: false, + failure: systemFailure('path-resolution-failed', error, { side, segmentIndex: index }), + }; + } + continue; + } + + const candidate = hostPath().join(current, segment); + let candidateStat; + try { + candidateStat = fs.lstatSync(candidate, { bigint: true }); + } catch (error) { + if (error?.code === 'ENOENT') { + if (!currentStat.isDirectory()) { + return { + ok: false, + failure: unknown('ancestor-not-directory', { side, segmentIndex: index }), + }; + } + const unresolved = segments.slice(index).filter((item) => item !== '.'); + if (unresolved.includes('..')) { + return { + ok: false, + failure: unknown('future-parent-traversal-indeterminate', { + side, + segmentIndex: index, + }), + }; + } + return { + ok: true, + existing: false, + ancestor: { + realPath: current, + stat: currentStat, + }, + unresolved, + }; + } + if (error?.code === 'ENOTDIR') { + return { + ok: false, + failure: systemFailure('ancestor-not-directory', error, { side, segmentIndex: index }), + }; + } + return { + ok: false, + failure: systemFailure('path-resolution-failed', error, { side, segmentIndex: index }), + }; + } + + if (candidateStat.isSymbolicLink()) { + let linkPlan; + try { + const authoredTarget = fs.readlinkSync(candidate); + const pathApi = hostPath(); + const internalRelativeLinkTarget = !pathApi.isAbsolute(authoredTarget) + && !pathApi.parse(authoredTarget).root; + const parsedTarget = absolutePath(authoredTarget, side, hostPath().dirname(candidate)); + if (!parsedTarget.ok) return parsedTarget; + const target = splitAbsolute(parsedTarget.path, side, { internalRelativeLinkTarget }); + if (!target.ok) return target; + linkPlan = { + root: target.root, + segments: [...target.segments, ...segments.slice(index + 1)], + }; + } catch (error) { + return { + ok: false, + failure: systemFailure('symlink-resolution-failed', error, { side, segmentIndex: index }), + }; + } + return resolvePlan(linkPlan, side, depth + 1); + } + + if (index < segments.length - 1 && !candidateStat.isDirectory()) { + return { + ok: false, + failure: unknown('ancestor-not-directory', { side, segmentIndex: index }), + }; + } + + try { + current = fs.realpathSync.native(candidate); + currentStat = statBigInt(current); + } catch (error) { + return { + ok: false, + failure: systemFailure('path-resolution-failed', error, { side, segmentIndex: index }), + }; + } + } + + return { + ok: true, + existing: true, + entry: { + realPath: current, + stat: currentStat, + }, + unresolved: [], + }; +} + +function resolveLocation(input, side) { + const parsed = absolutePath(input, side); + if (!parsed.ok) return parsed; + const plan = splitAbsolute(parsed.path, side); + if (!plan.ok) return plan; + return resolvePlan(plan, side, 0); +} + +function semanticNameEnvelope(name) { + const names = new Set([name]); + const pending = [name]; + while (pending.length > 0 && names.size <= 64) { + const current = pending.shift(); + const candidates = [ + current.normalize('NFC'), + current.normalize('NFD'), + current.toLocaleLowerCase('en-US'), + current.toLocaleUpperCase('en-US'), + ]; + for (const candidate of candidates) { + if (names.has(candidate)) continue; + names.add(candidate); + pending.push(candidate); + } + } + return names.size <= 64 ? names : null; +} + +function semanticEnvelopesOverlap(leftName, rightName) { + const left = semanticNameEnvelope(leftName); + const right = semanticNameEnvelope(rightName); + if (!left || !right) return true; + for (const spelling of left) { + if (right.has(spelling)) return true; + } + return false; +} + +function windowsDeviceName(name) { + const stem = name.split('.')[0].replace(/[ .]+$/u, '').toUpperCase(); + return /^(?:CON|PRN|AUX|NUL|CONIN\$|CONOUT\$|COM[1-9¹²³]|LPT[1-9¹²³])$/u.test(stem); +} + +function futureWindowsNameRisk(leftName, rightName) { + if (process.platform !== 'win32') return null; + const windowsShortName = /~[1-9][0-9]*(?:\.|$)/iu; + if (windowsShortName.test(leftName) || windowsShortName.test(rightName)) { + return unknown('future-short-name-indeterminate', { method: 'windows-8dot3' }); + } + if (windowsDeviceName(leftName) || windowsDeviceName(rightName)) { + return unknown('future-device-name-indeterminate', { method: 'windows-device-name' }); + } + if (/[ .]$/.test(leftName) || /[ .]$/.test(rightName)) { + return unknown('future-trim-name-indeterminate', { method: 'windows-trim-alias' }); + } + return null; +} + +/** + * Resolve one existing or future path through the host filesystem without + * exposing a string key for identity comparisons. + */ +export function resolvePhysicalLocation(targetPath) { + const resolution = resolveLocation(targetPath, 'target'); + if (!resolution.ok) return resolution.failure; + if (resolution.existing) { + return { + status: 'resolved', + location: { + kind: 'existing', + path: resolution.entry.realPath, + }, + reason: { + code: 'existing-native-realpath', + method: 'native-realpath', + }, + }; + } + return { + status: 'resolved', + location: { + kind: 'future', + ancestorPath: resolution.ancestor.realPath, + unresolved: [...resolution.unresolved], + }, + reason: { + code: 'future-physical-ancestor', + method: 'native-realpath', + }, + }; +} + +function probeNameAlias(directoryPath, leftName, rightName) { + if (leftName === rightName) { + return result('match', 'future-name-exact', { method: 'lexical-exact' }); + } + if (recentProbeNames.has(leftName) || recentProbeNames.has(rightName)) { + return result('different', 'internal-probe-name', { method: 'probe-suppression' }); + } + const windowsRisk = futureWindowsNameRisk(leftName, rightName); + if (windowsRisk) return windowsRisk; + if (!semanticEnvelopesOverlap(leftName, rightName)) { + return result('different', 'future-name-distinct', { method: 'semantic-envelope' }); + } + + const prefix = `.archify-path-semantics-${process.pid}-${crypto.randomBytes(10).toString('hex')}-`; + const probeName = `${prefix}${leftName}`; + const lookupName = `${prefix}${rightName}`; + const componentLength = (name) => process.platform === 'win32' + ? name.length + : Buffer.byteLength(name, 'utf8'); + if (componentLength(probeName) > 255 || componentLength(lookupName) > 255) { + return unknown('future-name-probe-unrepresentable', { + method: 'direct-filesystem-probe', + systemCode: 'ENAMETOOLONG', + }); + } + + let probePath; + let probeStat; + let descriptor; + let comparison; + let cleanupError; + try { + // Probe entries must live directly in the directory being queried. On + // Windows case sensitivity is per-directory and a child may not inherit it. + rememberProbeName(probeName); + rememberProbeName(lookupName); + probePath = path.join(directoryPath, probeName); + const lookupPath = path.join(directoryPath, lookupName); + descriptor = fs.openSync(probePath, 'wx', 0o600); + probeStat = fs.fstatSync(descriptor, { bigint: true }); + + let authoredStat; + let lookupStat; + try { + authoredStat = statBigInt(probePath); + lookupStat = statBigInt(lookupPath); + } catch (error) { + if (error?.code === 'ENOENT') { + comparison = result('different', 'future-name-different', { method: 'filesystem-probe' }); + } else { + comparison = systemFailure('future-name-probe-failed', error, { method: 'filesystem-probe' }); + } + } + + if (!comparison) { + const identity = compareKnownEntries( + { realPath: fs.realpathSync.native(probePath), stat: authoredStat }, + { realPath: fs.realpathSync.native(lookupPath), stat: lookupStat }, + 'future-name', + ); + if (identity.status === 'match') { + comparison = result('match', 'future-name-alias', { method: 'filesystem-probe' }); + } else if (identity.status === 'different') { + comparison = result('different', 'future-name-different', { method: 'filesystem-probe' }); + } else { + comparison = identity; + } + } + } catch (error) { + comparison = systemFailure('future-name-probe-failed', error, { method: 'filesystem-probe' }); + } finally { + // Pin the inode until cleanup finishes. Once the final handle is closed, + // an unlinked probe's inode can be reused by a replacement at the same name. + if (probeStat) cleanupError = removeOwnedProbe(probePath, probeStat); + if (descriptor !== undefined) { + try { + fs.closeSync(descriptor); + } catch (error) { + cleanupError = cleanupError ?? error; + } + } + } + + if (cleanupError) { + return systemFailure('future-name-probe-cleanup-failed', cleanupError, { + method: 'filesystem-probe', + ...(comparison ? { comparison: comparison.reason } : {}), + }); + } + return comparison; +} + +function sidecarCaseKey(component) { + // The candidate is accepted only after the containing filesystem confirms + // that the original grapheme and this spelling name the same entry. + return component.toLocaleUpperCase('en-US').toLocaleLowerCase('en-US'); +} + +function transformSidecarComponent(directoryPath, component, transform, phase) { + if (typeof Intl.Segmenter !== 'function') { + return { + ok: false, + failure: unknown('sidecar-unicode-segmentation-unavailable', { + operation: 'sidecar-namespace-key', + }), + }; + } + const segmenter = new Intl.Segmenter('en-US', { granularity: 'grapheme' }); + const comparisons = new Map(); + const output = []; + for (const { segment } of segmenter.segment(component)) { + const candidate = transform(segment); + if (candidate === segment) { + output.push(segment); + continue; + } + const cacheKey = `${segment}\0${candidate}`; + let comparison = comparisons.get(cacheKey); + if (!comparison) { + comparison = probeNameAlias(directoryPath, segment, candidate); + comparisons.set(cacheKey, comparison); + } + if (comparison.status === 'unknown') { + return { + ok: false, + failure: unknown(`sidecar-${phase}-semantics-indeterminate`, { + operation: 'sidecar-namespace-key', + cause: comparison.reason, + }), + }; + } + output.push(comparison.status === 'match' ? candidate : segment); + } + return { + ok: true, + component: output.join(''), + }; +} + +/** + * Produce a stable component for a sidecar namespace in one existing + * directory. The returned string is a collision-domain key, not a canonical + * path and must never be used to decide whether two filesystem entries match. + */ +export function sidecarNamespaceComponentKey(directoryPath, component) { + if (typeof component !== 'string' || component.length === 0 + || component === '.' || component === '..' + || hostPath().basename(component) !== component) { + return unknown('invalid-sidecar-component', { + operation: 'sidecar-namespace-key', + }); + } + + const directory = resolveLocation(directoryPath, 'sidecar-directory'); + if (!directory.ok) return directory.failure; + if (!directory.existing) { + return unknown('sidecar-directory-missing', { + operation: 'sidecar-namespace-key', + }); + } + if (!directory.entry.stat.isDirectory()) { + return unknown('sidecar-parent-not-directory', { + operation: 'sidecar-namespace-key', + }); + } + + const normalized = transformSidecarComponent( + directory.entry.realPath, + component, + (segment) => segment.normalize('NFC'), + 'normalization', + ); + if (!normalized.ok) return normalized.failure; + const cased = transformSidecarComponent( + directory.entry.realPath, + normalized.component, + sidecarCaseKey, + 'case', + ); + if (!cased.ok) return cased.failure; + const renormalized = transformSidecarComponent( + directory.entry.realPath, + cased.component, + (segment) => segment.normalize('NFC'), + 'normalization', + ); + if (!renormalized.ok) return renormalized.failure; + + return { + status: 'resolved', + directoryPath: directory.entry.realPath, + componentKey: renormalized.component, + reason: { + code: 'sidecar-namespace-key', + method: 'directory-filesystem-probe', + }, + }; +} + +function compareUnmaterializedNames(leftName, rightName) { + if (leftName === rightName) { + return result('match', 'future-name-exact', { method: 'lexical-exact' }); + } + const windowsRisk = futureWindowsNameRisk(leftName, rightName); + if (windowsRisk) return windowsRisk; + if (!semanticEnvelopesOverlap(leftName, rightName)) { + return result('different', 'future-name-distinct', { method: 'semantic-envelope' }); + } + return unknown('future-descendant-semantics-indeterminate', { + method: 'unmaterialized-directory', + }); +} + +function compareFutureLocations(left, right) { + const ancestor = compareKnownEntries(left.ancestor, right.ancestor, 'future-ancestor'); + if (ancestor.status !== 'match') return ancestor; + + if (left.unresolved.length !== right.unresolved.length) { + return result('different', 'future-depth-different', { + operation: 'same-location', + leftDepth: left.unresolved.length, + rightDepth: right.unresolved.length, + }); + } + + let probedSegments = 0; + for (let index = 0; index < left.unresolved.length; index += 1) { + const names = index === 0 + ? probeNameAlias( + left.ancestor.realPath, + left.unresolved[index], + right.unresolved[index], + ) + : compareUnmaterializedNames(left.unresolved[index], right.unresolved[index]); + if (names.reason.method === 'filesystem-probe') probedSegments += 1; + if (names.status !== 'match') { + const { code, ...reasonDetails } = names.reason; + return result(names.status, code, { + ...reasonDetails, + operation: 'same-location', + segmentIndex: index, + }); + } + } + + return result('match', probedSegments > 0 ? 'future-location-alias' : 'future-location-exact', { + operation: 'same-location', + method: probedSegments > 0 ? 'filesystem-probe' : 'lexical-exact', + probedSegments, + }); +} + +/** + * Compare two existing filesystem entries by physical identity. + * Missing or unidentifiable entries return `unknown`, never `different`. + */ +export function sameEntry(leftPath, rightPath) { + const left = resolveLocation(leftPath, 'left'); + if (!left.ok) return left.failure; + const right = resolveLocation(rightPath, 'right'); + if (!right.ok) return right.failure; + + if (!left.existing || !right.existing) { + return unknown('entry-missing', { + operation: 'same-entry', + missing: [ + ...(!left.existing ? ['left'] : []), + ...(!right.existing ? ['right'] : []), + ], + }); + } + + return compareKnownEntries(left.entry, right.entry, 'same-entry'); +} + +/** + * Compare two existing or future write targets using the containing filesystem's + * actual name semantics. Existing hard links and resolved symbolic links match. + */ +export function sameLocation(leftPath, rightPath) { + const left = resolveLocation(leftPath, 'left'); + if (!left.ok) return left.failure; + const right = resolveLocation(rightPath, 'right'); + if (!right.ok) return right.failure; + + if (left.existing && right.existing) { + return compareKnownEntries(left.entry, right.entry, 'same-location'); + } + if (left.existing !== right.existing) { + return result('different', 'location-existence-different', { + operation: 'same-location', + existing: left.existing ? 'left' : 'right', + }); + } + return compareFutureLocations(left, right); +} + +/** Compare the physical locations of the two paths' parent directories. */ +export function sameParent(leftPath, rightPath) { + const left = absolutePath(leftPath, 'left'); + if (!left.ok) return left.failure; + const right = absolutePath(rightPath, 'right'); + if (!right.ok) return right.failure; + + return sameLocation(hostPath().dirname(left.path), hostPath().dirname(right.path)); +} + +function parentEntry(entry) { + const parentPath = hostPath().dirname(entry.realPath); + // path-contract-allow: lexical-capability -- Both values are canonical paths captured by this primitive. + if (parentPath === entry.realPath) return null; + try { + const realPath = fs.realpathSync.native(parentPath); + return { + ok: true, + entry: { + realPath, + stat: statBigInt(realPath), + }, + }; + } catch (error) { + return { + ok: false, + failure: systemFailure('ancestor-resolution-failed', error, { + operation: 'contained-by', + }), + }; + } +} + +/** + * Determine physical containment in an existing directory. The comparison is + * inclusive and follows links; the target may exist or name a future location. + */ +export function containedBy(directoryPath, targetPath) { + const directory = resolveLocation(directoryPath, 'directory'); + if (!directory.ok) return directory.failure; + if (directory.existing && !directory.entry.stat.isDirectory()) { + return unknown('container-not-directory', { operation: 'contained-by' }); + } + + const target = resolveLocation(targetPath, 'target'); + if (!target.ok) return target.failure; + + if (!directory.existing) { + if (target.existing) { + return unknown('container-missing', { operation: 'contained-by' }); + } + const ancestor = compareKnownEntries(directory.ancestor, target.ancestor, 'contained-by'); + if (ancestor.status !== 'match') return ancestor; + if (target.unresolved.length < directory.unresolved.length) { + return result('different', 'future-container-prefix-too-deep', { + operation: 'contained-by', + }); + } + for (let index = 0; index < directory.unresolved.length; index += 1) { + const segment = index === 0 + ? probeNameAlias( + directory.ancestor.realPath, + directory.unresolved[index], + target.unresolved[index], + ) + : compareUnmaterializedNames( + directory.unresolved[index], + target.unresolved[index], + ); + if (segment.status === 'match') continue; + const { code, ...reasonDetails } = segment.reason; + return result(segment.status, code, { + ...reasonDetails, + operation: 'contained-by', + segmentIndex: index, + }); + } + return result('match', 'future-container-prefix-match', { + operation: 'contained-by', + target: 'future', + depth: target.unresolved.length - directory.unresolved.length, + }); + } + + let current; + if (!target.existing) { + current = target.ancestor; + } else if (target.entry.stat.isDirectory()) { + current = target.entry; + } else { + const parent = parentEntry(target.entry); + if (!parent?.ok) return parent?.failure ?? unknown('ancestor-resolution-failed', { + operation: 'contained-by', + }); + current = parent.entry; + } + + let depth = 0; + let identityWasUnknown = false; + while (current) { + const comparison = compareKnownEntries(directory.entry, current, 'contained-by'); + if (comparison.status === 'match') { + return result('match', 'physical-ancestor-match', { + operation: 'contained-by', + depth, + target: target.existing ? 'existing' : 'future', + }); + } + if (comparison.status === 'unknown') identityWasUnknown = true; + + const parent = parentEntry(current); + if (parent === null) break; + if (!parent.ok) return parent.failure; + current = parent.entry; + depth += 1; + } + + if (identityWasUnknown) { + return unknown('containment-identity-unavailable', { + operation: 'contained-by', + target: target.existing ? 'existing' : 'future', + }); + } + return result('different', 'physical-ancestor-not-found', { + operation: 'contained-by', + target: target.existing ? 'existing' : 'future', + }); +} diff --git a/packages/diagram-core/vendor/archify/renderers/shared/portable-path.mjs b/packages/diagram-core/vendor/archify/renderers/shared/portable-path.mjs new file mode 100644 index 0000000..e9f8df9 --- /dev/null +++ b/packages/diagram-core/vendor/archify/renderers/shared/portable-path.mjs @@ -0,0 +1,408 @@ +const PORTABLE_PATH_PROFILES = new Set(['output', 'repo', 'archive']); +const WINDOWS_SAFE_PROFILES = new Set(['output', 'archive']); +const WINDOWS_RESERVED_NAME = /^(?:con|prn|aux|nul|conin\$|conout\$|com[1-9¹²³]|lpt[1-9¹²³])(?:\.|$)/iu; +const WINDOWS_SHORT_NAME = /~[1-9][0-9]*(?:\.|$)/iu; +const URI_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*:/u; +const CONTROL_CHARACTER = /\p{Cc}/u; +const WINDOWS_INVALID_CHARACTER = /[<>"|?*]/u; +const MAX_SEMANTIC_VARIANTS = 32; + +export class PortablePathError extends Error { + constructor(message, { + code, + reason, + value, + profile, + segment, + segmentIndex, + character, + index, + conflictIndex, + conflictValue, + collisionKind, + semantics, + pathPart, + conflictPathPart, + utf8Bytes, + utf16CodeUnits, + limit, + } = {}) { + super(message); + this.name = 'PortablePathError'; + this.code = code; + this.reason = reason; + this.value = value; + this.profile = profile; + if (segment !== undefined) this.segment = segment; + if (segmentIndex !== undefined) this.segmentIndex = segmentIndex; + if (character !== undefined) this.character = character; + if (index !== undefined) this.index = index; + if (conflictIndex !== undefined) this.conflictIndex = conflictIndex; + if (conflictValue !== undefined) this.conflictValue = conflictValue; + if (collisionKind !== undefined) this.collisionKind = collisionKind; + if (semantics !== undefined) this.semantics = semantics; + if (pathPart !== undefined) this.pathPart = pathPart; + if (conflictPathPart !== undefined) this.conflictPathPart = conflictPathPart; + if (utf8Bytes !== undefined) this.utf8Bytes = utf8Bytes; + if (utf16CodeUnits !== undefined) this.utf16CodeUnits = utf16CodeUnits; + if (limit !== undefined) this.limit = limit; + } +} + +function pathError(value, profile, reason, message, details = {}) { + return new PortablePathError(message, { + code: `portable-path/${reason}`, + reason, + value, + profile, + ...details, + }); +} + +function assertProfile(profile) { + if (PORTABLE_PATH_PROFILES.has(profile)) return; + throw pathError( + undefined, + profile, + 'profile', + `Portable path profile must be one of: ${[...PORTABLE_PATH_PROFILES].join(', ')}.`, + ); +} + +export function validatePortablePath(value, options = {}) { + const profile = options?.profile; + assertProfile(profile); + + if (typeof value !== 'string') { + throw pathError(value, profile, 'type', 'Portable path must be a string.'); + } + if (value.length === 0) { + throw pathError(value, profile, 'empty', 'Portable path must not be empty.'); + } + if (/^[A-Za-z]:[\\/]/u.test(value) || value.startsWith('/') || value.startsWith('\\')) { + throw pathError(value, profile, 'absolute', 'Portable path must be relative.'); + } + if (/^[A-Za-z]:/u.test(value)) { + throw pathError( + value, + profile, + 'drive-relative', + 'Portable path must not use a drive-relative Windows path.', + ); + } + if (URI_SCHEME.test(value)) { + throw pathError(value, profile, 'uri', 'Portable path must not be a URI.'); + } + if (value.includes('\\')) { + throw pathError( + value, + profile, + 'backslash', + 'Portable path must use forward slashes as separators.', + ); + } + + const segments = value.split('/'); + for (const [segmentIndex, segment] of segments.entries()) { + const segmentDetails = { segment, segmentIndex }; + if (segment.length === 0) { + throw pathError( + value, + profile, + 'empty-segment', + 'Portable path must not contain empty segments.', + segmentDetails, + ); + } + if (segment === '.' || segment === '..') { + throw pathError( + value, + profile, + 'dot-segment', + 'Portable path must not contain dot segments.', + segmentDetails, + ); + } + const controlMatch = segment.match(CONTROL_CHARACTER); + if (controlMatch) { + throw pathError( + value, + profile, + 'control', + 'Portable path must not contain control characters.', + { ...segmentDetails, character: controlMatch[0] }, + ); + } + const surrogateMatch = segment.match(/[\uD800-\uDFFF]/u); + if (surrogateMatch) { + throw pathError( + value, + profile, + 'unpaired-surrogate', + 'Portable path must not contain unpaired UTF-16 surrogates.', + { ...segmentDetails, character: surrogateMatch[0] }, + ); + } + + if (!WINDOWS_SAFE_PROFILES.has(profile)) continue; + if (segment.includes(':')) { + throw pathError( + value, + profile, + 'windows-ads', + 'Portable path must not select a Windows alternate data stream.', + { ...segmentDetails, character: ':' }, + ); + } + const invalidMatch = segment.match(WINDOWS_INVALID_CHARACTER); + if (invalidMatch) { + throw pathError( + value, + profile, + 'windows-invalid-character', + 'Portable path contains a character that is invalid in Windows file names.', + { ...segmentDetails, character: invalidMatch[0] }, + ); + } + if (/[. ]$/u.test(segment)) { + throw pathError( + value, + profile, + 'windows-trailing-dot-space', + 'Portable path segments must not end with a dot or space.', + segmentDetails, + ); + } + if (WINDOWS_RESERVED_NAME.test(segment)) { + throw pathError( + value, + profile, + 'windows-reserved-name', + 'Portable path must not use a reserved Windows device name.', + segmentDetails, + ); + } + if (WINDOWS_SHORT_NAME.test(segment)) { + throw pathError( + value, + profile, + 'windows-short-name', + 'Portable path must not use a Windows 8.3 short-name shape.', + segmentDetails, + ); + } + const utf8Bytes = Buffer.byteLength(segment, 'utf8'); + const utf16CodeUnits = segment.length; + if (utf8Bytes > 255 || utf16CodeUnits > 255) { + throw pathError( + value, + profile, + 'component-too-long', + 'Portable path segments must fit both UTF-8 and UTF-16 filesystem component limits.', + { + ...segmentDetails, + utf8Bytes, + utf16CodeUnits, + limit: 255, + }, + ); + } + } + + return value; +} + +function collisionError(values, profile, index, conflictIndex, reason, details = {}) { + return new PortablePathError( + `Portable paths at indexes ${conflictIndex} and ${index} collide under portable filesystem semantics.`, + { + code: 'portable-path/collision', + reason, + value: values[index], + profile, + index, + conflictIndex, + conflictValue: values[conflictIndex], + ...details, + }, + ); +} + +function createSemanticIndex() { + return new Map(); +} + +function semanticEnvelope(value, profile, index) { + const variants = [value]; + const seen = new Set(variants); + const transforms = [ + (candidate) => candidate.normalize('NFC'), + (candidate) => candidate.normalize('NFD'), + // path-contract-allow: portable-logical-path -- Archive names require conservative case-collision closure. + (candidate) => candidate.toLocaleLowerCase('en-US'), + // path-contract-allow: portable-logical-path -- Archive names require conservative case-collision closure. + (candidate) => candidate.toLocaleUpperCase('en-US'), + ]; + + for (let cursor = 0; cursor < variants.length; cursor += 1) { + for (const transform of transforms) { + const transformed = transform(variants[cursor]); + if (seen.has(transformed)) continue; + if (variants.length >= MAX_SEMANTIC_VARIANTS) { + throw pathError( + value, + profile, + 'semantic-expansion', + 'Portable path semantic comparison exceeded its bounded Unicode expansion.', + { index, limit: MAX_SEMANTIC_VARIANTS }, + ); + } + seen.add(transformed); + variants.push(transformed); + } + } + + return variants; +} + +function classifySemanticCollision(value, conflictValue) { + if (value === conflictValue) return 'exact'; + if (value.normalize('NFC') === conflictValue.normalize('NFC')) return 'normalization'; + + const directLowerMatch = value.toLocaleLowerCase('en-US') + === conflictValue.toLocaleLowerCase('en-US'); + const directUpperMatch = value.toLocaleUpperCase('en-US') + === conflictValue.toLocaleUpperCase('en-US'); + return directLowerMatch || directUpperMatch ? 'case' : 'case-and-normalization'; +} + +function findSemanticCollision(semanticIndex, value, profile, sourceIndex) { + const variants = semanticEnvelope(value, profile, sourceIndex); + for (const variant of variants) { + const entry = semanticIndex.get(variant); + if (entry) { + return { + entry, + variants, + semantics: classifySemanticCollision(value, entry.value), + }; + } + } + return { entry: null, variants, semantics: null }; +} + +function rememberSemanticEntry(semanticIndex, entry, variants) { + for (const variant of variants) { + if (!semanticIndex.has(variant)) semanticIndex.set(variant, entry); + } +} + +export function validatePortablePathSet(values, options = {}) { + const profile = options?.profile; + assertProfile(profile); + if (!Array.isArray(values)) { + throw pathError(values, profile, 'set-type', 'Portable path set must be an array.'); + } + + const leafEntries = createSemanticIndex(); + const directoryEntries = createSemanticIndex(); + + for (const [index, value] of values.entries()) { + try { + validatePortablePath(value, { profile }); + } catch (error) { + if (error instanceof PortablePathError && error.index === undefined) error.index = index; + throw error; + } + + const leafCollision = findSemanticCollision(leafEntries, value, profile, index); + if (leafCollision.entry) { + const conflictIndex = leafCollision.entry.index; + throw collisionError( + values, + profile, + index, + conflictIndex, + leafCollision.semantics === 'exact' ? 'duplicate' : leafCollision.semantics, + { + collisionKind: 'entry', + semantics: leafCollision.semantics, + pathPart: value, + conflictPathPart: leafCollision.entry.value, + }, + ); + } + + const segments = value.split('/'); + const prefixes = segments.slice(0, -1).map((_, prefixIndex) => ( + segments.slice(0, prefixIndex + 1).join('/') + )); + for (const prefix of prefixes) { + const directoryCollision = findSemanticCollision(directoryEntries, prefix, profile, index); + if (directoryCollision.entry && directoryCollision.semantics !== 'exact') { + throw collisionError( + values, + profile, + index, + directoryCollision.entry.index, + `directory-${directoryCollision.semantics}`, + { + collisionKind: 'directory-spelling', + semantics: directoryCollision.semantics, + pathPart: prefix, + conflictPathPart: directoryCollision.entry.value, + }, + ); + } + + const fileCollision = findSemanticCollision(leafEntries, prefix, profile, index); + if (fileCollision.entry) { + throw collisionError( + values, + profile, + index, + fileCollision.entry.index, + fileCollision.semantics === 'exact' + ? 'tree-file' + : `tree-file-${fileCollision.semantics}`, + { + collisionKind: 'tree-file', + semantics: fileCollision.semantics, + pathPart: prefix, + conflictPathPart: fileCollision.entry.value, + }, + ); + } + } + + const directoryCollision = findSemanticCollision(directoryEntries, value, profile, index); + if (directoryCollision.entry) { + throw collisionError( + values, + profile, + index, + directoryCollision.entry.index, + directoryCollision.semantics === 'exact' + ? 'tree-file' + : `tree-file-${directoryCollision.semantics}`, + { + collisionKind: 'tree-file', + semantics: directoryCollision.semantics, + pathPart: value, + conflictPathPart: directoryCollision.entry.value, + }, + ); + } + + rememberSemanticEntry(leafEntries, { index, value }, leafCollision.variants); + for (const prefix of prefixes) { + rememberSemanticEntry( + directoryEntries, + { index, value: prefix }, + semanticEnvelope(prefix, profile, index), + ); + } + } + + return values; +} diff --git a/packages/diagram-core/vendor/archify/renderers/shared/repository-evidence.mjs b/packages/diagram-core/vendor/archify/renderers/shared/repository-evidence.mjs index fdfa531..33898c0 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/repository-evidence.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/repository-evidence.mjs @@ -1,11 +1,13 @@ import { spawnSync } from 'node:child_process'; import fs from 'node:fs'; import path from 'node:path'; -import { throwDiagnosticError } from './diagnostics.mjs'; +import { throwDiagnosticError, withDiagnosticRecordingSuppressed } from './diagnostics.mjs'; +import { sameEntry } from './path-semantics.mjs'; import { parseRepositoryRemote, redactRepositoryRemote, repositorySourceHref } from './repository-location.mjs'; const FULL_SHA_RE = /^[a-f0-9]{40}$/i; const CONTROL_CHARACTER_RE = /[\u0000-\u001f\u007f]/; +const MAX_SOURCE_BYTES = 16 * 1024 * 1024; function evidenceFailure(code, message, { subject = {}, evidence = {}, supportedFixes = [] } = {}) { throwDiagnosticError(message, [{ @@ -19,9 +21,10 @@ function evidenceFailure(code, message, { subject = {}, evidence = {}, supported } function runGit(repoRoot, args) { - const result = spawnSync('git', ['-C', repoRoot, ...args], { + // 固定 SHA 的来源必须读取原始对象,不能使用本地 replacement refs 的替换内容。 + const result = spawnSync('git', ['--no-replace-objects', '-C', repoRoot, ...args], { encoding: 'utf8', - maxBuffer: 16 * 1024 * 1024, + maxBuffer: MAX_SOURCE_BYTES, }); if (result.error) evidenceFailure('repository-evidence/git-unavailable', `Could not run Git: ${result.error.message}`, { evidence: { reason: result.error.message }, @@ -30,6 +33,56 @@ function runGit(repoRoot, args) { return result; } +// Check types in one session, then read only blobs whose cited lines need +// verification. Path-only references never require loading the file contents. +function prefetchBlobs(repoRoot, objectNeedsContent) { + const blobs = readBatchObjects(repoRoot, [...objectNeedsContent.keys()], false); + if (!blobs) return null; + const readable = [...objectNeedsContent].filter(([object, needsContent]) => { + const blob = blobs.get(object); + return needsContent && blob?.type === 'blob' && blob.size <= MAX_SOURCE_BYTES; + }).map(([object]) => object); + const contents = readBatchObjects(repoRoot, readable, true); + if (contents) for (const [object, blob] of contents) blobs.set(object, blob); + // Failed or oversized reads fall back in source order to the original + // per-file path, preserving its size limit and diagnostic behavior. + return blobs; +} + +function readBatchObjects(repoRoot, objects, includeContent) { + if (!objects.length) return new Map(); + const mode = includeContent ? '--batch' : '--batch-check'; + const result = spawnSync('git', ['--no-replace-objects', '-C', repoRoot, 'cat-file', mode], { + input: objects.join('\n') + '\n', + maxBuffer: 64 * 1024 * 1024, + }); + if (result.error || result.status !== 0 || !Buffer.isBuffer(result.stdout)) return null; + const buffer = result.stdout; + const blobs = new Map(); + let cursor = 0; + for (const object of objects) { + const newline = buffer.indexOf(0x0a, cursor); + if (newline < 0) return null; + const header = buffer.toString('utf8', cursor, newline); + cursor = newline + 1; + if (header.endsWith(' missing')) { + blobs.set(object, { missing: true }); + continue; + } + const parts = header.split(' '); + const size = Number(parts[2]); + if (parts.length !== 3 || !Number.isSafeInteger(size) || size < 0) return null; + const blob = { type: parts[1], size }; + if (includeContent) { + if (cursor + size >= buffer.length || buffer[cursor + size] !== 0x0a) return null; + blob.content = buffer.toString('utf8', cursor, cursor + size); + cursor += size + 1; + } + blobs.set(object, blob); + } + return blobs; +} + function gitValue(repoRoot, args, failure) { const result = runGit(repoRoot, args); if (result.status !== 0) evidenceFailure('repository-evidence/git-command', failure, { @@ -41,6 +94,7 @@ function gitValue(repoRoot, args, failure) { function verifiedSourcePath(value, where) { const sourcePath = String(value || ''); + // path-contract-allow: git-path -- Git tree entries use repository-relative POSIX syntax. if (!sourcePath || sourcePath.startsWith('/') || sourcePath.includes('\\') || CONTROL_CHARACTER_RE.test(sourcePath)) { evidenceFailure('repository-evidence/path-invalid', `${where} must be a repo-relative POSIX path.`, { subject: { path: where }, @@ -65,23 +119,38 @@ function sourceLineCount(content) { return lines.length - (/(?:\r\n|\n|\r)$/.test(content) ? 1 : 0); } +// Every diagram type carries its nodes under a different property name, and +// source evidence is authored on those nodes. One table keeps the verification +// below identical for all five types instead of branching per type: the only +// per-type fact is which array to read and which JSON pointer to quote back. +const EVIDENCE_NODE_COLLECTIONS = { + architecture: 'components', + workflow: 'nodes', + sequence: 'participants', + dataflow: 'nodes', + lifecycle: 'states', +}; + +function evidenceNodes(diagramType, diagram) { + const collection = EVIDENCE_NODE_COLLECTIONS[diagramType]; + if (!collection) return null; + return { collection, nodes: Array.isArray(diagram?.[collection]) ? diagram[collection] : [] }; +} + export function hasRepositoryEvidence(diagramType, diagram) { - if (diagramType !== 'architecture') return false; - const components = Array.isArray(diagram?.components) ? diagram.components : []; - return Boolean(diagram?.meta?.repository) || components.some((component) => Array.isArray(component?.sources) && component.sources.length); + const authored = evidenceNodes(diagramType, diagram); + if (!authored) return false; + return Boolean(diagram?.meta?.repository) || authored.nodes.some((node) => Array.isArray(node?.sources) && node.sources.length); } export function verifyRepositoryEvidence(diagramType, diagram, repoRootInput) { if (!hasRepositoryEvidence(diagramType, diagram)) return null; - if (diagramType !== 'architecture') evidenceFailure('repository-evidence/type-unsupported', 'Repository evidence is currently supported for architecture diagrams only.', { - subject: { diagramType }, - supportedFixes: ['use architecture mode or remove repository evidence'], - }); + const { collection, nodes: authoredNodes } = evidenceNodes(diagramType, diagram); const repository = diagram.meta?.repository; if (!repository) evidenceFailure('repository-evidence/repository-required', 'Repository evidence requires /meta/repository.', { - subject: { path: '/meta/repository' }, - supportedFixes: ['add the pinned repository metadata or remove component sources'], + subject: { path: '/meta/repository', diagramType, collection }, + supportedFixes: [`add the pinned repository metadata or remove /${collection} sources`], }); if (!FULL_SHA_RE.test(repository.revision || '')) { evidenceFailure('repository-evidence/revision-invalid', '/meta/repository/revision must be a full 40-character commit SHA.', { @@ -92,9 +161,13 @@ export function verifyRepositoryEvidence(diagramType, diagram, repoRootInput) { } const location = parseRepositoryRemote(repository.url, { authored: true }); if (!location) { + // A filesystem path is the common authoring mistake: the field carries the + // remote origin identity, which `git remote get-url origin` reports. + const filesystemPath = /^(?:[\\/]|~|\.{1,2}(?:[\\/]|$)|[A-Za-z]:[\\/])/.test(String(repository.url ?? '')); evidenceFailure('repository-evidence/url-invalid', '/meta/repository/url must be a credential-free HTTP(S) or Git SSH repository address without query, fragment, or dot segments.', { subject: { path: '/meta/repository/url' }, - supportedFixes: ['declare the matching repository address without credentials; use link_mode: local-only for internal repositories'], + evidence: filesystemPath ? { authoredValueLooksLike: 'local filesystem path; the expected value is the remote origin address' } : {}, + supportedFixes: ['run `git remote get-url origin` inside --repo-root and declare that credential-free address', 'use link_mode: local-only for internal repositories'], }); } const linkMode = repository.link_mode ?? 'web'; @@ -130,7 +203,15 @@ export function verifyRepositoryEvidence(diagramType, diagram, repoRootInput) { }); } const gitRoot = gitValue(realRoot, ['rev-parse', '--show-toplevel'], `Evidence root "${realRoot}" is not a Git repository.`); - if (fs.realpathSync(gitRoot) !== realRoot) { + const rootIdentity = sameEntry(realRoot, gitRoot); + if (rootIdentity.status === 'unknown') { + evidenceFailure('repository-evidence/root-identity-indeterminate', 'Could not determine whether the evidence root is the Git top-level directory.', { + subject: { repoRoot: realRoot }, + evidence: { gitTopLevel: gitRoot, relation: rootIdentity.reason }, + supportedFixes: ['pass the readable Git top-level directory using its canonical filesystem path'], + }); + } + if (rootIdentity.status === 'different') { evidenceFailure('repository-evidence/root-not-top-level', `Evidence root must be the Git top-level directory: ${gitRoot}`, { subject: { repoRoot: realRoot }, evidence: { gitTopLevel: gitRoot }, @@ -157,14 +238,39 @@ export function verifyRepositoryEvidence(diagramType, diagram, repoRootInput) { }); } + // The batch is an optimization only: every path, line-range, file and line + // check still runs in source order in the verification loop below, so a + // citation the batch cannot answer for never reorders the first diagnostic. + const citedObjects = new Map(); + for (const [nodeIndex, node] of authoredNodes.entries()) { + if (!Array.isArray(node.sources) || node.sources.length === 0) continue; + for (const [sourceIndex, authored] of node.sources.entries()) { + const at = `/${collection}/${nodeIndex}/sources/${sourceIndex}`; + let sourcePath; + try { + sourcePath = withDiagnosticRecordingSuppressed(() => verifiedSourcePath(authored.path, `${at}/path`)); + } catch { + continue; + } + const object = `${revision}:${sourcePath}`; + citedObjects.set(object, citedObjects.get(object) || Boolean(authored.line)); + } + } + const prefetchedBlobs = prefetchBlobs(realRoot, citedObjects); + const nodes = Object.create(null); let referenceCount = 0; - const components = Array.isArray(diagram.components) ? diagram.components : []; - for (const [componentIndex, component] of components.entries()) { - if (!Array.isArray(component.sources) || component.sources.length === 0) continue; + for (const [nodeIndex, node] of authoredNodes.entries()) { + if (!Array.isArray(node.sources) || node.sources.length === 0) continue; + // `componentId` shipped with the architecture-only path; keep it beside the + // type-neutral `nodeId` so existing agent handling stays valid. + const nodeSubject = collection === 'components' + ? { diagramType, collection, nodeId: node.id, componentId: node.id } + : { diagramType, collection, nodeId: node.id }; const verified = []; - for (const [sourceIndex, authored] of component.sources.entries()) { - const where = `/components/${componentIndex}/sources/${sourceIndex}/path`; + for (const [sourceIndex, authored] of node.sources.entries()) { + const at = `/${collection}/${nodeIndex}/sources/${sourceIndex}`; + const where = `${at}/path`; const source = { path: verifiedSourcePath(authored.path, where), ...(authored.line ? { line: authored.line } : {}), @@ -172,39 +278,47 @@ export function verifyRepositoryEvidence(diagramType, diagram, repoRootInput) { ...(authored.label ? { label: authored.label } : {}), }; if (source.endLine && !source.line) { - evidenceFailure('repository-evidence/line-required', `/components/${componentIndex}/sources/${sourceIndex}/end_line requires line.`, { - subject: { path: `/components/${componentIndex}/sources/${sourceIndex}/end_line`, componentId: component.id }, + evidenceFailure('repository-evidence/line-required', `${at}/end_line requires line.`, { + subject: { path: `${at}/end_line`, ...nodeSubject }, supportedFixes: ['add line or remove end_line'], }); } if (source.endLine && source.endLine < source.line) { - evidenceFailure('repository-evidence/line-range-invalid', `/components/${componentIndex}/sources/${sourceIndex}/end_line must be greater than or equal to line.`, { - subject: { path: `/components/${componentIndex}/sources/${sourceIndex}`, componentId: component.id }, + evidenceFailure('repository-evidence/line-range-invalid', `${at}/end_line must be greater than or equal to line.`, { + subject: { path: at, ...nodeSubject }, evidence: { line: source.line, endLine: source.endLine }, supportedFixes: ['use an end_line greater than or equal to line'], }); } const object = `${revision}:${source.path}`; - const type = runGit(realRoot, ['cat-file', '-t', object]); - if (type.status !== 0 || type.stdout.trim() !== 'blob') { + const prefetched = prefetchedBlobs ? prefetchedBlobs.get(object) : undefined; + const objectIsBlob = prefetched + ? !prefetched.missing && prefetched.type === 'blob' + : (() => { + const type = runGit(realRoot, ['cat-file', '-t', object]); + return type.status === 0 && type.stdout.trim() === 'blob'; + })(); + if (!objectIsBlob) { evidenceFailure('repository-evidence/file-missing', `${where} does not identify a file at revision ${revision}.`, { - subject: { path: where, componentId: component.id }, + subject: { path: where, ...nodeSubject }, evidence: { sourcePath: source.path, revision }, supportedFixes: ['use a file path that exists at the pinned revision'], }); } if (source.line) { - const content = runGit(realRoot, ['show', object]); + const content = prefetched && Object.hasOwn(prefetched, 'content') + ? { status: 0, stdout: prefetched.content } + : runGit(realRoot, ['show', object]); if (content.status !== 0) evidenceFailure('repository-evidence/file-unreadable', `${where} could not be read at revision ${revision}.`, { - subject: { path: where, componentId: component.id }, + subject: { path: where, ...nodeSubject }, evidence: { sourcePath: source.path, revision }, supportedFixes: ['verify the pinned blob is readable in the local checkout'], }); const lineCount = sourceLineCount(content.stdout); const requestedLine = source.endLine || source.line; if (requestedLine > lineCount) { - evidenceFailure('repository-evidence/line-out-of-range', `/components/${componentIndex}/sources/${sourceIndex} requests line ${requestedLine}, but ${source.path} has ${lineCount} lines at revision ${revision}.`, { - subject: { path: `/components/${componentIndex}/sources/${sourceIndex}`, componentId: component.id }, + evidenceFailure('repository-evidence/line-out-of-range', `${at} requests line ${requestedLine}, but ${source.path} has ${lineCount} lines at revision ${revision}.`, { + subject: { path: at, ...nodeSubject }, evidence: { sourcePath: source.path, requestedLine, lineCount, revision }, supportedFixes: ['use a line range that exists at the pinned revision'], }); @@ -213,12 +327,12 @@ export function verifyRepositoryEvidence(diagramType, diagram, repoRootInput) { verified.push({ ...source, ...(linkMode === 'web' ? { href: repositorySourceHref(location.provider, location.url, revision, source) } : {}) }); referenceCount += 1; } - nodes[component.id] = verified; + nodes[node.id] = verified; } if (referenceCount === 0) { - evidenceFailure('repository-evidence/source-required', '/meta/repository requires at least one component source reference.', { - subject: { path: '/meta/repository' }, - supportedFixes: ['add at least one verified component source or remove repository metadata'], + evidenceFailure('repository-evidence/source-required', `/meta/repository requires at least one /${collection} source reference.`, { + subject: { path: '/meta/repository', diagramType, collection }, + supportedFixes: [`add at least one verified /${collection} source or remove repository metadata`], }); } diff --git a/packages/diagram-core/vendor/archify/renderers/shared/repository-location.mjs b/packages/diagram-core/vendor/archify/renderers/shared/repository-location.mjs index 32257d6..aa6ee82 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/repository-location.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/repository-location.mjs @@ -36,6 +36,7 @@ export function parseRepositoryRemote(value, { authored = false } = {}) { const endpoint = provider && ((protocol === 'https:' && port === '443') || (protocol === 'ssh:' && port === '22')) ? 'standard' : `${protocol}${port}`; const pathKind = provider ? 'repository' : scp && !scpAbsolute ? 'relative' : 'absolute'; + // path-contract-allow: url-path -- GitHub repository names are case-insensitive URL identities. const identityPath = provider === 'github' ? repositoryPath.toLowerCase() : repositoryPath; const encodedPath = segments.map(encodeURIComponent).join('/'); const canonicalUrl = scp ? `git@${hostname}:${scpAbsolute ? '/' : ''}${repositoryPath}` diff --git a/packages/diagram-core/vendor/archify/renderers/shared/route-quality.mjs b/packages/diagram-core/vendor/archify/renderers/shared/route-quality.mjs new file mode 100644 index 0000000..a79779f --- /dev/null +++ b/packages/diagram-core/vendor/archify/renderers/shared/route-quality.mjs @@ -0,0 +1,614 @@ +import { recordDiagnostic } from './diagnostics.mjs'; +import { + asArray, + isFinitePoint, + normalizeRoutePoints, + properSegmentIntersection, + segmentIntersectsRect, +} from './geometry.mjs'; + +const DEFAULTS = Object.freeze({ + clearance: 2, + minimumDetourRatio: 2.5, + minimumExcessLengthPx: 200, + minimumEmptyExcursionPx: 96, + maximumObstacleCount: 80, + sharedCorridorMinimumPx: 32, +}); + +const OUTWARD = Object.freeze({ + left: [-1, 0], + right: [1, 0], + top: [0, -1], + bottom: [0, 1], +}); + +function rounded(value) { + return Math.round(value * 100) / 100; +} + +function pointKey(point) { + return `${point[0]}\u0000${point[1]}`; +} + +class MinHeap { + constructor() { + this.entries = []; + } + + push(key, distance) { + const entry = { key, distance }; + this.entries.push(entry); + let index = this.entries.length - 1; + while (index > 0) { + const parent = Math.floor((index - 1) / 2); + if (this.entries[parent].distance <= distance) break; + this.entries[index] = this.entries[parent]; + index = parent; + } + this.entries[index] = entry; + } + + pop() { + if (!this.entries.length) return null; + const first = this.entries[0]; + const last = this.entries.pop(); + if (!this.entries.length) return first; + let index = 0; + while (true) { + const left = index * 2 + 1; + const right = left + 1; + if (left >= this.entries.length) break; + const child = right < this.entries.length + && this.entries[right].distance < this.entries[left].distance ? right : left; + if (this.entries[child].distance >= last.distance) break; + this.entries[index] = this.entries[child]; + index = child; + } + this.entries[index] = last; + return first; + } +} + +function orthogonalLength(points) { + let total = 0; + for (let index = 0; index < points.length - 1; index += 1) { + const [x1, y1] = points[index]; + const [x2, y2] = points[index + 1]; + if (x1 !== x2 && y1 !== y2) return null; + total += Math.abs(x2 - x1) + Math.abs(y2 - y1); + } + return total; +} + +function inferredSide(points, endpoint) { + if (points.length < 2) return null; + const start = endpoint === 'source' ? points[0] : points.at(-2); + const end = endpoint === 'source' ? points[1] : points.at(-1); + const dx = end[0] - start[0]; + const dy = end[1] - start[1]; + if (endpoint === 'source') { + if (dx > 0 && dy === 0) return 'right'; + if (dx < 0 && dy === 0) return 'left'; + if (dy > 0 && dx === 0) return 'bottom'; + if (dy < 0 && dx === 0) return 'top'; + } else { + if (dx > 0 && dy === 0) return 'left'; + if (dx < 0 && dy === 0) return 'right'; + if (dy > 0 && dx === 0) return 'top'; + if (dy < 0 && dx === 0) return 'bottom'; + } + return null; +} + +function moveOutward(point, side, distance) { + const [dx, dy] = OUTWARD[side] || [0, 0]; + return [point[0] + dx * distance, point[1] + dy * distance]; +} + +function expandedRect(rect, clearance) { + return { + id: rect.id, + x: rect.x - clearance, + y: rect.y - clearance, + width: rect.width + clearance * 2, + height: rect.height + clearance * 2, + }; +} + +function boundsForRects(rects) { + const usable = [...rects].filter((rect) => ( + rect && isFinitePoint(rect.x, rect.y, rect.width, rect.height) + && rect.width >= 0 && rect.height >= 0 + )); + if (!usable.length) return null; + const left = Math.min(...usable.map((rect) => rect.x)); + const top = Math.min(...usable.map((rect) => rect.y)); + const right = Math.max(...usable.map((rect) => rect.x + rect.width)); + const bottom = Math.max(...usable.map((rect) => rect.y + rect.height)); + return { left, top, right, bottom, width: right - left, height: bottom - top }; +} + +function boundsForPoints(points) { + if (!points.length) return null; + const xs = points.map(([x]) => x); + const ys = points.map(([, y]) => y); + const left = Math.min(...xs); + const top = Math.min(...ys); + const right = Math.max(...xs); + const bottom = Math.max(...ys); + return { left, top, right, bottom, width: right - left, height: bottom - top }; +} + +function outsideExcursion(routeBounds, contentBounds) { + if (!routeBounds || !contentBounds) return null; + const sides = { + left: Math.max(0, contentBounds.left - routeBounds.left), + top: Math.max(0, contentBounds.top - routeBounds.top), + right: Math.max(0, routeBounds.right - contentBounds.right), + bottom: Math.max(0, routeBounds.bottom - contentBounds.bottom), + }; + return { ...sides, maximum: Math.max(...Object.values(sides)) }; +} + +function pointDistanceFromRect(point, rect) { + const dx = Math.max(rect.x - point[0], 0, point[0] - (rect.x + rect.width)); + const dy = Math.max(rect.y - point[1], 0, point[1] - (rect.y + rect.height)); + return dx + dy; +} + +function emptyControlPointClearance(points, contentRects) { + const controls = points.slice(1, -1); + const rects = [...contentRects].filter((rect) => ( + rect && isFinitePoint(rect.x, rect.y, rect.width, rect.height) + && rect.width >= 0 && rect.height >= 0 + )); + if (!controls.length || !rects.length) return null; + const distances = controls.map((point) => Math.min( + ...rects.map((rect) => pointDistanceFromRect(point, rect)), + )); + const maximum = Math.max(...distances); + return { maximum, point: controls[distances.indexOf(maximum)] }; +} + +function pointBlocked(point, obstacles) { + return obstacles.some((rect) => ( + point[0] >= rect.x && point[0] <= rect.x + rect.width + && point[1] >= rect.y && point[1] <= rect.y + rect.height + )); +} + +function segmentBlocked(start, end, obstacles) { + return obstacles.some((rect) => segmentIntersectsRect({ start, end }, rect)); +} + +function segmentConflictsWithAvoided(start, end, avoidedSegments, minimumOverlapPx, allowCrossings) { + return avoidedSegments.some((segment) => ( + (!allowCrossings && (properSegmentIntersection(start, end, segment.start, segment.end) + || orthogonalTouchOnAvoidedInterior(start, end, segment.start, segment.end))) + || collinearOverlap(start, end, segment.start, segment.end) >= minimumOverlapPx + )); +} + +function orthogonalTouchOnAvoidedInterior(start, end, avoidedStart, avoidedEnd) { + const epsilon = 0.0001; + const candidateHorizontal = Math.abs(start[1] - end[1]) <= epsilon; + const candidateVertical = Math.abs(start[0] - end[0]) <= epsilon; + const avoidedHorizontal = Math.abs(avoidedStart[1] - avoidedEnd[1]) <= epsilon; + const avoidedVertical = Math.abs(avoidedStart[0] - avoidedEnd[0]) <= epsilon; + if (candidateHorizontal && avoidedVertical) { + const x = avoidedStart[0]; + const y = start[1]; + return x >= Math.min(start[0], end[0]) - epsilon + && x <= Math.max(start[0], end[0]) + epsilon + && y > Math.min(avoidedStart[1], avoidedEnd[1]) + epsilon + && y < Math.max(avoidedStart[1], avoidedEnd[1]) - epsilon; + } + if (candidateVertical && avoidedHorizontal) { + const x = start[0]; + const y = avoidedStart[1]; + return y >= Math.min(start[1], end[1]) - epsilon + && y <= Math.max(start[1], end[1]) + epsilon + && x > Math.min(avoidedStart[0], avoidedEnd[0]) + epsilon + && x < Math.max(avoidedStart[0], avoidedEnd[0]) - epsilon; + } + return false; +} + +function pointOnSegmentInterior(point, start, end) { + const epsilon = 0.0001; + const cross = (end[0] - start[0]) * (point[1] - start[1]) + - (end[1] - start[1]) * (point[0] - start[0]); + if (Math.abs(cross) > epsilon) return false; + const dot = (point[0] - start[0]) * (point[0] - end[0]) + + (point[1] - start[1]) * (point[1] - end[1]); + return dot < -epsilon; +} + +function pointOnAvoidedInterior(point, avoidedSegments) { + return avoidedSegments.some((segment) => ( + pointOnSegmentInterior(point, segment.start, segment.end) + )); +} + +function writeGridMetrics(metrics, patch) { + if (!metrics || typeof metrics !== 'object') return; + Object.assign(metrics, patch); +} + +export function shortestOrthogonalGridRoute({ + start, + end, + points, + obstacles, + fromSide, + toSide, + clearance, + maximumObstacleCount, + endpointStubPx = clearance + 2, + maximumGridNodes = Infinity, + avoidedSegments = [], + allowAvoidedCrossings = false, + minimumAvoidedOverlapPx = 8, + routeSeparationPx = 8, + minimumSegmentPx = 8, + borderSegments = [], + bendPenaltyPx = 0, + metrics, +}) { + writeGridMetrics(metrics, { + status: 'initializing', + maximumGridNodes, + obstacleCount: 0, + avoidedSegmentCount: 0, + coordinateCount: 0, + candidateNodeCount: 0, + usableNodeCount: 0, + graphEdgeCount: 0, + visitedNodeCount: 0, + }); + if (!OUTWARD[fromSide] || !OUTWARD[toSide]) { + writeGridMetrics(metrics, { status: 'unsupported-endpoint-side' }); + return null; + } + const startStub = moveOutward(start, fromSide, endpointStubPx); + const endStub = moveOutward(end, toSide, endpointStubPx); + // The graph may legally leave the initial endpoint bounds to find a clear + // corridor. Keep every bounded obstacle and occupied relationship visible + // to that search; filtering them against the initial box lets a detour walk + // straight through geometry that only becomes relevant after it leaves the + // box. The explicit obstacle/node budgets below keep this deterministic. + const expanded = [...obstacles] + .filter((rect) => rect && isFinitePoint(rect.x, rect.y, rect.width, rect.height)) + .map((rect) => expandedRect(rect, clearance)); + const relevantAvoidedSegments = [...avoidedSegments] + .filter((segment) => segment?.start && segment?.end); + // Frame borders may be crossed perpendicularly but never borrowed as a + // corridor: the composition gate rejects any collinear run along them. + const relevantBorderSegments = [...borderSegments] + .filter((segment) => segment?.start && segment?.end); + writeGridMetrics(metrics, { + obstacleCount: expanded.length, + avoidedSegmentCount: relevantAvoidedSegments.length, + }); + if (expanded.length > maximumObstacleCount) { + writeGridMetrics(metrics, { status: 'obstacle-budget-exceeded' }); + return null; + } + + const xs = new Set([startStub[0], endStub[0], ...points.map(([x]) => x)]); + const ys = new Set([startStub[1], endStub[1], ...points.map(([, y]) => y)]); + for (const rect of expanded) { + xs.add(rect.x - 1); + xs.add(rect.x + rect.width + 1); + ys.add(rect.y - 1); + ys.add(rect.y + rect.height + 1); + } + for (const segment of relevantAvoidedSegments) { + const [segmentStart, segmentEnd] = [segment.start, segment.end]; + xs.add(segmentStart[0]); + xs.add(segmentEnd[0]); + ys.add(segmentStart[1]); + ys.add(segmentEnd[1]); + if (Math.abs(segmentStart[0] - segmentEnd[0]) <= 0.0001) { + xs.add(segmentStart[0] - routeSeparationPx); + xs.add(segmentStart[0] + routeSeparationPx); + } + if (Math.abs(segmentStart[1] - segmentEnd[1]) <= 0.0001) { + ys.add(segmentStart[1] - routeSeparationPx); + ys.add(segmentStart[1] + routeSeparationPx); + } + } + for (const segment of relevantBorderSegments) { + if (Math.abs(segment.start[0] - segment.end[0]) <= 0.0001) { + xs.add(segment.start[0] - routeSeparationPx); + xs.add(segment.start[0] + routeSeparationPx); + } + if (Math.abs(segment.start[1] - segment.end[1]) <= 0.0001) { + ys.add(segment.start[1] - routeSeparationPx); + ys.add(segment.start[1] + routeSeparationPx); + } + } + // Grid lines closer than a readable segment would let the search emit a + // micro jog between two obstacle edges; keep the endpoint stubs and coalesce + // the rest so every turn the route can take is at least one segment long. + const coalesce = (values, keep) => values.sort((a, b) => a - b).filter((value, index, sorted) => ( + index === 0 || keep.has(value) || value - sorted[index - 1] >= minimumSegmentPx + )); + const orderedX = coalesce([...xs], new Set([startStub[0], endStub[0]])); + const orderedY = coalesce([...ys], new Set([startStub[1], endStub[1]])); + const candidateNodeCount = orderedX.length * orderedY.length; + writeGridMetrics(metrics, { + coordinateCount: orderedX.length + orderedY.length, + candidateNodeCount, + }); + if (candidateNodeCount > maximumGridNodes) { + writeGridMetrics(metrics, { status: 'node-budget-exceeded' }); + return null; + } + const nodes = new Map(); + for (const x of orderedX) { + for (const y of orderedY) { + const point = [x, y]; + if (!pointBlocked(point, expanded) + && (allowAvoidedCrossings || !pointOnAvoidedInterior(point, relevantAvoidedSegments))) { + nodes.set(pointKey(point), point); + } + } + } + writeGridMetrics(metrics, { usableNodeCount: nodes.size }); + if (!nodes.has(pointKey(startStub)) || !nodes.has(pointKey(endStub))) { + writeGridMetrics(metrics, { status: 'endpoint-blocked' }); + return null; + } + + const adjacency = new Map([...nodes.keys()].map((key) => [key, []])); + let graphEdgeCount = 0; + const connectLine = (line, axis) => { + for (let index = 0; index < line.length - 1; index += 1) { + const left = line[index]; + const right = line[index + 1]; + if (segmentBlocked(left, right, expanded)) continue; + if (segmentConflictsWithAvoided( + left, + right, + relevantAvoidedSegments, + minimumAvoidedOverlapPx, + allowAvoidedCrossings, + )) continue; + if (relevantBorderSegments.some((segment) => ( + collinearOverlap(left, right, segment.start, segment.end) > 0.0001 + ))) continue; + const distance = Math.abs(right[0] - left[0]) + Math.abs(right[1] - left[1]); + const leftKey = pointKey(left); + const rightKey = pointKey(right); + adjacency.get(leftKey).push([rightKey, distance, axis === 'h' ? 'R' : 'D']); + adjacency.get(rightKey).push([leftKey, distance, axis === 'h' ? 'L' : 'U']); + graphEdgeCount += 1; + } + }; + for (const y of orderedY) { + connectLine(orderedX.map((x) => nodes.get(pointKey([x, y]))).filter(Boolean), 'h'); + } + for (const x of orderedX) { + connectLine(orderedY.map((y) => nodes.get(pointKey([x, y]))).filter(Boolean), 'v'); + } + writeGridMetrics(metrics, { graphEdgeCount }); + + // The search state carries the incoming direction so a turn can cost extra + // and a reversal is never taken: the pure shortest path hugs every obstacle + // corner with a staircase of short jogs, while a bend-penalised one takes + // the same corridor in a few long strokes. The first stub already leaves + // the endpoint along its side and the last one arrives along the end side. + const directionOf = ([dx, dy]) => (dx > 0 ? 'R' : dx < 0 ? 'L' : dy > 0 ? 'D' : 'U'); + const opposite = { R: 'L', L: 'R', D: 'U', U: 'D' }; + const stateKey = (key, direction) => `${key}|${direction}`; + const sourceAxis = directionOf(OUTWARD[fromSide]); + const targetAxis = opposite[directionOf(OUTWARD[toSide])]; + const source = pointKey(startStub); + const target = pointKey(endStub); + const sourceState = stateKey(source, sourceAxis); + const distances = new Map([[sourceState, 0]]); + const previous = new Map(); + const queue = new MinHeap(); + queue.push(sourceState, 0); + let visitedNodeCount = 0; + let targetState = null; + while (queue.entries.length) { + const next = queue.pop(); + const current = next.key; + const currentDistance = next.distance; + if (currentDistance !== distances.get(current)) continue; + visitedNodeCount += 1; + const [currentNode, currentAxis] = current.split('|'); + if (currentNode === target) { + // Arriving on the wrong axis costs one final turn onto the end stub. + const arrival = currentDistance + (currentAxis === targetAxis ? 0 : bendPenaltyPx); + if (targetState == null || arrival < targetState.distance) { + targetState = { key: current, distance: arrival }; + } + if (currentAxis === targetAxis || bendPenaltyPx === 0) break; + continue; + } + if (targetState && currentDistance >= targetState.distance) break; + for (const [neighbor, weight, axis] of adjacency.get(currentNode) || []) { + if (axis === opposite[currentAxis]) continue; + const candidate = currentDistance + weight + (axis === currentAxis ? 0 : bendPenaltyPx); + const neighborState = stateKey(neighbor, axis); + if (candidate >= (distances.get(neighborState) ?? Infinity)) continue; + distances.set(neighborState, candidate); + previous.set(neighborState, current); + queue.push(neighborState, candidate); + } + } + writeGridMetrics(metrics, { visitedNodeCount }); + if (!targetState) { + writeGridMetrics(metrics, { status: 'no-route' }); + return null; + } + const reversed = []; + for (let key = targetState.key; key; key = previous.get(key)) { + reversed.push(nodes.get(key.split('|')[0])); + if (key === sourceState) break; + } + if (pointKey(reversed.at(-1)) !== source) { + writeGridMetrics(metrics, { status: 'broken-predecessor-chain' }); + return null; + } + const shortestPoints = normalizeRoutePoints([start, ...reversed.reverse(), end]); + writeGridMetrics(metrics, { status: 'routed' }); + return { + points: shortestPoints, + length: orthogonalLength(shortestPoints), + obstacleCount: expanded.length, + }; +} + +function collinearOverlap(leftStart, leftEnd, rightStart, rightEnd) { + if (leftStart[0] === leftEnd[0] && rightStart[0] === rightEnd[0] + && leftStart[0] === rightStart[0]) { + return Math.max(0, Math.min(Math.max(leftStart[1], leftEnd[1]), Math.max(rightStart[1], rightEnd[1])) + - Math.max(Math.min(leftStart[1], leftEnd[1]), Math.min(rightStart[1], rightEnd[1]))); + } + if (leftStart[1] === leftEnd[1] && rightStart[1] === rightEnd[1] + && leftStart[1] === rightStart[1]) { + return Math.max(0, Math.min(Math.max(leftStart[0], leftEnd[0]), Math.max(rightStart[0], rightEnd[0])) + - Math.max(Math.min(leftStart[0], leftEnd[0]), Math.min(rightStart[0], rightEnd[0]))); + } + return 0; +} + +function segmentOutsideContent(start, end, contentBounds) { + if (!contentBounds) return false; + const midpoint = [(start[0] + end[0]) / 2, (start[1] + end[1]) / 2]; + return midpoint[0] < contentBounds.left || midpoint[0] > contentBounds.right + || midpoint[1] < contentBounds.top || midpoint[1] > contentBounds.bottom; +} + +function sharesOuterCorridor({ relation, relations, pathFor, points, contentBounds, minimumOverlap }) { + for (const other of asArray(relations)) { + if (!other || other === relation) continue; + const related = relation.from === other.from || relation.from === other.to + || relation.to === other.from || relation.to === other.to; + if (!related) continue; + const otherPoints = normalizeRoutePoints(pathFor(other)?.points || []); + for (let left = 0; left < points.length - 1; left += 1) { + if (!segmentOutsideContent(points[left], points[left + 1], contentBounds)) continue; + for (let right = 0; right < otherPoints.length - 1; right += 1) { + if (collinearOverlap(points[left], points[left + 1], otherPoints[right], otherPoints[right + 1]) >= minimumOverlap) { + return true; + } + } + } + } + return false; +} + +function relationshipSubject(diagramType, relationCollection, relationIndex, relation) { + return { + diagramType, + collection: relationCollection, + index: relationIndex, + ...(relation.id ? { id: relation.id } : {}), + from: relation.from, + to: relation.to, + }; +} + +/** + * Reject conspicuous authored detours without penalizing routes whose length is + * explained by opaque-node avoidance or a related shared outer corridor. + */ +export function cleanRouteDetourProblems({ + relations, + obstacles, + contentRects = obstacles, + endpointIds, + pathFor, + fromSideFor, + toSideFor, + diagramType, + relationCollection, + profile, + thresholds = {}, +}) { + if (profile !== 'showcase') return []; + const policy = { ...DEFAULTS, ...thresholds }; + const obstacleList = [...obstacles]; + const contentBounds = boundsForRects(contentRects); + const problems = []; + for (const [relationIndex, relation] of asArray(relations).entries()) { + if (!relation || !endpointIds?.has(relation.from) || !endpointIds?.has(relation.to)) continue; + if (!Array.isArray(relation.via) || relation.via.length === 0) continue; + const points = normalizeRoutePoints(pathFor(relation)?.points || []); + if (points.length < 3 || !points.every((point) => Array.isArray(point) && isFinitePoint(...point))) continue; + const actualLength = orthogonalLength(points); + if (!Number.isFinite(actualLength)) continue; + const start = points[0]; + const end = points.at(-1); + const manhattan = Math.abs(end[0] - start[0]) + Math.abs(end[1] - start[1]); + if (actualLength < manhattan * policy.minimumDetourRatio + || actualLength - manhattan < policy.minimumExcessLengthPx) continue; + const routeBounds = boundsForPoints(points); + const excursion = outsideExcursion(routeBounds, contentBounds); + const emptyClearance = emptyControlPointClearance(points, obstacleList); + if (Math.max(excursion?.maximum || 0, emptyClearance?.maximum || 0) + < policy.minimumEmptyExcursionPx) continue; + if (sharesOuterCorridor({ + relation, + relations, + pathFor, + points, + contentBounds, + minimumOverlap: policy.sharedCorridorMinimumPx, + })) continue; + + const fromSide = fromSideFor?.(relation) || inferredSide(points, 'source'); + const toSide = toSideFor?.(relation) || inferredSide(points, 'target'); + const shortest = shortestOrthogonalGridRoute({ + start, + end, + points, + obstacles: obstacleList, + fromSide, + toSide, + clearance: policy.clearance, + maximumObstacleCount: policy.maximumObstacleCount, + }); + if (!shortest || !Number.isFinite(shortest.length) || shortest.length <= 0) continue; + const detourRatio = actualLength / shortest.length; + const excessLength = actualLength - shortest.length; + if (detourRatio < policy.minimumDetourRatio || excessLength < policy.minimumExcessLengthPx) continue; + + const relationId = relation.id ? ` id "${relation.id}"` : ''; + const message = `[composition/excessive-route-detour] ${diagramType} ${relationCollection}[${relationIndex}]${relationId} "${relation.from}" -> "${relation.to}" travels ${Math.round(actualLength)}px, ${rounded(detourRatio)}x the ${Math.round(shortest.length)}px shortest obstacle-clearing orthogonal route, and reaches ${Math.round(excursion.maximum)}px beyond the content bounds — remove the distant via corridor or move it close to the connected content.`; + const supportedFix = 'remove the distant via points and retry automatic routing, or keep the endpoint sides and move the via corridor near the connected nodes while preserving labels and direction'; + recordDiagnostic({ + code: 'composition/excessive-route-detour', + severity: 'error', + message, + subject: relationshipSubject(diagramType, relationCollection, relationIndex, relation), + evidence: { + points, + actualLengthPx: rounded(actualLength), + shortestLegalPoints: shortest.points, + shortestLegalLengthPx: rounded(shortest.length), + detourRatio: rounded(detourRatio), + excessLengthPx: rounded(excessLength), + routeBounds, + contentBounds, + emptyExcursionPx: excursion, + emptyControlPointClearancePx: emptyClearance, + obstacleCount: shortest.obstacleCount, + thresholds: { + minimumDetourRatio: policy.minimumDetourRatio, + minimumExcessLengthPx: policy.minimumExcessLengthPx, + minimumEmptyExcursionPx: policy.minimumEmptyExcursionPx, + }, + }, + supportedFixes: [supportedFix], + }); + problems.push(message); + } + return problems; +} diff --git a/packages/diagram-core/vendor/archify/renderers/shared/sidecar-path.mjs b/packages/diagram-core/vendor/archify/renderers/shared/sidecar-path.mjs new file mode 100644 index 0000000..32e7360 --- /dev/null +++ b/packages/diagram-core/vendor/archify/renderers/shared/sidecar-path.mjs @@ -0,0 +1,38 @@ +import { createHash } from 'node:crypto'; + +const SIDECAR_STEM_NAMESPACE = /\.~archify-[0-9a-f]{64}$/iu; + +export function sidecarStemNeedsBounding(stem, suffixes) { + const fits = (value) => value.length <= 255 && Buffer.byteLength(value, 'utf8') <= 255; + return !suffixes.every((suffix) => fits(`${stem}${suffix}`)); +} + +export function boundedSidecarStem(stem, suffixes, { force = false, hashDomain } = {}) { + if (!force && !sidecarStemNeedsBounding(stem, suffixes) + && !SIDECAR_STEM_NAMESPACE.test(stem)) return stem; + const hashInput = hashDomain ? `${hashDomain}\0${stem}` : stem; + const marker = `.~archify-${createHash('sha256').update(hashInput).digest('hex')}`; + const codePoints = [...stem]; + while (codePoints.length + && sidecarStemNeedsBounding(`${codePoints.join('')}${marker}`, suffixes)) { + codePoints.pop(); + } + return `${codePoints.join('')}${marker}`; +} + +export function sidecarStemFromComponent(component) { + if (component.endsWith('.html')) { + return { + stem: component.slice(0, -'.html'.length), + options: undefined, + }; + } + return { + stem: component, + options: { force: true, hashDomain: 'full-component' }, + }; +} + +export function isBoundedSidecarStem(stem) { + return SIDECAR_STEM_NAMESPACE.test(stem); +} diff --git a/packages/diagram-core/vendor/archify/renderers/shared/spatial-grid.mjs b/packages/diagram-core/vendor/archify/renderers/shared/spatial-grid.mjs new file mode 100644 index 0000000..d2eb439 --- /dev/null +++ b/packages/diagram-core/vendor/archify/renderers/shared/spatial-grid.mjs @@ -0,0 +1,66 @@ +/** Uniform spatial grid for "which items can this box reach" queries (#8). */ + +// A cell box wider than this is not worth walking: the query returns every +// inserted item instead, which stays a superset of what the box reaches. +const DEFAULT_MAX_CELLS = 4096; + +export function createSpatialGrid(cellSize, { maxCells = DEFAULT_MAX_CELLS } = {}) { + const buckets = new Map(); + const items = []; + // Items whose own box cannot be walked are candidates for every query. + const overflow = []; + const keyOf = (x, y) => x + ':' + y; + const rangeOf = (box) => ({ + x0: Math.floor(box.minX / cellSize), x1: Math.floor(box.maxX / cellSize), + y0: Math.floor(box.minY / cellSize), y1: Math.floor(box.maxY / cellSize), + }); + // Finite coordinates can still land outside the safe-integer range, where + // incrementing an index no longer advances it; and a legal coordinate can + // name more cells than the grid is worth. Both cases stay out of the buckets + // and are answered by the item list, so they never hang or allocate. + const walkable = (range) => Number.isSafeInteger(range.x0) && Number.isSafeInteger(range.x1) + && Number.isSafeInteger(range.y0) && Number.isSafeInteger(range.y1) + && (range.x1 - range.x0 + 1) * (range.y1 - range.y0 + 1) <= maxCells; + + return { + insert(box, item) { + items.push(item); + const range = rangeOf(box); + if (!walkable(range)) { + overflow.push(item); + return; + } + for (let x = range.x0; x <= range.x1; x += 1) { + for (let y = range.y0; y <= range.y1; y += 1) { + const key = keyOf(x, y); + let bucket = buckets.get(key); + if (!bucket) { bucket = []; buckets.set(key, bucket); } + bucket.push(item); + } + } + }, + query(box) { + const range = rangeOf(box); + if (!walkable(range)) return items.slice(); + const seen = new Set(); + const found = []; + for (let x = range.x0; x <= range.x1; x += 1) { + for (let y = range.y0; y <= range.y1; y += 1) { + const bucket = buckets.get(keyOf(x, y)); + if (!bucket) continue; + for (const item of bucket) { + if (seen.has(item)) continue; + seen.add(item); + found.push(item); + } + } + } + for (const item of overflow) { + if (seen.has(item)) continue; + seen.add(item); + found.push(item); + } + return found; + }, + }; +} diff --git a/packages/diagram-core/vendor/archify/renderers/shared/text-fit.mjs b/packages/diagram-core/vendor/archify/renderers/shared/text-fit.mjs index 31c0b17..860356a 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/text-fit.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/text-fit.mjs @@ -16,7 +16,7 @@ // `minimum` font sizes are not, because renderers set node text at different // sizes (architecture sublabels are 9px, the rest are 7px). -import { textUnits } from './utils.mjs'; +import { textUnits, SEMANTIC_SIGIL_INSET, SEMANTIC_SIGIL_SIZE, SEMANTIC_SIGIL_FOOTPRINT, SOURCE_BADGE_FOOTPRINT } from './utils.mjs'; // widthFactor: px of advance width per text unit, per px of font size. // horizontalPadding: total px reserved inside the box so text never touches @@ -47,3 +47,59 @@ export function minimumNodeTextWidth(text, minimum) { export function availableNodeTextWidth(width) { return width - nodeTextFit.horizontalPadding; } + +// Adapted from Souptik Chakraborty's #220: shift only labels which reach a +// corner icon. Unlike the original hard gate, a narrow valid node uses a +// separate text row; its authored bounds and acceptance remain unchanged. +export function nodeLabelLayout({ width, height, rows, side = 'left', brand = false, source = false, step = '' }) { + const result = { x: width / 2, ys: rows.map(row => row.y), sigilY: SEMANTIC_SIGIL_INSET, sigilSize: SEMANTIC_SIGIL_SIZE }; + const labelWidth = minimumNodeTextWidth(rows[0].text, rows[0].font); + const stepEnd = step ? (side === 'left' ? 23 : 10) + minimumNodeTextWidth(step, 8) + 3 : 0; + const left = Math.max(side === 'left' ? SEMANTIC_SIGIL_FOOTPRINT + 2 : 4, stepEnd); + const right = width - (brand ? 26 : side === 'right' ? SEMANTIC_SIGIL_FOOTPRINT + 2 : 4) + - (source ? SOURCE_BADGE_FOOTPRINT : 0); + if (result.x - labelWidth / 2 >= left && result.x + labelWidth / 2 <= right) return result; + if (labelWidth <= right - left) { + // Round away from the icon, retaining the node centre whenever possible. + result.x = Math.min(Math.floor((right - labelWidth / 2) * 10) / 10, + Math.max(result.x, Math.ceil((left + labelWidth / 2) * 10) / 10)); + return result; + } + // Keep the existing font sizes and put the text below the decoration rail. + // Conservative ascent/descent bounds also protect CJK and fallback fonts. + let bottom = Math.max(brand ? 22 : SEMANTIC_SIGIL_FOOTPRINT, source ? 19 : 0); + const ys = rows.map(row => { + const y = Math.max(row.y, Math.ceil((bottom + 2 + row.font * 1.2) * 10) / 10); + bottom = y + row.font * 0.3; + return y; + }); + if (bottom <= height - 2) { + result.ys = ys; + return result; + } + if (source) { + // A source badge adds a second decoration on the right. On short boxes, + // restoring the original rows would put the title back under that badge. + // Try compact leading before giving up the dedicated text rail. Retain + // every font size and the authored box; only this crowded fallback packs + // the rows, with a full em above each baseline and 0.3 em below it. + let compactBottom = Math.max(brand ? 22 : SEMANTIC_SIGIL_FOOTPRINT, 19) + 1; + const compactYs = rows.map(row => { + const y = Math.ceil((compactBottom + 1 + row.font) * 10) / 10; + compactBottom = y + row.font * 0.3; + return y; + }); + // The compact fallback may also use the otherwise reserved bottom + // padding; the entire descent still stays inside the fixed box. + if (compactBottom <= height - 0.5) { + result.ys = compactYs; + return result; + } + } + // A deliberately short fixed box may have no spare row. Preserve its text + // and geometry, and fit only the decorative sigil in the space above it. + result.sigilY = 1; + result.sigilSize = Math.max(1, Math.min(SEMANTIC_SIGIL_SIZE, + Math.floor(rows[0].y - rows[0].font * 1.2 - 3))); + return result; +} diff --git a/packages/diagram-core/vendor/archify/renderers/shared/utils.mjs b/packages/diagram-core/vendor/archify/renderers/shared/utils.mjs index 8307518..46e78cb 100644 --- a/packages/diagram-core/vendor/archify/renderers/shared/utils.mjs +++ b/packages/diagram-core/vendor/archify/renderers/shared/utils.mjs @@ -33,12 +33,13 @@ const SIGIL_TONE = { frontend: 'frontend', start: 'frontend', backend: 'backend', - active: 'backend', + active: 'frontend', database: 'database', - success: 'database', + success: 'backend', cloud: 'cloud', waiting: 'cloud', security: 'security', + decision: 'database', failure: 'security', messagebus: 'messagebus', external: 'external', @@ -46,6 +47,12 @@ const SIGIL_TONE = { }; const SIGIL_SHAPE = { + calendar: ``, + clock: ``, + person: ``, + briefcase: ``, + flag: ``, + moon: ``, frontend: ` @@ -74,12 +81,24 @@ const SIGIL_SHAPE = { `, }; -// A quiet, renderer-owned role stamp. It is authored SVG content rather than a +// A quiet, renderer-owned corner symbol (type default or authored icon). It is +// SVG content rather than a // viewer overlay, so it survives canonical export while adding no focus target, // accessible name, layout box, or interaction state of its own. -export function renderSemanticSigil(kind, { x, y, size = 11 } = {}) { - const normalized = Object.hasOwn(SIGIL_SHAPE, kind) ? kind : 'neutral'; - const tone = SIGIL_TONE[normalized] || 'external'; +// Shared with label clearance so the reserved rail matches the actual icon. +export const SEMANTIC_SIGIL_INSET = 6; +export const SEMANTIC_SIGIL_SIZE = 11; +export const SEMANTIC_SIGIL_FOOTPRINT = SEMANTIC_SIGIL_INSET + SEMANTIC_SIGIL_SIZE; +// The viewer installs a runtime "sources" beacon on the node's top-right +// rail, just left of the brand mark. Layout must reserve the same footprint +// so labels never sit under the badge. +export const SOURCE_BADGE_FOOTPRINT = 38; + +export function renderSemanticSigil(kind, { x, y, size = SEMANTIC_SIGIL_SIZE, icon } = {}) { + if (icon === 'none') return ''; + const selected = icon ?? kind; + const normalized = Object.hasOwn(SIGIL_SHAPE, selected) ? selected : 'neutral'; + const tone = SIGIL_TONE[kind] || 'external'; const scale = size / 16; return `

${esc(card.title)}

    -${card.items.map((item) => `
  • • ${esc(item)}
  • `).join('\n')} +${card.items.map((item) => `
  • ${esc(item)}
  • `).join('\n')}
`).join('\n\n')} `; @@ -105,7 +124,6 @@ ${card.items.map((item) => `
  • • ${esc(item)}
  • `).join('\n')} const SVG_SLOT_RE = / [\s\S]*? /; const CARDS_SLOT_RE = / [\s\S]*? /; const SUBTITLE_SLOT_RE = /^([ \t]*)

    \[Subtitle description\]<\/p>[ \t]*(\r?\n)?/m; -const GUIDED_VIEWS_PLACEHOLDER = ''; const SOURCE_EVIDENCE_PLACEHOLDER = ' '; const I18N_PLACEHOLDER = ' '; @@ -120,7 +138,7 @@ const TEMPLATE_PLACEHOLDERS = [ '', '[PROJECT NAME] Architecture Diagram', '

    [PROJECT NAME] Architecture

    ', - GUIDED_VIEWS_PLACEHOLDER, + I18N_PLACEHOLDER, ]; export function applyTemplate(template, { @@ -130,7 +148,6 @@ export function applyTemplate(template, { cards, locale, visualPreset = 'classic', - guidedViews = [], sourceEvidence = null, }) { if (!SVG_SLOT_RE.test(template)) { @@ -155,7 +172,6 @@ export function applyTemplate(template, { } // Function replacers: a literal `$&`, `$'`, `$\`` or `$$` in titles, labels, // or rendered SVG must not be interpreted as a replacement pattern. - const guidedViewsJson = serializeScriptJson(guidedViews); const sourceEvidenceJson = serializeScriptJson(sourceEvidence); const resolvedLocale = resolveLocale(locale); const i18nJson = serializeScriptJson({ locale: resolvedLocale, messages: viewerCatalog(resolvedLocale) }); @@ -163,11 +179,8 @@ export function applyTemplate(template, { ? `

    ${esc(subtitle)}

    ` : ''; const i18nData = ` `; - const localizedTemplate = localizeTemplate(template, resolvedLocale); - const templateWithI18n = localizedTemplate.includes(I18N_PLACEHOLDER) - ? localizedTemplate.replace(I18N_PLACEHOLDER, () => i18nData) - : localizedTemplate.replace(GUIDED_VIEWS_PLACEHOLDER, () => `${i18nData}\n ${GUIDED_VIEWS_PLACEHOLDER}`); - return templateWithI18n + return localizeTemplate(template, resolvedLocale) + .replace(I18N_PLACEHOLDER, () => i18nData) .replace(TEMPLATE_PLACEHOLDERS[0], () => ``) .replace(TEMPLATE_PLACEHOLDERS[1], () => `${esc(translateMessage(resolvedLocale, 'page.title', { title }))}`) .replace(TEMPLATE_PLACEHOLDERS[2], () => `

    ${esc(title)}

    `) @@ -176,7 +189,6 @@ export function applyTemplate(template, { : '') .replace(SVG_SLOT_RE, () => svg) .replace(CARDS_SLOT_RE, () => cards) - .replace(GUIDED_VIEWS_PLACEHOLDER, () => ``) .replace(SOURCE_EVIDENCE_PLACEHOLDER, () => sourceEvidence ? ` ` : ''); @@ -200,33 +212,43 @@ export function applyTemplate(template, { // ranges because V8 has no \p{East_Asian_Width=W} property escape. const FULLWIDTH_RE = /[\u1100-\u115F\u231A-\u231B\u2329-\u232A\u23E9-\u23EC\u23F0\u23F3\u25FD-\u25FE\u2614-\u2615\u2630-\u2637\u2648-\u2653\u267F\u268A-\u268F\u2693\u26A1\u26AA-\u26AB\u26BD-\u26BE\u26C4-\u26C5\u26CE\u26D4\u26EA\u26F2-\u26F3\u26F5\u26FA\u26FD\u2705\u270A-\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B-\u2B1C\u2B50\u2B55\u2E80-\uA4CF\uA960-\uA97C\uAC00-\uD7A3\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE6F\uFF01-\uFF60\uFFE0-\uFFE6\u{16FE0}-\u{18DFF}\u{1AFF0}-\u{1AFFF}\u{1B000}-\u{1B2FF}\u{1F000}-\u{1FAFF}\u{20000}-\u{3FFFD}]/u; -// A variation selector (U+FE00-U+FE0F) carries no advance of its own: it -// re-presents the character before it. VS15 (U+FE0E) asks for text -// presentation, which renders narrow; VS16 (U+FE0F) asks for emoji -// presentation, which renders at the square emoji advance. So a base plus a -// selector is measured from the selector, not from the base -- otherwise -// widening the emoji-presentation bases above turns U+2B50 U+FE0F from two -// units into three while the glyph on screen stays one square, and leaves -// U+2708 U+FE0F at two only because its base happens to be narrow. -// -// A selector following a base that cannot take emoji presentation is -// malformed input; measuring it wide is the safe direction here, since -// over-measuring pads a box while under-measuring spills the label out of it. +// Variation selectors contribute no separate unit. This is a conservative +// width estimate, not a measurement of the selected glyph: its actual advance +// depends on the font and presentation (Unicode UAX #11). +// VS16 requests emoji presentation, so reserve two units for the sequence. +// VS15 retains the base's width estimate; forcing every text-presentation +// sequence to one unit undercounts wide bases, including CJK characters whose +// font ignores that selector. Neutral bases remain one unit. Some selected +// text glyphs can be narrower than this estimate; prefer extra space to overflow. const VARIATION_SELECTOR_FIRST = 0xfe00; const VARIATION_SELECTOR_LAST = 0xfe0f; -const VARIATION_SELECTOR_TEXT = 0xfe0e; const VARIATION_SELECTOR_EMOJI = 0xfe0f; +// Width measurement is pure and the same labels are measured many times per +// compile, so the unit count is memoized by its input string. +const TEXT_UNITS_CACHE = new Map(); +const MAX_TEXT_UNITS_CACHE_ENTRIES = 4096; +const MAX_CACHED_TEXT_LENGTH = 1024; + export function textUnits(text) { - const chars = Array.from(String(text ?? '')); + const cacheKey = String(text ?? ''); + const cachedUnits = TEXT_UNITS_CACHE.get(cacheKey); + if (cachedUnits !== undefined) return cachedUnits; + const chars = Array.from(cacheKey); let units = 0; for (let i = 0; i < chars.length; i += 1) { const codePoint = chars[i].codePointAt(0); if (codePoint >= VARIATION_SELECTOR_FIRST && codePoint <= VARIATION_SELECTOR_LAST) continue; const next = i + 1 < chars.length ? chars[i + 1].codePointAt(0) : -1; if (next === VARIATION_SELECTOR_EMOJI) units += 2; - else if (next === VARIATION_SELECTOR_TEXT) units += 1; else units += FULLWIDTH_RE.test(chars[i]) ? 2 : 1; } + // Keep repeated in-process compiles bounded, including unusually long labels. + if (cacheKey.length <= MAX_CACHED_TEXT_LENGTH) { + if (TEXT_UNITS_CACHE.size >= MAX_TEXT_UNITS_CACHE_ENTRIES) { + TEXT_UNITS_CACHE.delete(TEXT_UNITS_CACHE.keys().next().value); + } + TEXT_UNITS_CACHE.set(cacheKey, units); + } return units; } diff --git a/packages/diagram-core/vendor/archify/renderers/workflow/README.md b/packages/diagram-core/vendor/archify/renderers/workflow/README.md index 186d7b6..9fb7229 100644 --- a/packages/diagram-core/vendor/archify/renderers/workflow/README.md +++ b/packages/diagram-core/vendor/archify/renderers/workflow/README.md @@ -10,8 +10,8 @@ node archify/renderers/workflow/render-workflow.mjs input.workflow.json output.h The renderer validates input against `archify/schemas/workflow.schema.json` with the bundled standalone validator. No dependency installation is required. -If `output.html` is omitted, the renderer uses `meta.output` from the JSON file -or falls back to `workflow.html` in the current working directory. +If `output.html` is omitted, the renderer uses the required `meta.output` value +from the JSON file. After rendering, run the artifact checker: @@ -32,7 +32,8 @@ Workflow JSON files must set: "schema_version": 2, "diagram_type": "workflow", "meta": { - "title": "Agent Tool Call Workflow" + "title": "Agent Tool Call Workflow", + "output": "agent-tool-call.html" }, "lanes": [], "phases": [], @@ -73,6 +74,17 @@ node archify/bin/archify.mjs migrate workflow old.json new.json --to-schema 2 -- Running the command again with its schema-v2 output as the new source is an idempotent verification pass: the destination bytes and geometry stay unchanged. +If a legacy v1 source is blocked solely because `meta.output` is missing or no +longer portable, supply its replacement for the separate v2 destination: + +```bash +node archify/bin/archify.mjs migrate workflow old.json new.json --to-schema 2 --output reports/workflow.html --json +``` + +`--output` must itself be a portable POSIX-relative `.html` path. It updates +only the verified destination candidate; the source bytes remain unchanged and +all non-output schema and compiler diagnostics still block migration. + The command never overwrites the source by default. It maps absolute `via[*][0]`, `labelAt[0]`, and `channelX` values from legacy to solved rank space, preserves y coordinates unless a reported vertical constraint needs @@ -133,6 +145,7 @@ a verified migration-to-v2 repair; v1 never falls through to adaptive layout. | Automatic route rhythm | direct segment ≥28px; endpoint stub ≥8px; interior turn segment ≥16px | | Implicit viewBox | intrinsic content bounds plus contract padding | | Explicit viewBox | containment capacity; too-small input reports exact `requiredViewBox` and contributors | +| Lane measurement | A same-column vertical stack (two or more distinct `yOffset` values) opts an implicit, unpinned workflow into per-lane measurement. Explicit `meta.viewBox`, `via`, `labelAt`, `channelX`, or `channelY`, and workflows without a stack retain shared-height v2 geometry for compatibility. | The compiler applies constraints only to actual related or overlapping same-lane nodes, so a wide node in an unrelated lane does not expand every @@ -144,6 +157,39 @@ growth with a legal channel instead of widening every downstream rank. Measured multi-row legends participate in intrinsic height and explicit viewBox capacity. +The Issue #250 shape already has a v2 representation without an authored lane +size. Keep the three stages in one grouped lane, omit `meta.viewBox`, and center +their offsets around zero: + +```json +{ + "schema_version": 2, + "diagram_type": "workflow", + "meta": { "title": "stack", "output": "stack.html" }, + "lanes": [{ "id": "cage", "label": "one cage" }], + "groups": [{ "id": "g", "label": "cage", "lane": "cage", "fromCol": 1, "toCol": 3 }], + "nodes": [ + { "id": "a", "lane": "cage", "col": 2, "type": "security", "label": "stageA", "yOffset": -90 }, + { "id": "b", "lane": "cage", "col": 2, "type": "security", "label": "stageB", "yOffset": 0 }, + { "id": "c", "lane": "cage", "col": 2, "type": "security", "label": "stageC", "yOffset": 90 } + ], + "edges": [ + { "from": "a", "to": "b", "fromSide": "bottom", "toSide": "top" }, + { "from": "b", "to": "c", "fromSide": "bottom", "toSide": "top" } + ] +} +``` + +An implicit readable-v2 vertical stack whose measured lane height exceeds the +104px baseline opts into the desktop Viewer's height budget. This decision +comes from compiled geometry, not an authored sizing field. The Viewer changes only +the outer reader width so the complete lane remains on screen; canonical SVG +geometry and explicit `meta.viewBox` workflows retain their authored contracts. +When necessary, the Viewer may scale below the intrinsic 1:1 width only as far +as the 6px projected node-text floor. If the complete workflow still cannot fit +at that readable scale, `visual-check` reports the remaining viewport overflow +instead of clipping or introducing an internal scroller. + Authored `via`, `labelAt`, `channelX`, and `channelY` are absolute hard pins in v2; an infeasible pin returns `workflow/explicit-pin-conflict` rather than being silently moved. `fromSide` and `toSide` remain direction constraints. A route @@ -156,6 +202,7 @@ a feasible side; an authored side restricts that endpoint to the named port. - Use lanes for ownership or runtime boundaries. - Use phase headers for high-level story beats such as Intake, Plan, Execute, and Report. - Use groups for parallel checks, branch handling, or bounded work within a lane; every group must contain at least one node. +- For sequential stages stacked inside one container, use one v2 lane and one group, keep the stages in one column, and omit `meta.viewBox`. `yOffset` is relative to the center of the lane's content area, so center a three-stage stack with `-90 / 0 / 90` rather than `0 / 90 / 180`. With compiler-owned routes and canvas, the compiler expands only that lane. - Use `lane.variant: "exception"` for human wait, denial, retry, fallback, and failure lanes instead of mixing those paths into the happy path. - Set `mainPath` when the diagram has a clear happy path; the renderer validates that consecutive ids have matching edges and move left-to-right. - Place nodes with lane IDs and `col` indexes in `0..5`, not raw SVG coordinates. @@ -217,7 +264,38 @@ Set `meta.quality_profile` to `showcase` for polished delivery. Unrelated proper X crossings then fail with `composition/proper-crossing`; default `standard` keeps them as artifact-receipt warnings. Collinear lane corridors are outside the proper-X rule, but a separate gate warns in `standard` and fails in -`showcase` when unrelated edges overlap for at least 8px. Shared semantic -endpoints, point touches, and shorter overlaps remain valid. Showcase also +`showcase` when unrelated edges overlap for at least 8px. V1 keeps its authored +shared-endpoint contract. V2 also checks shared endpoints, including explicitly +controlled routes: long or mixed-style trunks, counterflow, proper interior X +crossings and overlapping independent arrowheads are not exempt. Pins are +preserved, not silently repaired; unresolved v2 corridor/arrowhead collisions +warn in `standard` and fail in `showcase`. + +V2 permits a same-direction shared terminal stub of at most 24 SVG units only +when both relationships share the actual source or target port, effective +variant, stroke width and role. A nonterminal overlap is never such a stub; +forward-collinear waypoints do not split a long trunk into permitted pieces. +Compatible short merges may share their terminal arrowhead. Automatic routes +consider separate ports, reserve absolute routes at contested nodes, and prefer +clear paths over shorter ambiguous ones. Crowded automatic corridors can use a +bounded local adjustment without moving nodes or changing explicit coordinates. + +The SVG carries `data-layout-contract="readable-v2"` and each edge's role so +artifact checks apply the same classification to actual visible path geometry, +not stale composition-point metadata. These internal output attributes do not +add authoring schema fields. Other diagram types retain their existing rules. +V2 proper-crossing diagnostics retain the relationship IDs, intersection point, +and supported fixes in both compiler/layout-JSON receipts and final HTML checks; +`standard` reports warnings while `showcase` rejects the crossing. Both analyses +merge forward-collinear waypoints without rewriting authored paths; real bends +and reversals remain endpoint touches rather than being merged into an X. + +The older per-edge `data-composition-routing="workflow-v2-auto"` marker remains +for compatibility with first-round exported HTML that has no root layout +contract and with older artifact checkers. Marker-only artifacts retain their +narrower automatic-pair crossing/counterflow policy; the root `readable-v2` +contract is authoritative when present and also checks explicit routes. Do not +remove the marker-only path as dead code without retiring that export format. +Showcase also rejects any route segment below 8px and any interior turn segment below 16px; ordinary 8–15px endpoint stubs remain valid for fixed lane gaps. diff --git a/packages/diagram-core/vendor/archify/renderers/workflow/render-workflow.mjs b/packages/diagram-core/vendor/archify/renderers/workflow/render-workflow.mjs index 27bfa14..329558a 100644 --- a/packages/diagram-core/vendor/archify/renderers/workflow/render-workflow.mjs +++ b/packages/diagram-core/vendor/archify/renderers/workflow/render-workflow.mjs @@ -5,7 +5,7 @@ import { throwDiagnosticError } from '../shared/diagnostics.mjs'; import { compileWorkflow } from './workflow-compiler.mjs'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const { diagram: workflow, template, outPath } = await loadDiagramWithBrandMarks({ +const { diagram: workflow, template, outPath, sourceEvidence } = await loadDiagramWithBrandMarks({ rendererDir: __dirname, diagramType: 'workflow', defaultExample: 'agent-tool-call.workflow.json' @@ -14,6 +14,7 @@ const { diagram: workflow, template, outPath } = await loadDiagramWithBrandMarks const compiled = compileWorkflow({ workflow, qualityProfile: process.env.ARCHIFY_QUALITY_PROFILE || workflow.meta?.quality_profile, + sourceEvidence, }); const layoutJson = process.argv.includes('--layout-json'); @@ -31,5 +32,6 @@ if (layoutJson) { meta: workflow.meta, svg: compiled.svg, cards: workflow.cards, + sourceEvidence, }); } diff --git a/packages/diagram-core/vendor/archify/renderers/workflow/workflow-compiler.mjs b/packages/diagram-core/vendor/archify/renderers/workflow/workflow-compiler.mjs index 81ba79a..b3b3b42 100644 --- a/packages/diagram-core/vendor/archify/renderers/workflow/workflow-compiler.mjs +++ b/packages/diagram-core/vendor/archify/renderers/workflow/workflow-compiler.mjs @@ -1,5 +1,14 @@ +import { createSpatialGrid } from '../shared/spatial-grid.mjs'; import { esc, renderDefinitions, renderSemanticSigil, textUnits } from '../shared/utils.mjs'; -import { animateAttr, focusEdgeAttrs, focusNodeAttrs, focusNodeTitle, svgAccessibleText, svgRootAttrs } from '../shared/cli.mjs'; +import { + animateAttr, + focusEdgeAttrs, + focusNodeAttrs, + focusNodeTitle, + svgAccessibleText, + svgRootAttrs, + validateCrossCollectionContracts, +} from '../shared/cli.mjs'; import { throwDiagnosticError, throwDiagnosticProblems, @@ -13,8 +22,8 @@ import { resolveLegend, renderLegend as renderResolvedLegend, } from '../shared/legend.mjs'; -import { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth } from '../shared/text-fit.mjs'; -import { brandLabelFitWidth, brandMetadataFor, brandTopRailProblem, renderBrandMark } from '../shared/brand-marks.mjs'; +import { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth, nodeLabelLayout } from '../shared/text-fit.mjs'; +import { brandLabelFitWidth, brandMarkFor, brandMetadataFor, brandTopRailProblem, renderBrandMark } from '../shared/brand-marks.mjs'; import { translateMessage as i18nText } from '../shared/i18n.mjs'; import { createMappedWorkflowCandidate, @@ -22,6 +31,7 @@ import { planningWorkflow, } from './workflow-migration-geometry.mjs'; import { + joinRoutePoints, asArray, isFinitePoint, rectsOverlap, @@ -34,7 +44,9 @@ import { cleanBorderRunProblems, cleanRouteRhythmProblems, cleanLabelRouteClearanceProblems, + cleanLabelCanvasContainmentProblems, collectAmbiguousCorridors, + collectArrowheadCollisions, collectLabelRouteClearance, collectBorderRuns, forwardCollinearAnalysisSegments, @@ -43,8 +55,8 @@ import { suggestLabelPairFix, anchor, automaticPortSpread, - defaultFromSide, - defaultToSide, + legacyDefaultFromSide as defaultFromSide, + legacyDefaultToSide as defaultToSide, chosenSide, normalizeRoutePoints, routeHonorsEndpointSides, @@ -54,14 +66,15 @@ import { componentFill, componentText, arrowClassMap, - variantAccent + variantAccent, + edgeLabelAccent } from '../shared/geometry.mjs'; const LEGACY_COLUMN_CENTERS = Object.freeze([88, 220, 300, 430, 500, 625]); const READABLE_CANDIDATE_COST_PRIORITY = Object.freeze([ - 'automaticForwardReversePx', 'properCrossingCount', 'sharedCorridorPx', + 'automaticForwardReversePx', 'labelRouteClearanceDeficit', 'interiorPreferred28Deficit', 'bendCount', @@ -103,6 +116,34 @@ function createLegacyLayout() { }; } +function hasAbsoluteWorkflowPins(workflow) { + return asArray(workflow.edges).some((edge) => ( + Array.isArray(edge.via) + || Array.isArray(edge.labelAt) + || edge.channelX !== undefined + || edge.channelY !== undefined + )); +} + +function hasVerticalStack(workflow) { + const offsetsByLaneAndColumn = new Map(); + for (const node of asArray(workflow.nodes)) { + if (!Number.isInteger(node.col)) continue; + const key = `${node.lane}\u0000${node.col}`; + const offsets = offsetsByLaneAndColumn.get(key) || new Set(); + offsets.add(Number(node.yOffset) || 0); + if (offsets.size > 1) return true; + offsetsByLaneAndColumn.set(key, offsets); + } + return false; +} + +function usesIndependentLaneMeasurement(workflow) { + return hasVerticalStack(workflow) + && !workflow.meta?.viewBox + && !hasAbsoluteWorkflowPins(workflow); +} + function authoredNodeWidth(node) { return Number.isFinite(node?.width) ? node.width : 92; } @@ -472,27 +513,45 @@ function createReadableLayout(workflow, layoutFeedback = {}) { widthContributors.add(`lane ${widestLaneLabel.lane.id || widestLaneLabel.lane.label} label width`); } } - let maxVerticalExtent = 0; - const verticalExtentContributors = new Set(); - for (const node of nodes) { - const yOffset = Number(node.yOffset) || 0; - const extent = authoredNodeHeight(node) / 2 + Math.abs(yOffset); - const contributor = `node ${node.id} height ${authoredNodeHeight(node)}px${yOffset ? ` with yOffset ${yOffset}px` : ''}`; - if (extent > maxVerticalExtent + 0.0001) { - maxVerticalExtent = extent; - verticalExtentContributors.clear(); - verticalExtentContributors.add(contributor); - } else if (Math.abs(extent - maxVerticalExtent) <= 0.0001) { - verticalExtentContributors.add(contributor); + const verticalExtent = (laneId) => { + let maximum = 0; + const contributors = new Set(); + for (const node of nodes) { + if (laneId !== undefined && node.lane !== laneId) continue; + const yOffset = Number(node.yOffset) || 0; + const extent = authoredNodeHeight(node) / 2 + Math.abs(yOffset); + const contributor = `node ${node.id} height ${authoredNodeHeight(node)}px${yOffset ? ` with yOffset ${yOffset}px` : ''}`; + if (extent > maximum + 0.0001) { + maximum = extent; + contributors.clear(); + contributors.add(contributor); + } else if (Math.abs(extent - maximum) <= 0.0001) { + contributors.add(contributor); + } } + return { maximum, contributors }; + }; + const sharedVerticalExtent = verticalExtent(); + const laneH = 30 + Math.max(74, Math.ceil(sharedVerticalExtent.maximum * 2 + 8)); + const independentLaneMeasurement = usesIndependentLaneMeasurement(workflow); + const laneBaseHeights = asArray(workflow.lanes).map((lane) => { + if (!independentLaneMeasurement) return laneH; + const ownVerticalExtent = verticalExtent(lane.id); + const height = 30 + Math.max(74, Math.ceil(ownVerticalExtent.maximum * 2 + 8)); + if (height > 104) { + for (const contributor of ownVerticalExtent.contributors) heightContributors.add(contributor); + } + return height; + }); + if (!independentLaneMeasurement && laneH > 104) { + for (const contributor of sharedVerticalExtent.contributors) heightContributors.add(contributor); } - const baseContentH = Math.max(74, Math.ceil(maxVerticalExtent * 2 + 8)); - const laneH = 30 + baseContentH; const groupsByLane = new Map(); for (const group of asArray(workflow.groups)) { groupsByLane.set(group.lane, [...(groupsByLane.get(group.lane) || []), group]); } - const groupLaneReserves = asArray(workflow.lanes).map((lane) => { + const groupLaneReserves = asArray(workflow.lanes).map((lane, laneIndex) => { + const baseContentH = laneBaseHeights[laneIndex] - 30; let header = 0; let footer = 0; for (const group of groupsByLane.get(lane.id) || []) { @@ -523,7 +582,9 @@ function createReadableLayout(workflow, layoutFeedback = {}) { }); const groupHeaderHeights = groupLaneReserves.map(({ header }) => header); const groupFooterHeights = groupLaneReserves.map(({ footer }) => footer); - const laneHeights = groupLaneReserves.map(({ header, footer }) => laneH + header + footer); + const laneHeights = groupLaneReserves.map(({ header, footer }, index) => ( + laneBaseHeights[index] + header + footer + )); const laneGap = Math.max(20, Math.ceil(layoutFeedback.laneGapMin || 0)); for (const [index, reserve] of groupHeaderHeights.entries()) { if (!reserve) continue; @@ -535,9 +596,6 @@ function createReadableLayout(workflow, layoutFeedback = {}) { const lane = asArray(workflow.lanes)[index]; heightContributors.add(`lane ${lane.id || lane.label} group frame containment ${reserve}px`); } - if (laneH > 104) { - for (const contributor of verticalExtentContributors) heightContributors.add(contributor); - } if (laneGap > 20) { for (const contributor of asArray(layoutFeedback.laneGapContributors)) { heightContributors.add(contributor); @@ -752,9 +810,492 @@ function semanticContractDiagnostics(workflow) { return diagnostics; } +// Legend footprint and canvas width: one phase of the workflow compile, lifted +// out of compileWorkflowInternal so the caller reads as a sequence of steps. +function resolveWorkflowLegendFootprint(workflow, layout) { + const LEGEND_CATALOG = [ + 'frontend', + 'backend', + 'security', + 'messagebus', + 'database', + 'cloud', + 'external', + ].map((kind) => ({ kind, label: i18nText(workflow.meta.locale, `legend.workflow.${kind}`) })); + const presentLegendKinds = new Set(asArray(workflow.nodes).map((node) => node.type)); + const workflowLegendEntries = resolveLegend( + workflow.meta?.legend, + LEGEND_CATALOG, + presentLegendKinds, + ); + const legendFootprintOptions = { fontSize: 7, itemGap: 7 }; + const oneRowLegendFootprint = legendFootprint(workflowLegendEntries, { + ...legendFootprintOptions, + width: Number.MAX_SAFE_INTEGER, + }); + const minimumCanvasWidth = workflow.schema_version === 2 + ? Math.max(layout.defaultViewBoxWidth, oneRowLegendFootprint.minWidth + 40) + : layout.defaultViewBoxWidth; + const legendPackingWidth = Math.max( + 1, + (workflow.schema_version === 2 + ? minimumCanvasWidth + : (workflow.meta?.viewBox?.[0] ?? minimumCanvasWidth)) - 40, + ); + const packedLegendFootprint = legendFootprint(workflowLegendEntries, { + ...legendFootprintOptions, + width: legendPackingWidth, + }); + const legendExtraHeight = workflow.schema_version === 2 + ? packedLegendFootprint.extraHeight + : 0; + return { + workflowLegendEntries, + presentLegendKinds, + legendPackingWidth, + packedLegendFootprint, + legendExtraHeight, + minimumCanvasWidth, + }; +} + +// Lane geometry: the canvas height, the lane lookups and the small position +// helpers every later phase reads. Lifted out of compileWorkflowInternal so the +// body reads as phases instead of one script. +function createWorkflowLaneGeometry(workflow, layout, legendExtraHeight, minimumCanvasWidth) { + // Content is 680px wide (laneX + laneW); auto height fits the lanes plus legend. + const autoHeight = layout.laneY + + (layout.laneHeights?.reduce((total, height) => total + height, 0) + ?? (workflow.lanes?.length || 1) * layout.laneH) + + ((workflow.lanes?.length || 1) - 1) * layout.laneGap + + 124 + + legendExtraHeight; + const initialViewBox = workflow.meta?.viewBox || [minimumCanvasWidth, autoHeight]; + + + const laneIndex = new Map(asArray(workflow.lanes).map((lane, index) => [lane.id, index])); + const laneLabels = new Map(asArray(workflow.lanes).map((lane) => [lane.id, lane.label])); + + function nodeContext(node) { + const group = asArray(workflow.groups).find((candidate) => ( + candidate.lane === node.lane && node.col >= candidate.fromCol && node.col <= candidate.toCol + )); + const phase = asArray(workflow.phases).find((candidate) => ( + node.col >= candidate.fromCol && node.col <= candidate.toCol + )); + return [laneLabels.get(node.lane), group?.label, phase?.label].filter(Boolean).join(' › ') + || i18nText(workflow.meta.locale, 'node.context.workflow'); + } + + function laneHeight(idOrIndex) { + const index = typeof idOrIndex === 'number' ? idOrIndex : laneIndex.get(idOrIndex); + return layout.laneHeights?.[index] ?? layout.laneH; + } + + function laneGroupHeaderH(idOrIndex) { + const index = typeof idOrIndex === 'number' ? idOrIndex : laneIndex.get(idOrIndex); + return layout.groupHeaderHeights?.[index] ?? 0; + } + + function laneGroupFooterH(idOrIndex) { + const index = typeof idOrIndex === 'number' ? idOrIndex : laneIndex.get(idOrIndex); + return layout.groupFooterHeights?.[index] ?? 0; + } + + function laneTop(id) { + const index = laneIndex.get(id); + const precedingHeight = asArray(workflow.lanes).slice(0, index) + .reduce((total, _lane, lanePosition) => total + laneHeight(lanePosition), 0); + return layout.laneY + precedingHeight + index * layout.laneGap; + } + + function lastLaneBottom() { + return layout.laneY + + asArray(workflow.lanes).reduce((total, _lane, index) => total + laneHeight(index), 0) + + (workflow.lanes.length - 1) * layout.laneGap; + } + + function legendY() { + return lastLaneBottom() + 44 + legendExtraHeight; + } + + return { + autoHeight, + initialViewBox, + laneIndex, + laneLabels, + nodeContext, + laneHeight, + laneGroupHeaderH, + laneGroupFooterH, + laneTop, + lastLaneBottom, + legendY, + }; +} + +// Node measurement: the measured node map and the text-fit sizes every later +// phase reads. Kept together so the compiler body reads as phases. +function measureWorkflowNodes(workflow, layout, laneGeometry) { + const { laneHeight, laneGroupHeaderH, laneGroupFooterH, laneTop } = laneGeometry; + function measureNode(node) { + const width = node.width || layout.nodeW; + const height = node.height || (node.tag ? 68 : layout.nodeH); + const cx = layout.colXs[node.col]; + const groupHeaderH = laneGroupHeaderH(node.lane); + const contentH = laneHeight(node.lane) - layout.laneTitleH + - groupHeaderH - laneGroupFooterH(node.lane); + const y = laneTop(node.lane) + layout.laneTitleH + groupHeaderH + + (contentH - height) / 2 + (node.yOffset || 0); + return { + ...node, + width, + height, + x: cx - width / 2, + y, + cx, + cy: y + height / 2 + }; + } + + // Font sizes for this renderer's node text; the fitting geometry is shared. + const nodeTextFit = { + labelPreferred: 11, + labelMinimum: 9, + sublabelPreferred: 8, + sublabelMinimum: 6, + tagPreferred: 7, + tagMinimum: 6, + }; + + const nodes = new Map(asArray(workflow.nodes).map((node) => [node.id, measureNode(node)])); + + return { measureNode, nodeTextFit, nodes }; +} + +// Step indexes: where each edge and node sits on the main path. Lifted out so +// the compiler body keeps only the phases that read them. +function createWorkflowStepIndexes(workflow) { + const mainPathSteps = new Map(asArray(workflow.mainPath).map((id, index) => [id, index])); + const edgeSteps = new Map(asArray(workflow.edges).map((edge, index) => { + const fromStep = mainPathSteps.get(edge.from); + const toStep = mainPathSteps.get(edge.to); + const mainStep = Number.isInteger(fromStep) && toStep === fromStep + 1 ? fromStep : null; + return [edge, mainStep ?? asArray(workflow.mainPath).length + index]; + })); + + function nodeStep(node) { + return mainPathSteps.get(node.id) ?? asArray(workflow.mainPath).length + asArray(workflow.nodes).findIndex((item) => item.id === node.id); + } + + return { mainPathSteps, edgeSteps, nodeStep }; +} + +// Legacy capacity repair: the v1 column-capacity gate and the three fix +// verifiers it uses. They share the measured nodes, the layout and the fix +// acceptor, so they are built together and the body only calls the gate. +function createLegacyCapacityRepair({ + workflow, + nodes, + layout, + discoverFixes, + resolvedQualityProfile, + authoredQualityProfile, + nodeTextFit, + acceptsFix, +}) { + function verifiedLegacyAlternative(edge, from, to, requiredClearance) { + const occupied = [...nodes.values()].filter((node) => node.lane === to.lane && node.id !== to.id); + const candidates = layout.colXs.map((center, col) => ({ center, col })) + .filter(({ col }) => col !== to.col) + .sort((a, b) => Math.abs(a.col - to.col) - Math.abs(b.col - to.col) || a.col - b.col); + for (const candidate of candidates) { + const candidateRect = { ...to, col: candidate.col, cx: candidate.center, x: candidate.center - to.width / 2 }; + if (occupied.some((node) => rectsOverlap(candidateRect, node, 8))) continue; + const centerDistance = Math.abs(candidate.center - from.cx); + const signedClearance = centerDistance - from.width / 2 - to.width / 2; + if (signedClearance < requiredClearance) continue; + if (acceptsFix((document) => { + document.nodes.find((node) => node.id === to.id).col = candidate.col; + })) return candidate.col; + } + return null; + } + + function readableMigrationProvidesCapacity(from, to, requiredClearance) { + const readable = createReadableLayout({ ...workflow, schema_version: 2 }); + const centerDistance = Math.abs(readable.colXs[to.col] - readable.colXs[from.col]); + if (centerDistance - from.width / 2 - to.width / 2 < requiredClearance) return false; + if (!discoverFixes) return false; + + return withDiagnosticRecordingSuppressed(() => { + const migrationQualityProfile = authoredQualityProfile; + let planned = compileWorkflowWithFeedback({ + workflow: intrinsicWorkflow(workflow), + qualityProfile: migrationQualityProfile, + discoverFixes: false, + }); + if (!planned.ok) { + planned = compileWorkflowWithFeedback({ + workflow: planningWorkflow(workflow), + qualityProfile: migrationQualityProfile, + discoverFixes: false, + }); + } + if (!planned.ok || !Array.isArray(planned.receipt?.columns)) return false; + + let candidate; + try { + candidate = createMappedWorkflowCandidate( + workflow, + LEGACY_COLUMN_CENTERS, + planned.receipt.columns, + ).document; + } catch { + return false; + } + let compiled = compileWorkflowWithFeedback({ + workflow: candidate, + qualityProfile: migrationQualityProfile, + discoverFixes: false, + }); + const requiredViewBox = compiled.diagnostics?.length + && compiled.diagnostics.every(({ code }) => code === 'workflow/viewbox-capacity') + ? compiled.diagnostics.find(({ evidence }) => Array.isArray(evidence?.requiredViewBox)) + ?.evidence.requiredViewBox + : null; + if (!compiled.ok && Array.isArray(candidate.meta?.viewBox) && requiredViewBox) { + candidate.meta.viewBox = [ + Math.max(candidate.meta.viewBox[0], requiredViewBox[0]), + Math.max(candidate.meta.viewBox[1], requiredViewBox[1]), + ]; + compiled = compileWorkflowWithFeedback({ + workflow: candidate, + qualityProfile: migrationQualityProfile, + discoverFixes: false, + }); + } + return compiled.ok; + }); + } + + function verifiedReducedWidths(from, to, requiredClearance) { + const widthBudget = 2 * (Math.abs(to.cx - from.cx) - requiredClearance); + if (widthBudget < 64) return null; + const widths = [from.width, to.width]; + let excess = widths[0] + widths[1] - widthBudget; + for (const index of widths[0] >= widths[1] ? [0, 1] : [1, 0]) { + const reduction = Math.min(excess, widths[index] - 32); + widths[index] -= reduction; + excess -= reduction; + } + if (excess > 0.0001) return null; + const candidates = [from, to]; + const labelsFit = candidates.every((node, index) => ( + textUnits(node.label) * 6.8 <= widths[index] + 6 + && (!node.sublabel || minimumNodeTextWidth(node.sublabel, nodeTextFit.sublabelMinimum) <= availableNodeTextWidth(widths[index])) + && (!node.tag || minimumNodeTextWidth(node.tag, nodeTextFit.tagMinimum) <= availableNodeTextWidth(widths[index])) + )); + if (!labelsFit) return null; + const serializedWidths = widths.map((width) => Math.floor((width + 1e-9) * 100) / 100); + const signedClearance = Math.abs(to.cx - from.cx) + - serializedWidths[0] / 2 - serializedWidths[1] / 2; + if (signedClearance + 0.0001 < requiredClearance) return null; + const accepted = acceptsFix((document) => { + document.nodes.find((node) => node.id === from.id).width = serializedWidths[0]; + document.nodes.find((node) => node.id === to.id).width = serializedWidths[1]; + }); + return accepted ? serializedWidths : null; + } + + function enforceLegacyColumnCapacity() { + if (workflow.schema_version !== 1) return; + for (const edge of workflow.edges) { + const from = nodes.get(edge.from); + const to = nodes.get(edge.to); + if (!from || !to || from.lane !== to.lane || from.col === to.col) continue; + if (!verticalIntervalsOverlap(from, to, 8)) continue; + const centerDistance = Math.abs(to.cx - from.cx); + const actualSignedClearance = centerDistance - from.width / 2 - to.width / 2; + const direct = !edge.via && ['auto', 'straight'].includes(edge.route || 'auto') + && Math.abs(from.cy - to.cy) < 0.0001; + const requiredDirectClearance = direct ? 28 : 8; + if (actualSignedClearance >= requiredDirectClearance) continue; + const alternative = verifiedLegacyAlternative(edge, from, to, requiredDirectClearance); + const reducedWidths = verifiedReducedWidths(from, to, requiredDirectClearance); + const capacity = actualSignedClearance < 0 + ? `overlap by ${Math.abs(Math.round(actualSignedClearance))}px` + : `leave only ${Math.round(actualSignedClearance)}px of direct clearance`; + const message = `Workflow columns ${from.col}→${to.col} place nodes "${from.id}" and "${to.id}" so they ${capacity} under the fixed-v1 layout.`; + const supportedFixes = []; + if (readableMigrationProvidesCapacity(from, to, requiredDirectClearance)) { + supportedFixes.push('migrate this workflow to schema_version 2'); + } + if (alternative !== null) supportedFixes.push(`move node "${to.id}" to verified free column ${alternative}`); + if (reducedWidths) { + supportedFixes.push(`set node widths "${from.id}"=${Math.round(reducedWidths[0] * 100) / 100}px and "${to.id}"=${Math.round(reducedWidths[1] * 100) / 100}px`); + } + throwDiagnosticError(message, [{ + code: 'workflow/column-capacity', + severity: 'error', + message, + subject: { + diagramType: 'workflow', + edge: edge.id ?? null, + from: edge.from, + to: edge.to, + fromCol: from.col, + toCol: to.col, + }, + evidence: { + centerDistancePx: centerDistance, + nodeWidthsPx: [from.width, to.width], + actualSignedClearancePx: actualSignedClearance, + requiredDirectClearancePx: requiredDirectClearance, + }, + supportedFixes, + suppresses: [ + 'workflow/short-edge', + 'clean-flow/endpoint-side-direction', + 'workflow/label-node-overlap', + ], + }]); + } + } + return { enforceLegacyColumnCapacity }; +} + +// Automatic side selection: which sides an automatic one-bend route leaves and +// enters. Uses the shared side cache and the readable candidate set, so both are +// passed in rather than captured. +function createAutomaticSideSelection({ + workflow, + readableSideCache, + readableAutomaticCandidateSet, + compareCost, + oneBendCrossLaneVia, +}) { + function legacyAutomaticOneBendSides(edge, from, to) { + const automaticRoute = !edge.via && (!edge.route || edge.route === 'auto'); + const automaticFrom = !edge.fromSide || edge.fromSide === 'auto'; + const automaticTo = !edge.toSide || edge.toSide === 'auto'; + if (!automaticRoute || !automaticFrom || !automaticTo || from.lane === to.lane) return null; + if (from.cx === to.cx || from.cy === to.cy) return null; + const verticalFrom = to.cy < from.cy ? 'top' : 'bottom'; + const horizontalTo = to.cx < from.cx ? 'right' : 'left'; + const horizontalFrom = to.cx < from.cx ? 'left' : 'right'; + const verticalTo = to.cy < from.cy ? 'bottom' : 'top'; + const candidates = [ + { fromSide: verticalFrom, toSide: horizontalTo }, + { fromSide: horizontalFrom, toSide: verticalTo }, + ]; + + return candidates.find(({ fromSide, toSide }) => { + const start = anchor(from, fromSide); + const end = anchor(to, toSide); + return oneBendCrossLaneVia(edge, start, end, fromSide, toSide); + }) || null; + } + + function readableAutomaticSides(edge, from, to) { + const automaticRoute = !edge.via + && edge.channelX === undefined + && edge.channelY === undefined + && (!edge.route || edge.route === 'auto'); + const authoredFrom = edge.fromSide && edge.fromSide !== 'auto' ? edge.fromSide : null; + const authoredTo = edge.toSide && edge.toSide !== 'auto' ? edge.toSide : null; + if (!automaticRoute || (authoredFrom && authoredTo)) return null; + if (readableSideCache.has(edge)) return readableSideCache.get(edge); + + const preferred = []; + const legacyPreferred = legacyAutomaticOneBendSides(edge, from, to); + if (legacyPreferred) preferred.push(legacyPreferred); + preferred.push({ + fromSide: authoredFrom || defaultFromSide(from, to), + toSide: authoredTo || defaultToSide(from, to), + }); + const sideOrder = ['right', 'bottom', 'left', 'top']; + for (const fromSide of authoredFrom ? [authoredFrom] : sideOrder) { + for (const toSide of authoredTo ? [authoredTo] : sideOrder) { + preferred.push({ fromSide, toSide }); + } + } + + const seen = new Set(); + const sidePairs = []; + for (const candidate of preferred) { + if (authoredFrom && candidate.fromSide !== authoredFrom) continue; + if (authoredTo && candidate.toSide !== authoredTo) continue; + const key = `${candidate.fromSide}:${candidate.toSide}`; + if (seen.has(key)) continue; + seen.add(key); + sidePairs.push(candidate); + } + + const naturalFromSide = authoredFrom || defaultFromSide(from, to); + const naturalToSide = authoredTo || defaultToSide(from, to); + const planFor = (candidate, pairOrdinal) => { + const start = anchor(from, candidate.fromSide); + const end = anchor(to, candidate.toSide); + return { + start, + end, + planned: readableAutomaticCandidateSet( + edge, + from, + to, + start, + end, + candidate.fromSide, + candidate.toSide, + { + ordinalOffset: pairOrdinal * 9, + naturalFromSide, + naturalToSide, + }, + ), + }; + }; + + const primary = sidePairs[0]; + if (primary) { + const { planned } = planFor(primary, 0); + if (planned.candidates.length) { + readableSideCache.set(edge, primary); + return primary; + } + } + + const candidates = []; + for (const [pairOrdinal, candidate] of sidePairs.entries()) { + const { planned } = planFor(candidate, pairOrdinal); + candidates.push(...planned.candidates.map((route) => ({ ...route, ...candidate }))); + } + candidates.sort((left, right) => compareCost(left.cost, right.cost)); + if (candidates.length) { + const selected = { + fromSide: candidates[0].fromSide, + toSide: candidates[0].toSide, + }; + readableSideCache.set(edge, selected); + return selected; + } + readableSideCache.set(edge, null); + return null; + } + + function automaticOneBendSides(edge, from, to) { + return workflow.schema_version === 2 + ? readableAutomaticSides(edge, from, to) + : legacyAutomaticOneBendSides(edge, from, to); + } + return { automaticOneBendSides }; +} + function compileWorkflowInternal({ workflow: inputWorkflow, qualityProfile, + sourceEvidence, discoverFixes = true, layoutFeedback = {}, } = {}) { @@ -777,6 +1318,7 @@ function compileWorkflowInternal({ let inputDiagnostics = []; try { validateSchema('workflow', qualityResolvedWorkflow); + validateCrossCollectionContracts('workflow', qualityResolvedWorkflow); } catch (error) { inputDiagnostics = Array.isArray(error?.archifyDiagnostics) ? error.archifyDiagnostics.map((diagnostic) => ({ @@ -815,99 +1357,31 @@ function compileWorkflowInternal({ ? createReadableLayout(workflow, layoutFeedback) : createLegacyLayout(); -const LEGEND_CATALOG = [ - 'frontend', - 'backend', - 'security', - 'messagebus', - 'database', - 'cloud', - 'external', -].map((kind) => ({ kind, label: i18nText(workflow.meta.locale, `legend.workflow.${kind}`) })); -const presentLegendKinds = new Set(asArray(workflow.nodes).map((node) => node.type)); -const workflowLegendEntries = resolveLegend( - workflow.meta?.legend, - LEGEND_CATALOG, +const { + workflowLegendEntries, presentLegendKinds, -); -const legendFootprintOptions = { fontSize: 7, itemGap: 7 }; -const oneRowLegendFootprint = legendFootprint(workflowLegendEntries, { - ...legendFootprintOptions, - width: Number.MAX_SAFE_INTEGER, -}); -const minimumCanvasWidth = workflow.schema_version === 2 - ? Math.max(layout.defaultViewBoxWidth, oneRowLegendFootprint.minWidth + 40) - : layout.defaultViewBoxWidth; -const legendPackingWidth = Math.max( - 1, - (workflow.schema_version === 2 - ? minimumCanvasWidth - : (workflow.meta?.viewBox?.[0] ?? minimumCanvasWidth)) - 40, -); -const packedLegendFootprint = legendFootprint(workflowLegendEntries, { - ...legendFootprintOptions, - width: legendPackingWidth, -}); -const legendExtraHeight = workflow.schema_version === 2 - ? packedLegendFootprint.extraHeight - : 0; - -// Content is 680px wide (laneX + laneW); auto height fits the lanes plus legend. -const autoHeight = layout.laneY - + (layout.laneHeights?.reduce((total, height) => total + height, 0) - ?? (workflow.lanes?.length || 1) * layout.laneH) - + ((workflow.lanes?.length || 1) - 1) * layout.laneGap - + 124 - + legendExtraHeight; -let viewBox = workflow.meta?.viewBox || [minimumCanvasWidth, autoHeight]; + legendPackingWidth, + packedLegendFootprint, + legendExtraHeight, + minimumCanvasWidth, +} = resolveWorkflowLegendFootprint(workflow, layout); + +const laneGeometry = createWorkflowLaneGeometry(workflow, layout, legendExtraHeight, minimumCanvasWidth); +const { + autoHeight, + laneIndex, + laneLabels, + nodeContext, + laneHeight, + laneGroupHeaderH, + laneGroupFooterH, + laneTop, + lastLaneBottom, + legendY, +} = laneGeometry; +let viewBox = laneGeometry.initialViewBox; let requiredViewBox = [...viewBox]; -const laneIndex = new Map(asArray(workflow.lanes).map((lane, index) => [lane.id, index])); -const laneLabels = new Map(asArray(workflow.lanes).map((lane) => [lane.id, lane.label])); - -function nodeContext(node) { - const group = asArray(workflow.groups).find((candidate) => ( - candidate.lane === node.lane && node.col >= candidate.fromCol && node.col <= candidate.toCol - )); - const phase = asArray(workflow.phases).find((candidate) => ( - node.col >= candidate.fromCol && node.col <= candidate.toCol - )); - return [laneLabels.get(node.lane), group?.label, phase?.label].filter(Boolean).join(' › ') - || i18nText(workflow.meta.locale, 'node.context.workflow'); -} - -function laneHeight(idOrIndex) { - const index = typeof idOrIndex === 'number' ? idOrIndex : laneIndex.get(idOrIndex); - return layout.laneHeights?.[index] ?? layout.laneH; -} - -function laneGroupHeaderH(idOrIndex) { - const index = typeof idOrIndex === 'number' ? idOrIndex : laneIndex.get(idOrIndex); - return layout.groupHeaderHeights?.[index] ?? 0; -} - -function laneGroupFooterH(idOrIndex) { - const index = typeof idOrIndex === 'number' ? idOrIndex : laneIndex.get(idOrIndex); - return layout.groupFooterHeights?.[index] ?? 0; -} - -function laneTop(id) { - const index = laneIndex.get(id); - const precedingHeight = asArray(workflow.lanes).slice(0, index) - .reduce((total, _lane, lanePosition) => total + laneHeight(lanePosition), 0); - return layout.laneY + precedingHeight + index * layout.laneGap; -} - -function lastLaneBottom() { - return layout.laneY - + asArray(workflow.lanes).reduce((total, _lane, index) => total + laneHeight(index), 0) - + (workflow.lanes.length - 1) * layout.laneGap; -} - -function legendY() { - return lastLaneBottom() + 44 + legendExtraHeight; -} - function workflowLegendLayout(obstacles = []) { return { x: 20, @@ -938,37 +1412,23 @@ function workflowLegendRects() { ]; } -function measureNode(node) { - const width = node.width || layout.nodeW; - const height = node.height || (node.tag ? 68 : layout.nodeH); - const cx = layout.colXs[node.col]; - const groupHeaderH = laneGroupHeaderH(node.lane); - const contentH = laneHeight(node.lane) - layout.laneTitleH - - groupHeaderH - laneGroupFooterH(node.lane); - const y = laneTop(node.lane) + layout.laneTitleH + groupHeaderH - + (contentH - height) / 2 + (node.yOffset || 0); - return { - ...node, - width, - height, - x: cx - width / 2, - y, - cx, - cy: y + height / 2 - }; -} +const { measureNode, nodeTextFit, nodes } = measureWorkflowNodes(workflow, layout, laneGeometry); -// Font sizes for this renderer's node text; the fitting geometry is shared. -const nodeTextFit = { - labelPreferred: 11, - labelMinimum: 9, - sublabelPreferred: 8, - sublabelMinimum: 6, - tagPreferred: 7, - tagMinimum: 6, -}; +// Obstacles of the routing search are queried through a uniform grid instead of +// scanned: a candidate can only fail an obstacle its own box can reach. +const OBSTACLE_CELL = 160; -const nodes = new Map(asArray(workflow.nodes).map((node) => [node.id, measureNode(node)])); +const obstacleGrid = createSpatialGrid(OBSTACLE_CELL); +let rightmostNodeEdge = 0; +for (const node of nodes.values()) { + obstacleGrid.insert(rectToBounds(node), { kind: 'node', node, bounds: rectToBounds(node) }); + rightmostNodeEdge = Math.max(rightmostNodeEdge, node.x + node.width); +} +let rightmostRoutedEdge = Number.NEGATIVE_INFINITY; + +// Routed endpoints per node, so the port search reads only the routes that touch +// the node instead of walking every routed path. +const nodeRoutes = new Map(); function workflowCompositionFrames() { const frames = []; @@ -1045,17 +1505,8 @@ function workflowSceneLabelObstacles() { return obstacles; } -const mainPathSteps = new Map(asArray(workflow.mainPath).map((id, index) => [id, index])); -const edgeSteps = new Map(asArray(workflow.edges).map((edge, index) => { - const fromStep = mainPathSteps.get(edge.from); - const toStep = mainPathSteps.get(edge.to); - const mainStep = Number.isInteger(fromStep) && toStep === fromStep + 1 ? fromStep : null; - return [edge, mainStep ?? asArray(workflow.mainPath).length + index]; -})); - -function nodeStep(node) { - return mainPathSteps.get(node.id) ?? asArray(workflow.mainPath).length + asArray(workflow.nodes).findIndex((item) => item.id === node.id); -} +const { mainPathSteps, edgeSteps, nodeStep } = createWorkflowStepIndexes(workflow); +const edgeIndexByEdge = new Map(asArray(workflow.edges).map((edge, index) => [edge, index])); function acceptsFix(mutator) { if (!discoverFixes) return false; @@ -1068,164 +1519,16 @@ function nodeStep(node) { }).ok); } - function verifiedLegacyAlternative(edge, from, to, requiredClearance) { - const occupied = [...nodes.values()].filter((node) => node.lane === to.lane && node.id !== to.id); - const candidates = layout.colXs.map((center, col) => ({ center, col })) - .filter(({ col }) => col !== to.col) - .sort((a, b) => Math.abs(a.col - to.col) - Math.abs(b.col - to.col) || a.col - b.col); - for (const candidate of candidates) { - const candidateRect = { ...to, col: candidate.col, cx: candidate.center, x: candidate.center - to.width / 2 }; - if (occupied.some((node) => rectsOverlap(candidateRect, node, 8))) continue; - const centerDistance = Math.abs(candidate.center - from.cx); - const signedClearance = centerDistance - from.width / 2 - to.width / 2; - if (signedClearance < requiredClearance) continue; - if (acceptsFix((document) => { - document.nodes.find((node) => node.id === to.id).col = candidate.col; - })) return candidate.col; - } - return null; - } - - function readableMigrationProvidesCapacity(from, to, requiredClearance) { - const readable = createReadableLayout({ ...workflow, schema_version: 2 }); - const centerDistance = Math.abs(readable.colXs[to.col] - readable.colXs[from.col]); - if (centerDistance - from.width / 2 - to.width / 2 < requiredClearance) return false; - if (!discoverFixes) return false; - - return withDiagnosticRecordingSuppressed(() => { - const migrationQualityProfile = authoredQualityProfile; - let planned = compileWorkflowWithFeedback({ - workflow: intrinsicWorkflow(workflow), - qualityProfile: migrationQualityProfile, - discoverFixes: false, - }); - if (!planned.ok) { - planned = compileWorkflowWithFeedback({ - workflow: planningWorkflow(workflow), - qualityProfile: migrationQualityProfile, - discoverFixes: false, - }); - } - if (!planned.ok || !Array.isArray(planned.receipt?.columns)) return false; - - let candidate; - try { - candidate = createMappedWorkflowCandidate( - workflow, - LEGACY_COLUMN_CENTERS, - planned.receipt.columns, - ).document; - } catch { - return false; - } - let compiled = compileWorkflowWithFeedback({ - workflow: candidate, - qualityProfile: migrationQualityProfile, - discoverFixes: false, - }); - const requiredViewBox = compiled.diagnostics?.length - && compiled.diagnostics.every(({ code }) => code === 'workflow/viewbox-capacity') - ? compiled.diagnostics.find(({ evidence }) => Array.isArray(evidence?.requiredViewBox)) - ?.evidence.requiredViewBox - : null; - if (!compiled.ok && Array.isArray(candidate.meta?.viewBox) && requiredViewBox) { - candidate.meta.viewBox = [ - Math.max(candidate.meta.viewBox[0], requiredViewBox[0]), - Math.max(candidate.meta.viewBox[1], requiredViewBox[1]), - ]; - compiled = compileWorkflowWithFeedback({ - workflow: candidate, - qualityProfile: migrationQualityProfile, - discoverFixes: false, - }); - } - return compiled.ok; - }); - } - -function verifiedReducedWidths(from, to, requiredClearance) { - const widthBudget = 2 * (Math.abs(to.cx - from.cx) - requiredClearance); - if (widthBudget < 64) return null; - const widths = [from.width, to.width]; - let excess = widths[0] + widths[1] - widthBudget; - for (const index of widths[0] >= widths[1] ? [0, 1] : [1, 0]) { - const reduction = Math.min(excess, widths[index] - 32); - widths[index] -= reduction; - excess -= reduction; - } - if (excess > 0.0001) return null; - const candidates = [from, to]; - const labelsFit = candidates.every((node, index) => ( - textUnits(node.label) * 6.8 <= widths[index] + 6 - && (!node.sublabel || minimumNodeTextWidth(node.sublabel, nodeTextFit.sublabelMinimum) <= availableNodeTextWidth(widths[index])) - && (!node.tag || minimumNodeTextWidth(node.tag, nodeTextFit.tagMinimum) <= availableNodeTextWidth(widths[index])) - )); - if (!labelsFit) return null; - const serializedWidths = widths.map((width) => Math.floor((width + 1e-9) * 100) / 100); - const signedClearance = Math.abs(to.cx - from.cx) - - serializedWidths[0] / 2 - serializedWidths[1] / 2; - if (signedClearance + 0.0001 < requiredClearance) return null; - const accepted = acceptsFix((document) => { - document.nodes.find((node) => node.id === from.id).width = serializedWidths[0]; - document.nodes.find((node) => node.id === to.id).width = serializedWidths[1]; - }); - return accepted ? serializedWidths : null; -} - -function enforceLegacyColumnCapacity() { - if (workflow.schema_version !== 1) return; - for (const edge of workflow.edges) { - const from = nodes.get(edge.from); - const to = nodes.get(edge.to); - if (!from || !to || from.lane !== to.lane || from.col === to.col) continue; - if (!verticalIntervalsOverlap(from, to, 8)) continue; - const centerDistance = Math.abs(to.cx - from.cx); - const actualSignedClearance = centerDistance - from.width / 2 - to.width / 2; - const direct = !edge.via && ['auto', 'straight'].includes(edge.route || 'auto') - && Math.abs(from.cy - to.cy) < 0.0001; - const requiredDirectClearance = direct ? 28 : 8; - if (actualSignedClearance >= requiredDirectClearance) continue; - const alternative = verifiedLegacyAlternative(edge, from, to, requiredDirectClearance); - const reducedWidths = verifiedReducedWidths(from, to, requiredDirectClearance); - const capacity = actualSignedClearance < 0 - ? `overlap by ${Math.abs(Math.round(actualSignedClearance))}px` - : `leave only ${Math.round(actualSignedClearance)}px of direct clearance`; - const message = `Workflow columns ${from.col}→${to.col} place nodes "${from.id}" and "${to.id}" so they ${capacity} under the fixed-v1 layout.`; - const supportedFixes = []; - if (readableMigrationProvidesCapacity(from, to, requiredDirectClearance)) { - supportedFixes.push('migrate this workflow to schema_version 2'); - } - if (alternative !== null) supportedFixes.push(`move node "${to.id}" to verified free column ${alternative}`); - if (reducedWidths) { - supportedFixes.push(`set node widths "${from.id}"=${Math.round(reducedWidths[0] * 100) / 100}px and "${to.id}"=${Math.round(reducedWidths[1] * 100) / 100}px`); - } - throwDiagnosticError(message, [{ - code: 'workflow/column-capacity', - severity: 'error', - message, - subject: { - diagramType: 'workflow', - edge: edge.id ?? null, - from: edge.from, - to: edge.to, - fromCol: from.col, - toCol: to.col, - }, - evidence: { - centerDistancePx: centerDistance, - nodeWidthsPx: [from.width, to.width], - actualSignedClearancePx: actualSignedClearance, - requiredDirectClearancePx: requiredDirectClearance, - }, - supportedFixes, - suppresses: [ - 'workflow/short-edge', - 'clean-flow/endpoint-side-direction', - 'workflow/label-node-overlap', - ], - }]); - } -} +const { enforceLegacyColumnCapacity } = createLegacyCapacityRepair({ + workflow, + nodes, + layout, + discoverFixes, + resolvedQualityProfile, + authoredQualityProfile, + nodeTextFit, + acceptsFix, +}); function verifiedEdgeFix(edge, message, mutator) { const edgeIndex = workflow.edges.indexOf(edge); @@ -1842,7 +2145,7 @@ function corridorTopologyMatches(points, axis, coordinate) { const via = axis === 'x' ? [[coordinate, start[1]], [coordinate, end[1]]] : [[start[0], coordinate], [end[0], coordinate]]; - const expected = normalizeRoutePoints([start, ...via, end]); + const expected = joinRoutePoints(start, via, end); const actualPattern = routeSegments(collapsed).map(({ orientation }) => orientation); const expectedPattern = routeSegments(expected).map(({ orientation }) => orientation); return actualPattern.length === expectedPattern.length @@ -1913,6 +2216,15 @@ function routeContainsChannelPin(points, field, value) { function validateReadablePinnedGeometry() { if (workflow.schema_version !== 2) return; + // Reserve absolute geometry at contested nodes before automatic routing, + // independently of IDs. Unrelated routes retain their diagnostic ordering. + for (const edge of workflow.edges) { + if (!hasAbsoluteRoutePins(edge) || !nodes.has(edge.from) || !nodes.has(edge.to)) continue; + if (!workflow.edges.some(other => !hasAbsoluteRoutePins(other) + && [edge.from, edge.to].some(id => id === other.from || id === other.to))) continue; + validateReadableRouteControls(edge); + pathFor(edge); + } for (const edge of workflow.edges) { if (!nodes.has(edge.from) || !nodes.has(edge.to)) continue; validateReadableRouteControls(edge); @@ -2387,6 +2699,9 @@ function validateWorkflow() { profile: workflow.meta?.quality_profile, profileIsAuthoritative: true, mergeForwardCollinearWaypoints: workflow.schema_version === 2, + includeSharedEndpoints: () => workflow.schema_version === 2, + warnInStandard: workflow.schema_version === 2, + ...(workflow.schema_version === 2 ? { onDiagnostic: diagnostic => workflowDiagnostics.push(diagnostic) } : {}), routeHint: 'adjust route/via, bias, or channel coordinates so the edges use separate lane corridors' })); problems.push(...cleanAmbiguousCorridorProblems({ @@ -2397,8 +2712,29 @@ function validateWorkflow() { relationCollection: 'edges', profile: workflow.meta?.quality_profile, profileIsAuthoritative: true, + includeSharedEndpoints: () => workflow.schema_version === 2, + allowShortWorkflowTrunks: workflow.schema_version === 2, + onDiagnostic: (diagnostic) => workflowDiagnostics.push(diagnostic), routeHint: 'adjust route/via, bias, or channel coordinates so unrelated edges do not visually merge' })); + if (workflow.schema_version === 2) { + const routedRelations = workflow.edges.map((relation, relationIndex) => ({ + relation: { ...relation, width: relation.width || (relation.variant === 'emphasis' ? 1.8 : 1.4) }, + relationIndex, points: pathFor(relation).points, + })); + for (const hit of collectArrowheadCollisions({ routedRelations, allowShortWorkflowTrunks: true })) { + const severity = resolvedQualityProfile === 'showcase' ? 'error' : 'warning'; + const name = entry => entry.relation.id || `${entry.relation.from}->${entry.relation.to}`; + const message = `[composition/arrowhead-collision] workflow arrows "${name(hit.left)}" and "${name(hit.right)}" overlap at their destination (clearance ${hit.distance}px; minimum ${hit.minimum}px).`; + workflowDiagnostics.push({ + code: 'composition/arrowhead-collision', severity, message, + subject: { diagramType: 'workflow', edge: name(hit.left), from: hit.left.relation.from, to: hit.left.relation.to }, + evidence: { otherEdge: name(hit.right), distancePx: hit.distance, minimumPx: hit.minimum }, + supportedFixes: ['use separate destination sides or ports with clearance for both arrow markers'], + }); + if (severity === 'error') problems.push(message); + } + } problems.push(...cleanBorderRunProblems({ relations: workflow.edges, endpointIds: new Set(nodes.keys()), @@ -2451,7 +2787,7 @@ function validateWorkflow() { for (const rect of labelRects) { for (const node of nodes.values()) { if (rectsOverlap(rect, node, -2)) { - problems.push(`Label "${rect.label}" overlaps node "${node.id}" — adjust labelDx/labelDy/labelSegment or set labelAt.\n${suggestLabelObstacleFix(rect, rect.lx, rect.ly, node, 'node')}`); + problems.push(`Label "${rect.label}" overlaps node "${node.id}" — adjust labelDx/labelDy/labelSegment or set labelAt.\n${suggestLabelObstacleFix(rect, rect.lx, rect.ly, node, 'node', viewBox, nodes.values())}`); } } } @@ -2480,11 +2816,21 @@ function validateWorkflow() { if (legendY() + 18 > viewBox[1]) { problems.push(`Legend exceeds viewBox height ${viewBox[1]} — set meta.viewBox[1] to at least ${legendY() + 18}.`); } + // v1 only; see collectLabelCanvasOverflow in shared/geometry.mjs. + problems.push(...cleanLabelCanvasContainmentProblems({ + labels: labelRects, + viewBox, + diagramType: 'workflow', + relationCollection: 'edges', + profile: workflow.meta?.quality_profile, + profileIsAuthoritative: true, + })); } if (problems.length) { throwDiagnosticProblems('Workflow layout validation failed', problems, { subject: { diagramType: 'workflow' }, + diagnostics: workflowDiagnostics, }); } } @@ -2664,6 +3010,10 @@ function validateReadableInputsBeforeRouting() { } byLane.set(node.lane, [...(byLane.get(node.lane) || []), node]); } + // Every overlapping pair is reported at once. Failing on the first pair + // made an author who stacked two groups of nodes fix one, rerun, and only + // then learn about the other; the draft already contained both. + const overlaps = []; for (const [lane, laneNodes] of byLane) { for (let left = 0; left < laneNodes.length; left += 1) { for (let right = left + 1; right < laneNodes.length; right += 1) { @@ -2683,7 +3033,7 @@ function validateReadableInputsBeforeRouting() { : []; }); const message = `Workflow nodes "${leftNode.id}" and "${rightNode.id}" are less than 8px apart in lane "${lane}".`; - fail({ + overlaps.push({ code: 'workflow/node-overlap', severity: 'error', message, @@ -2702,6 +3052,11 @@ function validateReadableInputsBeforeRouting() { } } } + if (overlaps.length) { + throwDiagnosticError(overlaps.length === 1 + ? overlaps[0].message + : `Workflow node overlap:\n- ${overlaps.map((entry) => entry.message).join('\n- ')}`, overlaps); + } } function gapYBetween(fromLane, toLane, bias = 0.5) { @@ -2748,10 +3103,38 @@ function sameLaneAutoVia(start, end) { return [[midX, start[1]], [midX, end[1]]]; } +function routeBounds(points) { + let minX = Infinity; let minY = Infinity; let maxX = -Infinity; let maxY = -Infinity; + for (const point of points) { + if (point[0] < minX) minX = point[0]; + if (point[0] > maxX) maxX = point[0]; + if (point[1] < minY) minY = point[1]; + if (point[1] > maxY) maxY = point[1]; + } + return { minX, minY, maxX, maxY }; +} + +function rectToBounds(rect) { + return { minX: rect.x, minY: rect.y, maxX: rect.x + rect.width, maxY: rect.y + rect.height }; +} + +function boundsOverlap(a, b, margin) { + return a.minX <= b.maxX + margin && b.minX <= a.maxX + margin + && a.minY <= b.maxY + margin && b.minY <= a.maxY + margin; +} + function routeClearsUnrelatedNodes(edge, points, clearance = 2) { const endpointIds = new Set([edge.from, edge.to]); - for (const node of nodes.values()) { + const routeExtent = routeBounds(points); + const queryBox = { + minX: routeExtent.minX - clearance, minY: routeExtent.minY - clearance, + maxX: routeExtent.maxX + clearance, maxY: routeExtent.maxY + clearance, + }; + for (const item of obstacleGrid.query(queryBox)) { + if (item.kind !== 'node') continue; + const node = item.node; if (endpointIds.has(node.id)) continue; + if (!boundsOverlap(routeExtent, rectToBounds(node), clearance)) continue; for (let index = 0; index < points.length - 1; index += 1) { if (segmentIntersectsRect({ start: points[index], end: points[index + 1] }, node, clearance)) { return false; @@ -2809,121 +3192,15 @@ function oneBendCrossLaneVia(edge, start, end, fromSide, toSide) { const pathCache = new Map(); const readableSideCache = new Map(); - -function legacyAutomaticOneBendSides(edge, from, to) { - const automaticRoute = !edge.via && (!edge.route || edge.route === 'auto'); - const automaticFrom = !edge.fromSide || edge.fromSide === 'auto'; - const automaticTo = !edge.toSide || edge.toSide === 'auto'; - if (!automaticRoute || !automaticFrom || !automaticTo || from.lane === to.lane) return null; - if (from.cx === to.cx || from.cy === to.cy) return null; - const verticalFrom = to.cy < from.cy ? 'top' : 'bottom'; - const horizontalTo = to.cx < from.cx ? 'right' : 'left'; - const horizontalFrom = to.cx < from.cx ? 'left' : 'right'; - const verticalTo = to.cy < from.cy ? 'bottom' : 'top'; - const candidates = [ - { fromSide: verticalFrom, toSide: horizontalTo }, - { fromSide: horizontalFrom, toSide: verticalTo }, - ]; - - return candidates.find(({ fromSide, toSide }) => { - const start = anchor(from, fromSide); - const end = anchor(to, toSide); - return oneBendCrossLaneVia(edge, start, end, fromSide, toSide); - }) || null; -} - -function readableAutomaticSides(edge, from, to) { - const automaticRoute = !edge.via - && edge.channelX === undefined - && edge.channelY === undefined - && (!edge.route || edge.route === 'auto'); - const authoredFrom = edge.fromSide && edge.fromSide !== 'auto' ? edge.fromSide : null; - const authoredTo = edge.toSide && edge.toSide !== 'auto' ? edge.toSide : null; - if (!automaticRoute || (authoredFrom && authoredTo)) return null; - if (readableSideCache.has(edge)) return readableSideCache.get(edge); - - const preferred = []; - const legacyPreferred = legacyAutomaticOneBendSides(edge, from, to); - if (legacyPreferred) preferred.push(legacyPreferred); - preferred.push({ - fromSide: authoredFrom || defaultFromSide(from, to), - toSide: authoredTo || defaultToSide(from, to), - }); - const sideOrder = ['right', 'bottom', 'left', 'top']; - for (const fromSide of authoredFrom ? [authoredFrom] : sideOrder) { - for (const toSide of authoredTo ? [authoredTo] : sideOrder) { - preferred.push({ fromSide, toSide }); - } - } - - const seen = new Set(); - const sidePairs = []; - for (const candidate of preferred) { - if (authoredFrom && candidate.fromSide !== authoredFrom) continue; - if (authoredTo && candidate.toSide !== authoredTo) continue; - const key = `${candidate.fromSide}:${candidate.toSide}`; - if (seen.has(key)) continue; - seen.add(key); - sidePairs.push(candidate); - } - - const naturalFromSide = authoredFrom || defaultFromSide(from, to); - const naturalToSide = authoredTo || defaultToSide(from, to); - const planFor = (candidate, pairOrdinal) => { - const start = anchor(from, candidate.fromSide); - const end = anchor(to, candidate.toSide); - return { - start, - end, - planned: readableAutomaticCandidateSet( - edge, - from, - to, - start, - end, - candidate.fromSide, - candidate.toSide, - { - ordinalOffset: pairOrdinal * 9, - naturalFromSide, - naturalToSide, - }, - ), - }; - }; - - const primary = sidePairs[0]; - if (primary) { - const { planned } = planFor(primary, 0); - if (planned.candidates.length) { - readableSideCache.set(edge, primary); - return primary; - } - } - - const candidates = []; - for (const [pairOrdinal, candidate] of sidePairs.entries()) { - const { planned } = planFor(candidate, pairOrdinal); - candidates.push(...planned.candidates.map((route) => ({ ...route, ...candidate }))); - } - candidates.sort((left, right) => compareCost(left.cost, right.cost)); - if (candidates.length) { - const selected = { - fromSide: candidates[0].fromSide, - toSide: candidates[0].toSide, - }; - readableSideCache.set(edge, selected); - return selected; - } - readableSideCache.set(edge, null); - return null; -} - -function automaticOneBendSides(edge, from, to) { - return workflow.schema_version === 2 - ? readableAutomaticSides(edge, from, to) - : legacyAutomaticOneBendSides(edge, from, to); -} +const workflowDiagnostics = []; + +const { automaticOneBendSides } = createAutomaticSideSelection({ + workflow, + readableSideCache, + readableAutomaticCandidateSet, + compareCost, + oneBendCrossLaneVia, +}); const OUTWARD_SIDE_VECTOR = Object.freeze({ left: [-1, 0], @@ -2972,13 +3249,19 @@ function routeMeetsHardRhythm(points) { function routeLabelClearsNodes(edge, points) { if (!edge.label || edge.labelAt) return true; const [lx, ly] = workflowEdgeLabelPoint(edge, points); - const rect = { - x: lx - workflowLabelWidth(edge.label) / 2, - y: ly - 10, - width: workflowLabelWidth(edge.label), - height: 14, + const width = workflowLabelWidth(edge.label); + const rect = { x: lx - width / 2, y: ly - 10, width, height: 14 }; + // The comparison shrinks the rect by two pixels, so only nodes inside the + // shrunk box can fail it. + const queryBox = { + minX: rect.x + 2, minY: rect.y + 2, + maxX: rect.x + rect.width - 2, maxY: rect.y + rect.height - 2, }; - return [...nodes.values()].every((node) => !rectsOverlap(rect, node, -2)); + for (const item of obstacleGrid.query(queryBox)) { + if (item.kind !== 'node') continue; + if (rectsOverlap(rect, item.node, -2)) return false; + } + return true; } function candidateLabelRect(edge, points) { @@ -2990,25 +3273,41 @@ function candidateLabelRect(edge, points) { function labelRouteClearanceDeficit(edge, points, threshold = 8) { const candidateLabel = candidateLabelRect(edge, points); + const candidateExtent = routeBounds(points); + if (candidateLabel) { + const labelExtent = rectToBounds(candidateLabel); + candidateExtent.minX = Math.min(candidateExtent.minX, labelExtent.minX); + candidateExtent.minY = Math.min(candidateExtent.minY, labelExtent.minY); + candidateExtent.maxX = Math.max(candidateExtent.maxX, labelExtent.maxX); + candidateExtent.maxY = Math.max(candidateExtent.maxY, labelExtent.maxY); + } + const queryBox = { + minX: candidateExtent.minX - threshold, minY: candidateExtent.minY - threshold, + maxX: candidateExtent.maxX + threshold, maxY: candidateExtent.maxY + threshold, + }; + // Accumulate in the order the routes were registered, which is the order the + // previous full scan used, so the floating-point sum is identical. + const items = obstacleGrid.query(queryBox) + .filter((item) => item.kind === 'route' || item.kind === 'label') + .sort((left, right) => left.sequence - right.sequence || (left.kind === right.kind ? 0 : left.kind === 'route' ? -1 : 1)); let deficit = 0; - for (const [otherEdge, routed] of pathCache) { - const otherIndex = workflow.edges.indexOf(otherEdge); - const otherLabel = labelRectFor(otherEdge, otherIndex); - if (candidateLabel) { - for (let index = 0; index < routed.points.length - 1; index += 1) { + for (const item of items) { + if (item.kind === 'route') { + if (!candidateLabel) continue; + const otherPoints = item.routed.points; + for (let index = 0; index < otherPoints.length - 1; index += 1) { const clearance = segmentRectClearance({ - start: routed.points[index], - end: routed.points[index + 1], + start: otherPoints[index], + end: otherPoints[index + 1], }, candidateLabel); if (clearance != null) deficit += Math.max(0, threshold - clearance); } - } - if (otherLabel) { + } else if (candidateLabel || !edge.label) { for (let index = 0; index < points.length - 1; index += 1) { const clearance = segmentRectClearance({ start: points[index], end: points[index + 1], - }, otherLabel); + }, item.rect); if (clearance != null) deficit += Math.max(0, threshold - clearance); } } @@ -3018,25 +3317,42 @@ function labelRouteClearanceDeficit(edge, points, threshold = 8) { function routeClearsPlacedLabels(edge, points) { const candidateLabel = candidateLabelRect(edge, points); - for (const [otherEdge, routed] of pathCache) { - const otherIndex = workflow.edges.indexOf(otherEdge); - const otherLabel = labelRectFor(otherEdge, otherIndex); - if (candidateLabel && otherLabel && rectsOverlap(candidateLabel, otherLabel, -2)) return false; - if (candidateLabel) { - for (let index = 0; index < routed.points.length - 1; index += 1) { - const clearance = segmentRectClearance({ - start: routed.points[index], - end: routed.points[index + 1], - }, candidateLabel); - if (clearance != null && clearance + 0.0001 < 4) return false; - } - } - if (otherLabel) { + const candidateExtent = routeBounds(points); + const queryBox = { + minX: candidateExtent.minX - 4, minY: candidateExtent.minY - 4, + maxX: candidateExtent.maxX + 4, maxY: candidateExtent.maxY + 4, + }; + if (candidateLabel) { + queryBox.minX = Math.min(queryBox.minX, candidateLabel.x - 4); + queryBox.minY = Math.min(queryBox.minY, candidateLabel.y - 4); + queryBox.maxX = Math.max(queryBox.maxX, candidateLabel.x + candidateLabel.width + 4); + queryBox.maxY = Math.max(queryBox.maxY, candidateLabel.y + candidateLabel.height + 4); + } + for (const item of obstacleGrid.query(queryBox)) { + // A label may sit far from the route it annotates, so both boxes are queried. + if (item.kind === 'label') { + if (candidateLabel && rectsOverlap(candidateLabel, item.rect, -2)) return false; + const rect = item.rect; + // Either axis further than the minimum clearance means no segment can reach it. + if (Math.max(rect.x - candidateExtent.maxX, candidateExtent.minX - (rect.x + rect.width)) >= 4 + || Math.max(rect.y - candidateExtent.maxY, candidateExtent.minY - (rect.y + rect.height)) >= 4) continue; for (let index = 0; index < points.length - 1; index += 1) { const clearance = segmentRectClearance({ start: points[index], end: points[index + 1], - }, otherLabel); + }, rect); + if (clearance != null && clearance + 0.0001 < 4) return false; + } + } else if (item.kind === 'route' && candidateLabel) { + const otherBounds = item.bounds; + if (Math.max(candidateLabel.x - otherBounds.maxX, otherBounds.minX - (candidateLabel.x + candidateLabel.width)) >= 4 + || Math.max(candidateLabel.y - otherBounds.maxY, otherBounds.minY - (candidateLabel.y + candidateLabel.height)) >= 4) continue; + const otherPoints = item.routed.points; + for (let index = 0; index < otherPoints.length - 1; index += 1) { + const clearance = segmentRectClearance({ + start: otherPoints[index], + end: otherPoints[index + 1], + }, candidateLabel); if (clearance != null && clearance + 0.0001 < 4) return false; } } @@ -3057,23 +3373,59 @@ function routeClearsLegend(edge, points) { return true; } +// Scene label obstacles are a pure function of the document and the layout. +let cachedSceneLabelObstacles = null; +function sceneLabelObstacles() { + if (!cachedSceneLabelObstacles) { + cachedSceneLabelObstacles = workflowSceneLabelObstacles(); + for (const obstacle of cachedSceneLabelObstacles) { + obstacleGrid.insert(rectToBounds(obstacle), { kind: 'scene', obstacle }); + } + } + return cachedSceneLabelObstacles; +} + function routeClearsSceneLabelObstacles(edge, points) { + // Asking for the cached list also publishes it to the grid. + sceneLabelObstacles(); const label = candidateLabelRect(edge, points); - for (const obstacle of workflowSceneLabelObstacles()) { + const extent = routeBounds(points); + const queryBox = { + minX: extent.minX, minY: extent.minY, maxX: extent.maxX, maxY: extent.maxY, + }; + if (label) { + queryBox.minX = Math.min(queryBox.minX, label.x); + queryBox.minY = Math.min(queryBox.minY, label.y); + queryBox.maxX = Math.max(queryBox.maxX, label.x + label.width); + queryBox.maxY = Math.max(queryBox.maxY, label.y + label.height); + } + for (const item of obstacleGrid.query(queryBox)) { + if (item.kind !== 'scene') continue; for (let index = 0; index < points.length - 1; index += 1) { - if (segmentIntersectsRect({ start: points[index], end: points[index + 1] }, obstacle)) { + if (segmentIntersectsRect({ start: points[index], end: points[index + 1] }, item.obstacle)) { return false; } } - if (label && rectsOverlap(label, obstacle)) return false; + if (label && rectsOverlap(label, item.obstacle)) return false; } return true; } +// Composition frames are pure as well; only a frame that reaches the candidate +// can share a border line with it. +let cachedCompositionFrames = null; +function compositionFrames() { + if (!cachedCompositionFrames) cachedCompositionFrames = workflowCompositionFrames(); + return cachedCompositionFrames; +} + function routeClearsFrameBorders(points) { + const extent = routeBounds(points); + const nearFrames = compositionFrames().filter((frame) => boundsOverlap(rectToBounds(frame), extent, 0)); + if (!nearFrames.length) return true; return collectBorderRuns({ routedRelations: [{ points }], - frames: workflowCompositionFrames(), + frames: nearFrames, }).length === 0; } @@ -3092,19 +3444,22 @@ function routeFitsCanvasOrigin(edge, points) { return routeExtentCoordinates(edge, points).every(([x, y]) => x >= 0 && y >= 0); } +// Predicates are pure, so their order does not change the result; they are +// ordered by "cheap and selective first" so the expensive clearance work runs +// on fewer candidates. function readableCandidateIsFeasible(edge, points, from, to, fromSide, toSide) { return points.length >= 2 && orthogonalRoute(points) - && routeHonorsEndpointSides(points, fromSide, toSide) && routeMeetsHardRhythm(points) + && routeHonorsEndpointSides(points, fromSide, toSide) && routeClearsEndpointNodes(points, from, to) - && routeClearsUnrelatedNodes(edge, points) && routeLabelClearsNodes(edge, points) - && routeClearsPlacedLabels(edge, points) - && routeClearsLegend(edge, points) && routeClearsSceneLabelObstacles(edge, points) + && routeClearsUnrelatedNodes(edge, points) + && routeClearsPlacedLabels(edge, points) + && routeFitsCanvasOrigin(edge, points) && routeClearsFrameBorders(points) - && routeFitsCanvasOrigin(edge, points); + && routeClearsLegend(edge, points); } function corridorViaY(start, end, fromSide, toSide, y) { @@ -3119,19 +3474,6 @@ function corridorViaX(start, end, fromSide, toSide, x) { return [startStub, [x, startStub[1]], [x, endStub[1]], endStub]; } -function axisOverlapLength(a, b, c, d) { - const horizontal = Math.abs(a[1] - b[1]) <= 0.0001 - && Math.abs(c[1] - d[1]) <= 0.0001 - && Math.abs(a[1] - c[1]) <= 0.0001; - const vertical = Math.abs(a[0] - b[0]) <= 0.0001 - && Math.abs(c[0] - d[0]) <= 0.0001 - && Math.abs(a[0] - c[0]) <= 0.0001; - if (!horizontal && !vertical) return 0; - const axis = horizontal ? 0 : 1; - return Math.max(0, Math.min(Math.max(a[axis], b[axis]), Math.max(c[axis], d[axis])) - - Math.max(Math.min(a[axis], b[axis]), Math.min(c[axis], d[axis]))); -} - function properAxisCrossing(a, b, c, d) { const firstHorizontal = Math.abs(a[1] - b[1]) <= 0.0001; const secondHorizontal = Math.abs(c[1] - d[1]) <= 0.0001; @@ -3146,19 +3488,40 @@ function properAxisCrossing(a, b, c, d) { && y < Math.max(vertical[0][1], vertical[1][1]) - 0.0001; } +function independentAutomaticRoute(edge) { + return workflow.schema_version === 2 + && !edge.via && edge.channelX === undefined && edge.channelY === undefined + && !edge.labelAt + && (!edge.route || edge.route === 'auto') + && (!edge.fromSide || edge.fromSide === 'auto') + && (!edge.toSide || edge.toSide === 'auto'); +} + function routeInteractionMetrics(edge, points) { let properCrossingCount = 0; let sharedCorridorPx = 0; - for (const [otherEdge, routed] of pathCache) { - if ([edge.from, edge.to].some((id) => id === otherEdge.from || id === otherEdge.to)) continue; + const extent = routeBounds(points); + const nearbyRoutes = obstacleGrid.query({ + minX: extent.minX - 8, minY: extent.minY - 8, + maxX: extent.maxX + 8, maxY: extent.maxY + 8, + }) + .filter((item) => item.kind === 'route') + .sort((left, right) => left.sequence - right.sequence); + for (const item of nearbyRoutes) { + const otherEdge = item.edge; + const routed = item.routed; + const sharedEndpoint = [edge.from, edge.to].some((id) => id === otherEdge.from || id === otherEdge.to); + if (sharedEndpoint && workflow.schema_version !== 2) continue; + sharedCorridorPx += collectAmbiguousCorridors({ + routedRelations: [{ relation: edge, points }, { relation: otherEdge, points: routed.points }], + includeSharedEndpoints: () => workflow.schema_version === 2, + allowShortWorkflowTrunks: workflow.schema_version === 2, + }).reduce((total, hit) => total + hit.overlapLength, 0); for (let left = 0; left < points.length - 1; left += 1) { for (let right = 0; right < routed.points.length - 1; right += 1) { if (properAxisCrossing(points[left], points[left + 1], routed.points[right], routed.points[right + 1])) { properCrossingCount += 1; } - sharedCorridorPx += axisOverlapLength( - points[left], points[left + 1], routed.points[right], routed.points[right + 1], - ); } } } @@ -3189,12 +3552,20 @@ function readableCandidateCost( const directLength = Math.abs(points.at(-1)[0] - points[0][0]) + Math.abs(points.at(-1)[1] - points[0][1]); const interiorPreferred28Deficit = segmentLengths.slice(1, -1) .reduce((total, length) => total + Math.max(0, 28 - length), 0); - const xs = points.map(([x]) => x); - const ys = points.map(([, y]) => y); - const canvasGrowthPx = Math.max(0, -Math.min(...xs)) - + Math.max(0, Math.max(...xs) - minimumCanvasWidth) - + Math.max(0, -Math.min(...ys)) - + Math.max(0, Math.max(...ys) - autoHeight); + let minX = Infinity; + let maxX = -Infinity; + let minY = Infinity; + let maxY = -Infinity; + for (const [x, y] of points) { + minX = Math.min(minX, x); + maxX = Math.max(maxX, x); + minY = Math.min(minY, y); + maxY = Math.max(maxY, y); + } + const canvasGrowthPx = Math.max(0, -minX) + + Math.max(0, maxX - minimumCanvasWidth) + + Math.max(0, -minY) + + Math.max(0, maxY - autoHeight); const from = nodes.get(edge.from); const to = nodes.get(edge.to); const naturalStart = anchor(from, naturalFromSide); @@ -3268,7 +3639,7 @@ function readableAutomaticCandidateSet( const candidates = rawCandidates.map((candidate, ordinal) => ({ ...candidate, ordinal: ordinalOffset + ordinal, - points: normalizeRoutePoints([start, ...candidate.via, end]), + points: joinRoutePoints(start, candidate.via, end), })).filter(({ points }) => ( readableCandidateIsFeasible(edge, points, from, to, fromSide, toSide) )).map((candidate) => ({ @@ -3301,58 +3672,44 @@ function readableAutomaticVia(edge, from, to, start, end, fromSide, toSide) { const currentPoints = normalizeRoutePoints([start, ...outsideRightCandidate.via, end]); const labelRect = candidateLabelRect(edge, currentPoints); let outsideRightMinX = outsideRight; - for (const node of nodes.values()) { - if (!labelRect || !rectsOverlap(labelRect, node, -2)) continue; - const rightwardLabelDeficit = node.x + node.width - 2 - labelRect.x; - if (rightwardLabelDeficit > 0) { - outsideRightMinX = Math.max( - outsideRightMinX, - outsideRight + rightwardLabelDeficit * 2, - ); - } - } - for (const [otherEdge, routed] of pathCache) { - const otherIndex = workflow.edges.indexOf(otherEdge); - const otherLabel = labelRectFor(otherEdge, otherIndex); - if (labelRect && otherLabel && rectsOverlap(labelRect, otherLabel, -2)) { - const rightwardLabelDeficit = otherLabel.x + otherLabel.width - 2 - labelRect.x; - if (rightwardLabelDeficit > 0) { - outsideRightMinX = Math.max( - outsideRightMinX, - outsideRight + rightwardLabelDeficit * 2, - ); - } - } - if (!labelRect) continue; - for (let index = 0; index < routed.points.length - 1; index += 1) { - const segment = { - start: routed.points[index], - end: routed.points[index + 1], - }; - const clearance = segmentRectClearance(segment, labelRect); - if (clearance == null || clearance + 0.0001 >= 4) continue; - const rightwardLabelDeficit = Math.max(segment.start[0], segment.end[0]) - + 4 - labelRect.x; - if (rightwardLabelDeficit > 0) { - outsideRightMinX = Math.max( - outsideRightMinX, - outsideRight + rightwardLabelDeficit * 2, - ); + if (labelRect) { + // Only obstacles whose box can reach the label rect can push the corridor. + const labelQuery = { + minX: labelRect.x - 4, minY: labelRect.y - 4, + maxX: labelRect.x + labelRect.width + 4, maxY: labelRect.y + labelRect.height + 4, + }; + for (const item of obstacleGrid.query(labelQuery)) { + if (item.kind === 'node') { + if (!rectsOverlap(labelRect, item.node, -2)) continue; + const rightwardLabelDeficit = item.node.x + item.node.width - 2 - labelRect.x; + if (rightwardLabelDeficit > 0) { + outsideRightMinX = Math.max(outsideRightMinX, outsideRight + rightwardLabelDeficit * 2); + } + } else if (item.kind === 'label') { + if (!rectsOverlap(labelRect, item.rect, -2)) continue; + const rightwardLabelDeficit = item.rect.x + item.rect.width - 2 - labelRect.x; + if (rightwardLabelDeficit > 0) { + outsideRightMinX = Math.max(outsideRightMinX, outsideRight + rightwardLabelDeficit * 2); + } + } else if (item.kind === 'route') { + const otherPoints = item.routed.points; + for (let index = 0; index < otherPoints.length - 1; index += 1) { + const clearance = segmentRectClearance({ + start: otherPoints[index], + end: otherPoints[index + 1], + }, labelRect); + if (clearance == null || clearance + 0.0001 >= 4) continue; + const rightwardLabelDeficit = Math.max(otherPoints[index][0], otherPoints[index + 1][0]) + + 4 - labelRect.x; + if (rightwardLabelDeficit > 0) { + outsideRightMinX = Math.max(outsideRightMinX, outsideRight + rightwardLabelDeficit * 2); + } + } } } } outsideRightMinX = Math.ceil(outsideRightMinX * 1000) / 1000; - let rightmostPlacedX = outsideRight; - for (const node of nodes.values()) { - rightmostPlacedX = Math.max(rightmostPlacedX, node.x + node.width); - } - for (const [otherEdge, routed] of pathCache) { - for (const [x] of routed.points) rightmostPlacedX = Math.max(rightmostPlacedX, x); - const otherLabel = labelRectFor(otherEdge, workflow.edges.indexOf(otherEdge)); - if (otherLabel) { - rightmostPlacedX = Math.max(rightmostPlacedX, otherLabel.x + otherLabel.width); - } - } + const rightmostPlacedX = Math.max(outsideRight, rightmostNodeEdge, rightmostRoutedEdge); let probeGrowth = Math.max( 32, labelRect?.width ?? 0, @@ -3496,7 +3853,7 @@ function readablePresetVia(edge, from, to, start, end, fromSide, toSide) { default: return readableAutomaticVia(edge, from, to, start, end, fromSide, toSide); } - const points = normalizeRoutePoints([start, ...via, end]); + const points = joinRoutePoints(start, via, end); if (readableCandidateIsFeasible(edge, points, from, to, fromSide, toSide) && routeMatchesPresetFamily(preset, points, from, to)) { return points.slice(1, -1); @@ -3617,6 +3974,13 @@ function workflowEdgeLabelPoint(edge, points) { if (points[labelSegment][0] === points[labelSegment + 1][0]) point[1] += 10; return point; } + if (!edge.labelAt && !Number.isInteger(edge.labelSegment) + && edge.labelDx === undefined && edge.labelDy === undefined + && points.length === 2 && points[0][0] === points[1][0]) { + // Center implicit v2 vertical labels in the corridor. Authored offsets + // retain their existing source-relative anchor, including explicit zero. + return [points[0][0], (points[0][1] + points[1][1]) / 2]; + } if (edge.labelAt || Number.isInteger(edge.labelSegment) || points.length <= 2) { return labelPoint(edge, points); } @@ -3661,6 +4025,39 @@ const automaticPorts = automaticPortSpread(workflow.edges, nodes, { sideFor: (edge, endpoint) => edgeSides(edge)[endpoint === 'source' ? 'fromSide' : 'toSide'], }); +function automaticPortCandidates(edge, node, side, preferred, counterpart) { + if (!independentAutomaticRoute(edge)) return [preferred]; + const verticalSide = side === 'left' || side === 'right'; + const axis = verticalSide ? 1 : 0; + const center = anchor(node, side); + const occupied = []; + for (const [other, routed] of nodeRoutes.get(node.id) ?? []) { + for (const endpoint of ['from', 'to']) { + if (other[endpoint] !== node.id) continue; + const point = endpoint === 'from' ? routed.points[0] : routed.points.at(-1); + const ownWidth = edge.width || (edge.variant === 'emphasis' ? 1.8 : 1.4); + const otherWidth = other.width || (other.variant === 'emphasis' ? 1.8 : 1.4); + if (Math.abs(point[1 - axis] - center[1 - axis]) < 0.0001) { + occupied.push({ coordinate: point[axis], clearance: Math.max(12, 3.5 * (ownWidth + otherWidth)) }); + } + } + } + const clear = (point) => occupied.every(({ coordinate, clearance }) => Math.abs(coordinate - point[axis]) >= clearance - 0.0001); + if (clear(preferred)) return [preferred]; + const candidates = []; + const extent = verticalSide ? node.height : node.width; + const direction = (verticalSide ? counterpart.cy : counterpart.cx) >= center[axis] ? 1 : -1; + for (let offset = 0; offset <= extent / 2 - 16; offset += 12) { + for (const sign of [direction, -direction]) { + const point = [...center]; + point[axis] += sign * offset; + if (clear(point) && !candidates.some((candidate) => candidate[axis] === point[axis])) candidates.push(point); + } + if (candidates.length >= 2) return candidates.slice(0, 2); + } + return candidates.length ? candidates : [preferred]; +} + function readableAutomaticRoute(edge, from, to, primarySides, primaryPorts) { const authoredFrom = edge.fromSide && edge.fromSide !== 'auto' ? edge.fromSide : null; const authoredTo = edge.toSide && edge.toSide !== 'auto' ? edge.toSide : null; @@ -3678,6 +4075,22 @@ function readableAutomaticRoute(edge, from, to, primarySides, primaryPorts) { const plans = []; const feedback = []; let firstFailure = null; + // Spreading ports for provisional sides can offset an otherwise clear + // facing pair. Keep the aligned route in the same feasibility/cost contest. + const alignedStart = automaticPortCandidates(edge, from, naturalFromSide, anchor(from, naturalFromSide), to)[0]; + const alignedEnd = automaticPortCandidates(edge, to, naturalToSide, anchor(to, naturalToSide), from)[0]; + const alignedPoints = [alignedStart, alignedEnd]; + if (to.col > from.col && !['return', 'error'].includes(edge.role) + && !edge.fromSide && !edge.toSide && !edge.labelAt + && readableCandidateIsFeasible(edge, alignedPoints, from, to, naturalFromSide, naturalToSide)) { + plans.push({ + family: 'aligned-facing', + points: alignedPoints, + fromSide: naturalFromSide, + toSide: naturalToSide, + cost: readableCandidateCost(edge, alignedPoints, -1, naturalFromSide, naturalToSide), + }); + } for (const candidateSides of sidePairs) { if (authoredFrom && candidateSides.fromSide !== authoredFrom) continue; if (authoredTo && candidateSides.toSide !== authoredTo) continue; @@ -3686,12 +4099,16 @@ function readableAutomaticRoute(edge, from, to, primarySides, primaryPorts) { const pairOrdinal = seen.size; seen.add(key); const primary = pairOrdinal === 0; - const start = primaryPorts?.from && primary + const preferredStart = primaryPorts?.from && primary ? primaryPorts.from : anchor(from, candidateSides.fromSide); - const end = primaryPorts?.to && primary + const preferredEnd = primaryPorts?.to && primary ? primaryPorts.to : anchor(to, candidateSides.toSide); + const starts = automaticPortCandidates(edge, from, candidateSides.fromSide, preferredStart, to); + const ends = automaticPortCandidates(edge, to, candidateSides.toSide, preferredEnd, from); + const [start] = starts; + const [end] = ends; const planned = readableAutomaticCandidateSet( edge, from, @@ -3710,6 +4127,35 @@ function readableAutomaticRoute(edge, from, to, primarySides, primaryPorts) { ...candidate, ...candidateSides, }))); + let portOrdinal = 0; + for (const alternativeStart of starts) { + for (const alternativeEnd of ends) { + if (alternativeStart === start && alternativeEnd === end) continue; + portOrdinal += 1; + const alternative = readableAutomaticCandidateSet(edge, from, to, alternativeStart, alternativeEnd, + candidateSides.fromSide, candidateSides.toSide, { + ordinalOffset: pairOrdinal * 9 + portOrdinal * 144, + naturalFromSide, + naturalToSide, + }); + plans.push(...alternative.candidates.map((candidate) => ({ ...candidate, ...candidateSides }))); + if (!alternative.candidates.length) { + try { + const via = withDiagnosticRecordingSuppressed(() => readableAutomaticVia( + edge, from, to, alternativeStart, alternativeEnd, candidateSides.fromSide, candidateSides.toSide, + )); + const points = joinRoutePoints(alternativeStart, via, alternativeEnd); + plans.push({ + points, ...candidateSides, + cost: readableCandidateCost(edge, points, pairOrdinal * 9 + portOrdinal * 144 + 6, naturalFromSide, naturalToSide), + }); + } catch (error) { + if (error instanceof WorkflowLayoutFeedback) feedback.push({ error, pairOrdinal }); + else if (!firstFailure) firstFailure = error; + } + } + } + } if (planned.candidates.length) continue; try { const expandedVia = withDiagnosticRecordingSuppressed(() => readableAutomaticVia( @@ -3721,7 +4167,7 @@ function readableAutomaticRoute(edge, from, to, primarySides, primaryPorts) { candidateSides.fromSide, candidateSides.toSide, )); - const expandedPoints = normalizeRoutePoints([start, ...expandedVia, end]); + const expandedPoints = joinRoutePoints(start, expandedVia, end); const outsideRightOrdinal = planned.rawCandidates.findIndex(({ family }) => ( family === 'outside-right' )); @@ -3750,6 +4196,34 @@ function readableAutomaticRoute(edge, from, to, primarySides, primaryPorts) { plans.sort((left, right) => compareCost(left.cost, right.cost)); if (plans.length) { + const repairSeeds = plans[0].cost.sharedCorridorPx > 0 + ? plans.filter((plan, index) => plans.findIndex(other => ( + other.fromSide === plan.fromSide && other.toSide === plan.toSide + && String(other.points[0]) === String(plan.points[0]) + && String(other.points.at(-1)) === String(plan.points.at(-1)) + )) === index).slice(0, 8) : []; + // A crowded fan-out can exhaust the fixed corridor coordinates even with + // distinct ports. Repair only interior segments of this automatic route; + // One pass over at most eight seeds and four offsets bounds the search. + for (const selected of repairSeeds) { + if (selected.cost.sharedCorridorPx === 0) continue; + const alternatives = []; + for (let segment = 1; segment < selected.points.length - 2; segment += 1) { + const a = selected.points[segment], b = selected.points[segment + 1]; + const axis = a[0] === b[0] ? 0 : 1; + for (const offset of [-16, 16, -32, 32]) { + const points = selected.points.map(point => [...point]); + points[segment][axis] += offset; + points[segment + 1][axis] += offset; + if (!readableCandidateIsFeasible(edge, points, from, to, selected.fromSide, selected.toSide)) continue; + const cost = readableCandidateCost(edge, points, selected.cost.stableCandidateOrdinal, naturalFromSide, naturalToSide); + if (compareCost(cost, selected.cost) < 0) alternatives.push({ ...selected, points, cost }); + } + } + alternatives.sort((a, b) => compareCost(a.cost, b.cost)); + if (alternatives.length) plans.push(alternatives[0]); + } + plans.sort((a, b) => compareCost(a.cost, b.cost)); const selected = plans[0]; return { points: selected.points, @@ -3928,6 +4402,30 @@ function readableControlledRoute(edge, from, to) { }; } +// Registering a routed path also publishes it (and its label box) to the grid. +let obstacleSequence = 0; +function registerRouted(edge, routed) { + pathCache.set(edge, routed); + const sequence = obstacleSequence++; + const routeExtent = routeBounds(routed.points); + obstacleGrid.insert(routeExtent, { kind: 'route', edge, routed, sequence, bounds: routeExtent }); + for (const [x] of routed.points) rightmostRoutedEdge = Math.max(rightmostRoutedEdge, x); + for (const end of ['from', 'to']) { + const nodeId = edge[end]; + if (nodeId === undefined || nodeId === null) continue; + let byEdge = nodeRoutes.get(nodeId); + if (!byEdge) { byEdge = new Map(); nodeRoutes.set(nodeId, byEdge); } + byEdge.set(edge, routed); + } + const index = edgeIndexByEdge.get(edge); + const label = index === undefined ? null : labelRectFor(edge, index); + if (label) { + obstacleGrid.insert(rectToBounds(label), { kind: 'label', edge, rect: label, sequence }); + rightmostRoutedEdge = Math.max(rightmostRoutedEdge, label.x + label.width); + } + return routed; +} + function pathFor(edge) { if (pathCache.has(edge)) return pathCache.get(edge); const from = nodes.get(edge.from); @@ -3940,8 +4438,7 @@ function pathFor(edge) { toSide: planned.toSide, }); const routed = { d: polylinePath(planned.points), points: planned.points }; - pathCache.set(edge, routed); - return routed; + return registerRouted(edge, routed); } } const ports = automaticPorts.get(edge); @@ -3964,8 +4461,7 @@ function pathFor(edge) { toSide: planned.toSide, }); const routed = { d: polylinePath(planned.points), points: planned.points }; - pathCache.set(edge, routed); - return routed; + return registerRouted(edge, routed); } const start = ports?.from || anchor(from, fromSide); const end = ports?.to || anchor(to, toSide); @@ -3977,15 +4473,21 @@ function pathFor(edge) { ? normalizeRoutePoints(authoredPoints) : authoredPoints; const routed = { d: polylinePath(points), points }; - pathCache.set(edge, routed); - return routed; + return registerRouted(edge, routed); } +// The label rectangle follows from the routed path, which is fixed once it is +// cached; keying on that object means a re-routed edge gets a fresh rectangle. +const LABEL_RECT_CACHE = new WeakMap(); + function labelRectFor(edge, relationIndex) { if (!edge.label || !nodes.has(edge.from) || !nodes.has(edge.to)) return null; - const [lx, ly] = workflowEdgeLabelPoint(edge, pathFor(edge).points); + const routed = pathFor(edge); + const cached = LABEL_RECT_CACHE.get(routed); + if (cached) return cached; + const [lx, ly] = workflowEdgeLabelPoint(edge, routed.points); const width = workflowLabelWidth(edge.label); - return { + const rect = { relation: edge, relationIndex, label: edge.label, @@ -3996,6 +4498,8 @@ function labelRectFor(edge, relationIndex) { lx, ly, }; + LABEL_RECT_CACHE.set(routed, rect); + return rect; } function measuredContentBounds() { @@ -4097,12 +4601,7 @@ function finalizeReadableViewBox() { ]; const outsideOrigin = bounds.left < 0 || bounds.top < 0; if (outsideOrigin) { - const hasAbsolutePins = workflow.edges.some((edge) => ( - Array.isArray(edge.via) - || Array.isArray(edge.labelAt) - || edge.channelX !== undefined - || edge.channelY !== undefined - )); + const hasAbsolutePins = hasAbsoluteWorkflowPins(workflow); const message = `Workflow geometry extends above or left of the viewBox origin (${Math.round(bounds.left)}, ${Math.round(bounds.top)}).`; throwDiagnosticError(message, [{ code: hasAbsolutePins ? 'workflow/explicit-pin-conflict' : 'workflow/solver-budget-exhausted', @@ -4192,14 +4691,18 @@ function renderNode(node) { const accent = componentText[node.type] || 't-muted'; const hasSub = node.sublabel != null && node.sublabel !== ''; const labelFontSize = fittedNodeFontSize(node.label, brandLabelFitWidth(node, node.width), nodeTextFit.labelPreferred, nodeTextFit.labelMinimum); - const sublabelFontSize = hasSub - ? fittedNodeFontSize(node.sublabel, node.width, nodeTextFit.sublabelPreferred, nodeTextFit.sublabelMinimum) - : nodeTextFit.sublabelPreferred; + const sublabelFontSize = fittedNodeFontSize(node.sublabel, node.width, nodeTextFit.sublabelPreferred, nodeTextFit.sublabelMinimum); + const tagFontSize = fittedNodeFontSize(node.tag, node.width, nodeTextFit.tagPreferred, nodeTextFit.tagMinimum); + const textRows = [{ text: node.label, font: labelFontSize, y: 21 }]; + if (hasSub) textRows.push({ text: node.sublabel, font: sublabelFontSize, y: 38 }); + if (node.tag) textRows.push({ text: node.tag, font: tagFontSize, y: node.height - 12 }); + const labelLayout = nodeLabelLayout({ width: node.width, height: node.height, rows: textRows, + brand: Boolean(brandMarkFor(node)), source: Boolean(sourceEvidence?.nodes?.[node.id]?.length) }); const sub = hasSub - ? `\n ${esc(node.sublabel)}` + ? `\n ${esc(node.sublabel)}` : ''; const tag = node.tag - ? `\n ${esc(node.tag)}` + ? `\n ${esc(node.tag)}` : ''; const brand = renderBrandMark(node, { x: node.x + node.width - 22, y: node.y + 6 }); const passport = { kind: node.type, sublabel: node.sublabel, tag: node.tag, context: nodeContext(node), ...brandMetadataFor(node) }; @@ -4207,8 +4710,8 @@ function renderNode(node) { ${focusNodeTitle(node.label, passport)} - ${renderSemanticSigil(node.type, { x: node.x + 6, y: node.y + 6 })}${brand ? `\n ${brand}` : ''} - ${esc(node.label)}${sub}${tag} + ${renderSemanticSigil(node.type, { icon: node.icon, x: node.x + 6, y: node.y + labelLayout.sigilY, size: labelLayout.sigilSize })}${brand ? `\n ${brand}` : ''} + ${esc(node.label)}${sub}${tag} `; } @@ -4216,7 +4719,9 @@ function renderEdgePath(edge, index) { const [cls, marker] = arrowClassMap[edge.variant || 'default'] || arrowClassMap.default; const routed = pathFor(edge); const strokeWidth = edge.width || (edge.variant === 'emphasis' ? 1.8 : 1.4); - return ` `; + const routing = independentAutomaticRoute(edge) ? ' data-composition-routing="workflow-v2-auto"' : ''; + const role = workflow.schema_version === 2 ? ` data-edge-role="${esc(edge.role || '')}"` : ''; + return ` `; } function renderEdgeLabel(edge, index) { @@ -4226,7 +4731,7 @@ function renderEdgeLabel(edge, index) { const labelW = workflowLabelWidth(edge.label); return ` - ${esc(edge.label)} + ${esc(edge.label)} `; } @@ -4246,7 +4751,14 @@ function renderLegend() { } function renderSvg() { - return ` + const readerFit = workflow.schema_version === 2 + && !workflow.meta?.viewBox + && hasVerticalStack(workflow) + && asArray(layout.laneHeights).some((height) => height > 104) + ? ' data-reader-fit="intrinsic-height"' + : ''; + const contract = workflow.schema_version === 2 ? ' data-layout-contract="readable-v2"' : ''; + return ` ${svgAccessibleText(workflow.meta, 'workflow')} ${renderDefinitions()} @@ -4308,7 +4820,7 @@ ${renderLegend()} const [x, y] = workflowEdgeLabelPoint(edge, pathFor(edge).points); return [{ edge: edge.id ?? null, label: edge.label, x, y, width: workflowLabelWidth(edge.label), height: 14 }]; }), - diagnostics: [], + diagnostics: workflowDiagnostics, }; return { ok: true, svg, receipt }; } catch (error) { @@ -4339,13 +4851,14 @@ function feedbackFailure(request) { return compilerFailure('readable-v2', diagnostics, message); } -function compileWorkflowWithFeedback({ workflow, qualityProfile, discoverFixes = true } = {}) { +function compileWorkflowWithFeedback({ workflow, qualityProfile, sourceEvidence, discoverFixes = true } = {}) { let layoutFeedback = {}; for (let attempt = 0; attempt <= MAX_READABLE_LAYOUT_FEEDBACK_ROUNDS; attempt += 1) { try { return compileWorkflowInternal({ workflow, qualityProfile, + sourceEvidence, discoverFixes, layoutFeedback, }); @@ -4395,6 +4908,6 @@ function compileWorkflowWithFeedback({ workflow, qualityProfile, discoverFixes = throw new Error('unreachable readable-v2 layout feedback state'); } -export function compileWorkflow({ workflow, qualityProfile } = {}) { - return compileWorkflowWithFeedback({ workflow, qualityProfile }); +export function compileWorkflow({ workflow, qualityProfile, sourceEvidence } = {}) { + return compileWorkflowWithFeedback({ workflow, qualityProfile, sourceEvidence }); } diff --git a/packages/diagram-core/vendor/archify/schemas/README.md b/packages/diagram-core/vendor/archify/schemas/README.md index 4a43011..f1a2763 100644 --- a/packages/diagram-core/vendor/archify/schemas/README.md +++ b/packages/diagram-core/vendor/archify/schemas/README.md @@ -15,18 +15,31 @@ against one of the schemas in this folder before any layout work happens. | `common.schema.json` | shared `$defs` only (no top-level document) | — | Every diagram schema requires `schema_version`, `diagram_type`, `meta` (with -`title`), and its structural arrays — except `segments`, `activations`, and +`title` and a durable portable `output`), and its structural arrays — except `segments`, `activations`, and `cards`, which are optional — and sets `additionalProperties: false` at every level, so unknown fields are rejected rather than silently ignored. Every `meta` object also accepts `animation: "trace"` for opt-in SVG/CSS motion in generated HTML. Omit it, or set `"none"`, for the default static output. -It also accepts `locale: "en" | "zh-CN"`. The field selects the fixed Viewer -UI, renderer-owned default legend and accessibility copy, document-title -suffix, and `` value; it does not translate authored strings. -Omitting it preserves legacy behavior and resolves to English. Unsupported -locale values fail schema validation instead of being guessed or silently -rewritten. +It also accepts `locale`, any well-formed language tag (schema pattern +`^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$`). The field selects the fixed Viewer UI, +renderer-owned default legend and accessibility copy, document-title suffix, +and `` value; it does not translate authored strings. `en` and +`zh-CN` are built-in catalogs; any other tag needs a matching `translations` +object (see below) or the renderer falls back to English and discloses it. +Omitting `locale` preserves legacy behavior and resolves to English. +Malformed locale tags fail schema validation instead of being guessed or +silently rewritten. + +`meta.translations` supplies the Viewer message catalog for a `locale` with no +built-in catalog, as data: an object mapping canonical message keys (see +`catalogKeys()` in `renderers/shared/i18n.mjs`) to translated strings whose +`{placeholder}` tokens match the English source. A key that is missing, +unrecognized, or has mismatched placeholders falls back to English rather than +failing the render; `validate`/`render`/`deliver` report the resulting +coverage to stderr. Spanish uses the reusable `examples/locales/es.json` +catalog; dev inputs that previously used only `locale: "es"` now need this +object in `meta.translations` to retain Spanish UI. `visual_preset` accepts `classic` (the stable default), `signal-flow` (luminous motion-forward presentation), `blueprint` (high-contrast engineering review), or `editorial` (warm publication-style design review and documentation). @@ -38,9 +51,8 @@ diagram renders at the same coordinates no matter how wide its viewBox is. wide canvas into column distance and label room rather than empty space on the right. Lane order, IDs, and message semantics are unchanged either way. -It may also include up to five guided `views`. Each view has a unique `id`, a -reader-facing `label`, a non-empty `focus` list of existing semantic node IDs, -and an optional short `note`. +`meta.views` is retired. The schemas still accept the old guided-view shape so +existing files keep validating, but renderers ignore it; do not author it. ### Legend presentation contract @@ -112,7 +124,19 @@ output. Workflow supports schema versions 1 and 2. Version 1 remains the fixed-layout compatibility contract; version 2 opts into the readable workflow compiler and can be produced explicitly with `archify migrate workflow ... --to-schema 2`. -The other four diagram schemas keep `schema_version` pinned to `1`. +Lifecycle also supports versions 1 and 2 with the same fields. Version 1 keeps +the fixed three-band layout; version 2 renders one row per lane on a shared +column grid (see the [lifecycle renderer](../renderers/lifecycle/README.md)). +Lifecycle has no migration command: to adopt v2, set `schema_version: 2`, +re-place lower-lane `col` values on the shared grid (v1 column `N` sat under +main column `N + 2`), and drop coordinates authored for the v1 canvas +(`viewBox`, `via`, `channelX`, `channelY`, `labelAt`). +The other three diagram schemas keep `schema_version` pinned to `1`; they have +no schema-version migration command. For any of the five diagram types, repair +a legacy missing or nonportable `meta.output` in the source and run `validate`. +For a workflow v1-to-v2 migration specifically, `migrate workflow` also accepts +`--output reports/diagram.html` to put that portable value in the separate v2 +destination without changing the legacy source. Workflow also accepts optional `semanticChecks`. `allowedRoots` and `allowedTerminals` close the set of intentional graph sources and sinks; @@ -124,7 +148,13 @@ workflow behavior and including a satisfied contract does not change SVG or layout-receipt bytes. A file that validates today must keep validating and rendering within its -declared version throughout the 2.x release line. Additive viewer, +declared version throughout the 2.x release line. The explicitly reviewed +portable-output hardening is the one exception: older v1 documents that omit +`meta.output` must add a portable POSIX-relative `.html` path (for example, +`reports/diagram.html`); ordinary explicit CLI output arguments do not replace +this durable authored value. The workflow-only v1-to-v2 migration command may +instead receive that value explicitly as `--output reports/diagram.html`; it +writes the value only to its separate validated destination. Additive viewer, accessibility, and presentation improvements may enhance generated HTML, but they must not reinterpret authored IR or turn a previously valid profile-less v1 file into a new hard layout failure. Breaking IR changes require a new @@ -138,18 +168,29 @@ The five diagram schemas reference `common.schema.json#/$defs/...`: - `point` — an `[x, y]` pair of numbers (used by `via` and `labelAt`) - `componentType` — `frontend`, `backend`, `database`, `cloud`, `security`, `messagebus`, `external` -- `locale` — the bounded renderer locale, `en` or `zh-CN` +- `locale` — a well-formed renderer locale tag (`en` and `zh-CN` are built in; + any other tag needs a matching `translations` object) +- `translations` — canonical message key → translated string, for a `locale` + with no built-in catalog +- `portableOutputPath` — the portable POSIX-relative `.html` path used by + `meta.output`; see the two output-path boundaries in the + [delivery contract](../references/delivery-contract.md#output-path-contracts) - `brandMark` — one optional built-in brand ID or explicit HTTP(S) site URL - `variant` — `default`, `emphasis`, `security`, `dashed` (sequence messages extend this list locally with `return`) - `legendMode` and `legendEntry` — the shared strict mode and label/visibility override shapes used by each renderer-owned key map -- `guidedViews` — the bounded, read-only reader paths accepted by `meta.views` +- `guidedViews` — the retired `meta.views` shape, still accepted and ignored - `cards` — the summary-card blocks rendered below the SVG Lifecycle state `type` is mode-specific (`start`/`active`/`waiting`/...) and stays in `lifecycle.schema.json`. +The JSON Schema definition is the portable contract's structurally expressible +preflight. The shipped generated validator wrapper and CLI additionally enforce +byte-based component limits and the complete runtime path contract; consumers +that need the same cross-platform acceptance boundary should use that wrapper. + ## Runtime validation At development time, `scripts/generate-validators.mjs` compiles all five @@ -163,10 +204,14 @@ express cleanly here: duplicate view IDs, duplicate focus IDs, focus IDs that do not exist in the diagram's semantic collection, and duplicate authored relationship IDs within the mode's relationship collection. -Architecture additionally supports opt-in, revision-pinned repository evidence. -`meta.repository` names a public GitHub URL and full commit SHA; a component may -carry one to three `sources` with repo-relative POSIX paths, optional line -ranges, and optional labels. Shape is schema-checked, then the renderer requires +All five modes support opt-in, revision-pinned repository evidence. +`meta.repository` names the repository URL and full commit SHA, with optional +`provider` (`github` or `gitee`) and `link_mode` (`web` or `local-only`; see the +authoring contract); a node may carry one to three `sources` with repo-relative POSIX paths, optional line +ranges, and optional labels. Sources are authored on the mode's own node +collection — Architecture `components`, Workflow and Data Flow `nodes`, +Sequence `participants`, Lifecycle `states` — and the verified payload is keyed +by node id. Shape is schema-checked, then the renderer requires `--repo-root`: the local Git origin must match, and Git must prove the commit, blobs, and requested lines. Verified evidence is embedded outside the canonical SVG for the Semantic Passport and Node Finder; ordinary documents and visual diff --git a/packages/diagram-core/vendor/archify/schemas/architecture.schema.json b/packages/diagram-core/vendor/archify/schemas/architecture.schema.json index 6943b27..5fe3b8e 100644 --- a/packages/diagram-core/vendor/archify/schemas/architecture.schema.json +++ b/packages/diagram-core/vendor/archify/schemas/architecture.schema.json @@ -11,30 +11,18 @@ "meta": { "type": "object", "additionalProperties": false, - "required": ["title"], + "required": ["title", "output"], "properties": { "title": { "type": "string", "minLength": 1 }, "locale": { "$ref": "common.schema.json#/$defs/locale" }, + "translations": { "$ref": "common.schema.json#/$defs/translations" }, "subtitle": { "type": "string" }, - "output": { "type": "string" }, + "output": { "$ref": "common.schema.json#/$defs/portableOutputPath" }, "animation": { "$ref": "common.schema.json#/$defs/animation" }, "visual_preset": { "$ref": "common.schema.json#/$defs/visualPreset" }, "quality_profile": { "$ref": "common.schema.json#/$defs/qualityProfile" }, "engineering_profile": { "enum": ["deployment-ownership"] }, - "repository": { - "type": "object", - "additionalProperties": false, - "required": ["url", "revision"], - "properties": { - "url": { - "type": "string", - "minLength": 1 - }, - "provider": { "enum": ["github", "gitee"] }, - "link_mode": { "enum": ["web", "local-only"] }, - "revision": { "type": "string", "pattern": "^[a-fA-F0-9]{40}$" } - } - }, + "repository": { "$ref": "common.schema.json#/$defs/repository" }, "views": { "$ref": "common.schema.json#/$defs/guidedViews" }, "legend": { "type": "object", @@ -95,23 +83,9 @@ "label": { "type": "string", "minLength": 1 }, "sublabel": { "type": "string" }, "tag": { "type": "string" }, + "icon": { "$ref": "common.schema.json#/$defs/nodeIcon" }, "brand": { "$ref": "common.schema.json#/$defs/brandMark" }, - "sources": { - "type": "array", - "minItems": 1, - "maxItems": 3, - "items": { - "type": "object", - "additionalProperties": false, - "required": ["path"], - "properties": { - "path": { "type": "string", "minLength": 1, "maxLength": 240 }, - "line": { "type": "integer", "minimum": 1 }, - "end_line": { "type": "integer", "minimum": 1 }, - "label": { "type": "string", "minLength": 1, "maxLength": 48 } - } - } - }, + "sources": { "$ref": "common.schema.json#/$defs/sourceReferences" }, "row": { "type": "integer", "minimum": 0 }, "col": { "type": "integer", "minimum": 0 }, "pos": { "$ref": "common.schema.json#/$defs/point" }, diff --git a/packages/diagram-core/vendor/archify/schemas/common.schema.json b/packages/diagram-core/vendor/archify/schemas/common.schema.json index 20a8515..2fe0c75 100644 --- a/packages/diagram-core/vendor/archify/schemas/common.schema.json +++ b/packages/diagram-core/vendor/archify/schemas/common.schema.json @@ -8,7 +8,15 @@ "pattern": "^[a-zA-Z][a-zA-Z0-9_-]*$" }, "locale": { - "enum": ["en", "zh-CN"] + "type": "string", + "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$", + "maxLength": 35 + }, + "translations": { + "type": "object", + "propertyNames": { "pattern": "^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$" }, + "additionalProperties": { "type": "string", "minLength": 1, "maxLength": 400 }, + "maxProperties": 600 }, "animation": { "enum": ["trace", "none"] @@ -19,6 +27,30 @@ "qualityProfile": { "enum": ["standard", "showcase"] }, + "portableOutputPath": { + "description": "A portable POSIX-relative HTML output path. It must be safe to interpret identically on every supported host filesystem.", + "type": "string", + "minLength": 1, + "pattern": "^[^/]+(?:/[^/]+)*$", + "allOf": [ + { "pattern": "(?:^|/)[^/]+[.][Hh][Tt][Mm][Ll]$" }, + { "not": { "pattern": "[\\\\<>:\"|?*\\u0000-\\u001F\\u007F-\\u009F]" } }, + { "not": { "pattern": "[\\uD800-\\uDFFF]" } }, + { "not": { "pattern": "(^|/)[.]{1,2}(/|$)" } }, + { "not": { "pattern": "[. ](/|$)" } }, + { "not": { "pattern": "(^|/)[^/]{256}" } }, + { + "not": { + "pattern": "(^|/)(?:[Cc][Oo][Nn]|[Pp][Rr][Nn]|[Aa][Uu][Xx]|[Nn][Uu][Ll]|[Cc][Oo][Nn][Ii][Nn][$]|[Cc][Oo][Nn][Oo][Uu][Tt][$]|[Cc][Oo][Mm][1-9¹²³]|[Ll][Pp][Tt][1-9¹²³])(?:[.]|/|$)" + } + }, + { + "not": { + "pattern": "(^|/)[^/]*~[1-9][0-9]*(?:[.]|/|$)" + } + } + ] + }, "side": { "enum": ["left", "right", "top", "bottom"] }, @@ -39,6 +71,10 @@ "componentType": { "enum": ["frontend", "backend", "database", "cloud", "security", "messagebus", "external"] }, + "nodeIcon": { + "description": "Decorative corner icon. Omit the icon field for the type default; none hides it. Does not change type, color, or legend grouping.", + "enum": ["calendar", "clock", "person", "briefcase", "flag", "moon", "frontend", "backend", "database", "cloud", "security", "messagebus", "external", "start", "active", "waiting", "success", "failure", "neutral", "none"] + }, "brandMark": { "oneOf": [ { @@ -95,6 +131,36 @@ } } }, + "repository": { + "type": "object", + "additionalProperties": false, + "required": ["url", "revision"], + "properties": { + "url": { + "type": "string", + "minLength": 1 + }, + "provider": { "enum": ["github", "gitee"] }, + "link_mode": { "enum": ["web", "local-only"] }, + "revision": { "type": "string", "pattern": "^[a-fA-F0-9]{40}$" } + } + }, + "sourceReferences": { + "type": "array", + "minItems": 1, + "maxItems": 3, + "items": { + "type": "object", + "additionalProperties": false, + "required": ["path"], + "properties": { + "path": { "type": "string", "minLength": 1, "maxLength": 240 }, + "line": { "type": "integer", "minimum": 1 }, + "end_line": { "type": "integer", "minimum": 1 }, + "label": { "type": "string", "minLength": 1, "maxLength": 48 } + } + } + }, "cards": { "type": "array", "items": { diff --git a/packages/diagram-core/vendor/archify/schemas/dataflow.schema.json b/packages/diagram-core/vendor/archify/schemas/dataflow.schema.json index 00f5148..4d8eecf 100644 --- a/packages/diagram-core/vendor/archify/schemas/dataflow.schema.json +++ b/packages/diagram-core/vendor/archify/schemas/dataflow.schema.json @@ -23,7 +23,8 @@ "type": "object", "additionalProperties": false, "required": [ - "title" + "title", + "output" ], "properties": { "title": { @@ -33,11 +34,14 @@ "locale": { "$ref": "common.schema.json#/$defs/locale" }, + "translations": { + "$ref": "common.schema.json#/$defs/translations" + }, "subtitle": { "type": "string" }, "output": { - "type": "string" + "$ref": "common.schema.json#/$defs/portableOutputPath" }, "animation": { "$ref": "common.schema.json#/$defs/animation" @@ -48,6 +52,9 @@ "quality_profile": { "$ref": "common.schema.json#/$defs/qualityProfile" }, + "repository": { + "$ref": "common.schema.json#/$defs/repository" + }, "views": { "$ref": "common.schema.json#/$defs/guidedViews" }, @@ -135,9 +142,13 @@ "tag": { "type": "string" }, + "icon": { "$ref": "common.schema.json#/$defs/nodeIcon" }, "brand": { "$ref": "common.schema.json#/$defs/brandMark" }, + "sources": { + "$ref": "common.schema.json#/$defs/sourceReferences" + }, "stage": { "type": "integer", "minimum": 0 diff --git a/packages/diagram-core/vendor/archify/schemas/lifecycle.schema.json b/packages/diagram-core/vendor/archify/schemas/lifecycle.schema.json index 017c155..83e4d2f 100644 --- a/packages/diagram-core/vendor/archify/schemas/lifecycle.schema.json +++ b/packages/diagram-core/vendor/archify/schemas/lifecycle.schema.json @@ -14,7 +14,10 @@ ], "properties": { "schema_version": { - "const": 1 + "enum": [ + 1, + 2 + ] }, "diagram_type": { "const": "lifecycle" @@ -23,7 +26,8 @@ "type": "object", "additionalProperties": false, "required": [ - "title" + "title", + "output" ], "properties": { "title": { @@ -33,11 +37,14 @@ "locale": { "$ref": "common.schema.json#/$defs/locale" }, + "translations": { + "$ref": "common.schema.json#/$defs/translations" + }, "subtitle": { "type": "string" }, "output": { - "type": "string" + "$ref": "common.schema.json#/$defs/portableOutputPath" }, "animation": { "$ref": "common.schema.json#/$defs/animation" @@ -48,6 +55,9 @@ "quality_profile": { "$ref": "common.schema.json#/$defs/qualityProfile" }, + "repository": { + "$ref": "common.schema.json#/$defs/repository" + }, "views": { "$ref": "common.schema.json#/$defs/guidedViews" }, @@ -81,7 +91,7 @@ }, { "type": "number", - "minimum": 566 + "minimum": 300 } ], "items": false, @@ -151,9 +161,13 @@ "tag": { "type": "string" }, + "icon": { "$ref": "common.schema.json#/$defs/nodeIcon" }, "brand": { "$ref": "common.schema.json#/$defs/brandMark" }, + "sources": { + "$ref": "common.schema.json#/$defs/sourceReferences" + }, "step": { "type": "string" }, diff --git a/packages/diagram-core/vendor/archify/schemas/sequence.schema.json b/packages/diagram-core/vendor/archify/schemas/sequence.schema.json index 446d0ec..1755297 100644 --- a/packages/diagram-core/vendor/archify/schemas/sequence.schema.json +++ b/packages/diagram-core/vendor/archify/schemas/sequence.schema.json @@ -22,7 +22,8 @@ "type": "object", "additionalProperties": false, "required": [ - "title" + "title", + "output" ], "properties": { "title": { @@ -32,11 +33,14 @@ "locale": { "$ref": "common.schema.json#/$defs/locale" }, + "translations": { + "$ref": "common.schema.json#/$defs/translations" + }, "subtitle": { "type": "string" }, "output": { - "type": "string" + "$ref": "common.schema.json#/$defs/portableOutputPath" }, "animation": { "$ref": "common.schema.json#/$defs/animation" @@ -51,6 +55,9 @@ "description": "Horizontal participant layout. Omit this field or use fixed for the stable 86px boxes and 108px gap. Use spread when a wide viewBox would leave unused horizontal space or meaningful participant labels do not fit the fixed boxes; spread derives wider boxes and gaps from the viewBox without changing participant order or message semantics.", "enum": ["fixed", "spread"] }, + "repository": { + "$ref": "common.schema.json#/$defs/repository" + }, "views": { "$ref": "common.schema.json#/$defs/guidedViews" }, @@ -115,8 +122,12 @@ "sublabel": { "type": "string" }, + "icon": { "$ref": "common.schema.json#/$defs/nodeIcon" }, "brand": { "$ref": "common.schema.json#/$defs/brandMark" + }, + "sources": { + "$ref": "common.schema.json#/$defs/sourceReferences" } } } diff --git a/packages/diagram-core/vendor/archify/schemas/workflow.schema.json b/packages/diagram-core/vendor/archify/schemas/workflow.schema.json index 1ccaf17..dad1457 100644 --- a/packages/diagram-core/vendor/archify/schemas/workflow.schema.json +++ b/packages/diagram-core/vendor/archify/schemas/workflow.schema.json @@ -26,7 +26,8 @@ "type": "object", "additionalProperties": false, "required": [ - "title" + "title", + "output" ], "properties": { "title": { @@ -36,11 +37,14 @@ "locale": { "$ref": "common.schema.json#/$defs/locale" }, + "translations": { + "$ref": "common.schema.json#/$defs/translations" + }, "subtitle": { "type": "string" }, "output": { - "type": "string" + "$ref": "common.schema.json#/$defs/portableOutputPath" }, "animation": { "enum": [ @@ -62,6 +66,9 @@ "showcase" ] }, + "repository": { + "$ref": "common.schema.json#/$defs/repository" + }, "views": { "$ref": "common.schema.json#/$defs/guidedViews" }, @@ -290,9 +297,13 @@ "tag": { "type": "string" }, + "icon": { "$ref": "common.schema.json#/$defs/nodeIcon" }, "brand": { "$ref": "common.schema.json#/$defs/brandMark" }, + "sources": { + "$ref": "common.schema.json#/$defs/sourceReferences" + }, "width": { "type": "number", "minimum": 32 diff --git a/packages/diagram-core/vendor/archify/scripts/check-render-output.mjs b/packages/diagram-core/vendor/archify/scripts/check-render-output.mjs index f714968..ae6e741 100644 --- a/packages/diagram-core/vendor/archify/scripts/check-render-output.mjs +++ b/packages/diagram-core/vendor/archify/scripts/check-render-output.mjs @@ -1,12 +1,17 @@ #!/usr/bin/env node import fs from 'node:fs'; +import { createHash } from 'node:crypto'; import path from 'node:path'; -import { collectAmbiguousCorridors, collectBorderRuns, collectLabelRouteClearance, collectRouteRhythmIssues, routeBudgetMetrics } from '../renderers/shared/geometry.mjs'; +import { collectAmbiguousCorridors, collectArrowheadCollisions, collectBorderRuns, collectLabelCanvasOverflow, collectLabelRouteClearance, collectRouteRhythmIssues, describeLabelCanvasOverflow, formatRect, forwardCollinearAnalysisSegments, minimumLabelRouteClearance, routeBudgetMetrics } from '../renderers/shared/geometry.mjs'; import { DESKTOP_READABILITY_VIEWPORT, DESKTOP_READER_DIAGRAM_WIDTH, + DECLARED_WIDE_READER_CONTRACT, + declaredWideReadabilityBudget, MIN_PROJECTED_NODE_TEXT_PX, + describeFixedWidthOverflow, + predictedFixedWidthOverflow, projectedNodeTextPx, } from '../renderers/shared/desktop-readability.mjs'; @@ -19,8 +24,11 @@ if (!input || input === '-h' || input === '--help') { const htmlPath = path.resolve(input); let html; +let artifact; try { - html = fs.readFileSync(htmlPath, 'utf8'); + const bytes = fs.readFileSync(htmlPath); + html = bytes.toString('utf8'); + artifact = { sha256: createHash('sha256').update(bytes).digest('hex'), bytes: bytes.byteLength }; } catch (err) { console.error(JSON.stringify({ ok: false, @@ -38,10 +46,12 @@ let composition = { summary: { errors: 0, warnings: 0 }, metrics: { properCrossings: 0, + resolvedCrossovers: 0, ambiguousCorridors: 0, containerBorderRuns: 0, labelRouteClearanceIssues: 0, minLabelRouteClearance: null, + labelCanvasOverflowIssues: 0, maxBends: 0, routesOverSuggestedBends: 0, maxStretch: null, @@ -62,9 +72,11 @@ let composition = { const NON_FINITE_TOKEN = /\b(?:NaN|undefined|Infinity)\b/; // Consume comments/CDATA as whole tokens, including any tag-like prose. const SVG_TAG_TOKEN = /|$)||$)|<(\/?)([A-Za-z][\w:-]*)(?=[\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>/g; +const AUTOMATIC_CROSSOVER_UNDERLAY_TAG = /]*\bdata-graph-role="automatic-crossover-underlay"[^>]*\/>/i; const HTML_VOID_ELEMENTS = new Set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr']); const SVG_HTML_INTEGRATION_POINTS = new Set(['foreignobject', 'desc', 'title']); const HTML_ATTRIBUTE = /([A-Za-z_:][\w:.-]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/g; +const readerContract = readerContractFromHtml(html); const NUMERIC_ATTRS = new Set([ 'x', 'y', 'x1', 'y1', 'x2', 'y2', 'dx', 'dy', 'cx', 'cy', 'r', 'rx', 'ry', 'fx', 'fy', 'fr', 'width', 'height', 'd', 'points', 'pathlength', 'transform', 'viewbox', 'offset', @@ -97,20 +109,35 @@ if (svgMatches.length === 1) { const svgRoot = svg.match(/]*>/i)?.[0] || ''; const svgAttrs = parseAttrs(svgRoot); const qualityProfile = svgAttrs['data-quality-profile'] || 'standard'; + const workflowV2 = svgAttrs['data-layout-contract'] === 'readable-v2'; const qualityGatesEnforced = svgAttrs['data-quality-gates'] !== 'advisory'; const nonFiniteAttrs = collectNonFiniteAttrs(svg); addCheck('finite_svg', nonFiniteAttrs.length === 0, nonFiniteAttrs); const legendStart = svg.indexOf(''); const beforeLegend = legendStart >= 0 ? svg.slice(0, legendStart) : svg; - const desktopReadabilityIssue = collectDesktopReadability(svgAttrs, beforeLegend); - const arrows = collectArrows(beforeLegend); + const desktopReadability = collectDesktopReadability(svgAttrs, beforeLegend, readerContract); + const desktopReadabilityIssue = desktopReadability.issue; + // The browser gate measures this later; the geometry is already certain here. + const viewportHeightIssue = predictedFixedWidthOverflow({ + viewBoxWidth: viewBoxSize(svgAttrs)[0], + viewBoxHeight: viewBoxSize(svgAttrs)[1], + readerFit: svgAttrs['data-reader-fit'] || null, + diagramType: svgAttrs['data-diagram-type'] || null, + }); + const arrows = collectArrows(beforeLegend, workflowV2); const diagonal = arrows.flatMap((arrow) => diagonalStraightSegments(arrow).map((segment) => ({ arrow, ...segment }))); addCheck( 'orthogonal_arrows', diagonal.length === 0, - diagonal.map(({ arrow, segmentIndex }) => `${arrow.kind} ${arrow.index} segment ${segmentIndex + 1}: ${arrow.raw}`), + diagonal.map(({ arrow, segmentIndex }) => `${arrow.kind} ${arrow.index} segment ${segmentIndex + 1}: expected an orthogonal segment or an explicitly authored direct straight route; ${arrow.raw}`), ); - const relationshipCrossings = collectRelationshipCrossings(arrows); + const measuredRelationshipCrossings = collectRelationshipCrossings(arrows, workflowV2); + const resolvedCrossovers = measuredRelationshipCrossings.filter((hit) => ( + hit.left.crossoverHalo && hit.right.crossoverHalo + )); + const relationshipCrossings = measuredRelationshipCrossings.filter((hit) => ( + !hit.left.crossoverHalo || !hit.right.crossoverHalo + )); const compositionFrames = collectCompositionFrames(beforeLegend); const containerBorderRuns = collectBorderRuns({ routedRelations: arrows @@ -125,10 +152,28 @@ if (svgMatches.length === 1) { const routedRelationships = arrows .filter((arrow) => arrow.from && arrow.to && arrow.routePoints.length) .map((arrow) => ({ relation: arrow, relationIndex: arrow.index, points: arrow.routePoints })); + const nodeRects = svgAttrs.transform ? [] : collectUntransformedNodeRects(beforeLegend); const routeMetrics = routeBudgetMetrics({ routedRelations: routedRelationships }); + // Architecture marks only one of its two Reader fits with its type. + const crowdedSides = svgAttrs['data-diagram-type'] === 'architecture' || svgAttrs['data-reader-primary-text'] === '14' + ? crowdedNodeSides(arrows, nodeRects) : []; const routeRhythmIssues = collectRouteRhythmIssues({ routedRelations: routedRelationships }); - const ambiguousCorridors = collectAmbiguousCorridors({ routedRelations: routedRelationships }); + const ambiguousCorridors = collectAmbiguousCorridors({ + routedRelations: routedRelationships, + includeSharedEndpoints: (left, right) => workflowV2 || (left.independentPorts && right.independentPorts), + allowShortWorkflowTrunks: workflowV2, + includeSharedEndpointCounterflow: (left, right) => left.automaticWorkflowRoute && right.automaticWorkflowRoute, + }); + const arrowheadCollisions = collectArrowheadCollisions({ + routedRelations: routedRelationships.filter((entry) => workflowV2 || entry.relation.independentPorts), + allowShortWorkflowTrunks: workflowV2, + }); const relationshipLabels = collectRelationshipLabelMasks(beforeLegend, arrows); + const leadingSpace = collectArchitectureLeadingSpace({ + svgAttrs, fragment: beforeLegend, nodeRects, frames: compositionFrames, + arrows, labels: relationshipLabels, + }); + const sequenceColumnSpace = collectSequenceColumnSpace({ svgAttrs, fragment: beforeLegend, nodeRects, arrows }); const labelClearanceThreshold = qualityProfile === 'showcase' ? 4 : 2; const labelRouteMeasurements = collectLabelRouteClearance({ labels: relationshipLabels, @@ -140,23 +185,37 @@ if (svgMatches.length === 1) { routedRelations: arrows.map((arrow) => ({ relation: arrow, relationIndex: arrow.index, points: arrow.routePoints })), threshold: labelClearanceThreshold, }); + // The renderers bound their own label rects, but `check` also re-measures an + // artifact it did not produce; see collectLabelCanvasOverflow in + // shared/geometry.mjs. + const labelCanvasOverflow = collectLabelCanvasOverflow({ + labels: relationshipLabels, + viewBox: viewBoxRect(svgAttrs), + }); const crossingIsError = qualityProfile === 'showcase'; const corridorIsError = qualityProfile === 'showcase'; const rhythmIsError = qualityProfile === 'showcase'; const labelClearanceIsError = qualityProfile === 'showcase'; + const labelContainmentIsError = qualityProfile === 'showcase'; const desktopReadabilityIsError = qualityProfile === 'showcase'; + // Certain geometry, but new: surface it as evidence first (CONTRIBUTING.md#product-and-compatibility-contracts). + const viewportHeightIsError = false; const compositionErrors = (qualityGatesEnforced ? containerBorderRuns.length : 0) + (crossingIsError ? relationshipCrossings.length : 0) - + (corridorIsError ? ambiguousCorridors.length : 0) + + (corridorIsError ? ambiguousCorridors.length + arrowheadCollisions.length : 0) + (labelClearanceIsError ? labelRouteClearance.length : 0) + + (labelContainmentIsError ? labelCanvasOverflow.length : 0) + (rhythmIsError ? routeRhythmIssues.length : 0) - + (desktopReadabilityIsError && desktopReadabilityIssue ? 1 : 0); + + (desktopReadabilityIsError && desktopReadabilityIssue ? 1 : 0) + + (viewportHeightIsError && viewportHeightIssue ? 1 : 0); const compositionWarnings = (qualityGatesEnforced ? 0 : containerBorderRuns.length) + (crossingIsError ? 0 : relationshipCrossings.length) - + (corridorIsError ? 0 : ambiguousCorridors.length) + + (corridorIsError ? 0 : ambiguousCorridors.length + arrowheadCollisions.length) + (labelClearanceIsError ? 0 : labelRouteClearance.length) + + (labelContainmentIsError ? 0 : labelCanvasOverflow.length) + (rhythmIsError ? 0 : routeRhythmIssues.length) - + (desktopReadabilityIsError || !desktopReadabilityIssue ? 0 : 1); + + (desktopReadabilityIsError || !desktopReadabilityIssue ? 0 : 1) + + (viewportHeightIsError || !viewportHeightIssue ? 0 : 1); composition = { schemaVersion: 1, profile: qualityProfile, @@ -167,17 +226,47 @@ if (svgMatches.length === 1) { }, metrics: { properCrossings: relationshipCrossings.length, + resolvedCrossovers: resolvedCrossovers.length, ambiguousCorridors: ambiguousCorridors.length, + arrowheadCollisions: arrowheadCollisions.length, containerBorderRuns: containerBorderRuns.length, labelRouteClearanceIssues: labelRouteClearance.length, - minLabelRouteClearance: labelRouteMeasurements.length - ? Math.round(Math.min(...labelRouteMeasurements.map((hit) => hit.clearance)) * 10) / 10 - : null, + labelCanvasOverflowIssues: labelCanvasOverflow.length, + minLabelRouteClearance: minimumLabelRouteClearance(labelRouteMeasurements), desktopReadabilityIssues: desktopReadabilityIssue ? 1 : 0, - minProjectedNodeTextPx: desktopReadabilityIssue?.projectedFontPx ?? null, + viewportHeightIssues: viewportHeightIssue ? 1 : 0, + minProjectedNodeTextPx: desktopReadability.evidence.minimumProjectedTextPx, ...roundedRouteMetrics(routeMetrics), }, suggestedLimits: { bendsPerRelationship: 2, stretch: 1.35, segmentPx: 16, microSegmentPx: 8 }, + // Perceptual review needs the affected relationships, not just a total. + // These are review evidence, not new pass/fail thresholds: a short, clear + // crossover can be preferable to a long crossing-free detour. + routeReview: { + crossings: resolvedCrossovers.map((hit) => { + const shared = [hit.left.from, hit.left.to].find((id) => id && (id === hit.right.from || id === hit.right.to)); + return { + left: relationshipRecord(hit.left), + right: relationshipRecord(hit.right), + point: hit.point, + ...(shared ? { sharedNode: shared } : {}), + }; + }), + ...(crowdedSides.length ? { crowdedSides } : {}), + detours: routedRelationships.flatMap((entry) => { + const metrics = routeBudgetMetrics({ routedRelations: [entry] }); + const blockers = directCorridorBlockers(entry.relation, nodeRects); + return metrics.routesOverSuggestedBends || metrics.routesOverSuggestedStretch ? [{ + relationship: relationshipRecord(entry.relation), + bends: metrics.maxBends, + stretch: metrics.maxStretch == null ? null : Math.round(metrics.maxStretch * 1000) / 1000, + ...(blockers.length ? { directCorridorBlockers: blockers } : {}), + }] : []; + }), + }, + leadingSpace, + ...(sequenceColumnSpace ? { sequenceColumnSpace } : {}), + desktopReadability: desktopReadability.evidence, issues: [ ...containerBorderRuns.map((hit) => ({ severity: qualityGatesEnforced ? 'error' : 'warning', @@ -204,6 +293,20 @@ if (svgMatches.length === 1) { from: hit.start.map((value) => Math.round(value * 10) / 10), to: hit.end.map((value) => Math.round(value * 10) / 10), })), + ...labelCanvasOverflow.map((hit) => { + const label = hit.label?.label || hit.relation?.label || ''; + return { + severity: labelContainmentIsError ? 'error' : 'warning', + code: 'composition/label-canvas-containment', + label, + relationship: relationshipRecord(hit.relation), + labelRect: roundedRect(hit.rect), + viewBox: hit.viewBox, + viewBoxOrigin: hit.viewBoxOrigin, + overflowPx: hit.overflowPx, + detail: `[composition/label-canvas-containment] ${qualityProfile} label "${label}" on ${relationshipName(hit.relation)} extends past the ${describeLabelCanvasOverflow(hit)} (label rect ${formatRect(hit.rect)}; viewBox ${hit.viewBox[0]}x${hit.viewBox[1]}${hit.viewBoxOrigin.some(Boolean) ? ` at ${hit.viewBoxOrigin[0]},${hit.viewBoxOrigin[1]}` : ''}) — use renderer-supported label controls (shorten the label or reorder participants for sequence; otherwise labelAt, labelDx, labelDy, or labelSegment), or enlarge meta.viewBox.`, + }; + }), ...relationshipCrossings.map((hit) => ({ severity: crossingIsError ? 'error' : 'warning', code: 'composition/proper-crossing', @@ -222,6 +325,15 @@ if (svgMatches.length === 1) { from: hit.overlapStart.map((value) => Math.round(value * 10) / 10), to: hit.overlapEnd.map((value) => Math.round(value * 10) / 10), })), + ...arrowheadCollisions.map((hit) => ({ + severity: corridorIsError ? 'error' : 'warning', + code: 'composition/arrowhead-collision', + relationship: relationshipRecord(hit.left.relation), + otherRelationship: relationshipRecord(hit.right.relation), + distancePx: hit.distance, + minimumPx: hit.minimum, + endpoints: [hit.left.tip, hit.right.tip], + })), ...routeRhythmIssues.map((hit) => ({ severity: rhythmIsError ? 'error' : 'warning', code: hit.code, @@ -235,9 +347,16 @@ if (svgMatches.length === 1) { ...(desktopReadabilityIssue ? [{ severity: desktopReadabilityIsError ? 'error' : 'warning', code: 'composition/desktop-readability', + ...(desktopReadabilityIssue.nodeId ? { nodeId: desktopReadabilityIssue.nodeId } : {}), + owner: desktopReadabilityIssue.owner, viewportWidth: DESKTOP_READABILITY_VIEWPORT.width, viewportHeight: DESKTOP_READABILITY_VIEWPORT.height, - availableDiagramWidth: DESKTOP_READER_DIAGRAM_WIDTH, + availableDiagramWidth: desktopReadability.evidence.availableDiagramWidth, + budgetBasis: desktopReadability.evidence.budgetBasis, + readerContract: desktopReadability.evidence.readerContract, + requestedTargetPx: desktopReadability.evidence.requestedTargetPx, + requestedTargetMet: desktopReadability.evidence.requestedTargetMet, + budgetLimit: desktopReadability.evidence.limit, viewBoxWidth: desktopReadabilityIssue.viewBoxWidth, scale: desktopReadabilityIssue.scale, text: desktopReadabilityIssue.text, @@ -246,6 +365,15 @@ if (svgMatches.length === 1) { projectedFontPx: desktopReadabilityIssue.projectedFontPx, minimumProjectedFontPx: MIN_PROJECTED_NODE_TEXT_PX, }] : []), + ...(viewportHeightIssue ? [{ + severity: viewportHeightIsError ? 'error' : 'warning', + code: 'composition/viewport-height', + readerFit: svgAttrs['data-reader-fit'] || null, + viewBoxWidth: viewBoxSize(svgAttrs)[0], + viewBoxHeight: viewBoxSize(svgAttrs)[1], + ...viewportHeightIssue, + detail: `[composition/viewport-height] ${describeFixedWidthOverflow({ ...viewportHeightIssue, viewBoxWidth: viewBoxSize(svgAttrs)[0], viewBoxHeight: viewBoxSize(svgAttrs)[1] })}`, + }] : []), ], }; addCheck( @@ -264,10 +392,12 @@ if (svgMatches.length === 1) { ); addCheck( 'relationship_corridors', - !corridorIsError || ambiguousCorridors.length === 0, - ambiguousCorridors.map((hit) => ( + !corridorIsError || ambiguousCorridors.length + arrowheadCollisions.length === 0, + [...ambiguousCorridors.map((hit) => ( `[composition/ambiguous-corridor] ${qualityProfile} ${relationshipName(hit.left.relation)} shares a ${Math.round(hit.overlapLength * 10) / 10}px corridor with ${relationshipName(hit.right.relation)} at [${formatPoint(hit.overlapStart)}] -> [${formatPoint(hit.overlapEnd)}]` - )), + )), ...arrowheadCollisions.map((hit) => ( + `[composition/arrowhead-collision] ${qualityProfile} ${relationshipName(hit.left.relation)} and ${relationshipName(hit.right.relation)} have incoming arrowheads ${hit.distance}px apart (minimum ${hit.minimum}px) — enlarge or reposition the destination, or choose separate toSide ports.` + ))], ); addCheck( 'container_border_runs', @@ -299,19 +429,44 @@ if (svgMatches.length === 1) { } const ok = checks.every((check) => check.ok) && composition.status !== 'fail'; -console.log(JSON.stringify({ ok, file: htmlPath, checks, composition }, null, 2)); +console.log(JSON.stringify({ ok, file: htmlPath, artifact, checks, composition }, null, 2)); // Let pending stdout writes drain: large receipts are asynchronous when piped. process.exitCode = ok ? 0 : 1; -function collectArrows(fragment) { +function collectArrows(fragment, useActualPoints = false) { const arrows = []; let index = 0; + let previousTag = null; + let previousTagEnd = 0; for (const tag of fragment.matchAll(/<(path|line)\b[^>]*>/gi)) { + const tagStart = tag.index; const raw = tag[0]; + const gap = previousTag ? fragment.slice(previousTagEnd, tagStart) : ''; + const precedingUnderlay = previousTag + && /^\s*$/.test(gap) + && previousTag.name === 'path' + && previousTag.underlayAttrs; + previousTag = { + name: tag[1].toLowerCase(), + underlayAttrs: tag[1].toLowerCase() === 'path' && AUTOMATIC_CROSSOVER_UNDERLAY_TAG.test(raw) + ? parseAttrs(raw) + : null, + }; + previousTagEnd = tagStart + raw.length; if (!/\bclass="[^"]*\ba-(?:default|emphasis|security|dashed)\b/.test(raw)) continue; if (!/\bmarker-end=/.test(raw)) continue; const attrs = parseAttrs(raw); + const routeStrokeWidth = numberAttr(attrs, 'stroke-width'); + const underlayStrokeWidth = precedingUnderlay ? numberAttr(precedingUnderlay, 'stroke-width') : NaN; + const verifiedCrossoverHalo = attrs['data-composition-crossover'] === 'halo' + && precedingUnderlay?.d === attrs.d + && precedingUnderlay?.fill === 'none' + && precedingUnderlay?.stroke === 'var(--mask)' + && precedingUnderlay?.['pointer-events'] === 'none' + && Number.isFinite(routeStrokeWidth) + && Number.isFinite(underlayStrokeWidth) + && underlayStrokeWidth >= routeStrokeWidth + 3; const segments = tag[1].toLowerCase() === 'line' ? lineSegments(attrs) : pathSegments(attrs.d || ''); @@ -322,9 +477,24 @@ function collectArrows(fragment) { kind: tag[1].toLowerCase(), index: index += 1, raw, + // Trust route intent only for a semantic edge with one visible direct + // segment. A stale marker on bent/curved geometry cannot waive the gate. + authoredStraight: attrs['data-composition-route'] === 'straight' + && Boolean(attrs['data-edge-from'] && attrs['data-edge-to']) + && segments.length === 1 && borderSegments.length === 1 + && (tag[1].toLowerCase() === 'line' || /^\s*M\s+[-+\d.eE]+\s+[-+\d.eE]+\s+L\s+[-+\d.eE]+\s+[-+\d.eE]+\s*$/.test(attrs.d || '')), + crossoverHalo: verifiedCrossoverHalo, + independentPorts: verifiedCrossoverHalo && attrs['data-composition-independent'] === 'true', + // Compatibility with first-round exports lacking a root layout contract. + // Readable-v2's root contract supersedes this narrower automatic-pair rule. + // This marker never certifies a crossover halo or waives a quality rule. + automaticWorkflowRoute: attrs['data-composition-routing'] === 'workflow-v2-auto', + width: routeStrokeWidth, + variant: raw.match(/\ba-(default|emphasis|security|dashed)\b/)?.[1] || 'default', + role: attrs['data-edge-role'], segments, borderSegments, - routePoints: parseRoutePoints(attrs['data-composition-points']) || ( + routePoints: (!useActualPoints && parseRoutePoints(attrs['data-composition-points'])) || ( borderSegments.length ? [borderSegments[0].start, ...borderSegments.map((segment) => segment.end)] : [] ), from: attrs['data-edge-from'] || attrs['data-composition-edge-from'], @@ -405,14 +575,24 @@ function parseRoutePoints(value) { return points.length >= 2 && points.every(isPoint) ? points : null; } -function collectRelationshipCrossings(arrows) { - const relationships = arrows.filter((arrow) => arrow.from && arrow.to && arrow.segments.length); +function collectRelationshipCrossings(arrows, includeSharedEndpoints = false) { + const relationships = arrows.filter((arrow) => arrow.from && arrow.to && arrow.segments.length).map(arrow => ({ + ...arrow, + // Readable-v2 routePoints come from the visible path, never its metadata. + // A straight-through via is not a visual endpoint; preserve real bends. + segments: includeSharedEndpoints ? forwardCollinearAnalysisSegments(arrow.routePoints) : arrow.segments, + })); const crossings = []; for (let leftIndex = 0; leftIndex < relationships.length; leftIndex += 1) { const left = relationships[leftIndex]; for (let rightIndex = leftIndex + 1; rightIndex < relationships.length; rightIndex += 1) { const right = relationships[rightIndex]; - if ([left.from, left.to].some((id) => id === right.from || id === right.to)) continue; + // A shared semantic endpoint does not make an interior X a junction + // when both paths opt into automatic workflow or independent-port checks. + if ([left.from, left.to].some((id) => id === right.from || id === right.to) + && !includeSharedEndpoints + && !(left.independentPorts && right.independentPorts) + && !(left.automaticWorkflowRoute && right.automaticWorkflowRoute)) continue; let point = null; for (const leftSegment of left.segments) { for (const rightSegment of right.segments) { @@ -433,6 +613,81 @@ function relationshipName(arrow) { : `relationship "${arrow.from}" -> "${arrow.to}"`; } +// Review evidence only. Mask rectangles are the visible node bounds emitted by +// our renderers. Skip transformed ancestry rather than mixing coordinate spaces. +function collectUntransformedNodeRects(fragment) { + const groups = []; + const nodes = new Map(); + for (const token of fragment.matchAll(SVG_TAG_TOKEN)) { + if (!token[2]) continue; + const name = token[2].toLowerCase(); + if (name === 'g') { + if (token[1]) groups.pop(); + else if (!/\/\s*>$/.test(token[0])) groups.push(parseAttrs(token[0])); + continue; + } + if (name !== 'rect' || token[1] || groups.some((group) => group.transform)) continue; + const attrs = parseAttrs(token[0]); + const owner = [...groups].reverse().find((group) => group['data-node-id']); + if (!owner || attrs.transform || !String(attrs.class || '').split(/\s+/).includes('c-mask')) continue; + const box = ['x', 'y', 'width', 'height'].map((key) => numberAttr(attrs, key)); + if (!box.every(Number.isFinite) || box[2] <= 0 || box[3] <= 0) continue; + const id = owner['data-node-id']; + // Ambiguous ownership is not reliable evidence for moving a node. + nodes.set(id, nodes.has(id) ? null : { id, label: owner['data-node-label'] || id, box }); + } + return [...nodes.values()].filter(Boolean); +} + +function directCorridorBlockers(relation, nodes) { + const from = nodes.find((node) => node.id === relation.from); + const to = nodes.find((node) => node.id === relation.to); + if (!from || !to || from === to) return []; + const center = ({ box: [x, y, w, h] }) => [x + w / 2, y + h / 2]; + const a = center(from); + const b = center(to); + const horizontal = Math.abs(a[1] - b[1]) < 0.01; + const vertical = Math.abs(a[0] - b[0]) < 0.01; + if (horizontal === vertical) return []; + const axis = horizontal ? 0 : 1; + const cross = 1 - axis; + const [first, last] = a[axis] < b[axis] ? [from, to] : [to, from]; + const low = first.box[axis] + first.box[axis + 2]; + const high = last.box[axis]; + if (high <= low) return []; + return nodes.filter((node) => node !== from && node !== to + && node.box[axis] < high && node.box[axis] + node.box[axis + 2] > low + && node.box[cross] < a[cross] && node.box[cross] + node.box[cross + 2] > a[cross]); +} + +// Automatic ports need a 16px corner gutter and 14px between neighbours, so a +// side facing more counterparts than that fits pushes routes onto other sides. +function crowdedNodeSides(arrows, nodes) { + const byId = new Map(nodes.map((node) => [node.id, node])); + const demand = new Map(); + for (const arrow of arrows) { + const from = byId.get(arrow.from); + const to = byId.get(arrow.to); + if (!from || !to || from === to) continue; + for (const [node, other] of [[from, to], [to, from]]) { + const [x, y, w, h] = node.box; + const dx = other.box[0] + other.box[2] / 2 - (x + w / 2); + const dy = other.box[1] + other.box[3] / 2 - (y + h / 2); + const side = dx !== 0 && Math.abs(dx) >= Math.abs(dy) ? (dx < 0 ? 'left' : 'right') : (dy > 0 ? 'bottom' : 'top'); + const key = `${node.id}\u0000${side}`; + const entry = demand.get(key) || { node, side, relationships: 0 }; + entry.relationships += 1; + demand.set(key, entry); + } + } + return [...demand.values()].flatMap(({ node, side, relationships }) => { + const sidePx = side === 'left' || side === 'right' ? node.box[3] : node.box[2]; + const neededPx = 32 + 14 * (relationships - 1); + return relationships > 1 && sidePx < neededPx + ? [{ node: node.id, label: node.label, side, relationships, sidePx, neededPx }] : []; + }); +} + function relationshipRecord(arrow) { const stableIndex = Number(arrow.key); return { @@ -481,6 +736,129 @@ function collectCompositionFrames(fragment) { return frames; } +// Evidence for author review only. Automatic Architecture is identifiable by +// its intrinsic Reader contract; authored canvases must retain their geometry. +function collectArchitectureLeadingSpace({ svgAttrs, fragment, nodeRects, frames, arrows, labels }) { + const evidence = { measured: false, reviewSuggested: false }; + if (svgAttrs['data-reader-fit'] !== 'intrinsic-height' + || svgAttrs['data-reader-primary-text'] !== '14' + || svgAttrs.transform + || [...fragment.matchAll(/]*\btransform\s*=[^>]*>/gi)] + .some((match) => !/\bdata-semantic-sigil=/.test(match[0])) + || /<(?:path|line|rect|text)\b[^>]*\btransform\s*=/i.test(fragment)) return evidence; + const [originX, originY, width, height] = viewBoxRect(svgAttrs); + if (![originX, originY, width, height].every(Number.isFinite) || width <= 0 || height <= 0) return evidence; + const nodeCount = [...fragment.matchAll(/]*\bdata-node-id=/gi)].length; + if (!nodeRects.length || nodeRects.length !== nodeCount) return evidence; + const semanticArrows = arrows.filter((arrow) => arrow.from && arrow.to); + if (semanticArrows.some((arrow) => !arrow.routePoints.length)) return evidence; + + const occupied = nodeRects.map((node) => node.box[1]); + for (const frame of frames) { + const top = frame.shape === 'line' + ? Math.min(frame.start[1], frame.end[1]) : frame.y; + if (!Number.isFinite(top)) return evidence; + occupied.push(top); + } + // Boundary titles can protrude above their structural frame. + for (const match of fragment.matchAll(/]*\bdata-graph-role="structural-frame-label"[^>]*>[\s\S]*?]*\bdata-graph-role="structural-frame-label-mask"[^>]*>/gi)) { + const rect = parseAttrs(match[0].match(/]*>/i)?.[0] || ''); + const y = numberAttr(rect, 'y'); + if (!Number.isFinite(y)) return evidence; + occupied.push(y); + } + for (const arrow of semanticArrows) { + for (const point of arrow.routePoints) occupied.push(point[1]); + } + for (const label of labels) occupied.push(label.rect.y); + if (!occupied.every(Number.isFinite)) return evidence; + const occupiedTop = Math.min(...occupied); + const gap = Math.max(0, occupiedTop - originY); + const heights = nodeRects.map((node) => node.box[3]).sort((a, b) => a - b); + const typicalNodeHeight = heights[Math.floor(heights.length / 2)]; + const ratio = gap / height; + return { + measured: true, + emptyTopPx: Math.round(gap * 10) / 10, + emptyTopRatio: Math.round(ratio * 1000) / 1000, + occupiedTop: Math.round(occupiedTop * 10) / 10, + viewBoxTop: originY, + canvasHeight: height, + typicalNodeHeight, + reviewSuggested: gap > 2 * typicalNodeHeight && ratio > 0.2, + }; +} + +// Advisory only: fixed columns are a compatibility contract. Measure semantic +// content, including long labels/notes, rather than treating every wide canvas +// as wasted space. Auto-sized segment frames do not add a participant column. +function collectSequenceColumnSpace({ svgAttrs, fragment, nodeRects, arrows }) { + const columnFit = svgAttrs['data-sequence-column-fit']; + if (!['fixed', 'spread'].includes(columnFit)) return null; + const evidence = { measured: false, reviewSuggested: false, columnFit }; + if (svgAttrs.transform || /$/.test(token[0])) brandGroups.push(inBrand); + } + const [originX, , width, height] = viewBoxRect(svgAttrs); + if (![originX, width, height].every(Number.isFinite) || width <= 0 || height <= 0) return evidence; + const nodeCount = [...fragment.matchAll(/]*\bdata-node-id=/gi)].length; + if (!nodeRects.length || nodeCount !== nodeRects.length) return evidence; + const semanticArrows = arrows.filter((arrow) => arrow.from && arrow.to); + if (semanticArrows.some((arrow) => !arrow.routePoints.length)) return evidence; + const rightEdges = nodeRects.map((node) => node.box[0] + node.box[2]); + for (const arrow of semanticArrows) { + for (const point of arrow.routePoints) rightEdges.push(point[0]); + } + // Label plates, activations and segment titles also reserve horizontal room. + for (const match of fragment.matchAll(/]*>/gi)) { + const attrs = parseAttrs(match[0]); + if (!String(attrs.class || '').split(/\s+/).includes('c-mask')) continue; + rightEdges.push(numberAttr(attrs, 'x') + numberAttr(attrs, 'width')); + } + for (const match of fragment.matchAll(/]*)>([\s\S]*?)<\/text>/gi)) { + const box = textBox(parseAttrs(match[1]), stripTags(match[2]).trim()); + if (!box) return evidence; + rightEdges.push(box.x2); + } + if (!rightEdges.every(Number.isFinite)) return evidence; + const occupiedRight = Math.max(...rightEdges); + const gap = Math.max(0, originX + width - occupiedRight); + const ratio = gap / width; + const widths = nodeRects.map((node) => node.box[2]).sort((a, b) => a - b); + const typicalParticipantWidth = widths[Math.floor(widths.length / 2)]; + return { + measured: true, + columnFit, + participantCount: nodeCount, + occupiedRight: Math.round(occupiedRight * 10) / 10, + viewBoxLeft: originX, + canvasWidth: width, + emptyRightPx: Math.round(gap * 10) / 10, + emptyRightRatio: Math.round(ratio * 1000) / 1000, + typicalParticipantWidth, + // Avoid stretching a small conversation merely to fill its canvas. These + // conservative review thresholds never contribute errors or warnings. + reviewSuggested: columnFit === 'fixed' && nodeCount >= 4 + && gap > 2 * typicalParticipantWidth && ratio > 0.25, + }; +} + function frameName(frame) { return `${frame.kind || 'frame'} "${frame.id}"`; } @@ -583,6 +961,7 @@ function straightPathSegments(d) { } function diagonalStraightSegments(arrow) { + if (arrow.authoredStraight) return []; return arrow.borderSegments.flatMap(({ start, end }, segmentIndex) => ( Math.abs(start[0] - end[0]) > 0.01 && Math.abs(start[1] - end[1]) > 0.01 ? [{ segmentIndex, start, end }] @@ -646,35 +1025,128 @@ function textBox(attrs, text) { }; } -function collectDesktopReadability(svgAttrs, fragment) { +// A foreign artifact may author a legal non-zero viewBox origin, so containment +// needs all four numbers; sizing checks read the trailing pair. +function viewBoxRect(svgAttrs) { const viewBox = String(svgAttrs.viewBox || '').trim().split(/[\s,]+/).map(Number); - const viewBoxWidth = viewBox.length === 4 ? viewBox[2] : Number.NaN; - if (!Number.isFinite(viewBoxWidth) || viewBoxWidth <= 0) return null; - const scale = Math.min(1, DESKTOP_READER_DIAGRAM_WIDTH / viewBoxWidth); - let worst = null; - for (const match of fragment.matchAll(/]*)>([\s\S]*?)<\/text>/gi)) { - const primary = /\bdata-node-label(?:\s*=|\s|$)/i.test(match[1]); - const boundary = /\bdata-boundary-label(?:\s*=|\s|$)/i.test(match[1]); - const context = /\bdata-detail\s*=\s*"context"/i.test(match[1]); - if (!primary && !boundary && !context) continue; + return viewBox.length === 4 ? viewBox : [Number.NaN, Number.NaN, Number.NaN, Number.NaN]; +} + +function viewBoxSize(svgAttrs) { + return viewBoxRect(svgAttrs).slice(2); +} + +function hasAttribute(attrs, name) { + return new RegExp('(?:^|\\s)' + name + '(?:\\s*=|\\s|$)', 'i').test(attrs); +} + +function readerContractFromHtml(source) { + const markers = [...source.matchAll(/]*>/gi)] + .map((match) => parseAttrs(match[0])) + .filter((attrs) => attrs.name === 'archify-reader-contract'); + return markers.length === 1 && markers[0].content === DECLARED_WIDE_READER_CONTRACT + ? DECLARED_WIDE_READER_CONTRACT + : null; +} + +function collectDesktopReadability(svgAttrs, fragment, contract) { + const [viewBoxWidth, viewBoxHeight] = viewBoxSize(svgAttrs); + const requestedMinimumTextPx = Number.parseFloat(svgAttrs['data-reader-min-text'] || ''); + const entries = []; + let invalidSemanticText = false; + const groups = []; + // Keep the complete ancestry, rather than a node-only stack: an edge can + // share its context group with its label or nest that group (Sequence). + for (const match of fragment.matchAll(/|$)||$)|]*)>([\s\S]*?)<\/text>|]*>|<\/g\s*>/gi)) { + if (match[0].startsWith('$/.test(match[0])) groups.push(parseAttrs(match[0])); + continue; + } const attrs = parseAttrs(match[1]); + if (attrs['data-detail'] === 'fine' || groups.some((group) => group['data-detail'] === 'fine')) continue; + const primary = hasAttribute(match[1], 'data-node-label'); + const boundary = hasAttribute(match[1], 'data-boundary-label'); + const context = attrs['data-detail'] === 'context' + || groups.some((group) => group['data-detail'] === 'context'); + const nodeOwner = [...groups].reverse().find((group) => group['data-node-id']); + const edgeOwner = [...groups].reverse().find((group) => group['data-edge-from'] && group['data-edge-to']); + const owner = primary + ? { kind: 'node', id: nodeOwner?.['data-node-id'] || null } + : boundary ? { kind: 'boundary', id: null } + : context && edgeOwner ? { + kind: 'edge', id: edgeOwner['data-edge-id'] || null, + from: edgeOwner['data-edge-from'], to: edgeOwner['data-edge-to'], + } + : context && nodeOwner ? { kind: 'node', id: nodeOwner['data-node-id'] } + : null; + // A context text with neither semantic owner is legend/fine/loose copy. + if (!owner) continue; const fontSize = Number.parseFloat(attrs['font-size'] || ''); - if (!Number.isFinite(fontSize)) continue; - const projected = projectedNodeTextPx(fontSize, viewBoxWidth); - if (projected >= MIN_PROJECTED_NODE_TEXT_PX) continue; - const candidate = { - viewBoxWidth, - scale, + if (!Number.isFinite(fontSize)) { + invalidSemanticText = true; + continue; + } + if (fontSize <= 0) invalidSemanticText = true; + entries.push({ + ...(owner.kind === 'node' && owner.id ? { nodeId: owner.id } : {}), + owner, text: stripTags(match[2]).trim(), - detail: primary - ? 'primary' - : boundary ? 'boundary' : 'context', + detail: primary ? 'primary' : boundary ? 'boundary' : owner.kind === 'edge' ? 'edge' : 'context', sourceFontPx: fontSize, - projectedFontPx: projected, - }; - if (!worst || candidate.projectedFontPx < worst.projectedFontPx) worst = candidate; + }); } - return worst; + const minimumSourceTextPx = entries.length ? Math.min(...entries.map((entry) => entry.sourceFontPx)) : Number.NaN; + const eligible = contract === DECLARED_WIDE_READER_CONTRACT + && svgAttrs['data-reader-fit'] === 'intrinsic-height' + && Number.isFinite(requestedMinimumTextPx) && requestedMinimumTextPx > 0 + && !invalidSemanticText && entries.length > 0; + const declared = eligible ? declaredWideReadabilityBudget({ + viewBoxWidth, + viewBoxHeight, + minimumSourceTextPx, + requestedMinimumTextPx, + }) : null; + const availableDiagramWidth = declared?.guaranteedSvgWidth ?? DESKTOP_READER_DIAGRAM_WIDTH; + const budgetBasis = declared ? 'recognized-declared-wide' : 'legacy-930'; + const scale = Number.isFinite(viewBoxWidth) && viewBoxWidth > 0 + ? Math.min(1, availableDiagramWidth / viewBoxWidth) : Number.NaN; + const projected = entries.map((entry) => ({ + ...entry, + viewBoxWidth, + scale, + projectedFontPx: projectedNodeTextPx(entry.sourceFontPx, viewBoxWidth, availableDiagramWidth), + })); + const worst = projected.reduce((current, entry) => ( + !current || entry.projectedFontPx < current.projectedFontPx ? entry : current + ), null); + const projectedMinimumTextPx = Number.isFinite(worst?.projectedFontPx) ? worst.projectedFontPx : null; + const hardFloorMet = Number.isFinite(worst?.projectedFontPx) + ? worst.projectedFontPx >= MIN_PROJECTED_NODE_TEXT_PX : null; + const requestedTargetMet = worst && Number.isFinite(requestedMinimumTextPx) + ? worst.projectedFontPx >= requestedMinimumTextPx : null; + const evidence = { + budgetBasis, + readerContract: contract, + availableDiagramWidth, + actualBudgetPx: availableDiagramWidth, + ...(declared ? { + actualReaderWidth: declared.actualReaderWidth, + desiredReaderWidth: declared.desiredReaderWidth, + viewportCap: declared.viewportCap, + limit: declared.limit, + } : { limit: 'legacy' }), + requestedTargetPx: Number.isFinite(requestedMinimumTextPx) ? requestedMinimumTextPx : null, + requestedTargetMet, + hardFloorPx: MIN_PROJECTED_NODE_TEXT_PX, + hardFloorMet, + minimumOwner: worst?.owner || null, + minimumSourceTextPx: worst?.sourceFontPx ?? null, + minimumProjectedTextPx: projectedMinimumTextPx, + semanticTextCount: entries.length, + }; + return { evidence, issue: worst && hardFloorMet === false ? worst : null }; } function estimatedTextWidth(text, fontSize) { diff --git a/packages/diagram-core/vendor/archify/scripts/check-update.mjs b/packages/diagram-core/vendor/archify/scripts/check-update.mjs index dd12e4b..30d529a 100644 --- a/packages/diagram-core/vendor/archify/scripts/check-update.mjs +++ b/packages/diagram-core/vendor/archify/scripts/check-update.mjs @@ -19,6 +19,7 @@ import { validateReleaseNotesUrl, validateStableUpdateManifest, } from './update-contract.mjs'; +import { sameEntry } from '../renderers/shared/path-semantics.mjs'; const OPERATION_STATE_FILE = 'state.json'; const OPERATION_OWNER_FILE = 'owner.json'; @@ -249,19 +250,41 @@ async function readJsonFile(target, maxBytes, expectedMetadata = null) { function isWithinDirectory(directory, target) { const relative = path.relative(directory, target); return relative === '' + // path-contract-allow: lexical-capability -- No-follow snapshots bind this mutation boundary. || (!path.isAbsolute(relative) && relative !== '..' && !relative.startsWith(`..${path.sep}`)); } +async function physicalDirectorySuffix(directory, target) { + const absoluteTarget = path.resolve(target); + const parsed = path.parse(absoluteTarget); + const segments = absoluteTarget.slice(parsed.root.length).split(path.sep).filter(Boolean); + let prefix = parsed.root; + for (let index = 0; index < segments.length; index += 1) { + prefix = path.join(prefix, segments[index]); + const relation = sameEntry(directory, prefix); + if (relation.status === 'match') { + const metadata = await fs.lstat(prefix, { bigint: true }); + if (metadata.isSymbolicLink()) { + throw new Error(`trusted cache prefix is a symbolic link or junction: ${prefix}`); + } + return segments.slice(index + 1); + } + if (relation.status === 'unknown' && relation.reason.code === 'entry-missing') break; + } + return null; +} + async function canonicalizeTrustedDirectoryPrefix(target) { const absoluteTarget = path.resolve(target); const trustedDirectories = [...new Set([os.homedir(), os.tmpdir()].map((directory) => ( path.resolve(directory) )))].sort((left, right) => right.length - left.length); for (const trustedDirectory of trustedDirectories) { - if (!isWithinDirectory(trustedDirectory, absoluteTarget)) continue; + const suffix = await physicalDirectorySuffix(trustedDirectory, absoluteTarget); + if (suffix === null) continue; try { const canonicalDirectory = await fs.realpath(trustedDirectory); - return path.resolve(canonicalDirectory, path.relative(trustedDirectory, absoluteTarget)); + return path.resolve(canonicalDirectory, ...suffix); } catch { // Fall back to validating the absolute path from its filesystem root. } @@ -331,7 +354,11 @@ function cacheTokenFor(cacheDirectory) { function resolveCacheTarget(token, target) { const resolved = path.resolve(target); - if (resolved === token.directory || !isWithinDirectory(token.directory, resolved)) { + const relative = path.relative(token.directory, resolved); + // This is a lexical capability check, not a physical-containment query. The + // async lstat snapshots below bind the prepared directory and every mutation + // parent across awaits; following a link here would weaken that no-link rule. + if (relative === '' || !isWithinDirectory(token.directory, resolved)) { throw invalidateCacheToken(token, 'cache mutation escaped its prepared directory'); } return resolved; @@ -1643,20 +1670,19 @@ async function runCli() { return silent('invalid-arguments'); } -async function isMainModule() { - if (!process.argv[1]) return false; +export function isMainModule({ + argvPath = process.argv[1], + modulePath = fileURLToPath(import.meta.url), +} = {}) { + if (!argvPath) return false; try { - const [entryPath, modulePath] = await Promise.all([ - fs.realpath(path.resolve(process.argv[1])), - fs.realpath(fileURLToPath(import.meta.url)), - ]); - return entryPath === modulePath; + return sameEntry(argvPath, modulePath).status === 'match'; } catch { - return path.resolve(process.argv[1]) === path.resolve(fileURLToPath(import.meta.url)); + return false; } } -if (await isMainModule()) { +if (isMainModule()) { let result; try { result = await runCli(); diff --git a/packages/diagram-core/vendor/archify/scripts/generate-brand-marks.mjs b/packages/diagram-core/vendor/archify/scripts/generate-brand-marks.mjs deleted file mode 100644 index 73490ba..0000000 --- a/packages/diagram-core/vendor/archify/scripts/generate-brand-marks.mjs +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/env node - -import fs from 'node:fs'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; -import * as simpleIcons from 'simple-icons'; - -const here = path.dirname(fileURLToPath(import.meta.url)); -const root = path.resolve(here, '..'); -const catalogPath = path.join(root, 'brand-marks', 'catalog.json'); -const outputPath = path.join(root, 'renderers', 'shared', 'generated-brand-marks.mjs'); -const catalog = JSON.parse(fs.readFileSync(catalogPath, 'utf8')); -const simpleIconsVersion = JSON.parse(fs.readFileSync( - path.join(root, 'node_modules', 'simple-icons', 'package.json'), - 'utf8', -)).version; -const simpleBySlug = new Map(Object.values(simpleIcons) - .filter((icon) => icon && typeof icon === 'object' && icon.slug && icon.path) - .map((icon) => [icon.slug, icon])); - -function normalizedList(value) { - return [...new Set((Array.isArray(value) ? value : []) - .map((item) => String(item).trim()) - .filter(Boolean))]; -} - -function lookupForms(value) { - const raw = String(value ?? '').trim().toLocaleLowerCase('en-US'); - if (!raw) return []; - return [...new Set([ - raw, - raw.replace(/[\s_]+/g, '-'), - raw.replace(/[\s_.-]+/g, ''), - ])]; -} - -function fail(message) { - console.error(`brand catalog: ${message}`); - process.exit(1); -} - -if (catalog.schemaVersion !== 1 || !Array.isArray(catalog.marks) || catalog.marks.length === 0) { - fail('catalog.json must contain a non-empty schemaVersion 1 marks array'); -} - -const ids = new Set(); -const lookupKeys = new Map(); -const domains = new Map(); -const generated = catalog.marks.map((entry, index) => { - if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(entry.id || '')) fail(`marks[${index}] has an invalid id`); - if (ids.has(entry.id)) fail(`duplicate id ${entry.id}`); - ids.add(entry.id); - - const aliases = normalizedList(entry.aliases); - const entryDomains = normalizedList(entry.domains).map((domain) => domain.toLowerCase()); - for (const key of [entry.id, ...aliases]) { - for (const form of lookupForms(key)) { - if (lookupKeys.has(form) && lookupKeys.get(form) !== entry.id) { - fail(`lookup key ${JSON.stringify(key)} is shared by ${lookupKeys.get(form)} and ${entry.id}`); - } - lookupKeys.set(form, entry.id); - } - } - for (const domain of entryDomains) { - if (domains.has(domain) && domains.get(domain) !== entry.id) { - fail(`domain ${domain} is shared by ${domains.get(domain)} and ${entry.id}`); - } - domains.set(domain, entry.id); - } - - let mark; - if (entry.simpleIcon) { - const icon = simpleBySlug.get(entry.simpleIcon); - if (!icon) fail(`${entry.id} references missing Simple Icons slug ${entry.simpleIcon}`); - mark = { - id: entry.id, - title: entry.title || icon.title, - category: entry.category, - aliases, - domains: entryDomains, - viewBox: 24, - hex: icon.hex, - path: icon.path, - provenance: { - provider: 'Simple Icons', - providerVersion: simpleIconsVersion, - source: icon.source, - ...(icon.guidelines ? { guidelines: icon.guidelines } : {}), - ...(icon.license ? { license: icon.license } : {}), - }, - }; - } else if (entry.custom) { - const custom = entry.custom; - if (!entry.title || !custom.path || !custom.source || !/^[0-9A-F]{6}$/i.test(custom.hex || '')) { - fail(`${entry.id} custom mark requires title, path, source, and six-digit hex`); - } - mark = { - id: entry.id, - title: entry.title, - category: entry.category, - aliases, - domains: entryDomains, - viewBox: custom.viewBox || 24, - hex: custom.hex.toUpperCase(), - path: custom.path, - provenance: { - provider: 'Official brand asset', - source: custom.source, - ...(custom.guidelines ? { guidelines: custom.guidelines } : {}), - }, - }; - } else { - fail(`${entry.id} must provide simpleIcon or custom`); - } - if (!mark.category || !mark.title) fail(`${entry.id} is missing category or title`); - for (const form of lookupForms(mark.title)) { - if (lookupKeys.has(form) && lookupKeys.get(form) !== entry.id) { - fail(`title ${JSON.stringify(mark.title)} is shared by ${lookupKeys.get(form)} and ${entry.id}`); - } - lookupKeys.set(form, entry.id); - } - return mark; -}).sort((left, right) => left.id.localeCompare(right.id)); - -const banner = `// Generated by scripts/generate-brand-marks.mjs from brand-marks/catalog.json.\n// Simple Icons ${simpleIconsVersion}. Do not edit by hand.\n`; -const source = `${banner}export const BRAND_MARKS = Object.freeze(${JSON.stringify(generated, null, 2)});\n`; - -if (process.argv.includes('--check')) { - const current = fs.existsSync(outputPath) - ? fs.readFileSync(outputPath, 'utf8').replace(/\r\n?/g, '\n') - : ''; - if (current !== source) { - console.error('generated brand marks are stale — run npm run generate:brand-marks'); - process.exit(1); - } -} else { - const temporary = `${outputPath}.${process.pid}.tmp`; - fs.writeFileSync(temporary, source); - fs.renameSync(temporary, outputPath); - console.log(`generated ${path.relative(root, outputPath)} (${generated.length} marks)`); -} diff --git a/packages/diagram-core/vendor/archify/scripts/generate-validators.mjs b/packages/diagram-core/vendor/archify/scripts/generate-validators.mjs deleted file mode 100644 index ab205bd..0000000 --- a/packages/diagram-core/vendor/archify/scripts/generate-validators.mjs +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env node - -import fs from 'node:fs'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; -import Ajv2020 from 'ajv/dist/2020.js'; -import standaloneCode from 'ajv/dist/standalone/index.js'; - -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const root = path.resolve(__dirname, '..'); -const schemasDir = path.join(root, 'schemas'); -const output = path.join(root, 'renderers/shared/generated-validators.mjs'); -const diagramTypes = ['workflow', 'sequence', 'dataflow', 'lifecycle', 'architecture']; - -const ajv = new Ajv2020({ - allErrors: true, - strict: true, - code: { source: true, esm: true }, -}); -ajv.addSchema(JSON.parse(fs.readFileSync(path.join(schemasDir, 'common.schema.json'), 'utf8'))); - -const schemaIds = {}; -for (const type of diagramTypes) { - const schema = JSON.parse(fs.readFileSync(path.join(schemasDir, `${type}.schema.json`), 'utf8')); - ajv.addSchema(schema); - schemaIds[type] = schema.$id; -} - -const banner = '// Generated by scripts/generate-validators.mjs. Do not edit by hand.\n'; -const ajvUcs2Import = 'require("ajv/dist/runtime/ucs2length").default'; -const inlineUcs2Length = `function ucs2length(str) { - const len = str.length; - let length = 0; - let pos = 0; - while (pos < len) { - length += 1; - const value = str.charCodeAt(pos++); - if (value >= 0xd800 && value <= 0xdbff && pos < len - && (str.charCodeAt(pos) & 0xfc00) === 0xdc00) pos += 1; - } - return length; -}`; -let validatorCode = standaloneCode(ajv, schemaIds); -if (!validatorCode.includes(ajvUcs2Import)) { - throw new Error('AJV standalone output no longer contains the expected ucs2length helper'); -} -validatorCode = validatorCode.replaceAll(ajvUcs2Import, inlineUcs2Length); -if (validatorCode.includes('require(')) { - throw new Error('AJV standalone output contains an unexpected runtime dependency'); -} -const generated = `${banner}${validatorCode}\n`; - -if (process.argv.includes('--check')) { - const current = fs.existsSync(output) - ? fs.readFileSync(output, 'utf8').replace(/\r\n?/g, '\n') - : ''; - if (current !== generated) { - console.error('generated validators are stale — run npm run generate:validators'); - process.exit(1); - } -} else { - const temporary = `${output}.${process.pid}.tmp`; - fs.writeFileSync(temporary, generated); - fs.renameSync(temporary, output); - console.log(`generated ${path.relative(root, output)}`); -} diff --git a/packages/diagram-core/vendor/archify/skill-release.json b/packages/diagram-core/vendor/archify/skill-release.json index aa40d67..a6bf3e0 100644 --- a/packages/diagram-core/vendor/archify/skill-release.json +++ b/packages/diagram-core/vendor/archify/skill-release.json @@ -1,8 +1,8 @@ { "schemaVersion": 1, "skillId": "archify", - "channel": "development", - "version": "2.17.0-dev.1", + "channel": "stable", + "version": "3.0.0", "source": { "repository": "https://github.com/tt-a1i/archify" }, diff --git a/packages/site/tests/e2e/archify-story.spec.ts b/packages/site/tests/e2e/archify-story.spec.ts index 76c8c45..2533c38 100644 --- a/packages/site/tests/e2e/archify-story.spec.ts +++ b/packages/site/tests/e2e/archify-story.spec.ts @@ -745,8 +745,8 @@ test("wide adjacent Lifecycle states preserve final geometry", async ({ await expect(diagram.locator("g[data-edge-from]")).toHaveCount(2); const geometry = await diagram.evaluate((svg) => { const states = [...svg.querySelectorAll( - "g[data-node-id] > rect:not(.c-mask)", - )].map((element) => element.getBoundingClientRect()); + "g[data-node-id]", + )].map((node) => node.querySelector("rect:not(.c-mask)")!.getBoundingClientRect()); const labels = [...svg.querySelectorAll( "g[data-edge-from] > text", )]; @@ -773,6 +773,19 @@ test("wide adjacent Lifecycle states preserve final geometry", async ({ ); return { stateIntersections: intersections(states, states), + overflowingStateLabels: [...svg.querySelectorAll( + "g[data-node-id]", + )].flatMap((node) => { + const box = node.querySelector("rect:not(.c-mask)")?.getBoundingClientRect(); + if (!box) return []; + return [...node.querySelectorAll("text[data-node-label]")].flatMap((label) => { + const text = label.getBoundingClientRect(); + return text.left < box.left || text.right > box.right || + text.top < box.top || text.bottom > box.bottom + ? [label.textContent] + : []; + }); + }), labelIntersections: intersections( labels.map((label) => label.getBoundingClientRect()), states, @@ -789,6 +802,7 @@ test("wide adjacent Lifecycle states preserve final geometry", async ({ }; }); expect(geometry.stateIntersections).toEqual([]); + expect(geometry.overflowingStateLabels).toEqual([]); expect(geometry.labelIntersections).toEqual([]); expect(geometry.minimumFontSize).toBeGreaterThanOrEqual(12); } finally { From a678bee2fa622cb398b779ce633cfe7f8b3e0a8f Mon Sep 17 00:00:00 2001 From: Dylan McCurry Date: Mon, 28 Sep 2026 08:32:10 -0400 Subject: [PATCH 2/3] test: verify native Archify v3 viewer contracts Account for v3 terminal borders, empty lifecycle bands, duplicate node-index text, and title-framed raster exports. Assert the canonical diagram retains a uniform scale inside the frame, preserving existing topology, readable text, source navigation and SVG/PNG coverage. Refs #41 --- CHANGELOG.md | 3 +++ docs/renderer.md | 4 ++++ docs/story-preview.md | 9 ++++++-- packages/cli/src/story-preview.test.ts | 4 ++-- packages/diagram-core/src/index.ts | 3 ++- packages/site/tests/e2e/archify-story.spec.ts | 4 ++-- .../site/tests/e2e/dataflow-story.spec.ts | 9 ++++---- .../site/tests/e2e/helpers/raster-figure.ts | 21 +++++++++++++++++++ .../site/tests/e2e/sequence-stories.spec.ts | 2 +- .../tests/e2e/topo-packages-story.spec.ts | 5 ++--- 10 files changed, 49 insertions(+), 15 deletions(-) create mode 100644 packages/site/tests/e2e/helpers/raster-figure.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 3253e16..130da21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ does not currently publish versioned releases. - Supply v3 output-path metadata at the adapter boundary without rewriting authored stories. Preserve compatible Lifecycle v1 inputs and the 12px effective-text requirement through final-font sizing and native route gaps. +- Preserve native v3 raster figure exports with their title and padded frame, + while verifying that inner diagram geometry remains uniformly scaled. + Lifecycle omits empty bands and visibly marks terminal states. - Retain upstream MIT, third-party and font notices unchanged; no vendor patch, npm renderer dependency, license-policy expansion or upstream-suite completion is implied. Refs #41. diff --git a/docs/renderer.md b/docs/renderer.md index ed75c39..290ee03 100644 --- a/docs/renderer.md +++ b/docs/renderer.md @@ -37,6 +37,10 @@ on the compatible native v1 geometry: state widths and column clearance account for final typography, preserving Topocode's 12px effective text requirement. The v3 viewer's own guided/story-view and ordinary share-card removal does not remove Topocode's authored-story catalogue or canonical SVG/PNG exports. +Native v3 PNG exports add the viewer's title and canvas frame around the +uniformly scaled canonical diagram. SVG remains the bare canonical geometry; +the test oracle accounts for frame dimensions rather than distorting or +cropping the diagram to preserve the previous whole-image aspect ratio. Native `deliver` provenance receipts describe the raw native artifact. Topocode then applies adapter typography/narrative changes and, for repository views, diff --git a/docs/story-preview.md b/docs/story-preview.md index 68ab17b..0adafa2 100644 --- a/docs/story-preview.md +++ b/docs/story-preview.md @@ -23,6 +23,8 @@ silently reuse a neighboring state's column. The Archify 3.0.0 adapter retains native Lifecycle schema v1; it reserves the native minimum route gap and sizes states for final 14.5px typography so the adaptive viewer still meets Topocode's 12px effective on-screen text floor. +Native v3 Lifecycle output omits empty bands and adds the terminal state's +double border; neither changes authored state or transition membership. The optional `classification` is `source-grounded` or `capability-demo`; omission retains the source-grounded behavior. Every source-grounded section @@ -83,8 +85,11 @@ renderer failures exit nonzero. Rendering completes in memory before the generated file is atomically replaced, so renderer failures do not publish a partial story. -The viewer exports the same canonical authored geometry as SVG or a -resolution-scaled PNG. Local serving permits blob images only for generated +The viewer exports canonical authored geometry as SVG. Native v3 PNG exports +place that same geometry, uniformly scaled, inside a title row and padded +canvas card; the complete PNG therefore has a different aspect ratio than the +bare SVG. No diagram content is cropped to force the old ratio. +Local serving permits blob images only for generated story viewers so the pinned runtime can rasterize its serialized SVG without broadening the Content Security Policy for shell pages. diff --git a/packages/cli/src/story-preview.test.ts b/packages/cli/src/story-preview.test.ts index b08eb23..5fd6131 100644 --- a/packages/cli/src/story-preview.test.ts +++ b/packages/cli/src/story-preview.test.ts @@ -269,14 +269,14 @@ describe("story preview", () => { expect(contents).toContain("Charge the accepted order."); }); - it("renders a committed lifecycle story with native lifecycle bands", async () => { + it("renders populated lifecycle bands without inventing an empty recovery phase", async () => { const { root, documentPath } = await fixture(familyStory("lifecycle")); const result = await previewStory(root, documentPath); const contents = await readFile(result.outputPath, "utf8"); expect(contents).toContain("01 / Checkout"); - expect(contents).toContain("02 / Interruptions + recovery"); + expect(contents).not.toContain("02 / Interruptions + recovery"); expect(contents).toContain("03 / Outcomes"); }); diff --git a/packages/diagram-core/src/index.ts b/packages/diagram-core/src/index.ts index 4e15032..1a9f4d2 100644 --- a/packages/diagram-core/src/index.ts +++ b/packages/diagram-core/src/index.ts @@ -1228,6 +1228,7 @@ function dataflowSpec( } const lifecycleFontSize = 14.5; +const lifecycleMinimumRouteLength = 32; function lifecycleSpec(story: ResolvedStoryDocument): ArchifyLifecycle { const stateDrafts = story.document.sections.map((section, index) => { @@ -1283,7 +1284,7 @@ function lifecycleSpec(story: ResolvedStoryDocument): ArchifyLifecycle { const overlaps = drafts.slice(0, position).some((other, otherIndex) => { const otherCenter = centers[cols[otherIndex]!]!; const otherRight = otherCenter + other.width / 2; - return left - otherRight < 32; + return left - otherRight < lifecycleMinimumRouteLength; }); if (overlaps) continue; search( diff --git a/packages/site/tests/e2e/archify-story.spec.ts b/packages/site/tests/e2e/archify-story.spec.ts index 2533c38..6fa85ed 100644 --- a/packages/site/tests/e2e/archify-story.spec.ts +++ b/packages/site/tests/e2e/archify-story.spec.ts @@ -2,6 +2,7 @@ import { mkdir, readFile, writeFile } from "node:fs/promises"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { expect } from "@playwright/test"; +import { expectCanonicalRasterFigure } from "./helpers/raster-figure.js"; import { commit, startTopoServer, @@ -592,10 +593,9 @@ test("actual Architecture exports preserve canonical geometry and labels", async const png = await readFile(pngPath!); expect(png.subarray(1, 4).toString("ascii")).toBe("PNG"); const pngWidth = png.readUInt32BE(16); - const pngHeight = png.readUInt32BE(20); const svgWidth = svgDimensions!.width; const svgHeight = svgDimensions!.height; - expect(pngWidth / svgWidth).toBe(pngHeight / svgHeight); + expectCanonicalRasterFigure(png, { width: svgWidth, height: svgHeight }); expect(pngWidth).toBeGreaterThanOrEqual(svgWidth); await expect(viewer.locator("html")) .toHaveAttribute("data-last-export-format", "png"); diff --git a/packages/site/tests/e2e/dataflow-story.spec.ts b/packages/site/tests/e2e/dataflow-story.spec.ts index f659fb4..b80a9a1 100644 --- a/packages/site/tests/e2e/dataflow-story.spec.ts +++ b/packages/site/tests/e2e/dataflow-story.spec.ts @@ -3,6 +3,7 @@ import type { Server } from "node:http"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { expect } from "@playwright/test"; +import { expectCanonicalRasterFigure } from "./helpers/raster-figure.js"; import { commit, startStaticServer, @@ -1060,7 +1061,7 @@ test("established long Dataflow bodies retain pinned native geometry and exports const pngHeight = png.readUInt32BE(20); expect(pngWidth).toBeGreaterThan(0); expect(pngHeight).toBeGreaterThan(0); - expect(pngWidth / pngHeight).toBeCloseTo(423 / 360, 2); + expectCanonicalRasterFigure(png, { width: 423, height: 360 }); await expect(viewer.locator("html")) .toHaveAttribute("data-last-export-canonical", "true"); } finally { @@ -1265,7 +1266,7 @@ test("final pinned Dataflow labels clear endpoint nodes and retain export geomet const pngHeight = png.readUInt32BE(20); expect(pngWidth).toBeGreaterThan(0); expect(pngHeight).toBeGreaterThan(0); - expect(pngWidth / pngHeight).toBeCloseTo(423 / 360, 2); + expectCanonicalRasterFigure(png, { width: 423, height: 360 }); await expect(viewer.locator("html")) .toHaveAttribute("data-last-export-canonical", "true"); } finally { @@ -1487,7 +1488,7 @@ test("small-font Dataflow labels satisfy native and final clearance", async ({ const pngHeight = png.readUInt32BE(20); expect(pngWidth).toBeGreaterThan(0); expect(pngHeight).toBeGreaterThan(0); - expect(pngWidth / pngHeight).toBeCloseTo(423 / 360, 2); + expectCanonicalRasterFigure(png, { width: 423, height: 360 }); await expect(viewer.locator("html")) .toHaveAttribute("data-last-export-canonical", "true"); } finally { @@ -1631,7 +1632,7 @@ test("long contained Dataflow labels retain final bounds and canonical exports", const pngHeight = png.readUInt32BE(20); expect(pngWidth).toBeGreaterThan(0); expect(pngHeight).toBeGreaterThan(0); - expect(pngWidth / pngHeight).toBeCloseTo(423 / 360, 2); + expectCanonicalRasterFigure(png, { width: 423, height: 360 }); await expect(viewer.locator("html")) .toHaveAttribute("data-last-export-canonical", "true"); } finally { diff --git a/packages/site/tests/e2e/helpers/raster-figure.ts b/packages/site/tests/e2e/helpers/raster-figure.ts new file mode 100644 index 0000000..86b5bdf --- /dev/null +++ b/packages/site/tests/e2e/helpers/raster-figure.ts @@ -0,0 +1,21 @@ +import { expect } from "@playwright/test"; + +export function expectCanonicalRasterFigure( + png: Buffer, + diagram: { readonly width: number; readonly height: number }, +): void { + expect([...png.subarray(0, 8)]).toEqual([137, 80, 78, 71, 13, 10, 26, 10]); + // Native v3 figures preserve the SVG at one scale inside 28px margins, + // 24px card padding and a 50px title row. These fixtures have no subtitle. + const figureWidth = diagram.width + 104; + const figureHeight = diagram.height + 154; + const scale = [4, 3, 2, 1].find((candidate) => + figureWidth * figureHeight * candidate ** 2 <= 16 * 1024 * 1024); + expect(scale, "Fixture must fit the native raster pixel budget").toBeDefined(); + const width = png.readUInt32BE(16); + const height = png.readUInt32BE(20); + expect(width).toBe(Math.round(figureWidth * scale!)); + expect(height).toBe(Math.round(figureHeight * scale!)); + expect((width - 104 * scale!) / diagram.width) + .toBe((height - 154 * scale!) / diagram.height); +} diff --git a/packages/site/tests/e2e/sequence-stories.spec.ts b/packages/site/tests/e2e/sequence-stories.spec.ts index 3d39774..fa86af8 100644 --- a/packages/site/tests/e2e/sequence-stories.spec.ts +++ b/packages/site/tests/e2e/sequence-stories.spec.ts @@ -417,7 +417,7 @@ test("Sequence final typography preserves wide participant titles", async ({ const viewer = page.frameLocator("[data-story-viewer]"); const diagram = viewer.locator('svg[role="img"]'); for (const section of wideSequenceStory.sections) { - await expect(viewer.getByText(section.body, { exact: true })) + await expect(diagram.getByText(section.body, { exact: true })) .toBeVisible(); } const measurement = await diagram.evaluate((svg) => { diff --git a/packages/site/tests/e2e/topo-packages-story.spec.ts b/packages/site/tests/e2e/topo-packages-story.spec.ts index 9109f62..9c757d6 100644 --- a/packages/site/tests/e2e/topo-packages-story.spec.ts +++ b/packages/site/tests/e2e/topo-packages-story.spec.ts @@ -2,6 +2,7 @@ import { access, cp, mkdir, readFile, writeFile } from "node:fs/promises"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { expect, type Page } from "@playwright/test"; +import { expectCanonicalRasterFigure } from "./helpers/raster-figure.js"; import { commit, startStaticServer, @@ -760,9 +761,7 @@ async function verifyRaggedArchitectureScenario( const png = await readFile(pngPath!); expect(png.subarray(1, 4).toString("ascii")).toBe("PNG"); const pngWidth = png.readUInt32BE(16); - const pngHeight = png.readUInt32BE(20); - expect(pngWidth / svgDimensions!.width) - .toBe(pngHeight / svgDimensions!.height); + expectCanonicalRasterFigure(png, svgDimensions!); expect(pngWidth).toBeGreaterThanOrEqual(svgDimensions!.width); await expect(frame.locator("html")) .toHaveAttribute("data-last-export-format", "png"); From 91b671f79a07bce1f11c0b389af8e8487fef04f6 Mon Sep 17 00:00:00 2001 From: Dylan McCurry Date: Mon, 28 Sep 2026 08:49:00 -0400 Subject: [PATCH 3/3] fix(diagram-core): stabilize v3 rendering context Use a consistent Lifecycle sans-serif stack across macOS and Linux while retaining glyph containment and the 12px floor. Resolve v3 output metadata only inside owned temporary directories, independent of caller files. Keep pristine vendor bytes unchanged. Refs #41 --- docs/renderer.md | 6 +++++- docs/story-preview.md | 3 +++ packages/diagram-core/src/index.ts | 5 +++-- packages/diagram-core/test/diagram-core.test.mjs | 13 +++++++++++++ packages/site/tests/e2e/archify-story.spec.ts | 12 +++++++++++- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/docs/renderer.md b/docs/renderer.md index 290ee03..ec04ac8 100644 --- a/docs/renderer.md +++ b/docs/renderer.md @@ -32,7 +32,11 @@ local patch must be separately listed with its upstream status. This pin has no vendor patches. The v3 adapter adds portable `meta.output` only to its generated renderer input; -authored Topocode stories retain their identity and schema. Lifecycle remains +authored Topocode stories retain their identity and schema. +Rendering runs in an owned temporary working directory, so resolving that +generated output field cannot depend on an unrelated `story.html` in the +caller's directory. +Lifecycle remains on the compatible native v1 geometry: state widths and column clearance account for final typography, preserving Topocode's 12px effective text requirement. The v3 viewer's own guided/story-view and ordinary share-card removal does not diff --git a/docs/story-preview.md b/docs/story-preview.md index 0adafa2..4982460 100644 --- a/docs/story-preview.md +++ b/docs/story-preview.md @@ -23,6 +23,9 @@ silently reuse a neighboring state's column. The Archify 3.0.0 adapter retains native Lifecycle schema v1; it reserves the native minimum route gap and sizes states for final 14.5px typography so the adaptive viewer still meets Topocode's 12px effective on-screen text floor. +Lifecycle uses an explicit Arial/Helvetica sans-serif stack rather than the +host's `system-ui` face, keeping wide-label fitting stable across the supported +macOS and Linux browser environments. Native v3 Lifecycle output omits empty bands and adds the terminal state's double border; neither changes authored state or transition membership. diff --git a/packages/diagram-core/src/index.ts b/packages/diagram-core/src/index.ts index 1a9f4d2..ad16048 100644 --- a/packages/diagram-core/src/index.ts +++ b/packages/diagram-core/src/index.ts @@ -1448,7 +1448,7 @@ svg g[data-edge-from] > text { svg text[data-node-label], svg text[font-size="10"][font-weight="600"], svg g[data-edge-from] > text { - font-family: ui-sans-serif, system-ui, sans-serif; + font-family: Arial, Helvetica, sans-serif; font-size: ${lifecycleFontSize}px; }`; const style = `