@inkeep/open-knowledge 0.16.0-beta.1 → 0.16.0-beta.3

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 (137) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +5 -5
  4. package/dist/constants-CRYjinaK.mjs +2 -0
  5. package/dist/{dist-6j4x3nmy.mjs → dist-LI_R8UvH.mjs} +1 -1
  6. package/dist/{dist-Dcg4smYg.mjs → dist-wZSZMIoi.mjs} +5 -5
  7. package/dist/{gh-detect-wbzQ2Z5B.mjs → gh-detect-atRB6-LM.mjs} +2 -2
  8. package/dist/index.mjs +1 -1
  9. package/dist/init-6ubtN129.mjs +1 -0
  10. package/dist/{init-Bd49mCW9.mjs → init-cCb4BV-1.mjs} +4 -4
  11. package/dist/{loader-yyLYaVhN.mjs → loader-CeZuzoj9.mjs} +2 -2
  12. package/dist/loader-D_kZv5X6.mjs +1 -0
  13. package/dist/{preview-DF7SCtlt.mjs → preview-0zWEGOpg.mjs} +2 -2
  14. package/dist/preview-Dvm4NRoB.mjs +1 -0
  15. package/dist/public/assets/{ActivityModeContent-Csy-lYtm.js → ActivityModeContent-Bvn7Dxuo.js} +1 -1
  16. package/dist/public/assets/{ConsentDialogBody-B1OWvzyk.js → ConsentDialogBody-C3cfuPKS.js} +1 -1
  17. package/dist/public/assets/{DocumentContext-C8n-fc7S.js → DocumentContext-BK44vUOF.js} +8 -8
  18. package/dist/public/assets/{GraphPanel-DXELWJD9.js → GraphPanel-Bk3Uhgmb.js} +1 -1
  19. package/dist/public/assets/{McpConsentDialogBody-CtLqSrfK.js → McpConsentDialogBody-CG9ncDqv.js} +1 -1
  20. package/dist/public/assets/{OpenInAgentMenuRequestContext-BqvKATfT.js → OpenInAgentMenuRequestContext-Dn-T6fee.js} +1 -1
  21. package/dist/public/assets/{SettingsDialogBody-CIE_A6cd.js → SettingsDialogBody-B_f7ik71.js} +1 -1
  22. package/dist/public/assets/{SourceEditor-CPuDd_gu.js → SourceEditor-B0xjus9Q.js} +1 -1
  23. package/dist/public/assets/TerminalPanel-BZV-Qu7g.js +145 -0
  24. package/dist/public/assets/{architectureDiagram-Q4EWVU46-BmpF1HV_.js → architectureDiagram-Q4EWVU46-CGfN8F1x.js} +1 -1
  25. package/dist/public/assets/{blockDiagram-DXYQGD6D-Y5N7V1J5.js → blockDiagram-DXYQGD6D-CvqzFRrs.js} +1 -1
  26. package/dist/public/assets/{c4Diagram-AHTNJAMY-BSmJhnUa.js → c4Diagram-AHTNJAMY-CTuRG6XQ.js} +1 -1
  27. package/dist/public/assets/channel-Z7DKCHS6.js +1 -0
  28. package/dist/public/assets/{checkbox-xiDPPQX2.js → checkbox-LNtTTZgr.js} +1 -1
  29. package/dist/public/assets/{chunk-336JU56O-CEtCBsiw.js → chunk-336JU56O-BalL_f4q.js} +2 -2
  30. package/dist/public/assets/{chunk-426QAEUC-xq7mFc66.js → chunk-426QAEUC-CYmyjEj-.js} +1 -1
  31. package/dist/public/assets/{chunk-4TB4RGXK-NJg9d9aO.js → chunk-4TB4RGXK-RPiRkbnR.js} +1 -1
  32. package/dist/public/assets/{chunk-5FUZZQ4R-CG5QQXov.js → chunk-5FUZZQ4R-Bp1iPpGN.js} +1 -1
  33. package/dist/public/assets/{chunk-5PVQY5BW-BFfnnQIi.js → chunk-5PVQY5BW-D2kQfsEU.js} +1 -1
  34. package/dist/public/assets/{chunk-EDXVE4YY-9Eze-YYC.js → chunk-EDXVE4YY-9CmJcS4N.js} +1 -1
  35. package/dist/public/assets/{chunk-ENJZ2VHE-loXqYw4u.js → chunk-ENJZ2VHE-DGOBbqgN.js} +1 -1
  36. package/dist/public/assets/{chunk-ICPOFSXX-Czafge50.js → chunk-ICPOFSXX-Dy9JRPZu.js} +1 -1
  37. package/dist/public/assets/{chunk-OYMX7WX6-ZDun6vrr.js → chunk-OYMX7WX6-tBzsu7Qb.js} +1 -1
  38. package/dist/public/assets/{chunk-U2HBQHQK-CSsi_nQO.js → chunk-U2HBQHQK-DThlp4DR.js} +1 -1
  39. package/dist/public/assets/{chunk-X2U36JSP-DZKPmsbB.js → chunk-X2U36JSP-b_VUmOsG.js} +1 -1
  40. package/dist/public/assets/{chunk-YZCP3GAM-CGzfn7n5.js → chunk-YZCP3GAM-CcH_aTzQ.js} +1 -1
  41. package/dist/public/assets/{chunk-ZZ45TVLE-BUFYnqAJ.js → chunk-ZZ45TVLE-CwnCYU7J.js} +1 -1
  42. package/dist/public/assets/classDiagram-6PBFFD2Q-BlQyIadX.js +1 -0
  43. package/dist/public/assets/classDiagram-v2-HSJHXN6E-DeRDAZjJ.js +1 -0
  44. package/dist/public/assets/clone-B2gSWiE3.js +1 -0
  45. package/dist/public/assets/{collapsible-T5wuIIwr.js → collapsible-CiYR1NR5.js} +1 -1
  46. package/dist/public/assets/config-validation-events-BFEw_0e9.js +12 -0
  47. package/dist/public/assets/{dagre-BE13jSMp.js → dagre--CGfxwL9.js} +1 -1
  48. package/dist/public/assets/{dagre-KV5264BT-WCVh4vDo.js → dagre-KV5264BT-Bgd9TndA.js} +1 -1
  49. package/dist/public/assets/{diagram-5BDNPKRD-BwCuU4A5.js → diagram-5BDNPKRD-YjznpYlO.js} +1 -1
  50. package/dist/public/assets/{diagram-G4DWMVQ6-SnuxFspv.js → diagram-G4DWMVQ6-Dg1TlI6M.js} +1 -1
  51. package/dist/public/assets/{diagram-MMDJMWI5-diafFr4-.js → diagram-MMDJMWI5-BJ7btGpD.js} +1 -1
  52. package/dist/public/assets/{diagram-TYMM5635-CdBAiH95.js → diagram-TYMM5635-BlLor9aT.js} +1 -1
  53. package/dist/public/assets/{dialog-DAnNTn2Z.js → dialog-CtMCOb1V.js} +1 -1
  54. package/dist/public/assets/{dist-rGiGXpRA.js → dist-B-IVhlJQ.js} +1 -1
  55. package/dist/public/assets/{dist-0kDsAKH1.js → dist-B9B58-J_.js} +1 -1
  56. package/dist/public/assets/{dist-DZpmpDA6.js → dist-Bn0QvNGs.js} +1 -1
  57. package/dist/public/assets/{dist-De7_06z9.js → dist-Bui1BhSw.js} +1 -1
  58. package/dist/public/assets/{dist--WFXzgaP.js → dist-C0jOOVYt.js} +1 -1
  59. package/dist/public/assets/{dist-D2xbbdaz2.js → dist-CjXb6uie.js} +1 -1
  60. package/dist/public/assets/{dist-y6LKqPoG.js → dist-CkyAinZx.js} +1 -1
  61. package/dist/public/assets/{dist-CLIXxF0N.js → dist-D1rVZYi52.js} +1 -1
  62. package/dist/public/assets/{dist-ChSeukn9.js → dist-Debx6b6u.js} +1 -1
  63. package/dist/public/assets/{dist-B5LD73X3.js → dist-Mxq-zflt.js} +1 -1
  64. package/dist/public/assets/{dist-3YNajely.js → dist-j3LJSXW6.js} +1 -1
  65. package/dist/public/assets/{dist-C7u3xI_X.js → dist-pSQcUvmU.js} +1 -1
  66. package/dist/public/assets/{dist-DANsqx2U.js → dist-qcpgtxJO.js} +1 -1
  67. package/dist/public/assets/{erDiagram-SMLLAGMA-DkWe230D.js → erDiagram-SMLLAGMA-CbusJ6ai.js} +1 -1
  68. package/dist/public/assets/{flowDiagram-DWJPFMVM-XblEo1i_.js → flowDiagram-DWJPFMVM-n690iqHN.js} +1 -1
  69. package/dist/public/assets/{ganttDiagram-T4ZO3ILL-BSG2Y6qr.js → ganttDiagram-T4ZO3ILL-CZUxDSBT.js} +1 -1
  70. package/dist/public/assets/{gitGraphDiagram-UUTBAWPF-D20pkY4t.js → gitGraphDiagram-UUTBAWPF-C6qYFsUb.js} +1 -1
  71. package/dist/public/assets/{graphlib-DTVXa63Y.js → graphlib-CxIN2cpg.js} +1 -1
  72. package/dist/public/assets/index-C428DlDI.css +1 -0
  73. package/dist/public/assets/index-Cb45dDN8.js +2019 -0
  74. package/dist/public/assets/{infoDiagram-42DDH7IO-BHIgui2V.js → infoDiagram-42DDH7IO-Csns7giJ.js} +1 -1
  75. package/dist/public/assets/{ishikawaDiagram-UXIWVN3A-COySm_Yo.js → ishikawaDiagram-UXIWVN3A-2JnHk_DL.js} +1 -1
  76. package/dist/public/assets/{journeyDiagram-VCZTEJTY-DqyhAR_2.js → journeyDiagram-VCZTEJTY-W5sor6G2.js} +1 -1
  77. package/dist/public/assets/{kanban-definition-6JOO6SKY-Boud3nvx.js → kanban-definition-6JOO6SKY-BcHKSFEp.js} +1 -1
  78. package/dist/public/assets/{keyboard-shortcuts-DNu_Qz96.js → keyboard-shortcuts-CqOYTsQU.js} +1 -1
  79. package/dist/public/assets/{line-D5idNiE3.js → line-BPa9YIgj.js} +1 -1
  80. package/dist/public/assets/{mermaid.core-CiuNJTJu.js → mermaid.core-srYvzXpO.js} +3 -3
  81. package/dist/public/assets/{mindmap-definition-QFDTVHPH-DKb2WzOx.js → mindmap-definition-QFDTVHPH-TBwtPWpG.js} +1 -1
  82. package/dist/public/assets/{pieDiagram-DEJITSTG-Du2iXB7c.js → pieDiagram-DEJITSTG-iP5EAWOK.js} +1 -1
  83. package/dist/public/assets/{project-paths-BocrcwYE.js → project-paths-By95zyI0.js} +1 -1
  84. package/dist/public/assets/{prop-types-CDQJyL6r.js → prop-types-CqTEMXrE.js} +1 -1
  85. package/dist/public/assets/{propagation-api-CuTE-jIt.js → propagation-api-qAYD7s-v.js} +1 -1
  86. package/dist/public/assets/{quadrantDiagram-34T5L4WZ-BXGwjhjK.js → quadrantDiagram-34T5L4WZ-CRzlf10O.js} +1 -1
  87. package/dist/public/assets/{requirementDiagram-MS252O5E-be2pdwJN.js → requirementDiagram-MS252O5E-Bg9QnuLQ.js} +1 -1
  88. package/dist/public/assets/{sankeyDiagram-XADWPNL6-B1I7kyez.js → sankeyDiagram-XADWPNL6-Cl4zPODp.js} +1 -1
  89. package/dist/public/assets/{sequenceDiagram-FGHM5R23-PxdXu77F.js → sequenceDiagram-FGHM5R23-B9LxUMHK.js} +1 -1
  90. package/dist/public/assets/{stateDiagram-FHFEXIEX-C34JyCcn.js → stateDiagram-FHFEXIEX-C8mEBLKf.js} +1 -1
  91. package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-60n5CD_7.js +1 -0
  92. package/dist/public/assets/{target-navigation-intent-Bveb0MPP.js → target-navigation-intent-DkDGdaxv.js} +1 -1
  93. package/dist/public/assets/{telemetry-impl-DoqF2oxU.js → telemetry-impl-B69NnnZ-.js} +1 -1
  94. package/dist/public/assets/terminal-theme-BhdZI3O9.js +1 -0
  95. package/dist/public/assets/{textarea-BuWgZ9oe.js → textarea-BeqA3EKD.js} +1 -1
  96. package/dist/public/assets/{timeline-definition-GMOUNBTQ-C8WcLn1-.js → timeline-definition-GMOUNBTQ-BdBq3Z-G.js} +1 -1
  97. package/dist/public/assets/{toggle-group-DsOyo0jm.js → toggle-group-Df7XaPvr.js} +1 -1
  98. package/dist/public/assets/{tooltip-DhvUSgK7.js → tooltip-Bp4cM4E8.js} +1 -1
  99. package/dist/public/assets/{vennDiagram-DHZGUBPP-CdzC1YU4.js → vennDiagram-DHZGUBPP-CJt2-p2B.js} +1 -1
  100. package/dist/public/assets/{wardleyDiagram-NUSXRM2D-TZAW47QU.js → wardleyDiagram-NUSXRM2D-CB_N5pVU.js} +1 -1
  101. package/dist/public/assets/{xychartDiagram-5P7HB3ND-Cu0DCktc.js → xychartDiagram-5P7HB3ND-DtVg628z.js} +1 -1
  102. package/dist/public/index.html +34 -34
  103. package/dist/{repair-launch-json-IjDH1MEo.mjs → repair-launch-json-D2xWr0yE.mjs} +2 -2
  104. package/dist/{repair-mcp-configs-DP8S99Yv.mjs → repair-mcp-configs-ovMudNql.mjs} +2 -2
  105. package/dist/repair-skills-DN4CoxxN.mjs +1 -0
  106. package/dist/{repair-skills-DsHqeRKO.mjs → repair-skills-DzMAdfno.mjs} +2 -2
  107. package/dist/{server-lock-BpjJj3OD-DlYx_Xz-.mjs → server-lock-BpjJj3OD-Cia38KR1.mjs} +56 -56
  108. package/dist/server-lock-CyhBidkz-tjTa2PuV.mjs +1 -0
  109. package/dist/{src-6vQuUOgy.mjs → src-DPU6_Fcs.mjs} +2 -2
  110. package/dist/{start-DnZWr4Pv.mjs → start-DbXSdBjV.mjs} +2 -2
  111. package/dist/start-DqRZ-r6P.mjs +1 -0
  112. package/dist/{write-project-skill-C5HoLkCk.mjs → write-project-skill-DcTlTtX0.mjs} +2 -2
  113. package/package.json +1 -1
  114. package/dist/constants-PrZJ-CTv.mjs +0 -2
  115. package/dist/init-CmEFD2yV.mjs +0 -1
  116. package/dist/loader-BMjYHLZp.mjs +0 -1
  117. package/dist/preview-DVsrv_hV.mjs +0 -1
  118. package/dist/public/assets/TerminalPanel-Cs6SOojP.js +0 -145
  119. package/dist/public/assets/channel-CxWPLabj.js +0 -1
  120. package/dist/public/assets/classDiagram-6PBFFD2Q-r3Z_tLK2.js +0 -1
  121. package/dist/public/assets/classDiagram-v2-HSJHXN6E-f9ZLpuaz.js +0 -1
  122. package/dist/public/assets/clone-te25EaCJ.js +0 -1
  123. package/dist/public/assets/config-validation-events-C0vw-EiG.js +0 -12
  124. package/dist/public/assets/index-BnOmMrYn.js +0 -2019
  125. package/dist/public/assets/index-CZh9fj9x.css +0 -1
  126. package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-CXoHW-xm.js +0 -1
  127. package/dist/public/assets/trash-2-C957VvQL.js +0 -1
  128. package/dist/repair-skills-DrcVDbk1.mjs +0 -1
  129. package/dist/server-lock-CyhBidkz-DUTkjNDG.mjs +0 -1
  130. package/dist/start-DQUEhZj2.mjs +0 -1
  131. /package/dist/public/assets/{dist-FC83wUOI.js → dist-CUqyztDT.js} +0 -0
  132. /package/dist/public/assets/{dist-QyEeuecv.js → dist-rFfpDyC7.js} +0 -0
  133. /package/dist/public/assets/{katex-BnO72pd2.js → katex-DBuiuHex.js} +0 -0
  134. /package/dist/public/assets/{mcp-consent-store-DWTjYi5_.js → mcp-consent-store-BmlKYN7O.js} +0 -0
  135. /package/dist/public/assets/{stex-CKKDmQmi.js → stex-CGHNatva.js} +0 -0
  136. /package/dist/public/assets/{trace-api-CbLDdnQA.js → trace-api-DPMyR1_m.js} +0 -0
  137. /package/dist/public/assets/{w3c-keyname-CIO0QKme.js → w3c-keyname-nBRha8PK.js} +0 -0
