@swarmvaultai/engine 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SwarmVault
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -206,7 +206,7 @@ This matters because many "OpenAI-compatible" backends only implement part of th
206
206
  ### Compile + Query
207
207
 
208
208
  - `compileVault(rootDir, { approve })` writes wiki pages, graph data, and search state using the vault schema as guidance, or stages a review bundle
209
- - compile also writes graph orientation pages such as `wiki/graph/report.md`, `wiki/graph/report.json`, and `wiki/graph/communities/<community>.md`
209
+ - compile also writes graph orientation pages such as `wiki/graph/report.md`, `wiki/graph/share-card.md`, `wiki/graph/report.json`, and `wiki/graph/communities/<community>.md`
210
210
  - compile propagates semantic tags onto page frontmatter and source-backed graph nodes, and records deterministic `contradicts` edges plus a Contradictions section in the graph report when conflicting claims are found
211
211
  - `benchmarkVault(rootDir, { questions })` writes `state/benchmark.json` and folds the latest benchmark summary into `wiki/graph/report.md` and `wiki/graph/report.json`
212
212
  - semantic graph query and embedding-backed similarity enrichment cache vectors under `state/embeddings.json` so graph-semantic refresh stays incremental
@@ -218,6 +218,7 @@ This matters because many "OpenAI-compatible" backends only implement part of th
218
218
  - `explainGraphVault(rootDir, target)` returns node, community, neighbor, provenance, and group-pattern details
219
219
  - `listGraphHyperedges(rootDir, target?, limit?)` returns graph hyperedges globally or for a specific node/page target
220
220
  - `listGodNodes(rootDir, limit)` returns the most connected bridge-heavy graph nodes
221
+ - `buildGraphShareArtifact(...)` and `renderGraphShareMarkdown(...)` produce the post-ready graph summary used by `wiki/graph/share-card.md` and the CLI `graph share` command
221
222
  - project-aware compile also builds `wiki/projects/index.md` plus `wiki/projects/<project>/index.md` rollups without duplicating page trees
222
223
  - human-authored insight pages in `wiki/insights/` are indexed into search and available to query without being rewritten by compile
223
224
  - `chart` and `image` formats save wrapper markdown pages plus local output assets under `wiki/outputs/assets/<slug>/`
@@ -262,7 +263,7 @@ Running the engine produces a local workspace with these main areas:
262
263
  - `raw/sources/`: immutable source copies
263
264
  - `raw/assets/`: copied attachments referenced by ingested markdown bundles and remote URL ingests
264
265
  - `wiki/`: generated markdown pages, the append-only `log.md` activity trail, staged candidates, saved query outputs, exploration hub pages, and a human-only `insights/` area
265
- - `wiki/graph/`: generated graph report pages and per-community summaries derived from `state/graph.json`
266
+ - `wiki/graph/`: generated graph report pages, the share card, and per-community summaries derived from `state/graph.json`
266
267
  - `wiki/graph/report.json`: machine-readable graph report data used by the viewer and export surfaces
267
268
  - `wiki/outputs/assets/`: local chart/image artifacts and JSON manifests for saved visual outputs
268
269
  - `wiki/code/`: generated module pages for ingested code sources
File without changes
File without changes
File without changes
package/dist/index.d.ts CHANGED
@@ -1620,6 +1620,48 @@ interface GraphReportArtifact {
1620
1620
  warnings: string[];
1621
1621
  };
1622
1622
  }
