-- sql-icon --
without: {
  tableEx: {
    shape: sql_table
    a: b
  }
  classEx: {
    shape: class
    a: b
  }
  codeEx: |go
    a := 1
  |
  mdEx: |md
    # This is for all ill-treated fellows

    You will live a long, healthy, happy life and make bags of money.
  |
}

with: {
  tableEx: {
    shape: sql_table
    a: b
    icon: https://icons.terrastruct.com/essentials%2F213-alarm.svg
  }
  classEx: {
    shape: class
    a: b
    icon: https://icons.terrastruct.com/essentials%2F213-alarm.svg
  }
  codeEx: |go
    a := 1
  | {
    icon: https://icons.terrastruct.com/essentials%2F213-alarm.svg
  }
  mdEx: |md
    # This is for all ill-treated fellows

    You will live a long, healthy, happy life and make bags of money.
  | {
    icon: https://icons.terrastruct.com/essentials%2F213-alarm.svg
  }
}

without.tableEx -> with.tableEx
without.classEx -> with.classEx
without.codeEx -> with.codeEx
without.mdEx -> with.mdEx

-- theme-overrides --

direction: right
vars: {
  d2-config: {
    theme-overrides: {
      B1: "#2E7D32"
      B2: "#66BB6A"
      B3: "#A5D6A7"
      B4: "#C5E1A5"
      B5: "#E6EE9C"
      B6: "#FFF59D"

      AA2: "#0D47A1"
      AA4: "#42A5F5"
      AA5: "#90CAF9"

      AB4: "#F44336"
      AB5: "#FFCDD2"

      N1: "#2E2E2E"
      N2: "#2E2E2E"
      N3: "#595959"
      N4: "#858585"
      N5: "#B1B1B1"
      N6: "#DCDCDC"
      N7: "#DCDCDC"
    }
    dark-theme-overrides: {
      B1: "#2E7D32"
      B2: "#66BB6A"
      B3: "#A5D6A7"
      B4: "#C5E1A5"
      B5: "#E6EE9C"
      B6: "#FFF59D"

      AA2: "#0D47A1"
      AA4: "#42A5F5"
      AA5: "#90CAF9"

      AB4: "#F44336"
      AB5: "#FFCDD2"

      N1: "#2E2E2E"
      N2: "#2E2E2E"
      N3: "#595959"
      N4: "#858585"
      N5: "#B1B1B1"
      N6: "#DCDCDC"
      N7: "#DCDCDC"
    }
  }
}

logs: {
  shape: page
  style.multiple: true
}
user: User {shape: person}
network: Network {
  tower: Cell Tower {
    satellites: {
      shape: stored_data
      style.multiple: true
    }

    satellites -> transmitter
    satellites -> transmitter
    satellites -> transmitter
    transmitter
  }
  processor: Data Processor {
    storage: Storage {
      shape: cylinder
      style.multiple: true
    }
  }
  portal: Online Portal {
    UI
  }

  tower.transmitter -> processor: phone logs
}
server: API Server

user -> network.tower: Make call
network.processor -> server
network.processor -> server
network.processor -> server

server -> logs
server -> logs
server -> logs: persist

server -> network.portal.UI: display
user -> network.portal.UI: access {
  style.stroke-dash: 3
}

costumes: {
  shape: sql_table
  id: int {constraint: primary_key}
  silliness: int
  monster: int
  last_updated: timestamp
}

monsters: {
  shape: sql_table
  id: int {constraint: primary_key}
  movie: string
  weight: int
  last_updated: timestamp
}

costumes.monster -> monsters.id

-- connection-underline --

a -> b: hi {
  style.underline: true
}

-- icon-style --

AWS Firewall Manager : {
  icon: https://icons.terrastruct.com/aws%2FSecurity%2C%20Identity%2C%20&%20Compliance%2FAWS-Firewall-Manager.svg
  icon.style.border-radius: 5
}

lambda : {
  shape: image
  icon: https://icons.terrastruct.com/aws%2FCompute%2FAWS-Lambda.svg
  icon.style.border-radius: 20
}

AWS Cloud : {
  icon: https://icons.terrastruct.com/aws%2F_Group%20Icons%2FAWS-Cloud_light-bg.svg
  icon.style.border-radius: 0
}

Mesh : {
  icon: https://icons.terrastruct.com/aws%2FNetworking%20&%20Content%20Delivery%2FAWS-App-Mesh.svg
  icon.style.border-radius: 999
}

