iso-explainer 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +119 -2
  3. package/README.pt-BR.md +89 -0
  4. package/bin/iso-explainer.mjs +75 -0
  5. package/package.json +37 -4
  6. package/skills/iso-explainer/SKILL.md +99 -0
  7. package/skills/iso-explainer/assets/figure/figure.mjs +93 -0
  8. package/skills/iso-explainer/assets/fonts/OFL.txt +93 -0
  9. package/skills/iso-explainer/assets/fonts/jetbrains-mono-latin-400-normal.woff2 +0 -0
  10. package/skills/iso-explainer/assets/fonts/jetbrains-mono-latin-500-normal.woff2 +0 -0
  11. package/skills/iso-explainer/assets/fonts/jetbrains-mono-latin-600-normal.woff2 +0 -0
  12. package/skills/iso-explainer/assets/fonts/jetbrains-mono-latin-700-normal.woff2 +0 -0
  13. package/skills/iso-explainer/assets/fonts/jetbrains-mono-latin-800-normal.woff2 +0 -0
  14. package/skills/iso-explainer/assets/runtime/ANATOMY-LICENSE.txt +21 -0
  15. package/skills/iso-explainer/assets/runtime/LUCIDE-LICENSE.txt +43 -0
  16. package/skills/iso-explainer/assets/runtime/app.js +727 -0
  17. package/skills/iso-explainer/assets/runtime/engine.js +1224 -0
  18. package/skills/iso-explainer/assets/runtime/icons.js +205 -0
  19. package/skills/iso-explainer/assets/runtime/kit.js +676 -0
  20. package/skills/iso-explainer/assets/runtime/looks-core.js +162 -0
  21. package/skills/iso-explainer/assets/runtime/looks.js +508 -0
  22. package/skills/iso-explainer/assets/runtime/styles.css +461 -0
  23. package/skills/iso-explainer/assets/runtime/template.html +29 -0
  24. package/skills/iso-explainer/assets/templates/starter.course.json +134 -0
  25. package/skills/iso-explainer/examples/arquitetura-pedidos.docs.json +1745 -0
  26. package/skills/iso-explainer/examples/catalogo-looks.course.json +599 -0
  27. package/skills/iso-explainer/examples/engenharia-na-pratica.course.json +2079 -0
  28. package/skills/iso-explainer/examples/figures/token-bucket.build.mjs +111 -0
  29. package/skills/iso-explainer/examples/figures/token-bucket.html +962 -0
  30. package/skills/iso-explainer/examples/historia-pedidos.story.json +1874 -0
  31. package/skills/iso-explainer/references/architecture-mode.md +82 -0
  32. package/skills/iso-explainer/references/design-system.md +58 -0
  33. package/skills/iso-explainer/references/engine.md +64 -0
  34. package/skills/iso-explainer/references/entities.md +72 -0
  35. package/skills/iso-explainer/references/figure-craft.md +62 -0
  36. package/skills/iso-explainer/references/flows.md +67 -0
  37. package/skills/iso-explainer/references/inside.md +74 -0
  38. package/skills/iso-explainer/references/layout.md +134 -0
  39. package/skills/iso-explainer/references/looks.md +60 -0
  40. package/skills/iso-explainer/references/schema.md +157 -0
  41. package/skills/iso-explainer/references/story-mode.md +72 -0
  42. package/skills/iso-explainer/references/storytelling.md +56 -0
  43. package/skills/iso-explainer/scripts/build.mjs +82 -0
  44. package/skills/iso-explainer/scripts/harvest.mjs +240 -0
  45. package/skills/iso-explainer/scripts/lib/layout.mjs +111 -0
  46. package/skills/iso-explainer/scripts/lib/resolve.mjs +269 -0
  47. package/skills/iso-explainer/scripts/snapshot.mjs +159 -0
  48. package/skills/iso-explainer/scripts/validate.mjs +58 -0
