                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ┌─────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 │ User Input Text │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 └─────────────────┘
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ▼
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ┌─────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 < Detection Phase >
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 └─────────────────┘
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ┌────────────────────┘       │       └────────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │                            │                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │                            │                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │                            │                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ▼                            ▼                            ▼
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ┌───────────────────────┐    ┌───────────────────────┐    ┌───────────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 │ flowDetector.ts       │    │ flowDetector-v2.ts    │    │ elk/detector.ts       │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 │ detector(txt, config) │    │ detector(txt, config) │    │ detector(txt, config) │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 └───────────────────────┘    └───────────────────────┘    └───────────────────────┘
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │                            │                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │                            │                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │                            │                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Checks /^\s*graph/         Checks /^\s*flowchart/     Checks /^\s*flowchart-elk/
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │                            │                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │                            │                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ▼                            ▼                            ▼
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ┌───────────────────┐         ┌────────────────┐             ┌─────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   < Legacy Flowchart? >         < New Flowchart? >             < ELK Layout? >
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   └───────────────────┘         └────────────────┘             └─────────────┘
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │                            │                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │                            │                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │                            │                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Yes                          Yes                          Yes
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             └───────────────────┐        │        ┌───────────────────┘
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ▼        ▼        ▼
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ┌───────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                │ loader() function │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                └───────────────────┘
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ▼
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ┌────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 │ flowDiagram.ts │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 │ diagram object │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 └────────────────┘
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ▼
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ┌────────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               < Diagram Components >
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               └────────────────────┘
                                                                                                       ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴───┘    └┐   └────┴─────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────┐
                                                                                                       │                                                                                                                                                                                                                                                                                                                         │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        │                              │                                                                                            │
                                                                                                       │                                                                                                                                                                                                                                                                                                                         │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        │                              │                                                                                            │
                                                                                                       │                                                                                                                                                                                                                                                                                                                         │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        │                              │                                                                                            │
                                                                                                       │                                                                                                                                                                                                                                                                                                                         │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        │                              │                                                                                            │
                                                                                                       ▼                                                                                                                                                                                                                                                                                                                         ▼                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ▼                              ▼                                                                                            ▼
                                                                                            ┌────────────────────┐                                                                                                                                                                                                                                                                                                     ┌──────────────────┐                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ┌───────────────────────────────────┐    ┌────────────────────┐                                                                ┌────────────────────────────┐
                                                                                            │ parser: flowParser │                                                                                                                                                                                                                                                                                                     │ db: new FlowDB() │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │ renderer: flowRenderer-v3-unified │    │ styles: flowStyles │                                                                │ init: (cnf: MermaidConfig) │
                                                                                            └────────────────────┘                                                                                                                                                                                                                                                                                                     └──────────────────┘                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             └───────────────────────────────────┘    └────────────────────┘                                                                └────────────────────────────┘
                                                             ┌───────────────────────────────┘                  └──────────────────────────────────────────────────────────────────┐                                                                                                                                                                                                                                             │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        │                              │                                                                                            │
                                                             │                                                                                                                     │                                                                                                                                                                                                                                             │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        │                              │                                                                                            │
                                                             │                                                                                                                     │                                                                                                                                                                                                                                             │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        │                              │                                                                                            │
                                                             │                                                                                                                     │                                                                                                                                                                                                                                             │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        │                              │                                                                                            │
                                                             ▼                                                                                                                     ▼                                                                                                                                                                                                                                             ▼                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ▼                              ▼                                                                                            │
                                                 ┌──────────────────────┐                                                                                                ┌──────────────────┐                                                                                                                                                                                                                            ┌──────────────┐                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ┌───────────────────────────────┐    ┌────────────────────┐                                                                                 ▼
                                                 │ parser/flowParser.ts │                                                                                                │ types.ts         │                                                                                                                                                                                                                            │ flowDb.ts    │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 │ flowRenderer-v3-unified.ts    │    │ styles.ts          │                                                                      ┌─────────────────────┐
                                                 │ newParser.parse(src) │                                                                                                │ Type Definitions │                                                                                                                                                                                                                            │ FlowDB class │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 │ draw(text, id, version, diag) │    │ getStyles(options) │                                                                      │ Configuration Setup │
                                                 └──────────────────────┘                                                                                                └──────────────────┘                                                                                                                                                                                                                            └──────────────┘                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 └───────────────────────────────┘    └────────────────────┘                                                                      └─────────────────────┘
                                                             │                                 ┌───────────────────────────┬──────────────────────────┬───────────────────┴───┴───┘┌──┘    └────────────────────┐                                                                                                                                                                                     ┌───────────────────┘            └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐                                                         │                              │                            ┌───────────────────────────┬─────────────────────────┴┬────┴──────┘      └──────┐
                                                             │                                 │                           │                          │                            │                            │                                                                                                                                                                                     │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         │                                                         │                              │                            │                           │                          │                         │
                                                     Preprocesses src                          │                           │                          │                            │                            │                                                                                                                                                                                     │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         │                                                         │                              │                            │                           │                          │                         │
                                                             │                                 │                           │                          │                            │                            │                                                                                                                                                                                     │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         │                                                         │                              │                            │                           │                          │                         │
                                                             │                                 │                           │                          │                            │                            │                                                                                                                                                                                     ▼                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         │                                                         ▼                              ▼                            │                           │                          │                         │
                                                             ▼                                 │                           │                          │                            │                            ▼                                                                                                                                                                         ┌───────────────────────┐                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             │                                            ┌────────────────────────┐    ┌───────────────────────────┐              │                           │                          │                         │
                                             ┌───────────────────────────────┐                 ▼                           ▼                          ▼                            ▼                 ┌─────────────────────┐                                                                                                                                                              │ constructor()         │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ▼                                            │ Initialize rendering   │    │ FlowChartStyleOptions     │              ▼                           ▼                          ▼                         ▼
                                             │ Remove trailing whitespace    │     ┌──────────────────────┐     ┌────────────────────┐     ┌─────────────────────┐    ┌────────────────────────┐     │ FlowVertexTypeParam │                                                                                                                                                              │ - Initialize counters │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ┌────────────┐                                      │ - getConfig()          │    │ - arrowheadColor, border2 │    ┌──────────────────────┐    ┌─────────────────────┐      ┌───────────────┐       ┌───────────────────┐
                                             │ src.replace(/}\s*\n/g, '}\n') │     │ FlowVertex interface │     │ FlowEdge interface │     │ FlowClass interface │    │ FlowSubGraph interface │     │ Shape types         │                                                                                                                                                              │ - Bind methods        │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      │ Test Files │                                      │ - handle securityLevel │    │ - clusterBkg, mainBkg     │    │ cnf.flowchart config │    │ arrowMarkerAbsolute │      │ layout config │       │ setConfig() calls │
                                             └───────────────────────────────┘     └──────────────────────┘     └────────────────────┘     └─────────────────────┘    └────────────────────────┘     └─────────────────────┘                                                                                                                                                              │ - Setup toolTips      │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      └────────────┘                                      │ - getDiagramElement()  │    │ - fontFamily, textColor   │    └──────────────────────┘    └─────────────────────┘      └───────────────┘       └───────────────────┘
                                                             │                                                                                                                                                                                                                                                                                                                            │ - Call clear()        │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ┌──────────────────────────┬────────┴────┘     └─────────┐                             └────────────────────────┘    └───────────────────────────┘
                                                             │                                                                                                                                                                                                                                                                                                                            └───────────────────────┘                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   │                          │                             │                                          │                              │
                                                             │                                                                                                                                                                                                                                                                                                                                        │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               │                          │                             │                                          │                              │
                                                             │                                                                                                                                                                                                                                                                                                                                        │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               │                          │                             │                                          │                              │
                                                             │                                                                                                                                                                                                                                                                                                                                        │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               │                          │                             ▼                                          │                              ▼
                                                             ▼                                                                                                                                                                                                                                                                                                                                        │                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               │                          │                 ┌────────────────────────┐                             ▼              ┌───────────────────────────────┐
                                             ┌───────────────────────────────┐                                                                                                                                                                                                                                                                                                                        ▼                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ▼                          ▼                 │ parser/*.spec.js files │                   ┌───────────────────┐    │ Generate CSS styles           │
                                             │ parser/flow.jison             │                                                                                                                                                                                                                                                                                                               ┌────────────────┐                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ┌────────────────┐     ┌─────────────────────────┐    │ - flow-text.spec.js    │                   │ diag.db.getData() │    │ - .label, .cluster-label      │
                                             │ flowJisonParser.parse(newSrc) │                                                                                                                                                                                                                                                                                                               < FlowDB Methods >                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              │ flowDb.spec.ts │     │ flowChartShapes.spec.js │    │ - flow-edges.spec.js   │                   │ as LayoutData     │    │ - .node, .edgePath            │
                                             └───────────────────────────────┘                                                                                                                                                                                                                                                                                                               └────────────────┘                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              └────────────────┘     └─────────────────────────┘    │ - flow-style.spec.js   │                   └───────────────────┘    │ - .flowchart-link, .edgeLabel │
                                                             │                                                                            ┌────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────┬──────────────────────────────┬─────────────────────────────┬─────────────────────────────┬────────────────────┴┴┴┴─┴┘└┼─┴┼┴┴─┴──────────────────────┬───────────────────────────────┬───────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐                                                                    │ - subgraph.spec.js     │                             │              └───────────────────────────────┘
                                                             │                                                                            │                                                                        │                                                          │                              │                             │                             │                            │  │                          │                               │                                                               │                                                                                                                                                                                    │                                                                                                                                                                                                    │                                                                    └────────────────────────┘                             │                              │
                                                             │                                                                            │                                                                        │                                                          │                              │                             │                             │                            │  │                          │                               │                                                               │                                                                                                                                                                                    │                                                                                                                                                                                                    │                                                                                                                           │                              │
                                                             │                                                                            │                                                                        │                                                          │                              │                             │                             │                            │  └──────────────────────────┼───────────────────────────────┼──────────────────────────────────┐                            │                                                                                                                                                                                    │                                                                                                                                                                                                    │                                                                                                                           │                              │
                                                             │                                                                            │                                                                        │                                                          │                              │                             │                             │                            │                             │                               │                                  └────────┐                   └──────────────────────┐                                                                                                                                                             │                                                                                                                                                                                                    │                                                                                                                           ▼                              │
                                                             │                                                                            ▼                                                                        │                                                          │                              │                             │                             │                            │                             │                               │                                           │                                          │                                                                                                                                                             │                                                                                                                                                                                                    │                                                                                                              ┌─────────────────────────┐                 │
                                                             ▼                                                         ┌─────────────────────────────────────┐                                                     ▼                                                          ▼                              ▼                             ▼                             ▼                            ▼                             ▼                               ▼                                           ▼                                          ▼                                                                                                                                                             ▼                                                                                                                                                                                                    ▼                                                                                                              │ Setup layout data       │                 ▼
                                                 ┌───────────────────────┐                                             │ addVertex(id, textObj, type, style, │                                  ┌─────────────────────────────────────┐                   ┌───────────────────────────────────────┐    ┌───────────────────┐    ┌─────────────────────────────────┐    ┌─────────────────────┐    ┌──────────────────────────┐    ┌──────────────────────────┐    ┌───────────────────────────────────────┐    ┌─────────────────────────────────────┐    ┌───────────┐                                                                                                                                        ┌───────────────────┐                                                                                                                                                                              ┌───────────────────────┐                                                                                                  │ - type, layoutAlgorithm │        ┌─────────────────┐
                                                 │ Parse Graph Structure │                                             │ classes, dir, props, metadata)      │                                  │ addLink(_start[], _end[], linkData) │                   │ addSingleLink(_start, _end, type, id) │    │ setDirection(dir) │    │ addSubGraph(nodes[], id, title) │    │ addClass(id, style) │    │ setClass(ids, className) │    │ setTooltip(ids, tooltip) │    │ setClickEvent(id, functionName, args) │    │ setClickFun(id, functionName, args) │    │ getData() │                                                                                                                                        < Utility Functions >                                                                                                                                                                              │ commonDb.js functions │                                                                                                  │ - direction, spacing    │        │ getIconStyles() │
                                                 └───────────────────────┘                                             └─────────────────────────────────────┘                                  └─────────────────────────────────────┘                   └───────────────────────────────────────┘    └───────────────────┘    └─────────────────────────────────┘    └─────────────────────┘    └──────────────────────────┘    └──────────────────────────┘    └───────────────────────────────────────┘    └─────────────────────────────────────┘    └───────────┘                                                                                                                                        └───────────────────┘                                                                                                                                                                              └───────────────────────┘                                                                                                  │ - markers, diagramId    │        └─────────────────┘
         ┌─────────────────────────┬──────────────┴────┘     │    └─────┴──────────────┬────────────────────────┐                         │                                                                                                                                   │                                                                                                           ┌──────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────────┴─┴──┼─┘  └───────────────────────┐                            ┌─────────────────────────┬─────────────────────────┬─────────────────────────┬───────┴─┴──┴─┘  └─┴──┴─┬┴───────────────────────┬────────────────────────┬────────────────────────┐                         ┌────────────────────────┬──────────────────────────┬────────────────────────┴──┼───┴───┘  └───┴───┴────────┬──────────────────────────┬────────────────────────┐                                      └─────────────────────────┘
         │                         │                         │                         │                        │                         │                                                                                                                                   │                                                                                                           │                              │                                                                                                          │                           │                            │                            │                         │                         │                         │                        │                        │                        │                        │                         │                        │                          │                           │                           │                          │                        │                          ┌────────────┘                       └────────────────────────────────────────────────────────────────────────────────┐
         │                         │                         │                         │                        │                         │                                                                                                                                   │                                                                                                           │                              │                                                                                                          │                           │                            │                            │                         │                         │                         │                        │                        │                        │                        │                         │                        │                          │                           │                           │                          │                        │                          │                                                                                                                     │
         │                         │                         │                         │                        │                         │                                                                                                                                   │                                                                                                           │                              │                                                                                                          │                           │                            │                            │                         │                         │                         │                        │                        │                        │                        │                         │                        │                          │                           │                           │                          │                        │                          │                                                                                                                     │
         │                         │                         │                         │                        │                         │                                                                                                                                   │                                                                                                           │                              │                                                                                                          │                           │                            │                            │                         │                         │                         │                        │                        │                        │                        │                         │                        │                          │                           │                           │                          │                        │                          │                                                                                                                     │
         │                         │                         │                         │                        │                         │                                                                                                                                   │                                                                                                           │                              │                                                                                                          ▼                           ▼                            ▼                            │                         │                         │                         │                        │                        │                        │                        │                         │                        │                          │                           │                           │                          │                        │                          │                                                                                                                     │
         ▼                         ▼                         ▼                         ▼                        ▼                         ▼                                                                                                                                   ▼                                                                                                           ▼                              ▼                                                                                                ┌───────────────────┐      ┌─────────────────────┐    ┌──────────────────────────────┐          ▼                         ▼                         ▼                         ▼                        ▼                        ▼                        ▼                        ▼                         ▼                        ▼                          ▼                           ▼                           ▼                          ▼                        ▼                          ▼                                                                                                                     ▼
┌────────────────┐          ┌─────────────┐         ┌─────────────────┐        ┌───────────────┐        ┌──────────────┐        ┌───────────────────┐                                                                                                                ┌─────────────────┐                                                                                  ┌───────────────────────────────┐    ┌────────────────────────────┐                                                                             │ Process subgraphs │      │ addNodeFromVertex() │    │ destructEdgeType()           │    ┌─────────────────┐     ┌──────────────┐         ┌────────────────┐         ┌───────────────┐         ┌────────────┐         ┌────────────────┐           ┌─────────┐          ┌─────────────────┐        ┌───────────────┐        ┌───────────────┐       ┌─────────────────────┐     ┌─────────────────────┐      ┌───────────────────┐      ┌───────────────────┐         ┌─────────┐       ┌──────────────────────────┐                                                                                              ┌──────────────────┐
│ Parse Vertices │          │ Parse Edges │         │ Parse Subgraphs │        │ Parse Classes │        │ Parse Styles │        < Vertex Processing >                                                                                                                < Edge Processing >                                                                                  │ Collect nodes[] from vertices │    │ Collect edges[] from edges │                                                                             │ - parentDB Map    │      │ for each vertex     │    │ arrowTypeStart, arrowTypeEnd │    │ lookUpDomId(id) │     │ getClasses() │         │ getDirection() │         │ getVertices() │         │ getEdges() │         │ getSubGraphs() │           │ clear() │          │ defaultConfig() │        │ setAccTitle() │        │ getAccTitle() │       │ setAccDescription() │     │ getAccDescription() │      │ setDiagramTitle() │      │ getDiagramTitle() │         │ clear() │       │ render(data4Layout, svg) │                                                                                              < Layout Algorithm >
└────────────────┘          └─────────────┘         └─────────────────┘        └───────────────┘        └──────────────┘        └───────────────────┘                                                                                                                └─────────────────┘                                                                                  └───────────────────────────────┘    └────────────────────────────┘                                                                             │ - subGraphDB Map  │      └─────────────────────┘    └──────────────────────────────┘    └─────────────────┘     └──────────────┘         └────────────────┘         └───────────────┘         └────────────┘         └────────────────┘           └─────────┘          └─────────────────┘        └───────────────┘        └───────────────┘       └─────────────────────┘     └─────────────────────┘      └───────────────────┘      └───────────────────┘         └─────────┘       └──────────────────────────┘                                                                                              └──────────────────┘
                                                                                             ┌──────────────────────────────┬────┴─────┘     └─────┴─────┬─────────────────────────────┐                             ┌────────────────────────────┬───────────────────┴───┘   │   └───┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────┐                                                                                 └───────────────────┘                 │                                                                                                                                                                                                                                                                                                                                                                                ┌──────────────────────────────────────────────────────────────────┘                        └────────────────────────────────────────────────────────────────┐                         ┌─────┘       └────────┴─┬─────────────────────────┐
                                                                                             │                              │                            │                             │                             │                            │                           │                                                                                                                           │                             │                                                                                                                       │                                                                                                                                                                                                                                                                                                                                                                                │                                                                                                                                                            │                         │                        │                         │
                                                                                             │                              │                            │                             │                             │                            │                           │                                                                                                                           │                             │                                                                                                                       │                                                                                                                                                                                                                                                                                                                                                                                │                                                                                                                                                            │                         │                        │                         │
                                                                                             │                              │                            │                             │                             │                            │                           │                                                                                                                           │                             │                                                                                                                       │                                                                                                                                                                                                                                                                                                                                                                                │                                                                                                                                                            │                         │                        │                         │
                                                                                             │                              │                            │                             │                             │                            │                           │                                                                                                                           │                             │                                                                                                                       │                                                                                                                                                                                                                                                                                                                                                                                │                                                                                                                                                            │                         │                        │                         │
                                                                                             ▼                              ▼                            ▼                             ▼                             ▼                            ▼                           ▼                                                                                                                           ▼                             ▼                                                                                                                       ▼                                                                                                                                                                                                                                                                                                                                                                                ▼                                                                                                                                                            ▼                         ▼                        ▼                         ▼
                                                                               ┌──────────────────────────┐    ┌────────────────────────────┐    ┌─────────────────────┐    ┌──────────────────────────────┐    ┌──────────────────────────┐    ┌───────────────────┐    ┌────────────────────────┐                                                                                      ┌────────────────────────────────┐    ┌─────────────────────┐                                                                                                  ┌───────────────┐                                                                                                                                                                                                                                                                                                                                                      ┌───────────────────────────────────┐                                                                                                                               ┌────────────────────┐         ┌───────────┐          ┌───────────────┐      ┌────────────────────┐
                                                                               │ Create FlowVertex object │    │ sanitizeText(textObj.text) │    │ Parse YAML metadata │    │ Set vertex properties        │    │ Create FlowEdge object   │    │ Process link text │    │ Set edge properties    │                                                                                      │ Generate edge ID               │    │ Validate edge limit │                                                                                                  < Node Creation >                                                                                                                                                                                                                                                                                                                                                      │ setupViewPortForSVG(svg, padding) │                                                                                                                               │ flowChartShapes.js │         │ dagre     │          │ dagre-wrapper │      │ elk                │
                                                                               │ - id, labelType, domId   │    └────────────────────────────┘    │ yaml.load(yamlData) │    │ - shape, label, icon, form   │    │ - start, end, type, text │    │ - sanitizeText()  │    │ - type, stroke, length │                                                                                      │ getEdgeId(start, end, counter) │    │ maxEdges check      │                                                                                                  └───────────────┘                                                                                                                                                                                                                                                                                                                                                      └───────────────────────────────────┘                                                                                                                               │ Shape Functions    │         │ (default) │          │ (v2 renderer) │      │ (external package) │
                                                                               │ - styles[], classes[]    │                                      └─────────────────────┘    │ - pos, img, constraint, w, h │    │ - labelType, classes[]   │    │ - strip quotes    │    └────────────────────────┘                                                                                      └────────────────────────────────┘    └─────────────────────┘                                                            ┌─────────────────────────────┬────────┴───┘    └────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────┐                                                                                                                                               │                                                                                                                                                 └────────────────────┘         └───────────┘          └───────────────┘      └────────────────────┘
                                                                               └──────────────────────────┘                                                                 └──────────────────────────────┘    └──────────────────────────┘    └───────────────────┘                                                                                                                                                                                                                                             │                             │                                                                                                                                                                                                                 │                              │                                                                                                                                               │                                                                                                                                                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  │                             │                                                                                                                                                                                                                 │                              │                                                                                                                                               │                                                                                                                                                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  │                             │                                                                                                                                                                                                                 │                              │                                                                                                                                               │                                                                                                                                                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  │                             ▼                                                                                                                                                                                                                 │                              │                                                                                                                                               │                                                                                                                                                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  │                  ┌─────────────────────────┐                                                                                                                                                                                                  │                              │                                                                                                                                               ▼                                                                                                                                                            │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ▼                  │ Create base node        │                                                                                                                                                                                                  ▼                              ▼                                                                                                                                 ┌──────────────────────────┐                                                                                                                                               ▼
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ┌────────────────────────────┐    │ - id, label, parentId   │                                                                                                                                                                                  ┌──────────────────────────────┐    ┌───────────────────────────┐                                                                                                                │ Process vertex links     │                                                                                                                                      ┌─────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   │ findNode(nodes, vertex.id) │    │ - cssStyles, cssClasses │                                                                                                                                                                                  │ getCompiledStyles(classDefs) │    │ getTypeFromVertex(vertex) │                                                                                                                │ - create anchor elements │                                                                                                                                      < Shape Functions >
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   └────────────────────────────┘    │ - shape, domId, tooltip │                                                                                                                                                                                  └──────────────────────────────┘    └───────────────────────────┘                                                                                                                │ - handle click events    │                                                                                                                                      └─────────────────┘
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     └─────────────────────────┘                                                                                                                                                                                                                                                                                                                                                                   └──────────────────────────┘                            ┌───────────────────────────────┬────────────────────────────────┬─────────────────────────────────────────┴─┴─┘ │  └─┼─┴──┼───────┬────────────────────────────────────────────────────────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    │                        └┐                            │                               │                                │                                               │    │    │       │                                                                    │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    │                         │                            │                               │                                │                                               │    │    │       │                                                                    │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    │                         │                            │                               │                                │                                               │    │    │       │                                                                    │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    │                         │                            │                               │                                │                                 ┌─────────────┘    └────┴───────┼─────────────────────────────────┬──────────────────────────────────┼────────────────────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    │                         │                            │                               │                                │                                 └────┐                          └──────────┐                      └─────────────┐                    └──────────────────────────┐     └──────────────────────────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ▼                         ▼                            ▼                               ▼                                ▼                                      ▼                                     ▼                                    ▼                                               ▼                                            ▼
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ┌────────────────┐       ┌──────────────────┐    ┌──────────────────────────────┐    ┌─────────────────────────────┐    ┌─────────────────────────────────────────┐    ┌────────────────────────────────┐    ┌───────────────────────────────┐    ┌──────────────────────────────────────────┐    ┌───────────────────────────────────────┐    ┌────────────────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           < Event Handling >       │ Final SVG Output │    │ question(parent, bbox, node) │    │ hexagon(parent, bbox, node) │    │ rect_left_inv_arrow(parent, bbox, node) │    │ lean_right(parent, bbox, node) │    │ lean_left(parent, bbox, node) │    │ insertPolygonShape(parent, w, h, points) │    │ intersectPolygon(node, points, point) │    │ intersectRect(node, point) │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           └────────────────┘       └──────────────────┘    └──────────────────────────────┘    └─────────────────────────────┘    └─────────────────────────────────────────┘    └────────────────────────────────┘    └───────────────────────────────┘    └──────────────────────────────────────────┘    └───────────────────────────────────────┘    └────────────────────────────┘
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ┌────────────────────┘      └┐      └───────────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       │                            │                              │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       │                            │                              │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       │                            │                              │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       │                            │                              │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ▼                            ▼                              ▼
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ┌────────────────────────┐    ┌────────────────────────┐    ┌───────────────────────────────────┐
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          │ setupToolTips(element) │    │ bindFunctions(element) │    │ utils.runFunc(functionName, args) │
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          └────────────────────────┘    └────────────────────────┘    └───────────────────────────────────┘