-- none-fill --

vars: {
  d2-config: {
    # Origami theme code
    theme-id: 302
  }
}
a.style.fill-pattern: none
b

-- width-smaller-than-label --
b: hello there cat {
  shape: person
  width: 64
  height: 66
}

-- width-smaller-than-label-custom-pos --
x: {
  width: 20
  label: long label
  label.near: center-center
}

-- nested-spread-substitutions-regression --
vars: {
  dog1: Frido {
    shape: circle
  }
  my-house: {
    label: "Home"
  }
}

ok: {
  ...${my-house}
  dog1: {
    ...${dog1}
  }
  dog1 -> dog3
}

-- bidirectional-connection-animation --
a <-> b: {style.animated: true}
a <-> c: {style.animated: true}
a <-> d: {style.animated: true}
a <-> e: {style.animated: true}
f <-> g: {style.animated: true}
x -- x: {style.animated: true}

-- opacity-zero-route --
grid: {
  *.style.opacity: 0
  grid-columns: 3
  a
  b
  c
  d
  e
  f
  g
  h

  d.style.opacity: 1
}

out -> grid.d

-- sketch-mode-circle-arrowhead --
vars: {
  d2-config: {
    sketch: true
  }
}

a
b
a <-> b: {
  source-arrowhead: {
    shape: circle
    style.filled: false
  }
}

x
y
z
x <-> y <-> z: {
  source-arrowhead: {
    shape: circle
    style.filled: false
  }
  direction: right
}

-- sketch-bidirectional-connection-animation --
vars: {
  d2-config: {
    sketch: true
  }
}

a <-> b: {style.animated: true}
a <-> c: {style.animated: true}
a <-> d: {style.animated: true}
a <-> e
f <-> g: {style.animated: true}
x -- x: {style.animated: true}

-- sketch-cross-arrowhead --
vars: {
  d2-config: {
    sketch: true
  }
}

start <-> end: {
    style.stroke-width: 6
    source-arrowhead.shape: cross
    target-arrowhead.shape: cross
}

-- sequence-edge-group-tall-edge-label --
Sequence: {
  shape: sequence_diagram
  System: System
  File: File
  A

  System Starts: {
    System <- File: One\nTwo\nThree\nFour\nFive\nSix
    System -> File: One\nTwo\nThree\nFour\nFive\nSix
    System -> File: One
    System -> File: Two
    System <- File: One\nTwo\nThree\nFour\nFive\nSix
    Alright: {
      System <- File: One\nTwo\nThree\nFour\nFive\nSix
    }
  }

  Okay: {
    A -> File: One\nTwo\nThree\nFour\nFive\nSix
  }
}

-- sequence-multiline-self-reference --
shape: sequence_diagram
x
y

x -> x: self referential long description which is\nmultirow\n3 rows
x -> x: self referential long description which is\nmultirow
x -> y: normal
y -> y: self referential long description which is\nmultirow\n3 rows

-- sequence-bounding-box --
backend.client: {
  shape: sequence_diagram
  client -> client: BO_ID -> D2_ID
}

-- sequence-multiline-alignment --
shape: sequence_diagram
a
b

b -> b: one\ntwo\nthree\nfour\nfive
b -> b: one\ntwo\nthree\nfour\nfive

a.req -> b: okay then

-- sequence-multiline-label --
shape: sequence_diagram
a
b

a -> b: okay then
a -> b: one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten
a -> b: one\ntwo\nthree\nfour\nfive

-- sequence-fontsize --
shape: sequence_diagram
(** -> **)[*].style.font-size: 24
(** -> **)[*].style.font-color: black
Front-End
Libreria
CD

Front-End.t1 -> Libreria.t1: generatePresentationPayload()
Libreria.t1 -> Libreria.t1: Generar y Firmar\nPrueba de TitularidadPrueba de TitularidadPrueba de TitularidadPrueba de Titularidad
Libreria.t1 -> Front-End.t1: Presentacion Firmada

-- multiline-class-headers --
A: "<<enumeration>>\nAlignment"{
    shape: class

    LeftAligned
    CenterAligned
    RightAligned
    Justified
}

C: "Alignment"{
    shape: class

    LeftAligned
    CenterAligned
    RightAligned
    Justified
}

D: "Alignment\nOf\nAlignment\nOf"{
    shape: class

    LeftAligned
    CenterAligned
    RightAligned
    Justified
}

