agentic-mermaid 0.5.4 → 0.5.6

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 (133) hide show
  1. package/AGENT_NATIVE.md +5 -9
  2. package/CHANGELOG.md +66 -0
  3. package/Instructions_for_agents.md +171 -97
  4. package/README.md +1 -1
  5. package/dist/agent-core.d.ts +7 -7
  6. package/dist/agent-core.js +1 -1
  7. package/dist/agent.d.ts +9 -10
  8. package/dist/agent.js +1 -1
  9. package/dist/agentic-mermaid-mcp.js +1 -1
  10. package/dist/am.js +1 -1
  11. package/dist/browser-lazy/chunks/{agentic-producer-core-ECZ3CMZM.js → agentic-producer-core-MYYZCUJS.js} +1 -1
  12. package/dist/browser-lazy/chunks/{architecture-H5LTMKQW.js → architecture-OHEIJI33.js} +6 -6
  13. package/dist/browser-lazy/chunks/{block-566X6FNV.js → block-DMBSQUFZ.js} +6 -6
  14. package/dist/browser-lazy/chunks/{builtin-backends-VAFEZXKY.js → builtin-backends-JTN3XG37.js} +3 -3
  15. package/dist/browser-lazy/chunks/{c4-ZXFDLBFK.js → c4-TK5GVVGU.js} +3 -3
  16. package/dist/browser-lazy/chunks/{chunk-7UFOFWBA.js → chunk-2R6M4CUH.js} +1 -1
  17. package/dist/browser-lazy/chunks/{chunk-YVNJDVQO.js → chunk-3K25OV6X.js} +1 -1
  18. package/dist/browser-lazy/chunks/{chunk-QVSZOF5M.js → chunk-3QXHJBE3.js} +1 -1
  19. package/dist/browser-lazy/chunks/{chunk-IUI4DYC3.js → chunk-4G652M75.js} +1 -1
  20. package/dist/browser-lazy/chunks/{chunk-LBXXKLIR.js → chunk-4WON4RCG.js} +3 -3
  21. package/dist/browser-lazy/chunks/{chunk-V6I2VGNQ.js → chunk-5SZ2YBKG.js} +9 -9
  22. package/dist/browser-lazy/chunks/{chunk-XHU3A432.js → chunk-CJZMMNPO.js} +1 -1
  23. package/dist/browser-lazy/chunks/{chunk-5LKPDHPC.js → chunk-F4CQMYR2.js} +4 -4
  24. package/dist/browser-lazy/chunks/{chunk-G4JBA7HU.js → chunk-GK5PSUKH.js} +3 -3
  25. package/dist/browser-lazy/chunks/{chunk-VRZKI33U.js → chunk-HAMXYU5V.js} +1 -1
  26. package/dist/browser-lazy/chunks/{chunk-Z7UHFVKN.js → chunk-IFUYPCDA.js} +6 -6
  27. package/dist/browser-lazy/chunks/{chunk-3JTYTXA6.js → chunk-ILCWDEZN.js} +4 -4
  28. package/dist/browser-lazy/chunks/{chunk-64JFHCJC.js → chunk-JJFXEH35.js} +1 -1
  29. package/dist/browser-lazy/chunks/{chunk-PXTLV57R.js → chunk-KOO3MCMJ.js} +1 -1
  30. package/dist/browser-lazy/chunks/{chunk-A7V5VDKN.js → chunk-LO25KEJY.js} +1 -1
  31. package/dist/browser-lazy/chunks/{chunk-TT5GR5EJ.js → chunk-MGB5QQEH.js} +1 -1
  32. package/dist/browser-lazy/chunks/{chunk-PSZEE64O.js → chunk-NVZKY7UI.js} +8 -8
  33. package/dist/browser-lazy/chunks/{chunk-6UOOATQR.js → chunk-PA7YKMP5.js} +1 -1
  34. package/dist/browser-lazy/chunks/{chunk-NKW2ZNCD.js → chunk-PS4HSV54.js} +1 -1
  35. package/dist/browser-lazy/chunks/{chunk-OBI5U5XU.js → chunk-QG67RIGQ.js} +1 -1
  36. package/dist/browser-lazy/chunks/{chunk-J57YRC2M.js → chunk-QOIFBX26.js} +1 -1
  37. package/dist/browser-lazy/chunks/chunk-QQCKPJF3.js +1 -0
  38. package/dist/browser-lazy/chunks/{chunk-O34YYEQV.js → chunk-QXSPMZ67.js} +1 -1
  39. package/dist/browser-lazy/chunks/{chunk-4NILRBC7.js → chunk-QYORAVMZ.js} +1 -1
  40. package/dist/browser-lazy/chunks/{chunk-OFOS57WQ.js → chunk-SC7LXD2V.js} +1 -1
  41. package/dist/browser-lazy/chunks/{chunk-EIYLJ4FI.js → chunk-SZAI2WB4.js} +12 -12
  42. package/dist/browser-lazy/chunks/{chunk-37FZNMPR.js → chunk-TXYQEDUF.js} +1 -1
  43. package/dist/browser-lazy/chunks/{chunk-2JQXRKBC.js → chunk-VR6YRNUZ.js} +1 -1
  44. package/dist/browser-lazy/chunks/{chunk-7TTFBJYA.js → chunk-WNTLLJPT.js} +1 -1
  45. package/dist/browser-lazy/chunks/{chunk-62MR3LWJ.js → chunk-YYF5TS6K.js} +1 -1
  46. package/dist/browser-lazy/chunks/{class-XIFNVBFE.js → class-QOJOM2XO.js} +8 -8
  47. package/dist/browser-lazy/chunks/{er-VEUYJBGG.js → er-2W6UXQT7.js} +6 -6
  48. package/dist/browser-lazy/chunks/{eventmodeling-G7DITZX7.js → eventmodeling-IVAFIO2U.js} +9 -9
  49. package/dist/browser-lazy/chunks/{flowchart-SSFIU4EU.js → flowchart-Y6OWQ46O.js} +1 -1
  50. package/dist/browser-lazy/chunks/{gantt-HQNVDX2B.js → gantt-BXTFJPZM.js} +6 -6
  51. package/dist/browser-lazy/chunks/{gitgraph-Z5MN6M6L.js → gitgraph-PW6R75SQ.js} +4 -4
  52. package/dist/browser-lazy/chunks/{ishikawa-UEERNFQV.js → ishikawa-GFX3XQQZ.js} +2 -2
  53. package/dist/browser-lazy/chunks/{journey-3BEWWGB5.js → journey-Q3M2GVKJ.js} +7 -7
  54. package/dist/browser-lazy/chunks/{kanban-2WFNCWLB.js → kanban-WVGVXROE.js} +11 -11
  55. package/dist/browser-lazy/chunks/{mindmap-R2C6SNYR.js → mindmap-CEDNSFJ6.js} +6 -6
  56. package/dist/browser-lazy/chunks/{packet-GMVCI5YZ.js → packet-Z56OVP2O.js} +3 -3
  57. package/dist/browser-lazy/chunks/{pie-WER45DKC.js → pie-FOJURIAM.js} +7 -7
  58. package/dist/browser-lazy/chunks/{quadrant-NCUPSFKN.js → quadrant-OGUQEK5C.js} +4 -4
  59. package/dist/browser-lazy/chunks/{radar-WLYS4YC5.js → radar-XTAUIQIJ.js} +9 -9
  60. package/dist/browser-lazy/chunks/render-core-QRFSDWGQ.js +3 -0
  61. package/dist/browser-lazy/chunks/{requirement-AK3NWMJ6.js → requirement-KEJ7ILX2.js} +7 -7
  62. package/dist/browser-lazy/chunks/{sankey-C2DY6WVU.js → sankey-ODWGDRAM.js} +8 -8
  63. package/dist/browser-lazy/chunks/{sequence-D4WJB44W.js → sequence-4ZNQR7S7.js} +1 -1
  64. package/dist/browser-lazy/chunks/{state-YUQVESE7.js → state-6IWPVJ4C.js} +2 -2
  65. package/dist/browser-lazy/chunks/{timeline-BMBJJXWR.js → timeline-LPJMPVPV.js} +4 -4
  66. package/dist/browser-lazy/chunks/{treemap-B66XBZZ6.js → treemap-2KFOQZRA.js} +4 -4
  67. package/dist/browser-lazy/chunks/xychart-KIPWFNVQ.js +16 -0
  68. package/dist/browser-lazy/chunks/{zenuml-62RLYFWP.js → zenuml-2ABFLOUP.js} +6 -6
  69. package/dist/browser-lazy/index.js +1 -1
  70. package/dist/browser.global.js +436 -436
  71. package/dist/chunk-3QC3FE2X.js +4 -0
  72. package/dist/{chunk-XU5LPD2D.js → chunk-5BYN55G4.js} +1 -1
  73. package/dist/chunk-5XKELJT2.js +2 -0
  74. package/dist/chunk-7HIKKNPP.js +150 -0
  75. package/dist/chunk-A5TX2FW5.js +2 -0
  76. package/dist/chunk-AS6A6XHE.js +2 -0
  77. package/dist/{chunk-DOFB572I.js → chunk-CGCGMO4U.js} +15 -15
  78. package/dist/chunk-GO4CS5KS.js +52 -0
  79. package/dist/{chunk-KXMANAST.js → chunk-JRLCGATA.js} +47 -47
  80. package/dist/{chunk-7XYB2LNC.js → chunk-K6TYUPTW.js} +2 -2
  81. package/dist/{chunk-HINRNKPO.js → chunk-QVP364DJ.js} +2 -2
  82. package/dist/chunk-V5RFODN6.js +2 -0
  83. package/dist/cli-PVKOWT4V.js +191 -0
  84. package/dist/elk-constructor.js +1 -1
  85. package/dist/{index-Bvhprdxz.d.ts → index-Bs7imZCS.d.ts} +14 -4
  86. package/dist/index.d.ts +4 -4
  87. package/dist/index.js +1 -1
  88. package/dist/{jsonl-RPJY6YWO.js → jsonl-5N4DTV7P.js} +2 -2
  89. package/dist/mcp-cli-EPIA7DTH.js +2 -0
  90. package/dist/{paint-certification-BoLyr006.d.ts → paint-certification-aIPtFDcn.d.ts} +2 -2
  91. package/dist/server-X6OFY2ZN.js +527 -0
  92. package/dist/{svg-styles-BnCoXyYe.d.ts → svg-styles-DfHloZTH.d.ts} +1 -1
  93. package/dist/svg-styles.d.ts +1 -1
  94. package/dist/svg-styles.js +1 -1
  95. package/dist/svg.d.ts +4 -4
  96. package/dist/svg.js +1 -1
  97. package/dist/{types-CLVJCaH2.d.ts → types-DkUbM48-.d.ts} +1 -1
  98. package/dist/zenuml/chunks/{appearance-5RM5MVM2.js → appearance-ROFRJDW7.js} +1 -1
  99. package/dist/zenuml/chunks/{builtin-backends-UTNWL4N3.js → builtin-backends-LM2A6WWK.js} +2 -2
  100. package/dist/zenuml/chunks/{chunk-ZNZRIISS.js → chunk-E6ZQYSVJ.js} +2 -2
  101. package/dist/zenuml/chunks/{chunk-IARQ24W3.js → chunk-KCHXQ5UA.js} +2 -2
  102. package/dist/zenuml/chunks/{chunk-3A6S6GNB.js → chunk-TEDVLVJM.js} +1 -1
  103. package/dist/zenuml/chunks/{chunk-CNLL4BGF.js → chunk-WD3ZPN3X.js} +1 -1
  104. package/dist/zenuml/chunks/{chunk-6J4BGPB2.js → chunk-WUHZDXTF.js} +24 -24
  105. package/dist/zenuml/chunks/{chunk-55WS466K.js → chunk-ZGLUBUQJ.js} +9 -9
  106. package/dist/zenuml/chunks/{render-core-ECIWU5ZS.js → render-core-WTHYSKBN.js} +2 -2
  107. package/dist/zenuml/chunks/{zenuml-N3LZMB2G.js → zenuml-3TCHUQJZ.js} +8 -8
  108. package/dist/zenuml.d.ts +2 -2
  109. package/dist/zenuml.js +1 -1
  110. package/docs/api.md +84 -4
  111. package/docs/quality.md +6 -3
  112. package/docs/style-authoring.md +23 -0
  113. package/docs/testing-strategy.md +59 -52
  114. package/examples/styles/readme-hero.md +4 -3
  115. package/package.json +4 -4
  116. package/server.json +2 -2
  117. package/skills/agentic-mermaid-diagram-workflow/SKILL.md +19 -154
  118. package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +12 -2
  119. package/skills/agentic-mermaid-diagram-workflow/references/hosted-mcp.md +5 -1
  120. package/dist/browser-lazy/chunks/chunk-6GPDLZFQ.js +0 -1
  121. package/dist/browser-lazy/chunks/render-core-42UVWIPF.js +0 -3
  122. package/dist/browser-lazy/chunks/xychart-HAVFROGT.js +0 -16
  123. package/dist/chunk-2DNGDTJD.js +0 -2
  124. package/dist/chunk-4F2UGYTM.js +0 -4
  125. package/dist/chunk-EHJI3QYE.js +0 -52
  126. package/dist/chunk-MKE7GNYU.js +0 -146
  127. package/dist/chunk-U4MT3RRE.js +0 -2
  128. package/dist/chunk-VUFVLGTH.js +0 -2
  129. package/dist/chunk-WYIB6BUR.js +0 -2
  130. package/dist/cli-ZYIDBYNS.js +0 -226
  131. package/dist/mcp-cli-YVDCORWA.js +0 -2
  132. package/dist/server-4JGAVXR3.js +0 -524
  133. package/docs/MCP-DIRECTORY-LISTINGS.md +0 -145
@@ -1,4 +1,4 @@
1
- import { S as StyleInput, Q as InternalStyleFace } from './svg-styles-BnCoXyYe.js';
1
+ import { S as StyleInput, Q as InternalStyleFace } from './svg-styles-DfHloZTH.js';
2
2
 