@@ -0,0 +1,962 @@
1
+ <!doctype html><html lang="pt-BR" data-theme="light"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Rate limit · token bucket</title><style>
2
+ :root{--page:#f4ebe0;--ink:#211e1b;--muted:#6f6961;--line:#ddd3c5;--accent:#5fae57;color-scheme:light}
3
+ :root[data-theme=dark]{--page:#1e1b18;--ink:#efe6d6;--muted:#a3998b;--line:#4f473d;--accent:#7fc278;color-scheme:dark}
4
+ *{box-sizing:border-box}
5
+ html,body{margin:0;height:100%;background:var(--page);color:var(--ink);font:12px/1.45 "JetBrains Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
6
+ .fig{height:100%;display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;gap:4px;padding:12px 16px 12px}
7
+ .row{display:flex;justify-content:space-between;align-items:baseline;gap:12px;color:var(--muted);font-size:10.5px;letter-spacing:.09em;text-transform:uppercase}
8
+ .row b{color:var(--ink);font-weight:700}
9
+ .readout{color:var(--ink);font-weight:700;letter-spacing:.02em;text-transform:none;font-variant-numeric:tabular-nums;text-align:right}
10
+ .stage{min-height:0;display:grid;outline:none}
11
+ .stage svg{width:100%;height:100%;display:block}
12
+ .controls{display:flex;flex-wrap:wrap;gap:6px 18px;align-items:center;color:var(--muted);font-size:11px}
13
+ .controls label{display:flex;gap:8px;align-items:center}
14
+ .controls output{color:var(--ink);font-weight:700;min-width:4ch;font-variant-numeric:tabular-nums}
15
+ input[type=range]{accent-color:var(--accent);width:120px}
16
+ .caption{margin:2px 0 0;color:var(--muted);font-size:11px;line-height:1.5}
17
+ @media (max-width:520px){.fig{padding:10px}.row{font-size:9.5px}input[type=range]{width:90px}}
18
+ </style></head>
19
+ <body><main class="fig">
20
+ <div class="row"><span>Fig 1</span><b>Rate limit · token bucket</b></div>
21
+ <div class="stage" id="stage" tabindex="0" role="img" aria-label="Rate limit · token bucket"><svg viewBox="0 0 640 360" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg"><g id="art"><path d="M242.1 171.8L242.9 170.3L244.7 169L247.2 168.2L250.2 167.8L253.2 167.9L256 168.5L258.2 169.6L259.5 171L259.8 172.6L259.8 179L259 180.5L257.2 181.7L254.7 182.6L251.7 183L248.6 182.9L245.8 182.2L243.7 181.1L242.4 179.7L242.1 178.2Z" fill="#4A433C"/><path d="M257.2 181.7L254.7 182.6L254.7 176.2L257.2 175.3ZM259.8 179L259 180.5L259 174.1L259.8 172.6ZM259 180.5L257.2 181.7L257.2 175.3L259 174.1Z" fill="#4A433C"/><path d="M254.7 182.6L251.7 183L251.7 176.6L254.7 176.2Z" fill="#4A433C"/><path d="M251.7 183L248.6 182.9L248.6 176.5L251.7 176.6ZM248.6 182.9L245.8 182.2L245.8 175.8L248.6 176.5Z" fill="#4A433C"/><path d="M245.8 182.2L243.7 181.1L243.7 174.7L245.8 175.8ZM243.7 181.1L242.4 179.7L242.4 173.3L243.7 174.7ZM242.4 179.7L242.1 178.2L242.1 171.8L242.4 173.3Z" fill="#4A433C"/><path d="M257.2 175.3L254.7 176.2L251.7 176.6L248.6 176.5L245.8 175.8L243.7 174.7L242.4 173.3L242.1 171.8L242.9 170.3L244.7 169L247.2 168.2L250.2 167.8L253.2 167.9L256 168.5L258.2 169.6L259.5 171L259.8 172.6L259 174.1Z" fill="#4A433C"/><path d="M259.8 172.6L259 174.1L257.2 175.3L254.7 176.2L251.7 176.6L248.6 176.5L245.8 175.8L243.7 174.7L242.4 173.3L242.1 171.8" fill="none" stroke="#6f6559" stroke-width="0.85" stroke-linecap="round"/><path d="M242.1 171.8L242.9 170.3L244.7 169L247.2 168.2L250.2 167.8L253.2 167.9L256 168.5L258.2 169.6L259.5 171L259.8 172.6M259.8 179L259 180.5L257.2 181.7L254.7 182.6L251.7 183L248.6 182.9L245.8 182.2L243.7 181.1L242.4 179.7L242.1 178.2M242.1 171.8L242.1 178.2M259.8 172.6L259.8 179" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/>
22
+ <path d="M463.9 282.7L464.7 281.2L466.5 280L469 279.1L472 278.7L475.1 278.8L477.9 279.5L480 280.5L481.3 281.9L481.6 283.5L481.6 289.9L480.8 291.4L479 292.6L476.5 293.5L473.5 293.9L470.5 293.8L467.7 293.1L465.5 292L464.2 290.6L463.9 289.1Z" fill="#4A433C"/><path d="M479 292.6L476.5 293.5L476.5 287.1L479 286.2ZM481.6 289.9L480.8 291.4L480.8 285L481.6 283.5ZM480.8 291.4L479 292.6L479 286.2L480.8 285Z" fill="#4A433C"/><path d="M476.5 293.5L473.5 293.9L473.5 287.5L476.5 287.1Z" fill="#4A433C"/><path d="M473.5 293.9L470.5 293.8L470.5 287.4L473.5 287.5ZM470.5 293.8L467.7 293.1L467.7 286.7L470.5 287.4Z" fill="#4A433C"/><path d="M467.7 293.1L465.5 292L465.5 285.6L467.7 286.7ZM465.5 292L464.2 290.6L464.2 284.2L465.5 285.6ZM464.2 290.6L463.9 289.1L463.9 282.7L464.2 284.2Z" fill="#4A433C"/><path d="M479 286.2L476.5 287.1L473.5 287.5L470.5 287.4L467.7 286.7L465.5 285.6L464.2 284.2L463.9 282.7L464.7 281.2L466.5 280L469 279.1L472 278.7L475.1 278.8L477.9 279.5L480 280.5L481.3 281.9L481.6 283.5L480.8 285Z" fill="#4A433C"/><path d="M481.6 283.5L480.8 285L479 286.2L476.5 287.1L473.5 287.5L470.5 287.4L467.7 286.7L465.5 285.6L464.2 284.2L463.9 282.7" fill="none" stroke="#6f6559" stroke-width="0.85" stroke-linecap="round"/><path d="M463.9 282.7L464.7 281.2L466.5 280L469 279.1L472 278.7L475.1 278.8L477.9 279.5L480 280.5L481.3 281.9L481.6 283.5M481.6 289.9L480.8 291.4L479 292.6L476.5 293.5L473.5 293.9L470.5 293.8L467.7 293.1L465.5 292L464.2 290.6L463.9 289.1M463.9 282.7L463.9 289.1M481.6 283.5L481.6 289.9" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/>
23
+ <path d="M158.4 213.6L159.2 212.2L161 210.9L163.5 210L166.5 209.6L169.5 209.7L172.3 210.4L174.5 211.5L175.8 212.9L176.1 214.4L176.1 220.8L175.3 222.3L173.5 223.6L171 224.5L168 224.9L164.9 224.7L162.1 224.1L160 223L158.7 221.6L158.4 220.1Z" fill="#4A433C"/><path d="M173.5 223.6L171 224.5L171 218.1L173.5 217.2ZM176.1 220.8L175.3 222.3L175.3 215.9L176.1 214.4ZM175.3 222.3L173.5 223.6L173.5 217.2L175.3 215.9Z" fill="#4A433C"/><path d="M171 224.5L168 224.9L168 218.5L171 218.1Z" fill="#4A433C"/><path d="M168 224.9L164.9 224.7L164.9 218.3L168 218.5ZM164.9 224.7L162.1 224.1L162.1 217.7L164.9 218.3Z" fill="#4A433C"/><path d="M162.1 224.1L160 223L160 216.6L162.1 217.7ZM160 223L158.7 221.6L158.7 215.2L160 216.6ZM158.7 221.6L158.4 220.1L158.4 213.6L158.7 215.2Z" fill="#4A433C"/><path d="M173.5 217.2L171 218.1L168 218.5L164.9 218.3L162.1 217.7L160 216.6L158.7 215.2L158.4 213.6L159.2 212.2L161 210.9L163.5 210L166.5 209.6L169.5 209.7L172.3 210.4L174.5 211.5L175.8 212.9L176.1 214.4L175.3 215.9Z" fill="#4A433C"/><path d="M176.1 214.4L175.3 215.9L173.5 217.2L171 218.1L168 218.5L164.9 218.3L162.1 217.7L160 216.6L158.7 215.2L158.4 213.6" fill="none" stroke="#6f6559" stroke-width="0.85" stroke-linecap="round"/><path d="M158.4 213.6L159.2 212.2L161 210.9L163.5 210L166.5 209.6L169.5 209.7L172.3 210.4L174.5 211.5L175.8 212.9L176.1 214.4M176.1 220.8L175.3 222.3L173.5 223.6L171 224.5L168 224.9L164.9 224.7L162.1 224.1L160 223L158.7 221.6L158.4 220.1M158.4 213.6L158.4 220.1M176.1 214.4L176.1 220.8" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/>
24
+ <path d="M380.2 324.6L381 323.1L382.8 321.8L385.3 320.9L388.3 320.5L391.4 320.7L394.2 321.3L396.3 322.4L397.6 323.8L397.9 325.3L397.9 331.7L397.1 333.2L395.3 334.5L392.8 335.4L389.8 335.8L386.8 335.6L384 335L381.8 333.9L380.5 332.5L380.2 331Z" fill="#4A433C"/><path d="M395.3 334.5L392.8 335.4L392.8 329L395.3 328.1ZM397.9 331.7L397.1 333.2L397.1 326.8L397.9 325.3ZM397.1 333.2L395.3 334.5L395.3 328.1L397.1 326.8Z" fill="#4A433C"/><path d="M392.8 335.4L389.8 335.8L389.8 329.4L392.8 329Z" fill="#4A433C"/><path d="M389.8 335.8L386.8 335.6L386.8 329.2L389.8 329.4ZM386.8 335.6L384 335L384 328.6L386.8 329.2Z" fill="#4A433C"/><path d="M384 335L381.8 333.9L381.8 327.5L384 328.6ZM381.8 333.9L380.5 332.5L380.5 326.1L381.8 327.5ZM380.5 332.5L380.2 331L380.2 324.6L380.5 326.1Z" fill="#4A433C"/><path d="M395.3 328.1L392.8 329L389.8 329.4L386.8 329.2L384 328.6L381.8 327.5L380.5 326.1L380.2 324.6L381 323.1L382.8 321.8L385.3 320.9L388.3 320.5L391.4 320.7L394.2 321.3L396.3 322.4L397.6 323.8L397.9 325.3L397.1 326.8Z" fill="#4A433C"/><path d="M397.9 325.3L397.1 326.8L395.3 328.1L392.8 329L389.8 329.4L386.8 329.2L384 328.6L381.8 327.5L380.5 326.1L380.2 324.6" fill="none" stroke="#6f6559" stroke-width="0.85" stroke-linecap="round"/><path d="M380.2 324.6L381 323.1L382.8 321.8L385.3 320.9L388.3 320.5L391.4 320.7L394.2 321.3L396.3 322.4L397.6 323.8L397.9 325.3M397.9 331.7L397.1 333.2L395.3 334.5L392.8 335.4L389.8 335.8L386.8 335.6L384 335L381.8 333.9L380.5 332.5L380.2 331M380.2 324.6L380.2 331M397.9 325.3L397.9 331.7" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/>
25
+ <path d="M144.1 201.2L144.3 199.8L145.2 198.4L146.6 197.1L148.4 196L240.5 149.9L242.7 149L245.3 148.3L248.1 147.9L250.9 147.8L253.8 147.9L256.6 148.3L259.2 149L261.4 149.9L491.6 265L493.4 266.2L494.8 267.4L495.7 268.8L495.9 270.3L495.9 283.1L495.7 284.5L494.8 285.9L493.4 287.2L491.6 288.3L399.5 334.4L397.3 335.3L394.7 336L391.9 336.4L389.1 336.5L386.2 336.4L383.4 336L380.8 335.3L378.6 334.4L148.4 219.3L146.6 218.1L145.2 216.9L144.3 215.5L144.1 214Z" fill="#e1d7ca"/><path d="M495.9 283.1L495.7 284.5L495.7 271.7L495.9 270.3ZM495.7 284.5L494.8 285.9L494.8 273.1L495.7 271.7ZM494.8 285.9L493.4 287.2L493.4 274.4L494.8 273.1ZM493.4 287.2L491.6 288.3L491.6 275.5L493.4 274.4ZM491.6 288.3L399.5 334.4L399.5 321.5L491.6 275.5ZM399.5 334.4L397.3 335.3L397.3 322.5L399.5 321.5Z" fill="#d6cabb"/><path d="M397.3 335.3L394.7 336L394.7 323.1L397.3 322.5ZM394.7 336L391.9 336.4L391.9 323.6L394.7 323.1ZM391.9 336.4L389.1 336.5L389.1 323.7L391.9 323.6Z" fill="#e1d7ca"/><path d="M389.1 336.5L386.2 336.4L386.2 323.6L389.1 323.7ZM386.2 336.4L383.4 336L383.4 323.1L386.2 323.6ZM383.4 336L380.8 335.3L380.8 322.5L383.4 323.1Z" fill="#ebe3d7"/><path d="M380.8 335.3L378.6 334.4L378.6 321.5L380.8 322.5ZM378.6 334.4L148.4 219.3L148.4 206.4L378.6 321.5ZM148.4 219.3L146.6 218.1L146.6 205.3L148.4 206.4ZM146.6 218.1L145.2 216.9L145.2 204L146.6 205.3ZM145.2 216.9L144.3 215.5L144.3 202.7L145.2 204ZM144.3 215.5L144.1 214L144.1 201.2L144.3 202.7Z" fill="#f3ede4"/><path d="M491.6 265L493.4 266.2L494.8 267.4L495.7 268.8L495.9 270.3L495.7 271.7L494.8 273.1L493.4 274.4L491.6 275.5L399.5 321.5L397.3 322.5L394.7 323.1L391.9 323.6L389.1 323.7L386.2 323.6L383.4 323.1L380.8 322.5L378.6 321.5L148.4 206.4L146.6 205.3L145.2 204L144.3 202.7L144.1 201.2L144.3 199.8L145.2 198.4L146.6 197.1L148.4 196L240.5 149.9L242.7 149L245.3 148.3L248.1 147.9L250.9 147.8L253.8 147.9L256.6 148.3L259.2 149L261.4 149.9Z" fill="#fbf7f0"/><path d="M495.9 270.3L495.7 271.7L494.8 273.1L493.4 274.4L491.6 275.5L399.5 321.5L397.3 322.5L394.7 323.1L391.9 323.6L389.1 323.7L386.2 323.6L383.4 323.1L380.8 322.5L378.6 321.5L148.4 206.4L146.6 205.3L145.2 204L144.3 202.7L144.1 201.2" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round"/><path d="M495.9 270.3L493.3 271.5L492.6 272.7L491.5 273.7L489.8 274.7L397.9 320.7L396 321.5L393.8 322.1L391.5 322.4L389.1 322.5L386.6 322.4L384.3 322.1L382.2 321.5L380.2 320.7L150.2 205.7L148.5 204.7L147.4 203.6L146.7 202.4L144.1 201.2" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round"/><path d="M144.1 201.2L144.3 199.8L145.2 198.4L146.6 197.1L148.4 196L240.5 149.9L242.7 149L245.3 148.3L248.1 147.9L250.9 147.8L253.8 147.9L256.6 148.3L259.2 149L261.4 149.9L491.6 265L493.4 266.2L494.8 267.4L495.7 268.8L495.9 270.3M495.9 283.1L495.7 284.5L494.8 285.9L493.4 287.2L491.6 288.3L399.5 334.4L397.3 335.3L394.7 336L391.9 336.4L389.1 336.5L386.2 336.4L383.4 336L380.8 335.3L378.6 334.4L148.4 219.3L146.6 218.1L145.2 216.9L144.3 215.5L144.1 214M495.9 270.3L495.9 283.1M144.1 201.2L144.1 214" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/><path d="M485.3 268.2L486.1 268.6L486.6 269.1L486.9 269.7L487.1 270.3L486.9 270.9L486.6 271.4L486.1 271.9L485.3 272.4L393.2 318.4L392.3 318.8L391.3 319L390.2 319.2L389.1 319.3L387.9 319.2L386.8 319L385.8 318.8L384.9 318.4L154.7 203.3L153.9 202.9L153.4 202.3L153.1 201.8L152.9 201.2L153.1 200.6L153.4 200.1L153.9 199.6L154.7 199.1L246.8 153.1L247.7 152.7L248.7 152.4L249.8 152.3L250.9 152.2L252.1 152.3L253.2 152.4L254.2 152.7L255.1 153.1Z" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round" stroke-linejoin="round"/>
26
+ <circle cx="250.9" cy="154.1" r="1.25" fill="none" stroke="#9a8f81" stroke-width=".55"/><circle cx="250.9" cy="154.1" r=".55" fill="#484139"/>
27
+ <circle cx="483.2" cy="270.3" r="1.25" fill="none" stroke="#9a8f81" stroke-width=".55"/><circle cx="483.2" cy="270.3" r=".55" fill="#484139"/>
28
+ <circle cx="156.8" cy="201.2" r="1.25" fill="none" stroke="#9a8f81" stroke-width=".55"/><circle cx="156.8" cy="201.2" r=".55" fill="#484139"/>
29
+ <circle cx="389.1" cy="317.4" r="1.25" fill="none" stroke="#9a8f81" stroke-width=".55"/><circle cx="389.1" cy="317.4" r=".55" fill="#484139"/>
30
+ <path d="M162.7 204.5L163 204.1L168.3 201.5L168.9 201.3L169.7 201.3L170.4 201.5L325.2 278.9L325.6 279.3L325.6 280.9L325.2 281.3L320 283.9L319.3 284.1L318.6 284.1L317.9 283.9L163 206.4L162.7 206.1Z" fill="#f6efe4"/><path d="M325.6 280.9L325.2 281.3L325.2 280L325.6 279.6ZM325.2 281.3L320 283.9L320 282.6L325.2 280ZM320 283.9L319.3 284.1L319.3 282.8L320 282.6Z" fill="#f6efe4"/><path d="M319.3 284.1L318.6 284.1L318.6 282.8L319.3 282.8Z" fill="#f6efe4"/><path d="M318.6 284.1L317.9 283.9L317.9 282.6L318.6 282.8ZM317.9 283.9L163 206.4L163 205.2L317.9 282.6ZM163 206.4L162.7 206.1L162.7 204.8L163 205.2Z" fill="#f6efe4"/><path d="M325.2 278.9L325.6 279.3L325.6 279.6L325.2 280L320 282.6L319.3 282.8L318.6 282.8L317.9 282.6L163 205.2L162.7 204.8L162.7 204.5L163 204.1L168.3 201.5L168.9 201.3L169.7 201.3L170.4 201.5Z" fill="#f6efe4"/><path d="M325.6 279.6L325.2 280L320 282.6L319.3 282.8L318.6 282.8L317.9 282.6L163 205.2L162.7 204.8" fill="none" stroke="#c4b8a7" stroke-width="0.65" stroke-linecap="round"/><path d="M162.7 204.8L162.7 204.5L163 204.1L168.3 201.5L168.9 201.3L169.7 201.3L170.4 201.5L325.2 278.9L325.6 279.3L325.6 279.6M325.6 280.9L325.2 281.3L320 283.9L319.3 284.1L318.6 284.1L317.9 283.9L163 206.4L162.7 206.1M325.6 279.6L325.6 280.9M162.7 204.8L162.7 206.1" fill="none" stroke="#6f6559" stroke-width="0.85" stroke-linejoin="round" stroke-linecap="round"/><path d="M177.2 205.4L174.6 206.7M181.4 207.5L178.7 208.8M185.5 209.6L182.9 210.9M189.7 211.7L187.1 213M198.1 215.9L195.5 217.2M202.3 218L199.7 219.3M206.5 220.1L203.9 221.4M210.7 222.2L208 223.5M219 226.4L216.4 227.7M223.2 228.4L220.6 229.8M227.4 230.5L224.8 231.8M231.6 232.6L229 233.9M240 236.8L237.3 238.1M244.1 238.9L241.5 240.2M248.3 241L245.7 242.3M252.5 243.1L249.9 244.4M260.9 247.3L258.3 248.6M265.1 249.4L262.5 250.7M269.3 251.5L266.6 252.8M273.4 253.6L270.8 254.9M281.8 257.7L279.2 259.1M286 259.8L283.4 261.1M290.2 261.9L287.6 263.2M294.4 264L291.7 265.3M302.7 268.2L300.1 269.5M306.9 270.3L304.3 271.6M311.1 272.4L308.5 273.7M315.3 274.5L312.7 275.8M323.7 278.7L321 280" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round" stroke-linejoin="round"/><path d="M173 203.3L168.3 205.7M193.9 213.8L189.2 216.2M214.8 224.3L210.1 226.6M235.8 234.7L231.1 237.1M256.7 245.2L252 247.5M277.6 255.7L272.9 258M298.5 266.1L293.8 268.5M319.5 276.6L314.8 278.9" fill="none" stroke="#6f6559" stroke-width="0.85" stroke-linecap="round" stroke-linejoin="round"/>
31
+ <path d="M340.1 291.8L340.3 291.2L340.9 290.7L353.5 284.4L354.4 284.1L355.6 284L356.7 284.1L357.7 284.4L389.1 300.1L389.7 300.6L389.9 301.2L389.9 302.7L389.7 303.3L389.1 303.8L376.5 310L375.5 310.4L374.4 310.5L373.3 310.4L372.3 310L340.9 294.3L340.3 293.9L340.1 293.3Z" fill="#ebe3d7"/><path d="M389.9 302.7L389.7 303.3L389.7 301.7L389.9 301.2ZM389.7 303.3L389.1 303.8L389.1 302.2L389.7 301.7ZM389.1 303.8L376.5 310L376.5 308.5L389.1 302.2ZM376.5 310L375.5 310.4L375.5 308.8L376.5 308.5Z" fill="#ebe3d7"/><path d="M375.5 310.4L374.4 310.5L374.4 308.9L375.5 308.8Z" fill="#ebe3d7"/><path d="M374.4 310.5L373.3 310.4L373.3 308.8L374.4 308.9Z" fill="#ebe3d7"/><path d="M373.3 310.4L372.3 310L372.3 308.5L373.3 308.8ZM372.3 310L340.9 294.3L340.9 292.8L372.3 308.5ZM340.9 294.3L340.3 293.9L340.3 292.3L340.9 292.8ZM340.3 293.9L340.1 293.3L340.1 291.8L340.3 292.3Z" fill="#ebe3d7"/><path d="M389.1 300.1L389.7 300.6L389.9 301.2L389.7 301.7L389.1 302.2L376.5 308.5L375.5 308.8L374.4 308.9L373.3 308.8L372.3 308.5L340.9 292.8L340.3 292.3L340.1 291.8L340.3 291.2L340.9 290.7L353.5 284.4L354.4 284.1L355.6 284L356.7 284.1L357.7 284.4Z" fill="#ebe3d7"/><path d="M389.9 301.2L389.7 301.7L389.1 302.2L376.5 308.5L375.5 308.8L374.4 308.9L373.3 308.8L372.3 308.5L340.9 292.8L340.3 292.3L340.1 291.8" fill="none" stroke="#c4b8a7" stroke-width="0.65" stroke-linecap="round"/><path d="M340.1 291.8L340.3 291.2L340.9 290.7L353.5 284.4L354.4 284.1L355.6 284L356.7 284.1L357.7 284.4L389.1 300.1L389.7 300.6L389.9 301.2M389.9 302.7L389.7 303.3L389.1 303.8L376.5 310L375.5 310.4L374.4 310.5L373.3 310.4L372.3 310L340.9 294.3L340.3 293.9L340.1 293.3M389.9 301.2L389.9 302.7M340.1 291.8L340.1 293.3" fill="none" stroke="#6f6559" stroke-width="0.85" stroke-linejoin="round" stroke-linecap="round"/><path d="M355.1 287.8L380.2 300.4M351.3 289.7L370.1 299.1M347.5 291.6L360.1 297.9" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round" stroke-linejoin="round"/>
32
+ <path d="M327.2 86.8L327.4 86.4L327.8 86L333.1 83.4L333.8 83.2L334.6 83.1L335.5 83.2L336.2 83.4L341.5 86L341.9 86.4L342.1 86.8L342.1 197L341.9 197.5L341.5 197.8L336.2 200.4L335.5 200.7L334.6 200.8L333.8 200.7L333.1 200.4L327.8 197.8L327.4 197.5L327.2 197Z" fill="#e1d7ca"/><path d="M342.1 197L341.9 197.5L341.9 87.2L342.1 86.8ZM341.9 197.5L341.5 197.8L341.5 87.6L341.9 87.2ZM341.5 197.8L336.2 200.4L336.2 90.2L341.5 87.6ZM336.2 200.4L335.5 200.7L335.5 90.5L336.2 90.2Z" fill="#d6cabb"/><path d="M335.5 200.7L334.6 200.8L334.6 90.5L335.5 90.5Z" fill="#e1d7ca"/><path d="M334.6 200.8L333.8 200.7L333.8 90.5L334.6 90.5Z" fill="#ebe3d7"/><path d="M333.8 200.7L333.1 200.4L333.1 90.2L333.8 90.5ZM333.1 200.4L327.8 197.8L327.8 87.6L333.1 90.2ZM327.8 197.8L327.4 197.5L327.4 87.2L327.8 87.6ZM327.4 197.5L327.2 197L327.2 86.8L327.4 87.2Z" fill="#f3ede4"/><path d="M341.5 86L341.9 86.4L342.1 86.8L341.9 87.2L341.5 87.6L336.2 90.2L335.5 90.5L334.6 90.5L333.8 90.5L333.1 90.2L327.8 87.6L327.4 87.2L327.2 86.8L327.4 86.4L327.8 86L333.1 83.4L333.8 83.2L334.6 83.1L335.5 83.2L336.2 83.4Z" fill="#fbf7f0"/><path d="M342.1 86.8L341.9 87.2L341.5 87.6L336.2 90.2L335.5 90.5L334.6 90.5L333.8 90.5L333.1 90.2L327.8 87.6L327.4 87.2L327.2 86.8" fill="none" stroke="#c4b8a7" stroke-width="0.65" stroke-linecap="round"/><path d="M342.1 86.8L341.1 87.1L340.8 87.3L335.7 89.9L335.2 90.1L334.6 90.1L334.1 90.1L333.6 89.9L328.5 87.3L328.2 87.1L327.2 86.8" fill="none" stroke="#c4b8a7" stroke-width="0.65" stroke-linecap="round"/><path d="M327.2 86.8L327.4 86.4L327.8 86L333.1 83.4L333.8 83.2L334.6 83.1L335.5 83.2L336.2 83.4L341.5 86L341.9 86.4L342.1 86.8M342.1 197L341.9 197.5L341.5 197.8L336.2 200.4L335.5 200.7L334.6 200.8L333.8 200.7L333.1 200.4L327.8 197.8L327.4 197.5L327.2 197M342.1 86.8L342.1 197M327.2 86.8L327.2 197" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/>
33
+ <path d="M311.4 68.9L311.5 68.3L312 67.8L312.7 67.3L331.5 57.9L332.4 57.5L333.5 57.3L334.6 57.2L335.8 57.3L336.9 57.5L337.8 57.9L356.6 67.3L357.3 67.8L357.8 68.3L357.9 68.9L357.9 86.8L357.8 87.4L357.3 87.9L356.6 88.4L337.8 97.8L336.9 98.2L335.8 98.4L334.6 98.5L333.5 98.4L332.4 98.2L331.5 97.8L312.7 88.4L312 87.9L311.5 87.4L311.4 86.8Z" fill="#f4cb80"/><path d="M357.9 86.8L357.8 87.4L357.8 69.5L357.9 68.9ZM357.8 87.4L357.3 87.9L357.3 70L357.8 69.5ZM357.3 87.9L356.6 88.4L356.6 70.4L357.3 70ZM356.6 88.4L337.8 97.8L337.8 79.9L356.6 70.4ZM337.8 97.8L336.9 98.2L336.9 80.2L337.8 79.9Z" fill="#f0bf6a"/><path d="M336.9 98.2L335.8 98.4L335.8 80.4L336.9 80.2ZM335.8 98.4L334.6 98.5L334.6 80.5L335.8 80.4Z" fill="#f4cb80"/><path d="M334.6 98.5L333.5 98.4L333.5 80.4L334.6 80.5ZM333.5 98.4L332.4 98.2L332.4 80.2L333.5 80.4Z" fill="#f8d796"/><path d="M332.4 98.2L331.5 97.8L331.5 79.9L332.4 80.2ZM331.5 97.8L312.7 88.4L312.7 70.4L331.5 79.9ZM312.7 88.4L312 87.9L312 70L312.7 70.4ZM312 87.9L311.5 87.4L311.5 69.5L312 70ZM311.5 87.4L311.4 86.8L311.4 68.9L311.5 69.5Z" fill="#fbe1ac"/><path d="M356.6 67.3L357.3 67.8L357.8 68.3L357.9 68.9L357.8 69.5L357.3 70L356.6 70.4L337.8 79.9L336.9 80.2L335.8 80.4L334.6 80.5L333.5 80.4L332.4 80.2L331.5 79.9L312.7 70.4L312 70L311.5 69.5L311.4 68.9L311.5 68.3L312 67.8L312.7 67.3L331.5 57.9L332.4 57.5L333.5 57.3L334.6 57.2L335.8 57.3L336.9 57.5L337.8 57.9Z" fill="#fee7b8"/><path d="M357.9 68.9L357.8 69.5L357.3 70L356.6 70.4L337.8 79.9L336.9 80.2L335.8 80.4L334.6 80.5L333.5 80.4L332.4 80.2L331.5 79.9L312.7 70.4L312 70L311.5 69.5L311.4 68.9" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round"/><path d="M357.9 68.9L356.6 69.3L356.3 69.7L355.7 70.1L337 79.4L336.3 79.7L335.5 79.9L334.6 79.9L333.8 79.9L333 79.7L332.3 79.4L313.6 70.1L313 69.7L312.7 69.3L311.4 68.9" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round"/><path d="M349.3 67.8L349.7 68.1L349.9 68.3L350.1 68.6L350.2 68.9L350.1 69.2L349.9 69.4L349.7 69.7L349.3 69.9L336.7 76.2L336.3 76.4L335.8 76.5L335.2 76.6L334.6 76.6L334.1 76.6L333.5 76.5L333 76.4L332.6 76.2L320 69.9L319.6 69.7L319.4 69.4L319.2 69.2L319.1 68.9L319.2 68.6L319.4 68.3L319.6 68.1L320 67.8L332.6 61.6L333 61.4L333.5 61.2L334.1 61.2L334.6 61.1L335.2 61.2L335.8 61.2L336.3 61.4L336.7 61.6Z" fill="#4A433C" stroke="#6f6559" stroke-width="0.85" stroke-linejoin="round"/><path d="M311.4 68.9L311.5 68.3L312 67.8L312.7 67.3L331.5 57.9L332.4 57.5L333.5 57.3L334.6 57.2L335.8 57.3L336.9 57.5L337.8 57.9L356.6 67.3L357.3 67.8L357.8 68.3L357.9 68.9M357.9 86.8L357.8 87.4L357.3 87.9L356.6 88.4L337.8 97.8L336.9 98.2L335.8 98.4L334.6 98.5L333.5 98.4L332.4 98.2L331.5 97.8L312.7 88.4L312 87.9L311.5 87.4L311.4 86.8M357.9 68.9L357.9 86.8M311.4 68.9L311.4 86.8" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/>
34
+ <path d="M330.8 211.5L331.4 209.7L332.6 208L334.4 206.4L336.7 205L339.5 203.9L342.6 203L346 202.4L349.6 202L353.2 202L356.8 202.4L360.1 203L363.3 203.9L366 205L368.4 206.4L370.2 208L371.4 209.7L372 211.5L372 221L371.4 222.7L370.2 224.4L368.4 226L366 227.4L363.3 228.5L360.1 229.4L356.8 230.1L353.2 230.4L349.6 230.4L346 230.1L342.6 229.4L339.5 228.5L336.7 227.4L334.4 226L332.6 224.4L331.4 222.7L330.8 221Z" fill="#f4cb80"/><path d="M366 227.4L363.3 228.5L363.3 220.8L366 219.7ZM363.3 228.5L360.1 229.4L360.1 221.7L363.3 220.8ZM372 221L371.4 222.7L371.4 215L372 213.3ZM371.4 222.7L370.2 224.4L370.2 216.7L371.4 215ZM370.2 224.4L368.4 226L368.4 218.3L370.2 216.7ZM368.4 226L366 227.4L366 219.7L368.4 218.3Z" fill="#f0bf6a"/><path d="M360.1 229.4L356.8 230.1L356.8 222.4L360.1 221.7ZM356.8 230.1L353.2 230.4L353.2 222.7L356.8 222.4ZM353.2 230.4L349.6 230.4L349.6 222.7L353.2 222.7Z" fill="#f4cb80"/><path d="M349.6 230.4L346 230.1L346 222.4L349.6 222.7ZM346 230.1L342.6 229.4L342.6 221.7L346 222.4Z" fill="#f8d796"/><path d="M342.6 229.4L339.5 228.5L339.5 220.8L342.6 221.7ZM339.5 228.5L336.7 227.4L336.7 219.7L339.5 220.8ZM336.7 227.4L334.4 226L334.4 218.3L336.7 219.7ZM334.4 226L332.6 224.4L332.6 216.7L334.4 218.3ZM332.6 224.4L331.4 222.7L331.4 215L332.6 216.7ZM331.4 222.7L330.8 221L330.8 213.3L331.4 215Z" fill="#fbe1ac"/><path d="M366 219.7L363.3 220.8L360.1 221.7L356.8 222.4L353.2 222.7L349.6 222.7L346 222.4L342.6 221.7L339.5 220.8L336.7 219.7L334.4 218.3L332.6 216.7L331.4 215L330.8 213.3L330.8 211.5L331.4 209.7L332.6 208L334.4 206.4L336.7 205L339.5 203.9L342.6 203L346 202.4L349.6 202L353.2 202L356.8 202.4L360.1 203L363.3 203.9L366 205L368.4 206.4L370.2 208L371.4 209.7L372 211.5L372 213.3L371.4 215L370.2 216.7L368.4 218.3Z" fill="#fee7b8"/><path d="M372 213.3L371.4 215L370.2 216.7L368.4 218.3L366 219.7L363.3 220.8L360.1 221.7L356.8 222.4L353.2 222.7L349.6 222.7L346 222.4L342.6 221.7L339.5 220.8L336.7 219.7L334.4 218.3L332.6 216.7L331.4 215L330.8 213.3" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round"/><path d="M372 213.3L370.3 214.9L369.1 216.5L367.4 218L365.2 219.3L362.6 220.4L359.6 221.2L356.4 221.8L353.1 222.1L349.7 222.1L346.3 221.8L343.1 221.2L340.2 220.4L337.6 219.3L335.4 218L333.7 216.5L332.5 214.9L330.8 213.3" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round"/><path d="M330.8 213.3L330.8 211.5L331.4 209.7L332.6 208L334.4 206.4L336.7 205L339.5 203.9L342.6 203L346 202.4L349.6 202L353.2 202L356.8 202.4L360.1 203L363.3 203.9L366 205L368.4 206.4L370.2 208L371.4 209.7L372 211.5L372 213.3M372 221L371.4 222.7L370.2 224.4L368.4 226L366 227.4L363.3 228.5L360.1 229.4L356.8 230.1L353.2 230.4L349.6 230.4L346 230.1L342.6 229.4L339.5 228.5L336.7 227.4L334.4 226L332.6 224.4L331.4 222.7L330.8 221M330.8 213.3L330.8 221M372 213.3L372 221" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/>
35
+ <g id="coins"></g>
36
+ <path d="M336.6 147.6L337.1 146.4L338 145.2L339.3 144L340.9 143.1L342.9 142.2L345.1 141.6L347.6 141.1L350.1 140.9L352.7 140.9L355.2 141.1L357.6 141.6L359.9 142.2L361.9 143.1L363.5 144L364.8 145.2L365.7 146.4L366.1 147.6L366.1 213L365.7 214.3L364.8 215.5L363.5 216.6L361.9 217.6L359.9 218.4L357.6 219.1L355.2 219.5L352.7 219.7L350.1 219.7L347.6 219.5L345.1 219.1L342.9 218.4L340.9 217.6L339.3 216.6L338 215.5L337.1 214.3L336.6 213Z" fill="#ffffff" opacity=".28"/><path d="M366.1 148.9L365.7 150.2L364.8 151.4L363.5 152.5L361.9 153.5L359.9 154.3L357.6 155L355.2 155.4L352.7 155.7L350.1 155.7L347.6 155.4L345.1 155L342.9 154.3L340.9 153.5L339.3 152.5L338 151.4L337.1 150.2L336.6 148.9" fill="none" stroke="#c4b8a7" stroke-width="0.65" stroke-linecap="round" stroke-linejoin="round"/><path d="M336.6 148.9L336.6 147.6L337.1 146.4L338 145.2L339.3 144L340.9 143.1L342.9 142.2L345.1 141.6L347.6 141.1L350.1 140.9L352.7 140.9L355.2 141.1L357.6 141.6L359.9 142.2L361.9 143.1L363.5 144L364.8 145.2L365.7 146.4L366.1 147.6L366.1 148.9M366.1 213L365.7 214.3L364.8 215.5L363.5 216.6L361.9 217.6L359.9 218.4L357.6 219.1L355.2 219.5L352.7 219.7L350.1 219.7L347.6 219.5L345.1 219.1L342.9 218.4L340.9 217.6L339.3 216.6L338 215.5L337.1 214.3L336.6 213M336.6 148.9L336.6 213M366.1 148.9L366.1 213" fill="none" stroke="#484139" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/>
37
+ <path d="M334.3 144.5L334.8 143L335.8 141.6L337.3 140.3L339.3 139.1L341.5 138.2L344.1 137.4L346.9 136.9L349.9 136.7L352.9 136.7L355.8 136.9L358.6 137.4L361.2 138.2L363.5 139.1L365.5 140.3L366.9 141.6L368 143L368.5 144.5L368.5 149L368 150.5L366.9 151.9L365.5 153.2L363.5 154.4L361.2 155.3L358.6 156.1L355.8 156.6L352.9 156.8L349.9 156.8L346.9 156.6L344.1 156.1L341.5 155.3L339.3 154.4L337.3 153.2L335.8 151.9L334.8 150.5L334.3 149Z" fill="#e1d7ca"/><path d="M363.5 154.4L361.2 155.3L361.2 152.2L363.5 151.3ZM361.2 155.3L358.6 156.1L358.6 153L361.2 152.2ZM368.5 149L368 150.5L368 147.4L368.5 146ZM368 150.5L366.9 151.9L366.9 148.8L368 147.4ZM366.9 151.9L365.5 153.2L365.5 150.1L366.9 148.8ZM365.5 153.2L363.5 154.4L363.5 151.3L365.5 150.1Z" fill="#d6cabb"/><path d="M358.6 156.1L355.8 156.6L355.8 153.5L358.6 153ZM355.8 156.6L352.9 156.8L352.9 153.8L355.8 153.5Z" fill="#e1d7ca"/><path d="M352.9 156.8L349.9 156.8L349.9 153.8L352.9 153.8ZM349.9 156.8L346.9 156.6L346.9 153.5L349.9 153.8ZM346.9 156.6L344.1 156.1L344.1 153L346.9 153.5Z" fill="#ebe3d7"/><path d="M344.1 156.1L341.5 155.3L341.5 152.2L344.1 153ZM341.5 155.3L339.3 154.4L339.3 151.3L341.5 152.2ZM339.3 154.4L337.3 153.2L337.3 150.1L339.3 151.3ZM337.3 153.2L335.8 151.9L335.8 148.8L337.3 150.1ZM335.8 151.9L334.8 150.5L334.8 147.4L335.8 148.8ZM334.8 150.5L334.3 149L334.3 146L334.8 147.4Z" fill="#f3ede4"/><path d="M363.5 151.3L361.2 152.2L358.6 153L355.8 153.5L352.9 153.8L349.9 153.8L346.9 153.5L344.1 153L341.5 152.2L339.3 151.3L337.3 150.1L335.8 148.8L334.8 147.4L334.3 146L334.3 144.5L334.8 143L335.8 141.6L337.3 140.3L339.3 139.1L341.5 138.2L344.1 137.4L346.9 136.9L349.9 136.7L352.9 136.7L355.8 136.9L358.6 137.4L361.2 138.2L363.5 139.1L365.5 140.3L366.9 141.6L368 143L368.5 144.5L368.5 146L368 147.4L366.9 148.8L365.5 150.1Z" fill="#fbf7f0"/><path d="M368.5 146L368 147.4L366.9 148.8L365.5 150.1L363.5 151.3L361.2 152.2L358.6 153L355.8 153.5L352.9 153.8L349.9 153.8L346.9 153.5L344.1 153L341.5 152.2L339.3 151.3L337.3 150.1L335.8 148.8L334.8 147.4L334.3 146" fill="none" stroke="#c4b8a7" stroke-width="0.65" stroke-linecap="round"/><path d="M361.4 150.2L359.7 151L357.8 151.5L355.8 152L353.6 152.2L351.4 152.3L349.2 152.2L347 152L344.9 151.5L343 151L341.3 150.2L339.9 149.4L338.7 148.4L337.9 147.4L337.4 146.3L337.2 145.2L337.4 144.1L337.9 143L338.7 142L339.9 141L341.3 140.2L343 139.5L344.9 138.9L347 138.5L349.2 138.2L351.4 138.1L353.6 138.2L355.8 138.5L357.8 138.9L359.7 139.5L361.4 140.2L362.9 141L364 142L364.9 143L365.4 144.1L365.6 145.2L365.4 146.3L364.9 147.4L364 148.4L362.9 149.4Z" fill="#4A433C" stroke="#6f6559" stroke-width="0.85" stroke-linejoin="round"/><path d="M334.3 146L334.3 144.5L334.8 143L335.8 141.6L337.3 140.3L339.3 139.1L341.5 138.2L344.1 137.4L346.9 136.9L349.9 136.7L352.9 136.7L355.8 136.9L358.6 137.4L361.2 138.2L363.5 139.1L365.5 140.3L366.9 141.6L368 143L368.5 144.5L368.5 146M368.5 149L368 150.5L366.9 151.9L365.5 153.2L363.5 154.4L361.2 155.3L358.6 156.1L355.8 156.6L352.9 156.8L349.9 156.8L346.9 156.6L344.1 156.1L341.5 155.3L339.3 154.4L337.3 153.2L335.8 151.9L334.8 150.5L334.3 149M334.3 146L334.3 149M368.5 146L368.5 149" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/>
38
+ <path d="M351.4 214.1L346.4 214.1M351.4 208.5L346.4 208.5M351.4 202.8L346.4 202.8M351.4 197.2L346.4 197.2M351.4 191.6L346.4 191.6M351.4 185.9L346.4 185.9M351.4 180.3L346.4 180.3M351.4 174.7L346.4 174.7M351.4 169L346.4 169M351.4 163.4L346.4 163.4" fill="none" stroke="#6f6559" stroke-width="0.85" stroke-linecap="round" stroke-linejoin="round"/>
39
+ <path d="M347.9 118.8L354.9 117.5L354.9 111.1L347.9 112.4Z" fill="#d6cabb" stroke="#c4b8a7" stroke-width=".5" stroke-linejoin="round"/><path d="M331.2 89.4L347.9 112.4L354.9 111.1L338.1 88.1Z" fill="#fbf7f0" stroke="#c4b8a7" stroke-width=".5" stroke-linejoin="round"/><path d="M331.2 95.8L347.9 118.8L347.9 112.4L331.2 89.4Z" fill="#e1d7ca" stroke="#c4b8a7" stroke-width=".5" stroke-linejoin="round"/><path d="M331.2 89.4L338.1 88.1L354.9 111.1L354.9 117.5L347.9 118.8L331.2 95.8Z" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round"/><path d="M346.7 117.5L347 116.6L348 115.9L349.6 115.3L351.4 115.2L353.2 115.3L354.7 115.9L355.8 116.6L356.1 117.5L356.1 127.8L355.8 128.7L354.7 129.5L353.2 130L351.4 130.1L349.6 130L348 129.5L347 128.7L346.7 127.8Z" fill="#4A433C"/><path d="M354.7 129.5L353.2 130L353.2 119.7L354.7 119.2ZM356.1 127.8L355.8 128.7L355.8 118.4L356.1 117.5ZM355.8 128.7L354.7 129.5L354.7 119.2L355.8 118.4Z" fill="#4A433C"/><path d="M353.2 130L351.4 130.1L351.4 119.9L353.2 119.7Z" fill="#4A433C"/><path d="M351.4 130.1L349.6 130L349.6 119.7L351.4 119.9Z" fill="#4A433C"/><path d="M349.6 130L348 129.5L348 119.2L349.6 119.7ZM348 129.5L347 128.7L347 118.4L348 119.2ZM347 128.7L346.7 127.8L346.7 117.5L347 118.4Z" fill="#4A433C"/><path d="M354.7 119.2L353.2 119.7L351.4 119.9L349.6 119.7L348 119.2L347 118.4L346.7 117.5L347 116.6L348 115.9L349.6 115.3L351.4 115.2L353.2 115.3L354.7 115.9L355.8 116.6L356.1 117.5L355.8 118.4Z" fill="#4A433C"/><path d="M356.1 117.5L355.8 118.4L354.7 119.2L353.2 119.7L351.4 119.9L349.6 119.7L348 119.2L347 118.4L346.7 117.5" fill="none" stroke="#6f6559" stroke-width="0.85" stroke-linecap="round"/><path d="M346.7 117.5L347 116.6L348 115.9L349.6 115.3L351.4 115.2L353.2 115.3L354.7 115.9L355.8 116.6L356.1 117.5M356.1 127.8L355.8 128.7L354.7 129.5L353.2 130L351.4 130.1L349.6 130L348 129.5L347 128.7L346.7 127.8M346.7 117.5L346.7 127.8M356.1 117.5L356.1 127.8" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/>
40
+ <g id="drop"></g>
41
+ <path d="M217.5 171.9L192.3 184.5M230 178.2L204.9 190.8M242.6 184.5L217.5 197M255.1 190.8L230 203.3M267.7 197L242.6 209.6M280.2 203.3L255.1 215.9M292.8 209.6L267.7 222.1M305.4 215.9L280.2 228.4M317.9 222.1L292.8 234.7M330.5 228.4L305.4 241M343 234.7L317.9 247.3M355.6 241L330.5 253.5M368.1 247.3L343 259.8M380.7 253.5L355.6 266.1M393.2 259.8L368.1 272.4M405.8 266.1L380.7 278.6M418.4 272.4L393.2 284.9M430.9 278.6L405.8 291.2" fill="none" stroke="#c4b8a7" stroke-width="0.65" stroke-linecap="round" stroke-linejoin="round"/><path d="M209.3 168.1L209.7 167.8L210.6 167.3L211.2 167.2L212 167.2L212.6 167.3L430.3 276.2L430.7 276.5L430.7 280.7L430.3 281.1L429.4 281.5L428.8 281.7L428 281.7L427.4 281.5L209.7 172.7L209.3 172.3Z" fill="#d6cabb"/><path d="M430.7 280.7L430.3 281.1L430.3 277.2L430.7 276.9ZM430.3 281.1L429.4 281.5L429.4 277.6L430.3 277.2Z" fill="#d6cabb"/><path d="M429.4 281.5L428.8 281.7L428.8 277.8L429.4 277.6ZM428.8 281.7L428 281.7L428 277.8L428.8 277.8Z" fill="#d6cabb"/><path d="M428 281.7L427.4 281.5L427.4 277.6L428 277.8Z" fill="#d6cabb"/><path d="M427.4 281.5L209.7 172.7L209.7 168.8L427.4 277.6ZM209.7 172.7L209.3 172.3L209.3 168.5L209.7 168.8Z" fill="#d6cabb"/><path d="M430.3 276.2L430.7 276.5L430.7 276.9L430.3 277.2L429.4 277.6L428.8 277.8L428 277.8L427.4 277.6L209.7 168.8L209.3 168.5L209.3 168.1L209.7 167.8L210.6 167.3L211.2 167.2L212 167.2L212.6 167.3Z" fill="#d6cabb"/><path d="M430.7 276.9L430.3 277.2L429.4 277.6L428.8 277.8L428 277.8L427.4 277.6L209.7 168.8L209.3 168.5" fill="none" stroke="#c4b8a7" stroke-width="0.65" stroke-linecap="round"/><path d="M209.3 168.5L209.3 168.1L209.7 167.8L210.6 167.3L211.2 167.2L212 167.2L212.6 167.3L430.3 276.2L430.7 276.5L430.7 276.9M430.7 280.7L430.3 281.1L429.4 281.5L428.8 281.7L428 281.7L427.4 281.5L209.7 172.7L209.3 172.3M430.7 276.9L430.7 280.7M209.3 168.5L209.3 172.3" fill="none" stroke="#6f6559" stroke-width="0.85" stroke-linejoin="round" stroke-linecap="round"/>
42
+ <g id="traffic"></g>
43
+ <path d="M190.5 177.5L190.9 177.2L191.7 176.8L192.4 176.6L193.1 176.6L193.8 176.8L411.5 285.6L411.8 285.9L411.8 290.1L411.5 290.5L410.6 290.9L410 291.1L409.2 291.1L408.5 290.9L190.9 182.1L190.5 181.7Z" fill="#d6cabb"/><path d="M411.8 290.1L411.5 290.5L411.5 286.6L411.8 286.3ZM411.5 290.5L410.6 290.9L410.6 287L411.5 286.6Z" fill="#d6cabb"/><path d="M410.6 290.9L410 291.1L410 287.2L410.6 287ZM410 291.1L409.2 291.1L409.2 287.2L410 287.2Z" fill="#d6cabb"/><path d="M409.2 291.1L408.5 290.9L408.5 287L409.2 287.2ZM408.5 290.9L190.9 182.1L190.9 178.2L408.5 287ZM190.9 182.1L190.5 181.7L190.5 177.9L190.9 178.2Z" fill="#d6cabb"/><path d="M411.5 285.6L411.8 285.9L411.8 286.3L411.5 286.6L410.6 287L410 287.2L409.2 287.2L408.5 287L190.9 178.2L190.5 177.9L190.5 177.5L190.9 177.2L191.7 176.8L192.4 176.6L193.1 176.6L193.8 176.8Z" fill="#d6cabb"/><path d="M411.8 286.3L411.5 286.6L410.6 287L410 287.2L409.2 287.2L408.5 287L190.9 178.2L190.5 177.9" fill="none" stroke="#c4b8a7" stroke-width="0.65" stroke-linecap="round"/><path d="M190.5 177.9L190.5 177.5L190.9 177.2L191.7 176.8L192.4 176.6L193.1 176.6L193.8 176.8L411.5 285.6L411.8 285.9L411.8 286.3M411.8 290.1L411.5 290.5L410.6 290.9L410 291.1L409.2 291.1L408.5 290.9L190.9 182.1L190.5 181.7M411.8 286.3L411.8 290.1M190.5 177.9L190.5 181.7" fill="none" stroke="#6f6559" stroke-width="0.85" stroke-linejoin="round" stroke-linecap="round"/>
44
+ <path d="M277.3 257.1L277.5 256.6L278.1 256.1L294.9 247.7L295.8 247.4L297 247.3L298.1 247.4L299.1 247.7L330.5 263.4L331.1 263.9L331.3 264.4L331.3 273.4L331.1 274L330.5 274.5L313.7 282.8L312.8 283.2L311.6 283.3L310.5 283.2L309.5 282.8L278.1 267.1L277.5 266.7L277.3 266.1Z" fill="#f3bcc7"/><path d="M331.3 273.4L331.1 274L331.1 265L331.3 264.4ZM331.1 274L330.5 274.5L330.5 265.5L331.1 265ZM330.5 274.5L313.7 282.8L313.7 273.9L330.5 265.5ZM313.7 282.8L312.8 283.2L312.8 274.2L313.7 273.9Z" fill="#eaa8b6"/><path d="M312.8 283.2L311.6 283.3L311.6 274.3L312.8 274.2Z" fill="#f3bcc7"/><path d="M311.6 283.3L310.5 283.2L310.5 274.2L311.6 274.3Z" fill="#f9d0d8"/><path d="M310.5 283.2L309.5 282.8L309.5 273.9L310.5 274.2ZM309.5 282.8L278.1 267.1L278.1 258.2L309.5 273.9ZM278.1 267.1L277.5 266.7L277.5 257.7L278.1 258.2ZM277.5 266.7L277.3 266.1L277.3 257.1L277.5 257.7Z" fill="#fde4e8"/><path d="M330.5 263.4L331.1 263.9L331.3 264.4L331.1 265L330.5 265.5L313.7 273.9L312.8 274.2L311.6 274.3L310.5 274.2L309.5 273.9L278.1 258.2L277.5 257.7L277.3 257.1L277.5 256.6L278.1 256.1L294.9 247.7L295.8 247.4L297 247.3L298.1 247.4L299.1 247.7Z" fill="#fde4e8"/><path d="M331.3 264.4L331.1 265L330.5 265.5L313.7 273.9L312.8 274.2L311.6 274.3L310.5 274.2L309.5 273.9L278.1 258.2L277.5 257.7L277.3 257.1" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round"/><path d="M331.3 264.4L330.3 264.8L329.8 265.2L313.2 273.5L312.4 273.8L311.6 273.8L310.8 273.8L310.1 273.5L278.8 257.9L278.3 257.5L277.3 257.1" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round"/><path d="M326.3 263.9L326.5 264L326.6 264.2L326.7 264.3L326.7 264.4L326.7 264.6L326.6 264.7L326.5 264.9L326.3 265L312.7 271.8L312.5 271.9L312.2 271.9L311.9 272L311.6 272L311.3 272L311.1 271.9L310.8 271.9L310.6 271.8L282.3 257.6L282.1 257.5L282 257.4L281.9 257.3L281.9 257.1L281.9 257L282 256.8L282.1 256.7L282.3 256.6L295.9 249.8L296.2 249.7L296.4 249.6L296.7 249.6L297 249.6L297.3 249.6L297.5 249.6L297.8 249.7L298 249.8Z" fill="#5F574E" stroke="#6f6559" stroke-width="0.85" stroke-linejoin="round"/><path d="M277.3 257.1L277.5 256.6L278.1 256.1L294.9 247.7L295.8 247.4L297 247.3L298.1 247.4L299.1 247.7L330.5 263.4L331.1 263.9L331.3 264.4M331.3 273.4L331.1 274L330.5 274.5L313.7 282.8L312.8 283.2L311.6 283.3L310.5 283.2L309.5 282.8L278.1 267.1L277.5 266.7L277.3 266.1M331.3 264.4L331.3 273.4M277.3 257.1L277.3 266.1" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/>
45
+ <g id="rejects"></g>
46
+ <path d="M290.3 242.9L290.9 241.9L292.2 241L293.9 240.4L295.9 240L298 240L300.1 240.4L301.8 241L303 241.9L303.7 242.9L303.7 247.8L303 248.8L301.8 249.7L300.1 250.3L298 250.6L295.9 250.6L293.9 250.3L292.2 249.7L290.9 248.8L290.3 247.8Z" fill="#4A433C"/><path d="M301.8 249.7L300.1 250.3L300.1 246.4L301.8 245.8ZM303.7 247.8L303 248.8L303 245L303.7 243.9ZM303 248.8L301.8 249.7L301.8 245.8L303 245Z" fill="#4A433C"/><path d="M300.1 250.3L298 250.6L298 246.8L300.1 246.4ZM298 250.6L295.9 250.6L295.9 246.8L298 246.8Z" fill="#4A433C"/><path d="M295.9 250.6L293.9 250.3L293.9 246.4L295.9 246.8Z" fill="#4A433C"/><path d="M293.9 250.3L292.2 249.7L292.2 245.8L293.9 246.4ZM292.2 249.7L290.9 248.8L290.9 245L292.2 245.8ZM290.9 248.8L290.3 247.8L290.3 243.9L290.9 245Z" fill="#4A433C"/><path d="M301.8 245.8L300.1 246.4L298 246.8L295.9 246.8L293.9 246.4L292.2 245.8L290.9 245L290.3 243.9L290.3 242.9L290.9 241.9L292.2 241L293.9 240.4L295.9 240L298 240L300.1 240.4L301.8 241L303 241.9L303.7 242.9L303.7 243.9L303 245Z" fill="#4A433C"/><path d="M303.7 243.9L303 245L301.8 245.8L300.1 246.4L298 246.8L295.9 246.8L293.9 246.4L292.2 245.8L290.9 245L290.3 243.9" fill="none" stroke="#6f6559" stroke-width="0.85" stroke-linecap="round"/><path d="M290.3 243.9L290.3 242.9L290.9 241.9L292.2 241L293.9 240.4L295.9 240L298 240L300.1 240.4L301.8 241L303 241.9L303.7 242.9L303.7 243.9M303.7 247.8L303 248.8L301.8 249.7L300.1 250.3L298 250.6L295.9 250.6L293.9 250.3L292.2 249.7L290.9 248.8L290.3 247.8M290.3 243.9L290.3 247.8M303.7 243.9L303.7 247.8" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/><path d="M292.6 215L293 214.3L293.8 213.6L295.1 213.2L296.6 213L298.1 213.1L299.5 213.4L300.6 213.9L301.3 214.6L301.4 215.4L301.4 243.6L301 244.3L300.1 245L298.9 245.4L297.4 245.6L295.8 245.6L294.4 245.2L293.3 244.7L292.7 244L292.6 243.2Z" fill="#e1d7ca"/><path d="M300.1 245L298.9 245.4L298.9 217.2L300.1 216.8ZM301.4 243.6L301 244.3L301 216.2L301.4 215.4ZM301 244.3L300.1 245L300.1 216.8L301 216.2Z" fill="#d6cabb"/><path d="M298.9 245.4L297.4 245.6L297.4 217.4L298.9 217.2Z" fill="#e1d7ca"/><path d="M297.4 245.6L295.8 245.6L295.8 217.4L297.4 217.4ZM295.8 245.6L294.4 245.2L294.4 217L295.8 217.4Z" fill="#ebe3d7"/><path d="M294.4 245.2L293.3 244.7L293.3 216.5L294.4 217ZM293.3 244.7L292.7 244L292.7 215.8L293.3 216.5ZM292.7 244L292.6 243.2L292.6 215L292.7 215.8Z" fill="#f3ede4"/><path d="M300.1 216.8L298.9 217.2L297.4 217.4L295.8 217.4L294.4 217L293.3 216.5L292.7 215.8L292.6 215L293 214.3L293.8 213.6L295.1 213.2L296.6 213L298.1 213.1L299.5 213.4L300.6 213.9L301.3 214.6L301.4 215.4L301 216.2Z" fill="#fbf7f0"/><path d="M301.4 215.4L301 216.2L300.1 216.8L298.9 217.2L297.4 217.4L295.8 217.4L294.4 217L293.3 216.5L292.7 215.8L292.6 215" fill="none" stroke="#c4b8a7" stroke-width="0.65" stroke-linecap="round"/><path d="M292.6 215L293 214.3L293.8 213.6L295.1 213.2L296.6 213L298.1 213.1L299.5 213.4L300.6 213.9L301.3 214.6L301.4 215.4M301.4 243.6L301 244.3L300.1 245L298.9 245.4L297.4 245.6L295.8 245.6L294.4 245.2L293.3 244.7L292.7 244L292.6 243.2M292.6 215L292.6 243.2M301.4 215.4L301.4 243.6" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/>
47
+ <g id="gate"></g>
48
+ <path d="M405.5 263.6L405.7 263L406.1 262.5L406.8 262L434.1 248.4L435 248.1L436 247.8L437.2 247.8L438.3 247.8L439.4 248.1L440.3 248.4L455 255.7L455.7 256.2L456.1 256.7L456.3 257.3L456.3 288.1L456.1 288.6L455.7 289.2L455 289.6L427.8 303.2L426.9 303.6L425.8 303.8L424.6 303.9L423.5 303.8L422.4 303.6L421.5 303.2L406.8 295.9L406.1 295.5L405.7 294.9L405.5 294.3Z" fill="#c3e1b2"/><path d="M456.3 288.1L456.1 288.6L456.1 257.9L456.3 257.3ZM456.1 288.6L455.7 289.2L455.7 258.4L456.1 257.9ZM455.7 289.2L455 289.6L455 258.9L455.7 258.4ZM455 289.6L427.8 303.2L427.8 272.5L455 258.9ZM427.8 303.2L426.9 303.6L426.9 272.8L427.8 272.5Z" fill="#b3d79f"/><path d="M426.9 303.6L425.8 303.8L425.8 273.1L426.9 272.8ZM425.8 303.8L424.6 303.9L424.6 273.1L425.8 273.1Z" fill="#c3e1b2"/><path d="M424.6 303.9L423.5 303.8L423.5 273.1L424.6 273.1ZM423.5 303.8L422.4 303.6L422.4 272.8L423.5 273.1Z" fill="#d1e9c2"/><path d="M422.4 303.6L421.5 303.2L421.5 272.5L422.4 272.8ZM421.5 303.2L406.8 295.9L406.8 265.2L421.5 272.5ZM406.8 295.9L406.1 295.5L406.1 264.7L406.8 265.2ZM406.1 295.5L405.7 294.9L405.7 264.2L406.1 264.7ZM405.7 294.9L405.5 294.3L405.5 263.6L405.7 264.2Z" fill="#e2f2d7"/><path d="M455 255.7L455.7 256.2L456.1 256.7L456.3 257.3L456.1 257.9L455.7 258.4L455 258.9L427.8 272.5L426.9 272.8L425.8 273.1L424.6 273.1L423.5 273.1L422.4 272.8L421.5 272.5L406.8 265.2L406.1 264.7L405.7 264.2L405.5 263.6L405.7 263L406.1 262.5L406.8 262L434.1 248.4L435 248.1L436 247.8L437.2 247.8L438.3 247.8L439.4 248.1L440.3 248.4Z" fill="#e2f2d7"/><path d="M456.3 257.3L456.1 257.9L455.7 258.4L455 258.9L427.8 272.5L426.9 272.8L425.8 273.1L424.6 273.1L423.5 273.1L422.4 272.8L421.5 272.5L406.8 265.2L406.1 264.7L405.7 264.2L405.5 263.6" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round"/><path d="M456.3 257.3L455 257.7L454.7 258.1L454.1 258.5L427 272L426.3 272.3L425.5 272.5L424.6 272.5L423.8 272.5L423 272.3L422.3 272L407.7 264.8L407.2 264.4L406.8 264L405.5 263.6" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round"/><path d="M456.3 272.7L456.2 273.1L455.9 273.5L455.5 273.9L455 274.3L427.8 287.9L427.1 288.1L426.3 288.3L425.5 288.5L424.6 288.5L423.8 288.5L422.9 288.3L422.2 288.1L421.5 287.9L406.8 280.5L406.3 280.2L405.9 279.8L405.6 279.4L405.5 279" fill="none" stroke="#9a8f81" stroke-width="0.8" stroke-linecap="round" stroke-linejoin="round"/><path d="M405.5 263.6L405.7 263L406.1 262.5L406.8 262L434.1 248.4L435 248.1L436 247.8L437.2 247.8L438.3 247.8L439.4 248.1L440.3 248.4L455 255.7L455.7 256.2L456.1 256.7L456.3 257.3M456.3 288.1L456.1 288.6L455.7 289.2L455 289.6L427.8 303.2L426.9 303.6L425.8 303.8L424.6 303.9L423.5 303.8L422.4 303.6L421.5 303.2L406.8 295.9L406.1 295.5L405.7 294.9L405.5 294.3M456.3 257.3L456.3 288.1M405.5 263.6L405.5 294.3" fill="none" stroke="#484139" stroke-width="1" stroke-linejoin="round" stroke-linecap="round"/></g></svg></div>
49
+ <div class="row"><span>suba o tráfego para esvaziar o tubo</span><span class="readout" id="readout" aria-live="polite">fichas 10/10 · aceitas 0 · 429 0</span></div>
50
+ <div class="controls"><label>reposição <input id="rate" type="range" min="0.5" max="5" step="0.5" value="2"><output id="rate-v">2/s</output></label>
51
+ <label>tráfego <input id="rps" type="range" min="0.5" max="8" step="0.5" value="3"><output id="rps-v">3/s</output></label></div><p class="caption">Cada cliente tem um tubo com 10 fichas, reposto pelo dispensador. Cada requisição gasta uma ficha na catraca; com o tubo vazio, o gateway responde 429.</p>
52
+ </main><script>(()=>{
53
+ // kit.js: core of the anatomy kit (github.com/wheresryan22/anatomy, commit 1482e84), vendored unmodified.
54
+ // MIT License, Copyright (c) 2026 Ryan. See ANATOMY-LICENSE.txt.
55
+ const AZIMUTH = 45;
56
+ const ELEVATION = 30;
57
+ const SHADES = 4;
58
+ const RADIANS = Math.PI / 180;
59
+ const UNIT = Math.sqrt(1.6);
60
+ function cameraOf({ scale, azimuth = AZIMUTH, elevation = ELEVATION }) {
61
+ const a = azimuth * RADIANS;
62
+ const e = elevation * RADIANS;
63
+ return { sinA: Math.sin(a), cosA: Math.cos(a), sinE: Math.sin(e), cosE: Math.cos(e), k: scale * UNIT };
64
+ }
65
+ function iso([x, y, z], projection) {
66
+ const { origin } = projection;
67
+ const { sinA, cosA, sinE, cosE, k } = cameraOf(projection);
68
+ return [origin[0] + (x * sinA - y * cosA) * k, origin[1] + ((x * cosA + y * sinA) * sinE - z * cosE) * k];
69
+ }
70
+ function towardViewer(projection) {
71
+ const { sinA, cosA } = cameraOf(projection);
72
+ return [cosA, sinA];
73
+ }
74
+ function depthOf([x, y, z], projection) {
75
+ const { sinA, cosA, sinE, cosE } = cameraOf(projection);
76
+ return (x * cosA + y * sinA) * cosE + z * sinE;
77
+ }
78
+ const tenth = (value) => {
79
+ const text = (Math.round(value * 10) / 10).toFixed(1).replace(/\.0$/, "");
80
+ return text === "-0" ? "0" : text;
81
+ };
82
+ function pathOf(points, closed = false) {
83
+ if (!points.length)
84
+ return "";
85
+ return points.map(([x, y], at) => `${at ? "L" : "M"}${tenth(x)} ${tenth(y)}`).join("") + (closed ? "Z" : "");
86
+ }
87
+ const joinPaths = (paths) => paths.filter(Boolean).join("");
88
+ function roundedPlan({ x, y, w, d, r }, steps = 8) {
89
+ const radius = Math.max(0, Math.min(r, w / 2, d / 2));
90
+ const corners = [
91
+ [x + w - radius, y + radius, -90],
92
+ [x + w - radius, y + d - radius, 0],
93
+ [x + radius, y + d - radius, 90],
94
+ [x + radius, y + radius, 180],
95
+ ];
96
+ const out = [];
97
+ for (const [cx, cy, start] of corners) {
98
+ const count = radius > 0 ? steps : 0;
99
+ for (let step = 0; step <= count; step++) {
100
+ const angle = (start + (count ? (90 * step) / count : 45)) * RADIANS;
101
+ out.push([cx + radius * Math.cos(angle), cy + radius * Math.sin(angle)]);
102
+ }
103
+ }
104
+ return out;
105
+ }
106
+ function signedArea(points) {
107
+ let area = 0;
108
+ for (let index = 0; index < points.length; index++) {
109
+ const [ax, ay] = points[index];
110
+ const [bx, by] = points[(index + 1) % points.length];
111
+ area += ax * by - bx * ay;
112
+ }
113
+ return area / 2;
114
+ }
115
+ const oriented = (points) => (signedArea(points) < 0 ? [...points].reverse() : points);
116
+ function convexHull(points) {
117
+ const sorted = [...points].sort((a, b) => a[0] - b[0] || a[1] - b[1]);
118
+ if (sorted.length < 3)
119
+ return sorted;
120
+ const cross = (o, a, b) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
121
+ const lower = [];
122
+ for (const point of sorted) {
123
+ while (lower.length >= 2 && cross(lower[lower.length - 2], lower[lower.length - 1], point) <= 0)
124
+ lower.pop();
125
+ lower.push(point);
126
+ }
127
+ const upper = [];
128
+ for (let index = sorted.length - 1; index >= 0; index--) {
129
+ const point = sorted[index];
130
+ while (upper.length >= 2 && cross(upper[upper.length - 2], upper[upper.length - 1], point) <= 0)
131
+ upper.pop();
132
+ upper.push(point);
133
+ }
134
+ return [...lower.slice(0, -1), ...upper.slice(0, -1)];
135
+ }
136
+ function runsOf(flags, want) {
137
+ const count = flags.length;
138
+ const runs = [];
139
+ const start = flags.findIndex((flag, index) => flag !== flags[(index + count - 1) % count]);
140
+ if (start < 0)
141
+ return flags[0] === want ? [Array.from({ length: count + 1 }, (_, index) => index % count)] : [];
142
+ let run = null;
143
+ for (let step = 0; step < count; step++) {
144
+ const index = (start + step) % count;
145
+ if (flags[index] === want) {
146
+ if (!run)
147
+ run = [index];
148
+ run.push((index + 1) % count);
149
+ }
150
+ else if (run) {
151
+ runs.push(run);
152
+ run = null;
153
+ }
154
+ }
155
+ if (run)
156
+ runs.push(run);
157
+ return runs;
158
+ }
159
+ function extrude(ring, z, height, projection, options = {}) {
160
+ const convex = options.convex ?? true;
161
+ const count = ring.length;
162
+ const counter = signedArea(ring) > 0;
163
+ const [vx, vy] = towardViewer(projection);
164
+ const { sinA, cosA } = cameraOf(projection);
165
+ const normals = ring.map(([ax, ay], index) => {
166
+ const [bx, by] = ring[(index + 1) % count];
167
+ const dx = bx - ax;
168
+ const dy = by - ay;
169
+ const length = Math.hypot(dx, dy) || 1;
170
+ return (counter ? [dy / length, -dx / length] : [-dy / length, dx / length]);
171
+ });
172
+ const facing = normals.map(([nx, ny]) => nx * vx + ny * vy > 1e-9);
173
+ const top = ring.map(([x, y]) => iso([x, y, z + height], projection));
174
+ const bottom = ring.map(([x, y]) => iso([x, y, z], projection));
175
+ const outline = [];
176
+ const crease = [];
177
+ for (const run of runsOf(facing, false))
178
+ outline.push(pathOf(run.map((index) => top[index])));
179
+ for (const run of runsOf(facing, true)) {
180
+ crease.push(pathOf(run.map((index) => top[index])));
181
+ if (height > 0)
182
+ outline.push(pathOf(run.map((index) => bottom[index])));
183
+ }
184
+ if (height > 0) {
185
+ for (let index = 0; index < count; index++) {
186
+ if (facing[(index + count - 1) % count] !== facing[index])
187
+ outline.push(pathOf([top[index], bottom[index]]));
188
+ }
189
+ }
190
+ let fill;
191
+ if (convex) {
192
+ fill = pathOf(convexHull([...top, ...bottom]), true);
193
+ }
194
+ else {
195
+ const parts = [pathOf(oriented(top), true), pathOf(oriented(bottom), true)];
196
+ for (let index = 0; index < count; index++) {
197
+ if (!facing[index])
198
+ continue;
199
+ const next = (index + 1) % count;
200
+ parts.push(pathOf(oriented([top[index], top[next], bottom[next], bottom[index]]), true));
201
+ }
202
+ fill = parts.join("");
203
+ }
204
+ const buckets = Array.from({ length: SHADES }, () => []);
205
+ if (height > 0) {
206
+ const [lx, ly] = [-sinA, cosA];
207
+ for (let index = 0; index < count; index++) {
208
+ if (!facing[index])
209
+ continue;
210
+ const [nx, ny] = normals[index];
211
+ const lit = (nx * lx + ny * ly + 1) / 2;
212
+ const shade = Math.min(SHADES - 1, Math.max(0, Math.floor(lit * SHADES)));
213
+ const next = (index + 1) % count;
214
+ buckets[shade].push(pathOf(oriented([top[index], top[next], bottom[next], bottom[index]]), true));
215
+ }
216
+ }
217
+ let bevel;
218
+ if (options.bevel && options.bevel > 0) {
219
+ const by = options.bevel;
220
+ const inset = ring.map(([x, y], index) => {
221
+ const [ax, ay] = normals[(index + count - 1) % count];
222
+ const [bx, by2] = normals[index];
223
+ const mx = ax + bx;
224
+ const my = ay + by2;
225
+ const length = Math.hypot(mx, my) || 1;
226
+ return [x - (mx / length) * by, y - (my / length) * by];
227
+ });
228
+ const insetTop = inset.map(([x, y]) => iso([x, y, z + height], projection));
229
+ bevel = runsOf(facing, true)
230
+ .map((run) => pathOf([top[run[0]], ...run.slice(1, -1).map((index) => insetTop[index]), top[run[run.length - 1]]]))
231
+ .join("");
232
+ }
233
+ return {
234
+ fill,
235
+ outline: outline.join(""),
236
+ crease: crease.join(""),
237
+ top: pathOf(oriented(top), true),
238
+ shades: buckets.map((paths) => paths.join("")),
239
+ bevel,
240
+ };
241
+ }
242
+ const ringOf = (plan, steps = 8) => roundedPlan(plan, steps);
243
+ function slabOf(plan, z, height, projection, steps = 8, bevel = 0) {
244
+ return extrude(ringOf(plan, steps), z, height, projection, { convex: true, bevel });
245
+ }
246
+ function circleRing(cx, cy, radius, steps = 40) {
247
+ return Array.from({ length: steps }, (_, step) => {
248
+ const angle = (step / steps) * Math.PI * 2;
249
+ return [cx + radius * Math.cos(angle), cy + radius * Math.sin(angle)];
250
+ });
251
+ }
252
+ function cylinder(cx, cy, radius, z, height, projection, steps = 32, bevel = 0) {
253
+ return extrude(circleRing(cx, cy, radius, steps), z, height, projection, { convex: true, bevel });
254
+ }
255
+ const insetPlan = ({ x, y, w, d, r }, by) => ({ x: x + by, y: y + by, w: w - by * 2, d: d - by * 2, r: Math.max(0, r - by) });
256
+ function onTop(points, z, projection, closed = false) {
257
+ return pathOf(points.map(([x, y]) => iso([x, y, z], projection)), closed);
258
+ }
259
+ const planOutline = (plan, z, projection, steps = 8) => onTop(ringOf(plan, steps), z, projection, true);
260
+ const lineOnTop = (from, to, z, projection) => onTop([from, to], z, projection);
261
+ const segment = (from, to, projection) => pathOf([iso(from, projection), iso(to, projection)]);
262
+ const rise = (at, from, to, projection) => segment([at[0], at[1], from], [at[0], at[1], to], projection);
263
+ const ring = (cx, cy, radius, z, projection, steps = 40) => onTop(circleRing(cx, cy, radius, steps), z, projection, true);
264
+ const pointsAt = (points, projection) => points.map((point) => iso(point, projection));
265
+ function dotGrid(x, y, columns, rows, gap, z, projection) {
266
+ const dots = [];
267
+ for (let row = 0; row < rows; row++) {
268
+ for (let column = 0; column < columns; column++)
269
+ dots.push(iso([x + column * gap, y + row * gap, z], projection));
270
+ }
271
+ return dots;
272
+ }
273
+ function corners({ x, y, w, d }, inset = 0) {
274
+ return [
275
+ [x + inset, y + inset],
276
+ [x + w - inset, y + inset],
277
+ [x + inset, y + d - inset],
278
+ [x + w - inset, y + d - inset],
279
+ ];
280
+ }
281
+ function boxCorners({ x, y, w, d }, z0, z1) {
282
+ const out = [];
283
+ for (const px of [x, x + w])
284
+ for (const py of [y, y + d])
285
+ for (const z of [z0, z1])
286
+ out.push([px, py, z]);
287
+ return out;
288
+ }
289
+ function knurl(cx, cy, radius, z0, z1, count, projection, inset = 0.4) {
290
+ const [vx, vy] = towardViewer(projection);
291
+ const lines = [];
292
+ for (let index = 0; index < count; index++) {
293
+ const angle = (index / count) * Math.PI * 2;
294
+ const nx = Math.cos(angle);
295
+ const ny = Math.sin(angle);
296
+ if (nx * vx + ny * vy < 0.15)
297
+ continue;
298
+ lines.push(segment([cx + radius * nx, cy + radius * ny, z0 + inset], [cx + radius * nx, cy + radius * ny, z1 - inset], projection));
299
+ }
300
+ return lines.join("");
301
+ }
302
+ function sideArc(cx, cy, radius, z, projection, steps = 24) {
303
+ const [vx, vy] = towardViewer(projection);
304
+ const facing = Math.atan2(vy, vx);
305
+ const points = [];
306
+ for (let step = 0; step <= steps; step++) {
307
+ const angle = facing - Math.PI / 2 + (step / steps) * Math.PI;
308
+ points.push(iso([cx + radius * Math.cos(angle), cy + radius * Math.sin(angle), z], projection));
309
+ }
310
+ return pathOf(points);
311
+ }
312
+ function ringSeam(ring, z, projection) {
313
+ const count = ring.length;
314
+ const counter = signedArea(ring) > 0;
315
+ const [vx, vy] = towardViewer(projection);
316
+ const facing = ring.map(([ax, ay], index) => {
317
+ const [bx, by] = ring[(index + 1) % count];
318
+ const dx = bx - ax;
319
+ const dy = by - ay;
320
+ const [nx, ny] = counter ? [dy, -dx] : [-dy, dx];
321
+ return nx * vx + ny * vy > 1e-9;
322
+ });
323
+ return runsOf(facing, true).map((run) => pathOf(run.map((index) => iso([ring[index][0], ring[index][1], z], projection)))).join("");
324
+ }
325
+ const sideSeam = (plan, z, projection, steps = 8) => ringSeam(ringOf(plan, steps), z, projection);
326
+ function sideRing(center, radius, axis, projection, steps = 20) {
327
+ const [px, py, pz] = center;
328
+ const points = [];
329
+ for (let step = 0; step < steps; step++) {
330
+ const angle = (step / steps) * Math.PI * 2;
331
+ const u = radius * Math.cos(angle);
332
+ const v = radius * Math.sin(angle);
333
+ points.push(iso(axis === "x" ? [px, py + u, pz + v] : [px + u, py, pz + v], projection));
334
+ }
335
+ return pathOf(points, true);
336
+ }
337
+ function coil(from, to, center, radius, turns, axis, projection, perTurn = 16) {
338
+ const count = Math.max(1, Math.round(turns * perTurn));
339
+ const back = [];
340
+ const front = [];
341
+ let run = [];
342
+ let near = null;
343
+ for (let index = 0; index <= count; index++) {
344
+ const share = index / count;
345
+ const angle = share * turns * Math.PI * 2;
346
+ const u = radius * Math.cos(angle);
347
+ const v = radius * Math.sin(angle);
348
+ const along = from + (to - from) * share;
349
+ const point = axis === "x" ? [along, center[0] + u, center[1] + v] : [center[0] + u, along, center[1] + v];
350
+ const normal = axis === "x" ? [0, Math.cos(angle), Math.sin(angle)] : [Math.cos(angle), 0, Math.sin(angle)];
351
+ const facing = depthOf(normal, projection) > 0;
352
+ const flat = iso(point, projection);
353
+ if (near === null)
354
+ near = facing;
355
+ if (facing !== near) {
356
+ run.push(flat);
357
+ (near ? front : back).push(pathOf(run));
358
+ run = [flat];
359
+ near = facing;
360
+ continue;
361
+ }
362
+ run.push(flat);
363
+ }
364
+ if (run.length > 1)
365
+ (near ? front : back).push(pathOf(run));
366
+ return { back: back.join(""), front: front.join("") };
367
+ }
368
+ function topTicks(from, to, step, every, edge, z, lengths, projection, axis = "x") {
369
+ const minor = [];
370
+ const major = [];
371
+ const first = Math.ceil(from / step) * step;
372
+ for (let at = first, index = Math.round(first / step); at <= to + 1e-9; at += step, index++) {
373
+ const big = index % every === 0;
374
+ const length = big ? lengths[1] : lengths[0];
375
+ const a = axis === "x" ? [at, edge] : [edge, at];
376
+ const b = axis === "x" ? [at, edge + length] : [edge + length, at];
377
+ (big ? major : minor).push(lineOnTop(a, b, z, projection));
378
+ }
379
+ return { minor: minor.join(""), major: major.join("") };
380
+ }
381
+ function sideTicks(from, to, step, every, face, top, lengths, projection, axis = "x") {
382
+ const minor = [];
383
+ const major = [];
384
+ const first = Math.ceil(from / step) * step;
385
+ for (let at = first, index = Math.round(first / step); at <= to + 1e-9; at += step, index++) {
386
+ const big = index % every === 0;
387
+ const length = big ? lengths[1] : lengths[0];
388
+ const a = axis === "x" ? [at, face, top] : [face, at, top];
389
+ const b = axis === "x" ? [at, face, top - length] : [face, at, top - length];
390
+ (big ? major : minor).push(segment(a, b, projection));
391
+ }
392
+ return { minor: minor.join(""), major: major.join("") };
393
+ }
394
+ function radialTicks(cx, cy, radius, count, every, z, lengths, projection, from = 0, span = Math.PI * 2) {
395
+ const minor = [];
396
+ const major = [];
397
+ const closed = Math.abs(span - Math.PI * 2) < 1e-9;
398
+ const steps = closed ? count : count + 1;
399
+ for (let index = 0; index < steps; index++) {
400
+ const angle = from + (index / count) * span;
401
+ const big = index % every === 0;
402
+ const inner = radius - (big ? lengths[1] : lengths[0]);
403
+ const sx = Math.sin(angle);
404
+ const sy = -Math.cos(angle);
405
+ (big ? major : minor).push(lineOnTop([cx + sx * inner, cy + sy * inner], [cx + sx * radius, cy + sy * radius], z, projection));
406
+ }
407
+ return { minor: minor.join(""), major: major.join("") };
408
+ }
409
+ const haloOf = (plan, z, height, projection) => slabOf(plan, z, height, projection).fill;
410
+ function axisVector(projection, [dx, dy, dz]) {
411
+ const origin = iso([0, 0, 0], projection);
412
+ const moved = iso([dx, dy, dz], projection);
413
+ return [moved[0] - origin[0], moved[1] - origin[1]];
414
+ }
415
+ const fine = (value) => Math.round(value * 100) / 100;
416
+ function translateAlong(projection, by) {
417
+ const [x, y] = axisVector(projection, by);
418
+ return `translate(${fine(x)} ${fine(y)})`;
419
+ }
420
+ const thousandth = (value) => Math.round(value * 1000) / 1000;
421
+ function axesAt(at, z, projection) {
422
+ const origin = iso([at[0], at[1], z], projection);
423
+ const along = (point) => {
424
+ const [px, py] = iso(point, projection);
425
+ return [px - origin[0], py - origin[1]];
426
+ };
427
+ return { origin, x: along([at[0] + 1, at[1], z]), y: along([at[0], at[1] + 1, z]), z: along([at[0], at[1], z + 1]) };
428
+ }
429
+ const matrixOf = (u, v, origin) => `matrix(${thousandth(u[0])} ${thousandth(u[1])} ${thousandth(v[0])} ${thousandth(v[1])} ${thousandth(origin[0])} ${thousandth(origin[1])})`;
430
+ function holdStill(element, [dx, dy]) {
431
+ const text = dx || dy ? `translate(${-dx} ${-dy})` : "";
432
+ element.querySelectorAll("[data-hold]").forEach((node) => (text ? node.setAttribute("transform", text) : node.removeAttribute("transform")));
433
+ }
434
+ function topMatrix(at, z, projection, along = "x") {
435
+ const { origin, x, y } = axesAt(at, z, projection);
436
+ return along === "x" ? matrixOf(x, y, origin) : matrixOf([-y[0], -y[1]], x, origin);
437
+ }
438
+ function sideMatrix(at, z, projection, face) {
439
+ const { origin, x, y, z: up } = axesAt(at, z, projection);
440
+ const down = [-up[0], -up[1]];
441
+ return face === "left" ? matrixOf(x, down, origin) : matrixOf([-y[0], -y[1]], down, origin);
442
+ }
443
+ function screenRise(height, projection) {
444
+ const { cosE, k } = cameraOf(projection);
445
+ return height * cosE * k;
446
+ }
447
+ function fitProjection(points, width, height, { pad = 24, headroom = 0, azimuth = AZIMUTH, elevation = ELEVATION } = {}) {
448
+ const unit = { origin: [0, 0], scale: 1, azimuth, elevation };
449
+ const flat = points.map((point) => iso(point, unit));
450
+ const xs = flat.map(([x]) => x);
451
+ const ys = flat.map(([, y]) => y);
452
+ const left = Math.min(...xs);
453
+ const right = Math.max(...xs);
454
+ const up = Math.min(...ys);
455
+ const down = Math.max(...ys);
456
+ const scale = Math.min((width - pad * 2) / (right - left), (height - pad * 2 - headroom) / (down - up));
457
+ return {
458
+ origin: [width / 2 - ((left + right) / 2) * scale, headroom + (height - headroom) / 2 - ((up + down) / 2) * scale],
459
+ scale,
460
+ azimuth,
461
+ elevation,
462
+ };
463
+ }
464
+ const escape = (text) => text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
465
+ const attrs = (pairs) => Object.entries(pairs)
466
+ .filter(([, value]) => value !== undefined && value !== false)
467
+ .map(([key, value]) => ` ${key}="${escape(String(value))}"`)
468
+ .join("");
469
+ function solidSvg(paths, { tone = "hi", crease = "faint", halo = false, lit = false, flat = false, className, inner = "" } = {}) {
470
+ const parts = [];
471
+ if (halo)
472
+ parts.push(`<path class="iso-halo" d="${paths.fill}"/>`);
473
+ parts.push(`<path class="iso-fill" d="${paths.fill}"/>`);
474
+ if (!flat) {
475
+ paths.shades.forEach((d, shade) => {
476
+ if (d)
477
+ parts.push(`<path class="iso-shade" data-shade="${shade}" d="${d}"/>`);
478
+ });
479
+ parts.push(`<path class="iso-top" d="${paths.top}"/>`);
480
+ }
481
+ if (crease !== "none" && paths.crease)
482
+ parts.push(`<path class="iso-line iso-crease" data-tone="${crease}" d="${paths.crease}"/>`);
483
+ if (crease !== "none" && paths.bevel)
484
+ parts.push(`<path class="iso-line iso-bevel" data-tone="${crease}" d="${paths.bevel}"/>`);
485
+ if (inner)
486
+ parts.push(inner);
487
+ parts.push(`<path class="iso-line iso-edge" data-tone="${tone}" d="${paths.outline}"/>`);
488
+ return `<g${attrs({ class: className ? `iso-solid ${className}` : "iso-solid", "data-lit": lit ? "" : undefined, "data-seamless": paths.seamless ? "" : undefined })}>${parts.join("")}</g>`;
489
+ }
490
+ function lineSvg(d, { tone = "lo", dotted = false, dashed = false, flow = false, className, free } = {}) {
491
+ if (!d)
492
+ return "";
493
+ return `<path${attrs({
494
+ class: className ? `iso-line ${className}` : "iso-line",
495
+ "data-tone": tone,
496
+ "data-free": free === true ? "" : free || undefined,
497
+ "data-dotted": dotted ? "" : undefined,
498
+ "data-dashed": dashed ? "" : undefined,
499
+ "data-flow": flow ? "" : undefined,
500
+ d,
501
+ })}/>`;
502
+ }
503
+ function dotsSvg(points, { size = 0.5, tone = "mid", pulse = false } = {}) {
504
+ const dots = points
505
+ .map(([x, y, alpha], index) => `<circle cx="${tenth(x)}" cy="${tenth(y)}" r="${size}"${alpha !== undefined && alpha < 1 ? ` fill-opacity="${Math.max(0, alpha).toFixed(2)}"` : ""}${pulse ? ` data-pulse="" style="--pulse-at:${(index * 137) % 1600}ms"` : ""}/>`)
506
+ .join("");
507
+ return `<g class="iso-dots" data-tone="${tone}">${dots}</g>`;
508
+ }
509
+ function fadedSvg(list, style = {}) {
510
+ const groups = new Map();
511
+ for (const entry of list) {
512
+ const [d, alpha] = Array.isArray(entry) ? entry : [entry.d, entry.alpha];
513
+ if (!d || !(alpha > 0.02))
514
+ continue;
515
+ const level = Math.min(1, Math.round(alpha * 20) / 20);
516
+ groups.set(level, (groups.get(level) ?? "") + d);
517
+ }
518
+ return [...groups].map(([alpha, d]) => (alpha >= 1 ? lineSvg(d, style) : `<g opacity="${alpha.toFixed(2)}">${lineSvg(d, style)}</g>`)).join("");
519
+ }
520
+ function fadeLineSvg(points, { fade = [0, 0], tone = "lo", className, stops = 6 } = {}) {
521
+ if (points.length < 2)
522
+ return "";
523
+ const ease = (t) => t * t * (3 - 2 * t);
524
+ const hashOf = (text) => {
525
+ let hash = 2166136261;
526
+ for (let index = 0; index < text.length; index++)
527
+ hash = Math.imul(hash ^ text.charCodeAt(index), 16777619);
528
+ return (hash >>> 0).toString(36);
529
+ };
530
+ const lengths = [0];
531
+ for (let index = 1; index < points.length; index++)
532
+ lengths.push(lengths[index - 1] + Math.hypot(points[index][0] - points[index - 1][0], points[index][1] - points[index - 1][1]));
533
+ const at = (length) => {
534
+ let index = 1;
535
+ while (index < points.length - 1 && lengths[index] < length)
536
+ index++;
537
+ const span = lengths[index] - lengths[index - 1] || 1;
538
+ const t = Math.max(0, Math.min(1, (length - lengths[index - 1]) / span));
539
+ return [points[index - 1][0] + (points[index][0] - points[index - 1][0]) * t, points[index - 1][1] + (points[index][1] - points[index - 1][1]) * t];
540
+ };
541
+ const pieceOf = (from, to) => [at(from), ...points.filter((_, index) => lengths[index] > from + 1e-6 && lengths[index] < to - 1e-6), at(to)];
542
+ const total = lengths[lengths.length - 1];
543
+ if (total < 1e-6)
544
+ return "";
545
+ let [start, end] = Array.isArray(fade) ? fade : [fade, fade];
546
+ if (start + end > total) {
547
+ const share = total / (start + end);
548
+ start *= share;
549
+ end *= share;
550
+ }
551
+ const paint = `var(--anatomy-${tone})`;
552
+ const ramp = (piece, rising) => {
553
+ const d = pathOf(piece);
554
+ const [x1, y1] = piece[0];
555
+ const [x2, y2] = piece[piece.length - 1];
556
+ const id = `iso-fade-${hashOf(`${d}|${tone}|${rising}`)}`;
557
+ const marks = Array.from({ length: stops + 1 }, (_, index) => {
558
+ const t = index / stops;
559
+ const alpha = ease(rising ? t : 1 - t);
560
+ return `<stop offset="${t.toFixed(3)}" stop-opacity="${alpha.toFixed(3)}" style="stop-color:${paint}"/>`;
561
+ }).join("");
562
+ const gradient = `<linearGradient id="${id}" gradientUnits="userSpaceOnUse" x1="${tenth(x1)}" y1="${tenth(y1)}" x2="${tenth(x2)}" y2="${tenth(y2)}">${marks}</linearGradient>`;
563
+ return `<defs>${gradient}</defs><path${attrs({ class: className ? `iso-line ${className}` : "iso-line", "data-tone": tone, "data-free": rising ? "start" : "end", d, style: `stroke:url(#${id})` })}/>`;
564
+ };
565
+ const parts = [];
566
+ if (start > 0.05)
567
+ parts.push(ramp(pieceOf(0, start), true));
568
+ if (total - end - start > 0.05)
569
+ parts.push(lineSvg(pathOf(pieceOf(start, total - end)), { tone, className }));
570
+ if (end > 0.05)
571
+ parts.push(ramp(pieceOf(total - end, total), false));
572
+ return `<g class="iso-fade">${parts.join("")}</g>`;
573
+ }
574
+ function wireSvg(from, to, { via = [], tone = "lo", dotted = false, dashed = false, flow = false, ends = "both", size = 1.2 } = {}) {
575
+ const d = pathOf([from, ...via, to]);
576
+ const end = ([x, y]) => `<circle class="iso-wire-end" cx="${tenth(x)}" cy="${tenth(y)}" r="${size}"/>`;
577
+ return `<g class="iso-wire" data-tone="${tone}">${lineSvg(d, { tone, dotted, dashed, flow })}${ends === "both" || ends === "from" ? end(from) : ""}${ends === "both" || ends === "to" ? end(to) : ""}</g>`;
578
+ }
579
+ function faceTextSvg(transform, text, { size = 3, tone = "mid", anchor = "start" } = {}) {
580
+ return `<text class="iso-face-text" data-tone="${tone}" transform="${transform}" font-size="${size}" text-anchor="${anchor}">${escape(text)}</text>`;
581
+ }
582
+ function groupSvg(children, extra = {}) {
583
+ return `<g${attrs(extra)}>${Array.isArray(children) ? children.join("") : children}</g>`;
584
+ }
585
+ function figureSvg({ width, height, label, body, standalone = false, className }) {
586
+ const style = standalone ? `<style>${ISO_CSS}</style>` : "";
587
+ return `<svg${attrs({
588
+ xmlns: "http://www.w3.org/2000/svg",
589
+ class: `iso-svg${standalone ? " iso" : ""}${className ? ` ${className}` : ""}`,
590
+ "data-theme": standalone || undefined,
591
+ viewBox: `0 0 ${width} ${height}`,
592
+ role: "img",
593
+ "aria-label": label,
594
+ })}>${style}${Array.isArray(body) ? body.join("") : body}</svg>`;
595
+ }
596
+ function swatchSvg(mark) {
597
+ if (mark === "raised" || mark === "flat" || mark === "lit") {
598
+ const body = mark === "flat" ? "M2 6.5 8 3.5 14 6.5 8 9.5Z" : "M2 4.5 8 1.5 14 4.5 14 6 8 9 2 6Z";
599
+ const crease = mark === "flat" ? "" : `<path class="iso-swatch-crease" d="M2 4.5 8 7.5 14 4.5"/>`;
600
+ return `<svg class="iso-swatch" data-mark="${mark}" viewBox="0 0 16 10" aria-hidden="true"><path d="${body}"/>${crease}</svg>`;
601
+ }
602
+ return `<svg class="iso-swatch" data-mark="${mark}" viewBox="0 0 16 10" aria-hidden="true"><path d="M1.5 5h13"/></svg>`;
603
+ }
604
+ function plateHtml({ fig, title, hint, readout = "", keys = [], caption, body }) {
605
+ const corner = (name, text, extra = "") => `<span class="iso-plate-corner" data-corner="${name}"${extra}>${escape(text)}</span>`;
606
+ const legend = keys.length || caption
607
+ ? `<figcaption class="iso-legend">${keys.length ? `<span class="iso-keys">${keys.map((key) => `<span class="iso-key">${swatchSvg(key.mark)}${escape(key.label)}</span>`).join("")}</span>` : ""}${caption ? `<span class="iso-caption">${escape(caption)}</span>` : ""}</figcaption>`
608
+ : "";
609
+ return `<figure class="iso-figure"><div class="iso-plate"><div class="iso-plate-corners" aria-hidden="true">${corner("fig", fig)}${title ? corner("title", title) : ""}${hint ? corner("hint", hint) : ""}${corner("readout", readout, " data-readout")}</div>${body}</div>${legend}</figure>`;
610
+ }
611
+ function pageHtml({ title, theme = "dark", body, script = "", width = 650 }) {
612
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${escape(title)}</title><style>${ISO_CSS}${PAGE_CSS.replace("__WIDTH__", String(width))}</style></head><body class="iso" data-theme="${theme}"><main class="iso-page">${body}</main>${script ? `<script type="module">${script.replace(/<\/(script)/gi, "<\\/$1")}<\/script>` : ""}</body></html>`;
613
+ }
614
+ const PAGE_CSS = `
615
+ *{box-sizing:border-box}
616
+ html{color-scheme:dark}
617
+ body[data-theme="light"]{color-scheme:light}
618
+ body{margin:0;background:var(--anatomy-page);color:var(--anatomy-text);font:14px/1.6 ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;-webkit-font-smoothing:antialiased}
619
+ .iso-page{width:min(__WIDTH__px,100% - 32px);margin:64px auto 96px}
620
+ `;
621
+ const ISO_CSS = `
622
+ .iso{
623
+ --anatomy-page:#0b0b0b;--anatomy-card:#131313;--anatomy-text:#a3a3a3;--anatomy-strong:#e6e6e6;--anatomy-muted:#6e6e6e;
624
+ --anatomy-paper:#131313;--anatomy-face:#1b1b1b;--anatomy-top:#1c1c1c;
625
+ --anatomy-shade-0:#0f0f0f;--anatomy-shade-1:#121212;--anatomy-shade-2:#151515;--anatomy-shade-3:#181818;
626
+ --anatomy-lit-top:#262626;--anatomy-lit-shade:#1d1d1d;
627
+ --anatomy-hi:#d4d4d4;--anatomy-mid:#6a6a6a;--anatomy-lo:#3e3e3e;--anatomy-faint:#2a2a2a;--anatomy-lit:#ffffff;
628
+ --anatomy-halo:#050505;--anatomy-halo-opacity:.9;--anatomy-dot:#e6e6e6;
629
+ --anatomy-red:#ff6b6b;--anatomy-green:#6be0a0;--anatomy-blue:#6b9bff;
630
+ --anatomy-weight:.6px;--anatomy-ease:cubic-bezier(.32,.72,0,1);
631
+ --anatomy-mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
632
+ --anatomy-lift:inset 0 1px 0 0 #ffffff0a,inset 0 0 0 1px #ffffff06,0 0 0 1px #00000026,0 1px 1px -.5px #00000014,0 3px 3px -1.5px #00000014,0 6px 6px -3px #00000014,0 12px 12px -6px #00000014;
633
+ }
634
+ .iso[data-theme="light"]{
635
+ --anatomy-page:#f2f2ef;--anatomy-card:#fbfbfa;--anatomy-text:#57575a;--anatomy-strong:#18181a;--anatomy-muted:#8c8c90;
636
+ --anatomy-paper:#fbfbfa;--anatomy-face:#ffffff;--anatomy-top:#ffffff;
637
+ --anatomy-shade-0:#dcdcd9;--anatomy-shade-1:#e5e5e2;--anatomy-shade-2:#ededea;--anatomy-shade-3:#f4f4f1;
638
+ --anatomy-lit-top:#ffffff;--anatomy-lit-shade:#eeeeeb;
639
+ --anatomy-hi:#26262a;--anatomy-mid:#8a8a8f;--anatomy-lo:#b4b4b8;--anatomy-faint:#d4d4d6;--anatomy-lit:#000000;
640
+ --anatomy-halo:#8a8a80;--anatomy-halo-opacity:.32;--anatomy-dot:#3a3a3e;
641
+ --anatomy-red:#e5484d;--anatomy-green:#30a46c;--anatomy-blue:#3e63dd;
642
+ --anatomy-lift:inset 0 1px 0 0 #ffffff,0 0 0 1px #0000000f,0 1px 1px -.5px #0000000a,0 3px 3px -1.5px #0000000a,0 6px 6px -3px #0000000a,0 12px 12px -6px #0000000a;
643
+ }
644
+ .iso-svg{display:block;width:100%;height:auto;overflow:visible}
645
+ .iso-svg path,.iso-svg circle{vector-effect:non-scaling-stroke}
646
+ .iso-fill{fill:var(--anatomy-paper);stroke:none}
647
+ .iso-solid[data-lit]>.iso-fill{fill:var(--anatomy-face)}
648
+ .iso-shade,.iso-top{stroke:none}
649
+ .iso-shade[data-shade="0"]{fill:var(--anatomy-shade-0)}
650
+ .iso-shade[data-shade="1"]{fill:var(--anatomy-shade-1)}
651
+ .iso-shade[data-shade="2"]{fill:var(--anatomy-shade-2)}
652
+ .iso-shade[data-shade="3"]{fill:var(--anatomy-shade-3)}
653
+ .iso-top{fill:var(--anatomy-top)}
654
+ .iso-solid[data-lit]>.iso-top{fill:var(--anatomy-lit-top)}
655
+ .iso-solid[data-lit]>.iso-shade{fill:var(--anatomy-lit-shade)}
656
+ .iso-solid[data-seamless]>.iso-shade,.iso-solid[data-seamless]>.iso-top{stroke-width:.4;stroke-linejoin:round}
657
+ .iso-solid[data-seamless]>.iso-shade[data-shade="0"]{stroke:var(--anatomy-shade-0)}
658
+ .iso-solid[data-seamless]>.iso-shade[data-shade="1"]{stroke:var(--anatomy-shade-1)}
659
+ .iso-solid[data-seamless]>.iso-shade[data-shade="2"]{stroke:var(--anatomy-shade-2)}
660
+ .iso-solid[data-seamless]>.iso-shade[data-shade="3"]{stroke:var(--anatomy-shade-3)}
661
+ .iso-solid[data-seamless]>.iso-top{stroke:var(--anatomy-top)}
662
+ .iso-solid[data-seamless][data-lit]>.iso-top{stroke:var(--anatomy-lit-top)}
663
+ .iso-solid[data-seamless][data-lit]>.iso-shade{stroke:var(--anatomy-lit-shade)}
664
+ .iso-solid[data-lit]>.iso-edge{stroke:var(--anatomy-lit)}
665
+ .iso-halo{fill:var(--anatomy-halo);stroke:none;filter:blur(9px);opacity:var(--anatomy-halo-opacity);transform:translateY(3px)}
666
+ .iso-line{fill:none;stroke:var(--anatomy-lo);stroke-width:var(--anatomy-weight);stroke-linecap:round;stroke-linejoin:round}
667
+ .iso-line[data-tone="hi"]{stroke:var(--anatomy-hi)}
668
+ .iso-line[data-tone="mid"]{stroke:var(--anatomy-mid)}
669
+ .iso-line[data-tone="lo"]{stroke:var(--anatomy-lo)}
670
+ .iso-line[data-tone="faint"]{stroke:var(--anatomy-faint)}
671
+ .iso-line[data-tone="lit"]{stroke:var(--anatomy-lit)}
672
+ .iso-line[data-tone="red"]{stroke:var(--anatomy-red)}
673
+ .iso-line[data-tone="green"]{stroke:var(--anatomy-green)}
674
+ .iso-line[data-tone="blue"]{stroke:var(--anatomy-blue)}
675
+ .iso-line[data-dotted]{stroke-dasharray:.01 3.5;stroke-width:1}
676
+ .iso-line[data-dashed]{stroke-dasharray:3 3}
677
+ .iso-line[data-flow]{stroke-dasharray:2 6}
678
+ .iso-wire-end{fill:var(--anatomy-paper);stroke:var(--anatomy-lo);stroke-width:var(--anatomy-weight)}
679
+ .iso-wire[data-tone="hi"] .iso-wire-end{stroke:var(--anatomy-hi)}
680
+ .iso-wire[data-tone="mid"] .iso-wire-end{stroke:var(--anatomy-mid)}
681
+ .iso-wire[data-tone="faint"] .iso-wire-end{stroke:var(--anatomy-faint)}
682
+ .iso-wire[data-tone="lit"] .iso-wire-end{stroke:var(--anatomy-lit)}
683
+ .iso-dots circle{fill:var(--anatomy-dot);stroke:none;opacity:.32}
684
+ .iso-dots[data-tone="hi"] circle{opacity:.85}
685
+ .iso-dots[data-tone="mid"] circle{opacity:.45}
686
+ .iso-dots[data-tone="lo"] circle{opacity:.22}
687
+ .iso-dots[data-tone="faint"] circle{opacity:.12}
688
+ .iso-face-text{fill:var(--anatomy-mid);font-family:var(--anatomy-mono);letter-spacing:.04em}
689
+ .iso-face-text[data-tone="hi"]{fill:var(--anatomy-hi)}
690
+ .iso-face-text[data-tone="lo"]{fill:var(--anatomy-lo)}
691
+ .iso-face-text[data-tone="faint"]{fill:var(--anatomy-faint)}
692
+ .tb-body{fill:var(--anatomy-shade-2);stroke:none}
693
+ .tb-shine{fill:var(--anatomy-top);stroke:none}
694
+ .tb-shade{fill:var(--anatomy-shade-0);stroke:none}
695
+ .tb-ring{fill:none;stroke:var(--anatomy-lo);stroke-width:.45;stroke-linecap:butt;stroke-linejoin:round}
696
+ .tb-ring[data-tone="mid"]{stroke:var(--anatomy-mid)}
697
+ .tb-ring[data-tone="faint"]{stroke:var(--anatomy-faint)}
698
+ .tb-ring[data-tone="hi"]{stroke:var(--anatomy-hi)}
699
+ @keyframes iso-flow{to{stroke-dashoffset:-32}}
700
+ @keyframes iso-pulse{0%,100%{opacity:.18}12%{opacity:1}40%{opacity:.18}}
701
+ .iso-line[data-flow]{animation:iso-flow 1600ms linear infinite}
702
+ .iso-dots circle[data-pulse]{animation:iso-pulse 1600ms steps(1,end) infinite;animation-delay:var(--pulse-at,0ms)}
703
+ .iso-figure{margin:32px 0 36px}
704
+ .iso-plate{position:relative;padding:52px 24px;border-radius:0;background:var(--anatomy-card);box-shadow:0 0 0 1px var(--anatomy-mid);--anatomy-paper:var(--anatomy-card)}
705
+ .iso-plate-corners{position:absolute;inset:18px 20px;pointer-events:none}
706
+ .iso-plate-corner{position:absolute;color:var(--anatomy-muted);font-family:var(--anatomy-mono);font-size:10.5px;line-height:1;letter-spacing:.04em;white-space:nowrap}
707
+ .iso-plate-corner[data-corner="fig"]{top:0;left:0;color:var(--anatomy-text)}
708
+ .iso-plate-corner[data-corner="title"]{top:0;right:0;text-transform:uppercase;letter-spacing:.1em}
709
+ .iso-plate-corner[data-corner="hint"]{bottom:0;left:0;text-transform:uppercase;letter-spacing:.1em}
710
+ .iso-plate-corner[data-corner="readout"]{right:0;bottom:0;color:var(--anatomy-text);font-variant-numeric:tabular-nums}
711
+ .iso-plate .iso-svg{margin:0 auto}
712
+ .iso-legend{display:grid;gap:8px;margin-top:12px;color:var(--anatomy-muted);font-size:13px;line-height:1.55}
713
+ .iso-keys{display:flex;flex-wrap:wrap;gap:6px 18px}
714
+ .iso-key{display:inline-flex;align-items:center;gap:7px}
715
+ .iso-swatch{width:16px;height:10px;flex:none;overflow:visible}
716
+ .iso-swatch path{fill:none;stroke:var(--anatomy-hi);stroke-width:1;vector-effect:non-scaling-stroke;stroke-linejoin:round;stroke-linecap:round}
717
+ .iso-swatch[data-mark="raised"] path,.iso-swatch[data-mark="flat"] path{stroke:var(--anatomy-mid)}
718
+ .iso-swatch[data-mark="lit"] path{stroke:var(--anatomy-lit)}
719
+ .iso-swatch[data-mark="dim"] path{stroke:var(--anatomy-lo)}
720
+ .iso-swatch[data-mark="dotted"] path{stroke-dasharray:.01 3;stroke-width:1.4}
721
+ .iso-swatch[data-mark="dashed"] path{stroke-dasharray:3 2.5}
722
+ .iso-swatch[data-mark="red"] path{stroke:var(--anatomy-red)}
723
+ .iso-swatch[data-mark="green"] path{stroke:var(--anatomy-green)}
724
+ .iso-swatch[data-mark="blue"] path{stroke:var(--anatomy-blue)}
725
+ .iso-swatch-crease{stroke:var(--anatomy-lo)!important}
726
+ @media (max-width:560px){.iso-plate{padding:48px 12px 70px}.iso-plate-corner[data-corner="hint"]{bottom:18px}}
727
+ @media (prefers-reduced-motion:reduce){.iso-line[data-flow],.iso-dots circle[data-pulse]{animation:none}}
728
+ `;
729
+
730
+ // iso-explainer · looks-core.js
731
+ // "Looks": each block can be drawn as a small physical object whose working IS what the
732
+ // component does (a boom gate for a gateway, a conveyor for a queue…), in the anatomy style:
733
+ // many small precise solids, four-tone faces, painter's order, lines that end on something,
734
+ // exactly one lit part, calm motion driven by the scene (packets, cpu, failures).
735
+ // Geometry comes from the vendored anatomy kit (kit.js); colours are emitted as hex so the
736
+ // engine's dark-theme remap (themed) works unchanged.
737
+
738
+
739
+ /* ── camera: kit projection that lands exactly on engine iso() ──
740
+ engine: iso(x,y,z) = [14(x+y), 7(x−y) − z] (grid units, z in px)
741
+ kit: azimuth 45°, elevation 30°, world y flipped, W world units per grid unit. */
742
+ const W = 20;
743
+ const K = 14 / (Math.SQRT1_2 * W);
744
+ const lookP = (origin = [0, 0]) => ({ origin, scale: K / Math.sqrt(1.6), azimuth: 45, elevation: 30 });
745
+ const PX_PER_Z = cameraOf(lookP()).cosE * K; // screen px per world z unit
746
+ const toWorld = (dx, dy, hpx = 0) => [dx * W, -dy * W, hpx / PX_PER_Z]; // engine grid offset → world
747
+
748
+ /* ── tones ── */
749
+ const NEUTRAL = { top: '#fbf7f0', shade: ['#d6cabb', '#e1d7ca', '#ebe3d7', '#f3ede4'] };
750
+ const LINE = { hi: ['#484139', 1], mid: ['#6f6559', 0.85], lo: ['#9a8f81', 0.8], faint: ['#c4b8a7', 0.65] };
751
+ const toneOf = (pal) => (pal ? { top: pal.top[0], shade: [pal.side[1], pal.side[0], pal.top[1], pal.top[0]] } : NEUTRAL);
752
+ const solidTone = (hex) => ({ top: hex, shade: [hex, hex, hex, hex] });
753
+
754
+ /* ── painters ── */
755
+ function solid(p, tone = NEUTRAL, { line = 'hi', crease = 'faint', inner = '', flat = false } = {}) {
756
+ const [lc, lw] = LINE[line], [cc, cw] = LINE[crease] || []; // crease "none" draws no inner lines
757
+ let s = `<path d="${p.fill}" fill="${tone.shade[1]}"/>`;
758
+ if (!flat) {
759
+ p.shades.forEach((d, i) => { if (d) s += `<path d="${d}" fill="${tone.shade[i]}"/>`; });
760
+ s += `<path d="${p.top}" fill="${tone.top}"/>`;
761
+ }
762
+ if (cc && p.crease) s += `<path d="${p.crease}" fill="none" stroke="${cc}" stroke-width="${cw}" stroke-linecap="round"/>`;
763
+ if (cc && p.bevel) s += `<path d="${p.bevel}" fill="none" stroke="${cc}" stroke-width="${cw}" stroke-linecap="round"/>`;
764
+ return `${s}${inner}<path d="${p.outline}" fill="none" stroke="${lc}" stroke-width="${lw}" stroke-linejoin="round" stroke-linecap="round"/>`;
765
+ }
766
+ const line = (d, tone = 'mid', w) => (d ? `<path d="${d}" fill="none" stroke="${LINE[tone][0]}" stroke-width="${w ?? LINE[tone][1]}" stroke-linecap="round" stroke-linejoin="round"/>` : '');
767
+ const fillPath = (d, fill, tone = 'hi') => `<path d="${d}" fill="${fill}" stroke="${LINE[tone][0]}" stroke-width="${LINE[tone][1]}" stroke-linejoin="round"/>`;
768
+ const dots = (pts, r = 0.9, fill = LINE.hi[0]) => pts.map(([x, y]) => `<circle cx="${x.toFixed(1)}" cy="${y.toFixed(1)}" r="${r}" fill="${fill}"/>`).join('');
769
+ const screw = (P, x, y, z) => { const [[sx, sy]] = pointsAt([[x, y, z]], P); return `<circle cx="${sx.toFixed(1)}" cy="${sy.toFixed(1)}" r="1.25" fill="none" stroke="${LINE.lo[0]}" stroke-width=".55"/><circle cx="${sx.toFixed(1)}" cy="${sy.toFixed(1)}" r=".55" fill="${LINE.hi[0]}"/>`; };
770
+
771
+ const sub = (a, b) => [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
772
+ const add = (a, b) => [a[0] + b[0], a[1] + b[1], a[2] + b[2]];
773
+ const mul = (a, k) => [a[0] * k, a[1] * k, a[2] * k];
774
+ const cross3 = (a, b) => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
775
+ const norm = (a) => { const l = Math.hypot(...a) || 1; return mul(a, 1 / l); };
776
+ function hull(pts) {
777
+ const s = [...pts].sort((a, b) => a[0] - b[0] || a[1] - b[1]);
778
+ const c = (o, a, b) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
779
+ const lo = [], up = [];
780
+ for (const p of s) { while (lo.length >= 2 && c(lo[lo.length - 2], lo[lo.length - 1], p) <= 0) lo.pop(); lo.push(p); }
781
+ for (let i = s.length - 1; i >= 0; i--) { const p = s[i]; while (up.length >= 2 && c(up[up.length - 2], up[up.length - 1], p) <= 0) up.pop(); up.push(p); }
782
+ return [...lo.slice(0, -1), ...up.slice(0, -1)];
783
+ }
784
+ // A box along any direction: from a to b, `wide` across `side`, `thick` across the other normal.
785
+ // Used for parts that tilt or rotate (boom arms, levers, press rams).
786
+ function beam(a, b, side, wide, thick, P, tone = NEUTRAL, { line: ln = 'hi' } = {}) {
787
+ const d = norm(sub(b, a)), u = norm(side), n = norm(cross3(d, u));
788
+ const C = [];
789
+ for (const p of [a, b]) for (const su of [-1, 1]) for (const sn of [-1, 1]) C.push(add(add(p, mul(u, su * wide / 2)), mul(n, sn * thick / 2)));
790
+ const idx = (pa, su, sn) => pa * 4 + (su > 0 ? 2 : 0) + (sn > 0 ? 1 : 0);
791
+ const faces = [
792
+ { n: mul(d, -1), q: [idx(0, -1, -1), idx(0, 1, -1), idx(0, 1, 1), idx(0, -1, 1)] },
793
+ { n: d, q: [idx(1, -1, -1), idx(1, -1, 1), idx(1, 1, 1), idx(1, 1, -1)] },
794
+ { n: u, q: [idx(0, 1, -1), idx(1, 1, -1), idx(1, 1, 1), idx(0, 1, 1)] },
795
+ { n: mul(u, -1), q: [idx(0, -1, -1), idx(0, -1, 1), idx(1, -1, 1), idx(1, -1, -1)] },
796
+ { n, q: [idx(0, -1, 1), idx(0, 1, 1), idx(1, 1, 1), idx(1, -1, 1)] },
797
+ { n: mul(n, -1), q: [idx(0, -1, -1), idx(1, -1, -1), idx(1, 1, -1), idx(0, 1, -1)] },
798
+ ];
799
+ const S = pointsAt(C, P), { sinA, cosA } = cameraOf(P);
800
+ let out = '';
801
+ for (const f of faces) {
802
+ if (depthOf(f.n, P) <= 1e-6) continue;
803
+ const up = f.n[2] > 0.7, lit = (f.n[0] * -sinA + -f.n[1] * cosA + 1) / 2; // y is flipped in the plan light
804
+ const fill = up ? tone.top : tone.shade[Math.min(3, Math.max(0, Math.floor(lit * 4)))];
805
+ out += `<path d="${pathOf(f.q.map((i) => S[i]), true)}" fill="${fill}" stroke="${LINE.faint[0]}" stroke-width=".5" stroke-linejoin="round"/>`;
806
+ }
807
+ return out + `<path d="${pathOf(hull(S), true)}" fill="none" stroke="${LINE[ln][0]}" stroke-width="${LINE[ln][1]}" stroke-linejoin="round"/>`;
808
+ }
809
+
810
+ /* ── shared parts ── */
811
+ // The plinth: the entity's colour, a groove, corner screws. Every look stands on one.
812
+ function plinth(P, hx, hy, z, tone) {
813
+ const plan = { x: -hx, y: -hy, w: hx * 2, d: hy * 2, r: Math.min(9, hx * 0.22) };
814
+ const s = slabOf(plan, 0, z, P, 8, 1.2);
815
+ let out = solid(s, tone, { crease: 'lo' }) + line(planOutline(insetPlan(plan, 4.5), z, P), 'lo', 0.7);
816
+ for (const [x, y] of corners(plan, 7.5)) out += screw(P, x, y, z);
817
+ return out;
818
+ }
819
+ const env = (hx, hy, top) => ({ hx, hy, top }); // envelope: half sizes + top z (world units)
820
+
821
+
822
+ // The usual start of a look: half sizes, a scale u (the catalogue is drawn for a ±40 footprint),
823
+ // the plinth top z0, point/plan helpers, and the plinth itself.
824
+ function rig(e, P, pal, plinthZ = 6) {
825
+ const d = e.d ?? e.s ?? (e.r ?? 2) * 2, w = e.w ?? e.s ?? (e.r ?? 2) * 2;
826
+ const hx = (d * W) / 2, hy = (w * W) / 2, u = Math.min(hx, hy) / 40, z0 = plinthZ * u;
827
+ return {
828
+ hx, hy, u, z0,
829
+ at: (x, y, z) => [x * u, y * u, z0 + z * u],
830
+ pl: (x, y, w2, d2, r = 1) => ({ x: x * u, y: y * u, w: w2 * u, d: d2 * u, r: r * u }),
831
+ base: plinth(P, hx, hy, z0, toneOf(pal)),
832
+ };
833
+ }
834
+ // Polygons drawn in a vertical plane: y = const (the front-left face) or x = const (the front-right face).
835
+ // pts are [a, z] pairs: a runs along x (for planeY) or y (for planeX).
836
+ const planeY = (y, pts, P, closed = true) => pathOf(pointsAt(pts.map(([x, z]) => [x, y, z]), P), closed);
837
+ const planeX = (x, pts, P, closed = true) => pathOf(pointsAt(pts.map(([y, z]) => [x, y, z]), P), closed);
838
+ // A spur gear outline (2D, around [ca, cz]) with `teeth`, turned by `rot` radians.
839
+ function gear(ca, cz, r, teeth, rot = 0) {
840
+ const pts = [], n = teeth * 4;
841
+ for (let i = 0; i < n; i++) {
842
+ const a = rot + (i / n) * Math.PI * 2, rr = (i % 4 < 2 ? r : r * 0.8);
843
+ pts.push([ca + Math.cos(a) * rr, cz + Math.sin(a) * rr]);
844
+ }
845
+ return pts;
846
+ }
847
+ const circle2 = (ca, cz, r, steps = 24) => Array.from({ length: steps }, (_, i) => [ca + Math.cos((i / steps) * Math.PI * 2) * r, cz + Math.sin((i / steps) * Math.PI * 2) * r]);
848
+
849
+ // A stroke in any colour (screens, hands), and a glass body (outline + faint fill).
850
+ // Colour rule (same as the stage): lowercase hex follows the theme; UPPERCASE hex never changes, so
851
+ // intrinsically dark materials (rubber, chip packages, openings, screens) stay dark in the dark theme.
852
+ const stroke = (d, color, w = 1) => (d ? `<path d="${d}" fill="none" stroke="${color}" stroke-width="${w}" stroke-linecap="round" stroke-linejoin="round"/>` : '');
853
+ const glass = (p) => `<path d="${p.fill}" fill="#ffffff" opacity=".28"/>` + line(p.crease, 'faint') + line(p.outline, 'hi');
854
+
855
+ /* Dark theme: every lowercase hex in generated SVG is remapped in HSL.
856
+ - near-neutral warm colours invert lightness (paper → charcoal, ink → cream)
857
+ - light pastels become deep, low-saturation tones
858
+ - mid tones stay, dark tones become light.
859
+ UPPERCASE hex is never remapped (use it for colours that must stay fixed). */
860
+ const hexToHsl = (hex) => {
861
+ const n = parseInt(hex.length === 4 ? hex.slice(1).replace(/./g, '$&$&') : hex.slice(1), 16);
862
+ const r = ((n >> 16) & 255) / 255, g = ((n >> 8) & 255) / 255, b = (n & 255) / 255;
863
+ const max = Math.max(r, g, b), min = Math.min(r, g, b), c = max - min, l = (max + min) / 2;
864
+ let h = 0;
865
+ if (c) {
866
+ h = max === r ? ((g - b) / c) % 6 : max === g ? (b - r) / c + 2 : (r - g) / c + 4;
867
+ h *= 60; if (h < 0) h += 360;
868
+ }
869
+ const s = c ? c / (1 - Math.abs(2 * l - 1)) : 0;
870
+ return { h, s, l, c };
871
+ };
872
+ const hslToHex = (h, s, l) => {
873
+ const c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(((h / 60) % 2) - 1)), m = l - c / 2;
874
+ const [r, g, b] = h < 60 ? [c, x, 0] : h < 120 ? [x, c, 0] : h < 180 ? [0, c, x] : h < 240 ? [0, x, c] : h < 300 ? [x, 0, c] : [c, 0, x];
875
+ const t = (v) => Math.round(Math.max(0, Math.min(1, v + m)) * 255).toString(16).padStart(2, '0');
876
+ return `#${t(r)}${t(g)}${t(b)}`;
877
+ };
878
+ const darkCache = new Map();
879
+ function darkHex(hex) {
880
+ if (darkCache.has(hex)) return darkCache.get(hex);
881
+ const { h, s, l, c } = hexToHsl(hex);
882
+ let out;
883
+ if (c < 0.05 || (c < 0.14 && h >= 10 && h <= 64)) {
884
+ const L = l >= 0.88 ? 0.11 + (l - 0.9) * 0.9 : 1 - l;
885
+ out = hslToHex(c < 0.02 ? 34 : h, 0.12, Math.max(0.06, Math.min(0.93, L)));
886
+ } else if (l >= 0.66) out = hslToHex(h, Math.min(s, 0.5) * 0.62, 0.17 + (l - 0.66) * 0.55);
887
+ else if (l >= 0.36) out = hex;
888
+ else out = hslToHex(h, Math.min(s, 0.6), 0.8);
889
+ darkCache.set(hex, out);
890
+ return out;
891
+ }
892
+
893
+ const P = {"origin":[320,248.56051348056337],"scale":1.1698485915090833,"azimuth":45,"elevation":30};
894
+
895
+ const $ = (s) => document.querySelector(s);
896
+ const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;
897
+ const isDarkNow = () => document.documentElement.dataset.theme === 'dark';
898
+ const themed = (s) => (isDarkNow() ? String(s).replace(/#[0-9a-f]{6}\b|#[0-9a-f]{3}\b/g, darkHex) : s);
899
+ const ART = $('#art'), ART_LIGHT = ART.innerHTML, LIVE = {}, themeCbs = [];
900
+ const put = (id, svg) => { LIVE[id] = svg; const n = document.getElementById(id); if (n) n.innerHTML = themed(svg); };
901
+ const readout = (t) => { $('#readout').textContent = t; $('#stage').setAttribute('aria-valuetext', t); };
902
+ const onTheme = (f) => themeCbs.push(f);
903
+ function retheme() { ART.innerHTML = themed(ART_LIGHT); for (const id in LIVE) put(id, LIVE[id]); themeCbs.forEach((f) => f()); }
904
+ new MutationObserver(retheme).observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] });
905
+ let visible = true;
906
+ new IntersectionObserver(([e]) => { visible = e.isIntersecting; }).observe($('#stage'));
907
+ // loop(fn): fn(dt, t) every frame while visible; once (dt = 0) under reduced motion.
908
+ function loop(fn) {
909
+ if (reduced) { fn(0, 0); return; }
910
+ let last = performance.now(), t = 0;
911
+ const tick = (now) => { const dt = Math.min(0.05, (now - last) / 1000); last = now; if (visible && !document.hidden) { t += dt; fn(dt, t); } requestAnimationFrame(tick); };
912
+ requestAnimationFrame(tick);
913
+ }
914
+ if (isDarkNow()) retheme();
915
+
916
+
917
+ const TUBE = [0,-30], CAP = 10, COIN = 4.4, Z0 = 10;
918
+ const AMBER = {"top":"#fee7b8","shade":["#f0bf6a","#f4cb80","#f8d796","#fbe1ac"]};
919
+ const S = { tokens: CAP, refill: 0, ok: 0, no: 0, spawn: 0, balls: [], drops: [], flies: [], gate: 0, gateTo: 0 };
920
+ const ctl = (id) => +$('#' + id).value;
921
+ for (const id of ['rate', 'rps']) $('#' + id).addEventListener('input', () => { $('#' + id + '-v').textContent = $('#' + id).value + '/s'; });
922
+ const ball = (x, y, z, fill, r = 5.2) => { const [[sx, sy]] = pointsAt([[x, y, z]], P); return '<circle cx="' + sx.toFixed(1) + '" cy="' + (sy - r * 0.3).toFixed(1) + '" r="' + r + '" fill="' + fill + '" stroke="#211e1b" stroke-width="1.2"/>'; };
923
+ function draw() {
924
+ let coins = '';
925
+ const n = Math.floor(S.tokens);
926
+ for (let i = 0; i < n; i++) coins += solid(cylinder(TUBE[0], TUBE[1], 8.4, Z0 + 6.4 + i * COIN, COIN - 0.7, P, 28, 0.4), AMBER, { crease: 'lo' });
927
+ put('coins', coins);
928
+ put('drop', S.drops.map((d) => solid(cylinder(TUBE[0], TUBE[1], 6, d.z, 2.2, P, 20), AMBER, { crease: 'lo' })).join(''));
929
+ put('traffic', S.balls.filter((b) => !b.rej).map((b) => ball(b.x, 0, Z0 + 8, b.ok ? '#9fd08f' : '#f3b47f')).join('') + S.flies.map((f) => '<g opacity="' + (1 - f.t).toFixed(2) + '">' + solid(cylinder(f.x, f.y, 4, f.z, 1.6, P, 16), AMBER, { crease: 'lo' }) + '</g>').join(''));
930
+ put('rejects', S.balls.filter((b) => b.rej).map((b) => '<g opacity="' + Math.min(1, b.life).toFixed(2) + '">' + ball(b.x, b.y, b.z, '#ec7a6f') + '</g>').join(''));
931
+ let arms = '';
932
+ for (let k = 0; k < 3; k++) { const a = S.gate + k * 2.0944; arms += beam([0, 22, Z0 + 23], [Math.cos(a) * 15, 22 + Math.sin(a) * 15, Z0 + 23], [0, 0, 1], 2.4, 2.4, P, NEUTRAL); }
933
+ put('gate', arms + solid(cylinder(0, 22, 4.2, Z0 + 21, 5, P, 18), AMBER, { crease: 'lo' }));
934
+ readout('fichas ' + n + '/' + CAP + ' · aceitas ' + S.ok + ' · 429 ' + S.no);
935
+ }
936
+ loop((dt) => {
937
+ const rate = ctl('rate'), rps = ctl('rps');
938
+ // refill: one coin leaves the nozzle every 1/rate s while the tube has room
939
+ S.refill += dt * rate;
940
+ while (S.refill >= 1) { S.refill -= 1; if (S.tokens + S.drops.length < CAP) S.drops.push({ z: Z0 + 72 }); }
941
+ for (const d of S.drops) d.z -= dt * 120;
942
+ S.drops = S.drops.filter((d) => { if (d.z <= Z0 + 6.4 + Math.floor(S.tokens) * COIN) { S.tokens = Math.min(CAP, Math.floor(S.tokens) + 1); return false; } return true; });
943
+ // traffic: requests roll in from the left; at the turnstile each one spends a coin or is turned aside
944
+ S.spawn += dt * rps;
945
+ while (S.spawn >= 1) { S.spawn -= 1; S.balls.push({ x: -112, y: 0, z: Z0 + 8, ok: false, rej: false, life: 1 }); }
946
+ for (const b of S.balls) {
947
+ if (b.rej) { b.y = Math.min(40, b.y + dt * 60); b.x = Math.min(24, b.x + dt * 25); if (b.y >= 40) { b.z = Math.max(Z0 + 6, b.z - dt * 30); b.life -= dt * 0.7; } continue; }
948
+ const before = b.x; b.x += dt * 80;
949
+ if (before < 0 && b.x >= 0) {
950
+ if (S.tokens >= 1) { S.tokens -= 1; b.ok = true; S.ok++; S.gateTo += 2.0944; S.flies.push({ x: TUBE[0], y: TUBE[1], z: Z0 + 8, t: 0 }); }
951
+ else { b.rej = true; S.no++; }
952
+ }
953
+ }
954
+ S.balls = S.balls.filter((b) => b.x < 98 && b.life > 0);
955
+ for (const f of S.flies) { f.t += dt * 2.2; f.y = TUBE[1] + (0 - TUBE[1]) * f.t; f.z = Z0 + 8 + Math.sin(f.t * Math.PI) * 16; }
956
+ S.flies = S.flies.filter((f) => f.t < 1);
957
+ S.gate += (S.gateTo - S.gate) * (1 - Math.exp(-10 * dt));
958
+ draw();
959
+ });
960
+ draw();
961
+
962
+ })();</script></body></html>