-- connection-style-fill --
shape: sequence_diagram
customer
employee
rental
item

alice
bob

(* -> *)[*].style.fill: black
(* -> *)[*].style.font-color: white

customer -> employee: "rent(this, i, p)"
employee -> rental: "new(this, i, p)"
rental -> employee
employee -> rental: isValid()
rental -> item: isRentable(c)
item -> customer: is(Adult)
customer -> item: true

alice -> bob: What does it mean\nto be well-adjusted?
bob -> alice: The ability to play bridge or\ngolf as if they were games.

-- extended-ascii --
1: |md
  ÇéþüðæØÅßñò
|
2: |md
  òØõùßÍÿåÆ
|
3: |md
  çÆÐÞ©ßþúí
|
4: |md
  ÉáøÿÑö
|
1 -> 2 -> 3 -> 4 -> 1

-- unicode --
■: |md
  ■ foo bar
|
□: |md
  □ foo bar
|
●: |md
  ● foo bar
|
○: |md
  ○ foo bar
|
◆: |md
  ◆ foo bar
|
◇: |md
  ◇ foo bar
|
▲: |md
  ▲ foo bar
|
△: |md
  △ foo bar
|
▼: |md
  ▼ foo bar
|
▽: |md
  ▽ foo bar
|
※: |md
  ※ foo bar
|
◎: |md
  ◎ foo bar
|

-- gradient --
style.fill: "radial-gradient(circle, white 0%, #8A2BE2 60%, #4B0082 100%)"
gradient: {
  style.fill: "linear-gradient(#f69d3c, #3f87a6)"
  style.stroke: "linear-gradient(to top right, red, blue)"
  style.font-color: "radial-gradient(red, yellow, green, cyan, blue)"
}
colors: {
  style.fill: "linear-gradient(45deg, rgba(255,0,0,0.5) 0%, rgba(0,0,255,0.5) 100%)"
  style.stroke: "linear-gradient(to right, red, blue, green)"
  style.font-color: "linear-gradient(to bottom right, red 0%, yellow 25%, green 50%, cyan 75%, blue 100%)"
}
gradient -> colors: foobar {style.font-color: red; style.stroke: red; style.fill: "radial-gradient(#ffffff, #000000)"}

-- var_in_markdown --
vars: {
  service-x: Kube
}
x: ${service-x}
description: |md
  ${service-x} is a service

  ```
  Let ${y} be ${x}
  ```
|
b -> description -> a

-- md-tables --
# Financial table
savings: ||md
  | Month    | Savings | Expenses | Balance |
  | -------- | ------- | -------- | ------- |
  | January  | $250    | $150     | $100    |
  | February | $80     | $200     | -$120   |
  | March    | $420    | $180     | $240    |
||

# Simple 2x2 table
status: ||md
  | Status | Count |
  | ------ | ----- |
  | Done   | 42    |
  | Todo   | 17    |
||

# Long table with many rows
metrics: ||md
  | Metric    | Value   |
  | --------- | ------- |
  | Uptime    | 99.9%   |
  | Latency   | 150ms   |
  | Errors    | 0.01%   |
  | Requests  | 15k/min |
  | CPU       | 45%     |
  | Memory    | 68%     |
  | Disk      | 72%     |
  | Network   | 33%     |
||

# Connect tables with labeled edges
savings -> status: Triggers {
  style: {
    stroke-dash: 5
  }
}
status -> metrics: Monitors {
  style: {
    stroke-width: 2
  }
}

# Add some styling
savings.style: {
  fill: "#e8f4f8"
  stroke: "#4a90e2"
}

status.style: {
  fill: "#f8e8e8"
  stroke: "#e24a4a"
}

metrics.style: {
  fill: "#f0f8e8"
  stroke: "#82e24a"
}

# Container for financial data
financial: {
  label: "Financial Overview"
  style.stroke-width: 2

  monthly: ||md
    | Month     | Revenue  | Costs    | Margin |
    | --------- | -------- | -------- | ------ |
    | January   | $25,000  | $18,000  | 28%    |
    | February  | $28,500  | $19,200  | 33%    |
    | March     | $31,200  | $21,500  | 31%    |
  ||

  quarterly: ||md
    | Quarter | Target | Actual | Variance |
    |:--------|-------:|:------:|:---------|
    | Q1 2024 | $75K   | $84.7K | +12.9%   |
    | Q2 2024 | $82K   | -      | -        |
  ||

  monthly -> quarterly: "Aggregates"
}