1623
+ interface GraphShareArtifact {
1624
+ generatedAt: string;
1625
+ vaultName: string;
1626
+ tagline: string;
1627
+ overview: {
1628
+ sources: number;
1629
+ nodes: number;
1630
+ edges: number;
1631
+ pages: number;
1632
+ communities: number;
1633
+ };
1634
+ firstPartyOverview: {
1635
+ nodes: number;
1636
+ edges: number;
1637
+ pages: number;
1638
+ communities: number;
1639
+ };
1640
+ highlights: {
1641
+ topHubs: Array<{
1642
+ nodeId: string;
1643
+ label: string;
1644
+ degree?: number;
1645
+ }>;
1646
+ bridgeNodes: Array<{
1647
+ nodeId: string;
1648
+ label: string;
1649
+ bridgeScore?: number;
1650
+ }>;
1651
+ surprisingConnections: Array<{
1652
+ sourceLabel: string;
1653
+ targetLabel: string;
1654
+ relation: string;
1655
+ why: string;
1656
+ }>;
1657
+ suggestedQuestions: string[];
1658
+ };
1659
+ knowledgeGaps: string[];
1660
+ shortPost: string;
1661
+ relatedNodeIds: string[];
1662
+ relatedPageIds: string[];
1663
+ relatedSourceIds: string[];
1664
+ }
1623
1665
  interface ScheduledCompileTask {
1624
1666
  type: "compile";
1625
1667
  approve?: boolean;
@@ -1961,6 +2003,13 @@ type GraphPushInternalOptions = GraphPushNeo4jOptions & {
1961
2003
  };
1962
2004
  declare function pushGraphNeo4j(rootDir: string, options?: GraphPushInternalOptions): Promise<GraphPushResult>;
1963
2005
 
2006
+ declare function buildGraphShareArtifact(input: {
2007
+ graph: GraphArtifact;
2008
+ report?: GraphReportArtifact | null;
2009
+ vaultName?: string;
2010
+ }): GraphShareArtifact;
2011
+ declare function renderGraphShareMarkdown(artifact: GraphShareArtifact): string;
2012
+
1964
2013
  declare function graphDiff(oldGraph: GraphArtifact, newGraph: GraphArtifact): GraphDiffResult;
1965
2014
  /**
1966
2015
  * Compute the blast radius of changing a file/module by tracing reverse import
@@ -2564,4 +2613,4 @@ declare function createWebSearchAdapter(id: string, config: WebSearchProviderCon
2564
2613
  type WebSearchTaskId = "deepLintProvider" | "queryProvider" | "exploreProvider";
2565
2614
  declare function getWebSearchAdapterForTask(rootDir: string, task: WebSearchTaskId): Promise<WebSearchAdapter>;
2566
2615
 
2567
- export { ALL_MIGRATIONS, type AddOptions, type AddResult, type AgentType, type AnalyzedTerm, type ApprovalBundleType, type ApprovalChangeType, type ApprovalDetail, type ApprovalDiffHunk, type ApprovalDiffLine, type ApprovalEntry, type ApprovalEntryDetail, type ApprovalEntryLabel, type ApprovalEntryStatus, type ApprovalFrontmatterChange, type ApprovalManifest, type ApprovalStructuredDiff, type ApprovalSummary, type AudioTranscriptionRequest, type AudioTranscriptionResponse, type BenchmarkArtifact, type BenchmarkByClassEntry, type BenchmarkOptions, type BenchmarkQuestionResult, type BenchmarkSummary, type BlastRadiusResult, type CandidatePromotionConfig, type CandidateRecord, type ChartDatum, type ChartSpec, type ClaimStatus, type CodeAnalysis, type CodeDiagnostic, type CodeImport, type CodeIndexArtifact, type CodeIndexEntry, type CodeLanguage, type CodeSymbol, type CodeSymbolKind, type CommandRoleExecutorConfig, type CompileOptions, type CompileResult, type CompileState, type ConsolidationConfig, type ConsolidationPromotion, type ConsolidationResult, DEFAULT_CONSOLIDATION_CONFIG, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HALF_LIFE_DAYS_BY_SOURCE_CLASS, DEFAULT_PROMOTION_CONFIG, DEFAULT_REDACTION_PATTERNS, DEFAULT_STALE_THRESHOLD, type DegradationOutcome, type DirectoryIngestFailure, type DirectoryIngestResult, type DirectoryIngestSkip, type EmbeddingCacheArtifact, type EmbeddingCacheEntry, type EvidenceClass, type ExploreOptions, type ExploreResult, type ExploreStepResult, type ExtractionClaim, type ExtractionKind, type ExtractionTerm, type Freshness, type FreshnessConfig, type GenerationAttachment, type GenerationRequest, type GenerationResponse, type GitHookStatus, type GraphArtifact, type GraphDiffResult, type GraphEdge, type GraphExplainNeighbor, type GraphExplainResult, type GraphExportFormat, type GraphExportResult, type GraphHyperedge, type GraphNode, type GraphPage, type GraphPathResult, type GraphPushCounts, type GraphPushNeo4jOptions, type GraphPushResult, type GraphQueryMatch, type GraphQueryResult, type GraphReportArtifact, type GuidedSessionMode, type GuidedSourceSessionAnswers, type GuidedSourceSessionQuestion, type GuidedSourceSessionRecord, type GuidedSourceSessionStatus, type ImageGenerationRequest, type ImageGenerationResponse, type ImageVisionExtraction, type InboxImportResult, type InboxImportSkip, type IngestOptions, type InitOptions, type InputIngestResult, type InstallAgentOptions, type InstallAgentResult, LARGE_REPO_NODE_THRESHOLD, LOCAL_WHISPER_MODEL_SIZES, type LintFinding, type LintOptions, type LocalWhisperAdapterOptions, type LocalWhisperBinaryDiscovery, LocalWhisperProviderAdapter, type LocalWhisperSetupStatus, type ManagedSourceAddOptions, type ManagedSourceAddResult, type ManagedSourceDeleteResult, type ManagedSourceKind, type ManagedSourceRecord, type ManagedSourceReloadOptions, type ManagedSourceReloadResult, type ManagedSourceStatus, type ManagedSourceSyncCounts, type ManagedSourcesArtifact, type MemoryTier, type MigrationPlan, type MigrationResult, type MigrationStep, type Neo4jGraphSinkConfig, OPENAI_COMPATIBLE_CAPABILITY_MATRIX, type OpenAiCompatiblePresetId, type OrchestrationConfig, type OrchestrationFinding, type OrchestrationProposal, type OrchestrationRole, type OrchestrationRoleConfig, type OrchestrationRoleResult, type OutputAsset, type OutputAssetRole, type OutputFormat, type OutputOrigin, type PageKind, type PageManager, type PageStatus, type PendingSemanticRefreshEntry, type Polarity, type PromotionDecision, type PromotionGateKind, type PromotionGateResult, type PromotionSession, type ProviderAdapter, type ProviderCapability, type ProviderConfig, type ProviderPresetCapability, type ProviderRegistrationOptions, type ProviderRegistrationResult, type ProviderRoleExecutorConfig, type ProviderType, type QueryOptions, type QueryResult, type RedactionMatchSummary, type RedactionPatternConfig, type RedactionSettings, type RedactionSummary, type RepoSyncResult, type ResolvedLargeRepoDefaults, type ResolvedPaths, type ReviewActionResult, type RoleExecutorConfig, type SceneElement, type SceneSpec, type ScheduleController, type ScheduleJobConfig, type ScheduleStateRecord, type ScheduleTriggerConfig, type ScheduledCompileTask, type ScheduledConsolidateTask, type ScheduledExploreTask, type ScheduledLintTask, type ScheduledQueryTask, type ScheduledRunResult, type ScheduledTaskConfig, type SearchResult, type SourceAnalysis, type SourceAttachment, type SourceCaptureType, type SourceClaim, type SourceClass, type SourceExtractionArtifact, type SourceGuideResult, type SourceKind, type SourceManifest, type SourceRationale, type SourceReviewResult, type SynthesizedHubEdge, type SynthesizedHubNode, type SynthesizedHyperedgeHubs, type VaultConfig, type VaultDashboardPack, type VaultProfileConfig, type VaultProfilePreset, type VaultVersionRecord, type WatchConfig, type WatchController, type WatchOptions, type WatchRepoSyncResult, type WatchRunRecord, type WatchStatusResult, type WebSearchAdapter, type WebSearchProviderConfig, type WebSearchProviderType, type WebSearchResult, type WhisperRunResult, type WhisperRunner, acceptApproval, addInput, addManagedSource, addWatchedRoot, agentTypeSchema, applyDecayToPages, archiveCandidate, assertProviderCapability, autoCommitWikiChanges, benchmarkVault, blastRadius, blastRadiusVault, bootstrapDemo, buildConfiguredRedactor, buildRedactor, compileVault, computeDecayScore, consolidateVault, createMcpServer, createProvider, createSupersessionEdge, createWebSearchAdapter, defaultVaultConfig, defaultVaultSchema, deleteManagedSource, detectVaultVersion, discoverLocalWhisperBinary, downloadWhisperModel, estimatePageTokens, estimateTokens, evaluateCandidateForPromotion, expectedModelPath, explainGraphVault, exploreVault, exportGraphFormat, exportGraphHtml, exportGraphReportHtml, exportObsidianCanvas, exportObsidianVault, getGitHookStatus, getProviderForTask, getWatchStatus, getWebSearchAdapterForTask, getWorkspaceInfo, graphDiff, guideManagedSource, guideSourceScope, importInbox, ingestDirectory, ingestInput, ingestInputDetailed, initVault, initWorkspace, installAgent, installConfiguredAgents, installGitHooks, lintVault, listApprovals, listCandidates, listGodNodes, listGraphHyperedges, listManagedSourceRecords, listManifests, listPages, listSchedules, listTrackedRepoRoots, listWatchedRoots, loadVaultConfig, loadVaultSchema, loadVaultSchemas, lookupPresetCapabilities, markSuperseded, modelDownloadUrl, pathGraphVault, persistDecayFrontmatter, planMigration, previewCandidatePromotions, promoteCandidate, providerCapabilitySchema, providerTypeSchema, pushGraphNeo4j, queryGraphVault, queryVault, readApproval, readExtractedText, readGraphReport, readPage, registerLocalWhisperProvider, rejectApproval, reloadManagedSources, removeWatchedRoot, resetDecay, resolveConsolidationConfig, resolveDecayConfig, resolveLargeRepoDefaults, resolvePaths, resolveRedactionPatterns, resolveWatchedRepoRoots, resumeSourceSession, reviewManagedSource, reviewSourceScope, runAutoPromotion, runConsolidation, runDecayPass, runMigration, runSchedule, runWatchCycle, searchVault, serveSchedules, stageGeneratedOutputPages, startGraphServer, startMcpServer, summarizeLocalWhisperSetup, syncTrackedRepos, syncTrackedReposForWatch, synthesizeHyperedgeHubs, trimToTokenBudget, uninstallGitHooks, watchVault, webSearchProviderTypeSchema, withCapabilityFallback };
2616
+ export { ALL_MIGRATIONS, type AddOptions, type AddResult, type AgentType, type AnalyzedTerm, type ApprovalBundleType, type ApprovalChangeType, type ApprovalDetail, type ApprovalDiffHunk, type ApprovalDiffLine, type ApprovalEntry, type ApprovalEntryDetail, type ApprovalEntryLabel, type ApprovalEntryStatus, type ApprovalFrontmatterChange, type ApprovalManifest, type ApprovalStructuredDiff, type ApprovalSummary, type AudioTranscriptionRequest, type AudioTranscriptionResponse, type BenchmarkArtifact, type BenchmarkByClassEntry, type BenchmarkOptions, type BenchmarkQuestionResult, type BenchmarkSummary, type BlastRadiusResult, type CandidatePromotionConfig, type CandidateRecord, type ChartDatum, type ChartSpec, type ClaimStatus, type CodeAnalysis, type CodeDiagnostic, type CodeImport, type CodeIndexArtifact, type CodeIndexEntry, type CodeLanguage, type CodeSymbol, type CodeSymbolKind, type CommandRoleExecutorConfig, type CompileOptions, type CompileResult, type CompileState, type ConsolidationConfig, type ConsolidationPromotion, type ConsolidationResult, DEFAULT_CONSOLIDATION_CONFIG, DEFAULT_HALF_LIFE_DAYS, DEFAULT_HALF_LIFE_DAYS_BY_SOURCE_CLASS, DEFAULT_PROMOTION_CONFIG, DEFAULT_REDACTION_PATTERNS, DEFAULT_STALE_THRESHOLD, type DegradationOutcome, type DirectoryIngestFailure, type DirectoryIngestResult, type DirectoryIngestSkip, type EmbeddingCacheArtifact, type EmbeddingCacheEntry, type EvidenceClass, type ExploreOptions, type ExploreResult, type ExploreStepResult, type ExtractionClaim, type ExtractionKind, type ExtractionTerm, type Freshness, type FreshnessConfig, type GenerationAttachment, type GenerationRequest, type GenerationResponse, type GitHookStatus, type GraphArtifact, type GraphDiffResult, type GraphEdge, type GraphExplainNeighbor, type GraphExplainResult, type GraphExportFormat, type GraphExportResult, type GraphHyperedge, type GraphNode, type GraphPage, type GraphPathResult, type GraphPushCounts, type GraphPushNeo4jOptions, type GraphPushResult, type GraphQueryMatch, type GraphQueryResult, type GraphReportArtifact, type GraphShareArtifact, type GuidedSessionMode, type GuidedSourceSessionAnswers, type GuidedSourceSessionQuestion, type GuidedSourceSessionRecord, type GuidedSourceSessionStatus, type ImageGenerationRequest, type ImageGenerationResponse, type ImageVisionExtraction, type InboxImportResult, type InboxImportSkip, type IngestOptions, type InitOptions, type InputIngestResult, type InstallAgentOptions, type InstallAgentResult, LARGE_REPO_NODE_THRESHOLD, LOCAL_WHISPER_MODEL_SIZES, type LintFinding, type LintOptions, type LocalWhisperAdapterOptions, type LocalWhisperBinaryDiscovery, LocalWhisperProviderAdapter, type LocalWhisperSetupStatus, type ManagedSourceAddOptions, type ManagedSourceAddResult, type ManagedSourceDeleteResult, type ManagedSourceKind, type ManagedSourceRecord, type ManagedSourceReloadOptions, type ManagedSourceReloadResult, type ManagedSourceStatus, type ManagedSourceSyncCounts, type ManagedSourcesArtifact, type MemoryTier, type MigrationPlan, type MigrationResult, type MigrationStep, type Neo4jGraphSinkConfig, OPENAI_COMPATIBLE_CAPABILITY_MATRIX, type OpenAiCompatiblePresetId, type OrchestrationConfig, type OrchestrationFinding, type OrchestrationProposal, type OrchestrationRole, type OrchestrationRoleConfig, type OrchestrationRoleResult, type OutputAsset, type OutputAssetRole, type OutputFormat, type OutputOrigin, type PageKind, type PageManager, type PageStatus, type PendingSemanticRefreshEntry, type Polarity, type PromotionDecision, type PromotionGateKind, type PromotionGateResult, type PromotionSession, type ProviderAdapter, type ProviderCapability, type ProviderConfig, type ProviderPresetCapability, type ProviderRegistrationOptions, type ProviderRegistrationResult, type ProviderRoleExecutorConfig, type ProviderType, type QueryOptions, type QueryResult, type RedactionMatchSummary, type RedactionPatternConfig, type RedactionSettings, type RedactionSummary, type RepoSyncResult, type ResolvedLargeRepoDefaults, type ResolvedPaths, type ReviewActionResult, type RoleExecutorConfig, type SceneElement, type SceneSpec, type ScheduleController, type ScheduleJobConfig, type ScheduleStateRecord, type ScheduleTriggerConfig, type ScheduledCompileTask, type ScheduledConsolidateTask, type ScheduledExploreTask, type ScheduledLintTask, type ScheduledQueryTask, type ScheduledRunResult, type ScheduledTaskConfig, type SearchResult, type SourceAnalysis, type SourceAttachment, type SourceCaptureType, type SourceClaim, type SourceClass, type SourceExtractionArtifact, type SourceGuideResult, type SourceKind, type SourceManifest, type SourceRationale, type SourceReviewResult, type SynthesizedHubEdge, type SynthesizedHubNode, type SynthesizedHyperedgeHubs, type VaultConfig, type VaultDashboardPack, type VaultProfileConfig, type VaultProfilePreset, type VaultVersionRecord, type WatchConfig, type WatchController, type WatchOptions, type WatchRepoSyncResult, type WatchRunRecord, type WatchStatusResult, type WebSearchAdapter, type WebSearchProviderConfig, type WebSearchProviderType, type WebSearchResult, type WhisperRunResult, type WhisperRunner, acceptApproval, addInput, addManagedSource, addWatchedRoot, agentTypeSchema, applyDecayToPages, archiveCandidate, assertProviderCapability, autoCommitWikiChanges, benchmarkVault, blastRadius, blastRadiusVault, bootstrapDemo, buildConfiguredRedactor, buildGraphShareArtifact, buildRedactor, compileVault, computeDecayScore, consolidateVault, createMcpServer, createProvider, createSupersessionEdge, createWebSearchAdapter, defaultVaultConfig, defaultVaultSchema, deleteManagedSource, detectVaultVersion, discoverLocalWhisperBinary, downloadWhisperModel, estimatePageTokens, estimateTokens, evaluateCandidateForPromotion, expectedModelPath, explainGraphVault, exploreVault, exportGraphFormat, exportGraphHtml, exportGraphReportHtml, exportObsidianCanvas, exportObsidianVault, getGitHookStatus, getProviderForTask, getWatchStatus, getWebSearchAdapterForTask, getWorkspaceInfo, graphDiff, guideManagedSource, guideSourceScope, importInbox, ingestDirectory, ingestInput, ingestInputDetailed, initVault, initWorkspace, installAgent, installConfiguredAgents, installGitHooks, lintVault, listApprovals, listCandidates, listGodNodes, listGraphHyperedges, listManagedSourceRecords, listManifests, listPages, listSchedules, listTrackedRepoRoots, listWatchedRoots, loadVaultConfig, loadVaultSchema, loadVaultSchemas, lookupPresetCapabilities, markSuperseded, modelDownloadUrl, pathGraphVault, persistDecayFrontmatter, planMigration, previewCandidatePromotions, promoteCandidate, providerCapabilitySchema, providerTypeSchema, pushGraphNeo4j, queryGraphVault, queryVault, readApproval, readExtractedText, readGraphReport, readPage, registerLocalWhisperProvider, rejectApproval, reloadManagedSources, removeWatchedRoot, renderGraphShareMarkdown, resetDecay, resolveConsolidationConfig, resolveDecayConfig, resolveLargeRepoDefaults, resolvePaths, resolveRedactionPatterns, resolveWatchedRepoRoots, resumeSourceSession, reviewManagedSource, reviewSourceScope, runAutoPromotion, runConsolidation, runDecayPass, runMigration, runSchedule, runWatchCycle, searchVault, serveSchedules, stageGeneratedOutputPages, startGraphServer, startMcpServer, summarizeLocalWhisperSetup, syncTrackedRepos, syncTrackedReposForWatch, synthesizeHyperedgeHubs, trimToTokenBudget, uninstallGitHooks, watchVault, webSearchProviderTypeSchema, withCapabilityFallback };
package/dist/index.js CHANGED
@@ -7073,6 +7073,202 @@ function enrichGraph(graph, manifests, analyses, extraSimilarityEdges = [], opti
7073
7073
  };
7074
7074
  }
7075
7075
 
7076
+ // src/graph-share.ts
7077
+ function displayVaultName(value) {
7078
+ const trimmed = value?.trim();
7079
+ return trimmed ? trimmed : "this vault";
7080
+ }
7081
+ function sortedFallbackHubs(graph) {
7082
+ return graph.nodes.filter((node) => node.type !== "source").sort(
7083
+ (left, right) => (right.degree ?? 0) - (left.degree ?? 0) || (right.bridgeScore ?? 0) - (left.bridgeScore ?? 0) || left.label.localeCompare(right.label)
7084
+ ).slice(0, 5);
7085
+ }
7086
+ function graphNodeMap(graph) {
7087
+ return new Map(graph.nodes.map((node) => [node.id, node]));
7088
+ }
7089
+ function compactJoin(values, fallback) {
7090
+ const filtered = values.filter(Boolean);
7091
+ if (!filtered.length) {
7092
+ return fallback;
7093
+ }
7094
+ if (filtered.length === 1) {
7095
+ return filtered[0] ?? fallback;
7096
+ }
7097
+ if (filtered.length === 2) {
7098
+ return `${filtered[0]} and ${filtered[1]}`;
7099
+ }
7100
+ return `${filtered.slice(0, -1).join(", ")}, and ${filtered[filtered.length - 1]}`;
7101
+ }
7102
+ function buildShortPost(input) {
7103
+ const topHubLine = input.topHubs.length ? `Top hubs: ${compactJoin(
7104
+ input.topHubs.slice(0, 3).map((node) => node.label),
7105
+ "still emerging"
7106
+ )}.` : "Top hubs are still emerging.";
7107
+ const surprise = input.surprisingConnections[0];
7108
+ const surpriseLine = surprise ? `Most surprising link: ${surprise.sourceLabel} ${surprise.relation} ${surprise.targetLabel}.` : "The graph is ready for its first surprising connection.";
7109
+ return [
7110
+ `I scanned ${input.vaultName} with SwarmVault: ${input.overview.sources} sources -> ${input.overview.pages} wiki pages, ${input.overview.nodes} graph nodes, ${input.overview.edges} edges.`,
7111
+ topHubLine,
7112
+ surpriseLine,
7113
+ "Everything stays local. Try: npm install -g @swarmvaultai/cli && swarmvault scan ./your-repo"
7114
+ ].join("\n");
7115
+ }
7116
+ function buildGraphShareArtifact(input) {
7117
+ const { graph, report } = input;
7118
+ const vaultName = displayVaultName(input.vaultName);
7119
+ const nodesById = graphNodeMap(graph);
7120
+ const fallbackHubs = sortedFallbackHubs(graph);
7121
+ const reportHubs = report?.godNodes.map((node) => {
7122
+ const graphNode = nodesById.get(node.nodeId);
7123
+ return {
7124
+ nodeId: node.nodeId,
7125
+ label: node.label ?? graphNode?.label ?? node.nodeId,
7126
+ degree: node.degree ?? graphNode?.degree
7127
+ };
7128
+ }) ?? [];
7129
+ const fallbackHubHighlights = fallbackHubs.map((node) => ({
7130
+ nodeId: node.id,
7131
+ label: node.label,
7132
+ degree: node.degree
7133
+ }));
7134
+ const topHubs = (reportHubs.length ? reportHubs : fallbackHubHighlights).slice(0, 5);
7135
+ const reportBridgeNodes = report?.bridgeNodes.map((node) => {
7136
+ const graphNode = nodesById.get(node.nodeId);
7137
+ return {
7138
+ nodeId: node.nodeId,
7139
+ label: node.label ?? graphNode?.label ?? node.nodeId,
7140
+ bridgeScore: node.bridgeScore ?? graphNode?.bridgeScore
7141
+ };
7142
+ }) ?? [];
7143
+ const fallbackBridgeNodes = fallbackHubs.map((node) => ({
7144
+ nodeId: node.id,
7145
+ label: node.label,
7146
+ bridgeScore: node.bridgeScore
7147
+ }));
7148
+ const bridgeNodes = (reportBridgeNodes.length ? reportBridgeNodes : fallbackBridgeNodes).slice(0, 3).filter((node) => node.label);
7149
+ const surprisingConnections = (report?.surprisingConnections ?? []).slice(0, 3).map((connection) => {
7150
+ const source = nodesById.get(connection.sourceNodeId);
7151
+ const target = nodesById.get(connection.targetNodeId);
7152
+ return {
7153
+ sourceLabel: source?.label ?? connection.sourceNodeId,
7154
+ targetLabel: target?.label ?? connection.targetNodeId,
7155
+ relation: connection.relation,
7156
+ why: truncate(connection.why || connection.explanation || "Cross-community connection", 180)
7157
+ };
7158
+ });
7159
+ const overview = {
7160
+ sources: graph.sources.length,
7161
+ nodes: report?.overview.nodes ?? graph.nodes.length,
7162
+ edges: report?.overview.edges ?? graph.edges.length,
7163
+ pages: report?.overview.pages ?? graph.pages.length,
7164
+ communities: report?.overview.communities ?? graph.communities?.length ?? 0
7165
+ };
7166
+ const firstPartyOverview = report?.firstPartyOverview ?? {
7167
+ nodes: graph.nodes.filter((node) => node.sourceClass === "first_party").length,
7168
+ edges: graph.edges.length,
7169
+ pages: graph.pages.filter((page) => page.sourceClass === "first_party").length,
7170
+ communities: graph.communities?.length ?? 0
7171
+ };
7172
+ const relatedNodeIds = uniqueBy([...topHubs.map((node) => node.nodeId), ...bridgeNodes.map((node) => node.nodeId)], (value) => value);
7173
+ const relatedPageIds = uniqueBy(
7174
+ relatedNodeIds.map((nodeId) => nodesById.get(nodeId)?.pageId).filter((pageId) => Boolean(pageId)),
7175
+ (value) => value
7176
+ );
7177
+ const relatedSourceIds = uniqueBy(
7178
+ [...graph.sources.map((source) => source.sourceId), ...relatedNodeIds.flatMap((nodeId) => nodesById.get(nodeId)?.sourceIds ?? [])],
7179
+ (value) => value
7180
+ );
7181
+ const knowledgeGaps = report?.knowledgeGaps?.warnings?.length ? report.knowledgeGaps.warnings.slice(0, 3) : report?.warnings?.length ? report.warnings.slice(0, 3) : [];
7182
+ const tagline = `A local-first map of ${vaultName}: ${overview.sources} sources compiled into ${overview.nodes} graph nodes and ${overview.pages} wiki pages.`;
7183
+ const artifact = {
7184
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
7185
+ vaultName,
7186
+ tagline,
7187
+ overview,
7188
+ firstPartyOverview,
7189
+ highlights: {
7190
+ topHubs,
7191
+ bridgeNodes,
7192
+ surprisingConnections,
7193
+ suggestedQuestions: (report?.suggestedQuestions ?? []).slice(0, 5)
7194
+ },
7195
+ knowledgeGaps,
7196
+ shortPost: "",
7197
+ relatedNodeIds,
7198
+ relatedPageIds,
7199
+ relatedSourceIds
7200
+ };
7201
+ return {
7202
+ ...artifact,
7203
+ shortPost: buildShortPost({
7204
+ vaultName,
7205
+ overview,
7206
+ topHubs,
7207
+ surprisingConnections
7208
+ })
7209
+ };
7210
+ }
7211
+ function renderGraphShareMarkdown(artifact) {
7212
+ const lines = [
7213
+ "# SwarmVault Share Card",
7214
+ "",
7215
+ `> ${artifact.tagline}`,
7216
+ "",
7217
+ "## Snapshot",
7218
+ "",
7219
+ `- Sources: ${artifact.overview.sources}`,
7220
+ `- Wiki pages: ${artifact.overview.pages}`,
7221
+ `- Graph nodes: ${artifact.overview.nodes}`,
7222
+ `- Graph edges: ${artifact.overview.edges}`,
7223
+ `- Communities: ${artifact.overview.communities}`,
7224
+ `- First-party focus: ${artifact.firstPartyOverview.nodes} nodes, ${artifact.firstPartyOverview.edges} edges, ${artifact.firstPartyOverview.pages} pages`,
7225
+ "",
7226
+ "## Highlights",
7227
+ "",
7228
+ artifact.highlights.topHubs.length ? `- Top hubs: ${compactJoin(
7229
+ artifact.highlights.topHubs.slice(0, 5).map((node) => node.degree ? `${node.label} (${node.degree})` : node.label),
7230
+ "none yet"
7231
+ )}` : "- Top hubs: none yet",
7232
+ artifact.highlights.bridgeNodes.length ? `- Bridge nodes: ${compactJoin(
7233
+ artifact.highlights.bridgeNodes.slice(0, 3).map((node) => node.label),
7234
+ "none yet"
7235
+ )}` : "- Bridge nodes: none yet",
7236
+ ...artifact.highlights.surprisingConnections.length ? artifact.highlights.surprisingConnections.map(
7237
+ (connection) => `- Surprising link: ${connection.sourceLabel} ${connection.relation} ${connection.targetLabel}. ${connection.why}`
7238
+ ) : ["- Surprising link: not enough cross-community evidence yet"],
7239
+ "",
7240
+ "## Ask Next",
7241
+ "",
7242
+ ...artifact.highlights.suggestedQuestions.length ? artifact.highlights.suggestedQuestions.map((question) => `- ${question}`) : ["- Add more sources, run `swarmvault compile`, then ask the graph what changed."],
7243
+ "",
7244
+ "## Share Post",
7245
+ "",
7246
+ "```text",
7247
+ artifact.shortPost,
7248
+ "```",
7249
+ "",
7250
+ "## Reproduce",
7251
+ "",
7252
+ "```bash",
7253
+ "npm install -g @swarmvaultai/cli",
7254
+ "swarmvault scan ./your-repo",
7255
+ "swarmvault graph share --post",
7256
+ "```",
7257
+ ""
7258
+ ];
7259
+ if (artifact.knowledgeGaps.length) {
7260
+ lines.splice(
7261
+ lines.indexOf("## Ask Next"),
7262
+ 0,
7263
+ "## Gaps To Strengthen",
7264
+ "",
7265
+ ...artifact.knowledgeGaps.map((warning) => `- ${warning}`),
7266
+ ""
7267
+ );
7268
+ }
7269
+ return `${lines.join("\n")}`;
7270
+ }
7271
+
7076
7272
  // src/graph-query-core.ts
7077
7273
  var NODE_TYPE_PRIORITY = {
7078
7274
  concept: 6,
@@ -8907,6 +9103,65 @@ function buildGraphReportPage(input) {
8907
9103
  content: matter2.stringify(body, frontmatter)
8908
9104
  };
8909
9105
  }
9106
+ function buildGraphSharePage(input) {
9107
+ const pageId = "graph:share-card";
9108
+ const pathValue = "graph/share-card.md";
9109
+ const artifact = buildGraphShareArtifact({
9110
+ graph: input.graph,
9111
+ report: input.report,
9112
+ vaultName: input.vaultName
9113
+ });
9114
+ const frontmatter = {
9115
+ page_id: pageId,
9116
+ kind: "graph_report",
9117
+ cssclasses: cssclassesFor("graph_report"),
9118
+ title: "Share Card",
9119
+ tags: ["graph", "share"],
9120
+ source_ids: artifact.relatedSourceIds,
9121
+ project_ids: [],
9122
+ node_ids: artifact.relatedNodeIds,
9123
+ freshness: "fresh",
9124
+ status: input.metadata.status,
9125
+ confidence: input.metadata.confidence,
9126
+ created_at: input.metadata.createdAt,
9127
+ updated_at: input.metadata.updatedAt,
9128
+ compiled_from: input.metadata.compiledFrom,
9129
+ managed_by: input.metadata.managedBy,
9130
+ backlinks: [],
9131
+ schema_hash: input.schemaHash,
9132
+ source_hashes: {},
9133
+ source_semantic_hashes: {},
9134
+ related_page_ids: artifact.relatedPageIds,
9135
+ related_node_ids: artifact.relatedNodeIds,
9136
+ related_source_ids: artifact.relatedSourceIds
9137
+ };
9138
+ return {
9139
+ page: {
9140
+ id: pageId,
9141
+ path: pathValue,
9142
+ title: "Share Card",
9143
+ kind: "graph_report",
9144
+ sourceIds: artifact.relatedSourceIds,
9145
+ projectIds: [],
9146
+ nodeIds: artifact.relatedNodeIds,
9147
+ freshness: "fresh",
9148
+ status: input.metadata.status,
9149
+ confidence: input.metadata.confidence,
9150
+ backlinks: [],
9151
+ schemaHash: input.schemaHash,
9152
+ sourceHashes: {},
9153
+ sourceSemanticHashes: {},
9154
+ relatedPageIds: artifact.relatedPageIds,
9155
+ relatedNodeIds: artifact.relatedNodeIds,
9156
+ relatedSourceIds: artifact.relatedSourceIds,
9157
+ createdAt: input.metadata.createdAt,
9158
+ updatedAt: input.metadata.updatedAt,
9159
+ compiledFrom: input.metadata.compiledFrom,
9160
+ managedBy: input.metadata.managedBy
9161
+ },
9162
+ content: matter2.stringify(renderGraphShareMarkdown(artifact), frontmatter)
9163
+ };
9164
+ }
8910
9165
  function buildCommunitySummaryPage(input) {
8911
9166
  const pageId = `graph:${input.community.id}`;
8912
9167
  const pathValue = communityPagePath(input.community.id);
@@ -22641,8 +22896,23 @@ async function buildGraphOrientationPages(graph, paths, schemaHash, previousComp
22641
22896
  report
22642
22897
  })
22643
22898
  );
22899
+ const shareRecord = await buildManagedGraphPage(
22900
+ path26.join(paths.wikiDir, "graph", "share-card.md"),
22901
+ {
22902
+ managedBy: "system",
22903
+ compiledFrom: uniqueStrings4(graph.pages.flatMap((page) => page.sourceIds)),
22904
+ confidence: 1
22905
+ },
22906
+ (metadata) => buildGraphSharePage({
22907
+ graph,
22908
+ schemaHash,
22909
+ metadata,
22910
+ report,
22911
+ vaultName: path26.basename(paths.rootDir)
22912
+ })
22913
+ );
22644
22914
  return {
22645
- records: [reportRecord, ...communityRecords],
22915
+ records: [reportRecord, shareRecord, ...communityRecords],
22646
22916
  report
22647
22917
  };
22648
22918
  }
@@ -26615,7 +26885,7 @@ async function getWatchStatus(rootDir) {
26615
26885
  }
26616
26886
 
26617
26887
  // src/mcp.ts
26618
- var SERVER_VERSION = "1.1.0";
26888
+ var SERVER_VERSION = "1.2.0";
26619
26889
  async function createMcpServer(rootDir) {
26620
26890
  const server = new McpServer({
26621
26891
  name: "swarmvault",
@@ -30072,6 +30342,7 @@ export {
30072
30342
  blastRadiusVault,
30073
30343
  bootstrapDemo,
30074
30344
  buildConfiguredRedactor,
30345
+ buildGraphShareArtifact,
30075
30346
  buildRedactor,
30076
30347
  compileVault,
30077
30348
  computeDecayScore,
@@ -30147,6 +30418,7 @@ export {
30147
30418
  rejectApproval,
30148
30419
  reloadManagedSources,
30149
30420
  removeWatchedRoot,
30421
+ renderGraphShareMarkdown,
30150
30422
  resetDecay,
30151
30423
  resolveConsolidationConfig,
30152
30424
  resolveDecayConfig,
@@ -331,7 +331,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
331
331
  `).concat(n.picking?`if(outColor.a == 0.0) discard;
332
332
  else outColor = vIndex;`:"",`
333
333
  }
334
- `),u=xB(r,i,s);u.aPosition=r.getAttribLocation(u,"aPosition"),u.aIndex=r.getAttribLocation(u,"aIndex"),u.aVertType=r.getAttribLocation(u,"aVertType"),u.aTransform=r.getAttribLocation(u,"aTransform"),u.aAtlasId=r.getAttribLocation(u,"aAtlasId"),u.aTex=r.getAttribLocation(u,"aTex"),u.aPointAPointB=r.getAttribLocation(u,"aPointAPointB"),u.aPointCPointD=r.getAttribLocation(u,"aPointCPointD"),u.aLineWidth=r.getAttribLocation(u,"aLineWidth"),u.aColor=r.getAttribLocation(u,"aColor"),u.aCornerRadius=r.getAttribLocation(u,"aCornerRadius"),u.aBorderColor=r.getAttribLocation(u,"aBorderColor"),u.uPanZoomMatrix=r.getUniformLocation(u,"uPanZoomMatrix"),u.uAtlasSize=r.getUniformLocation(u,"uAtlasSize"),u.uBGColor=r.getUniformLocation(u,"uBGColor"),u.uZoom=r.getUniformLocation(u,"uZoom"),u.uTextures=[];for(var f=0;f<this.batchManager.getMaxAtlasesPerBatch();f++)u.uTextures.push(r.getUniformLocation(u,"uTexture".concat(f)));return u}},{key:"_createVAO",value:function(){var n=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=n.length/2;var r=this.maxInstances,i=this.gl,l=this.program,s=i.createVertexArray();return i.bindVertexArray(s),NB(i,"vec2",l.aPosition,n),this.transformBuffer=RB(i,r,l.aTransform),this.indexBuffer=Ea(i,r,"vec4",l.aIndex),this.vertTypeBuffer=Ea(i,r,"int",l.aVertType),this.atlasIdBuffer=Ea(i,r,"int",l.aAtlasId),this.texBuffer=Ea(i,r,"vec4",l.aTex),this.pointAPointBBuffer=Ea(i,r,"vec4",l.aPointAPointB),this.pointCPointDBuffer=Ea(i,r,"vec4",l.aPointCPointD),this.lineWidthBuffer=Ea(i,r,"vec2",l.aLineWidth),this.colorBuffer=Ea(i,r,"vec4",l.aColor),this.cornerRadiusBuffer=Ea(i,r,"vec4",l.aCornerRadius),this.borderColorBuffer=Ea(i,r,"vec4",l.aBorderColor),i.bindVertexArray(null),s}},{key:"buffers",get:function(){var n=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(r){return Ri(r,"Buffer")}).map(function(r){return n[r]})),this._buffers}},{key:"startFrame",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:iu.SCREEN;this.panZoomMatrix=n,this.renderTarget=r,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(n,r){return n.visible()?r&&r.isVisible?r.isVisible(n):!0:!1}},{key:"drawTexture",value:function(n,r,i){var l=this.atlasManager,s=this.batchManager,u=l.getRenderTypeOpts(i);if(this._isVisible(n,u)&&!(n.isEdge()&&!this._isValidEdge(n))){if(this.renderTarget.picking&&u.getTexPickingMode){var f=u.getTexPickingMode(n);if(f===Vf.IGNORE)return;if(f==Vf.USE_BB){this.drawPickingRectangle(n,r,i);return}}var c=l.getAtlasInfo(n,i),h=Nr(c),v;try{for(h.s();!(v=h.n()).done;){var p=v.value,m=p.atlas,y=p.tex1,w=p.tex2;s.canAddToCurrentBatch(m)||this.endBatch();for(var S=s.getAtlasIndexForBatch(m),x=0,C=[[y,!0],[w,!1]];x<C.length;x++){var T=Pn(C[x],2),A=T[0],N=T[1];if(A.w!=0){var k=this.instanceCount;this.vertTypeBuffer.getView(k)[0]=ep;var _=this.indexBuffer.getView(k);ys(r,_);var O=this.atlasIdBuffer.getView(k);O[0]=S;var P=this.texBuffer.getView(k);P[0]=A.x,P[1]=A.y,P[2]=A.w,P[3]=A.h;var M=this.transformBuffer.getMatrixView(k);this.setTransformMatrix(n,M,u,p,N),this.instanceCount++,N||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(F){h.e(F)}finally{h.f()}}}},{key:"setTransformMatrix",value:function(n,r,i,l){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,u=0;if(i.shapeProps&&i.shapeProps.padding&&(u=n.pstyle(i.shapeProps.padding).pfValue),l){var f=l.bb,c=l.tex1,h=l.tex2,v=c.w/(c.w+h.w);s||(v=1-v);var p=this._getAdjustedBB(f,u,s,v);this._applyTransformMatrix(r,p,i,n)}else{var m=i.getBoundingBox(n),y=this._getAdjustedBB(m,u,!0,1);this._applyTransformMatrix(r,y,i,n)}}},{key:"_applyTransformMatrix",value:function(n,r,i,l){var s,u;ow(n);var f=i.getRotation?i.getRotation(l):0;if(f!==0){var c=i.getRotationPoint(l),h=c.x,v=c.y;Rf(n,n,[h,v]),uw(n,n,f);var p=i.getRotationOffset(l);s=p.x+(r.xOffset||0),u=p.y+(r.yOffset||0)}else s=r.x1,u=r.y1;Rf(n,n,[s,u]),jp(n,n,[r.w,r.h])}},{key:"_getAdjustedBB",value:function(n,r,i,l){var s=n.x1,u=n.y1,f=n.w,c=n.h,h=n.yOffset;r&&(s-=r,u-=r,f+=2*r,c+=2*r);var v=0,p=f*l;return i&&l<1?f=p:!i&&l<1&&(v=f-p,s+=v,f=p),{x1:s,y1:u,w:f,h:c,xOffset:v,yOffset:h}}},{key:"drawPickingRectangle",value:function(n,r,i){var l=this.atlasManager.getRenderTypeOpts(i),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=bs;var u=this.indexBuffer.getView(s);ys(r,u);var f=this.colorBuffer.getView(s);gl([0,0,0],1,f);var c=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(n,c,l),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(n,r,i){var l=this.simpleShapeOptions.get(i);if(this._isVisible(n,l)){var s=l.shapeProps,u=this._getVertTypeForShape(n,s.shape);if(u===void 0||l.isSimple&&!l.isSimple(n,this.renderTarget)){this.drawTexture(n,r,i);return}var f=this.instanceCount;if(this.vertTypeBuffer.getView(f)[0]=u,u===cf||u===$o){var c=l.getBoundingBox(n),h=this._getCornerRadius(n,s.radius,c),v=this.cornerRadiusBuffer.getView(f);v[0]=h,v[1]=h,v[2]=h,v[3]=h,u===$o&&(v[0]=0,v[2]=0)}var p=this.indexBuffer.getView(f);ys(r,p);var m=this.renderTarget.picking?1:n.pstyle(s.opacity).value,y=n.pstyle(s.color).value,w=this.colorBuffer.getView(f);gl(y,m,w);var S=this.lineWidthBuffer.getView(f);if(S[0]=0,S[1]=0,s.border){var x=n.pstyle("border-width").value;if(x>0){var C=n.pstyle("border-color").value,T=n.pstyle("border-opacity").value,A=this.borderColorBuffer.getView(f);gl(C,T,A);var N=n.pstyle("border-position").value;if(N==="inside")S[0]=0,S[1]=-x;else if(N==="outside")S[0]=x,S[1]=0;else{var k=x/2;S[0]=k,S[1]=-k}}}var _=this.transformBuffer.getMatrixView(f);this.setTransformMatrix(n,_,l),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(n,r){var i=n.pstyle(r).value;switch(i){case"rectangle":return bs;case"ellipse":return Ko;case"roundrectangle":case"round-rectangle":return cf;case"bottom-round-rectangle":return $o;default:return}}},{key:"_getCornerRadius",value:function(n,r,i){var l=i.w,s=i.h;if(n.pstyle(r).value==="auto")return zi(l,s);var u=n.pstyle(r).pfValue,f=l/2,c=s/2;return Math.min(u,c,f)}},{key:"drawEdgeArrow",value:function(n,r,i){if(n.visible()){var l=n._private.rscratch,s,u,f;if(i==="source"?(s=l.arrowStartX,u=l.arrowStartY,f=l.srcArrowAngle):(s=l.arrowEndX,u=l.arrowEndY,f=l.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(u)||u==null||isNaN(f)||f==null)){var c=n.pstyle(i+"-arrow-shape").value;if(c!=="none"){var h=n.pstyle(i+"-arrow-color").value,v=n.pstyle("opacity").value,p=n.pstyle("line-opacity").value,m=v*p,y=n.pstyle("width").pfValue,w=n.pstyle("arrow-scale").value,S=this.r.getArrowWidth(y,w),x=this.instanceCount,C=this.transformBuffer.getMatrixView(x);ow(C),Rf(C,C,[s,u]),jp(C,C,[S,S]),uw(C,C,f),this.vertTypeBuffer.getView(x)[0]=tp;var T=this.indexBuffer.getView(x);ys(r,T);var A=this.colorBuffer.getView(x);gl(h,m,A),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(n,r){if(n.visible()){var i=this._getEdgePoints(n);if(i){var l=n.pstyle("opacity").value,s=n.pstyle("line-opacity").value,u=n.pstyle("width").pfValue,f=n.pstyle("line-color").value,c=l*s;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=cw;var v=this.indexBuffer.getView(h);ys(r,v);var p=this.colorBuffer.getView(h);gl(f,c,p);var m=this.lineWidthBuffer.getView(h);m[0]=u;var y=this.pointAPointBBuffer.getView(h);y[0]=i[0],y[1]=i[1],y[2]=i[2],y[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var w=0;w<i.length-2;w+=2){var S=this.instanceCount;this.vertTypeBuffer.getView(S)[0]=fw;var x=this.indexBuffer.getView(S);ys(r,x);var C=this.colorBuffer.getView(S);gl(f,c,C);var T=this.lineWidthBuffer.getView(S);T[0]=u;var A=i[w-2],N=i[w-1],k=i[w],_=i[w+1],O=i[w+2],P=i[w+3],M=i[w+4],F=i[w+5];w==0&&(A=2*k-O+.001,N=2*_-P+.001),w==i.length-4&&(M=2*O-k+.001,F=2*P-_+.001);var U=this.pointAPointBBuffer.getView(S);U[0]=A,U[1]=N,U[2]=k,U[3]=_;var j=this.pointCPointDBuffer.getView(S);j[0]=O,j[1]=P,j[2]=M,j[3]=F,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(n){var r=n._private.rscratch;return!(r.badLine||r.allpts==null||isNaN(r.allpts[0]))}},{key:"_getEdgePoints",value:function(n){var r=n._private.rscratch;if(this._isValidEdge(n)){var i=r.allpts;if(i.length==4)return i;var l=this._getNumSegments(n);return this._getCurveSegmentPoints(i,l)}}},{key:"_getNumSegments",value:function(n){var r=15;return Math.min(Math.max(r,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(n,r){if(n.length==4)return n;for(var i=Array((r+1)*2),l=0;l<=r;l++)if(l==0)i[0]=n[0],i[1]=n[1];else if(l==r)i[l*2]=n[n.length-2],i[l*2+1]=n[n.length-1];else{var s=l/r;this._setCurvePoint(n,s,i,l*2)}return i}},{key:"_setCurvePoint",value:function(n,r,i,l){if(n.length<=2)i[l]=n[0],i[l+1]=n[1];else{for(var s=Array(n.length-2),u=0;u<s.length;u+=2){var f=(1-r)*n[u]+r*n[u+2],c=(1-r)*n[u+1]+r*n[u+3];s[u]=f,s[u+1]=c}return this._setCurvePoint(s,r,i,l)}}},{key:"endBatch",value:function(){var n=this.gl,r=this.vao,i=this.vertexCount,l=this.instanceCount;if(l!==0){var s=this.renderTarget.picking?this.pickingProgram:this.program;n.useProgram(s),n.bindVertexArray(r);var u=Nr(this.buffers),f;try{for(u.s();!(f=u.n()).done;){var c=f.value;c.bufferSubData(l)}}catch(y){u.e(y)}finally{u.f()}for(var h=this.batchManager.getAtlases(),v=0;v<h.length;v++)h[v].bufferIfNeeded(n);for(var p=0;p<h.length;p++)n.activeTexture(n.TEXTURE0+p),n.bindTexture(n.TEXTURE_2D,h[p].texture),n.uniform1i(s.uTextures[p],p);n.uniform1f(s.uZoom,SB(this.r)),n.uniformMatrix3fv(s.uPanZoomMatrix,!1,this.panZoomMatrix),n.uniform1i(s.uAtlasSize,this.batchManager.getAtlasSize());var m=gl(this.bgColor,1);n.uniform4fv(s.uBGColor,m),n.drawArraysInstanced(n.TRIANGLES,0,i,l),n.bindVertexArray(null),n.bindTexture(n.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:l,atlasCount:h.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var n=this.atlasManager.getDebugInfo(),r=n.reduce(function(s,u){return s+u.atlasCount},0),i=this.batchDebugInfo,l=i.reduce(function(s,u){return s+u.count},0);return{atlasInfo:n,totalAtlases:r,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:i.length,batchInfo:i,totalInstances:l}}}])})(),rT={};rT.initWebgl=function(t,e){var n=this,r=n.data.contexts[n.WEBGL];t.bgColor=VB(n),t.webglTexSize=Math.min(t.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),t.webglTexRows=Math.min(t.webglTexRows,54),t.webglTexRowsNodes=Math.min(t.webglTexRowsNodes,54),t.webglBatchSize=Math.min(t.webglBatchSize,16384),t.webglTexPerBatch=Math.min(t.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=t.webglDebug,n.webglDebugShowAtlases=t.webglDebugShowAtlases,n.pickingFrameBuffer=MB(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new GB(n,r,t);var i=function(v){return function(p){return n.getTextAngle(p,v)}},l=function(v){return function(p){var m=p.pstyle(v);return m&&m.value}},s=function(v){return function(p){return p.pstyle("".concat(v,"-opacity")).value>0}},u=function(v){var p=v.pstyle("text-events").strValue==="yes";return p?Vf.USE_BB:Vf.IGNORE},f=function(v){var p=v.position(),m=p.x,y=p.y,w=v.outerWidth(),S=v.outerHeight();return{w,h:S,x1:m-w/2,y1:y-S/2}};n.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),n.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),n.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),n.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:f,isSimple:TB,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),n.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:f,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),n.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:f,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),n.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:u,getKey:np(e.getLabelKey,null),getBoundingBox:rp(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:i(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:l("label")}),n.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:u,getKey:np(e.getSourceLabelKey,"source"),getBoundingBox:rp(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:i("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:l("source-label")}),n.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:u,getKey:np(e.getTargetLabelKey,"target"),getBoundingBox:rp(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:i("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:l("target-label")});var c=Au(function(){console.log("garbage collect flag set"),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(h,v){var p=!1;v&&v.length>0&&(p|=n.drawing.invalidate(v)),p&&c()}),$B(n)};function VB(t){var e=t.cy.container(),n=e&&e.style&&e.style.backgroundColor||"white";return RS(n)}function aT(t,e){var n=t._private.rscratch;return _r(n,"labelWrapCachedLines",e)||[]}var np=function(e,n){return function(r){var i=e(r),l=aT(r,n);return l.length>1?l.map(function(s,u){return"".concat(i,"_").concat(u)}):i}},rp=function(e,n){return function(r,i){var l=e(r);if(typeof i=="string"){var s=i.indexOf("_");if(s>0){var u=Number(i.substring(s+1)),f=aT(r,n),c=l.h/f.length,h=c*u,v=l.y1+h;return{x1:l.x1,w:l.w,y1:v,h:c,yOffset:h}}}return l}};function $B(t){{var e=t.render;t.render=function(l){l=l||{};var s=t.cy;t.webgl&&(s.zoom()>ZC?(KB(t),e.call(t,l)):(YB(t),lT(t,l,iu.SCREEN)))}}{var n=t.matchCanvasSize;t.matchCanvasSize=function(l){n.call(t,l),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(l,s,u,f){return eL(t,l,s)};{var r=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){r.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var i=t.notify;t.notify=function(l,s){i.call(t,l,s),l==="viewport"||l==="bounds"?t.pickingFrameBuffer.needsDraw=!0:l==="background"&&t.drawing.invalidate(s,{type:"node-body"})}}}function KB(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function YB(t){var e=function(r){r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,t.canvasWidth,t.canvasHeight),r.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function XB(t){var e=t.canvasWidth,n=t.canvasHeight,r=km(t),i=r.pan,l=r.zoom,s=Jg();Rf(s,s,[i.x,i.y]),jp(s,s,[l,l]);var u=Jg();BB(u,e,n);var f=Jg();return OB(f,u,s),f}function iT(t,e){var n=t.canvasWidth,r=t.canvasHeight,i=km(t),l=i.pan,s=i.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,n,r),e.translate(l.x,l.y),e.scale(s,s)}function ZB(t,e){t.drawSelectionRectangle(e,function(n){return iT(t,n)})}function QB(t){var e=t.data.contexts[t.NODE];e.save(),iT(t,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function WB(t){var e=function(i,l,s){for(var u=i.atlasManager.getAtlasCollection(l),f=t.data.contexts[t.NODE],c=u.atlases,h=0;h<c.length;h++){var v=c[h],p=v.canvas;if(p){var m=p.width,y=p.height,w=m*h,S=p.height*s,x=.4;f.save(),f.scale(x,x),f.drawImage(p,w,S),f.strokeStyle="black",f.rect(w,S,m,y),f.stroke(),f.restore()}}},n=0;e(t.drawing,"node",n++),e(t.drawing,"label",n++)}function JB(t,e,n,r,i){var l,s,u,f,c=km(t),h=c.pan,v=c.zoom;{var p=CB(t,h,v,e,n),m=Pn(p,2),y=m[0],w=m[1],S=6;l=y-S/2,s=w-S/2,u=S,f=S}if(u===0||f===0)return[];var x=t.data.contexts[t.WEBGL];x.bindFramebuffer(x.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(x.viewport(0,0,x.canvas.width,x.canvas.height),lT(t,null,iu.PICKING),t.pickingFrameBuffer.needsDraw=!1);var C=u*f,T=new Uint8Array(C*4);x.readPixels(l,s,u,f,x.RGBA,x.UNSIGNED_BYTE,T),x.bindFramebuffer(x.FRAMEBUFFER,null);for(var A=new Set,N=0;N<C;N++){var k=T.slice(N*4,N*4+4),_=AB(k)-1;_>=0&&A.add(_)}return A}function eL(t,e,n){var r=JB(t,e,n),i=t.getCachedZSortedEles(),l,s,u=Nr(r),f;try{for(u.s();!(f=u.n()).done;){var c=f.value,h=i[c];if(!l&&h.isNode()&&(l=h),!s&&h.isEdge()&&(s=h),l&&s)break}}catch(v){u.e(v)}finally{u.f()}return[l,s].filter(Boolean)}function ap(t,e,n){var r=t.drawing;e+=1,n.isNode()?(r.drawNode(n,e,"node-underlay"),r.drawNode(n,e,"node-body"),r.drawTexture(n,e,"label"),r.drawNode(n,e,"node-overlay")):(r.drawEdgeLine(n,e),r.drawEdgeArrow(n,e,"source"),r.drawEdgeArrow(n,e,"target"),r.drawTexture(n,e,"label"),r.drawTexture(n,e,"edge-source-label"),r.drawTexture(n,e,"edge-target-label"))}function lT(t,e,n){var r;t.webglDebug&&(r=performance.now());var i=t.drawing,l=0;if(n.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&ZB(t,e),t.data.canvasNeedsRedraw[t.NODE]||n.picking){var s=t.data.contexts[t.WEBGL];n.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var u=XB(t),f=t.getCachedZSortedEles();if(l=f.length,i.startFrame(u,n),n.screen){for(var c=0;c<f.nondrag.length;c++)ap(t,c,f.nondrag[c]);for(var h=0;h<f.drag.length;h++)ap(t,h,f.drag[h])}else if(n.picking)for(var v=0;v<f.length;v++)ap(t,v,f[v]);i.endFrame(),n.screen&&t.webglDebugShowAtlases&&(QB(t),WB(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var p=performance.now(),m=!1,y=Math.ceil(p-r),w=i.getDebugInfo(),S=["".concat(l," elements"),"".concat(w.totalInstances," instances"),"".concat(w.batchCount," batches"),"".concat(w.totalAtlases," atlases"),"".concat(w.wrappedCount," wrapped textures"),"".concat(w.simpleCount," simple shapes")].join(", ");if(m)console.log("WebGL (".concat(n.name,") - time ").concat(y,"ms, ").concat(S));else{console.log("WebGL (".concat(n.name,") - frame time ").concat(y,"ms")),console.log("Totals:"),console.log(" ".concat(S)),console.log("Texture Atlases Used:");var x=w.atlasInfo,C=Nr(x),T;try{for(C.s();!(T=C.n()).done;){var A=T.value;console.log(" ".concat(A.type,": ").concat(A.keyCount," keys, ").concat(A.atlasCount," atlases"))}}catch(N){C.e(N)}finally{C.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,i.gc())}var $i={};$i.drawPolygonPath=function(t,e,n,r,i,l){var s=r/2,u=i/2;t.beginPath&&t.beginPath(),t.moveTo(e+s*l[0],n+u*l[1]);for(var f=1;f<l.length/2;f++)t.lineTo(e+s*l[f*2],n+u*l[f*2+1]);t.closePath()};$i.drawRoundPolygonPath=function(t,e,n,r,i,l,s){s.forEach(function(u){return qC(t,u)}),t.closePath()};$i.drawRoundRectanglePath=function(t,e,n,r,i,l){var s=r/2,u=i/2,f=l==="auto"?zi(r,i):Math.min(l,u,s);t.beginPath&&t.beginPath(),t.moveTo(e,n-u),t.arcTo(e+s,n-u,e+s,n,f),t.arcTo(e+s,n+u,e,n+u,f),t.arcTo(e-s,n+u,e-s,n,f),t.arcTo(e-s,n-u,e,n-u,f),t.lineTo(e,n-u),t.closePath()};$i.drawBottomRoundRectanglePath=function(t,e,n,r,i,l){var s=r/2,u=i/2,f=l==="auto"?zi(r,i):l;t.beginPath&&t.beginPath(),t.moveTo(e,n-u),t.lineTo(e+s,n-u),t.lineTo(e+s,n),t.arcTo(e+s,n+u,e,n+u,f),t.arcTo(e-s,n+u,e-s,n,f),t.lineTo(e-s,n-u),t.lineTo(e,n-u),t.closePath()};$i.drawCutRectanglePath=function(t,e,n,r,i,l,s){var u=r/2,f=i/2,c=s==="auto"?gm():s;t.beginPath&&t.beginPath(),t.moveTo(e-u+c,n-f),t.lineTo(e+u-c,n-f),t.lineTo(e+u,n-f+c),t.lineTo(e+u,n+f-c),t.lineTo(e+u-c,n+f),t.lineTo(e-u+c,n+f),t.lineTo(e-u,n+f-c),t.lineTo(e-u,n-f+c),t.closePath()};$i.drawBarrelPath=function(t,e,n,r,i){var l=r/2,s=i/2,u=e-l,f=e+l,c=n-s,h=n+s,v=_p(r,i),p=v.widthOffset,m=v.heightOffset,y=v.ctrlPtOffsetPct*p;t.beginPath&&t.beginPath(),t.moveTo(u,c+m),t.lineTo(u,h-m),t.quadraticCurveTo(u+y,h,u+p,h),t.lineTo(f-p,h),t.quadraticCurveTo(f-y,h,f,h-m),t.lineTo(f,c+m),t.quadraticCurveTo(f-y,c,f-p,c),t.lineTo(u+p,c),t.quadraticCurveTo(u+y,c,u,c+m),t.closePath()};var dw=Math.sin(0),hw=Math.cos(0),Hp={},Gp={},sT=Math.PI/40;for(var Es=0*Math.PI;Es<2*Math.PI;Es+=sT)Hp[Es]=Math.sin(Es),Gp[Es]=Math.cos(Es);$i.drawEllipsePath=function(t,e,n,r,i){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,n,r/2,i/2,0,0,2*Math.PI);else for(var l,s,u=r/2,f=i/2,c=0*Math.PI;c<2*Math.PI;c+=sT)l=e-u*Hp[c]*dw+u*Gp[c]*hw,s=n+f*Gp[c]*dw+f*Hp[c]*hw,c===0?t.moveTo(l,s):t.lineTo(l,s);t.closePath()};var Ou={};Ou.createBuffer=function(t,e){var n=document.createElement("canvas");return n.width=t,n.height=e,[n,n.getContext("2d")]};Ou.bufferCanvasImage=function(t){var e=this.cy,n=e.mutableElements(),r=n.boundingBox(),i=this.findContainerClientCoords(),l=t.full?Math.ceil(r.w):i[2],s=t.full?Math.ceil(r.h):i[3],u=Ge(t.maxWidth)||Ge(t.maxHeight),f=this.getPixelRatio(),c=1;if(t.scale!==void 0)l*=t.scale,s*=t.scale,c=t.scale;else if(u){var h=1/0,v=1/0;Ge(t.maxWidth)&&(h=c*t.maxWidth/l),Ge(t.maxHeight)&&(v=c*t.maxHeight/s),c=Math.min(h,v),l*=c,s*=c}u||(l*=f,s*=f,c*=f);var p=document.createElement("canvas");p.width=l,p.height=s,p.style.width=l+"px",p.style.height=s+"px";var m=p.getContext("2d");if(l>0&&s>0){m.clearRect(0,0,l,s),m.globalCompositeOperation="source-over";var y=this.getCachedZSortedEles();if(t.full)m.translate(-r.x1*c,-r.y1*c),m.scale(c,c),this.drawElements(m,y),m.scale(1/c,1/c),m.translate(r.x1*c,r.y1*c);else{var w=e.pan(),S={x:w.x*c,y:w.y*c};c*=e.zoom(),m.translate(S.x,S.y),m.scale(c,c),this.drawElements(m,y),m.scale(1/c,1/c),m.translate(-S.x,-S.y)}t.bg&&(m.globalCompositeOperation="destination-over",m.fillStyle=t.bg,m.rect(0,0,l,s),m.fill())}return p};function tL(t,e){for(var n=atob(t),r=new ArrayBuffer(n.length),i=new Uint8Array(r),l=0;l<n.length;l++)i[l]=n.charCodeAt(l);return new Blob([r],{type:e})}function vw(t){var e=t.indexOf(",");return t.substr(e+1)}function oT(t,e,n){var r=function(){return e.toDataURL(n,t.quality)};switch(t.output){case"blob-promise":return new qs(function(i,l){try{e.toBlob(function(s){s!=null?i(s):l(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,t.quality)}catch(s){l(s)}});case"blob":return tL(vw(r()),n);case"base64":return vw(r());default:return r()}}Ou.png=function(t){return oT(t,this.bufferCanvasImage(t),"image/png")};Ou.jpg=function(t){return oT(t,this.bufferCanvasImage(t),"image/jpeg")};var uT={};uT.nodeShapeImpl=function(t,e,n,r,i,l,s,u){switch(t){case"ellipse":return this.drawEllipsePath(e,n,r,i,l);case"polygon":return this.drawPolygonPath(e,n,r,i,l,s);case"round-polygon":return this.drawRoundPolygonPath(e,n,r,i,l,s,u);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,n,r,i,l,u);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,n,r,i,l,s,u);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,n,r,i,l,u);case"barrel":return this.drawBarrelPath(e,n,r,i,l)}};var nL=cT,At=cT.prototype;At.CANVAS_LAYERS=3;At.SELECT_BOX=0;At.DRAG=1;At.NODE=2;At.WEBGL=3;At.CANVAS_TYPES=["2d","2d","2d","webgl2"];At.BUFFER_COUNT=3;At.TEXTURE_BUFFER=0;At.MOTIONBLUR_BUFFER_NODE=1;At.MOTIONBLUR_BUFFER_DRAG=2;function cT(t){var e=this,n=e.cy.window(),r=n.document;t.webgl&&(At.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(At.CANVAS_LAYERS),contexts:new Array(At.CANVAS_LAYERS),canvasNeedsRedraw:new Array(At.CANVAS_LAYERS),bufferCanvases:new Array(At.BUFFER_COUNT),bufferContexts:new Array(At.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",l="rgba(0,0,0,0)";e.data.canvasContainer=r.createElement("div");var s=e.data.canvasContainer.style;e.data.canvasContainer.style[i]=l,s.position="relative",s.zIndex="0",s.overflow="hidden";var u=t.cy.container();u.appendChild(e.data.canvasContainer),u.style[i]=l;var f={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};Zk()&&(f["-ms-touch-action"]="none",f["touch-action"]="none");for(var c=0;c<At.CANVAS_LAYERS;c++){var h=e.data.canvases[c]=r.createElement("canvas"),v=At.CANVAS_TYPES[c];e.data.contexts[c]=h.getContext(v),e.data.contexts[c]||mn("Could not create canvas of type "+v),Object.keys(f).forEach(function(ge){h.style[ge]=f[ge]}),h.style.position="absolute",h.setAttribute("data-id","layer"+c),h.style.zIndex=String(At.CANVAS_LAYERS-c),e.data.canvasContainer.appendChild(h),e.data.canvasNeedsRedraw[c]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[At.NODE].setAttribute("data-id","layer"+At.NODE+"-node"),e.data.canvases[At.SELECT_BOX].setAttribute("data-id","layer"+At.SELECT_BOX+"-selectbox"),e.data.canvases[At.DRAG].setAttribute("data-id","layer"+At.DRAG+"-drag"),e.data.canvases[At.WEBGL]&&e.data.canvases[At.WEBGL].setAttribute("data-id","layer"+At.WEBGL+"-webgl");for(var c=0;c<At.BUFFER_COUNT;c++)e.data.bufferCanvases[c]=r.createElement("canvas"),e.data.bufferContexts[c]=e.data.bufferCanvases[c].getContext("2d"),e.data.bufferCanvases[c].style.position="absolute",e.data.bufferCanvases[c].setAttribute("data-id","buffer"+c),e.data.bufferCanvases[c].style.zIndex=String(-c-1),e.data.bufferCanvases[c].style.visibility="hidden";e.pathsEnabled=!0;var p=yr(),m=function(te){return{x:(te.x1+te.x2)/2,y:(te.y1+te.y2)/2}},y=function(te){return{x:-te.w/2,y:-te.h/2}},w=function(te){var le=te[0]._private,fe=le.oldBackgroundTimestamp===le.backgroundTimestamp;return!fe},S=function(te){return te[0]._private.nodeKey},x=function(te){return te[0]._private.labelStyleKey},C=function(te){return te[0]._private.sourceLabelStyleKey},T=function(te){return te[0]._private.targetLabelStyleKey},A=function(te,le,fe,Ee,Re){return e.drawElement(te,le,fe,!1,!1,Re)},N=function(te,le,fe,Ee,Re){return e.drawElementText(te,le,fe,Ee,"main",Re)},k=function(te,le,fe,Ee,Re){return e.drawElementText(te,le,fe,Ee,"source",Re)},_=function(te,le,fe,Ee,Re){return e.drawElementText(te,le,fe,Ee,"target",Re)},O=function(te){return te.boundingBox(),te[0]._private.bodyBounds},P=function(te){return te.boundingBox(),te[0]._private.labelBounds.main||p},M=function(te){return te.boundingBox(),te[0]._private.labelBounds.source||p},F=function(te){return te.boundingBox(),te[0]._private.labelBounds.target||p},U=function(te,le){return le},j=function(te){return m(O(te))},K=function(te,le,fe){var Ee=te?te+"-":"";return{x:le.x+fe.pstyle(Ee+"text-margin-x").pfValue,y:le.y+fe.pstyle(Ee+"text-margin-y").pfValue}},$=function(te,le,fe){var Ee=te[0]._private.rscratch;return{x:Ee[le],y:Ee[fe]}},B=function(te){return K("",$(te,"labelX","labelY"),te)},H=function(te){return K("source",$(te,"sourceLabelX","sourceLabelY"),te)},Y=function(te){return K("target",$(te,"targetLabelX","targetLabelY"),te)},Q=function(te){return y(O(te))},z=function(te){return y(M(te))},I=function(te){return y(F(te))},q=function(te){var le=P(te),fe=y(P(te));if(te.isNode()){switch(te.pstyle("text-halign").value){case"left":fe.x=-le.w-(le.leftPad||0);break;case"right":fe.x=-(le.rightPad||0);break}switch(te.pstyle("text-valign").value){case"top":fe.y=-le.h-(le.topPad||0);break;case"bottom":fe.y=-(le.botPad||0);break}}return fe},L=e.data.eleTxrCache=new nu(e,{getKey:S,doesEleInvalidateKey:w,drawElement:A,getBoundingBox:O,getRotationPoint:j,getRotationOffset:Q,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),W=e.data.lblTxrCache=new nu(e,{getKey:x,drawElement:N,getBoundingBox:P,getRotationPoint:B,getRotationOffset:q,isVisible:U}),ae=e.data.slbTxrCache=new nu(e,{getKey:C,drawElement:k,getBoundingBox:M,getRotationPoint:H,getRotationOffset:z,isVisible:U}),se=e.data.tlbTxrCache=new nu(e,{getKey:T,drawElement:_,getBoundingBox:F,getRotationPoint:Y,getRotationOffset:I,isVisible:U}),me=e.data.lyrTxrCache=new QC(e);e.onUpdateEleCalcs(function(te,le){L.invalidateElements(le),W.invalidateElements(le),ae.invalidateElements(le),se.invalidateElements(le),me.invalidateElements(le);for(var fe=0;fe<le.length;fe++){var Ee=le[fe]._private;Ee.oldBackgroundTimestamp=Ee.backgroundTimestamp}});var ke=function(te){for(var le=0;le<te.length;le++)me.enqueueElementRefinement(te[le].ele)};L.onDequeue(ke),W.onDequeue(ke),ae.onDequeue(ke),se.onDequeue(ke),t.webgl&&e.initWebgl(t,{getStyleKey:S,getLabelKey:x,getSourceLabelKey:C,getTargetLabelKey:T,drawElement:A,drawLabel:N,drawSourceLabel:k,drawTargetLabel:_,getElementBox:O,getLabelBox:P,getSourceLabelBox:M,getTargetLabelBox:F,getElementRotationPoint:j,getElementRotationOffset:Q,getLabelRotationPoint:B,getSourceLabelRotationPoint:H,getTargetLabelRotationPoint:Y,getLabelRotationOffset:q,getSourceLabelRotationOffset:z,getTargetLabelRotationOffset:I})}At.redrawHint=function(t,e){var n=this;switch(t){case"eles":n.data.canvasNeedsRedraw[At.NODE]=e;break;case"drag":n.data.canvasNeedsRedraw[At.DRAG]=e;break;case"select":n.data.canvasNeedsRedraw[At.SELECT_BOX]=e;break;case"gc":n.data.gc=!0;break}};var rL=typeof Path2D<"u";At.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};At.usePaths=function(){return rL&&this.pathsEnabled};At.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};At.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};At.makeOffscreenCanvas=function(t,e){var n;if((typeof OffscreenCanvas>"u"?"undefined":Hn(OffscreenCanvas))!=="undefined")n=new OffscreenCanvas(t,e);else{var r=this.cy.window(),i=r.document;n=i.createElement("canvas"),n.width=t,n.height=e}return n};[WC,Aa,Wa,_m,Nl,Vi,br,rT,$i,Ou,uT].forEach(function(t){gt(At,t)});var aL=[{name:"null",impl:zC},{name:"base",impl:YC},{name:"canvas",impl:nL}],iL=[{type:"layout",extensions:NO},{type:"renderer",extensions:aL}],fT={},dT={};function hT(t,e,n){var r=n,i=function(O){Kt("Can not register `"+e+"` for `"+t+"` since `"+O+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(mu.prototype[e])return i(e);mu.prototype[e]=n}else if(t==="collection"){if(ar.prototype[e])return i(e);ar.prototype[e]=n}else if(t==="layout"){for(var l=function(O){this.options=O,n.call(this,O),Pt(this._private)||(this._private={}),this._private.cy=O.cy,this._private.listeners=[],this.createEmitter()},s=l.prototype=Object.create(n.prototype),u=[],f=0;f<u.length;f++){var c=u[f];s[c]=s[c]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var h=n.prototype.stop;s.stop=function(){var _=this.options;if(_&&_.animate){var O=this.animations;if(O)for(var P=0;P<O.length;P++)O[P].stop()}return h?h.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var v=function(O){return O._private.cy},p={addEventFields:function(O,P){P.layout=O,P.cy=v(O),P.target=O},bubble:function(){return!0},parent:function(O){return v(O)}};gt(s,{createEmitter:function(){return this._private.emitter=new ud(p,this),this},emitter:function(){return this._private.emitter},on:function(O,P){return this.emitter().on(O,P),this},one:function(O,P){return this.emitter().one(O,P),this},once:function(O,P){return this.emitter().one(O,P),this},removeListener:function(O,P){return this.emitter().removeListener(O,P),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(O,P){return this.emitter().emit(O,P),this}}),$t.eventAliasesOn(s),r=l}else if(t==="renderer"&&e!=="null"&&e!=="base"){var m=vT("renderer","base"),y=m.prototype,w=n,S=n.prototype,x=function(){m.apply(this,arguments),w.apply(this,arguments)},C=x.prototype;for(var T in y){var A=y[T],N=S[T]!=null;if(N)return i(T);C[T]=A}for(var k in S)C[k]=S[k];y.clientFunctions.forEach(function(_){C[_]=C[_]||function(){mn("Renderer does not implement `renderer."+_+"()` on its prototype")}}),r=x}else if(t==="__proto__"||t==="constructor"||t==="prototype")return mn(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return MS({map:fT,keys:[t,e],value:r})}function vT(t,e){return OS({map:fT,keys:[t,e]})}function lL(t,e,n,r,i){return MS({map:dT,keys:[t,e,n,r],value:i})}function sL(t,e,n,r){return OS({map:dT,keys:[t,e,n,r]})}var Vp=function(){if(arguments.length===2)return vT.apply(null,arguments);if(arguments.length===3)return hT.apply(null,arguments);if(arguments.length===4)return sL.apply(null,arguments);if(arguments.length===5)return lL.apply(null,arguments);mn("Invalid extension access syntax")};mu.prototype.extension=Vp;iL.forEach(function(t){t.extensions.forEach(function(e){hT(t.type,e.name,e.impl)})});var $f=function(){if(!(this instanceof $f))return new $f;this.length=0},Dl=$f.prototype;Dl.instanceString=function(){return"stylesheet"};Dl.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};Dl.css=function(t,e){var n=this.length-1;if(ut(t))this[n].properties.push({name:t,value:e});else if(Pt(t))for(var r=t,i=Object.keys(r),l=0;l<i.length;l++){var s=i[l],u=r[s];if(u!=null){var f=Zn.properties[s]||Zn.properties[Jf(s)];if(f!=null){var c=f.name,h=u;this[n].properties.push({name:c,value:h})}}}return this};Dl.style=Dl.css;Dl.generateStyle=function(t){var e=new Zn(t);return this.appendToStyle(e)};Dl.appendToStyle=function(t){for(var e=0;e<this.length;e++){var n=this[e],r=n.selector,i=n.properties;t.selector(r);for(var l=0;l<i.length;l++){var s=i[l];t.css(s.name,s.value)}}return t};var oL="3.33.2",Al=function(e){if(e===void 0&&(e={}),Pt(e))return new mu(e);if(ut(e))return Vp.apply(Vp,arguments)};Al.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(Al),t.apply(null,e),this};Al.warnings=function(t){return US(t)};Al.version=oL;Al.stylesheet=Al.Stylesheet=$f;const uL=[{id:"source",label:"Source",color:"#f59e0b",shape:"shape-round"},{id:"module",label:"Module",color:"#fb7185",shape:""},{id:"symbol",label:"Symbol",color:"#8b5cf6",shape:"shape-diamond"},{id:"rationale",label:"Rationale",color:"#14b8a6",shape:"shape-hex"},{id:"concept",label:"Concept",color:"#0ea5e9",shape:""},{id:"entity",label:"Entity",color:"#22c55e",shape:"shape-round"}],cL=[{label:"Structural (extracted)",color:"rgba(148, 163, 184, 0.7)",style:"line-solid"},{label:"Inferred",color:"rgba(56, 189, 248, 0.7)",style:"line-solid"},{label:"Conflicted",color:"var(--c-text-error)",style:"line-solid"},{label:"Similarity",color:"rgba(249, 115, 22, 0.7)",style:"line-dashed"}];function fL(){const[t,e]=pe.useState(!0);return t?D.jsxs("aside",{className:"canvas-legend","aria-label":"Graph legend",children:[D.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[D.jsx("span",{className:"canvas-legend-heading",children:"Legend"}),D.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>e(!1),"aria-label":"Hide legend",title:"Hide legend",children:"×"})]}),D.jsxs("div",{className:"canvas-legend-group",children:[D.jsx("span",{className:"label",children:"Nodes"}),uL.map(n=>D.jsxs("div",{className:"legend-row",children:[D.jsx("span",{className:`legend-swatch ${n.shape}`,style:{background:n.color},"aria-hidden":"true"}),D.jsx("span",{children:n.label})]},n.id))]}),D.jsxs("div",{className:"canvas-legend-group",style:{marginTop:"var(--sp-2)"},children:[D.jsx("span",{className:"label",children:"Edges"}),cL.map(n=>D.jsxs("div",{className:"legend-row",children:[D.jsx("span",{className:`legend-swatch ${n.style}`,style:{color:n.color},"aria-hidden":"true"}),D.jsx("span",{children:n.label})]},n.label))]})]}):D.jsx("button",{type:"button",className:"btn legend-toggle",onClick:()=>e(!0),title:"Show legend","aria-label":"Show legend",children:"Legend"})}const Ai=180,_i=120;function dL({cyRef:t}){const e=pe.useRef(null),n=pe.useRef(null),[r,i]=pe.useState(null);pe.useEffect(()=>{const s=t.current;if(!s)return;const u=()=>{const c=n.current?.getContext("2d");if(!c)return;c.clearRect(0,0,Ai,_i);const h=s.nodes();if(h.empty())return;const v=h.boundingBox({includeNodes:!0,includeEdges:!1}),p=v.w===0?1:v.w,m=v.h===0?1:v.h,y=Math.min((Ai-8)/p,(_i-8)/m),w=(Ai-p*y)/2,S=(_i-m*y)/2;c.fillStyle="rgba(125, 211, 252, 0.7)",h.forEach(k=>{const _=k.position(),O=(_.x-v.x1)*y+w,P=(_.y-v.y1)*y+S;c.beginPath(),c.arc(O,P,1.4,0,Math.PI*2),c.fill()});const x=s.extent(),C=(x.x1-v.x1)*y+w,T=(x.y1-v.y1)*y+S,A=(x.x2-x.x1)*y,N=(x.y2-x.y1)*y;i({x:Math.max(0,Math.min(Ai,C)),y:Math.max(0,Math.min(_i,T)),w:Math.max(2,Math.min(Ai,A)),h:Math.max(2,Math.min(_i,N))})};u();const f=()=>requestAnimationFrame(u);return s.on("pan zoom add remove position layoutstop",f),()=>{s.off("pan zoom add remove position layoutstop",f)}},[t]);const l=s=>{const u=t.current;if(!u||!e.current)return;const f=e.current.getBoundingClientRect(),c=s.clientX-f.left,h=s.clientY-f.top,v=u.nodes();if(v.empty())return;const p=v.boundingBox({includeNodes:!0,includeEdges:!1}),m=Math.min((Ai-8)/Math.max(1,p.w),(_i-8)/Math.max(1,p.h)),y=(Ai-p.w*m)/2,w=(_i-p.h*m)/2,S=(c-y)/m+p.x1,x=(h-w)/m+p.y1;u.center({position:()=>({x:S,y:x})})};return D.jsxs("div",{ref:e,className:"canvas-minimap",role:"presentation",onClick:l,"aria-hidden":"true",children:[D.jsx("canvas",{ref:n,width:Ai,height:_i,style:{width:"100%",height:"100%"}}),r?D.jsx("div",{className:"canvas-minimap-viewport",style:{left:r.x,top:r.y,width:r.w,height:r.h}}):null]})}function hL(t,e){const n=[],r=[];for(const i of t.hyperedges??[]){const l=i.nodeIds.filter(u=>e.has(u));if(l.length<2)continue;const s=`hyper:${i.id}`;n.push({data:{id:s,label:i.relation,hyperedgeId:i.id,relation:i.relation,isHub:!0,color:"#a78bfa"},classes:"hyper"});for(const u of l)r.push({data:{id:`hyper-edge:${i.id}:${u}`,source:s,target:u,relation:i.relation,hyperedgeId:i.id,isHubEdge:!0},classes:"hyperEdge"})}return{hubNodes:n,hubEdges:r}}function vL(t){typeof window>"u"||(window.__SWARMVAULT_TEST__={getNodeIds:()=>t.nodes().map(e=>e.id()),getConnectedNodePair:()=>{const e=t.edges()[0];return!e||e.empty()?null:{from:e.source().id(),to:e.target().id()}},getRenderedNodePosition:e=>{const n=t.getElementById(e);if(!n||n.empty())return null;const r=n.renderedPosition();return{x:r.x,y:r.y}},clearSelection:()=>{t.elements(":selected").unselect()},hasClass:(e,n)=>{const r=t.getElementById(e);return!r.empty()&&r.hasClass(n)}})}function gL(t,e){typeof window>"u"||!window.__SWARMVAULT_TEST__||e===t&&delete window.__SWARMVAULT_TEST__}const pL={source:"#f59e0b",module:"#fb7185",symbol:"#8b5cf6",rationale:"#14b8a6",concept:"#0ea5e9",entity:"#22c55e"},mL={cose:"Force (cose)",concentric:"Concentric",circle:"Circle",breadthfirst:"Hierarchy",grid:"Grid"},yL={cose:{name:"cose",animate:!1,idealEdgeLength:280,nodeRepulsion:12e4,nodeOverlap:60,gravity:.08,nestingFactor:1.2,edgeElasticity:100,numIter:3e3},concentric:{name:"concentric",animate:!1,minNodeSpacing:30,levelWidth:()=>1},circle:{name:"circle",animate:!1,radius:320},breadthfirst:{name:"breadthfirst",animate:!1,spacingFactor:1.4,directed:!0},grid:{name:"grid",animate:!1,padding:40}};function bL({graph:t,edgeStatusFilter:e,communityFilter:n,sourceClassFilter:r,selectedTags:i=[],pathResult:l,onNodeSelect:s,cyRef:u,fitTrigger:f,pageTags:c,onLayoutChange:h}){const v=pe.useRef(null),[p,m]=pe.useState("cose"),[y,w]=pe.useState("auto"),[S,x]=pe.useState(!0),C=pe.useEffectEvent(M=>{s(M)}),T=pe.useEffectEvent(M=>{u.current?.destroy(),u.current=M}),A=pe.useEffectEvent(M=>{u.current===M&&(u.current=null),M.destroy()}),N=pe.useEffectEvent(M=>{const F=u.current;if(F&&(F.elements().removeClass("path-node path-edge"),M)){for(const U of M.nodeIds)F.getElementById(U).addClass("path-node");for(const U of M.edgeIds)F.getElementById(U).addClass("path-edge")}}),k=pe.useEffectEvent(()=>{u.current?.resize()}),_=(()=>{if(!t||i.length===0||!c)return null;const M=new Set;for(const F of t.nodes){if(!F.pageId)continue;const U=c[F.pageId]??[];i.every(j=>U.includes(j))&&M.add(F.id)}return M})();pe.useEffect(()=>{if(!v.current||!t)return;const M=new Set(t.nodes.filter(B=>n==="all"||B.communityId===n).filter(B=>r==="all"||(B.sourceClass??"")===r).filter(B=>!_||_.has(B.id)).map(B=>B.id)),F=y==="always"?"data(label)":y==="never"?"":"data(label)",U=y==="always"?0:y==="never"?999:.5,{hubNodes:j,hubEdges:K}=S?hL(t,M):{hubNodes:[],hubEdges:[]},$=Al({container:v.current,elements:[...t.nodes.filter(B=>M.has(B.id)).map(B=>({data:{...B,color:pL[B.type]??"#94a3b8"}})),...j,...t.edges.filter(B=>M.has(B.source)&&M.has(B.target)).filter(B=>e==="all"||B.status===e).map(B=>({data:B,classes:[B.relation==="semantically_similar_to"?"similarity-edge":"",B.status==="conflicted"?"conflicted-edge":"",B.status==="inferred"?"inferred-edge":""].filter(Boolean).join(" ")})),...K],layout:yL[p],style:[{selector:"node",style:{label:F,"background-color":"data(color)","background-opacity":.85,color:"var(--c-text-primary)","font-family":'"Inter", "Segoe UI", system-ui, sans-serif',"font-size":11,"font-weight":"normal","text-halign":"center","text-valign":"bottom","text-margin-y":7,"text-max-width":"100px","text-wrap":"ellipsis","min-zoomed-font-size":U,"text-background-opacity":.55,"text-background-color":"var(--c-bg-base)","text-background-padding":"2px","text-background-shape":"roundrectangle","border-width":0,"overlay-padding":4}},{selector:"node[?isGodNode]",style:{width:56,height:56,"border-width":1.5,"border-color":"rgba(254, 240, 138, 0.65)","border-opacity":1,"background-opacity":1,"font-size":12,"font-weight":"bold","text-max-width":"140px","z-index":12}},{selector:'node[type = "module"]',style:{shape:"round-rectangle",width:44,height:28,"z-index":8}},{selector:'node[type = "symbol"]',style:{shape:"diamond",width:20,height:20,"background-opacity":.6}},{selector:'node[type = "rationale"]',style:{shape:"hexagon",width:28,height:28,"background-opacity":.75}},{selector:'node[type = "source"]',style:{shape:"ellipse",width:32,height:32,"background-opacity":.95,"z-index":10}},{selector:'node[type = "concept"]',style:{shape:"round-rectangle",width:34,height:22,"background-opacity":.7}},{selector:'node[type = "entity"]',style:{shape:"ellipse",width:26,height:26,"background-opacity":.7}},{selector:"edge",style:{width:.8,"line-color":"rgba(71, 85, 105, 0.45)","target-arrow-shape":"triangle-backcurve","target-arrow-color":"rgba(71, 85, 105, 0.45)","arrow-scale":.6,"curve-style":"bezier","font-size":8,"text-background-opacity":0,"text-background-color":"var(--c-bg-base)","text-background-padding":"2px","text-background-shape":"roundrectangle","text-rotation":"autorotate","text-margin-y":-8}},{selector:"edge:selected",style:{label:"data(relation)",width:2,"text-background-opacity":.7}},{selector:".similarity-edge",style:{"line-style":"dashed","line-color":"rgba(249, 115, 22, 0.5)","target-arrow-color":"rgba(249, 115, 22, 0.5)","line-dash-pattern":[6,4]}},{selector:".inferred-edge",style:{"line-color":"rgba(56, 189, 248, 0.6)","target-arrow-color":"rgba(56, 189, 248, 0.6)"}},{selector:".conflicted-edge",style:{"line-color":"rgba(248, 113, 113, 0.7)","target-arrow-color":"rgba(248, 113, 113, 0.7)",width:1.5}},{selector:".path-node",style:{"border-width":3,"border-color":"#38bdf8","background-opacity":1,"z-index":100}},{selector:".path-edge",style:{width:2.5,"line-color":"#38bdf8","target-arrow-color":"#38bdf8",label:"data(relation)","text-background-opacity":.7,"z-index":100}},{selector:":selected",style:{"border-width":2,"border-color":"#e2e8f0"}},{selector:"node:active",style:{"overlay-color":"#38bdf8","overlay-opacity":.12}},{selector:"node.hyper",style:{shape:"round-rectangle",width:18,height:14,"background-color":"#0f172a","background-opacity":.85,"border-width":1.5,"border-color":"#a78bfa","border-style":"dashed",color:"#c4b5fd","font-size":9,"font-weight":"normal","text-max-width":"120px","z-index":4}},{selector:"edge.hyperEdge",style:{width:.8,"line-color":"rgba(167, 139, 250, 0.55)","line-style":"dashed","line-dash-pattern":[4,3],"target-arrow-shape":"none","curve-style":"straight"}}]});return $.on("select","node",B=>C(B.target.data())),$.on("unselect","node",()=>C(null)),$.on("mouseover","edge",B=>{B.target.style("label",B.target.data("relation")??""),B.target.style("width",1.8),B.target.style("z-index",999)}),$.on("mouseout","edge",B=>{!B.target.selected()&&!B.target.hasClass("path-edge")&&(B.target.removeStyle("label"),B.target.removeStyle("width"),B.target.removeStyle("z-index"))}),$.on("mouseover","node",B=>{B.target.style("text-max-width","200px"),B.target.style("text-wrap","wrap"),B.target.style("z-index",999)}),$.on("mouseout","node",B=>{B.target.selected()||(B.target.removeStyle("text-max-width"),B.target.removeStyle("text-wrap"),B.target.removeStyle("z-index"))}),T($),vL($),()=>{gL($,u.current),A($)}},[n,e,t,r,p,y,_,u,S]),pe.useEffect(()=>{N(l)},[l]),pe.useEffect(()=>{const M=v.current;if(!M)return;const F=new ResizeObserver(()=>k());return F.observe(M),()=>F.disconnect()},[]),pe.useEffect(()=>{f!=null&&u.current?.fit(void 0,30)},[f,u.current?.fit]);const O=()=>u.current?.fit(void 0,30),P=()=>u.current?.reset();return D.jsxs("div",{className:"canvas-wrap",children:[D.jsxs("div",{className:"canvas-toolbar",role:"toolbar","aria-label":"Graph view controls",children:[D.jsxs("div",{className:"canvas-toolbar-group",children:[D.jsx("label",{htmlFor:"layout-select",className:"label",children:"Layout"}),D.jsx("select",{id:"layout-select",className:"input",value:p,onChange:M=>{const F=M.target.value;m(F),h?.(F)},children:Object.entries(mL).map(([M,F])=>D.jsx("option",{value:M,children:F},M))})]}),D.jsxs("div",{className:"canvas-toolbar-group",children:[D.jsx("label",{htmlFor:"label-mode",className:"label",children:"Labels"}),D.jsxs("select",{id:"label-mode",className:"input",value:y,onChange:M=>w(M.target.value),children:[D.jsx("option",{value:"auto",children:"Auto"}),D.jsx("option",{value:"always",children:"Always"}),D.jsx("option",{value:"never",children:"Never"})]})]}),D.jsx("div",{className:"canvas-toolbar-group",children:D.jsxs("label",{className:"label",htmlFor:"hyperedge-toggle",children:[D.jsx("input",{id:"hyperedge-toggle",type:"checkbox","data-testid":"hyperedge-toggle","aria-label":"Show hyperedges",checked:S,onChange:M=>x(M.target.checked)})," ","Show hyperedges"]})}),D.jsxs("div",{className:"canvas-toolbar-group",children:[D.jsx("button",{type:"button",className:"btn",onClick:O,title:"Fit to viewport (F)",children:"Fit"}),D.jsx("button",{type:"button",className:"btn",onClick:P,title:"Reset zoom",children:"Reset"})]})]}),D.jsx("div",{className:"canvas","data-testid":"graph-canvas",ref:v}),D.jsx(fL,{}),D.jsx(dL,{cyRef:u})]})}function EL({graphQueryInput:t,onGraphQueryInputChange:e,onRunQuery:n,graphQueryResult:r,pathFrom:i,onPathFromChange:l,pathTo:s,onPathToChange:u,onHighlightPath:f,pathResult:c,graphError:h,graph:v,onOpenPage:p,onNavigateNode:m}){return D.jsxs("section",{className:"panel","data-testid":"graph-tools",children:[D.jsx("h3",{className:"panel-heading",children:"Graph Tools"}),h?D.jsx("p",{className:"text-error",children:h}):null,D.jsxs("div",{className:"card-list",children:[D.jsxs("article",{className:"card",children:[D.jsx("span",{className:"label",children:"query"}),D.jsx("input",{type:"search",className:"input","data-testid":"graph-query-input","aria-label":"Graph query",value:t,onChange:y=>e(y.target.value),placeholder:"Ask a question about the graph\\u2026"}),D.jsx("button",{type:"button",className:"btn btn-primary","data-testid":"graph-query-run",onClick:n,children:"Run"}),r?D.jsxs(D.Fragment,{children:[D.jsx("p",{className:"text-secondary text-sm",children:r.summary}),D.jsxs("div",{className:"chip-row",children:[r.hyperedgeIds.map(y=>v?.hyperedges?.find(w=>w.id===y)).filter(y=>!!y).slice(0,2).map(y=>D.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{const w=y.nodeIds[0];w&&m(w)},children:y.label},y.id)),r.pageIds.map(y=>v?.pages?.find(w=>w.id===y)).filter(y=>!!y).slice(0,4).map(y=>D.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{p(y.path,y.id)},children:y.title},y.id))]})]}):null]}),D.jsxs("article",{className:"card",children:[D.jsx("span",{className:"label",children:"path"}),D.jsx("input",{type:"text",className:"input","data-testid":"graph-path-from","aria-label":"Path from node",value:i,onChange:y=>l(y.target.value),placeholder:"From node ID or label\\u2026"}),D.jsx("input",{type:"text",className:"input","data-testid":"graph-path-to","aria-label":"Path to node",value:s,onChange:y=>u(y.target.value),placeholder:"To node ID or label\\u2026"}),D.jsx("button",{type:"button",className:"btn btn-primary","data-testid":"graph-path-highlight",onClick:f,children:"Highlight"}),c?D.jsx("p",{className:"text-secondary text-sm","data-testid":"graph-path-summary",children:c.summary}):null]})]})]})}const xL={error:"is-error",warning:"is-warning",info:"is-info"};function wL({findings:t,error:e,onOpenPage:n}){if(e)return D.jsxs("section",{className:"panel","aria-label":"Lint findings",children:[D.jsx("h3",{className:"panel-heading",children:"Lint Findings"}),D.jsx("p",{className:"text-error",children:e})]});if(!t.length)return D.jsxs("section",{className:"panel","aria-label":"Lint findings",children:[D.jsx("h3",{className:"panel-heading",children:"Lint Findings"}),D.jsxs("p",{className:"text-muted text-sm",children:["No lint findings. Run ",D.jsx("code",{children:"swarmvault lint --deep"})," for a fresh sweep."]})]});const r=t.reduce((i,l)=>{const s=i[l.category]??[];return s.push(l),i[l.category]=s,i},{});return D.jsxs("section",{className:"panel","aria-label":"Lint findings",children:[D.jsxs("h3",{className:"panel-heading",children:["Lint Findings ",D.jsxs("span",{className:"panel-meta",children:[t.length," total"]})]}),D.jsx("div",{className:"card-list",children:Object.entries(r).map(([i,l])=>D.jsxs("div",{children:[D.jsxs("p",{className:"label",style:{marginBottom:4},children:[i," · ",l.length]}),D.jsxs("div",{className:"card-list",children:[l.slice(0,12).map(s=>D.jsxs("article",{className:`lint-finding ${xL[s.severity]}`,children:[D.jsx("strong",{className:"text-sm",children:s.message}),s.pagePath?D.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{n(s.pagePath??"",s.pageId)},children:"Open page"}):null]},s.id)),l.length>12?D.jsxs("p",{className:"text-muted text-sm",children:["+",l.length-12," more"]}):null]})]},i))})]})}function SL(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const CL=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TL=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,DL={};function gw(t,e){return(DL.jsx?TL:CL).test(t)}const AL=/[ \t\n\f\r]/g;function _L(t){return typeof t=="object"?t.type==="text"?pw(t.value):!1:pw(t)}function pw(t){return t.replace(AL,"")===""}class Bu{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Bu.prototype.normal={};Bu.prototype.property={};Bu.prototype.space=void 0;function gT(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new Bu(n,r,e)}function $p(t){return t.toLowerCase()}class Mr{constructor(e,n){this.attribute=n,this.property=e}}Mr.prototype.attribute="";Mr.prototype.booleanish=!1;Mr.prototype.boolean=!1;Mr.prototype.commaOrSpaceSeparated=!1;Mr.prototype.commaSeparated=!1;Mr.prototype.defined=!1;Mr.prototype.mustUseProperty=!1;Mr.prototype.number=!1;Mr.prototype.overloadedBoolean=!1;Mr.prototype.property="";Mr.prototype.spaceSeparated=!1;Mr.prototype.space=void 0;let kL=0;const Dt=Rl(),In=Rl(),Kp=Rl(),Be=Rl(),cn=Rl(),Ls=Rl(),qr=Rl();function Rl(){return 2**++kL}const Yp=Object.freeze(Object.defineProperty({__proto__:null,boolean:Dt,booleanish:In,commaOrSpaceSeparated:qr,commaSeparated:Ls,number:Be,overloadedBoolean:Kp,spaceSeparated:cn},Symbol.toStringTag,{value:"Module"})),ip=Object.keys(Yp);class Nm extends Mr{constructor(e,n,r,i){let l=-1;if(super(e,n),mw(this,"space",i),typeof r=="number")for(;++l<ip.length;){const s=ip[l];mw(this,ip[l],(r&Yp[s])===Yp[s])}}}Nm.prototype.defined=!0;function mw(t,e,n){n&&(t[e]=n)}function $s(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const l=new Nm(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),e[r]=l,n[$p(r)]=r,n[$p(l.attribute)]=r}return new Bu(e,n,t.space)}const pT=$s({properties:{ariaActiveDescendant:null,ariaAtomic:In,ariaAutoComplete:null,ariaBusy:In,ariaChecked:In,ariaColCount:Be,ariaColIndex:Be,ariaColSpan:Be,ariaControls:cn,ariaCurrent:null,ariaDescribedBy:cn,ariaDetails:null,ariaDisabled:In,ariaDropEffect:cn,ariaErrorMessage:null,ariaExpanded:In,ariaFlowTo:cn,ariaGrabbed:In,ariaHasPopup:null,ariaHidden:In,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:cn,ariaLevel:Be,ariaLive:null,ariaModal:In,ariaMultiLine:In,ariaMultiSelectable:In,ariaOrientation:null,ariaOwns:cn,ariaPlaceholder:null,ariaPosInSet:Be,ariaPressed:In,ariaReadOnly:In,ariaRelevant:null,ariaRequired:In,ariaRoleDescription:cn,ariaRowCount:Be,ariaRowIndex:Be,ariaRowSpan:Be,ariaSelected:In,ariaSetSize:Be,ariaSort:null,ariaValueMax:Be,ariaValueMin:Be,ariaValueNow:Be,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function mT(t,e){return e in t?t[e]:e}function yT(t,e){return mT(t,e.toLowerCase())}const NL=$s({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ls,acceptCharset:cn,accessKey:cn,action:null,allow:null,allowFullScreen:Dt,allowPaymentRequest:Dt,allowUserMedia:Dt,alt:null,as:null,async:Dt,autoCapitalize:null,autoComplete:cn,autoFocus:Dt,autoPlay:Dt,blocking:cn,capture:null,charSet:null,checked:Dt,cite:null,className:cn,cols:Be,colSpan:null,content:null,contentEditable:In,controls:Dt,controlsList:cn,coords:Be|Ls,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Dt,defer:Dt,dir:null,dirName:null,disabled:Dt,download:Kp,draggable:In,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Dt,formTarget:null,headers:cn,height:Be,hidden:Kp,high:Be,href:null,hrefLang:null,htmlFor:cn,httpEquiv:cn,id:null,imageSizes:null,imageSrcSet:null,inert:Dt,inputMode:null,integrity:null,is:null,isMap:Dt,itemId:null,itemProp:cn,itemRef:cn,itemScope:Dt,itemType:cn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Dt,low:Be,manifest:null,max:null,maxLength:Be,media:null,method:null,min:null,minLength:Be,multiple:Dt,muted:Dt,name:null,nonce:null,noModule:Dt,noValidate:Dt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Dt,optimum:Be,pattern:null,ping:cn,placeholder:null,playsInline:Dt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Dt,referrerPolicy:null,rel:cn,required:Dt,reversed:Dt,rows:Be,rowSpan:Be,sandbox:cn,scope:null,scoped:Dt,seamless:Dt,selected:Dt,shadowRootClonable:Dt,shadowRootDelegatesFocus:Dt,shadowRootMode:null,shape:null,size:Be,sizes:null,slot:null,span:Be,spellCheck:In,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Be,step:null,style:null,tabIndex:Be,target:null,title:null,translate:null,type:null,typeMustMatch:Dt,useMap:null,value:In,width:Be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:cn,axis:null,background:null,bgColor:null,border:Be,borderColor:null,bottomMargin:Be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Dt,declare:Dt,event:null,face:null,frame:null,frameBorder:null,hSpace:Be,leftMargin:Be,link:null,longDesc:null,lowSrc:null,marginHeight:Be,marginWidth:Be,noResize:Dt,noHref:Dt,noShade:Dt,noWrap:Dt,object:null,profile:null,prompt:null,rev:null,rightMargin:Be,rules:null,scheme:null,scrolling:In,standby:null,summary:null,text:null,topMargin:Be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Be,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Dt,disableRemotePlayback:Dt,prefix:null,property:null,results:Be,security:null,unselectable:null},space:"html",transform:yT}),RL=$s({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:qr,accentHeight:Be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Be,amplitude:Be,arabicForm:null,ascent:Be,attributeName:null,attributeType:null,azimuth:Be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Be,by:null,calcMode:null,capHeight:Be,className:cn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Be,diffuseConstant:Be,direction:null,display:null,dur:null,divisor:Be,dominantBaseline:null,download:Dt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Be,enableBackground:null,end:null,event:null,exponent:Be,externalResourcesRequired:null,fill:null,fillOpacity:Be,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ls,g2:Ls,glyphName:Ls,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Be,horizOriginX:Be,horizOriginY:Be,id:null,ideographic:Be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Be,k:Be,k1:Be,k2:Be,k3:Be,k4:Be,kernelMatrix:qr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Be,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Be,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Be,overlineThickness:Be,paintOrder:null,panose1:null,path:null,pathLength:Be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:cn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Be,pointsAtY:Be,pointsAtZ:Be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:qr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:qr,rev:qr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:qr,requiredFeatures:qr,requiredFonts:qr,requiredFormats:qr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Be,specularExponent:Be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Be,strikethroughThickness:Be,string:null,stroke:null,strokeDashArray:qr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Be,strokeOpacity:Be,strokeWidth:null,style:null,surfaceScale:Be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:qr,tabIndex:Be,tableValues:null,target:null,targetX:Be,targetY:Be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:qr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Be,underlineThickness:Be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Be,values:null,vAlphabetic:Be,vMathematical:Be,vectorEffect:null,vHanging:Be,vIdeographic:Be,version:null,vertAdvY:Be,vertOriginX:Be,vertOriginY:Be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mT}),bT=$s({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),ET=$s({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yT}),xT=$s({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),ML={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},OL=/[A-Z]/g,yw=/-[a-z]/g,BL=/^data[-\w.:]+$/i;function LL(t,e){const n=$p(e);let r=e,i=Mr;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&BL.test(e)){if(e.charAt(4)==="-"){const l=e.slice(5).replace(yw,IL);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=e.slice(4);if(!yw.test(l)){let s=l.replace(OL,FL);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=Nm}return new i(r,e)}function FL(t){return"-"+t.toLowerCase()}function IL(t){return t.charAt(1).toUpperCase()}const zL=gT([pT,NL,bT,ET,xT],"html"),Rm=gT([pT,RL,bT,ET,xT],"svg");function PL(t){return t.join(" ").trim()}var xs={},lp,bw;function UL(){if(bw)return lp;bw=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,u=/^\s+|\s+$/g,f=`
334
+ `),u=xB(r,i,s);u.aPosition=r.getAttribLocation(u,"aPosition"),u.aIndex=r.getAttribLocation(u,"aIndex"),u.aVertType=r.getAttribLocation(u,"aVertType"),u.aTransform=r.getAttribLocation(u,"aTransform"),u.aAtlasId=r.getAttribLocation(u,"aAtlasId"),u.aTex=r.getAttribLocation(u,"aTex"),u.aPointAPointB=r.getAttribLocation(u,"aPointAPointB"),u.aPointCPointD=r.getAttribLocation(u,"aPointCPointD"),u.aLineWidth=r.getAttribLocation(u,"aLineWidth"),u.aColor=r.getAttribLocation(u,"aColor"),u.aCornerRadius=r.getAttribLocation(u,"aCornerRadius"),u.aBorderColor=r.getAttribLocation(u,"aBorderColor"),u.uPanZoomMatrix=r.getUniformLocation(u,"uPanZoomMatrix"),u.uAtlasSize=r.getUniformLocation(u,"uAtlasSize"),u.uBGColor=r.getUniformLocation(u,"uBGColor"),u.uZoom=r.getUniformLocation(u,"uZoom"),u.uTextures=[];for(var f=0;f<this.batchManager.getMaxAtlasesPerBatch();f++)u.uTextures.push(r.getUniformLocation(u,"uTexture".concat(f)));return u}},{key:"_createVAO",value:function(){var n=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=n.length/2;var r=this.maxInstances,i=this.gl,l=this.program,s=i.createVertexArray();return i.bindVertexArray(s),NB(i,"vec2",l.aPosition,n),this.transformBuffer=RB(i,r,l.aTransform),this.indexBuffer=Ea(i,r,"vec4",l.aIndex),this.vertTypeBuffer=Ea(i,r,"int",l.aVertType),this.atlasIdBuffer=Ea(i,r,"int",l.aAtlasId),this.texBuffer=Ea(i,r,"vec4",l.aTex),this.pointAPointBBuffer=Ea(i,r,"vec4",l.aPointAPointB),this.pointCPointDBuffer=Ea(i,r,"vec4",l.aPointCPointD),this.lineWidthBuffer=Ea(i,r,"vec2",l.aLineWidth),this.colorBuffer=Ea(i,r,"vec4",l.aColor),this.cornerRadiusBuffer=Ea(i,r,"vec4",l.aCornerRadius),this.borderColorBuffer=Ea(i,r,"vec4",l.aBorderColor),i.bindVertexArray(null),s}},{key:"buffers",get:function(){var n=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(r){return Ri(r,"Buffer")}).map(function(r){return n[r]})),this._buffers}},{key:"startFrame",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:iu.SCREEN;this.panZoomMatrix=n,this.renderTarget=r,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(n,r){return n.visible()?r&&r.isVisible?r.isVisible(n):!0:!1}},{key:"drawTexture",value:function(n,r,i){var l=this.atlasManager,s=this.batchManager,u=l.getRenderTypeOpts(i);if(this._isVisible(n,u)&&!(n.isEdge()&&!this._isValidEdge(n))){if(this.renderTarget.picking&&u.getTexPickingMode){var f=u.getTexPickingMode(n);if(f===Vf.IGNORE)return;if(f==Vf.USE_BB){this.drawPickingRectangle(n,r,i);return}}var c=l.getAtlasInfo(n,i),h=Nr(c),v;try{for(h.s();!(v=h.n()).done;){var p=v.value,m=p.atlas,y=p.tex1,w=p.tex2;s.canAddToCurrentBatch(m)||this.endBatch();for(var S=s.getAtlasIndexForBatch(m),x=0,C=[[y,!0],[w,!1]];x<C.length;x++){var T=Pn(C[x],2),A=T[0],N=T[1];if(A.w!=0){var k=this.instanceCount;this.vertTypeBuffer.getView(k)[0]=ep;var _=this.indexBuffer.getView(k);ys(r,_);var O=this.atlasIdBuffer.getView(k);O[0]=S;var P=this.texBuffer.getView(k);P[0]=A.x,P[1]=A.y,P[2]=A.w,P[3]=A.h;var M=this.transformBuffer.getMatrixView(k);this.setTransformMatrix(n,M,u,p,N),this.instanceCount++,N||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(F){h.e(F)}finally{h.f()}}}},{key:"setTransformMatrix",value:function(n,r,i,l){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,u=0;if(i.shapeProps&&i.shapeProps.padding&&(u=n.pstyle(i.shapeProps.padding).pfValue),l){var f=l.bb,c=l.tex1,h=l.tex2,v=c.w/(c.w+h.w);s||(v=1-v);var p=this._getAdjustedBB(f,u,s,v);this._applyTransformMatrix(r,p,i,n)}else{var m=i.getBoundingBox(n),y=this._getAdjustedBB(m,u,!0,1);this._applyTransformMatrix(r,y,i,n)}}},{key:"_applyTransformMatrix",value:function(n,r,i,l){var s,u;ow(n);var f=i.getRotation?i.getRotation(l):0;if(f!==0){var c=i.getRotationPoint(l),h=c.x,v=c.y;Rf(n,n,[h,v]),uw(n,n,f);var p=i.getRotationOffset(l);s=p.x+(r.xOffset||0),u=p.y+(r.yOffset||0)}else s=r.x1,u=r.y1;Rf(n,n,[s,u]),jp(n,n,[r.w,r.h])}},{key:"_getAdjustedBB",value:function(n,r,i,l){var s=n.x1,u=n.y1,f=n.w,c=n.h,h=n.yOffset;r&&(s-=r,u-=r,f+=2*r,c+=2*r);var v=0,p=f*l;return i&&l<1?f=p:!i&&l<1&&(v=f-p,s+=v,f=p),{x1:s,y1:u,w:f,h:c,xOffset:v,yOffset:h}}},{key:"drawPickingRectangle",value:function(n,r,i){var l=this.atlasManager.getRenderTypeOpts(i),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=bs;var u=this.indexBuffer.getView(s);ys(r,u);var f=this.colorBuffer.getView(s);gl([0,0,0],1,f);var c=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(n,c,l),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(n,r,i){var l=this.simpleShapeOptions.get(i);if(this._isVisible(n,l)){var s=l.shapeProps,u=this._getVertTypeForShape(n,s.shape);if(u===void 0||l.isSimple&&!l.isSimple(n,this.renderTarget)){this.drawTexture(n,r,i);return}var f=this.instanceCount;if(this.vertTypeBuffer.getView(f)[0]=u,u===cf||u===$o){var c=l.getBoundingBox(n),h=this._getCornerRadius(n,s.radius,c),v=this.cornerRadiusBuffer.getView(f);v[0]=h,v[1]=h,v[2]=h,v[3]=h,u===$o&&(v[0]=0,v[2]=0)}var p=this.indexBuffer.getView(f);ys(r,p);var m=this.renderTarget.picking?1:n.pstyle(s.opacity).value,y=n.pstyle(s.color).value,w=this.colorBuffer.getView(f);gl(y,m,w);var S=this.lineWidthBuffer.getView(f);if(S[0]=0,S[1]=0,s.border){var x=n.pstyle("border-width").value;if(x>0){var C=n.pstyle("border-color").value,T=n.pstyle("border-opacity").value,A=this.borderColorBuffer.getView(f);gl(C,T,A);var N=n.pstyle("border-position").value;if(N==="inside")S[0]=0,S[1]=-x;else if(N==="outside")S[0]=x,S[1]=0;else{var k=x/2;S[0]=k,S[1]=-k}}}var _=this.transformBuffer.getMatrixView(f);this.setTransformMatrix(n,_,l),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(n,r){var i=n.pstyle(r).value;switch(i){case"rectangle":return bs;case"ellipse":return Ko;case"roundrectangle":case"round-rectangle":return cf;case"bottom-round-rectangle":return $o;default:return}}},{key:"_getCornerRadius",value:function(n,r,i){var l=i.w,s=i.h;if(n.pstyle(r).value==="auto")return zi(l,s);var u=n.pstyle(r).pfValue,f=l/2,c=s/2;return Math.min(u,c,f)}},{key:"drawEdgeArrow",value:function(n,r,i){if(n.visible()){var l=n._private.rscratch,s,u,f;if(i==="source"?(s=l.arrowStartX,u=l.arrowStartY,f=l.srcArrowAngle):(s=l.arrowEndX,u=l.arrowEndY,f=l.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(u)||u==null||isNaN(f)||f==null)){var c=n.pstyle(i+"-arrow-shape").value;if(c!=="none"){var h=n.pstyle(i+"-arrow-color").value,v=n.pstyle("opacity").value,p=n.pstyle("line-opacity").value,m=v*p,y=n.pstyle("width").pfValue,w=n.pstyle("arrow-scale").value,S=this.r.getArrowWidth(y,w),x=this.instanceCount,C=this.transformBuffer.getMatrixView(x);ow(C),Rf(C,C,[s,u]),jp(C,C,[S,S]),uw(C,C,f),this.vertTypeBuffer.getView(x)[0]=tp;var T=this.indexBuffer.getView(x);ys(r,T);var A=this.colorBuffer.getView(x);gl(h,m,A),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(n,r){if(n.visible()){var i=this._getEdgePoints(n);if(i){var l=n.pstyle("opacity").value,s=n.pstyle("line-opacity").value,u=n.pstyle("width").pfValue,f=n.pstyle("line-color").value,c=l*s;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=cw;var v=this.indexBuffer.getView(h);ys(r,v);var p=this.colorBuffer.getView(h);gl(f,c,p);var m=this.lineWidthBuffer.getView(h);m[0]=u;var y=this.pointAPointBBuffer.getView(h);y[0]=i[0],y[1]=i[1],y[2]=i[2],y[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var w=0;w<i.length-2;w+=2){var S=this.instanceCount;this.vertTypeBuffer.getView(S)[0]=fw;var x=this.indexBuffer.getView(S);ys(r,x);var C=this.colorBuffer.getView(S);gl(f,c,C);var T=this.lineWidthBuffer.getView(S);T[0]=u;var A=i[w-2],N=i[w-1],k=i[w],_=i[w+1],O=i[w+2],P=i[w+3],M=i[w+4],F=i[w+5];w==0&&(A=2*k-O+.001,N=2*_-P+.001),w==i.length-4&&(M=2*O-k+.001,F=2*P-_+.001);var U=this.pointAPointBBuffer.getView(S);U[0]=A,U[1]=N,U[2]=k,U[3]=_;var j=this.pointCPointDBuffer.getView(S);j[0]=O,j[1]=P,j[2]=M,j[3]=F,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(n){var r=n._private.rscratch;return!(r.badLine||r.allpts==null||isNaN(r.allpts[0]))}},{key:"_getEdgePoints",value:function(n){var r=n._private.rscratch;if(this._isValidEdge(n)){var i=r.allpts;if(i.length==4)return i;var l=this._getNumSegments(n);return this._getCurveSegmentPoints(i,l)}}},{key:"_getNumSegments",value:function(n){var r=15;return Math.min(Math.max(r,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(n,r){if(n.length==4)return n;for(var i=Array((r+1)*2),l=0;l<=r;l++)if(l==0)i[0]=n[0],i[1]=n[1];else if(l==r)i[l*2]=n[n.length-2],i[l*2+1]=n[n.length-1];else{var s=l/r;this._setCurvePoint(n,s,i,l*2)}return i}},{key:"_setCurvePoint",value:function(n,r,i,l){if(n.length<=2)i[l]=n[0],i[l+1]=n[1];else{for(var s=Array(n.length-2),u=0;u<s.length;u+=2){var f=(1-r)*n[u]+r*n[u+2],c=(1-r)*n[u+1]+r*n[u+3];s[u]=f,s[u+1]=c}return this._setCurvePoint(s,r,i,l)}}},{key:"endBatch",value:function(){var n=this.gl,r=this.vao,i=this.vertexCount,l=this.instanceCount;if(l!==0){var s=this.renderTarget.picking?this.pickingProgram:this.program;n.useProgram(s),n.bindVertexArray(r);var u=Nr(this.buffers),f;try{for(u.s();!(f=u.n()).done;){var c=f.value;c.bufferSubData(l)}}catch(y){u.e(y)}finally{u.f()}for(var h=this.batchManager.getAtlases(),v=0;v<h.length;v++)h[v].bufferIfNeeded(n);for(var p=0;p<h.length;p++)n.activeTexture(n.TEXTURE0+p),n.bindTexture(n.TEXTURE_2D,h[p].texture),n.uniform1i(s.uTextures[p],p);n.uniform1f(s.uZoom,SB(this.r)),n.uniformMatrix3fv(s.uPanZoomMatrix,!1,this.panZoomMatrix),n.uniform1i(s.uAtlasSize,this.batchManager.getAtlasSize());var m=gl(this.bgColor,1);n.uniform4fv(s.uBGColor,m),n.drawArraysInstanced(n.TRIANGLES,0,i,l),n.bindVertexArray(null),n.bindTexture(n.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:l,atlasCount:h.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var n=this.atlasManager.getDebugInfo(),r=n.reduce(function(s,u){return s+u.atlasCount},0),i=this.batchDebugInfo,l=i.reduce(function(s,u){return s+u.count},0);return{atlasInfo:n,totalAtlases:r,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:i.length,batchInfo:i,totalInstances:l}}}])})(),rT={};rT.initWebgl=function(t,e){var n=this,r=n.data.contexts[n.WEBGL];t.bgColor=VB(n),t.webglTexSize=Math.min(t.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),t.webglTexRows=Math.min(t.webglTexRows,54),t.webglTexRowsNodes=Math.min(t.webglTexRowsNodes,54),t.webglBatchSize=Math.min(t.webglBatchSize,16384),t.webglTexPerBatch=Math.min(t.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=t.webglDebug,n.webglDebugShowAtlases=t.webglDebugShowAtlases,n.pickingFrameBuffer=MB(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new GB(n,r,t);var i=function(v){return function(p){return n.getTextAngle(p,v)}},l=function(v){return function(p){var m=p.pstyle(v);return m&&m.value}},s=function(v){return function(p){return p.pstyle("".concat(v,"-opacity")).value>0}},u=function(v){var p=v.pstyle("text-events").strValue==="yes";return p?Vf.USE_BB:Vf.IGNORE},f=function(v){var p=v.position(),m=p.x,y=p.y,w=v.outerWidth(),S=v.outerHeight();return{w,h:S,x1:m-w/2,y1:y-S/2}};n.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),n.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),n.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),n.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:f,isSimple:TB,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),n.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:f,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),n.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:f,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),n.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:u,getKey:np(e.getLabelKey,null),getBoundingBox:rp(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:i(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:l("label")}),n.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:u,getKey:np(e.getSourceLabelKey,"source"),getBoundingBox:rp(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:i("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:l("source-label")}),n.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:u,getKey:np(e.getTargetLabelKey,"target"),getBoundingBox:rp(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:i("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:l("target-label")});var c=Au(function(){console.log("garbage collect flag set"),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(h,v){var p=!1;v&&v.length>0&&(p|=n.drawing.invalidate(v)),p&&c()}),$B(n)};function VB(t){var e=t.cy.container(),n=e&&e.style&&e.style.backgroundColor||"white";return RS(n)}function aT(t,e){var n=t._private.rscratch;return _r(n,"labelWrapCachedLines",e)||[]}var np=function(e,n){return function(r){var i=e(r),l=aT(r,n);return l.length>1?l.map(function(s,u){return"".concat(i,"_").concat(u)}):i}},rp=function(e,n){return function(r,i){var l=e(r);if(typeof i=="string"){var s=i.indexOf("_");if(s>0){var u=Number(i.substring(s+1)),f=aT(r,n),c=l.h/f.length,h=c*u,v=l.y1+h;return{x1:l.x1,w:l.w,y1:v,h:c,yOffset:h}}}return l}};function $B(t){{var e=t.render;t.render=function(l){l=l||{};var s=t.cy;t.webgl&&(s.zoom()>ZC?(KB(t),e.call(t,l)):(YB(t),lT(t,l,iu.SCREEN)))}}{var n=t.matchCanvasSize;t.matchCanvasSize=function(l){n.call(t,l),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(l,s,u,f){return eL(t,l,s)};{var r=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){r.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var i=t.notify;t.notify=function(l,s){i.call(t,l,s),l==="viewport"||l==="bounds"?t.pickingFrameBuffer.needsDraw=!0:l==="background"&&t.drawing.invalidate(s,{type:"node-body"})}}}function KB(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function YB(t){var e=function(r){r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,t.canvasWidth,t.canvasHeight),r.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function XB(t){var e=t.canvasWidth,n=t.canvasHeight,r=km(t),i=r.pan,l=r.zoom,s=Jg();Rf(s,s,[i.x,i.y]),jp(s,s,[l,l]);var u=Jg();BB(u,e,n);var f=Jg();return OB(f,u,s),f}function iT(t,e){var n=t.canvasWidth,r=t.canvasHeight,i=km(t),l=i.pan,s=i.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,n,r),e.translate(l.x,l.y),e.scale(s,s)}function ZB(t,e){t.drawSelectionRectangle(e,function(n){return iT(t,n)})}function QB(t){var e=t.data.contexts[t.NODE];e.save(),iT(t,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function WB(t){var e=function(i,l,s){for(var u=i.atlasManager.getAtlasCollection(l),f=t.data.contexts[t.NODE],c=u.atlases,h=0;h<c.length;h++){var v=c[h],p=v.canvas;if(p){var m=p.width,y=p.height,w=m*h,S=p.height*s,x=.4;f.save(),f.scale(x,x),f.drawImage(p,w,S),f.strokeStyle="black",f.rect(w,S,m,y),f.stroke(),f.restore()}}},n=0;e(t.drawing,"node",n++),e(t.drawing,"label",n++)}function JB(t,e,n,r,i){var l,s,u,f,c=km(t),h=c.pan,v=c.zoom;{var p=CB(t,h,v,e,n),m=Pn(p,2),y=m[0],w=m[1],S=6;l=y-S/2,s=w-S/2,u=S,f=S}if(u===0||f===0)return[];var x=t.data.contexts[t.WEBGL];x.bindFramebuffer(x.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(x.viewport(0,0,x.canvas.width,x.canvas.height),lT(t,null,iu.PICKING),t.pickingFrameBuffer.needsDraw=!1);var C=u*f,T=new Uint8Array(C*4);x.readPixels(l,s,u,f,x.RGBA,x.UNSIGNED_BYTE,T),x.bindFramebuffer(x.FRAMEBUFFER,null);for(var A=new Set,N=0;N<C;N++){var k=T.slice(N*4,N*4+4),_=AB(k)-1;_>=0&&A.add(_)}return A}function eL(t,e,n){var r=JB(t,e,n),i=t.getCachedZSortedEles(),l,s,u=Nr(r),f;try{for(u.s();!(f=u.n()).done;){var c=f.value,h=i[c];if(!l&&h.isNode()&&(l=h),!s&&h.isEdge()&&(s=h),l&&s)break}}catch(v){u.e(v)}finally{u.f()}return[l,s].filter(Boolean)}function ap(t,e,n){var r=t.drawing;e+=1,n.isNode()?(r.drawNode(n,e,"node-underlay"),r.drawNode(n,e,"node-body"),r.drawTexture(n,e,"label"),r.drawNode(n,e,"node-overlay")):(r.drawEdgeLine(n,e),r.drawEdgeArrow(n,e,"source"),r.drawEdgeArrow(n,e,"target"),r.drawTexture(n,e,"label"),r.drawTexture(n,e,"edge-source-label"),r.drawTexture(n,e,"edge-target-label"))}function lT(t,e,n){var r;t.webglDebug&&(r=performance.now());var i=t.drawing,l=0;if(n.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&ZB(t,e),t.data.canvasNeedsRedraw[t.NODE]||n.picking){var s=t.data.contexts[t.WEBGL];n.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var u=XB(t),f=t.getCachedZSortedEles();if(l=f.length,i.startFrame(u,n),n.screen){for(var c=0;c<f.nondrag.length;c++)ap(t,c,f.nondrag[c]);for(var h=0;h<f.drag.length;h++)ap(t,h,f.drag[h])}else if(n.picking)for(var v=0;v<f.length;v++)ap(t,v,f[v]);i.endFrame(),n.screen&&t.webglDebugShowAtlases&&(QB(t),WB(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var p=performance.now(),m=!1,y=Math.ceil(p-r),w=i.getDebugInfo(),S=["".concat(l," elements"),"".concat(w.totalInstances," instances"),"".concat(w.batchCount," batches"),"".concat(w.totalAtlases," atlases"),"".concat(w.wrappedCount," wrapped textures"),"".concat(w.simpleCount," simple shapes")].join(", ");if(m)console.log("WebGL (".concat(n.name,") - time ").concat(y,"ms, ").concat(S));else{console.log("WebGL (".concat(n.name,") - frame time ").concat(y,"ms")),console.log("Totals:"),console.log(" ".concat(S)),console.log("Texture Atlases Used:");var x=w.atlasInfo,C=Nr(x),T;try{for(C.s();!(T=C.n()).done;){var A=T.value;console.log(" ".concat(A.type,": ").concat(A.keyCount," keys, ").concat(A.atlasCount," atlases"))}}catch(N){C.e(N)}finally{C.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,i.gc())}var $i={};$i.drawPolygonPath=function(t,e,n,r,i,l){var s=r/2,u=i/2;t.beginPath&&t.beginPath(),t.moveTo(e+s*l[0],n+u*l[1]);for(var f=1;f<l.length/2;f++)t.lineTo(e+s*l[f*2],n+u*l[f*2+1]);t.closePath()};$i.drawRoundPolygonPath=function(t,e,n,r,i,l,s){s.forEach(function(u){return qC(t,u)}),t.closePath()};$i.drawRoundRectanglePath=function(t,e,n,r,i,l){var s=r/2,u=i/2,f=l==="auto"?zi(r,i):Math.min(l,u,s);t.beginPath&&t.beginPath(),t.moveTo(e,n-u),t.arcTo(e+s,n-u,e+s,n,f),t.arcTo(e+s,n+u,e,n+u,f),t.arcTo(e-s,n+u,e-s,n,f),t.arcTo(e-s,n-u,e,n-u,f),t.lineTo(e,n-u),t.closePath()};$i.drawBottomRoundRectanglePath=function(t,e,n,r,i,l){var s=r/2,u=i/2,f=l==="auto"?zi(r,i):l;t.beginPath&&t.beginPath(),t.moveTo(e,n-u),t.lineTo(e+s,n-u),t.lineTo(e+s,n),t.arcTo(e+s,n+u,e,n+u,f),t.arcTo(e-s,n+u,e-s,n,f),t.lineTo(e-s,n-u),t.lineTo(e,n-u),t.closePath()};$i.drawCutRectanglePath=function(t,e,n,r,i,l,s){var u=r/2,f=i/2,c=s==="auto"?gm():s;t.beginPath&&t.beginPath(),t.moveTo(e-u+c,n-f),t.lineTo(e+u-c,n-f),t.lineTo(e+u,n-f+c),t.lineTo(e+u,n+f-c),t.lineTo(e+u-c,n+f),t.lineTo(e-u+c,n+f),t.lineTo(e-u,n+f-c),t.lineTo(e-u,n-f+c),t.closePath()};$i.drawBarrelPath=function(t,e,n,r,i){var l=r/2,s=i/2,u=e-l,f=e+l,c=n-s,h=n+s,v=_p(r,i),p=v.widthOffset,m=v.heightOffset,y=v.ctrlPtOffsetPct*p;t.beginPath&&t.beginPath(),t.moveTo(u,c+m),t.lineTo(u,h-m),t.quadraticCurveTo(u+y,h,u+p,h),t.lineTo(f-p,h),t.quadraticCurveTo(f-y,h,f,h-m),t.lineTo(f,c+m),t.quadraticCurveTo(f-y,c,f-p,c),t.lineTo(u+p,c),t.quadraticCurveTo(u+y,c,u,c+m),t.closePath()};var dw=Math.sin(0),hw=Math.cos(0),Hp={},Gp={},sT=Math.PI/40;for(var Es=0*Math.PI;Es<2*Math.PI;Es+=sT)Hp[Es]=Math.sin(Es),Gp[Es]=Math.cos(Es);$i.drawEllipsePath=function(t,e,n,r,i){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,n,r/2,i/2,0,0,2*Math.PI);else for(var l,s,u=r/2,f=i/2,c=0*Math.PI;c<2*Math.PI;c+=sT)l=e-u*Hp[c]*dw+u*Gp[c]*hw,s=n+f*Gp[c]*dw+f*Hp[c]*hw,c===0?t.moveTo(l,s):t.lineTo(l,s);t.closePath()};var Ou={};Ou.createBuffer=function(t,e){var n=document.createElement("canvas");return n.width=t,n.height=e,[n,n.getContext("2d")]};Ou.bufferCanvasImage=function(t){var e=this.cy,n=e.mutableElements(),r=n.boundingBox(),i=this.findContainerClientCoords(),l=t.full?Math.ceil(r.w):i[2],s=t.full?Math.ceil(r.h):i[3],u=Ge(t.maxWidth)||Ge(t.maxHeight),f=this.getPixelRatio(),c=1;if(t.scale!==void 0)l*=t.scale,s*=t.scale,c=t.scale;else if(u){var h=1/0,v=1/0;Ge(t.maxWidth)&&(h=c*t.maxWidth/l),Ge(t.maxHeight)&&(v=c*t.maxHeight/s),c=Math.min(h,v),l*=c,s*=c}u||(l*=f,s*=f,c*=f);var p=document.createElement("canvas");p.width=l,p.height=s,p.style.width=l+"px",p.style.height=s+"px";var m=p.getContext("2d");if(l>0&&s>0){m.clearRect(0,0,l,s),m.globalCompositeOperation="source-over";var y=this.getCachedZSortedEles();if(t.full)m.translate(-r.x1*c,-r.y1*c),m.scale(c,c),this.drawElements(m,y),m.scale(1/c,1/c),m.translate(r.x1*c,r.y1*c);else{var w=e.pan(),S={x:w.x*c,y:w.y*c};c*=e.zoom(),m.translate(S.x,S.y),m.scale(c,c),this.drawElements(m,y),m.scale(1/c,1/c),m.translate(-S.x,-S.y)}t.bg&&(m.globalCompositeOperation="destination-over",m.fillStyle=t.bg,m.rect(0,0,l,s),m.fill())}return p};function tL(t,e){for(var n=atob(t),r=new ArrayBuffer(n.length),i=new Uint8Array(r),l=0;l<n.length;l++)i[l]=n.charCodeAt(l);return new Blob([r],{type:e})}function vw(t){var e=t.indexOf(",");return t.substr(e+1)}function oT(t,e,n){var r=function(){return e.toDataURL(n,t.quality)};switch(t.output){case"blob-promise":return new qs(function(i,l){try{e.toBlob(function(s){s!=null?i(s):l(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,t.quality)}catch(s){l(s)}});case"blob":return tL(vw(r()),n);case"base64":return vw(r());default:return r()}}Ou.png=function(t){return oT(t,this.bufferCanvasImage(t),"image/png")};Ou.jpg=function(t){return oT(t,this.bufferCanvasImage(t),"image/jpeg")};var uT={};uT.nodeShapeImpl=function(t,e,n,r,i,l,s,u){switch(t){case"ellipse":return this.drawEllipsePath(e,n,r,i,l);case"polygon":return this.drawPolygonPath(e,n,r,i,l,s);case"round-polygon":return this.drawRoundPolygonPath(e,n,r,i,l,s,u);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,n,r,i,l,u);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,n,r,i,l,s,u);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,n,r,i,l,u);case"barrel":return this.drawBarrelPath(e,n,r,i,l)}};var nL=cT,At=cT.prototype;At.CANVAS_LAYERS=3;At.SELECT_BOX=0;At.DRAG=1;At.NODE=2;At.WEBGL=3;At.CANVAS_TYPES=["2d","2d","2d","webgl2"];At.BUFFER_COUNT=3;At.TEXTURE_BUFFER=0;At.MOTIONBLUR_BUFFER_NODE=1;At.MOTIONBLUR_BUFFER_DRAG=2;function cT(t){var e=this,n=e.cy.window(),r=n.document;t.webgl&&(At.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(At.CANVAS_LAYERS),contexts:new Array(At.CANVAS_LAYERS),canvasNeedsRedraw:new Array(At.CANVAS_LAYERS),bufferCanvases:new Array(At.BUFFER_COUNT),bufferContexts:new Array(At.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",l="rgba(0,0,0,0)";e.data.canvasContainer=r.createElement("div");var s=e.data.canvasContainer.style;e.data.canvasContainer.style[i]=l,s.position="relative",s.zIndex="0",s.overflow="hidden";var u=t.cy.container();u.appendChild(e.data.canvasContainer),u.style[i]=l;var f={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};Zk()&&(f["-ms-touch-action"]="none",f["touch-action"]="none");for(var c=0;c<At.CANVAS_LAYERS;c++){var h=e.data.canvases[c]=r.createElement("canvas"),v=At.CANVAS_TYPES[c];e.data.contexts[c]=h.getContext(v),e.data.contexts[c]||mn("Could not create canvas of type "+v),Object.keys(f).forEach(function(ge){h.style[ge]=f[ge]}),h.style.position="absolute",h.setAttribute("data-id","layer"+c),h.style.zIndex=String(At.CANVAS_LAYERS-c),e.data.canvasContainer.appendChild(h),e.data.canvasNeedsRedraw[c]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[At.NODE].setAttribute("data-id","layer"+At.NODE+"-node"),e.data.canvases[At.SELECT_BOX].setAttribute("data-id","layer"+At.SELECT_BOX+"-selectbox"),e.data.canvases[At.DRAG].setAttribute("data-id","layer"+At.DRAG+"-drag"),e.data.canvases[At.WEBGL]&&e.data.canvases[At.WEBGL].setAttribute("data-id","layer"+At.WEBGL+"-webgl");for(var c=0;c<At.BUFFER_COUNT;c++)e.data.bufferCanvases[c]=r.createElement("canvas"),e.data.bufferContexts[c]=e.data.bufferCanvases[c].getContext("2d"),e.data.bufferCanvases[c].style.position="absolute",e.data.bufferCanvases[c].setAttribute("data-id","buffer"+c),e.data.bufferCanvases[c].style.zIndex=String(-c-1),e.data.bufferCanvases[c].style.visibility="hidden";e.pathsEnabled=!0;var p=yr(),m=function(te){return{x:(te.x1+te.x2)/2,y:(te.y1+te.y2)/2}},y=function(te){return{x:-te.w/2,y:-te.h/2}},w=function(te){var le=te[0]._private,fe=le.oldBackgroundTimestamp===le.backgroundTimestamp;return!fe},S=function(te){return te[0]._private.nodeKey},x=function(te){return te[0]._private.labelStyleKey},C=function(te){return te[0]._private.sourceLabelStyleKey},T=function(te){return te[0]._private.targetLabelStyleKey},A=function(te,le,fe,Ee,Re){return e.drawElement(te,le,fe,!1,!1,Re)},N=function(te,le,fe,Ee,Re){return e.drawElementText(te,le,fe,Ee,"main",Re)},k=function(te,le,fe,Ee,Re){return e.drawElementText(te,le,fe,Ee,"source",Re)},_=function(te,le,fe,Ee,Re){return e.drawElementText(te,le,fe,Ee,"target",Re)},O=function(te){return te.boundingBox(),te[0]._private.bodyBounds},P=function(te){return te.boundingBox(),te[0]._private.labelBounds.main||p},M=function(te){return te.boundingBox(),te[0]._private.labelBounds.source||p},F=function(te){return te.boundingBox(),te[0]._private.labelBounds.target||p},U=function(te,le){return le},j=function(te){return m(O(te))},K=function(te,le,fe){var Ee=te?te+"-":"";return{x:le.x+fe.pstyle(Ee+"text-margin-x").pfValue,y:le.y+fe.pstyle(Ee+"text-margin-y").pfValue}},$=function(te,le,fe){var Ee=te[0]._private.rscratch;return{x:Ee[le],y:Ee[fe]}},B=function(te){return K("",$(te,"labelX","labelY"),te)},H=function(te){return K("source",$(te,"sourceLabelX","sourceLabelY"),te)},Y=function(te){return K("target",$(te,"targetLabelX","targetLabelY"),te)},Q=function(te){return y(O(te))},z=function(te){return y(M(te))},I=function(te){return y(F(te))},q=function(te){var le=P(te),fe=y(P(te));if(te.isNode()){switch(te.pstyle("text-halign").value){case"left":fe.x=-le.w-(le.leftPad||0);break;case"right":fe.x=-(le.rightPad||0);break}switch(te.pstyle("text-valign").value){case"top":fe.y=-le.h-(le.topPad||0);break;case"bottom":fe.y=-(le.botPad||0);break}}return fe},L=e.data.eleTxrCache=new nu(e,{getKey:S,doesEleInvalidateKey:w,drawElement:A,getBoundingBox:O,getRotationPoint:j,getRotationOffset:Q,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),W=e.data.lblTxrCache=new nu(e,{getKey:x,drawElement:N,getBoundingBox:P,getRotationPoint:B,getRotationOffset:q,isVisible:U}),ae=e.data.slbTxrCache=new nu(e,{getKey:C,drawElement:k,getBoundingBox:M,getRotationPoint:H,getRotationOffset:z,isVisible:U}),se=e.data.tlbTxrCache=new nu(e,{getKey:T,drawElement:_,getBoundingBox:F,getRotationPoint:Y,getRotationOffset:I,isVisible:U}),me=e.data.lyrTxrCache=new QC(e);e.onUpdateEleCalcs(function(te,le){L.invalidateElements(le),W.invalidateElements(le),ae.invalidateElements(le),se.invalidateElements(le),me.invalidateElements(le);for(var fe=0;fe<le.length;fe++){var Ee=le[fe]._private;Ee.oldBackgroundTimestamp=Ee.backgroundTimestamp}});var ke=function(te){for(var le=0;le<te.length;le++)me.enqueueElementRefinement(te[le].ele)};L.onDequeue(ke),W.onDequeue(ke),ae.onDequeue(ke),se.onDequeue(ke),t.webgl&&e.initWebgl(t,{getStyleKey:S,getLabelKey:x,getSourceLabelKey:C,getTargetLabelKey:T,drawElement:A,drawLabel:N,drawSourceLabel:k,drawTargetLabel:_,getElementBox:O,getLabelBox:P,getSourceLabelBox:M,getTargetLabelBox:F,getElementRotationPoint:j,getElementRotationOffset:Q,getLabelRotationPoint:B,getSourceLabelRotationPoint:H,getTargetLabelRotationPoint:Y,getLabelRotationOffset:q,getSourceLabelRotationOffset:z,getTargetLabelRotationOffset:I})}At.redrawHint=function(t,e){var n=this;switch(t){case"eles":n.data.canvasNeedsRedraw[At.NODE]=e;break;case"drag":n.data.canvasNeedsRedraw[At.DRAG]=e;break;case"select":n.data.canvasNeedsRedraw[At.SELECT_BOX]=e;break;case"gc":n.data.gc=!0;break}};var rL=typeof Path2D<"u";At.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};At.usePaths=function(){return rL&&this.pathsEnabled};At.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};At.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};At.makeOffscreenCanvas=function(t,e){var n;if((typeof OffscreenCanvas>"u"?"undefined":Hn(OffscreenCanvas))!=="undefined")n=new OffscreenCanvas(t,e);else{var r=this.cy.window(),i=r.document;n=i.createElement("canvas"),n.width=t,n.height=e}return n};[WC,Aa,Wa,_m,Nl,Vi,br,rT,$i,Ou,uT].forEach(function(t){gt(At,t)});var aL=[{name:"null",impl:zC},{name:"base",impl:YC},{name:"canvas",impl:nL}],iL=[{type:"layout",extensions:NO},{type:"renderer",extensions:aL}],fT={},dT={};function hT(t,e,n){var r=n,i=function(O){Kt("Can not register `"+e+"` for `"+t+"` since `"+O+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(mu.prototype[e])return i(e);mu.prototype[e]=n}else if(t==="collection"){if(ar.prototype[e])return i(e);ar.prototype[e]=n}else if(t==="layout"){for(var l=function(O){this.options=O,n.call(this,O),Pt(this._private)||(this._private={}),this._private.cy=O.cy,this._private.listeners=[],this.createEmitter()},s=l.prototype=Object.create(n.prototype),u=[],f=0;f<u.length;f++){var c=u[f];s[c]=s[c]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var h=n.prototype.stop;s.stop=function(){var _=this.options;if(_&&_.animate){var O=this.animations;if(O)for(var P=0;P<O.length;P++)O[P].stop()}return h?h.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var v=function(O){return O._private.cy},p={addEventFields:function(O,P){P.layout=O,P.cy=v(O),P.target=O},bubble:function(){return!0},parent:function(O){return v(O)}};gt(s,{createEmitter:function(){return this._private.emitter=new ud(p,this),this},emitter:function(){return this._private.emitter},on:function(O,P){return this.emitter().on(O,P),this},one:function(O,P){return this.emitter().one(O,P),this},once:function(O,P){return this.emitter().one(O,P),this},removeListener:function(O,P){return this.emitter().removeListener(O,P),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(O,P){return this.emitter().emit(O,P),this}}),$t.eventAliasesOn(s),r=l}else if(t==="renderer"&&e!=="null"&&e!=="base"){var m=vT("renderer","base"),y=m.prototype,w=n,S=n.prototype,x=function(){m.apply(this,arguments),w.apply(this,arguments)},C=x.prototype;for(var T in y){var A=y[T],N=S[T]!=null;if(N)return i(T);C[T]=A}for(var k in S)C[k]=S[k];y.clientFunctions.forEach(function(_){C[_]=C[_]||function(){mn("Renderer does not implement `renderer."+_+"()` on its prototype")}}),r=x}else if(t==="__proto__"||t==="constructor"||t==="prototype")return mn(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return MS({map:fT,keys:[t,e],value:r})}function vT(t,e){return OS({map:fT,keys:[t,e]})}function lL(t,e,n,r,i){return MS({map:dT,keys:[t,e,n,r],value:i})}function sL(t,e,n,r){return OS({map:dT,keys:[t,e,n,r]})}var Vp=function(){if(arguments.length===2)return vT.apply(null,arguments);if(arguments.length===3)return hT.apply(null,arguments);if(arguments.length===4)return sL.apply(null,arguments);if(arguments.length===5)return lL.apply(null,arguments);mn("Invalid extension access syntax")};mu.prototype.extension=Vp;iL.forEach(function(t){t.extensions.forEach(function(e){hT(t.type,e.name,e.impl)})});var $f=function(){if(!(this instanceof $f))return new $f;this.length=0},Dl=$f.prototype;Dl.instanceString=function(){return"stylesheet"};Dl.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};Dl.css=function(t,e){var n=this.length-1;if(ut(t))this[n].properties.push({name:t,value:e});else if(Pt(t))for(var r=t,i=Object.keys(r),l=0;l<i.length;l++){var s=i[l],u=r[s];if(u!=null){var f=Zn.properties[s]||Zn.properties[Jf(s)];if(f!=null){var c=f.name,h=u;this[n].properties.push({name:c,value:h})}}}return this};Dl.style=Dl.css;Dl.generateStyle=function(t){var e=new Zn(t);return this.appendToStyle(e)};Dl.appendToStyle=function(t){for(var e=0;e<this.length;e++){var n=this[e],r=n.selector,i=n.properties;t.selector(r);for(var l=0;l<i.length;l++){var s=i[l];t.css(s.name,s.value)}}return t};var oL="3.33.2",Al=function(e){if(e===void 0&&(e={}),Pt(e))return new mu(e);if(ut(e))return Vp.apply(Vp,arguments)};Al.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(Al),t.apply(null,e),this};Al.warnings=function(t){return US(t)};Al.version=oL;Al.stylesheet=Al.Stylesheet=$f;const uL=[{id:"source",label:"Source",color:"#f59e0b",shape:"shape-round"},{id:"module",label:"Module",color:"#fb7185",shape:""},{id:"symbol",label:"Symbol",color:"#8b5cf6",shape:"shape-diamond"},{id:"rationale",label:"Rationale",color:"#14b8a6",shape:"shape-hex"},{id:"concept",label:"Concept",color:"#0ea5e9",shape:""},{id:"entity",label:"Entity",color:"#22c55e",shape:"shape-round"}],cL=[{label:"Structural (extracted)",color:"rgba(148, 163, 184, 0.7)",style:"line-solid"},{label:"Inferred",color:"rgba(56, 189, 248, 0.7)",style:"line-solid"},{label:"Conflicted",color:"var(--c-text-error)",style:"line-solid"},{label:"Similarity",color:"rgba(249, 115, 22, 0.7)",style:"line-dashed"}];function fL(){const[t,e]=pe.useState(!0);return t?D.jsxs("aside",{className:"canvas-legend","aria-label":"Graph legend",children:[D.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[D.jsx("span",{className:"canvas-legend-heading",children:"Legend"}),D.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>e(!1),"aria-label":"Hide legend",title:"Hide legend",children:"×"})]}),D.jsxs("div",{className:"canvas-legend-group",children:[D.jsx("span",{className:"label",children:"Nodes"}),uL.map(n=>D.jsxs("div",{className:"legend-row",children:[D.jsx("span",{className:`legend-swatch ${n.shape}`,style:{background:n.color},"aria-hidden":"true"}),D.jsx("span",{children:n.label})]},n.id))]}),D.jsxs("div",{className:"canvas-legend-group",style:{marginTop:"var(--sp-2)"},children:[D.jsx("span",{className:"label",children:"Edges"}),cL.map(n=>D.jsxs("div",{className:"legend-row",children:[D.jsx("span",{className:`legend-swatch ${n.style}`,style:{color:n.color},"aria-hidden":"true"}),D.jsx("span",{children:n.label})]},n.label))]})]}):D.jsx("button",{type:"button",className:"btn legend-toggle",onClick:()=>e(!0),title:"Show legend","aria-label":"Show legend",children:"Legend"})}const Ai=180,_i=120;function dL({cyRef:t}){const e=pe.useRef(null),n=pe.useRef(null),[r,i]=pe.useState(null);pe.useEffect(()=>{const s=t.current;if(!s)return;const u=()=>{const c=n.current?.getContext("2d");if(!c)return;c.clearRect(0,0,Ai,_i);const h=s.nodes();if(h.empty())return;const v=h.boundingBox({includeNodes:!0,includeEdges:!1}),p=v.w===0?1:v.w,m=v.h===0?1:v.h,y=Math.min((Ai-8)/p,(_i-8)/m),w=(Ai-p*y)/2,S=(_i-m*y)/2;c.fillStyle="rgba(125, 211, 252, 0.7)",h.forEach(k=>{const _=k.position(),O=(_.x-v.x1)*y+w,P=(_.y-v.y1)*y+S;c.beginPath(),c.arc(O,P,1.4,0,Math.PI*2),c.fill()});const x=s.extent(),C=(x.x1-v.x1)*y+w,T=(x.y1-v.y1)*y+S,A=(x.x2-x.x1)*y,N=(x.y2-x.y1)*y;i({x:Math.max(0,Math.min(Ai,C)),y:Math.max(0,Math.min(_i,T)),w:Math.max(2,Math.min(Ai,A)),h:Math.max(2,Math.min(_i,N))})};u();const f=()=>requestAnimationFrame(u);return s.on("pan zoom add remove position layoutstop",f),()=>{s.off("pan zoom add remove position layoutstop",f)}},[t]);const l=s=>{const u=t.current;if(!u||!e.current)return;const f=e.current.getBoundingClientRect(),c=s.clientX-f.left,h=s.clientY-f.top,v=u.nodes();if(v.empty())return;const p=v.boundingBox({includeNodes:!0,includeEdges:!1}),m=Math.min((Ai-8)/Math.max(1,p.w),(_i-8)/Math.max(1,p.h)),y=(Ai-p.w*m)/2,w=(_i-p.h*m)/2,S=(c-y)/m+p.x1,x=(h-w)/m+p.y1;u.center({position:()=>({x:S,y:x})})};return D.jsxs("div",{ref:e,className:"canvas-minimap",role:"presentation",onClick:l,"aria-hidden":"true",children:[D.jsx("canvas",{ref:n,width:Ai,height:_i,style:{width:"100%",height:"100%"}}),r?D.jsx("div",{className:"canvas-minimap-viewport",style:{left:r.x,top:r.y,width:r.w,height:r.h}}):null]})}function hL(t,e){const n=[],r=[];for(const i of t.hyperedges??[]){const l=i.nodeIds.filter(u=>e.has(u));if(l.length<2)continue;const s=`hyper:${i.id}`;n.push({data:{id:s,label:i.relation,hyperedgeId:i.id,relation:i.relation,isHub:!0,color:"#a78bfa"},classes:"hyper"});for(const u of l)r.push({data:{id:`hyper-edge:${i.id}:${u}`,source:s,target:u,relation:i.relation,hyperedgeId:i.id,isHubEdge:!0},classes:"hyperEdge"})}return{hubNodes:n,hubEdges:r}}function vL(t){typeof window>"u"||(window.__SWARMVAULT_TEST__={getNodeIds:()=>t.nodes().map(e=>e.id()),getConnectedNodePair:()=>{const e=t.edges()[0];return!e||e.empty()?null:{from:e.source().id(),to:e.target().id()}},getRenderedNodePosition:e=>{const n=t.getElementById(e);if(!n||n.empty())return null;const r=n.renderedPosition();return{x:r.x,y:r.y}},clearSelection:()=>{t.elements(":selected").unselect()},hasClass:(e,n)=>{const r=t.getElementById(e);return!r.empty()&&r.hasClass(n)}})}function gL(t,e){typeof window>"u"||!window.__SWARMVAULT_TEST__||e===t&&delete window.__SWARMVAULT_TEST__}const pL={source:"#f59e0b",module:"#fb7185",symbol:"#8b5cf6",rationale:"#14b8a6",concept:"#0ea5e9",entity:"#22c55e"},mL={cose:"Force (cose)",concentric:"Concentric",circle:"Circle",breadthfirst:"Hierarchy",grid:"Grid"},yL={cose:{name:"cose",animate:!1,idealEdgeLength:280,nodeRepulsion:12e4,nodeOverlap:60,gravity:.08,nestingFactor:1.2,edgeElasticity:100,numIter:3e3},concentric:{name:"concentric",animate:!1,minNodeSpacing:30,levelWidth:()=>1},circle:{name:"circle",animate:!1,radius:320},breadthfirst:{name:"breadthfirst",animate:!1,spacingFactor:1.4,directed:!0},grid:{name:"grid",animate:!1,padding:40}};function bL({graph:t,edgeStatusFilter:e,communityFilter:n,sourceClassFilter:r,selectedTags:i=[],pathResult:l,onNodeSelect:s,cyRef:u,fitTrigger:f,pageTags:c,onLayoutChange:h}){const v=pe.useRef(null),[p,m]=pe.useState("cose"),[y,w]=pe.useState("auto"),[S,x]=pe.useState(!0),C=pe.useEffectEvent(M=>{s(M)}),T=pe.useEffectEvent(M=>{u.current?.destroy(),u.current=M}),A=pe.useEffectEvent(M=>{u.current===M&&(u.current=null),M.destroy()}),N=pe.useEffectEvent(M=>{const F=u.current;if(F&&(F.elements().removeClass("path-node path-edge"),M)){for(const U of M.nodeIds)F.getElementById(U).addClass("path-node");for(const U of M.edgeIds)F.getElementById(U).addClass("path-edge")}}),k=pe.useEffectEvent(()=>{u.current?.resize()}),_=(()=>{if(!t||i.length===0||!c)return null;const M=new Set;for(const F of t.nodes){if(!F.pageId)continue;const U=c[F.pageId]??[];i.every(j=>U.includes(j))&&M.add(F.id)}return M})();pe.useEffect(()=>{if(!v.current||!t)return;const M=new Set(t.nodes.filter(B=>n==="all"||B.communityId===n).filter(B=>r==="all"||(B.sourceClass??"")===r).filter(B=>!_||_.has(B.id)).map(B=>B.id)),F=y==="always"?"data(label)":y==="never"?"":"data(label)",U=y==="always"?0:y==="never"?999:.5,{hubNodes:j,hubEdges:K}=S?hL(t,M):{hubNodes:[],hubEdges:[]},$=Al({container:v.current,elements:[...t.nodes.filter(B=>M.has(B.id)).map(B=>({data:{...B,color:pL[B.type]??"#94a3b8"}})),...j,...t.edges.filter(B=>M.has(B.source)&&M.has(B.target)).filter(B=>e==="all"||B.status===e).map(B=>({data:B,classes:[B.relation==="semantically_similar_to"?"similarity-edge":"",B.status==="conflicted"?"conflicted-edge":"",B.status==="inferred"?"inferred-edge":""].filter(Boolean).join(" ")})),...K],layout:yL[p],style:[{selector:"node",style:{label:F,"background-color":"data(color)","background-opacity":.85,color:"var(--c-text-primary)","font-family":'"Inter", "Segoe UI", system-ui, sans-serif',"font-size":11,"font-weight":"normal","text-halign":"center","text-valign":"bottom","text-margin-y":7,"text-max-width":"100px","text-wrap":"ellipsis","min-zoomed-font-size":U,"text-background-opacity":.55,"text-background-color":"var(--c-bg-base)","text-background-padding":"2px","text-background-shape":"roundrectangle","border-width":0,"overlay-padding":4}},{selector:"node[?isGodNode]",style:{width:56,height:56,"border-width":1.5,"border-color":"rgba(254, 240, 138, 0.65)","border-opacity":1,"background-opacity":1,"font-size":12,"font-weight":"bold","text-max-width":"140px","z-index":12}},{selector:'node[type = "module"]',style:{shape:"round-rectangle",width:44,height:28,"z-index":8}},{selector:'node[type = "symbol"]',style:{shape:"diamond",width:20,height:20,"background-opacity":.6}},{selector:'node[type = "rationale"]',style:{shape:"hexagon",width:28,height:28,"background-opacity":.75}},{selector:'node[type = "source"]',style:{shape:"ellipse",width:32,height:32,"background-opacity":.95,"z-index":10}},{selector:'node[type = "concept"]',style:{shape:"round-rectangle",width:34,height:22,"background-opacity":.7}},{selector:'node[type = "entity"]',style:{shape:"ellipse",width:26,height:26,"background-opacity":.7}},{selector:"edge",style:{width:.8,"line-color":"rgba(71, 85, 105, 0.45)","target-arrow-shape":"triangle-backcurve","target-arrow-color":"rgba(71, 85, 105, 0.45)","arrow-scale":.6,"curve-style":"bezier","font-size":8,"text-background-opacity":0,"text-background-color":"var(--c-bg-base)","text-background-padding":"2px","text-background-shape":"roundrectangle","text-rotation":"autorotate","text-margin-y":-8}},{selector:"edge:selected",style:{label:"data(relation)",width:2,"text-background-opacity":.7}},{selector:".similarity-edge",style:{"line-style":"dashed","line-color":"rgba(249, 115, 22, 0.5)","target-arrow-color":"rgba(249, 115, 22, 0.5)","line-dash-pattern":[6,4]}},{selector:".inferred-edge",style:{"line-color":"rgba(56, 189, 248, 0.6)","target-arrow-color":"rgba(56, 189, 248, 0.6)"}},{selector:".conflicted-edge",style:{"line-color":"rgba(248, 113, 113, 0.7)","target-arrow-color":"rgba(248, 113, 113, 0.7)",width:1.5}},{selector:".path-node",style:{"border-width":3,"border-color":"#38bdf8","background-opacity":1,"z-index":100}},{selector:".path-edge",style:{width:2.5,"line-color":"#38bdf8","target-arrow-color":"#38bdf8",label:"data(relation)","text-background-opacity":.7,"z-index":100}},{selector:":selected",style:{"border-width":2,"border-color":"#e2e8f0"}},{selector:"node:active",style:{"overlay-color":"#38bdf8","overlay-opacity":.12}},{selector:"node.hyper",style:{shape:"round-rectangle",width:18,height:14,"background-color":"#0f172a","background-opacity":.85,"border-width":1.5,"border-color":"#a78bfa","border-style":"dashed",color:"#c4b5fd","font-size":9,"font-weight":"normal","text-max-width":"120px","z-index":4}},{selector:"edge.hyperEdge",style:{width:.8,"line-color":"rgba(167, 139, 250, 0.55)","line-style":"dashed","line-dash-pattern":[4,3],"target-arrow-shape":"none","curve-style":"straight"}}]});return $.on("select","node",B=>C(B.target.data())),$.on("unselect","node",()=>C(null)),$.on("tap",B=>{B.target===$&&($.elements(":selected").unselect(),C(null))}),$.on("mouseover","edge",B=>{B.target.style("label",B.target.data("relation")??""),B.target.style("width",1.8),B.target.style("z-index",999)}),$.on("mouseout","edge",B=>{!B.target.selected()&&!B.target.hasClass("path-edge")&&(B.target.removeStyle("label"),B.target.removeStyle("width"),B.target.removeStyle("z-index"))}),$.on("mouseover","node",B=>{B.target.style("text-max-width","200px"),B.target.style("text-wrap","wrap"),B.target.style("z-index",999)}),$.on("mouseout","node",B=>{B.target.selected()||(B.target.removeStyle("text-max-width"),B.target.removeStyle("text-wrap"),B.target.removeStyle("z-index"))}),T($),vL($),()=>{gL($,u.current),A($)}},[n,e,t,r,p,y,_,u,S]),pe.useEffect(()=>{N(l)},[l]),pe.useEffect(()=>{const M=v.current;if(!M)return;const F=new ResizeObserver(()=>k());return F.observe(M),()=>F.disconnect()},[]),pe.useEffect(()=>{f!=null&&u.current?.fit(void 0,30)},[f,u.current?.fit]);const O=()=>u.current?.fit(void 0,30),P=()=>u.current?.reset();return D.jsxs("div",{className:"canvas-wrap",children:[D.jsxs("div",{className:"canvas-toolbar",role:"toolbar","aria-label":"Graph view controls",children:[D.jsxs("div",{className:"canvas-toolbar-group",children:[D.jsx("label",{htmlFor:"layout-select",className:"label",children:"Layout"}),D.jsx("select",{id:"layout-select",className:"input",value:p,onChange:M=>{const F=M.target.value;m(F),h?.(F)},children:Object.entries(mL).map(([M,F])=>D.jsx("option",{value:M,children:F},M))})]}),D.jsxs("div",{className:"canvas-toolbar-group",children:[D.jsx("label",{htmlFor:"label-mode",className:"label",children:"Labels"}),D.jsxs("select",{id:"label-mode",className:"input",value:y,onChange:M=>w(M.target.value),children:[D.jsx("option",{value:"auto",children:"Auto"}),D.jsx("option",{value:"always",children:"Always"}),D.jsx("option",{value:"never",children:"Never"})]})]}),D.jsx("div",{className:"canvas-toolbar-group",children:D.jsxs("label",{className:"label",htmlFor:"hyperedge-toggle",children:[D.jsx("input",{id:"hyperedge-toggle",type:"checkbox","data-testid":"hyperedge-toggle","aria-label":"Show hyperedges",checked:S,onChange:M=>x(M.target.checked)})," ","Show hyperedges"]})}),D.jsxs("div",{className:"canvas-toolbar-group",children:[D.jsx("button",{type:"button",className:"btn",onClick:O,title:"Fit to viewport (F)",children:"Fit"}),D.jsx("button",{type:"button",className:"btn",onClick:P,title:"Reset zoom",children:"Reset"})]})]}),D.jsx("div",{className:"canvas","data-testid":"graph-canvas",ref:v}),D.jsx(fL,{}),D.jsx(dL,{cyRef:u})]})}function EL({graphQueryInput:t,onGraphQueryInputChange:e,onRunQuery:n,graphQueryResult:r,pathFrom:i,onPathFromChange:l,pathTo:s,onPathToChange:u,onHighlightPath:f,pathResult:c,graphError:h,graph:v,onOpenPage:p,onNavigateNode:m}){return D.jsxs("section",{className:"panel","data-testid":"graph-tools",children:[D.jsx("h3",{className:"panel-heading",children:"Graph Tools"}),h?D.jsx("p",{className:"text-error",children:h}):null,D.jsxs("div",{className:"card-list",children:[D.jsxs("article",{className:"card",children:[D.jsx("span",{className:"label",children:"query"}),D.jsx("input",{type:"search",className:"input","data-testid":"graph-query-input","aria-label":"Graph query",value:t,onChange:y=>e(y.target.value),placeholder:"Ask a question about the graph\\u2026"}),D.jsx("button",{type:"button",className:"btn btn-primary","data-testid":"graph-query-run",onClick:n,children:"Run"}),r?D.jsxs(D.Fragment,{children:[D.jsx("p",{className:"text-secondary text-sm",children:r.summary}),D.jsxs("div",{className:"chip-row",children:[r.hyperedgeIds.map(y=>v?.hyperedges?.find(w=>w.id===y)).filter(y=>!!y).slice(0,2).map(y=>D.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{const w=y.nodeIds[0];w&&m(w)},children:y.label},y.id)),r.pageIds.map(y=>v?.pages?.find(w=>w.id===y)).filter(y=>!!y).slice(0,4).map(y=>D.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{p(y.path,y.id)},children:y.title},y.id))]})]}):null]}),D.jsxs("article",{className:"card",children:[D.jsx("span",{className:"label",children:"path"}),D.jsx("input",{type:"text",className:"input","data-testid":"graph-path-from","aria-label":"Path from node",value:i,onChange:y=>l(y.target.value),placeholder:"From node ID or label\\u2026"}),D.jsx("input",{type:"text",className:"input","data-testid":"graph-path-to","aria-label":"Path to node",value:s,onChange:y=>u(y.target.value),placeholder:"To node ID or label\\u2026"}),D.jsx("button",{type:"button",className:"btn btn-primary","data-testid":"graph-path-highlight",onClick:f,children:"Highlight"}),c?D.jsx("p",{className:"text-secondary text-sm","data-testid":"graph-path-summary",children:c.summary}):null]})]})]})}const xL={error:"is-error",warning:"is-warning",info:"is-info"};function wL({findings:t,error:e,onOpenPage:n}){if(e)return D.jsxs("section",{className:"panel","aria-label":"Lint findings",children:[D.jsx("h3",{className:"panel-heading",children:"Lint Findings"}),D.jsx("p",{className:"text-error",children:e})]});if(!t.length)return D.jsxs("section",{className:"panel","aria-label":"Lint findings",children:[D.jsx("h3",{className:"panel-heading",children:"Lint Findings"}),D.jsxs("p",{className:"text-muted text-sm",children:["No lint findings. Run ",D.jsx("code",{children:"swarmvault lint --deep"})," for a fresh sweep."]})]});const r=t.reduce((i,l)=>{const s=i[l.category]??[];return s.push(l),i[l.category]=s,i},{});return D.jsxs("section",{className:"panel","aria-label":"Lint findings",children:[D.jsxs("h3",{className:"panel-heading",children:["Lint Findings ",D.jsxs("span",{className:"panel-meta",children:[t.length," total"]})]}),D.jsx("div",{className:"card-list",children:Object.entries(r).map(([i,l])=>D.jsxs("div",{children:[D.jsxs("p",{className:"label",style:{marginBottom:4},children:[i," · ",l.length]}),D.jsxs("div",{className:"card-list",children:[l.slice(0,12).map(s=>D.jsxs("article",{className:`lint-finding ${xL[s.severity]}`,children:[D.jsx("strong",{className:"text-sm",children:s.message}),s.pagePath?D.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>{n(s.pagePath??"",s.pageId)},children:"Open page"}):null]},s.id)),l.length>12?D.jsxs("p",{className:"text-muted text-sm",children:["+",l.length-12," more"]}):null]})]},i))})]})}function SL(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const CL=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TL=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,DL={};function gw(t,e){return(DL.jsx?TL:CL).test(t)}const AL=/[ \t\n\f\r]/g;function _L(t){return typeof t=="object"?t.type==="text"?pw(t.value):!1:pw(t)}function pw(t){return t.replace(AL,"")===""}class Bu{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Bu.prototype.normal={};Bu.prototype.property={};Bu.prototype.space=void 0;function gT(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new Bu(n,r,e)}function $p(t){return t.toLowerCase()}class Mr{constructor(e,n){this.attribute=n,this.property=e}}Mr.prototype.attribute="";Mr.prototype.booleanish=!1;Mr.prototype.boolean=!1;Mr.prototype.commaOrSpaceSeparated=!1;Mr.prototype.commaSeparated=!1;Mr.prototype.defined=!1;Mr.prototype.mustUseProperty=!1;Mr.prototype.number=!1;Mr.prototype.overloadedBoolean=!1;Mr.prototype.property="";Mr.prototype.spaceSeparated=!1;Mr.prototype.space=void 0;let kL=0;const Dt=Rl(),In=Rl(),Kp=Rl(),Be=Rl(),cn=Rl(),Ls=Rl(),qr=Rl();function Rl(){return 2**++kL}const Yp=Object.freeze(Object.defineProperty({__proto__:null,boolean:Dt,booleanish:In,commaOrSpaceSeparated:qr,commaSeparated:Ls,number:Be,overloadedBoolean:Kp,spaceSeparated:cn},Symbol.toStringTag,{value:"Module"})),ip=Object.keys(Yp);class Nm extends Mr{constructor(e,n,r,i){let l=-1;if(super(e,n),mw(this,"space",i),typeof r=="number")for(;++l<ip.length;){const s=ip[l];mw(this,ip[l],(r&Yp[s])===Yp[s])}}}Nm.prototype.defined=!0;function mw(t,e,n){n&&(t[e]=n)}function $s(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const l=new Nm(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),e[r]=l,n[$p(r)]=r,n[$p(l.attribute)]=r}return new Bu(e,n,t.space)}const pT=$s({properties:{ariaActiveDescendant:null,ariaAtomic:In,ariaAutoComplete:null,ariaBusy:In,ariaChecked:In,ariaColCount:Be,ariaColIndex:Be,ariaColSpan:Be,ariaControls:cn,ariaCurrent:null,ariaDescribedBy:cn,ariaDetails:null,ariaDisabled:In,ariaDropEffect:cn,ariaErrorMessage:null,ariaExpanded:In,ariaFlowTo:cn,ariaGrabbed:In,ariaHasPopup:null,ariaHidden:In,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:cn,ariaLevel:Be,ariaLive:null,ariaModal:In,ariaMultiLine:In,ariaMultiSelectable:In,ariaOrientation:null,ariaOwns:cn,ariaPlaceholder:null,ariaPosInSet:Be,ariaPressed:In,ariaReadOnly:In,ariaRelevant:null,ariaRequired:In,ariaRoleDescription:cn,ariaRowCount:Be,ariaRowIndex:Be,ariaRowSpan:Be,ariaSelected:In,ariaSetSize:Be,ariaSort:null,ariaValueMax:Be,ariaValueMin:Be,ariaValueNow:Be,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function mT(t,e){return e in t?t[e]:e}function yT(t,e){return mT(t,e.toLowerCase())}const NL=$s({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ls,acceptCharset:cn,accessKey:cn,action:null,allow:null,allowFullScreen:Dt,allowPaymentRequest:Dt,allowUserMedia:Dt,alt:null,as:null,async:Dt,autoCapitalize:null,autoComplete:cn,autoFocus:Dt,autoPlay:Dt,blocking:cn,capture:null,charSet:null,checked:Dt,cite:null,className:cn,cols:Be,colSpan:null,content:null,contentEditable:In,controls:Dt,controlsList:cn,coords:Be|Ls,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Dt,defer:Dt,dir:null,dirName:null,disabled:Dt,download:Kp,draggable:In,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Dt,formTarget:null,headers:cn,height:Be,hidden:Kp,high:Be,href:null,hrefLang:null,htmlFor:cn,httpEquiv:cn,id:null,imageSizes:null,imageSrcSet:null,inert:Dt,inputMode:null,integrity:null,is:null,isMap:Dt,itemId:null,itemProp:cn,itemRef:cn,itemScope:Dt,itemType:cn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Dt,low:Be,manifest:null,max:null,maxLength:Be,media:null,method:null,min:null,minLength:Be,multiple:Dt,muted:Dt,name:null,nonce:null,noModule:Dt,noValidate:Dt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Dt,optimum:Be,pattern:null,ping:cn,placeholder:null,playsInline:Dt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Dt,referrerPolicy:null,rel:cn,required:Dt,reversed:Dt,rows:Be,rowSpan:Be,sandbox:cn,scope:null,scoped:Dt,seamless:Dt,selected:Dt,shadowRootClonable:Dt,shadowRootDelegatesFocus:Dt,shadowRootMode:null,shape:null,size:Be,sizes:null,slot:null,span:Be,spellCheck:In,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Be,step:null,style:null,tabIndex:Be,target:null,title:null,translate:null,type:null,typeMustMatch:Dt,useMap:null,value:In,width:Be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:cn,axis:null,background:null,bgColor:null,border:Be,borderColor:null,bottomMargin:Be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Dt,declare:Dt,event:null,face:null,frame:null,frameBorder:null,hSpace:Be,leftMargin:Be,link:null,longDesc:null,lowSrc:null,marginHeight:Be,marginWidth:Be,noResize:Dt,noHref:Dt,noShade:Dt,noWrap:Dt,object:null,profile:null,prompt:null,rev:null,rightMargin:Be,rules:null,scheme:null,scrolling:In,standby:null,summary:null,text:null,topMargin:Be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Be,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Dt,disableRemotePlayback:Dt,prefix:null,property:null,results:Be,security:null,unselectable:null},space:"html",transform:yT}),RL=$s({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:qr,accentHeight:Be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Be,amplitude:Be,arabicForm:null,ascent:Be,attributeName:null,attributeType:null,azimuth:Be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Be,by:null,calcMode:null,capHeight:Be,className:cn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Be,diffuseConstant:Be,direction:null,display:null,dur:null,divisor:Be,dominantBaseline:null,download:Dt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Be,enableBackground:null,end:null,event:null,exponent:Be,externalResourcesRequired:null,fill:null,fillOpacity:Be,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ls,g2:Ls,glyphName:Ls,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Be,horizOriginX:Be,horizOriginY:Be,id:null,ideographic:Be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Be,k:Be,k1:Be,k2:Be,k3:Be,k4:Be,kernelMatrix:qr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Be,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Be,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Be,overlineThickness:Be,paintOrder:null,panose1:null,path:null,pathLength:Be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:cn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Be,pointsAtY:Be,pointsAtZ:Be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:qr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:qr,rev:qr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:qr,requiredFeatures:qr,requiredFonts:qr,requiredFormats:qr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Be,specularExponent:Be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Be,strikethroughThickness:Be,string:null,stroke:null,strokeDashArray:qr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Be,strokeOpacity:Be,strokeWidth:null,style:null,surfaceScale:Be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:qr,tabIndex:Be,tableValues:null,target:null,targetX:Be,targetY:Be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:qr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Be,underlineThickness:Be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Be,values:null,vAlphabetic:Be,vMathematical:Be,vectorEffect:null,vHanging:Be,vIdeographic:Be,version:null,vertAdvY:Be,vertOriginX:Be,vertOriginY:Be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mT}),bT=$s({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),ET=$s({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yT}),xT=$s({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),ML={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},OL=/[A-Z]/g,yw=/-[a-z]/g,BL=/^data[-\w.:]+$/i;function LL(t,e){const n=$p(e);let r=e,i=Mr;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&BL.test(e)){if(e.charAt(4)==="-"){const l=e.slice(5).replace(yw,IL);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=e.slice(4);if(!yw.test(l)){let s=l.replace(OL,FL);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=Nm}return new i(r,e)}function FL(t){return"-"+t.toLowerCase()}function IL(t){return t.charAt(1).toUpperCase()}const zL=gT([pT,NL,bT,ET,xT],"html"),Rm=gT([pT,RL,bT,ET,xT],"svg");function PL(t){return t.join(" ").trim()}var xs={},lp,bw;function UL(){if(bw)return lp;bw=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,u=/^\s+|\s+$/g,f=`
335
335
  `,c="/",h="*",v="",p="comment",m="declaration";function y(S,x){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];x=x||{};var C=1,T=1;function A(K){var $=K.match(e);$&&(C+=$.length);var B=K.lastIndexOf(f);T=~B?K.length-B:T+K.length}function N(){var K={line:C,column:T};return function($){return $.position=new k(K),P(),$}}function k(K){this.start=K,this.end={line:C,column:T},this.source=x.source}k.prototype.content=S;function _(K){var $=new Error(x.source+":"+C+":"+T+": "+K);if($.reason=K,$.filename=x.source,$.line=C,$.column=T,$.source=S,!x.silent)throw $}function O(K){var $=K.exec(S);if($){var B=$[0];return A(B),S=S.slice(B.length),$}}function P(){O(n)}function M(K){var $;for(K=K||[];$=F();)$!==!1&&K.push($);return K}function F(){var K=N();if(!(c!=S.charAt(0)||h!=S.charAt(1))){for(var $=2;v!=S.charAt($)&&(h!=S.charAt($)||c!=S.charAt($+1));)++$;if($+=2,v===S.charAt($-1))return _("End of comment missing");var B=S.slice(2,$-2);return T+=2,A(B),S=S.slice($),T+=2,K({type:p,comment:B})}}function U(){var K=N(),$=O(r);if($){if(F(),!O(i))return _("property missing ':'");var B=O(l),H=K({type:m,property:w($[0].replace(t,v)),value:B?w(B[0].replace(t,v)):v});return O(s),H}}function j(){var K=[];M(K);for(var $;$=U();)$!==!1&&(K.push($),M(K));return K}return P(),j()}function w(S){return S?S.replace(u,v):v}return lp=y,lp}var Ew;function qL(){if(Ew)return xs;Ew=1;var t=xs&&xs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(xs,"__esModule",{value:!0}),xs.default=n;const e=t(UL());function n(r,i){let l=null;if(!r||typeof r!="string")return l;const s=(0,e.default)(r),u=typeof i=="function";return s.forEach(f=>{if(f.type!=="declaration")return;const{property:c,value:h}=f;u?i(c,h,f):h&&(l=l||{},l[c]=h)}),l}return xs}var Yo={},xw;function jL(){if(xw)return Yo;xw=1,Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,l=function(c){return!c||n.test(c)||t.test(c)},s=function(c,h){return h.toUpperCase()},u=function(c,h){return"".concat(h,"-")},f=function(c,h){return h===void 0&&(h={}),l(c)?c:(c=c.toLowerCase(),h.reactCompat?c=c.replace(i,u):c=c.replace(r,u),c.replace(e,s))};return Yo.camelCase=f,Yo}var Xo,ww;function HL(){if(ww)return Xo;ww=1;var t=Xo&&Xo.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(qL()),n=jL();function r(i,l){var s={};return!i||typeof i!="string"||(0,e.default)(i,function(u,f){u&&f&&(s[(0,n.camelCase)(u,l)]=f)}),s}return r.default=r,Xo=r,Xo}var GL=HL();const VL=xu(GL),wT=ST("end"),Mm=ST("start");function ST(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function $L(t){const e=Mm(t),n=wT(t);if(e&&n)return{start:e,end:n}}function lu(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Sw(t.position):"start"in t||"end"in t?Sw(t):"line"in t||"column"in t?Xp(t):""}function Xp(t){return Cw(t&&t.line)+":"+Cw(t&&t.column)}function Sw(t){return Xp(t&&t.start)+"-"+Xp(t&&t.end)}function Cw(t){return t&&typeof t=="number"?t:1}class dr extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",l={},s=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof e=="string"?i=e:!l.cause&&e&&(s=!0,i=e.message,l.cause=e),!l.ruleId&&!l.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?l.ruleId=r:(l.source=r.slice(0,f),l.ruleId=r.slice(f+1))}if(!l.place&&l.ancestors&&l.ancestors){const f=l.ancestors[l.ancestors.length-1];f&&(l.place=f.position)}const u=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=u?u.line:void 0,this.name=lu(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=s&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}dr.prototype.file="";dr.prototype.name="";dr.prototype.reason="";dr.prototype.message="";dr.prototype.stack="";dr.prototype.column=void 0;dr.prototype.line=void 0;dr.prototype.ancestors=void 0;dr.prototype.cause=void 0;dr.prototype.fatal=void 0;dr.prototype.place=void 0;dr.prototype.ruleId=void 0;dr.prototype.source=void 0;const Om={}.hasOwnProperty,KL=new Map,YL=/[A-Z]/g,XL=new Set(["table","tbody","thead","tfoot","tr"]),ZL=new Set(["td","th"]),CT="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function QL(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=iF(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=aF(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Rm:zL,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},l=TT(i,t,void 0);return l&&typeof l!="string"?l:i.create(t,i.Fragment,{children:l||void 0},void 0)}function TT(t,e,n){if(e.type==="element")return WL(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return JL(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return tF(t,e,n);if(e.type==="mdxjsEsm")return eF(t,e);if(e.type==="root")return nF(t,e,n);if(e.type==="text")return rF(t,e)}function WL(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Rm,t.schema=i),t.ancestors.push(e);const l=AT(t,e.tagName,!1),s=lF(t,e);let u=Lm(t,e);return XL.has(e.tagName)&&(u=u.filter(function(f){return typeof f=="string"?!_L(f):!0})),DT(t,s,l,e),Bm(s,u),t.ancestors.pop(),t.schema=r,t.create(e,l,s,n)}function JL(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}bu(t,e.position)}function eF(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);bu(t,e.position)}function tF(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=Rm,t.schema=i),t.ancestors.push(e);const l=e.name===null?t.Fragment:AT(t,e.name,!0),s=sF(t,e),u=Lm(t,e);return DT(t,s,l,e),Bm(s,u),t.ancestors.pop(),t.schema=r,t.create(e,l,s,n)}function nF(t,e,n){const r={};return Bm(r,Lm(t,e)),t.create(e,t.Fragment,r,n)}function rF(t,e){return e.value}function DT(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function Bm(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function aF(t,e,n){return r;function r(i,l,s,u){const c=Array.isArray(s.children)?n:e;return u?c(l,s,u):c(l,s)}}function iF(t,e){return n;function n(r,i,l,s){const u=Array.isArray(l.children),f=Mm(r);return e(i,l,s,u,{columnNumber:f?f.column-1:void 0,fileName:t,lineNumber:f?f.line:void 0},void 0)}}function lF(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&Om.call(e.properties,i)){const l=oF(t,i,e.properties[i]);if(l){const[s,u]=l;t.tableCellAlignToStyle&&s==="align"&&typeof u=="string"&&ZL.has(e.tagName)?r=u:n[s]=u}}if(r){const l=n.style||(n.style={});l[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function sF(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const l=r.data.estree.body[0];l.type;const s=l.expression;s.type;const u=s.properties[0];u.type,Object.assign(n,t.evaluater.evaluateExpression(u.argument))}else bu(t,e.position);else{const i=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const u=r.value.data.estree.body[0];u.type,l=t.evaluater.evaluateExpression(u.expression)}else bu(t,e.position);else l=r.value===null?!0:r.value;n[i]=l}return n}function Lm(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:KL;for(;++r<e.children.length;){const l=e.children[r];let s;if(t.passKeys){const f=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(f){const c=i.get(f)||0;s=f+"-"+c,i.set(f,c+1)}}const u=TT(t,l,s);u!==void 0&&n.push(u)}return n}function oF(t,e,n){const r=LL(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?SL(n):PL(n)),r.property==="style"){let i=typeof n=="object"?n:uF(t,String(n));return t.stylePropertyNameCase==="css"&&(i=cF(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?ML[r.property]||r.property:r.attribute,n]}}function uF(t,e){try{return VL(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new dr("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=CT+"#cannot-parse-style-attribute",i}}function AT(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let l=-1,s;for(;++l<i.length;){const u=gw(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};s=s?{type:"MemberExpression",object:s,property:u,computed:!!(l&&u.type==="Literal"),optional:!1}:u}r=s}else r=gw(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return Om.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);bu(t)}function bu(t,e){const n=new dr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=CT+"#cannot-handle-mdx-estrees-without-createevaluater",n}function cF(t){const e={};let n;for(n in t)Om.call(t,n)&&(e[fF(n)]=t[n]);return e}function fF(t){let e=t.replace(YL,dF);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function dF(t){return"-"+t.toLowerCase()}const sp={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},hF={};function Fm(t,e){const n=hF,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return _T(t,r,i)}function _T(t,e,n){if(vF(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Tw(t.children,e,n)}return Array.isArray(t)?Tw(t,e,n):""}function Tw(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=_T(t[i],e,n);return r.join("")}function vF(t){return!!(t&&typeof t=="object")}const Dw=document.createElement("i");function Im(t){const e="&"+t+";";Dw.innerHTML=e;const n=Dw.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Hr(t,e,n,r){const i=t.length;let l=0,s;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);l<r.length;)s=r.slice(l,l+1e4),s.unshift(e,0),t.splice(...s),l+=1e4,e+=1e4}function ra(t,e){return t.length>0?(Hr(t,t.length,0,e),t):e}const Aw={}.hasOwnProperty;function kT(t){const e={};let n=-1;for(;++n<t.length;)gF(e,t[n]);return e}function gF(t,e){let n;for(n in e){const i=(Aw.call(t,n)?t[n]:void 0)||(t[n]={}),l=e[n];let s;if(l)for(s in l){Aw.call(i,s)||(i[s]=[]);const u=l[s];pF(i[s],Array.isArray(u)?u:u?[u]:[])}}}function pF(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Hr(t,0,0,r)}function NT(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function da(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const mr=Ki(/[A-Za-z]/),or=Ki(/[\dA-Za-z]/),mF=Ki(/[#-'*+\--9=?A-Z^-~]/);function Kf(t){return t!==null&&(t<32||t===127)}const Zp=Ki(/\d/),yF=Ki(/[\dA-Fa-f]/),bF=Ki(/[!-/:-@[-`{-~]/);function vt(t){return t!==null&&t<-2}function sn(t){return t!==null&&(t<0||t===32)}function Nt(t){return t===-2||t===-1||t===32}const md=Ki(new RegExp("\\p{P}|\\p{S}","u")),_l=Ki(/\s/);function Ki(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ks(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const l=t.charCodeAt(n);let s="";if(l===37&&or(t.charCodeAt(n+1))&&or(t.charCodeAt(n+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(s=String.fromCharCode(l));else if(l>55295&&l<57344){const u=t.charCodeAt(n+1);l<56320&&u>56319&&u<57344?(s=String.fromCharCode(l,u),i=1):s="�"}else s=String.fromCharCode(l);s&&(e.push(t.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Ft(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let l=0;return s;function s(f){return Nt(f)?(t.enter(n),u(f)):e(f)}function u(f){return Nt(f)&&l++<i?(t.consume(f),u):(t.exit(n),e(f))}}const EF={tokenize:xF};function xF(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),Ft(t,e,"linePrefix")}function i(u){return t.enter("paragraph"),l(u)}function l(u){const f=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,s(u)}function s(u){if(u===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(u);return}return vt(u)?(t.consume(u),t.exit("chunkText"),l):(t.consume(u),s)}}const wF={tokenize:SF},_w={tokenize:CF};function SF(t){const e=this,n=[];let r=0,i,l,s;return u;function u(T){if(r<n.length){const A=n[r];return e.containerState=A[1],t.attempt(A[0].continuation,f,c)(T)}return c(T)}function f(T){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&C();const A=e.events.length;let N=A,k;for(;N--;)if(e.events[N][0]==="exit"&&e.events[N][1].type==="chunkFlow"){k=e.events[N][1].end;break}x(r);let _=A;for(;_<e.events.length;)e.events[_][1].end={...k},_++;return Hr(e.events,N+1,0,e.events.slice(A)),e.events.length=_,c(T)}return u(T)}function c(T){if(r===n.length){if(!i)return p(T);if(i.currentConstruct&&i.currentConstruct.concrete)return y(T);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(_w,h,v)(T)}function h(T){return i&&C(),x(r),p(T)}function v(T){return e.parser.lazy[e.now().line]=r!==n.length,s=e.now().offset,y(T)}function p(T){return e.containerState={},t.attempt(_w,m,y)(T)}function m(T){return r++,n.push([e.currentConstruct,e.containerState]),p(T)}function y(T){if(T===null){i&&C(),x(0),t.consume(T);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),w(T)}function w(T){if(T===null){S(t.exit("chunkFlow"),!0),x(0),t.consume(T);return}return vt(T)?(t.consume(T),S(t.exit("chunkFlow")),r=0,e.interrupt=void 0,u):(t.consume(T),w)}function S(T,A){const N=e.sliceStream(T);if(A&&N.push(null),T.previous=l,l&&(l.next=T),l=T,i.defineSkip(T.start),i.write(N),e.parser.lazy[T.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<s&&(!i.events[k][1].end||i.events[k][1].end.offset>s))return;const _=e.events.length;let O=_,P,M;for(;O--;)if(e.events[O][0]==="exit"&&e.events[O][1].type==="chunkFlow"){if(P){M=e.events[O][1].end;break}P=!0}for(x(r),k=_;k<e.events.length;)e.events[k][1].end={...M},k++;Hr(e.events,O+1,0,e.events.slice(_)),e.events.length=k}}function x(T){let A=n.length;for(;A-- >T;){const N=n[A];e.containerState=N[1],N[0].exit.call(e,t)}n.length=T}function C(){i.write([null]),l=void 0,i=void 0,e.containerState._closeFlow=void 0}}function CF(t,e,n){return Ft(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ps(t){if(t===null||sn(t)||_l(t))return 1;if(md(t))return 2}function yd(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const l=t[i].resolveAll;l&&!r.includes(l)&&(e=l(e,n),r.push(l))}return e}const Qp={name:"attention",resolveAll:TF,tokenize:DF};function TF(t,e){let n=-1,r,i,l,s,u,f,c,h;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;f=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const v={...t[r][1].end},p={...t[n][1].start};kw(v,-f),kw(p,f),s={type:f>1?"strongSequence":"emphasisSequence",start:v,end:{...t[r][1].end}},u={type:f>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:p},l={type:f>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:f>1?"strong":"emphasis",start:{...s.start},end:{...u.end}},t[r][1].end={...s.start},t[n][1].start={...u.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=ra(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=ra(c,[["enter",i,e],["enter",s,e],["exit",s,e],["enter",l,e]]),c=ra(c,yd(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=ra(c,[["exit",l,e],["enter",u,e],["exit",u,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(h=2,c=ra(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,Hr(t,r-1,n-r+3,c),n=r+c.length-h-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function DF(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ps(r);let l;return s;function s(f){return l=f,t.enter("attentionSequence"),u(f)}function u(f){if(f===l)return t.consume(f),u;const c=t.exit("attentionSequence"),h=Ps(f),v=!h||h===2&&i||n.includes(f),p=!i||i===2&&h||n.includes(r);return c._open=!!(l===42?v:v&&(i||!p)),c._close=!!(l===42?p:p&&(h||!v)),e(f)}}function kw(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const AF={name:"autolink",tokenize:_F};function _F(t,e,n){let r=0;return i;function i(m){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),l}function l(m){return mr(m)?(t.consume(m),s):m===64?n(m):c(m)}function s(m){return m===43||m===45||m===46||or(m)?(r=1,u(m)):c(m)}function u(m){return m===58?(t.consume(m),r=0,f):(m===43||m===45||m===46||or(m))&&r++<32?(t.consume(m),u):(r=0,c(m))}function f(m){return m===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.exit("autolink"),e):m===null||m===32||m===60||Kf(m)?n(m):(t.consume(m),f)}function c(m){return m===64?(t.consume(m),h):mF(m)?(t.consume(m),c):n(m)}function h(m){return or(m)?v(m):n(m)}function v(m){return m===46?(t.consume(m),r=0,h):m===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.exit("autolink"),e):p(m)}function p(m){if((m===45||or(m))&&r++<63){const y=m===45?p:v;return t.consume(m),y}return n(m)}}const Lu={partial:!0,tokenize:kF};function kF(t,e,n){return r;function r(l){return Nt(l)?Ft(t,i,"linePrefix")(l):i(l)}function i(l){return l===null||vt(l)?e(l):n(l)}}const RT={continuation:{tokenize:RF},exit:MF,name:"blockQuote",tokenize:NF};function NF(t,e,n){const r=this;return i;function i(s){if(s===62){const u=r.containerState;return u.open||(t.enter("blockQuote",{_container:!0}),u.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),l}return n(s)}function l(s){return Nt(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}function RF(t,e,n){const r=this;return i;function i(s){return Nt(s)?Ft(t,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):l(s)}function l(s){return t.attempt(RT,e,n)(s)}}function MF(t){t.exit("blockQuote")}const MT={name:"characterEscape",tokenize:OF};function OF(t,e,n){return r;function r(l){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(l),t.exit("escapeMarker"),i}function i(l){return bF(l)?(t.enter("characterEscapeValue"),t.consume(l),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(l)}}const OT={name:"characterReference",tokenize:BF};function BF(t,e,n){const r=this;let i=0,l,s;return u;function u(v){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(v),t.exit("characterReferenceMarker"),f}function f(v){return v===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(v),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),l=31,s=or,h(v))}function c(v){return v===88||v===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(v),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),l=6,s=yF,h):(t.enter("characterReferenceValue"),l=7,s=Zp,h(v))}function h(v){if(v===59&&i){const p=t.exit("characterReferenceValue");return s===or&&!Im(r.sliceSerialize(p))?n(v):(t.enter("characterReferenceMarker"),t.consume(v),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return s(v)&&i++<l?(t.consume(v),h):n(v)}}const Nw={partial:!0,tokenize:FF},Rw={concrete:!0,name:"codeFenced",tokenize:LF};function LF(t,e,n){const r=this,i={partial:!0,tokenize:N};let l=0,s=0,u;return f;function f(k){return c(k)}function c(k){const _=r.events[r.events.length-1];return l=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,u=k,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),h(k)}function h(k){return k===u?(s++,t.consume(k),h):s<3?n(k):(t.exit("codeFencedFenceSequence"),Nt(k)?Ft(t,v,"whitespace")(k):v(k))}function v(k){return k===null||vt(k)?(t.exit("codeFencedFence"),r.interrupt?e(k):t.check(Nw,w,A)(k)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||vt(k)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),v(k)):Nt(k)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ft(t,m,"whitespace")(k)):k===96&&k===u?n(k):(t.consume(k),p)}function m(k){return k===null||vt(k)?v(k):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),y(k))}function y(k){return k===null||vt(k)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),v(k)):k===96&&k===u?n(k):(t.consume(k),y)}function w(k){return t.attempt(i,A,S)(k)}function S(k){return t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),x}function x(k){return l>0&&Nt(k)?Ft(t,C,"linePrefix",l+1)(k):C(k)}function C(k){return k===null||vt(k)?t.check(Nw,w,A)(k):(t.enter("codeFlowValue"),T(k))}function T(k){return k===null||vt(k)?(t.exit("codeFlowValue"),C(k)):(t.consume(k),T)}function A(k){return t.exit("codeFenced"),e(k)}function N(k,_,O){let P=0;return M;function M($){return k.enter("lineEnding"),k.consume($),k.exit("lineEnding"),F}function F($){return k.enter("codeFencedFence"),Nt($)?Ft(k,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):U($)}function U($){return $===u?(k.enter("codeFencedFenceSequence"),j($)):O($)}function j($){return $===u?(P++,k.consume($),j):P>=s?(k.exit("codeFencedFenceSequence"),Nt($)?Ft(k,K,"whitespace")($):K($)):O($)}function K($){return $===null||vt($)?(k.exit("codeFencedFence"),_($)):O($)}}}function FF(t,e,n){const r=this;return i;function i(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),l)}function l(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}const op={name:"codeIndented",tokenize:zF},IF={partial:!0,tokenize:PF};function zF(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),Ft(t,l,"linePrefix",5)(c)}function l(c){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?f(c):vt(c)?t.attempt(IF,s,f)(c):(t.enter("codeFlowValue"),u(c))}function u(c){return c===null||vt(c)?(t.exit("codeFlowValue"),s(c)):(t.consume(c),u)}function f(c){return t.exit("codeIndented"),e(c)}}function PF(t,e,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):vt(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i):Ft(t,l,"linePrefix",5)(s)}function l(s){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(s):vt(s)?i(s):n(s)}}const UF={name:"codeText",previous:jF,resolve:qF,tokenize:HF};function qF(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function jF(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function HF(t,e,n){let r=0,i,l;return s;function s(v){return t.enter("codeText"),t.enter("codeTextSequence"),u(v)}function u(v){return v===96?(t.consume(v),r++,u):(t.exit("codeTextSequence"),f(v))}function f(v){return v===null?n(v):v===32?(t.enter("space"),t.consume(v),t.exit("space"),f):v===96?(l=t.enter("codeTextSequence"),i=0,h(v)):vt(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),f):(t.enter("codeTextData"),c(v))}function c(v){return v===null||v===32||v===96||vt(v)?(t.exit("codeTextData"),f(v)):(t.consume(v),c)}function h(v){return v===96?(t.consume(v),i++,h):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(v)):(l.type="codeTextData",c(v))}}class GF{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Zo(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Zo(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Zo(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Zo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Zo(this.left,n.reverse())}}}function Zo(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function BT(t){const e={};let n=-1,r,i,l,s,u,f,c;const h=new GF(t);for(;++n<h.length;){for(;n in e;)n=e[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,l=0,l<f.length&&f[l][1].type==="lineEndingBlank"&&(l+=2),l<f.length&&f[l][1].type==="content"))for(;++l<f.length&&f[l][1].type!=="content";)f[l][1].type==="chunkText"&&(f[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,VF(h,n)),n=e[n],c=!0);else if(r[1]._container){for(l=n,i=void 0;l--;)if(s=h.get(l),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=l);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;i&&(r[1].end={...h.get(i)[1].start},u=h.slice(i,n),u.unshift(r),h.splice(i,n-i+1,u))}}return Hr(t,0,Number.POSITIVE_INFINITY,h.slice(0)),!c}function VF(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const l=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const u=s.events,f=[],c={};let h,v,p=-1,m=n,y=0,w=0;const S=[w];for(;m;){for(;t.get(++i)[1]!==m;);l.push(i),m._tokenizer||(h=r.sliceStream(m),m.next||h.push(null),v&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(h),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),v=m,m=m.next}for(m=n;++p<u.length;)u[p][0]==="exit"&&u[p-1][0]==="enter"&&u[p][1].type===u[p-1][1].type&&u[p][1].start.line!==u[p][1].end.line&&(w=p+1,S.push(w),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):S.pop(),p=S.length;p--;){const x=u.slice(S[p],S[p+1]),C=l.pop();f.push([C,C+x.length-1]),t.splice(C,2,x)}for(f.reverse(),p=-1;++p<f.length;)c[y+f[p][0]]=y+f[p][1],y+=f[p][1]-f[p][0]-1;return c}const $F={resolve:YF,tokenize:XF},KF={partial:!0,tokenize:ZF};function YF(t){return BT(t),t}function XF(t,e){let n;return r;function r(u){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(u)}function i(u){return u===null?l(u):vt(u)?t.check(KF,s,l)(u):(t.consume(u),i)}function l(u){return t.exit("chunkContent"),t.exit("content"),e(u)}function s(u){return t.consume(u),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function ZF(t,e,n){const r=this;return i;function i(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),Ft(t,l,"linePrefix")}function l(s){if(s===null||vt(s))return n(s);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(s):t.interrupt(r.parser.constructs.flow,n,e)(s)}}function LT(t,e,n,r,i,l,s,u,f){const c=f||Number.POSITIVE_INFINITY;let h=0;return v;function v(x){return x===60?(t.enter(r),t.enter(i),t.enter(l),t.consume(x),t.exit(l),p):x===null||x===32||x===41||Kf(x)?n(x):(t.enter(r),t.enter(s),t.enter(u),t.enter("chunkString",{contentType:"string"}),w(x))}function p(x){return x===62?(t.enter(l),t.consume(x),t.exit(l),t.exit(i),t.exit(r),e):(t.enter(u),t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===62?(t.exit("chunkString"),t.exit(u),p(x)):x===null||x===60||vt(x)?n(x):(t.consume(x),x===92?y:m)}function y(x){return x===60||x===62||x===92?(t.consume(x),m):m(x)}function w(x){return!h&&(x===null||x===41||sn(x))?(t.exit("chunkString"),t.exit(u),t.exit(s),t.exit(r),e(x)):h<c&&x===40?(t.consume(x),h++,w):x===41?(t.consume(x),h--,w):x===null||x===32||x===40||Kf(x)?n(x):(t.consume(x),x===92?S:w)}function S(x){return x===40||x===41||x===92?(t.consume(x),w):w(x)}}function FT(t,e,n,r,i,l){const s=this;let u=0,f;return c;function c(m){return t.enter(r),t.enter(i),t.consume(m),t.exit(i),t.enter(l),h}function h(m){return u>999||m===null||m===91||m===93&&!f||m===94&&!u&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(t.exit(l),t.enter(i),t.consume(m),t.exit(i),t.exit(r),e):vt(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),v(m))}function v(m){return m===null||m===91||m===93||vt(m)||u++>999?(t.exit("chunkString"),h(m)):(t.consume(m),f||(f=!Nt(m)),m===92?p:v)}function p(m){return m===91||m===92||m===93?(t.consume(m),u++,v):v(m)}}function IT(t,e,n,r,i,l){let s;return u;function u(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),s=p===40?41:p,f):n(p)}function f(p){return p===s?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(l),c(p))}function c(p){return p===s?(t.exit(l),f(s)):p===null?n(p):vt(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),Ft(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===s||p===null||vt(p)?(t.exit("chunkString"),c(p)):(t.consume(p),p===92?v:h)}function v(p){return p===s||p===92?(t.consume(p),h):h(p)}}function su(t,e){let n;return r;function r(i){return vt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Nt(i)?Ft(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const QF={name:"definition",tokenize:JF},WF={partial:!0,tokenize:eI};function JF(t,e,n){const r=this;let i;return l;function l(m){return t.enter("definition"),s(m)}function s(m){return FT.call(r,t,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function u(m){return i=da(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),f):n(m)}function f(m){return sn(m)?su(t,c)(m):c(m)}function c(m){return LT(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function h(m){return t.attempt(WF,v,v)(m)}function v(m){return Nt(m)?Ft(t,p,"whitespace")(m):p(m)}function p(m){return m===null||vt(m)?(t.exit("definition"),r.parser.defined.push(i),e(m)):n(m)}}function eI(t,e,n){return r;function r(u){return sn(u)?su(t,i)(u):n(u)}function i(u){return IT(t,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function l(u){return Nt(u)?Ft(t,s,"whitespace")(u):s(u)}function s(u){return u===null||vt(u)?e(u):n(u)}}const tI={name:"hardBreakEscape",tokenize:nI};function nI(t,e,n){return r;function r(l){return t.enter("hardBreakEscape"),t.consume(l),i}function i(l){return vt(l)?(t.exit("hardBreakEscape"),e(l)):n(l)}}const rI={name:"headingAtx",resolve:aI,tokenize:iI};function aI(t,e){let n=t.length-2,r=3,i,l;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},l={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Hr(t,r,n-r+1,[["enter",i,e],["enter",l,e],["exit",l,e],["exit",i,e]])),t}function iI(t,e,n){let r=0;return i;function i(h){return t.enter("atxHeading"),l(h)}function l(h){return t.enter("atxHeadingSequence"),s(h)}function s(h){return h===35&&r++<6?(t.consume(h),s):h===null||sn(h)?(t.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(t.enter("atxHeadingSequence"),f(h)):h===null||vt(h)?(t.exit("atxHeading"),e(h)):Nt(h)?Ft(t,u,"whitespace")(h):(t.enter("atxHeadingText"),c(h))}function f(h){return h===35?(t.consume(h),f):(t.exit("atxHeadingSequence"),u(h))}function c(h){return h===null||h===35||sn(h)?(t.exit("atxHeadingText"),u(h)):(t.consume(h),c)}}const lI=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Mw=["pre","script","style","textarea"],sI={concrete:!0,name:"htmlFlow",resolveTo:cI,tokenize:fI},oI={partial:!0,tokenize:hI},uI={partial:!0,tokenize:dI};function cI(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function fI(t,e,n){const r=this;let i,l,s,u,f;return c;function c(L){return h(L)}function h(L){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(L),v}function v(L){return L===33?(t.consume(L),p):L===47?(t.consume(L),l=!0,w):L===63?(t.consume(L),i=3,r.interrupt?e:z):mr(L)?(t.consume(L),s=String.fromCharCode(L),S):n(L)}function p(L){return L===45?(t.consume(L),i=2,m):L===91?(t.consume(L),i=5,u=0,y):mr(L)?(t.consume(L),i=4,r.interrupt?e:z):n(L)}function m(L){return L===45?(t.consume(L),r.interrupt?e:z):n(L)}function y(L){const W="CDATA[";return L===W.charCodeAt(u++)?(t.consume(L),u===W.length?r.interrupt?e:U:y):n(L)}function w(L){return mr(L)?(t.consume(L),s=String.fromCharCode(L),S):n(L)}function S(L){if(L===null||L===47||L===62||sn(L)){const W=L===47,ae=s.toLowerCase();return!W&&!l&&Mw.includes(ae)?(i=1,r.interrupt?e(L):U(L)):lI.includes(s.toLowerCase())?(i=6,W?(t.consume(L),x):r.interrupt?e(L):U(L)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(L):l?C(L):T(L))}return L===45||or(L)?(t.consume(L),s+=String.fromCharCode(L),S):n(L)}function x(L){return L===62?(t.consume(L),r.interrupt?e:U):n(L)}function C(L){return Nt(L)?(t.consume(L),C):M(L)}function T(L){return L===47?(t.consume(L),M):L===58||L===95||mr(L)?(t.consume(L),A):Nt(L)?(t.consume(L),T):M(L)}function A(L){return L===45||L===46||L===58||L===95||or(L)?(t.consume(L),A):N(L)}function N(L){return L===61?(t.consume(L),k):Nt(L)?(t.consume(L),N):T(L)}function k(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(t.consume(L),f=L,_):Nt(L)?(t.consume(L),k):O(L)}function _(L){return L===f?(t.consume(L),f=null,P):L===null||vt(L)?n(L):(t.consume(L),_)}function O(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||sn(L)?N(L):(t.consume(L),O)}function P(L){return L===47||L===62||Nt(L)?T(L):n(L)}function M(L){return L===62?(t.consume(L),F):n(L)}function F(L){return L===null||vt(L)?U(L):Nt(L)?(t.consume(L),F):n(L)}function U(L){return L===45&&i===2?(t.consume(L),B):L===60&&i===1?(t.consume(L),H):L===62&&i===4?(t.consume(L),I):L===63&&i===3?(t.consume(L),z):L===93&&i===5?(t.consume(L),Q):vt(L)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(oI,q,j)(L)):L===null||vt(L)?(t.exit("htmlFlowData"),j(L)):(t.consume(L),U)}function j(L){return t.check(uI,K,q)(L)}function K(L){return t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),$}function $(L){return L===null||vt(L)?j(L):(t.enter("htmlFlowData"),U(L))}function B(L){return L===45?(t.consume(L),z):U(L)}function H(L){return L===47?(t.consume(L),s="",Y):U(L)}function Y(L){if(L===62){const W=s.toLowerCase();return Mw.includes(W)?(t.consume(L),I):U(L)}return mr(L)&&s.length<8?(t.consume(L),s+=String.fromCharCode(L),Y):U(L)}function Q(L){return L===93?(t.consume(L),z):U(L)}function z(L){return L===62?(t.consume(L),I):L===45&&i===2?(t.consume(L),z):U(L)}function I(L){return L===null||vt(L)?(t.exit("htmlFlowData"),q(L)):(t.consume(L),I)}function q(L){return t.exit("htmlFlow"),e(L)}}function dI(t,e,n){const r=this;return i;function i(s){return vt(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),l):n(s)}function l(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}function hI(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Lu,e,n)}}const vI={name:"htmlText",tokenize:gI};function gI(t,e,n){const r=this;let i,l,s;return u;function u(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),f}function f(z){return z===33?(t.consume(z),c):z===47?(t.consume(z),N):z===63?(t.consume(z),T):mr(z)?(t.consume(z),O):n(z)}function c(z){return z===45?(t.consume(z),h):z===91?(t.consume(z),l=0,y):mr(z)?(t.consume(z),C):n(z)}function h(z){return z===45?(t.consume(z),m):n(z)}function v(z){return z===null?n(z):z===45?(t.consume(z),p):vt(z)?(s=v,H(z)):(t.consume(z),v)}function p(z){return z===45?(t.consume(z),m):v(z)}function m(z){return z===62?B(z):z===45?p(z):v(z)}function y(z){const I="CDATA[";return z===I.charCodeAt(l++)?(t.consume(z),l===I.length?w:y):n(z)}function w(z){return z===null?n(z):z===93?(t.consume(z),S):vt(z)?(s=w,H(z)):(t.consume(z),w)}function S(z){return z===93?(t.consume(z),x):w(z)}function x(z){return z===62?B(z):z===93?(t.consume(z),x):w(z)}function C(z){return z===null||z===62?B(z):vt(z)?(s=C,H(z)):(t.consume(z),C)}function T(z){return z===null?n(z):z===63?(t.consume(z),A):vt(z)?(s=T,H(z)):(t.consume(z),T)}function A(z){return z===62?B(z):T(z)}function N(z){return mr(z)?(t.consume(z),k):n(z)}function k(z){return z===45||or(z)?(t.consume(z),k):_(z)}function _(z){return vt(z)?(s=_,H(z)):Nt(z)?(t.consume(z),_):B(z)}function O(z){return z===45||or(z)?(t.consume(z),O):z===47||z===62||sn(z)?P(z):n(z)}function P(z){return z===47?(t.consume(z),B):z===58||z===95||mr(z)?(t.consume(z),M):vt(z)?(s=P,H(z)):Nt(z)?(t.consume(z),P):B(z)}function M(z){return z===45||z===46||z===58||z===95||or(z)?(t.consume(z),M):F(z)}function F(z){return z===61?(t.consume(z),U):vt(z)?(s=F,H(z)):Nt(z)?(t.consume(z),F):P(z)}function U(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(t.consume(z),i=z,j):vt(z)?(s=U,H(z)):Nt(z)?(t.consume(z),U):(t.consume(z),K)}function j(z){return z===i?(t.consume(z),i=void 0,$):z===null?n(z):vt(z)?(s=j,H(z)):(t.consume(z),j)}function K(z){return z===null||z===34||z===39||z===60||z===61||z===96?n(z):z===47||z===62||sn(z)?P(z):(t.consume(z),K)}function $(z){return z===47||z===62||sn(z)?P(z):n(z)}function B(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),e):n(z)}function H(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),Y}function Y(z){return Nt(z)?Ft(t,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):Q(z)}function Q(z){return t.enter("htmlTextData"),s(z)}}const zm={name:"labelEnd",resolveAll:bI,resolveTo:EI,tokenize:xI},pI={tokenize:wI},mI={tokenize:SI},yI={tokenize:CI};function bI(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&Hr(t,0,t.length,n),t}function EI(t,e){let n=t.length,r=0,i,l,s,u;for(;n--;)if(i=t[n][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const f={type:t[l][1].type==="labelLink"?"link":"image",start:{...t[l][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[l][1].start},end:{...t[s][1].end}},h={type:"labelText",start:{...t[l+r+2][1].end},end:{...t[s-2][1].start}};return u=[["enter",f,e],["enter",c,e]],u=ra(u,t.slice(l+1,l+r+3)),u=ra(u,[["enter",h,e]]),u=ra(u,yd(e.parser.constructs.insideSpan.null,t.slice(l+r+4,s-3),e)),u=ra(u,[["exit",h,e],t[s-2],t[s-1],["exit",c,e]]),u=ra(u,t.slice(s+1)),u=ra(u,[["exit",f,e]]),Hr(t,l,t.length,u),t}function xI(t,e,n){const r=this;let i=r.events.length,l,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){l=r.events[i][1];break}return u;function u(p){return l?l._inactive?v(p):(s=r.parser.defined.includes(da(r.sliceSerialize({start:l.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(p),t.exit("labelMarker"),t.exit("labelEnd"),f):n(p)}function f(p){return p===40?t.attempt(pI,h,s?h:v)(p):p===91?t.attempt(mI,h,s?c:v)(p):s?h(p):v(p)}function c(p){return t.attempt(yI,h,v)(p)}function h(p){return e(p)}function v(p){return l._balanced=!0,n(p)}}function wI(t,e,n){return r;function r(v){return t.enter("resource"),t.enter("resourceMarker"),t.consume(v),t.exit("resourceMarker"),i}function i(v){return sn(v)?su(t,l)(v):l(v)}function l(v){return v===41?h(v):LT(t,s,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function s(v){return sn(v)?su(t,f)(v):h(v)}function u(v){return n(v)}function f(v){return v===34||v===39||v===40?IT(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):h(v)}function c(v){return sn(v)?su(t,h)(v):h(v)}function h(v){return v===41?(t.enter("resourceMarker"),t.consume(v),t.exit("resourceMarker"),t.exit("resource"),e):n(v)}}function SI(t,e,n){const r=this;return i;function i(u){return FT.call(r,t,l,s,"reference","referenceMarker","referenceString")(u)}function l(u){return r.parser.defined.includes(da(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(u):n(u)}function s(u){return n(u)}}function CI(t,e,n){return r;function r(l){return t.enter("reference"),t.enter("referenceMarker"),t.consume(l),t.exit("referenceMarker"),i}function i(l){return l===93?(t.enter("referenceMarker"),t.consume(l),t.exit("referenceMarker"),t.exit("reference"),e):n(l)}}const TI={name:"labelStartImage",resolveAll:zm.resolveAll,tokenize:DI};function DI(t,e,n){const r=this;return i;function i(u){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(u),t.exit("labelImageMarker"),l}function l(u){return u===91?(t.enter("labelMarker"),t.consume(u),t.exit("labelMarker"),t.exit("labelImage"),s):n(u)}function s(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):e(u)}}const AI={name:"labelStartLink",resolveAll:zm.resolveAll,tokenize:_I};function _I(t,e,n){const r=this;return i;function i(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),l}function l(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):e(s)}}const up={name:"lineEnding",tokenize:kI};function kI(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Ft(t,e,"linePrefix")}}const Mf={name:"thematicBreak",tokenize:NI};function NI(t,e,n){let r=0,i;return l;function l(c){return t.enter("thematicBreak"),s(c)}function s(c){return i=c,u(c)}function u(c){return c===i?(t.enter("thematicBreakSequence"),f(c)):r>=3&&(c===null||vt(c))?(t.exit("thematicBreak"),e(c)):n(c)}function f(c){return c===i?(t.consume(c),r++,f):(t.exit("thematicBreakSequence"),Nt(c)?Ft(t,u,"whitespace")(c):u(c))}}const Ar={continuation:{tokenize:BI},exit:FI,name:"list",tokenize:OI},RI={partial:!0,tokenize:II},MI={partial:!0,tokenize:LI};function OI(t,e,n){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return u;function u(m){const y=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Zp(m)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),m===42||m===45?t.check(Mf,n,c)(m):c(m);if(!r.interrupt||m===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),f(m)}return n(m)}function f(m){return Zp(m)&&++s<10?(t.consume(m),f):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(t.exit("listItemValue"),c(m)):n(m)}function c(m){return t.enter("listItemMarker"),t.consume(m),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,t.check(Lu,r.interrupt?n:h,t.attempt(RI,p,v))}function h(m){return r.containerState.initialBlankLine=!0,l++,p(m)}function v(m){return Nt(m)?(t.enter("listItemPrefixWhitespace"),t.consume(m),t.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=l+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(m)}}function BI(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Lu,i,l);function i(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ft(t,e,"listItemIndent",r.containerState.size+1)(u)}function l(u){return r.containerState.furtherBlankLines||!Nt(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(MI,e,s)(u))}function s(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ft(t,t.attempt(Ar,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function LI(t,e,n){const r=this;return Ft(t,i,"listItemIndent",r.containerState.size+1);function i(l){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?e(l):n(l)}}function FI(t){t.exit(this.containerState.type)}function II(t,e,n){const r=this;return Ft(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const s=r.events[r.events.length-1];return!Nt(l)&&s&&s[1].type==="listItemPrefixWhitespace"?e(l):n(l)}}const Ow={name:"setextUnderline",resolveTo:zI,tokenize:PI};function zI(t,e){let n=t.length,r,i,l;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!l&&t[n][1].type==="definition"&&(l=n);const s={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",l?(t.splice(i,0,["enter",s,e]),t.splice(l+1,0,["exit",t[r][1],e]),t[r][1].end={...t[l][1].end}):t[r][1]=s,t.push(["exit",s,e]),t}function PI(t,e,n){const r=this;let i;return l;function l(c){let h=r.events.length,v;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){v=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||v)?(t.enter("setextHeadingLine"),i=c,s(c)):n(c)}function s(c){return t.enter("setextHeadingLineSequence"),u(c)}function u(c){return c===i?(t.consume(c),u):(t.exit("setextHeadingLineSequence"),Nt(c)?Ft(t,f,"lineSuffix")(c):f(c))}function f(c){return c===null||vt(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const UI={tokenize:qI};function qI(t){const e=this,n=t.attempt(Lu,r,t.attempt(this.parser.constructs.flowInitial,i,Ft(t,t.attempt(this.parser.constructs.flow,i,t.attempt($F,i)),"linePrefix")));return n;function r(l){if(l===null){t.consume(l);return}return t.enter("lineEndingBlank"),t.consume(l),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(l){if(l===null){t.consume(l);return}return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const jI={resolveAll:PT()},HI=zT("string"),GI=zT("text");function zT(t){return{resolveAll:PT(t==="text"?VI:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],l=n.attempt(i,s,u);return s;function s(h){return c(h)?l(h):u(h)}function u(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),f}function f(h){return c(h)?(n.exit("data"),l(h)):(n.consume(h),f)}function c(h){if(h===null)return!0;const v=i[h];let p=-1;if(v)for(;++p<v.length;){const m=v[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function PT(t){return e;function e(n,r){let i=-1,l;for(;++i<=n.length;)l===void 0?n[i]&&n[i][1].type==="data"&&(l=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==l+2&&(n[l][1].end=n[i-1][1].end,n.splice(l+2,i-l-2),i=l+2),l=void 0);return t?t(n,r):n}}function VI(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let l=i.length,s=-1,u=0,f;for(;l--;){const c=i[l];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)u++,s--;if(s)break;s=-1}else if(c===-2)f=!0,u++;else if(c!==-1){l++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(u=0),u){const c={type:n===t.length||f||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?s:r.start._bufferIndex+s,_index:r.start._index+l,line:r.end.line,column:r.end.column-u,offset:r.end.offset-u},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const $I={42:Ar,43:Ar,45:Ar,48:Ar,49:Ar,50:Ar,51:Ar,52:Ar,53:Ar,54:Ar,55:Ar,56:Ar,57:Ar,62:RT},KI={91:QF},YI={[-2]:op,[-1]:op,32:op},XI={35:rI,42:Mf,45:[Ow,Mf],60:sI,61:Ow,95:Mf,96:Rw,126:Rw},ZI={38:OT,92:MT},QI={[-5]:up,[-4]:up,[-3]:up,33:TI,38:OT,42:Qp,60:[AF,vI],91:AI,92:[tI,MT],93:zm,95:Qp,96:UF},WI={null:[Qp,jI]},JI={null:[42,95]},ez={null:[]},tz=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:JI,contentInitial:KI,disable:ez,document:$I,flow:XI,flowInitial:YI,insideSpan:WI,string:ZI,text:QI},Symbol.toStringTag,{value:"Module"}));function nz(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},l=[];let s=[],u=[];const f={attempt:_(N),check:_(k),consume:C,enter:T,exit:A,interrupt:_(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:w,events:[],now:y,parser:t,previous:null,sliceSerialize:p,sliceStream:m,write:v};let h=e.tokenize.call(c,f);return e.resolveAll&&l.push(e),c;function v(F){return s=ra(s,F),S(),s[s.length-1]!==null?[]:(O(e,0),c.events=yd(l,c.events,c),c.events)}function p(F,U){return az(m(F),U)}function m(F){return rz(s,F)}function y(){const{_bufferIndex:F,_index:U,line:j,column:K,offset:$}=r;return{_bufferIndex:F,_index:U,line:j,column:K,offset:$}}function w(F){i[F.line]=F.column,M()}function S(){let F;for(;r._index<s.length;){const U=s[r._index];if(typeof U=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<U.length;)x(U.charCodeAt(r._bufferIndex));else x(U)}}function x(F){h=h(F)}function C(F){vt(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,M()):F!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=F}function T(F,U){const j=U||{};return j.type=F,j.start=y(),c.events.push(["enter",j,c]),u.push(j),j}function A(F){const U=u.pop();return U.end=y(),c.events.push(["exit",U,c]),U}function N(F,U){O(F,U.from)}function k(F,U){U.restore()}function _(F,U){return j;function j(K,$,B){let H,Y,Q,z;return Array.isArray(K)?q(K):"tokenize"in K?q([K]):I(K);function I(se){return me;function me(ke){const ge=ke!==null&&se[ke],te=ke!==null&&se.null,le=[...Array.isArray(ge)?ge:ge?[ge]:[],...Array.isArray(te)?te:te?[te]:[]];return q(le)(ke)}}function q(se){return H=se,Y=0,se.length===0?B:L(se[Y])}function L(se){return me;function me(ke){return z=P(),Q=se,se.partial||(c.currentConstruct=se),se.name&&c.parser.constructs.disable.null.includes(se.name)?ae():se.tokenize.call(U?Object.assign(Object.create(c),U):c,f,W,ae)(ke)}}function W(se){return F(Q,z),$}function ae(se){return z.restore(),++Y<H.length?L(H[Y]):B}}}function O(F,U){F.resolveAll&&!l.includes(F)&&l.push(F),F.resolve&&Hr(c.events,U,c.events.length-U,F.resolve(c.events.slice(U),c)),F.resolveTo&&(c.events=F.resolveTo(c.events,c))}function P(){const F=y(),U=c.previous,j=c.currentConstruct,K=c.events.length,$=Array.from(u);return{from:K,restore:B};function B(){r=F,c.previous=U,c.currentConstruct=j,c.events.length=K,u=$,M()}}function M(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function rz(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,l=e.end._bufferIndex;let s;if(n===i)s=[t[n].slice(r,l)];else{if(s=t.slice(n,i),r>-1){const u=s[0];typeof u=="string"?s[0]=u.slice(r):s.shift()}l>0&&s.push(t[i].slice(0,l))}return s}function az(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const l=t[n];let s;if(typeof l=="string")s=l;else switch(l){case-5:{s="\r";break}case-4:{s=`
336
336
  `;break}case-3:{s=`\r
337
337
  `;break}case-2:{s=e?" ":" ";break}case-1:{if(!e&&i)continue;s=" ";break}default:s=String.fromCharCode(l)}i=l===-2,r.push(s)}return r.join("")}function iz(t){const r={constructs:kT([tz,...(t||{}).extensions||[]]),content:i(EF),defined:[],document:i(wF),flow:i(UI),lazy:{},string:i(HI),text:i(GI)};return r;function i(l){return s;function s(u){return nz(r,l,u)}}}function lz(t){for(;!BT(t););return t}const Bw=/[\0\t\n\r]/g;function sz(){let t=1,e="",n=!0,r;return i;function i(l,s,u){const f=[];let c,h,v,p,m;for(l=e+(typeof l=="string"?l.toString():new TextDecoder(s||void 0).decode(l)),v=0,e="",n&&(l.charCodeAt(0)===65279&&v++,n=void 0);v<l.length;){if(Bw.lastIndex=v,c=Bw.exec(l),p=c&&c.index!==void 0?c.index:l.length,m=l.charCodeAt(p),!c){e=l.slice(v);break}if(m===10&&v===p&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),v<p&&(f.push(l.slice(v,p)),t+=p-v),m){case 0:{f.push(65533),t++;break}case 9:{for(h=Math.ceil(t/4)*4,f.push(-2);t++<h;)f.push(-1);break}case 10:{f.push(-4),t=1;break}default:r=!0,t=1}v=p+1}return u&&(r&&f.push(-5),e&&f.push(e),f.push(null)),f}}const oz=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function uz(t){return t.replace(oz,cz)}function cz(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),l=i===120||i===88;return NT(n.slice(l?2:1),l?16:10)}return Im(n)||t}const UT={}.hasOwnProperty;function fz(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),dz(n)(lz(iz(n).document().write(sz()(t,e,!0))))}function dz(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(et),autolinkProtocol:P,autolinkEmail:P,atxHeading:l(Ke),blockQuote:l(te),characterEscape:P,characterReference:P,codeFenced:l(le),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:l(le,s),codeText:l(fe,s),codeTextData:P,data:P,codeFlowValue:P,definition:l(Ee),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:l(Re),hardBreakEscape:l(Xe),hardBreakTrailing:l(Xe),htmlFlow:l(st,s),htmlFlowData:P,htmlText:l(st,s),htmlTextData:P,image:l(Je),label:s,link:l(et),listItem:l(Ve),listItemValue:p,listOrdered:l(Pe,v),listUnordered:l(Pe),paragraph:l(tt),reference:L,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:l(Ke),strong:l(ct),thematicBreak:l(yt)},exit:{atxHeading:f(),atxHeadingSequence:N,autolink:f(),autolinkEmail:ge,autolinkProtocol:ke,blockQuote:f(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:se,characterReference:me,codeFenced:f(S),codeFencedFence:w,codeFencedFenceInfo:m,codeFencedFenceMeta:y,codeFlowValue:M,codeIndented:f(x),codeText:f($),codeTextData:M,data:M,definition:f(),definitionDestinationString:A,definitionLabelString:C,definitionTitleString:T,emphasis:f(),hardBreakEscape:f(U),hardBreakTrailing:f(U),htmlFlow:f(j),htmlFlowData:M,htmlText:f(K),htmlTextData:M,image:f(H),label:Q,labelText:Y,lineEnding:F,link:f(B),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:W,resourceDestinationString:z,resourceTitleString:I,resource:q,setextHeading:f(O),setextHeadingLineSequence:_,setextHeadingText:k,strong:f(),thematicBreak:f()}};qT(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(oe){let Ce={type:"root",children:[]};const Oe={stack:[Ce],tokenStack:[],config:e,enter:u,exit:c,buffer:s,resume:h,data:n},Ze=[];let Le=-1;for(;++Le<oe.length;)if(oe[Le][1].type==="listOrdered"||oe[Le][1].type==="listUnordered")if(oe[Le][0]==="enter")Ze.push(Le);else{const qe=Ze.pop();Le=i(oe,qe,Le)}for(Le=-1;++Le<oe.length;){const qe=e[oe[Le][0]];UT.call(qe,oe[Le][1].type)&&qe[oe[Le][1].type].call(Object.assign({sliceSerialize:oe[Le][2].sliceSerialize},Oe),oe[Le][1])}if(Oe.tokenStack.length>0){const qe=Oe.tokenStack[Oe.tokenStack.length-1];(qe[1]||Lw).call(Oe,void 0,qe[0])}for(Ce.position={start:ki(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:ki(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},Le=-1;++Le<e.transforms.length;)Ce=e.transforms[Le](Ce)||Ce;return Ce}function i(oe,Ce,Oe){let Ze=Ce-1,Le=-1,qe=!1,ye,V,ne,ce;for(;++Ze<=Oe;){const ue=oe[Ze];switch(ue[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ue[0]==="enter"?Le++:Le--,ce=void 0;break}case"lineEndingBlank":{ue[0]==="enter"&&(ye&&!ce&&!Le&&!ne&&(ne=Ze),ce=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ce=void 0}if(!Le&&ue[0]==="enter"&&ue[1].type==="listItemPrefix"||Le===-1&&ue[0]==="exit"&&(ue[1].type==="listUnordered"||ue[1].type==="listOrdered")){if(ye){let xe=Ze;for(V=void 0;xe--;){const ze=oe[xe];if(ze[1].type==="lineEnding"||ze[1].type==="lineEndingBlank"){if(ze[0]==="exit")continue;V&&(oe[V][1].type="lineEndingBlank",qe=!0),ze[1].type="lineEnding",V=xe}else if(!(ze[1].type==="linePrefix"||ze[1].type==="blockQuotePrefix"||ze[1].type==="blockQuotePrefixWhitespace"||ze[1].type==="blockQuoteMarker"||ze[1].type==="listItemIndent"))break}ne&&(!V||ne<V)&&(ye._spread=!0),ye.end=Object.assign({},V?oe[V][1].start:ue[1].end),oe.splice(V||Ze,0,["exit",ye,ue[2]]),Ze++,Oe++}if(ue[1].type==="listItemPrefix"){const xe={type:"listItem",_spread:!1,start:Object.assign({},ue[1].start),end:void 0};ye=xe,oe.splice(Ze,0,["enter",xe,ue[2]]),Ze++,Oe++,ne=void 0,ce=!0}}}return oe[Ce][1]._spread=qe,Oe}function l(oe,Ce){return Oe;function Oe(Ze){u.call(this,oe(Ze),Ze),Ce&&Ce.call(this,Ze)}}function s(){this.stack.push({type:"fragment",children:[]})}function u(oe,Ce,Oe){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([Ce,Oe||void 0]),oe.position={start:ki(Ce.start),end:void 0}}function f(oe){return Ce;function Ce(Oe){oe&&oe.call(this,Oe),c.call(this,Oe)}}function c(oe,Ce){const Oe=this.stack.pop(),Ze=this.tokenStack.pop();if(Ze)Ze[0].type!==oe.type&&(Ce?Ce.call(this,oe,Ze[0]):(Ze[1]||Lw).call(this,oe,Ze[0]));else throw new Error("Cannot close `"+oe.type+"` ("+lu({start:oe.start,end:oe.end})+"): it’s not open");Oe.position.end=ki(oe.end)}function h(){return Fm(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function p(oe){if(this.data.expectingFirstListItemValue){const Ce=this.stack[this.stack.length-2];Ce.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function m(){const oe=this.resume(),Ce=this.stack[this.stack.length-1];Ce.lang=oe}function y(){const oe=this.resume(),Ce=this.stack[this.stack.length-1];Ce.meta=oe}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const oe=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const oe=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=oe.replace(/(\r?\n|\r)$/g,"")}function C(oe){const Ce=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=Ce,Oe.identifier=da(this.sliceSerialize(oe)).toLowerCase()}function T(){const oe=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=oe}function A(){const oe=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=oe}function N(oe){const Ce=this.stack[this.stack.length-1];if(!Ce.depth){const Oe=this.sliceSerialize(oe).length;Ce.depth=Oe}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function _(oe){const Ce=this.stack[this.stack.length-1];Ce.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function P(oe){const Oe=this.stack[this.stack.length-1].children;let Ze=Oe[Oe.length-1];(!Ze||Ze.type!=="text")&&(Ze=Ue(),Ze.position={start:ki(oe.start),end:void 0},Oe.push(Ze)),this.stack.push(Ze)}function M(oe){const Ce=this.stack.pop();Ce.value+=this.sliceSerialize(oe),Ce.position.end=ki(oe.end)}function F(oe){const Ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Oe=Ce.children[Ce.children.length-1];Oe.position.end=ki(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Ce.type)&&(P.call(this,oe),M.call(this,oe))}function U(){this.data.atHardBreak=!0}function j(){const oe=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=oe}function K(){const oe=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=oe}function $(){const oe=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=oe}function B(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=Ce,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function H(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=Ce,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function Y(oe){const Ce=this.sliceSerialize(oe),Oe=this.stack[this.stack.length-2];Oe.label=uz(Ce),Oe.identifier=da(Ce).toLowerCase()}function Q(){const oe=this.stack[this.stack.length-1],Ce=this.resume(),Oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Oe.type==="link"){const Ze=oe.children;Oe.children=Ze}else Oe.alt=Ce}function z(){const oe=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=oe}function I(){const oe=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=oe}function q(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function W(oe){const Ce=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=Ce,Oe.identifier=da(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function ae(oe){this.data.characterReferenceType=oe.type}function se(oe){const Ce=this.sliceSerialize(oe),Oe=this.data.characterReferenceType;let Ze;Oe?(Ze=NT(Ce,Oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ze=Im(Ce);const Le=this.stack[this.stack.length-1];Le.value+=Ze}function me(oe){const Ce=this.stack.pop();Ce.position.end=ki(oe.end)}function ke(oe){M.call(this,oe);const Ce=this.stack[this.stack.length-1];Ce.url=this.sliceSerialize(oe)}function ge(oe){M.call(this,oe);const Ce=this.stack[this.stack.length-1];Ce.url="mailto:"+this.sliceSerialize(oe)}function te(){return{type:"blockquote",children:[]}}function le(){return{type:"code",lang:null,meta:null,value:""}}function fe(){return{type:"inlineCode",value:""}}function Ee(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Re(){return{type:"emphasis",children:[]}}function Ke(){return{type:"heading",depth:0,children:[]}}function Xe(){return{type:"break"}}function st(){return{type:"html",value:""}}function Je(){return{type:"image",title:null,url:"",alt:null}}function et(){return{type:"link",title:null,url:"",children:[]}}function Pe(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function Ve(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function tt(){return{type:"paragraph",children:[]}}function ct(){return{type:"strong",children:[]}}function Ue(){return{type:"text",value:""}}function yt(){return{type:"thematicBreak"}}}function ki(t){return{line:t.line,column:t.column,offset:t.offset}}function qT(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?qT(t,r):hz(t,r)}}function hz(t,e){let n;for(n in e)if(UT.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function Lw(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+lu({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+lu({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+lu({start:e.start,end:e.end})+") is still open")}function vz(t){const e=this;e.parser=n;function n(r){return fz(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function gz(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function pz(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>SwarmVault Graph</title>
7
- <script type="module" crossorigin src="/assets/index-TXBR63qb.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-DwLzGcBF.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CRcCxyS8.css">
9
9
  </head>
10
10
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarmvaultai/engine",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Core engine for SwarmVault: ingest, compile, query, lint, and provider abstractions.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -39,13 +39,6 @@
39
39
  "engines": {
40
40
  "node": ">=24.0.0"
41
41
  },
42
- "scripts": {
43
- "build": "test -f ../viewer/dist/index.html || pnpm --dir ../viewer build; tsup src/index.ts --format esm --dts && tsup --config tsup.hooks.config.ts && rm -rf dist/viewer && mkdir -p dist/viewer && cp -R ../viewer/dist/. dist/viewer/",
44
- "pretest": "tsup --config tsup.hooks.config.ts",
45
- "test": "SWARMVAULT_ALLOW_PRIVATE_URLS=1 vitest run",
46
- "typecheck": "tsc --noEmit",
47
- "prepublishOnly": "node ../../scripts/check-release-sync.mjs && node ../../scripts/check-published-manifests.mjs"
48
- },
49
42
  "dependencies": {
50
43
  "@asciidoctor/core": "^3.0.4",
51
44
  "@modelcontextprotocol/sdk": "^1.29.0",
@@ -95,5 +88,11 @@
95
88
  "graphology-types": "^0.24.8",
96
89
  "tsup": "^8.5.0",
97
90
  "vitest": "^3.2.4"
91
+ },
92
+ "scripts": {
93
+ "build": "test -f ../viewer/dist/index.html || pnpm --dir ../viewer build; tsup src/index.ts --format esm --dts && tsup --config tsup.hooks.config.ts && rm -rf dist/viewer && mkdir -p dist/viewer && cp -R ../viewer/dist/. dist/viewer/",
94
+ "pretest": "tsup --config tsup.hooks.config.ts",
95
+ "test": "SWARMVAULT_ALLOW_PRIVATE_URLS=1 vitest run",
96
+ "typecheck": "tsc --noEmit"
98
97
  }
99
- }
98
+ }