@rafiqui987/markode 0.2.7 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +239 -108
  2. package/dist/cli.js +1289 -639
  3. package/dist/web/assets/{abnfDiagram-WEYOIA3C-DpbJC7Xp.js → abnfDiagram-WEYOIA3C-uyv195L6.js} +1 -1
  4. package/dist/web/assets/{arc-DC4i8MWg.js → arc-CnHtXLAe.js} +1 -1
  5. package/dist/web/assets/{architecture-WOLXFQ4H-eBViYpWx.js → architecture-WOLXFQ4H-tPJ2P-p7.js} +1 -1
  6. package/dist/web/assets/{architectureDiagram-ZHVYKT53-BUdoz7It.js → architectureDiagram-ZHVYKT53-C-WCNTHv.js} +1 -1
  7. package/dist/web/assets/{blockDiagram-RJAE7QA3-g9DAd_oM.js → blockDiagram-RJAE7QA3-DRgAHQJ9.js} +1 -1
  8. package/dist/web/assets/{c4Diagram-XDPPPE54-DRNtmahu.js → c4Diagram-XDPPPE54-DBBsZpdC.js} +1 -1
  9. package/dist/web/assets/channel-COq7V7WB.js +1 -0
  10. package/dist/web/assets/{chunk-2E7WHVMD-pLVU_fk3.js → chunk-2E7WHVMD-CQSFul1o.js} +1 -1
  11. package/dist/web/assets/{chunk-4EMNKR2T-CILPvkQp.js → chunk-4EMNKR2T-DHeQ05G5.js} +1 -1
  12. package/dist/web/assets/{chunk-55XCU76K-D3MGCCrv.js → chunk-55XCU76K-C9qNkR8H.js} +1 -1
  13. package/dist/web/assets/{chunk-7S6XSTFO-CN1GsbIT.js → chunk-7S6XSTFO-C_2BTQ4f.js} +1 -1
  14. package/dist/web/assets/{chunk-AQDTSKZB-CUWKsFsd.js → chunk-AQDTSKZB-DZLt6T8h.js} +1 -1
  15. package/dist/web/assets/{chunk-DSNLSHJZ-CwfiRg01.js → chunk-DSNLSHJZ-6EnWiUHw.js} +1 -1
  16. package/dist/web/assets/{chunk-HAGFOTED-Do-8YoBu.js → chunk-HAGFOTED-C4TrjvWC.js} +1 -1
  17. package/dist/web/assets/{chunk-HNE4Q36P-1-JjBgqP.js → chunk-HNE4Q36P-Bhz3xzgF.js} +1 -1
  18. package/dist/web/assets/{chunk-NQOKRVIF-BEHeLMtz.js → chunk-NQOKRVIF-fn9o0p_a.js} +1 -1
  19. package/dist/web/assets/{chunk-UHW7PFBP-CC1DKtp5.js → chunk-UHW7PFBP-y_Cnbpso.js} +1 -1
  20. package/dist/web/assets/{chunk-VQ5W62QI-CWY0eXsE.js → chunk-VQ5W62QI-BDGHstYR.js} +1 -1
  21. package/dist/web/assets/{chunk-WQQL4CDK-BJl_ufDd.js → chunk-WQQL4CDK-DVgns4LS.js} +1 -1
  22. package/dist/web/assets/{chunk-XXDRQBXY-DKVbKHOf.js → chunk-XXDRQBXY-z-xFeaXQ.js} +1 -1
  23. package/dist/web/assets/{chunk-YZO67HFG-dhkHuKWt.js → chunk-YZO67HFG-O3X4dDhT.js} +1 -1
  24. package/dist/web/assets/{chunk-ZAUX2LTX-CA6m357j.js → chunk-ZAUX2LTX-dMpe16to.js} +1 -1
  25. package/dist/web/assets/{chunk-ZCHMQSOR-DUBbqrP7.js → chunk-ZCHMQSOR-DmywVAUg.js} +1 -1
  26. package/dist/web/assets/{classDiagram-v2-4MYWR3UA-PXy4ulRK.js → classDiagram-v2-4MYWR3UA-DNFxIeoH.js} +1 -1
  27. package/dist/web/assets/{cose-bilkent-JH36ORCC-BDYEjy3u.js → cose-bilkent-JH36ORCC-C78U5xAn.js} +1 -1
  28. package/dist/web/assets/{cynefin-EF2NZ3EQ-BOMUQs4F.js → cynefin-EF2NZ3EQ-53hzJKH9.js} +1 -1
  29. package/dist/web/assets/{cynefinDiagram-WF24UDRP-cX0NpQ7L.js → cynefinDiagram-WF24UDRP-D7qakSAO.js} +1 -1
  30. package/dist/web/assets/{dagre-NK4GIZVX-BAP6Gj-L.js → dagre-NK4GIZVX-JnnDdmH0.js} +1 -1
  31. package/dist/web/assets/{diagram-CBK3MWTC-B5AONjPA.js → diagram-CBK3MWTC-C9dCT7nt.js} +1 -1
  32. package/dist/web/assets/{diagram-I5XIIV2D-BkwhoH5d.js → diagram-I5XIIV2D-BODrA_Tz.js} +1 -1
  33. package/dist/web/assets/{diagram-ODIL2UCW-DUFps_5l.js → diagram-ODIL2UCW-ByZtzdTi.js} +1 -1
  34. package/dist/web/assets/{diagram-PFBEJUXE-Dj94WcA4.js → diagram-PFBEJUXE-Dc3cgafk.js} +1 -1
  35. package/dist/web/assets/{diagram-RJA3I4VV-BRhr049b.js → diagram-RJA3I4VV-BnTNuzvk.js} +1 -1
  36. package/dist/web/assets/{diagram-TYUNFSNR-C9EtKuKD.js → diagram-TYUNFSNR-fbw92djE.js} +1 -1
  37. package/dist/web/assets/{dist-DTXSqpYP.js → dist-8bzcdWlP.js} +1 -1
  38. package/dist/web/assets/{dist-DMEslBFn.js → dist-BPKiY16E.js} +1 -1
  39. package/dist/web/assets/{dist-6_cnylgs.js → dist-BeUBXLX5.js} +1 -1
  40. package/dist/web/assets/{dist-SlIdOLRu.js → dist-BfedOYsq.js} +1 -1
  41. package/dist/web/assets/{dist-uYDRxuA0.js → dist-BruzXrfs.js} +1 -1
  42. package/dist/web/assets/{dist-CXAToOJL.js → dist-BwF8pAVO.js} +1 -1
  43. package/dist/web/assets/{dist-DfKlgEia.js → dist-CAttduN3.js} +1 -1
  44. package/dist/web/assets/{dist-CRKS1wXG.js → dist-CC7LN-Hh.js} +1 -1
  45. package/dist/web/assets/{dist-B-4tAY5T.js → dist-CFUj2tCy.js} +2 -2
  46. package/dist/web/assets/{dist-C6oRdq_x.js → dist-CM1-Tp30.js} +1 -1
  47. package/dist/web/assets/{dist-B91b1nu8.js → dist-CfeLR_Q4.js} +1 -1
  48. package/dist/web/assets/{dist-BhvCwF6v.js → dist-CrUcXP5H.js} +1 -1
  49. package/dist/web/assets/{dist-D5_2d6Ki.js → dist-CubY9gnU.js} +1 -1
  50. package/dist/web/assets/{dist-CxtEXJtW.js → dist-D0R-qVeY.js} +1 -1
  51. package/dist/web/assets/{dist-CUajnf5G.js → dist-D5EOvBuF.js} +1 -1
  52. package/dist/web/assets/{dist-C7gsSbg8.js → dist-DcGC8X1E.js} +1 -1
  53. package/dist/web/assets/{dist-CMFTG-Cz.js → dist-EljmWMub.js} +1 -1
  54. package/dist/web/assets/{dist-hiB1k3yb.js → dist-ga2OvaLo.js} +1 -1
  55. package/dist/web/assets/{dist-BOIkyUDE.js → dist-tv7yScoP.js} +1 -1
  56. package/dist/web/assets/{ebnfDiagram-V4P3TTPT-hUPVHW_L.js → ebnfDiagram-V4P3TTPT-DPsfv1uf.js} +1 -1
  57. package/dist/web/assets/{elk-QONTBCTQ-CK3_-qCI.js → elk-QONTBCTQ-DoINDZCB.js} +1 -1
  58. package/dist/web/assets/{erDiagram-KYQIGQAA-BnzshuRd.js → erDiagram-KYQIGQAA-ChPWyTRi.js} +1 -1
  59. package/dist/web/assets/{eventmodeling-K75KTNOO-YpRkYpNJ.js → eventmodeling-K75KTNOO-B1BhcpV6.js} +1 -1
  60. package/dist/web/assets/flowDiagram-IUGLLWBU-DZzMwlmj.js +1 -0
  61. package/dist/web/assets/{ganttDiagram-R7GPNTJY-Cof-TrXj.js → ganttDiagram-R7GPNTJY-BpChuBNI.js} +1 -1
  62. package/dist/web/assets/{gitGraph-VSP46ZUC-ClyrQrUV.js → gitGraph-VSP46ZUC-BhIFPres.js} +1 -1
  63. package/dist/web/assets/{gitGraphDiagram-PDYL7XHY-DcHBmgeW.js → gitGraphDiagram-PDYL7XHY-CHejLr2o.js} +1 -1
  64. package/dist/web/assets/index-CQGURl2V.css +1 -0
  65. package/dist/web/assets/index-CafleYLD.js +132 -0
  66. package/dist/web/assets/{info-OHQRW6UA-DJuVnR49.js → info-OHQRW6UA-p_XOG9kY.js} +1 -1
  67. package/dist/web/assets/{infoDiagram-MVDRKAX5-SPivATVi.js → infoDiagram-MVDRKAX5-BjEI8OE0.js} +1 -1
  68. package/dist/web/assets/{ishikawaDiagram-HPEHV2GE-luEQCi0p.js → ishikawaDiagram-HPEHV2GE-B_7LEH0q.js} +1 -1
  69. package/dist/web/assets/{journeyDiagram-BOSHW7O7-CDWNQ0FV.js → journeyDiagram-BOSHW7O7-DprR7PC1.js} +1 -1
  70. package/dist/web/assets/{kanban-definition-FNSA4HC5-kCg2Ntni.js → kanban-definition-FNSA4HC5-Dgn1OKTQ.js} +1 -1
  71. package/dist/web/assets/{line-Cs-2UOsh.js → line-CsP7ezWR.js} +1 -1
  72. package/dist/web/assets/{linear-Dn78ogyi.js → linear-DutM4-eX.js} +1 -1
  73. package/dist/web/assets/{mermaid-parser.core-XUq3kRg7.js → mermaid-parser.core-CRHYFOhU.js} +3 -3
  74. package/dist/web/assets/{mermaid.core-KP0iScKW.js → mermaid.core-C-ITLWC9.js} +4 -4
  75. package/dist/web/assets/{mindmap-definition-6OY57UG3-DYfhBOEV.js → mindmap-definition-6OY57UG3-B3gANyDJ.js} +1 -1
  76. package/dist/web/assets/{packet-JDAUHWVQ-m_mxaPh2.js → packet-JDAUHWVQ-0H1cA20q.js} +1 -1
  77. package/dist/web/assets/{pegDiagram-ECIUJNBX-C57XlI0z.js → pegDiagram-ECIUJNBX-BUxriBaM.js} +1 -1
  78. package/dist/web/assets/{pie-XZMESJXO-COU-cPpy.js → pie-XZMESJXO-CSOHv2zM.js} +1 -1
  79. package/dist/web/assets/{pieDiagram-GNMPY74T-Cgv_MwBq.js → pieDiagram-GNMPY74T-B7B_ijMh.js} +1 -1
  80. package/dist/web/assets/{quadrantDiagram-D57K4MC3-DLP-IJBg.js → quadrantDiagram-D57K4MC3-CuDX_hzm.js} +1 -1
  81. package/dist/web/assets/{radar-ABXABTNO-DVnhW8Tu.js → radar-ABXABTNO-Bhdhmyn3.js} +1 -1
  82. package/dist/web/assets/{railroad-I3PHUGI6-CbNbR4f3.js → railroad-I3PHUGI6-D8J0asfg.js} +1 -1
  83. package/dist/web/assets/{railroad-abnf-LNEFI6M7-QapD3MRY.js → railroad-abnf-LNEFI6M7-DSkwXAS5.js} +1 -1
  84. package/dist/web/assets/{railroad-ebnf-DWYD2UWJ-CSlvjrRs.js → railroad-ebnf-DWYD2UWJ-CUA5ZluT.js} +1 -1
  85. package/dist/web/assets/{railroad-peg-JR7BVNR7-CabNa_kN.js → railroad-peg-JR7BVNR7-DOmtcJJ_.js} +1 -1
  86. package/dist/web/assets/{railroadDiagram-Y72NRBL7-DnlOXd0I.js → railroadDiagram-Y72NRBL7-Bfa59bDk.js} +1 -1
  87. package/dist/web/assets/{requirementDiagram-EQYSW5RA-Dq1MJEdy.js → requirementDiagram-EQYSW5RA-TqWBSttg.js} +1 -1
  88. package/dist/web/assets/{sankeyDiagram-SY24JHO5--LVb7hhV.js → sankeyDiagram-SY24JHO5-DXW4vZ49.js} +1 -1
  89. package/dist/web/assets/{sequenceDiagram-BLEHNHQU-Cg8W2Kc8.js → sequenceDiagram-BLEHNHQU-bR6akpDb.js} +1 -1
  90. package/dist/web/assets/{src-w1h_Rr-8.js → src-DWy4o1sh.js} +1 -1
  91. package/dist/web/assets/{stateDiagram-v2-A6IESKWZ-ck5PGLTp.js → stateDiagram-v2-A6IESKWZ-G-L9fY1U.js} +1 -1
  92. package/dist/web/assets/{swimlanes-B3ENRKFQ--RxIRIY6.js → swimlanes-B3ENRKFQ-Bvz0uaIY.js} +1 -1
  93. package/dist/web/assets/swimlanesDiagram-AYQRV4AK-D8Xb8aOe.js +8 -0
  94. package/dist/web/assets/{timeline-definition-JXYKGLGB-Cgtckb20.js → timeline-definition-JXYKGLGB-CLuowMKW.js} +1 -1
  95. package/dist/web/assets/{treeView-D4JQ5SDB-Byi5cU2l.js → treeView-D4JQ5SDB-P9KKVCsV.js} +1 -1
  96. package/dist/web/assets/{treemap-SAJKECNS-DJ7_3_F8.js → treemap-SAJKECNS-CJHxQeBA.js} +1 -1
  97. package/dist/web/assets/{usecaseDiagram-WPOLBNNX-DkTE13SV.js → usecaseDiagram-WPOLBNNX-Dp-yumhB.js} +1 -1
  98. package/dist/web/assets/{vennDiagram-Q3Y3IDCW-C5G521q2.js → vennDiagram-Q3Y3IDCW-WYfAKKah.js} +1 -1
  99. package/dist/web/assets/{wardley-7MLQ67FV-PChC3W6T.js → wardley-7MLQ67FV-16kL0OjA.js} +1 -1
  100. package/dist/web/assets/{wardleyDiagram-IVAIDKWA-B9sJfj7x.js → wardleyDiagram-IVAIDKWA-CKpO66Ll.js} +1 -1
  101. package/dist/web/assets/{xychartDiagram-4URNHDU4-CmuAuTkp.js → xychartDiagram-4URNHDU4-BAlKKoEI.js} +1 -1
  102. package/dist/web/index.html +3 -3
  103. package/package.json +4 -2
  104. package/templates/proposals/SKILL.md +14 -6
  105. package/templates/skill/SKILL.md +18 -0
  106. package/dist/web/assets/channel-B4Lj3Yy_.js +0 -1
  107. package/dist/web/assets/flowDiagram-IUGLLWBU-DA73lQLy.js +0 -1
  108. package/dist/web/assets/index-CFg9w5Ih.js +0 -63
  109. package/dist/web/assets/index-CT9Wzb6W.css +0 -1
  110. package/dist/web/assets/swimlanesDiagram-AYQRV4AK-CeoYxgix.js +0 -8
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t}from"./src-w1h_Rr-8.js";import{b as n}from"./chunk-DSNLSHJZ-CwfiRg01.js";import"./chunk-7S6XSTFO-CN1GsbIT.js";import"./chunk-YZO67HFG-dhkHuKWt.js";import"./chunk-AQDTSKZB-CUWKsFsd.js";import"./chunk-UHW7PFBP-CC1DKtp5.js";import{c as r}from"./chunk-HAGFOTED-Do-8YoBu.js";import{a as i,i as a,n as o}from"./chunk-ZAUX2LTX-CA6m357j.js";import{a as s,i as c,l}from"./chunk-WQQL4CDK-BJl_ufDd.js";import{$ as u,A as d,B as f,C as p,D as m,E as h,F as g,G as ee,H as _,I as te,J as ne,K as re,L as ie,M as ae,N as oe,O as se,P as v,Q as y,R as ce,S as le,T as ue,U as de,V as fe,W as pe,X as me,Y as he,Z as b,_ as x,a as S,b as ge,c as _e,d as ve,et as ye,f as C,g as be,h as xe,i as w,it as Se,j as Ce,k as we,l as Te,m as Ee,n as T,nt as De,o as E,p as Oe,q as ke,r as D,rt as Ae,s as je,t as O,tt as k,u as Me,v as Ne,w as Pe,x as Fe,y as Ie,z as A}from"./graphlib-DS17s2tU.js";import{r as Le}from"./chunk-HNE4Q36P-1-JjBgqP.js";import{c as Re,i as ze,n as j,o as Be,r as Ve,s as He,t as Ue}from"./chunk-ZCHMQSOR-DUBbqrP7.js";var We=/\s/;function Ge(e){for(var t=e.length;t--&&We.test(e.charAt(t)););return t}var Ke=/^\s+/;function qe(e){return e&&e.slice(0,Ge(e)+1).replace(Ke,``)}var Je=NaN,Ye=/^[-+]0x[0-9a-f]+$/i,Xe=/^0b[01]+$/i,Ze=/^0o[0-7]+$/i,Qe=parseInt;function $e(e){if(typeof e==`number`)return e;if(ye(e))return Je;if(b(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=b(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=qe(e);var n=Xe.test(e);return n||Ze.test(e)?Qe(e.slice(2),n?2:8):Ye.test(e)?Je:+e}var et=1/0,tt=17976931348623157e292;function M(e){return e?(e=$e(e),e===et||e===-et?(e<0?-1:1)*tt:e===e?e:0):e===0?e:0}function nt(e){var t=M(e),n=t%1;return t===t?n?t-n:t:0}var rt=Object.create,it=function(){function e(){}return function(t){if(!b(t))return{};if(rt)return rt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function at(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function N(e,t,n){t==`__proto__`&&ke?ke(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var ot=Object.prototype.hasOwnProperty;function P(e,t,n){var r=e[t];(!(ot.call(e,t)&&_(r,n))||n===void 0&&!(t in e))&&N(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?N(n,s,c):P(n,s,c)}return n}function I(e,t,n){if(!b(n))return!1;var r=typeof t;return(r==`number`?A(n)&&de(t,n.length):r==`string`&&t in n)?_(n[t],e):!1}function st(e){return f(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 ct(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var lt=Object.prototype.hasOwnProperty;function ut(e){if(!b(e))return ct(e);var t=ce(e),n=[];for(var r in e)(r!=`constructor`||!t&&lt.call(e,r))&&n.push(r);return n}function L(e){return A(e)?ae(e,!0):ut(e)}function R(e){return e!=null&&e.length?p(e,1):[]}function dt(e){return re(fe(e,void 0,R),e+``)}var ft=Ce(Object.getPrototypeOf,Object),pt=`[object Object]`,mt=Function.prototype,ht=Object.prototype,gt=mt.toString,_t=ht.hasOwnProperty,vt=gt.call(Object);function yt(e){if(!k(e)||De(e)!=pt)return!1;var t=ft(e);if(t===null)return!0;var n=_t.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&gt.call(n)==vt}var bt=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function xt(e){return bt.test(e)}function St(e,t){return e&&F(t,we(t),e)}function Ct(e,t){return e&&F(t,L(t),e)}var wt=typeof exports==`object`&&exports&&!exports.nodeType&&exports,Tt=wt&&typeof module==`object`&&module&&!module.nodeType&&module,Et=Tt&&Tt.exports===wt?Se.Buffer:void 0,Dt=Et?Et.allocUnsafe:void 0;function Ot(e,t){if(t)return e.slice();var n=e.length,r=Dt?Dt(n):new e.constructor(n);return e.copy(r),r}function kt(e,t){return F(e,ge(e),t)}var At=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Pe(t,ge(e)),e=ft(e);return t}:Fe;function jt(e,t){return F(e,At(e),t)}function Mt(e){return Ie(e,L,At)}var Nt=Object.prototype.hasOwnProperty;function Pt(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&Nt.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function Ft(e){var t=new e.constructor(e.byteLength);return new be(t).set(new be(e)),t}function It(e,t){var n=t?Ft(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var Lt=/\w*$/;function Rt(e){var t=new e.constructor(e.source,Lt.exec(e));return t.lastIndex=e.lastIndex,t}var zt=Ae?Ae.prototype:void 0,Bt=zt?zt.valueOf:void 0;function Vt(e){return Bt?Object(Bt.call(e)):{}}function Ht(e,t){var n=t?Ft(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Ut=`[object Boolean]`,Wt=`[object Date]`,Gt=`[object Map]`,Kt=`[object Number]`,qt=`[object RegExp]`,Jt=`[object Set]`,Yt=`[object String]`,Xt=`[object Symbol]`,Zt=`[object ArrayBuffer]`,Qt=`[object DataView]`,$t=`[object Float32Array]`,en=`[object Float64Array]`,tn=`[object Int8Array]`,nn=`[object Int16Array]`,rn=`[object Int32Array]`,an=`[object Uint8Array]`,on=`[object Uint8ClampedArray]`,sn=`[object Uint16Array]`,cn=`[object Uint32Array]`;function ln(e,t,n){var r=e.constructor;switch(t){case Zt:return Ft(e);case Ut:case Wt:return new r(+e);case Qt:return It(e,n);case $t:case en:case tn:case nn:case rn:case an:case on:case sn:case cn:return Ht(e,n);case Gt:return new r;case Kt:case Yt:return new r(e);case qt:return Rt(e);case Jt:return new r;case Xt:return Vt(e)}}function un(e){return typeof e.constructor==`function`&&!ce(e)?it(ft(e)):{}}var dn=`[object Map]`;function fn(e){return k(e)&&x(e)==dn}var pn=v&&v.isMap,mn=pn?g(pn):fn,hn=`[object Set]`;function gn(e){return k(e)&&x(e)==hn}var _n=v&&v.isSet,vn=_n?g(_n):gn,yn=1,bn=2,xn=4,Sn=`[object Arguments]`,Cn=`[object Array]`,wn=`[object Boolean]`,Tn=`[object Date]`,En=`[object Error]`,Dn=`[object Function]`,On=`[object GeneratorFunction]`,kn=`[object Map]`,An=`[object Number]`,jn=`[object Object]`,Mn=`[object RegExp]`,Nn=`[object Set]`,Pn=`[object String]`,Fn=`[object Symbol]`,In=`[object WeakMap]`,Ln=`[object ArrayBuffer]`,Rn=`[object DataView]`,zn=`[object Float32Array]`,Bn=`[object Float64Array]`,Vn=`[object Int8Array]`,Hn=`[object Int16Array]`,Un=`[object Int32Array]`,Wn=`[object Uint8Array]`,Gn=`[object Uint8ClampedArray]`,Kn=`[object Uint16Array]`,qn=`[object Uint32Array]`,z={};z[Sn]=z[Cn]=z[Ln]=z[Rn]=z[wn]=z[Tn]=z[zn]=z[Bn]=z[Vn]=z[Hn]=z[Un]=z[kn]=z[An]=z[jn]=z[Mn]=z[Nn]=z[Pn]=z[Fn]=z[Wn]=z[Gn]=z[Kn]=z[qn]=!0,z[En]=z[Dn]=z[In]=!1;function B(e,t,n,r,i,a){var o,s=t&yn,c=t&bn,l=t&xn;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!b(e))return e;var u=y(e);if(u){if(o=Pt(e),!s)return at(e,o)}else{var d=x(e),f=d==Dn||d==On;if(te(e))return Ot(e,s);if(d==jn||d==Sn||f&&!i){if(o=c||f?{}:un(e),!s)return c?jt(e,Ct(o,e)):kt(e,St(o,e))}else{if(!z[d])return i?e:{};o=ln(e,d,s)}}a||=new le;var p=a.get(e);if(p)return p;a.set(e,o),vn(e)?e.forEach(function(r){o.add(B(r,t,n,r,e,a))}):mn(e)&&e.forEach(function(r,i){o.set(i,B(r,t,n,i,e,a))});var m=u?void 0:(l?c?Mt:Ne:c?L:we)(e);return ee(m||e,function(r,i){m&&(i=r,r=e[i]),P(o,i,B(r,t,n,i,e,a))}),o}var Jn=1,Yn=4;function Xn(e){return B(e,Jn|Yn)}var Zn=function(){return Se.Date.now()},Qn=Object.prototype,$n=Qn.hasOwnProperty,er=f(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||_(u,Qn[l])&&!$n.call(e,l))&&(e[l]=a[l])}return e});function tr(e,t,n){(n!==void 0&&!_(e[t],n)||n===void 0&&!(t in e))&&N(e,t,n)}function nr(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}function rr(e){return F(e,L(e))}function ir(e,t,n,r,i,a,o){var s=nr(e,n),c=nr(t,n),l=o.get(c);if(l)tr(e,n,l);else{var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=y(c),p=!f&&te(c),m=!f&&!p&&oe(c);u=c,f||p||m?y(s)?u=s:_e(s)?u=at(s):p?(d=!1,u=Ot(c,!0)):m?(d=!1,u=Ht(c,!0)):u=[]:yt(c)||ie(c)?(u=s,ie(s)?u=rr(s):(!b(s)||he(s))&&(u=un(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),tr(e,n,u)}}function ar(e,t,n,r,i){e!==t&&ve(t,function(a,o){if(i||=new le,b(a))ir(e,t,o,n,ar,r,i);else{var s=r?r(nr(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),tr(e,o,s)}},L)}function V(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function or(e){return function(t,n,r){var i=Object(t);if(!A(t)){var a=C(n,3);t=we(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 sr=Math.max;function cr(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:nt(n);return i<0&&(i=sr(r+i,0)),pe(e,C(t,3),i)}var lr=or(cr);function ur(e,t){var n=-1,r=A(e)?Array(e.length):[];return Te(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function H(e,t){return(y(e)?u:ur)(e,C(t,3))}function dr(e,t){return e==null?e:ve(e,je(t),L)}function fr(e,t){return e&&Me(e,je(t))}function pr(e,t){return e>t}var mr=Object.prototype.hasOwnProperty;function hr(e,t){return e!=null&&mr.call(e,t)}function gr(e,t){return e!=null&&xe(e,t,hr)}var _r=`[object String]`;function vr(e){return typeof e==`string`||!y(e)&&k(e)&&De(e)==_r}function yr(e,t){return e<t}function U(e,t){var n={};return t=C(t,3),Me(e,function(e,r,i){N(n,r,t(e,r,i))}),n}function br(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&&!ye(o):n(o,s)))var s=o,c=a}return c}function W(e){return e&&e.length?br(e,me,pr):void 0}var xr=st(function(e,t,n){ar(e,t,n)});function G(e){return e&&e.length?br(e,me,yr):void 0}function Sr(e,t){return e&&e.length?br(e,C(t,2),yr):void 0}function Cr(e,t,n,r){if(!b(e))return e;t=m(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=h(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=b(u)?u:de(t[i+1])?[]:{})}P(s,c,l),s=s[c]}return e}function wr(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=ue(e,o);n(s,o)&&Cr(a,m(o,e),s)}return a}function Tr(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Er(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=ye(e),o=t!==void 0,s=t===null,c=t===t,l=ye(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 Dr(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=Er(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function Or(e,t,n){t=t.length?u(t,function(e){return y(e)?function(t){return ue(t,e.length===1?e[0]:e)}:e}):[me];var r=-1;return t=u(t,g(C)),Tr(ur(e,function(e,n,i){return{criteria:u(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return Dr(e,t,n)})}var kr=Oe(`length`),Ar=`\\ud800-\\udfff`,jr=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Mr=`\\ufe0e\\ufe0f`,Nr=`[`+Ar+`]`,Pr=`[`+jr+`]`,Fr=`\\ud83c[\\udffb-\\udfff]`,Ir=`(?:`+Pr+`|`+Fr+`)`,Lr=`[^`+Ar+`]`,Rr=`(?:\\ud83c[\\udde6-\\uddff]){2}`,zr=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Br=`\\u200d`,Vr=Ir+`?`,Hr=`[`+Mr+`]?`,Ur=`(?:`+Br+`(?:`+[Lr,Rr,zr].join(`|`)+`)`+Hr+Vr+`)*`,Wr=Hr+Vr+Ur,Gr=`(?:`+[Lr+Pr+`?`,Pr,Rr,zr,Nr].join(`|`)+`)`,Kr=RegExp(Fr+`(?=`+Fr+`)|`+Gr+Wr,`g`);function qr(e){for(var t=Kr.lastIndex=0;Kr.test(e);)++t;return t}function Jr(e){return xt(e)?qr(e):kr(e)}function Yr(e,t){return wr(e,t,function(t,n){return Ee(e,n)})}var K=dt(function(e,t){return e==null?{}:Yr(e,t)}),Xr=Math.ceil,Zr=Math.max;function Qr(e,t,n,r){for(var i=-1,a=Zr(Xr((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function $r(e){return function(t,n,r){return r&&typeof r!=`number`&&I(t,n,r)&&(n=r=void 0),t=M(t),n===void 0?(n=t,t=0):n=M(n),r=r===void 0?t<n?1:-1:M(r),Qr(t,n,r,e)}}var q=$r(),ei=`[object Map]`,ti=`[object Set]`;function ni(e){if(e==null)return 0;if(A(e))return vr(e)?Jr(e):e.length;var t=x(e);return t==ei||t==ti?e.size:d(e).length}var J=f(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]]),Or(e,p(t,1),[])}),ri=0;function ii(e){var t=++ri;return se(e)+t}function ai(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 oi(e,t){return ai(e||[],t||[],P)}var si=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return ci(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&ci(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,li)),n=n._prev;return`[`+e.join(`, `)+`]`}};function ci(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function li(e,t){if(e!==`_next`&&e!==`_prev`)return t}var ui=ne(1);function di(e,t){if(e.nodeCount()<=1)return[];var n=mi(e,t||ui);return R(H(fi(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function fi(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)pi(e,t,n,o);for(;o=i.dequeue();)pi(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(pi(e,t,n,o,!0));break}}}return r}function pi(e,t,n,r,i){var a=i?[]:void 0;return E(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,hi(t,n,s)}),E(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,hi(t,n,o)}),e.removeNode(r.v),a}function mi(e,t){var n=new O,r=0,i=0;E(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),E(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 si}),o=r+1;return E(n.nodes(),function(e){hi(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function hi(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 gi(e){var t=e.graph().acyclicer===`greedy`?di(e,n(e)):_i(e);E(t,function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,ii(`rev`))});function n(e){return function(t){return e.edge(t).weight}}}function _i(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,E(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return E(e.nodes(),i),t}function vi(e){E(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=ii(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function yi(e){var t=new O().setGraph(e.graph());return E(e.nodes(),function(n){t.setNode(n,e.node(n))}),E(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 bi(e){var t=new O({multigraph:e.isMultigraph()}).setGraph(e.graph());return E(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),E(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function xi(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(Ti(e)+1),function(){return[]});return E(e.nodes(),function(n){var r=e.node(n),i=r.rank;D(i)||(t[i][r.order]=n)}),t}function Si(e){var t=G(H(e.nodes(),function(t){return e.node(t).rank}));E(e.nodes(),function(n){var r=e.node(n);gr(r,`rank`)&&(r.rank-=t)})}function Ci(e){var t=G(H(e.nodes(),function(t){return e.node(t).rank})),n=[];E(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;E(n,function(t,n){D(t)&&n%i!==0?--r:r&&E(t,function(t){e.node(t).rank+=r})})}function wi(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 Ti(e){return W(H(e.nodes(),function(t){var n=e.node(t).rank;if(!D(n))return n}))}function Ei(e,t){var n={lhs:[],rhs:[]};return E(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Di(e,t){var n=Zn();try{return t()}finally{console.log(e+` time: `+(Zn()-n)+`ms`)}}function Oi(e,t){return t()}function ki(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&E(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)Ai(e,`borderLeft`,`_bl`,n,i,a),Ai(e,`borderRight`,`_br`,n,i,a)}}E(e.children(),t)}function Ai(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 ji(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&Ni(e)}function Mi(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&Fi(e),(t===`lr`||t===`rl`)&&(Li(e),Ni(e))}function Ni(e){E(e.nodes(),function(t){Pi(e.node(t))}),E(e.edges(),function(t){Pi(e.edge(t))})}function Pi(e){var t=e.width;e.width=e.height,e.height=t}function Fi(e){E(e.nodes(),function(t){Ii(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);E(n.points,Ii),Object.prototype.hasOwnProperty.call(n,`y`)&&Ii(n)})}function Ii(e){e.y=-e.y}function Li(e){E(e.nodes(),function(t){Ri(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);E(n.points,Ri),Object.prototype.hasOwnProperty.call(n,`x`)&&Ri(n)})}function Ri(e){var t=e.x;e.x=e.y,e.y=t}function zi(e){e.graph().dummyChains=[],E(e.edges(),function(t){Bi(e,t)})}function Bi(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=0;for(++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 Vi(e){E(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 Hi(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}E(e.sources(),n)}function Z(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function Ui(e){var t=new O({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;Wi(t,e)<r;)i=Gi(t,e),a=t.hasNode(i.v)?Z(e,i):-Z(e,i),Ki(t,e,a);return t}function Wi(e,t){function n(r){E(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 E(e.nodes(),n),e.nodeCount()}function Gi(e,t){return Sr(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return Z(t,n)})}function Ki(e,t,n){E(e.nodes(),function(e){t.node(e).rank+=n})}ne(1),ne(1),qi.CycleException=Q;function qi(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,E(e.predecessors(a),i),delete n[a],r.push(a))}if(E(e.sinks(),i),ni(t)!==e.nodeCount())throw new Q;return r}function Q(){}Q.prototype=Error();function Ji(e,t,n){y(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return E(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);Yi(e,t,n===`post`,a,r,i)}),i}function Yi(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),E(i(t),function(t){Yi(e,t,n,r,i,a)}),n&&a.push(t))}function Xi(e,t){return Ji(e,t,`post`)}function Zi(e,t){return Ji(e,t,`pre`)}$.initLowLimValues=ta,$.initCutValues=Qi,$.calcCutValue=ea,$.leaveEdge=ra,$.enterEdge=ia,$.exchangeEdges=aa;function $(e){e=yi(e),Hi(e);var t=Ui(e);ta(t),Qi(t,e);for(var n,r;n=ra(t);)r=ia(t,e,n),aa(t,e,n,r)}function Qi(e,t){var n=Xi(e,e.nodes());n=n.slice(0,n.length-1),E(n,function(n){$i(e,t,n)})}function $i(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=ea(e,t,n)}function ea(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,E(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,sa(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function ta(e,t){arguments.length<2&&(t=e.nodes()[0]),na(e,{},1,t)}function na(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,E(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=na(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function ra(e){return lr(e.edges(),function(t){return e.edge(t).cutvalue<0})}function ia(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),Sr(S(t.edges(),function(t){return c===ca(e,e.node(t.v),s)&&c!==ca(e,e.node(t.w),s)}),function(e){return Z(t,e)})}function aa(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),ta(e),Qi(e,t),oa(e,t)}function oa(e,t){var n=Zi(e,lr(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),E(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 sa(e,t,n){return e.hasEdge(t,n)}function ca(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function la(e){switch(e.graph().ranker){case`network-simplex`:fa(e);break;case`tight-tree`:da(e);break;case`longest-path`:ua(e);break;default:fa(e)}}var ua=Hi;function da(e){Hi(e),Ui(e)}function fa(e){$(e)}function pa(e){var t=Y(e,`root`,{},`_root`),n=ha(e),r=W(w(n))-1,i=2*r+1;e.graph().nestingRoot=t,E(e.edges(),function(t){e.edge(t).minlen*=i});var a=ga(e)+1;E(e.children(),function(o){ma(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function ma(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});else{var c=wi(e,`_bt`),l=wi(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,E(s,function(s){ma(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 ha(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&E(a,function(e){n(e,i+1)}),t[r]=i}return E(e.children(),function(e){n(e,1)}),t}function ga(e){return T(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function _a(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,E(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function va(e,t,n){var r={},i;E(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 ya(e,t,n){var r=ba(e),i=new O({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return E(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),E(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=D(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 ba(e){for(var t;e.hasNode(t=ii(`_root`)););return t}function xa(e,t){for(var n=0,r=1;r<t.length;++r)n+=Sa(e,t[r-1],t[r]);return n}function Sa(e,t,n){for(var r=oi(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 E(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 Ca(e){var t={},n=S(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){gr(t,n)||(t[n]=!0,r[e.node(n).rank].push(n),E(e.successors(n),i))}var a=J(n,function(t){return e.node(t).rank});return E(a,i),r}function wa(e,t){return H(t,function(t){var n=e.inEdges(t);if(n.length){var r=T(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}}return{v:t}})}function Ta(e,t){var n={};return E(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};D(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),E(t.edges(),function(e){var t=n[e.v],r=n[e.w];!D(t)&&!D(r)&&(r.indegree++,t.out.push(n[e.w]))}),Ea(S(n,function(e){return!e.indegree}))}function Ea(e){var t=[];function n(e){return function(t){t.merged||(D(t.barycenter)||D(e.barycenter)||t.barycenter>=e.barycenter)&&Da(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),E(i.in.reverse(),n(i)),E(i.out,r(i))}return H(S(t,function(e){return!e.merged}),function(e){return K(e,[`vs`,`i`,`barycenter`,`weight`])})}function Da(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 Oa(e,t){var n=Ei(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(Aa(!!t)),c=ka(a,i,c),E(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=ka(a,i,c)});var l={vs:R(a)};return s&&(l.barycenter=o/s,l.weight=s),l}function ka(e,t,n){for(var r;t.length&&(r=V(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Aa(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 ja(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=S(i,function(e){return e!==o&&e!==s}));var l=wa(e,i);E(l,function(t){if(e.children(t.v).length){var i=ja(e,t.v,n,r);c[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&Na(t,i)}});var u=Ta(l,n);Ma(u,c);var d=Oa(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){E(e,function(e){e.vs=R(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function Na(e,t){D(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 Pa(e){var t=Ti(e),n=Fa(e,q(1,t+1),`inEdges`),r=Fa(e,q(t-1,-1,-1),`outEdges`),i=Ca(e);La(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){Ia(s%2?n:r,s%4>=2),i=X(e);var l=xa(e,i);l<a&&(c=0,o=Xn(i),a=l)}La(e,o)}function Fa(e,t,n){return H(t,function(t){return ya(e,t,n)})}function Ia(e,t){var n=new O;E(e,function(e){var r=e.graph().root,i=ja(e,r,n,t);E(i.vs,function(t,n){e.node(t).order=n}),va(e,n,i.vs)})}function La(e,t){E(t,function(t){E(t,function(t,n){e.node(t).order=n})})}function Ra(e){var t=Ba(e);E(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=za(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 za(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 Ba(e){var t={},n=0;function r(i){var a=n;E(e.children(i),r),t[i]={low:a,lim:n++}}return E(e.children(),r),t}function Va(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=V(r);return E(r,function(t,c){var l=Ua(e,t),u=l?e.node(l).order:o;(l||t===s)&&(E(r.slice(a,c+1),function(t){E(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Wa(n,r,t)})}),a=c+1,i=u)}),r}return T(t,r),n}function Ha(e,t){var n={};function r(t,r,i,a,o){var s;E(q(r,i),function(r){s=t[r],e.node(s).dummy&&E(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Wa(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return E(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 T(t,i),n}function Ua(e,t){if(e.node(t).dummy)return lr(e.predecessors(t),function(t){return e.node(t).dummy})}function Wa(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 Ga(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function Ka(e,t,n,r){var i={},a={},o={};return E(t,function(e){E(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),E(t,function(e){var t=-1;E(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]&&!Ga(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function qa(e,t,n,r,i){var a={},o=Ja(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)),E(r,function(e){a[e]=a[n[e]]}),a}function Ja(e,t,n,r){var i=new O,a=e.graph(),o=$a(a.nodesep,a.edgesep,r);return E(t,function(t){var r;E(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 Ya(e,t){return Sr(w(t),function(t){var n=-1/0,r=1/0;return dr(t,function(t,i){var a=eo(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function Xa(e,t){var n=w(t),r=G(n),i=W(n);E([`u`,`d`],function(n){E([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=w(s);c=a===`l`?r-G(l):i-W(l),c&&(e[o]=U(s,function(e){return e+c}))}})})}function Za(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 Qa(e){var t=X(e),n=xr(Va(e,t),Ha(e,t)),r={},i;return E([`u`,`d`],function(a){i=a===`u`?t:w(t).reverse(),E([`l`,`r`],function(t){t===`r`&&(i=H(i,function(e){return w(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=Ka(e,i,n,o),c=qa(e,i,s.root,s.align,t===`r`);t===`r`&&(c=U(c,function(e){return-e})),r[a+t]=c})}),Xa(r,Ya(e,r)),Za(r,e.graph().align)}function $a(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}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}return l&&(c+=n?l:-l),l=0,c}}function eo(e,t){return e.node(t).width}function to(e){e=bi(e),no(e),fr(Qa(e),function(t,n){e.node(n).x=t})}function no(e){var t=X(e),n=e.graph().ranksep,r=0;E(t,function(t){var i=W(H(t,function(t){return e.node(t).height}));E(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function ro(e,t){var n=t&&t.debugTiming?Di:Oi;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>ho(e));n(` runLayout`,()=>io(t,n)),n(` updateInputGraph`,()=>ao(e,t))})}function io(e,t){t(` makeSpaceForEdgeLabels`,()=>go(e)),t(` removeSelfEdges`,()=>To(e)),t(` acyclic`,()=>gi(e)),t(` nestingGraph.run`,()=>pa(e)),t(` rank`,()=>la(bi(e))),t(` injectEdgeLabelProxies`,()=>_o(e)),t(` removeEmptyRanks`,()=>Ci(e)),t(` nestingGraph.cleanup`,()=>_a(e)),t(` normalizeRanks`,()=>Si(e)),t(` assignRankMinMax`,()=>vo(e)),t(` removeEdgeLabelProxies`,()=>yo(e)),t(` normalize.run`,()=>zi(e)),t(` parentDummyChains`,()=>Ra(e)),t(` addBorderSegments`,()=>ki(e)),t(` order`,()=>Pa(e)),t(` insertSelfEdges`,()=>Eo(e)),t(` adjustCoordinateSystem`,()=>ji(e)),t(` position`,()=>to(e)),t(` positionSelfEdges`,()=>Do(e)),t(` removeBorderNodes`,()=>wo(e)),t(` normalize.undo`,()=>Vi(e)),t(` fixupEdgeLabelCoords`,()=>So(e)),t(` undoCoordinateSystem`,()=>Mi(e)),t(` translateGraph`,()=>bo(e)),t(` assignNodeIntersects`,()=>xo(e)),t(` reversePoints`,()=>Co(e)),t(` acyclic.undo`,()=>vi(e))}function ao(e,t){E(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))}),E(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 oo=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],so={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},co=[`acyclicer`,`ranker`,`rankdir`,`align`],lo=[`width`,`height`],uo={width:0,height:0},fo=[`minlen`,`weight`,`width`,`height`,`labeloffset`],po={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},mo=[`labelpos`];function ho(e){var t=new O({multigraph:!0,compound:!0}),n=ko(e.graph());return t.setGraph(xr({},so,Oo(n,oo),K(n,co))),E(e.nodes(),function(n){var r=ko(e.node(n));t.setNode(n,er(Oo(r,lo),uo)),t.setParent(n,e.parent(n))}),E(e.edges(),function(n){var r=ko(e.edge(n));t.setEdge(n,xr({},po,Oo(r,fo),K(r,mo)))}),t}function go(e){var t=e.graph();t.ranksep/=2,E(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 _o(e){E(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 vo(e){var t=0;E(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 yo(e){E(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function bo(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)}E(e.nodes(),function(t){c(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,E(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),E(e.edges(),function(n){var i=e.edge(n);E(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 xo(e){E(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(xi(r,a)),n.points.push(xi(i,o))})}function So(e){E(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}})}function Co(e){E(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function wo(e){E(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}}),E(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function To(e){E(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 Eo(e){var t=X(e);E(t,function(t){var n=0;E(t,function(t,r){var i=e.node(t);i.order=r+n,E(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 Do(e){E(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 Oo(e,t){return U(K(e,t),Number)}function ko(e){var t={};return E(e,function(e,n){t[n.toLowerCase()]=e}),t}var Ao=e((e,t,n)=>Math.max(t,Math.min(n,e)),`clamp`),jo=e((e=`TB`)=>{switch(e){case`BT`:return`bottom`;case`LR`:return`right`;case`RL`:return`left`;default:return`top`}},`getDefaultSelfLoopSide`),Mo=e(e=>e===`flowchart`||e===`flowchart-v2`||e===`stateDiagram`||e===`er`||e===`classDiagram`,`shouldMergeSelfLoopSegments`),No=[`x`,`y`,`width`,`height`,`labelBBox`,`intersect`,`calcIntersect`,`diff`,`clusterNode`],Po=e((e,t,n,r,i)=>{let a=[],o=new Set;if(n.forEach(({start:e,end:t})=>{e!==r&&o.add(e),t!==r&&o.add(t)}),o.forEach(t=>{let n=e.node(t);typeof n?.x==`number`&&typeof n?.y==`number`&&a.push(n)}),a.length===0&&n.forEach(({edge:e})=>{(e.points??[]).forEach(e=>{typeof e?.x==`number`&&typeof e?.y==`number`&&a.push(e)})}),a.length===0)return jo(i);let s=a.reduce((e,t)=>({x:e.x+t.x/a.length,y:e.y+t.y/a.length}),{x:0,y:0}),c=s.x-t.x,l=s.y-t.y;return Math.abs(c)>Math.abs(l)?c>0?`right`:`left`:Math.abs(l)>0?l>0?`bottom`:`top`:jo(i)},`getSelfLoopSide`),Fo=e((e,t=`top`,n=0,r=0)=>{let i=e.x,a=e.y-n,o=e.width/2,s=e.height/2,c=Math.max(36,Math.min(100,e.width*.8)),l=Ao(Math.max(r,e.width*.35),36,c),u=Ao(Math.min(e.width,e.height)*.45,24,48);switch(t){case`bottom`:{let e=a+s;return[{x:i-l/2,y:e},{x:i-l/2,y:e+u},{x:i+l/2,y:e+u},{x:i+l/2,y:e}]}case`right`:{let e=i+o;return[{x:e,y:a-l/2},{x:e+u,y:a-l/2},{x:e+u,y:a+l/2},{x:e,y:a+l/2}]}case`left`:{let e=i-o;return[{x:e,y:a-l/2},{x:e-u,y:a-l/2},{x:e-u,y:a+l/2},{x:e,y:a+l/2}]}default:{let e=a-s;return[{x:i-l/2,y:e},{x:i-l/2,y:e-u},{x:i+l/2,y:e-u},{x:i+l/2,y:e}]}}},`getSelfLoopPoints`),Io=e((e,t,n=`top`,r=0,i={})=>{let a=e.x,o=e.y-r,s=i.width??0,c=i.height??0;switch(n){case`bottom`:return{x:a,y:Math.max(...t.map(e=>e.y))+c/2+4};case`right`:return{x:Math.max(...t.map(e=>e.x))+s/2+4,y:o};case`left`:return{x:Math.min(...t.map(e=>e.x))-s/2-4,y:o};default:return{x:a,y:Math.min(...t.map(e=>e.y))-c/2-4}}},`getSelfLoopLabelPosition`),Lo=e((e,t=0,{mergeSelfLoops:n=!0}={})=>{let r=new Map,i=[],a=e.graph()?.rankdir;return e.edges().forEach(t=>{let a=e.edge(t);if(n&&a.selfLoop){let e=a.selfLoop.id;r.has(e)||r.set(e,[]),r.get(e).push({edge:a,start:t.v,end:t.w})}else i.push({edge:a,start:t.v,end:t.w})}),r.forEach(n=>{if(n.length!==3){n.forEach(e=>i.push(e));return}n.sort((e,t)=>e.edge.selfLoop.order-t.edge.selfLoop.order);let[r,o,s]=n,c=r.edge.originalEdge??o.edge.originalEdge??s.edge.originalEdge??o.edge,l=e.node(c.start);if(!l){n.forEach(e=>i.push(e));return}let u={width:o.edge.width,height:o.edge.height},d=Po(e,l,n,c.start,a),f=Fo(l,d,t,u.width??0),p=Io(l,f,d,t,u),m={...o.edge,...c,id:c.id,points:f,start:c.start,end:c.end,x:p.x,y:p.y,width:u.width,height:u.height,labelStyle:o.edge.labelStyle,fromCluster:r.edge.fromCluster??o.edge.fromCluster??s.edge.fromCluster,toCluster:r.edge.toCluster??o.edge.toCluster??s.edge.toCluster};delete m.selfLoop,delete m.originalEdge,i.push({edge:m,start:m.start,end:m.end})}),i},`getEdgesToRender`),Ro=e(async({element:n,graph:a,diagramType:c,id:l,parentCluster:u,siteConfig:d})=>{let f=a.graph().rankdir;t.trace(`Dir in recursive render - dir:`,f);let{clusters:p,edgePaths:m,edgeLabels:h,nodes:g,rootGroups:ee}=ze(n,{edgePathsClass:`edgePaths`});a.nodes()?t.info(`Recursive render XXX`,a.nodes()):t.info(`No nodes found for`,a),a.edges().length>0&&t.info(`Recursive edges`,a.edge(a.edges()[0]));let _=Mo(c);await Promise.all(a.nodes().map(async function(e){let n=a.node(e);if(u!==void 0){let n=JSON.parse(JSON.stringify(u.clusterData));t.trace(`Setting data for parent cluster XXX
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t}from"./src-DWy4o1sh.js";import{b as n}from"./chunk-DSNLSHJZ-6EnWiUHw.js";import"./chunk-7S6XSTFO-C_2BTQ4f.js";import"./chunk-YZO67HFG-O3X4dDhT.js";import"./chunk-AQDTSKZB-DZLt6T8h.js";import"./chunk-UHW7PFBP-y_Cnbpso.js";import{c as r}from"./chunk-HAGFOTED-C4TrjvWC.js";import{a as i,i as a,n as o}from"./chunk-ZAUX2LTX-dMpe16to.js";import{a as s,i as c,l}from"./chunk-WQQL4CDK-DVgns4LS.js";import{$ as u,A as d,B as f,C as p,D as m,E as h,F as g,G as ee,H as _,I as te,J as ne,K as re,L as ie,M as ae,N as oe,O as se,P as v,Q as y,R as ce,S as le,T as ue,U as de,V as fe,W as pe,X as me,Y as he,Z as b,_ as x,a as S,b as ge,c as _e,d as ve,et as ye,f as C,g as be,h as xe,i as w,it as Se,j as Ce,k as we,l as Te,m as Ee,n as T,nt as De,o as E,p as Oe,q as ke,r as D,rt as Ae,s as je,t as O,tt as k,u as Me,v as Ne,w as Pe,x as Fe,y as Ie,z as A}from"./graphlib-DS17s2tU.js";import{r as Le}from"./chunk-HNE4Q36P-Bhz3xzgF.js";import{c as Re,i as ze,n as j,o as Be,r as Ve,s as He,t as Ue}from"./chunk-ZCHMQSOR-DmywVAUg.js";var We=/\s/;function Ge(e){for(var t=e.length;t--&&We.test(e.charAt(t)););return t}var Ke=/^\s+/;function qe(e){return e&&e.slice(0,Ge(e)+1).replace(Ke,``)}var Je=NaN,Ye=/^[-+]0x[0-9a-f]+$/i,Xe=/^0b[01]+$/i,Ze=/^0o[0-7]+$/i,Qe=parseInt;function $e(e){if(typeof e==`number`)return e;if(ye(e))return Je;if(b(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=b(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=qe(e);var n=Xe.test(e);return n||Ze.test(e)?Qe(e.slice(2),n?2:8):Ye.test(e)?Je:+e}var et=1/0,tt=17976931348623157e292;function M(e){return e?(e=$e(e),e===et||e===-et?(e<0?-1:1)*tt:e===e?e:0):e===0?e:0}function nt(e){var t=M(e),n=t%1;return t===t?n?t-n:t:0}var rt=Object.create,it=function(){function e(){}return function(t){if(!b(t))return{};if(rt)return rt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function at(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function N(e,t,n){t==`__proto__`&&ke?ke(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var ot=Object.prototype.hasOwnProperty;function P(e,t,n){var r=e[t];(!(ot.call(e,t)&&_(r,n))||n===void 0&&!(t in e))&&N(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?N(n,s,c):P(n,s,c)}return n}function I(e,t,n){if(!b(n))return!1;var r=typeof t;return(r==`number`?A(n)&&de(t,n.length):r==`string`&&t in n)?_(n[t],e):!1}function st(e){return f(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 ct(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var lt=Object.prototype.hasOwnProperty;function ut(e){if(!b(e))return ct(e);var t=ce(e),n=[];for(var r in e)(r!=`constructor`||!t&&lt.call(e,r))&&n.push(r);return n}function L(e){return A(e)?ae(e,!0):ut(e)}function R(e){return e!=null&&e.length?p(e,1):[]}function dt(e){return re(fe(e,void 0,R),e+``)}var ft=Ce(Object.getPrototypeOf,Object),pt=`[object Object]`,mt=Function.prototype,ht=Object.prototype,gt=mt.toString,_t=ht.hasOwnProperty,vt=gt.call(Object);function yt(e){if(!k(e)||De(e)!=pt)return!1;var t=ft(e);if(t===null)return!0;var n=_t.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&gt.call(n)==vt}var bt=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function xt(e){return bt.test(e)}function St(e,t){return e&&F(t,we(t),e)}function Ct(e,t){return e&&F(t,L(t),e)}var wt=typeof exports==`object`&&exports&&!exports.nodeType&&exports,Tt=wt&&typeof module==`object`&&module&&!module.nodeType&&module,Et=Tt&&Tt.exports===wt?Se.Buffer:void 0,Dt=Et?Et.allocUnsafe:void 0;function Ot(e,t){if(t)return e.slice();var n=e.length,r=Dt?Dt(n):new e.constructor(n);return e.copy(r),r}function kt(e,t){return F(e,ge(e),t)}var At=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Pe(t,ge(e)),e=ft(e);return t}:Fe;function jt(e,t){return F(e,At(e),t)}function Mt(e){return Ie(e,L,At)}var Nt=Object.prototype.hasOwnProperty;function Pt(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&Nt.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function Ft(e){var t=new e.constructor(e.byteLength);return new be(t).set(new be(e)),t}function It(e,t){var n=t?Ft(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var Lt=/\w*$/;function Rt(e){var t=new e.constructor(e.source,Lt.exec(e));return t.lastIndex=e.lastIndex,t}var zt=Ae?Ae.prototype:void 0,Bt=zt?zt.valueOf:void 0;function Vt(e){return Bt?Object(Bt.call(e)):{}}function Ht(e,t){var n=t?Ft(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Ut=`[object Boolean]`,Wt=`[object Date]`,Gt=`[object Map]`,Kt=`[object Number]`,qt=`[object RegExp]`,Jt=`[object Set]`,Yt=`[object String]`,Xt=`[object Symbol]`,Zt=`[object ArrayBuffer]`,Qt=`[object DataView]`,$t=`[object Float32Array]`,en=`[object Float64Array]`,tn=`[object Int8Array]`,nn=`[object Int16Array]`,rn=`[object Int32Array]`,an=`[object Uint8Array]`,on=`[object Uint8ClampedArray]`,sn=`[object Uint16Array]`,cn=`[object Uint32Array]`;function ln(e,t,n){var r=e.constructor;switch(t){case Zt:return Ft(e);case Ut:case Wt:return new r(+e);case Qt:return It(e,n);case $t:case en:case tn:case nn:case rn:case an:case on:case sn:case cn:return Ht(e,n);case Gt:return new r;case Kt:case Yt:return new r(e);case qt:return Rt(e);case Jt:return new r;case Xt:return Vt(e)}}function un(e){return typeof e.constructor==`function`&&!ce(e)?it(ft(e)):{}}var dn=`[object Map]`;function fn(e){return k(e)&&x(e)==dn}var pn=v&&v.isMap,mn=pn?g(pn):fn,hn=`[object Set]`;function gn(e){return k(e)&&x(e)==hn}var _n=v&&v.isSet,vn=_n?g(_n):gn,yn=1,bn=2,xn=4,Sn=`[object Arguments]`,Cn=`[object Array]`,wn=`[object Boolean]`,Tn=`[object Date]`,En=`[object Error]`,Dn=`[object Function]`,On=`[object GeneratorFunction]`,kn=`[object Map]`,An=`[object Number]`,jn=`[object Object]`,Mn=`[object RegExp]`,Nn=`[object Set]`,Pn=`[object String]`,Fn=`[object Symbol]`,In=`[object WeakMap]`,Ln=`[object ArrayBuffer]`,Rn=`[object DataView]`,zn=`[object Float32Array]`,Bn=`[object Float64Array]`,Vn=`[object Int8Array]`,Hn=`[object Int16Array]`,Un=`[object Int32Array]`,Wn=`[object Uint8Array]`,Gn=`[object Uint8ClampedArray]`,Kn=`[object Uint16Array]`,qn=`[object Uint32Array]`,z={};z[Sn]=z[Cn]=z[Ln]=z[Rn]=z[wn]=z[Tn]=z[zn]=z[Bn]=z[Vn]=z[Hn]=z[Un]=z[kn]=z[An]=z[jn]=z[Mn]=z[Nn]=z[Pn]=z[Fn]=z[Wn]=z[Gn]=z[Kn]=z[qn]=!0,z[En]=z[Dn]=z[In]=!1;function B(e,t,n,r,i,a){var o,s=t&yn,c=t&bn,l=t&xn;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!b(e))return e;var u=y(e);if(u){if(o=Pt(e),!s)return at(e,o)}else{var d=x(e),f=d==Dn||d==On;if(te(e))return Ot(e,s);if(d==jn||d==Sn||f&&!i){if(o=c||f?{}:un(e),!s)return c?jt(e,Ct(o,e)):kt(e,St(o,e))}else{if(!z[d])return i?e:{};o=ln(e,d,s)}}a||=new le;var p=a.get(e);if(p)return p;a.set(e,o),vn(e)?e.forEach(function(r){o.add(B(r,t,n,r,e,a))}):mn(e)&&e.forEach(function(r,i){o.set(i,B(r,t,n,i,e,a))});var m=u?void 0:(l?c?Mt:Ne:c?L:we)(e);return ee(m||e,function(r,i){m&&(i=r,r=e[i]),P(o,i,B(r,t,n,i,e,a))}),o}var Jn=1,Yn=4;function Xn(e){return B(e,Jn|Yn)}var Zn=function(){return Se.Date.now()},Qn=Object.prototype,$n=Qn.hasOwnProperty,er=f(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||_(u,Qn[l])&&!$n.call(e,l))&&(e[l]=a[l])}return e});function tr(e,t,n){(n!==void 0&&!_(e[t],n)||n===void 0&&!(t in e))&&N(e,t,n)}function nr(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}function rr(e){return F(e,L(e))}function ir(e,t,n,r,i,a,o){var s=nr(e,n),c=nr(t,n),l=o.get(c);if(l)tr(e,n,l);else{var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=y(c),p=!f&&te(c),m=!f&&!p&&oe(c);u=c,f||p||m?y(s)?u=s:_e(s)?u=at(s):p?(d=!1,u=Ot(c,!0)):m?(d=!1,u=Ht(c,!0)):u=[]:yt(c)||ie(c)?(u=s,ie(s)?u=rr(s):(!b(s)||he(s))&&(u=un(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),tr(e,n,u)}}function ar(e,t,n,r,i){e!==t&&ve(t,function(a,o){if(i||=new le,b(a))ir(e,t,o,n,ar,r,i);else{var s=r?r(nr(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),tr(e,o,s)}},L)}function V(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function or(e){return function(t,n,r){var i=Object(t);if(!A(t)){var a=C(n,3);t=we(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 sr=Math.max;function cr(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:nt(n);return i<0&&(i=sr(r+i,0)),pe(e,C(t,3),i)}var lr=or(cr);function ur(e,t){var n=-1,r=A(e)?Array(e.length):[];return Te(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function H(e,t){return(y(e)?u:ur)(e,C(t,3))}function dr(e,t){return e==null?e:ve(e,je(t),L)}function fr(e,t){return e&&Me(e,je(t))}function pr(e,t){return e>t}var mr=Object.prototype.hasOwnProperty;function hr(e,t){return e!=null&&mr.call(e,t)}function gr(e,t){return e!=null&&xe(e,t,hr)}var _r=`[object String]`;function vr(e){return typeof e==`string`||!y(e)&&k(e)&&De(e)==_r}function yr(e,t){return e<t}function U(e,t){var n={};return t=C(t,3),Me(e,function(e,r,i){N(n,r,t(e,r,i))}),n}function br(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&&!ye(o):n(o,s)))var s=o,c=a}return c}function W(e){return e&&e.length?br(e,me,pr):void 0}var xr=st(function(e,t,n){ar(e,t,n)});function G(e){return e&&e.length?br(e,me,yr):void 0}function Sr(e,t){return e&&e.length?br(e,C(t,2),yr):void 0}function Cr(e,t,n,r){if(!b(e))return e;t=m(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=h(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=b(u)?u:de(t[i+1])?[]:{})}P(s,c,l),s=s[c]}return e}function wr(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=ue(e,o);n(s,o)&&Cr(a,m(o,e),s)}return a}function Tr(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Er(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=ye(e),o=t!==void 0,s=t===null,c=t===t,l=ye(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 Dr(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=Er(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function Or(e,t,n){t=t.length?u(t,function(e){return y(e)?function(t){return ue(t,e.length===1?e[0]:e)}:e}):[me];var r=-1;return t=u(t,g(C)),Tr(ur(e,function(e,n,i){return{criteria:u(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return Dr(e,t,n)})}var kr=Oe(`length`),Ar=`\\ud800-\\udfff`,jr=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Mr=`\\ufe0e\\ufe0f`,Nr=`[`+Ar+`]`,Pr=`[`+jr+`]`,Fr=`\\ud83c[\\udffb-\\udfff]`,Ir=`(?:`+Pr+`|`+Fr+`)`,Lr=`[^`+Ar+`]`,Rr=`(?:\\ud83c[\\udde6-\\uddff]){2}`,zr=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Br=`\\u200d`,Vr=Ir+`?`,Hr=`[`+Mr+`]?`,Ur=`(?:`+Br+`(?:`+[Lr,Rr,zr].join(`|`)+`)`+Hr+Vr+`)*`,Wr=Hr+Vr+Ur,Gr=`(?:`+[Lr+Pr+`?`,Pr,Rr,zr,Nr].join(`|`)+`)`,Kr=RegExp(Fr+`(?=`+Fr+`)|`+Gr+Wr,`g`);function qr(e){for(var t=Kr.lastIndex=0;Kr.test(e);)++t;return t}function Jr(e){return xt(e)?qr(e):kr(e)}function Yr(e,t){return wr(e,t,function(t,n){return Ee(e,n)})}var K=dt(function(e,t){return e==null?{}:Yr(e,t)}),Xr=Math.ceil,Zr=Math.max;function Qr(e,t,n,r){for(var i=-1,a=Zr(Xr((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function $r(e){return function(t,n,r){return r&&typeof r!=`number`&&I(t,n,r)&&(n=r=void 0),t=M(t),n===void 0?(n=t,t=0):n=M(n),r=r===void 0?t<n?1:-1:M(r),Qr(t,n,r,e)}}var q=$r(),ei=`[object Map]`,ti=`[object Set]`;function ni(e){if(e==null)return 0;if(A(e))return vr(e)?Jr(e):e.length;var t=x(e);return t==ei||t==ti?e.size:d(e).length}var J=f(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]]),Or(e,p(t,1),[])}),ri=0;function ii(e){var t=++ri;return se(e)+t}function ai(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 oi(e,t){return ai(e||[],t||[],P)}var si=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return ci(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&ci(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,li)),n=n._prev;return`[`+e.join(`, `)+`]`}};function ci(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function li(e,t){if(e!==`_next`&&e!==`_prev`)return t}var ui=ne(1);function di(e,t){if(e.nodeCount()<=1)return[];var n=mi(e,t||ui);return R(H(fi(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function fi(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)pi(e,t,n,o);for(;o=i.dequeue();)pi(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(pi(e,t,n,o,!0));break}}}return r}function pi(e,t,n,r,i){var a=i?[]:void 0;return E(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,hi(t,n,s)}),E(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,hi(t,n,o)}),e.removeNode(r.v),a}function mi(e,t){var n=new O,r=0,i=0;E(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),E(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 si}),o=r+1;return E(n.nodes(),function(e){hi(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function hi(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 gi(e){var t=e.graph().acyclicer===`greedy`?di(e,n(e)):_i(e);E(t,function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,ii(`rev`))});function n(e){return function(t){return e.edge(t).weight}}}function _i(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,E(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return E(e.nodes(),i),t}function vi(e){E(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=ii(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function yi(e){var t=new O().setGraph(e.graph());return E(e.nodes(),function(n){t.setNode(n,e.node(n))}),E(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 bi(e){var t=new O({multigraph:e.isMultigraph()}).setGraph(e.graph());return E(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),E(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function xi(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(Ti(e)+1),function(){return[]});return E(e.nodes(),function(n){var r=e.node(n),i=r.rank;D(i)||(t[i][r.order]=n)}),t}function Si(e){var t=G(H(e.nodes(),function(t){return e.node(t).rank}));E(e.nodes(),function(n){var r=e.node(n);gr(r,`rank`)&&(r.rank-=t)})}function Ci(e){var t=G(H(e.nodes(),function(t){return e.node(t).rank})),n=[];E(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;E(n,function(t,n){D(t)&&n%i!==0?--r:r&&E(t,function(t){e.node(t).rank+=r})})}function wi(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 Ti(e){return W(H(e.nodes(),function(t){var n=e.node(t).rank;if(!D(n))return n}))}function Ei(e,t){var n={lhs:[],rhs:[]};return E(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Di(e,t){var n=Zn();try{return t()}finally{console.log(e+` time: `+(Zn()-n)+`ms`)}}function Oi(e,t){return t()}function ki(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&E(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)Ai(e,`borderLeft`,`_bl`,n,i,a),Ai(e,`borderRight`,`_br`,n,i,a)}}E(e.children(),t)}function Ai(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 ji(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&Ni(e)}function Mi(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&Fi(e),(t===`lr`||t===`rl`)&&(Li(e),Ni(e))}function Ni(e){E(e.nodes(),function(t){Pi(e.node(t))}),E(e.edges(),function(t){Pi(e.edge(t))})}function Pi(e){var t=e.width;e.width=e.height,e.height=t}function Fi(e){E(e.nodes(),function(t){Ii(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);E(n.points,Ii),Object.prototype.hasOwnProperty.call(n,`y`)&&Ii(n)})}function Ii(e){e.y=-e.y}function Li(e){E(e.nodes(),function(t){Ri(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);E(n.points,Ri),Object.prototype.hasOwnProperty.call(n,`x`)&&Ri(n)})}function Ri(e){var t=e.x;e.x=e.y,e.y=t}function zi(e){e.graph().dummyChains=[],E(e.edges(),function(t){Bi(e,t)})}function Bi(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=0;for(++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 Vi(e){E(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 Hi(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}E(e.sources(),n)}function Z(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function Ui(e){var t=new O({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;Wi(t,e)<r;)i=Gi(t,e),a=t.hasNode(i.v)?Z(e,i):-Z(e,i),Ki(t,e,a);return t}function Wi(e,t){function n(r){E(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 E(e.nodes(),n),e.nodeCount()}function Gi(e,t){return Sr(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return Z(t,n)})}function Ki(e,t,n){E(e.nodes(),function(e){t.node(e).rank+=n})}ne(1),ne(1),qi.CycleException=Q;function qi(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,E(e.predecessors(a),i),delete n[a],r.push(a))}if(E(e.sinks(),i),ni(t)!==e.nodeCount())throw new Q;return r}function Q(){}Q.prototype=Error();function Ji(e,t,n){y(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return E(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);Yi(e,t,n===`post`,a,r,i)}),i}function Yi(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),E(i(t),function(t){Yi(e,t,n,r,i,a)}),n&&a.push(t))}function Xi(e,t){return Ji(e,t,`post`)}function Zi(e,t){return Ji(e,t,`pre`)}$.initLowLimValues=ta,$.initCutValues=Qi,$.calcCutValue=ea,$.leaveEdge=ra,$.enterEdge=ia,$.exchangeEdges=aa;function $(e){e=yi(e),Hi(e);var t=Ui(e);ta(t),Qi(t,e);for(var n,r;n=ra(t);)r=ia(t,e,n),aa(t,e,n,r)}function Qi(e,t){var n=Xi(e,e.nodes());n=n.slice(0,n.length-1),E(n,function(n){$i(e,t,n)})}function $i(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=ea(e,t,n)}function ea(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,E(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,sa(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function ta(e,t){arguments.length<2&&(t=e.nodes()[0]),na(e,{},1,t)}function na(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,E(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=na(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function ra(e){return lr(e.edges(),function(t){return e.edge(t).cutvalue<0})}function ia(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),Sr(S(t.edges(),function(t){return c===ca(e,e.node(t.v),s)&&c!==ca(e,e.node(t.w),s)}),function(e){return Z(t,e)})}function aa(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),ta(e),Qi(e,t),oa(e,t)}function oa(e,t){var n=Zi(e,lr(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),E(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 sa(e,t,n){return e.hasEdge(t,n)}function ca(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function la(e){switch(e.graph().ranker){case`network-simplex`:fa(e);break;case`tight-tree`:da(e);break;case`longest-path`:ua(e);break;default:fa(e)}}var ua=Hi;function da(e){Hi(e),Ui(e)}function fa(e){$(e)}function pa(e){var t=Y(e,`root`,{},`_root`),n=ha(e),r=W(w(n))-1,i=2*r+1;e.graph().nestingRoot=t,E(e.edges(),function(t){e.edge(t).minlen*=i});var a=ga(e)+1;E(e.children(),function(o){ma(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function ma(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});else{var c=wi(e,`_bt`),l=wi(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,E(s,function(s){ma(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 ha(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&E(a,function(e){n(e,i+1)}),t[r]=i}return E(e.children(),function(e){n(e,1)}),t}function ga(e){return T(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function _a(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,E(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function va(e,t,n){var r={},i;E(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 ya(e,t,n){var r=ba(e),i=new O({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return E(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),E(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=D(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 ba(e){for(var t;e.hasNode(t=ii(`_root`)););return t}function xa(e,t){for(var n=0,r=1;r<t.length;++r)n+=Sa(e,t[r-1],t[r]);return n}function Sa(e,t,n){for(var r=oi(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 E(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 Ca(e){var t={},n=S(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){gr(t,n)||(t[n]=!0,r[e.node(n).rank].push(n),E(e.successors(n),i))}var a=J(n,function(t){return e.node(t).rank});return E(a,i),r}function wa(e,t){return H(t,function(t){var n=e.inEdges(t);if(n.length){var r=T(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}}return{v:t}})}function Ta(e,t){var n={};return E(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};D(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),E(t.edges(),function(e){var t=n[e.v],r=n[e.w];!D(t)&&!D(r)&&(r.indegree++,t.out.push(n[e.w]))}),Ea(S(n,function(e){return!e.indegree}))}function Ea(e){var t=[];function n(e){return function(t){t.merged||(D(t.barycenter)||D(e.barycenter)||t.barycenter>=e.barycenter)&&Da(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),E(i.in.reverse(),n(i)),E(i.out,r(i))}return H(S(t,function(e){return!e.merged}),function(e){return K(e,[`vs`,`i`,`barycenter`,`weight`])})}function Da(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 Oa(e,t){var n=Ei(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(Aa(!!t)),c=ka(a,i,c),E(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=ka(a,i,c)});var l={vs:R(a)};return s&&(l.barycenter=o/s,l.weight=s),l}function ka(e,t,n){for(var r;t.length&&(r=V(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Aa(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 ja(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=S(i,function(e){return e!==o&&e!==s}));var l=wa(e,i);E(l,function(t){if(e.children(t.v).length){var i=ja(e,t.v,n,r);c[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&Na(t,i)}});var u=Ta(l,n);Ma(u,c);var d=Oa(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){E(e,function(e){e.vs=R(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function Na(e,t){D(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 Pa(e){var t=Ti(e),n=Fa(e,q(1,t+1),`inEdges`),r=Fa(e,q(t-1,-1,-1),`outEdges`),i=Ca(e);La(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){Ia(s%2?n:r,s%4>=2),i=X(e);var l=xa(e,i);l<a&&(c=0,o=Xn(i),a=l)}La(e,o)}function Fa(e,t,n){return H(t,function(t){return ya(e,t,n)})}function Ia(e,t){var n=new O;E(e,function(e){var r=e.graph().root,i=ja(e,r,n,t);E(i.vs,function(t,n){e.node(t).order=n}),va(e,n,i.vs)})}function La(e,t){E(t,function(t){E(t,function(t,n){e.node(t).order=n})})}function Ra(e){var t=Ba(e);E(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=za(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 za(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 Ba(e){var t={},n=0;function r(i){var a=n;E(e.children(i),r),t[i]={low:a,lim:n++}}return E(e.children(),r),t}function Va(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=V(r);return E(r,function(t,c){var l=Ua(e,t),u=l?e.node(l).order:o;(l||t===s)&&(E(r.slice(a,c+1),function(t){E(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Wa(n,r,t)})}),a=c+1,i=u)}),r}return T(t,r),n}function Ha(e,t){var n={};function r(t,r,i,a,o){var s;E(q(r,i),function(r){s=t[r],e.node(s).dummy&&E(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Wa(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return E(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 T(t,i),n}function Ua(e,t){if(e.node(t).dummy)return lr(e.predecessors(t),function(t){return e.node(t).dummy})}function Wa(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 Ga(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function Ka(e,t,n,r){var i={},a={},o={};return E(t,function(e){E(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),E(t,function(e){var t=-1;E(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]&&!Ga(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function qa(e,t,n,r,i){var a={},o=Ja(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)),E(r,function(e){a[e]=a[n[e]]}),a}function Ja(e,t,n,r){var i=new O,a=e.graph(),o=$a(a.nodesep,a.edgesep,r);return E(t,function(t){var r;E(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 Ya(e,t){return Sr(w(t),function(t){var n=-1/0,r=1/0;return dr(t,function(t,i){var a=eo(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function Xa(e,t){var n=w(t),r=G(n),i=W(n);E([`u`,`d`],function(n){E([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=w(s);c=a===`l`?r-G(l):i-W(l),c&&(e[o]=U(s,function(e){return e+c}))}})})}function Za(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 Qa(e){var t=X(e),n=xr(Va(e,t),Ha(e,t)),r={},i;return E([`u`,`d`],function(a){i=a===`u`?t:w(t).reverse(),E([`l`,`r`],function(t){t===`r`&&(i=H(i,function(e){return w(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=Ka(e,i,n,o),c=qa(e,i,s.root,s.align,t===`r`);t===`r`&&(c=U(c,function(e){return-e})),r[a+t]=c})}),Xa(r,Ya(e,r)),Za(r,e.graph().align)}function $a(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}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}return l&&(c+=n?l:-l),l=0,c}}function eo(e,t){return e.node(t).width}function to(e){e=bi(e),no(e),fr(Qa(e),function(t,n){e.node(n).x=t})}function no(e){var t=X(e),n=e.graph().ranksep,r=0;E(t,function(t){var i=W(H(t,function(t){return e.node(t).height}));E(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function ro(e,t){var n=t&&t.debugTiming?Di:Oi;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>ho(e));n(` runLayout`,()=>io(t,n)),n(` updateInputGraph`,()=>ao(e,t))})}function io(e,t){t(` makeSpaceForEdgeLabels`,()=>go(e)),t(` removeSelfEdges`,()=>To(e)),t(` acyclic`,()=>gi(e)),t(` nestingGraph.run`,()=>pa(e)),t(` rank`,()=>la(bi(e))),t(` injectEdgeLabelProxies`,()=>_o(e)),t(` removeEmptyRanks`,()=>Ci(e)),t(` nestingGraph.cleanup`,()=>_a(e)),t(` normalizeRanks`,()=>Si(e)),t(` assignRankMinMax`,()=>vo(e)),t(` removeEdgeLabelProxies`,()=>yo(e)),t(` normalize.run`,()=>zi(e)),t(` parentDummyChains`,()=>Ra(e)),t(` addBorderSegments`,()=>ki(e)),t(` order`,()=>Pa(e)),t(` insertSelfEdges`,()=>Eo(e)),t(` adjustCoordinateSystem`,()=>ji(e)),t(` position`,()=>to(e)),t(` positionSelfEdges`,()=>Do(e)),t(` removeBorderNodes`,()=>wo(e)),t(` normalize.undo`,()=>Vi(e)),t(` fixupEdgeLabelCoords`,()=>So(e)),t(` undoCoordinateSystem`,()=>Mi(e)),t(` translateGraph`,()=>bo(e)),t(` assignNodeIntersects`,()=>xo(e)),t(` reversePoints`,()=>Co(e)),t(` acyclic.undo`,()=>vi(e))}function ao(e,t){E(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))}),E(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 oo=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],so={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},co=[`acyclicer`,`ranker`,`rankdir`,`align`],lo=[`width`,`height`],uo={width:0,height:0},fo=[`minlen`,`weight`,`width`,`height`,`labeloffset`],po={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},mo=[`labelpos`];function ho(e){var t=new O({multigraph:!0,compound:!0}),n=ko(e.graph());return t.setGraph(xr({},so,Oo(n,oo),K(n,co))),E(e.nodes(),function(n){var r=ko(e.node(n));t.setNode(n,er(Oo(r,lo),uo)),t.setParent(n,e.parent(n))}),E(e.edges(),function(n){var r=ko(e.edge(n));t.setEdge(n,xr({},po,Oo(r,fo),K(r,mo)))}),t}function go(e){var t=e.graph();t.ranksep/=2,E(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 _o(e){E(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 vo(e){var t=0;E(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 yo(e){E(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function bo(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)}E(e.nodes(),function(t){c(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,E(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),E(e.edges(),function(n){var i=e.edge(n);E(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 xo(e){E(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(xi(r,a)),n.points.push(xi(i,o))})}function So(e){E(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}})}function Co(e){E(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function wo(e){E(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}}),E(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function To(e){E(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 Eo(e){var t=X(e);E(t,function(t){var n=0;E(t,function(t,r){var i=e.node(t);i.order=r+n,E(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 Do(e){E(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 Oo(e,t){return U(K(e,t),Number)}function ko(e){var t={};return E(e,function(e,n){t[n.toLowerCase()]=e}),t}var Ao=e((e,t,n)=>Math.max(t,Math.min(n,e)),`clamp`),jo=e((e=`TB`)=>{switch(e){case`BT`:return`bottom`;case`LR`:return`right`;case`RL`:return`left`;default:return`top`}},`getDefaultSelfLoopSide`),Mo=e(e=>e===`flowchart`||e===`flowchart-v2`||e===`stateDiagram`||e===`er`||e===`classDiagram`,`shouldMergeSelfLoopSegments`),No=[`x`,`y`,`width`,`height`,`labelBBox`,`intersect`,`calcIntersect`,`diff`,`clusterNode`],Po=e((e,t,n,r,i)=>{let a=[],o=new Set;if(n.forEach(({start:e,end:t})=>{e!==r&&o.add(e),t!==r&&o.add(t)}),o.forEach(t=>{let n=e.node(t);typeof n?.x==`number`&&typeof n?.y==`number`&&a.push(n)}),a.length===0&&n.forEach(({edge:e})=>{(e.points??[]).forEach(e=>{typeof e?.x==`number`&&typeof e?.y==`number`&&a.push(e)})}),a.length===0)return jo(i);let s=a.reduce((e,t)=>({x:e.x+t.x/a.length,y:e.y+t.y/a.length}),{x:0,y:0}),c=s.x-t.x,l=s.y-t.y;return Math.abs(c)>Math.abs(l)?c>0?`right`:`left`:Math.abs(l)>0?l>0?`bottom`:`top`:jo(i)},`getSelfLoopSide`),Fo=e((e,t=`top`,n=0,r=0)=>{let i=e.x,a=e.y-n,o=e.width/2,s=e.height/2,c=Math.max(36,Math.min(100,e.width*.8)),l=Ao(Math.max(r,e.width*.35),36,c),u=Ao(Math.min(e.width,e.height)*.45,24,48);switch(t){case`bottom`:{let e=a+s;return[{x:i-l/2,y:e},{x:i-l/2,y:e+u},{x:i+l/2,y:e+u},{x:i+l/2,y:e}]}case`right`:{let e=i+o;return[{x:e,y:a-l/2},{x:e+u,y:a-l/2},{x:e+u,y:a+l/2},{x:e,y:a+l/2}]}case`left`:{let e=i-o;return[{x:e,y:a-l/2},{x:e-u,y:a-l/2},{x:e-u,y:a+l/2},{x:e,y:a+l/2}]}default:{let e=a-s;return[{x:i-l/2,y:e},{x:i-l/2,y:e-u},{x:i+l/2,y:e-u},{x:i+l/2,y:e}]}}},`getSelfLoopPoints`),Io=e((e,t,n=`top`,r=0,i={})=>{let a=e.x,o=e.y-r,s=i.width??0,c=i.height??0;switch(n){case`bottom`:return{x:a,y:Math.max(...t.map(e=>e.y))+c/2+4};case`right`:return{x:Math.max(...t.map(e=>e.x))+s/2+4,y:o};case`left`:return{x:Math.min(...t.map(e=>e.x))-s/2-4,y:o};default:return{x:a,y:Math.min(...t.map(e=>e.y))-c/2-4}}},`getSelfLoopLabelPosition`),Lo=e((e,t=0,{mergeSelfLoops:n=!0}={})=>{let r=new Map,i=[],a=e.graph()?.rankdir;return e.edges().forEach(t=>{let a=e.edge(t);if(n&&a.selfLoop){let e=a.selfLoop.id;r.has(e)||r.set(e,[]),r.get(e).push({edge:a,start:t.v,end:t.w})}else i.push({edge:a,start:t.v,end:t.w})}),r.forEach(n=>{if(n.length!==3){n.forEach(e=>i.push(e));return}n.sort((e,t)=>e.edge.selfLoop.order-t.edge.selfLoop.order);let[r,o,s]=n,c=r.edge.originalEdge??o.edge.originalEdge??s.edge.originalEdge??o.edge,l=e.node(c.start);if(!l){n.forEach(e=>i.push(e));return}let u={width:o.edge.width,height:o.edge.height},d=Po(e,l,n,c.start,a),f=Fo(l,d,t,u.width??0),p=Io(l,f,d,t,u),m={...o.edge,...c,id:c.id,points:f,start:c.start,end:c.end,x:p.x,y:p.y,width:u.width,height:u.height,labelStyle:o.edge.labelStyle,fromCluster:r.edge.fromCluster??o.edge.fromCluster??s.edge.fromCluster,toCluster:r.edge.toCluster??o.edge.toCluster??s.edge.toCluster};delete m.selfLoop,delete m.originalEdge,i.push({edge:m,start:m.start,end:m.end})}),i},`getEdgesToRender`),Ro=e(async({element:n,graph:a,diagramType:c,id:l,parentCluster:u,siteConfig:d})=>{let f=a.graph().rankdir;t.trace(`Dir in recursive render - dir:`,f);let{clusters:p,edgePaths:m,edgeLabels:h,nodes:g,rootGroups:ee}=ze(n,{edgePathsClass:`edgePaths`});a.nodes()?t.info(`Recursive render XXX`,a.nodes()):t.info(`No nodes found for`,a),a.edges().length>0&&t.info(`Recursive edges`,a.edge(a.edges()[0]));let _=Mo(c);await Promise.all(a.nodes().map(async function(e){let n=a.node(e);if(u!==void 0){let n=JSON.parse(JSON.stringify(u.clusterData));t.trace(`Setting data for parent cluster XXX
2
2
  Node.id = `,e,`
3
3
  data=`,n.height,`
4
4
  Parent cluster`,u.height),a.setNode(u.id,n),a.parent(e)||(t.trace(`Setting parent`,e,u.id),a.setParent(e,u.id,n))}if(t.info(`(Insert) Node XXX`+e+`: `+JSON.stringify(a.node(e))),n?.clusterNode){t.info(`Cluster identified XBX`,e,n.width,a.node(e));let{ranksep:o,nodesep:s}=a.graph();n.graph.setGraph({...n.graph.graph(),ranksep:o+25,nodesep:s});let u=await Go({element:g,graph:n.graph,diagramType:c,id:l,parentCluster:a.node(e),siteConfig:d}),f=u.elem;r(n,f),n.diff=u.diff||0,t.info(`New compound node after recursive render XAX`,e,`width`,n.width,`height`,n.height),i(f,n)}else a.children(e).length>0?(t.trace(`Cluster - the non recursive path XBX`,e,n.id,n,n.width,`Graph:`,a),t.trace(Be(n.id,a)),j.set(n.id,{id:Be(n.id,a),node:n})):(t.trace(`Node - the non recursive path XAX`,e,g,a.node(e),f),await He(g,a.node(e),{config:d,dir:f}))})),await e(async()=>{let e=a.edges().map(async function(e){let n=a.edge(e.v,e.w,e.name);if(t.info(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(e)),t.info(`Edge `+e.v+` -> `+e.w+`: `,e,` `,JSON.stringify(a.edge(e))),t.info(`Fix`,j,`ids:`,e.v,e.w,`Translating: `,j.get(e.v),j.get(e.w)),_&&n.selfLoop){if(n.selfLoop.order!==1)return;let e={...n.originalEdge,...n,id:n.selfLoop.id,startLabelLeft:n.originalEdge?.startLabelLeft??n.startLabelLeft,startLabelRight:n.originalEdge?.startLabelRight??n.startLabelRight,endLabelLeft:n.originalEdge?.endLabelLeft??n.endLabelLeft,endLabelRight:n.originalEdge?.endLabelRight??n.endLabelRight};await s(h,e),n.width=e.width,n.height=e.height,n.labelStyle=e.labelStyle}else await s(h,n)});await Promise.all(e)},`processEdges`)();let{subGraphTitleTotalMargin:te}=o(d);return{elem:ee,graph:a,groups:{clusters:p,edgePaths:m,edgeLabels:h,nodes:g,rootGroups:ee},diagramType:c,id:l,mergeSelfLoops:_,subGraphTitleTotalMargin:te}},`measureDagreGraph`),zo=e(e=>{t.info(`############################################# XXX`),t.info(`### Layout ### XXX`),t.info(`############################################# XXX`),ro(e)},`runDagreGraphLayout`),Bo=e((e,t,n)=>{let r=e.node(t);if(!r)return;let i={...r};return r?.clusterNode?i.y=(r.y??0)+n:e.children(t).length>0?i.height=(r.height??0)+n:i.y=(r.y??0)+n/2,i},`normalizeDagreNode`),Vo=e((e,t)=>{No.forEach(n=>{t[n]!==void 0&&(e[n]=t[n])})},`applyDagreNodeLayout`),Ho=e((e,t,n,r)=>({...e,start:e.start??t,end:e.end??n,points:(e.points??[]).map(e=>({...e,y:typeof e.y==`number`?e.y+r:e.y}))}),`normalizeDagreEdge`),Uo=e((e,t)=>{let{graph:n,mergeSelfLoops:r,subGraphTitleTotalMargin:i=0}=t,a=new Map(e.nodes.map(e=>[e.id,e]));Re(n).forEach(e=>{let t=Bo(n,e,i);if(!t)return;Vo(n.node(e),t);let r=a.get(e);r&&Vo(r,t)});let o=i/2;return e.edges=Lo(n,o,{mergeSelfLoops:r}).map(({edge:e,start:t,end:n})=>Ho(e,t,n,o)),e},`applyDagreLayoutResult`),Wo=e(async({elem:e,graph:n,groups:{clusters:r,edgePaths:i},diagramType:o,id:s,mergeSelfLoops:u,subGraphTitleTotalMargin:d})=>{let f=0;await Promise.all(Re(n).map(async function(e){let i=n.node(e);if(t.info(`Position XBX => `+e+`: (`+i.x,`,`+i.y,`) width: `,i.width,` height: `,i.height),i?.clusterNode)i.y+=d,t.info(`A tainted cluster node XBX1`,e,i.id,i.width,i.height,i.x,i.y,n.parent(e)),j.get(i.id).node=i,a(i);else if(n.children(e).length>0){t.info(`A pure cluster node XBX1`,e,i.id,i.x,i.y,i.width,i.height,n.parent(e)),i.height+=d,n.node(i.parentId);let a=i?.padding/2||0,o=i?.labelBBox?.height||0,s=o-a||0;t.debug(`OffsetY`,s,`labelHeight`,o,`halfPadding`,a),await Le(r,i),j.get(i.id).node=i}else{let e=n.node(i.parentId);i.y+=d/2,t.info(`A regular node XBX1 - using the padding`,i.id,`parent`,i.parentId,i.width,i.height,i.x,i.y,`offsetY`,i.offsetY,`parent`,e,e?.offsetY,i),a(i)}}));let p=d/2;return Lo(n,p,{mergeSelfLoops:u}).forEach(function({edge:e,start:r,end:a}){t.info(`Edge `+r+` -> `+a+`: `+JSON.stringify(e),e),e.points.forEach(e=>e.y+=p);let u=n.node(r),d=n.node(a),f=c(i,e,j,o,u,d,s);l(e,f)}),n.nodes().forEach(function(e){let r=n.node(e);t.info(e,r.type,r.diff),r.isGroup&&(f=r.diff)}),t.warn(`Returning from recursive render XAX`,e,f),{elem:e,diff:f}},`paintDagreLayoutCore`),Go=e(async e=>{let t=await Ro(e);return zo(t.graph),await Wo(t)},`renderDagreSubgraph`),Ko=e(e=>{let n=new O({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.nodeSpacing||e.config?.flowchart?.nodeSpacing,ranksep:e.config?.rankSpacing||e.rankSpacing||e.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return e.nodes.forEach(e=>{n.setNode(e.id,{...e}),e.parentId&&n.setParent(e.id,e.parentId)}),t.debug(`Edges:`,e.edges),e.edges.forEach(e=>{if(e.start===e.end){let t=e.start,r=t+`---`+t+`---1`,i=t+`---`+t+`---2`,a=n.node(t);n.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:``,label:``,padding:0,shape:`labelRect`,style:``,width:10,height:10}),n.setParent(r,a.parentId),n.setNode(i,{domId:i,id:i,parentId:a.parentId,labelStyle:``,padding:0,shape:`labelRect`,label:``,style:``,width:10,height:10}),n.setParent(i,a.parentId);let o=structuredClone(e),s=structuredClone(e),c=structuredClone(e),l=structuredClone(e);s.originalEdge=o,s.selfLoop={id:o.id,order:0},c.originalEdge=o,c.selfLoop={id:o.id,order:1},l.originalEdge=o,l.selfLoop={id:o.id,order:2},s.label=``,s.arrowTypeEnd=`none`,s.endLabelLeft=``,s.endLabelRight=``,s.startLabelLeft=``,s.id=t+`-cyclic-special-1`,c.startLabelRight=``,c.startLabelLeft=``,c.endLabelLeft=``,c.endLabelRight=``,c.arrowTypeStart=`none`,c.arrowTypeEnd=`none`,c.id=t+`-cyclic-special-mid`,l.label=``,l.startLabelRight=``,l.startLabelLeft=``,l.arrowTypeStart=`none`,a.isGroup&&(s.fromCluster=t,l.toCluster=t),l.id=t+`-cyclic-special-2`,l.arrowTypeStart=`none`,n.setEdge(t,r,s,t+`-cyclic-special-0`),n.setEdge(r,i,c,t+`-cyclic-special-1`),n.setEdge(i,t,l,t+`-cyclic-special-2`)}else n.setEdge(e.start,e.end,{...e},e.id)}),Ue(n),{graph:n}},`prepareLayoutForDagre`),qo=e(async(e,{element:t,preparedLayout:r})=>{let i=r??Ko(e),a=n(),o=await Ro({element:t,graph:i.graph,diagramType:e.type,id:e.diagramId,parentCluster:void 0,siteConfig:a});return i.measuredLayout=o,o},`measureDagreLayout`),Jo=e((e,t)=>{let n=t.preparedLayout?.measuredLayout;if(!n)throw Error(`runDagreLayoutCore requires measureDagreLayout to run first`);return zo(n.graph),Uo(e,n),n},`runDagreLayoutCore`),Yo=Ve({prepareLayout:Ko,measureLayout:qo,runLayoutCore:Jo,paintOptions:{clusterDb:j,getNodes:e((e,{measure:t})=>Re(t.graph).map(e=>t.graph.node(e)).filter(Boolean),`getDagrePaintNodes`),getEdgeNode:e((e,t,{measure:n})=>e?n.graph.node(e):void 0,`getDagreEdgeNode`),skipNode:e((e,{measure:t})=>!t.graph.hasNode(e.id),`skipNode`),isCluster:e((e,{measure:t})=>t.graph.hasNode(e.id)&&(t.graph.children(e.id)??[]).length>0,`isCluster`)}});export{Uo as applyDagreLayoutResult,Lo as getEdgesToRender,qo as measureDagreLayout,Ko as prepareLayoutForDagre,Yo as render,Jo as runDagreLayoutCore};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-XUq3kRg7.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n,p as r}from"./src-w1h_Rr-8.js";import{C as i,E as a,H as o,U as s,_ as c,a as l,c as u,f as d,q as f,v as p,y as m}from"./chunk-DSNLSHJZ-CwfiRg01.js";import{t as h}from"./ordinal-BDEzSJ7C.js";import{t as g}from"./defaultLocale-BFoDCU3G.js";import{i as _}from"./chunk-7S6XSTFO-CN1GsbIT.js";import{t as v}from"./chunk-JWPE2WC7-DVXcaiue.js";import{i as y,n as b}from"./chunk-UHW7PFBP-CC1DKtp5.js";import{t as x}from"./chunk-VQ5W62QI-CWY0eXsE.js";import{a as S}from"./mermaid.core-KP0iScKW.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 ee(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 te(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 ne(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 re=(1+Math.sqrt(5))/2;function ie(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?te(c,n,r,i,h?r+=m*g/h:a):ne(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var ae=(function e(t){function n(e,n,r,i,a){ie(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(re);function oe(){var e=ae,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(ee),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 J=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=s,this.getAccTitle=p,this.setDiagramTitle=f,this.getDiagramTitle=i,this.getAccDescription=c,this.setAccDescription=o}static{t(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let e=d,t=m();return _({...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=>{b(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(){l(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function Y(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}t(Y,`buildHierarchy`);var se=t((e,n)=>{v(e,n);let r=[];for(let t of e.TreemapRows??[])t.$type===`ClassDefStatement`&&n.addClass(t.className??``,t.styleText??``);for(let t of e.TreemapRows??[]){let e=t.item;if(!e)continue;let i=t.indent?parseInt(t.indent):0,a=ce(e),o=e.classSelector?n.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};r.push(c)}let i=Y(r),a=t((e,t)=>{for(let r of e)n.addNode(r,t),r.children&&r.children.length>0&&a(r.children,t+1)},`addNodesRecursively`);a(i,0)},`populate`),ce=t(e=>e.name?String(e.name):``,`getItemName`),X={parser:{yy:void 0},parse:t(async t=>{try{let r=await e(`treemap`,t);n.debug(`Treemap AST:`,r);let i=X.parser?.yy;if(!(i instanceof J))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.`);se(r,i)}catch(e){throw n.error(`Error parsing treemap:`,e),e}},`parse`)},Z=10,Q=10,$=25,le={draw:t((e,i,a,o)=>{let s=o.db,c=s.getConfig(),l=c.padding??Z,d=s.getDiagramTitle(),f=s.getRoot(),{themeVariables:p}=m();if(!f)return;let _=d?30:0,v=S(i),b=c.nodeWidth?c.nodeWidth*Q:960,C=c.nodeHeight?c.nodeHeight*Q:500,w=b,T=C+_;v.attr(`viewBox`,`0 0 ${w} ${T}`),u(v,T,w,c.useMaxWidth);let E;try{let e=c.valueFormat||`,`;if(e===`$0,0`)E=t(e=>`$`+g(`,`)(e),`valueFormat`);else if(e.startsWith(`$`)&&e.includes(`,`)){let n=/\.\d+/.exec(e),r=n?n[0]:``;E=t(e=>`$`+g(`,`+r)(e),`valueFormat`)}else if(e.startsWith(`$`)){let n=e.substring(1);E=t(e=>`$`+g(n||``)(e),`valueFormat`)}else E=g(e)}catch(e){n.error(`Error creating format function:`,e),E=g(`,`)}let D=h().range([`transparent`,p.cScale0,p.cScale1,p.cScale2,p.cScale3,p.cScale4,p.cScale5,p.cScale6,p.cScale7,p.cScale8,p.cScale9,p.cScale10,p.cScale11]),O=h().range([`transparent`,p.cScalePeer0,p.cScalePeer1,p.cScalePeer2,p.cScalePeer3,p.cScalePeer4,p.cScalePeer5,p.cScalePeer6,p.cScalePeer7,p.cScalePeer8,p.cScalePeer9,p.cScalePeer10,p.cScalePeer11]),k=h().range([p.cScaleLabel0,p.cScaleLabel1,p.cScaleLabel2,p.cScaleLabel3,p.cScaleLabel4,p.cScaleLabel5,p.cScaleLabel6,p.cScaleLabel7,p.cScaleLabel8,p.cScaleLabel9,p.cScaleLabel10,p.cScaleLabel11]);d&&v.append(`text`).attr(`x`,w/2).attr(`y`,_/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(d);let A=v.append(`g`).attr(`transform`,`translate(0, ${_})`).attr(`class`,`treemapContainer`),j=R(f).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=oe().size([b,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(l).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-${i}-${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=y({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-${i}-${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;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=r(this),n=e.data.name;t.text(n);let i=e.x1-e.x0,a;a=c.showValues!==!1&&e.value?i-10-30-10-6:i-6-6;let o=Math.max(15,a),s=t.node();if(s.getComputedTextLength()>o){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),s.getComputedTextLength()>o&&t.text(``);break}if(t.text(e+`...`),s.getComputedTextLength()<=o)break}}}),c.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;`+y({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=>y({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-${i}-${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)+`;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.data.name).each(function(e){let t=r(this),n=e.x1-e.x0,i=e.y1-e.y0,a=t.node(),o=n-2*H,s=i-2*H;if(o<U||s<U){t.style(`display`,`none`);return}let c=parseInt(t.style(`font-size`),10),l=.6;for(;a.getComputedTextLength()>o&&c>B;)c--,t.style(`font-size`,`${c}px`);let u=Math.max(V,Math.min(z,Math.round(c*l))),d=c+W+u;for(;d>s&&c>B&&(c--,u=Math.max(V,Math.min(z,Math.round(c*l))),!(u<V&&c===B));)t.style(`font-size`,`${c}px`),d=c+W+u;t.style(`font-size`,`${c}px`),I?(c<B||s<B)&&t.style(`display`,`none`):(a.getComputedTextLength()>o||c<B||s<c)&&t.style(`display`,`none`)}),c.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)+`;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let t=r(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let i=r(n).select(`.treemapLabel`);if(i.empty()||i.style(`display`)===`none`){t.style(`display`,`none`);return}let a=parseFloat(i.style(`font-size`)),o=Math.max(V,Math.min(z,Math.round(a*.6)));t.style(`font-size`,`${o}px`);let s=(e.y1-e.y0)/2+a/2+W;t.attr(`y`,s);let c=e.x1-e.x0,l=e.y1-e.y0-4,u=c-2*H;t.node().getComputedTextLength()>u||s+o>l||o<V?t.style(`display`,`none`):t.style(`display`,null)});let K=c.diagramPadding??8;x(v,K,`flowchart`,c?.useMaxWidth||!1)},`draw`),getClasses:t(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:X,get db(){return new J},renderer:le,styles:t(({treemap:e}={})=>{let t=a(),n=m(),r=_(t,n.themeVariables),i=_(ue,e),o=i.titleColor??r.titleColor,s=i.labelColor??r.textColor,c=i.valueColor??r.textColor;return`
1
+ import{n as e}from"./mermaid-parser.core-CRHYFOhU.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n,p as r}from"./src-DWy4o1sh.js";import{C as i,E as a,H as o,U as s,_ as c,a as l,c as u,f as d,q as f,v as p,y as m}from"./chunk-DSNLSHJZ-6EnWiUHw.js";import{t as h}from"./ordinal-BDEzSJ7C.js";import{t as g}from"./defaultLocale-BFoDCU3G.js";import{i as _}from"./chunk-7S6XSTFO-C_2BTQ4f.js";import{t as v}from"./chunk-JWPE2WC7-DVXcaiue.js";import{i as y,n as b}from"./chunk-UHW7PFBP-y_Cnbpso.js";import{t as x}from"./chunk-VQ5W62QI-BDGHstYR.js";import{a as S}from"./mermaid.core-C-ITLWC9.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 ee(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 te(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 ne(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 re=(1+Math.sqrt(5))/2;function ie(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?te(c,n,r,i,h?r+=m*g/h:a):ne(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var ae=(function e(t){function n(e,n,r,i,a){ie(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(re);function oe(){var e=ae,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(ee),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 J=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=s,this.getAccTitle=p,this.setDiagramTitle=f,this.getDiagramTitle=i,this.getAccDescription=c,this.setAccDescription=o}static{t(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let e=d,t=m();return _({...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=>{b(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(){l(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function Y(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}t(Y,`buildHierarchy`);var se=t((e,n)=>{v(e,n);let r=[];for(let t of e.TreemapRows??[])t.$type===`ClassDefStatement`&&n.addClass(t.className??``,t.styleText??``);for(let t of e.TreemapRows??[]){let e=t.item;if(!e)continue;let i=t.indent?parseInt(t.indent):0,a=ce(e),o=e.classSelector?n.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};r.push(c)}let i=Y(r),a=t((e,t)=>{for(let r of e)n.addNode(r,t),r.children&&r.children.length>0&&a(r.children,t+1)},`addNodesRecursively`);a(i,0)},`populate`),ce=t(e=>e.name?String(e.name):``,`getItemName`),X={parser:{yy:void 0},parse:t(async t=>{try{let r=await e(`treemap`,t);n.debug(`Treemap AST:`,r);let i=X.parser?.yy;if(!(i instanceof J))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.`);se(r,i)}catch(e){throw n.error(`Error parsing treemap:`,e),e}},`parse`)},Z=10,Q=10,$=25,le={draw:t((e,i,a,o)=>{let s=o.db,c=s.getConfig(),l=c.padding??Z,d=s.getDiagramTitle(),f=s.getRoot(),{themeVariables:p}=m();if(!f)return;let _=d?30:0,v=S(i),b=c.nodeWidth?c.nodeWidth*Q:960,C=c.nodeHeight?c.nodeHeight*Q:500,w=b,T=C+_;v.attr(`viewBox`,`0 0 ${w} ${T}`),u(v,T,w,c.useMaxWidth);let E;try{let e=c.valueFormat||`,`;if(e===`$0,0`)E=t(e=>`$`+g(`,`)(e),`valueFormat`);else if(e.startsWith(`$`)&&e.includes(`,`)){let n=/\.\d+/.exec(e),r=n?n[0]:``;E=t(e=>`$`+g(`,`+r)(e),`valueFormat`)}else if(e.startsWith(`$`)){let n=e.substring(1);E=t(e=>`$`+g(n||``)(e),`valueFormat`)}else E=g(e)}catch(e){n.error(`Error creating format function:`,e),E=g(`,`)}let D=h().range([`transparent`,p.cScale0,p.cScale1,p.cScale2,p.cScale3,p.cScale4,p.cScale5,p.cScale6,p.cScale7,p.cScale8,p.cScale9,p.cScale10,p.cScale11]),O=h().range([`transparent`,p.cScalePeer0,p.cScalePeer1,p.cScalePeer2,p.cScalePeer3,p.cScalePeer4,p.cScalePeer5,p.cScalePeer6,p.cScalePeer7,p.cScalePeer8,p.cScalePeer9,p.cScalePeer10,p.cScalePeer11]),k=h().range([p.cScaleLabel0,p.cScaleLabel1,p.cScaleLabel2,p.cScaleLabel3,p.cScaleLabel4,p.cScaleLabel5,p.cScaleLabel6,p.cScaleLabel7,p.cScaleLabel8,p.cScaleLabel9,p.cScaleLabel10,p.cScaleLabel11]);d&&v.append(`text`).attr(`x`,w/2).attr(`y`,_/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(d);let A=v.append(`g`).attr(`transform`,`translate(0, ${_})`).attr(`class`,`treemapContainer`),j=R(f).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=oe().size([b,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(l).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-${i}-${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=y({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-${i}-${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;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=r(this),n=e.data.name;t.text(n);let i=e.x1-e.x0,a;a=c.showValues!==!1&&e.value?i-10-30-10-6:i-6-6;let o=Math.max(15,a),s=t.node();if(s.getComputedTextLength()>o){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),s.getComputedTextLength()>o&&t.text(``);break}if(t.text(e+`...`),s.getComputedTextLength()<=o)break}}}),c.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;`+y({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=>y({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-${i}-${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)+`;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.data.name).each(function(e){let t=r(this),n=e.x1-e.x0,i=e.y1-e.y0,a=t.node(),o=n-2*H,s=i-2*H;if(o<U||s<U){t.style(`display`,`none`);return}let c=parseInt(t.style(`font-size`),10),l=.6;for(;a.getComputedTextLength()>o&&c>B;)c--,t.style(`font-size`,`${c}px`);let u=Math.max(V,Math.min(z,Math.round(c*l))),d=c+W+u;for(;d>s&&c>B&&(c--,u=Math.max(V,Math.min(z,Math.round(c*l))),!(u<V&&c===B));)t.style(`font-size`,`${c}px`),d=c+W+u;t.style(`font-size`,`${c}px`),I?(c<B||s<B)&&t.style(`display`,`none`):(a.getComputedTextLength()>o||c<B||s<c)&&t.style(`display`,`none`)}),c.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)+`;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let t=r(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let i=r(n).select(`.treemapLabel`);if(i.empty()||i.style(`display`)===`none`){t.style(`display`,`none`);return}let a=parseFloat(i.style(`font-size`)),o=Math.max(V,Math.min(z,Math.round(a*.6)));t.style(`font-size`,`${o}px`);let s=(e.y1-e.y0)/2+a/2+W;t.attr(`y`,s);let c=e.x1-e.x0,l=e.y1-e.y0-4,u=c-2*H;t.node().getComputedTextLength()>u||s+o>l||o<V?t.style(`display`,`none`):t.style(`display`,null)});let K=c.diagramPadding??8;x(v,K,`flowchart`,c?.useMaxWidth||!1)},`draw`),getClasses:t(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:X,get db(){return new J},renderer:le,styles:t(({treemap:e}={})=>{let t=a(),n=m(),r=_(t,n.themeVariables),i=_(ue,e),o=i.titleColor??r.titleColor,s=i.labelColor??r.textColor,c=i.valueColor??r.textColor;return`
2
2
  .treemapNode.section {
3
3
  stroke: ${i.sectionStrokeColor};
4
4
  stroke-width: ${i.sectionStrokeWidth};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-XUq3kRg7.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-w1h_Rr-8.js";import{C as r,H as i,U as a,_ as o,a as s,c,f as l,q as u,v as d,y as f}from"./chunk-DSNLSHJZ-CwfiRg01.js";import{i as p}from"./chunk-7S6XSTFO-CN1GsbIT.js";import{t as m}from"./chunk-JWPE2WC7-DVXcaiue.js";import{a as h}from"./mermaid.core-KP0iScKW.js";var g=l.packet,_=class{constructor(){this.packet=[],this.setAccTitle=a,this.getAccTitle=d,this.setDiagramTitle=u,this.getDiagramTitle=r,this.getAccDescription=o,this.setAccDescription=i}static{t(this,`PacketDB`)}getConfig(){let e=p({...g,...f().packet});return e.showBits&&(e.paddingY+=10),e}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){s(),this.packet=[]}},v=1e4,y=t((e,t)=>{m(e,t);let r=-1,i=[],a=1,{bitsPerRow:o}=t.getConfig();for(let{start:s,end:c,bits:l,label:u}of e.blocks){if(s!==void 0&&c!==void 0&&c<s)throw Error(`Packet block ${s} - ${c} is invalid. End must be greater than start.`);if(s??=r+1,s!==r+1)throw Error(`Packet block ${s} - ${c??s} is not contiguous. It should start from ${r+1}.`);if(l===0)throw Error(`Packet block ${s} is invalid. Cannot have a zero bit field.`);for(c??=s+(l??1)-1,l??=c-s+1,r=c,n.debug(`Packet block ${s} - ${r} with label ${u}`);i.length<=o+1&&t.getPacket().length<v;){let[e,n]=b({start:s,end:c,bits:l,label:u},a,o);if(i.push(e),e.end+1===a*o&&(t.pushWord(i),i=[],a++),!n)break;({start:s,end:c,bits:l,label:u}=n)}}t.pushWord(i)},`populate`),b=t((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:t(async t=>{let r=await e(`packet`,t),i=x.parser?.yy;if(!(i 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.`);n.debug(r),y(r,i)},`parse`)},S=t((e,t,n,r)=>{let i=r.db,a=i.getConfig(),{rowHeight:o,paddingY:s,bitWidth:l,bitsPerRow:u}=a,d=i.getPacket(),f=i.getDiagramTitle(),p=o+s,m=p*(d.length+1)-(f?0:o),g=l*u+2,_=h(t);_.attr(`viewBox`,`0 0 ${g} ${m}`),c(_,m,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(f).attr(`x`,g/2).attr(`y`,m-p/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=t((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c,bitOrder:l})=>{let u=e.append(`g`),d=n*(r+a)+a,f=l===`descending`;for(let e of t){let t=e.end-e.start+1,n=e.start%s,a=(f?s-n-t:n)*o+1,l=t*o-i;if(u.append(`rect`).attr(`x`,a).attr(`y`,d).attr(`width`,l).attr(`height`,r).attr(`class`,`packetBlock`),u.append(`text`).attr(`x`,a+l/2).attr(`y`,d+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let[p,m]=f?[e.end,e.start]:[e.start,e.end],h=t===1,g=d-2;u.append(`text`).attr(`x`,a+(h?l/2:0)).attr(`y`,g).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,h?`middle`:`start`).text(p),h||u.append(`text`).attr(`x`,a+l).attr(`y`,g).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(m)}},`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:t(({packet:e}={})=>{let t=p(T,e);return`
1
+ import{n as e}from"./mermaid-parser.core-CRHYFOhU.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-DWy4o1sh.js";import{C as r,H as i,U as a,_ as o,a as s,c,f as l,q as u,v as d,y as f}from"./chunk-DSNLSHJZ-6EnWiUHw.js";import{i as p}from"./chunk-7S6XSTFO-C_2BTQ4f.js";import{t as m}from"./chunk-JWPE2WC7-DVXcaiue.js";import{a as h}from"./mermaid.core-C-ITLWC9.js";var g=l.packet,_=class{constructor(){this.packet=[],this.setAccTitle=a,this.getAccTitle=d,this.setDiagramTitle=u,this.getDiagramTitle=r,this.getAccDescription=o,this.setAccDescription=i}static{t(this,`PacketDB`)}getConfig(){let e=p({...g,...f().packet});return e.showBits&&(e.paddingY+=10),e}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){s(),this.packet=[]}},v=1e4,y=t((e,t)=>{m(e,t);let r=-1,i=[],a=1,{bitsPerRow:o}=t.getConfig();for(let{start:s,end:c,bits:l,label:u}of e.blocks){if(s!==void 0&&c!==void 0&&c<s)throw Error(`Packet block ${s} - ${c} is invalid. End must be greater than start.`);if(s??=r+1,s!==r+1)throw Error(`Packet block ${s} - ${c??s} is not contiguous. It should start from ${r+1}.`);if(l===0)throw Error(`Packet block ${s} is invalid. Cannot have a zero bit field.`);for(c??=s+(l??1)-1,l??=c-s+1,r=c,n.debug(`Packet block ${s} - ${r} with label ${u}`);i.length<=o+1&&t.getPacket().length<v;){let[e,n]=b({start:s,end:c,bits:l,label:u},a,o);if(i.push(e),e.end+1===a*o&&(t.pushWord(i),i=[],a++),!n)break;({start:s,end:c,bits:l,label:u}=n)}}t.pushWord(i)},`populate`),b=t((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:t(async t=>{let r=await e(`packet`,t),i=x.parser?.yy;if(!(i 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.`);n.debug(r),y(r,i)},`parse`)},S=t((e,t,n,r)=>{let i=r.db,a=i.getConfig(),{rowHeight:o,paddingY:s,bitWidth:l,bitsPerRow:u}=a,d=i.getPacket(),f=i.getDiagramTitle(),p=o+s,m=p*(d.length+1)-(f?0:o),g=l*u+2,_=h(t);_.attr(`viewBox`,`0 0 ${g} ${m}`),c(_,m,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(f).attr(`x`,g/2).attr(`y`,m-p/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=t((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c,bitOrder:l})=>{let u=e.append(`g`),d=n*(r+a)+a,f=l===`descending`;for(let e of t){let t=e.end-e.start+1,n=e.start%s,a=(f?s-n-t:n)*o+1,l=t*o-i;if(u.append(`rect`).attr(`x`,a).attr(`y`,d).attr(`width`,l).attr(`height`,r).attr(`class`,`packetBlock`),u.append(`text`).attr(`x`,a+l/2).attr(`y`,d+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let[p,m]=f?[e.end,e.start]:[e.start,e.end],h=t===1,g=d-2;u.append(`text`).attr(`x`,a+(h?l/2:0)).attr(`y`,g).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,h?`middle`:`start`).text(p),h||u.append(`text`).attr(`x`,a+l).attr(`y`,g).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(m)}},`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:t(({packet:e}={})=>{let t=p(T,e);return`
2
2
  .packetByte {
3
3
  font-size: ${t.byteFontSize};
4
4
  }
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-XUq3kRg7.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-w1h_Rr-8.js";import{C as r,H as i,U as a,_ as o,a as s,c,f as l,q as u,v as d,y as f,z as p}from"./chunk-DSNLSHJZ-CwfiRg01.js";import{i as m}from"./chunk-7S6XSTFO-CN1GsbIT.js";import{t as h}from"./chunk-JWPE2WC7-DVXcaiue.js";import{r as g,t as _}from"./chunk-YZO67HFG-dhkHuKWt.js";import{t as v}from"./chunk-2Q5K7J3B-C1jixKkw.js";import{a as y}from"./mermaid.core-KP0iScKW.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))}t(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}t(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})}t(k,`remapErrorLines`);function A(e){let t=e.split(`
1
+ import{n as e}from"./mermaid-parser.core-CRHYFOhU.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-DWy4o1sh.js";import{C as r,H as i,U as a,_ as o,a as s,c,f as l,q as u,v as d,y as f,z as p}from"./chunk-DSNLSHJZ-6EnWiUHw.js";import{i as m}from"./chunk-7S6XSTFO-C_2BTQ4f.js";import{t as h}from"./chunk-JWPE2WC7-DVXcaiue.js";import{r as g,t as _}from"./chunk-YZO67HFG-O3X4dDhT.js";import{t as v}from"./chunk-2Q5K7J3B-C1jixKkw.js";import{a as y}from"./mermaid.core-C-ITLWC9.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))}t(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}t(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})}t(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===``||T.test(r)||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}}t(A,`preprocessBoxDrawing`);var j=new v(()=>({cnt:1,stack:[{id:0,level:-1,name:`/`,nodeType:`directory`,children:[]}]})),M=t(()=>{j.reset(),s()},`clear`),N=t(()=>j.records.stack[0],`getRoot`),P=t(()=>j.records.cnt,`getCount`),F=l.treeView,I={clear:M,addNode:t((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:t(()=>m(F,f().treeView),`getConfig`),getAccTitle:d,getAccDescription:o,getDiagramTitle:r,setAccDescription:i,setAccTitle:a,setDiagramTitle:u},L=t(e=>{h(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?p(c,f()):void 0;I.addNode(e,n,i,a,s,l)}},`populate`),R={parse:t(async t=>{let{text:r,lineMap:i}=A(t);try{let t=await e(`treeView`,r);n.debug(t),L(t)}catch(e){throw i.size>0&&e instanceof Error&&(e.message=k(e.message,i)),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)]}}t(B,`detectIcon`);function V(e,t){return e.includes(`:`)?e:e in z.icons||!t?`${z.prefix}:${e}`:`${t}:${e}`}t(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`}`}}}t(H,`getNodeIcon`),g([{name:z.prefix,icons:z}]);var U=14,W=4,G=16,K=t(async(e,n)=>{let r=[],i=t(e=>{let t=H(e,n);t&&r.push({icon:t,node:e}),e.children.forEach(i)},`collect`);i(e);let a=await Promise.all(r.map(async({icon:e,node:t})=>({id:t.id,svg:await _(e,{height:U,width:U})})));return new Map(a.map(({id:e,svg:t})=>[e,t]))},`resolveNodeIcons`),q=t((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=t((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=t((e,n,r,i)=>{let a=0,o=0,s=[],c=t((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=t((t,n=0)=>{c(e,t,r,n),t.children.forEach(e=>{l(e,n+1)});let{x:i,y:a,height:o}=t.BBox;if(t.children.length){let{y:n,height:s}=t.children[t.children.length-1].BBox;J(e,i+r.paddingX,a+o,i+r.paddingX,n+s/2+r.lineThickness/2,r.lineThickness)}},`processNode`);l(n);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 n=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+n.width+r.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:t(async(e,t,r,i)=>{n.debug(`Rendering treeView diagram
4
4
  `+e);let a=i.db,o=a.getRoot(),s=a.getConfig(),l=y(t),u=l.append(`g`);u.attr(`class`,`tree-view`);let{totalHeight:d,totalWidth:f}=Y(u,o,s,await K(o,s));l.attr(`viewBox`,`-${s.lineThickness/2} 0 ${f} ${d}`),c(l,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:t(({treeView:e})=>{let{labelFontSize:t,labelColor:n,lineColor:r,iconColor:i,descriptionColor:a,highlightBg:o,highlightStroke:s}=m(Z,e);return`
@@ -1,3 +1,3 @@
1
- import{T as e}from"./chunk-NGNAAXSQ-C2Wy9Xmz.js";import{n as t}from"./mermaid-parser.core-XUq3kRg7.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r,p as i}from"./src-w1h_Rr-8.js";import{C as a,H as o,U as s,X as c,_ as l,a as u,b as d,f,q as p,v as m,y as h,z as g}from"./chunk-DSNLSHJZ-CwfiRg01.js";import{i as ee,t as te,v as _}from"./chunk-7S6XSTFO-CN1GsbIT.js";import{t as ne}from"./chunk-JWPE2WC7-DVXcaiue.js";var v=`position frame`,y=`frame positioned`,b=`position relation`,x=`relation positioned`,re=n(function(e){r.debug(`options str`,e)},`setOptions`),ie=n(function(){return{}},`getOptions`),ae=n(function(){S(),u()},`clear`);function S(){C={}}n(S,`reset`);var oe=f.eventmodeling,se=n(()=>ee({...oe,...h().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((i,a)=>{let o=P(i,t.dataEntities,n);e=J(e,{$kind:v,index:a,frame:i,textProps:o});let s;V(i)?(r.debug(`source frame`,i.sourceFrames),s=t.frames.filter(e=>i.sourceFrames.some(t=>t.$refText===e.name)),s.forEach(t=>{e=J(e,{$kind:b,index:a,frame:i,sourceFrame:t})})):e=J(e,{$kind:b,index:a,frame:i})}),e={...e,sortedSwimlanesArray:R(e.swimlanes)},e}n(w,`getState`);function T(e){C.ast=void 0;let t=new Set;for(let n of e.frames){if(t.has(n.name)){let e=n.$cstNode?.range.start.line,t=e===void 0?``:` on line ${e+1}`;throw Error(`Duplicate event modeling frame ID "${n.name}"${t}`)}t.add(n.name)}C.ast=e}n(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}n(D,`getDiagramProps`);var ce={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function O(e){let t=e.split(`.`);if(t.length===2)return t[0]}n(O,`extractNamespace`);function k(e){let t=e.split(`.`);return t.length===2?t[1]:e}n(k,`extractName`);function A(e,t){if(t&&t.length!==0)return Object.values(e).find(e=>e.namespace===t)}n(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}n(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}}}n(M,`calculateSwimlaneProps`);function N(e){let{themeVariables:t}=h();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`}}}n(N,`calculateEntityVisualProps`);function P(e,t,n){let i=h(),a=g(k(e.entityIdentifier)??``,i),o,s={fontSize:16,fontWeight:700,fontFamily:`"trebuchet ms", verdana, arial, sans-serif`,joinWith:`<br/>`},c=`<b>${_(a,n.textMaxWidth,s)}</b>`;if(e.dataInlineValue&&(o=e.dataInlineValue,o=o.substring(o.indexOf(`{`)+1),o=o.substring(0,o.lastIndexOf(`}`)-1),o=g(o,i),o=_(o,n.textMaxWidth,s),o=o.replaceAll(` `,`&nbsp;`)),e.dataReference){let r=t.find(t=>t.name===e.dataReference?.$refText);r&&(o=r.dataBlockValue,o=o.substring(o.indexOf(`{
1
+ import{T as e}from"./chunk-NGNAAXSQ-C2Wy9Xmz.js";import{n as t}from"./mermaid-parser.core-CRHYFOhU.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r,p as i}from"./src-DWy4o1sh.js";import{C as a,H as o,U as s,X as c,_ as l,a as u,b as d,f,q as p,v as m,y as h,z as g}from"./chunk-DSNLSHJZ-6EnWiUHw.js";import{i as ee,t as te,v as _}from"./chunk-7S6XSTFO-C_2BTQ4f.js";import{t as ne}from"./chunk-JWPE2WC7-DVXcaiue.js";var v=`position frame`,y=`frame positioned`,b=`position relation`,x=`relation positioned`,re=n(function(e){r.debug(`options str`,e)},`setOptions`),ie=n(function(){return{}},`getOptions`),ae=n(function(){S(),u()},`clear`);function S(){C={}}n(S,`reset`);var oe=f.eventmodeling,se=n(()=>ee({...oe,...h().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((i,a)=>{let o=P(i,t.dataEntities,n);e=J(e,{$kind:v,index:a,frame:i,textProps:o});let s;V(i)?(r.debug(`source frame`,i.sourceFrames),s=t.frames.filter(e=>i.sourceFrames.some(t=>t.$refText===e.name)),s.forEach(t=>{e=J(e,{$kind:b,index:a,frame:i,sourceFrame:t})})):e=J(e,{$kind:b,index:a,frame:i})}),e={...e,sortedSwimlanesArray:R(e.swimlanes)},e}n(w,`getState`);function T(e){C.ast=void 0;let t=new Set;for(let n of e.frames){if(t.has(n.name)){let e=n.$cstNode?.range.start.line,t=e===void 0?``:` on line ${e+1}`;throw Error(`Duplicate event modeling frame ID "${n.name}"${t}`)}t.add(n.name)}C.ast=e}n(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}n(D,`getDiagramProps`);var ce={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function O(e){let t=e.split(`.`);if(t.length===2)return t[0]}n(O,`extractNamespace`);function k(e){let t=e.split(`.`);return t.length===2?t[1]:e}n(k,`extractName`);function A(e,t){if(t&&t.length!==0)return Object.values(e).find(e=>e.namespace===t)}n(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}n(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}}}n(M,`calculateSwimlaneProps`);function N(e){let{themeVariables:t}=h();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`}}}n(N,`calculateEntityVisualProps`);function P(e,t,n){let i=h(),a=g(k(e.entityIdentifier)??``,i),o,s={fontSize:16,fontWeight:700,fontFamily:`"trebuchet ms", verdana, arial, sans-serif`,joinWith:`<br/>`},c=`<b>${_(a,n.textMaxWidth,s)}</b>`;if(e.dataInlineValue&&(o=e.dataInlineValue,o=o.substring(o.indexOf(`{`)+1),o=o.substring(0,o.lastIndexOf(`}`)-1),o=g(o,i),o=_(o,n.textMaxWidth,s),o=o.replaceAll(` `,`&nbsp;`)),e.dataReference){let r=t.find(t=>t.name===e.dataReference?.$refText);r&&(o=r.dataBlockValue,o=o.substring(o.indexOf(`{
2
2
  `)+2),o=o.substring(0,o.lastIndexOf(`}`)-1),o=g(o,i),o=_(o,n.textMaxWidth,s),o=o.replaceAll(` `,`&nbsp;`),o+=`<br/>`)}let l=o!==void 0;l&&(c+=`<br/><br/><code style="text-align: left; display: block;max-width:${n.textMaxWidth}px">${o}</code>`);let u={fontSize:s.fontSize,fontWeight:s.fontWeight,fontFamily:s.fontFamily},d=te(c,u),f=l?d.width/3:d.width,p={content:c,width:f,height:d.height};return r.debug(`[${e.name}] ${e.entityIdentifier} text`,p),p}n(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}]}n(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}n(I,`calculateX`);function L(e,t){let n=[...e.map(e=>e.r),t];return Math.max(...n)}n(L,`calculateMaxRight`);function R(e){return Object.values(e).sort((e,t)=>e.index-t.index)}n(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}n(z,`evolveFramePositioned`);function B(e,t){return e===0&&t.sourceFrames.length===0}n(B,`isFirstFrame`);function V(e){return e.sourceFrames!==void 0&&e.sourceFrames!==null&&e.sourceFrames.length>0}n(V,`hasSourceFrame`);function H(e,t){if(t!=null)return e.find(e=>e.frame.name===t.name)}n(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}}n(U,`findBoxByLineIndex`);function W(t,n){let r=n;if(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;if(r.sourceFrame)a=H(t.boxes,r.sourceFrame);else{if(e(r.frame))return[];a=U(t.boxes,i.swimlane.index,r.index-1)}return a===void 0?[]:[{$kind:x,frame:r.frame,index:r.index,sourceBox:a,targetBox:i}]}n(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]}}n(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 i=n(e,t);return r.debug(`decided events`,i),i}n(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 r.debug(`evolve events`,{state:e,newState:n,events:t}),n}n(q,`evolve`);function J(e,t){return q(e,K(e,t))}n(J,`dispatch`);var Y={getConfig:se,preserveCommentsWhenParsing:!0,setOptions:re,getOptions:ie,clear:ae,setAccTitle:s,getAccTitle:m,getAccDescription:l,setAccDescription:o,setDiagramTitle:p,getDiagramTitle:a,setAst:T,getDiagramProps:D,getState:w},de={parse:n(async e=>{let n=await t(`eventmodeling`,e);r.debug(n),Y.setAst(n),ne(n,Y)},`parse`)},fe=d()?.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)}}n(X,`renderD3Box`);function Z(e,t){return e>t}n(Z,`dirUpwards`);function Q(e,t,n,i){return a=>{let o=a.sourceBox.swimlane.y+t.swimlanePadding,s=a.targetBox.swimlane.y+t.swimlanePadding,c=Z(o,s),l=a.sourceBox.x+a.sourceBox.dimension.width*2/3,u=a.targetBox.x+a.targetBox.dimension.width/3,d,f;r.debug(`rendering relation up=${c} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),c?(d=o,f=s+a.targetBox.dimension.height):(d=o+a.sourceBox.dimension.height,f=s);let p=i.emRelationStroke??a.visual.stroke;e.append(`path`).attr(`class`,`em-relation`).attr(`fill`,a.visual.fill).attr(`stroke`,p).attr(`stroke-width`,`1`).attr(`marker-end`,`url(#${n})`).attr(`d`,`M${l} ${d} L${u} ${f}`)}}n(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)}}n($,`renderD3Swimlane`);var pe={parser:de,db:Y,renderer:{draw:n(function(e,t,n,a){if(r.debug(`in eventmodeling renderer`,e+`
3
3
  `,`id:`,t,n),!fe)throw Error(`EventModeling config not found`);let o=a.db,{themeVariables:s,eventmodeling:l}=d(),u=i(`[id="${t}"]`),f=o.getDiagramProps(),p=o.getState(),m=`em-arrowhead-${t}`,h=s.emArrowhead??`#000000`;p.sortedSwimlanesArray.forEach($(u,p.maxR,f,s)),p.boxes.forEach(X(u,f)),p.relations.forEach(Q(u,f,m,s)),u.append(`defs`).append(`marker`).attr(`id`,m).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`,h),c(void 0,u,l?.padding??30,l?.useMaxWidth)},`draw`)},styles:n(e=>``,`getStyles`)};export{pe as diagram};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-XUq3kRg7.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-w1h_Rr-8.js";import{C as r,E as i,H as a,U as o,_ as s,a as c,c as l,f as u,q as d,v as f,y as p}from"./chunk-DSNLSHJZ-CwfiRg01.js";import{i as m}from"./chunk-7S6XSTFO-CN1GsbIT.js";import{t as h}from"./chunk-JWPE2WC7-DVXcaiue.js";import{a as g}from"./mermaid.core-KP0iScKW.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v=32,y={axes:[],curves:[],options:_},b=structuredClone(y),x=u.radar,S=t(()=>m({...x,...p().radar}),`getConfig`),C=t(()=>b.axes,`getAxes`),w=t(()=>b.curves,`getCurves`),T=t(()=>b.options,`getOptions`),E=t(e=>{b.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),D=t(e=>{b.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:O(e.entries)}))},`setCurves`),O=t(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:t(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&&(n.warn(`Radar diagram ticks (${b.options.ticks}) exceeds maximum allowed (${v}). Using ${v} instead.`),b.options.ticks=v)},`setOptions`),getConfig:S,clear:t(()=>{c(),b=structuredClone(y)},`clear`),setAccTitle:o,getAccTitle:f,setDiagramTitle:d,getDiagramTitle:r,getAccDescription:s,setAccDescription:a},A=t(e=>{h(e,k);let{axes:t,curves:n,options:r}=e;k.setAxes(t),k.setCurves(n),k.setOptions(r)},`populate`),j={parse:t(async t=>{let r=await e(`radar`,t);n.debug(r),A(r)},`parse`)},M=t((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),s=i.getOptions(),c=i.getConfig(),l=i.getDiagramTitle(),u=N(g(t),c),d=s.max??Math.max(...o.map(e=>Math.max(...e.entries))),f=s.min,p=Math.min(c.width,c.height)/2;P(u,a,p,s.ticks,s.graticule),F(u,a,p,c),I(u,a,o,f,d,s.graticule,c),z(u,o,s.showLegend,c),u.append(`text`).attr(`class`,`radarTitle`).text(l).attr(`x`,0).attr(`y`,-c.height/2-c.marginTop)},`draw`),N=t((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 l(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=t((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=t((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}`)})}t(I,`drawCurves`);function L(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}t(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`}t(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)})}t(z,`drawLegend`);var B={draw:M},V=t((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-CRHYFOhU.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-DWy4o1sh.js";import{C as r,E as i,H as a,U as o,_ as s,a as c,c as l,f as u,q as d,v as f,y as p}from"./chunk-DSNLSHJZ-6EnWiUHw.js";import{i as m}from"./chunk-7S6XSTFO-C_2BTQ4f.js";import{t as h}from"./chunk-JWPE2WC7-DVXcaiue.js";import{a as g}from"./mermaid.core-C-ITLWC9.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v=32,y={axes:[],curves:[],options:_},b=structuredClone(y),x=u.radar,S=t(()=>m({...x,...p().radar}),`getConfig`),C=t(()=>b.axes,`getAxes`),w=t(()=>b.curves,`getCurves`),T=t(()=>b.options,`getOptions`),E=t(e=>{b.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),D=t(e=>{b.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:O(e.entries)}))},`setCurves`),O=t(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:t(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&&(n.warn(`Radar diagram ticks (${b.options.ticks}) exceeds maximum allowed (${v}). Using ${v} instead.`),b.options.ticks=v)},`setOptions`),getConfig:S,clear:t(()=>{c(),b=structuredClone(y)},`clear`),setAccTitle:o,getAccTitle:f,setDiagramTitle:d,getDiagramTitle:r,getAccDescription:s,setAccDescription:a},A=t(e=>{h(e,k);let{axes:t,curves:n,options:r}=e;k.setAxes(t),k.setCurves(n),k.setOptions(r)},`populate`),j={parse:t(async t=>{let r=await e(`radar`,t);n.debug(r),A(r)},`parse`)},M=t((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),s=i.getOptions(),c=i.getConfig(),l=i.getDiagramTitle(),u=N(g(t),c),d=s.max??Math.max(...o.map(e=>Math.max(...e.entries))),f=s.min,p=Math.min(c.width,c.height)/2;P(u,a,p,s.ticks,s.graticule),F(u,a,p,c),I(u,a,o,f,d,s.graticule,c),z(u,o,s.showLegend,c),u.append(`text`).attr(`class`,`radarTitle`).text(l).attr(`x`,0).attr(`y`,-c.height/2-c.marginTop)},`draw`),N=t((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 l(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=t((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=t((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}`)})}t(I,`drawCurves`);function L(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}t(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`}t(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)})}t(z,`drawLegend`);var B={draw:M},V=t((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,4 +1,4 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-w1h_Rr-8.js";import{C as r,G as i,H as a,U as o,_ as s,a as c,at as l,b as u,d,et as f,q as p,s as m,v as h}from"./chunk-DSNLSHJZ-CwfiRg01.js";import{t as g}from"./channel-B4Lj3Yy_.js";import{_,c as v}from"./chunk-7S6XSTFO-CN1GsbIT.js";import"./chunk-YZO67HFG-dhkHuKWt.js";import"./chunk-AQDTSKZB-CUWKsFsd.js";import{t as y}from"./chunk-5VM5RSS4-ZNzvKenW.js";import"./chunk-UHW7PFBP-CC1DKtp5.js";import{i as b,n as x,o as S,r as C}from"./chunk-J5ZVWO5B-oDCd-gWO.js";import{a as w}from"./chunk-HAGFOTED-Do-8YoBu.js";import"./chunk-ZAUX2LTX-CA6m357j.js";import"./chunk-WQQL4CDK-BJl_ufDd.js";import{t as T}from"./chunk-55XCU76K-D3MGCCrv.js";import{t as E}from"./chunk-XXDRQBXY-DKVbKHOf.js";import{t as D}from"./chunk-VQ5W62QI-CWY0eXsE.js";import"./chunk-HNE4Q36P-1-JjBgqP.js";import{i as O,n as k,r as A,t as j}from"./mermaid.core-KP0iScKW.js";var M={SHAPE_UNSUPPORTED:`SHAPE_UNSUPPORTED`,SHAPE_REMOVED:`SHAPE_REMOVED`,EDGE_OPERATOR_UNSUPPORTED:`EDGE_OPERATOR_UNSUPPORTED`,REFERENCE_EDGE_LABEL_REJECTED:`REFERENCE_EDGE_LABEL_REJECTED`,CONNECTOR_REF_UNRESOLVED:`CONNECTOR_REF_UNRESOLVED`,CONNECTOR_REF_NOT_A_CONNECTOR:`CONNECTOR_REF_NOT_A_CONNECTOR`,METADATA_KEY_MISAPPLIED:`METADATA_KEY_MISAPPLIED`,DUPLICATE_ID_NODE:`DUPLICATE_ID_NODE`,RESERVED_SYNTHETIC_ID:`RESERVED_SYNTHETIC_ID`,CONTAINMENT_VIOLATION:`CONTAINMENT_VIOLATION`,EDGE_SEMANTIC_CONTRADICTION:`EDGE_SEMANTIC_CONTRADICTION`,FLOW_NO_INPUT:`FLOW_NO_INPUT`},N=new Set([M.SHAPE_UNSUPPORTED,M.SHAPE_REMOVED,M.CONTAINMENT_VIOLATION]);new Set(Object.values(M).filter(e=>!N.has(e)));var P=new Map([[`task`,`roundedRect`],[`tool`,`subroutine`],[`input`,`lean-right`],[`decision`,`diamond`],[`refdoc`,`lin-doc`],[`action`,`hexagon`],[`round`,`rect`]]),ee=new Set(`doc.stadium.terminal.circle.trapezoid.inv_trapezoid.inv-trapezoid.doublecircle.double-circle.typeDeclaration.procs.lean_left.lean-left.in-out.cylinder.ellipse.odd.tag-rect.tagged-rectangle.delay.half-rounded-rectangle.lin-rect.lined-rectangle.win-pane.window-pane.curv-trap.curved-trapezoid`.split(`.`)),te=new Set([`roundedRect`,`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`lean-right`,`diamond`,`lin-doc`,`lined-document`,`hexagon`,`hex`,`connector`,`collapsedGroup`]),F=`roundedRect`;function I(e){return e&&(P.get(e)??e)}e(I,`resolveShapeAlias`);function ne(e,n){for(let r of e)if(!r.isGroup){if((!r.shape||r.shape===`squareRect`||r.shape===`rect`)&&(r.shape=F),ee.has(r.shape)){let e=`shape "${r.shape}" was removed in v0.8.1, using "${F}"`;n?.emitError?n.emitError(`SHAPE_REMOVED`,e,{nodeId:r.id}):t.warn(`agentflow: ${e}`),r.shape=F}else if(!te.has(r.shape)){let e=`shape "${r.shape}" is not supported, using "${F}"`;n?.emitWarning?n.emitWarning(`SHAPE_UNSUPPORTED`,e,{nodeId:r.id}):t.warn(`agentflow: ${e}`),r.shape=F}}}e(ne,`normaliseNodeShapes`);var L=new Map([[`tool`,0],[`task`,1],[`decision`,2],[`input`,3],[`refdoc`,4],[`connector`,5],[`action`,6]]),R=L.size,z=e(e=>`af-kind-${e}`,`kindClass`),B=[...L.keys()],V=e(e=>Math.max(1,e-R),`containerSlotCount`),H=e((e,t)=>{let n=R+e%V(t);return t>0?n%t:n},`containerSlot`);function re(e,t,n){let r=u().themeVariables?.borderColorArray,i=Array.isArray(r)?r.length:0,a=n.size;for(let r of e??[]){if(r.isGroup||r.shape===`collapsedGroup`){r.colorIndex=H(n.get(String(r.id))??a++,i);continue}let e=t(String(r.id));e&&L.has(e)&&(r.cssClasses=`${r.cssClasses??``} ${z(e)}`.replace(/\s+/g,` `).trim())}}e(re,`assignColorSlots`);var ie=`agentflow-`,ae=new Set([`shape`,`view`,`icon`,`img`,`form`,`pos`,`w`,`h`,`class`,`style`,`labelType`]),oe=new Set([`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`tool`]),se={flow:`flowGroup`};function ce(e){if(Array.isArray(e))return e.map(e=>ce(e));if(typeof e!=`object`||!e)return e;let t={};for(let n of Object.keys(e))n!==`__proto__`&&n!==`constructor`&&n!==`prototype`&&(t[n]=ce(e[n]));return t}e(ce,`stripPrototypeKeys`);function le(e){let t=!1,n=!1,r=0,i,a=[];for(let o of e.split(`
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-DWy4o1sh.js";import{C as r,G as i,H as a,U as o,_ as s,a as c,at as l,b as u,d,et as f,q as p,s as m,v as h}from"./chunk-DSNLSHJZ-6EnWiUHw.js";import{t as g}from"./channel-COq7V7WB.js";import{_,c as v}from"./chunk-7S6XSTFO-C_2BTQ4f.js";import"./chunk-YZO67HFG-O3X4dDhT.js";import"./chunk-AQDTSKZB-DZLt6T8h.js";import{t as y}from"./chunk-5VM5RSS4-ZNzvKenW.js";import"./chunk-UHW7PFBP-y_Cnbpso.js";import{i as b,n as x,o as S,r as C}from"./chunk-J5ZVWO5B-oDCd-gWO.js";import{a as w}from"./chunk-HAGFOTED-C4TrjvWC.js";import"./chunk-ZAUX2LTX-dMpe16to.js";import"./chunk-WQQL4CDK-DVgns4LS.js";import{t as T}from"./chunk-55XCU76K-C9qNkR8H.js";import{t as E}from"./chunk-XXDRQBXY-z-xFeaXQ.js";import{t as D}from"./chunk-VQ5W62QI-BDGHstYR.js";import"./chunk-HNE4Q36P-Bhz3xzgF.js";import{i as O,n as k,r as A,t as j}from"./mermaid.core-C-ITLWC9.js";var M={SHAPE_UNSUPPORTED:`SHAPE_UNSUPPORTED`,SHAPE_REMOVED:`SHAPE_REMOVED`,EDGE_OPERATOR_UNSUPPORTED:`EDGE_OPERATOR_UNSUPPORTED`,REFERENCE_EDGE_LABEL_REJECTED:`REFERENCE_EDGE_LABEL_REJECTED`,CONNECTOR_REF_UNRESOLVED:`CONNECTOR_REF_UNRESOLVED`,CONNECTOR_REF_NOT_A_CONNECTOR:`CONNECTOR_REF_NOT_A_CONNECTOR`,METADATA_KEY_MISAPPLIED:`METADATA_KEY_MISAPPLIED`,DUPLICATE_ID_NODE:`DUPLICATE_ID_NODE`,RESERVED_SYNTHETIC_ID:`RESERVED_SYNTHETIC_ID`,CONTAINMENT_VIOLATION:`CONTAINMENT_VIOLATION`,EDGE_SEMANTIC_CONTRADICTION:`EDGE_SEMANTIC_CONTRADICTION`,FLOW_NO_INPUT:`FLOW_NO_INPUT`},N=new Set([M.SHAPE_UNSUPPORTED,M.SHAPE_REMOVED,M.CONTAINMENT_VIOLATION]);new Set(Object.values(M).filter(e=>!N.has(e)));var P=new Map([[`task`,`roundedRect`],[`tool`,`subroutine`],[`input`,`lean-right`],[`decision`,`diamond`],[`refdoc`,`lin-doc`],[`action`,`hexagon`],[`round`,`rect`]]),ee=new Set(`doc.stadium.terminal.circle.trapezoid.inv_trapezoid.inv-trapezoid.doublecircle.double-circle.typeDeclaration.procs.lean_left.lean-left.in-out.cylinder.ellipse.odd.tag-rect.tagged-rectangle.delay.half-rounded-rectangle.lin-rect.lined-rectangle.win-pane.window-pane.curv-trap.curved-trapezoid`.split(`.`)),te=new Set([`roundedRect`,`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`lean-right`,`diamond`,`lin-doc`,`lined-document`,`hexagon`,`hex`,`connector`,`collapsedGroup`]),F=`roundedRect`;function I(e){return e&&(P.get(e)??e)}e(I,`resolveShapeAlias`);function ne(e,n){for(let r of e)if(!r.isGroup){if((!r.shape||r.shape===`squareRect`||r.shape===`rect`)&&(r.shape=F),ee.has(r.shape)){let e=`shape "${r.shape}" was removed in v0.8.1, using "${F}"`;n?.emitError?n.emitError(`SHAPE_REMOVED`,e,{nodeId:r.id}):t.warn(`agentflow: ${e}`),r.shape=F}else if(!te.has(r.shape)){let e=`shape "${r.shape}" is not supported, using "${F}"`;n?.emitWarning?n.emitWarning(`SHAPE_UNSUPPORTED`,e,{nodeId:r.id}):t.warn(`agentflow: ${e}`),r.shape=F}}}e(ne,`normaliseNodeShapes`);var L=new Map([[`tool`,0],[`task`,1],[`decision`,2],[`input`,3],[`refdoc`,4],[`connector`,5],[`action`,6]]),R=L.size,z=e(e=>`af-kind-${e}`,`kindClass`),B=[...L.keys()],V=e(e=>Math.max(1,e-R),`containerSlotCount`),H=e((e,t)=>{let n=R+e%V(t);return t>0?n%t:n},`containerSlot`);function re(e,t,n){let r=u().themeVariables?.borderColorArray,i=Array.isArray(r)?r.length:0,a=n.size;for(let r of e??[]){if(r.isGroup||r.shape===`collapsedGroup`){r.colorIndex=H(n.get(String(r.id))??a++,i);continue}let e=t(String(r.id));e&&L.has(e)&&(r.cssClasses=`${r.cssClasses??``} ${z(e)}`.replace(/\s+/g,` `).trim())}}e(re,`assignColorSlots`);var ie=`agentflow-`,ae=new Set([`shape`,`view`,`icon`,`img`,`form`,`pos`,`w`,`h`,`class`,`style`,`labelType`]),oe=new Set([`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`tool`]),se={flow:`flowGroup`};function ce(e){if(Array.isArray(e))return e.map(e=>ce(e));if(typeof e!=`object`||!e)return e;let t={};for(let n of Object.keys(e))n!==`__proto__`&&n!==`constructor`&&n!==`prototype`&&(t[n]=ce(e[n]));return t}e(ce,`stripPrototypeKeys`);function le(e){let t=!1,n=!1,r=0,i,a=[];for(let o of e.split(`
2
2
  `)){if(i!==void 0){let e=o.length-o.trimStart().length;if(o.trim()===``||e>i){a.push(o);continue}i=void 0}let e=-1;for(let i=0;i<o.length;i++){let a=o[i];if(n)a===`\\`?i++:a===`"`&&(n=!1);else if(t)a===`'`&&(t=!1);else if(a===`"`)n=!0;else if(a===`'`)t=!0;else if(a===`#`&&(i===0||o[i-1]===` `||o[i-1]===` `)){e=i;break}else a===`[`||a===`{`?r++:(a===`]`||a===`}`)&&(r=Math.max(0,r-1))}if(t||n||r>0){a.push(o);continue}let s=e>=0?o.slice(0,e):o,c=e>=0?o.slice(e):``;/:\s*[>|][\d+-]*\s*$/.test(s)?(i=o.length-o.trimStart().length,a.push(o)):a.push(s.replace(/,([\t ]*)$/,`$1`)+c)}return a.join(`
3
3
  `)}e(le,`stripLineTrailingCommas`);var ue=class{constructor(){this.vertexCounter=0,this.config=u(),this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.globalNodes=new Set,this.connectors=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.diagramId=``,this.preserveCommentsWhenParsing=!0,this.frontmatterLineOffset=0,this.elementMappings=[],this.bareVertexMappings=new WeakSet,this.diagnostics=[],this.postParseValidationRun=!1,this.funs=[],this.setAccTitle=o,this.setAccDescription=a,this.setDiagramTitle=p,this.getAccTitle=h,this.getAccDescription=s,this.getDiagramTitle=r,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addGlobal=this.addGlobal.bind(this),this.addConnector=this.addConnector.bind(this),this.addConnectorMapping=this.addConnectorMapping.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.setFrontmatterLineOffset=this.setFrontmatterLineOffset.bind(this),this.addVertexMapping=this.addVertexMapping.bind(this),this.extendVertexMapping=this.extendVertexMapping.bind(this),this.addEdgeMapping=this.addEdgeMapping.bind(this),this.addSubgraphMapping=this.addSubgraphMapping.bind(this),this.emitWarning=this.emitWarning.bind(this),this.emitError=this.emitError.bind(this),this.getDiagnostics=this.getDiagnostics.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen(`gen-2`)}static{e(this,`AgentFlowDB`)}sanitizeText(e){return m.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case`markdown`:case`string`:case`text`:return e;default:return`markdown`}}setDiagramId(e){this.diagramId=e}lookUpDomId(e){for(let t of this.vertices.values())if(t.id===e)return this.diagramId?`${this.diagramId}-${t.domId}`:t.domId;return this.diagramId?`${this.diagramId}-${e}`:e}addVertex(e,t,n,r,i,a,o={},s,c){if(!e||e.trim().length===0)return;let l;if(s!==void 0){let e;e=s.includes(`
4
4
  `)?s+`
@@ -1 +1 @@
1
- import{C as e,M as t,N as n,g as r,r as i,s as a,u as o,v as s,y as c}from"./dist-B-4tAY5T.js";var l={__proto__:null,anyref:34,dataref:34,eqref:34,externref:34,i31ref:34,funcref:34,i8:34,i16:34,i32:34,i64:34,f32:34,f64:34},u=i.deserialize({version:14,states:`!^Q]QPOOOqQPO'#CbOOQO'#Cd'#CdOOQO'#Cl'#ClOOQO'#Ch'#ChQ]QPOOOOQO,58|,58|OxQPO,58|OOQO-E6f-E6fOOQO1G.h1G.h`,stateData:`!P~O_OSPOSQOS~OTPOVROXROYROZROaQO~OSUO~P]OSXO~P]O`,goto:`xaPPPPPPbPbPPPhPPPrXROPTVQTOQVPTWTVXSOPTV`,nodeNames:`⚠ LineComment BlockComment Module ) ( App Identifier Type Keyword Number String`,maxTerm:17,nodeProps:[[`isolate`,-3,1,2,11,``],[`openedBy`,4,`(`],[`closedBy`,5,`)`],[`group`,-6,6,7,8,9,10,11,`Expression`]],skippedNodes:[0,1,2],repeatNodeCount:1,tokenData:"0o~R^XY}YZ}]^}pq}rs!Stu#pxy'Uyz(e{|(j}!O(j!Q!R(s!R![*p!]!^.^#T#o.{~!SO_~~!VVOr!Srs!ls#O!S#O#P!q#P;'S!S;'S;=`#j<%lO!S~!qOZ~~!tRO;'S!S;'S;=`!};=`O!S~#QWOr!Srs!ls#O!S#O#P!q#P;'S!S;'S;=`#j;=`<%l!S<%lO!S~#mP;=`<%l!S~#siqr%bst%btu%buv%bvw%bwx%bz{%b{|%b}!O%b!O!P%b!P!Q%b!Q![%b![!]%b!^!_%b!_!`%b!`!a%b!a!b%b!b!c%b!c!}%b#Q#R%b#R#S%b#S#T%b#T#o%b#p#q%b#r#s%b~%giV~qr%bst%btu%buv%bvw%bwx%bz{%b{|%b}!O%b!O!P%b!P!Q%b!Q![%b![!]%b!^!_%b!_!`%b!`!a%b!a!b%b!b!c%b!c!}%b#Q#R%b#R#S%b#S#T%b#T#o%b#p#q%b#r#s%b~'ZPT~!]!^'^~'aTO!]'^!]!^'p!^;'S'^;'S;=`(_<%lO'^~'sVOy'^yz(Yz!]'^!]!^'p!^;'S'^;'S;=`(_<%lO'^~(_OQ~~(bP;=`<%l'^~(jOS~~(mQ!Q!R(s!R![*p~(xUY~!O!P)[!Q![*p!g!h){#R#S+U#X#Y){#l#m+[~)aRY~!Q![)j!g!h){#X#Y){~)oSY~!Q![)j!g!h){#R#S*j#X#Y){~*OR{|*X}!O*X!Q![*_~*[P!Q![*_~*dQY~!Q![*_#R#S*X~*mP!Q![)j~*uTY~!O!P)[!Q![*p!g!h){#R#S+U#X#Y){~+XP!Q![*p~+_R!Q![+h!c!i+h#T#Z+h~+mVY~!O!P,S!Q![+h!c!i+h!r!s-P#R#S+[#T#Z+h#d#e-P~,XTY~!Q![,h!c!i,h!r!s-P#T#Z,h#d#e-P~,mUY~!Q![,h!c!i,h!r!s-P#R#S.Q#T#Z,h#d#e-P~-ST{|-c}!O-c!Q![-o!c!i-o#T#Z-o~-fR!Q![-o!c!i-o#T#Z-o~-tSY~!Q![-o!c!i-o#R#S-c#T#Z-o~.TR!Q![,h!c!i,h#T#Z,h~.aP!]!^.d~.iSP~OY.dZ;'S.d;'S;=`.u<%lO.d~.xP;=`<%l.d~/QiX~qr.{st.{tu.{uv.{vw.{wx.{z{.{{|.{}!O.{!O!P.{!P!Q.{!Q![.{![!].{!^!_.{!_!`.{!`!a.{!a!b.{!b!c.{!c!}.{#Q#R.{#R#S.{#S#T.{#T#o.{#p#q.{#r#s.{",tokenizers:[0],topRules:{Module:[0,3]},specialized:[{term:9,get:e=>l[e]||-1}],tokenPrec:0}),d=a.define({name:`wast`,parser:u.configure({props:[e.add({App:r({closing:`)`,align:!1})}),c.add({App:s,BlockComment(e){return{from:e.from+2,to:e.to-2}}}),t({Keyword:n.keyword,Type:n.typeName,Number:n.number,String:n.string,Identifier:n.variableName,LineComment:n.lineComment,BlockComment:n.blockComment,"( )":n.paren})]}),languageData:{commentTokens:{line:`;;`,block:{open:`(;`,close:`;)`}},closeBrackets:{brackets:[`(`,`"`]}}});function f(){return new o(d)}export{f as wast};
1
+ import{C as e,M as t,N as n,g as r,r as i,s as a,u as o,v as s,y as c}from"./dist-CFUj2tCy.js";var l={__proto__:null,anyref:34,dataref:34,eqref:34,externref:34,i31ref:34,funcref:34,i8:34,i16:34,i32:34,i64:34,f32:34,f64:34},u=i.deserialize({version:14,states:`!^Q]QPOOOqQPO'#CbOOQO'#Cd'#CdOOQO'#Cl'#ClOOQO'#Ch'#ChQ]QPOOOOQO,58|,58|OxQPO,58|OOQO-E6f-E6fOOQO1G.h1G.h`,stateData:`!P~O_OSPOSQOS~OTPOVROXROYROZROaQO~OSUO~P]OSXO~P]O`,goto:`xaPPPPPPbPbPPPhPPPrXROPTVQTOQVPTWTVXSOPTV`,nodeNames:`⚠ LineComment BlockComment Module ) ( App Identifier Type Keyword Number String`,maxTerm:17,nodeProps:[[`isolate`,-3,1,2,11,``],[`openedBy`,4,`(`],[`closedBy`,5,`)`],[`group`,-6,6,7,8,9,10,11,`Expression`]],skippedNodes:[0,1,2],repeatNodeCount:1,tokenData:"0o~R^XY}YZ}]^}pq}rs!Stu#pxy'Uyz(e{|(j}!O(j!Q!R(s!R![*p!]!^.^#T#o.{~!SO_~~!VVOr!Srs!ls#O!S#O#P!q#P;'S!S;'S;=`#j<%lO!S~!qOZ~~!tRO;'S!S;'S;=`!};=`O!S~#QWOr!Srs!ls#O!S#O#P!q#P;'S!S;'S;=`#j;=`<%l!S<%lO!S~#mP;=`<%l!S~#siqr%bst%btu%buv%bvw%bwx%bz{%b{|%b}!O%b!O!P%b!P!Q%b!Q![%b![!]%b!^!_%b!_!`%b!`!a%b!a!b%b!b!c%b!c!}%b#Q#R%b#R#S%b#S#T%b#T#o%b#p#q%b#r#s%b~%giV~qr%bst%btu%buv%bvw%bwx%bz{%b{|%b}!O%b!O!P%b!P!Q%b!Q![%b![!]%b!^!_%b!_!`%b!`!a%b!a!b%b!b!c%b!c!}%b#Q#R%b#R#S%b#S#T%b#T#o%b#p#q%b#r#s%b~'ZPT~!]!^'^~'aTO!]'^!]!^'p!^;'S'^;'S;=`(_<%lO'^~'sVOy'^yz(Yz!]'^!]!^'p!^;'S'^;'S;=`(_<%lO'^~(_OQ~~(bP;=`<%l'^~(jOS~~(mQ!Q!R(s!R![*p~(xUY~!O!P)[!Q![*p!g!h){#R#S+U#X#Y){#l#m+[~)aRY~!Q![)j!g!h){#X#Y){~)oSY~!Q![)j!g!h){#R#S*j#X#Y){~*OR{|*X}!O*X!Q![*_~*[P!Q![*_~*dQY~!Q![*_#R#S*X~*mP!Q![)j~*uTY~!O!P)[!Q![*p!g!h){#R#S+U#X#Y){~+XP!Q![*p~+_R!Q![+h!c!i+h#T#Z+h~+mVY~!O!P,S!Q![+h!c!i+h!r!s-P#R#S+[#T#Z+h#d#e-P~,XTY~!Q![,h!c!i,h!r!s-P#T#Z,h#d#e-P~,mUY~!Q![,h!c!i,h!r!s-P#R#S.Q#T#Z,h#d#e-P~-ST{|-c}!O-c!Q![-o!c!i-o#T#Z-o~-fR!Q![-o!c!i-o#T#Z-o~-tSY~!Q![-o!c!i-o#R#S-c#T#Z-o~.TR!Q![,h!c!i,h#T#Z,h~.aP!]!^.d~.iSP~OY.dZ;'S.d;'S;=`.u<%lO.d~.xP;=`<%l.d~/QiX~qr.{st.{tu.{uv.{vw.{wx.{z{.{{|.{}!O.{!O!P.{!P!Q.{!Q![.{![!].{!^!_.{!_!`.{!`!a.{!a!b.{!b!c.{!c!}.{#Q#R.{#R#S.{#S#T.{#T#o.{#p#q.{#r#s.{",tokenizers:[0],topRules:{Module:[0,3]},specialized:[{term:9,get:e=>l[e]||-1}],tokenPrec:0}),d=a.define({name:`wast`,parser:u.configure({props:[e.add({App:r({closing:`)`,align:!1})}),c.add({App:s,BlockComment(e){return{from:e.from+2,to:e.to-2}}}),t({Keyword:n.keyword,Type:n.typeName,Number:n.number,String:n.string,Identifier:n.variableName,LineComment:n.lineComment,BlockComment:n.blockComment,"( )":n.paren})]}),languageData:{commentTokens:{line:`;;`,block:{open:`(;`,close:`;)`}},closeBrackets:{brackets:[`(`,`"`]}}});function f(){return new o(d)}export{f as wast};
@@ -1,2 +1,2 @@
1
- import{A as e,C as t,M as n,N as r,m as i,n as a,r as o,s,u as c,y as l}from"./dist-B-4tAY5T.js";import{a as u,i as d}from"./index-CFg9w5Ih.js";var ee=36,f=1,p=2,m=3,h=4,te=5,ne=6,re=7,ie=8,ae=9,oe=10,se=11,ce=12,g=13,_=14,le=15,ue=16,de=17,v=18,fe=19,y=20,b=21,x=22,S=23,C=24;function w(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function pe(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function T(e,t,n){for(let r=!1;;){if(e.next<0)return;if(e.next==t&&!r){e.advance();return}r=n&&!r&&e.next==92,e.advance()}}function me(e,t){scan:for(;;){if(e.next<0)return;if(e.next==36){e.advance();for(let n=0;n<t.length;n++){if(e.next!=t.charCodeAt(n))continue scan;e.advance()}if(e.next==36){e.advance();return}}else e.advance()}}function he(e,t){let n=`[{<(`.indexOf(String.fromCharCode(t)),r=n<0?t:`]}>)`.charCodeAt(n);for(;;){if(e.next<0)return;if(e.next==r&&e.peek(1)==39){e.advance(2);return}e.advance()}}function E(e,t){for(;e.next==95||w(e.next);)t!=null&&(t+=String.fromCharCode(e.next)),e.advance();return t}function ge(e){if(e.next==39||e.next==34||e.next==96){let t=e.next;e.advance(),T(e,t,!1)}else E(e)}function D(e,t){for(;e.next==48||e.next==49;)e.advance();t&&e.next==t&&e.advance()}function O(e,t){for(;;){if(e.next==46){if(t)break;t=!0}else if(e.next<48||e.next>57)break;e.advance()}if(e.next==69||e.next==101)for(e.advance(),(e.next==43||e.next==45)&&e.advance();e.next>=48&&e.next<=57;)e.advance()}function k(e){for(;!(e.next<0||e.next==10);)e.advance()}function A(e,t){for(let n=0;n<t.length;n++)if(t.charCodeAt(n)==e)return!0;return!1}var j=` \r
1
+ import{A as e,C as t,M as n,N as r,m as i,n as a,r as o,s,u as c,y as l}from"./dist-CFUj2tCy.js";import{a as u,i as d}from"./index-CafleYLD.js";var ee=36,f=1,p=2,m=3,h=4,te=5,ne=6,re=7,ie=8,ae=9,oe=10,se=11,ce=12,g=13,_=14,le=15,ue=16,de=17,v=18,fe=19,y=20,b=21,x=22,S=23,C=24;function w(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function pe(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function T(e,t,n){for(let r=!1;;){if(e.next<0)return;if(e.next==t&&!r){e.advance();return}r=n&&!r&&e.next==92,e.advance()}}function me(e,t){scan:for(;;){if(e.next<0)return;if(e.next==36){e.advance();for(let n=0;n<t.length;n++){if(e.next!=t.charCodeAt(n))continue scan;e.advance()}if(e.next==36){e.advance();return}}else e.advance()}}function he(e,t){let n=`[{<(`.indexOf(String.fromCharCode(t)),r=n<0?t:`]}>)`.charCodeAt(n);for(;;){if(e.next<0)return;if(e.next==r&&e.peek(1)==39){e.advance(2);return}e.advance()}}function E(e,t){for(;e.next==95||w(e.next);)t!=null&&(t+=String.fromCharCode(e.next)),e.advance();return t}function ge(e){if(e.next==39||e.next==34||e.next==96){let t=e.next;e.advance(),T(e,t,!1)}else E(e)}function D(e,t){for(;e.next==48||e.next==49;)e.advance();t&&e.next==t&&e.advance()}function O(e,t){for(;;){if(e.next==46){if(t)break;t=!0}else if(e.next<48||e.next>57)break;e.advance()}if(e.next==69||e.next==101)for(e.advance(),(e.next==43||e.next==45)&&e.advance();e.next>=48&&e.next<=57;)e.advance()}function k(e){for(;!(e.next<0||e.next==10);)e.advance()}function A(e,t){for(let n=0;n<t.length;n++)if(t.charCodeAt(n)==e)return!0;return!1}var j=` \r
2
2
  `;function M(e,t,n){let r=Object.create(null);r.true=r.false=te,r.null=r.unknown=ne;for(let t of e.split(` `))t&&(r[t]=y);for(let e of t.split(` `))e&&(r[e]=b);for(let e of(n||``).split(` `))e&&(r[e]=C);return r}var N=`array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying `,P=`absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone `,F={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:`*+-%<>!=&|~^/`,specialVar:`?`,identifierQuotes:`"`,caseInsensitiveIdentifiers:!1,words:M(P,N)};function I(e,t,n,r){let i={};for(let t in F)i[t]=(e.hasOwnProperty(t)?e:F)[t];return t&&(i.words=M(t,n||``,r)),i}function L(e){return new a(t=>{let{next:n}=t;if(t.advance(),A(n,j)){for(;A(t.next,j);)t.advance();t.acceptToken(ee)}else if(n==36&&e.doubleDollarQuotedStrings){let e=E(t,``);t.next==36&&(t.advance(),me(t,e),t.acceptToken(m))}else if(n==39||n==34&&e.doubleQuotedStrings)T(t,n,e.backslashEscapes),t.acceptToken(m);else if(n==35&&e.hashComments||n==47&&t.next==47&&e.slashComments)k(t),t.acceptToken(f);else if(n==45&&t.next==45&&(!e.spaceAfterDashes||t.peek(1)==32))k(t),t.acceptToken(f);else if(n==47&&t.next==42){t.advance();for(let e=1;;){let n=t.next;if(t.next<0)break;if(t.advance(),n==42&&t.next==47){if(e--,t.advance(),!e)break}else n==47&&t.next==42&&(e++,t.advance())}t.acceptToken(p)}else if((n==101||n==69)&&t.next==39)t.advance(),T(t,39,!0),t.acceptToken(m);else if((n==110||n==78)&&t.next==39&&e.charSetCasts)t.advance(),T(t,39,e.backslashEscapes),t.acceptToken(m);else if(n==95&&e.charSetCasts)for(let n=0;;n++){if(t.next==39&&n>1){t.advance(),T(t,39,e.backslashEscapes),t.acceptToken(m);break}if(!w(t.next))break;t.advance()}else if(e.plsqlQuotingMechanism&&(n==113||n==81)&&t.next==39&&t.peek(1)>0&&!A(t.peek(1),j)){let e=t.peek(1);t.advance(2),he(t,e),t.acceptToken(m)}else if(A(n,e.identifierQuotes))T(t,n==91?93:n,!1),t.acceptToken(fe);else if(n==40)t.acceptToken(re);else if(n==41)t.acceptToken(ie);else if(n==123)t.acceptToken(ae);else if(n==125)t.acceptToken(oe);else if(n==91)t.acceptToken(se);else if(n==93)t.acceptToken(ce);else if(n==59)t.acceptToken(g);else if(e.unquotedBitLiterals&&n==48&&t.next==98)t.advance(),D(t),t.acceptToken(x);else if((n==98||n==66)&&(t.next==39||t.next==34)){let n=t.next;t.advance(),e.treatBitsAsBytes?(T(t,n,e.backslashEscapes),t.acceptToken(S)):(D(t,n),t.acceptToken(x))}else if(n==48&&(t.next==120||t.next==88)||(n==120||n==88)&&t.next==39){let e=t.next==39;for(t.advance();pe(t.next);)t.advance();e&&t.next==39&&t.advance(),t.acceptToken(h)}else if(n==46&&t.next>=48&&t.next<=57)O(t,!0),t.acceptToken(h);else if(n==46)t.acceptToken(_);else if(n>=48&&n<=57)O(t,!1),t.acceptToken(h);else if(A(n,e.operatorChars)){for(;A(t.next,e.operatorChars);)t.advance();t.acceptToken(le)}else if(A(n,e.specialVar))t.next==n&&t.advance(),ge(t),t.acceptToken(de);else if(n==58||n==44)t.acceptToken(ue);else if(w(n)){let r=E(t,String.fromCharCode(n));t.acceptToken(t.next==46||t.peek(-r.length-1)==46?v:e.words[r.toLowerCase()]??v)}})}var R=L(F),_e=o.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:`⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement`,maxTerm:38,nodeProps:[[`isolate`,-4,1,2,3,19,``]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:`RORO`,tokenizers:[0,R],topRules:{Script:[0,25]},tokenPrec:0});function z(e){let t=e.cursor().moveTo(e.from,-1);for(;/Comment/.test(t.name);)t.moveTo(t.from,-1);return t.node}function B(e,t){let n=e.sliceString(t.from,t.to),r=/^([`'"\[])(.*)([`'"\]])$/.exec(n);return r?r[2]:n}function V(e){return e&&(e.name==`Identifier`||e.name==`QuotedIdentifier`)}function ve(e,t){if(t.name==`CompositeIdentifier`){let n=[];for(let r=t.firstChild;r;r=r.nextSibling)V(r)&&n.push(B(e,r));return n}return[B(e,t)]}function H(e,t){for(let n=[];;){if(!t||t.name!=`.`)return n;let r=z(t);if(!V(r))return n;n.unshift(B(e,r)),t=z(r)}}function ye(t,n){let r=e(t).resolveInner(n,-1),i=xe(t.doc,r);return r.name==`Identifier`||r.name==`QuotedIdentifier`||r.name==`Keyword`?{from:r.from,quoted:r.name==`QuotedIdentifier`?t.doc.sliceString(r.from,r.from+1):null,parents:H(t.doc,z(r)),aliases:i}:r.name==`.`?{from:n,quoted:null,parents:H(t.doc,r),aliases:i}:{from:n,quoted:null,parents:[],empty:!0,aliases:i}}var be=new Set(`where group having order union intersect except all distinct limit offset fetch for`.split(` `));function xe(e,t){let n;for(let e=t;!n;e=e.parent){if(!e)return null;e.name==`Statement`&&(n=e)}let r=null;for(let t=n.firstChild,i=!1,a=null;t;t=t.nextSibling){let n=t.name==`Keyword`?e.sliceString(t.from,t.to).toLowerCase():null,o=null;if(!i)i=n==`from`;else if(n==`as`&&a&&V(t.nextSibling))o=B(e,t.nextSibling);else if(n&&be.has(n))break;else a&&V(t)&&(o=B(e,t));o&&(r||=Object.create(null),r[o]=ve(e,a)),a=/Identifier$/.test(t.name)?t:null}return r}function Se(e,t,n){return n.map(n=>({...n,label:n.label[0]==e?n.label:e+n.label+t,apply:void 0}))}var Ce=/^\w*$/,we=/^[`'"\[]?\w*[`'"\]]?$/;function U(e){return e.self&&typeof e.self.label==`string`}var Te=class e{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(t){let n=this.children||=Object.create(null);return n[t]||(t&&!this.list.some(e=>e.label==t)&&this.list.push(W(t,`type`,this.idQuote,this.idCaseInsensitive)),n[t]=new e(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(t=>t.label==e.label);t>-1?this.list[t]=e:this.list.push(e)}addCompletions(e){for(let t of e)this.addCompletion(typeof t==`string`?W(t,`property`,this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):U(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let n=e[t],r=null,i=t.replace(/\\?\./g,e=>e==`.`?`\0`:e).split(`\0`),a=this;U(n)&&(r=n.self,n=n.children);for(let e=0;e<i.length;e++)r&&e==i.length-1&&a.addCompletion(r),a=a.child(i[e].replace(/\\\./g,`.`));a.addNamespace(n)}}};function W(e,t,n,r){return RegExp(`^[a-z_][a-z_\\d]*$`,r?`i`:``).test(e)?{label:e,type:t}:{label:e,type:t,apply:n+e+G(n)}}function G(e){return e===`[`?`]`:e}function Ee(e,t,n,r,i,a){let o=new Te(a?.spec.identifierQuotes?.[0]||`"`,!!a?.spec.caseInsensitiveIdentifiers),s=i?o.child(i):null;return o.addNamespace(e),t&&(s||o).addCompletions(t),n&&o.addCompletions(n),s&&o.addCompletions(s.list),r&&o.addCompletions((s||o).child(r).list),e=>{let{parents:t,from:n,quoted:i,empty:a,aliases:c}=ye(e.state,e.pos);if(a&&!e.explicit)return null;c&&t.length==1&&(t=c[t[0]]||t);let l=o;for(let e of t){for(;!l.children||!l.children[e];)if(l==o&&s)l=s;else if(l==s&&r)l=l.child(r);else return null;let t=l.maybeChild(e);if(!t)return null;l=t}let u=l.list;if(l==o&&c&&(u=u.concat(Object.keys(c).map(e=>({label:e,type:`constant`})))),i){let t=i[0],r=G(t);return{from:n,to:e.state.sliceDoc(e.pos,e.pos+1)==r?e.pos+1:void 0,options:Se(t,r,u),validFor:we}}return{from:n,options:u,validFor:Ce}}}function De(e){return e==b?`type`:e==y?`keyword`:`variable`}function Oe(e,t,n){let r=Object.keys(e).map(r=>n(t?r.toUpperCase():r,De(e[r])));return u([`QuotedIdentifier`,`String`,`LineComment`,`BlockComment`,`.`],d(r))}var ke=_e.configure({props:[t.add({Statement:i()}),l.add({Statement(e,t){return{from:Math.min(e.from+100,t.doc.lineAt(e.from).to),to:e.to}},BlockComment(e){return{from:e.from+2,to:e.to-2}}}),n({Keyword:r.keyword,Type:r.typeName,Builtin:r.standard(r.name),Bits:r.number,Bytes:r.string,Bool:r.bool,Null:r.null,Number:r.number,String:r.string,Identifier:r.name,QuotedIdentifier:r.special(r.string),SpecialVar:r.special(r.name),LineComment:r.lineComment,BlockComment:r.blockComment,Operator:r.operator,"Semi Punctuation":r.punctuation,"( )":r.paren,"{ }":r.brace,"[ ]":r.squareBracket})]}),K=class e{constructor(e,t,n){this.dialect=e,this.language=t,this.spec=n}get extension(){return this.language.extension}configureLanguage(t,n){return new e(this.dialect,this.language.configure(t,n),this.spec)}static define(t){let n=I(t,t.keywords,t.types,t.builtin),r=s.define({name:`sql`,parser:ke.configure({tokenizers:[{from:R,to:L(n)}]}),languageData:{commentTokens:{line:`--`,block:{open:`/*`,close:`*/`}},closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]}}});return new e(n,r,t)}};function Ae(e,t){return{label:e,type:t,boost:-1}}function q(e,t=!1,n){return Oe(e.dialect.words,t,n||Ae)}function J(e){return e.schema?Ee(e.schema,e.tables,e.schemas,e.defaultTable,e.defaultSchema,e.dialect||Y):()=>null}function je(e){return e.schema?(e.dialect||Y).language.data.of({autocomplete:J(e)}):[]}function Me(e={}){let t=e.dialect||Y;return new c(t.language,[je(e),t.language.data.of({autocomplete:q(t,e.upperCaseKeywords,e.keywordCompletion)})])}var Y=K.define({}),Ne=K.define({charSetCasts:!0,doubleDollarQuotedStrings:!0,operatorChars:"+-*/<>=~!@#%^&|`?",specialVar:``,keywords:P+`abort abs absent access according ada admin aggregate alias also always analyse analyze array_agg array_max_cardinality asensitive assert assignment asymmetric atomic attach attribute attributes avg backward base64 begin_frame begin_partition bernoulli bit_length blocked bom cache called cardinality catalog_name ceil ceiling chain char_length character_length character_set_catalog character_set_name character_set_schema characteristics characters checkpoint class class_origin cluster coalesce cobol collation_catalog collation_name collation_schema collect column_name columns command_function command_function_code comment comments committed concurrently condition_number configuration conflict connection_name constant constraint_catalog constraint_name constraint_schema contains content control conversion convert copy corr cost covar_pop covar_samp csv cume_dist current_catalog current_row current_schema cursor_name database datalink datatype datetime_interval_code datetime_interval_precision db debug defaults defined definer degree delimiter delimiters dense_rank depends derived detach detail dictionary disable discard dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue document dump dynamic_function dynamic_function_code element elsif empty enable encoding encrypted end_frame end_partition endexec enforced enum errcode error event every exclude excluding exclusive exp explain expression extension extract family file filter final first_value flag floor following force foreach fortran forward frame_row freeze fs functions fusion generated granted greatest groups handler header hex hierarchy hint id ignore ilike immediately immutable implementation implicit import include including increment indent index indexes info inherit inherits inline insensitive instance instantiable instead integrity intersection invoker isnull key_member key_type label lag last_value lead leakproof least length library like_regex link listen ln load location lock locked log logged lower mapping matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text min minvalue mod mode more move multiset mumps name namespace nfc nfd nfkc nfkd nil normalize normalized nothing notice notify notnull nowait nth_value ntile nullable nullif nulls number occurrences_regex octet_length octets off offset oids operator options ordering others over overlay overriding owned owner parallel parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partition pascal passing passthrough password percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding prepared print_strict_params procedural procedures program publication query quote raise range rank reassign recheck recovery refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex rename repeatable replace replica requiring reset respect restart restore result_oid returned_cardinality returned_length returned_octet_length returned_sqlstate returning reverse routine_catalog routine_name routine_schema routines row_count row_number rowtype rule scale schema_name schemas scope scope_catalog scope_name scope_schema security selective self sensitive sequence sequences serializable server server_name setof share show simple skip slice snapshot source specific_name sqlcode sqlerror sqrt stable stacked standalone statement statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time table_name tables tablesample tablespace temp template ties token top_level_count transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex trigger_catalog trigger_name trigger_schema trim trim_array truncate trusted type types uescape unbounded uncommitted unencrypted unlink unlisten unlogged unnamed untyped upper uri use_column use_variable user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema vacuum valid validate validator value_of var_pop var_samp varbinary variable_conflict variadic verbose version versioning views volatile warning whitespace width_bucket window within wrapper xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate yes`,types:N+`bigint int8 bigserial serial8 varbit bool box bytea cidr circle precision float8 inet int4 json jsonb line lseg macaddr macaddr8 money numeric pg_lsn point polygon float4 int2 smallserial serial2 serial serial4 text timetz timestamptz tsquery tsvector txid_snapshot uuid xml`}),X=`accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill`,Z=N+`bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int1 int2 int3 int4 int8 float4 float8 varbinary varcharacter precision datetime unsigned signed`,Q=`charset clear edit ego help nopager notee nowarning pager print prompt quit rehash source status system tee`,Pe=K.define({operatorChars:`*+-%<>!=&|^`,charSetCasts:!0,doubleQuotedStrings:!0,unquotedBitLiterals:!0,hashComments:!0,spaceAfterDashes:!0,specialVar:`@?`,identifierQuotes:"`",keywords:P+`group_concat `+X,types:Z,builtin:Q}),Fe=K.define({operatorChars:`*+-%<>!=&|^`,charSetCasts:!0,doubleQuotedStrings:!0,unquotedBitLiterals:!0,hashComments:!0,spaceAfterDashes:!0,specialVar:`@?`,identifierQuotes:"`",keywords:P+`always generated groupby_concat hard persistent shutdown soft virtual `+X,types:Z,builtin:Q}),Ie=K.define({keywords:P+`add external procedure all fetch public alter file raiserror and fillfactor read any for readtext as foreign reconfigure asc freetext references authorization freetexttable replication backup from restore begin full restrict between function return break goto revert browse grant revoke bulk group right by having rollback cascade holdlock rowcount case identity rowguidcol check identity_insert rule checkpoint identitycol save close if schema clustered in securityaudit coalesce index select collate inner semantickeyphrasetable column insert semanticsimilaritydetailstable commit intersect semanticsimilaritytable compute into session_user constraint is set contains join setuser containstable key shutdown continue kill some convert left statistics create like system_user cross lineno table current load tablesample current_date merge textsize current_time national then current_timestamp nocheck to current_user nonclustered top cursor not tran database null transaction dbcc nullif trigger deallocate of truncate declare off try_convert default offsets tsequal delete on union deny open unique desc opendatasource unpivot disk openquery update distinct openrowset updatetext distributed openxml use double option user drop or values dump order varying else outer view end over waitfor errlvl percent when escape pivot where except plan while exec precision with execute primary within group exists print writetext exit proc noexpand index forceseek forcescan holdlock nolock nowait paglock readcommitted readcommittedlock readpast readuncommitted repeatableread rowlock serializable snapshot spatial_window_max_cells tablock tablockx updlock xlock keepidentity keepdefaults ignore_constraints ignore_triggers`,types:N+`smalldatetime datetimeoffset datetime2 datetime bigint smallint smallmoney tinyint money real text nvarchar ntext varbinary image hierarchyid uniqueidentifier sql_variant xml`,builtin:`approx_count_distinct approx_percentile_cont approx_percentile_disc avg checksum_agg count count_big grouping grouping_id max min product stdev stdevp sum var varp ai_generate_embeddings ai_generate_chunks cume_dist first_value lag last_value lead percentile_cont percentile_disc percent_rank left_shift right_shift bit_count get_bit set_bit collationproperty tertiary_weights @@datefirst @@dbts @@langid @@language @@lock_timeout @@max_connections @@max_precision @@nestlevel @@options @@remserver @@servername @@servicename @@spid @@textsize @@version cast convert parse try_cast try_convert try_parse asymkey_id asymkeyproperty certproperty cert_id crypt_gen_random decryptbyasymkey decryptbycert decryptbykey decryptbykeyautoasymkey decryptbykeyautocert decryptbypassphrase encryptbyasymkey encryptbycert encryptbykey encryptbypassphrase hashbytes is_objectsigned key_guid key_id key_name signbyasymkey signbycert symkeyproperty verifysignedbycert verifysignedbyasymkey @@cursor_rows @@fetch_status cursor_status datalength ident_current ident_incr ident_seed identity sql_variant_property @@datefirst current_timestamp current_timezone current_timezone_id date_bucket dateadd datediff datediff_big datefromparts datename datepart datetime2fromparts datetimefromparts datetimeoffsetfromparts datetrunc day eomonth getdate getutcdate isdate month smalldatetimefromparts switchoffset sysdatetime sysdatetimeoffset sysutcdatetime timefromparts todatetimeoffset year edit_distance edit_distance_similarity jaro_winkler_distance jaro_winkler_similarity edge_id_from_parts graph_id_from_edge_id graph_id_from_node_id node_id_from_parts object_id_from_edge_id object_id_from_node_id json isjson json_array json_contains json_modify json_object json_path_exists json_query json_value regexp_like regexp_replace regexp_substr regexp_instr regexp_count regexp_matches regexp_split_to_table abs acos asin atan atn2 ceiling cos cot degrees exp floor log log10 pi power radians rand round sign sin sqrt square tan choose greatest iif least @@procid app_name applock_mode applock_test assemblyproperty col_length col_name columnproperty databasepropertyex db_id db_name file_id file_idex file_name filegroup_id filegroup_name filegroupproperty fileproperty filepropertyex fulltextcatalogproperty fulltextserviceproperty index_col indexkey_property indexproperty next value for object_definition object_id object_name object_schema_name objectproperty objectpropertyex original_db_name parsename schema_id schema_name scope_identity serverproperty stats_date type_id type_name typeproperty dense_rank ntile rank row_number publishingservername certenclosed certprivatekey current_user database_principal_id has_dbaccess has_perms_by_name is_member is_rolemember is_srvrolemember loginproperty original_login permissions pwdencrypt pwdcompare session_user sessionproperty suser_id suser_name suser_sid suser_sname system_user user user_id user_name ascii char charindex concat concat_ws difference format left len lower ltrim nchar patindex quotename replace replicate reverse right rtrim soundex space str string_agg string_escape stuff substring translate trim unicode upper $partition @@error @@identity @@pack_received @@rowcount @@trancount binary_checksum checksum compress connectionproperty context_info current_request_id current_transaction_id decompress error_line error_message error_number error_procedure error_severity error_state formatmessage get_filestream_transaction_context getansinull host_id host_name isnull isnumeric min_active_rowversion newid newsequentialid rowcount_big session_context xact_state @@connections @@cpu_busy @@idle @@io_busy @@pack_sent @@packet_errors @@timeticks @@total_errors @@total_read @@total_write textptr textvalid columns_updated eventdata trigger_nestlevel vector_distance vectorproperty vector_search generate_series opendatasource openjson openquery openrowset openxml predict string_split coalesce nullif apply catch filter force include keep keepfixed modify optimize parameterization parameters partition recompile sequence set`,operatorChars:`*+-%<>!=^&|/`,specialVar:`@`,identifierQuotes:`"[`}),Le=K.define({keywords:P+`abort analyze attach autoincrement conflict database detach exclusive fail glob ignore index indexed instead isnull notnull offset plan pragma query raise regexp reindex rename replace temp vacuum virtual`,types:N+`bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int2 int8 unsigned signed real`,builtin:`auth backup bail changes clone databases dbinfo dump echo eqp explain fullschema headers help import imposter indexes iotrace lint load log mode nullvalue once print prompt quit restore save scanstats separator shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width`,operatorChars:`*+-%<>!=&|/~`,identifierQuotes:'`"',specialVar:`@:?$`}),$=K.define({keywords:`add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime infinity NaN`,types:N+`ascii bigint blob counter frozen inet list map static text timeuuid tuple uuid varint`,slashComments:!0}),Re=K.define({keywords:P+`abort accept access add all alter and any arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body by case cast char_base check close cluster clusters colauth column comment commit compress connected constant constraint crash create current currval cursor data_base database dba deallocate debugoff debugon declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry exception exception_init exchange exclusive exists external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base of off offline on online only option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw rebuild record ref references refresh rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work`,builtin:`appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define echo editfile embedded feedback flagger flush heading headsep instance linesize lno loboffset logsource longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar repfooter repheader serveroutput shiftinout show showmode spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout timing trimout trimspool ttitle underline verify version wrap`,types:N+`ascii bfile bfilename bigserial bit blob dec long number nvarchar nvarchar2 serial smallint string text uid varchar2 xml`,operatorChars:`*/+-%<>!=~`,doubleQuotedStrings:!0,charSetCasts:!0,plsqlQuotingMechanism:!0});export{$ as Cassandra,Ie as MSSQL,Fe as MariaSQL,Pe as MySQL,Re as PLSQL,Ne as PostgreSQL,K as SQLDialect,Le as SQLite,Y as StandardSQL,q as keywordCompletionSource,J as schemaCompletionSource,Me as sql};