# Container for system metrics
monitoring: {
  label: "System Health"
  style.3d: true

  availability: ||md
    | Service    | Status | Uptime | Last Incident |
    |:-----------|:------:|:------:|:--------------|
    | API        | ✅     | 99.9%  | 15 days ago   |
    | Database   | ✅     | 99.8%  | 3 days ago    |
    | Cache      | ⚠️     | 98.5%  | 1 hour ago    |
  ||

  performance: ||md
    | Metric          |  P50  |  P90  |  P99  |
    |:----------------|:-----:|:-----:|:-----:|
    | Response Time   | 120ms | 350ms | 750ms |
    | DB Query Time   |  45ms | 180ms | 450ms |
    | Cache Latency   |   5ms |  12ms |  30ms |
  ||

  availability -> performance: "Affects"
}

# Container for project status
projects: {
  label: "Project Tracking"
  style.stroke: "#4a90e2"
  style.double-border: true

  status: ||md
    | Project | Priority | Progress | Due Date | Owner |
    |---------|:--------:|:--------:|:---------|:------|
    | Alpha   | HIGH     | ![p](https://progress.com/80) 80% | 2024-04-01 | Alice |
    | Beta    | MEDIUM   | ![p](https://progress.com/45) 45% | 2024-05-15 | Bob   |
    | Gamma   | LOW      | ![p](https://progress.com/20) 20% | 2024-06-30 | Carol |
  ||

  risks: ||md
    | Risk ID | Description | Impact | Mitigation |
    |:-------:|:------------|:------:|:-----------|
    | R1      | Resource shortage | 🔴 High | Hire contractors |
    | R2      | Technical debt | 🟡 Med | Code review |
    | R3      | Scope creep | 🟢 Low | Clear requirements |
  ||
}

# Container for team stats
team: {
  label: "Team Analytics"
  style.fill: "#f5f5f5"

  velocity: ||md
    | Sprint | Points | Completed | Carryover |
    |:-------|:------:|:---------:|:---------:|
    | SP-1   | 34     | 30        | 4         |
    | SP-2   | 38     | 35        | 3         |
    | SP-3   | 42     | 40        | 2         |
    | Average| 38     | 35        | 3         |
  ||
}

# Connect containers
financial -> monitoring: "Impacts"
monitoring -> projects: "Informs" {
  style.stroke-dash: 5
}
projects -> team: "Assigns" {
  style.animated: true
}

# Styling
financial.style.fill: "#e8f4f8"
monitoring.style.fill: "#f8e8e8"
projects.style.fill: "#e8f8e8"
team.style.fill: "#f8f0e8"

-- sql-table-reserved --
my_table: {
  shape: sql_table
  icon: https://static.wikia.nocookie.net/tomandjerry/images/4/46/JerryJumbo3-1-.jpg
  width: 200
  height: 200
  "shape": string
  "icon": string
  "width": int
  "height": int
}

x -> my_table."shape"

-- single-backslash-latex --
formula: {
  equation: |latex
    \begin{equation} \label{eq1}
    \begin{split}
    A & = \frac{\\pi r^2}{2} \\
     & = \frac{1}{2} \pi r^2
    \end{split}
    \end{equation}
  |
}

-- link-on-connections --
a <-> b: {
  link: https://google.com/
}

b -> c: test {
  link: layers.d
}

layers: {
  d: {
    d
  }
}

-- shape-animate --
vars: {
  d2-config: {
    layout-engine: elk
    # Terminal theme code
    theme-id: 300
  }
}
network: {
  cell tower: {
    satellites: {
      shape: stored_data
      style.multiple: true
    }

    transmitter

    satellites -> transmitter: send
    satellites -> transmitter: send
    satellites -> transmitter: send
  }

  online portal: {
    ui: {shape: hexagon}
  }

  data processor: {
    storage: {
               style.animated: true
      shape: cylinder
      style.multiple: true
    }
  }

  cell tower.transmitter -> data processor.storage: phone logs
}

user: {
  shape: person
  width: 130
}

user -> network.cell tower: make call
user -> network.online portal.ui: access {
  style.stroke-dash: 3
}

api server -> network.online portal.ui: display
api server -> logs: persist
logs: {shape: page; style.multiple: true}

network.data processor -> api server

-- note-overlap --
shape: sequence_diagram
alice -> bob
alice -> alice: "Self-messages"
alice -> alice: "Self-messages"
alice -> alice: "Self-messages"
alice -> alice: "Self-messages"

bob."In the eyes of my dog, I'm a man."

-- elk-title-near --
title: "diagram title : Red-line hits 'near: top-center' in elk" {near: top-center}
a: {
  a -> b
}
b: {
  c
}

a.b -> b.c
b.c -> a.a: {style.font-color: red; style.stroke: red; style.fill: mistyrose}

-- sql-casing-panic --

asdf:{
  shape:sQl_table
  zxcv
}

-- connection-icons --
direction: right
a -> b: hello {
  icon: https://icons.terrastruct.com/essentials%2F213-alarm.svg
}
b -> c: {
  icon: https://icons.terrastruct.com/essentials%2F213-alarm.svg
}

direction: right
producer -> consumer: {
  icon: https://icons.terrastruct.com/aws%2FApplication%20Integration%2FAmazon-Simple-Queue-Service-SQS.svg
  icon.style.border-radius: 20
}

-- model-view --
# Models
user.style.fill: blue
softwareSystem: {
  serviceA.class: ok
  serviceB
  serviceC.class: ok
  serviceD

  serviceA -> serviceB
  serviceA -> serviceD
  serviceC -> serviceB
}
externalSystem
user -> softwareSystem
softwareSystem -> externalSystem

# Clear models
**: suspend
(** -> **)[*]: suspend

# Include all top-level objects
*: unsuspend
# Include all objects with a certain class
**: unsuspend {
  &class: ok
}
# Include all connections/objects connected to an object
(** -> externalSystem)[*]: unsuspend

-- sequence-diagram-note-md --
shape: sequence_diagram
x -> y: hello
x.x: |md
  ## A man who fishes for marlin in ponds

  - ...dramatic pause

  will put his money in Etruscan bonds.
|

y.z: |latex
  \\lim_{h \\rightarrow 0 } \\frac{f(x+h)-f(x)}{h}
|

x.z: |python
  1 + 1 = 2
|

-- md-label --
rectangle.shape: rectangle
rectangle: |md
  # hello

  - world

  blah blah
|

square.shape: square
square: |md
  # hello

  - world

  blah blah
|

page.shape: page
page: |md
  # hello

  - world

  blah blah
|

parallelogram.shape: parallelogram
parallelogram: |md
  # hello

  - world

  blah blah
|

document.shape: document
document: |md
  # hello

  - world

  blah blah
|

cylinder.shape: cylinder
cylinder: |md
  # hello

  - world

  blah blah
|

queue.shape: queue
queue: |md
  # hello

  - world

  blah blah
|

package.shape: package
package: |md
  # hello

  - world

  blah blah
|

step.shape: step
step: |md
  # hello

  - world

  blah blah
|

callout.shape: callout
callout: |md
  # hello

  - world

  blah blah
|

stored_data.shape: stored_data
stored_data: |md
  # hello

  - world

  blah blah
|

person.shape: person
person: |md
  # hello

  - world

  blah blah
|

diamond.shape: diamond
diamond: |md
  # hello

  - world

  blah blah
|

oval.shape: oval
oval: |md
  # hello

  - world

  blah blah
|

circle.shape: circle
circle: |md
  # hello

  - world

  blah blah
|

hexagon.shape: hexagon
hexagon: |md
  # hello

  - world

  blah blah
|

cloud.shape: cloud
cloud: |md
  # hello

  - world

  blah blah
|

-- c4-person-shape --
c4mdperson.shape: c4-person
c4mdperson: |md
## Personal Banking Customer

[person]

A customer of the bank, with\
personal bank accounts
  |
c4person: {
  shape: c4-person
  label: "C4 Style Person"
}
regular_person -> c4mdperson

regular_person: {
  shape: person
  label: "Standard Person"
}

c4person -> regular_person: "Compare shapes"

styling: {
  c4styled: {
    shape: c4-person
    style.fill: "#91BEEA"
    style.stroke: "#2E6195"
    style.stroke-width: 2
  }

  c4sized: {
    shape: c4-person
    width: 150
    height: 180
    label: "Custom Size"
  }
}

c4person -> styling.c4styled -> styling.c4sized
**: {
  &shape: c4-person
  style.fill: "#08427b"
  style.stroke: black
  style.font-color: white
  style.stroke-width: 1
}

-- legend --
vars: {
  d2-legend: "凡例"{
    a: {
      label: Microservice
    }
    b: Database {
      shape: cylinder
      style.stroke-dash: 2
    }
    a <-> b: Good relationship {
      style.stroke: red
      style.stroke-dash: 2
      style.stroke-width: 1
    }
    a -> b: Bad relationship
    a -> b: Tenuous {
      target-arrowhead.shape: circle
    }
  }
}

api-1
api-2

api-1 -> postgres
api-2 -> postgres

postgres: {
  shape: cylinder
}
postgres -> external: {
  style.stroke: black
}

api-1 <-> api-2: {
  style.stroke: red
  style.stroke-dash: 2
}
api-1 -> api-3: {
  target-arrowhead.shape: circle
}

-- dark-theme-md --

vars: {
	d2-config: {
		dark-theme-id: 200
	}
}
a.shape: rectangle
a: |md
  # hey
|

-- small-c4-person --

a.shape: c4-person
a: c4-person
a.width: 180

-- c4-person-label --
c4mdperson: |md
## Personal Banking Customer

[person]

A customer of the bank, with personal bank accounts
  | {
    shape: c4-person
    label.near: center-center
  }

c4mdperson2: |md
## Personal Banking Customer

[person]

A customer of the bank, with personal bank accounts
  | {
    shape: c4-person
    label.near: top-center
  }

c4mdperson3: |md
## Personal Banking Customer

[person]

A customer of the bank, with personal bank accounts
  | {
    shape: c4-person
    label.near: bottom-center
  }

customer1: |md
  ## Personal Banking Customer
  [person]

  A customer of the bank, with pekkrsonal bank ccountskks.
| {
  shape: c4-person
}

customer2: |md
  ## Personal Banking Customerk
  [person]

  A customer of the bank, with pekkrsonal bank accountskks.

  A customer of the bank, with pekkrsonal bank accountskks.

  A customer of the bank, with pekkrsonal bank accountskks.
| {
  shape: c4-person
}

customer3: |md
  ## Personal Banking Customer
  [person]

  A customer of the bank, with pekkrsonal bank accountskks.
| {
  shape: c4-person
}

customer4: |md
  ## Personal Banking Customer
  [person]

  A customer of the bank, with pekkrsonal bank accountskks.
| {
  shape: c4-person
}

-- edge-special-text --
a -> b: |latex
  \lim_{h \rightarrow 0 } \frac{f(x+h)-f(x)}{h}
|

c -> d: |md
  **Bold text** and *italic text*

  - Item 1
  - Item 2
|

e -> f: |go
  func main() {
    fmt.Println("Hello World")
  }
|
z -> x: regular

-- edge-special-text-sequence --
shape: sequence_diagram

Alice -> Bob: |latex
  f(x) = x^2 + 2x + 1
|

Bob -> Charlie: |md
  **Authentication** required

  Please provide *credentials*
|

Charlie -> Alice: |go
func main() {
  fmt.Println("Hello World")
}
|

-- sequence-icon-label --
shape: sequence_diagram

User: {
  icon: https://icons.terrastruct.com/azure/General%20Service%20Icons/User%20Icon.svg
}
UserB: {
  label.near: bottom-center
  icon: https://icons.terrastruct.com/azure/General%20Service%20Icons/User%20Icon.svg
}

-- border-container --
vars: {
  d2-config: {
    theme-id: 300
  }
}
style.fill: black
env: Your environment {
  style.fill: black
  style.stroke-dash: 2
  style.double-border: false
  style.stroke: "#1e402d"
  label.near: border-bottom-center
  style.font-color: "#3ddb89"
  app: Your applicaton {
    style.stroke: "#3d9069"
    style.fill: "#222a25"
    style.font-color: "#63c08c"

    *.style.stroke: "#adf1c6"
    *.style.fill: "#306a4a"
    *.style.font-color: "#eef9f3"
    Workflow
    SDK
    Workers
    Workflow -> SDK: hello {
      style.stroke: "#fbfdfd"
      style.font-color: "#adf1c6"
    }
  }
}

-- border-label --
*.label.near: border-bottom-center

rectangle.shape: rectangle
square.shape: square
page.shape: page
parallelogram.shape: parallelogram
document.shape: document
cylinder.shape: cylinder
queue.shape: queue
package.shape: package
step.shape: step
callout.shape: callout
stored_data.shape: stored_data
person.shape: person
diamond.shape: diamond
oval.shape: oval
circle.shape: circle
hexagon.shape: hexagon
cloud.shape: cloud

cloud2.shape: cloud
cloud2.height: 400

-- tooltip-positioning --
grid-columns: 8

rect_top_left: Rectangle {
  tooltip: Top Left {
    near: top-left
  }
}

rect_top_center: Rectangle {
  tooltip: Top Center {
    near: top-center
  }
}

rect_top_right: Rectangle {
  tooltip: Top Right {
    near: top-right
  }
}

rect_center_left: Rectangle {
  tooltip: Center Left {
    near: center-left
  }
}

rect_center_right: Rectangle {
  tooltip: Center Right {
    near: center-right
  }
}

rect_bottom_left: Rectangle {
  tooltip: Bottom Left {
    near: bottom-left
  }
}

rect_bottom_center: Rectangle {
  tooltip: Bottom Center {
    near: bottom-center
  }
}

rect_bottom_right: Rectangle {
  tooltip: Bottom Right {
    near: bottom-right
  }
}

# Circle shape with all positions
circle_top_left: Circle {
  shape: circle
  tooltip: Circle Top Left {
    near: top-left
  }
}

circle_top_center: Circle {
  shape: circle
  tooltip: Circle Top Center {
    near: top-center
  }
}

circle_top_right: Circle {
  shape: circle
  tooltip: Circle Top Right {
    near: top-right
  }
}

circle_center_left: Circle {
  shape: circle
  tooltip: Circle Center Left {
    near: center-left
  }
}

circle_center_right: Circle {
  shape: circle
  tooltip: Circle Center Right {
    near: center-right
  }
}

circle_bottom_left: Circle {
  shape: circle
  tooltip: Circle Bottom Left {
    near: bottom-left
  }
}

circle_bottom_center: Circle {
  shape: circle
  tooltip: Circle Bottom Center {
    near: bottom-center
  }
}

circle_bottom_right: Circle {
  shape: circle
  tooltip: Circle Bottom Right {
    near: bottom-right
  }
}

# Diamond shape with all positions
diamond_top_left: Diamond {
  shape: diamond
  tooltip: Diamond Top Left {
    near: top-left
  }
}

diamond_top_center: Diamond {
  shape: diamond
  tooltip: Diamond Top Center {
    near: top-center
  }
}

diamond_top_right: Diamond {
  shape: diamond
  tooltip: Diamond Top Right {
    near: top-right
  }
}

diamond_center_left: Diamond {
  shape: diamond
  tooltip: Diamond Center Left {
    near: center-left
  }
}

diamond_center_right: Diamond {
  shape: diamond
  tooltip: Diamond Center Right {
    near: center-right
  }
}

diamond_bottom_left: Diamond {
  shape: diamond
  tooltip: Diamond Bottom Left {
    near: bottom-left
  }
}

diamond_bottom_center: Diamond {
  shape: diamond
  tooltip: Diamond Bottom Center {
    near: bottom-center
  }
}

diamond_bottom_right: Diamond {
  shape: diamond
  tooltip: Diamond Bottom Right {
    near: bottom-right
  }
}

# Cloud shape with all positions
cloud_top_left: Cloud {
  shape: cloud
  tooltip: Cloud Top Left {
    near: top-left
  }
}

cloud_top_center: Cloud {
  shape: cloud
  tooltip: Cloud Top Center {
    near: top-center
  }
}

cloud_top_right: Cloud {
  shape: cloud
  tooltip: Cloud Top Right {
    near: top-right
  }
}

cloud_center_left: Cloud {
  shape: cloud
  tooltip: Cloud Center Left {
    near: center-left
  }
}

cloud_center_right: Cloud {
  shape: cloud
  tooltip: Cloud Center Right {
    near: center-right
  }
}

cloud_bottom_left: Cloud {
  shape: cloud
  tooltip: Cloud Bottom Left {
    near: bottom-left
  }
}

cloud_bottom_center: Cloud {
  shape: cloud
  tooltip: Cloud Bottom Center {
    near: bottom-center
  }
}

cloud_bottom_right: Cloud {
  shape: cloud
  tooltip: Cloud Bottom Right {
    near: bottom-right
  }
}

# Hexagon shape with all positions
hex_top_left: Hexagon {
  shape: hexagon
  tooltip: Hexagon Top Left {
    near: top-left
  }
}

hex_top_center: Hexagon {
  shape: hexagon
  tooltip: Hexagon Top Center {
    near: top-center
  }
}

hex_top_right: Hexagon {
  shape: hexagon
  tooltip: Hexagon Top Right {
    near: top-right
  }
}

hex_center_left: Hexagon {
  shape: hexagon
  tooltip: Hexagon Center Left {
    near: center-left
  }
}

hex_center_right: Hexagon {
  shape: hexagon
  tooltip: Hexagon Center Right {
    near: center-right
  }
}

hex_bottom_left: Hexagon {
  shape: hexagon
  tooltip: Hexagon Bottom Left {
    near: bottom-left
  }
}

hex_bottom_center: Hexagon {
  shape: hexagon
  tooltip: Hexagon Bottom Center {
    near: bottom-center
  }
}

hex_bottom_right: Hexagon {
  shape: hexagon
  tooltip: Hexagon Bottom Right {
    near: bottom-right
  }
}

# Cylinder shape with all positions
cyl_top_left: Cylinder {
  shape: cylinder
  tooltip: Cylinder Top Left {
    near: top-left
  }
}

cyl_top_center: Cylinder {
  shape: cylinder
  tooltip: Cylinder Top Center {
    near: top-center
  }
}

cyl_top_right: Cylinder {
  shape: cylinder
  tooltip: Cylinder Top Right {
    near: top-right
  }
}

cyl_center_left: Cylinder {
  shape: cylinder
  tooltip: Cylinder Center Left {
    near: center-left
  }
}

cyl_center_right: Cylinder {
  shape: cylinder
  tooltip: Cylinder Center Right {
    near: center-right
  }
}

cyl_bottom_left: Cylinder {
  shape: cylinder
  tooltip: Cylinder Bottom Left {
    near: bottom-left
  }
}

cyl_bottom_center: Cylinder {
  shape: cylinder
  tooltip: Cylinder Bottom Center {
    near: bottom-center
  }
}

cyl_bottom_right: Cylinder {
  shape: cylinder
  tooltip: Cylinder Bottom Right {
    near: bottom-right
  }
}

rect_top_left_long: Rectangle {
  tooltip: |md
    # Longform

    Beneath this stone lies Murphy,\
    They buried him today,\
    He lived the life of Riley,\
    While Riley was away.
  | {
    near: top-left
  }
}

rect_top_center_long: Rectangle {
  tooltip: |md
    # Longform

    Beneath this stone lies Murphy,\
    They buried him today,\
    He lived the life of Riley,\
    While Riley was away.
  | {
    near: top-center
  }
}

rect_top_right_long: Rectangle {
  tooltip: |md
    # Longform

    Beneath this stone lies Murphy,\
    They buried him today,\
    He lived the life of Riley,\
    While Riley was away.
  | {
    near: top-right
  }
}

rect_center_left_long: Rectangle {
  tooltip: |md
    # Longform

    Beneath this stone lies Murphy,\
    They buried him today,\
    He lived the life of Riley,\
    While Riley was away.
  | {
    near: center-left
  }
}

rect_center_right_long: Rectangle {
  tooltip: |md
    # Longform

    Beneath this stone lies Murphy,\
    They buried him today,\
    He lived the life of Riley,\
    While Riley was away.
  | {
    near: center-right
  }
}

rect_bottom_left_long: Rectangle {
  tooltip: |md
    While Riley was away.
  | {
    near: bottom-left
  }
}

rect_bottom_center_long: Rectangle {
  tooltip: |md
    While Riley was away.
  | {
    near: bottom-center
  }
}

rect_bottom_right_long: Rectangle {
  tooltip: |md
    Beneath this stone lies Murphy
  | {
    near: bottom-right
  }
}

okay: |md
  okay
|

-- legend-leak --
vars:"d2 v0.7.0" {
  d2-config: {
    layout-engine: dagre
  }

  d2-legend:"凡例" {
    a: {shape:c4-person}
    b: {shape:person}
    c: {shape: cylinder}

    "" -> "": bad { style.stroke-dash: 2 }
    "" -> "": good { style.stroke: red }
  }

}
style: {fill-pattern: dots; fill:"radial-gradient(#fbfbf8, #e3e3f0)"; stroke: "#a0a0a0"; stroke-width: 1; border-radius: 8}

a->b