3
3
  interface DiagramColors {
4
4
  /** Background color → CSS variable --bg */
@@ -1 +1 @@
1
- import{n as e}from"./chunk-3A6S6GNB.js";import{ka as o,o as r,oa as l,sa as t}from"./chunk-IARQ24W3.js";import"./chunk-GC7IPQ5P.js";function n(n){let a=e(n),s=Object.keys(a??{}).filter(e=>!["formatVersion","$schema","name","blurb","colors","roles"].includes(e));for(let[e,o]of Object.entries(a?.roles??{})){let r="node"===e||"group"===e?["fillColor","borderColor","textColor"]:"edge"===e?["strokeColor","textColor"]:"label"===e?["textColor"]:[];for(let l of Object.keys(o))r.includes(l)||s.push(`roles.${e}.${l}`)}if(s.length)throw Error(`ZenUML cannot realize ${s.join(", ")}; use a palette or node/edge/group/label paint colors.`);let d=t({...l,...a?.colors}),i=a?.roles,u=i?.node?.fillColor??d.nodeFill,c=i?.group?.fillColor??d.groupHdr,g={background:d.bg,foreground:i?.label?.textColor??d.text,muted:d.textMuted,nodeFill:u,nodeBorder:i?.node?.borderColor??d.nodeStroke,nodeText:i?.node?.textColor??r(i?.label?.textColor??d.text,u),edge:i?.edge?.strokeColor??d.line,edgeText:i?.edge?.textColor??i?.label?.textColor??d.text,groupFill:c,groupBorder:i?.group?.borderColor??d.nodeStroke,groupText:i?.group?.textColor??r(i?.label?.textColor??d.text,c)};for(let[e,r]of Object.entries(g))if(!o(r))throw Error(`ZenUML ${e} requires a concrete, non-fetching color; unresolved CSS variables are unavailable.`);return g}export{n as resolveZenUMLAppearance};
1
+ import{n as e}from"./chunk-TEDVLVJM.js";import{ka as o,o as r,oa as l,sa as t}from"./chunk-KCHXQ5UA.js";import"./chunk-GC7IPQ5P.js";function n(n){let a=e(n),s=Object.keys(a??{}).filter(e=>!["formatVersion","$schema","name","blurb","colors","roles"].includes(e));for(let[e,o]of Object.entries(a?.roles??{})){let r="node"===e||"group"===e?["fillColor","borderColor","textColor"]:"edge"===e?["strokeColor","textColor"]:"label"===e?["textColor"]:[];for(let l of Object.keys(o))r.includes(l)||s.push(`roles.${e}.${l}`)}if(s.length)throw Error(`ZenUML cannot realize ${s.join(", ")}; use a palette or node/edge/group/label paint colors.`);let d=t({...l,...a?.colors}),i=a?.roles,u=i?.node?.fillColor??d.nodeFill,c=i?.group?.fillColor??d.groupHdr,C={background:d.bg,foreground:i?.label?.textColor??d.text,muted:d.textMuted,nodeFill:u,nodeBorder:i?.node?.borderColor??d.nodeStroke,nodeText:i?.node?.textColor??r(i?.label?.textColor??d.text,u),edge:i?.edge?.strokeColor??d.line,edgeText:i?.edge?.textColor??i?.label?.textColor??d.text,groupFill:c,groupBorder:i?.group?.borderColor??d.nodeStroke,groupText:i?.group?.textColor??r(i?.label?.textColor??d.text,c)};for(let[e,r]of Object.entries(C))if(!o(r))throw Error(`ZenUML ${e} requires a concrete, non-fetching color; unresolved CSS variables are unavailable.`);return C}export{n as resolveZenUMLAppearance};
@@ -1,4 +1,4 @@
1
- import{N as t,da as e,j as s,k as r,la as n,na as a,oa as i,p as o,pa as l,qa as h,t as u,ua as p,z as c}from"./chunk-6J4BGPB2.js";import{$ as f,Ja as d,R as g,V as k,k as y,l as M,m as m,ta as x}from"./chunk-IARQ24W3.js";import"./chunk-GC7IPQ5P.js";function v(t,e,s){if(t&&t.length){let[r,n]=e,a=Math.PI/180*s,i=Math.cos(a),o=Math.sin(a);for(let e of t){let[t,s]=e;e[0]=(t-r)*i-(s-n)*o+r,e[1]=(t-r)*o+(s-n)*i+n}}}function b(t,e){var s;let r=e.hachureAngle+90,n=e.hachureGap;n<0&&(n=4*e.strokeWidth),n=Math.round(Math.max(n,.1));let a=1;return e.roughness>=1&&((null==(s=e.randomizer)?void 0:s.next())||Math.random())>.7&&(a=n),function(t,e,s,r=1){let n=Math.max(e,.1),a=t[0]&&t[0][0]&&"number"==typeof t[0][0]?[t]:t,i=[0,0];if(s)for(let t of a)v(t,i,s);let o=function(t,e,s){let r=[];for(let e of t){var n,a;let t=[...e];n=t[0],a=t[t.length-1],n[0]===a[0]&&n[1]===a[1]||t.push([t[0][0],t[0][1]]),t.length>2&&r.push(t)}let i=[];e=Math.max(e,.1);let o=[];for(let t of r)for(let e=0;e<t.length-1;e++){let s=t[e],r=t[e+1];if(s[1]!==r[1]){let t=Math.min(s[1],r[1]);o.push({ymin:t,ymax:Math.max(s[1],r[1]),x:t===s[1]?s[0]:r[0],islope:(r[0]-s[0])/(r[1]-s[1])})}}if(o.sort((t,e)=>t.ymin<e.ymin?-1:t.ymin>e.ymin?1:t.x<e.x?-1:t.x>e.x?1:t.ymax===e.ymax?0:(t.ymax-e.ymax)/Math.abs(t.ymax-e.ymax)),!o.length)return i;let l=[],h=o[0].ymin,u=0;for(;l.length||o.length;){if(o.length){let t=-1;for(let e=0;e<o.length&&!(o[e].ymin>h);e++)t=e;o.splice(0,t+1).forEach(t=>{l.push({s:h,edge:t})})}if((l=l.filter(t=>!(t.edge.ymax<=h))).sort((t,e)=>t.edge.x===e.edge.x?0:(t.edge.x-e.edge.x)/Math.abs(t.edge.x-e.edge.x)),(1!==s||u%e==0)&&l.length>1)for(let t=0;t<l.length;t+=2){let e=t+1;if(e>=l.length)break;let s=l[t].edge,r=l[e].edge;i.push([[Math.round(s.x),h],[Math.round(r.x),h]])}h+=s,l.forEach(t=>{t.edge.x=t.edge.x+s*t.edge.islope}),u++}return i}(a,n,r);if(s){let t;for(let t of a)v(t,i,-s);t=[],o.forEach(e=>t.push(...e)),v(t,i,-s)}return o}(t,n,r,a||1)}var $=class{constructor(t){this.helper=t}fillPolygons(t,e){return this._fillPolygons(t,e)}_fillPolygons(t,e){let s=b(t,e);return{type:"fillSketch",ops:this.renderLines(s,e)}}renderLines(t,e){let s=[];for(let r of t)s.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],e));return s}};function P(t){let e=t[0],s=t[1];return Math.sqrt(Math.pow(e[0]-s[0],2)+Math.pow(e[1]-s[1],2))}var w=class extends ${fillPolygons(t,e){let s=e.hachureGap;s<0&&(s=4*e.strokeWidth);let r=b(t,Object.assign({},e,{hachureGap:s=Math.max(s,.1)})),n=Math.PI/180*e.hachureAngle,a=[],i=.5*s*Math.cos(n),o=.5*s*Math.sin(n);for(let[t,e]of r)P([t,e])&&a.push([[t[0]-i,t[1]+o],[...e]],[[t[0]+i,t[1]-o],[...e]]);return{type:"fillSketch",ops:this.renderLines(a,e)}}},S=class extends ${fillPolygons(t,e){let s=this._fillPolygons(t,e),r=Object.assign({},e,{hachureAngle:e.hachureAngle+90}),n=this._fillPolygons(t,r);return s.ops=s.ops.concat(n.ops),s}},O=class{constructor(t){this.helper=t}fillPolygons(t,e){let s=b(t,e=Object.assign({},e,{hachureAngle:0}));return this.dotsOnLines(s,e)}dotsOnLines(t,e){let s=[],r=e.hachureGap;r<0&&(r=4*e.strokeWidth),r=Math.max(r,.1);let n=e.fillWeight;n<0&&(n=e.strokeWidth/2);let a=r/4;for(let i of t){let t=P(i),o=Math.ceil(t/r)-1,l=t-o*r,h=(i[0][0]+i[1][0])/2-r/4,u=Math.min(i[0][1],i[1][1]);for(let t=0;t<o;t++){let i=h-a+2*Math.random()*a,o=u+l+t*r-a+2*Math.random()*a,p=this.helper.ellipse(i,o,n,n,e);s.push(...p.ops)}}return{type:"fillSketch",ops:s}}},L=class{constructor(t){this.helper=t}fillPolygons(t,e){let s=b(t,e);return{type:"fillSketch",ops:this.dashedLine(s,e)}}dashedLine(t,e){let s=e.dashOffset<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashOffset,r=e.dashGap<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashGap,n=[];return t.forEach(t=>{let a=P(t),i=Math.floor(a/(s+r)),o=(a+r-i*(s+r))/2,l=t[0],h=t[1];l[0]>h[0]&&(l=t[1],h=t[0]);let u=Math.atan((h[1]-l[1])/(h[0]-l[0]));for(let t=0;t<i;t++){let a=t*(s+r),i=a+s,h=[l[0]+a*Math.cos(u)+o*Math.cos(u),l[1]+a*Math.sin(u)+o*Math.sin(u)],p=[l[0]+i*Math.cos(u)+o*Math.cos(u),l[1]+i*Math.sin(u)+o*Math.sin(u)];n.push(...this.helper.doubleLineOps(h[0],h[1],p[0],p[1],e))}}),n}},j=class{constructor(t){this.helper=t}fillPolygons(t,e){let s=e.hachureGap<0?4*e.strokeWidth:e.hachureGap,r=e.zigzagOffset<0?s:e.zigzagOffset,n=b(t,e=Object.assign({},e,{hachureGap:s+r}));return{type:"fillSketch",ops:this.zigzagLines(n,r,e)}}zigzagLines(t,e,s){let r=[];return t.forEach(t=>{let n=Math.round(P(t)/(2*e)),a=t[0],i=t[1];a[0]>i[0]&&(a=t[1],i=t[0]);let o=Math.atan((i[1]-a[1])/(i[0]-a[0]));for(let t=0;t<n;t++){let n=2*t*e,i=(t+1)*2*e,l=Math.sqrt(2*Math.pow(e,2)),h=[a[0]+n*Math.cos(o),a[1]+n*Math.sin(o)],u=[a[0]+i*Math.cos(o),a[1]+i*Math.sin(o)],p=[h[0]+l*Math.cos(o+Math.PI/4),h[1]+l*Math.sin(o+Math.PI/4)];r.push(...this.helper.doubleLineOps(h[0],h[1],p[0],p[1],s),...this.helper.doubleLineOps(p[0],p[1],u[0],u[1],s))}}),r}},I={},_=class{constructor(t){this.seed=t}next(){return this.seed?(0x80000000-1&(this.seed=Math.imul(48271,this.seed)))/0x80000000:Math.random()}},W={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function z(t){let e=[],s=function(t){let e=[];for(;""!==t;)if(t.match(/^([ \t\r\n,]+)/))t=t.substr(RegExp.$1.length);else if(t.match(/^([aAcChHlLmMqQsStTvVzZ])/))e[e.length]={type:0,text:RegExp.$1},t=t.substr(RegExp.$1.length);else{if(!t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];e[e.length]={type:1,text:`${parseFloat(RegExp.$1)}`},t=t.substr(RegExp.$1.length)}return e[e.length]={type:2,text:""},e}(t),r="BOD",n=0,a=s[0];for(;2!==a.type;){let i=0,o=[];if("BOD"===r)if("M"!==a.text&&"m"!==a.text)return z("M0,0"+t);else n++,i=W[a.text],r=a.text;else 1===a.type?i=W[r]:(n++,i=W[a.text],r=a.text);if(n+i<s.length){for(let t=n;t<n+i;t++){let e=s[t];if(1===e.type)o[o.length]=+e.text;else throw Error("Param not a number: "+r+","+e.text)}if("number"==typeof W[r]){let t={key:r,data:o};e.push(t),n+=i,a=s[n],"M"===r&&(r="L"),"m"===r&&(r="l")}else throw Error("Bad segment: "+r)}else throw Error("Path data ended short")}return e}function A(t){let e=0,s=0,r=0,n=0,a=[];for(let{key:i,data:o}of t)switch(i){case"M":a.push({key:"M",data:[...o]}),[e,s]=o,[r,n]=o;break;case"m":e+=o[0],s+=o[1],a.push({key:"M",data:[e,s]}),r=e,n=s;break;case"L":a.push({key:"L",data:[...o]}),[e,s]=o;break;case"l":e+=o[0],s+=o[1],a.push({key:"L",data:[e,s]});break;case"C":a.push({key:"C",data:[...o]}),e=o[4],s=o[5];break;case"c":{let t=o.map((t,r)=>r%2?t+s:t+e);a.push({key:"C",data:t}),e=t[4],s=t[5];break}case"Q":a.push({key:"Q",data:[...o]}),e=o[2],s=o[3];break;case"q":{let t=o.map((t,r)=>r%2?t+s:t+e);a.push({key:"Q",data:t}),e=t[2],s=t[3];break}case"A":a.push({key:"A",data:[...o]}),e=o[5],s=o[6];break;case"a":e+=o[5],s+=o[6],a.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],e,s]});break;case"H":a.push({key:"H",data:[...o]}),e=o[0];break;case"h":e+=o[0],a.push({key:"H",data:[e]});break;case"V":a.push({key:"V",data:[...o]}),s=o[0];break;case"v":s+=o[0],a.push({key:"V",data:[s]});break;case"S":a.push({key:"S",data:[...o]}),e=o[2],s=o[3];break;case"s":{let t=o.map((t,r)=>r%2?t+s:t+e);a.push({key:"S",data:t}),e=t[2],s=t[3];break}case"T":a.push({key:"T",data:[...o]}),e=o[0],s=o[1];break;case"t":e+=o[0],s+=o[1],a.push({key:"T",data:[e,s]});break;case"Z":case"z":a.push({key:"Z",data:[]}),e=r,s=n}return a}function C(t){let e=[],s="",r=0,n=0,a=0,i=0,o=0,l=0;for(let{key:h,data:u}of t){switch(h){case"M":e.push({key:"M",data:[...u]}),[r,n]=u,[a,i]=u;break;case"C":e.push({key:"C",data:[...u]}),r=u[4],n=u[5],o=u[2],l=u[3];break;case"L":e.push({key:"L",data:[...u]}),[r,n]=u;break;case"H":r=u[0],e.push({key:"L",data:[r,n]});break;case"V":n=u[0],e.push({key:"L",data:[r,n]});break;case"S":{let t=0,a=0;"C"===s||"S"===s?(t=r+(r-o),a=n+(n-l)):(t=r,a=n),e.push({key:"C",data:[t,a,...u]}),o=u[0],l=u[1],r=u[2],n=u[3];break}case"T":{let[t,a]=u,i=0,h=0;"Q"===s||"T"===s?(i=r+(r-o),h=n+(n-l)):(i=r,h=n);let p=r+2*(i-r)/3,c=n+2*(h-n)/3,f=t+2*(i-t)/3,d=a+2*(h-a)/3;e.push({key:"C",data:[p,c,f,d,t,a]}),o=i,l=h,r=t,n=a;break}case"Q":{let[t,s,a,i]=u,h=r+2*(t-r)/3,p=n+2*(s-n)/3,c=a+2*(t-a)/3,f=i+2*(s-i)/3;e.push({key:"C",data:[h,p,c,f,a,i]}),o=t,l=s,r=a,n=i;break}case"A":{let t=Math.abs(u[0]),s=Math.abs(u[1]),a=u[2],i=u[3],o=u[4],l=u[5],h=u[6];0===t||0===s?(e.push({key:"C",data:[r,n,l,h,l,h]}),r=l,n=h):(r!==l||n!==h)&&((function t(e,s,r,n,a,i,o,l,h,u){let p=Math.PI*o/180,c=[],f=0,d=0,g=0,k=0;if(u)[f,d,g,k]=u;else{[e,s]=T(e,s,-p),[r,n]=T(r,n,-p);let t=(e-r)/2,o=(s-n)/2,u=t*t/(a*a)+o*o/(i*i);u>1&&(a*=u=Math.sqrt(u),i*=u);let c=a*a,y=i*i,M=(l===h?-1:1)*Math.sqrt(Math.abs((c*y-c*o*o-y*t*t)/(c*o*o+y*t*t)));g=M*a*o/i+(e+r)/2,k=-(M*i)*t/a+(s+n)/2,f=Math.asin(parseFloat(((s-k)/i).toFixed(9))),d=Math.asin(parseFloat(((n-k)/i).toFixed(9))),e<g&&(f=Math.PI-f),r<g&&(d=Math.PI-d),f<0&&(f=2*Math.PI+f),d<0&&(d=2*Math.PI+d),h&&f>d&&(f-=2*Math.PI),!h&&d>f&&(d-=2*Math.PI)}let y=d-f;if(Math.abs(y)>120*Math.PI/180){let e=d,s=r,l=n;c=t(r=g+a*Math.cos(d=h&&d>f?f+120*Math.PI/180*1:f+-(120*Math.PI/180*1)),n=k+i*Math.sin(d),s,l,a,i,o,0,h,[d,e,g,k])}y=d-f;let M=Math.cos(f),m=Math.cos(d),x=Math.tan(y/4),v=4/3*a*x,b=4/3*i*x,$=[e,s],P=[e+v*Math.sin(f),s-b*M],w=[r+v*Math.sin(d),n-b*m],S=[r,n];if(P[0]=2*$[0]-P[0],P[1]=2*$[1]-P[1],u)return[P,w,S].concat(c);{c=[P,w,S].concat(c);let t=[];for(let e=0;e<c.length;e+=3){let s=T(c[e][0],c[e][1],p),r=T(c[e+1][0],c[e+1][1],p),n=T(c[e+2][0],c[e+2][1],p);t.push([s[0],s[1],r[0],r[1],n[0],n[1]])}return t}})(r,n,l,h,t,s,a,i,o).forEach(function(t){e.push({key:"C",data:t})}),r=l,n=h);break}case"Z":e.push({key:"Z",data:[]}),r=a,n=i}s=h}return e}function T(t,e,s){return[t*Math.cos(s)-e*Math.sin(s),t*Math.sin(s)+e*Math.cos(s)]}var G={randOffset:function(t,e){return K(t,e)},randOffsetWithRange:function(t,e,s){return D(t,e,s)},ellipse:function(t,e,s,r,n){let a=q(s,r,n);return F(t,e,n,a).opset},doubleLineOps:function(t,e,s,r,n){return U(t,e,s,r,n,!0)}};function E(t,e,s,r,n){return{type:"path",ops:U(t,e,s,r,n)}}function R(t,e,s){let r=(t||[]).length;if(r>2){let n=[];for(let e=0;e<r-1;e++)n.push(...U(t[e][0],t[e][1],t[e+1][0],t[e+1][1],s));return e&&n.push(...U(t[r-1][0],t[r-1][1],t[0][0],t[0][1],s)),{type:"path",ops:n}}return 2===r?E(t[0][0],t[0][1],t[1][0],t[1][1],s):{type:"path",ops:[]}}function B(t,e){if(t.length){let s="number"==typeof t[0][0]?[t]:t,r=Y(s[0],+(1+.2*e.roughness),e),n=e.disableMultiStroke?[]:Y(s[0],1.5*(1+.22*e.roughness),H(e));for(let t=1;t<s.length;t++){let a=s[t];if(a.length){let t=Y(a,+(1+.2*e.roughness),e),s=e.disableMultiStroke?[]:Y(a,1.5*(1+.22*e.roughness),H(e));for(let e of t)"move"!==e.op&&r.push(e);for(let t of s)"move"!==t.op&&n.push(t)}}return{type:"path",ops:r.concat(n)}}return{type:"path",ops:[]}}function q(t,e,s){let r=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(t/2,2)+Math.pow(e/2,2))/2)),n=2*Math.PI/Math.ceil(Math.max(s.curveStepCount,s.curveStepCount/Math.sqrt(200)*r)),a=Math.abs(t/2),i=Math.abs(e/2),o=1-s.curveFitting;return a+=K(a*o,s),i+=K(i*o,s),{increment:n,rx:a,ry:i}}function F(t,e,s,r){let[n,a]=te(r.increment,t,e,r.rx,r.ry,1,r.increment*D(.1,D(.4,1,s),s),s),i=tt(n,null,s);if(!s.disableMultiStroke&&0!==s.roughness){let[n]=te(r.increment,t,e,r.rx,r.ry,1.5,0,s),a=tt(n,null,s);i=i.concat(a)}return{estimatedPoints:a,opset:{type:"path",ops:i}}}function Q(t,e,s,r,n,a,i,o,l){let h=Math.abs(s/2),u=Math.abs(r/2);h+=K(.01*h,l),u+=K(.01*u,l);let p=n,c=a;for(;p<0;)p+=2*Math.PI,c+=2*Math.PI;c-p>2*Math.PI&&(p=0,c=2*Math.PI);let f=Math.min(2*Math.PI/l.curveStepCount/2,(c-p)/2),d=ts(f,t,e,h,u,p,c,1,l);if(!l.disableMultiStroke){let s=ts(f,t,e,h,u,p,c,1.5,l);d.push(...s)}return i&&(o?d.push(...U(t,e,t+h*Math.cos(p),e+u*Math.sin(p),l),...U(t,e,t+h*Math.cos(c),e+u*Math.sin(c),l)):d.push({op:"lineTo",data:[t,e]},{op:"lineTo",data:[t+h*Math.cos(p),e+u*Math.sin(p)]})),{type:"path",ops:d}}function Z(t,e){let s=C(A(z(t))),r=[],n=[0,0],a=[0,0];for(let{key:t,data:i}of s)switch(t){case"M":a=[i[0],i[1]],n=[i[0],i[1]];break;case"L":r.push(...U(a[0],a[1],i[0],i[1],e)),a=[i[0],i[1]];break;case"C":{let[t,s,n,o,l,h]=i;r.push(...function(t,e,s,r,n,a,i,o){let l=[],h=[o.maxRandomnessOffset||1,(o.maxRandomnessOffset||1)+.3],u=[0,0],p=o.disableMultiStroke?1:2,c=o.preserveVertices;for(let f=0;f<p;f++)0===f?l.push({op:"move",data:[i[0],i[1]]}):l.push({op:"move",data:[i[0]+(c?0:K(h[0],o)),i[1]+(c?0:K(h[0],o))]}),u=c?[n,a]:[n+K(h[f],o),a+K(h[f],o)],l.push({op:"bcurveTo",data:[t+K(h[f],o),e+K(h[f],o),s+K(h[f],o),r+K(h[f],o),u[0],u[1]]});return l}(t,s,n,o,l,h,a,e)),a=[l,h];break}case"Z":r.push(...U(a[0],a[1],n[0],n[1],e)),a=[n[0],n[1]]}return{type:"path",ops:r}}function V(t,e){let s=[];for(let r of t)if(r.length){let t=e.maxRandomnessOffset||0,n=r.length;if(n>2){s.push({op:"move",data:[r[0][0]+K(t,e),r[0][1]+K(t,e)]});for(let a=1;a<n;a++)s.push({op:"lineTo",data:[r[a][0]+K(t,e),r[a][1]+K(t,e)]})}}return{type:"fillPath",ops:s}}function N(t,e){return(function(t,e){let s=t.fillStyle||"hachure";if(!I[s])switch(s){case"zigzag":I[s]||(I[s]=new w(e));break;case"cross-hatch":I[s]||(I[s]=new S(e));break;case"dots":I[s]||(I[s]=new O(e));break;case"dashed":I[s]||(I[s]=new L(e));break;case"zigzag-line":I[s]||(I[s]=new j(e));break;default:I[s="hachure"]||(I[s]=new $(e))}return I[s]})(e,G).fillPolygons(t,e)}function H(t){let e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function J(t){return t.randomizer||(t.randomizer=new _(t.seed||0)),t.randomizer.next()}function D(t,e,s,r=1){return s.roughness*r*(J(s)*(e-t)+t)}function K(t,e,s=1){return D(-t,t,e,s)}function U(t,e,s,r,n,a=!1){let i=a?n.disableMultiStrokeFill:n.disableMultiStroke,o=X(t,e,s,r,n,!0,!1);if(i)return o;let l=X(t,e,s,r,n,!0,!0);return o.concat(l)}function X(t,e,s,r,n,a,i){let o=Math.pow(t-s,2)+Math.pow(e-r,2),l=Math.sqrt(o),h=1;h=l<200?1:l>500?.4:-.0016668*l+1.233334;let u=n.maxRandomnessOffset||0;u*u*100>o&&(u=l/10);let p=u/2,c=.2+.2*J(n),f=n.bowing*n.maxRandomnessOffset*(r-e)/200,d=n.bowing*n.maxRandomnessOffset*(t-s)/200;f=K(f,n,h),d=K(d,n,h);let g=[],k=n.preserveVertices;return a&&(i?g.push({op:"move",data:[t+(k?0:K(p,n,h)),e+(k?0:K(p,n,h))]}):g.push({op:"move",data:[t+(k?0:K(u,n,h)),e+(k?0:K(u,n,h))]})),i?g.push({op:"bcurveTo",data:[f+t+(s-t)*c+K(p,n,h),d+e+(r-e)*c+K(p,n,h),f+t+2*(s-t)*c+K(p,n,h),d+e+2*(r-e)*c+K(p,n,h),s+(k?0:K(p,n,h)),r+(k?0:K(p,n,h))]}):g.push({op:"bcurveTo",data:[f+t+(s-t)*c+K(u,n,h),d+e+(r-e)*c+K(u,n,h),f+t+2*(s-t)*c+K(u,n,h),d+e+2*(r-e)*c+K(u,n,h),s+(k?0:K(u,n,h)),r+(k?0:K(u,n,h))]}),g}function Y(t,e,s){if(!t.length)return[];let r=[];r.push([t[0][0]+K(e,s),t[0][1]+K(e,s)]),r.push([t[0][0]+K(e,s),t[0][1]+K(e,s)]);for(let n=1;n<t.length;n++)r.push([t[n][0]+K(e,s),t[n][1]+K(e,s)]),n===t.length-1&&r.push([t[n][0]+K(e,s),t[n][1]+K(e,s)]);return tt(r,null,s)}function tt(t,e,s){let r=t.length,n=[];if(r>3){let a=[],i=1-s.curveTightness;n.push({op:"move",data:[t[1][0],t[1][1]]});for(let e=1;e+2<r;e++){let s=t[e];a[0]=[s[0],s[1]],a[1]=[s[0]+(i*t[e+1][0]-i*t[e-1][0])/6,s[1]+(i*t[e+1][1]-i*t[e-1][1])/6],a[2]=[t[e+1][0]+(i*t[e][0]-i*t[e+2][0])/6,t[e+1][1]+(i*t[e][1]-i*t[e+2][1])/6],a[3]=[t[e+1][0],t[e+1][1]],n.push({op:"bcurveTo",data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(e&&2===e.length){let t=s.maxRandomnessOffset;n.push({op:"lineTo",data:[e[0]+K(t,s),e[1]+K(t,s)]})}}else 3===r?(n.push({op:"move",data:[t[1][0],t[1][1]]}),n.push({op:"bcurveTo",data:[t[1][0],t[1][1],t[2][0],t[2][1],t[2][0],t[2][1]]})):2===r&&n.push(...X(t[0][0],t[0][1],t[1][0],t[1][1],s,!0,!0));return n}function te(t,e,s,r,n,a,i,o){let l=0===o.roughness,h=[],u=[];if(l){t/=4,u.push([e+r*Math.cos(-t),s+n*Math.sin(-t)]);for(let a=0;a<=2*Math.PI;a+=t){let t=[e+r*Math.cos(a),s+n*Math.sin(a)];h.push(t),u.push(t)}u.push([e+ +r,s+0*n]),u.push([e+r*Math.cos(t),s+n*Math.sin(t)])}else{let l=K(.5,o)-Math.PI/2;u.push([K(a,o)+e+.9*r*Math.cos(l-t),K(a,o)+s+.9*n*Math.sin(l-t)]);let p=2*Math.PI+l-.01;for(let i=l;i<p;i+=t){let t=[K(a,o)+e+r*Math.cos(i),K(a,o)+s+n*Math.sin(i)];h.push(t),u.push(t)}u.push([K(a,o)+e+r*Math.cos(l+2*Math.PI+.5*i),K(a,o)+s+n*Math.sin(l+2*Math.PI+.5*i)]),u.push([K(a,o)+e+.98*r*Math.cos(l+i),K(a,o)+s+.98*n*Math.sin(l+i)]),u.push([K(a,o)+e+.9*r*Math.cos(l+.5*i),K(a,o)+s+.9*n*Math.sin(l+.5*i)])}return[u,h]}function ts(t,e,s,r,n,a,i,o,l){let h=a+K(.1,l),u=[];u.push([K(o,l)+e+.9*r*Math.cos(h-t),K(o,l)+s+.9*n*Math.sin(h-t)]);for(let a=h;a<=i;a+=t)u.push([K(o,l)+e+r*Math.cos(a),K(o,l)+s+n*Math.sin(a)]);return u.push([e+r*Math.cos(i),s+n*Math.sin(i)]),u.push([e+r*Math.cos(i),s+n*Math.sin(i)]),tt(u,null,l)}function tr(t,e=0){let s=t.length;if(s<3)throw Error("A curve must have at least three points.");let r=[];if(3===s)r.push([...t[0]],[...t[1]],[...t[2]],[...t[2]]);else{let s=[];s.push(t[0],t[0]);for(let e=1;e<t.length;e++)s.push(t[e]),e===t.length-1&&s.push(t[e]);let n=[],a=1-e;r.push([...s[0]]);for(let t=1;t+2<s.length;t++){let e=s[t];n[0]=[e[0],e[1]],n[1]=[e[0]+(a*s[t+1][0]-a*s[t-1][0])/6,e[1]+(a*s[t+1][1]-a*s[t-1][1])/6],n[2]=[s[t+1][0]+(a*s[t][0]-a*s[t+2][0])/6,s[t+1][1]+(a*s[t][1]-a*s[t+2][1])/6],n[3]=[s[t+1][0],s[t+1][1]],r.push(n[1],n[2],n[3])}}return r}function tn(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function ta(t,e,s){return[t[0]+(e[0]-t[0])*s,t[1]+(e[1]-t[1])*s]}function ti(t,e,s,r,n){let a=n||[],i=t[e],o=t[s-1],l=0,h=1;for(let r=e+1;r<s-1;++r){let e=function(t,e,s){let r=tn(e,s);if(0===r)return tn(t,e);let n=((t[0]-e[0])*(s[0]-e[0])+(t[1]-e[1])*(s[1]-e[1]))/r;return tn(t,ta(e,s,n=Math.max(0,Math.min(1,n))))}(t[r],i,o);e>l&&(l=e,h=r)}return Math.sqrt(l)>r?(ti(t,e,h+1,r,a),ti(t,h,s,r,a)):(a.length||a.push(i),a.push(o)),a}function to(t,e=.15,s){let r=[],n=(t.length-1)/3;for(let s=0;s<n;s++)!function t(e,s,r,n){let a,i,o,l,h,u,p,c,f=n||[];if(a=e[s+0],i=e[s+1],o=e[s+2],l=e[s+3],h=3*i[0]-2*a[0]-l[0],h*=h,u=3*i[1]-2*a[1]-l[1],u*=u,p=3*o[0]-2*l[0]-a[0],p*=p,c=3*o[1]-2*l[1]-a[1],c*=c,h<p&&(h=p),u<c&&(u=c),h+u<r){let t=e[s+0];f.length?Math.sqrt(tn(f[f.length-1],t))>1&&f.push(t):f.push(t),f.push(e[s+3])}else{let n=e[s+0],a=e[s+1],i=e[s+2],o=e[s+3],l=ta(n,a,.5),h=ta(a,i,.5),u=ta(i,o,.5),p=ta(l,h,.5),c=ta(h,u,.5),d=ta(p,c,.5);t([n,l,p,d],0,r,f),t([d,c,u,o],0,r,f)}return f}(t,3*s,e,r);return s&&s>0?ti(r,0,r.length,s):r}var tl="none",th=new class{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(0x80000000*Math.random())}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,e,s){return{shape:t,sets:e||[],options:s||this.defaultOptions}}line(t,e,s,r,n){let a=this._o(n);return this._d("line",[E(t,e,s,r,a)],a)}rectangle(t,e,s,r,n){let a=this._o(n),i=[],o=R([[t,e],[t+s,e],[t+s,e+r],[t,e+r]],!0,a);if(a.fill){let n=[[t,e],[t+s,e],[t+s,e+r],[t,e+r]];"solid"===a.fillStyle?i.push(V([n],a)):i.push(N([n],a))}return a.stroke!==tl&&i.push(o),this._d("rectangle",i,a)}ellipse(t,e,s,r,n){let a=this._o(n),i=[],o=q(s,r,a),l=F(t,e,a,o);if(a.fill)if("solid"===a.fillStyle){let s=F(t,e,a,o).opset;s.type="fillPath",i.push(s)}else i.push(N([l.estimatedPoints],a));return a.stroke!==tl&&i.push(l.opset),this._d("ellipse",i,a)}circle(t,e,s,r){let n=this.ellipse(t,e,s,s,r);return n.shape="circle",n}linearPath(t,e){let s=this._o(e);return this._d("linearPath",[R(t,!1,s)],s)}arc(t,e,s,r,n,a,i=!1,o){let l=this._o(o),h=[],u=Q(t,e,s,r,n,a,i,!0,l);if(i&&l.fill)if("solid"===l.fillStyle){let i=Object.assign({},l);i.disableMultiStroke=!0;let o=Q(t,e,s,r,n,a,!0,!1,i);o.type="fillPath",h.push(o)}else h.push(function(t,e,s,r,n,a,i){let o=Math.abs(s/2),l=Math.abs(r/2);o+=K(.01*o,i),l+=K(.01*l,i);let h=n,u=a;for(;h<0;)h+=2*Math.PI,u+=2*Math.PI;u-h>2*Math.PI&&(h=0,u=2*Math.PI);let p=(u-h)/i.curveStepCount,c=[];for(let s=h;s<=u;s+=p)c.push([t+o*Math.cos(s),e+l*Math.sin(s)]);return c.push([t+o*Math.cos(u),e+l*Math.sin(u)]),c.push([t,e]),N([c],i)}(t,e,s,r,n,a,l));return l.stroke!==tl&&h.push(u),this._d("arc",h,l)}curve(t,e){let s=this._o(e),r=[],n=B(t,s);if(s.fill&&s.fill!==tl)if("solid"===s.fillStyle){let e=B(t,Object.assign(Object.assign({},s),{disableMultiStroke:!0,roughness:s.roughness?s.roughness+s.fillShapeRoughnessGain:0}));r.push({type:"fillPath",ops:this._mergedShape(e.ops)})}else{let e=[];if(t.length)for(let r of"number"==typeof t[0][0]?[t]:t)r.length<3?e.push(...r):3===r.length?e.push(...to(tr([r[0],r[0],r[1],r[2]]),10,(1+s.roughness)/2)):e.push(...to(tr(r),10,(1+s.roughness)/2));e.length&&r.push(N([e],s))}return s.stroke!==tl&&r.push(n),this._d("curve",r,s)}polygon(t,e){let s=this._o(e),r=[],n=R(t,!0,s);return s.fill&&("solid"===s.fillStyle?r.push(V([t],s)):r.push(N([t],s))),s.stroke!==tl&&r.push(n),this._d("polygon",r,s)}path(t,e){let s=this._o(e),r=[];if(!t)return this._d("path",r,s);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let n=s.fill&&"transparent"!==s.fill&&s.fill!==tl,a=s.stroke!==tl,i=!!(s.simplification&&s.simplification<1),o=i?4-4*(s.simplification||1):(1+s.roughness)/2,l=function(t,e,s){let r=C(A(z(t))),n=[],a=[],i=[0,0],o=[],l=()=>{o.length>=4&&a.push(...to(o,1)),o=[]},h=()=>{l(),a.length&&(n.push(a),a=[])};for(let{key:t,data:e}of r)switch(t){case"M":h(),i=[e[0],e[1]],a.push(i);break;case"L":l(),a.push([e[0],e[1]]);break;case"C":if(!o.length){let t=a.length?a[a.length-1]:i;o.push([t[0],t[1]])}o.push([e[0],e[1]]),o.push([e[2],e[3]]),o.push([e[4],e[5]]);break;case"Z":l(),a.push([i[0],i[1]])}if(h(),!s)return n;let u=[];for(let t of n){let e=ti(t,0,t.length,s);e.length&&u.push(e)}return u}(t,0,o),h=Z(t,s);if(n)if("solid"===s.fillStyle)if(1===l.length){let e=Z(t,Object.assign(Object.assign({},s),{disableMultiStroke:!0,roughness:s.roughness?s.roughness+s.fillShapeRoughnessGain:0}));r.push({type:"fillPath",ops:this._mergedShape(e.ops)})}else r.push(V(l,s));else r.push(N(l,s));return a&&(i?l.forEach(t=>{r.push(R(t,!1,s))}):r.push(h)),this._d("path",r,s)}opsToPath(t,e){let s="";for(let r of t.ops){let t="number"==typeof e&&e>=0?r.data.map(t=>+t.toFixed(e)):r.data;switch(r.op){case"move":s+=`M${t[0]} ${t[1]} `;break;case"bcurveTo":s+=`C${t[0]} ${t[1]}, ${t[2]} ${t[3]}, ${t[4]} ${t[5]} `;break;case"lineTo":s+=`L${t[0]} ${t[1]} `}}return s.trim()}toPaths(t){let e=t.sets||[],s=t.options||this.defaultOptions,r=[];for(let t of e){let e=null;switch(t.type){case"path":e={d:this.opsToPath(t),stroke:s.stroke,strokeWidth:s.strokeWidth,fill:tl};break;case"fillPath":e={d:this.opsToPath(t),stroke:tl,strokeWidth:0,fill:s.fill||tl};break;case"fillSketch":e=this.fillSketch(t,s)}e&&r.push(e)}return r}fillSketch(t,e){let s=e.fillWeight;return s<0&&(s=e.strokeWidth/2),{d:this.opsToPath(t),stroke:e.fill||tl,strokeWidth:s,fill:tl}}_mergedShape(t){return t.filter((t,e)=>0===e||"move"!==t.op)}};function tu(t){return{roughness:t?.roughness??1,bowing:t?.bowing??1,passes:t?.passes??2,strokeWidth:t?.strokeWidth??1.6,fill:t?.fill??"none",hachureAngle:t?.hachureAngle??-41,hachureGap:t?.hachureGap??5,fillWeight:t?.fillWeight??.9}}function tp(t,e,s,r,n,a={},i){let o=[],l=function(t={}){return[`stroke-linecap="${t.lineCap??"round"}"`,`stroke-linejoin="${t.lineJoin??"round"}"`,...void 0!==t.miterLimit?[`stroke-miterlimit="${g(String(t.miterLimit))}"`]:[],...void 0!==t.dashArray?[`stroke-dasharray="${g(t.dashArray)}"`]:[],...void 0!==t.dashOffset?[`stroke-dashoffset="${g(String(t.dashOffset))}"`]:[],...void 0!==t.opacity?[`stroke-opacity="${g(String(t.opacity))}"`]:[],...void 0!==t.pathLength?[`pathLength="${g(String(t.pathLength))}"`]:[],...void 0!==t.paintOrder?[`paint-order="${g(t.paintOrder)}"`]:[],...void 0!==t.mixBlendMode?[`style="mix-blend-mode:${t.mixBlendMode}"`]:[],...t.nonScaling?['vector-effect="non-scaling-stroke"']:[]].join(" ")}(a),h=l?` ${l}`:" ",u=i?.stroke===void 0?"":` stroke-opacity="${g(String(i.stroke))}"`,p=i?.fill===void 0?"":` stroke-opacity="${g(String(i.fill))}"`;for(let a of t){let t=th.opsToPath(a,2);t&&("path"===a.type?o.push(`<path d="${t}" fill="none" stroke="${e}" stroke-width="${k(s)}"${h}${u} />`):"fillPath"===a.type?o.push(`<path d="${t}" fill="${r}" fill-opacity="${g(String(i?.fill??.92))}" stroke="none" />`):"fillSketch"===a.type&&o.push(`<path d="${t}" fill="none" stroke="${r}" stroke-width="${k(n.fillWeight)}"${p} />`))}return o.join(`
1
+ import{N as t,da as e,j as s,k as r,la as n,na as a,oa as i,p as o,pa as l,qa as h,t as u,ua as p,z as c}from"./chunk-WUHZDXTF.js";import{$ as f,Ja as d,R as g,V as k,k as y,l as M,m as m,ta as x}from"./chunk-KCHXQ5UA.js";import"./chunk-GC7IPQ5P.js";function v(t,e,s){if(t&&t.length){let[r,n]=e,a=Math.PI/180*s,i=Math.cos(a),o=Math.sin(a);for(let e of t){let[t,s]=e;e[0]=(t-r)*i-(s-n)*o+r,e[1]=(t-r)*o+(s-n)*i+n}}}function b(t,e){var s;let r=e.hachureAngle+90,n=e.hachureGap;n<0&&(n=4*e.strokeWidth),n=Math.round(Math.max(n,.1));let a=1;return e.roughness>=1&&((null==(s=e.randomizer)?void 0:s.next())||Math.random())>.7&&(a=n),function(t,e,s,r=1){let n=Math.max(e,.1),a=t[0]&&t[0][0]&&"number"==typeof t[0][0]?[t]:t,i=[0,0];if(s)for(let t of a)v(t,i,s);let o=function(t,e,s){let r=[];for(let e of t){var n,a;let t=[...e];n=t[0],a=t[t.length-1],n[0]===a[0]&&n[1]===a[1]||t.push([t[0][0],t[0][1]]),t.length>2&&r.push(t)}let i=[];e=Math.max(e,.1);let o=[];for(let t of r)for(let e=0;e<t.length-1;e++){let s=t[e],r=t[e+1];if(s[1]!==r[1]){let t=Math.min(s[1],r[1]);o.push({ymin:t,ymax:Math.max(s[1],r[1]),x:t===s[1]?s[0]:r[0],islope:(r[0]-s[0])/(r[1]-s[1])})}}if(o.sort((t,e)=>t.ymin<e.ymin?-1:t.ymin>e.ymin?1:t.x<e.x?-1:t.x>e.x?1:t.ymax===e.ymax?0:(t.ymax-e.ymax)/Math.abs(t.ymax-e.ymax)),!o.length)return i;let l=[],h=o[0].ymin,u=0;for(;l.length||o.length;){if(o.length){let t=-1;for(let e=0;e<o.length&&!(o[e].ymin>h);e++)t=e;o.splice(0,t+1).forEach(t=>{l.push({s:h,edge:t})})}if((l=l.filter(t=>!(t.edge.ymax<=h))).sort((t,e)=>t.edge.x===e.edge.x?0:(t.edge.x-e.edge.x)/Math.abs(t.edge.x-e.edge.x)),(1!==s||u%e==0)&&l.length>1)for(let t=0;t<l.length;t+=2){let e=t+1;if(e>=l.length)break;let s=l[t].edge,r=l[e].edge;i.push([[Math.round(s.x),h],[Math.round(r.x),h]])}h+=s,l.forEach(t=>{t.edge.x=t.edge.x+s*t.edge.islope}),u++}return i}(a,n,r);if(s){let t;for(let t of a)v(t,i,-s);t=[],o.forEach(e=>t.push(...e)),v(t,i,-s)}return o}(t,n,r,a||1)}var $=class{constructor(t){this.helper=t}fillPolygons(t,e){return this._fillPolygons(t,e)}_fillPolygons(t,e){let s=b(t,e);return{type:"fillSketch",ops:this.renderLines(s,e)}}renderLines(t,e){let s=[];for(let r of t)s.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],e));return s}};function P(t){let e=t[0],s=t[1];return Math.sqrt(Math.pow(e[0]-s[0],2)+Math.pow(e[1]-s[1],2))}var w=class extends ${fillPolygons(t,e){let s=e.hachureGap;s<0&&(s=4*e.strokeWidth);let r=b(t,Object.assign({},e,{hachureGap:s=Math.max(s,.1)})),n=Math.PI/180*e.hachureAngle,a=[],i=.5*s*Math.cos(n),o=.5*s*Math.sin(n);for(let[t,e]of r)P([t,e])&&a.push([[t[0]-i,t[1]+o],[...e]],[[t[0]+i,t[1]-o],[...e]]);return{type:"fillSketch",ops:this.renderLines(a,e)}}},S=class extends ${fillPolygons(t,e){let s=this._fillPolygons(t,e),r=Object.assign({},e,{hachureAngle:e.hachureAngle+90}),n=this._fillPolygons(t,r);return s.ops=s.ops.concat(n.ops),s}},O=class{constructor(t){this.helper=t}fillPolygons(t,e){let s=b(t,e=Object.assign({},e,{hachureAngle:0}));return this.dotsOnLines(s,e)}dotsOnLines(t,e){let s=[],r=e.hachureGap;r<0&&(r=4*e.strokeWidth),r=Math.max(r,.1);let n=e.fillWeight;n<0&&(n=e.strokeWidth/2);let a=r/4;for(let i of t){let t=P(i),o=Math.ceil(t/r)-1,l=t-o*r,h=(i[0][0]+i[1][0])/2-r/4,u=Math.min(i[0][1],i[1][1]);for(let t=0;t<o;t++){let i=h-a+2*Math.random()*a,o=u+l+t*r-a+2*Math.random()*a,p=this.helper.ellipse(i,o,n,n,e);s.push(...p.ops)}}return{type:"fillSketch",ops:s}}},L=class{constructor(t){this.helper=t}fillPolygons(t,e){let s=b(t,e);return{type:"fillSketch",ops:this.dashedLine(s,e)}}dashedLine(t,e){let s=e.dashOffset<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashOffset,r=e.dashGap<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashGap,n=[];return t.forEach(t=>{let a=P(t),i=Math.floor(a/(s+r)),o=(a+r-i*(s+r))/2,l=t[0],h=t[1];l[0]>h[0]&&(l=t[1],h=t[0]);let u=Math.atan((h[1]-l[1])/(h[0]-l[0]));for(let t=0;t<i;t++){let a=t*(s+r),i=a+s,h=[l[0]+a*Math.cos(u)+o*Math.cos(u),l[1]+a*Math.sin(u)+o*Math.sin(u)],p=[l[0]+i*Math.cos(u)+o*Math.cos(u),l[1]+i*Math.sin(u)+o*Math.sin(u)];n.push(...this.helper.doubleLineOps(h[0],h[1],p[0],p[1],e))}}),n}},j=class{constructor(t){this.helper=t}fillPolygons(t,e){let s=e.hachureGap<0?4*e.strokeWidth:e.hachureGap,r=e.zigzagOffset<0?s:e.zigzagOffset,n=b(t,e=Object.assign({},e,{hachureGap:s+r}));return{type:"fillSketch",ops:this.zigzagLines(n,r,e)}}zigzagLines(t,e,s){let r=[];return t.forEach(t=>{let n=Math.round(P(t)/(2*e)),a=t[0],i=t[1];a[0]>i[0]&&(a=t[1],i=t[0]);let o=Math.atan((i[1]-a[1])/(i[0]-a[0]));for(let t=0;t<n;t++){let n=2*t*e,i=(t+1)*2*e,l=Math.sqrt(2*Math.pow(e,2)),h=[a[0]+n*Math.cos(o),a[1]+n*Math.sin(o)],u=[a[0]+i*Math.cos(o),a[1]+i*Math.sin(o)],p=[h[0]+l*Math.cos(o+Math.PI/4),h[1]+l*Math.sin(o+Math.PI/4)];r.push(...this.helper.doubleLineOps(h[0],h[1],p[0],p[1],s),...this.helper.doubleLineOps(p[0],p[1],u[0],u[1],s))}}),r}},I={},_=class{constructor(t){this.seed=t}next(){return this.seed?(0x80000000-1&(this.seed=Math.imul(48271,this.seed)))/0x80000000:Math.random()}},W={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function z(t){let e=[],s=function(t){let e=[];for(;""!==t;)if(t.match(/^([ \t\r\n,]+)/))t=t.substr(RegExp.$1.length);else if(t.match(/^([aAcChHlLmMqQsStTvVzZ])/))e[e.length]={type:0,text:RegExp.$1},t=t.substr(RegExp.$1.length);else{if(!t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];e[e.length]={type:1,text:`${parseFloat(RegExp.$1)}`},t=t.substr(RegExp.$1.length)}return e[e.length]={type:2,text:""},e}(t),r="BOD",n=0,a=s[0];for(;2!==a.type;){let i=0,o=[];if("BOD"===r)if("M"!==a.text&&"m"!==a.text)return z("M0,0"+t);else n++,i=W[a.text],r=a.text;else 1===a.type?i=W[r]:(n++,i=W[a.text],r=a.text);if(n+i<s.length){for(let t=n;t<n+i;t++){let e=s[t];if(1===e.type)o[o.length]=+e.text;else throw Error("Param not a number: "+r+","+e.text)}if("number"==typeof W[r]){let t={key:r,data:o};e.push(t),n+=i,a=s[n],"M"===r&&(r="L"),"m"===r&&(r="l")}else throw Error("Bad segment: "+r)}else throw Error("Path data ended short")}return e}function C(t){let e=0,s=0,r=0,n=0,a=[];for(let{key:i,data:o}of t)switch(i){case"M":a.push({key:"M",data:[...o]}),[e,s]=o,[r,n]=o;break;case"m":e+=o[0],s+=o[1],a.push({key:"M",data:[e,s]}),r=e,n=s;break;case"L":a.push({key:"L",data:[...o]}),[e,s]=o;break;case"l":e+=o[0],s+=o[1],a.push({key:"L",data:[e,s]});break;case"C":a.push({key:"C",data:[...o]}),e=o[4],s=o[5];break;case"c":{let t=o.map((t,r)=>r%2?t+s:t+e);a.push({key:"C",data:t}),e=t[4],s=t[5];break}case"Q":a.push({key:"Q",data:[...o]}),e=o[2],s=o[3];break;case"q":{let t=o.map((t,r)=>r%2?t+s:t+e);a.push({key:"Q",data:t}),e=t[2],s=t[3];break}case"A":a.push({key:"A",data:[...o]}),e=o[5],s=o[6];break;case"a":e+=o[5],s+=o[6],a.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],e,s]});break;case"H":a.push({key:"H",data:[...o]}),e=o[0];break;case"h":e+=o[0],a.push({key:"H",data:[e]});break;case"V":a.push({key:"V",data:[...o]}),s=o[0];break;case"v":s+=o[0],a.push({key:"V",data:[s]});break;case"S":a.push({key:"S",data:[...o]}),e=o[2],s=o[3];break;case"s":{let t=o.map((t,r)=>r%2?t+s:t+e);a.push({key:"S",data:t}),e=t[2],s=t[3];break}case"T":a.push({key:"T",data:[...o]}),e=o[0],s=o[1];break;case"t":e+=o[0],s+=o[1],a.push({key:"T",data:[e,s]});break;case"Z":case"z":a.push({key:"Z",data:[]}),e=r,s=n}return a}function A(t){let e=[],s="",r=0,n=0,a=0,i=0,o=0,l=0;for(let{key:h,data:u}of t){switch(h){case"M":e.push({key:"M",data:[...u]}),[r,n]=u,[a,i]=u;break;case"C":e.push({key:"C",data:[...u]}),r=u[4],n=u[5],o=u[2],l=u[3];break;case"L":e.push({key:"L",data:[...u]}),[r,n]=u;break;case"H":r=u[0],e.push({key:"L",data:[r,n]});break;case"V":n=u[0],e.push({key:"L",data:[r,n]});break;case"S":{let t=0,a=0;"C"===s||"S"===s?(t=r+(r-o),a=n+(n-l)):(t=r,a=n),e.push({key:"C",data:[t,a,...u]}),o=u[0],l=u[1],r=u[2],n=u[3];break}case"T":{let[t,a]=u,i=0,h=0;"Q"===s||"T"===s?(i=r+(r-o),h=n+(n-l)):(i=r,h=n);let p=r+2*(i-r)/3,c=n+2*(h-n)/3,f=t+2*(i-t)/3,d=a+2*(h-a)/3;e.push({key:"C",data:[p,c,f,d,t,a]}),o=i,l=h,r=t,n=a;break}case"Q":{let[t,s,a,i]=u,h=r+2*(t-r)/3,p=n+2*(s-n)/3,c=a+2*(t-a)/3,f=i+2*(s-i)/3;e.push({key:"C",data:[h,p,c,f,a,i]}),o=t,l=s,r=a,n=i;break}case"A":{let t=Math.abs(u[0]),s=Math.abs(u[1]),a=u[2],i=u[3],o=u[4],l=u[5],h=u[6];0===t||0===s?(e.push({key:"C",data:[r,n,l,h,l,h]}),r=l,n=h):(r!==l||n!==h)&&((function t(e,s,r,n,a,i,o,l,h,u){let p=Math.PI*o/180,c=[],f=0,d=0,g=0,k=0;if(u)[f,d,g,k]=u;else{[e,s]=T(e,s,-p),[r,n]=T(r,n,-p);let t=(e-r)/2,o=(s-n)/2,u=t*t/(a*a)+o*o/(i*i);u>1&&(a*=u=Math.sqrt(u),i*=u);let c=a*a,y=i*i,M=(l===h?-1:1)*Math.sqrt(Math.abs((c*y-c*o*o-y*t*t)/(c*o*o+y*t*t)));g=M*a*o/i+(e+r)/2,k=-(M*i)*t/a+(s+n)/2,f=Math.asin(parseFloat(((s-k)/i).toFixed(9))),d=Math.asin(parseFloat(((n-k)/i).toFixed(9))),e<g&&(f=Math.PI-f),r<g&&(d=Math.PI-d),f<0&&(f=2*Math.PI+f),d<0&&(d=2*Math.PI+d),h&&f>d&&(f-=2*Math.PI),!h&&d>f&&(d-=2*Math.PI)}let y=d-f;if(Math.abs(y)>120*Math.PI/180){let e=d,s=r,l=n;c=t(r=g+a*Math.cos(d=h&&d>f?f+120*Math.PI/180*1:f+-(120*Math.PI/180*1)),n=k+i*Math.sin(d),s,l,a,i,o,0,h,[d,e,g,k])}y=d-f;let M=Math.cos(f),m=Math.cos(d),x=Math.tan(y/4),v=4/3*a*x,b=4/3*i*x,$=[e,s],P=[e+v*Math.sin(f),s-b*M],w=[r+v*Math.sin(d),n-b*m],S=[r,n];if(P[0]=2*$[0]-P[0],P[1]=2*$[1]-P[1],u)return[P,w,S].concat(c);{c=[P,w,S].concat(c);let t=[];for(let e=0;e<c.length;e+=3){let s=T(c[e][0],c[e][1],p),r=T(c[e+1][0],c[e+1][1],p),n=T(c[e+2][0],c[e+2][1],p);t.push([s[0],s[1],r[0],r[1],n[0],n[1]])}return t}})(r,n,l,h,t,s,a,i,o).forEach(function(t){e.push({key:"C",data:t})}),r=l,n=h);break}case"Z":e.push({key:"Z",data:[]}),r=a,n=i}s=h}return e}function T(t,e,s){return[t*Math.cos(s)-e*Math.sin(s),t*Math.sin(s)+e*Math.cos(s)]}var G={randOffset:function(t,e){return U(t,e)},randOffsetWithRange:function(t,e,s){return J(t,e,s)},ellipse:function(t,e,s,r,n){let a=q(s,r,n);return B(t,e,n,a).opset},doubleLineOps:function(t,e,s,r,n){return K(t,e,s,r,n,!0)}};function E(t,e,s,r,n){return{type:"path",ops:K(t,e,s,r,n)}}function R(t,e,s){let r=(t||[]).length;if(r>2){let n=[];for(let e=0;e<r-1;e++)n.push(...K(t[e][0],t[e][1],t[e+1][0],t[e+1][1],s));return e&&n.push(...K(t[r-1][0],t[r-1][1],t[0][0],t[0][1],s)),{type:"path",ops:n}}return 2===r?E(t[0][0],t[0][1],t[1][0],t[1][1],s):{type:"path",ops:[]}}function F(t,e){if(t.length){let s="number"==typeof t[0][0]?[t]:t,r=Y(s[0],+(1+.2*e.roughness),e),n=e.disableMultiStroke?[]:Y(s[0],1.5*(1+.22*e.roughness),H(e));for(let t=1;t<s.length;t++){let a=s[t];if(a.length){let t=Y(a,+(1+.2*e.roughness),e),s=e.disableMultiStroke?[]:Y(a,1.5*(1+.22*e.roughness),H(e));for(let e of t)"move"!==e.op&&r.push(e);for(let t of s)"move"!==t.op&&n.push(t)}}return{type:"path",ops:r.concat(n)}}return{type:"path",ops:[]}}function q(t,e,s){let r=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(t/2,2)+Math.pow(e/2,2))/2)),n=2*Math.PI/Math.ceil(Math.max(s.curveStepCount,s.curveStepCount/Math.sqrt(200)*r)),a=Math.abs(t/2),i=Math.abs(e/2),o=1-s.curveFitting;return a+=U(a*o,s),i+=U(i*o,s),{increment:n,rx:a,ry:i}}function B(t,e,s,r){let[n,a]=te(r.increment,t,e,r.rx,r.ry,1,r.increment*J(.1,J(.4,1,s),s),s),i=tt(n,null,s);if(!s.disableMultiStroke&&0!==s.roughness){let[n]=te(r.increment,t,e,r.rx,r.ry,1.5,0,s),a=tt(n,null,s);i=i.concat(a)}return{estimatedPoints:a,opset:{type:"path",ops:i}}}function Q(t,e,s,r,n,a,i,o,l){let h=Math.abs(s/2),u=Math.abs(r/2);h+=U(.01*h,l),u+=U(.01*u,l);let p=n,c=a;for(;p<0;)p+=2*Math.PI,c+=2*Math.PI;c-p>2*Math.PI&&(p=0,c=2*Math.PI);let f=Math.min(2*Math.PI/l.curveStepCount/2,(c-p)/2),d=ts(f,t,e,h,u,p,c,1,l);if(!l.disableMultiStroke){let s=ts(f,t,e,h,u,p,c,1.5,l);d.push(...s)}return i&&(o?d.push(...K(t,e,t+h*Math.cos(p),e+u*Math.sin(p),l),...K(t,e,t+h*Math.cos(c),e+u*Math.sin(c),l)):d.push({op:"lineTo",data:[t,e]},{op:"lineTo",data:[t+h*Math.cos(p),e+u*Math.sin(p)]})),{type:"path",ops:d}}function Z(t,e){let s=A(C(z(t))),r=[],n=[0,0],a=[0,0];for(let{key:t,data:i}of s)switch(t){case"M":a=[i[0],i[1]],n=[i[0],i[1]];break;case"L":r.push(...K(a[0],a[1],i[0],i[1],e)),a=[i[0],i[1]];break;case"C":{let[t,s,n,o,l,h]=i;r.push(...function(t,e,s,r,n,a,i,o){let l=[],h=[o.maxRandomnessOffset||1,(o.maxRandomnessOffset||1)+.3],u=[0,0],p=o.disableMultiStroke?1:2,c=o.preserveVertices;for(let f=0;f<p;f++)0===f?l.push({op:"move",data:[i[0],i[1]]}):l.push({op:"move",data:[i[0]+(c?0:U(h[0],o)),i[1]+(c?0:U(h[0],o))]}),u=c?[n,a]:[n+U(h[f],o),a+U(h[f],o)],l.push({op:"bcurveTo",data:[t+U(h[f],o),e+U(h[f],o),s+U(h[f],o),r+U(h[f],o),u[0],u[1]]});return l}(t,s,n,o,l,h,a,e)),a=[l,h];break}case"Z":r.push(...K(a[0],a[1],n[0],n[1],e)),a=[n[0],n[1]]}return{type:"path",ops:r}}function V(t,e){let s=[];for(let r of t)if(r.length){let t=e.maxRandomnessOffset||0,n=r.length;if(n>2){s.push({op:"move",data:[r[0][0]+U(t,e),r[0][1]+U(t,e)]});for(let a=1;a<n;a++)s.push({op:"lineTo",data:[r[a][0]+U(t,e),r[a][1]+U(t,e)]})}}return{type:"fillPath",ops:s}}function N(t,e){return(function(t,e){let s=t.fillStyle||"hachure";if(!I[s])switch(s){case"zigzag":I[s]||(I[s]=new w(e));break;case"cross-hatch":I[s]||(I[s]=new S(e));break;case"dots":I[s]||(I[s]=new O(e));break;case"dashed":I[s]||(I[s]=new L(e));break;case"zigzag-line":I[s]||(I[s]=new j(e));break;default:I[s="hachure"]||(I[s]=new $(e))}return I[s]})(e,G).fillPolygons(t,e)}function H(t){let e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function D(t){return t.randomizer||(t.randomizer=new _(t.seed||0)),t.randomizer.next()}function J(t,e,s,r=1){return s.roughness*r*(D(s)*(e-t)+t)}function U(t,e,s=1){return J(-t,t,e,s)}function K(t,e,s,r,n,a=!1){let i=a?n.disableMultiStrokeFill:n.disableMultiStroke,o=X(t,e,s,r,n,!0,!1);if(i)return o;let l=X(t,e,s,r,n,!0,!0);return o.concat(l)}function X(t,e,s,r,n,a,i){let o=Math.pow(t-s,2)+Math.pow(e-r,2),l=Math.sqrt(o),h=1;h=l<200?1:l>500?.4:-.0016668*l+1.233334;let u=n.maxRandomnessOffset||0;u*u*100>o&&(u=l/10);let p=u/2,c=.2+.2*D(n),f=n.bowing*n.maxRandomnessOffset*(r-e)/200,d=n.bowing*n.maxRandomnessOffset*(t-s)/200;f=U(f,n,h),d=U(d,n,h);let g=[],k=n.preserveVertices;return a&&(i?g.push({op:"move",data:[t+(k?0:U(p,n,h)),e+(k?0:U(p,n,h))]}):g.push({op:"move",data:[t+(k?0:U(u,n,h)),e+(k?0:U(u,n,h))]})),i?g.push({op:"bcurveTo",data:[f+t+(s-t)*c+U(p,n,h),d+e+(r-e)*c+U(p,n,h),f+t+2*(s-t)*c+U(p,n,h),d+e+2*(r-e)*c+U(p,n,h),s+(k?0:U(p,n,h)),r+(k?0:U(p,n,h))]}):g.push({op:"bcurveTo",data:[f+t+(s-t)*c+U(u,n,h),d+e+(r-e)*c+U(u,n,h),f+t+2*(s-t)*c+U(u,n,h),d+e+2*(r-e)*c+U(u,n,h),s+(k?0:U(u,n,h)),r+(k?0:U(u,n,h))]}),g}function Y(t,e,s){if(!t.length)return[];let r=[];r.push([t[0][0]+U(e,s),t[0][1]+U(e,s)]),r.push([t[0][0]+U(e,s),t[0][1]+U(e,s)]);for(let n=1;n<t.length;n++)r.push([t[n][0]+U(e,s),t[n][1]+U(e,s)]),n===t.length-1&&r.push([t[n][0]+U(e,s),t[n][1]+U(e,s)]);return tt(r,null,s)}function tt(t,e,s){let r=t.length,n=[];if(r>3){let a=[],i=1-s.curveTightness;n.push({op:"move",data:[t[1][0],t[1][1]]});for(let e=1;e+2<r;e++){let s=t[e];a[0]=[s[0],s[1]],a[1]=[s[0]+(i*t[e+1][0]-i*t[e-1][0])/6,s[1]+(i*t[e+1][1]-i*t[e-1][1])/6],a[2]=[t[e+1][0]+(i*t[e][0]-i*t[e+2][0])/6,t[e+1][1]+(i*t[e][1]-i*t[e+2][1])/6],a[3]=[t[e+1][0],t[e+1][1]],n.push({op:"bcurveTo",data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(e&&2===e.length){let t=s.maxRandomnessOffset;n.push({op:"lineTo",data:[e[0]+U(t,s),e[1]+U(t,s)]})}}else 3===r?(n.push({op:"move",data:[t[1][0],t[1][1]]}),n.push({op:"bcurveTo",data:[t[1][0],t[1][1],t[2][0],t[2][1],t[2][0],t[2][1]]})):2===r&&n.push(...X(t[0][0],t[0][1],t[1][0],t[1][1],s,!0,!0));return n}function te(t,e,s,r,n,a,i,o){let l=0===o.roughness,h=[],u=[];if(l){t/=4,u.push([e+r*Math.cos(-t),s+n*Math.sin(-t)]);for(let a=0;a<=2*Math.PI;a+=t){let t=[e+r*Math.cos(a),s+n*Math.sin(a)];h.push(t),u.push(t)}u.push([e+ +r,s+0*n]),u.push([e+r*Math.cos(t),s+n*Math.sin(t)])}else{let l=U(.5,o)-Math.PI/2;u.push([U(a,o)+e+.9*r*Math.cos(l-t),U(a,o)+s+.9*n*Math.sin(l-t)]);let p=2*Math.PI+l-.01;for(let i=l;i<p;i+=t){let t=[U(a,o)+e+r*Math.cos(i),U(a,o)+s+n*Math.sin(i)];h.push(t),u.push(t)}u.push([U(a,o)+e+r*Math.cos(l+2*Math.PI+.5*i),U(a,o)+s+n*Math.sin(l+2*Math.PI+.5*i)]),u.push([U(a,o)+e+.98*r*Math.cos(l+i),U(a,o)+s+.98*n*Math.sin(l+i)]),u.push([U(a,o)+e+.9*r*Math.cos(l+.5*i),U(a,o)+s+.9*n*Math.sin(l+.5*i)])}return[u,h]}function ts(t,e,s,r,n,a,i,o,l){let h=a+U(.1,l),u=[];u.push([U(o,l)+e+.9*r*Math.cos(h-t),U(o,l)+s+.9*n*Math.sin(h-t)]);for(let a=h;a<=i;a+=t)u.push([U(o,l)+e+r*Math.cos(a),U(o,l)+s+n*Math.sin(a)]);return u.push([e+r*Math.cos(i),s+n*Math.sin(i)]),u.push([e+r*Math.cos(i),s+n*Math.sin(i)]),tt(u,null,l)}function tr(t,e=0){let s=t.length;if(s<3)throw Error("A curve must have at least three points.");let r=[];if(3===s)r.push([...t[0]],[...t[1]],[...t[2]],[...t[2]]);else{let s=[];s.push(t[0],t[0]);for(let e=1;e<t.length;e++)s.push(t[e]),e===t.length-1&&s.push(t[e]);let n=[],a=1-e;r.push([...s[0]]);for(let t=1;t+2<s.length;t++){let e=s[t];n[0]=[e[0],e[1]],n[1]=[e[0]+(a*s[t+1][0]-a*s[t-1][0])/6,e[1]+(a*s[t+1][1]-a*s[t-1][1])/6],n[2]=[s[t+1][0]+(a*s[t][0]-a*s[t+2][0])/6,s[t+1][1]+(a*s[t][1]-a*s[t+2][1])/6],n[3]=[s[t+1][0],s[t+1][1]],r.push(n[1],n[2],n[3])}}return r}function tn(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function ta(t,e,s){return[t[0]+(e[0]-t[0])*s,t[1]+(e[1]-t[1])*s]}function ti(t,e,s,r,n){let a=n||[],i=t[e],o=t[s-1],l=0,h=1;for(let r=e+1;r<s-1;++r){let e=function(t,e,s){let r=tn(e,s);if(0===r)return tn(t,e);let n=((t[0]-e[0])*(s[0]-e[0])+(t[1]-e[1])*(s[1]-e[1]))/r;return tn(t,ta(e,s,n=Math.max(0,Math.min(1,n))))}(t[r],i,o);e>l&&(l=e,h=r)}return Math.sqrt(l)>r?(ti(t,e,h+1,r,a),ti(t,h,s,r,a)):(a.length||a.push(i),a.push(o)),a}function to(t,e=.15,s){let r=[],n=(t.length-1)/3;for(let s=0;s<n;s++)!function t(e,s,r,n){let a,i,o,l,h,u,p,c,f=n||[];if(a=e[s+0],i=e[s+1],o=e[s+2],l=e[s+3],h=3*i[0]-2*a[0]-l[0],h*=h,u=3*i[1]-2*a[1]-l[1],u*=u,p=3*o[0]-2*l[0]-a[0],p*=p,c=3*o[1]-2*l[1]-a[1],c*=c,h<p&&(h=p),u<c&&(u=c),h+u<r){let t=e[s+0];f.length?Math.sqrt(tn(f[f.length-1],t))>1&&f.push(t):f.push(t),f.push(e[s+3])}else{let n=e[s+0],a=e[s+1],i=e[s+2],o=e[s+3],l=ta(n,a,.5),h=ta(a,i,.5),u=ta(i,o,.5),p=ta(l,h,.5),c=ta(h,u,.5),d=ta(p,c,.5);t([n,l,p,d],0,r,f),t([d,c,u,o],0,r,f)}return f}(t,3*s,e,r);return s&&s>0?ti(r,0,r.length,s):r}var tl="none",th=new class{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(0x80000000*Math.random())}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,e,s){return{shape:t,sets:e||[],options:s||this.defaultOptions}}line(t,e,s,r,n){let a=this._o(n);return this._d("line",[E(t,e,s,r,a)],a)}rectangle(t,e,s,r,n){let a=this._o(n),i=[],o=R([[t,e],[t+s,e],[t+s,e+r],[t,e+r]],!0,a);if(a.fill){let n=[[t,e],[t+s,e],[t+s,e+r],[t,e+r]];"solid"===a.fillStyle?i.push(V([n],a)):i.push(N([n],a))}return a.stroke!==tl&&i.push(o),this._d("rectangle",i,a)}ellipse(t,e,s,r,n){let a=this._o(n),i=[],o=q(s,r,a),l=B(t,e,a,o);if(a.fill)if("solid"===a.fillStyle){let s=B(t,e,a,o).opset;s.type="fillPath",i.push(s)}else i.push(N([l.estimatedPoints],a));return a.stroke!==tl&&i.push(l.opset),this._d("ellipse",i,a)}circle(t,e,s,r){let n=this.ellipse(t,e,s,s,r);return n.shape="circle",n}linearPath(t,e){let s=this._o(e);return this._d("linearPath",[R(t,!1,s)],s)}arc(t,e,s,r,n,a,i=!1,o){let l=this._o(o),h=[],u=Q(t,e,s,r,n,a,i,!0,l);if(i&&l.fill)if("solid"===l.fillStyle){let i=Object.assign({},l);i.disableMultiStroke=!0;let o=Q(t,e,s,r,n,a,!0,!1,i);o.type="fillPath",h.push(o)}else h.push(function(t,e,s,r,n,a,i){let o=Math.abs(s/2),l=Math.abs(r/2);o+=U(.01*o,i),l+=U(.01*l,i);let h=n,u=a;for(;h<0;)h+=2*Math.PI,u+=2*Math.PI;u-h>2*Math.PI&&(h=0,u=2*Math.PI);let p=(u-h)/i.curveStepCount,c=[];for(let s=h;s<=u;s+=p)c.push([t+o*Math.cos(s),e+l*Math.sin(s)]);return c.push([t+o*Math.cos(u),e+l*Math.sin(u)]),c.push([t,e]),N([c],i)}(t,e,s,r,n,a,l));return l.stroke!==tl&&h.push(u),this._d("arc",h,l)}curve(t,e){let s=this._o(e),r=[],n=F(t,s);if(s.fill&&s.fill!==tl)if("solid"===s.fillStyle){let e=F(t,Object.assign(Object.assign({},s),{disableMultiStroke:!0,roughness:s.roughness?s.roughness+s.fillShapeRoughnessGain:0}));r.push({type:"fillPath",ops:this._mergedShape(e.ops)})}else{let e=[];if(t.length)for(let r of"number"==typeof t[0][0]?[t]:t)r.length<3?e.push(...r):3===r.length?e.push(...to(tr([r[0],r[0],r[1],r[2]]),10,(1+s.roughness)/2)):e.push(...to(tr(r),10,(1+s.roughness)/2));e.length&&r.push(N([e],s))}return s.stroke!==tl&&r.push(n),this._d("curve",r,s)}polygon(t,e){let s=this._o(e),r=[],n=R(t,!0,s);return s.fill&&("solid"===s.fillStyle?r.push(V([t],s)):r.push(N([t],s))),s.stroke!==tl&&r.push(n),this._d("polygon",r,s)}path(t,e){let s=this._o(e),r=[];if(!t)return this._d("path",r,s);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let n=s.fill&&"transparent"!==s.fill&&s.fill!==tl,a=s.stroke!==tl,i=!!(s.simplification&&s.simplification<1),o=i?4-4*(s.simplification||1):(1+s.roughness)/2,l=function(t,e,s){let r=A(C(z(t))),n=[],a=[],i=[0,0],o=[],l=()=>{o.length>=4&&a.push(...to(o,1)),o=[]},h=()=>{l(),a.length&&(n.push(a),a=[])};for(let{key:t,data:e}of r)switch(t){case"M":h(),i=[e[0],e[1]],a.push(i);break;case"L":l(),a.push([e[0],e[1]]);break;case"C":if(!o.length){let t=a.length?a[a.length-1]:i;o.push([t[0],t[1]])}o.push([e[0],e[1]]),o.push([e[2],e[3]]),o.push([e[4],e[5]]);break;case"Z":l(),a.push([i[0],i[1]])}if(h(),!s)return n;let u=[];for(let t of n){let e=ti(t,0,t.length,s);e.length&&u.push(e)}return u}(t,0,o),h=Z(t,s);if(n)if("solid"===s.fillStyle)if(1===l.length){let e=Z(t,Object.assign(Object.assign({},s),{disableMultiStroke:!0,roughness:s.roughness?s.roughness+s.fillShapeRoughnessGain:0}));r.push({type:"fillPath",ops:this._mergedShape(e.ops)})}else r.push(V(l,s));else r.push(N(l,s));return a&&(i?l.forEach(t=>{r.push(R(t,!1,s))}):r.push(h)),this._d("path",r,s)}opsToPath(t,e){let s="";for(let r of t.ops){let t="number"==typeof e&&e>=0?r.data.map(t=>+t.toFixed(e)):r.data;switch(r.op){case"move":s+=`M${t[0]} ${t[1]} `;break;case"bcurveTo":s+=`C${t[0]} ${t[1]}, ${t[2]} ${t[3]}, ${t[4]} ${t[5]} `;break;case"lineTo":s+=`L${t[0]} ${t[1]} `}}return s.trim()}toPaths(t){let e=t.sets||[],s=t.options||this.defaultOptions,r=[];for(let t of e){let e=null;switch(t.type){case"path":e={d:this.opsToPath(t),stroke:s.stroke,strokeWidth:s.strokeWidth,fill:tl};break;case"fillPath":e={d:this.opsToPath(t),stroke:tl,strokeWidth:0,fill:s.fill||tl};break;case"fillSketch":e=this.fillSketch(t,s)}e&&r.push(e)}return r}fillSketch(t,e){let s=e.fillWeight;return s<0&&(s=e.strokeWidth/2),{d:this.opsToPath(t),stroke:e.fill||tl,strokeWidth:s,fill:tl}}_mergedShape(t){return t.filter((t,e)=>0===e||"move"!==t.op)}};function tu(t){return{roughness:t?.roughness??1,bowing:t?.bowing??1,passes:t?.passes??2,strokeWidth:t?.strokeWidth??1.6,fill:t?.fill??"none",hachureAngle:t?.hachureAngle??-41,hachureGap:t?.hachureGap??5,fillWeight:t?.fillWeight??.9}}function tp(t,e,s,r,n,a={},i){let o=[],l=function(t={}){return[`stroke-linecap="${t.lineCap??"round"}"`,`stroke-linejoin="${t.lineJoin??"round"}"`,...void 0!==t.miterLimit?[`stroke-miterlimit="${g(String(t.miterLimit))}"`]:[],...void 0!==t.dashArray?[`stroke-dasharray="${g(t.dashArray)}"`]:[],...void 0!==t.dashOffset?[`stroke-dashoffset="${g(String(t.dashOffset))}"`]:[],...void 0!==t.opacity?[`stroke-opacity="${g(String(t.opacity))}"`]:[],...void 0!==t.pathLength?[`pathLength="${g(String(t.pathLength))}"`]:[],...void 0!==t.paintOrder?[`paint-order="${g(t.paintOrder)}"`]:[],...void 0!==t.mixBlendMode?[`style="mix-blend-mode:${t.mixBlendMode}"`]:[],...t.nonScaling?['vector-effect="non-scaling-stroke"']:[]].join(" ")}(a),h=l?` ${l}`:" ",u=i?.stroke===void 0?"":` stroke-opacity="${g(String(i.stroke))}"`,p=i?.fill===void 0?"":` stroke-opacity="${g(String(i.fill))}"`;for(let a of t){let t=th.opsToPath(a,2);t&&("path"===a.type?o.push(`<path d="${t}" fill="none" stroke="${e}" stroke-width="${k(s)}"${h}${u} />`):"fillPath"===a.type?o.push(`<path d="${t}" fill="${r}" fill-opacity="${g(String(i?.fill??.92))}" stroke="none" />`):"fillSketch"===a.type&&o.push(`<path d="${t}" fill="none" stroke="${r}" stroke-width="${k(n.fillWeight)}"${p} />`))}return o.join(`
2
2
  `)}function tc(t,e,s,r,n,a,i,o,l){var h,u,p,c,f;let d={...o,...void 0!==i?{dashArray:i}:{}},g={seed:e,roughness:a.roughness,bowing:a.bowing,stroke:s,strokeWidth:r,disableMultiStroke:a.passes<2,...n?{fill:n,fillStyle:"solid"===a.fill?"solid":"hachure",fillWeight:a.fillWeight,hachureGap:a.hachureGap,hachureAngle:a.hachureAngle}:{},preserveVertices:!1};try{switch(t.kind){case"rect":let e;return(t.rx??0)>.5?tp(th.path((h=t.x,u=t.y,p=t.width,c=t.height,f=t.rx,e=Math.min(f,p/2,c/2),`M ${h+e} ${u} L ${h+p-e} ${u} Q ${h+p} ${u} ${h+p} ${u+e} L ${h+p} ${u+c-e} Q ${h+p} ${u+c} ${h+p-e} ${u+c} L ${h+e} ${u+c} Q ${h} ${u+c} ${h} ${u+c-e} L ${h} ${u+e} Q ${h} ${u} ${h+e} ${u} Z`),g).sets,s,r,n,a,d,l):tp(th.rectangle(t.x,t.y,t.width,t.height,g).sets,s,r,n,a,d,l);case"circle":return tp(th.circle(t.cx,t.cy,2*t.r,g).sets,s,r,n,a,d,l);case"ellipse":return tp(th.ellipse(t.cx,t.cy,2*t.rx,2*t.ry,g).sets,s,r,n,a,d,l);case"line":return tp(th.line(t.x1,t.y1,t.x2,t.y2,g).sets,s,r,void 0,a,d,l);case"polygon":return tp(th.polygon(t.points.map(t=>[t.x,t.y]),g).sets,s,r,n,a,d,l);case"polyline":return tp(th.linearPath(t.points.map(t=>[t.x,t.y]),g).sets,s,r,void 0,a,d,l);case"path":return tp(th.path(t.d,g).sets,s,r,n,a,d,l);case"compound":return""}}catch{return""}}function tf(t,e,s,r,n,a,i,o,l){if(t.sketcher){let h=t.sketcher(e,{seed:s,stroke:r,width:n,fill:a,p:t.p,style:t.ctx.style,dash:i,strokeProjection:o,opacity:l});if(null!==h)return h}return tc(e,s,r,n,a,t.p,i,o,l)}function td(t,e,s){return t.replace(`<${e} `,`<${e} ${s} `)}function tg(t){if(void 0===t)return 1;let e="number"==typeof t?t:parseFloat(t);return Number.isNaN(e)?1:e}function tk(t,e){return void 0!==t?t:e}function ty(t,e){return e&&""!==t?`<g transform="${c(e)}">${t}</g>`:t}function tM(t){return t.startsWith("var(--_node-fill")||t.startsWith("var(--_group")||"var(--bg)"===t||"var(--surface)"===t}function tm(t,e){return/<text\b[^>]*?\sfill="/.test(t)?t.replace(/(<text\b[^>]*?\sfill=")[^"]*(")/,`$1${g(e)}$2`):t.replace(/<text /,`<text fill="${g(e)}" `)}function tx(e,s){switch(e.kind){case"document":return t(e);case"shape":return"shape"===d(e.role).sketch?function(e,s){let n=s.p,a=t(e),i=function(t){let e=[],s=0,r,n=/<\/([a-zA-Z][a-zA-Z0-9-]*)>/g,a=[];for(let e of f(t)){let t=new Map(e.attributes.map(t=>[t.name,t.value]));a.push({index:e.start,kind:e.selfClosing?"self":"open",tag:e.name,attrs:t})}for(;null!==(r=n.exec(t));)a.push({index:r.index,kind:"close",tag:r[1]});for(let t of(a.sort((t,e)=>t.index-e.index),a))"self"===t.kind?0===s&&e.push({tag:t.tag,attrs:t.attrs}):"open"===t.kind?(0===s&&e.push({tag:t.tag,attrs:t.attrs}),s++):s--;return e}(a),l="compound"===e.geometry.kind?e.geometry.children:[e.geometry];if(i.length<l.length)return a;let h=a.split(`
3
3
  `),u=t=>1===h.length&&0===t?a:h[t]??"",p=[];for(let t=0;t<l.length;t++){var c,d;let a=i[t],o=tk(a.attrs.get("stroke"),e.paint.stroke),h=tk(a.attrs.get("fill"),e.paint.fill),f=r(s.ctx.seed,e.id,`outline:${t}`)||1,g=tg(tk(a.attrs.get("stroke-width"),e.paint.strokeWidth)),k=tk(a.attrs.get("stroke-dasharray"),e.paint.strokeDasharray),y=void 0!==o&&"none"!==o&&g>0,M=void 0!==h&&"none"!==h,m=M&&"none"!==n.fill?h:void 0,x=function(t,e){let s=t.get("opacity")??e.opacity,r=t.get("fill-opacity")??e.fillOpacity,n=t.get("stroke-opacity")??e.strokeOpacity;if(void 0===s&&void 0===r&&void 0===n)return;let a=t=>void 0===t?s:void 0===s?t:Number(s)*Number(t);return{fill:a(r),stroke:a(n)}}(a.attrs,e.paint)??{};if("wash"===n.fill&&e.channels?.category!==void 0&&["pie-slice","actor","legend","point","bar"].includes(e.role)&&(x.fill??="1"),!y){if(e.surfaceFragment&&M&&"none"===n.fill&&tM(h))continue;if(m){let r=tf(s,l[t],f,"none",0,m,k,void 0,x);if(r){p.push(ty(r,e.transform));continue}}p.push(u(t));continue}let v=Math.max(.6,Math.min(n.strokeWidth*g,4*n.strokeWidth)),b=tf(s,l[t],f,o,v,m,k,void 0,x);if(!b){p.push(u(t));continue}M&&"none"===n.fill&&!tM(h)&&p.push((c=u(t),d=a.tag,/style="/.test(c)?c.replace(/style="([^"]*)"/,(t,e)=>{let s=0===e.trim().length||/;\s*$/.test(e)?"":";";return`style="${e}${s}stroke:none"`}):td(c,d,'style="stroke:none"'))),p.push(ty(b,e.transform))}let g=p.filter(Boolean).join(`
4
4
  `);return e.identity&&!/\sdata-id=/.test(g)?o(g,e.identity):g}(e,s):t(e);case"connector":return"connector"===d(e.role).sketch?function(e,s){let n=t(e);if("invisible"===e.lineStyle||""===n)return n;let a=e.stroke.color,i=tg(e.stroke.width);if(i<=0)return n;let o=e.stroke.encodesValue?i:s.p.strokeWidth*i,l=r(s.ctx.seed,e.id,"stroke")||1,h=e.stroke.dash?"string"==typeof e.stroke.dash.array?e.stroke.dash.array:e.stroke.dash.array.join(" "):void 0,p={...void 0!==h?{dashArray:h}:{},...e.stroke.dash?.offset!==void 0?{dashOffset:e.stroke.dash.offset}:{},lineCap:e.stroke.lineCap,lineJoin:e.stroke.lineJoin,miterLimit:e.stroke.miterLimit,...void 0!==e.stroke.opacity?{opacity:e.stroke.opacity}:{},...void 0!==e.stroke.pathLength?{pathLength:e.stroke.pathLength}:{},...void 0!==e.stroke.paintOrder?{paintOrder:e.stroke.paintOrder}:{},...void 0!==e.stroke.mixBlendMode?{mixBlendMode:e.stroke.mixBlendMode}:{},nonScaling:e.stroke.nonScaling},c="",f=e.route.geometry;if("polyline"===f.kind)c=tf(s,{kind:"polyline",points:f.points},l,a,o,void 0,h,p);else if("line"===f.kind)c=tf(s,f,l,a,o,void 0,h,p);else{let t=u(f,e.route.closed);if(1===t.length&&(c=tf(s,{kind:"path",d:f.d},l,a,o,void 0,h,p)),!c&&f.points.length>1){let e=t.map((t,e)=>{let r=t.points[0],n=t.points.at(-1);return tf(s,{kind:"polyline",points:[...t.closed&&r&&n&&(r.x!==n.x||r.y!==n.y)?[...t.points,r]:t.points]},l+e,a,o,void 0,h,p)});c=e.every(Boolean)?e.join(`
@@ -6,7 +6,7 @@ import{N as t,da as e,j as s,k as r,la as n,na as a,oa as i,p as o,pa as l,qa as
6
6
  ${ty(c,e.transform)}`}(e,s):t(e);case"text":return d(e.role).textHalo?(void 0!==e.pageFill?tm(t(e),e.pageFill):function(t,e,s){let r=s.colors,n=void 0===r?void 0:x("var(--bg)",r);if(void 0===r||void 0===n)return t;let a=e.fontSize>=24?m:M,i=t=>{let e=x(t,r);return void 0!==e&&(y(e,n)??a)<a};return(void 0!==e.paint.fill&&i(e.paint.fill)?tm(t,"var(--_text)"):t).replace(/(<tspan\b[^>]*?\sfill=")([^"]*)(")/g,(t,e,s,r)=>i(s)?`${e}var(--_text)${r}`:t)}(t(e),e,s)).replace(/<text\b[^>]*>/g,t=>t.replace(/\s(?:paint-order|stroke|stroke-width|stroke-linejoin|stroke-linecap)="[^"]*"/g,"").replace(/^<text/,'<text paint-order="stroke" stroke="var(--bg)" stroke-width="3" stroke-linejoin="round" stroke-linecap="round"')):t(e);case"group":return i(e.open,e.close,e.join,e.children.map(t=>({serialized:tx(t.node,s),indent:t.indent})))}}function tv(t,s){return{id:t,capabilities:e(`backend:${t}`,"sketch",s?"hybrid":"rough"),drawNode:(t,e)=>tx(t,{ctx:e,p:tu(e.style),sketcher:s}),render(t,e){let r=n(t),i={ctx:e,p:tu(e.style),sketcher:s,colors:r.colors},o=[];for(let t=0;t<r.parts.length;t++){let s=r.parts[t];if(o.push(a(e,s,tx(s,i))),0===t&&"document"===s.kind&&"open"===s.element){let t=l(r,e);t&&o.push(t);let s=function(t,e){let s=t?.backdrop??"plain";if("paper-ruled"===s){let t=['<g data-backdrop="paper-ruled">'];for(let s=26;s<e.height;s+=26)t.push(` <line x1="0" y1="${s}" x2="${e.width}" y2="${s}" stroke="var(--_line)" stroke-width="0.5" opacity="0.14" />`);return t.push("</g>"),t.join(`
7
7
  `)}if("grid"===s){let t=['<g data-backdrop="grid">'];for(let s=22;s<e.width;s+=22)t.push(` <line x1="${s}" y1="0" x2="${s}" y2="${e.height}" stroke="var(--_line)" stroke-width="0.5" opacity="0.10" />`);for(let s=22;s<e.height;s+=22)t.push(` <line x1="0" y1="${s}" x2="${e.width}" y2="${s}" stroke="var(--_line)" stroke-width="0.5" opacity="0.10" />`);return t.push("</g>"),t.join(`
8
8
  `)}return""}(e.style,r);s&&o.push(s)}}return o.join(`
9
- `)}}}var tb=tv("rough"),{PI:t$}=Math,tP=t$+1e-4,tw=.5,tS=[1,1];function tO(t,e,s,r=t=>t){return t*r(.5-e*(.5-s))}var{min:tL}=Math;function tj(t,e,s){let r=tL(1,e/s);return tL(1,t+(tL(1,1-r)-t)*(.275*r))}function tI(t,e){return[t[0]+e[0],t[1]+e[1]]}function t_(t,e,s){return t[0]=e[0]+s[0],t[1]=e[1]+s[1],t}function tW(t,e){return[t[0]-e[0],t[1]-e[1]]}function tz(t,e,s){return t[0]=e[0]-s[0],t[1]=e[1]-s[1],t}function tA(t,e){return[t[0]*e,t[1]*e]}function tC(t,e,s){return t[0]=e[0]*s,t[1]=e[1]*s,t}function tT(t){return[t[1],-t[0]]}function tG(t,e){let s=e[0];return t[0]=e[1],t[1]=-s,t}function tE(t,e){return t[0]*e[0]+t[1]*e[1]}function tR(t,e){let s=t[0]-e[0],r=t[1]-e[1];return s*s+r*r}function tB(t){var e;return e=Math.hypot(t[0],t[1]),[t[0]/e,t[1]/e]}function tq(t,e,s){let r=Math.sin(s),n=Math.cos(s),a=t[0]-e[0],i=t[1]-e[1];return[a*n-i*r+e[0],a*r+i*n+e[1]]}function tF(t,e,s,r){let n=Math.sin(r),a=Math.cos(r),i=e[0]-s[0],o=e[1]-s[1];return t[0]=i*a-o*n+s[0],t[1]=i*n+o*a+s[1],t}function tQ(t,e,s){return tI(t,tA(tW(e,t),s))}var tZ=[0,0],tV=[0,0],tN=[0,0];function tH(t,e,s){return!1===t||void 0===t?0:!0===t?Math.max(e,s):t}var tJ=[0,0];function tD(t){return null!=t&&t>=0}var tK=t=>Math.round(1e3*t)/1e3,tU=(t,e,s)=>t+(e-t)*s,tX=t=>Math.max(0,Math.min(1,t));function tY(t){switch(t.kind){case"rect":return[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];case"polygon":return t.points;case"circle":{let e=[];for(let s=0;s<24;s++){let r=s/24*Math.PI*2;e.push({x:t.cx+Math.cos(r)*t.r,y:t.cy+Math.sin(r)*t.r})}return e}case"ellipse":{let e=[];for(let s=0;s<28;s++){let r=s/28*Math.PI*2;e.push({x:t.cx+Math.cos(r)*t.rx,y:t.cy+Math.sin(r)*t.ry})}return e}default:return null}}function t0(t,e,s){if(t.length<2)return"";var r=function(t,e={}){return function(t,e={}){var s,r;let{size:n=16,smoothing:a=.5,thinning:i=.5,simulatePressure:o=!0,easing:l=t=>t,start:h={},end:u={},last:p=!1}=e,{cap:c=!0,easing:f=t=>t*(2-t)}=h,{cap:d=!0,easing:g=t=>--t*t*t+1}=u;if(0===t.length||n<=0)return[];let k=t[t.length-1].runningLength,y=tH(h.taper,n,k),M=tH(u.taper,n,k),m=(n*a)**2,x=[],v=[],b=t.slice(0,10).reduce((t,e)=>{let s=e.pressure;return o&&(s=tj(t,e.distance,n)),(t+s)/2},t[0].pressure),$=tO(n,i,t[t.length-1].pressure,l),P,w=t[0].vector,S=t[0].point,O=S,L=S,j=O,I=!1;for(let e=0;e<t.length;e++){let{pressure:s}=t[e],{point:r,vector:a,distance:h,runningLength:u}=t[e],p=e===t.length-1;if(!p&&k-u<3)continue;i?(o&&(s=tj(b,h,n)),$=tO(n,i,s,l)):$=n/2,void 0===P&&(P=$),$=Math.max(.01,$*Math.min(u<y?f(u/y):1,k-u<M?g((k-u)/M):1));let c=(p?t[e]:t[e+1]).vector,d=p?1:tE(a,c),_=0>tE(a,w)&&!I,W=null!==d&&d<0;if(_||W){tG(tZ,w),tC(tZ,tZ,$);for(let t=0;t<=1;t+=.07692307692307693)tz(tV,r,tZ),tF(tV,tV,r,tP*t),L=[tV[0],tV[1]],x.push(L),t_(tN,r,tZ),tF(tN,tN,r,-(tP*t)),j=[tN[0],tN[1]],v.push(j);S=L,O=j,W&&(I=!0);continue}if(I=!1,p){tG(tZ,a),tC(tZ,tZ,$),x.push(tW(r,tZ)),v.push(tI(r,tZ));continue}(function(t,e,s,r){let n=s[0]-e[0],a=s[1]-e[1];t[0]=e[0]+n*r,t[1]=e[1]+a*r})(tZ,c,a,d),tG(tZ,tZ),tC(tZ,tZ,$),tz(tV,r,tZ),L=[tV[0],tV[1]],(e<=1||tR(S,L)>m)&&(x.push(L),S=L),t_(tN,r,tZ),j=[tN[0],tN[1]],(e<=1||tR(O,j)>m)&&(v.push(j),O=j),b=s,w=a}let _=[t[0].point[0],t[0].point[1]],W=t.length>1?[t[t.length-1].point[0],t[t.length-1].point[1]]:tI(t[0].point,[1,1]),z=[],A=[];if(1===t.length){if(!(y||M)||p)return function(t,e){var s;let r=(s=tB(tT(tW(t,tI(t,[1,1])))),tI(t,tA(s,-e))),n=[],a=1/13;for(let e=a;e<=1;e+=a)n.push(tq(r,t,2*tP*e));return n}(_,P||$)}else{let e,n,a;y||M&&1===t.length||(c?z.push(...function(t,e,s){let r=[],n=1/13;for(let s=n;s<=1;s+=n)r.push(tq(e,t,tP*s));return r}(_,v[0],0)):z.push(...(n=tA(e=tW(x[0],v[0]),.5),a=tA(e,.51),[tW(_,n),tW(_,a),tI(_,a),tI(_,n)])));let i=tT([-(s=t[t.length-1].vector)[0],-s[1]]);M||y&&1===t.length?A.push(W):d?A.push(...function(t,e,s,r){let n=[],a=tI(t,tA(e,s)),i=1/29;for(let e=i;e<1;e+=i)n.push(tq(a,t,3*tP*e));return n}(W,i,$,0)):A.push(tI(W,tA(i,r=$)),tI(W,tA(i,.99*r)),tW(W,tA(i,.99*r)),tW(W,tA(i,r)))}return x.concat(A,v.reverse(),z)}(function(t,e={}){let{streamline:s=.5,size:r=16,last:n=!1}=e;if(0===t.length)return[];let a=.15+(1-s)*.85,i=Array.isArray(t[0])?t:t.map(({x:t,y:e,pressure:s=tw})=>[t,e,s]);if(2===i.length){let t=i[1];i=i.slice(0,-1);for(let e=1;e<5;e++)i.push(tQ(i[0],t,e/4))}1===i.length&&(i=[...i,[...tI(i[0],tS),...i[0].slice(2)]]);let o=[{point:[i[0][0],i[0][1]],pressure:tD(i[0][2])?i[0][2]:.25,vector:[...tS],distance:0,runningLength:0}],l=!1,h=0,u=o[0],p=i.length-1;for(let t=1;t<i.length;t++){var c,f;let e=n&&t===p?[i[t][0],i[t][1]]:tQ(u.point,i[t],a);if((c=u.point)[0]===e[0]&&c[1]===e[1])continue;let s=(f=u.point,Math.hypot(e[1]-f[1],e[0]-f[0]));if(h+=s,t<p&&!l){if(h<r)continue;l=!0}tz(tJ,u.point,e),u={point:e,pressure:tD(i[t][2])?i[t][2]:tw,vector:tB(tJ),distance:s,runningLength:h},o.push(u)}return o[0].vector=o[1]?.vector||[0,0],o}(t,e),e)}(function(t,e,s,r){let n=s?[...t,t[0]]:t,a=[];for(let t=0;t<n.length-1;t++){let r=n[t],i=n[t+1],o=Math.hypot(i.x-r.x,i.y-r.y)||1,l=Math.max(1,Math.ceil(o/14)),h=-(i.y-r.y)/o,u=(i.x-r.x)/o;for(let o=0;o<l;o++){if(t>0&&0===o)continue;let p=o/l,c=s||(0!==t||0!==o)&&(t!==n.length-2||o!==l)?(e()-.5)*2:0,f={x:tU(r.x,i.x,p)+h*c,y:tU(r.y,i.y,p)+u*c},d=tX(.52+.12*Math.sin((t+p)/Math.max(1,n.length-1)*Math.PI*2)+(e()-.5)*.16);a.push([f.x,f.y,d])}}let i=n[n.length-1];return a.push([i.x,i.y,s?a[0]?.[2]??.55:.46]),a}(t,e,s.closed,0),{size:s.width,thinning:.58,smoothing:.62,streamline:.35,simulatePressure:!1,start:{cap:!0,taper:10*!s.closed},end:{cap:!0,taper:14*!s.closed},last:!0});if(r.length<2)return"";let n=[`M${tK(r[0][0])},${tK(r[0][1])}`];for(let t=1;t<r.length;t++){let[e,s]=r[t],[a,i]=r[(t+1)%r.length];n.push(`Q${tK(e)},${tK(s)} ${tK((e+a)/2)},${tK((s+i)/2)}`)}return n.push("Z"),n.join(" ")}var t1=Object.freeze([h,tb,tv("hybrid",(t,e)=>{var r,n,a,i,o;let l=e.style?.stroke??"jittered",h=(e.style?.fill??"none")==="wash"&&void 0!==e.fill,u="freehand"===l,p=e.opacity?.fill===void 0?void 0:Number(e.opacity.fill),c=e.opacity?.stroke===void 0?void 0:Number(e.opacity.stroke);if(!h&&!u)return null;let f=[];if(h){let i,o=s((0x9e3779b9^e.seed)>>>0),l="path"===t.kind?null:tY(t);l?f.push((r=e.fill,n=p??e.style?.washOpacity??.3,a=e.style?.washEdge??.34,i=l.map(t=>({x:t.x+(o()-.5)*3,y:t.y+(o()-.5)*3})).map((t,e)=>`${e?"L":"M"}${tK(t.x)},${tK(t.y)}`).join(" ")+" Z",`<path d="${i}" fill="${r}" fill-opacity="${n}" stroke="none" />
9
+ `)}}}var tb=tv("rough"),{PI:t$}=Math,tP=t$+1e-4,tw=.5,tS=[1,1];function tO(t,e,s,r=t=>t){return t*r(.5-e*(.5-s))}var{min:tL}=Math;function tj(t,e,s){let r=tL(1,e/s);return tL(1,t+(tL(1,1-r)-t)*(.275*r))}function tI(t,e){return[t[0]+e[0],t[1]+e[1]]}function t_(t,e,s){return t[0]=e[0]+s[0],t[1]=e[1]+s[1],t}function tW(t,e){return[t[0]-e[0],t[1]-e[1]]}function tz(t,e,s){return t[0]=e[0]-s[0],t[1]=e[1]-s[1],t}function tC(t,e){return[t[0]*e,t[1]*e]}function tA(t,e,s){return t[0]=e[0]*s,t[1]=e[1]*s,t}function tT(t){return[t[1],-t[0]]}function tG(t,e){let s=e[0];return t[0]=e[1],t[1]=-s,t}function tE(t,e){return t[0]*e[0]+t[1]*e[1]}function tR(t,e){let s=t[0]-e[0],r=t[1]-e[1];return s*s+r*r}function tF(t){var e;return e=Math.hypot(t[0],t[1]),[t[0]/e,t[1]/e]}function tq(t,e,s){let r=Math.sin(s),n=Math.cos(s),a=t[0]-e[0],i=t[1]-e[1];return[a*n-i*r+e[0],a*r+i*n+e[1]]}function tB(t,e,s,r){let n=Math.sin(r),a=Math.cos(r),i=e[0]-s[0],o=e[1]-s[1];return t[0]=i*a-o*n+s[0],t[1]=i*n+o*a+s[1],t}function tQ(t,e,s){return tI(t,tC(tW(e,t),s))}var tZ=[0,0],tV=[0,0],tN=[0,0];function tH(t,e,s){return!1===t||void 0===t?0:!0===t?Math.max(e,s):t}var tD=[0,0];function tJ(t){return null!=t&&t>=0}var tU=t=>Math.round(1e3*t)/1e3,tK=(t,e,s)=>t+(e-t)*s,tX=t=>Math.max(0,Math.min(1,t));function tY(t){switch(t.kind){case"rect":return[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];case"polygon":return t.points;case"circle":{let e=[];for(let s=0;s<24;s++){let r=s/24*Math.PI*2;e.push({x:t.cx+Math.cos(r)*t.r,y:t.cy+Math.sin(r)*t.r})}return e}case"ellipse":{let e=[];for(let s=0;s<28;s++){let r=s/28*Math.PI*2;e.push({x:t.cx+Math.cos(r)*t.rx,y:t.cy+Math.sin(r)*t.ry})}return e}default:return null}}function t0(t,e,s){if(t.length<2)return"";var r=function(t,e={}){return function(t,e={}){var s,r;let{size:n=16,smoothing:a=.5,thinning:i=.5,simulatePressure:o=!0,easing:l=t=>t,start:h={},end:u={},last:p=!1}=e,{cap:c=!0,easing:f=t=>t*(2-t)}=h,{cap:d=!0,easing:g=t=>--t*t*t+1}=u;if(0===t.length||n<=0)return[];let k=t[t.length-1].runningLength,y=tH(h.taper,n,k),M=tH(u.taper,n,k),m=(n*a)**2,x=[],v=[],b=t.slice(0,10).reduce((t,e)=>{let s=e.pressure;return o&&(s=tj(t,e.distance,n)),(t+s)/2},t[0].pressure),$=tO(n,i,t[t.length-1].pressure,l),P,w=t[0].vector,S=t[0].point,O=S,L=S,j=O,I=!1;for(let e=0;e<t.length;e++){let{pressure:s}=t[e],{point:r,vector:a,distance:h,runningLength:u}=t[e],p=e===t.length-1;if(!p&&k-u<3)continue;i?(o&&(s=tj(b,h,n)),$=tO(n,i,s,l)):$=n/2,void 0===P&&(P=$),$=Math.max(.01,$*Math.min(u<y?f(u/y):1,k-u<M?g((k-u)/M):1));let c=(p?t[e]:t[e+1]).vector,d=p?1:tE(a,c),_=0>tE(a,w)&&!I,W=null!==d&&d<0;if(_||W){tG(tZ,w),tA(tZ,tZ,$);for(let t=0;t<=1;t+=.07692307692307693)tz(tV,r,tZ),tB(tV,tV,r,tP*t),L=[tV[0],tV[1]],x.push(L),t_(tN,r,tZ),tB(tN,tN,r,-(tP*t)),j=[tN[0],tN[1]],v.push(j);S=L,O=j,W&&(I=!0);continue}if(I=!1,p){tG(tZ,a),tA(tZ,tZ,$),x.push(tW(r,tZ)),v.push(tI(r,tZ));continue}(function(t,e,s,r){let n=s[0]-e[0],a=s[1]-e[1];t[0]=e[0]+n*r,t[1]=e[1]+a*r})(tZ,c,a,d),tG(tZ,tZ),tA(tZ,tZ,$),tz(tV,r,tZ),L=[tV[0],tV[1]],(e<=1||tR(S,L)>m)&&(x.push(L),S=L),t_(tN,r,tZ),j=[tN[0],tN[1]],(e<=1||tR(O,j)>m)&&(v.push(j),O=j),b=s,w=a}let _=[t[0].point[0],t[0].point[1]],W=t.length>1?[t[t.length-1].point[0],t[t.length-1].point[1]]:tI(t[0].point,[1,1]),z=[],C=[];if(1===t.length){if(!(y||M)||p)return function(t,e){var s;let r=(s=tF(tT(tW(t,tI(t,[1,1])))),tI(t,tC(s,-e))),n=[],a=1/13;for(let e=a;e<=1;e+=a)n.push(tq(r,t,2*tP*e));return n}(_,P||$)}else{let e,n,a;y||M&&1===t.length||(c?z.push(...function(t,e,s){let r=[],n=1/13;for(let s=n;s<=1;s+=n)r.push(tq(e,t,tP*s));return r}(_,v[0],0)):z.push(...(n=tC(e=tW(x[0],v[0]),.5),a=tC(e,.51),[tW(_,n),tW(_,a),tI(_,a),tI(_,n)])));let i=tT([-(s=t[t.length-1].vector)[0],-s[1]]);M||y&&1===t.length?C.push(W):d?C.push(...function(t,e,s,r){let n=[],a=tI(t,tC(e,s)),i=1/29;for(let e=i;e<1;e+=i)n.push(tq(a,t,3*tP*e));return n}(W,i,$,0)):C.push(tI(W,tC(i,r=$)),tI(W,tC(i,.99*r)),tW(W,tC(i,.99*r)),tW(W,tC(i,r)))}return x.concat(C,v.reverse(),z)}(function(t,e={}){let{streamline:s=.5,size:r=16,last:n=!1}=e;if(0===t.length)return[];let a=.15+(1-s)*.85,i=Array.isArray(t[0])?t:t.map(({x:t,y:e,pressure:s=tw})=>[t,e,s]);if(2===i.length){let t=i[1];i=i.slice(0,-1);for(let e=1;e<5;e++)i.push(tQ(i[0],t,e/4))}1===i.length&&(i=[...i,[...tI(i[0],tS),...i[0].slice(2)]]);let o=[{point:[i[0][0],i[0][1]],pressure:tJ(i[0][2])?i[0][2]:.25,vector:[...tS],distance:0,runningLength:0}],l=!1,h=0,u=o[0],p=i.length-1;for(let t=1;t<i.length;t++){var c,f;let e=n&&t===p?[i[t][0],i[t][1]]:tQ(u.point,i[t],a);if((c=u.point)[0]===e[0]&&c[1]===e[1])continue;let s=(f=u.point,Math.hypot(e[1]-f[1],e[0]-f[0]));if(h+=s,t<p&&!l){if(h<r)continue;l=!0}tz(tD,u.point,e),u={point:e,pressure:tJ(i[t][2])?i[t][2]:tw,vector:tF(tD),distance:s,runningLength:h},o.push(u)}return o[0].vector=o[1]?.vector||[0,0],o}(t,e),e)}(function(t,e,s,r){let n=s?[...t,t[0]]:t,a=[];for(let t=0;t<n.length-1;t++){let r=n[t],i=n[t+1],o=Math.hypot(i.x-r.x,i.y-r.y)||1,l=Math.max(1,Math.ceil(o/14)),h=-(i.y-r.y)/o,u=(i.x-r.x)/o;for(let o=0;o<l;o++){if(t>0&&0===o)continue;let p=o/l,c=s||(0!==t||0!==o)&&(t!==n.length-2||o!==l)?(e()-.5)*2:0,f={x:tK(r.x,i.x,p)+h*c,y:tK(r.y,i.y,p)+u*c},d=tX(.52+.12*Math.sin((t+p)/Math.max(1,n.length-1)*Math.PI*2)+(e()-.5)*.16);a.push([f.x,f.y,d])}}let i=n[n.length-1];return a.push([i.x,i.y,s?a[0]?.[2]??.55:.46]),a}(t,e,s.closed,0),{size:s.width,thinning:.58,smoothing:.62,streamline:.35,simulatePressure:!1,start:{cap:!0,taper:10*!s.closed},end:{cap:!0,taper:14*!s.closed},last:!0});if(r.length<2)return"";let n=[`M${tU(r[0][0])},${tU(r[0][1])}`];for(let t=1;t<r.length;t++){let[e,s]=r[t],[a,i]=r[(t+1)%r.length];n.push(`Q${tU(e)},${tU(s)} ${tU((e+a)/2)},${tU((s+i)/2)}`)}return n.push("Z"),n.join(" ")}var t1=Object.freeze([h,tb,tv("hybrid",(t,e)=>{var r,n,a,i,o;let l=e.style?.stroke??"jittered",h=(e.style?.fill??"none")==="wash"&&void 0!==e.fill,u="freehand"===l,p=e.opacity?.fill===void 0?void 0:Number(e.opacity.fill),c=e.opacity?.stroke===void 0?void 0:Number(e.opacity.stroke);if(!h&&!u)return null;let f=[];if(h){let i,o=s((0x9e3779b9^e.seed)>>>0),l="path"===t.kind?null:tY(t);l?f.push((r=e.fill,n=p??e.style?.washOpacity??.3,a=e.style?.washEdge??.34,i=l.map(t=>({x:t.x+(o()-.5)*3,y:t.y+(o()-.5)*3})).map((t,e)=>`${e?"L":"M"}${tU(t.x)},${tU(t.y)}`).join(" ")+" Z",`<path d="${i}" fill="${r}" fill-opacity="${n}" stroke="none" />
10
10
  <path d="${i}" fill="none" stroke="${r}" stroke-width="1.4" stroke-opacity="${a}" />`)):"path"===t.kind&&f.push(`<path d="${t.d}" fill="${e.fill}" fill-opacity="${p??e.style?.washOpacity??.3}" stroke="${e.fill}" stroke-width="1.4" stroke-opacity="${e.style?.washEdge??.34}" />`)}if(u&&!e.dash){let r=s(e.seed||1),n=Math.max(2.5,2.2*e.width),a="";if("polyline"===t.kind)a=t0(t.points,r,{width:n,closed:!1});else if("line"===t.kind)a=t0([{x:t.x1,y:t.y1},{x:t.x2,y:t.y2}],r,{width:n,closed:!1});else{let e=tY(t);e&&(a=t0(e,r,{width:n,closed:!0}))}if(a){let t=e.strokeProjection?[...void 0!==e.strokeProjection.opacity?[`opacity="${g(String(e.strokeProjection.opacity))}"`]:[],...void 0!==e.strokeProjection.paintOrder?[`paint-order="${g(e.strokeProjection.paintOrder)}"`]:[],...void 0!==e.strokeProjection.mixBlendMode?[`style="mix-blend-mode:${e.strokeProjection.mixBlendMode}"`]:[]].join(" "):"",s=void 0===c?"":` fill-opacity="${g(String(c))}"`;return f.push(`<path d="${a}" fill="${e.stroke}" stroke="none"${s}${t?` ${t}`:""} />`),f.join(`
11
11
  `)}}let d=(i=e.seed,o=e.stroke,tc(t,i,o,e.width,h?void 0:e.fill,e.p,e.dash,e.strokeProjection,e.opacity));return d&&f.push(d),f.length>0?f.join(`
12
12
  `):null})]);for(let t of t1)t!==h&&p(t);export{t1 as BUILTIN_BACKENDS};
@@ -1,4 +1,4 @@
1
- import{A as e,B as t,C as i,F as a,G as r,b as n,c as o,d as s,e as l,f as c,h as d,i as u,j as f,k as p,m as m,n as g,p as h,q as y,s as v,u as b,v as S,z as $}from"./chunk-55WS466K.js";import{a as w,b as x,c as C,e as O,g as j,i as k,l as E,m as F,n as A,o as I,p as T}from"./chunk-3A6S6GNB.js";import{a as z,ba as D,c as L,m as M,va as R}from"./chunk-6J4BGPB2.js";import{a as q,b as N,d as P,e as B,ia as W,ja as _,ka as V,la as J,ma as G,na as H,v as U,w as K}from"./chunk-IARQ24W3.js";function Y(e){return q(e)?e:void 0}function X(e,t){let i=e.$ref;if("string"!=typeof i||!i.startsWith("#/"))return;let a=t;for(let e of i.slice(2).split("/")){if(!q(a))return;a=a[e.replaceAll("~1","/").replaceAll("~0","~")]}return Y(a)}function Q(e,t,i=t,a=[],r={}){let n="field"===r.diagnostics,o=(e,t,i,a,s)=>{let l=Y(t.$defs)?t:i,c=(e,t=!0)=>[{path:a,message:e,generic:t}];if(void 0!==t.$ref){let i=X(t,l);return i?o(e,i,l,a,s):c(n?"uses an unresolved schema reference":`uses unresolved schema reference ${String(t.$ref)}`,!1)}let d=Array.isArray(t.anyOf)?t.anyOf.map(Y).filter(e=>void 0!==e):[];if(d.length>0){let i=n?d.filter(t=>(function e(t,i,a){let r=X(i,a);if(r)return e(t,r,a);let n=Array.isArray(i.anyOf)?i.anyOf.map(Y).filter(e=>void 0!==e):[];if(n.length>0)return n.some(i=>e(t,i,a));switch(i.type){case"null":return null===t;case"string":return"string"==typeof t;case"number":case"integer":return"number"==typeof t;case"boolean":return"boolean"==typeof t;case"array":return Array.isArray(t);case"object":return q(t);default:return!0}})(e,t,l)):[],r=(i.length>0?i:d).map(t=>o(e,t,l,a,new Set(s)));if(!r.some(e=>0===e.length)){let e=t["x-agentic-mermaid-validation-expectation"];return n&&0!==i.length||"string"!=typeof e?r.sort((e,t)=>e.length-t.length)[0]??c("must match an allowed shape"):c(`must be ${e}`)}}let u=Array.isArray(t.oneOf)?t.oneOf.map(Y).filter(e=>void 0!==e):[];if(u.length>0&&!n){let t=u.filter(t=>0===o(e,t,l,a,new Set(s)).length);if(1!==t.length)return c(`must match exactly one allowed shape (matched ${t.length})`)}let f=n?(e,t)=>e===t:Object.is;if(Object.prototype.hasOwnProperty.call(t,"const")&&!f(e,t.const))return c(`must equal ${String(t.const)}`);if(Array.isArray(t.enum)&&!(n?t.enum.includes(e):t.enum.some(t=>Object.is(t,e))))return c(`must be one of ${t.enum.map(String).join(" | ")}`);let p=t.type;if(!(void 0===p||"null"===p&&null===e||"string"===p&&"string"==typeof e||"number"===p&&"number"==typeof e&&Number.isFinite(e)||"integer"===p&&"number"==typeof e&&Number.isFinite(e)&&Number.isInteger(e)||"boolean"===p&&"boolean"==typeof e||"array"===p&&Array.isArray(e)||"object"===p&&q(e))){let e="number"===p?"a finite number":"integer"===p?"a finite integer":"object"===p?"a plain JSON object":"array"===p?"an array":"null"===p?"null":`a ${String(p)}`;return c(`must be ${e}`)}if("number"==typeof e){if("number"==typeof t.minimum&&e<t.minimum)return c(`must be at least ${t.minimum}`);if("number"==typeof t.exclusiveMinimum&&e<=t.exclusiveMinimum)return c(`must be greater than ${t.exclusiveMinimum}`);if("number"==typeof t.maximum&&e>t.maximum)return c(`must be at most ${t.maximum}`)}if("string"==typeof e){if("number"==typeof t.minLength&&e.length<t.minLength)return c(`must contain at least ${t.minLength} character${1===t.minLength?"":"s"}`);if("string"==typeof t.pattern){let i;try{i=new RegExp(t.pattern,n?void 0:"u").test(e)}catch{return c("uses an invalid schema pattern",!1)}if(!i)return c(r.patternMismatch?.(t)??`must match ${t.pattern}`)}if("number"==typeof t.maxLength&&e.length>t.maxLength)return c(`must contain at most ${t.maxLength} characters`)}if(Array.isArray(e)&&"array"===p){if("number"==typeof t.minItems&&e.length<t.minItems)return c(`must contain at least ${t.minItems} item${1===t.minItems?"":"s"}`);if("number"==typeof t.maxItems&&e.length>t.maxItems)return c(`must contain at most ${t.maxItems} items`);if(s.has(e))return c("must be acyclic",!1);let i=Y(t.items);if(i){s.add(e);try{let t=e.flatMap((e,t)=>o(e,i,l,[...a,t],s));if(t.length>0)return t}finally{s.delete(e)}}}if(q(e)&&("object"===p||void 0!==t.properties||void 0!==t.required||void 0!==t.additionalProperties)){if(s.has(e))return c("must be acyclic",!1);s.add(e);try{let i=Y(t.properties)??{},r=Array.isArray(t.required)?t.required.filter(e=>"string"==typeof e):[],n=[];for(let t of r)Object.prototype.hasOwnProperty.call(e,t)||n.push({path:[...a,t],message:"is required",generic:!1});for(let[r,c]of Object.entries(e)){if(x(r)){n.push({path:[...a,r],message:"uses a forbidden prototype key",generic:!1});continue}let e=Y(i[r]);if(e){n.push(...o(c,e,l,[...a,r],s));continue}if(!1===t.additionalProperties){n.push({path:[...a,r],message:"is not allowed",generic:!1});continue}let d=Y(t.additionalProperties);d&&n.push(...o(c,d,l,[...a,r],s))}if(n.length>0)return n}finally{s.delete(e)}}return r.validateRuntime?.(e,t,a)??[]};return o(e,t,i,a,new Set)}var Z,ee=new Set(Object.values(e).flat()),et=new Set(["primaryTextColor","textColor","nodeTextColor","secondaryTextColor","tertiaryTextColor"]),ei=new Set([...Array.from({length:12},(e,t)=>`pie${t+1}`),"pieStrokeColor","pieOuterStrokeColor","pieSectionTextColor","pieTitleTextColor","pieLegendTextColor"]),ea=new Set(["pieSectionTextColor","pieTitleTextColor","pieLegendTextColor"]),er=new Set([...Array.from({length:8},(e,t)=>[`git${t}`,`gitBranchLabel${t}`,`gitInv${t}`]).flat(),"commitLabelColor","commitLabelBackground"]),en=new Set([...Array.from({length:8},(e,t)=>`gitBranchLabel${t}`),"commitLabelColor"]),eo=new Set(Array.from({length:12},(e,t)=>[`cScale${t}`,`cScaleLabel${t}`,`cScaleInv${t}`]).flat()),es=new Set([...Array.from({length:12},(e,t)=>`cScale${t}`),"titleColor"]),el=new Set(["clusterBkg","clusterBorder"]),ec=["backgroundColor","titleColor","xAxisLabelColor","xAxisTickColor","xAxisLineColor","xAxisTitleColor","yAxisLabelColor","yAxisTickColor","yAxisLineColor","yAxisTitleColor","legendTextColor","dataLabelColor"],ed=new Set(["xAxisTickColor","xAxisLineColor","yAxisTickColor","yAxisLineColor"]),eu=[["bg",e.bg],["surface",e.surface],["line",e.line],["accent",e.accent]];function ef(e,t=!1){let i="string"==typeof e?e:JSON.stringify(e)??String(e);return t&&i.length>256?`${i.slice(0,256)}\u2026`:i}var ep=class extends Error{code="INVALID_THEME_COLOR";key;value;constructor(e,t,i){let a=ef(t,!0);super(m({what:`themeVariables.${e}: ${JSON.stringify(a)} is not a CSS color`,expectedForm:G(i),example:`themeVariables.${e}:#f96`}).message),this.name="ThemeVariableColorError",this.key=e,this.value=a}},em=class extends Error{code="INVALID_RENDER_COLOR";field;value;constructor(e,t){let i=ef(t,!0);super(m({what:`render option "${e}": ${JSON.stringify(i)} is not a CSS color for Architecture derived paint`,expectedForm:"a drawable CSS color or var(--name)",example:`${e}:#f96`}).message),this.name="RenderOptionColorError",this.field=e,this.value=i}},eg=class extends Error{code="INVALID_CONFIG_COLOR";path;value;constructor(e,t,i,a){let r=ef(t,!0),n=ef(e,!0);super(m({what:`${n}: ${JSON.stringify(r)} is not ${"array"===a?"an array of CSS colors":"map"===a?"a map of CSS colors":"a CSS color"}`,expectedForm:a?"array"===a?"an array of drawable CSS colors":"an object mapping node labels to drawable CSS colors":G(i),example:`${n}${"array"===a?': ["#f96"]':"map"===a?': {"A":"#f96"}':": #f96"}`}).message),this.name="FamilyConfigColorError",this.path=n,this.value=r}};function eh(e){return null===e||"object"!=typeof e||Array.isArray(e)?void 0:e}function ey(e,t,i,a){let r=e[i];if(void 0!==r&&void 0===J(r,a))throw new eg(`${t}.${i}`,r,a)}function ev(e,t,i,a){let r=e[i];if(void 0!==r){if(!Array.isArray(r))throw new eg(`${t}.${i}`,r,a,"array");for(let e=0;e<r.length;e++){let n=r[e];if(void 0===J(n,a))throw new eg(`${t}.${i}[${e}]`,n,a)}}}function eb(e,t,i,a){if(!e)return;let r="pie"===t?ei:"gitgraph"===t?er:"timeline"===t?eo:"radar"===t?es:"architecture"===t?el:void 0,n=r?new Set([...ee,...r]):ee,o="architecture"===t?new Set(eu.flatMap(([t,r])=>i?.[t]!==void 0||"surface"===t&&a&&(a?.groupHeaderSurface||a?.groupSurface?.trim().toLowerCase()!=="none")||("line"===t||"accent"===t)&&a?.edgeStroke?[]:r.find(t=>{let i=e[t];return"string"==typeof i&&i.length>0})??[])):void 0;for(let i of n){if(!Object.hasOwn(e,i))continue;let r=e[i];if(void 0===r)continue;let n=ef(r),s=et.has(i)||ea.has(i)||en.has(i)||"timeline"===t&&eo.has(i)||"radar"===t&&es.has(i)||"architecture"===t&&("clusterBkg"===i&&(!a||!a.groupHeaderSurface&&a.groupSurface?.trim().toLowerCase()==="none")||o?.has(i));if(void 0===J(r,!s))throw new ep(i,n,!s)}if("radar"===t){let t=eh(e.radar);if(!t)return;for(let e of["axisColor","graticuleColor"]){let i=t[e];if(void 0===i)continue;let a="graticuleColor"===e,r=ef(i);if(void 0===J(i,a))throw new ep(`radar.${e}`,r,a)}}if("xychart"===t){let t=eh(e.xyChart);if(!t)return;for(let e of ec){if("backgroundColor"===e&&i?.bg!==void 0)continue;let a=t[e];if(void 0===a)continue;let r=ed.has(e),n=ef(a);if(void 0===J(a,r))throw new ep(`xyChart.${e}`,n,r)}let a=t.plotColorPalette;if(void 0!==a&&("string"!=typeof a||0!==a.trim().length)){let e="string"==typeof a?_(a):a;if(!Array.isArray(e))throw new ep("xyChart.plotColorPalette",JSON.stringify(a)??String(a),!1);for(let[t,i]of e.entries()){let e="string"==typeof i?i.trim():JSON.stringify(i)??String(i);if(void 0===J(i))throw new ep(`xyChart.plotColorPalette[${t}]`,e,!1)}}}if("architecture"===t&&("string"!=typeof e.mainBkg||0===e.mainBkg.length)){let t=e.secondaryColor;if(void 0!==t){let e=ef(t);if(void 0===J(t,!0))throw new ep("secondaryColor",e,!0)}}}var eS={schemaVersion:2,provenance:{version:"12.2.0"},families:[{id:"flowchart",headers:[{value:"flowchart",agenticStatus:"native"},{value:"graph",agenticStatus:"native"},{value:"flowchart-elk",agenticStatus:"unsupported"}]},{id:"swimlane",headers:[{value:"swimlane-beta",agenticStatus:"unsupported"}]},{id:"sequence",headers:[{value:"sequenceDiagram",agenticStatus:"native"}]},{id:"class",headers:[{value:"classDiagram",agenticStatus:"native"},{value:"classDiagram-v2",agenticStatus:"native"}]},{id:"state",headers:[{value:"stateDiagram",agenticStatus:"native"},{value:"stateDiagram-v2",agenticStatus:"native"}]},{id:"er",headers:[{value:"erDiagram",agenticStatus:"native"}]},{id:"journey",headers:[{value:"journey",agenticStatus:"native"}]},{id:"gantt",headers:[{value:"gantt",agenticStatus:"native"}]},{id:"pie",headers:[{value:"pie",agenticStatus:"native"}]},{id:"quadrant",headers:[{value:"quadrantChart",agenticStatus:"native"}]},{id:"requirement",headers:[{value:"requirementDiagram",agenticStatus:"native"},{value:"requirement",agenticStatus:"native"}]},{id:"gitgraph",headers:[{value:"gitGraph",agenticStatus:"native"}]},{id:"c4",headers:[{value:"C4Context",agenticStatus:"native"},{value:"C4Container",agenticStatus:"native"},{value:"C4Component",agenticStatus:"native"},{value:"C4Dynamic",agenticStatus:"native"},{value:"C4Deployment",agenticStatus:"native"}]},{id:"mindmap",headers:[{value:"mindmap",agenticStatus:"native"}]},{id:"timeline",headers:[{value:"timeline",agenticStatus:"native"}]},{id:"zenuml",headers:[{value:"zenuml",agenticStatus:"native"}]},{id:"sankey",headers:[{value:"sankey",agenticStatus:"native"},{value:"sankey-beta",agenticStatus:"native"}]},{id:"xychart",headers:[{value:"xychart",agenticStatus:"native"},{value:"xychart-beta",agenticStatus:"native"}]},{id:"block",headers:[{value:"block",agenticStatus:"native"},{value:"block-beta",agenticStatus:"native"}]},{id:"packet",headers:[{value:"packet",agenticStatus:"native"},{value:"packet-beta",agenticStatus:"native"}]},{id:"kanban",headers:[{value:"kanban",agenticStatus:"native"}]},{id:"architecture",headers:[{value:"architecture",agenticStatus:"native"},{value:"architecture-beta",agenticStatus:"native"}]},{id:"radar",headers:[{value:"radar-beta",agenticStatus:"native"}]},{id:"eventmodeling",headers:[{value:"eventmodeling",agenticStatus:"native"}]},{id:"treemap",headers:[{value:"treemap",agenticStatus:"native"},{value:"treemap-beta",agenticStatus:"native"}]},{id:"venn",headers:[{value:"venn-beta",agenticStatus:"unsupported"}]},{id:"ishikawa",headers:[{value:"ishikawa",agenticStatus:"native"},{value:"ishikawa-beta",agenticStatus:"native"}]},{id:"wardley",headers:[{value:"wardley-beta",agenticStatus:"unsupported"}]},{id:"cynefin",headers:[{value:"cynefin-beta",agenticStatus:"unsupported"}]},{id:"treeview",headers:[{value:"treeView-beta",agenticStatus:"unsupported"}]},{id:"railroad",headers:[{value:"railroad-beta",agenticStatus:"unsupported"},{value:"railroad-ebnf-beta",agenticStatus:"unsupported"},{value:"railroad-abnf-beta",agenticStatus:"unsupported"},{value:"railroad-peg-beta",agenticStatus:"unsupported"}]},{id:"agentflow",headers:[{value:"agentflow-beta",agenticStatus:"unsupported"}]},{id:"usecase",headers:[{value:"usecase-beta",agenticStatus:"unsupported"}]}]};function e$(e,t,i,a){let r=g(e),l=-1,d=-1,u=e.length,m=Math.max(0,Math.min(e.length,i??0)),$=m;for(;$<=e.length;){let i=/\r\n?|\n/g;i.lastIndex=$;let a=i.exec(e),r=a?.index??-1,n=r<0?e.length:r,o=e.slice($,n).replace(/\r$/,""),c=o.trim(),f=c.startsWith(t)?c.slice(t.length):"",p=/^\s*;/.test(f);if(c===t||p||/^\s/.test(f)&&s(c)!==c){if(d=(l=$+o.indexOf(t))+t.length,c===t)u=a?a.index+a[0].length:e.length;else for(u=p?e.indexOf(";",d)+1:d;u<n&&/[ \t]/.test(e[u]);)u++;break}if(r<0)break;$=a.index+a[0].length}if(l<0){let i=e.indexOf(t,m);l=i<0?m:i,d=Math.min(e.length,l+t.length);let a=e.indexOf(`
1
+ import{A as e,B as t,C as i,F as a,G as r,b as n,c as o,d as s,e as l,f as c,h as d,i as u,j as f,k as p,m as m,n as g,p as h,q as y,s as v,u as b,v as S,z as $}from"./chunk-ZGLUBUQJ.js";import{a as w,b as x,c as C,e as O,g as j,i as k,l as E,m as F,n as A,o as I,p as T}from"./chunk-TEDVLVJM.js";import{a as D,ba as z,c as L,m as M,va as q}from"./chunk-WUHZDXTF.js";import{a as R,b as N,d as P,e as B,ia as _,ja as W,ka as V,la as J,ma as H,na as G,v as U,w as K}from"./chunk-KCHXQ5UA.js";function Y(e){return R(e)?e:void 0}function X(e,t){let i=e.$ref;if("string"!=typeof i||!i.startsWith("#/"))return;let a=t;for(let e of i.slice(2).split("/")){if(!R(a))return;a=a[e.replaceAll("~1","/").replaceAll("~0","~")]}return Y(a)}function Z(e,t,i=t,a=[],r={}){let n="field"===r.diagnostics,o=(e,t,i,a,s)=>{let l=Y(t.$defs)?t:i,c=(e,t=!0)=>[{path:a,message:e,generic:t}];if(void 0!==t.$ref){let i=X(t,l);return i?o(e,i,l,a,s):c(n?"uses an unresolved schema reference":`uses unresolved schema reference ${String(t.$ref)}`,!1)}let d=Array.isArray(t.anyOf)?t.anyOf.map(Y).filter(e=>void 0!==e):[];if(d.length>0){let i=n?d.filter(t=>(function e(t,i,a){let r=X(i,a);if(r)return e(t,r,a);let n=Array.isArray(i.anyOf)?i.anyOf.map(Y).filter(e=>void 0!==e):[];if(n.length>0)return n.some(i=>e(t,i,a));switch(i.type){case"null":return null===t;case"string":return"string"==typeof t;case"number":case"integer":return"number"==typeof t;case"boolean":return"boolean"==typeof t;case"array":return Array.isArray(t);case"object":return R(t);default:return!0}})(e,t,l)):[],r=(i.length>0?i:d).map(t=>o(e,t,l,a,new Set(s)));if(!r.some(e=>0===e.length)){let e=t["x-agentic-mermaid-validation-expectation"];return n&&0!==i.length||"string"!=typeof e?r.sort((e,t)=>e.length-t.length)[0]??c("must match an allowed shape"):c(`must be ${e}`)}}let u=Array.isArray(t.oneOf)?t.oneOf.map(Y).filter(e=>void 0!==e):[];if(u.length>0&&!n){let t=u.filter(t=>0===o(e,t,l,a,new Set(s)).length);if(1!==t.length)return c(`must match exactly one allowed shape (matched ${t.length})`)}let f=n?(e,t)=>e===t:Object.is;if(Object.prototype.hasOwnProperty.call(t,"const")&&!f(e,t.const))return c(`must equal ${String(t.const)}`);if(Array.isArray(t.enum)&&!(n?t.enum.includes(e):t.enum.some(t=>Object.is(t,e))))return c(`must be one of ${t.enum.map(String).join(" | ")}`);let p=t.type;if(!(void 0===p||"null"===p&&null===e||"string"===p&&"string"==typeof e||"number"===p&&"number"==typeof e&&Number.isFinite(e)||"integer"===p&&"number"==typeof e&&Number.isFinite(e)&&Number.isInteger(e)||"boolean"===p&&"boolean"==typeof e||"array"===p&&Array.isArray(e)||"object"===p&&R(e))){let e="number"===p?"a finite number":"integer"===p?"a finite integer":"object"===p?"a plain JSON object":"array"===p?"an array":"null"===p?"null":`a ${String(p)}`;return c(`must be ${e}`)}if("number"==typeof e){if("number"==typeof t.minimum&&e<t.minimum)return c(`must be at least ${t.minimum}`);if("number"==typeof t.exclusiveMinimum&&e<=t.exclusiveMinimum)return c(`must be greater than ${t.exclusiveMinimum}`);if("number"==typeof t.maximum&&e>t.maximum)return c(`must be at most ${t.maximum}`)}if("string"==typeof e){if("number"==typeof t.minLength&&e.length<t.minLength)return c(`must contain at least ${t.minLength} character${1===t.minLength?"":"s"}`);if("string"==typeof t.pattern){let i;try{i=new RegExp(t.pattern,n?void 0:"u").test(e)}catch{return c("uses an invalid schema pattern",!1)}if(!i)return c(r.patternMismatch?.(t)??`must match ${t.pattern}`)}if("number"==typeof t.maxLength&&e.length>t.maxLength)return c(`must contain at most ${t.maxLength} characters`)}if(Array.isArray(e)&&"array"===p){if("number"==typeof t.minItems&&e.length<t.minItems)return c(`must contain at least ${t.minItems} item${1===t.minItems?"":"s"}`);if("number"==typeof t.maxItems&&e.length>t.maxItems)return c(`must contain at most ${t.maxItems} items`);if(s.has(e))return c("must be acyclic",!1);let i=Y(t.items);if(i){s.add(e);try{let t=e.flatMap((e,t)=>o(e,i,l,[...a,t],s));if(t.length>0)return t}finally{s.delete(e)}}}if(R(e)&&("object"===p||void 0!==t.properties||void 0!==t.required||void 0!==t.additionalProperties)){if(s.has(e))return c("must be acyclic",!1);s.add(e);try{let i=Y(t.properties)??{},r=Array.isArray(t.required)?t.required.filter(e=>"string"==typeof e):[],n=[];for(let t of r)Object.prototype.hasOwnProperty.call(e,t)||n.push({path:[...a,t],message:"is required",generic:!1});for(let[r,c]of Object.entries(e)){if(x(r)){n.push({path:[...a,r],message:"uses a forbidden prototype key",generic:!1});continue}let e=Y(i[r]);if(e){n.push(...o(c,e,l,[...a,r],s));continue}if(!1===t.additionalProperties){n.push({path:[...a,r],message:"is not allowed",generic:!1});continue}let d=Y(t.additionalProperties);d&&n.push(...o(c,d,l,[...a,r],s))}if(n.length>0)return n}finally{s.delete(e)}}return r.validateRuntime?.(e,t,a)??[]};return o(e,t,i,a,new Set)}var Q,ee=new Set(Object.values(e).flat()),et=new Set(["primaryTextColor","textColor","nodeTextColor","secondaryTextColor","tertiaryTextColor"]),ei=new Set([...Array.from({length:12},(e,t)=>`pie${t+1}`),"pieStrokeColor","pieOuterStrokeColor","pieSectionTextColor","pieTitleTextColor","pieLegendTextColor"]),ea=new Set(["pieSectionTextColor","pieTitleTextColor","pieLegendTextColor"]),er=new Set([...Array.from({length:8},(e,t)=>[`git${t}`,`gitBranchLabel${t}`,`gitInv${t}`]).flat(),"commitLabelColor","commitLabelBackground"]),en=new Set([...Array.from({length:8},(e,t)=>`gitBranchLabel${t}`),"commitLabelColor"]),eo=new Set(Array.from({length:12},(e,t)=>[`cScale${t}`,`cScaleLabel${t}`,`cScaleInv${t}`]).flat()),es=new Set([...Array.from({length:12},(e,t)=>`cScale${t}`),"titleColor"]),el=new Set(["clusterBkg","clusterBorder"]),ec=["backgroundColor","titleColor","xAxisLabelColor","xAxisTickColor","xAxisLineColor","xAxisTitleColor","yAxisLabelColor","yAxisTickColor","yAxisLineColor","yAxisTitleColor","legendTextColor","dataLabelColor"],ed=new Set(["xAxisTickColor","xAxisLineColor","yAxisTickColor","yAxisLineColor"]),eu=[["bg",e.bg],["surface",e.surface],["line",e.line],["accent",e.accent]];function ef(e,t=!1){let i="string"==typeof e?e:JSON.stringify(e)??String(e);return t&&i.length>256?`${i.slice(0,256)}\u2026`:i}var ep=class extends Error{code="INVALID_THEME_COLOR";key;value;constructor(e,t,i){let a=ef(t,!0);super(m({what:`themeVariables.${e}: ${JSON.stringify(a)} is not a CSS color`,expectedForm:H(i),example:`themeVariables.${e}:#f96`}).message),this.name="ThemeVariableColorError",this.key=e,this.value=a}},em=class extends Error{code="INVALID_RENDER_COLOR";field;value;constructor(e,t){let i=ef(t,!0);super(m({what:`render option "${e}": ${JSON.stringify(i)} is not a CSS color for Architecture derived paint`,expectedForm:"a drawable CSS color or var(--name)",example:`${e}:#f96`}).message),this.name="RenderOptionColorError",this.field=e,this.value=i}},eg=class extends Error{code="INVALID_CONFIG_COLOR";path;value;constructor(e,t,i,a){let r=ef(t,!0),n=ef(e,!0);super(m({what:`${n}: ${JSON.stringify(r)} is not ${"array"===a?"an array of CSS colors":"map"===a?"a map of CSS colors":"a CSS color"}`,expectedForm:a?"array"===a?"an array of drawable CSS colors":"an object mapping node labels to drawable CSS colors":H(i),example:`${n}${"array"===a?': ["#f96"]':"map"===a?': {"A":"#f96"}':": #f96"}`}).message),this.name="FamilyConfigColorError",this.path=n,this.value=r}};function eh(e){return null===e||"object"!=typeof e||Array.isArray(e)?void 0:e}function ey(e,t,i,a){let r=e[i];if(void 0!==r&&void 0===J(r,a))throw new eg(`${t}.${i}`,r,a)}function ev(e,t,i,a){let r=e[i];if(void 0!==r){if(!Array.isArray(r))throw new eg(`${t}.${i}`,r,a,"array");for(let e=0;e<r.length;e++){let n=r[e];if(void 0===J(n,a))throw new eg(`${t}.${i}[${e}]`,n,a)}}}function eb(e,t,i,a){if(!e)return;let r="pie"===t?ei:"gitgraph"===t?er:"timeline"===t?eo:"radar"===t?es:"architecture"===t?el:void 0,n=r?new Set([...ee,...r]):ee,o="architecture"===t?new Set(eu.flatMap(([t,r])=>i?.[t]!==void 0||"surface"===t&&a&&(a?.groupHeaderSurface||a?.groupSurface?.trim().toLowerCase()!=="none")||("line"===t||"accent"===t)&&a?.edgeStroke?[]:r.find(t=>{let i=e[t];return"string"==typeof i&&i.length>0})??[])):void 0;for(let i of n){if(!Object.hasOwn(e,i))continue;let r=e[i];if(void 0===r)continue;let n=ef(r),s=et.has(i)||ea.has(i)||en.has(i)||"timeline"===t&&eo.has(i)||"radar"===t&&es.has(i)||"architecture"===t&&("clusterBkg"===i&&(!a||!a.groupHeaderSurface&&a.groupSurface?.trim().toLowerCase()==="none")||o?.has(i));if(void 0===J(r,!s))throw new ep(i,n,!s)}if("radar"===t){let t=eh(e.radar);if(!t)return;for(let e of["axisColor","graticuleColor"]){let i=t[e];if(void 0===i)continue;let a="graticuleColor"===e,r=ef(i);if(void 0===J(i,a))throw new ep(`radar.${e}`,r,a)}}if("xychart"===t){let t=eh(e.xyChart);if(!t)return;for(let e of ec){if("backgroundColor"===e&&i?.bg!==void 0)continue;let a=t[e];if(void 0===a)continue;let r=ed.has(e),n=ef(a);if(void 0===J(a,r))throw new ep(`xyChart.${e}`,n,r)}let a=t.plotColorPalette;if(void 0!==a&&("string"!=typeof a||0!==a.trim().length)){let e="string"==typeof a?W(a):a;if(!Array.isArray(e))throw new ep("xyChart.plotColorPalette",JSON.stringify(a)??String(a),!1);for(let[t,i]of e.entries()){let e="string"==typeof i?i.trim():JSON.stringify(i)??String(i);if(void 0===J(i))throw new ep(`xyChart.plotColorPalette[${t}]`,e,!1)}}}if("architecture"===t&&("string"!=typeof e.mainBkg||0===e.mainBkg.length)){let t=e.secondaryColor;if(void 0!==t){let e=ef(t);if(void 0===J(t,!0))throw new ep("secondaryColor",e,!0)}}}var eS={schemaVersion:2,provenance:{version:"12.2.0"},families:[{id:"flowchart",headers:[{value:"flowchart",agenticStatus:"native"},{value:"graph",agenticStatus:"native"},{value:"flowchart-elk",agenticStatus:"unsupported"}]},{id:"swimlane",headers:[{value:"swimlane-beta",agenticStatus:"unsupported"}]},{id:"sequence",headers:[{value:"sequenceDiagram",agenticStatus:"native"}]},{id:"class",headers:[{value:"classDiagram",agenticStatus:"native"},{value:"classDiagram-v2",agenticStatus:"native"}]},{id:"state",headers:[{value:"stateDiagram",agenticStatus:"native"},{value:"stateDiagram-v2",agenticStatus:"native"}]},{id:"er",headers:[{value:"erDiagram",agenticStatus:"native"}]},{id:"journey",headers:[{value:"journey",agenticStatus:"native"}]},{id:"gantt",headers:[{value:"gantt",agenticStatus:"native"}]},{id:"pie",headers:[{value:"pie",agenticStatus:"native"}]},{id:"quadrant",headers:[{value:"quadrantChart",agenticStatus:"native"}]},{id:"requirement",headers:[{value:"requirementDiagram",agenticStatus:"native"},{value:"requirement",agenticStatus:"native"}]},{id:"gitgraph",headers:[{value:"gitGraph",agenticStatus:"native"}]},{id:"c4",headers:[{value:"C4Context",agenticStatus:"native"},{value:"C4Container",agenticStatus:"native"},{value:"C4Component",agenticStatus:"native"},{value:"C4Dynamic",agenticStatus:"native"},{value:"C4Deployment",agenticStatus:"native"}]},{id:"mindmap",headers:[{value:"mindmap",agenticStatus:"native"}]},{id:"timeline",headers:[{value:"timeline",agenticStatus:"native"}]},{id:"zenuml",headers:[{value:"zenuml",agenticStatus:"native"}]},{id:"sankey",headers:[{value:"sankey",agenticStatus:"native"},{value:"sankey-beta",agenticStatus:"native"}]},{id:"xychart",headers:[{value:"xychart",agenticStatus:"native"},{value:"xychart-beta",agenticStatus:"native"}]},{id:"block",headers:[{value:"block",agenticStatus:"native"},{value:"block-beta",agenticStatus:"native"}]},{id:"packet",headers:[{value:"packet",agenticStatus:"native"},{value:"packet-beta",agenticStatus:"native"}]},{id:"kanban",headers:[{value:"kanban",agenticStatus:"native"}]},{id:"architecture",headers:[{value:"architecture",agenticStatus:"native"},{value:"architecture-beta",agenticStatus:"native"}]},{id:"radar",headers:[{value:"radar-beta",agenticStatus:"native"}]},{id:"eventmodeling",headers:[{value:"eventmodeling",agenticStatus:"native"}]},{id:"treemap",headers:[{value:"treemap",agenticStatus:"native"},{value:"treemap-beta",agenticStatus:"native"}]},{id:"venn",headers:[{value:"venn-beta",agenticStatus:"unsupported"}]},{id:"ishikawa",headers:[{value:"ishikawa",agenticStatus:"native"},{value:"ishikawa-beta",agenticStatus:"native"}]},{id:"wardley",headers:[{value:"wardley-beta",agenticStatus:"unsupported"}]},{id:"cynefin",headers:[{value:"cynefin-beta",agenticStatus:"unsupported"}]},{id:"treeview",headers:[{value:"treeView-beta",agenticStatus:"unsupported"}]},{id:"railroad",headers:[{value:"railroad-beta",agenticStatus:"unsupported"},{value:"railroad-ebnf-beta",agenticStatus:"unsupported"},{value:"railroad-abnf-beta",agenticStatus:"unsupported"},{value:"railroad-peg-beta",agenticStatus:"unsupported"}]},{id:"agentflow",headers:[{value:"agentflow-beta",agenticStatus:"unsupported"}]},{id:"usecase",headers:[{value:"usecase-beta",agenticStatus:"unsupported"}]}]};function e$(e,t,i,a){let r=g(e),l=-1,d=-1,u=e.length,m=Math.max(0,Math.min(e.length,i??0)),$=m;for(;$<=e.length;){let i=/\r\n?|\n/g;i.lastIndex=$;let a=i.exec(e),r=a?.index??-1,n=r<0?e.length:r,o=e.slice($,n).replace(/\r$/,""),c=o.trim(),f=c.startsWith(t)?c.slice(t.length):"",p=/^\s*;/.test(f);if(c===t||p||/^\s/.test(f)&&s(c)!==c){if(d=(l=$+o.indexOf(t))+t.length,c===t)u=a?a.index+a[0].length:e.length;else for(u=p?e.indexOf(";",d)+1:d;u<n&&/[ \t]/.test(e[u]);)u++;break}if(r<0)break;$=a.index+a[0].length}if(l<0){let i=e.indexOf(t,m);l=i<0?m:i,d=Math.min(e.length,l+t.length);let a=e.indexOf(`
2
2
  `,d);for(u=a<0?e.length:a+1,$=l;$>0&&10!==e.charCodeAt($-1);)$--}return Object.freeze({source:h(r,0,e.length),...(i??$)>0?{wrapper:h(r,0,i??$)}:{},...function(e,t,i,a=g(e),r){let s=n(e),l=s?.source.length??0,d=function(e,t,i=g(e),a=c(e),r){let n=[...e.slice(t).matchAll(/[^\r\n]*(?:\r\n?|\n|$)/g)],o=n.map(e=>e[0]),s=e.slice(t),l=f(P(a),S(s).split(/\r\n?|\n/),r),d=b(s,l),u=s.split("");for(let e of d.directives)for(let t=e.start;t<e.end;t++)"\r"!==u[t]&&u[t]!==`
3
3
  `&&(u[t]=" ");let p=u.join("").split(/\r\n?|\n/),m=n.map(e=>t+e.index),$=[],w=f(P(a),p,r);for(let e=0;e<p.length;e++){let t=y(p,e);if(void 0===t)break;if(null===t){e=v(w,e,p.length);continue}let a=m[e],r;r="block"===t.form?m[t.endIndex]+p[t.endIndex].indexOf("}")+1:a+o[e].length,$.push(h(i,a,r)),e=t.endIndex}return Object.freeze($)}(e,l,a,i,r),u=e.split("");for(let t of d)if(/^\s*%% agentic-mermaid (?:accTitle|accDescr):/.test(e.slice(t.start.offset,t.end.offset)))for(let e=t.start.offset;e<t.end.offset;e++)"\r"!==u[e]&&u[e]!==`
4
- `&&(u[e]=" ");let m=(function(e,t,i=0,a=g(e)){let r=[],n=new RegExp(t.source,t.flags.includes("g")?t.flags:`${t.flags}g`),o;for(;null!==(o=n.exec(e));)r.push(h(a,i+o.index,i+o.index+o[0].length)),0===o[0].length&&n.lastIndex++;return Object.freeze(r)})(u.join("").slice(l),RegExp(o.source,"gm"),l,a).filter(t=>p(e.slice(t.start.offset,t.end.offset)));return{...s?{frontmatter:h(a,0,l)}:{},...m.length>0?{initDirectives:m}:{},...d.length>0?{accessibilityDirectives:Object.freeze(d)}:{}}}(e,0,t,r,a),header:h(r,l,d),body:h(r,u,e.length)})}var ew=class extends Error{name="MermaidFamilyDetectionError";code;line;preservation;help;constructor(e){super(e.message),this.code=e.code,this.line=e.line,this.preservation=e.preservation,this.help=e.help}toJSON(){return{code:this.code,message:this.message,line:this.line,preservation:this.preservation,help:this.help}}};function ex(e,t){if(!e||"object"!=typeof e||Array.isArray(e))return;let i=e[t];return i&&"object"==typeof i&&!Array.isArray(i)?i:void 0}Object.freeze(["library","cli","codeMode","localMcp","hostedMcp","editor","website"]);var eC=["onConfigDiagnostic"],eO=(e,t)=>({type:"string",...void 0===t?{}:{default:t}}),ej=(e,t,i={})=>({type:"number",...void 0===t?{}:{default:t},...i}),ek=(e,t)=>ej(void 0,t,{minimum:0}),eE=(e,t)=>ej(void 0,t,{exclusiveMinimum:0}),eF=e=>ej(void 0,void 0,{minimum:1,maximum:1e3}),eA=(e,t)=>({type:"boolean",...void 0===t?{}:{default:t}}),eI=(e,t)=>({...eO(void 0,t),"x-agentic-mermaid-runtime-validator":"safeCssPaint"}),eT=(e,t)=>({...eO(void 0,t),"x-agentic-mermaid-runtime-validator":"safeCssFontFamily"}),ez=(e,t,i=[])=>({type:"object",additionalProperties:!1,properties:e,...0===i.length?{}:{required:i}}),eD={type:"string",enum:["uppercase","lowercase","capitalize"]},eL={...ez({groupHeaderHeight:eE(void 0),groupFontSize:eE(void 0),groupFontWeight:eF(void 0),groupLetterSpacing:ej(void 0),groupFont:eT(void 0),groupTextTransform:{...eD},groupPaddingX:ek(void 0),groupPaddingY:ek(void 0),groupLabelPaddingX:ek(void 0),groupCornerRadius:ek(void 0),groupLineWidth:ek(void 0),groupText:eI(void 0),serviceFontSize:eE(void 0),serviceFontWeight:eF(void 0),serviceLetterSpacing:ej(void 0),serviceTextTransform:{...eD},servicePaddingX:ek(void 0),servicePaddingY:ek(void 0),serviceCornerRadius:ek(void 0),serviceLineWidth:ek(void 0),serviceText:eI(void 0),edgeFontSize:eE(void 0),edgeFontWeight:eF(void 0),edgeLetterSpacing:ej(void 0),edgeTextTransform:{...eD},edgeLineWidth:ek(void 0),edgeBendRadius:ek(void 0),edgeStroke:eI(void 0),edgeText:eI(void 0),iconSize:eE(void 0),serviceIconSize:eE(void 0),junctionOuterRadius:eE(void 0),junctionInnerRadius:ek(void 0),groupSurface:eI(void 0),groupHeaderSurface:eI(void 0),groupBorder:eI(void 0),serviceSurface:eI(void 0),serviceBorder:eI(void 0)},void 0),"x-agentic-mermaid-runtime-validator":"architectureVisual"},eM={anyOf:[{type:"string"},(()=>{let e=k(),t=e.$defs,i=e=>{if(Array.isArray(e))return e.map(i);if(null===e||"object"!=typeof e)return e;let a=e.$ref;if("string"==typeof a&&a.startsWith("#/$defs/")){let e=t?.[a.slice(8)];if(!e)throw Error(`StyleSpec schema has unresolved local reference ${a}`);return i(e)}return Object.fromEntries(Object.entries(e).filter(([e])=>"$defs"!==e).map(([e,t])=>[e,i(t)]))},{$schema:a,$id:r,title:n,...o}=e;return i(o)})()],"x-agentic-mermaid-validation-expectation":"a registered Style name or StyleSpec"},eR={anyOf:[{type:"null"},{type:"string"},{type:"number"},{type:"boolean"},{type:"array",items:{$ref:"#/$defs/jsonValue"}},{type:"object",additionalProperties:{$ref:"#/$defs/jsonValue"}}],"x-agentic-mermaid-validation-expectation":"a finite, acyclic JSON value without prototype keys"},eq=["flowchart","state","class","er","architecture","c4"],eN=N({layoutHints:{validationExpectation:"contain integer ranks, node groups and edge IDs",schema:{type:"object",additionalProperties:!1,properties:{ranks:{type:"object",additionalProperties:{type:"integer",minimum:0,maximum:1e4}},adjacent:{type:"array",items:{type:"array",minItems:2,items:{type:"string"}}},shortEdges:{type:"array",items:{type:"string"}}}},applicableBuiltinFamilies:["flowchart","state"]},graphLayout:{validationExpectation:"be a graph layout selection object",schema:{anyOf:[ez({backend:{type:"string",const:"elk"},fallback:{type:"string",enum:["none"]}},void 0,["backend"]),ez({backend:{type:"string",const:"agentic"},fallback:{type:"string",enum:["none","elk"]}},void 0,["backend"])]},applicableBuiltinFamilies:["flowchart","state","architecture","class","er","requirement"]},layoutSafety:{validationExpectation:"be report or strict",schema:{type:"string",enum:["report","strict"],default:"report"}},bg:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0,"#FFFFFF")},fg:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0,"#27272A")},line:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0)},accent:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0)},muted:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0)},surface:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0)},border:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0)},font:{validationExpectation:"be a safe non-fetching CSS font family or stack",schema:eT(void 0,"Inter")},style:{validationExpectation:"be a registered Style name or StyleSpec, or an array of them",schema:{anyOf:[eM,{type:"array",items:eM}],"x-agentic-mermaid-runtime-validator":"styleInput"}},padding:{validationExpectation:"be a non-negative finite number",schema:ek(void 0,40),applicableBuiltinFamilies:["flowchart","state","architecture","c4"]},nodeSpacing:{validationExpectation:"be a non-negative finite number",schema:ek(void 0,24),applicableBuiltinFamilies:eq},layerSpacing:{validationExpectation:"be a non-negative finite number",schema:ek(void 0,40),applicableBuiltinFamilies:eq},wrappingWidth:{validationExpectation:"be a positive finite number",schema:eE(void 0),applicableBuiltinFamilies:["flowchart"]},componentSpacing:{validationExpectation:"be a non-negative finite number",schema:ek(void 0),applicableBuiltinFamilies:[]},transparent:{validationExpectation:"be a boolean",schema:eA(void 0,!1)},interactive:{validationExpectation:"be a boolean",schema:eA(void 0,!1),applicableBuiltinFamilies:["xychart","pie","quadrant"]},shadow:{validationExpectation:"be a boolean",schema:eA(void 0,!1),applicableBuiltinFamilies:["flowchart","state","sequence","timeline","class","er","journey","xychart","pie","quadrant","gantt","mindmap","gitgraph","sankey"]},class:{validationExpectation:"be a class options object",schema:ez({hierarchicalNamespaces:eA(void 0,!0)},void 0),applicableBuiltinFamilies:["class"]},kanban:{validationExpectation:"be a kanban options object",schema:ez({maxWidth:eE(void 0)},void 0),applicableBuiltinFamilies:["kanban"]},pie:{validationExpectation:"be a pie options object",schema:ez({maxWidth:eE(void 0)},void 0),applicableBuiltinFamilies:["pie"]},radar:{validationExpectation:"be a radar options object",schema:ez({maxWidth:eE(void 0)},void 0),applicableBuiltinFamilies:["radar"]},architecture:{validationExpectation:"be an architecture options object",schema:ez({visual:eL},void 0),applicableBuiltinFamilies:["architecture"]},timeline:{validationExpectation:"be a timeline options object",schema:ez({maxWidth:eE(void 0)},void 0),applicableBuiltinFamilies:["timeline"]},journey:{validationExpectation:"be a journey options object",schema:ez({experienceCurve:eA(void 0,!0)},void 0),applicableBuiltinFamilies:["journey"]},gantt:{validationExpectation:"be a Gantt options object",schema:ez({dependencyArrows:eA(void 0,!1),criticalPath:eA(void 0,!1)},void 0),applicableBuiltinFamilies:["gantt"]},mermaidConfig:{validationExpectation:"be a plain JSON object",schema:{type:"object",additionalProperties:{$ref:"#/$defs/jsonValue"}}},embedFontImport:{validationExpectation:"be a boolean",schema:eA(void 0,!1)},compact:{validationExpectation:"be a boolean",schema:eA(void 0,!1)},idPrefix:{validationExpectation:"be non-empty and contain only ASCII letters, digits, underscore, hyphen, dot, and colon",schema:{...eO(void 0),pattern:"^[A-Za-z0-9_.:-]+$"}},security:{validationExpectation:"be default or strict",schema:{type:"string",enum:["default","strict"],default:"default"}},ganttToday:{validationExpectation:"be a string",schema:eO(void 0),applicableBuiltinFamilies:["gantt"]},seed:{validationExpectation:"be a finite number",schema:ej(void 0,0)}}),eP=Object.freeze(Object.keys(eN)),eB=Object.freeze(eP.filter(e=>"applicableBuiltinFamilies"in eN[e]));function eW(e){let t=e=>Array.isArray(e)?e.map(t):q(e)?Object.fromEntries(Object.entries(e).map(([e,i])=>[e,t(i)])):e;return t(e)}function e_(e){let t=String(e[0]??"");for(let i of e.slice(1))t+="number"==typeof i?`[${i}]`:`.${i}`;return`render option "${t}"`}function eV(e){return j(C(e).map(e=>e.path.length>0?`${e_(e.path)} ${e.message}`:`render options ${e.message}`),"render options")}function eJ(e,t,i){let a=t["x-agentic-mermaid-runtime-validator"];if("safeCssColor"===a&&void 0===V(e))return[{path:i,message:"must be a safe, non-fetching CSS color",generic:!1}];if("safeCssPaint"===a&&void 0===H(e))return[{path:i,message:"must be a safe, non-fetching CSS paint",generic:!1}];if("safeCssFontFamily"===a&&void 0===W(e))return[{path:i,message:"must be a safe, non-fetching CSS font family or stack",generic:!1}];if("styleInput"===a)try{A(e)}catch(e){return[{path:i,message:`is invalid: ${e instanceof Error?e.message:String(e)}`,generic:!1}]}if("architectureVisual"===a&&q(e)){let t=e.junctionOuterRadius,a=e.junctionInnerRadius;if("number"==typeof t&&"number"==typeof a&&a>t)return[{path:[...i,"junctionInnerRadius"],message:"must not exceed junctionOuterRadius",generic:!1}]}return[]}function eG(e){if(!q(e))return["render options must be a plain JSON object"];let t=eV(e);if(t.length>0)return t;let i=[],a=Z??=N(function(){let e={};for(let t of eP){let i=eN[t],a="terminalNote"in i?i.terminalNote:void 0,r="applicableBuiltinFamilies"in i?i.applicableBuiltinFamilies:void 0;e[t]={...eW(i.schema),"x-agentic-mermaid-terminal":i.terminal,...void 0===a?{}:{"x-agentic-mermaid-terminal-note":a},...void 0===r?{}:{"x-agentic-mermaid-applicable-builtin-families":[...r]}}}return{type:"object",additionalProperties:!1,properties:e,$defs:{jsonValue:eW(eR)}}}());for(let[t,r]of Object.entries(e)){if(!Object.hasOwn(eN,t)){i.push(`unknown render option "${t}"`);continue}if(null===r){i.push(`render option "${t}" must be omitted instead of null`);continue}let e=eN[t],n=Q(r,e.schema,a,[t],{diagnostics:"field",validateRuntime:eJ});n.length>0&&n.every(e=>e.generic&&1===e.path.length)?i.push(`render option "${t}" must ${e.validationExpectation}`):i.push(...n.map(e=>`${e_(e.path)} ${e.message}`))}return j(i,"render options")}var eH=class extends Error{constructor(e,t){super(`Parsed Mermaid family "${e}" serialized as family "${t}"`),this.expectedFamilyId=e,this.detectedFamilyId=t}expectedFamilyId;detectedFamilyId;name="ParsedDiagramFamilyMismatchError";code="PARSED_DIAGRAM_FAMILY_MISMATCH"},eU=class extends Error{name="RenderCapabilityError";code="UNSATISFIED_RENDER_CAPABILITIES";output;family;decision;constructor(e,t,i,a){super(e),this.output=t,this.family=Object.freeze({id:i.identity.id,version:i.identity.version}),this.decision=a}toJSON(){return{name:this.name,code:this.code,message:this.message,output:this.output,family:this.family,decision:this.decision}}},eK=class extends TypeError{constructor(e){super(e),this.name="RenderConfigError"}},eY=new WeakMap;function eX(e){let t=eY.get(e);if(!t)throw Error("Resolved render request has no internal execution plan");return t}function eQ(e,t=[]){let i,a=eY.get(e),r=a?.executionDecision,n=a&&Object.hasOwn(a,"textMeasurement")?a.textMeasurement:void 0;return Object.freeze({version:e.version,output:e.output,sharedRequestDigest:e.sharedRequestDigest,requestDigest:e.requestDigest,appearanceDigest:e.appearance.digest,capabilityDecision:e.capabilityDecision,diagnostics:(i=new Set,Object.freeze([...Object.hasOwn(e,"resolutionDiagnostics")?e.resolutionDiagnostics:[],...t,...L(e).flatMap(e=>"agentic"===e.requested&&"elk"===e.selected?[{code:"GRAPH_LAYOUT_FALLBACK",feature:"graph-layout",message:`Agentic graph layout used the requested ELK fallback: ${e.reason??"candidate rejected"}`}]:[])].flatMap(e=>{let t=e5(e);return i.has(t)?[]:(i.add(t),[Object.freeze({...e})])}))),...r?{executionDecision:r}:{},...n?{textMeasurement:n.identity}:{},...L(e).length?{layoutDecisions:L(e)}:{}})}function eZ(e){let t=e0.get(e);if(t)return t;let i=eY.get(e)?.backend?.identity.id??("layout"===e.output?`backend:${e.appearance.inferredBackend}`:void 0),a=Object.freeze({renderOptions:e.renderOptions,...e.appearance.face?{styleFace:e.appearance.face}:{},...i?{paintBackendId:i}:{},...e.familyConfig?{familyConfig:e.familyConfig}:{},...e.appearance.family?{familyAppearance:e.appearance.family}:{}});return eY.has(e)&&e0.set(e,a),a}var e0=new WeakMap;function e1(e){let t={};for(let i of eP){let a=e[i];void 0!==a&&(t[i]=a)}return t}var e6=new Set(["padding","nodeSpacing","layerSpacing","wrappingWidth","class"]);function e2(e,t="$",i=0,a=new Set,r={nodes:0,chars:0,opaque:!1,admission:void 0}){let n=r.admission;if(n?.valid)switch((++n.nodes>w.maxNodes||i>w.maxDepth)&&(n.valid=!1),typeof e){case"number":e-e!=0&&(n.valid=!1);break;case"undefined":case"bigint":case"symbol":case"function":n.valid=!1}if("string"==typeof e){if(r.chars+=e.length,r.chars>2e6)throw TypeError(`data exceeds the 2000000-character aggregate limit at ${t}`);return e}if(null===e||"object"!=typeof e)return e;if(i>64)throw TypeError(`data exceeds maximum depth 64 at ${t}`);if(++r.nodes>1e5)throw TypeError(`data exceeds the 100000-node aggregate limit at ${t}`);if(a.has(e))throw TypeError(`data must be acyclic at ${t}`);if(Array.isArray(e)){if(e.length>1e5)throw TypeError(`data array exceeds the 100000-entry limit at ${t}`);a.add(e);try{let o=[],s=Object.create(null);s.enumerable=s.configurable=s.writable=!0;for(let n=0;n<e.length;n++){if(n>=1e5)throw TypeError(`data array exceeds the 100000-entry limit at ${t}`);if(!Object.prototype.hasOwnProperty.call(e,n))throw TypeError(`data must not contain a sparse array at ${t}[${n}]`);s.value=e2(e[n],`${t}[${n}]`,i+1,a,r),Object.defineProperty(o,n,s)}return n&&o.length>w.maxItemsPerContainer&&(n.valid=!1),te(o,!r.opaque)}finally{a.delete(e)}}if(!q(e))return r.opaque=!0,n&&(n.valid=!1),e;a.add(e);try{let o={},s=0;for(let[l,c]of Object.entries(e)){if(r.chars+=l.length,r.chars>2e6)throw TypeError(`data exceeds the 2000000-character aggregate limit at ${t}.${l}`);if(void 0!==c){n&&(++s>w.maxItemsPerContainer||x(l))&&(n.valid=!1);let e=e2(c,`${t}.${l}`,i+1,a,r);l in o?Object.defineProperty(o,l,{value:e,enumerable:!0}):o[l]=e}}return te(o,!r.opaque)}finally{a.delete(e)}}function e4(e,t,i,a=!1){let r;if(void 0===t)return;if(!q(t))throw TypeError(`Family "${e.id}" returned ${i} data that is not a plain object`);if(a)return t;try{r=e2(t)}catch(t){throw TypeError(`Family "${e.id}" returned invalid ${i} data: ${t instanceof Error?t.message:String(t)}`)}let n={...eR,$defs:{jsonValue:eR}},o=Q(r,n,n,[`family${"config"===i?"Config":"Appearance"}`],{diagnostics:"field",validateRuntime:eJ});if(o.length>0){let t=o.map(e=>`${e.path.join(".")} ${e.message}`).join("; ");throw TypeError(`Family "${e.id}" returned invalid ${i} data: ${t}`)}return tt(r)}function e5(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e5).join(",")}]`;let t="{",i="";for(let a of Object.keys(e).sort()){let r=e[a];void 0!==r&&(t+=`${i}${JSON.stringify(a)}:${e5(r)}`,i=",")}return`${t}}`}function e3(e,t){try{let t,i;return t=e8(e),()=>(void 0===i&&(i=e9(e5(t)),t=void 0),i)}catch(e){throw e instanceof TypeError&&/aggregate limit/.test(e.message)?new a("sourceCharacters",t.originalText.length+t.text.length,!0):e}}function e8(e){let t,i={nodes:0,valid:2e6<=w.maxAggregateTextCharacters&&6e6<=w.maxAggregateTextBytes};try{t=ti(e,"render contract digest input",i)}catch(e){throw TypeError((e instanceof Error?e.message:String(e)).replace("data exceeds maximum depth","data exceeds maximum nesting depth"))}return i.valid||O(t,"render contract digest input",{allowUndefinedObjectProperties:!0}),t}function e9(e){let t=-0x340d631c,i=-0x7bdddcdb;for(let a=0;a<e.length;a++){let r=i^e.charCodeAt(a),n=(r>>>16)*435+((65535&r)*435>>>16)>>>16;i=Math.imul(r,435),t=Math.imul(t,435)+n+(r<<8)|0}return`fnv1a64:${(t>>>0).toString(16).padStart(8,"0")}${(i>>>0).toString(16).padStart(8,"0")}`}var e7=new WeakSet;function te(e,t=!0){return Object.freeze(e),t&&e7.add(e),e}function tt(e,t="$",i,a){let r;if(null===e||"object"!=typeof e||e7.has(e))return e;if(i??=new Set,a??=new WeakMap,i.has(e))throw TypeError(`render request contains a cycle at ${t}`);let n=a.get(e);if(n)return n;let o=Object.getPrototypeOf(e);if(!Array.isArray(e)&&o!==Object.prototype&&null!==o)throw TypeError(`render request contains a non-JSON object at ${t}`);if(i.add(e),Array.isArray(e)){let n=e.length,o=Array(n);for(let r=0;r<n;r++)r in e&&(o[r]=tt(e[r],`${t}[${r}]`,i,a));r=o}else{let n={};for(let[r,o]of Object.entries(e)){let e=tt(o,`${t}.${r}`,i,a);r in n?Object.defineProperty(n,r,{value:e,enumerable:!0}):n[r]=e}r=n}return i.delete(e),a.set(e,r),te(r)}function ti(e,t,i){try{return tt(i?e2(e,"$",0,new Set,{nodes:0,chars:0,opaque:!1,admission:i}):e2(e))}catch(e){throw TypeError(`${t} could not be snapshotted: ${e instanceof Error?e.message:String(e)}`)}}var ta=Object.freeze({serializable:tt({})}),tr=new WeakMap,tn=new WeakMap;function to(e){if(tr.has(e))return e;let t=tl(e),i=tt(I(t.serializable.style)),a=eG(t.serializable);if(a.length)throw new eK(`Invalid RenderOptions: ${a.join("; ")}`);let r=tc(t.serializable.style),n=Object.freeze({...t.serializable,...t.onConfigDiagnostic?{onConfigDiagnostic:t.onConfigDiagnostic}:{}});return tr.set(n,Object.freeze({...t,capturedStyle:i})),tn.set(t.serializable,r),n}function ts(e){let t=tr.get(e)?.capturedStyle;if(!t)throw TypeError("Render options have not been captured");return t.style?F(t.style):"default"}function tl(e){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new eK("Invalid RenderOptions: render options must be an object");let t=tr.get(e);if(t)return t;let i=[],a;for(let[t,r]of Object.entries(e))"onConfigDiagnostic"===t?a=r:void 0!==r&&i.push([t,r]);if(void 0!==a&&"function"!=typeof a)throw new eK("Invalid RenderOptions: onConfigDiagnostic must be a function");if(0===i.length&&void 0===a)return ta;let r=Object.fromEntries(i),n;try{n=ti(r,"RenderOptions")}catch(t){let e=(t instanceof Error?t.message:String(t)).replace("data exceeds maximum depth","render option tree exceeds maximum nesting depth");throw new eK(`Invalid RenderOptions: ${e}`)}return Object.freeze({serializable:n,...void 0===a?{}:{onConfigDiagnostic:a}})}function tc(e){return tt((void 0===e?[]:Array.isArray(e)?e:[e]).flatMap(e=>{if("string"!=typeof e||"crisp"===e)return[];let t=E(e);return t?[{input:e,canonicalId:t.canonicalId}]:[]}))}var td="1.0.0";function tu(e,t,i=td){return t?[{id:e,version:i}]:[]}function tf(e,t=`^${td}`){return{id:e,range:t,level:"required"}}function tp(e){return`scene-primitive:${e.primitive}/${e.feature}/${e.operation}`}var tm=new WeakMap;function tg(e,t){let i=tm.get(e.backend);return i||(i=new Set(D.filter(t=>e.backend.capabilities.some(e=>e.primitive===t.primitive&&e.feature===t.feature&&e.operation===t.operation&&"unsupported"!==e.realization))),tm.set(e.backend,i)),i.has(t)}var th=new Map;function ty(e){return!e.id.startsWith("output:")&&!e.id.startsWith("operation:")&&!e.id.startsWith("backend:")&&!e.id.startsWith("scene-primitive:")&&"core:scene"!==e.id}function tv(a,n={},o="svg",s,c={}){let f=tl(n),p=f.serializable,m=eV(p);if(m.length>0)throw new eK(`Invalid RenderOptions: ${m.join("; ")}`);let g=f.capturedStyle??I(p.style),h=g.style,y=tt(g.face),v=f.capturedStyle?[]:eG(p);if(v.length>0)throw new eK(`Invalid RenderOptions: ${v.join("; ")}`);let b,S=tt($(a,p.mermaidConfig??{},e=>c.familyDescriptor?c.familyDescriptor:"registered"===(b=function(e,t="strict"){let i=l(e),a=u(i,t);if(a)return{kind:"registered",family:a};let r=function(e,t=eS){let i=(e.split(";")[0]??"").trim().toLowerCase();return t.families.flatMap(e=>e.headers.map(t=>({family:e,header:t}))).sort((e,t)=>t.header.value.length-e.header.value.length||z(e.family.id,t.family.id)).find(e=>(function(e,t){let i=t.trim().toLowerCase();if(e===i)return!0;if(!e.startsWith(i))return!1;let a=e[i.length];return void 0!==a&&/[\s:]/.test(a)})(i,e.header.value))??null}(i);return r?{kind:"upstream",match:r}:{kind:"unknown",header:e}}(e)).kind?b.family:null)),w=c.familyDescriptor??function(e,t){if("registered"===t.kind)return t.family;throw new ew(function(e,t,i,a,r){let n=eS.provenance.version;if("unknown"===e.kind)return{code:"UNKNOWN_HEADER",message:`Unrecognized Mermaid header: "${e.header}"`,line:1,preservation:{version:1,classification:"unknown",source:t,header:e.header,mermaidVersion:n,spans:e$(t,a??e.header,i,null)},help:"Check for a Mermaid upgrade or register a namespaced family descriptor; the source was preserved unchanged."};let{family:o,header:s}=e.match,l="inventory-only"===s.agenticStatus?"inventory-only":"unsupported",c="native"===s.agenticStatus;return{code:c?"FAMILY_DESCRIPTOR_MISMATCH":"UNSUPPORTED_FAMILY",message:c?`Mermaid ${n} header "${s.value}" is marked native but no installed family descriptor claimed it`:`Mermaid ${n} family "${o.id}" is ${l} in Agentic Mermaid`,line:1,preservation:{version:1,classification:l,source:t,header:s.value,upstreamFamilyId:o.id,mermaidVersion:n,spans:e$(t,a??s.value,i,null)},help:c?"Report a descriptor/manifest mismatch; the source was preserved unchanged.":`Install a family descriptor for "${s.value}" or use a currently native family; the source was preserved unchanged.`}}("unknown"===t.kind?{...t,header:e.lines[0]??e.firstLine}:t,e.originalText,e.authoredWrapperLength??e.wrapperSource?.length??0,e.authoredHeader??e.lines[0]??e.firstLine,0))}(S,b);if(void 0!==c.expectedFamilyId&&w.id!==c.expectedFamilyId)throw new eH(c.expectedFamilyId,w.id);r("sourceCharacters",S.originalText.length+S.text.length);let x=M(S.config.themeCSS,p.security??"default");if(x)throw new eK(x);"architecture"!==w.id&&eb(S.config.themeVariables,w.id,p),function(e,t){let i=eh(e[t]);if(i){if("timeline"===t)ev(i,"timeline","sectionFills",!1),ev(i,"timeline","sectionColours",!1),(void 0===i.sectionColours||Array.isArray(i.sectionColours)&&0===i.sectionColours.length)&&ev(i,"timeline","sectionColors",!1);else if("journey"===t)ev(i,"journey","actorColours",!0),ev(i,"journey","sectionFills",!1),ev(i,"journey","sectionColours",!1),ey(i,"journey","titleColor",!1);else if("requirement"===t)ey(i,"requirement","rect_fill",!0),ey(i,"requirement","rect_border_color",!0),ey(i,"requirement","text_color",!1);else if("sankey"===t){let e=i.linkColor;if("source"!==e&&"target"!==e&&"gradient"!==e&&ey(i,"sankey","linkColor",!0),void 0===i.nodeColors)return;let t=eh(i.nodeColors);if(!t)throw new eg("sankey.nodeColors",i.nodeColors,!1,"map");let a=void 0!==e&&"gradient"!==e;for(let[e,i]of Object.entries(t))if(void 0===J(i,a))throw new eg(/^[\w-]+$/.test(e)?`sankey.nodeColors.${e}`:`sankey.nodeColors[${JSON.stringify(e)}]`,i,a)}}}(S.frontmatter,w.id);let C=Object.freeze(eP.filter(e=>void 0!==p[e])),O=function(e,t){if(e.id.startsWith("family:")){let i=new Set(e.applicableRenderOptions??[]);return Object.freeze(t.flatMap(t=>!eB.includes(t)||i.has(t)?[]:[Object.freeze({code:"RENDER_OPTION_NOT_APPLICABLE",feature:`render-option:${t}`,message:`Render option "${t}" does not apply to extension family "${e.id}". Its FamilyDescriptor does not list the field in applicableRenderOptions.`})]))}let i=e.id;return Object.freeze(t.flatMap(e=>{let t=eN[e];if(!("applicableBuiltinFamilies"in t))return[];let a=t.applicableBuiltinFamilies;if(a.includes(i))return[];let r=0===a.length?"No built-in family currently consumes this option.":`Applicable built-in families: ${a.join(", ")}.`;return[Object.freeze({code:"RENDER_OPTION_NOT_APPLICABLE",feature:`render-option:${e}`,message:`Render option "${e}" does not apply to built-in Mermaid family "${i}". ${r}`})]}))}(w,C),{appearance:j,renderOptions:k,familyConfig:E}=function(a){let{family:r,source:n,options:o,style:s,styleFace:l}=a,c="strict"===o.security?{...o,embedFontImport:!1}:{...o};o.graphLayout&&(c.graphLayout={...o.graphLayout,fallback:o.graphLayout.fallback??"none"});let d=void 0!==s&&T(s);d&&(c=function(t,i,a){let r={...t},n=t=>e[t].some(e=>a?.[e]!==void 0);for(let e of["bg","fg","line","accent","muted","surface","border"])void 0!==r[e]||n(e)||i.colors?.[e]===void 0||(r[e]=i.colors[e]);return void 0===r.font&&void 0!==i.font&&(r.font=i.font),r}(c,s,n.config.themeVariables));let u=o.font??n.config.fontFamily??i(n.config.themeVariables,"fontFamily")??c.font??"Inter",f=W(u)??u,{style:p,...m}=c,g={...m,...s?{style:s}:{},font:f,mermaidConfig:n.config},h={...t(g,n.config,f)},y=function(e,t,i,a,r,n){if(!e.normalizeRequest)return{renderOptions:i,colors:a};let o=Object.freeze({source:tt(t),renderOptions:tt(i),colors:tt(a),...r?{style:tt(r)}:{},...n?{styleFace:tt(n)}:{}}),s=e.normalizeRequest(o);if(void 0===s)return{renderOptions:i,colors:a};let l,c={nodes:0,valid:!0};try{l=ti(s,`Family "${e.id}" request normalizer result`,c)}catch(t){throw TypeError(`Family "${e.id}" request normalizer returned invalid data: ${t instanceof Error?t.message:String(t)}`)}if(!q(l))throw TypeError(`Family "${e.id}" request normalizer must return a plain object`);let d=Object.keys(l).find(e=>!["renderOptions","familyConfig","appearance"].includes(e));if(d)throw TypeError(`Family "${e.id}" request normalizer returned unknown field "${d}"`);let u=l,f=u.appearance;if(void 0!==f){if(!q(f))throw TypeError(`Family "${e.id}" request normalizer returned a non-object appearance`);let t=Object.keys(f).find(e=>!["colors","family"].includes(e));if(t)throw TypeError(`Family "${e.id}" request normalizer returned unknown appearance field "${t}"`)}let p=u.renderOptions??i;if(void 0!==p.onConfigDiagnostic)throw TypeError(`Family "${e.id}" request normalizer may not return executable option "onConfigDiagnostic"`);let m=eG(Object.fromEntries(Object.entries(p).filter(([e,t])=>void 0!==t&&!eC.includes(e))));if(m.length>0)throw new eK(`Family "${e.id}" returned invalid normalized RenderOptions: ${m.join("; ")}`);let g=e1(i),h=e1(p);for(let t of eP)if(!e6.has(t)&&e5(g[t])!==e5(h[t]))throw TypeError(`Family "${e.id}" request normalizer may not rewrite non-geometry option "${t}"`);let y=f?.colors?function(e,t,i){let a=new Set(["bg","fg","line","accent","muted","surface","border","shadow","font","embedFontImport"]),r=Object.keys(t).find(e=>!a.has(e));if(r)throw TypeError(`Family "${e.id}" returned unknown appearance color field "${r}"`);let n={...i};for(let i of["bg","fg","line","accent","muted","surface","border"]){let a=t[i];if(void 0===a)continue;let r=H(a);if(void 0===r)throw new eK(`Family "${e.id}" returned an unsafe ${i} paint`);n[i]=r}if(void 0!==t.font){let a=W(t.font);if(void 0===a)throw new eK(`Family "${e.id}" returned an unsafe font family`);if(a!==i.font)throw TypeError(`Family "${e.id}" request normalizer may not rewrite appearance field "font"`)}if(void 0!==t.shadow){if("boolean"!=typeof t.shadow)throw TypeError(`Family "${e.id}" returned a non-boolean shadow value`);if(t.shadow!==i.shadow)throw TypeError(`Family "${e.id}" request normalizer may not rewrite appearance field "shadow"`)}if(void 0!==t.embedFontImport){if("boolean"!=typeof t.embedFontImport)throw TypeError(`Family "${e.id}" returned a non-boolean embedFontImport value`);if(t.embedFontImport!==i.embedFontImport)throw TypeError(`Family "${e.id}" request normalizer may not rewrite appearance field "embedFontImport"`)}return n}(e,f.colors,a):a,v=e4(e,u.familyConfig,"config",c.valid),b=e4(e,f?.family,"appearance",c.valid);return{renderOptions:p,colors:y,...v?{familyConfig:v}:{},...b?{familyAppearance:b}:{}}}(r,n,g,h,s,l),v=tt(y.colors),b=tn.get(o)??tc(o.style),S=function(t){let i=new Set;for(let a of Object.values(e))for(let e of a){let a=t.config.themeVariables?.[e];"string"==typeof a&&a.length>0&&void 0===V(a)&&i.add(e)}return Object.freeze([...i].sort())}(n),$={version:2,colors:v,font:f,style:tt(s),face:tt(l),styled:d,inferredBackend:s?F(s):"default",styleReferences:b,...S.length>0?{unsafeThemeColorKeys:S}:{},...y.familyAppearance?{family:y.familyAppearance}:{}},w=tt({...$,digest:e9(e5(e8($)))});return tt({renderOptions:tt(y.renderOptions),appearance:w,...y.familyConfig?{familyConfig:y.familyConfig}:{}})}({family:w,source:S,options:p,...h?{style:h}:{},...y?{styleFace:y}:{}}),A=j.family?.visual;"architecture"===w.id&&eb(S.config.themeVariables,w.id,p,A),function(e,t,i){if("architecture"!==t||!e)return;let a=i?.edgeStroke;if("string"==typeof a&&"none"===a.trim().toLowerCase())throw new em("architecture.visual.edgeStroke",a);for(let t of["bg","surface","line","accent"]){let r=e[t];if("string"==typeof r&&"none"===r.trim().toLowerCase()&&("surface"!==t||i?.groupSurface?.trim().toLowerCase()==="none")&&!("surface"===t&&i?.groupHeaderSurface)&&!(("line"===t||"accent"===t)&&a))throw new em(t,r)}let r=i?.groupSurface;if(!i?.groupHeaderSurface&&"string"==typeof r&&"none"===r.trim().toLowerCase())throw new em("architecture.visual.groupSurface",r)}(p,w.id,A);let L=function(e,t,i,a,r,n){var o,s,l,c,u;let f,p,m,g,h;"svg"===i||"png"===i?"scene"==(f=t.styled||e.lowerScene?"scene":"family-svg")&&(p=R(m=t.styled?t.inferredBackend:"default",a.backendPolicy)):f="layout"===i?"layout":"terminal";let y="scene"===f?(g=new Set(e.scenePrimitiveEvidence.filter(e=>"applicable"===e.applicability).map(e=>e.primitive)),D.filter(e=>g.has(e.primitive))):[],v=p?y.flatMap(e=>tu(tp(e),tg(p,e))):[],b=[{id:e.identity.id,version:e.identity.version},...tu("operation:layout",void 0!==e.layout),...tu("operation:project-positioned",void 0!==e.projectPositioned),...tu("operation:lower-scene",void 0!==e.lowerScene),...tu("operation:render-svg",void 0!==e.renderSvg),...tu("operation:render-terminal",void 0!==e.renderAscii),...tu("core:scene","scene"===f),...tu("backend:scene-renderer",void 0!==p,p?.identity.version),...v],S=[tf("core:family-descriptor"),tf(e.identity.id,e.identity.version)],$;switch(f){case"scene":S.push(tf("core:scene"),tf("operation:layout"),tf("operation:lower-scene"),tf("backend:scene-renderer",p?.identity.version??td),...y.map(e=>tf(tp(e)))),$=!!(e.layout&&e.lowerScene&&p&&y.every(e=>tg(p,e)));break;case"family-svg":S.push(tf("operation:layout"),tf("operation:render-svg")),$=!!(e.layout&&e.renderSvg);break;case"terminal":S.push(tf("operation:render-terminal")),$=void 0!==e.renderAscii;break;case"layout":S.push(tf("operation:layout"),tf("operation:project-positioned")),$=!!(e.layout&&e.projectPositioned)}let w=function(e,t,i,a){let r=function(e,t,i,a){let r=t.length+i.length;if("string"!=typeof e||r>256)return;let n=e.length+16*r;if(n>16384)return;let o=`${e.length}:${e};${a};${t.length};${i.length};`;for(let e of t){if("string"!=typeof e.id||"string"!=typeof e.version||(n+=e.id.length+e.version.length)>16384)return;o+=`${e.id.length}:${e.id}${e.version.length}:${e.version}`}for(let e of i){if("string"!=typeof e.id||"string"!=typeof e.range||"string"!=typeof e.level||(n+=e.id.length+e.range.length+e.level.length)>16384)return;o+=`${e.id.length}:${e.id}${e.range.length}:${e.range}${e.level.length}:${e.level}`}return o.length<=8192?o:void 0}(e,t,i,a),n=void 0===r?void 0:th.get(r);if(B("capability-decision",void 0===r?"bypass":n?"hit":"miss",void 0===r?"tuple-budget":void 0),n)return n;let o=U(e,{offers:t,requirements:i,outputAvailable:a});return void 0!==r&&(th.size<32?th.set(r,o):B("capability-decision","store-skipped","capacity")),o}(i,b,S,$);if(!w.accepted){let a,r;throw c=f,u=p,r=(a=w.resolutions.filter(e=>"required"===e.level&&"selected"!==e.status).map(e=>e.id).join(", "))?` (unsatisfied capabilities: ${a})`:"","layout"===i?new eU(`No public layout projection registered for Mermaid family "${e.id}"${r}`,i,e,w):"ascii"===i||"unicode"===i||"html"===i?new eU(`No ASCII renderer registered for Mermaid family ${e.id}${r}`,i,e,w):t.styled&&!e.lowerScene?new eU(`Family "${e.id}" does not support styled rendering (no SceneGraph lowering registered). Render without the style option, or register a lowerScene hook for the family.${r}`,i,e,w):"scene"===c&&e.layout&&e.lowerScene&&!u?new eU(t.styled?`Style "${t.style?.name??"(inline)"}" requires an unavailable SceneGraph backend${r}`:`Default SceneGraph backend is not registered${r}`,i,e,w):new eU(`No SVG renderer registered for Mermaid family ${e.id}${r}`,i,e,w)}let x="terminal"===f?void 0:K(a.textMeasurement,t.font),C;if("scene"===f||"family-svg"===f){let t=Object.freeze("scene"===f?{mode:"scene",requestedId:m,selectedId:p.identity.id,version:p.identity.version,hostPolicy:void 0!==a.backendPolicy}:{mode:"family-svg"}),i={family:Object.freeze({id:e.identity.id,version:e.identity.version}),backend:t,...x?{textMeasurement:x.identity}:{}};C=Object.freeze({...i,digest:e9(e5(e8(i)))})}let O=void 0===r?void 0:Object.freeze((o=e.id,s=e.config,l=e.configDiagnostics,h=d(o),function(e,t,i,a){var r;let n;if(!i)return[];let o=a??d(e)?.configDiagnostics;return r=t.flatMap(t=>o?[...o({root:t,config:i})]:function(e,{root:t,config:i},a={}){let r=function(e,t,i){if(!i)return[];let a=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0,r=ex(t,i.section);if(!r)return a&&i.section in a?[{code:"INEFFECTIVE_CONFIG",field:i.section,message:`${e} config section "${i.section}" must be an object; the invalid value has no effect.`}]:[];let n=new Set(i.keys);return Object.keys(r).filter(e=>!n.has(e)).sort().map(t=>({code:"INEFFECTIVE_CONFIG",field:`${i.section}.${t}`,message:`${e} config field "${t}" is unknown and has no effect; check the spelling or remove it.`}))}(e,t,i),n=ex(t,i.section);if(n){for(let[e,t]of Object.entries(a))if(e in n&&!t.valid(n[e])){let a=`${i.section}.${e}`;r.push({code:"INEFFECTIVE_CONFIG",field:a,message:`${a} must be ${t.expected}; the invalid value has no effect.`})}}return[...r,...function(e,t,i,a={}){if(!i)return[];let r=ex(t,i.section);if(!r)return[];let n=new Set(i.noopKeys??[]);return Object.keys(r).filter(e=>{if(!n.has(e))return!1;let t=a[e];return!t||t.valid(r[e])}).sort().map(t=>({code:"INEFFECTIVE_CONFIG",field:`${i.section}.${t}`,message:`${e} config field "${t}" is accepted for ${e.includes(":")?"compatibility":"Mermaid compatibility"} but has no effect on this renderer.`}))}(e,t,i,a)]}(e,{root:t,config:i})),n=new Set,r.sort((e,t)=>z(e.field,t.field)||z(e.message,t.message)).filter(e=>{let t=`${e.code}\0${e.field}\0${e.message}`;return!n.has(t)&&(n.add(t),!0)})}(o,[r],s??h?.config,l??h?.configDiagnostics)).map(e=>Object.freeze({...e})));return Object.freeze({output:i,mode:f,family:e,...p?{backend:p}:{},...m?{requestedBackendId:m}:{},...void 0===O?{}:{configDiagnostics:O},...n?{onConfigDiagnostic:n}:{},capabilityDecision:w,...C?{executionDecision:C}:{},...x?{textMeasurement:x}:{}})}(w,j,o,c,p.mermaidConfig,f.onConfigDiagnostic),N=L.capabilityDecision,P=Object.freeze(N.resolutions.filter(ty)),_=Object.freeze({version:N.version,accepted:P.every(e=>"required"!==e.level||"selected"===e.status),resolutions:P}),G={version:2,authoredSource:S.originalText,source:S.text,options:e1(k),appearance:j.digest,...E?{familyConfig:E}:{},...L.textMeasurement?{textMeasurement:L.textMeasurement.identity}:{},capabilities:_},Y=e3(G,S),X=e3({...G,output:o,outputOptions:s,capabilities:N},S),Q=Object.freeze({version:2,output:o,source:tt(S),renderOptions:k,appearance:j,...E?{familyConfig:E}:{},capabilityDecision:N,explicitOptionFields:C,...0===O.length?{}:{resolutionDiagnostics:O},get sharedRequestDigest(){return Y()},get requestDigest(){return X()}});return eY.set(Q,L),Q}export{eK as a,eX as b,eQ as c,eZ as d,e9 as e,to as f,ts as g,tv as h};
4
+ `&&(u[e]=" ");let m=(function(e,t,i=0,a=g(e)){let r=[],n=new RegExp(t.source,t.flags.includes("g")?t.flags:`${t.flags}g`),o;for(;null!==(o=n.exec(e));)r.push(h(a,i+o.index,i+o.index+o[0].length)),0===o[0].length&&n.lastIndex++;return Object.freeze(r)})(u.join("").slice(l),RegExp(o.source,"gm"),l,a).filter(t=>p(e.slice(t.start.offset,t.end.offset)));return{...s?{frontmatter:h(a,0,l)}:{},...m.length>0?{initDirectives:m}:{},...d.length>0?{accessibilityDirectives:Object.freeze(d)}:{}}}(e,0,t,r,a),header:h(r,l,d),body:h(r,u,e.length)})}var ew=class extends Error{name="MermaidFamilyDetectionError";code;line;preservation;help;constructor(e){super(e.message),this.code=e.code,this.line=e.line,this.preservation=e.preservation,this.help=e.help}toJSON(){return{code:this.code,message:this.message,line:this.line,preservation:this.preservation,help:this.help}}};function ex(e,t){if(!e||"object"!=typeof e||Array.isArray(e))return;let i=e[t];return i&&"object"==typeof i&&!Array.isArray(i)?i:void 0}Object.freeze(["library","cli","codeMode","localMcp","hostedMcp","editor","website"]);var eC=["onConfigDiagnostic"],eO=(e,t)=>({type:"string",...void 0===t?{}:{default:t}}),ej=(e,t,i={})=>({type:"number",...void 0===t?{}:{default:t},...i}),ek=(e,t)=>ej(void 0,t,{minimum:0}),eE=(e,t)=>ej(void 0,t,{exclusiveMinimum:0}),eF=e=>ej(void 0,void 0,{minimum:1,maximum:1e3}),eA=(e,t)=>({type:"boolean",...void 0===t?{}:{default:t}}),eI=(e,t)=>({...eO(void 0,t),"x-agentic-mermaid-runtime-validator":"safeCssPaint"}),eT=(e,t)=>({...eO(void 0,t),"x-agentic-mermaid-runtime-validator":"safeCssFontFamily"}),eD=(e,t,i=[])=>({type:"object",additionalProperties:!1,properties:e,...0===i.length?{}:{required:i}}),ez={type:"string",enum:["uppercase","lowercase","capitalize"]},eL={...eD({groupHeaderHeight:eE(void 0),groupFontSize:eE(void 0),groupFontWeight:eF(void 0),groupLetterSpacing:ej(void 0),groupFont:eT(void 0),groupTextTransform:{...ez},groupPaddingX:ek(void 0),groupPaddingY:ek(void 0),groupLabelPaddingX:ek(void 0),groupCornerRadius:ek(void 0),groupLineWidth:ek(void 0),groupText:eI(void 0),serviceFontSize:eE(void 0),serviceFontWeight:eF(void 0),serviceLetterSpacing:ej(void 0),serviceTextTransform:{...ez},servicePaddingX:ek(void 0),servicePaddingY:ek(void 0),serviceCornerRadius:ek(void 0),serviceLineWidth:ek(void 0),serviceText:eI(void 0),edgeFontSize:eE(void 0),edgeFontWeight:eF(void 0),edgeLetterSpacing:ej(void 0),edgeTextTransform:{...ez},edgeLineWidth:ek(void 0),edgeBendRadius:ek(void 0),edgeStroke:eI(void 0),edgeText:eI(void 0),iconSize:eE(void 0),serviceIconSize:eE(void 0),junctionOuterRadius:eE(void 0),junctionInnerRadius:ek(void 0),groupSurface:eI(void 0),groupHeaderSurface:eI(void 0),groupBorder:eI(void 0),serviceSurface:eI(void 0),serviceBorder:eI(void 0)},void 0),"x-agentic-mermaid-runtime-validator":"architectureVisual"},eM={anyOf:[{type:"string"},(()=>{let e=k(),t=e.$defs,i=e=>{if(Array.isArray(e))return e.map(i);if(null===e||"object"!=typeof e)return e;let a=e.$ref;if("string"==typeof a&&a.startsWith("#/$defs/")){let e=t?.[a.slice(8)];if(!e)throw Error(`StyleSpec schema has unresolved local reference ${a}`);return i(e)}return Object.fromEntries(Object.entries(e).filter(([e])=>"$defs"!==e).map(([e,t])=>[e,i(t)]))},{$schema:a,$id:r,title:n,...o}=e;return i(o)})()],"x-agentic-mermaid-validation-expectation":"a registered Style name or StyleSpec"},eq={anyOf:[{type:"null"},{type:"string"},{type:"number"},{type:"boolean"},{type:"array",items:{$ref:"#/$defs/jsonValue"}},{type:"object",additionalProperties:{$ref:"#/$defs/jsonValue"}}],"x-agentic-mermaid-validation-expectation":"a finite, acyclic JSON value without prototype keys"},eR=["flowchart","state","class","er","architecture","c4"],eN=N({layoutHints:{validationExpectation:"contain integer ranks, node groups and edge IDs",schema:{type:"object",additionalProperties:!1,properties:{ranks:{type:"object",additionalProperties:{type:"integer",minimum:0,maximum:1e4}},adjacent:{type:"array",items:{type:"array",minItems:2,items:{type:"string"}}},shortEdges:{type:"array",items:{type:"string"}}}},applicableBuiltinFamilies:["flowchart","state"]},graphLayout:{validationExpectation:"be a graph layout selection object",schema:{anyOf:[eD({backend:{type:"string",const:"elk"},fallback:{type:"string",enum:["none"]}},void 0,["backend"]),eD({backend:{type:"string",const:"agentic"},fallback:{type:"string",enum:["none","elk"]}},void 0,["backend"])]},applicableBuiltinFamilies:["flowchart","state","architecture","class","er","requirement"]},layoutSafety:{validationExpectation:"be report or strict",schema:{type:"string",enum:["report","strict"],default:"report"}},bg:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0,"#FFFFFF")},fg:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0,"#27272A")},line:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0)},accent:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0)},muted:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0)},surface:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0)},border:{validationExpectation:"be a safe non-fetching CSS paint",schema:eI(void 0)},font:{validationExpectation:"be a safe non-fetching CSS font family or stack",schema:eT(void 0,"Inter")},style:{validationExpectation:"be a registered Style name or StyleSpec, or an array of them",schema:{anyOf:[eM,{type:"array",items:eM}],"x-agentic-mermaid-runtime-validator":"styleInput"}},padding:{validationExpectation:"be a non-negative finite number",schema:ek(void 0,40),applicableBuiltinFamilies:["flowchart","state","architecture","c4"]},nodeSpacing:{validationExpectation:"be a non-negative finite number",schema:ek(void 0,24),applicableBuiltinFamilies:eR},layerSpacing:{validationExpectation:"be a non-negative finite number",schema:ek(void 0,40),applicableBuiltinFamilies:eR},wrappingWidth:{validationExpectation:"be a positive finite number",schema:eE(void 0),applicableBuiltinFamilies:["flowchart"]},componentSpacing:{validationExpectation:"be a non-negative finite number",schema:ek(void 0),applicableBuiltinFamilies:[]},transparent:{validationExpectation:"be a boolean",schema:eA(void 0,!1)},interactive:{validationExpectation:"be a boolean",schema:eA(void 0,!1),applicableBuiltinFamilies:["xychart","pie","quadrant"]},shadow:{validationExpectation:"be a boolean",schema:eA(void 0,!1),applicableBuiltinFamilies:["flowchart","state","sequence","timeline","class","er","journey","xychart","pie","quadrant","gantt","mindmap","gitgraph","sankey"]},class:{validationExpectation:"be a class options object",schema:eD({hierarchicalNamespaces:eA(void 0,!0)},void 0),applicableBuiltinFamilies:["class"]},kanban:{validationExpectation:"be a kanban options object",schema:eD({maxWidth:eE(void 0)},void 0),applicableBuiltinFamilies:["kanban"]},pie:{validationExpectation:"be a pie options object",schema:eD({maxWidth:eE(void 0)},void 0),applicableBuiltinFamilies:["pie"]},radar:{validationExpectation:"be a radar options object",schema:eD({maxWidth:eE(void 0)},void 0),applicableBuiltinFamilies:["radar"]},architecture:{validationExpectation:"be an architecture options object",schema:eD({visual:eL},void 0),applicableBuiltinFamilies:["architecture"]},timeline:{validationExpectation:"be a timeline options object",schema:eD({maxWidth:eE(void 0)},void 0),applicableBuiltinFamilies:["timeline"]},journey:{validationExpectation:"be a journey options object",schema:eD({experienceCurve:eA(void 0,!0)},void 0),applicableBuiltinFamilies:["journey"]},gantt:{validationExpectation:"be a Gantt options object",schema:eD({dependencyArrows:eA(void 0,!1),criticalPath:eA(void 0,!1)},void 0),applicableBuiltinFamilies:["gantt"]},mermaidConfig:{validationExpectation:"be a plain JSON object",schema:{type:"object",additionalProperties:{$ref:"#/$defs/jsonValue"}}},embedFontImport:{validationExpectation:"be a boolean",schema:eA(void 0,!1)},compact:{validationExpectation:"be a boolean",schema:eA(void 0,!1)},idPrefix:{validationExpectation:"be non-empty and contain only ASCII letters, digits, underscore, hyphen, dot, and colon",schema:{...eO(void 0),pattern:"^[A-Za-z0-9_.:-]+$"}},security:{validationExpectation:"be default or strict",schema:{type:"string",enum:["default","strict"],default:"default"}},ganttToday:{validationExpectation:"be a string",schema:eO(void 0),applicableBuiltinFamilies:["gantt"]},seed:{validationExpectation:"be a finite number",schema:ej(void 0,0)}}),eP=Object.freeze(Object.keys(eN)),eB=Object.freeze(eP.filter(e=>"applicableBuiltinFamilies"in eN[e]));function e_(e){let t=e=>Array.isArray(e)?e.map(t):R(e)?Object.fromEntries(Object.entries(e).map(([e,i])=>[e,t(i)])):e;return t(e)}function eW(e){let t=String(e[0]??"");for(let i of e.slice(1))t+="number"==typeof i?`[${i}]`:`.${i}`;return`render option "${t}"`}function eV(e){return j(C(e).map(e=>e.path.length>0?`${eW(e.path)} ${e.message}`:`render options ${e.message}`),"render options")}function eJ(e,t,i){let a=t["x-agentic-mermaid-runtime-validator"];if("safeCssColor"===a&&void 0===V(e))return[{path:i,message:"must be a safe, non-fetching CSS color",generic:!1}];if("safeCssPaint"===a&&void 0===G(e))return[{path:i,message:"must be a safe, non-fetching CSS paint",generic:!1}];if("safeCssFontFamily"===a&&void 0===_(e))return[{path:i,message:"must be a safe, non-fetching CSS font family or stack",generic:!1}];if("styleInput"===a)try{A(e)}catch(e){return[{path:i,message:`is invalid: ${e instanceof Error?e.message:String(e)}`,generic:!1}]}if("architectureVisual"===a&&R(e)){let t=e.junctionOuterRadius,a=e.junctionInnerRadius;if("number"==typeof t&&"number"==typeof a&&a>t)return[{path:[...i,"junctionInnerRadius"],message:"must not exceed junctionOuterRadius",generic:!1}]}return[]}function eH(e){if(!R(e))return["render options must be a plain JSON object"];let t=eV(e);if(t.length>0)return t;let i=[],a=Q??=N(function(){let e={};for(let t of eP){let i=eN[t],a="terminalNote"in i?i.terminalNote:void 0,r="applicableBuiltinFamilies"in i?i.applicableBuiltinFamilies:void 0;e[t]={...e_(i.schema),"x-agentic-mermaid-terminal":i.terminal,...void 0===a?{}:{"x-agentic-mermaid-terminal-note":a},...void 0===r?{}:{"x-agentic-mermaid-applicable-builtin-families":[...r]}}}return{type:"object",additionalProperties:!1,properties:e,$defs:{jsonValue:e_(eq)}}}());for(let[t,r]of Object.entries(e)){if(!Object.hasOwn(eN,t)){i.push(`unknown render option "${t}"`);continue}if(null===r){i.push(`render option "${t}" must be omitted instead of null`);continue}let e=eN[t],n=Z(r,e.schema,a,[t],{diagnostics:"field",validateRuntime:eJ});n.length>0&&n.every(e=>e.generic&&1===e.path.length)?i.push(`render option "${t}" must ${e.validationExpectation}`):i.push(...n.map(e=>`${eW(e.path)} ${e.message}`))}return j(i,"render options")}var eG=class extends Error{constructor(e,t){super(`Parsed Mermaid family "${e}" serialized as family "${t}"`),this.expectedFamilyId=e,this.detectedFamilyId=t}expectedFamilyId;detectedFamilyId;name="ParsedDiagramFamilyMismatchError";code="PARSED_DIAGRAM_FAMILY_MISMATCH"},eU=class extends Error{name="RenderCapabilityError";code="UNSATISFIED_RENDER_CAPABILITIES";output;family;decision;constructor(e,t,i,a){super(e),this.output=t,this.family=Object.freeze({id:i.identity.id,version:i.identity.version}),this.decision=a}toJSON(){return{name:this.name,code:this.code,message:this.message,output:this.output,family:this.family,decision:this.decision}}},eK=class extends TypeError{constructor(e){super(e),this.name="RenderConfigError"}},eY=new WeakMap;function eX(e){let t=eY.get(e);if(!t)throw Error("Resolved render request has no internal execution plan");return t}function eZ(e,t=[]){let i,a=eY.get(e),r=a?.executionDecision,n=a&&Object.hasOwn(a,"textMeasurement")?a.textMeasurement:void 0;return Object.freeze({version:e.version,output:e.output,sharedRequestDigest:e.sharedRequestDigest,requestDigest:e.requestDigest,appearanceDigest:e.appearance.digest,capabilityDecision:e.capabilityDecision,diagnostics:(i=new Set,Object.freeze([...Object.hasOwn(e,"resolutionDiagnostics")?e.resolutionDiagnostics:[],...t,...L(e).flatMap(e=>"agentic"===e.requested&&"elk"===e.selected?[{code:"GRAPH_LAYOUT_FALLBACK",feature:"graph-layout",message:`Agentic graph layout used the requested ELK fallback: ${e.reason??"candidate rejected"}`}]:[])].flatMap(e=>{let t=e5(e);return i.has(t)?[]:(i.add(t),[Object.freeze({...e})])}))),...r?{executionDecision:r}:{},...n?{textMeasurement:n.identity}:{},...L(e).length?{layoutDecisions:L(e)}:{}})}function eQ(e){let t=e0.get(e);if(t)return t;let i=eY.get(e)?.backend?.identity.id??("layout"===e.output?`backend:${e.appearance.inferredBackend}`:void 0),a=Object.freeze({renderOptions:e.renderOptions,...e.appearance.face?{styleFace:e.appearance.face}:{},...i?{paintBackendId:i}:{},...e.familyConfig?{familyConfig:e.familyConfig}:{},...e.appearance.family?{familyAppearance:e.appearance.family}:{}});return eY.has(e)&&e0.set(e,a),a}var e0=new WeakMap;function e1(e){let t={};for(let i of eP){let a=e[i];void 0!==a&&(t[i]=a)}return t}var e2=new Set(["padding","nodeSpacing","layerSpacing","wrappingWidth","class"]);function e6(e,t="$",i=0,a=new Set,r={nodes:0,chars:0,opaque:!1,admission:void 0}){let n=r.admission;if(n?.valid)switch((++n.nodes>w.maxNodes||i>w.maxDepth)&&(n.valid=!1),typeof e){case"number":e-e!=0&&(n.valid=!1);break;case"undefined":case"bigint":case"symbol":case"function":n.valid=!1}if("string"==typeof e){if(r.chars+=e.length,r.chars>2e6)throw TypeError(`data exceeds the 2000000-character aggregate limit at ${t}`);return e}if(null===e||"object"!=typeof e)return e;if(i>64)throw TypeError(`data exceeds maximum depth 64 at ${t}`);if(++r.nodes>1e5)throw TypeError(`data exceeds the 100000-node aggregate limit at ${t}`);if(a.has(e))throw TypeError(`data must be acyclic at ${t}`);if(Array.isArray(e)){if(e.length>1e5)throw TypeError(`data array exceeds the 100000-entry limit at ${t}`);a.add(e);try{let o=[],s=Object.create(null);s.enumerable=s.configurable=s.writable=!0;for(let n=0;n<e.length;n++){if(n>=1e5)throw TypeError(`data array exceeds the 100000-entry limit at ${t}`);if(!Object.prototype.hasOwnProperty.call(e,n))throw TypeError(`data must not contain a sparse array at ${t}[${n}]`);s.value=e6(e[n],`${t}[${n}]`,i+1,a,r),Object.defineProperty(o,n,s)}return n&&o.length>w.maxItemsPerContainer&&(n.valid=!1),te(o,!r.opaque)}finally{a.delete(e)}}if(!R(e))return r.opaque=!0,n&&(n.valid=!1),e;a.add(e);try{let o={},s=0;for(let[l,c]of Object.entries(e)){if(r.chars+=l.length,r.chars>2e6)throw TypeError(`data exceeds the 2000000-character aggregate limit at ${t}.${l}`);if(void 0!==c){n&&(++s>w.maxItemsPerContainer||x(l))&&(n.valid=!1);let e=e6(c,`${t}.${l}`,i+1,a,r);l in o?Object.defineProperty(o,l,{value:e,enumerable:!0}):o[l]=e}}return te(o,!r.opaque)}finally{a.delete(e)}}function e4(e,t,i,a=!1){let r;if(void 0===t)return;if(!R(t))throw TypeError(`Family "${e.id}" returned ${i} data that is not a plain object`);if(a)return t;try{r=e6(t)}catch(t){throw TypeError(`Family "${e.id}" returned invalid ${i} data: ${t instanceof Error?t.message:String(t)}`)}let n={...eq,$defs:{jsonValue:eq}},o=Z(r,n,n,[`family${"config"===i?"Config":"Appearance"}`],{diagnostics:"field",validateRuntime:eJ});if(o.length>0){let t=o.map(e=>`${e.path.join(".")} ${e.message}`).join("; ");throw TypeError(`Family "${e.id}" returned invalid ${i} data: ${t}`)}return tt(r)}function e5(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e5).join(",")}]`;let t="{",i="";for(let a of Object.keys(e).sort()){let r=e[a];void 0!==r&&(t+=`${i}${JSON.stringify(a)}:${e5(r)}`,i=",")}return`${t}}`}function e3(e,t){try{let t,i;return t=e8(e),()=>(void 0===i&&(i=e9(e5(t)),t=void 0),i)}catch(e){throw e instanceof TypeError&&/aggregate limit/.test(e.message)?new a("sourceCharacters",t.originalText.length+t.text.length,!0):e}}function e8(e){let t,i={nodes:0,valid:2e6<=w.maxAggregateTextCharacters&&6e6<=w.maxAggregateTextBytes};try{t=ti(e,"render contract digest input",i)}catch(e){throw TypeError((e instanceof Error?e.message:String(e)).replace("data exceeds maximum depth","data exceeds maximum nesting depth"))}return i.valid||O(t,"render contract digest input",{allowUndefinedObjectProperties:!0}),t}function e9(e){let t=-0x340d631c,i=-0x7bdddcdb;for(let a=0;a<e.length;a++){let r=i^e.charCodeAt(a),n=(r>>>16)*435+((65535&r)*435>>>16)>>>16;i=Math.imul(r,435),t=Math.imul(t,435)+n+(r<<8)|0}return`fnv1a64:${(t>>>0).toString(16).padStart(8,"0")}${(i>>>0).toString(16).padStart(8,"0")}`}var e7=new WeakSet;function te(e,t=!0){return Object.freeze(e),t&&e7.add(e),e}function tt(e,t="$",i,a){let r;if(null===e||"object"!=typeof e||e7.has(e))return e;if(i??=new Set,a??=new WeakMap,i.has(e))throw TypeError(`render request contains a cycle at ${t}`);let n=a.get(e);if(n)return n;let o=Object.getPrototypeOf(e);if(!Array.isArray(e)&&o!==Object.prototype&&null!==o)throw TypeError(`render request contains a non-JSON object at ${t}`);if(i.add(e),Array.isArray(e)){let n=e.length,o=Array(n);for(let r=0;r<n;r++)r in e&&(o[r]=tt(e[r],`${t}[${r}]`,i,a));r=o}else{let n={};for(let[r,o]of Object.entries(e)){let e=tt(o,`${t}.${r}`,i,a);r in n?Object.defineProperty(n,r,{value:e,enumerable:!0}):n[r]=e}r=n}return i.delete(e),a.set(e,r),te(r)}function ti(e,t,i){try{return tt(i?e6(e,"$",0,new Set,{nodes:0,chars:0,opaque:!1,admission:i}):e6(e))}catch(e){throw TypeError(`${t} could not be snapshotted: ${e instanceof Error?e.message:String(e)}`)}}var ta=Object.freeze({serializable:tt({})}),tr=new WeakMap,tn=new WeakMap;function to(e){if(tr.has(e))return e;let t=tl(e),i=tt(I(t.serializable.style)),a=eH(t.serializable);if(a.length)throw new eK(`Invalid RenderOptions: ${a.join("; ")}`);let r=tc(t.serializable.style),n=Object.freeze({...t.serializable,...t.onConfigDiagnostic?{onConfigDiagnostic:t.onConfigDiagnostic}:{}});return tr.set(n,Object.freeze({...t,capturedStyle:i})),tn.set(t.serializable,r),n}function ts(e){let t=tr.get(e)?.capturedStyle;if(!t)throw TypeError("Render options have not been captured");return t.style?F(t.style):"default"}function tl(e){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new eK("Invalid RenderOptions: render options must be an object");let t=tr.get(e);if(t)return t;let i=[],a;for(let[t,r]of Object.entries(e))"onConfigDiagnostic"===t?a=r:void 0!==r&&i.push([t,r]);if(void 0!==a&&"function"!=typeof a)throw new eK("Invalid RenderOptions: onConfigDiagnostic must be a function");if(0===i.length&&void 0===a)return ta;let r=Object.fromEntries(i),n;try{n=ti(r,"RenderOptions")}catch(t){let e=(t instanceof Error?t.message:String(t)).replace("data exceeds maximum depth","render option tree exceeds maximum nesting depth");throw new eK(`Invalid RenderOptions: ${e}`)}return Object.freeze({serializable:n,...void 0===a?{}:{onConfigDiagnostic:a}})}function tc(e){return tt((void 0===e?[]:Array.isArray(e)?e:[e]).flatMap(e=>{if("string"!=typeof e||"crisp"===e)return[];let t=E(e);return t?[{input:e,canonicalId:t.canonicalId}]:[]}))}var td="1.0.0";function tu(e,t,i=td){return t?[{id:e,version:i}]:[]}function tf(e,t=`^${td}`){return{id:e,range:t,level:"required"}}function tp(e){return`scene-primitive:${e.primitive}/${e.feature}/${e.operation}`}var tm=new WeakMap;function tg(e,t){let i=tm.get(e.backend);return i||(i=new Set(z.filter(t=>e.backend.capabilities.some(e=>e.primitive===t.primitive&&e.feature===t.feature&&e.operation===t.operation&&"unsupported"!==e.realization))),tm.set(e.backend,i)),i.has(t)}var th=new Map;function ty(e){return!e.id.startsWith("output:")&&!e.id.startsWith("operation:")&&!e.id.startsWith("backend:")&&!e.id.startsWith("scene-primitive:")&&"core:scene"!==e.id}function tv(a,n={},o="svg",s,c={}){let f=tl(n),p=f.serializable,m=eV(p);if(m.length>0)throw new eK(`Invalid RenderOptions: ${m.join("; ")}`);let g=f.capturedStyle??I(p.style),h=g.style,y=tt(g.face),v=f.capturedStyle?[]:eH(p);if(v.length>0)throw new eK(`Invalid RenderOptions: ${v.join("; ")}`);let b,S=tt($(a,p.mermaidConfig??{},e=>c.familyDescriptor?c.familyDescriptor:"registered"===(b=function(e,t="strict"){let i=l(e),a=u(i,t);if(a)return{kind:"registered",family:a};let r=function(e,t=eS){let i=(e.split(";")[0]??"").trim().toLowerCase();return t.families.flatMap(e=>e.headers.map(t=>({family:e,header:t}))).sort((e,t)=>t.header.value.length-e.header.value.length||D(e.family.id,t.family.id)).find(e=>(function(e,t){let i=t.trim().toLowerCase();if(e===i)return!0;if(!e.startsWith(i))return!1;let a=e[i.length];return void 0!==a&&/[\s:]/.test(a)})(i,e.header.value))??null}(i);return r?{kind:"upstream",match:r}:{kind:"unknown",header:e}}(e)).kind?b.family:null)),w=c.familyDescriptor??function(e,t){if("registered"===t.kind)return t.family;throw new ew(function(e,t,i,a,r){let n=eS.provenance.version;if("unknown"===e.kind)return{code:"UNKNOWN_HEADER",message:`Unrecognized Mermaid header: "${e.header}"`,line:1,preservation:{version:1,classification:"unknown",source:t,header:e.header,mermaidVersion:n,spans:e$(t,a??e.header,i,null)},help:"Check for a Mermaid upgrade or register a namespaced family descriptor; the source was preserved unchanged."};let{family:o,header:s}=e.match,l="inventory-only"===s.agenticStatus?"inventory-only":"unsupported",c="native"===s.agenticStatus;return{code:c?"FAMILY_DESCRIPTOR_MISMATCH":"UNSUPPORTED_FAMILY",message:c?`Mermaid ${n} header "${s.value}" is marked native but no installed family descriptor claimed it`:`Mermaid ${n} family "${o.id}" is ${l} in Agentic Mermaid`,line:1,preservation:{version:1,classification:l,source:t,header:s.value,upstreamFamilyId:o.id,mermaidVersion:n,spans:e$(t,a??s.value,i,null)},help:c?"Report a descriptor/manifest mismatch; the source was preserved unchanged.":`Install a family descriptor for "${s.value}" or use a currently native family; the source was preserved unchanged.`}}("unknown"===t.kind?{...t,header:e.lines[0]??e.firstLine}:t,e.originalText,e.authoredWrapperLength??e.wrapperSource?.length??0,e.authoredHeader??e.lines[0]??e.firstLine,0))}(S,b);if(void 0!==c.expectedFamilyId&&w.id!==c.expectedFamilyId)throw new eG(c.expectedFamilyId,w.id);r("sourceCharacters",S.originalText.length+S.text.length);let x=M(S.config.themeCSS,p.security??"default");if(x)throw new eK(x);"architecture"!==w.id&&eb(S.config.themeVariables,w.id,p),function(e,t){let i=eh(e[t]);if(i){if("timeline"===t)ev(i,"timeline","sectionFills",!1),ev(i,"timeline","sectionColours",!1),(void 0===i.sectionColours||Array.isArray(i.sectionColours)&&0===i.sectionColours.length)&&ev(i,"timeline","sectionColors",!1);else if("journey"===t)ev(i,"journey","actorColours",!0),ev(i,"journey","sectionFills",!1),ev(i,"journey","sectionColours",!1),ey(i,"journey","titleColor",!1);else if("requirement"===t)ey(i,"requirement","rect_fill",!0),ey(i,"requirement","rect_border_color",!0),ey(i,"requirement","text_color",!1);else if("sankey"===t){let e=i.linkColor;if("source"!==e&&"target"!==e&&"gradient"!==e&&ey(i,"sankey","linkColor",!0),void 0===i.nodeColors)return;let t=eh(i.nodeColors);if(!t)throw new eg("sankey.nodeColors",i.nodeColors,!1,"map");let a=void 0!==e&&"gradient"!==e;for(let[e,i]of Object.entries(t))if(void 0===J(i,a))throw new eg(/^[\w-]+$/.test(e)?`sankey.nodeColors.${e}`:`sankey.nodeColors[${JSON.stringify(e)}]`,i,a)}}}(S.frontmatter,w.id);let C=Object.freeze(eP.filter(e=>void 0!==p[e])),O=function(e,t){if(e.id.startsWith("family:")){let i=new Set(e.applicableRenderOptions??[]);return Object.freeze(t.flatMap(t=>!eB.includes(t)||i.has(t)?[]:[Object.freeze({code:"RENDER_OPTION_NOT_APPLICABLE",feature:`render-option:${t}`,message:`Render option "${t}" does not apply to extension family "${e.id}". Its FamilyDescriptor does not list the field in applicableRenderOptions.`})]))}let i=e.id;return Object.freeze(t.flatMap(e=>{let t=eN[e];if(!("applicableBuiltinFamilies"in t))return[];let a=t.applicableBuiltinFamilies;if(a.includes(i))return[];let r=0===a.length?"No built-in family currently consumes this option.":`Applicable built-in families: ${a.join(", ")}.`;return[Object.freeze({code:"RENDER_OPTION_NOT_APPLICABLE",feature:`render-option:${e}`,message:`Render option "${e}" does not apply to built-in Mermaid family "${i}". ${r}`})]}))}(w,C),{appearance:j,renderOptions:k,familyConfig:E}=function(a){let{family:r,source:n,options:o,style:s,styleFace:l}=a,c="strict"===o.security?{...o,embedFontImport:!1}:{...o};o.graphLayout&&(c.graphLayout={...o.graphLayout,fallback:o.graphLayout.fallback??"none"});let d=void 0!==s&&T(s);d&&(c=function(t,i,a){let r={...t},n=t=>e[t].some(e=>a?.[e]!==void 0);for(let e of["bg","fg","line","accent","muted","surface","border"])void 0!==r[e]||n(e)||i.colors?.[e]===void 0||(r[e]=i.colors[e]);return void 0===r.font&&void 0!==i.font&&(r.font=i.font),r}(c,s,n.config.themeVariables));let u=o.font??n.config.fontFamily??i(n.config.themeVariables,"fontFamily")??c.font??"Inter",f=_(u)??u,{style:p,...m}=c,g={...m,...s?{style:s}:{},font:f,mermaidConfig:n.config},h={...t(g,n.config,f)},y=function(e,t,i,a,r,n){if(!e.normalizeRequest)return{renderOptions:i,colors:a};let o=Object.freeze({source:tt(t),renderOptions:tt(i),colors:tt(a),...r?{style:tt(r)}:{},...n?{styleFace:tt(n)}:{}}),s=e.normalizeRequest(o);if(void 0===s)return{renderOptions:i,colors:a};let l,c={nodes:0,valid:!0};try{l=ti(s,`Family "${e.id}" request normalizer result`,c)}catch(t){throw TypeError(`Family "${e.id}" request normalizer returned invalid data: ${t instanceof Error?t.message:String(t)}`)}if(!R(l))throw TypeError(`Family "${e.id}" request normalizer must return a plain object`);let d=Object.keys(l).find(e=>!["renderOptions","familyConfig","appearance"].includes(e));if(d)throw TypeError(`Family "${e.id}" request normalizer returned unknown field "${d}"`);let u=l,f=u.appearance;if(void 0!==f){if(!R(f))throw TypeError(`Family "${e.id}" request normalizer returned a non-object appearance`);let t=Object.keys(f).find(e=>!["colors","family"].includes(e));if(t)throw TypeError(`Family "${e.id}" request normalizer returned unknown appearance field "${t}"`)}let p=u.renderOptions??i;if(void 0!==p.onConfigDiagnostic)throw TypeError(`Family "${e.id}" request normalizer may not return executable option "onConfigDiagnostic"`);let m=eH(Object.fromEntries(Object.entries(p).filter(([e,t])=>void 0!==t&&!eC.includes(e))));if(m.length>0)throw new eK(`Family "${e.id}" returned invalid normalized RenderOptions: ${m.join("; ")}`);let g=e1(i),h=e1(p);for(let t of eP)if(!e2.has(t)&&e5(g[t])!==e5(h[t]))throw TypeError(`Family "${e.id}" request normalizer may not rewrite non-geometry option "${t}"`);let y=f?.colors?function(e,t,i){let a=new Set(["bg","fg","line","accent","muted","surface","border","shadow","font","embedFontImport"]),r=Object.keys(t).find(e=>!a.has(e));if(r)throw TypeError(`Family "${e.id}" returned unknown appearance color field "${r}"`);let n={...i};for(let i of["bg","fg","line","accent","muted","surface","border"]){let a=t[i];if(void 0===a)continue;let r=G(a);if(void 0===r)throw new eK(`Family "${e.id}" returned an unsafe ${i} paint`);n[i]=r}if(void 0!==t.font){let a=_(t.font);if(void 0===a)throw new eK(`Family "${e.id}" returned an unsafe font family`);if(a!==i.font)throw TypeError(`Family "${e.id}" request normalizer may not rewrite appearance field "font"`)}if(void 0!==t.shadow){if("boolean"!=typeof t.shadow)throw TypeError(`Family "${e.id}" returned a non-boolean shadow value`);if(t.shadow!==i.shadow)throw TypeError(`Family "${e.id}" request normalizer may not rewrite appearance field "shadow"`)}if(void 0!==t.embedFontImport){if("boolean"!=typeof t.embedFontImport)throw TypeError(`Family "${e.id}" returned a non-boolean embedFontImport value`);if(t.embedFontImport!==i.embedFontImport)throw TypeError(`Family "${e.id}" request normalizer may not rewrite appearance field "embedFontImport"`)}return n}(e,f.colors,a):a,v=e4(e,u.familyConfig,"config",c.valid),b=e4(e,f?.family,"appearance",c.valid);return{renderOptions:p,colors:y,...v?{familyConfig:v}:{},...b?{familyAppearance:b}:{}}}(r,n,g,h,s,l),v=tt(y.colors),b=tn.get(o)??tc(o.style),S=function(t){let i=new Set;for(let a of Object.values(e))for(let e of a){let a=t.config.themeVariables?.[e];"string"==typeof a&&a.length>0&&void 0===V(a)&&i.add(e)}return Object.freeze([...i].sort())}(n),$={version:2,colors:v,font:f,style:tt(s),face:tt(l),styled:d,inferredBackend:s?F(s):"default",styleReferences:b,...S.length>0?{unsafeThemeColorKeys:S}:{},...y.familyAppearance?{family:y.familyAppearance}:{}},w=tt({...$,digest:e9(e5(e8($)))});return tt({renderOptions:tt(y.renderOptions),appearance:w,...y.familyConfig?{familyConfig:y.familyConfig}:{}})}({family:w,source:S,options:p,...h?{style:h}:{},...y?{styleFace:y}:{}}),A=j.family?.visual;"architecture"===w.id&&eb(S.config.themeVariables,w.id,p,A),function(e,t,i){if("architecture"!==t||!e)return;let a=i?.edgeStroke;if("string"==typeof a&&"none"===a.trim().toLowerCase())throw new em("architecture.visual.edgeStroke",a);for(let t of["bg","surface","line","accent"]){let r=e[t];if("string"==typeof r&&"none"===r.trim().toLowerCase()&&("surface"!==t||i?.groupSurface?.trim().toLowerCase()==="none")&&!("surface"===t&&i?.groupHeaderSurface)&&!(("line"===t||"accent"===t)&&a))throw new em(t,r)}let r=i?.groupSurface;if(!i?.groupHeaderSurface&&"string"==typeof r&&"none"===r.trim().toLowerCase())throw new em("architecture.visual.groupSurface",r)}(p,w.id,A);let L=function(e,t,i,a,r,n){var o,s,l,c,u;let f,p,m,g,h;"svg"===i||"png"===i?"scene"==(f=t.styled||e.lowerScene?"scene":"family-svg")&&(p=q(m=t.styled?t.inferredBackend:"default",a.backendPolicy)):f="layout"===i?"layout":"terminal";let y="scene"===f?(g=new Set(e.scenePrimitiveEvidence.filter(e=>"applicable"===e.applicability).map(e=>e.primitive)),z.filter(e=>g.has(e.primitive))):[],v=p?y.flatMap(e=>tu(tp(e),tg(p,e))):[],b=[{id:e.identity.id,version:e.identity.version},...tu("operation:layout",void 0!==e.layout),...tu("operation:project-positioned",void 0!==e.projectPositioned),...tu("operation:lower-scene",void 0!==e.lowerScene),...tu("operation:render-svg",void 0!==e.renderSvg),...tu("operation:render-terminal",void 0!==e.renderAscii),...tu("core:scene","scene"===f),...tu("backend:scene-renderer",void 0!==p,p?.identity.version),...v],S=[tf("core:family-descriptor"),tf(e.identity.id,e.identity.version)],$;switch(f){case"scene":S.push(tf("core:scene"),tf("operation:layout"),tf("operation:lower-scene"),tf("backend:scene-renderer",p?.identity.version??td),...y.map(e=>tf(tp(e)))),$=!!(e.layout&&e.lowerScene&&p&&y.every(e=>tg(p,e)));break;case"family-svg":S.push(tf("operation:layout"),tf("operation:render-svg")),$=!!(e.layout&&e.renderSvg);break;case"terminal":S.push(tf("operation:render-terminal")),$=void 0!==e.renderAscii;break;case"layout":S.push(tf("operation:layout"),tf("operation:project-positioned")),$=!!(e.layout&&e.projectPositioned)}let w=function(e,t,i,a){let r=function(e,t,i,a){let r=t.length+i.length;if("string"!=typeof e||r>256)return;let n=e.length+16*r;if(n>16384)return;let o=`${e.length}:${e};${a};${t.length};${i.length};`;for(let e of t){if("string"!=typeof e.id||"string"!=typeof e.version||(n+=e.id.length+e.version.length)>16384)return;o+=`${e.id.length}:${e.id}${e.version.length}:${e.version}`}for(let e of i){if("string"!=typeof e.id||"string"!=typeof e.range||"string"!=typeof e.level||(n+=e.id.length+e.range.length+e.level.length)>16384)return;o+=`${e.id.length}:${e.id}${e.range.length}:${e.range}${e.level.length}:${e.level}`}return o.length<=8192?o:void 0}(e,t,i,a),n=void 0===r?void 0:th.get(r);if(B("capability-decision",void 0===r?"bypass":n?"hit":"miss",void 0===r?"tuple-budget":void 0),n)return n;let o=U(e,{offers:t,requirements:i,outputAvailable:a});return void 0!==r&&(th.size<32?th.set(r,o):B("capability-decision","store-skipped","capacity")),o}(i,b,S,$);if(!w.accepted){let a,r;throw c=f,u=p,r=(a=w.resolutions.filter(e=>"required"===e.level&&"selected"!==e.status).map(e=>e.id).join(", "))?` (unsatisfied capabilities: ${a})`:"","layout"===i?new eU(`No public layout projection registered for Mermaid family "${e.id}"${r}`,i,e,w):"ascii"===i||"unicode"===i||"html"===i?new eU(`No ASCII renderer registered for Mermaid family ${e.id}${r}`,i,e,w):t.styled&&!e.lowerScene?new eU(`Family "${e.id}" does not support styled rendering (no SceneGraph lowering registered). Render without the style option, or register a lowerScene hook for the family.${r}`,i,e,w):"scene"===c&&e.layout&&e.lowerScene&&!u?new eU(t.styled?`Style "${t.style?.name??"(inline)"}" requires an unavailable SceneGraph backend${r}`:`Default SceneGraph backend is not registered${r}`,i,e,w):new eU(`No SVG renderer registered for Mermaid family ${e.id}${r}`,i,e,w)}let x="terminal"===f?void 0:K(a.textMeasurement,t.font),C;if("scene"===f||"family-svg"===f){let t=Object.freeze("scene"===f?{mode:"scene",requestedId:m,selectedId:p.identity.id,version:p.identity.version,hostPolicy:void 0!==a.backendPolicy}:{mode:"family-svg"}),i={family:Object.freeze({id:e.identity.id,version:e.identity.version}),backend:t,...x?{textMeasurement:x.identity}:{}};C=Object.freeze({...i,digest:e9(e5(e8(i)))})}let O=void 0===r?void 0:Object.freeze((o=e.id,s=e.config,l=e.configDiagnostics,h=d(o),function(e,t,i,a){var r;let n;if(!i)return[];let o=a??d(e)?.configDiagnostics;return r=t.flatMap(t=>o?[...o({root:t,config:i})]:function(e,{root:t,config:i},a={}){let r=function(e,t,i){if(!i)return[];let a=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0,r=ex(t,i.section);if(!r)return a&&i.section in a?[{code:"INEFFECTIVE_CONFIG",field:i.section,message:`${e} config section "${i.section}" must be an object; the invalid value has no effect.`}]:[];let n=new Set(i.keys);return Object.keys(r).filter(e=>!n.has(e)).sort().map(t=>({code:"INEFFECTIVE_CONFIG",field:`${i.section}.${t}`,message:`${e} config field "${t}" is unknown and has no effect; check the spelling or remove it.`}))}(e,t,i),n=ex(t,i.section);if(n){for(let[e,t]of Object.entries(a))if(e in n&&!t.valid(n[e])){let a=`${i.section}.${e}`;r.push({code:"INEFFECTIVE_CONFIG",field:a,message:`${a} must be ${t.expected}; the invalid value has no effect.`})}}return[...r,...function(e,t,i,a={}){if(!i)return[];let r=ex(t,i.section);if(!r)return[];let n=new Set(i.noopKeys??[]);return Object.keys(r).filter(e=>{if(!n.has(e))return!1;let t=a[e];return!t||t.valid(r[e])}).sort().map(t=>({code:"INEFFECTIVE_CONFIG",field:`${i.section}.${t}`,message:`${e} config field "${t}" is accepted for ${e.includes(":")?"compatibility":"Mermaid compatibility"} but has no effect on this renderer.`}))}(e,t,i,a)]}(e,{root:t,config:i})),n=new Set,r.sort((e,t)=>D(e.field,t.field)||D(e.message,t.message)).filter(e=>{let t=`${e.code}\0${e.field}\0${e.message}`;return!n.has(t)&&(n.add(t),!0)})}(o,[r],s??h?.config,l??h?.configDiagnostics)).map(e=>Object.freeze({...e})));return Object.freeze({output:i,mode:f,family:e,...p?{backend:p}:{},...m?{requestedBackendId:m}:{},...void 0===O?{}:{configDiagnostics:O},...n?{onConfigDiagnostic:n}:{},capabilityDecision:w,...C?{executionDecision:C}:{},...x?{textMeasurement:x}:{}})}(w,j,o,c,p.mermaidConfig,f.onConfigDiagnostic),N=L.capabilityDecision,P=Object.freeze(N.resolutions.filter(ty)),W=Object.freeze({version:N.version,accepted:P.every(e=>"required"!==e.level||"selected"===e.status),resolutions:P}),H={version:2,authoredSource:S.originalText,source:S.text,options:e1(k),appearance:j.digest,...E?{familyConfig:E}:{},...L.textMeasurement?{textMeasurement:L.textMeasurement.identity}:{},capabilities:W},Y=e3(H,S),X=e3({...H,output:o,outputOptions:s,capabilities:N},S),Z=Object.freeze({version:2,output:o,source:tt(S),renderOptions:k,appearance:j,...E?{familyConfig:E}:{},capabilityDecision:N,explicitOptionFields:C,...0===O.length?{}:{resolutionDiagnostics:O},get sharedRequestDigest(){return Y()},get requestDigest(){return X()}});return eY.set(Z,L),Z}export{eK as a,eX as b,eZ as c,eQ as d,e9 as e,to as f,ts as g,tv as h};