@@ -1 +1 @@
1
- import{T as e,_ as t,b as n,c as r,d as i,f as a,g as o,h as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h,v as ee}from"./reduce-Cr8PO88G.js";import{C as te,f as ne,h as g,i as re,n as ie,t as ae,u as oe}from"./_baseFor-BB4KANPr.js";import{n as se,r as ce,t as le}from"./isObjectLike-BWNDxuxw.js";import{i as ue,n as de}from"./isEmpty-Bq6bzoiF.js";import{t as fe}from"./isSymbol-W-l9JIco.js";import{a as _,i as pe,n as v,o as me,r as he,t as y}from"./flatten-BHQFj2az.js";import{C as ge,N as _e,S as ve,T as b,_ as x,b as ye,v as S,x as C,y as be}from"./chunk-5PVQY5BW-BFfnnQIi.js";import{i as xe,n as w,r as T,t as E}from"./graphlib-DTVXa63Y.js";import{n as Se,t as Ce}from"./now-F1RJRIcM.js";var we=1/0,Te=17976931348623157e292;function D(e){return e?(e=Se(e),e===we||e===-we?(e<0?-1:1)*Te:e===e?e:0):e===0?e:0}function Ee(e){var t=D(e),n=t%1;return t===t?n?t-n:t:0}function De(e){return ye(ve(e,void 0,y),e+``)}var Oe=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function ke(e){return Oe.test(e)}var Ae=1,je=4;function Me(e){return xe(e,Ae|je)}var Ne=Object.prototype,Pe=Ne.hasOwnProperty,Fe=be(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&S(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=ge(a),s=-1,c=o.length;++s<c;){var l=o[s],u=e[l];(u===void 0||te(u,Ne[l])&&!Pe.call(e,l))&&(e[l]=a[l])}return e});function O(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function Ie(e){return function(t,r,a){var o=Object(t);if(!re(t)){var s=i(r,3);t=n(t),r=function(e){return s(o[e],e,o)}}var c=e(t,r,a);return c>-1?o[s?t[c]:c]:void 0}}var Le=Math.max;function Re(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var a=n==null?0:Ee(n);return a<0&&(a=Le(r+a,0)),u(e,i(t,3),a)}var k=Ie(Re);function ze(e,t){return e==null?e:ae(e,f(t),ge)}function Be(e,t){return e&&h(e,f(t))}function Ve(e,t){return e>t}var He=Object.prototype.hasOwnProperty;function Ue(e,t){return e!=null&&He.call(e,t)}function We(e,t){return e!=null&&c(e,t,Ue)}var Ge=`[object String]`;function Ke(e){return typeof e==`string`||!g(e)&&le(e)&&ce(e)==Ge}function A(e,t){var n={};return t=i(t,3),h(e,function(e,r,i){_e(n,r,t(e,r,i))}),n}function j(e){return e&&e.length?pe(e,ie,Ve):void 0}function M(e,t){return e&&e.length?pe(e,i(t,2),he):void 0}function qe(e,n,r,i){if(!se(e))return e;n=t(n,e);for(var a=-1,s=n.length,c=s-1,l=e;l!=null&&++a<s;){var u=o(n[a]),d=r;if(u===`__proto__`||u===`constructor`||u===`prototype`)return e;if(a!=c){var f=l[u];d=i?i(f,u,l):void 0,d===void 0&&(d=se(f)?f:ne(n[a+1])?[]:{})}b(l,u,d),l=l[u]}return e}function Je(e,n,r){for(var i=-1,a=n.length,o={};++i<a;){var c=n[i],l=s(e,c);r(l,c)&&qe(o,t(c,e),l)}return o}function Ye(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Xe(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=fe(e),o=t!==void 0,s=t===null,c=t===t,l=fe(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 Ze(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=Xe(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function Qe(t,n,r){n=n.length?e(n,function(e){return g(e)?function(t){return s(t,e.length===1?e[0]:e)}:e}):[ie];var a=-1;return n=e(n,oe(i)),Ye(me(t,function(t,r,i){return{criteria:e(n,function(e){return e(t)}),index:++a,value:t}}),function(e,t){return Ze(e,t,r)})}var $e=a(`length`),et=`\\ud800-\\udfff`,tt=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,nt=`\\ufe0e\\ufe0f`,rt=`[`+et+`]`,N=`[`+tt+`]`,P=`\\ud83c[\\udffb-\\udfff]`,it=`(?:`+N+`|`+P+`)`,at=`[^`+et+`]`,ot=`(?:\\ud83c[\\udde6-\\uddff]){2}`,st=`[\\ud800-\\udbff][\\udc00-\\udfff]`,ct=`\\u200d`,lt=it+`?`,ut=`[`+nt+`]?`,dt=`(?:`+ct+`(?:`+[at,ot,st].join(`|`)+`)`+ut+lt+`)*`,ft=ut+lt+dt,pt=`(?:`+[at+N+`?`,N,ot,st,rt].join(`|`)+`)`,mt=RegExp(P+`(?=`+P+`)|`+pt+ft,`g`);function ht(e){for(var t=mt.lastIndex=0;mt.test(e);)++t;return t}function gt(e){return ke(e)?ht(e):$e(e)}function _t(e,t){return Je(e,t,function(t,n){return d(e,n)})}var F=De(function(e,t){return e==null?{}:_t(e,t)}),vt=Math.ceil,yt=Math.max;function bt(e,t,n,r){for(var i=-1,a=yt(vt((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function xt(e){return function(t,n,r){return r&&typeof r!=`number`&&S(t,n,r)&&(n=r=void 0),t=D(t),n===void 0?(n=t,t=0):n=D(n),r=r===void 0?t<n?1:-1:D(r),bt(t,n,r,e)}}var I=xt(),St=`[object Map]`,Ct=`[object Set]`;function wt(e){if(e==null)return 0;if(re(e))return Ke(e)?gt(e):e.length;var t=de(e);return t==St||t==Ct?e.size:ue(e).length}var L=be(function(e,t){if(e==null)return[];var n=t.length;return n>1&&S(e,t[0],t[1])?t=[]:n>2&&S(t[0],t[1],t[2])&&(t=[t[0]]),Qe(e,p(t,1),[])}),Tt=0;function R(e){var t=++Tt;return ee(e)+t}function Et(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 Dt(e,t){return Et(e||[],t||[],b)}var Ot=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return kt(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&kt(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,At)),n=n._prev;return`[`+e.join(`, `)+`]`}};function kt(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function At(e,t){if(e!==`_next`&&e!==`_prev`)return t}var jt=C(1);function Mt(e,t){if(e.nodeCount()<=1)return[];var n=Pt(e,t||jt);return y(_(Nt(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function Nt(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)z(e,t,n,o);for(;o=i.dequeue();)z(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(z(e,t,n,o,!0));break}}}return r}function z(e,t,n,r,i){var a=i?[]:void 0;return l(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,B(t,n,s)}),l(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,B(t,n,o)}),e.removeNode(r.v),a}function Pt(e,t){var n=new E,r=0,i=0;l(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),l(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=I(i+r+3).map(function(){return new Ot}),o=r+1;return l(n.nodes(),function(e){B(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function B(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 Ft(e){l(e.graph().acyclicer===`greedy`?Mt(e,t(e)):It(e),function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,R(`rev`))});function t(e){return function(t){return e.edge(t).weight}}}function It(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,l(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return l(e.nodes(),i),t}function Lt(e){l(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 V(e,t,n,r){var i;do i=R(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function Rt(e){var t=new E().setGraph(e.graph());return l(e.nodes(),function(n){t.setNode(n,e.node(n))}),l(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 zt(e){var t=new E({multigraph:e.isMultigraph()}).setGraph(e.graph());return l(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),l(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function Bt(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 H(e){var t=_(I(Wt(e)+1),function(){return[]});return l(e.nodes(),function(n){var r=e.node(n),i=r.rank;w(i)||(t[i][r.order]=n)}),t}function Vt(e){var t=v(_(e.nodes(),function(t){return e.node(t).rank}));l(e.nodes(),function(n){var r=e.node(n);We(r,`rank`)&&(r.rank-=t)})}function Ht(e){var t=v(_(e.nodes(),function(t){return e.node(t).rank})),n=[];l(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;l(n,function(t,n){w(t)&&n%i!==0?--r:r&&l(t,function(t){e.node(t).rank+=r})})}function Ut(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),V(e,`border`,i,t)}function Wt(e){return j(_(e.nodes(),function(t){var n=e.node(t).rank;if(!w(n))return n}))}function Gt(e,t){var n={lhs:[],rhs:[]};return l(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Kt(e,t){var n=Ce();try{return t()}finally{console.log(e+` time: `+(Ce()-n)+`ms`)}}function qt(e,t){return t()}function Jt(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&l(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)Yt(e,`borderLeft`,`_bl`,n,i,a),Yt(e,`borderRight`,`_br`,n,i,a)}}l(e.children(),t)}function Yt(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=V(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Xt(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&Qt(e)}function Zt(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&en(e),(t===`lr`||t===`rl`)&&(tn(e),Qt(e))}function Qt(e){l(e.nodes(),function(t){$t(e.node(t))}),l(e.edges(),function(t){$t(e.edge(t))})}function $t(e){var t=e.width;e.width=e.height,e.height=t}function en(e){l(e.nodes(),function(t){U(e.node(t))}),l(e.edges(),function(t){var n=e.edge(t);l(n.points,U),Object.prototype.hasOwnProperty.call(n,`y`)&&U(n)})}function U(e){e.y=-e.y}function tn(e){l(e.nodes(),function(t){W(e.node(t))}),l(e.edges(),function(t){var n=e.edge(t);l(n.points,W),Object.prototype.hasOwnProperty.call(n,`x`)&&W(n)})}function W(e){var t=e.x;e.x=e.y,e.y=t}function nn(e){e.graph().dummyChains=[],l(e.edges(),function(t){rn(e,t)})}function rn(e,t){var n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a!==r+1){e.removeEdge(t);var l=void 0,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],l={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},u=V(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 an(e){l(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 G(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=v(_(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}l(e.sources(),n)}function K(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function on(e){var t=new E({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;sn(t,e)<r;)i=cn(t,e),a=t.hasNode(i.v)?K(e,i):-K(e,i),ln(t,e,a);return t}function sn(e,t){function n(r){l(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!K(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return l(e.nodes(),n),e.nodeCount()}function cn(e,t){return M(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return K(t,n)})}function ln(e,t,n){l(e.nodes(),function(e){t.node(e).rank+=n})}C(1),C(1),un.CycleException=q;function un(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,l(e.predecessors(a),i),delete n[a],r.push(a))}if(l(e.sinks(),i),wt(t)!==e.nodeCount())throw new q;return r}function q(){}q.prototype=Error();function dn(e,t,n){g(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return l(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);fn(e,t,n===`post`,a,r,i)}),i}function fn(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),l(i(t),function(t){fn(e,t,n,r,i,a)}),n&&a.push(t))}function pn(e,t){return dn(e,t,`post`)}function mn(e,t){return dn(e,t,`pre`)}J.initLowLimValues=X,J.initCutValues=Y,J.calcCutValue=gn,J.leaveEdge=vn,J.enterEdge=yn,J.exchangeEdges=Z;function J(e){e=Rt(e),G(e);var t=on(e);X(t),Y(t,e);for(var n,r;n=vn(t);)r=yn(t,e,n),Z(t,e,n,r)}function Y(e,t){var n=pn(e,e.nodes());n=n.slice(0,n.length-1),l(n,function(n){hn(e,t,n)})}function hn(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=gn(e,t,n)}function gn(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,l(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,xn(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function X(e,t){arguments.length<2&&(t=e.nodes()[0]),_n(e,{},1,t)}function _n(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,l(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=_n(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function vn(e){return k(e.edges(),function(t){return e.edge(t).cutvalue<0})}function yn(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var o=e.node(i),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),M(r(t.edges(),function(t){return l===Sn(e,e.node(t.v),c)&&l!==Sn(e,e.node(t.w),c)}),function(e){return K(t,e)})}function Z(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),X(e),Y(e,t),bn(e,t)}function bn(e,t){var n=mn(e,k(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),l(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 xn(e,t,n){return e.hasEdge(t,n)}function Sn(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function Cn(e){switch(e.graph().ranker){case`network-simplex`:En(e);break;case`tight-tree`:Tn(e);break;case`longest-path`:wn(e);break;default:En(e)}}var wn=G;function Tn(e){G(e),on(e)}function En(e){J(e)}function Dn(e){var t=V(e,`root`,{},`_root`),n=kn(e),r=j(T(n))-1,i=2*r+1;e.graph().nestingRoot=t,l(e.edges(),function(t){e.edge(t).minlen*=i});var a=An(e)+1;l(e.children(),function(o){On(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function On(e,t,n,r,i,a,o){var s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}var c=Ut(e,`_bt`),u=Ut(e,`_bb`),d=e.node(o);e.setParent(c,o),d.borderTop=c,e.setParent(u,o),d.borderBottom=u,l(s,function(s){On(e,t,n,r,i,a,s);var l=e.node(s),d=l.borderTop?l.borderTop:s,f=l.borderBottom?l.borderBottom:s,p=l.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,u,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+a[o]})}function kn(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&l(a,function(e){n(e,i+1)}),t[r]=i}return l(e.children(),function(e){n(e,1)}),t}function An(e){return m(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function jn(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,l(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function Mn(e,t,n){var r={},i;l(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 Nn(e,t,n){var r=Pn(e),i=new E({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return l(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),l(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=w(r)?0:r.weight;i.setEdge(n,a,{weight:e.edge(t).weight+o})}),Object.prototype.hasOwnProperty.call(o,`minRank`)&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function Pn(e){for(var t;e.hasNode(t=R(`_root`)););return t}function Fn(e,t){for(var n=0,r=1;r<t.length;++r)n+=In(e,t[r-1],t[r]);return n}function In(e,t,n){for(var r=Dt(n,_(n,function(e,t){return t})),i=y(_(t,function(t){return L(_(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=_(Array(o),function(){return 0}),c=0;return l(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 Ln(e){var t={},n=r(e.nodes(),function(t){return!e.children(t).length}),i=_(I(j(_(n,function(t){return e.node(t).rank}))+1),function(){return[]});function a(n){We(t,n)||(t[n]=!0,i[e.node(n).rank].push(n),l(e.successors(n),a))}return l(L(n,function(t){return e.node(t).rank}),a),i}function Rn(e,t){return _(t,function(t){var n=e.inEdges(t);if(n.length){var r=m(n,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}function zn(e,t){var n={};return l(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};w(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),l(t.edges(),function(e){var t=n[e.v],r=n[e.w];!w(t)&&!w(r)&&(r.indegree++,t.out.push(n[e.w]))}),Bn(r(n,function(e){return!e.indegree}))}function Bn(e){var t=[];function n(e){return function(t){t.merged||(w(t.barycenter)||w(e.barycenter)||t.barycenter>=e.barycenter)&&Vn(e,t)}}function i(t){return function(n){n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){var a=e.pop();t.push(a),l(a.in.reverse(),n(a)),l(a.out,i(a))}return _(r(t,function(e){return!e.merged}),function(e){return F(e,[`vs`,`i`,`barycenter`,`weight`])})}function Vn(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 Hn(e,t){var n=Gt(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=L(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,c=0;r.sort(Wn(!!t)),c=Un(a,i,c),l(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=Un(a,i,c)});var u={vs:y(a)};return s&&(u.barycenter=o/s,u.weight=s),u}function Un(e,t,n){for(var r;t.length&&(r=O(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Wn(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 Gn(e,t,n,i){var a=e.children(t),o=e.node(t),s=o?o.borderLeft:void 0,c=o?o.borderRight:void 0,u={};s&&(a=r(a,function(e){return e!==s&&e!==c}));var d=Rn(e,a);l(d,function(t){if(e.children(t.v).length){var r=Gn(e,t.v,n,i);u[t.v]=r,Object.prototype.hasOwnProperty.call(r,`barycenter`)&&qn(t,r)}});var f=zn(d,n);Kn(f,u);var p=Hn(f,i);if(s&&(p.vs=y([s,p.vs,c]),e.predecessors(s).length)){var m=e.node(e.predecessors(s)[0]),h=e.node(e.predecessors(c)[0]);Object.prototype.hasOwnProperty.call(p,`barycenter`)||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+m.order+h.order)/(p.weight+2),p.weight+=2}return p}function Kn(e,t){l(e,function(e){e.vs=y(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function qn(e,t){w(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function Jn(e){var t=Wt(e),n=Yn(e,I(1,t+1),`inEdges`),r=Yn(e,I(t-1,-1,-1),`outEdges`),i=Ln(e);Zn(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){Xn(s%2?n:r,s%4>=2),i=H(e);var l=Fn(e,i);l<a&&(c=0,o=Me(i),a=l)}Zn(e,o)}function Yn(e,t,n){return _(t,function(t){return Nn(e,t,n)})}function Xn(e,t){var n=new E;l(e,function(e){var r=e.graph().root,i=Gn(e,r,n,t);l(i.vs,function(t,n){e.node(t).order=n}),Mn(e,n,i.vs)})}function Zn(e,t){l(t,function(t){l(t,function(t,n){e.node(t).order=n})})}function Qn(e){var t=er(e);l(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=$n(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 $n(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 er(e){var t={},n=0;function r(i){var a=n;l(e.children(i),r),t[i]={low:a,lim:n++}}return l(e.children(),r),t}function tr(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=O(r);return l(r,function(t,c){var u=rr(e,t),d=u?e.node(u).order:o;(u||t===s)&&(l(r.slice(a,c+1),function(t){l(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||d<o)&&!(a.dummy&&e.node(t).dummy)&&ir(n,r,t)})}),a=c+1,i=d)}),r}return m(t,r),n}function nr(e,t){var n={};function r(t,r,i,a,o){var s;l(I(r,i),function(r){s=t[r],e.node(s).dummy&&l(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&ir(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return l(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 m(t,i),n}function rr(e,t){if(e.node(t).dummy)return k(e.predecessors(t),function(t){return e.node(t).dummy})}function ir(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 ar(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function or(e,t,n,r){var i={},a={},o={};return l(t,function(e){l(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),l(t,function(e){var t=-1;l(e,function(e){var s=r(e);if(s.length){s=L(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]&&!ar(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function sr(e,t,n,r,i){var a={},o=cr(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 u(e){a[e]=o.inEdges(e).reduce(function(e,t){return Math.max(e,a[t.v]+o.edge(t))},0)}function d(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(u,o.predecessors.bind(o)),c(d,o.successors.bind(o)),l(r,function(e){a[e]=a[n[e]]}),a}function cr(e,t,n,r){var i=new E,a=e.graph(),o=pr(a.nodesep,a.edgesep,r);return l(t,function(t){var r;l(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 lr(e,t){return M(T(t),function(t){var n=-1/0,r=1/0;return ze(t,function(t,i){var a=mr(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function ur(e,t){var n=T(t),r=v(n),i=j(n);l([`u`,`d`],function(n){l([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=T(s);c=a===`l`?r-v(l):i-j(l),c&&(e[o]=A(s,function(e){return e+c}))}})})}function dr(e,t){return A(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=L(_(e,r));return(i[1]+i[2])/2})}function fr(e){var t=H(e),n=x(tr(e,t),nr(e,t)),r={},i;return l([`u`,`d`],function(a){i=a===`u`?t:T(t).reverse(),l([`l`,`r`],function(t){t===`r`&&(i=_(i,function(e){return T(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=or(e,i,n,o),c=sr(e,i,s.root,s.align,t===`r`);t===`r`&&(c=A(c,function(e){return-e})),r[a+t]=c})}),ur(r,lr(e,r)),dr(r,e.graph().align)}function pr(e,t,n){return function(r,i,a){var o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.prototype.hasOwnProperty.call(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.prototype.hasOwnProperty.call(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function mr(e,t){return e.node(t).width}function hr(e){e=zt(e),gr(e),Be(fr(e),function(t,n){e.node(n).x=t})}function gr(e){var t=H(e),n=e.graph().ranksep,r=0;l(t,function(t){var i=j(_(t,function(t){return e.node(t).height}));l(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function _r(e,t){var n=t&&t.debugTiming?Kt:qt;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>Or(e));n(` runLayout`,()=>vr(t,n)),n(` updateInputGraph`,()=>yr(e,t))})}function vr(e,t){t(` makeSpaceForEdgeLabels`,()=>kr(e)),t(` removeSelfEdges`,()=>Rr(e)),t(` acyclic`,()=>Ft(e)),t(` nestingGraph.run`,()=>Dn(e)),t(` rank`,()=>Cn(zt(e))),t(` injectEdgeLabelProxies`,()=>Ar(e)),t(` removeEmptyRanks`,()=>Ht(e)),t(` nestingGraph.cleanup`,()=>jn(e)),t(` normalizeRanks`,()=>Vt(e)),t(` assignRankMinMax`,()=>jr(e)),t(` removeEdgeLabelProxies`,()=>Mr(e)),t(` normalize.run`,()=>nn(e)),t(` parentDummyChains`,()=>Qn(e)),t(` addBorderSegments`,()=>Jt(e)),t(` order`,()=>Jn(e)),t(` insertSelfEdges`,()=>zr(e)),t(` adjustCoordinateSystem`,()=>Xt(e)),t(` position`,()=>hr(e)),t(` positionSelfEdges`,()=>Br(e)),t(` removeBorderNodes`,()=>Lr(e)),t(` normalize.undo`,()=>an(e)),t(` fixupEdgeLabelCoords`,()=>Fr(e)),t(` undoCoordinateSystem`,()=>Zt(e)),t(` translateGraph`,()=>Nr(e)),t(` assignNodeIntersects`,()=>Pr(e)),t(` reversePoints`,()=>Ir(e)),t(` acyclic.undo`,()=>Lt(e))}function yr(e,t){l(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))}),l(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 br=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],xr={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},Sr=[`acyclicer`,`ranker`,`rankdir`,`align`],Cr=[`width`,`height`],wr={width:0,height:0},Tr=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Er={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Dr=[`labelpos`];function Or(e){var t=new E({multigraph:!0,compound:!0}),n=$(e.graph());return t.setGraph(x({},xr,Q(n,br),F(n,Sr))),l(e.nodes(),function(n){var r=$(e.node(n));t.setNode(n,Fe(Q(r,Cr),wr)),t.setParent(n,e.parent(n))}),l(e.edges(),function(n){var r=$(e.edge(n));t.setEdge(n,x({},Er,Q(r,Tr),F(r,Dr)))}),t}function kr(e){var t=e.graph();t.ranksep/=2,l(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 Ar(e){l(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);V(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function jr(e){var t=0;l(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=j(t,r.maxRank))}),e.graph().maxRank=t}function Mr(e){l(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function Nr(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)}l(e.nodes(),function(t){c(e.node(t))}),l(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,l(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),l(e.edges(),function(n){var i=e.edge(n);l(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 Pr(e){l(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(Bt(r,a)),n.points.push(Bt(i,o))})}function Fr(e){l(e.edges(),function(t){var n=e.edge(t);if(Object.prototype.hasOwnProperty.call(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function Ir(e){l(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function Lr(e){l(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(O(n.borderLeft)),o=e.node(O(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}}),l(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function Rr(e){l(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 zr(e){l(H(e),function(t){var n=0;l(t,function(t,r){var i=e.node(t);i.order=r+n,l(i.selfEdges,function(t){V(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 Br(e){l(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 Q(e,t){return A(F(e,t),Number)}function $(e){var t={};return l(e,function(e,n){t[n.toLowerCase()]=e}),t}export{_r as t};
1
+ import{T as e,_ as t,b as n,c as r,d as i,f as a,g as o,h as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h,v as ee}from"./reduce-Cr8PO88G.js";import{C as te,f as ne,h as g,i as re,n as ie,t as ae,u as oe}from"./_baseFor-BB4KANPr.js";import{n as se,r as ce,t as le}from"./isObjectLike-BWNDxuxw.js";import{i as ue,n as de}from"./isEmpty-Bq6bzoiF.js";import{t as fe}from"./isSymbol-W-l9JIco.js";import{a as _,i as pe,n as v,o as me,r as he,t as y}from"./flatten-BHQFj2az.js";import{C as ge,N as _e,S as ve,T as b,_ as x,b as ye,v as S,x as C,y as be}from"./chunk-5PVQY5BW-D2kQfsEU.js";import{i as xe,n as w,r as T,t as E}from"./graphlib-CxIN2cpg.js";import{n as Se,t as Ce}from"./now-F1RJRIcM.js";var we=1/0,Te=17976931348623157e292;function D(e){return e?(e=Se(e),e===we||e===-we?(e<0?-1:1)*Te:e===e?e:0):e===0?e:0}function Ee(e){var t=D(e),n=t%1;return t===t?n?t-n:t:0}function De(e){return ye(ve(e,void 0,y),e+``)}var Oe=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function ke(e){return Oe.test(e)}var Ae=1,je=4;function Me(e){return xe(e,Ae|je)}var Ne=Object.prototype,Pe=Ne.hasOwnProperty,Fe=be(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&S(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=ge(a),s=-1,c=o.length;++s<c;){var l=o[s],u=e[l];(u===void 0||te(u,Ne[l])&&!Pe.call(e,l))&&(e[l]=a[l])}return e});function O(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function Ie(e){return function(t,r,a){var o=Object(t);if(!re(t)){var s=i(r,3);t=n(t),r=function(e){return s(o[e],e,o)}}var c=e(t,r,a);return c>-1?o[s?t[c]:c]:void 0}}var Le=Math.max;function Re(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var a=n==null?0:Ee(n);return a<0&&(a=Le(r+a,0)),u(e,i(t,3),a)}var k=Ie(Re);function ze(e,t){return e==null?e:ae(e,f(t),ge)}function Be(e,t){return e&&h(e,f(t))}function Ve(e,t){return e>t}var He=Object.prototype.hasOwnProperty;function Ue(e,t){return e!=null&&He.call(e,t)}function We(e,t){return e!=null&&c(e,t,Ue)}var Ge=`[object String]`;function Ke(e){return typeof e==`string`||!g(e)&&le(e)&&ce(e)==Ge}function A(e,t){var n={};return t=i(t,3),h(e,function(e,r,i){_e(n,r,t(e,r,i))}),n}function j(e){return e&&e.length?pe(e,ie,Ve):void 0}function M(e,t){return e&&e.length?pe(e,i(t,2),he):void 0}function qe(e,n,r,i){if(!se(e))return e;n=t(n,e);for(var a=-1,s=n.length,c=s-1,l=e;l!=null&&++a<s;){var u=o(n[a]),d=r;if(u===`__proto__`||u===`constructor`||u===`prototype`)return e;if(a!=c){var f=l[u];d=i?i(f,u,l):void 0,d===void 0&&(d=se(f)?f:ne(n[a+1])?[]:{})}b(l,u,d),l=l[u]}return e}function Je(e,n,r){for(var i=-1,a=n.length,o={};++i<a;){var c=n[i],l=s(e,c);r(l,c)&&qe(o,t(c,e),l)}return o}function Ye(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Xe(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=fe(e),o=t!==void 0,s=t===null,c=t===t,l=fe(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 Ze(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=Xe(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function Qe(t,n,r){n=n.length?e(n,function(e){return g(e)?function(t){return s(t,e.length===1?e[0]:e)}:e}):[ie];var a=-1;return n=e(n,oe(i)),Ye(me(t,function(t,r,i){return{criteria:e(n,function(e){return e(t)}),index:++a,value:t}}),function(e,t){return Ze(e,t,r)})}var $e=a(`length`),et=`\\ud800-\\udfff`,tt=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,nt=`\\ufe0e\\ufe0f`,rt=`[`+et+`]`,N=`[`+tt+`]`,P=`\\ud83c[\\udffb-\\udfff]`,it=`(?:`+N+`|`+P+`)`,at=`[^`+et+`]`,ot=`(?:\\ud83c[\\udde6-\\uddff]){2}`,st=`[\\ud800-\\udbff][\\udc00-\\udfff]`,ct=`\\u200d`,lt=it+`?`,ut=`[`+nt+`]?`,dt=`(?:`+ct+`(?:`+[at,ot,st].join(`|`)+`)`+ut+lt+`)*`,ft=ut+lt+dt,pt=`(?:`+[at+N+`?`,N,ot,st,rt].join(`|`)+`)`,mt=RegExp(P+`(?=`+P+`)|`+pt+ft,`g`);function ht(e){for(var t=mt.lastIndex=0;mt.test(e);)++t;return t}function gt(e){return ke(e)?ht(e):$e(e)}function _t(e,t){return Je(e,t,function(t,n){return d(e,n)})}var F=De(function(e,t){return e==null?{}:_t(e,t)}),vt=Math.ceil,yt=Math.max;function bt(e,t,n,r){for(var i=-1,a=yt(vt((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function xt(e){return function(t,n,r){return r&&typeof r!=`number`&&S(t,n,r)&&(n=r=void 0),t=D(t),n===void 0?(n=t,t=0):n=D(n),r=r===void 0?t<n?1:-1:D(r),bt(t,n,r,e)}}var I=xt(),St=`[object Map]`,Ct=`[object Set]`;function wt(e){if(e==null)return 0;if(re(e))return Ke(e)?gt(e):e.length;var t=de(e);return t==St||t==Ct?e.size:ue(e).length}var L=be(function(e,t){if(e==null)return[];var n=t.length;return n>1&&S(e,t[0],t[1])?t=[]:n>2&&S(t[0],t[1],t[2])&&(t=[t[0]]),Qe(e,p(t,1),[])}),Tt=0;function R(e){var t=++Tt;return ee(e)+t}function Et(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 Dt(e,t){return Et(e||[],t||[],b)}var Ot=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return kt(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&kt(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,At)),n=n._prev;return`[`+e.join(`, `)+`]`}};function kt(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function At(e,t){if(e!==`_next`&&e!==`_prev`)return t}var jt=C(1);function Mt(e,t){if(e.nodeCount()<=1)return[];var n=Pt(e,t||jt);return y(_(Nt(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function Nt(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)z(e,t,n,o);for(;o=i.dequeue();)z(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(z(e,t,n,o,!0));break}}}return r}function z(e,t,n,r,i){var a=i?[]:void 0;return l(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,B(t,n,s)}),l(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,B(t,n,o)}),e.removeNode(r.v),a}function Pt(e,t){var n=new E,r=0,i=0;l(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),l(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=I(i+r+3).map(function(){return new Ot}),o=r+1;return l(n.nodes(),function(e){B(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function B(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 Ft(e){l(e.graph().acyclicer===`greedy`?Mt(e,t(e)):It(e),function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,R(`rev`))});function t(e){return function(t){return e.edge(t).weight}}}function It(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,l(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return l(e.nodes(),i),t}function Lt(e){l(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 V(e,t,n,r){var i;do i=R(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function Rt(e){var t=new E().setGraph(e.graph());return l(e.nodes(),function(n){t.setNode(n,e.node(n))}),l(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 zt(e){var t=new E({multigraph:e.isMultigraph()}).setGraph(e.graph());return l(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),l(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function Bt(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 H(e){var t=_(I(Wt(e)+1),function(){return[]});return l(e.nodes(),function(n){var r=e.node(n),i=r.rank;w(i)||(t[i][r.order]=n)}),t}function Vt(e){var t=v(_(e.nodes(),function(t){return e.node(t).rank}));l(e.nodes(),function(n){var r=e.node(n);We(r,`rank`)&&(r.rank-=t)})}function Ht(e){var t=v(_(e.nodes(),function(t){return e.node(t).rank})),n=[];l(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;l(n,function(t,n){w(t)&&n%i!==0?--r:r&&l(t,function(t){e.node(t).rank+=r})})}function Ut(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),V(e,`border`,i,t)}function Wt(e){return j(_(e.nodes(),function(t){var n=e.node(t).rank;if(!w(n))return n}))}function Gt(e,t){var n={lhs:[],rhs:[]};return l(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Kt(e,t){var n=Ce();try{return t()}finally{console.log(e+` time: `+(Ce()-n)+`ms`)}}function qt(e,t){return t()}function Jt(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&l(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)Yt(e,`borderLeft`,`_bl`,n,i,a),Yt(e,`borderRight`,`_br`,n,i,a)}}l(e.children(),t)}function Yt(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=V(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Xt(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&Qt(e)}function Zt(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&en(e),(t===`lr`||t===`rl`)&&(tn(e),Qt(e))}function Qt(e){l(e.nodes(),function(t){$t(e.node(t))}),l(e.edges(),function(t){$t(e.edge(t))})}function $t(e){var t=e.width;e.width=e.height,e.height=t}function en(e){l(e.nodes(),function(t){U(e.node(t))}),l(e.edges(),function(t){var n=e.edge(t);l(n.points,U),Object.prototype.hasOwnProperty.call(n,`y`)&&U(n)})}function U(e){e.y=-e.y}function tn(e){l(e.nodes(),function(t){W(e.node(t))}),l(e.edges(),function(t){var n=e.edge(t);l(n.points,W),Object.prototype.hasOwnProperty.call(n,`x`)&&W(n)})}function W(e){var t=e.x;e.x=e.y,e.y=t}function nn(e){e.graph().dummyChains=[],l(e.edges(),function(t){rn(e,t)})}function rn(e,t){var n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a!==r+1){e.removeEdge(t);var l=void 0,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],l={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},u=V(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 an(e){l(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 G(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=v(_(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}l(e.sources(),n)}function K(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function on(e){var t=new E({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;sn(t,e)<r;)i=cn(t,e),a=t.hasNode(i.v)?K(e,i):-K(e,i),ln(t,e,a);return t}function sn(e,t){function n(r){l(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!K(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return l(e.nodes(),n),e.nodeCount()}function cn(e,t){return M(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return K(t,n)})}function ln(e,t,n){l(e.nodes(),function(e){t.node(e).rank+=n})}C(1),C(1),un.CycleException=q;function un(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,l(e.predecessors(a),i),delete n[a],r.push(a))}if(l(e.sinks(),i),wt(t)!==e.nodeCount())throw new q;return r}function q(){}q.prototype=Error();function dn(e,t,n){g(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return l(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);fn(e,t,n===`post`,a,r,i)}),i}function fn(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),l(i(t),function(t){fn(e,t,n,r,i,a)}),n&&a.push(t))}function pn(e,t){return dn(e,t,`post`)}function mn(e,t){return dn(e,t,`pre`)}J.initLowLimValues=X,J.initCutValues=Y,J.calcCutValue=gn,J.leaveEdge=vn,J.enterEdge=yn,J.exchangeEdges=Z;function J(e){e=Rt(e),G(e);var t=on(e);X(t),Y(t,e);for(var n,r;n=vn(t);)r=yn(t,e,n),Z(t,e,n,r)}function Y(e,t){var n=pn(e,e.nodes());n=n.slice(0,n.length-1),l(n,function(n){hn(e,t,n)})}function hn(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=gn(e,t,n)}function gn(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,l(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,xn(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function X(e,t){arguments.length<2&&(t=e.nodes()[0]),_n(e,{},1,t)}function _n(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,l(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=_n(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function vn(e){return k(e.edges(),function(t){return e.edge(t).cutvalue<0})}function yn(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var o=e.node(i),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),M(r(t.edges(),function(t){return l===Sn(e,e.node(t.v),c)&&l!==Sn(e,e.node(t.w),c)}),function(e){return K(t,e)})}function Z(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),X(e),Y(e,t),bn(e,t)}function bn(e,t){var n=mn(e,k(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),l(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 xn(e,t,n){return e.hasEdge(t,n)}function Sn(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function Cn(e){switch(e.graph().ranker){case`network-simplex`:En(e);break;case`tight-tree`:Tn(e);break;case`longest-path`:wn(e);break;default:En(e)}}var wn=G;function Tn(e){G(e),on(e)}function En(e){J(e)}function Dn(e){var t=V(e,`root`,{},`_root`),n=kn(e),r=j(T(n))-1,i=2*r+1;e.graph().nestingRoot=t,l(e.edges(),function(t){e.edge(t).minlen*=i});var a=An(e)+1;l(e.children(),function(o){On(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function On(e,t,n,r,i,a,o){var s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}var c=Ut(e,`_bt`),u=Ut(e,`_bb`),d=e.node(o);e.setParent(c,o),d.borderTop=c,e.setParent(u,o),d.borderBottom=u,l(s,function(s){On(e,t,n,r,i,a,s);var l=e.node(s),d=l.borderTop?l.borderTop:s,f=l.borderBottom?l.borderBottom:s,p=l.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,u,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+a[o]})}function kn(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&l(a,function(e){n(e,i+1)}),t[r]=i}return l(e.children(),function(e){n(e,1)}),t}function An(e){return m(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function jn(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,l(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function Mn(e,t,n){var r={},i;l(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 Nn(e,t,n){var r=Pn(e),i=new E({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return l(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),l(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=w(r)?0:r.weight;i.setEdge(n,a,{weight:e.edge(t).weight+o})}),Object.prototype.hasOwnProperty.call(o,`minRank`)&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function Pn(e){for(var t;e.hasNode(t=R(`_root`)););return t}function Fn(e,t){for(var n=0,r=1;r<t.length;++r)n+=In(e,t[r-1],t[r]);return n}function In(e,t,n){for(var r=Dt(n,_(n,function(e,t){return t})),i=y(_(t,function(t){return L(_(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=_(Array(o),function(){return 0}),c=0;return l(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 Ln(e){var t={},n=r(e.nodes(),function(t){return!e.children(t).length}),i=_(I(j(_(n,function(t){return e.node(t).rank}))+1),function(){return[]});function a(n){We(t,n)||(t[n]=!0,i[e.node(n).rank].push(n),l(e.successors(n),a))}return l(L(n,function(t){return e.node(t).rank}),a),i}function Rn(e,t){return _(t,function(t){var n=e.inEdges(t);if(n.length){var r=m(n,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}function zn(e,t){var n={};return l(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};w(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),l(t.edges(),function(e){var t=n[e.v],r=n[e.w];!w(t)&&!w(r)&&(r.indegree++,t.out.push(n[e.w]))}),Bn(r(n,function(e){return!e.indegree}))}function Bn(e){var t=[];function n(e){return function(t){t.merged||(w(t.barycenter)||w(e.barycenter)||t.barycenter>=e.barycenter)&&Vn(e,t)}}function i(t){return function(n){n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){var a=e.pop();t.push(a),l(a.in.reverse(),n(a)),l(a.out,i(a))}return _(r(t,function(e){return!e.merged}),function(e){return F(e,[`vs`,`i`,`barycenter`,`weight`])})}function Vn(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 Hn(e,t){var n=Gt(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=L(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,c=0;r.sort(Wn(!!t)),c=Un(a,i,c),l(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=Un(a,i,c)});var u={vs:y(a)};return s&&(u.barycenter=o/s,u.weight=s),u}function Un(e,t,n){for(var r;t.length&&(r=O(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Wn(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 Gn(e,t,n,i){var a=e.children(t),o=e.node(t),s=o?o.borderLeft:void 0,c=o?o.borderRight:void 0,u={};s&&(a=r(a,function(e){return e!==s&&e!==c}));var d=Rn(e,a);l(d,function(t){if(e.children(t.v).length){var r=Gn(e,t.v,n,i);u[t.v]=r,Object.prototype.hasOwnProperty.call(r,`barycenter`)&&qn(t,r)}});var f=zn(d,n);Kn(f,u);var p=Hn(f,i);if(s&&(p.vs=y([s,p.vs,c]),e.predecessors(s).length)){var m=e.node(e.predecessors(s)[0]),h=e.node(e.predecessors(c)[0]);Object.prototype.hasOwnProperty.call(p,`barycenter`)||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+m.order+h.order)/(p.weight+2),p.weight+=2}return p}function Kn(e,t){l(e,function(e){e.vs=y(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function qn(e,t){w(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function Jn(e){var t=Wt(e),n=Yn(e,I(1,t+1),`inEdges`),r=Yn(e,I(t-1,-1,-1),`outEdges`),i=Ln(e);Zn(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){Xn(s%2?n:r,s%4>=2),i=H(e);var l=Fn(e,i);l<a&&(c=0,o=Me(i),a=l)}Zn(e,o)}function Yn(e,t,n){return _(t,function(t){return Nn(e,t,n)})}function Xn(e,t){var n=new E;l(e,function(e){var r=e.graph().root,i=Gn(e,r,n,t);l(i.vs,function(t,n){e.node(t).order=n}),Mn(e,n,i.vs)})}function Zn(e,t){l(t,function(t){l(t,function(t,n){e.node(t).order=n})})}function Qn(e){var t=er(e);l(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=$n(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 $n(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 er(e){var t={},n=0;function r(i){var a=n;l(e.children(i),r),t[i]={low:a,lim:n++}}return l(e.children(),r),t}function tr(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=O(r);return l(r,function(t,c){var u=rr(e,t),d=u?e.node(u).order:o;(u||t===s)&&(l(r.slice(a,c+1),function(t){l(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||d<o)&&!(a.dummy&&e.node(t).dummy)&&ir(n,r,t)})}),a=c+1,i=d)}),r}return m(t,r),n}function nr(e,t){var n={};function r(t,r,i,a,o){var s;l(I(r,i),function(r){s=t[r],e.node(s).dummy&&l(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&ir(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return l(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 m(t,i),n}function rr(e,t){if(e.node(t).dummy)return k(e.predecessors(t),function(t){return e.node(t).dummy})}function ir(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 ar(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function or(e,t,n,r){var i={},a={},o={};return l(t,function(e){l(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),l(t,function(e){var t=-1;l(e,function(e){var s=r(e);if(s.length){s=L(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]&&!ar(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function sr(e,t,n,r,i){var a={},o=cr(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 u(e){a[e]=o.inEdges(e).reduce(function(e,t){return Math.max(e,a[t.v]+o.edge(t))},0)}function d(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(u,o.predecessors.bind(o)),c(d,o.successors.bind(o)),l(r,function(e){a[e]=a[n[e]]}),a}function cr(e,t,n,r){var i=new E,a=e.graph(),o=pr(a.nodesep,a.edgesep,r);return l(t,function(t){var r;l(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 lr(e,t){return M(T(t),function(t){var n=-1/0,r=1/0;return ze(t,function(t,i){var a=mr(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function ur(e,t){var n=T(t),r=v(n),i=j(n);l([`u`,`d`],function(n){l([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=T(s);c=a===`l`?r-v(l):i-j(l),c&&(e[o]=A(s,function(e){return e+c}))}})})}function dr(e,t){return A(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=L(_(e,r));return(i[1]+i[2])/2})}function fr(e){var t=H(e),n=x(tr(e,t),nr(e,t)),r={},i;return l([`u`,`d`],function(a){i=a===`u`?t:T(t).reverse(),l([`l`,`r`],function(t){t===`r`&&(i=_(i,function(e){return T(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=or(e,i,n,o),c=sr(e,i,s.root,s.align,t===`r`);t===`r`&&(c=A(c,function(e){return-e})),r[a+t]=c})}),ur(r,lr(e,r)),dr(r,e.graph().align)}function pr(e,t,n){return function(r,i,a){var o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.prototype.hasOwnProperty.call(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.prototype.hasOwnProperty.call(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function mr(e,t){return e.node(t).width}function hr(e){e=zt(e),gr(e),Be(fr(e),function(t,n){e.node(n).x=t})}function gr(e){var t=H(e),n=e.graph().ranksep,r=0;l(t,function(t){var i=j(_(t,function(t){return e.node(t).height}));l(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function _r(e,t){var n=t&&t.debugTiming?Kt:qt;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>Or(e));n(` runLayout`,()=>vr(t,n)),n(` updateInputGraph`,()=>yr(e,t))})}function vr(e,t){t(` makeSpaceForEdgeLabels`,()=>kr(e)),t(` removeSelfEdges`,()=>Rr(e)),t(` acyclic`,()=>Ft(e)),t(` nestingGraph.run`,()=>Dn(e)),t(` rank`,()=>Cn(zt(e))),t(` injectEdgeLabelProxies`,()=>Ar(e)),t(` removeEmptyRanks`,()=>Ht(e)),t(` nestingGraph.cleanup`,()=>jn(e)),t(` normalizeRanks`,()=>Vt(e)),t(` assignRankMinMax`,()=>jr(e)),t(` removeEdgeLabelProxies`,()=>Mr(e)),t(` normalize.run`,()=>nn(e)),t(` parentDummyChains`,()=>Qn(e)),t(` addBorderSegments`,()=>Jt(e)),t(` order`,()=>Jn(e)),t(` insertSelfEdges`,()=>zr(e)),t(` adjustCoordinateSystem`,()=>Xt(e)),t(` position`,()=>hr(e)),t(` positionSelfEdges`,()=>Br(e)),t(` removeBorderNodes`,()=>Lr(e)),t(` normalize.undo`,()=>an(e)),t(` fixupEdgeLabelCoords`,()=>Fr(e)),t(` undoCoordinateSystem`,()=>Zt(e)),t(` translateGraph`,()=>Nr(e)),t(` assignNodeIntersects`,()=>Pr(e)),t(` reversePoints`,()=>Ir(e)),t(` acyclic.undo`,()=>Lt(e))}function yr(e,t){l(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))}),l(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 br=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],xr={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},Sr=[`acyclicer`,`ranker`,`rankdir`,`align`],Cr=[`width`,`height`],wr={width:0,height:0},Tr=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Er={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Dr=[`labelpos`];function Or(e){var t=new E({multigraph:!0,compound:!0}),n=$(e.graph());return t.setGraph(x({},xr,Q(n,br),F(n,Sr))),l(e.nodes(),function(n){var r=$(e.node(n));t.setNode(n,Fe(Q(r,Cr),wr)),t.setParent(n,e.parent(n))}),l(e.edges(),function(n){var r=$(e.edge(n));t.setEdge(n,x({},Er,Q(r,Tr),F(r,Dr)))}),t}function kr(e){var t=e.graph();t.ranksep/=2,l(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 Ar(e){l(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);V(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function jr(e){var t=0;l(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=j(t,r.maxRank))}),e.graph().maxRank=t}function Mr(e){l(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function Nr(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)}l(e.nodes(),function(t){c(e.node(t))}),l(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,l(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),l(e.edges(),function(n){var i=e.edge(n);l(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 Pr(e){l(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(Bt(r,a)),n.points.push(Bt(i,o))})}function Fr(e){l(e.edges(),function(t){var n=e.edge(t);if(Object.prototype.hasOwnProperty.call(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function Ir(e){l(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function Lr(e){l(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(O(n.borderLeft)),o=e.node(O(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}}),l(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function Rr(e){l(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 zr(e){l(H(e),function(t){var n=0;l(t,function(t,r){var i=e.node(t);i.order=r+n,l(i.selfEdges,function(t){V(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 Br(e){l(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 Q(e,t){return A(F(e,t),Number)}function $(e){var t={};return l(e,function(e,n){t[n.toLowerCase()]=e}),t}export{_r as t};
@@ -1,4 +1,4 @@
1
- import{a as e}from"./flatten-BHQFj2az.js";import{n as t,r as n}from"./src-DxsrUvGr.js";import{b as r}from"./chunk-ICPOFSXX-Czafge50.js";import"./chunk-5PVQY5BW-BFfnnQIi.js";import"./chunk-U2HBQHQK-CSsi_nQO.js";import"./chunk-BSJP7CBP-gINBJmdn.js";import{n as i}from"./chunk-ZZ45TVLE-BUFYnqAJ.js";import{n as a,t as o}from"./graphlib-DTVXa63Y.js";import{t as s}from"./clone-te25EaCJ.js";import{t as c}from"./dagre-BE13jSMp.js";import"./chunk-X2U36JSP-DZKPmsbB.js";import{a as l,c as u,i as d,l as f,n as p,t as m,u as h}from"./chunk-5FUZZQ4R-CG5QQXov.js";import{a as g,i as _,n as v,r as y,t as b}from"./chunk-ENJZ2VHE-loXqYw4u.js";function x(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:S(e),edges:C(e)};return a(e.graph())||(t.value=s(e.graph())),t}function S(t){return e(t.nodes(),function(e){var n=t.node(e),r=t.parent(e),i={v:e};return a(n)||(i.value=n),a(r)||(i.parent=r),i})}function C(t){return e(t.edges(),function(e){var n=t.edge(e),r={v:e.v,w:e.w};return a(e.name)||(r.name=e.name),a(n)||(r.value=n),r})}var w=new Map,T=new Map,E=new Map,D=t(()=>{T.clear(),E.clear(),w.clear()},`clear`),O=t((e,t)=>{let r=T.get(t)||[];return n.trace(`In isDescendant`,t,` `,e,` = `,r.includes(e)),r.includes(e)},`isDescendant`),k=t((e,t)=>{let r=T.get(t)||[];return n.info(`Descendants of `,t,` is `,r),n.info(`Edge is `,e),e.v===t||e.w===t?!1:r?r.includes(e.v)||O(e.v,t)||O(e.w,t)||r.includes(e.w):(n.debug(`Tilt, `,t,`,not in descendants`),!1)},`edgeInCluster`),A=t((e,t,r,i)=>{n.warn(`Copying children of `,e,`root`,i,`data`,t.node(e),i);let a=t.children(e)||[];e!==i&&a.push(e),n.warn(`Copying (nodes) clusterId`,e,`nodes`,a),a.forEach(a=>{if(t.children(a).length>0)A(a,t,r,i);else{let o=t.node(a);n.info(`cp `,a,` to `,i,` with parent `,e),r.setNode(a,o),i!==t.parent(a)&&(n.warn(`Setting parent`,a,t.parent(a)),r.setParent(a,t.parent(a))),e!==i&&a!==e?(n.debug(`Setting parent`,a,e),r.setParent(a,e)):(n.info(`In copy `,e,`root`,i,`data`,t.node(e),i),n.debug(`Not Setting parent for node=`,a,`cluster!==rootId`,e!==i,`node!==clusterId`,a!==e));let s=t.edges(a);n.debug(`Copying Edges`,s),s.forEach(a=>{n.info(`Edge`,a);let o=t.edge(a.v,a.w,a.name);n.info(`Edge data`,o,i);try{k(a,i)?(n.info(`Copying as `,a.v,a.w,o,a.name),r.setEdge(a.v,a.w,o,a.name),n.info(`newGraph edges `,r.edges(),r.edge(r.edges()[0]))):n.info(`Skipping copy of edge `,a.v,`-->`,a.w,` rootId: `,i,` clusterId:`,e)}catch(e){n.error(e)}})}n.debug(`Removing node`,a),t.removeNode(a)})},`copy`),j=t((e,t)=>{let n=t.children(e),r=[...n];for(let i of n)E.set(i,e),r=[...r,...j(i,t)];return r},`extractDescendants`),M=t((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),i=e.edges().filter(e=>e.v===n||e.w===n),a=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),o=i.map(e=>({v:e.v,w:e.w}));return a.filter(e=>o.some(t=>e.v===t.v&&e.w===t.w))},`findCommonEdges`),N=t((e,t,r)=>{let i=t.children(e);if(n.trace(`Searching children of id `,e,i),i.length<1)return e;let a;for(let e of i){let n=N(e,t,r),i=M(t,r,n);if(n)if(i.length>0)a=n;else return n}return a},`findNonClusterChild`),P=t(e=>!w.has(e)||!w.get(e).externalConnections?e:w.has(e)?w.get(e).id:e,`getAnchorId`),F=t((e,t)=>{if(!e||t>10){n.debug(`Opting out, no graph `);return}else n.debug(`Opting in, graph `);e.nodes().forEach(function(t){e.children(t).length>0&&(n.warn(`Cluster identified`,t,` Replacement id in edges: `,N(t,e,t)),T.set(t,j(t,e)),w.set(t,{id:N(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let r=e.children(t),i=e.edges();r.length>0?(n.debug(`Cluster identified`,t,T),i.forEach(e=>{O(e.v,t)^O(e.w,t)&&(n.warn(`Edge: `,e,` leaves cluster `,t),n.warn(`Descendants of XXX `,t,`: `,T.get(t)),w.get(t).externalConnections=!0)})):n.debug(`Not a cluster `,t,T)});for(let t of w.keys()){let n=w.get(t).id,r=e.parent(n);r!==t&&w.has(r)&&!w.get(r).externalConnections&&(w.get(t).id=r)}e.edges().forEach(function(t){let r=e.edge(t);n.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(t)),n.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(e.edge(t)));let i=t.v,a=t.w;if(n.warn(`Fix XXX`,w,`ids:`,t.v,t.w,`Translating: `,w.get(t.v),` --- `,w.get(t.w)),w.get(t.v)||w.get(t.w)){if(n.warn(`Fixing and trying - removing XXX`,t.v,t.w,t.name),i=P(t.v),a=P(t.w),e.removeEdge(t.v,t.w,t.name),i!==t.v){let n=e.parent(i);w.get(n).externalConnections=!0,r.fromCluster=t.v}if(a!==t.w){let n=e.parent(a);w.get(n).externalConnections=!0,r.toCluster=t.w}n.warn(`Fix Replacing with XXX`,i,a,t.name),e.setEdge(i,a,r,t.name)}}),n.warn(`Adjusted Graph`,x(e)),I(e,0),n.trace(w)},`adjustClustersAndEdges`),I=t((e,t)=>{if(n.warn(`extractor - `,t,x(e),e.children(`D`)),t>10){n.error(`Bailing out`);return}let r=e.nodes(),i=!1;for(let t of r){let n=e.children(t);i||=n.length>0}if(!i){n.debug(`Done, no node has children`,e.nodes());return}n.debug(`Nodes = `,r,t);for(let i of r)if(n.debug(`Extracting node`,i,w,w.has(i)&&!w.get(i).externalConnections,!e.parent(i),e.node(i),e.children(`D`),` Depth `,t),!w.has(i))n.debug(`Not a cluster`,i,t);else if(!w.get(i).externalConnections&&e.children(i)&&e.children(i).length>0){n.warn(`Cluster without external connections, without a parent and with children`,i,t);let r=e.graph().rankdir===`TB`?`LR`:`TB`;w.get(i)?.clusterData?.dir&&(r=w.get(i).clusterData.dir,n.warn(`Fixing dir`,w.get(i).clusterData.dir,r));let a=new o({multigraph:!0,compound:!0}).setGraph({rankdir:r,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});n.warn(`Old graph before copy`,x(e)),A(i,e,a,i),e.setNode(i,{clusterNode:!0,id:i,clusterData:w.get(i).clusterData,label:w.get(i).label,graph:a}),n.warn(`New graph after copy node: (`,i,`)`,x(a)),n.debug(`Old graph after copy`,x(e))}else n.warn(`Cluster ** `,i,` **not meeting the criteria !externalConnections:`,!w.get(i).externalConnections,` no parent: `,!e.parent(i),` children `,e.children(i)&&e.children(i).length>0,e.children(`D`),t),n.debug(w);r=e.nodes(),n.warn(`New list of nodes`,r);for(let i of r){let r=e.node(i);n.warn(` Now next level`,i,r),r?.clusterNode&&I(r.graph,t+1)}},`extractor`),L=t((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(t=>{let r=L(e,e.children(t));n=[...n,...r]}),n},`sorter`),R=t(e=>L(e,e.children()),`sortNodesByHierarchy`),z=t(async(e,r,a,o,s,p)=>{n.warn(`Graph in recursive render:XAX`,x(r),s);let m=r.graph().rankdir;n.trace(`Dir in recursive render - dir:`,m);let _=e.insert(`g`).attr(`class`,`root`);r.nodes()?n.info(`Recursive render XXX`,r.nodes()):n.info(`No nodes found for`,r),r.edges().length>0&&n.info(`Recursive edges`,r.edge(r.edges()[0]));let b=_.insert(`g`).attr(`class`,`clusters`),S=_.insert(`g`).attr(`class`,`edgePaths`),C=_.insert(`g`).attr(`class`,`edgeLabels`),T=_.insert(`g`).attr(`class`,`nodes`);await Promise.all(r.nodes().map(async function(e){let t=r.node(e);if(s!==void 0){let t=JSON.parse(JSON.stringify(s.clusterData));n.trace(`Setting data for parent cluster XXX
1
+ import{a as e}from"./flatten-BHQFj2az.js";import{n as t,r as n}from"./src-DxsrUvGr.js";import{b as r}from"./chunk-ICPOFSXX-Dy9JRPZu.js";import"./chunk-5PVQY5BW-D2kQfsEU.js";import"./chunk-U2HBQHQK-DThlp4DR.js";import"./chunk-BSJP7CBP-gINBJmdn.js";import{n as i}from"./chunk-ZZ45TVLE-CwnCYU7J.js";import{n as a,t as o}from"./graphlib-CxIN2cpg.js";import{t as s}from"./clone-B2gSWiE3.js";import{t as c}from"./dagre--CGfxwL9.js";import"./chunk-X2U36JSP-b_VUmOsG.js";import{a as l,c as u,i as d,l as f,n as p,t as m,u as h}from"./chunk-5FUZZQ4R-Bp1iPpGN.js";import{a as g,i as _,n as v,r as y,t as b}from"./chunk-ENJZ2VHE-DGOBbqgN.js";function x(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:S(e),edges:C(e)};return a(e.graph())||(t.value=s(e.graph())),t}function S(t){return e(t.nodes(),function(e){var n=t.node(e),r=t.parent(e),i={v:e};return a(n)||(i.value=n),a(r)||(i.parent=r),i})}function C(t){return e(t.edges(),function(e){var n=t.edge(e),r={v:e.v,w:e.w};return a(e.name)||(r.name=e.name),a(n)||(r.value=n),r})}var w=new Map,T=new Map,E=new Map,D=t(()=>{T.clear(),E.clear(),w.clear()},`clear`),O=t((e,t)=>{let r=T.get(t)||[];return n.trace(`In isDescendant`,t,` `,e,` = `,r.includes(e)),r.includes(e)},`isDescendant`),k=t((e,t)=>{let r=T.get(t)||[];return n.info(`Descendants of `,t,` is `,r),n.info(`Edge is `,e),e.v===t||e.w===t?!1:r?r.includes(e.v)||O(e.v,t)||O(e.w,t)||r.includes(e.w):(n.debug(`Tilt, `,t,`,not in descendants`),!1)},`edgeInCluster`),A=t((e,t,r,i)=>{n.warn(`Copying children of `,e,`root`,i,`data`,t.node(e),i);let a=t.children(e)||[];e!==i&&a.push(e),n.warn(`Copying (nodes) clusterId`,e,`nodes`,a),a.forEach(a=>{if(t.children(a).length>0)A(a,t,r,i);else{let o=t.node(a);n.info(`cp `,a,` to `,i,` with parent `,e),r.setNode(a,o),i!==t.parent(a)&&(n.warn(`Setting parent`,a,t.parent(a)),r.setParent(a,t.parent(a))),e!==i&&a!==e?(n.debug(`Setting parent`,a,e),r.setParent(a,e)):(n.info(`In copy `,e,`root`,i,`data`,t.node(e),i),n.debug(`Not Setting parent for node=`,a,`cluster!==rootId`,e!==i,`node!==clusterId`,a!==e));let s=t.edges(a);n.debug(`Copying Edges`,s),s.forEach(a=>{n.info(`Edge`,a);let o=t.edge(a.v,a.w,a.name);n.info(`Edge data`,o,i);try{k(a,i)?(n.info(`Copying as `,a.v,a.w,o,a.name),r.setEdge(a.v,a.w,o,a.name),n.info(`newGraph edges `,r.edges(),r.edge(r.edges()[0]))):n.info(`Skipping copy of edge `,a.v,`-->`,a.w,` rootId: `,i,` clusterId:`,e)}catch(e){n.error(e)}})}n.debug(`Removing node`,a),t.removeNode(a)})},`copy`),j=t((e,t)=>{let n=t.children(e),r=[...n];for(let i of n)E.set(i,e),r=[...r,...j(i,t)];return r},`extractDescendants`),M=t((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),i=e.edges().filter(e=>e.v===n||e.w===n),a=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),o=i.map(e=>({v:e.v,w:e.w}));return a.filter(e=>o.some(t=>e.v===t.v&&e.w===t.w))},`findCommonEdges`),N=t((e,t,r)=>{let i=t.children(e);if(n.trace(`Searching children of id `,e,i),i.length<1)return e;let a;for(let e of i){let n=N(e,t,r),i=M(t,r,n);if(n)if(i.length>0)a=n;else return n}return a},`findNonClusterChild`),P=t(e=>!w.has(e)||!w.get(e).externalConnections?e:w.has(e)?w.get(e).id:e,`getAnchorId`),F=t((e,t)=>{if(!e||t>10){n.debug(`Opting out, no graph `);return}else n.debug(`Opting in, graph `);e.nodes().forEach(function(t){e.children(t).length>0&&(n.warn(`Cluster identified`,t,` Replacement id in edges: `,N(t,e,t)),T.set(t,j(t,e)),w.set(t,{id:N(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let r=e.children(t),i=e.edges();r.length>0?(n.debug(`Cluster identified`,t,T),i.forEach(e=>{O(e.v,t)^O(e.w,t)&&(n.warn(`Edge: `,e,` leaves cluster `,t),n.warn(`Descendants of XXX `,t,`: `,T.get(t)),w.get(t).externalConnections=!0)})):n.debug(`Not a cluster `,t,T)});for(let t of w.keys()){let n=w.get(t).id,r=e.parent(n);r!==t&&w.has(r)&&!w.get(r).externalConnections&&(w.get(t).id=r)}e.edges().forEach(function(t){let r=e.edge(t);n.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(t)),n.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(e.edge(t)));let i=t.v,a=t.w;if(n.warn(`Fix XXX`,w,`ids:`,t.v,t.w,`Translating: `,w.get(t.v),` --- `,w.get(t.w)),w.get(t.v)||w.get(t.w)){if(n.warn(`Fixing and trying - removing XXX`,t.v,t.w,t.name),i=P(t.v),a=P(t.w),e.removeEdge(t.v,t.w,t.name),i!==t.v){let n=e.parent(i);w.get(n).externalConnections=!0,r.fromCluster=t.v}if(a!==t.w){let n=e.parent(a);w.get(n).externalConnections=!0,r.toCluster=t.w}n.warn(`Fix Replacing with XXX`,i,a,t.name),e.setEdge(i,a,r,t.name)}}),n.warn(`Adjusted Graph`,x(e)),I(e,0),n.trace(w)},`adjustClustersAndEdges`),I=t((e,t)=>{if(n.warn(`extractor - `,t,x(e),e.children(`D`)),t>10){n.error(`Bailing out`);return}let r=e.nodes(),i=!1;for(let t of r){let n=e.children(t);i||=n.length>0}if(!i){n.debug(`Done, no node has children`,e.nodes());return}n.debug(`Nodes = `,r,t);for(let i of r)if(n.debug(`Extracting node`,i,w,w.has(i)&&!w.get(i).externalConnections,!e.parent(i),e.node(i),e.children(`D`),` Depth `,t),!w.has(i))n.debug(`Not a cluster`,i,t);else if(!w.get(i).externalConnections&&e.children(i)&&e.children(i).length>0){n.warn(`Cluster without external connections, without a parent and with children`,i,t);let r=e.graph().rankdir===`TB`?`LR`:`TB`;w.get(i)?.clusterData?.dir&&(r=w.get(i).clusterData.dir,n.warn(`Fixing dir`,w.get(i).clusterData.dir,r));let a=new o({multigraph:!0,compound:!0}).setGraph({rankdir:r,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});n.warn(`Old graph before copy`,x(e)),A(i,e,a,i),e.setNode(i,{clusterNode:!0,id:i,clusterData:w.get(i).clusterData,label:w.get(i).label,graph:a}),n.warn(`New graph after copy node: (`,i,`)`,x(a)),n.debug(`Old graph after copy`,x(e))}else n.warn(`Cluster ** `,i,` **not meeting the criteria !externalConnections:`,!w.get(i).externalConnections,` no parent: `,!e.parent(i),` children `,e.children(i)&&e.children(i).length>0,e.children(`D`),t),n.debug(w);r=e.nodes(),n.warn(`New list of nodes`,r);for(let i of r){let r=e.node(i);n.warn(` Now next level`,i,r),r?.clusterNode&&I(r.graph,t+1)}},`extractor`),L=t((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(t=>{let r=L(e,e.children(t));n=[...n,...r]}),n},`sorter`),R=t(e=>L(e,e.children()),`sortNodesByHierarchy`),z=t(async(e,r,a,o,s,p)=>{n.warn(`Graph in recursive render:XAX`,x(r),s);let m=r.graph().rankdir;n.trace(`Dir in recursive render - dir:`,m);let _=e.insert(`g`).attr(`class`,`root`);r.nodes()?n.info(`Recursive render XXX`,r.nodes()):n.info(`No nodes found for`,r),r.edges().length>0&&n.info(`Recursive edges`,r.edge(r.edges()[0]));let b=_.insert(`g`).attr(`class`,`clusters`),S=_.insert(`g`).attr(`class`,`edgePaths`),C=_.insert(`g`).attr(`class`,`edgeLabels`),T=_.insert(`g`).attr(`class`,`nodes`);await Promise.all(r.nodes().map(async function(e){let t=r.node(e);if(s!==void 0){let t=JSON.parse(JSON.stringify(s.clusterData));n.trace(`Setting data for parent cluster XXX
2
2
  Node.id = `,e,`
3
3
  data=`,t.height,`
4
4
  Parent cluster`,s.height),r.setNode(s.id,t),r.parent(e)||(n.trace(`Setting parent`,e,s.id),r.setParent(e,s.id,t))}if(n.info(`(Insert) Node XXX`+e+`: `+JSON.stringify(r.node(e))),t?.clusterNode){n.info(`Cluster identified XBX`,e,t.width,r.node(e));let{ranksep:i,nodesep:s}=r.graph();t.graph.setGraph({...t.graph.graph(),ranksep:i+25,nodesep:s});let c=await z(T,t.graph,a,o,r.node(e),p),l=c.elem;h(t,l),t.diff=c.diff||0,n.info(`New compound node after recursive render XAX`,e,`width`,t.width,`height`,t.height),f(l,t)}else r.children(e).length>0?(n.trace(`Cluster - the non recursive path XBX`,e,t.id,t,t.width,`Graph:`,r),n.trace(N(t.id,r)),w.set(t.id,{id:N(t.id,r),node:t})):(n.trace(`Node - the non recursive path XAX`,e,T,r.node(e),m),await l(T,r.node(e),{config:p,dir:m}))})),await t(async()=>{let e=r.edges().map(async function(e){let t=r.edge(e.v,e.w,e.name);n.info(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(e)),n.info(`Edge `+e.v+` -> `+e.w+`: `,e,` `,JSON.stringify(r.edge(e))),n.info(`Fix`,w,`ids:`,e.v,e.w,`Translating: `,w.get(e.v),w.get(e.w)),await y(C,t)});await Promise.all(e)},`processEdges`)(),n.info(`Graph before layout:`,JSON.stringify(x(r))),n.info(`############################################# XXX`),n.info(`### Layout ### XXX`),n.info(`############################################# XXX`),c(r),n.info(`Graph after layout:`,JSON.stringify(x(r)));let E=0,{subGraphTitleTotalMargin:D}=i(p);return await Promise.all(R(r).map(async function(e){let t=r.node(e);if(n.info(`Position XBX => `+e+`: (`+t.x,`,`+t.y,`) width: `,t.width,` height: `,t.height),t?.clusterNode)t.y+=D,n.info(`A tainted cluster node XBX1`,e,t.id,t.width,t.height,t.x,t.y,r.parent(e)),w.get(t.id).node=t,u(t);else if(r.children(e).length>0){n.info(`A pure cluster node XBX1`,e,t.id,t.x,t.y,t.width,t.height,r.parent(e)),t.height+=D,r.node(t.parentId);let i=t?.padding/2||0,a=t?.labelBBox?.height||0,o=a-i||0;n.debug(`OffsetY`,o,`labelHeight`,a,`halfPadding`,i),await d(b,t),w.get(t.id).node=t}else{let e=r.node(t.parentId);t.y+=D/2,n.info(`A regular node XBX1 - using the padding`,t.id,`parent`,t.parentId,t.width,t.height,t.x,t.y,`offsetY`,t.offsetY,`parent`,e,e?.offsetY,t),u(t)}})),r.edges().forEach(function(e){let t=r.edge(e);n.info(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(t),t),t.points.forEach(e=>e.y+=D/2),g(t,v(S,t,w,a,r.node(e.v),r.node(e.w),o))}),r.nodes().forEach(function(e){let t=r.node(e);n.info(e,t.type,t.diff),t.isGroup&&(E=t.diff)}),n.warn(`Returning from recursive render XAX`,_,E),{elem:_,diff:E}},`recursiveRender`),B=t(async(e,t)=>{let i=new o({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),a=t.select(`g`);_(a,e.markers,e.type,e.diagramId),p(),b(),m(),D(),e.nodes.forEach(e=>{i.setNode(e.id,{...e}),e.parentId&&i.setParent(e.id,e.parentId)}),n.debug(`Edges:`,e.edges),e.edges.forEach(e=>{if(e.start===e.end){let t=e.start,n=t+`---`+t+`---1`,r=t+`---`+t+`---2`,a=i.node(t);i.setNode(n,{domId:n,id:n,parentId:a.parentId,labelStyle:``,label:``,padding:0,shape:`labelRect`,style:``,width:10,height:10}),i.setParent(n,a.parentId),i.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:``,padding:0,shape:`labelRect`,label:``,style:``,width:10,height:10}),i.setParent(r,a.parentId);let o=structuredClone(e),s=structuredClone(e),c=structuredClone(e);o.label=``,o.arrowTypeEnd=`none`,o.id=t+`-cyclic-special-1`,s.arrowTypeStart=`none`,s.arrowTypeEnd=`none`,s.id=t+`-cyclic-special-mid`,c.label=``,a.isGroup&&(o.fromCluster=t,c.toCluster=t),c.id=t+`-cyclic-special-2`,c.arrowTypeStart=`none`,i.setEdge(t,n,o,t+`-cyclic-special-0`),i.setEdge(n,r,s,t+`-cyclic-special-1`),i.setEdge(r,t,c,t+`-cyc<lic-special-2`)}else i.setEdge(e.start,e.end,{...e},e.id)}),n.warn(`Graph at first:`,JSON.stringify(x(i))),F(i),n.warn(`Graph after XAX:`,JSON.stringify(x(i)));let s=r();await z(a,i,e.type,e.diagramId,void 0,s)},`render`);export{B as render};
@@ -1,4 +1,4 @@
1
- import{n as e,r as t}from"./src-DxsrUvGr.js";import{B as n,C as r,V as i,W as a,_ as o,a as s,c,d as l,v as u,y as d}from"./chunk-ICPOFSXX-Czafge50.js";import{r as f}from"./chunk-5PVQY5BW-BFfnnQIi.js";import{t as p}from"./chunk-426QAEUC-xq7mFc66.js";import{t as m}from"./chunk-4BX2VUAB-DeXGuanp.js";import{t as h}from"./mermaid-parser.core-CIRt0Dgq.js";import{t as g}from"./chunk-QZHKN3VN-DGZr8ZKt.js";var _=new g(()=>({cnt:1,stack:[{id:0,level:-1,name:`/`,children:[]}]})),v=e(()=>{_.reset(),s()},`clear`),y=e(()=>_.records.stack[0],`getRoot`),b=e(()=>_.records.cnt,`getCount`),x=l.treeView,S={clear:v,addNode:e((e,t)=>{for(;e<=_.records.stack[_.records.stack.length-1].level;)_.records.stack.pop();let n={id:_.records.cnt++,level:e,name:t,children:[]};_.records.stack[_.records.stack.length-1].children.push(n),_.records.stack.push(n)},`addNode`),getRoot:y,getCount:b,getConfig:e(()=>f(x,d().treeView),`getConfig`),getAccTitle:u,getAccDescription:o,getDiagramTitle:r,setAccDescription:n,setAccTitle:i,setDiagramTitle:a},C=e(e=>{m(e,S),e.nodes.map(e=>S.addNode(e.indent?parseInt(e.indent):0,e.name))},`populate`),w={parse:e(async e=>{let n=await h(`treeView`,e);t.debug(n),C(n)},`parse`)},T=e((e,t,n,r,i)=>{let a=r.append(`text`).text(n.name).attr(`dominant-baseline`,`middle`).attr(`class`,`treeView-node-label`),{height:o,width:s}=a.node().getBBox(),c=o+i.paddingY*2,l=s+i.paddingX*2;a.attr(`x`,e+i.paddingX),a.attr(`y`,t+c/2),n.BBox={x:e,y:t,width:l,height:c}},`positionLabel`),E=e((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`),D=e((t,n,r)=>{let i=0,a=0,o=e((e,t,n,r)=>{let o=r*(n.rowIndent+n.paddingX);T(o,i,t,e,n);let{height:s,width:c}=t.BBox;E(e,o-n.rowIndent,i+s/2,o,i+s/2,n.lineThickness),a=Math.max(a,o+c),i+=s},`drawNode`),s=e((e,n=0)=>{o(t,e,r,n),e.children.forEach(e=>{s(e,n+1)});let{x:i,y:a,height:c}=e.BBox;if(e.children.length){let{y:n,height:o}=e.children[e.children.length-1].BBox;E(t,i+r.paddingX,a+c,i+r.paddingX,n+o/2+r.lineThickness/2,r.lineThickness)}},`processNode`);return s(n),{totalHeight:i,totalWidth:a}},`drawTree`),O={draw:e((e,n,r,i)=>{t.debug(`Rendering treeView diagram
1
+ import{n as e,r as t}from"./src-DxsrUvGr.js";import{B as n,C as r,V as i,W as a,_ as o,a as s,c,d as l,v as u,y as d}from"./chunk-ICPOFSXX-Dy9JRPZu.js";import{r as f}from"./chunk-5PVQY5BW-D2kQfsEU.js";import{t as p}from"./chunk-426QAEUC-CYmyjEj-.js";import{t as m}from"./chunk-4BX2VUAB-DeXGuanp.js";import{t as h}from"./mermaid-parser.core-CIRt0Dgq.js";import{t as g}from"./chunk-QZHKN3VN-DGZr8ZKt.js";var _=new g(()=>({cnt:1,stack:[{id:0,level:-1,name:`/`,children:[]}]})),v=e(()=>{_.reset(),s()},`clear`),y=e(()=>_.records.stack[0],`getRoot`),b=e(()=>_.records.cnt,`getCount`),x=l.treeView,S={clear:v,addNode:e((e,t)=>{for(;e<=_.records.stack[_.records.stack.length-1].level;)_.records.stack.pop();let n={id:_.records.cnt++,level:e,name:t,children:[]};_.records.stack[_.records.stack.length-1].children.push(n),_.records.stack.push(n)},`addNode`),getRoot:y,getCount:b,getConfig:e(()=>f(x,d().treeView),`getConfig`),getAccTitle:u,getAccDescription:o,getDiagramTitle:r,setAccDescription:n,setAccTitle:i,setDiagramTitle:a},C=e(e=>{m(e,S),e.nodes.map(e=>S.addNode(e.indent?parseInt(e.indent):0,e.name))},`populate`),w={parse:e(async e=>{let n=await h(`treeView`,e);t.debug(n),C(n)},`parse`)},T=e((e,t,n,r,i)=>{let a=r.append(`text`).text(n.name).attr(`dominant-baseline`,`middle`).attr(`class`,`treeView-node-label`),{height:o,width:s}=a.node().getBBox(),c=o+i.paddingY*2,l=s+i.paddingX*2;a.attr(`x`,e+i.paddingX),a.attr(`y`,t+c/2),n.BBox={x:e,y:t,width:l,height:c}},`positionLabel`),E=e((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`),D=e((t,n,r)=>{let i=0,a=0,o=e((e,t,n,r)=>{let o=r*(n.rowIndent+n.paddingX);T(o,i,t,e,n);let{height:s,width:c}=t.BBox;E(e,o-n.rowIndent,i+s/2,o,i+s/2,n.lineThickness),a=Math.max(a,o+c),i+=s},`drawNode`),s=e((e,n=0)=>{o(t,e,r,n),e.children.forEach(e=>{s(e,n+1)});let{x:i,y:a,height:c}=e.BBox;if(e.children.length){let{y:n,height:o}=e.children[e.children.length-1].BBox;E(t,i+r.paddingX,a+c,i+r.paddingX,n+o/2+r.lineThickness/2,r.lineThickness)}},`processNode`);return s(n),{totalHeight:i,totalWidth:a}},`drawTree`),O={draw:e((e,n,r,i)=>{t.debug(`Rendering treeView diagram
2
2
  `+e);let a=i.db,o=a.getRoot(),s=a.getConfig(),l=p(n),u=l.append(`g`);u.attr(`class`,`tree-view`);let{totalHeight:d,totalWidth:f}=D(u,o,s);l.attr(`viewBox`,`-${s.lineThickness/2} 0 ${f} ${d}`),c(l,d,f,s.useMaxWidth)},`draw`)},k={labelFontSize:`16px`,labelColor:`black`,lineColor:`black`},A={db:S,renderer:O,parser:w,styles:e(({treeView:e})=>{let{labelFontSize:t,labelColor:n,lineColor:r}=f(k,e);return`
3
3
  .treeView-node-label {
4
4
  font-size: ${t};
@@ -1,4 +1,4 @@
1
- import{n as e,r as t}from"./src-DxsrUvGr.js";import{B as n,C as r,E as i,V as a,W as o,_ as s,a as c,c as l,d as u,v as d,y as f}from"./chunk-ICPOFSXX-Czafge50.js";import{t as p}from"./ordinal-C2dFitP3.js";import{C as m}from"./src-DXWvEiD2.js";import{t as h}from"./defaultLocale-C061bpWn.js";import{r as g}from"./chunk-5PVQY5BW-BFfnnQIi.js";import{t as _}from"./chunk-426QAEUC-xq7mFc66.js";import{t as v}from"./chunk-4BX2VUAB-DeXGuanp.js";import{t as y}from"./mermaid-parser.core-CIRt0Dgq.js";import{t as b}from"./chunk-EDXVE4YY-9Eze-YYC.js";import{i as x,n as S}from"./chunk-X2U36JSP-DZKPmsbB.js";function C(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function w(){return this.eachAfter(C)}function T(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function E(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function D(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function O(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function k(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function A(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function j(e){for(var t=this,n=M(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function M(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function N(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function P(){return Array.from(this)}function F(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function I(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*L(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function R(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=V)):t===void 0&&(t=B);for(var n=new W(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new W(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(U)}function z(){return R(this).eachBefore(H)}function B(e){return e.children}function V(e){return Array.isArray(e)?e[1]:null}function H(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function U(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function W(e){this.data=e,this.depth=this.height=0,this.parent=null}W.prototype=R.prototype={constructor:W,count:w,each:T,eachAfter:D,eachBefore:E,find:O,sum:k,sort:A,path:j,ancestors:N,descendants:P,leaves:F,links:I,copy:z,[Symbol.iterator]:L};function G(e){if(typeof e!=`function`)throw Error();return e}function K(){return 0}function q(e){return function(){return e}}function J(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function ee(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function te(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}var ne=(1+Math.sqrt(5))/2;function re(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?ee(c,n,r,i,h?r+=m*g/h:a):te(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var ie=(function e(t){function n(e,n,r,i,a){re(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(ne);function ae(){var e=ie,t=!1,n=1,r=1,i=[0],a=K,o=K,s=K,c=K,l=K;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(J),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),t.x0=r,t.y0=u,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=l(t)-n,u+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),e(t,r,u,d,f))}return u.round=function(e){return arguments.length?(t=!!e,u):t},u.size=function(e){return arguments.length?(n=+e[0],r=+e[1],u):[n,r]},u.tile=function(t){return arguments.length?(e=G(t),u):e},u.padding=function(e){return arguments.length?u.paddingInner(e).paddingOuter(e):u.paddingInner()},u.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:q(+e),u):a},u.paddingOuter=function(e){return arguments.length?u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):u.paddingTop()},u.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:q(+e),u):o},u.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:q(+e),u):s},u.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:q(+e),u):c},u.paddingLeft=function(e){return arguments.length?(l=typeof e==`function`?e:q(+e),u):l},u}var Y=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=a,this.getAccTitle=d,this.setDiagramTitle=o,this.getDiagramTitle=r,this.getAccDescription=s,this.setAccDescription=n}static{e(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let e=u,t=f();return g({...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=>{S(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(){c(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function X(e){if(!e.length)return[];let t=[],n=[];return e.forEach(e=>{let r={name:e.name,children:e.type===`Leaf`?void 0:[]};for(r.classSelector=e?.classSelector,e?.cssCompiledStyles&&(r.cssCompiledStyles=e.cssCompiledStyles),e.type===`Leaf`&&e.value!==void 0&&(r.value=e.value);n.length>0&&n[n.length-1].level>=e.level;)n.pop();if(n.length===0)t.push(r);else{let e=n[n.length-1].node;e.children?e.children.push(r):e.children=[r]}e.type!==`Leaf`&&n.push({node:r,level:e.level})}),t}e(X,`buildHierarchy`);var oe=e((t,n)=>{v(t,n);let r=[];for(let e of t.TreemapRows??[])e.$type===`ClassDefStatement`&&n.addClass(e.className??``,e.styleText??``);for(let e of t.TreemapRows??[]){let t=e.item;if(!t)continue;let i=e.indent?parseInt(e.indent):0,a=se(t),o=t.classSelector?n.getStylesForClass(t.classSelector):[],s=o.length>0?o:void 0,c={level:i,name:a,type:t.$type,value:t.value,classSelector:t.classSelector,cssCompiledStyles:s};r.push(c)}let i=X(r),a=e((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`),se=e(e=>e.name?String(e.name):``,`getItemName`),Z={parser:{yy:void 0},parse:e(async e=>{try{let n=await y(`treemap`,e);t.debug(`Treemap AST:`,n);let r=Z.parser?.yy;if(!(r instanceof Y))throw Error(`parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);oe(n,r)}catch(e){throw t.error(`Error parsing treemap:`,e),e}},`parse`)},ce=10,Q=10,$=25,le={draw:e((n,r,i,a)=>{let o=a.db,s=o.getConfig(),c=s.padding??ce,u=o.getDiagramTitle(),d=o.getRoot(),{themeVariables:g}=f();if(!d)return;let v=u?30:0,y=_(r),S=s.nodeWidth?s.nodeWidth*Q:960,C=s.nodeHeight?s.nodeHeight*Q:500,w=S,T=C+v;y.attr(`viewBox`,`0 0 ${w} ${T}`),l(y,T,w,s.useMaxWidth);let E;try{let t=s.valueFormat||`,`;if(t===`$0,0`)E=e(e=>`$`+h(`,`)(e),`valueFormat`);else if(t.startsWith(`$`)&&t.includes(`,`)){let n=/\.\d+/.exec(t),r=n?n[0]:``;E=e(e=>`$`+h(`,`+r)(e),`valueFormat`)}else if(t.startsWith(`$`)){let n=t.substring(1);E=e(e=>`$`+h(n||``)(e),`valueFormat`)}else E=h(t)}catch(e){t.error(`Error creating format function:`,e),E=h(`,`)}let D=p().range([`transparent`,g.cScale0,g.cScale1,g.cScale2,g.cScale3,g.cScale4,g.cScale5,g.cScale6,g.cScale7,g.cScale8,g.cScale9,g.cScale10,g.cScale11]),O=p().range([`transparent`,g.cScalePeer0,g.cScalePeer1,g.cScalePeer2,g.cScalePeer3,g.cScalePeer4,g.cScalePeer5,g.cScalePeer6,g.cScalePeer7,g.cScalePeer8,g.cScalePeer9,g.cScalePeer10,g.cScalePeer11]),k=p().range([g.cScaleLabel0,g.cScaleLabel1,g.cScaleLabel2,g.cScaleLabel3,g.cScaleLabel4,g.cScaleLabel5,g.cScaleLabel6,g.cScaleLabel7,g.cScaleLabel8,g.cScaleLabel9,g.cScaleLabel10,g.cScaleLabel11]);u&&y.append(`text`).attr(`x`,w/2).attr(`y`,v/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(u);let A=y.append(`g`).attr(`transform`,`translate(0, ${v})`).attr(`class`,`treemapContainer`),j=R(d).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=ae().size([S,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(c).paddingLeft(e=>e.children&&e.children.length>0?Q:0).paddingRight(e=>e.children&&e.children.length>0?Q:0).paddingBottom(e=>e.children&&e.children.length>0?Q:0).round(!0)(j),N=M.descendants().filter(e=>e.children&&e.children.length>0),P=A.selectAll(`.treemapSection`).data(N).enter().append(`g`).attr(`class`,`treemapSection`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,$).attr(`class`,`treemapSectionHeader`).attr(`fill`,`none`).attr(`fill-opacity`,.6).attr(`stroke-width`,.6).attr(`style`,e=>e.depth===0?`display: none;`:``),P.append(`clipPath`).attr(`id`,(e,t)=>`clip-section-${r}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-12)).attr(`height`,$),P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,(e,t)=>`treemapSection section${t}`).attr(`fill`,e=>D(e.data.name)).attr(`fill-opacity`,.6).attr(`stroke`,e=>O(e.data.name)).attr(`stroke-width`,2).attr(`stroke-opacity`,.4).attr(`style`,e=>{if(e.depth===0)return`display: none;`;let t=x({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(`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;`+x({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=m(this),n=e.data.name;t.text(n);let r=e.x1-e.x0,i;i=s.showValues!==!1&&e.value?r-10-30-10-6:r-6-6;let a=Math.max(15,i),o=t.node();if(o.getComputedTextLength()>a){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),o.getComputedTextLength()>a&&t.text(``);break}if(t.text(e+`...`),o.getComputedTextLength()<=a)break}}}),s.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;`+x({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`));let F=M.leaves(),I=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})`);I.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=>x({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),I.append(`clipPath`).attr(`id`,(e,t)=>`clip-${r}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-4)).attr(`height`,e=>Math.max(0,e.y1-e.y0-4)),I.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: 38px;fill:`+k(e.data.name)+`;`+x({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${r}-${t})`).text(e=>e.data.name).each(function(e){let t=m(this),n=e.x1-e.x0,r=e.y1-e.y0,i=t.node(),a=n-8,o=r-8;if(a<10||o<10){t.style(`display`,`none`);return}let s=parseInt(t.style(`font-size`),10),c=.6;for(;i.getComputedTextLength()>a&&s>8;)s--,t.style(`font-size`,`${s}px`);let l=Math.max(6,Math.min(28,Math.round(s*c))),u=s+2+l;for(;u>o&&s>8&&(s--,l=Math.max(6,Math.min(28,Math.round(s*c))),!(l<6&&s===8));)t.style(`font-size`,`${s}px`),u=s+2+l;t.style(`font-size`,`${s}px`),(i.getComputedTextLength()>a||s<8||o<s)&&t.style(`display`,`none`)}),s.showValues!==!1&&I.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: 28px;fill:`+k(e.data.name)+`;`+x({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${r}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let t=m(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let r=m(n).select(`.treemapLabel`);if(r.empty()||r.style(`display`)===`none`){t.style(`display`,`none`);return}let i=parseFloat(r.style(`font-size`)),a=Math.max(6,Math.min(28,Math.round(i*.6)));t.style(`font-size`,`${a}px`);let o=(e.y1-e.y0)/2+i/2+2;t.attr(`y`,o);let s=e.x1-e.x0,c=e.y1-e.y0-4,l=s-8;t.node().getComputedTextLength()>l||o+a>c||a<6?t.style(`display`,`none`):t.style(`display`,null)}),b(y,s.diagramPadding??8,`flowchart`,s?.useMaxWidth||!1)},`draw`),getClasses:e(function(e,t){return t.db.getClasses()},`getClasses`)},ue={sectionStrokeColor:`black`,sectionStrokeWidth:`1`,sectionFillColor:`#efefef`,leafStrokeColor:`black`,leafStrokeWidth:`1`,leafFillColor:`#efefef`,labelFontSize:`12px`,valueFontSize:`10px`,titleFontSize:`14px`},de={parser:Z,get db(){return new Y},renderer:le,styles:e(({treemap:e}={})=>{let t=g(i(),f().themeVariables),n=g(ue,e),r=n.titleColor??t.titleColor,a=n.labelColor??t.textColor,o=n.valueColor??t.textColor;return`
1
+ import{n as e,r as t}from"./src-DxsrUvGr.js";import{B as n,C as r,E as i,V as a,W as o,_ as s,a as c,c as l,d as u,v as d,y as f}from"./chunk-ICPOFSXX-Dy9JRPZu.js";import{t as p}from"./ordinal-C2dFitP3.js";import{C as m}from"./src-DXWvEiD2.js";import{t as h}from"./defaultLocale-C061bpWn.js";import{r as g}from"./chunk-5PVQY5BW-D2kQfsEU.js";import{t as _}from"./chunk-426QAEUC-CYmyjEj-.js";import{t as v}from"./chunk-4BX2VUAB-DeXGuanp.js";import{t as y}from"./mermaid-parser.core-CIRt0Dgq.js";import{t as b}from"./chunk-EDXVE4YY-9CmJcS4N.js";import{i as x,n as S}from"./chunk-X2U36JSP-b_VUmOsG.js";function C(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function w(){return this.eachAfter(C)}function T(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function E(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function D(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function O(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function k(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function A(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function j(e){for(var t=this,n=M(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function M(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function N(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function P(){return Array.from(this)}function F(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function I(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*L(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function R(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=V)):t===void 0&&(t=B);for(var n=new W(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new W(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(U)}function z(){return R(this).eachBefore(H)}function B(e){return e.children}function V(e){return Array.isArray(e)?e[1]:null}function H(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function U(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function W(e){this.data=e,this.depth=this.height=0,this.parent=null}W.prototype=R.prototype={constructor:W,count:w,each:T,eachAfter:D,eachBefore:E,find:O,sum:k,sort:A,path:j,ancestors:N,descendants:P,leaves:F,links:I,copy:z,[Symbol.iterator]:L};function G(e){if(typeof e!=`function`)throw Error();return e}function K(){return 0}function q(e){return function(){return e}}function J(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function ee(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function te(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}var ne=(1+Math.sqrt(5))/2;function re(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?ee(c,n,r,i,h?r+=m*g/h:a):te(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var ie=(function e(t){function n(e,n,r,i,a){re(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(ne);function ae(){var e=ie,t=!1,n=1,r=1,i=[0],a=K,o=K,s=K,c=K,l=K;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(J),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),t.x0=r,t.y0=u,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=l(t)-n,u+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),e(t,r,u,d,f))}return u.round=function(e){return arguments.length?(t=!!e,u):t},u.size=function(e){return arguments.length?(n=+e[0],r=+e[1],u):[n,r]},u.tile=function(t){return arguments.length?(e=G(t),u):e},u.padding=function(e){return arguments.length?u.paddingInner(e).paddingOuter(e):u.paddingInner()},u.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:q(+e),u):a},u.paddingOuter=function(e){return arguments.length?u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):u.paddingTop()},u.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:q(+e),u):o},u.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:q(+e),u):s},u.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:q(+e),u):c},u.paddingLeft=function(e){return arguments.length?(l=typeof e==`function`?e:q(+e),u):l},u}var Y=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=a,this.getAccTitle=d,this.setDiagramTitle=o,this.getDiagramTitle=r,this.getAccDescription=s,this.setAccDescription=n}static{e(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let e=u,t=f();return g({...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=>{S(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(){c(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function X(e){if(!e.length)return[];let t=[],n=[];return e.forEach(e=>{let r={name:e.name,children:e.type===`Leaf`?void 0:[]};for(r.classSelector=e?.classSelector,e?.cssCompiledStyles&&(r.cssCompiledStyles=e.cssCompiledStyles),e.type===`Leaf`&&e.value!==void 0&&(r.value=e.value);n.length>0&&n[n.length-1].level>=e.level;)n.pop();if(n.length===0)t.push(r);else{let e=n[n.length-1].node;e.children?e.children.push(r):e.children=[r]}e.type!==`Leaf`&&n.push({node:r,level:e.level})}),t}e(X,`buildHierarchy`);var oe=e((t,n)=>{v(t,n);let r=[];for(let e of t.TreemapRows??[])e.$type===`ClassDefStatement`&&n.addClass(e.className??``,e.styleText??``);for(let e of t.TreemapRows??[]){let t=e.item;if(!t)continue;let i=e.indent?parseInt(e.indent):0,a=se(t),o=t.classSelector?n.getStylesForClass(t.classSelector):[],s=o.length>0?o:void 0,c={level:i,name:a,type:t.$type,value:t.value,classSelector:t.classSelector,cssCompiledStyles:s};r.push(c)}let i=X(r),a=e((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`),se=e(e=>e.name?String(e.name):``,`getItemName`),Z={parser:{yy:void 0},parse:e(async e=>{try{let n=await y(`treemap`,e);t.debug(`Treemap AST:`,n);let r=Z.parser?.yy;if(!(r instanceof Y))throw Error(`parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);oe(n,r)}catch(e){throw t.error(`Error parsing treemap:`,e),e}},`parse`)},ce=10,Q=10,$=25,le={draw:e((n,r,i,a)=>{let o=a.db,s=o.getConfig(),c=s.padding??ce,u=o.getDiagramTitle(),d=o.getRoot(),{themeVariables:g}=f();if(!d)return;let v=u?30:0,y=_(r),S=s.nodeWidth?s.nodeWidth*Q:960,C=s.nodeHeight?s.nodeHeight*Q:500,w=S,T=C+v;y.attr(`viewBox`,`0 0 ${w} ${T}`),l(y,T,w,s.useMaxWidth);let E;try{let t=s.valueFormat||`,`;if(t===`$0,0`)E=e(e=>`$`+h(`,`)(e),`valueFormat`);else if(t.startsWith(`$`)&&t.includes(`,`)){let n=/\.\d+/.exec(t),r=n?n[0]:``;E=e(e=>`$`+h(`,`+r)(e),`valueFormat`)}else if(t.startsWith(`$`)){let n=t.substring(1);E=e(e=>`$`+h(n||``)(e),`valueFormat`)}else E=h(t)}catch(e){t.error(`Error creating format function:`,e),E=h(`,`)}let D=p().range([`transparent`,g.cScale0,g.cScale1,g.cScale2,g.cScale3,g.cScale4,g.cScale5,g.cScale6,g.cScale7,g.cScale8,g.cScale9,g.cScale10,g.cScale11]),O=p().range([`transparent`,g.cScalePeer0,g.cScalePeer1,g.cScalePeer2,g.cScalePeer3,g.cScalePeer4,g.cScalePeer5,g.cScalePeer6,g.cScalePeer7,g.cScalePeer8,g.cScalePeer9,g.cScalePeer10,g.cScalePeer11]),k=p().range([g.cScaleLabel0,g.cScaleLabel1,g.cScaleLabel2,g.cScaleLabel3,g.cScaleLabel4,g.cScaleLabel5,g.cScaleLabel6,g.cScaleLabel7,g.cScaleLabel8,g.cScaleLabel9,g.cScaleLabel10,g.cScaleLabel11]);u&&y.append(`text`).attr(`x`,w/2).attr(`y`,v/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(u);let A=y.append(`g`).attr(`transform`,`translate(0, ${v})`).attr(`class`,`treemapContainer`),j=R(d).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=ae().size([S,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(c).paddingLeft(e=>e.children&&e.children.length>0?Q:0).paddingRight(e=>e.children&&e.children.length>0?Q:0).paddingBottom(e=>e.children&&e.children.length>0?Q:0).round(!0)(j),N=M.descendants().filter(e=>e.children&&e.children.length>0),P=A.selectAll(`.treemapSection`).data(N).enter().append(`g`).attr(`class`,`treemapSection`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,$).attr(`class`,`treemapSectionHeader`).attr(`fill`,`none`).attr(`fill-opacity`,.6).attr(`stroke-width`,.6).attr(`style`,e=>e.depth===0?`display: none;`:``),P.append(`clipPath`).attr(`id`,(e,t)=>`clip-section-${r}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-12)).attr(`height`,$),P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,(e,t)=>`treemapSection section${t}`).attr(`fill`,e=>D(e.data.name)).attr(`fill-opacity`,.6).attr(`stroke`,e=>O(e.data.name)).attr(`stroke-width`,2).attr(`stroke-opacity`,.4).attr(`style`,e=>{if(e.depth===0)return`display: none;`;let t=x({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(`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;`+x({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=m(this),n=e.data.name;t.text(n);let r=e.x1-e.x0,i;i=s.showValues!==!1&&e.value?r-10-30-10-6:r-6-6;let a=Math.max(15,i),o=t.node();if(o.getComputedTextLength()>a){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),o.getComputedTextLength()>a&&t.text(``);break}if(t.text(e+`...`),o.getComputedTextLength()<=a)break}}}),s.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;`+x({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`));let F=M.leaves(),I=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})`);I.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=>x({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),I.append(`clipPath`).attr(`id`,(e,t)=>`clip-${r}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-4)).attr(`height`,e=>Math.max(0,e.y1-e.y0-4)),I.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: 38px;fill:`+k(e.data.name)+`;`+x({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${r}-${t})`).text(e=>e.data.name).each(function(e){let t=m(this),n=e.x1-e.x0,r=e.y1-e.y0,i=t.node(),a=n-8,o=r-8;if(a<10||o<10){t.style(`display`,`none`);return}let s=parseInt(t.style(`font-size`),10),c=.6;for(;i.getComputedTextLength()>a&&s>8;)s--,t.style(`font-size`,`${s}px`);let l=Math.max(6,Math.min(28,Math.round(s*c))),u=s+2+l;for(;u>o&&s>8&&(s--,l=Math.max(6,Math.min(28,Math.round(s*c))),!(l<6&&s===8));)t.style(`font-size`,`${s}px`),u=s+2+l;t.style(`font-size`,`${s}px`),(i.getComputedTextLength()>a||s<8||o<s)&&t.style(`display`,`none`)}),s.showValues!==!1&&I.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: 28px;fill:`+k(e.data.name)+`;`+x({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${r}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let t=m(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let r=m(n).select(`.treemapLabel`);if(r.empty()||r.style(`display`)===`none`){t.style(`display`,`none`);return}let i=parseFloat(r.style(`font-size`)),a=Math.max(6,Math.min(28,Math.round(i*.6)));t.style(`font-size`,`${a}px`);let o=(e.y1-e.y0)/2+i/2+2;t.attr(`y`,o);let s=e.x1-e.x0,c=e.y1-e.y0-4,l=s-8;t.node().getComputedTextLength()>l||o+a>c||a<6?t.style(`display`,`none`):t.style(`display`,null)}),b(y,s.diagramPadding??8,`flowchart`,s?.useMaxWidth||!1)},`draw`),getClasses:e(function(e,t){return t.db.getClasses()},`getClasses`)},ue={sectionStrokeColor:`black`,sectionStrokeWidth:`1`,sectionFillColor:`#efefef`,leafStrokeColor:`black`,leafStrokeWidth:`1`,leafFillColor:`#efefef`,labelFontSize:`12px`,valueFontSize:`10px`,titleFontSize:`14px`},de={parser:Z,get db(){return new Y},renderer:le,styles:e(({treemap:e}={})=>{let t=g(i(),f().themeVariables),n=g(ue,e),r=n.titleColor??t.titleColor,a=n.labelColor??t.textColor,o=n.valueColor??t.textColor;return`
2
2
  .treemapNode.section {
3
3
  stroke: ${n.sectionStrokeColor};
4
4
  stroke-width: ${n.sectionStrokeWidth};
@@ -1,4 +1,4 @@
1
- import{n as e,r as t}from"./src-DxsrUvGr.js";import{B as n,C as r,E as i,V as a,W as o,_ as s,a as c,c as l,d as u,v as d,y as f}from"./chunk-ICPOFSXX-Czafge50.js";import{r as p}from"./chunk-5PVQY5BW-BFfnnQIi.js";import{t as m}from"./chunk-426QAEUC-xq7mFc66.js";import{t as h}from"./chunk-4BX2VUAB-DeXGuanp.js";import{t as g}from"./mermaid-parser.core-CIRt0Dgq.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v={axes:[],curves:[],options:_},y=structuredClone(v),b=u.radar,x=e(()=>p({...b,...f().radar}),`getConfig`),S=e(()=>y.axes,`getAxes`),C=e(()=>y.curves,`getCurves`),w=e(()=>y.options,`getOptions`),T=e(e=>{y.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),E=e(e=>{y.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:D(e.entries)}))},`setCurves`),D=e(e=>{if(e[0].axis==null)return e.map(e=>e.value);let t=S();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`),O={getAxes:S,getCurves:C,getOptions:w,setAxes:T,setCurves:E,setOptions:e(e=>{let t=e.reduce((e,t)=>(e[t.name]=t,e),{});y.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}},`setOptions`),getConfig:x,clear:e(()=>{c(),y=structuredClone(v)},`clear`),setAccTitle:a,getAccTitle:d,setDiagramTitle:o,getDiagramTitle:r,getAccDescription:s,setAccDescription:n},k=e(e=>{h(e,O);let{axes:t,curves:n,options:r}=e;O.setAxes(t),O.setCurves(n),O.setOptions(r)},`populate`),A={parse:e(async e=>{let n=await g(`radar`,e);t.debug(n),k(n)},`parse`)},j=e((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),s=i.getOptions(),c=i.getConfig(),l=i.getDiagramTitle(),u=M(m(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;N(u,a,p,s.ticks,s.graticule),P(u,a,p,c),F(u,a,o,f,d,s.graticule,c),R(u,o,s.showLegend,c),u.append(`text`).attr(`class`,`radarTitle`).text(l).attr(`x`,0).attr(`y`,-c.height/2-c.marginTop)},`draw`),M=e((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}`),e.append(`g`).attr(`transform`,`translate(${i.x}, ${i.y})`)},`drawFrame`),N=e((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`),P=e((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;e.append(`line`).attr(`x1`,0).attr(`y1`,0).attr(`x2`,n*r.axisScaleFactor*Math.cos(s)).attr(`y2`,n*r.axisScaleFactor*Math.sin(s)).attr(`class`,`radarAxisLine`),e.append(`text`).text(o).attr(`x`,n*r.axisLabelFactor*Math.cos(s)).attr(`y`,n*r.axisLabelFactor*Math.sin(s)).attr(`class`,`radarAxisLabel`)}},`drawAxes`);function F(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=I(e,r,i,c);return{x:a*Math.cos(n),y:a*Math.sin(n)}});a===`circle`?e.append(`path`).attr(`d`,L(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}`)})}e(F,`drawCurves`);function I(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}e(I,`relativeRadius`);function L(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`}e(L,`closedRoundCurve`);function R(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)})}e(R,`drawLegend`);var z={draw:j},B=e((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,r as t}from"./src-DxsrUvGr.js";import{B as n,C as r,E as i,V as a,W as o,_ as s,a as c,c as l,d as u,v as d,y as f}from"./chunk-ICPOFSXX-Dy9JRPZu.js";import{r as p}from"./chunk-5PVQY5BW-D2kQfsEU.js";import{t as m}from"./chunk-426QAEUC-CYmyjEj-.js";import{t as h}from"./chunk-4BX2VUAB-DeXGuanp.js";import{t as g}from"./mermaid-parser.core-CIRt0Dgq.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v={axes:[],curves:[],options:_},y=structuredClone(v),b=u.radar,x=e(()=>p({...b,...f().radar}),`getConfig`),S=e(()=>y.axes,`getAxes`),C=e(()=>y.curves,`getCurves`),w=e(()=>y.options,`getOptions`),T=e(e=>{y.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),E=e(e=>{y.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:D(e.entries)}))},`setCurves`),D=e(e=>{if(e[0].axis==null)return e.map(e=>e.value);let t=S();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`),O={getAxes:S,getCurves:C,getOptions:w,setAxes:T,setCurves:E,setOptions:e(e=>{let t=e.reduce((e,t)=>(e[t.name]=t,e),{});y.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}},`setOptions`),getConfig:x,clear:e(()=>{c(),y=structuredClone(v)},`clear`),setAccTitle:a,getAccTitle:d,setDiagramTitle:o,getDiagramTitle:r,getAccDescription:s,setAccDescription:n},k=e(e=>{h(e,O);let{axes:t,curves:n,options:r}=e;O.setAxes(t),O.setCurves(n),O.setOptions(r)},`populate`),A={parse:e(async e=>{let n=await g(`radar`,e);t.debug(n),k(n)},`parse`)},j=e((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),s=i.getOptions(),c=i.getConfig(),l=i.getDiagramTitle(),u=M(m(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;N(u,a,p,s.ticks,s.graticule),P(u,a,p,c),F(u,a,o,f,d,s.graticule,c),R(u,o,s.showLegend,c),u.append(`text`).attr(`class`,`radarTitle`).text(l).attr(`x`,0).attr(`y`,-c.height/2-c.marginTop)},`draw`),M=e((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}`),e.append(`g`).attr(`transform`,`translate(${i.x}, ${i.y})`)},`drawFrame`),N=e((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`),P=e((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;e.append(`line`).attr(`x1`,0).attr(`y1`,0).attr(`x2`,n*r.axisScaleFactor*Math.cos(s)).attr(`y2`,n*r.axisScaleFactor*Math.sin(s)).attr(`class`,`radarAxisLine`),e.append(`text`).text(o).attr(`x`,n*r.axisLabelFactor*Math.cos(s)).attr(`y`,n*r.axisLabelFactor*Math.sin(s)).attr(`class`,`radarAxisLabel`)}},`drawAxes`);function F(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=I(e,r,i,c);return{x:a*Math.cos(n),y:a*Math.sin(n)}});a===`circle`?e.append(`path`).attr(`d`,L(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}`)})}e(F,`drawCurves`);function I(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}e(I,`relativeRadius`);function L(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`}e(L,`closedRoundCurve`);function R(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)})}e(R,`drawLegend`);var z={draw:j},B=e((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,r as t}from"./src-DxsrUvGr.js";import{B as n,C as r,V as i,W as a,_ as o,a as s,c,d as l,v as u,y as d}from"./chunk-ICPOFSXX-Czafge50.js";import{r as f}from"./chunk-5PVQY5BW-BFfnnQIi.js";import{t as p}from"./chunk-426QAEUC-xq7mFc66.js";import{t as m}from"./chunk-4BX2VUAB-DeXGuanp.js";import{t as h}from"./mermaid-parser.core-CIRt0Dgq.js";var g=l.packet,_=class{constructor(){this.packet=[],this.setAccTitle=i,this.getAccTitle=u,this.setDiagramTitle=a,this.getDiagramTitle=r,this.getAccDescription=o,this.setAccDescription=n}static{e(this,`PacketDB`)}getConfig(){let e=f({...g,...d().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=e((e,n)=>{m(e,n);let r=-1,i=[],a=1,{bitsPerRow:o}=n.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,t.debug(`Packet block ${s} - ${r} with label ${u}`);i.length<=o+1&&n.getPacket().length<v;){let[e,t]=b({start:s,end:c,bits:l,label:u},a,o);if(i.push(e),e.end+1===a*o&&(n.pushWord(i),i=[],a++),!t)break;({start:s,end:c,bits:l,label:u}=t)}}n.pushWord(i)},`populate`),b=e((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:e(async e=>{let n=await h(`packet`,e),r=x.parser?.yy;if(!(r instanceof _))throw Error(`parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);t.debug(n),y(n,r)},`parse`)},S=e((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(),m=o+s,h=m*(d.length+1)-(f?0:o),g=l*u+2,_=p(t);_.attr(`viewBox`,`0 0 ${g} ${h}`),c(_,h,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(f).attr(`x`,g/2).attr(`y`,h-m/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=e((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c})=>{let l=e.append(`g`),u=n*(r+a)+a;for(let e of t){let t=e.start%s*o+1,n=(e.end-e.start+1)*o-i;if(l.append(`rect`).attr(`x`,t).attr(`y`,u).attr(`width`,n).attr(`height`,r).attr(`class`,`packetBlock`),l.append(`text`).attr(`x`,t+n/2).attr(`y`,u+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let a=e.end===e.start,d=u-2;l.append(`text`).attr(`x`,t+(a?n/2:0)).attr(`y`,d).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,a?`middle`:`start`).text(e.start),a||l.append(`text`).attr(`x`,t+n).attr(`y`,d).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(e.end)}},`drawWord`),w={draw:S},T={byteFontSize:`10px`,startByteColor:`black`,endByteColor:`black`,labelColor:`black`,labelFontSize:`12px`,titleColor:`black`,titleFontSize:`14px`,blockStrokeColor:`black`,blockStrokeWidth:`1`,blockFillColor:`#efefef`},E={parser:x,get db(){return new _},renderer:w,styles:e(({packet:e}={})=>{let t=f(T,e);return`
1
+ import{n as e,r as t}from"./src-DxsrUvGr.js";import{B as n,C as r,V as i,W as a,_ as o,a as s,c,d as l,v as u,y as d}from"./chunk-ICPOFSXX-Dy9JRPZu.js";import{r as f}from"./chunk-5PVQY5BW-D2kQfsEU.js";import{t as p}from"./chunk-426QAEUC-CYmyjEj-.js";import{t as m}from"./chunk-4BX2VUAB-DeXGuanp.js";import{t as h}from"./mermaid-parser.core-CIRt0Dgq.js";var g=l.packet,_=class{constructor(){this.packet=[],this.setAccTitle=i,this.getAccTitle=u,this.setDiagramTitle=a,this.getDiagramTitle=r,this.getAccDescription=o,this.setAccDescription=n}static{e(this,`PacketDB`)}getConfig(){let e=f({...g,...d().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=e((e,n)=>{m(e,n);let r=-1,i=[],a=1,{bitsPerRow:o}=n.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,t.debug(`Packet block ${s} - ${r} with label ${u}`);i.length<=o+1&&n.getPacket().length<v;){let[e,t]=b({start:s,end:c,bits:l,label:u},a,o);if(i.push(e),e.end+1===a*o&&(n.pushWord(i),i=[],a++),!t)break;({start:s,end:c,bits:l,label:u}=t)}}n.pushWord(i)},`populate`),b=e((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:e(async e=>{let n=await h(`packet`,e),r=x.parser?.yy;if(!(r instanceof _))throw Error(`parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);t.debug(n),y(n,r)},`parse`)},S=e((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(),m=o+s,h=m*(d.length+1)-(f?0:o),g=l*u+2,_=p(t);_.attr(`viewBox`,`0 0 ${g} ${h}`),c(_,h,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(f).attr(`x`,g/2).attr(`y`,h-m/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=e((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c})=>{let l=e.append(`g`),u=n*(r+a)+a;for(let e of t){let t=e.start%s*o+1,n=(e.end-e.start+1)*o-i;if(l.append(`rect`).attr(`x`,t).attr(`y`,u).attr(`width`,n).attr(`height`,r).attr(`class`,`packetBlock`),l.append(`text`).attr(`x`,t+n/2).attr(`y`,u+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let a=e.end===e.start,d=u-2;l.append(`text`).attr(`x`,t+(a?n/2:0)).attr(`y`,d).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,a?`middle`:`start`).text(e.start),a||l.append(`text`).attr(`x`,t+n).attr(`y`,d).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(e.end)}},`drawWord`),w={draw:S},T={byteFontSize:`10px`,startByteColor:`black`,endByteColor:`black`,labelColor:`black`,labelFontSize:`12px`,titleColor:`black`,titleFontSize:`14px`,blockStrokeColor:`black`,blockStrokeWidth:`1`,blockFillColor:`#efefef`},E={parser:x,get db(){return new _},renderer:w,styles:e(({packet:e}={})=>{let t=f(T,e);return`
2
2
  .packetByte {
3
3
  font-size: ${t.byteFontSize};
4
4
  }
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,r,t as i}from"./compiler-runtime-Cs91PcD2.js";import{i as a,l as o,s,t as c,u as l}from"./button-CNAPefQE.js";import{r as u}from"./dist-QyEeuecv.js";import{a as d,d as f,f as p,i as m,l as h,n as g,o as _,r as ee,s as te,u as ne}from"./dist-FC83wUOI.js";var re=l(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),v=e(t(),1),y=n(),b=`focusScope.autoFocusOnMount`,x=`focusScope.autoFocusOnUnmount`,ie={bubbles:!1,cancelable:!0},ae=`FocusScope`,S=v.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[c,l]=v.useState(null),u=m(i),d=m(a),f=v.useRef(null),h=s(t,e=>l(e)),g=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;c.contains(t)?f.current=t:C(f.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(c.contains(t)||C(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&C(c)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,c,g.paused]),v.useEffect(()=>{if(c){fe.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(b,ie);c.addEventListener(b,u),c.dispatchEvent(t),t.defaultPrevented||(oe(he(ce(c)),{select:!0}),document.activeElement===e&&C(c))}return()=>{c.removeEventListener(b,u),setTimeout(()=>{let t=new CustomEvent(x,ie);c.addEventListener(x,d),c.dispatchEvent(t),t.defaultPrevented||C(e??document.body,{select:!0}),c.removeEventListener(x,d),fe.remove(g)},0)}}},[c,u,d,g]);let _=v.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=se(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&C(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&C(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,y.jsx)(p.div,{tabIndex:-1,...o,ref:h,onKeyDown:_})});S.displayName=ae;function oe(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(C(r,{select:t}),document.activeElement!==n)return}function se(e){let t=ce(e);return[le(t,e),le(t.reverse(),e)]}function ce(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function le(e,t){for(let n of e)if(!ue(n,{upTo:t}))return n}function ue(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function de(e){return e instanceof HTMLInputElement&&`select`in e}function C(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&de(e)&&t&&e.select()}}var fe=pe();function pe(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=me(e,t),e.unshift(t)},remove(t){e=me(e,t),e[0]?.resume()}}}function me(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function he(e){return e.filter(e=>e.tagName!==`A`)}var w=0;function ge(){v.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??_e()),document.body.insertAdjacentElement(`beforeend`,e[1]??_e()),w++,()=>{w===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),w--}},[])}function _e(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var T=function(){return T=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},T.apply(this,arguments)};function ve(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function ye(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var E=`right-scroll-bar-position`,D=`width-before-scroll-bar`,be=`with-scroll-bars-hidden`,xe=`--removed-body-scroll-bar-size`;function O(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Se(e,t){var n=(0,v.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Ce=typeof window<`u`?v.useLayoutEffect:v.useEffect,we=new WeakMap;function Te(e,t){var n=Se(t||null,function(t){return e.forEach(function(e){return O(e,t)})});return Ce(function(){var t=we.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||O(e,null)}),i.forEach(function(e){r.has(e)||O(e,a)})}we.set(n,e)},[e]),n}function Ee(e){return e}function De(e,t){t===void 0&&(t=Ee);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Oe(e){e===void 0&&(e={});var t=De(null);return t.options=T({async:!0,ssr:!1},e),t}var ke=function(e){var t=e.sideCar,n=ve(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return v.createElement(r,T({},n))};ke.isSideCarExport=!0;function Ae(e,t){return e.useMedium(t),ke}var je=Oe(),k=function(){},A=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:k,onWheelCapture:k,onTouchMoveCapture:k}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,ee=_===void 0?`div`:_,te=e.gapMode,ne=ve(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),re=f,y=Te([n,t]),b=T(T({},ne),i);return v.createElement(v.Fragment,null,u&&v.createElement(re,{sideCar:je,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:te}),o?v.cloneElement(v.Children.only(s),T(T({},b),{ref:y})):v.createElement(ee,T({},b,{className:c,ref:y}),s))});A.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},A.classNames={fullWidth:D,zeroRight:E};var Me,Ne=function(){if(Me)return Me;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Pe(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Ne();return t&&e.setAttribute(`nonce`,t),e}function Fe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ie(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Le=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Pe())&&(Fe(t,n),Ie(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Re=function(){var e=Le();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ze=function(){var e=Re();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Be={left:0,top:0,right:0,gap:0},j=function(e){return parseInt(e||``,10)||0},Ve=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[j(n),j(r),j(i)]},He=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Be;var t=Ve(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Ue=ze(),M=`data-scroll-locked`,We=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,r,t as i}from"./compiler-runtime-Cs91PcD2.js";import{i as a,l as o,s,t as c,u as l}from"./button-CNAPefQE.js";import{r as u}from"./dist-rFfpDyC7.js";import{a as d,d as f,f as p,i as m,l as h,n as g,o as _,r as ee,s as te,u as ne}from"./dist-CUqyztDT.js";var re=l(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),v=e(t(),1),y=n(),b=`focusScope.autoFocusOnMount`,x=`focusScope.autoFocusOnUnmount`,ie={bubbles:!1,cancelable:!0},ae=`FocusScope`,S=v.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[c,l]=v.useState(null),u=m(i),d=m(a),f=v.useRef(null),h=s(t,e=>l(e)),g=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;c.contains(t)?f.current=t:C(f.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(c.contains(t)||C(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&C(c)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,c,g.paused]),v.useEffect(()=>{if(c){fe.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(b,ie);c.addEventListener(b,u),c.dispatchEvent(t),t.defaultPrevented||(oe(he(ce(c)),{select:!0}),document.activeElement===e&&C(c))}return()=>{c.removeEventListener(b,u),setTimeout(()=>{let t=new CustomEvent(x,ie);c.addEventListener(x,d),c.dispatchEvent(t),t.defaultPrevented||C(e??document.body,{select:!0}),c.removeEventListener(x,d),fe.remove(g)},0)}}},[c,u,d,g]);let _=v.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=se(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&C(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&C(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,y.jsx)(p.div,{tabIndex:-1,...o,ref:h,onKeyDown:_})});S.displayName=ae;function oe(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(C(r,{select:t}),document.activeElement!==n)return}function se(e){let t=ce(e);return[le(t,e),le(t.reverse(),e)]}function ce(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function le(e,t){for(let n of e)if(!ue(n,{upTo:t}))return n}function ue(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function de(e){return e instanceof HTMLInputElement&&`select`in e}function C(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&de(e)&&t&&e.select()}}var fe=pe();function pe(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=me(e,t),e.unshift(t)},remove(t){e=me(e,t),e[0]?.resume()}}}function me(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function he(e){return e.filter(e=>e.tagName!==`A`)}var w=0;function ge(){v.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??_e()),document.body.insertAdjacentElement(`beforeend`,e[1]??_e()),w++,()=>{w===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),w--}},[])}function _e(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var T=function(){return T=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},T.apply(this,arguments)};function ve(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function ye(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var E=`right-scroll-bar-position`,D=`width-before-scroll-bar`,be=`with-scroll-bars-hidden`,xe=`--removed-body-scroll-bar-size`;function O(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Se(e,t){var n=(0,v.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Ce=typeof window<`u`?v.useLayoutEffect:v.useEffect,we=new WeakMap;function Te(e,t){var n=Se(t||null,function(t){return e.forEach(function(e){return O(e,t)})});return Ce(function(){var t=we.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||O(e,null)}),i.forEach(function(e){r.has(e)||O(e,a)})}we.set(n,e)},[e]),n}function Ee(e){return e}function De(e,t){t===void 0&&(t=Ee);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Oe(e){e===void 0&&(e={});var t=De(null);return t.options=T({async:!0,ssr:!1},e),t}var ke=function(e){var t=e.sideCar,n=ve(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return v.createElement(r,T({},n))};ke.isSideCarExport=!0;function Ae(e,t){return e.useMedium(t),ke}var je=Oe(),k=function(){},A=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:k,onWheelCapture:k,onTouchMoveCapture:k}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,ee=_===void 0?`div`:_,te=e.gapMode,ne=ve(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),re=f,y=Te([n,t]),b=T(T({},ne),i);return v.createElement(v.Fragment,null,u&&v.createElement(re,{sideCar:je,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:te}),o?v.cloneElement(v.Children.only(s),T(T({},b),{ref:y})):v.createElement(ee,T({},b,{className:c,ref:y}),s))});A.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},A.classNames={fullWidth:D,zeroRight:E};var Me,Ne=function(){if(Me)return Me;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Pe(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Ne();return t&&e.setAttribute(`nonce`,t),e}function Fe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ie(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Le=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Pe())&&(Fe(t,n),Ie(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Re=function(){var e=Le();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ze=function(){var e=Re();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Be={left:0,top:0,right:0,gap:0},j=function(e){return parseInt(e||``,10)||0},Ve=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[j(n),j(r),j(i)]},He=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Be;var t=Ve(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Ue=ze(),M=`data-scroll-locked`,We=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
2
  .${be} {
3
3
  overflow: hidden ${r};
4
4
  padding-right: ${s}px ${r};
@@ -1 +1 @@
1
- import{B as e,G as t,H as n,K as r,U as i,V as a,z as o}from"./dist--WFXzgaP.js";var s=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new c(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from,c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,r=this.buffer.length;if(r==0&&e.parent&&(r=e.bufferBase-e.parent.bufferBase,e=e.parent),r>0&&e.buffer[r-4]==0&&e.buffer[r-1]>-1){if(t==n)return;if(e.buffer[r-2]>=t){e.buffer[r-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(;n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new l(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216))if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new c(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},c=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},l=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3,this.state=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0)}},u=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function d(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var f=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},p=new f,m=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=p,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos);this.chunk=this.pos+e.length>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=p,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},h=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;v(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};h.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var g=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?d(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(v(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};g.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var _=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function v(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||b(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function y(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function b(e,t,n,r){let i=y(n,r,t);return i<0||y(n,r,e)<i}var x=typeof process<`u`&&/\bparse\b/.test({}.LOG),S=null;function C(t,n,r){let i=t.cursor(e.IncludeAnonymous);for(i.moveTo(n);;)if(!(r<0?i.childBefore(n):i.childAfter(n)))for(;;){if((r<0?i.to<n:i.from>n)&&!i.type.isError)return r<0?Math.max(0,Math.min(i.to-1,n-25)):Math.min(t.length,Math.max(i.from+1,n+25));if(r<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return r<0?0:t.length}}var w=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?C(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?C(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[i],s=this.start[t]+n.positions[i];if(s>e)return this.nextStart=s,null;if(o instanceof r){if(s==e){if(s<this.safeFrom)return null;let e=s+o.length;if(e<=this.safeTo){let t=o.prop(a.lookAhead);if(!t||e+t<this.fragment.to)return o}}this.index[t]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+o.length}}},T=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new f)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if(!(n&&!c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new f,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new f,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535)if(o[s+1]==1)s=M(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(M(o,s+2),t,n,r));break}o[s]==t&&(r=this.putAction(M(o,s+1),t,n,r))}return r}},E=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new m(t,r),this.tokens=new T(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[s.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new w(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&N(r);if(e)return x&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw x&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return x&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500)if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}advanceStack(e,t,n){let i=e.pos,{parser:o}=this,s=x?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let c=this.fragments.nodeAt(i);c;){let i=this.parser.nodeSet.types[c.type.id]==c.type?o.getGoto(e.state,c.type.id):-1;if(i>-1&&c.length&&(!t||(c.prop(a.contextHash)||0)==n))return e.useNode(c,i),x&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(c.type.id)})`),!0;if(!(c instanceof r)||c.children.length==0||c.positions[0]>0)break;let l=c.children[0];if(l instanceof r&&c.positions[0]==0)c=l;else break}}let c=o.stateSlot(e.state,4);if(c>0)return e.reduce(c),x&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let r=0;r<l.length;){let a=l[r++],c=l[r++],u=l[r++],d=r==l.length||!n,f=d?e:e.split(),p=this.tokens.mainToken;if(f.apply(a,c,p?p.start:f.pos,u),x&&console.log(s+this.stackID(f)+` (via ${a&65536?`reduce of ${o.getName(a&65535)}`:`shift`} for ${o.getName(c)} @ ${i}${f==e?``:`, split`})`),d)return!0;f.pos>i?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return D(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=x?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),x&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(x&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)x&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))x&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),x&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),D(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),r.build({buffer:u.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(S||=new WeakMap).get(e);return t||S.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function D(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var O=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},k=e=>e,A=class{constructor(e){this.start=e.start,this.shift=e.shift||k,this.reduce=e.reduce||k,this.reuse=e.reuse||k,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},j=class e extends t{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(` `);this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push(``);let r=Object.keys(e.topRules).map(t=>e.topRules[t][1]),s=[];for(let e=0;e<t.length;e++)s.push([]);function c(e,t,n){s[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];typeof e==`string`&&(e=a[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)c(r,e,t[n++]);else{let i=t[n+-r];for(let a=-r;a>0;a--)c(t[n++],e,i);n++}}}this.nodeSet=new n(t.map((t,n)=>i.define({name:n>=this.minRepeatTerm?void 0:t,id:n,props:s[n],top:r.indexOf(n)>-1,error:n==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(n)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=o;let l=d(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(P),this.states=d(e.states,Uint32Array),this.data=d(e.stateData),this.goto=d(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>typeof e==`number`?new h(l,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new E(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535)if(n[i+1]==1)a=n[i=M(n,i+2)];else if(n[i+1]==2)return M(n,i+2);else break;if(a==t||a==0)return M(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=M(this.data,n+2);else break;r=t(M(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=M(this.data,n+2);else break;if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(t){let n=Object.assign(Object.create(e.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);n.top=e}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((e,r)=>{let i=t.specializers.find(t=>t.from==e.external);if(!i)return e;let a=Object.assign(Object.assign({},e),{external:i.to});return n.specializers[r]=P(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new O(e,n,r)}static deserialize(t){return new e(t)}};function M(e,t){return e[t]|e[t+1]<<16}function N(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function P(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}export{g as i,_ as n,j as r,A as t};
1
+ import{B as e,G as t,H as n,K as r,U as i,V as a,z as o}from"./dist-C0jOOVYt.js";var s=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new c(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from,c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,r=this.buffer.length;if(r==0&&e.parent&&(r=e.bufferBase-e.parent.bufferBase,e=e.parent),r>0&&e.buffer[r-4]==0&&e.buffer[r-1]>-1){if(t==n)return;if(e.buffer[r-2]>=t){e.buffer[r-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(;n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new l(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216))if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new c(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},c=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},l=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3,this.state=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0)}},u=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function d(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var f=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},p=new f,m=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=p,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos);this.chunk=this.pos+e.length>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=p,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},h=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;v(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};h.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var g=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?d(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(v(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};g.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var _=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function v(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||b(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function y(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function b(e,t,n,r){let i=y(n,r,t);return i<0||y(n,r,e)<i}var x=typeof process<`u`&&/\bparse\b/.test({}.LOG),S=null;function C(t,n,r){let i=t.cursor(e.IncludeAnonymous);for(i.moveTo(n);;)if(!(r<0?i.childBefore(n):i.childAfter(n)))for(;;){if((r<0?i.to<n:i.from>n)&&!i.type.isError)return r<0?Math.max(0,Math.min(i.to-1,n-25)):Math.min(t.length,Math.max(i.from+1,n+25));if(r<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return r<0?0:t.length}}var w=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?C(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?C(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[i],s=this.start[t]+n.positions[i];if(s>e)return this.nextStart=s,null;if(o instanceof r){if(s==e){if(s<this.safeFrom)return null;let e=s+o.length;if(e<=this.safeTo){let t=o.prop(a.lookAhead);if(!t||e+t<this.fragment.to)return o}}this.index[t]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+o.length}}},T=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new f)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if(!(n&&!c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new f,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new f,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535)if(o[s+1]==1)s=M(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(M(o,s+2),t,n,r));break}o[s]==t&&(r=this.putAction(M(o,s+1),t,n,r))}return r}},E=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new m(t,r),this.tokens=new T(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[s.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new w(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&N(r);if(e)return x&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw x&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return x&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500)if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}advanceStack(e,t,n){let i=e.pos,{parser:o}=this,s=x?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let c=this.fragments.nodeAt(i);c;){let i=this.parser.nodeSet.types[c.type.id]==c.type?o.getGoto(e.state,c.type.id):-1;if(i>-1&&c.length&&(!t||(c.prop(a.contextHash)||0)==n))return e.useNode(c,i),x&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(c.type.id)})`),!0;if(!(c instanceof r)||c.children.length==0||c.positions[0]>0)break;let l=c.children[0];if(l instanceof r&&c.positions[0]==0)c=l;else break}}let c=o.stateSlot(e.state,4);if(c>0)return e.reduce(c),x&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let r=0;r<l.length;){let a=l[r++],c=l[r++],u=l[r++],d=r==l.length||!n,f=d?e:e.split(),p=this.tokens.mainToken;if(f.apply(a,c,p?p.start:f.pos,u),x&&console.log(s+this.stackID(f)+` (via ${a&65536?`reduce of ${o.getName(a&65535)}`:`shift`} for ${o.getName(c)} @ ${i}${f==e?``:`, split`})`),d)return!0;f.pos>i?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return D(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=x?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),x&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(x&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)x&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))x&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),x&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),D(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),r.build({buffer:u.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(S||=new WeakMap).get(e);return t||S.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function D(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var O=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},k=e=>e,A=class{constructor(e){this.start=e.start,this.shift=e.shift||k,this.reduce=e.reduce||k,this.reuse=e.reuse||k,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},j=class e extends t{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(` `);this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push(``);let r=Object.keys(e.topRules).map(t=>e.topRules[t][1]),s=[];for(let e=0;e<t.length;e++)s.push([]);function c(e,t,n){s[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];typeof e==`string`&&(e=a[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)c(r,e,t[n++]);else{let i=t[n+-r];for(let a=-r;a>0;a--)c(t[n++],e,i);n++}}}this.nodeSet=new n(t.map((t,n)=>i.define({name:n>=this.minRepeatTerm?void 0:t,id:n,props:s[n],top:r.indexOf(n)>-1,error:n==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(n)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=o;let l=d(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(P),this.states=d(e.states,Uint32Array),this.data=d(e.stateData),this.goto=d(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>typeof e==`number`?new h(l,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new E(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535)if(n[i+1]==1)a=n[i=M(n,i+2)];else if(n[i+1]==2)return M(n,i+2);else break;if(a==t||a==0)return M(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=M(this.data,n+2);else break;r=t(M(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=M(this.data,n+2);else break;if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(t){let n=Object.assign(Object.create(e.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);n.top=e}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((e,r)=>{let i=t.specializers.find(t=>t.from==e.external);if(!i)return e;let a=Object.assign(Object.assign({},e),{external:i.to});return n.specializers[r]=P(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new O(e,n,r)}static deserialize(t){return new e(t)}};function M(e,t){return e[t]|e[t+1]<<16}function N(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function P(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}export{g as i,_ as n,j as r,A as t};