@kingsoftcloud/ksadk-web 0.3.19 → 0.3.21

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 (190) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +2 -2
  3. package/RELEASE_PROVENANCE.json +2 -2
  4. package/dist-ksadk/assets/{ArtifactsPanel-cjsDWTLW.js → ArtifactsPanel-BTenzy1K.js} +1 -1
  5. package/dist-ksadk/assets/{CodeBlock-DTtT6SBI.js → CodeBlock-CWxI359u.js} +1 -1
  6. package/dist-ksadk/assets/{MathMessageMarkdown-Dap7DsE1.js → MathMessageMarkdown-B15VlKfr.js} +1 -1
  7. package/dist-ksadk/assets/{MermaidBlock-C2QkLej8.js → MermaidBlock-CF2HMJlR.js} +6 -6
  8. package/dist-ksadk/assets/{NativeTerminalPanel-CeLWBCnF.js → NativeTerminalPanel-BxxcxRm3.js} +1 -1
  9. package/dist-ksadk/assets/{OfficialA2uiRenderer-BshRBsxZ.js → OfficialA2uiRenderer-CV3Q-e0k.js} +1 -1
  10. package/dist-ksadk/assets/{abnfDiagram-VCTEODGH-RvCk4kKS.js → abnfDiagram-VCTEODGH-C17mm8XX.js} +1 -1
  11. package/dist-ksadk/assets/{arc-R-NvbHBi.js → arc-CCLBsX1i.js} +1 -1
  12. package/dist-ksadk/assets/architecture-7GRP2DOG-BY2RHa5r.js +1 -0
  13. package/dist-ksadk/assets/{architectureDiagram-5GKGNRK7-CWyeEVzn.js → architectureDiagram-5GKGNRK7-3pYSVy-d.js} +1 -1
  14. package/dist-ksadk/assets/{blockDiagram-NRAW4CY4-CHbhUWj9.js → blockDiagram-NRAW4CY4-CsOB-WCp.js} +1 -1
  15. package/dist-ksadk/assets/{c4Diagram-UCG6FXSJ-BJAftB45.js → c4Diagram-UCG6FXSJ-CU7GynG6.js} +1 -1
  16. package/dist-ksadk/assets/channel-DwzgTDPP.js +1 -0
  17. package/dist-ksadk/assets/chunk-2Q5K7J3B-N0kjk6xb.js +1 -0
  18. package/dist-ksadk/assets/{chunk-5VM5RSS4-BHufOSfh.js → chunk-5VM5RSS4-Cq3ikYM6.js} +1 -1
  19. package/dist-ksadk/assets/{chunk-F27PBJKO-BNPW42o9.js → chunk-F27PBJKO-6qvmutbT.js} +1 -1
  20. package/dist-ksadk/assets/{chunk-G27WJ6UU-D_eOFZiC.js → chunk-G27WJ6UU-BPmeKaDK.js} +1 -1
  21. package/dist-ksadk/assets/{chunk-JWPE2WC7-DEVN_PSR.js → chunk-JWPE2WC7-zKI5bjIE.js} +1 -1
  22. package/dist-ksadk/assets/{chunk-LCL6LL3I-DjGV_Lnh.js → chunk-LCL6LL3I-DZu2N18T.js} +1 -1
  23. package/dist-ksadk/assets/{chunk-POPQ4Y6H-C2i8ZB07.js → chunk-POPQ4Y6H-BGNgCFIF.js} +1 -1
  24. package/dist-ksadk/assets/{chunk-RHFEMEQ7-DMk7_iWC.js → chunk-RHFEMEQ7-G_H04lee.js} +1 -1
  25. package/dist-ksadk/assets/{chunk-SVP7TREG-wHQkXddN.js → chunk-SVP7TREG-BFQPbitJ.js} +1 -1
  26. package/dist-ksadk/assets/{chunk-XXDRQBXY-gvpc9yiQ.js → chunk-XXDRQBXY-BbCZlhsd.js} +1 -1
  27. package/dist-ksadk/assets/classDiagram-DTDB5LWJ-tbe25yqD.js +1 -0
  28. package/dist-ksadk/assets/classDiagram-v2-JRS7N3AN-tbe25yqD.js +1 -0
  29. package/dist-ksadk/assets/{cose-bilkent-JH36ORCC-BF-zBbK8.js → cose-bilkent-JH36ORCC-C4DjCklV.js} +1 -1
  30. package/dist-ksadk/assets/cynefin-OW5HDTMX-CSDfrArA.js +1 -0
  31. package/dist-ksadk/assets/{cynefinDiagram-5FMLGOSQ-0_hg7nkA.js → cynefinDiagram-5FMLGOSQ-CT5ZGJWR.js} +1 -1
  32. package/dist-ksadk/assets/{dagre-3AP2YEHR-uSuKjV2i.js → dagre-3AP2YEHR-DpvhjWtg.js} +1 -1
  33. package/dist-ksadk/assets/{dagre-BCQPdEAN.js → dagre-DXyfwLa_.js} +1 -1
  34. package/dist-ksadk/assets/{diagram-S7CK7UJ4-ay17NfAC.js → diagram-S7CK7UJ4-BFXOsPnj.js} +1 -1
  35. package/dist-ksadk/assets/{diagram-UQ7AKVKN-CaUhPrNE.js → diagram-UQ7AKVKN-DjknKAEr.js} +1 -1
  36. package/dist-ksadk/assets/{diagram-VSXAHHWV-upF8B0NL.js → diagram-VSXAHHWV-BB85Ss9s.js} +1 -1
  37. package/dist-ksadk/assets/{diagram-VX7I27RA-B4t46LEt.js → diagram-VX7I27RA-BXi257cj.js} +1 -1
  38. package/dist-ksadk/assets/{diagram-Z3DM3KII-BeHjswE7.js → diagram-Z3DM3KII-DpUD78cp.js} +1 -1
  39. package/dist-ksadk/assets/{dist-DIeaHG12.js → dist-B06powmG.js} +1 -1
  40. package/dist-ksadk/assets/{dist-Bt4Xk1Ro.js → dist-BNv0PyLr.js} +1 -1
  41. package/dist-ksadk/assets/{dist-B0PMHWqd.js → dist-BRZbKA2x.js} +1 -1
  42. package/dist-ksadk/assets/{dist-B0s4RUpo.js → dist-BYwMHGkY.js} +1 -1
  43. package/dist-ksadk/assets/{dist-CIZ7o8ol.js → dist-BZW9mKsK.js} +1 -1
  44. package/dist-ksadk/assets/{dist-COzkztpc.js → dist-BeVI-Kxd.js} +1 -1
  45. package/dist-ksadk/assets/{dist-uAoeCAZ2.js → dist-Bq9DY1Dv.js} +1 -1
  46. package/dist-ksadk/assets/{dist-CW5ZHS5y.js → dist-Bzd2QgV8.js} +1 -1
  47. package/dist-ksadk/assets/{dist-h0bOCJVW.js → dist-CMFDdLf4.js} +1 -1
  48. package/dist-ksadk/assets/{dist-58qYwY0M.js → dist-CV9d3y2j.js} +1 -1
  49. package/dist-ksadk/assets/{dist-Be3VXZq8.js → dist-CXVLGraS.js} +1 -1
  50. package/dist-ksadk/assets/{dist-Bt0YWq2H.js → dist-CczefzvC.js} +1 -1
  51. package/dist-ksadk/assets/{dist-C577ALLK.js → dist-Cj2Auk2b.js} +1 -1
  52. package/dist-ksadk/assets/{dist-DfFlb9ip.js → dist-CnQbOxbh.js} +1 -1
  53. package/dist-ksadk/assets/{dist-Dze75pZq.js → dist-DBGrMizf.js} +1 -1
  54. package/dist-ksadk/assets/{dist-DvOmTQAV.js → dist-DavYaJ9Q.js} +1 -1
  55. package/dist-ksadk/assets/{dist-BGzoFqM2.js → dist-Dycz9kOr.js} +1 -1
  56. package/dist-ksadk/assets/{dist-BLCD6xMk.js → dist-R5ApucPA.js} +1 -1
  57. package/dist-ksadk/assets/{dist-AF7gi0D5.js → dist-TZoM3zbE.js} +1 -1
  58. package/dist-ksadk/assets/{dist-CdhMAiGd.js → dist-WrvDVf9t.js} +1 -1
  59. package/dist-ksadk/assets/{dist-mkEF0-z9.js → dist-Z1yWL6bl.js} +1 -1
  60. package/dist-ksadk/assets/{dist-Bx4az-XW.js → dist-r1VjfiSE.js} +1 -1
  61. package/dist-ksadk/assets/{ebnfDiagram-PWID7BFC-CZKqGdhK.js → ebnfDiagram-PWID7BFC-lDIRqB5V.js} +1 -1
  62. package/dist-ksadk/assets/{erDiagram-SSCWMZ5O-CfQ9oOg4.js → erDiagram-SSCWMZ5O-BiSx4WXZ.js} +1 -1
  63. package/dist-ksadk/assets/eventmodeling-NTZA5JFV-CA5gOEzT.js +1 -0
  64. package/dist-ksadk/assets/flowDiagram-A5DVABFB-BEQAxSrx.js +1 -0
  65. package/dist-ksadk/assets/{ganttDiagram-EL5Y4UJY-CWdRcbsA.js → ganttDiagram-EL5Y4UJY-B2XMRclR.js} +1 -1
  66. package/dist-ksadk/assets/gitGraph-4MIJSDKK-DhOY6HCO.js +1 -0
  67. package/dist-ksadk/assets/{gitGraphDiagram-WWUBYQGX-S2TxceQ8.js → gitGraphDiagram-WWUBYQGX-B0Im0UQT.js} +1 -1
  68. package/dist-ksadk/assets/index-B9UP7He9.css +2 -0
  69. package/dist-ksadk/assets/index-DybHfQCT.js +1135 -0
  70. package/dist-ksadk/assets/info-A6RAGUB7-Dp4VkXgu.js +1 -0
  71. package/dist-ksadk/assets/{infoDiagram-RXCK75RN-7M0hPUvw.js → infoDiagram-RXCK75RN-CoIIy7xO.js} +1 -1
  72. package/dist-ksadk/assets/{ishikawaDiagram-5VMMS53U-DApt_KC9.js → ishikawaDiagram-5VMMS53U-CdOil3Ww.js} +1 -1
  73. package/dist-ksadk/assets/{journeyDiagram-EYS64GPL-03NWnwcI.js → journeyDiagram-EYS64GPL-ag6kSf5d.js} +1 -1
  74. package/dist-ksadk/assets/{kanban-definition-3QL26DDD-CWrM-ciB.js → kanban-definition-3QL26DDD-CmIFaKQY.js} +1 -1
  75. package/dist-ksadk/assets/{katex-CVJEnrQQ.js → katex-DxefP4aZ.js} +1 -1
  76. package/dist-ksadk/assets/{linear-CuvdttYn.js → linear-DwipGcVt.js} +1 -1
  77. package/dist-ksadk/assets/{mermaid-parser.core-CyiGaINC.js → mermaid-parser.core-vshe0mzD.js} +2 -2
  78. package/dist-ksadk/assets/{mindmap-definition-FBJOCRG2-Cx8x9zok.js → mindmap-definition-FBJOCRG2-Dw-6--QW.js} +1 -1
  79. package/dist-ksadk/assets/packet-AYTQ26CC-CeRM6FyX.js +1 -0
  80. package/dist-ksadk/assets/{pegDiagram-XKGWAZYB-BvMeLOBU.js → pegDiagram-XKGWAZYB-DFNebRUp.js} +1 -1
  81. package/dist-ksadk/assets/pie-WAS4IAKB-Djp6ckL7.js +1 -0
  82. package/dist-ksadk/assets/{pieDiagram-E7YTZNPT-BTEiUEUk.js → pieDiagram-E7YTZNPT-CHxeRYAb.js} +1 -1
  83. package/dist-ksadk/assets/{quadrantDiagram-AXDQQJYC-CEMfGgSc.js → quadrantDiagram-AXDQQJYC-B5EZIUvT.js} +1 -1
  84. package/dist-ksadk/assets/radar-RG4KPBEZ-D2dsze9F.js +1 -0
  85. package/dist-ksadk/assets/railroad-74A4TZTK-DBwQwqS4.js +1 -0
  86. package/dist-ksadk/assets/railroad-abnf-HS5TGJTU-DkPaTgaM.js +1 -0
  87. package/dist-ksadk/assets/railroad-ebnf-LZEXJU2U-CGj2E-SZ.js +1 -0
  88. package/dist-ksadk/assets/railroad-peg-WCYAUIDC-DGXLjDY5.js +1 -0
  89. package/dist-ksadk/assets/{railroadDiagram-O6MQD6OU-DjL0Ielv.js → railroadDiagram-O6MQD6OU-D3sGYWAm.js} +1 -1
  90. package/dist-ksadk/assets/{requirementDiagram-EFPCY7ZU-Da11svpD.js → requirementDiagram-EFPCY7ZU-C-MRJ006.js} +1 -1
  91. package/dist-ksadk/assets/{sankeyDiagram-P5KCCOFB-DtKGEnlF.js → sankeyDiagram-P5KCCOFB-C5Qc8Tw5.js} +1 -1
  92. package/dist-ksadk/assets/{sequenceDiagram-WJ2MYXX4-CR6Ct1Vm.js → sequenceDiagram-WJ2MYXX4-Cwt6RdFu.js} +1 -1
  93. package/dist-ksadk/assets/{sizeCapture-X5ZJPWSS-DaQE2An6.js → sizeCapture-X5ZJPWSS-DffXmYT6.js} +1 -1
  94. package/dist-ksadk/assets/{stateDiagram-HBIQ2CUA-Ct2KGWos.js → stateDiagram-HBIQ2CUA-CsWi85pm.js} +1 -1
  95. package/dist-ksadk/assets/stateDiagram-v2-4QOOHH4V-DP_nPml6.js +1 -0
  96. package/dist-ksadk/assets/{swimlanes-XN3QIQJK-BpIOaZ-N.js → swimlanes-XN3QIQJK-BFT0NQ46.js} +1 -1
  97. package/dist-ksadk/assets/swimlanesDiagram-VK2B7HYN-DOvIyrQA.js +8 -0
  98. package/dist-ksadk/assets/{timeline-definition-24CTP7MA-CdwbtpKP.js → timeline-definition-24CTP7MA-DXYCmjmW.js} +1 -1
  99. package/dist-ksadk/assets/treeView-Q6P3EWNA-Drao7JLN.js +1 -0
  100. package/dist-ksadk/assets/treemap-WGGIJYW6-CdCZ9GK9.js +1 -0
  101. package/dist-ksadk/assets/{vennDiagram-4TSXK5OY-Dr_5LEwY.js → vennDiagram-4TSXK5OY-D7CAii6e.js} +1 -1
  102. package/dist-ksadk/assets/wardley-WFR3VGLG-BaPyAVbq.js +1 -0
  103. package/dist-ksadk/assets/{wardleyDiagram-VM6X3IG4-DYojPjE8.js → wardleyDiagram-VM6X3IG4-cQzt4L9O.js} +1 -1
  104. package/dist-ksadk/assets/{xychartDiagram-S5SC5T6Z-DV3dpSiv.js → xychartDiagram-S5SC5T6Z-DazvdMTB.js} +1 -1
  105. package/dist-ksadk/index.html +2 -2
  106. package/dist-lib/App.d.ts.map +1 -1
  107. package/dist-lib/{AttachmentPreview-COS-HmHj.js → AttachmentPreview-DPxeFYm-.js} +2 -2
  108. package/dist-lib/{ConnectedComposer-CB_YmxRQ.js → ConnectedComposer-CVMfDdns.js} +3 -3
  109. package/dist-lib/{ConnectedMessageList-CJgvv-Hi.js → ConnectedMessageList-BnRqhlEn.js} +924 -611
  110. package/dist-lib/{WorkspacePanelContainer-DU6mKsi5.js → WorkspacePanelContainer-3h8wgDJj.js} +2 -2
  111. package/dist-lib/{a2ui-e0gsVo7e.js → a2ui-DmynyrCk.js} +1 -1
  112. package/dist-lib/api/client.d.ts +1 -0
  113. package/dist-lib/api/client.d.ts.map +1 -1
  114. package/dist-lib/api/messages.d.ts +2 -0
  115. package/dist-lib/api/messages.d.ts.map +1 -1
  116. package/dist-lib/chat-composer.js +2 -2
  117. package/dist-lib/chat-timeline.js +3 -3
  118. package/dist-lib/components/chat/ChatMessageList.d.ts +5 -1
  119. package/dist-lib/components/chat/ChatMessageList.d.ts.map +1 -1
  120. package/dist-lib/components/chat/ConnectedMessageList.d.ts +2 -1
  121. package/dist-lib/components/chat/ConnectedMessageList.d.ts.map +1 -1
  122. package/dist-lib/components/chat/HistoryAnchoredRows.d.ts +44 -0
  123. package/dist-lib/components/chat/HistoryAnchoredRows.d.ts.map +1 -0
  124. package/dist-lib/components/chat/history-reading-anchor.d.ts +16 -0
  125. package/dist-lib/components/chat/history-reading-anchor.d.ts.map +1 -0
  126. package/dist-lib/components/chat/types.d.ts +1 -0
  127. package/dist-lib/components/chat/types.d.ts.map +1 -1
  128. package/dist-lib/components.js +5 -5
  129. package/dist-lib/conversation.js +1 -1
  130. package/dist-lib/core/api/facade.d.ts +3 -3
  131. package/dist-lib/core/api/facade.d.ts.map +1 -1
  132. package/dist-lib/core/api/types.d.ts +3 -0
  133. package/dist-lib/core/api/types.d.ts.map +1 -1
  134. package/dist-lib/core/conversation/hosted.d.ts +1 -1
  135. package/dist-lib/core/conversation/hosted.d.ts.map +1 -1
  136. package/dist-lib/core/run/agui.d.ts +3 -2
  137. package/dist-lib/core/run/agui.d.ts.map +1 -1
  138. package/dist-lib/core/run/dispatcher.d.ts.map +1 -1
  139. package/dist-lib/core/run/engine.d.ts +1 -0
  140. package/dist-lib/core/run/engine.d.ts.map +1 -1
  141. package/dist-lib/core/run/types.d.ts +4 -0
  142. package/dist-lib/core/run/types.d.ts.map +1 -1
  143. package/dist-lib/hooks/useAgentChat.d.ts.map +1 -1
  144. package/dist-lib/hooks/useRunAgent.d.ts +2 -1
  145. package/dist-lib/hooks/useRunAgent.d.ts.map +1 -1
  146. package/dist-lib/hooks/useSessionLifecycle.d.ts +3 -1
  147. package/dist-lib/hooks/useSessionLifecycle.d.ts.map +1 -1
  148. package/dist-lib/hooks.js +42 -41
  149. package/dist-lib/{permission-B9NRAmxP.js → permission-B60mkAsy.js} +1 -1
  150. package/dist-lib/{persisted-session-history-C8S6Tl-E.js → persisted-session-history-B9O1vWtS.js} +212 -203
  151. package/dist-lib/runtime.js +112 -110
  152. package/dist-lib/{session-events-BMRjrPq2.js → session-events-COiszsgX.js} +1 -0
  153. package/dist-lib/{feedback-nyK8zFEK.js → session-message-history-DC89pksC.js} +10 -2
  154. package/dist-lib/styles.css +1 -1
  155. package/dist-lib/{useSessionLifecycle-DPwSsODU.js → useSessionLifecycle-DeX2s_iU.js} +1377 -1115
  156. package/dist-lib/utils/message-virtualization.d.ts +24 -2
  157. package/dist-lib/utils/message-virtualization.d.ts.map +1 -1
  158. package/dist-lib/utils/session-event-history.d.ts +1 -1
  159. package/dist-lib/utils/session-event-history.d.ts.map +1 -1
  160. package/dist-lib/utils/session-events.d.ts.map +1 -1
  161. package/dist-lib/utils/session-items.d.ts.map +1 -1
  162. package/dist-lib/utils/session-message-history.d.ts +2 -0
  163. package/dist-lib/utils/session-message-history.d.ts.map +1 -1
  164. package/dist-lib/utils/transcript-order.d.ts +1 -1
  165. package/dist-lib/utils/transcript-order.d.ts.map +1 -1
  166. package/package.json +1 -1
  167. package/dist-ksadk/assets/architecture-7GRP2DOG-BgT_ltgS.js +0 -1
  168. package/dist-ksadk/assets/channel-CO8jKUdU.js +0 -1
  169. package/dist-ksadk/assets/chunk-2Q5K7J3B-BQ7ktM_H.js +0 -1
  170. package/dist-ksadk/assets/classDiagram-DTDB5LWJ-HRhUD6oW.js +0 -1
  171. package/dist-ksadk/assets/classDiagram-v2-JRS7N3AN-HRhUD6oW.js +0 -1
  172. package/dist-ksadk/assets/cynefin-OW5HDTMX-DlLbgFtT.js +0 -1
  173. package/dist-ksadk/assets/eventmodeling-NTZA5JFV-BgSxiUqa.js +0 -1
  174. package/dist-ksadk/assets/flowDiagram-A5DVABFB-Dcg0DKL0.js +0 -1
  175. package/dist-ksadk/assets/gitGraph-4MIJSDKK-DiYbIL_1.js +0 -1
  176. package/dist-ksadk/assets/index-CK5of5EC.js +0 -1135
  177. package/dist-ksadk/assets/index-ofLgkIsP.css +0 -2
  178. package/dist-ksadk/assets/info-A6RAGUB7-CIUhUhPM.js +0 -1
  179. package/dist-ksadk/assets/packet-AYTQ26CC-CVt8vTzN.js +0 -1
  180. package/dist-ksadk/assets/pie-WAS4IAKB-BmY8d_KC.js +0 -1
  181. package/dist-ksadk/assets/radar-RG4KPBEZ-D-vxRTHO.js +0 -1
  182. package/dist-ksadk/assets/railroad-74A4TZTK-hDbxS9Gl.js +0 -1
  183. package/dist-ksadk/assets/railroad-abnf-HS5TGJTU-6j4dsPir.js +0 -1
  184. package/dist-ksadk/assets/railroad-ebnf-LZEXJU2U-f3r0amOv.js +0 -1
  185. package/dist-ksadk/assets/railroad-peg-WCYAUIDC-DpGM5wUK.js +0 -1
  186. package/dist-ksadk/assets/stateDiagram-v2-4QOOHH4V-IHXiAplS.js +0 -1
  187. package/dist-ksadk/assets/swimlanesDiagram-VK2B7HYN-ByC69bCd.js +0 -8
  188. package/dist-ksadk/assets/treeView-Q6P3EWNA-Bm72pNZV.js +0 -1
  189. package/dist-ksadk/assets/treemap-WGGIJYW6-Dpgkdt4o.js +0 -1
  190. package/dist-ksadk/assets/wardley-WFR3VGLG-C9w6FZRL.js +0 -1
