import { r as __name } from "../chunks/rolldown-runtime.mjs"; import { $ as ComputedNode, C as ComputedView, Di as toComputed, Dn as ViewAutoLayout, E as ParsedView, Gr as Any, Jr as AnyParsed, Si as ViewId, X as ComputedDynamicView, Z as ComputedEdge, aa as _stage, bn as AnyIncludePredicate, ei as ElementId, oa as _type, qi as StepPath, v as ComputedLikeC4ModelData, vi as Unknown, vt as LayoutedDynamicView, wn as BaseViewProperties, x as ParsedLikeC4ModelData, ya as NonEmptyArray, yn as AnyExcludePredicate, zn as ModelExpression } from "../chunks/index.mjs"; import { C as ElementModel, T as RelationshipModel, n as LikeC4Model } from "../chunks/LikeC4Model.mjs"; import { U as ViewPredicate } from "../chunks/_types.mjs"; import "../chunks/index5.mjs"; import { a as LayoutedProjectNode, i as LayoutedProjectEdge, n as ComputedProjectNode, o as LayoutedProjectsView, r as ComputedProjectsView, t as ComputedProjectEdge } from "../chunks/_types2.mjs"; //#region src/compute-view/compute-view.d.ts type ComputeViewResult = { isSuccess: true; error?: undefined; view: V; } | { isSuccess: false; error: Error; view: undefined; }; declare function unsafeComputeView(viewsource: ParsedView, likec4model: LikeC4Model): ComputedView; declare function computeView(viewsource: ParsedView, likec4model: LikeC4Model): ComputeViewResult>; declare function computeParsedModelData = toComputed>(parsed: ParsedLikeC4ModelData): ComputedLikeC4ModelData; declare function computeLikeC4Model = toComputed>(parsed: ParsedLikeC4ModelData): LikeC4Model; //#endregion //#region src/compute-view/utils/resolve-extended-views.d.ts /** * Resolve rules of extended views * (Removes invalid views) */ declare function resolveRulesExtendedViews>>(unresolvedViews: V): V; //#endregion //#region src/compute-view/utils/with-readable-edges.d.ts /** * Convert hashed edge ids to human-readable * Mostly for testing purposes */ declare function withReadableEdges>({ edges, nodes, ...view }: V, separator?: string): V & { nodeIds: string[]; edgeIds: string[]; }; declare function viewsWithReadableEdges({ views, ...model }: ComputedLikeC4ModelData): ComputedLikeC4ModelData; //#endregion //#region src/compute-view/projects-view/compute.d.ts /** * Computes an overview of projects and their relationships */ declare function computeProjectsView(likec4models: NonEmptyArray): ComputedProjectsView; //#endregion //#region src/compute-view/relationships-view/_types.d.ts type RelationshipsViewData = { incomers: ReadonlySet>; incoming: ReadonlySet>; subjects: ReadonlySet>; outgoing: ReadonlySet>; outgoers: ReadonlySet>; }; //#endregion //#region src/compute-view/relationships-view/compute.d.ts declare function computeRelationshipsView(subjectId: ElementId, likec4model: LikeC4Model, scopeViewId: ViewId | null, scope?: 'global' | 'view'): RelationshipsViewData; //#endregion //#region src/compute-view/relationships-view/utils.d.ts /** * Builds a tree structure from a flat list of elements. * @param elements - An iterable of ElementModel instances. * @returns An object containing the sorted elements, a lookup by ID, root elements, parent and children accessors, and a flatten method. * @example * ```ts * const elements = [ * { id: 'A' }, * { id: 'A.B' }, * { id: 'A.B.C' }, * { id: 'A.B.D' }, * { id: 'E' }, * ] * * const tree = treeFromElements(elements) * * tree.sorted.map(e => e.id) // ['A', 'A.B', 'A.B.C', 'A.B.D', 'E'] * * tree.byId('A.B').id // 'A.B' * * [...tree.root].map(e => e.id) // ['A', 'E'] * * tree.parent(tree.byId('A.B.C'))?.id // 'A.B' * * tree.children(tree.byId('A')).map(e => e.id) // ['A.B'] */ declare function treeFromElements(elements: Iterable>): Readonly<{ /** * Elements sorted in a way that parents go before their descendants. */ sorted: ReadonlyArray>; /** * Get element by its id (FQN) */ byId(id: ElementId): ElementModel; /** * Root elements (i.e. those without parents) */ root: ReadonlySet>; /** * Get parent element or null if it's a root */ parent(el: ElementId | ElementModel): ElementModel | null; /** * Get child elements (i.e. direct descendants) */ children(el: ElementId | ElementModel): ReadonlyArray>; /** * Flattens the tree structure by removing redundant hierarchy levels, * while always keeping the direct parent of every leaf (the leaf owner). * @example * A * └── B * ├── C * │ └── D * │ └── E * └── F * └── G * becomes * A * ├── C * │ └── D * │ └── E * └── F * └── G */ flatten(): ReadonlySet>; }>; //#endregion //#region src/compute-view/adhoc-view/compute.d.ts interface AdhocViewIncludePredicate extends AnyIncludePredicate> {} interface AdhocViewExcludePredicate extends AnyExcludePredicate> {} type AdhocViewPredicate = AdhocViewIncludePredicate | AdhocViewExcludePredicate; interface ComputedAdhocView extends BaseViewProperties { readonly [_type]: 'adhoc'; readonly [_stage]: 'computed'; readonly nodes: ReadonlyArray; readonly edges: ReadonlyArray; readonly autoLayout: ViewAutoLayout; } /** * Computes an adhoc view based on the given predicates. * Adhoc views are not defined in the model, but computed on demand. * Available for logical model only. * * @param predicates accepts the same predicates as element view. * @param likec4model The LikeC4 model to compute view. * @returns The computed adhoc view. */ declare function computeAdhocView(likec4model: LikeC4Model, predicates: AdhocViewPredicate>[]): ComputedAdhocView; //#endregion //#region src/compute-view/adhoc-view/builder.d.ts /** * Allows you to define type-safe adhoc views using types from the model. */ declare class AdhocView { #private; private readonly model; /** * Creates a new adhoc view builder. */ static use(model: LikeC4Model): AdhocView; private constructor(); /** * Used to cache the type of the predicates. */ readonly Expr: ViewPredicate.AllExpression>; include(...predicates: this['Expr'][]): this; exclude(...predicates: this['Expr'][]): this; compute(): ComputedAdhocView; } //#endregion //#region src/compute-view/dynamic-view/computeFlow.d.ts /** * Result of {@link computeFlow}: the subset of the dynamic view that should be * rendered for a given selection of visible subflows. */ interface ComputeFlowResult | LayoutedDynamicView> { /** * The subflows that were explicitly requested to be visible. */ readonly subflows: readonly StepPath[]; readonly nodes: V['nodes']; readonly edges: V['edges']; } /** * Walks the recursive flow tree of a {@link ComputedDynamicView} and resolves * which steps (edges) and actors (nodes) must be shown. * * By default (no `subflows`) everything is visible — every step, every loop/opt * and every branch of every `alt`/`try`. Passing `subflows` only narrows the * branches/sections of `alt`/`try` containers: * * - A container whose branches are not mentioned in `subflows` keeps showing all * of them (default), independent of any selection made in other containers. * - Once any branch within a container is requested (the container id is a * prefix of a requested subflow), that container shows only the branches on a * requested path — i.e. branches that are themselves requested or that enclose * a requested nested subflow. * * The last rule means selecting a deeply nested branch keeps all of its parent * branches visible (they enclose the requested subflow), while the parents' * unrelated siblings are hidden. * * @param opts.view - The computed dynamic view to resolve. * @param opts.subflows - Ids of subflows requested to be visible (empty = all). * @returns The visible nodes and edges, preserving the order of `view.nodes` * and `view.edges`. Each node's `children`/`inEdges`/`outEdges` are narrowed * to the visible subset to keep the result internally consistent. */ declare function computeFlow | LayoutedDynamicView>(opts: { view: V; subflows?: readonly StepPath[]; }): ComputeFlowResult; //#endregion export { AdhocView, type AdhocViewExcludePredicate, type AdhocViewIncludePredicate, type AdhocViewPredicate, type ComputeFlowResult, type ComputeViewResult, type ComputedAdhocView, type ComputedProjectEdge, type ComputedProjectNode, type ComputedProjectsView, type LayoutedProjectEdge, type LayoutedProjectNode, type LayoutedProjectsView, type RelationshipsViewData, computeAdhocView, computeFlow, computeLikeC4Model, computeParsedModelData, computeProjectsView, computeRelationshipsView, computeView, resolveRulesExtendedViews, treeFromElements, unsafeComputeView, viewsWithReadableEdges, withReadableEdges };