@@ -1 +1 @@
1
- import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as ee,S as te,T as ne,U as re,V as ie,W as ae,X as oe,Y as se,Z as v,_ as y,at as ce,b as le,ct as ue,dt as b,et as x,ft as S,g as C,gt as de,h as w,ht as fe,it as pe,j as me,k as T,lt as E,m as D,mt as he,nt as ge,ot as _e,p as O,pt as k,q as ve,rt as ye,st as be,tt as xe,ut as A,v as j,w as M,x as Se,y as Ce,z as we}from"./MermaidBlock-C2QkLej8.js";var Te=/\s/;function Ee(e){for(var t=e.length;t--&&Te.test(e.charAt(t)););return t}var De=/^\s+/;function Oe(e){return e&&e.slice(0,Ee(e)+1).replace(De,``)}var ke=NaN,Ae=/^[-+]0x[0-9a-f]+$/i,je=/^0b[01]+$/i,Me=/^0o[0-7]+$/i,Ne=parseInt;function Pe(e){if(typeof e==`number`)return e;if(S(e))return ke;if(E(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=E(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=Oe(e);var n=je.test(e);return n||Me.test(e)?Ne(e.slice(2),n?2:8):Ae.test(e)?ke:+e}var Fe=1/0,Ie=17976931348623157e292;function N(e){return e?(e=Pe(e),e===Fe||e===-Fe?(e<0?-1:1)*Ie:e===e?e:0):e===0?e:0}function Le(e){var t=N(e),n=t%1;return t===t?n?t-n:t:0}var Re=Object.create,ze=function(){function e(){}return function(t){if(!E(t))return{};if(Re)return Re(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Be(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function P(e,t,n){t==`__proto__`&&ce?ce(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Ve=Object.prototype.hasOwnProperty;function He(e,t,n){var r=e[t];(!(Ve.call(e,t)&&x(r,n))||n===void 0&&!(t in e))&&P(e,t,n)}function F(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?P(n,s,c):He(n,s,c)}return n}function I(e,t,n){if(!E(n))return!1;var r=typeof t;return(r==`number`?v(n)&&xe(t,n.length):r==`string`&&t in n)?x(n[t],e):!1}function Ue(e){return _(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&I(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}function We(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Ge=Object.prototype.hasOwnProperty;function Ke(e){if(!E(e))return We(e);var t=oe(e),n=[];for(var r in e)r==`constructor`&&(t||!Ge.call(e,r))||n.push(r);return n}function L(e){return v(e)?ae(e,!0):Ke(e)}function R(e){return e!=null&&e.length?o(e,1):[]}function qe(t){return pe(e(t,void 0,R),t+``)}var Je=re(Object.getPrototypeOf,Object),Ye=`[object Object]`,Xe=Function.prototype,Ze=Object.prototype,Qe=Xe.toString,$e=Ze.hasOwnProperty,et=Qe.call(Object);function tt(e){if(!k(e)||he(e)!=Ye)return!1;var t=Je(e);if(t===null)return!0;var n=$e.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Qe.call(n)==et}var nt=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function rt(e){return nt.test(e)}function it(e,t){return e&&F(t,ie(t),e)}function at(e,t){return e&&F(t,L(t),e)}var ot=typeof exports==`object`&&exports&&!exports.nodeType&&exports,st=ot&&typeof module==`object`&&module&&!module.nodeType&&module,ct=st&&st.exports===ot?de.Buffer:void 0,lt=ct?ct.allocUnsafe:void 0;function ut(e,t){if(t)return e.slice();var n=e.length,r=lt?lt(n):new e.constructor(n);return e.copy(r),r}function dt(e,t){return F(e,p(e),t)}var ft=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)l(t,p(e)),e=Je(e);return t}:m;function pt(e,t){return F(e,ft(e),t)}function mt(e){return me(e,L,ft)}var ht=Object.prototype.hasOwnProperty;function gt(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&ht.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function _t(e){var t=new e.constructor(e.byteLength);return new h(t).set(new h(e)),t}function vt(e,t){var n=t?_t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var yt=/\w*$/;function bt(e){var t=new e.constructor(e.source,yt.exec(e));return t.lastIndex=e.lastIndex,t}var xt=fe?fe.prototype:void 0,St=xt?xt.valueOf:void 0;function Ct(e){return St?Object(St.call(e)):{}}function wt(e,t){var n=t?_t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Tt=`[object Boolean]`,Et=`[object Date]`,Dt=`[object Map]`,Ot=`[object Number]`,kt=`[object RegExp]`,At=`[object Set]`,jt=`[object String]`,Mt=`[object Symbol]`,Nt=`[object ArrayBuffer]`,Pt=`[object DataView]`,Ft=`[object Float32Array]`,It=`[object Float64Array]`,Lt=`[object Int8Array]`,Rt=`[object Int16Array]`,zt=`[object Int32Array]`,Bt=`[object Uint8Array]`,Vt=`[object Uint8ClampedArray]`,Ht=`[object Uint16Array]`,Ut=`[object Uint32Array]`;function Wt(e,t,n){var r=e.constructor;switch(t){case Nt:return _t(e);case Tt:case Et:return new r(+e);case Pt:return vt(e,n);case Ft:case It:case Lt:case Rt:case zt:case Bt:case Vt:case Ht:case Ut:return wt(e,n);case Dt:return new r;case Ot:case jt:return new r(e);case kt:return bt(e);case At:return new r;case Mt:return Ct(e)}}function Gt(e){return typeof e.constructor==`function`&&!oe(e)?ze(Je(e)):{}}var Kt=`[object Map]`;function qt(e){return k(e)&&T(e)==Kt}var Jt=d&&d.isMap,Yt=Jt?ve(Jt):qt,Xt=`[object Set]`;function Zt(e){return k(e)&&T(e)==Xt}var Qt=d&&d.isSet,$t=Qt?ve(Qt):Zt,en=1,tn=2,nn=4,rn=`[object Arguments]`,an=`[object Array]`,on=`[object Boolean]`,sn=`[object Date]`,cn=`[object Error]`,ln=`[object Function]`,un=`[object GeneratorFunction]`,dn=`[object Map]`,fn=`[object Number]`,pn=`[object Object]`,mn=`[object RegExp]`,hn=`[object Set]`,gn=`[object String]`,_n=`[object Symbol]`,vn=`[object WeakMap]`,yn=`[object ArrayBuffer]`,bn=`[object DataView]`,xn=`[object Float32Array]`,Sn=`[object Float64Array]`,Cn=`[object Int8Array]`,wn=`[object Int16Array]`,Tn=`[object Int32Array]`,En=`[object Uint8Array]`,Dn=`[object Uint8ClampedArray]`,On=`[object Uint16Array]`,kn=`[object Uint32Array]`,z={};z[rn]=z[an]=z[yn]=z[bn]=z[on]=z[sn]=z[xn]=z[Sn]=z[Cn]=z[wn]=z[Tn]=z[dn]=z[fn]=z[pn]=z[mn]=z[hn]=z[gn]=z[_n]=z[En]=z[Dn]=z[On]=z[kn]=!0,z[cn]=z[ln]=z[vn]=!1;function B(e,n,r,i,a,o){var s,c=n&en,l=n&tn,d=n&nn;if(r&&(s=a?r(e,i,a,o):r(e)),s!==void 0)return s;if(!E(e))return e;var f=A(e);if(f){if(s=gt(e),!c)return Be(e,s)}else{var p=T(e),m=p==ln||p==un;if(u(e))return ut(e,c);if(p==pn||p==rn||m&&!a){if(s=l||m?{}:Gt(e),!c)return l?pt(e,at(s,e)):dt(e,it(s,e))}else{if(!z[p])return a?e:{};s=Wt(e,p,c)}}o||=new g;var h=o.get(e);if(h)return h;o.set(e,s),$t(e)?e.forEach(function(t){s.add(B(t,n,r,t,e,o))}):Yt(e)&&e.forEach(function(t,i){s.set(i,B(t,n,r,i,e,o))});var _=f?void 0:(d?l?mt:t:l?L:ie)(e);return ye(_||e,function(t,i){_&&(i=t,t=e[i]),He(s,i,B(t,n,r,i,e,o))}),s}var An=1,jn=4;function Mn(e){return B(e,An|jn)}var Nn=function(){return de.Date.now()},Pn=Object.prototype,Fn=Pn.hasOwnProperty,In=_(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&I(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=L(a),s=-1,c=o.length;++s<c;){var l=o[s],u=e[l];(u===void 0||x(u,Pn[l])&&!Fn.call(e,l))&&(e[l]=a[l])}return e});function Ln(e,t,n){(n!==void 0&&!x(e[t],n)||n===void 0&&!(t in e))&&P(e,t,n)}function Rn(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}function zn(e){return F(e,L(e))}function Bn(e,t,n,r,i,a,o){var c=Rn(e,n),l=Rn(t,n),d=o.get(l);if(d){Ln(e,n,d);return}var f=a?a(c,l,n+``,e,t,o):void 0,p=f===void 0;if(p){var m=A(l),h=!m&&u(l),g=!m&&!h&&s(l);f=l,m||h||g?A(c)?f=c:le(c)?f=Be(c):h?(p=!1,f=ut(l,!0)):g?(p=!1,f=wt(l,!0)):f=[]:tt(l)||se(l)?(f=c,se(c)?f=zn(c):(!E(c)||be(c))&&(f=Gt(l))):p=!1}p&&(o.set(l,f),i(f,l,r,a,o),o.delete(l)),Ln(e,n,f)}function Vn(e,t,n,i,a){e!==t&&r(t,function(r,o){if(a||=new g,E(r))Bn(e,t,o,n,Vn,i,a);else{var s=i?i(Rn(e,o),r,o+``,e,t,a):void 0;s===void 0&&(s=r),Ln(e,o,s)}},L)}function V(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function Hn(e){return function(t,n,r){var i=Object(t);if(!v(t)){var a=M(n,3);t=ie(t),n=function(e){return a(i[e],e,i)}}var o=e(t,n,r);return o>-1?i[a?t[o]:o]:void 0}}var Un=Math.max;function Wn(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:Le(n);return i<0&&(i=Un(r+i,0)),ge(e,M(t,3),i)}var Gn=Hn(Wn);function Kn(e,t){var n=-1,r=v(e)?Array(e.length):[];return Se(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function H(e,t){return(A(e)?b:Kn)(e,M(t,3))}function qn(e,t){return e==null?e:r(e,Ce(t),L)}function Jn(e,t){return e&&te(e,Ce(t))}function Yn(e,t){return e>t}var Xn=Object.prototype.hasOwnProperty;function Zn(e,t){return e!=null&&Xn.call(e,t)}function Qn(e,t){return e!=null&&i(e,t,Zn)}var $n=`[object String]`;function er(e){return typeof e==`string`||!A(e)&&k(e)&&he(e)==$n}function tr(e,t){return e<t}function U(e,t){var n={};return t=M(t,3),te(e,function(e,r,i){P(n,r,t(e,r,i))}),n}function nr(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],o=t(a);if(o!=null&&(s===void 0?o===o&&!S(o):n(o,s)))var s=o,c=a}return c}function W(e){return e&&e.length?nr(e,ue,Yn):void 0}var rr=Ue(function(e,t,n){Vn(e,t,n)});function G(e){return e&&e.length?nr(e,ue,tr):void 0}function ir(e,t){return e&&e.length?nr(e,M(t,2),tr):void 0}function ar(e,t,n,r){if(!E(e))return e;t=we(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=ee(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=E(u)?u:xe(t[i+1])?[]:{})}He(s,c,l),s=s[c]}return e}function or(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=f(e,o);n(s,o)&&ar(a,we(o,e),s)}return a}function sr(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function cr(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=S(e),o=t!==void 0,s=t===null,c=t===t,l=S(t);if(!s&&!l&&!a&&e>t||a&&o&&c&&!s&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!c)return-1}return 0}function lr(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=cr(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function ur(e,t,n){t=t.length?b(t,function(e){return A(e)?function(t){return f(t,e.length===1?e[0]:e)}:e}):[ue];var r=-1;return t=b(t,ve(M)),sr(Kn(e,function(e,n,i){return{criteria:b(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return lr(e,t,n)})}var dr=ne(`length`),fr=`\\ud800-\\udfff`,pr=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,mr=`\\ufe0e\\ufe0f`,hr=`[`+fr+`]`,gr=`[`+pr+`]`,_r=`\\ud83c[\\udffb-\\udfff]`,vr=`(?:`+gr+`|`+_r+`)`,yr=`[^`+fr+`]`,br=`(?:\\ud83c[\\udde6-\\uddff]){2}`,xr=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Sr=`\\u200d`,Cr=vr+`?`,wr=`[`+mr+`]?`,Tr=`(?:`+Sr+`(?:`+[yr,br,xr].join(`|`)+`)`+wr+Cr+`)*`,Er=wr+Cr+Tr,Dr=`(?:`+[yr+gr+`?`,gr,br,xr,hr].join(`|`)+`)`,Or=RegExp(_r+`(?=`+_r+`)|`+Dr+Er,`g`);function kr(e){for(var t=Or.lastIndex=0;Or.test(e);)++t;return t}function Ar(e){return rt(e)?kr(e):dr(e)}function jr(e,t){return or(e,t,function(t,n){return a(e,n)})}var K=qe(function(e,t){return e==null?{}:jr(e,t)}),Mr=Math.ceil,Nr=Math.max;function Pr(e,t,n,r){for(var i=-1,a=Nr(Mr((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function Fr(e){return function(t,n,r){return r&&typeof r!=`number`&&I(t,n,r)&&(n=r=void 0),t=N(t),n===void 0?(n=t,t=0):n=N(n),r=r===void 0?t<n?1:-1:N(r),Pr(t,n,r,e)}}var q=Fr(),Ir=`[object Map]`,Lr=`[object Set]`;function Rr(e){if(e==null)return 0;if(v(e))return er(e)?Ar(e):e.length;var t=T(e);return t==Ir||t==Lr?e.size:c(e).length}var J=_(function(e,t){if(e==null)return[];var n=t.length;return n>1&&I(e,t[0],t[1])?t=[]:n>2&&I(t[0],t[1],t[2])&&(t=[t[0]]),ur(e,o(t,1),[])}),zr=0;function Br(e){var t=++zr;return n(e)+t}function Vr(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}function Hr(e,t){return Vr(e||[],t||[],He)}var Ur=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return Wr(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&Wr(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,Gr)),n=n._prev;return`[`+e.join(`, `)+`]`}};function Wr(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Gr(e,t){if(e!==`_next`&&e!==`_prev`)return t}var Kr=_e(1);function qr(e,t){if(e.nodeCount()<=1)return[];var n=Xr(e,t||Kr);return R(H(Jr(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function Jr(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)Yr(e,t,n,o);for(;o=i.dequeue();)Yr(e,t,n,o);if(e.nodeCount()){for(var s=t.length-2;s>0;--s)if(o=t[s].dequeue(),o){r=r.concat(Yr(e,t,n,o,!0));break}}}return r}function Yr(e,t,n,r,i){var a=i?[]:void 0;return j(e.inEdges(r.v),function(r){var o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,Zr(t,n,s)}),j(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,Zr(t,n,o)}),e.removeNode(r.v),a}function Xr(e,t){var n=new O,r=0,i=0;j(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),j(e.edges(),function(e){var a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s),i=Math.max(i,n.node(e.v).out+=o),r=Math.max(r,n.node(e.w).in+=o)});var a=q(i+r+3).map(function(){return new Ur}),o=r+1;return j(n.nodes(),function(e){Zr(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function Zr(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function Qr(e){j(e.graph().acyclicer===`greedy`?qr(e,t(e)):$r(e),function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,Br(`rev`))});function t(e){return function(t){return e.edge(t).weight}}}function $r(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,j(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return j(e.nodes(),i),t}function ei(e){j(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Y(e,t,n,r){var i;do i=Br(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function ti(e){var t=new O().setGraph(e.graph());return j(e.nodes(),function(n){t.setNode(n,e.node(n))}),j(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function ni(e){var t=new O({multigraph:e.isMultigraph()}).setGraph(e.graph());return j(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),j(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function ri(e,t){var n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);var c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function X(e){var t=H(q(si(e)+1),function(){return[]});return j(e.nodes(),function(n){var r=e.node(n),i=r.rank;w(i)||(t[i][r.order]=n)}),t}function ii(e){var t=G(H(e.nodes(),function(t){return e.node(t).rank}));j(e.nodes(),function(n){var r=e.node(n);Qn(r,`rank`)&&(r.rank-=t)})}function ai(e){var t=G(H(e.nodes(),function(t){return e.node(t).rank})),n=[];j(e.nodes(),function(r){var i=e.node(r).rank-t;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=e.graph().nodeRankFactor;j(n,function(t,n){w(t)&&n%i!==0?--r:r&&j(t,function(t){e.node(t).rank+=r})})}function oi(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),Y(e,`border`,i,t)}function si(e){return W(H(e.nodes(),function(t){var n=e.node(t).rank;if(!w(n))return n}))}function ci(e,t){var n={lhs:[],rhs:[]};return j(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function li(e,t){var n=Nn();try{return t()}finally{console.log(e+` time: `+(Nn()-n)+`ms`)}}function ui(e,t){return t()}function di(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&j(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)fi(e,`borderLeft`,`_bl`,n,i,a),fi(e,`borderRight`,`_br`,n,i,a)}}j(e.children(),t)}function fi(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=Y(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function pi(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&hi(e)}function mi(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&_i(e),(t===`lr`||t===`rl`)&&(yi(e),hi(e))}function hi(e){j(e.nodes(),function(t){gi(e.node(t))}),j(e.edges(),function(t){gi(e.edge(t))})}function gi(e){var t=e.width;e.width=e.height,e.height=t}function _i(e){j(e.nodes(),function(t){vi(e.node(t))}),j(e.edges(),function(t){var n=e.edge(t);j(n.points,vi),Object.prototype.hasOwnProperty.call(n,`y`)&&vi(n)})}function vi(e){e.y=-e.y}function yi(e){j(e.nodes(),function(t){bi(e.node(t))}),j(e.edges(),function(t){var n=e.edge(t);j(n.points,bi),Object.prototype.hasOwnProperty.call(n,`x`)&&bi(n)})}function bi(e){var t=e.x;e.x=e.y,e.y=t}function xi(e){e.graph().dummyChains=[],j(e.edges(),function(t){Si(e,t)})}function Si(e,t){var n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a!==r+1){e.removeEdge(t);var l=void 0,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],l={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},u=Y(e,`edge`,l,`_d`),r===c&&(l.width=s.width,l.height=s.height,l.dummy=`edge-label`,l.labelpos=s.labelpos),e.setEdge(n,u,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,i,{weight:s.weight},o)}}function Ci(e){j(e.graph().dummyChains,function(t){var n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function wi(e){var t={};function n(r){var i=e.node(r);if(Object.prototype.hasOwnProperty.call(t,r))return i.rank;t[r]=!0;var a=G(H(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}j(e.sources(),n)}function Z(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function Ti(e){var t=new O({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;Ei(t,e)<r;)i=Di(t,e),a=t.hasNode(i.v)?Z(e,i):-Z(e,i),Oi(t,e,a);return t}function Ei(e,t){function n(r){j(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!Z(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return j(e.nodes(),n),e.nodeCount()}function Di(e,t){return ir(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return Z(t,n)})}function Oi(e,t,n){j(e.nodes(),function(e){t.node(e).rank+=n})}_e(1),_e(1),ki.CycleException=Q;function ki(e){var t={},n={},r=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new Q;Object.prototype.hasOwnProperty.call(t,a)||(n[a]=!0,t[a]=!0,j(e.predecessors(a),i),delete n[a],r.push(a))}if(j(e.sinks(),i),Rr(t)!==e.nodeCount())throw new Q;return r}function Q(){}Q.prototype=Error();function Ai(e,t,n){A(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return j(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);ji(e,t,n===`post`,a,r,i)}),i}function ji(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),j(i(t),function(t){ji(e,t,n,r,i,a)}),n&&a.push(t))}function Mi(e,t){return Ai(e,t,`post`)}function Ni(e,t){return Ai(e,t,`pre`)}$.initLowLimValues=Li,$.initCutValues=Pi,$.calcCutValue=Ii,$.leaveEdge=zi,$.enterEdge=Bi,$.exchangeEdges=Vi;function $(e){e=ti(e),wi(e);var t=Ti(e);Li(t),Pi(t,e);for(var n,r;n=zi(t);)r=Bi(t,e,n),Vi(t,e,n,r)}function Pi(e,t){var n=Mi(e,e.nodes());n=n.slice(0,n.length-1),j(n,function(n){Fi(e,t,n)})}function Fi(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=Ii(e,t,n)}function Ii(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,j(t.nodeEdges(n),function(a){var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,Ui(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function Li(e,t){arguments.length<2&&(t=e.nodes()[0]),Ri(e,{},1,t)}function Ri(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,j(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=Ri(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function zi(e){return Gn(e.edges(),function(t){return e.edge(t).cutvalue<0})}function Bi(e,t,n){var r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);var a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),ir(y(t.edges(),function(t){return c===Wi(e,e.node(t.v),s)&&c!==Wi(e,e.node(t.w),s)}),function(e){return Z(t,e)})}function Vi(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),Li(e),Pi(e,t),Hi(e,t)}function Hi(e,t){var n=Ni(e,Gn(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),j(n,function(n){var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function Ui(e,t,n){return e.hasEdge(t,n)}function Wi(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function Gi(e){switch(e.graph().ranker){case`network-simplex`:Ji(e);break;case`tight-tree`:qi(e);break;case`longest-path`:Ki(e);break;default:Ji(e)}}var Ki=wi;function qi(e){wi(e),Ti(e)}function Ji(e){$(e)}function Yi(e){var t=Y(e,`root`,{},`_root`),n=Zi(e),r=W(C(n))-1,i=2*r+1;e.graph().nestingRoot=t,j(e.edges(),function(t){e.edge(t).minlen*=i});var a=Qi(e)+1;j(e.children(),function(o){Xi(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function Xi(e,t,n,r,i,a,o){var s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}var c=oi(e,`_bt`),l=oi(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,j(s,function(s){Xi(e,t,n,r,i,a,s);var u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-a[o]+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+a[o]})}function Zi(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&j(a,function(e){n(e,i+1)}),t[r]=i}return j(e.children(),function(e){n(e,1)}),t}function Qi(e){return D(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function $i(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,j(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function ea(e,t,n){var r={},i;j(n,function(n){for(var a=e.parent(n),o,s;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function ta(e,t,n){var r=na(e),i=new O({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return j(e.nodes(),function(a){var o=e.node(a),s=e.parent(a);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||r),j(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=w(r)?0:r.weight;i.setEdge(n,a,{weight:e.edge(t).weight+o})}),Object.prototype.hasOwnProperty.call(o,`minRank`)&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function na(e){for(var t;e.hasNode(t=Br(`_root`)););return t}function ra(e,t){for(var n=0,r=1;r<t.length;++r)n+=ia(e,t[r-1],t[r]);return n}function ia(e,t,n){for(var r=Hr(n,H(n,function(e,t){return t})),i=R(H(t,function(t){return J(H(e.outEdges(t),function(t){return{pos:r[t.w],weight:e.edge(t).weight}}),`pos`)})),a=1;a<n.length;)a<<=1;var o=2*a-1;--a;var s=H(Array(o),function(){return 0}),c=0;return j(i.forEach(function(e){var t=e.pos+a;s[t]+=e.weight;for(var n=0;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n})),c}function aa(e){var t={},n=y(e.nodes(),function(t){return!e.children(t).length}),r=H(q(W(H(n,function(t){return e.node(t).rank}))+1),function(){return[]});function i(n){Qn(t,n)||(t[n]=!0,r[e.node(n).rank].push(n),j(e.successors(n),i))}return j(J(n,function(t){return e.node(t).rank}),i),r}function oa(e,t){return H(t,function(t){var n=e.inEdges(t);if(n.length){var r=D(n,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}function sa(e,t){var n={};return j(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};w(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),j(t.edges(),function(e){var t=n[e.v],r=n[e.w];!w(t)&&!w(r)&&(r.indegree++,t.out.push(n[e.w]))}),ca(y(n,function(e){return!e.indegree}))}function ca(e){var t=[];function n(e){return function(t){t.merged||(w(t.barycenter)||w(e.barycenter)||t.barycenter>=e.barycenter)&&la(e,t)}}function r(t){return function(n){n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){var i=e.pop();t.push(i),j(i.in.reverse(),n(i)),j(i.out,r(i))}return H(y(t,function(e){return!e.merged}),function(e){return K(e,[`vs`,`i`,`barycenter`,`weight`])})}function la(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function ua(e,t){var n=ci(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=J(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,c=0;r.sort(fa(!!t)),c=da(a,i,c),j(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=da(a,i,c)});var l={vs:R(a)};return s&&(l.barycenter=o/s,l.weight=s),l}function da(e,t,n){for(var r;t.length&&(r=V(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function fa(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}function pa(e,t,n,r){var i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=y(i,function(e){return e!==o&&e!==s}));var l=oa(e,i);j(l,function(t){if(e.children(t.v).length){var i=pa(e,t.v,n,r);c[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&ha(t,i)}});var u=sa(l,n);ma(u,c);var d=ua(u,r);if(o&&(d.vs=R([o,d.vs,s]),e.predecessors(o).length)){var f=e.node(e.predecessors(o)[0]),p=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d}function ma(e,t){j(e,function(e){e.vs=R(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function ha(e,t){w(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function ga(e){var t=si(e),n=_a(e,q(1,t+1),`inEdges`),r=_a(e,q(t-1,-1,-1),`outEdges`),i=aa(e);ya(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){va(s%2?n:r,s%4>=2),i=X(e);var l=ra(e,i);l<a&&(c=0,o=Mn(i),a=l)}ya(e,o)}function _a(e,t,n){return H(t,function(t){return ta(e,t,n)})}function va(e,t){var n=new O;j(e,function(e){var r=e.graph().root,i=pa(e,r,n,t);j(i.vs,function(t,n){e.node(t).order=n}),ea(e,n,i.vs)})}function ya(e,t){j(t,function(t){j(t,function(t,n){e.node(t).order=n})})}function ba(e){var t=Sa(e);j(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=xa(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(l=o[c+1]).minRank<=r.rank;)c++;l=o[c]}e.setParent(n,l),n=e.successors(n)[0]}})}function xa(e,t,n,r){var i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c=n,l;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function Sa(e){var t={},n=0;function r(i){var a=n;j(e.children(i),r),t[i]={low:a,lim:n++}}return j(e.children(),r),t}function Ca(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=V(r);return j(r,function(t,c){var l=Ta(e,t),u=l?e.node(l).order:o;(l||t===s)&&(j(r.slice(a,c+1),function(t){j(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Ea(n,r,t)})}),a=c+1,i=u)}),r}return D(t,r),n}function wa(e,t){var n={};function r(t,r,i,a,o){var s;j(q(r,i),function(r){s=t[r],e.node(s).dummy&&j(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Ea(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return j(n,function(s,c){if(e.node(s).dummy===`border`){var l=e.predecessors(s);l.length&&(a=e.node(l[0]).order,r(n,o,c,i,a),o=c,i=a)}r(n,o,n.length,a,t.length)}),n}return D(t,i),n}function Ta(e,t){if(e.node(t).dummy)return Gn(e.predecessors(t),function(t){return e.node(t).dummy})}function Ea(e,t,n){if(t>n){var r=t;t=n,n=r}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[t];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Da(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function Oa(e,t,n,r){var i={},a={},o={};return j(t,function(e){j(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),j(t,function(e){var t=-1;j(e,function(e){var s=r(e);if(s.length){s=J(s,function(e){return o[e]});for(var c=(s.length-1)/2,l=Math.floor(c),u=Math.ceil(c);l<=u;++l){var d=s[l];a[e]===e&&t<o[d]&&!Da(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function ka(e,t,n,r,i){var a={},o=Aa(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){for(var n=o.nodes(),r=n.pop(),i={};r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce(function(e,t){return Math.max(e,a[t.v]+o.edge(t))},0)}function u(t){var n=o.outEdges(t).reduce(function(e,t){return Math.min(e,a[t.w]-o.edge(t))},1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),j(r,function(e){a[e]=a[n[e]]}),a}function Aa(e,t,n,r){var i=new O,a=e.graph(),o=Fa(a.nodesep,a.edgesep,r);return j(t,function(t){var r;j(t,function(t){var a=n[t];if(i.setNode(a),r){var s=n[r],c=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),c||0))}r=t})}),i}function ja(e,t){return ir(C(t),function(t){var n=-1/0,r=1/0;return qn(t,function(t,i){var a=Ia(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function Ma(e,t){var n=C(t),r=G(n),i=W(n);j([`u`,`d`],function(n){j([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=C(s);c=a===`l`?r-G(l):i-W(l),c&&(e[o]=U(s,function(e){return e+c}))}})})}function Na(e,t){return U(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=J(H(e,r));return(i[1]+i[2])/2})}function Pa(e){var t=X(e),n=rr(Ca(e,t),wa(e,t)),r={},i;return j([`u`,`d`],function(a){i=a===`u`?t:C(t).reverse(),j([`l`,`r`],function(t){t===`r`&&(i=H(i,function(e){return C(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=Oa(e,i,n,o),c=ka(e,i,s.root,s.align,t===`r`);t===`r`&&(c=U(c,function(e){return-e})),r[a+t]=c})}),Ma(r,ja(e,r)),Na(r,e.graph().align)}function Fa(e,t,n){return function(r,i,a){var o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.prototype.hasOwnProperty.call(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.prototype.hasOwnProperty.call(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function Ia(e,t){return e.node(t).width}function La(e){e=ni(e),Ra(e),Jn(Pa(e),function(t,n){e.node(n).x=t})}function Ra(e){var t=X(e),n=e.graph().ranksep,r=0;j(t,function(t){var i=W(H(t,function(t){return e.node(t).height}));j(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function za(e,t){var n=t&&t.debugTiming?li:ui;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>Xa(e));n(` runLayout`,()=>Ba(t,n)),n(` updateInputGraph`,()=>Va(e,t))})}function Ba(e,t){t(` makeSpaceForEdgeLabels`,()=>Za(e)),t(` removeSelfEdges`,()=>oo(e)),t(` acyclic`,()=>Qr(e)),t(` nestingGraph.run`,()=>Yi(e)),t(` rank`,()=>Gi(ni(e))),t(` injectEdgeLabelProxies`,()=>Qa(e)),t(` removeEmptyRanks`,()=>ai(e)),t(` nestingGraph.cleanup`,()=>$i(e)),t(` normalizeRanks`,()=>ii(e)),t(` assignRankMinMax`,()=>$a(e)),t(` removeEdgeLabelProxies`,()=>eo(e)),t(` normalize.run`,()=>xi(e)),t(` parentDummyChains`,()=>ba(e)),t(` addBorderSegments`,()=>di(e)),t(` order`,()=>ga(e)),t(` insertSelfEdges`,()=>so(e)),t(` adjustCoordinateSystem`,()=>pi(e)),t(` position`,()=>La(e)),t(` positionSelfEdges`,()=>co(e)),t(` removeBorderNodes`,()=>ao(e)),t(` normalize.undo`,()=>Ci(e)),t(` fixupEdgeLabelCoords`,()=>ro(e)),t(` undoCoordinateSystem`,()=>mi(e)),t(` translateGraph`,()=>to(e)),t(` assignNodeIntersects`,()=>no(e)),t(` reversePoints`,()=>io(e)),t(` acyclic.undo`,()=>ei(e))}function Va(e,t){j(e.nodes(),function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))}),j(e.edges(),function(n){var r=e.edge(n),i=t.edge(n);r.points=i.points,Object.prototype.hasOwnProperty.call(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Ha=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],Ua={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},Wa=[`acyclicer`,`ranker`,`rankdir`,`align`],Ga=[`width`,`height`],Ka={width:0,height:0},qa=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Ja={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Ya=[`labelpos`];function Xa(e){var t=new O({multigraph:!0,compound:!0}),n=uo(e.graph());return t.setGraph(rr({},Ua,lo(n,Ha),K(n,Wa))),j(e.nodes(),function(n){var r=uo(e.node(n));t.setNode(n,In(lo(r,Ga),Ka)),t.setParent(n,e.parent(n))}),j(e.edges(),function(n){var r=uo(e.edge(n));t.setEdge(n,rr({},Ja,lo(r,qa),K(r,Ya)))}),t}function Za(e){var t=e.graph();t.ranksep/=2,j(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Qa(e){j(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);Y(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function $a(e){var t=0;j(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=W(t,r.maxRank))}),e.graph().maxRank=t}function eo(e){j(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function to(e){var t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){var a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}j(e.nodes(),function(t){c(e.node(t))}),j(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,j(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),j(e.edges(),function(n){var i=e.edge(n);j(i.points,function(e){e.x-=t,e.y-=r}),Object.prototype.hasOwnProperty.call(i,`x`)&&(i.x-=t),Object.prototype.hasOwnProperty.call(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function no(e){j(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(ri(r,a)),n.points.push(ri(i,o))})}function ro(e){j(e.edges(),function(t){var n=e.edge(t);if(Object.prototype.hasOwnProperty.call(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function io(e){j(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function ao(e){j(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(V(n.borderLeft)),o=e.node(V(n.borderRight));n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),j(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function oo(e){j(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function so(e){j(X(e),function(t){var n=0;j(t,function(t,r){var i=e.node(t);i.order=r+n,j(i.selfEdges,function(t){Y(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function co(e){j(e.nodes(),function(t){var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function lo(e,t){return U(K(e,t),Number)}function uo(e){var t={};return j(e,function(e,n){t[n.toLowerCase()]=e}),t}export{za as t};
1
+ import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as ee,S as te,T as ne,U as re,V as ie,W as ae,X as oe,Y as se,Z as v,_ as y,at as ce,b as le,ct as ue,dt as b,et as x,ft as S,g as C,gt as de,h as w,ht as fe,it as pe,j as me,k as T,lt as E,m as D,mt as he,nt as ge,ot as _e,p as O,pt as k,q as ve,rt as ye,st as be,tt as xe,ut as A,v as j,w as M,x as Se,y as Ce,z as we}from"./MermaidBlock-CF2HMJlR.js";var Te=/\s/;function Ee(e){for(var t=e.length;t--&&Te.test(e.charAt(t)););return t}var De=/^\s+/;function Oe(e){return e&&e.slice(0,Ee(e)+1).replace(De,``)}var ke=NaN,Ae=/^[-+]0x[0-9a-f]+$/i,je=/^0b[01]+$/i,Me=/^0o[0-7]+$/i,Ne=parseInt;function Pe(e){if(typeof e==`number`)return e;if(S(e))return ke;if(E(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=E(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=Oe(e);var n=je.test(e);return n||Me.test(e)?Ne(e.slice(2),n?2:8):Ae.test(e)?ke:+e}var Fe=1/0,Ie=17976931348623157e292;function N(e){return e?(e=Pe(e),e===Fe||e===-Fe?(e<0?-1:1)*Ie:e===e?e:0):e===0?e:0}function Le(e){var t=N(e),n=t%1;return t===t?n?t-n:t:0}var Re=Object.create,ze=function(){function e(){}return function(t){if(!E(t))return{};if(Re)return Re(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Be(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function P(e,t,n){t==`__proto__`&&ce?ce(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Ve=Object.prototype.hasOwnProperty;function He(e,t,n){var r=e[t];(!(Ve.call(e,t)&&x(r,n))||n===void 0&&!(t in e))&&P(e,t,n)}function F(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?P(n,s,c):He(n,s,c)}return n}function I(e,t,n){if(!E(n))return!1;var r=typeof t;return(r==`number`?v(n)&&xe(t,n.length):r==`string`&&t in n)?x(n[t],e):!1}function Ue(e){return _(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&I(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}function We(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Ge=Object.prototype.hasOwnProperty;function Ke(e){if(!E(e))return We(e);var t=oe(e),n=[];for(var r in e)r==`constructor`&&(t||!Ge.call(e,r))||n.push(r);return n}function L(e){return v(e)?ae(e,!0):Ke(e)}function R(e){return e!=null&&e.length?o(e,1):[]}function qe(t){return pe(e(t,void 0,R),t+``)}var Je=re(Object.getPrototypeOf,Object),Ye=`[object Object]`,Xe=Function.prototype,Ze=Object.prototype,Qe=Xe.toString,$e=Ze.hasOwnProperty,et=Qe.call(Object);function tt(e){if(!k(e)||he(e)!=Ye)return!1;var t=Je(e);if(t===null)return!0;var n=$e.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Qe.call(n)==et}var nt=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function rt(e){return nt.test(e)}function it(e,t){return e&&F(t,ie(t),e)}function at(e,t){return e&&F(t,L(t),e)}var ot=typeof exports==`object`&&exports&&!exports.nodeType&&exports,st=ot&&typeof module==`object`&&module&&!module.nodeType&&module,ct=st&&st.exports===ot?de.Buffer:void 0,lt=ct?ct.allocUnsafe:void 0;function ut(e,t){if(t)return e.slice();var n=e.length,r=lt?lt(n):new e.constructor(n);return e.copy(r),r}function dt(e,t){return F(e,p(e),t)}var ft=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)l(t,p(e)),e=Je(e);return t}:m;function pt(e,t){return F(e,ft(e),t)}function mt(e){return me(e,L,ft)}var ht=Object.prototype.hasOwnProperty;function gt(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&ht.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function _t(e){var t=new e.constructor(e.byteLength);return new h(t).set(new h(e)),t}function vt(e,t){var n=t?_t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var yt=/\w*$/;function bt(e){var t=new e.constructor(e.source,yt.exec(e));return t.lastIndex=e.lastIndex,t}var xt=fe?fe.prototype:void 0,St=xt?xt.valueOf:void 0;function Ct(e){return St?Object(St.call(e)):{}}function wt(e,t){var n=t?_t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Tt=`[object Boolean]`,Et=`[object Date]`,Dt=`[object Map]`,Ot=`[object Number]`,kt=`[object RegExp]`,At=`[object Set]`,jt=`[object String]`,Mt=`[object Symbol]`,Nt=`[object ArrayBuffer]`,Pt=`[object DataView]`,Ft=`[object Float32Array]`,It=`[object Float64Array]`,Lt=`[object Int8Array]`,Rt=`[object Int16Array]`,zt=`[object Int32Array]`,Bt=`[object Uint8Array]`,Vt=`[object Uint8ClampedArray]`,Ht=`[object Uint16Array]`,Ut=`[object Uint32Array]`;function Wt(e,t,n){var r=e.constructor;switch(t){case Nt:return _t(e);case Tt:case Et:return new r(+e);case Pt:return vt(e,n);case Ft:case It:case Lt:case Rt:case zt:case Bt:case Vt:case Ht:case Ut:return wt(e,n);case Dt:return new r;case Ot:case jt:return new r(e);case kt:return bt(e);case At:return new r;case Mt:return Ct(e)}}function Gt(e){return typeof e.constructor==`function`&&!oe(e)?ze(Je(e)):{}}var Kt=`[object Map]`;function qt(e){return k(e)&&T(e)==Kt}var Jt=d&&d.isMap,Yt=Jt?ve(Jt):qt,Xt=`[object Set]`;function Zt(e){return k(e)&&T(e)==Xt}var Qt=d&&d.isSet,$t=Qt?ve(Qt):Zt,en=1,tn=2,nn=4,rn=`[object Arguments]`,an=`[object Array]`,on=`[object Boolean]`,sn=`[object Date]`,cn=`[object Error]`,ln=`[object Function]`,un=`[object GeneratorFunction]`,dn=`[object Map]`,fn=`[object Number]`,pn=`[object Object]`,mn=`[object RegExp]`,hn=`[object Set]`,gn=`[object String]`,_n=`[object Symbol]`,vn=`[object WeakMap]`,yn=`[object ArrayBuffer]`,bn=`[object DataView]`,xn=`[object Float32Array]`,Sn=`[object Float64Array]`,Cn=`[object Int8Array]`,wn=`[object Int16Array]`,Tn=`[object Int32Array]`,En=`[object Uint8Array]`,Dn=`[object Uint8ClampedArray]`,On=`[object Uint16Array]`,kn=`[object Uint32Array]`,z={};z[rn]=z[an]=z[yn]=z[bn]=z[on]=z[sn]=z[xn]=z[Sn]=z[Cn]=z[wn]=z[Tn]=z[dn]=z[fn]=z[pn]=z[mn]=z[hn]=z[gn]=z[_n]=z[En]=z[Dn]=z[On]=z[kn]=!0,z[cn]=z[ln]=z[vn]=!1;function B(e,n,r,i,a,o){var s,c=n&en,l=n&tn,d=n&nn;if(r&&(s=a?r(e,i,a,o):r(e)),s!==void 0)return s;if(!E(e))return e;var f=A(e);if(f){if(s=gt(e),!c)return Be(e,s)}else{var p=T(e),m=p==ln||p==un;if(u(e))return ut(e,c);if(p==pn||p==rn||m&&!a){if(s=l||m?{}:Gt(e),!c)return l?pt(e,at(s,e)):dt(e,it(s,e))}else{if(!z[p])return a?e:{};s=Wt(e,p,c)}}o||=new g;var h=o.get(e);if(h)return h;o.set(e,s),$t(e)?e.forEach(function(t){s.add(B(t,n,r,t,e,o))}):Yt(e)&&e.forEach(function(t,i){s.set(i,B(t,n,r,i,e,o))});var _=f?void 0:(d?l?mt:t:l?L:ie)(e);return ye(_||e,function(t,i){_&&(i=t,t=e[i]),He(s,i,B(t,n,r,i,e,o))}),s}var An=1,jn=4;function Mn(e){return B(e,An|jn)}var Nn=function(){return de.Date.now()},Pn=Object.prototype,Fn=Pn.hasOwnProperty,In=_(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&I(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=L(a),s=-1,c=o.length;++s<c;){var l=o[s],u=e[l];(u===void 0||x(u,Pn[l])&&!Fn.call(e,l))&&(e[l]=a[l])}return e});function Ln(e,t,n){(n!==void 0&&!x(e[t],n)||n===void 0&&!(t in e))&&P(e,t,n)}function Rn(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}function zn(e){return F(e,L(e))}function Bn(e,t,n,r,i,a,o){var c=Rn(e,n),l=Rn(t,n),d=o.get(l);if(d){Ln(e,n,d);return}var f=a?a(c,l,n+``,e,t,o):void 0,p=f===void 0;if(p){var m=A(l),h=!m&&u(l),g=!m&&!h&&s(l);f=l,m||h||g?A(c)?f=c:le(c)?f=Be(c):h?(p=!1,f=ut(l,!0)):g?(p=!1,f=wt(l,!0)):f=[]:tt(l)||se(l)?(f=c,se(c)?f=zn(c):(!E(c)||be(c))&&(f=Gt(l))):p=!1}p&&(o.set(l,f),i(f,l,r,a,o),o.delete(l)),Ln(e,n,f)}function Vn(e,t,n,i,a){e!==t&&r(t,function(r,o){if(a||=new g,E(r))Bn(e,t,o,n,Vn,i,a);else{var s=i?i(Rn(e,o),r,o+``,e,t,a):void 0;s===void 0&&(s=r),Ln(e,o,s)}},L)}function V(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function Hn(e){return function(t,n,r){var i=Object(t);if(!v(t)){var a=M(n,3);t=ie(t),n=function(e){return a(i[e],e,i)}}var o=e(t,n,r);return o>-1?i[a?t[o]:o]:void 0}}var Un=Math.max;function Wn(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:Le(n);return i<0&&(i=Un(r+i,0)),ge(e,M(t,3),i)}var Gn=Hn(Wn);function Kn(e,t){var n=-1,r=v(e)?Array(e.length):[];return Se(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function H(e,t){return(A(e)?b:Kn)(e,M(t,3))}function qn(e,t){return e==null?e:r(e,Ce(t),L)}function Jn(e,t){return e&&te(e,Ce(t))}function Yn(e,t){return e>t}var Xn=Object.prototype.hasOwnProperty;function Zn(e,t){return e!=null&&Xn.call(e,t)}function Qn(e,t){return e!=null&&i(e,t,Zn)}var $n=`[object String]`;function er(e){return typeof e==`string`||!A(e)&&k(e)&&he(e)==$n}function tr(e,t){return e<t}function U(e,t){var n={};return t=M(t,3),te(e,function(e,r,i){P(n,r,t(e,r,i))}),n}function nr(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],o=t(a);if(o!=null&&(s===void 0?o===o&&!S(o):n(o,s)))var s=o,c=a}return c}function W(e){return e&&e.length?nr(e,ue,Yn):void 0}var rr=Ue(function(e,t,n){Vn(e,t,n)});function G(e){return e&&e.length?nr(e,ue,tr):void 0}function ir(e,t){return e&&e.length?nr(e,M(t,2),tr):void 0}function ar(e,t,n,r){if(!E(e))return e;t=we(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=ee(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=E(u)?u:xe(t[i+1])?[]:{})}He(s,c,l),s=s[c]}return e}function or(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=f(e,o);n(s,o)&&ar(a,we(o,e),s)}return a}function sr(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function cr(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=S(e),o=t!==void 0,s=t===null,c=t===t,l=S(t);if(!s&&!l&&!a&&e>t||a&&o&&c&&!s&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!c)return-1}return 0}function lr(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=cr(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function ur(e,t,n){t=t.length?b(t,function(e){return A(e)?function(t){return f(t,e.length===1?e[0]:e)}:e}):[ue];var r=-1;return t=b(t,ve(M)),sr(Kn(e,function(e,n,i){return{criteria:b(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return lr(e,t,n)})}var dr=ne(`length`),fr=`\\ud800-\\udfff`,pr=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,mr=`\\ufe0e\\ufe0f`,hr=`[`+fr+`]`,gr=`[`+pr+`]`,_r=`\\ud83c[\\udffb-\\udfff]`,vr=`(?:`+gr+`|`+_r+`)`,yr=`[^`+fr+`]`,br=`(?:\\ud83c[\\udde6-\\uddff]){2}`,xr=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Sr=`\\u200d`,Cr=vr+`?`,wr=`[`+mr+`]?`,Tr=`(?:`+Sr+`(?:`+[yr,br,xr].join(`|`)+`)`+wr+Cr+`)*`,Er=wr+Cr+Tr,Dr=`(?:`+[yr+gr+`?`,gr,br,xr,hr].join(`|`)+`)`,Or=RegExp(_r+`(?=`+_r+`)|`+Dr+Er,`g`);function kr(e){for(var t=Or.lastIndex=0;Or.test(e);)++t;return t}function Ar(e){return rt(e)?kr(e):dr(e)}function jr(e,t){return or(e,t,function(t,n){return a(e,n)})}var K=qe(function(e,t){return e==null?{}:jr(e,t)}),Mr=Math.ceil,Nr=Math.max;function Pr(e,t,n,r){for(var i=-1,a=Nr(Mr((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function Fr(e){return function(t,n,r){return r&&typeof r!=`number`&&I(t,n,r)&&(n=r=void 0),t=N(t),n===void 0?(n=t,t=0):n=N(n),r=r===void 0?t<n?1:-1:N(r),Pr(t,n,r,e)}}var q=Fr(),Ir=`[object Map]`,Lr=`[object Set]`;function Rr(e){if(e==null)return 0;if(v(e))return er(e)?Ar(e):e.length;var t=T(e);return t==Ir||t==Lr?e.size:c(e).length}var J=_(function(e,t){if(e==null)return[];var n=t.length;return n>1&&I(e,t[0],t[1])?t=[]:n>2&&I(t[0],t[1],t[2])&&(t=[t[0]]),ur(e,o(t,1),[])}),zr=0;function Br(e){var t=++zr;return n(e)+t}function Vr(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}function Hr(e,t){return Vr(e||[],t||[],He)}var Ur=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return Wr(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&Wr(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,Gr)),n=n._prev;return`[`+e.join(`, `)+`]`}};function Wr(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Gr(e,t){if(e!==`_next`&&e!==`_prev`)return t}var Kr=_e(1);function qr(e,t){if(e.nodeCount()<=1)return[];var n=Xr(e,t||Kr);return R(H(Jr(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function Jr(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)Yr(e,t,n,o);for(;o=i.dequeue();)Yr(e,t,n,o);if(e.nodeCount()){for(var s=t.length-2;s>0;--s)if(o=t[s].dequeue(),o){r=r.concat(Yr(e,t,n,o,!0));break}}}return r}function Yr(e,t,n,r,i){var a=i?[]:void 0;return j(e.inEdges(r.v),function(r){var o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,Zr(t,n,s)}),j(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,Zr(t,n,o)}),e.removeNode(r.v),a}function Xr(e,t){var n=new O,r=0,i=0;j(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),j(e.edges(),function(e){var a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s),i=Math.max(i,n.node(e.v).out+=o),r=Math.max(r,n.node(e.w).in+=o)});var a=q(i+r+3).map(function(){return new Ur}),o=r+1;return j(n.nodes(),function(e){Zr(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function Zr(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function Qr(e){j(e.graph().acyclicer===`greedy`?qr(e,t(e)):$r(e),function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,Br(`rev`))});function t(e){return function(t){return e.edge(t).weight}}}function $r(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,j(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return j(e.nodes(),i),t}function ei(e){j(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Y(e,t,n,r){var i;do i=Br(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function ti(e){var t=new O().setGraph(e.graph());return j(e.nodes(),function(n){t.setNode(n,e.node(n))}),j(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function ni(e){var t=new O({multigraph:e.isMultigraph()}).setGraph(e.graph());return j(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),j(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function ri(e,t){var n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);var c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function X(e){var t=H(q(si(e)+1),function(){return[]});return j(e.nodes(),function(n){var r=e.node(n),i=r.rank;w(i)||(t[i][r.order]=n)}),t}function ii(e){var t=G(H(e.nodes(),function(t){return e.node(t).rank}));j(e.nodes(),function(n){var r=e.node(n);Qn(r,`rank`)&&(r.rank-=t)})}function ai(e){var t=G(H(e.nodes(),function(t){return e.node(t).rank})),n=[];j(e.nodes(),function(r){var i=e.node(r).rank-t;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=e.graph().nodeRankFactor;j(n,function(t,n){w(t)&&n%i!==0?--r:r&&j(t,function(t){e.node(t).rank+=r})})}function oi(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),Y(e,`border`,i,t)}function si(e){return W(H(e.nodes(),function(t){var n=e.node(t).rank;if(!w(n))return n}))}function ci(e,t){var n={lhs:[],rhs:[]};return j(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function li(e,t){var n=Nn();try{return t()}finally{console.log(e+` time: `+(Nn()-n)+`ms`)}}function ui(e,t){return t()}function di(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&j(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)fi(e,`borderLeft`,`_bl`,n,i,a),fi(e,`borderRight`,`_br`,n,i,a)}}j(e.children(),t)}function fi(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=Y(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function pi(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&hi(e)}function mi(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&_i(e),(t===`lr`||t===`rl`)&&(yi(e),hi(e))}function hi(e){j(e.nodes(),function(t){gi(e.node(t))}),j(e.edges(),function(t){gi(e.edge(t))})}function gi(e){var t=e.width;e.width=e.height,e.height=t}function _i(e){j(e.nodes(),function(t){vi(e.node(t))}),j(e.edges(),function(t){var n=e.edge(t);j(n.points,vi),Object.prototype.hasOwnProperty.call(n,`y`)&&vi(n)})}function vi(e){e.y=-e.y}function yi(e){j(e.nodes(),function(t){bi(e.node(t))}),j(e.edges(),function(t){var n=e.edge(t);j(n.points,bi),Object.prototype.hasOwnProperty.call(n,`x`)&&bi(n)})}function bi(e){var t=e.x;e.x=e.y,e.y=t}function xi(e){e.graph().dummyChains=[],j(e.edges(),function(t){Si(e,t)})}function Si(e,t){var n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a!==r+1){e.removeEdge(t);var l=void 0,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],l={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},u=Y(e,`edge`,l,`_d`),r===c&&(l.width=s.width,l.height=s.height,l.dummy=`edge-label`,l.labelpos=s.labelpos),e.setEdge(n,u,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,i,{weight:s.weight},o)}}function Ci(e){j(e.graph().dummyChains,function(t){var n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function wi(e){var t={};function n(r){var i=e.node(r);if(Object.prototype.hasOwnProperty.call(t,r))return i.rank;t[r]=!0;var a=G(H(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}j(e.sources(),n)}function Z(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function Ti(e){var t=new O({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;Ei(t,e)<r;)i=Di(t,e),a=t.hasNode(i.v)?Z(e,i):-Z(e,i),Oi(t,e,a);return t}function Ei(e,t){function n(r){j(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!Z(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return j(e.nodes(),n),e.nodeCount()}function Di(e,t){return ir(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return Z(t,n)})}function Oi(e,t,n){j(e.nodes(),function(e){t.node(e).rank+=n})}_e(1),_e(1),ki.CycleException=Q;function ki(e){var t={},n={},r=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new Q;Object.prototype.hasOwnProperty.call(t,a)||(n[a]=!0,t[a]=!0,j(e.predecessors(a),i),delete n[a],r.push(a))}if(j(e.sinks(),i),Rr(t)!==e.nodeCount())throw new Q;return r}function Q(){}Q.prototype=Error();function Ai(e,t,n){A(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return j(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);ji(e,t,n===`post`,a,r,i)}),i}function ji(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),j(i(t),function(t){ji(e,t,n,r,i,a)}),n&&a.push(t))}function Mi(e,t){return Ai(e,t,`post`)}function Ni(e,t){return Ai(e,t,`pre`)}$.initLowLimValues=Li,$.initCutValues=Pi,$.calcCutValue=Ii,$.leaveEdge=zi,$.enterEdge=Bi,$.exchangeEdges=Vi;function $(e){e=ti(e),wi(e);var t=Ti(e);Li(t),Pi(t,e);for(var n,r;n=zi(t);)r=Bi(t,e,n),Vi(t,e,n,r)}function Pi(e,t){var n=Mi(e,e.nodes());n=n.slice(0,n.length-1),j(n,function(n){Fi(e,t,n)})}function Fi(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=Ii(e,t,n)}function Ii(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,j(t.nodeEdges(n),function(a){var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,Ui(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function Li(e,t){arguments.length<2&&(t=e.nodes()[0]),Ri(e,{},1,t)}function Ri(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,j(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=Ri(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function zi(e){return Gn(e.edges(),function(t){return e.edge(t).cutvalue<0})}function Bi(e,t,n){var r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);var a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),ir(y(t.edges(),function(t){return c===Wi(e,e.node(t.v),s)&&c!==Wi(e,e.node(t.w),s)}),function(e){return Z(t,e)})}function Vi(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),Li(e),Pi(e,t),Hi(e,t)}function Hi(e,t){var n=Ni(e,Gn(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),j(n,function(n){var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function Ui(e,t,n){return e.hasEdge(t,n)}function Wi(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function Gi(e){switch(e.graph().ranker){case`network-simplex`:Ji(e);break;case`tight-tree`:qi(e);break;case`longest-path`:Ki(e);break;default:Ji(e)}}var Ki=wi;function qi(e){wi(e),Ti(e)}function Ji(e){$(e)}function Yi(e){var t=Y(e,`root`,{},`_root`),n=Zi(e),r=W(C(n))-1,i=2*r+1;e.graph().nestingRoot=t,j(e.edges(),function(t){e.edge(t).minlen*=i});var a=Qi(e)+1;j(e.children(),function(o){Xi(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function Xi(e,t,n,r,i,a,o){var s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}var c=oi(e,`_bt`),l=oi(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,j(s,function(s){Xi(e,t,n,r,i,a,s);var u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-a[o]+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+a[o]})}function Zi(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&j(a,function(e){n(e,i+1)}),t[r]=i}return j(e.children(),function(e){n(e,1)}),t}function Qi(e){return D(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function $i(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,j(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function ea(e,t,n){var r={},i;j(n,function(n){for(var a=e.parent(n),o,s;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function ta(e,t,n){var r=na(e),i=new O({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return j(e.nodes(),function(a){var o=e.node(a),s=e.parent(a);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||r),j(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=w(r)?0:r.weight;i.setEdge(n,a,{weight:e.edge(t).weight+o})}),Object.prototype.hasOwnProperty.call(o,`minRank`)&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function na(e){for(var t;e.hasNode(t=Br(`_root`)););return t}function ra(e,t){for(var n=0,r=1;r<t.length;++r)n+=ia(e,t[r-1],t[r]);return n}function ia(e,t,n){for(var r=Hr(n,H(n,function(e,t){return t})),i=R(H(t,function(t){return J(H(e.outEdges(t),function(t){return{pos:r[t.w],weight:e.edge(t).weight}}),`pos`)})),a=1;a<n.length;)a<<=1;var o=2*a-1;--a;var s=H(Array(o),function(){return 0}),c=0;return j(i.forEach(function(e){var t=e.pos+a;s[t]+=e.weight;for(var n=0;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n})),c}function aa(e){var t={},n=y(e.nodes(),function(t){return!e.children(t).length}),r=H(q(W(H(n,function(t){return e.node(t).rank}))+1),function(){return[]});function i(n){Qn(t,n)||(t[n]=!0,r[e.node(n).rank].push(n),j(e.successors(n),i))}return j(J(n,function(t){return e.node(t).rank}),i),r}function oa(e,t){return H(t,function(t){var n=e.inEdges(t);if(n.length){var r=D(n,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}function sa(e,t){var n={};return j(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};w(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),j(t.edges(),function(e){var t=n[e.v],r=n[e.w];!w(t)&&!w(r)&&(r.indegree++,t.out.push(n[e.w]))}),ca(y(n,function(e){return!e.indegree}))}function ca(e){var t=[];function n(e){return function(t){t.merged||(w(t.barycenter)||w(e.barycenter)||t.barycenter>=e.barycenter)&&la(e,t)}}function r(t){return function(n){n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){var i=e.pop();t.push(i),j(i.in.reverse(),n(i)),j(i.out,r(i))}return H(y(t,function(e){return!e.merged}),function(e){return K(e,[`vs`,`i`,`barycenter`,`weight`])})}function la(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function ua(e,t){var n=ci(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=J(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,c=0;r.sort(fa(!!t)),c=da(a,i,c),j(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=da(a,i,c)});var l={vs:R(a)};return s&&(l.barycenter=o/s,l.weight=s),l}function da(e,t,n){for(var r;t.length&&(r=V(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function fa(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}function pa(e,t,n,r){var i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=y(i,function(e){return e!==o&&e!==s}));var l=oa(e,i);j(l,function(t){if(e.children(t.v).length){var i=pa(e,t.v,n,r);c[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&ha(t,i)}});var u=sa(l,n);ma(u,c);var d=ua(u,r);if(o&&(d.vs=R([o,d.vs,s]),e.predecessors(o).length)){var f=e.node(e.predecessors(o)[0]),p=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d}function ma(e,t){j(e,function(e){e.vs=R(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function ha(e,t){w(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function ga(e){var t=si(e),n=_a(e,q(1,t+1),`inEdges`),r=_a(e,q(t-1,-1,-1),`outEdges`),i=aa(e);ya(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){va(s%2?n:r,s%4>=2),i=X(e);var l=ra(e,i);l<a&&(c=0,o=Mn(i),a=l)}ya(e,o)}function _a(e,t,n){return H(t,function(t){return ta(e,t,n)})}function va(e,t){var n=new O;j(e,function(e){var r=e.graph().root,i=pa(e,r,n,t);j(i.vs,function(t,n){e.node(t).order=n}),ea(e,n,i.vs)})}function ya(e,t){j(t,function(t){j(t,function(t,n){e.node(t).order=n})})}function ba(e){var t=Sa(e);j(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=xa(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(l=o[c+1]).minRank<=r.rank;)c++;l=o[c]}e.setParent(n,l),n=e.successors(n)[0]}})}function xa(e,t,n,r){var i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c=n,l;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function Sa(e){var t={},n=0;function r(i){var a=n;j(e.children(i),r),t[i]={low:a,lim:n++}}return j(e.children(),r),t}function Ca(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=V(r);return j(r,function(t,c){var l=Ta(e,t),u=l?e.node(l).order:o;(l||t===s)&&(j(r.slice(a,c+1),function(t){j(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Ea(n,r,t)})}),a=c+1,i=u)}),r}return D(t,r),n}function wa(e,t){var n={};function r(t,r,i,a,o){var s;j(q(r,i),function(r){s=t[r],e.node(s).dummy&&j(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Ea(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return j(n,function(s,c){if(e.node(s).dummy===`border`){var l=e.predecessors(s);l.length&&(a=e.node(l[0]).order,r(n,o,c,i,a),o=c,i=a)}r(n,o,n.length,a,t.length)}),n}return D(t,i),n}function Ta(e,t){if(e.node(t).dummy)return Gn(e.predecessors(t),function(t){return e.node(t).dummy})}function Ea(e,t,n){if(t>n){var r=t;t=n,n=r}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[t];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Da(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function Oa(e,t,n,r){var i={},a={},o={};return j(t,function(e){j(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),j(t,function(e){var t=-1;j(e,function(e){var s=r(e);if(s.length){s=J(s,function(e){return o[e]});for(var c=(s.length-1)/2,l=Math.floor(c),u=Math.ceil(c);l<=u;++l){var d=s[l];a[e]===e&&t<o[d]&&!Da(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function ka(e,t,n,r,i){var a={},o=Aa(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){for(var n=o.nodes(),r=n.pop(),i={};r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce(function(e,t){return Math.max(e,a[t.v]+o.edge(t))},0)}function u(t){var n=o.outEdges(t).reduce(function(e,t){return Math.min(e,a[t.w]-o.edge(t))},1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),j(r,function(e){a[e]=a[n[e]]}),a}function Aa(e,t,n,r){var i=new O,a=e.graph(),o=Fa(a.nodesep,a.edgesep,r);return j(t,function(t){var r;j(t,function(t){var a=n[t];if(i.setNode(a),r){var s=n[r],c=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),c||0))}r=t})}),i}function ja(e,t){return ir(C(t),function(t){var n=-1/0,r=1/0;return qn(t,function(t,i){var a=Ia(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function Ma(e,t){var n=C(t),r=G(n),i=W(n);j([`u`,`d`],function(n){j([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=C(s);c=a===`l`?r-G(l):i-W(l),c&&(e[o]=U(s,function(e){return e+c}))}})})}function Na(e,t){return U(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=J(H(e,r));return(i[1]+i[2])/2})}function Pa(e){var t=X(e),n=rr(Ca(e,t),wa(e,t)),r={},i;return j([`u`,`d`],function(a){i=a===`u`?t:C(t).reverse(),j([`l`,`r`],function(t){t===`r`&&(i=H(i,function(e){return C(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=Oa(e,i,n,o),c=ka(e,i,s.root,s.align,t===`r`);t===`r`&&(c=U(c,function(e){return-e})),r[a+t]=c})}),Ma(r,ja(e,r)),Na(r,e.graph().align)}function Fa(e,t,n){return function(r,i,a){var o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.prototype.hasOwnProperty.call(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.prototype.hasOwnProperty.call(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function Ia(e,t){return e.node(t).width}function La(e){e=ni(e),Ra(e),Jn(Pa(e),function(t,n){e.node(n).x=t})}function Ra(e){var t=X(e),n=e.graph().ranksep,r=0;j(t,function(t){var i=W(H(t,function(t){return e.node(t).height}));j(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function za(e,t){var n=t&&t.debugTiming?li:ui;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>Xa(e));n(` runLayout`,()=>Ba(t,n)),n(` updateInputGraph`,()=>Va(e,t))})}function Ba(e,t){t(` makeSpaceForEdgeLabels`,()=>Za(e)),t(` removeSelfEdges`,()=>oo(e)),t(` acyclic`,()=>Qr(e)),t(` nestingGraph.run`,()=>Yi(e)),t(` rank`,()=>Gi(ni(e))),t(` injectEdgeLabelProxies`,()=>Qa(e)),t(` removeEmptyRanks`,()=>ai(e)),t(` nestingGraph.cleanup`,()=>$i(e)),t(` normalizeRanks`,()=>ii(e)),t(` assignRankMinMax`,()=>$a(e)),t(` removeEdgeLabelProxies`,()=>eo(e)),t(` normalize.run`,()=>xi(e)),t(` parentDummyChains`,()=>ba(e)),t(` addBorderSegments`,()=>di(e)),t(` order`,()=>ga(e)),t(` insertSelfEdges`,()=>so(e)),t(` adjustCoordinateSystem`,()=>pi(e)),t(` position`,()=>La(e)),t(` positionSelfEdges`,()=>co(e)),t(` removeBorderNodes`,()=>ao(e)),t(` normalize.undo`,()=>Ci(e)),t(` fixupEdgeLabelCoords`,()=>ro(e)),t(` undoCoordinateSystem`,()=>mi(e)),t(` translateGraph`,()=>to(e)),t(` assignNodeIntersects`,()=>no(e)),t(` reversePoints`,()=>io(e)),t(` acyclic.undo`,()=>ei(e))}function Va(e,t){j(e.nodes(),function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))}),j(e.edges(),function(n){var r=e.edge(n),i=t.edge(n);r.points=i.points,Object.prototype.hasOwnProperty.call(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Ha=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],Ua={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},Wa=[`acyclicer`,`ranker`,`rankdir`,`align`],Ga=[`width`,`height`],Ka={width:0,height:0},qa=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Ja={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Ya=[`labelpos`];function Xa(e){var t=new O({multigraph:!0,compound:!0}),n=uo(e.graph());return t.setGraph(rr({},Ua,lo(n,Ha),K(n,Wa))),j(e.nodes(),function(n){var r=uo(e.node(n));t.setNode(n,In(lo(r,Ga),Ka)),t.setParent(n,e.parent(n))}),j(e.edges(),function(n){var r=uo(e.edge(n));t.setEdge(n,rr({},Ja,lo(r,qa),K(r,Ya)))}),t}function Za(e){var t=e.graph();t.ranksep/=2,j(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Qa(e){j(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);Y(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function $a(e){var t=0;j(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=W(t,r.maxRank))}),e.graph().maxRank=t}function eo(e){j(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function to(e){var t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){var a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}j(e.nodes(),function(t){c(e.node(t))}),j(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,j(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),j(e.edges(),function(n){var i=e.edge(n);j(i.points,function(e){e.x-=t,e.y-=r}),Object.prototype.hasOwnProperty.call(i,`x`)&&(i.x-=t),Object.prototype.hasOwnProperty.call(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function no(e){j(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(ri(r,a)),n.points.push(ri(i,o))})}function ro(e){j(e.edges(),function(t){var n=e.edge(t);if(Object.prototype.hasOwnProperty.call(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function io(e){j(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function ao(e){j(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(V(n.borderLeft)),o=e.node(V(n.borderRight));n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),j(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function oo(e){j(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function so(e){j(X(e),function(t){var n=0;j(t,function(t,r){var i=e.node(t);i.order=r+n,j(i.selfEdges,function(t){Y(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function co(e){j(e.nodes(),function(t){var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function lo(e,t){return U(K(e,t),Number)}function uo(e){var t={};return j(e,function(e,n){t[n.toLowerCase()]=e}),t}export{za as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-CyiGaINC.js";import{t}from"./chunk-JWPE2WC7-DEVN_PSR.js";import{t as n}from"./chunk-2Q5K7J3B-BQ7ktM_H.js";import{Ir as r,Lt as i,Nr as a,Sr as o,_n as s,ar as c,bn as l,br as u,cr as d,er as f,or as p,rr as m,sr as h,ur as g,vn as _,vr as v,yr as y}from"./MermaidBlock-C2QkLej8.js";var b=/[─━│┃└┗├┣]/,x=/[└┗├┣]/,S=/[─━]/,C=/^[\s│┃]+$/,w=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,T=/^\s*%%/,E=` `;function D(e){return e.some(e=>b.test(e))}r(D,`isBoxDrawingFormat`);function O(e){for(let t of e){let e=x.exec(t);if(e?.index&&e.index>0)return e.index}return 4}r(O,`inferSegmentWidth`);function k(e,t){return e.replace(/\bline\s+(\d+)\b/gi,(e,n)=>{let r=parseInt(n,10),i=t.get(r);return i?`line ${i}`:e})}r(k,`remapErrorLines`);function A(e){let t=e.split(`
1
+ import{n as e}from"./mermaid-parser.core-vshe0mzD.js";import{t}from"./chunk-JWPE2WC7-zKI5bjIE.js";import{t as n}from"./chunk-2Q5K7J3B-N0kjk6xb.js";import{Ir as r,Lt as i,Nr as a,Sr as o,_n as s,ar as c,bn as l,br as u,cr as d,er as f,or as p,rr as m,sr as h,ur as g,vn as _,vr as v,yr as y}from"./MermaidBlock-CF2HMJlR.js";var b=/[─━│┃└┗├┣]/,x=/[└┗├┣]/,S=/[─━]/,C=/^[\s│┃]+$/,w=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,T=/^\s*%%/,E=` `;function D(e){return e.some(e=>b.test(e))}r(D,`isBoxDrawingFormat`);function O(e){for(let t of e){let e=x.exec(t);if(e?.index&&e.index>0)return e.index}return 4}r(O,`inferSegmentWidth`);function k(e,t){return e.replace(/\bline\s+(\d+)\b/gi,(e,n)=>{let r=parseInt(n,10),i=t.get(r);return i?`line ${i}`:e})}r(k,`remapErrorLines`);function A(e){let t=e.split(`
2
2
  `),n=new Map,r=-1;for(let[e,n]of t.entries())if(n.trim()===`treeView-beta`){r=e;break}if(r===-1)return{text:e,lineMap:n};let i=[];for(let e=r+1;e<t.length;e++){let n=t[e];n.trim()===``||T.test(n)||w.test(n)||C.test(n)||i.push(n.replace(/\t/g,` `))}if(!D(i))return{text:e,lineMap:n};let a=O(i),o=[],s=0;for(let e=0;e<=r;e++)o.push(t[e]),s++,n.set(s,e+1);for(let e=r+1;e<t.length;e++){let r=t[e],i=r.trim(),c=e+1;if(i===``){o.push(r),s++,n.set(s,c);continue}if(T.test(r)){o.push(r),s++,n.set(s,c);continue}if(w.test(r)){o.push(r),s++,n.set(s,c);continue}if(C.test(r))continue;let l=r.replace(/\t/g,` `),u=x.exec(l);if(u?.index!==void 0){let e=u.index,t=Math.round(e/a)+1,r=e+1;for(;r<l.length&&S.test(l[r]);)r++;for(;r<l.length&&l[r]===` `;)r++;let i=l.slice(r).trimEnd();if(!i)throw Error(`Line ${c}: Empty node \u2014 expected a filename or directory name after the box-drawing prefix`);let d=E.repeat(t);o.push(d+i),s++,n.set(s,c)}else if(/^[\s─━│┃└┗├┣]+$/.test(l))continue;else if(b.test(l))o.push(r),s++,n.set(s,c);else if(/^\s+/.test(l))throw Error(`Line ${c}: Unexpected indentation without box-drawing characters. In box-drawing format, use \u251C\u2500\u2500 or \u2514\u2500\u2500 prefixes for indented nodes.`);else o.push(r),s++,n.set(s,c)}return{text:o.join(`
3
3
  `),lineMap:n}}r(A,`preprocessBoxDrawing`);var j=new n(()=>({cnt:1,stack:[{id:0,level:-1,name:`/`,nodeType:`directory`,children:[]}]})),M=r(()=>{j.reset(),f()},`clear`),N=r(()=>j.records.stack[0],`getRoot`),P=r(()=>j.records.cnt,`getCount`),F=c.treeView,I={clear:M,addNode:r((e,t,n,r,i,a)=>{for(;e<=j.records.stack[j.records.stack.length-1].level;)j.records.stack.pop();let o={id:j.records.cnt++,level:e,name:t,nodeType:n,icon:i,cssClass:r,description:a,children:[]};j.records.stack[j.records.stack.length-1].children.push(o),j.records.stack.push(o)},`addNode`),getRoot:N,getCount:P,getConfig:r(()=>i(F,d().treeView),`getConfig`),getAccTitle:h,getAccDescription:p,getDiagramTitle:g,setAccDescription:y,setAccTitle:u,setDiagramTitle:o},L=r(e=>{t(e,I);for(let t of e.nodes){let e=typeof t.indent==`number`?t.indent:0,n=t.name,r=n.endsWith(`/`);r&&(n=n.slice(0,-1));let i=r?`directory`:`file`,a=t.classAnnotation||void 0,o=t.iconAnnotation,s=o===void 0?void 0:o||`none`,c=t.descAnnotation||void 0,l=c?v(c,d()):void 0;I.addNode(e,n,i,a,s,l)}},`populate`),R={parse:r(async t=>{let{text:n,lineMap:r}=A(t);try{let t=await e(`treeView`,n);a.debug(t),L(t)}catch(e){throw r.size>0&&e instanceof Error&&(e.message=k(e.message,r)),e}},`parse`)},z={prefix:`mermaid-treeview`,height:24,width:24,icons:{folder:{body:`<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>`},file:{body:`<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>`}}};function B(e,t){let n=t?.filenameIcons?.[e];if(n)return n;let r=e.lastIndexOf(`.`);if(r>0){let n=e.substring(r).toLowerCase(),i=t?.extensionIcons;return i?.[n]??i?.[n.slice(1)]}}r(B,`detectIcon`);function V(e,t){return e.includes(`:`)?e:e in z.icons||!t?`${z.prefix}:${e}`:`${t}:${e}`}r(V,`qualifyIcon`);function H(e,t){if(e.icon!==`none`){if(e.icon)return V(e.icon,t.defaultIconPack);if(t.showIcons){if(e.nodeType===`file`){let n=B(e.name,t);if(n===`none`)return;if(n)return V(n,t.defaultIconPack)}return`${z.prefix}:${e.nodeType===`directory`?`folder`:`file`}`}}}r(H,`getNodeIcon`),_([{name:z.prefix,icons:z}]);var U=14,W=4,G=16,K=r(async(e,t)=>{let n=[],i=r(e=>{let r=H(e,t);r&&n.push({icon:r,node:e}),e.children.forEach(i)},`collect`);i(e);let a=await Promise.all(n.map(async({icon:e,node:t})=>({id:t.id,svg:await s(e,{height:U,width:U})})));return new Map(a.map(({id:e,svg:t})=>[e,t]))},`resolveNodeIcons`),q=r((e,t,n,r,i,a)=>{let o=r.append(`g`),s=`treeView-node-label`;n.nodeType===`directory`&&(s+=` treeView-node-dir`),n.cssClass&&(s+=` ${n.cssClass}`);let c=U+W,l=H(n,i),u=l!==void 0;l&&o.append(`g`).attr(`class`,`treeView-node-icon`).attr(`transform`,`translate(${e+i.paddingX}, ${t+i.paddingY})`).html(a.get(n.id)??``);let d=o.append(`text`).text(n.name).attr(`dominant-baseline`,`middle`).attr(`class`,s),{height:f,width:p}=d.node().getBBox(),m=f+i.paddingY*2,h=e+i.paddingX+(u?c:0);d.attr(`x`,h),d.attr(`y`,t+m/2);let g=h+p;return n.BBox={x:e,y:t,width:p+i.paddingX*2+(u?c:0),height:m},n.cssClass?.split(/\s+/).includes(`highlight`)&&o.insert(`rect`,`:first-child`).attr(`x`,e).attr(`y`,t+1).attr(`width`,0).attr(`height`,m-2).attr(`rx`,3).attr(`class`,`treeView-highlight-bg`),{node:n,nodeGroup:o,labelRightEdge:g,centerY:t+m/2}},`positionLabel`),J=r((e,t,n,r,i,a)=>e.append(`line`).attr(`x1`,t).attr(`y1`,n).attr(`x2`,r).attr(`y2`,i).attr(`stroke-width`,a).attr(`class`,`treeView-node-line`),`positionLine`),Y=r((e,t,n,i)=>{let a=0,o=0,s=[],c=r((e,t,n,r)=>{let c=r*(n.rowIndent+n.paddingX),l=q(c,a,t,e,n,i);s.push(l);let{height:u,width:d}=t.BBox;J(e,c-n.rowIndent,a+u/2,c,a+u/2,n.lineThickness),o=Math.max(o,c+d),a+=u},`drawNode`),l=r((t,r=0)=>{c(e,t,n,r),t.children.forEach(e=>{l(e,r+1)});let{x:i,y:a,height:o}=t.BBox;if(t.children.length){let{y:r,height:s}=t.children[t.children.length-1].BBox;J(e,i+n.paddingX,a+o,i+n.paddingX,r+s/2+n.lineThickness/2,n.lineThickness)}},`processNode`);l(t);let u=s.filter(e=>e.node.description);if(u.length>0){let e=Math.max(...s.map(e=>e.labelRightEdge))+G;for(let t of u){let r=t.nodeGroup.append(`text`).text(t.node.description).attr(`dominant-baseline`,`middle`).attr(`class`,`treeView-node-description`).attr(`x`,e).attr(`y`,t.centerY).node().getBBox();o=Math.max(o,e+r.width+n.paddingX)}}for(let e of s)if(e.node.cssClass?.split(/\s+/).includes(`highlight`)){let t=e.nodeGroup.select(`.treeView-highlight-bg`);if(!t.empty()){let n=o-e.node.BBox.x+8;t.attr(`width`,n),o=Math.max(o,e.node.BBox.x+n+2)}}return{totalHeight:a,totalWidth:o}},`drawTree`),X={draw:r(async(e,t,n,r)=>{a.debug(`Rendering treeView diagram
4
4
  `+e);let i=r.db,o=i.getRoot(),s=i.getConfig(),c=l(t),u=c.append(`g`);u.attr(`class`,`tree-view`);let{totalHeight:d,totalWidth:f}=Y(u,o,s,await K(o,s));c.attr(`viewBox`,`-${s.lineThickness/2} 0 ${f} ${d}`),m(c,d,f,s.useMaxWidth)},`draw`)},Z={labelFontSize:`16px`,labelColor:`black`,lineColor:`black`,iconColor:`#546e7a`,descriptionColor:`#6a9955`,highlightBg:`rgba(255, 193, 7, 0.15)`,highlightStroke:`#ffc107`},Q={db:I,renderer:X,parser:R,styles:r(({treeView:e})=>{let{labelFontSize:t,labelColor:n,lineColor:r,iconColor:a,descriptionColor:o,highlightBg:s,highlightStroke:c}=i(Z,e);return`
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-CyiGaINC.js";import{t}from"./chunk-JWPE2WC7-DEVN_PSR.js";import{Ir as n,Lt as r,Nr as i,Sr as a,ar as o,bn as s,br as c,cr as l,dr as u,er as d,or as f,rr as p,sr as m,ur as h,yr as g}from"./MermaidBlock-C2QkLej8.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v=32,y={axes:[],curves:[],options:_},b=structuredClone(y),x=o.radar,S=n(()=>r({...x,...l().radar}),`getConfig`),C=n(()=>b.axes,`getAxes`),w=n(()=>b.curves,`getCurves`),T=n(()=>b.options,`getOptions`),E=n(e=>{b.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),D=n(e=>{b.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:O(e.entries)}))},`setCurves`),O=n(e=>{if(e[0].axis==null)return e.map(e=>e.value);let t=C();if(t.length===0)throw Error(`Axes must be populated before curves for reference entries`);return t.map(t=>{let n=e.find(e=>e.axis?.$refText===t.name);if(n===void 0)throw Error(`Missing entry for axis `+t.label);return n.value})},`computeCurveEntries`),k={getAxes:C,getCurves:w,getOptions:T,setAxes:E,setCurves:D,setOptions:n(e=>{let t=e.reduce((e,t)=>(e[t.name]=t,e),{});b.options={showLegend:t.showLegend?.value??_.showLegend,ticks:t.ticks?.value??_.ticks,max:t.max?.value??_.max,min:t.min?.value??_.min,graticule:t.graticule?.value??_.graticule},b.options.ticks>v&&(i.warn(`Radar diagram ticks (${b.options.ticks}) exceeds maximum allowed (${v}). Using ${v} instead.`),b.options.ticks=v)},`setOptions`),getConfig:S,clear:n(()=>{d(),b=structuredClone(y)},`clear`),setAccTitle:c,getAccTitle:m,setDiagramTitle:a,getDiagramTitle:h,getAccDescription:f,setAccDescription:g},A=n(e=>{t(e,k);let{axes:n,curves:r,options:i}=e;k.setAxes(n),k.setCurves(r),k.setOptions(i)},`populate`),j={parse:n(async t=>{let n=await e(`radar`,t);i.debug(n),A(n)},`parse`)},M=n((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),c=i.getOptions(),l=i.getConfig(),u=i.getDiagramTitle(),d=N(s(t),l),f=c.max??Math.max(...o.map(e=>Math.max(...e.entries))),p=c.min,m=Math.min(l.width,l.height)/2;P(d,a,m,c.ticks,c.graticule),F(d,a,m,l),I(d,a,o,p,f,c.graticule,l),z(d,o,c.showLegend,l),d.append(`text`).attr(`class`,`radarTitle`).text(u).attr(`x`,0).attr(`y`,-l.height/2-l.marginTop)},`draw`),N=n((e,t)=>{let n=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,i={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return p(e,r,n,t.useMaxWidth??!0),e.attr(`viewBox`,`0 0 ${n} ${r}`).attr(`overflow`,`visible`),e.append(`g`).attr(`transform`,`translate(${i.x}, ${i.y})`)},`drawFrame`),P=n((e,t,n,r,i)=>{if(i===`circle`)for(let t=0;t<r;t++){let i=n*(t+1)/r;e.append(`circle`).attr(`r`,i).attr(`class`,`radarGraticule`)}else if(i===`polygon`){let i=t.length;for(let a=0;a<r;a++){let o=n*(a+1)/r,s=t.map((e,t)=>{let n=2*t*Math.PI/i-Math.PI/2;return`${o*Math.cos(n)},${o*Math.sin(n)}`}).join(` `);e.append(`polygon`).attr(`points`,s).attr(`class`,`radarGraticule`)}}},`drawGraticule`),F=n((e,t,n,r)=>{let i=t.length;for(let a=0;a<i;a++){let o=t[a].label,s=2*a*Math.PI/i-Math.PI/2,c=Math.cos(s),l=Math.sin(s);e.append(`line`).attr(`x1`,0).attr(`y1`,0).attr(`x2`,n*r.axisScaleFactor*c).attr(`y2`,n*r.axisScaleFactor*l).attr(`class`,`radarAxisLine`);let u=c>.01?`start`:c<-.01?`end`:`middle`,d=l>.01?`hanging`:l<-.01?`auto`:`central`;e.append(`text`).text(o).attr(`x`,n*r.axisLabelFactor*c+4*c).attr(`y`,n*r.axisLabelFactor*l+4*l).attr(`text-anchor`,u).attr(`dominant-baseline`,d).attr(`class`,`radarAxisLabel`)}},`drawAxes`);function I(e,t,n,r,i,a,o){let s=t.length,c=Math.min(o.width,o.height)/2;n.forEach((t,n)=>{if(t.entries.length!==s)return;let l=t.entries.map((e,t)=>{let n=2*Math.PI*t/s-Math.PI/2,a=L(e,r,i,c);return{x:a*Math.cos(n),y:a*Math.sin(n)}});a===`circle`?e.append(`path`).attr(`d`,R(l,o.curveTension)).attr(`class`,`radarCurve-${n}`):a===`polygon`&&e.append(`polygon`).attr(`points`,l.map(e=>`${e.x},${e.y}`).join(` `)).attr(`class`,`radarCurve-${n}`)})}n(I,`drawCurves`);function L(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}n(L,`relativeRadius`);function R(e,t){let n=e.length,r=`M${e[0].x},${e[0].y}`;for(let i=0;i<n;i++){let a=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],c=e[(i+2)%n],l={x:o.x+(s.x-a.x)*t,y:o.y+(s.y-a.y)*t},u={x:s.x-(c.x-o.x)*t,y:s.y-(c.y-o.y)*t};r+=` C${l.x},${l.y} ${u.x},${u.y} ${s.x},${s.y}`}return`${r} Z`}n(R,`closedRoundCurve`);function z(e,t,n,r){if(!n)return;let i=(r.width/2+r.marginRight)*3/4,a=-(r.height/2+r.marginTop)*3/4;t.forEach((t,n)=>{let r=e.append(`g`).attr(`transform`,`translate(${i}, ${a+n*20})`);r.append(`rect`).attr(`width`,12).attr(`height`,12).attr(`class`,`radarLegendBox-${n}`),r.append(`text`).attr(`x`,16).attr(`y`,0).attr(`class`,`radarLegendText`).text(t.label)})}n(z,`drawLegend`);var B={draw:M},V=n((e,t)=>{let n=``;for(let r=0;r<e.THEME_COLOR_LIMIT;r++){let i=e[`cScale${r}`];n+=`
1
+ import{n as e}from"./mermaid-parser.core-vshe0mzD.js";import{t}from"./chunk-JWPE2WC7-zKI5bjIE.js";import{Ir as n,Lt as r,Nr as i,Sr as a,ar as o,bn as s,br as c,cr as l,dr as u,er as d,or as f,rr as p,sr as m,ur as h,yr as g}from"./MermaidBlock-CF2HMJlR.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v=32,y={axes:[],curves:[],options:_},b=structuredClone(y),x=o.radar,S=n(()=>r({...x,...l().radar}),`getConfig`),C=n(()=>b.axes,`getAxes`),w=n(()=>b.curves,`getCurves`),T=n(()=>b.options,`getOptions`),E=n(e=>{b.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),D=n(e=>{b.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:O(e.entries)}))},`setCurves`),O=n(e=>{if(e[0].axis==null)return e.map(e=>e.value);let t=C();if(t.length===0)throw Error(`Axes must be populated before curves for reference entries`);return t.map(t=>{let n=e.find(e=>e.axis?.$refText===t.name);if(n===void 0)throw Error(`Missing entry for axis `+t.label);return n.value})},`computeCurveEntries`),k={getAxes:C,getCurves:w,getOptions:T,setAxes:E,setCurves:D,setOptions:n(e=>{let t=e.reduce((e,t)=>(e[t.name]=t,e),{});b.options={showLegend:t.showLegend?.value??_.showLegend,ticks:t.ticks?.value??_.ticks,max:t.max?.value??_.max,min:t.min?.value??_.min,graticule:t.graticule?.value??_.graticule},b.options.ticks>v&&(i.warn(`Radar diagram ticks (${b.options.ticks}) exceeds maximum allowed (${v}). Using ${v} instead.`),b.options.ticks=v)},`setOptions`),getConfig:S,clear:n(()=>{d(),b=structuredClone(y)},`clear`),setAccTitle:c,getAccTitle:m,setDiagramTitle:a,getDiagramTitle:h,getAccDescription:f,setAccDescription:g},A=n(e=>{t(e,k);let{axes:n,curves:r,options:i}=e;k.setAxes(n),k.setCurves(r),k.setOptions(i)},`populate`),j={parse:n(async t=>{let n=await e(`radar`,t);i.debug(n),A(n)},`parse`)},M=n((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),c=i.getOptions(),l=i.getConfig(),u=i.getDiagramTitle(),d=N(s(t),l),f=c.max??Math.max(...o.map(e=>Math.max(...e.entries))),p=c.min,m=Math.min(l.width,l.height)/2;P(d,a,m,c.ticks,c.graticule),F(d,a,m,l),I(d,a,o,p,f,c.graticule,l),z(d,o,c.showLegend,l),d.append(`text`).attr(`class`,`radarTitle`).text(u).attr(`x`,0).attr(`y`,-l.height/2-l.marginTop)},`draw`),N=n((e,t)=>{let n=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,i={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return p(e,r,n,t.useMaxWidth??!0),e.attr(`viewBox`,`0 0 ${n} ${r}`).attr(`overflow`,`visible`),e.append(`g`).attr(`transform`,`translate(${i.x}, ${i.y})`)},`drawFrame`),P=n((e,t,n,r,i)=>{if(i===`circle`)for(let t=0;t<r;t++){let i=n*(t+1)/r;e.append(`circle`).attr(`r`,i).attr(`class`,`radarGraticule`)}else if(i===`polygon`){let i=t.length;for(let a=0;a<r;a++){let o=n*(a+1)/r,s=t.map((e,t)=>{let n=2*t*Math.PI/i-Math.PI/2;return`${o*Math.cos(n)},${o*Math.sin(n)}`}).join(` `);e.append(`polygon`).attr(`points`,s).attr(`class`,`radarGraticule`)}}},`drawGraticule`),F=n((e,t,n,r)=>{let i=t.length;for(let a=0;a<i;a++){let o=t[a].label,s=2*a*Math.PI/i-Math.PI/2,c=Math.cos(s),l=Math.sin(s);e.append(`line`).attr(`x1`,0).attr(`y1`,0).attr(`x2`,n*r.axisScaleFactor*c).attr(`y2`,n*r.axisScaleFactor*l).attr(`class`,`radarAxisLine`);let u=c>.01?`start`:c<-.01?`end`:`middle`,d=l>.01?`hanging`:l<-.01?`auto`:`central`;e.append(`text`).text(o).attr(`x`,n*r.axisLabelFactor*c+4*c).attr(`y`,n*r.axisLabelFactor*l+4*l).attr(`text-anchor`,u).attr(`dominant-baseline`,d).attr(`class`,`radarAxisLabel`)}},`drawAxes`);function I(e,t,n,r,i,a,o){let s=t.length,c=Math.min(o.width,o.height)/2;n.forEach((t,n)=>{if(t.entries.length!==s)return;let l=t.entries.map((e,t)=>{let n=2*Math.PI*t/s-Math.PI/2,a=L(e,r,i,c);return{x:a*Math.cos(n),y:a*Math.sin(n)}});a===`circle`?e.append(`path`).attr(`d`,R(l,o.curveTension)).attr(`class`,`radarCurve-${n}`):a===`polygon`&&e.append(`polygon`).attr(`points`,l.map(e=>`${e.x},${e.y}`).join(` `)).attr(`class`,`radarCurve-${n}`)})}n(I,`drawCurves`);function L(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}n(L,`relativeRadius`);function R(e,t){let n=e.length,r=`M${e[0].x},${e[0].y}`;for(let i=0;i<n;i++){let a=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],c=e[(i+2)%n],l={x:o.x+(s.x-a.x)*t,y:o.y+(s.y-a.y)*t},u={x:s.x-(c.x-o.x)*t,y:s.y-(c.y-o.y)*t};r+=` C${l.x},${l.y} ${u.x},${u.y} ${s.x},${s.y}`}return`${r} Z`}n(R,`closedRoundCurve`);function z(e,t,n,r){if(!n)return;let i=(r.width/2+r.marginRight)*3/4,a=-(r.height/2+r.marginTop)*3/4;t.forEach((t,n)=>{let r=e.append(`g`).attr(`transform`,`translate(${i}, ${a+n*20})`);r.append(`rect`).attr(`width`,12).attr(`height`,12).attr(`class`,`radarLegendBox-${n}`),r.append(`text`).attr(`x`,16).attr(`y`,0).attr(`class`,`radarLegendText`).text(t.label)})}n(z,`drawLegend`);var B={draw:M},V=n((e,t)=>{let n=``;for(let r=0;r<e.THEME_COLOR_LIMIT;r++){let i=e[`cScale${r}`];n+=`
2
2
  .radarCurve-${r} {
3
3
  color: ${i};
4
4
  fill: ${i};
@@ -1,3 +1,3 @@
1
- import{N as e,n as t}from"./mermaid-parser.core-CyiGaINC.js";import{t as n}from"./chunk-JWPE2WC7-DEVN_PSR.js";import{Ir as r,Lt as i,Nr as a,Pt as o,Sr as s,Wt as c,Zn as l,ar as u,br as d,cr as f,er as p,lr as m,or as h,sr as g,ur as ee,vr as _,wr as te,yr as ne}from"./MermaidBlock-C2QkLej8.js";var v=`position frame`,y=`frame positioned`,b=`position relation`,x=`relation positioned`,re=r(function(e){a.debug(`options str`,e)},`setOptions`),ie=r(function(){return{}},`getOptions`),ae=r(function(){S(),p()},`clear`);function S(){C={}}r(S,`reset`);var oe=u.eventmodeling,se=r(()=>i({...oe,...f().eventmodeling}),`getConfig`),C={};function w(){let e=ce,{ast:t}=C,n=D();if(!t)throw Error(`No data for EventModel`);return t.frames.forEach((r,i)=>{let o=P(r,t.dataEntities,n);e=J(e,{$kind:v,index:i,frame:r,textProps:o});let s;V(r)?(a.debug(`source frame`,r.sourceFrames),s=t.frames.filter(e=>r.sourceFrames.some(t=>t.$refText===e.name)),s.forEach(t=>{e=J(e,{$kind:b,index:i,frame:r,sourceFrame:t})})):e=J(e,{$kind:b,index:i,frame:r})}),e={...e,sortedSwimlanesArray:R(e.swimlanes)},e}r(w,`getState`);function T(e){C.ast=e}r(T,`setAst`);var E={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:`bold`,boxTextPadding:10,swimlaneTextFontWeight:`bold`,labelUiAutomation:`UI/Automation`,labelUiAutomationPrefix:`UI/A: `,labelCommandReadModel:`Command/Read Model`,labelCommandReadModelPrefix:`C/RM: `,labelEvents:`Events`,labelEventsPrefix:`Stream: `};function D(){return E}r(D,`getDiagramProps`);var ce={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function O(e){let t=e.split(`.`);if(t.length===2)return t[0]}r(O,`extractNamespace`);function k(e){let t=e.split(`.`);return t.length===2?t[1]:e}r(k,`extractName`);function A(e,t){if(!(!t||t.length===0))return Object.values(e).find(e=>e.namespace===t)}r(A,`findSwimlaneByNamespace`);function j(e,t,n){return Math.max(t,...Object.keys(e).filter(e=>{let r=Number.parseInt(e);return r>t&&r<n}).map(e=>Number.parseInt(e)))+1}r(j,`findNextAvailableIndex`);function M(e,t){let n=O(e.entityIdentifier),r=A(t,n);switch(e.modelEntityType){case`ui`:case`pcr`:case`processor`:return r?{index:r.index,label:r.namespace||E.labelUiAutomation}:n?{index:j(t,0,100),label:E.labelUiAutomationPrefix+n}:{index:0,label:E.labelUiAutomation};case`rmo`:case`readmodel`:case`cmd`:case`command`:return r?{index:r.index,label:r.namespace||E.labelCommandReadModel}:n?{index:j(t,100,200),label:E.labelCommandReadModelPrefix+n}:{index:100,label:E.labelCommandReadModel};default:return r?{index:r.index,label:r.namespace||E.labelEvents}:n?{index:j(t,200,300),label:E.labelEventsPrefix+n}:{index:200,label:E.labelEvents}}}r(M,`calculateSwimlaneProps`);function N(e){let{themeVariables:t}=f();switch(e.modelEntityType){case`ui`:return{fill:t.emUiFill??`white`,stroke:t.emUiStroke??`#dbdada`};case`pcr`:case`processor`:return{fill:t.emProcessorFill??`#edb3f6`,stroke:t.emProcessorStroke??`#b88cbf`};case`rmo`:case`readmodel`:return{fill:t.emReadModelFill??`#d3f1a2`,stroke:t.emReadModelStroke??`#a3b732`};case`cmd`:case`command`:return{fill:t.emCommandFill??`#bcd6fe`,stroke:t.emCommandStroke??`#679ac3`};case`evt`:case`event`:return{fill:t.emEventFill??`#ffb778`,stroke:t.emEventStroke??`#c19a0f`};default:return{fill:`red`,stroke:`black`}}}r(N,`calculateEntityVisualProps`);function P(e,t,n){let r=f(),i=_(k(e.entityIdentifier)??``,r),s,l={fontSize:16,fontWeight:700,fontFamily:`"trebuchet ms", verdana, arial, sans-serif`,joinWith:`<br/>`},u=`<b>${c(i,n.textMaxWidth,l)}</b>`;if(e.dataInlineValue&&(s=e.dataInlineValue,s=s.substring(s.indexOf(`{`)+1),s=s.substring(0,s.lastIndexOf(`}`)-1),s=_(s,r),s=c(s,n.textMaxWidth,l),s=s.replaceAll(` `,`&nbsp;`)),e.dataReference){let i=t.find(t=>t.name===e.dataReference?.$refText);i&&(s=i.dataBlockValue,s=s.substring(s.indexOf(`{
1
+ import{N as e,n as t}from"./mermaid-parser.core-vshe0mzD.js";import{t as n}from"./chunk-JWPE2WC7-zKI5bjIE.js";import{Ir as r,Lt as i,Nr as a,Pt as o,Sr as s,Wt as c,Zn as l,ar as u,br as d,cr as f,er as p,lr as m,or as h,sr as g,ur as ee,vr as _,wr as te,yr as ne}from"./MermaidBlock-CF2HMJlR.js";var v=`position frame`,y=`frame positioned`,b=`position relation`,x=`relation positioned`,re=r(function(e){a.debug(`options str`,e)},`setOptions`),ie=r(function(){return{}},`getOptions`),ae=r(function(){S(),p()},`clear`);function S(){C={}}r(S,`reset`);var oe=u.eventmodeling,se=r(()=>i({...oe,...f().eventmodeling}),`getConfig`),C={};function w(){let e=ce,{ast:t}=C,n=D();if(!t)throw Error(`No data for EventModel`);return t.frames.forEach((r,i)=>{let o=P(r,t.dataEntities,n);e=J(e,{$kind:v,index:i,frame:r,textProps:o});let s;V(r)?(a.debug(`source frame`,r.sourceFrames),s=t.frames.filter(e=>r.sourceFrames.some(t=>t.$refText===e.name)),s.forEach(t=>{e=J(e,{$kind:b,index:i,frame:r,sourceFrame:t})})):e=J(e,{$kind:b,index:i,frame:r})}),e={...e,sortedSwimlanesArray:R(e.swimlanes)},e}r(w,`getState`);function T(e){C.ast=e}r(T,`setAst`);var E={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:`bold`,boxTextPadding:10,swimlaneTextFontWeight:`bold`,labelUiAutomation:`UI/Automation`,labelUiAutomationPrefix:`UI/A: `,labelCommandReadModel:`Command/Read Model`,labelCommandReadModelPrefix:`C/RM: `,labelEvents:`Events`,labelEventsPrefix:`Stream: `};function D(){return E}r(D,`getDiagramProps`);var ce={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function O(e){let t=e.split(`.`);if(t.length===2)return t[0]}r(O,`extractNamespace`);function k(e){let t=e.split(`.`);return t.length===2?t[1]:e}r(k,`extractName`);function A(e,t){if(!(!t||t.length===0))return Object.values(e).find(e=>e.namespace===t)}r(A,`findSwimlaneByNamespace`);function j(e,t,n){return Math.max(t,...Object.keys(e).filter(e=>{let r=Number.parseInt(e);return r>t&&r<n}).map(e=>Number.parseInt(e)))+1}r(j,`findNextAvailableIndex`);function M(e,t){let n=O(e.entityIdentifier),r=A(t,n);switch(e.modelEntityType){case`ui`:case`pcr`:case`processor`:return r?{index:r.index,label:r.namespace||E.labelUiAutomation}:n?{index:j(t,0,100),label:E.labelUiAutomationPrefix+n}:{index:0,label:E.labelUiAutomation};case`rmo`:case`readmodel`:case`cmd`:case`command`:return r?{index:r.index,label:r.namespace||E.labelCommandReadModel}:n?{index:j(t,100,200),label:E.labelCommandReadModelPrefix+n}:{index:100,label:E.labelCommandReadModel};default:return r?{index:r.index,label:r.namespace||E.labelEvents}:n?{index:j(t,200,300),label:E.labelEventsPrefix+n}:{index:200,label:E.labelEvents}}}r(M,`calculateSwimlaneProps`);function N(e){let{themeVariables:t}=f();switch(e.modelEntityType){case`ui`:return{fill:t.emUiFill??`white`,stroke:t.emUiStroke??`#dbdada`};case`pcr`:case`processor`:return{fill:t.emProcessorFill??`#edb3f6`,stroke:t.emProcessorStroke??`#b88cbf`};case`rmo`:case`readmodel`:return{fill:t.emReadModelFill??`#d3f1a2`,stroke:t.emReadModelStroke??`#a3b732`};case`cmd`:case`command`:return{fill:t.emCommandFill??`#bcd6fe`,stroke:t.emCommandStroke??`#679ac3`};case`evt`:case`event`:return{fill:t.emEventFill??`#ffb778`,stroke:t.emEventStroke??`#c19a0f`};default:return{fill:`red`,stroke:`black`}}}r(N,`calculateEntityVisualProps`);function P(e,t,n){let r=f(),i=_(k(e.entityIdentifier)??``,r),s,l={fontSize:16,fontWeight:700,fontFamily:`"trebuchet ms", verdana, arial, sans-serif`,joinWith:`<br/>`},u=`<b>${c(i,n.textMaxWidth,l)}</b>`;if(e.dataInlineValue&&(s=e.dataInlineValue,s=s.substring(s.indexOf(`{`)+1),s=s.substring(0,s.lastIndexOf(`}`)-1),s=_(s,r),s=c(s,n.textMaxWidth,l),s=s.replaceAll(` `,`&nbsp;`)),e.dataReference){let i=t.find(t=>t.name===e.dataReference?.$refText);i&&(s=i.dataBlockValue,s=s.substring(s.indexOf(`{
2
2
  `)+2),s=s.substring(0,s.lastIndexOf(`}`)-1),s=_(s,r),s=c(s,n.textMaxWidth,l),s=s.replaceAll(` `,`&nbsp;`),s+=`<br/>`)}let d=s!==void 0;d&&(u+=`<br/><br/><code style="text-align: left; display: block;max-width:${n.textMaxWidth}px">${s}</code>`);let p={fontSize:l.fontSize,fontWeight:l.fontWeight,fontFamily:l.fontFamily},m=o(u,p),h=d?m.width/3:m.width,g={content:u,width:h,height:m.height};return a.debug(`[${e.name}] ${e.entityIdentifier} text`,g),g}r(P,`calculateTextProps`);function F(e,t){let n=t,r=N(n.frame),i={width:n.textProps.width+2*E.boxTextPadding,height:n.textProps.height+2*E.boxTextPadding};return[{$kind:y,frame:n.frame,index:n.index,visual:r,dimension:i,textProps:n.textProps}]}r(F,`decidePositionFrame`);function I(e,t,n){return t===void 0?E.contentStartX:t.index===e.index&&e.r?e.r+E.boxPadding:n===void 0?E.contentStartX:n.r-E.boxOverlap+E.boxPadding}r(I,`calculateX`);function L(e,t){let n=[...e.map(e=>e.r),t];return Math.max(...n)}r(L,`calculateMaxRight`);function R(e){return Object.values(e).sort((e,t)=>e.index-t.index)}r(R,`sortedSwimlanesArray`);function z(e,t){let n=t,r=M(n.frame,e.swimlanes),i;i=r.index in e.swimlanes?e.swimlanes[r.index]:{index:r.index,label:r.label,r:0,y:r.index*E.swimlaneMinHeight+E.swimlaneGap,height:E.swimlaneMinHeight,maxHeight:E.swimlaneMinHeight};let a=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,o=e.previousSwimlaneNumber===void 0?void 0:e.swimlanes[e.previousSwimlaneNumber],s={width:Math.max(E.boxMinWidth,Math.min(E.boxMaxWidth,n.dimension.width))+2*E.boxPadding,height:Math.max(E.boxMinHeight,Math.min(E.boxMaxHeight,n.dimension.height))+2*E.boxPadding},c=I(i,o,a),l=c+s.width+E.boxPadding,u=L(Object.values(e.swimlanes),l);i.r=c+s.width,i.maxHeight=Math.max(i.maxHeight,s.height),i.height=Math.max(E.swimlaneMinHeight,i.maxHeight)+2*E.swimlanePadding;let d={x:c,y:E.swimlanePadding+i.y,r:l,dimension:s,leftSibling:!1,swimlane:i,visual:n.visual,text:n.textProps.content,frame:n.frame,index:n.index},f={...e,boxes:[...e.boxes,d],swimlanes:{...e.swimlanes,[`${i.index}`]:i},previousSwimlaneNumber:r.index,previousFrame:n.frame,maxR:u},p=R(f.swimlanes);p.length>0&&(p[0].y=0);for(let e=1;e<p.length;e++){let t=p[e],n=p[e-1];t.y=n.y+n.height+E.swimlaneGap}return f}r(z,`evolveFramePositioned`);function B(e,t){return e===0&&t.sourceFrames.length===0}r(B,`isFirstFrame`);function V(e){return e.sourceFrames!==void 0&&e.sourceFrames!==null&&e.sourceFrames.length>0}r(V,`hasSourceFrame`);function H(e,t){if(t!=null)return e.find(e=>e.frame.name===t.name)}r(H,`findBoxByFrame`);function U(e,t,n){if(!(n<0))for(let r=n;r>=0;r--){let n=e[r];if(n.swimlane.index!==t)return n}}r(U,`findBoxByLineIndex`);function W(t,n){let r=n;if(e(r.frame)||B(r.index,r.frame))return[];let i=H(t.boxes,r.frame);if(i===void 0)throw Error(`Target box not found for frame ${r.frame.name}`);let a;return a=r.sourceFrame?H(t.boxes,r.sourceFrame):U(t.boxes,i.swimlane.index,r.index-1),a===void 0?[]:[{$kind:x,frame:r.frame,index:r.index,sourceBox:a,targetBox:i}]}r(W,`decidePositionRelation`);function G(e,t){let n=t,r={visual:{fill:`none`,stroke:`#000`},source:{x:n.sourceBox.x,y:n.sourceBox.y},target:{x:n.targetBox.x,y:n.targetBox.y},sourceBox:n.sourceBox,targetBox:n.targetBox};return{...e,relations:[...e.relations,r]}}r(G,`evolveRelationPositioned`);var le={[v]:F,[b]:W},ue={[y]:z,[x]:G};function K(e,t){let n=le[t.$kind];if(n==null)return[];let r=n(e,t);return a.debug(`decided events`,r),r}r(K,`decide`);function q(e,t){let n=t.reduce((e,t)=>{let n=ue[t.$kind];return n==null?e:n(e,t)},e);return a.debug(`evolve events`,{state:e,newState:n,events:t}),n}r(q,`evolve`);function J(e,t){return q(e,K(e,t))}r(J,`dispatch`);var Y={getConfig:se,setOptions:re,getOptions:ie,clear:ae,setAccTitle:d,getAccTitle:g,getAccDescription:h,setAccDescription:ne,setDiagramTitle:s,getDiagramTitle:ee,setAst:T,getDiagramProps:D,getState:w},de={parse:r(async e=>{let r=await t(`eventmodeling`,e);a.debug(r),Y.setAst(r),n(r,Y)},`parse`)},fe=m()?.eventmodeling;function X(e,t){return n=>{let r=n.swimlane.y+t.swimlanePadding,i=e.append(`g`).attr(`class`,`em-box`);i.append(`rect`).attr(`x`,n.x).attr(`y`,r).attr(`rx`,`3`).attr(`width`,n.dimension.width).attr(`height`,n.dimension.height).attr(`stroke`,n.visual.stroke).attr(`fill`,n.visual.fill),i.append(`foreignObject`).attr(`x`,n.x+t.boxPadding).attr(`y`,r+10).attr(`width`,n.dimension.width-2*t.boxPadding).attr(`height`,n.dimension.height-2*t.boxPadding).append(`xhtml:div`).style(`display`,`table`).style(`height`,`100%`).style(`width`,`100%`).append(`span`).style(`display`,`table-cell`).style(`text-align`,`center`).style(`vertical-align`,`middle`).html(n.text)}}r(X,`renderD3Box`);function Z(e,t){return e>t}r(Z,`dirUpwards`);function Q(e,t,n,r){return i=>{let o=i.sourceBox.swimlane.y+t.swimlanePadding,s=i.targetBox.swimlane.y+t.swimlanePadding,c=Z(o,s),l=i.sourceBox.x+i.sourceBox.dimension.width*2/3,u=i.targetBox.x+i.targetBox.dimension.width/3,d,f;a.debug(`rendering relation up=${c} for `,{sourceBox:i.sourceBox,targetBox:i.targetBox}),c?(d=o,f=s+i.targetBox.dimension.height):(d=o+i.sourceBox.dimension.height,f=s);let p=r.emRelationStroke??i.visual.stroke;e.append(`path`).attr(`class`,`em-relation`).attr(`fill`,i.visual.fill).attr(`stroke`,p).attr(`stroke-width`,`1`).attr(`marker-end`,`url(#${n})`).attr(`d`,`M${l} ${d} L${u} ${f}`)}}r(Q,`renderD3Relation`);function $(e,t,n,r){return i=>{let a=e.append(`g`).attr(`class`,`em-swimlane`),o=r.emSwimlaneBackgroundOdd??`rgb(250,250,250)`,s=r.emSwimlaneBackgroundStroke??`rgb(240,240,240)`;a.append(`rect`).attr(`x`,0).attr(`y`,i.y).attr(`rx`,`3`).attr(`width`,t+n.swimlanePadding).attr(`height`,i.height).attr(`fill`,o).attr(`stroke`,s),a.append(`text`).attr(`font-weight`,n.swimlaneTextFontWeight).attr(`x`,30).attr(`y`,i.y+30).text(i.label)}}r($,`renderD3Swimlane`);var pe={parser:de,db:Y,renderer:{draw:r(function(e,t,n,r){if(a.debug(`in eventmodeling renderer`,e+`
3
3
  `,`id:`,t,n),!fe)throw Error(`EventModeling config not found`);let i=r.db,{themeVariables:o,eventmodeling:s}=m(),c=l(`[id="${t}"]`),u=i.getDiagramProps(),d=i.getState(),f=`em-arrowhead-${t}`,p=o.emArrowhead??`#000000`;d.sortedSwimlanesArray.forEach($(c,d.maxR,u,o)),d.boxes.forEach(X(c,u)),d.relations.forEach(Q(c,u,f,o)),c.append(`defs`).append(`marker`).attr(`id`,f).attr(`markerWidth`,`10`).attr(`markerHeight`,`7`).attr(`refX`,`10`).attr(`refY`,`3.5`).attr(`orient`,`auto`).append(`polygon`).attr(`points`,`0 0, 10 3.5, 0 7`).attr(`fill`,p),te(void 0,c,s?.padding??30,s?.useMaxWidth)},`draw`)},styles:r(e=>``,`getStyles`)};export{pe as diagram};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-CyiGaINC.js";import{t}from"./ordinal-hYBb2elL.js";import{t as n}from"./defaultLocale-C8Fc0cco.js";import{t as r}from"./chunk-JWPE2WC7-DEVN_PSR.js";import{t as i}from"./chunk-POPQ4Y6H-C2i8ZB07.js";import{At as a,Ir as o,Lt as s,Nr as c,Sr as l,Zn as u,ar as d,bn as f,br as p,cr as m,dr as h,er as g,jt as _,or as v,rr as y,sr as b,ur as x,yr as S}from"./MermaidBlock-C2QkLej8.js";function C(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function w(){return this.eachAfter(C)}function T(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function E(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function D(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function O(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function k(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function A(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function j(e){for(var t=this,n=M(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function M(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function N(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function P(){return Array.from(this)}function F(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function I(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*L(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function R(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=V)):t===void 0&&(t=B);for(var n=new W(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new W(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(U)}function z(){return R(this).eachBefore(H)}function B(e){return e.children}function V(e){return Array.isArray(e)?e[1]:null}function H(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function U(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function W(e){this.data=e,this.depth=this.height=0,this.parent=null}W.prototype=R.prototype={constructor:W,count:w,each:T,eachAfter:D,eachBefore:E,find:O,sum:k,sort:A,path:j,ancestors:N,descendants:P,leaves:F,links:I,copy:z,[Symbol.iterator]:L};function G(e){if(typeof e!=`function`)throw Error();return e}function K(){return 0}function q(e){return function(){return e}}function J(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function ee(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function te(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}var ne=(1+Math.sqrt(5))/2;function re(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?ee(c,n,r,i,h?r+=m*g/h:a):te(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var ie=(function e(t){function n(e,n,r,i,a){re(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(ne);function ae(){var e=ie,t=!1,n=1,r=1,i=[0],a=K,o=K,s=K,c=K,l=K;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(J),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),t.x0=r,t.y0=u,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=l(t)-n,u+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),e(t,r,u,d,f))}return u.round=function(e){return arguments.length?(t=!!e,u):t},u.size=function(e){return arguments.length?(n=+e[0],r=+e[1],u):[n,r]},u.tile=function(t){return arguments.length?(e=G(t),u):e},u.padding=function(e){return arguments.length?u.paddingInner(e).paddingOuter(e):u.paddingInner()},u.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:q(+e),u):a},u.paddingOuter=function(e){return arguments.length?u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):u.paddingTop()},u.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:q(+e),u):o},u.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:q(+e),u):s},u.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:q(+e),u):c},u.paddingLeft=function(e){return arguments.length?(l=typeof e==`function`?e:q(+e),u):l},u}var Y=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=p,this.getAccTitle=b,this.setDiagramTitle=l,this.getDiagramTitle=x,this.getAccDescription=v,this.setAccDescription=S}static{o(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let e=d,t=m();return s({...e.treemap,...t.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),t===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:``,children:this.outerNodes}}addClass(e,t){let n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},r=t.replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);r&&r.forEach(e=>{a(e)&&(n?.textStyles?n.textStyles.push(e):n.textStyles=[e]),n?.styles?n.styles.push(e):n.styles=[e]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){g(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function X(e){if(!e.length)return[];let t=[],n=[];return e.forEach(e=>{let r={name:e.name,children:e.type===`Leaf`?void 0:[]};for(r.classSelector=e?.classSelector,e?.cssCompiledStyles&&(r.cssCompiledStyles=e.cssCompiledStyles),e.type===`Leaf`&&e.value!==void 0&&(r.value=e.value);n.length>0&&n[n.length-1].level>=e.level;)n.pop();if(n.length===0)t.push(r);else{let e=n[n.length-1].node;e.children?e.children.push(r):e.children=[r]}e.type!==`Leaf`&&n.push({node:r,level:e.level})}),t}o(X,`buildHierarchy`);var oe=o((e,t)=>{r(e,t);let n=[];for(let n of e.TreemapRows??[])n.$type===`ClassDefStatement`&&t.addClass(n.className??``,n.styleText??``);for(let r of e.TreemapRows??[]){let e=r.item;if(!e)continue;let i=r.indent?parseInt(r.indent):0,a=se(e),o=e.classSelector?t.getStylesForClass(e.classSelector):[],s=o.length>0?o:void 0,c={level:i,name:a,type:e.$type,value:e.value,classSelector:e.classSelector,cssCompiledStyles:s};n.push(c)}let i=X(n),a=o((e,n)=>{for(let r of e)t.addNode(r,n),r.children&&r.children.length>0&&a(r.children,n+1)},`addNodesRecursively`);a(i,0)},`populate`),se=o(e=>e.name?String(e.name):``,`getItemName`),Z={parser:{yy:void 0},parse:o(async t=>{try{let n=await e(`treemap`,t);c.debug(`Treemap AST:`,n);let r=Z.parser?.yy;if(!(r instanceof Y))throw Error(`parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);oe(n,r)}catch(e){throw c.error(`Error parsing treemap:`,e),e}},`parse`)},ce=10,Q=10,$=25,le={draw:o((e,r,a,s)=>{let l=s.db,d=l.getConfig(),p=d.padding??ce,h=l.getDiagramTitle(),g=l.getRoot(),{themeVariables:v}=m();if(!g)return;let b=h?30:0,x=f(r),S=d.nodeWidth?d.nodeWidth*Q:960,C=d.nodeHeight?d.nodeHeight*Q:500,w=S,T=C+b;x.attr(`viewBox`,`0 0 ${w} ${T}`),y(x,T,w,d.useMaxWidth);let E;try{let e=d.valueFormat||`,`;if(e===`$0,0`)E=o(e=>`$`+n(`,`)(e),`valueFormat`);else if(e.startsWith(`$`)&&e.includes(`,`)){let t=/\.\d+/.exec(e),r=t?t[0]:``;E=o(e=>`$`+n(`,`+r)(e),`valueFormat`)}else if(e.startsWith(`$`)){let t=e.substring(1);E=o(e=>`$`+n(t||``)(e),`valueFormat`)}else E=n(e)}catch(e){c.error(`Error creating format function:`,e),E=n(`,`)}let D=t().range([`transparent`,v.cScale0,v.cScale1,v.cScale2,v.cScale3,v.cScale4,v.cScale5,v.cScale6,v.cScale7,v.cScale8,v.cScale9,v.cScale10,v.cScale11]),O=t().range([`transparent`,v.cScalePeer0,v.cScalePeer1,v.cScalePeer2,v.cScalePeer3,v.cScalePeer4,v.cScalePeer5,v.cScalePeer6,v.cScalePeer7,v.cScalePeer8,v.cScalePeer9,v.cScalePeer10,v.cScalePeer11]),k=t().range([v.cScaleLabel0,v.cScaleLabel1,v.cScaleLabel2,v.cScaleLabel3,v.cScaleLabel4,v.cScaleLabel5,v.cScaleLabel6,v.cScaleLabel7,v.cScaleLabel8,v.cScaleLabel9,v.cScaleLabel10,v.cScaleLabel11]);h&&x.append(`text`).attr(`x`,w/2).attr(`y`,b/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(h);let A=x.append(`g`).attr(`transform`,`translate(0, ${b})`).attr(`class`,`treemapContainer`),j=R(g).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=ae().size([S,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(p).paddingLeft(e=>e.children&&e.children.length>0?Q:0).paddingRight(e=>e.children&&e.children.length>0?Q:0).paddingBottom(e=>e.children&&e.children.length>0?Q:0).round(!0)(j),N=M.descendants().filter(e=>e.children&&e.children.length>0),P=A.selectAll(`.treemapSection`).data(N).enter().append(`g`).attr(`class`,`treemapSection`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,$).attr(`class`,`treemapSectionHeader`).attr(`fill`,`none`).attr(`fill-opacity`,.6).attr(`stroke-width`,.6).attr(`style`,e=>e.depth===0?`display: none;`:``),P.append(`clipPath`).attr(`id`,(e,t)=>`clip-section-${r}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-12)).attr(`height`,$),P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,(e,t)=>`treemapSection section${t}`).attr(`fill`,e=>D(e.data.name)).attr(`fill-opacity`,.6).attr(`stroke`,e=>O(e.data.name)).attr(`stroke-width`,2).attr(`stroke-opacity`,.4).attr(`style`,e=>{if(e.depth===0)return`display: none;`;let t=_({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+`;`+t.borderStyles.join(`;`)}),P.append(`text`).attr(`class`,`treemapSectionLabel`).attr(`x`,6).attr(`y`,$/2).attr(`dominant-baseline`,`middle`).text(e=>e.depth===0?``:e.data.name).attr(`font-weight`,`bold`).attr(`clip-path`,(e,t)=>`url(#clip-section-${r}-${t})`).attr(`style`,e=>e.depth===0?`display: none;`:`dominant-baseline: middle; font-size: 12px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+_({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=u(this),n=e.data.name;t.text(n);let r=e.x1-e.x0,i;i=d.showValues!==!1&&e.value?r-10-30-10-6:r-6-6;let a=Math.max(15,i),o=t.node();if(o.getComputedTextLength()>a){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),o.getComputedTextLength()>a&&t.text(``);break}if(t.text(e+`...`),o.getComputedTextLength()<=a)break}}}),d.showValues!==!1&&P.append(`text`).attr(`class`,`treemapSectionValue`).attr(`x`,e=>e.x1-e.x0-10).attr(`y`,$/2).attr(`text-anchor`,`end`).attr(`dominant-baseline`,`middle`).text(e=>e.value?E(e.value):``).attr(`font-style`,`italic`).attr(`style`,e=>e.depth===0?`display: none;`:`text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+_({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`));let F=M.leaves(),I=F.length>20,L=I?16:38,z=I?14:28,B=I?4:8,V=I?4:6,H=I?2:4,U=I?8:10,W=I?1:2,G=A.selectAll(`.treemapLeafGroup`).data(F).enter().append(`g`).attr(`class`,(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:``}x`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);G.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,`treemapLeaf`).attr(`fill`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`style`,e=>_({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr(`fill-opacity`,.3).attr(`stroke`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`stroke-width`,3),G.append(`clipPath`).attr(`id`,(e,t)=>`clip-${r}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-4)).attr(`height`,e=>Math.max(0,e.y1-e.y0-4)),G.append(`text`).attr(`class`,`treemapLabel`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,e=>(e.y1-e.y0)/2).attr(`style`,e=>`text-anchor: middle; dominant-baseline: middle; font-size: ${L}px;fill:`+k(e.data.name)+`;`+_({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${r}-${t})`).text(e=>e.data.name).each(function(e){let t=u(this),n=e.x1-e.x0,r=e.y1-e.y0,i=t.node(),a=n-2*H,o=r-2*H;if(a<U||o<U){t.style(`display`,`none`);return}let s=parseInt(t.style(`font-size`),10),c=.6;for(;i.getComputedTextLength()>a&&s>B;)s--,t.style(`font-size`,`${s}px`);let l=Math.max(V,Math.min(z,Math.round(s*c))),d=s+W+l;for(;d>o&&s>B&&(s--,l=Math.max(V,Math.min(z,Math.round(s*c))),!(l<V&&s===B));)t.style(`font-size`,`${s}px`),d=s+W+l;t.style(`font-size`,`${s}px`),I?(s<B||o<B)&&t.style(`display`,`none`):(i.getComputedTextLength()>a||s<B||o<s)&&t.style(`display`,`none`)}),d.showValues!==!1&&G.append(`text`).attr(`class`,`treemapValue`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,function(e){return(e.y1-e.y0)/2}).attr(`style`,e=>`text-anchor: middle; dominant-baseline: hanging; font-size: ${z}px;fill:`+k(e.data.name)+`;`+_({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${r}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let t=u(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let r=u(n).select(`.treemapLabel`);if(r.empty()||r.style(`display`)===`none`){t.style(`display`,`none`);return}let i=parseFloat(r.style(`font-size`)),a=Math.max(V,Math.min(z,Math.round(i*.6)));t.style(`font-size`,`${a}px`);let o=(e.y1-e.y0)/2+i/2+W;t.attr(`y`,o);let s=e.x1-e.x0,c=e.y1-e.y0-4,l=s-2*H;t.node().getComputedTextLength()>l||o+a>c||a<V?t.style(`display`,`none`):t.style(`display`,null)}),i(x,d.diagramPadding??8,`flowchart`,d?.useMaxWidth||!1)},`draw`),getClasses:o(function(e,t){return t.db.getClasses()},`getClasses`)},ue={sectionStrokeColor:`black`,sectionStrokeWidth:`1`,sectionFillColor:`#efefef`,leafStrokeColor:`black`,leafStrokeWidth:`1`,leafFillColor:`#efefef`,labelFontSize:`12px`,valueFontSize:`10px`,titleFontSize:`14px`},de={parser:Z,get db(){return new Y},renderer:le,styles:o(({treemap:e}={})=>{let t=s(h(),m().themeVariables),n=s(ue,e),r=n.titleColor??t.titleColor,i=n.labelColor??t.textColor,a=n.valueColor??t.textColor;return`
1
+ import{n as e}from"./mermaid-parser.core-vshe0mzD.js";import{t}from"./ordinal-hYBb2elL.js";import{t as n}from"./defaultLocale-C8Fc0cco.js";import{t as r}from"./chunk-JWPE2WC7-zKI5bjIE.js";import{t as i}from"./chunk-POPQ4Y6H-BGNgCFIF.js";import{At as a,Ir as o,Lt as s,Nr as c,Sr as l,Zn as u,ar as d,bn as f,br as p,cr as m,dr as h,er as g,jt as _,or as v,rr as y,sr as b,ur as x,yr as S}from"./MermaidBlock-CF2HMJlR.js";function C(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function w(){return this.eachAfter(C)}function T(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function E(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function D(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function O(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function k(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function A(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function j(e){for(var t=this,n=M(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function M(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function N(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function P(){return Array.from(this)}function F(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function I(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*L(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function R(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=V)):t===void 0&&(t=B);for(var n=new W(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new W(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(U)}function z(){return R(this).eachBefore(H)}function B(e){return e.children}function V(e){return Array.isArray(e)?e[1]:null}function H(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function U(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function W(e){this.data=e,this.depth=this.height=0,this.parent=null}W.prototype=R.prototype={constructor:W,count:w,each:T,eachAfter:D,eachBefore:E,find:O,sum:k,sort:A,path:j,ancestors:N,descendants:P,leaves:F,links:I,copy:z,[Symbol.iterator]:L};function G(e){if(typeof e!=`function`)throw Error();return e}function K(){return 0}function q(e){return function(){return e}}function J(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function ee(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function te(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}var ne=(1+Math.sqrt(5))/2;function re(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?ee(c,n,r,i,h?r+=m*g/h:a):te(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var ie=(function e(t){function n(e,n,r,i,a){re(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(ne);function ae(){var e=ie,t=!1,n=1,r=1,i=[0],a=K,o=K,s=K,c=K,l=K;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(J),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),t.x0=r,t.y0=u,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=l(t)-n,u+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),e(t,r,u,d,f))}return u.round=function(e){return arguments.length?(t=!!e,u):t},u.size=function(e){return arguments.length?(n=+e[0],r=+e[1],u):[n,r]},u.tile=function(t){return arguments.length?(e=G(t),u):e},u.padding=function(e){return arguments.length?u.paddingInner(e).paddingOuter(e):u.paddingInner()},u.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:q(+e),u):a},u.paddingOuter=function(e){return arguments.length?u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):u.paddingTop()},u.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:q(+e),u):o},u.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:q(+e),u):s},u.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:q(+e),u):c},u.paddingLeft=function(e){return arguments.length?(l=typeof e==`function`?e:q(+e),u):l},u}var Y=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=p,this.getAccTitle=b,this.setDiagramTitle=l,this.getDiagramTitle=x,this.getAccDescription=v,this.setAccDescription=S}static{o(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let e=d,t=m();return s({...e.treemap,...t.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),t===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:``,children:this.outerNodes}}addClass(e,t){let n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},r=t.replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);r&&r.forEach(e=>{a(e)&&(n?.textStyles?n.textStyles.push(e):n.textStyles=[e]),n?.styles?n.styles.push(e):n.styles=[e]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){g(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function X(e){if(!e.length)return[];let t=[],n=[];return e.forEach(e=>{let r={name:e.name,children:e.type===`Leaf`?void 0:[]};for(r.classSelector=e?.classSelector,e?.cssCompiledStyles&&(r.cssCompiledStyles=e.cssCompiledStyles),e.type===`Leaf`&&e.value!==void 0&&(r.value=e.value);n.length>0&&n[n.length-1].level>=e.level;)n.pop();if(n.length===0)t.push(r);else{let e=n[n.length-1].node;e.children?e.children.push(r):e.children=[r]}e.type!==`Leaf`&&n.push({node:r,level:e.level})}),t}o(X,`buildHierarchy`);var oe=o((e,t)=>{r(e,t);let n=[];for(let n of e.TreemapRows??[])n.$type===`ClassDefStatement`&&t.addClass(n.className??``,n.styleText??``);for(let r of e.TreemapRows??[]){let e=r.item;if(!e)continue;let i=r.indent?parseInt(r.indent):0,a=se(e),o=e.classSelector?t.getStylesForClass(e.classSelector):[],s=o.length>0?o:void 0,c={level:i,name:a,type:e.$type,value:e.value,classSelector:e.classSelector,cssCompiledStyles:s};n.push(c)}let i=X(n),a=o((e,n)=>{for(let r of e)t.addNode(r,n),r.children&&r.children.length>0&&a(r.children,n+1)},`addNodesRecursively`);a(i,0)},`populate`),se=o(e=>e.name?String(e.name):``,`getItemName`),Z={parser:{yy:void 0},parse:o(async t=>{try{let n=await e(`treemap`,t);c.debug(`Treemap AST:`,n);let r=Z.parser?.yy;if(!(r instanceof Y))throw Error(`parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);oe(n,r)}catch(e){throw c.error(`Error parsing treemap:`,e),e}},`parse`)},ce=10,Q=10,$=25,le={draw:o((e,r,a,s)=>{let l=s.db,d=l.getConfig(),p=d.padding??ce,h=l.getDiagramTitle(),g=l.getRoot(),{themeVariables:v}=m();if(!g)return;let b=h?30:0,x=f(r),S=d.nodeWidth?d.nodeWidth*Q:960,C=d.nodeHeight?d.nodeHeight*Q:500,w=S,T=C+b;x.attr(`viewBox`,`0 0 ${w} ${T}`),y(x,T,w,d.useMaxWidth);let E;try{let e=d.valueFormat||`,`;if(e===`$0,0`)E=o(e=>`$`+n(`,`)(e),`valueFormat`);else if(e.startsWith(`$`)&&e.includes(`,`)){let t=/\.\d+/.exec(e),r=t?t[0]:``;E=o(e=>`$`+n(`,`+r)(e),`valueFormat`)}else if(e.startsWith(`$`)){let t=e.substring(1);E=o(e=>`$`+n(t||``)(e),`valueFormat`)}else E=n(e)}catch(e){c.error(`Error creating format function:`,e),E=n(`,`)}let D=t().range([`transparent`,v.cScale0,v.cScale1,v.cScale2,v.cScale3,v.cScale4,v.cScale5,v.cScale6,v.cScale7,v.cScale8,v.cScale9,v.cScale10,v.cScale11]),O=t().range([`transparent`,v.cScalePeer0,v.cScalePeer1,v.cScalePeer2,v.cScalePeer3,v.cScalePeer4,v.cScalePeer5,v.cScalePeer6,v.cScalePeer7,v.cScalePeer8,v.cScalePeer9,v.cScalePeer10,v.cScalePeer11]),k=t().range([v.cScaleLabel0,v.cScaleLabel1,v.cScaleLabel2,v.cScaleLabel3,v.cScaleLabel4,v.cScaleLabel5,v.cScaleLabel6,v.cScaleLabel7,v.cScaleLabel8,v.cScaleLabel9,v.cScaleLabel10,v.cScaleLabel11]);h&&x.append(`text`).attr(`x`,w/2).attr(`y`,b/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(h);let A=x.append(`g`).attr(`transform`,`translate(0, ${b})`).attr(`class`,`treemapContainer`),j=R(g).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=ae().size([S,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(p).paddingLeft(e=>e.children&&e.children.length>0?Q:0).paddingRight(e=>e.children&&e.children.length>0?Q:0).paddingBottom(e=>e.children&&e.children.length>0?Q:0).round(!0)(j),N=M.descendants().filter(e=>e.children&&e.children.length>0),P=A.selectAll(`.treemapSection`).data(N).enter().append(`g`).attr(`class`,`treemapSection`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,$).attr(`class`,`treemapSectionHeader`).attr(`fill`,`none`).attr(`fill-opacity`,.6).attr(`stroke-width`,.6).attr(`style`,e=>e.depth===0?`display: none;`:``),P.append(`clipPath`).attr(`id`,(e,t)=>`clip-section-${r}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-12)).attr(`height`,$),P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,(e,t)=>`treemapSection section${t}`).attr(`fill`,e=>D(e.data.name)).attr(`fill-opacity`,.6).attr(`stroke`,e=>O(e.data.name)).attr(`stroke-width`,2).attr(`stroke-opacity`,.4).attr(`style`,e=>{if(e.depth===0)return`display: none;`;let t=_({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+`;`+t.borderStyles.join(`;`)}),P.append(`text`).attr(`class`,`treemapSectionLabel`).attr(`x`,6).attr(`y`,$/2).attr(`dominant-baseline`,`middle`).text(e=>e.depth===0?``:e.data.name).attr(`font-weight`,`bold`).attr(`clip-path`,(e,t)=>`url(#clip-section-${r}-${t})`).attr(`style`,e=>e.depth===0?`display: none;`:`dominant-baseline: middle; font-size: 12px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+_({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=u(this),n=e.data.name;t.text(n);let r=e.x1-e.x0,i;i=d.showValues!==!1&&e.value?r-10-30-10-6:r-6-6;let a=Math.max(15,i),o=t.node();if(o.getComputedTextLength()>a){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),o.getComputedTextLength()>a&&t.text(``);break}if(t.text(e+`...`),o.getComputedTextLength()<=a)break}}}),d.showValues!==!1&&P.append(`text`).attr(`class`,`treemapSectionValue`).attr(`x`,e=>e.x1-e.x0-10).attr(`y`,$/2).attr(`text-anchor`,`end`).attr(`dominant-baseline`,`middle`).text(e=>e.value?E(e.value):``).attr(`font-style`,`italic`).attr(`style`,e=>e.depth===0?`display: none;`:`text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+_({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`));let F=M.leaves(),I=F.length>20,L=I?16:38,z=I?14:28,B=I?4:8,V=I?4:6,H=I?2:4,U=I?8:10,W=I?1:2,G=A.selectAll(`.treemapLeafGroup`).data(F).enter().append(`g`).attr(`class`,(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:``}x`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);G.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,`treemapLeaf`).attr(`fill`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`style`,e=>_({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr(`fill-opacity`,.3).attr(`stroke`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`stroke-width`,3),G.append(`clipPath`).attr(`id`,(e,t)=>`clip-${r}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-4)).attr(`height`,e=>Math.max(0,e.y1-e.y0-4)),G.append(`text`).attr(`class`,`treemapLabel`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,e=>(e.y1-e.y0)/2).attr(`style`,e=>`text-anchor: middle; dominant-baseline: middle; font-size: ${L}px;fill:`+k(e.data.name)+`;`+_({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${r}-${t})`).text(e=>e.data.name).each(function(e){let t=u(this),n=e.x1-e.x0,r=e.y1-e.y0,i=t.node(),a=n-2*H,o=r-2*H;if(a<U||o<U){t.style(`display`,`none`);return}let s=parseInt(t.style(`font-size`),10),c=.6;for(;i.getComputedTextLength()>a&&s>B;)s--,t.style(`font-size`,`${s}px`);let l=Math.max(V,Math.min(z,Math.round(s*c))),d=s+W+l;for(;d>o&&s>B&&(s--,l=Math.max(V,Math.min(z,Math.round(s*c))),!(l<V&&s===B));)t.style(`font-size`,`${s}px`),d=s+W+l;t.style(`font-size`,`${s}px`),I?(s<B||o<B)&&t.style(`display`,`none`):(i.getComputedTextLength()>a||s<B||o<s)&&t.style(`display`,`none`)}),d.showValues!==!1&&G.append(`text`).attr(`class`,`treemapValue`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,function(e){return(e.y1-e.y0)/2}).attr(`style`,e=>`text-anchor: middle; dominant-baseline: hanging; font-size: ${z}px;fill:`+k(e.data.name)+`;`+_({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${r}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let t=u(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let r=u(n).select(`.treemapLabel`);if(r.empty()||r.style(`display`)===`none`){t.style(`display`,`none`);return}let i=parseFloat(r.style(`font-size`)),a=Math.max(V,Math.min(z,Math.round(i*.6)));t.style(`font-size`,`${a}px`);let o=(e.y1-e.y0)/2+i/2+W;t.attr(`y`,o);let s=e.x1-e.x0,c=e.y1-e.y0-4,l=s-2*H;t.node().getComputedTextLength()>l||o+a>c||a<V?t.style(`display`,`none`):t.style(`display`,null)}),i(x,d.diagramPadding??8,`flowchart`,d?.useMaxWidth||!1)},`draw`),getClasses:o(function(e,t){return t.db.getClasses()},`getClasses`)},ue={sectionStrokeColor:`black`,sectionStrokeWidth:`1`,sectionFillColor:`#efefef`,leafStrokeColor:`black`,leafStrokeWidth:`1`,leafFillColor:`#efefef`,labelFontSize:`12px`,valueFontSize:`10px`,titleFontSize:`14px`},de={parser:Z,get db(){return new Y},renderer:le,styles:o(({treemap:e}={})=>{let t=s(h(),m().themeVariables),n=s(ue,e),r=n.titleColor??t.titleColor,i=n.labelColor??t.textColor,a=n.valueColor??t.textColor;return`
2
2
  .treemapNode.section {
3
3
  stroke: ${n.sectionStrokeColor};
4
4
  stroke-width: ${n.sectionStrokeWidth};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-CyiGaINC.js";import{t}from"./chunk-JWPE2WC7-DEVN_PSR.js";import{Ir as n,Lt as r,Nr as i,Sr as a,ar as o,bn as s,br as c,cr as l,er as u,or as d,rr as f,sr as p,ur as m,yr as h}from"./MermaidBlock-C2QkLej8.js";var g=o.packet,_=class{constructor(){this.packet=[],this.setAccTitle=c,this.getAccTitle=p,this.setDiagramTitle=a,this.getDiagramTitle=m,this.getAccDescription=d,this.setAccDescription=h}static{n(this,`PacketDB`)}getConfig(){let e=r({...g,...l().packet});return e.showBits&&(e.paddingY+=10),e}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){u(),this.packet=[]}},v=1e4,y=n((e,n)=>{t(e,n);let r=-1,a=[],o=1,{bitsPerRow:s}=n.getConfig();for(let{start:t,end:c,bits:l,label:u}of e.blocks){if(t!==void 0&&c!==void 0&&c<t)throw Error(`Packet block ${t} - ${c} is invalid. End must be greater than start.`);if(t??=r+1,t!==r+1)throw Error(`Packet block ${t} - ${c??t} is not contiguous. It should start from ${r+1}.`);if(l===0)throw Error(`Packet block ${t} is invalid. Cannot have a zero bit field.`);for(c??=t+(l??1)-1,l??=c-t+1,r=c,i.debug(`Packet block ${t} - ${r} with label ${u}`);a.length<=s+1&&n.getPacket().length<v;){let[e,r]=b({start:t,end:c,bits:l,label:u},o,s);if(a.push(e),e.end+1===o*s&&(n.pushWord(a),a=[],o++),!r)break;({start:t,end:c,bits:l,label:u}=r)}}n.pushWord(a)},`populate`),b=n((e,t,n)=>{if(e.start===void 0)throw Error(`start should have been set during first phase`);if(e.end===void 0)throw Error(`end should have been set during first phase`);if(e.start>e.end)throw Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*n)return[e,void 0];let r=t*n-1,i=t*n;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:i,end:e.end,label:e.label,bits:e.end-i}]},`getNextFittingBlock`),x={parser:{yy:void 0},parse:n(async t=>{let n=await e(`packet`,t),r=x.parser?.yy;if(!(r instanceof _))throw Error(`parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);i.debug(n),y(n,r)},`parse`)},S=n((e,t,n,r)=>{let i=r.db,a=i.getConfig(),{rowHeight:o,paddingY:c,bitWidth:l,bitsPerRow:u}=a,d=i.getPacket(),p=i.getDiagramTitle(),m=o+c,h=m*(d.length+1)-(p?0:o),g=l*u+2,_=s(t);_.attr(`viewBox`,`0 0 ${g} ${h}`),f(_,h,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(p).attr(`x`,g/2).attr(`y`,h-m/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=n((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c})=>{let l=e.append(`g`),u=n*(r+a)+a;for(let e of t){let t=e.start%s*o+1,n=(e.end-e.start+1)*o-i;if(l.append(`rect`).attr(`x`,t).attr(`y`,u).attr(`width`,n).attr(`height`,r).attr(`class`,`packetBlock`),l.append(`text`).attr(`x`,t+n/2).attr(`y`,u+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let a=e.end===e.start,d=u-2;l.append(`text`).attr(`x`,t+(a?n/2:0)).attr(`y`,d).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,a?`middle`:`start`).text(e.start),a||l.append(`text`).attr(`x`,t+n).attr(`y`,d).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(e.end)}},`drawWord`),w={draw:S},T={byteFontSize:`10px`,startByteColor:`black`,endByteColor:`black`,labelColor:`black`,labelFontSize:`12px`,titleColor:`black`,titleFontSize:`14px`,blockStrokeColor:`black`,blockStrokeWidth:`1`,blockFillColor:`#efefef`},E={parser:x,get db(){return new _},renderer:w,styles:n(({packet:e}={})=>{let t=r(T,e);return`
1
+ import{n as e}from"./mermaid-parser.core-vshe0mzD.js";import{t}from"./chunk-JWPE2WC7-zKI5bjIE.js";import{Ir as n,Lt as r,Nr as i,Sr as a,ar as o,bn as s,br as c,cr as l,er as u,or as d,rr as f,sr as p,ur as m,yr as h}from"./MermaidBlock-CF2HMJlR.js";var g=o.packet,_=class{constructor(){this.packet=[],this.setAccTitle=c,this.getAccTitle=p,this.setDiagramTitle=a,this.getDiagramTitle=m,this.getAccDescription=d,this.setAccDescription=h}static{n(this,`PacketDB`)}getConfig(){let e=r({...g,...l().packet});return e.showBits&&(e.paddingY+=10),e}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){u(),this.packet=[]}},v=1e4,y=n((e,n)=>{t(e,n);let r=-1,a=[],o=1,{bitsPerRow:s}=n.getConfig();for(let{start:t,end:c,bits:l,label:u}of e.blocks){if(t!==void 0&&c!==void 0&&c<t)throw Error(`Packet block ${t} - ${c} is invalid. End must be greater than start.`);if(t??=r+1,t!==r+1)throw Error(`Packet block ${t} - ${c??t} is not contiguous. It should start from ${r+1}.`);if(l===0)throw Error(`Packet block ${t} is invalid. Cannot have a zero bit field.`);for(c??=t+(l??1)-1,l??=c-t+1,r=c,i.debug(`Packet block ${t} - ${r} with label ${u}`);a.length<=s+1&&n.getPacket().length<v;){let[e,r]=b({start:t,end:c,bits:l,label:u},o,s);if(a.push(e),e.end+1===o*s&&(n.pushWord(a),a=[],o++),!r)break;({start:t,end:c,bits:l,label:u}=r)}}n.pushWord(a)},`populate`),b=n((e,t,n)=>{if(e.start===void 0)throw Error(`start should have been set during first phase`);if(e.end===void 0)throw Error(`end should have been set during first phase`);if(e.start>e.end)throw Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*n)return[e,void 0];let r=t*n-1,i=t*n;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:i,end:e.end,label:e.label,bits:e.end-i}]},`getNextFittingBlock`),x={parser:{yy:void 0},parse:n(async t=>{let n=await e(`packet`,t),r=x.parser?.yy;if(!(r instanceof _))throw Error(`parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);i.debug(n),y(n,r)},`parse`)},S=n((e,t,n,r)=>{let i=r.db,a=i.getConfig(),{rowHeight:o,paddingY:c,bitWidth:l,bitsPerRow:u}=a,d=i.getPacket(),p=i.getDiagramTitle(),m=o+c,h=m*(d.length+1)-(p?0:o),g=l*u+2,_=s(t);_.attr(`viewBox`,`0 0 ${g} ${h}`),f(_,h,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(p).attr(`x`,g/2).attr(`y`,h-m/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=n((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c})=>{let l=e.append(`g`),u=n*(r+a)+a;for(let e of t){let t=e.start%s*o+1,n=(e.end-e.start+1)*o-i;if(l.append(`rect`).attr(`x`,t).attr(`y`,u).attr(`width`,n).attr(`height`,r).attr(`class`,`packetBlock`),l.append(`text`).attr(`x`,t+n/2).attr(`y`,u+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let a=e.end===e.start,d=u-2;l.append(`text`).attr(`x`,t+(a?n/2:0)).attr(`y`,d).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,a?`middle`:`start`).text(e.start),a||l.append(`text`).attr(`x`,t+n).attr(`y`,d).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(e.end)}},`drawWord`),w={draw:S},T={byteFontSize:`10px`,startByteColor:`black`,endByteColor:`black`,labelColor:`black`,labelFontSize:`12px`,titleColor:`black`,titleFontSize:`14px`,blockStrokeColor:`black`,blockStrokeWidth:`1`,blockFillColor:`#efefef`},E={parser:x,get db(){return new _},renderer:w,styles:n(({packet:e}={})=>{let t=r(T,e);return`
2
2
  .packetByte {
3
3
  font-size: ${t.byteFontSize};
4
4
  }
@@ -1 +1 @@
1
- import{A as e,F as t,M as n,O as r,P as i,j as a,k as o}from"./index-CK5of5EC.js";var s=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new c(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from;n<r.minRepeatTerm&&s==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new l(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216))if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new c(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},c=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},l=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},u=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function d(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var f=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},p=new f,m=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=p,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=p,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},h=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;v(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};h.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var g=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?d(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(v(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};g.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var _=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function v(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||b(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function y(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function b(e,t,n,r){let i=y(n,r,t);return i<0||y(n,r,e)<i}var x=typeof process<`u`&&/\bparse\b/.test({}.LOG),S=null;function C(e,t,n){let r=e.cursor(o.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var w=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?C(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?C(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(n){if(n<this.nextStart)return null;for(;this.fragment&&this.safeTo<=n;)this.nextFragment();if(!this.fragment)return null;for(;;){let r=this.trees.length-1;if(r<0)return this.nextFragment(),null;let i=this.trees[r],a=this.index[r];if(a==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=i.children[a],s=this.start[r]+i.positions[a];if(s>n)return this.nextStart=s,null;if(o instanceof t){if(s==n){if(s<this.safeFrom)return null;let t=s+o.length;if(t<=this.safeTo){let n=o.prop(e.lookAhead);if(!n||t+n<this.fragment.to)return o}}this.index[r]++,s+o.length>=Math.max(this.safeFrom,n)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[r]++,this.nextStart=s+o.length}}},T=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new f)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if(!(n&&!c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new f,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new f,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535)if(o[s+1]==1)s=M(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(M(o,s+2),t,n,r));break}o[s]==t&&(r=this.putAction(M(o,s+1),t,n,r))}return r}},E=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new m(t,r),this.tokens=new T(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[s.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new w(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&N(r);if(e)return x&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw x&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return x&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500)if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}advanceStack(n,r,i){let a=n.pos,{parser:o}=this,s=x?this.stackID(n)+` -> `:``;if(this.stoppedAt!=null&&a>this.stoppedAt)return n.forceReduce()?n:null;if(this.fragments){let r=n.curContext&&n.curContext.tracker.strict,i=r?n.curContext.hash:0;for(let c=this.fragments.nodeAt(a);c;){let a=this.parser.nodeSet.types[c.type.id]==c.type?o.getGoto(n.state,c.type.id):-1;if(a>-1&&c.length&&(!r||(c.prop(e.contextHash)||0)==i))return n.useNode(c,a),x&&console.log(s+this.stackID(n)+` (via reuse of ${o.getName(c.type.id)})`),!0;if(!(c instanceof t)||c.children.length==0||c.positions[0]>0)break;let l=c.children[0];if(l instanceof t&&c.positions[0]==0)c=l;else break}}let c=o.stateSlot(n.state,4);if(c>0)return n.reduce(c),x&&console.log(s+this.stackID(n)+` (via always-reduce ${o.getName(c&65535)})`),!0;if(n.stack.length>=8400)for(;n.stack.length>6e3&&n.forceReduce(););let l=this.tokens.getActions(n);for(let e=0;e<l.length;){let t=l[e++],c=l[e++],u=l[e++],d=e==l.length||!i,f=d?n:n.split(),p=this.tokens.mainToken;if(f.apply(t,c,p?p.start:f.pos,u),x&&console.log(s+this.stackID(f)+` (via ${t&65536?`reduce of ${o.getName(t&65535)}`:`shift`} for ${o.getName(c)} @ ${a}${f==n?``:`, split`})`),d)return!0;f.pos>a?r.push(f):i.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return D(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=x?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),x&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(x&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)x&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))x&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),x&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),D(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),t.build({buffer:u.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(S||=new WeakMap).get(e);return t||S.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function D(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var O=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},k=e=>e,A=class{constructor(e){this.start=e.start,this.shift=e.shift||k,this.reduce=e.reduce||k,this.reuse=e.reuse||k,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},j=class t extends i{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let i=t.nodeNames.split(` `);this.minRepeatTerm=i.length;for(let e=0;e<t.repeatNodeCount;e++)i.push(``);let o=Object.keys(t.topRules).map(e=>t.topRules[e][1]),s=[];for(let e=0;e<i.length;e++)s.push([]);function c(e,t,n){s[e].push([t,t.deserialize(String(n))])}if(t.nodeProps)for(let n of t.nodeProps){let t=n[0];typeof t==`string`&&(t=e[t]);for(let e=1;e<n.length;){let r=n[e++];if(r>=0)c(r,t,n[e++]);else{let i=n[e+-r];for(let a=-r;a>0;a--)c(n[e++],t,i);e++}}}this.nodeSet=new a(i.map((e,r)=>n.define({name:r>=this.minRepeatTerm?void 0:e,id:r,props:s[r],top:o.indexOf(r)>-1,error:r==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(r)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=r;let l=d(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(P),this.states=d(t.states,Uint32Array),this.data=d(t.stateData),this.goto=d(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(e=>typeof e==`number`?new h(l,e):e),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new E(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535)if(n[i+1]==1)a=n[i=M(n,i+2)];else if(n[i+1]==2)return M(n,i+2);else break;if(a==t||a==0)return M(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=M(this.data,n+2);else break;r=t(M(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=M(this.data,n+2);else break;if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let n=Object.assign(Object.create(t.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let t=this.topRules[e.top];if(!t)throw RangeError(`Invalid top rule name ${e.top}`);n.top=t}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((t,r)=>{let i=e.specializers.find(e=>e.from==t.external);if(!i)return t;let a=Object.assign(Object.assign({},t),{external:i.to});return n.specializers[r]=P(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new O(e,n,r)}static deserialize(e){return new t(e)}};function M(e,t){return e[t]|e[t+1]<<16}function N(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function P(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}export{g as i,_ as n,j as r,A as t};
1
+ import{A as e,F as t,M as n,O as r,P as i,j as a,k as o}from"./index-DybHfQCT.js";var s=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new c(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from;n<r.minRepeatTerm&&s==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new l(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216))if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new c(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},c=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},l=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},u=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function d(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var f=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},p=new f,m=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=p,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=p,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},h=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;v(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};h.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var g=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?d(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(v(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};g.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var _=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function v(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||b(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function y(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function b(e,t,n,r){let i=y(n,r,t);return i<0||y(n,r,e)<i}var x=typeof process<`u`&&/\bparse\b/.test({}.LOG),S=null;function C(e,t,n){let r=e.cursor(o.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var w=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?C(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?C(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(n){if(n<this.nextStart)return null;for(;this.fragment&&this.safeTo<=n;)this.nextFragment();if(!this.fragment)return null;for(;;){let r=this.trees.length-1;if(r<0)return this.nextFragment(),null;let i=this.trees[r],a=this.index[r];if(a==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=i.children[a],s=this.start[r]+i.positions[a];if(s>n)return this.nextStart=s,null;if(o instanceof t){if(s==n){if(s<this.safeFrom)return null;let t=s+o.length;if(t<=this.safeTo){let n=o.prop(e.lookAhead);if(!n||t+n<this.fragment.to)return o}}this.index[r]++,s+o.length>=Math.max(this.safeFrom,n)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[r]++,this.nextStart=s+o.length}}},T=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new f)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if(!(n&&!c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new f,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new f,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535)if(o[s+1]==1)s=M(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(M(o,s+2),t,n,r));break}o[s]==t&&(r=this.putAction(M(o,s+1),t,n,r))}return r}},E=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new m(t,r),this.tokens=new T(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[s.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new w(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&N(r);if(e)return x&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw x&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return x&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500)if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}advanceStack(n,r,i){let a=n.pos,{parser:o}=this,s=x?this.stackID(n)+` -> `:``;if(this.stoppedAt!=null&&a>this.stoppedAt)return n.forceReduce()?n:null;if(this.fragments){let r=n.curContext&&n.curContext.tracker.strict,i=r?n.curContext.hash:0;for(let c=this.fragments.nodeAt(a);c;){let a=this.parser.nodeSet.types[c.type.id]==c.type?o.getGoto(n.state,c.type.id):-1;if(a>-1&&c.length&&(!r||(c.prop(e.contextHash)||0)==i))return n.useNode(c,a),x&&console.log(s+this.stackID(n)+` (via reuse of ${o.getName(c.type.id)})`),!0;if(!(c instanceof t)||c.children.length==0||c.positions[0]>0)break;let l=c.children[0];if(l instanceof t&&c.positions[0]==0)c=l;else break}}let c=o.stateSlot(n.state,4);if(c>0)return n.reduce(c),x&&console.log(s+this.stackID(n)+` (via always-reduce ${o.getName(c&65535)})`),!0;if(n.stack.length>=8400)for(;n.stack.length>6e3&&n.forceReduce(););let l=this.tokens.getActions(n);for(let e=0;e<l.length;){let t=l[e++],c=l[e++],u=l[e++],d=e==l.length||!i,f=d?n:n.split(),p=this.tokens.mainToken;if(f.apply(t,c,p?p.start:f.pos,u),x&&console.log(s+this.stackID(f)+` (via ${t&65536?`reduce of ${o.getName(t&65535)}`:`shift`} for ${o.getName(c)} @ ${a}${f==n?``:`, split`})`),d)return!0;f.pos>a?r.push(f):i.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return D(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=x?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),x&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(x&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)x&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))x&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),x&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),D(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),t.build({buffer:u.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(S||=new WeakMap).get(e);return t||S.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function D(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var O=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},k=e=>e,A=class{constructor(e){this.start=e.start,this.shift=e.shift||k,this.reduce=e.reduce||k,this.reuse=e.reuse||k,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},j=class t extends i{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let i=t.nodeNames.split(` `);this.minRepeatTerm=i.length;for(let e=0;e<t.repeatNodeCount;e++)i.push(``);let o=Object.keys(t.topRules).map(e=>t.topRules[e][1]),s=[];for(let e=0;e<i.length;e++)s.push([]);function c(e,t,n){s[e].push([t,t.deserialize(String(n))])}if(t.nodeProps)for(let n of t.nodeProps){let t=n[0];typeof t==`string`&&(t=e[t]);for(let e=1;e<n.length;){let r=n[e++];if(r>=0)c(r,t,n[e++]);else{let i=n[e+-r];for(let a=-r;a>0;a--)c(n[e++],t,i);e++}}}this.nodeSet=new a(i.map((e,r)=>n.define({name:r>=this.minRepeatTerm?void 0:e,id:r,props:s[r],top:o.indexOf(r)>-1,error:r==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(r)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=r;let l=d(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(P),this.states=d(t.states,Uint32Array),this.data=d(t.stateData),this.goto=d(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(e=>typeof e==`number`?new h(l,e):e),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new E(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535)if(n[i+1]==1)a=n[i=M(n,i+2)];else if(n[i+1]==2)return M(n,i+2);else break;if(a==t||a==0)return M(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=M(this.data,n+2);else break;r=t(M(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=M(this.data,n+2);else break;if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let n=Object.assign(Object.create(t.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let t=this.topRules[e.top];if(!t)throw RangeError(`Invalid top rule name ${e.top}`);n.top=t}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((t,r)=>{let i=e.specializers.find(e=>e.from==t.external);if(!i)return t;let a=Object.assign(Object.assign({},t),{external:i.to});return n.specializers[r]=P(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new O(e,n,r)}static deserialize(e){return new t(e)}};function M(e,t){return e[t]|e[t+1]<<16}function N(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function P(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}export{g as i,_ as n,j as r,A as t};