research-copilot 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +190 -0
  3. package/app/build/icon.icns +0 -0
  4. package/app/build/icon.ico +0 -0
  5. package/app/build/icon.png +0 -0
  6. package/app/out/main/index.mjs +6719 -0
  7. package/app/out/preload/index.js +141 -0
  8. package/app/out/renderer/assets/Inter-Variable-Latin-8kRkwJBP.woff2 +0 -0
  9. package/app/out/renderer/assets/Inter-Variable-LatinExt-B_-bZUTo.woff2 +0 -0
  10. package/app/out/renderer/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  11. package/app/out/renderer/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  12. package/app/out/renderer/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  13. package/app/out/renderer/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  14. package/app/out/renderer/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  15. package/app/out/renderer/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  16. package/app/out/renderer/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  17. package/app/out/renderer/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  18. package/app/out/renderer/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  19. package/app/out/renderer/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  20. package/app/out/renderer/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  21. package/app/out/renderer/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  22. package/app/out/renderer/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  23. package/app/out/renderer/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  24. package/app/out/renderer/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  25. package/app/out/renderer/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  26. package/app/out/renderer/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  27. package/app/out/renderer/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  28. package/app/out/renderer/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  29. package/app/out/renderer/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  30. package/app/out/renderer/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  31. package/app/out/renderer/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  32. package/app/out/renderer/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  33. package/app/out/renderer/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  34. package/app/out/renderer/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  35. package/app/out/renderer/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  36. package/app/out/renderer/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  37. package/app/out/renderer/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  38. package/app/out/renderer/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  39. package/app/out/renderer/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  40. package/app/out/renderer/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  41. package/app/out/renderer/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  42. package/app/out/renderer/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  43. package/app/out/renderer/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  44. package/app/out/renderer/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  45. package/app/out/renderer/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  46. package/app/out/renderer/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  47. package/app/out/renderer/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  48. package/app/out/renderer/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  49. package/app/out/renderer/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  50. package/app/out/renderer/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  51. package/app/out/renderer/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  52. package/app/out/renderer/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  53. package/app/out/renderer/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  54. package/app/out/renderer/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  55. package/app/out/renderer/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  56. package/app/out/renderer/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  57. package/app/out/renderer/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  58. package/app/out/renderer/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  59. package/app/out/renderer/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  60. package/app/out/renderer/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  61. package/app/out/renderer/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  62. package/app/out/renderer/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  63. package/app/out/renderer/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  64. package/app/out/renderer/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  65. package/app/out/renderer/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  66. package/app/out/renderer/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  67. package/app/out/renderer/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  68. package/app/out/renderer/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  69. package/app/out/renderer/assets/MilkdownMarkdownEditor-bLPxrCVb.js +89821 -0
  70. package/app/out/renderer/assets/MilkdownMarkdownEditor-tTNRIB2K.css +2555 -0
  71. package/app/out/renderer/assets/Tableau10-BqnYsPR6.js +9 -0
  72. package/app/out/renderer/assets/apl-fqmucPXA.js +140 -0
  73. package/app/out/renderer/assets/arc-J47ePHZ2.js +132 -0
  74. package/app/out/renderer/assets/array-DgktLKBx.js +6 -0
  75. package/app/out/renderer/assets/asciiarmor-DucZyvP0.js +56 -0
  76. package/app/out/renderer/assets/asn1-BnOEsgAm.js +144 -0
  77. package/app/out/renderer/assets/asterisk-QAlztEwS.js +345 -0
  78. package/app/out/renderer/assets/blockDiagram-c4efeb88-5uRQXgQJ.js +1817 -0
  79. package/app/out/renderer/assets/brainfuck-DZVCuF_t.js +53 -0
  80. package/app/out/renderer/assets/c4Diagram-c83219d4-C4iCTPEL.js +2464 -0
  81. package/app/out/renderer/assets/channel-ZAmhHE3g.js +7 -0
  82. package/app/out/renderer/assets/classDiagram-beda092f-7NOZxq_W.js +357 -0
  83. package/app/out/renderer/assets/classDiagram-v2-2358418a-5fPT-cUH.js +291 -0
  84. package/app/out/renderer/assets/clike-xqXYL6ge.js +805 -0
  85. package/app/out/renderer/assets/clojure-BhXMqnxz.js +849 -0
  86. package/app/out/renderer/assets/clone-CsnzsYXQ.js +8 -0
  87. package/app/out/renderer/assets/cmake-BGaNd9E7.js +71 -0
  88. package/app/out/renderer/assets/cobol-4yqQntpt.js +120 -0
  89. package/app/out/renderer/assets/coffeescript-D2dXvhEc.js +308 -0
  90. package/app/out/renderer/assets/commonlisp-CF_VNHQR.js +130 -0
  91. package/app/out/renderer/assets/createText-1719965b-Cji7KN4K.js +4904 -0
  92. package/app/out/renderer/assets/crystal-DyuLTqLs.js +398 -0
  93. package/app/out/renderer/assets/css-c-jst79C.js +1783 -0
  94. package/app/out/renderer/assets/cypher-Dlu_3r4V.js +121 -0
  95. package/app/out/renderer/assets/d-UURgV0Ux.js +179 -0
  96. package/app/out/renderer/assets/diff-B_Bi2Crb.js +25 -0
  97. package/app/out/renderer/assets/dockerfile-Bvk733Ga.js +201 -0
  98. package/app/out/renderer/assets/dtd-Dy74G54E.js +114 -0
  99. package/app/out/renderer/assets/dylan-TSb-Nfix.js +314 -0
  100. package/app/out/renderer/assets/ebnf-DAomQUbD.js +139 -0
  101. package/app/out/renderer/assets/ecl-B59qGGVg.js +178 -0
  102. package/app/out/renderer/assets/edges-96097737-CD0EvAZQ.js +1844 -0
  103. package/app/out/renderer/assets/eiffel-Dze7nlu3.js +134 -0
  104. package/app/out/renderer/assets/elm-DG7jkhNZ.js +176 -0
  105. package/app/out/renderer/assets/erDiagram-0228fc6a-DRYXBpi7.js +1321 -0
  106. package/app/out/renderer/assets/erlang-BO6gOnGA.js +674 -0
  107. package/app/out/renderer/assets/factor-CMxFHDqz.js +65 -0
  108. package/app/out/renderer/assets/fcl-CDDUNjTj.js +141 -0
  109. package/app/out/renderer/assets/flowDb-c6c81e3f-CuoIN-Cy.js +1713 -0
  110. package/app/out/renderer/assets/flowDiagram-50d868cf-CPWPLOml.js +1272 -0
  111. package/app/out/renderer/assets/flowDiagram-v2-4f6560a1-C_R12s4S.js +33 -0
  112. package/app/out/renderer/assets/flowchart-elk-definition-6af322e1-BdKUSFpi.js +92921 -0
  113. package/app/out/renderer/assets/forth-B9D2JCeE.js +116 -0
  114. package/app/out/renderer/assets/fortran-CAG2BFbe.js +467 -0
  115. package/app/out/renderer/assets/ganttDiagram-a2739b55-ygqT5HlG.js +3399 -0
  116. package/app/out/renderer/assets/gas-d3KEcW3x.js +294 -0
  117. package/app/out/renderer/assets/gherkin-DhZlEZiy.js +115 -0
  118. package/app/out/renderer/assets/gitGraphDiagram-82fe8481-D97GT4iA.js +1791 -0
  119. package/app/out/renderer/assets/graph-DpC13d95.js +1237 -0
  120. package/app/out/renderer/assets/groovy-CpwJiBl7.js +223 -0
  121. package/app/out/renderer/assets/haskell-BlGBCCe3.js +459 -0
  122. package/app/out/renderer/assets/haxe-7MlzfeYV.js +514 -0
  123. package/app/out/renderer/assets/http-BqypyemW.js +79 -0
  124. package/app/out/renderer/assets/idl-4HIGJlDI.js +985 -0
  125. package/app/out/renderer/assets/index-4-ziknCv.js +292 -0
  126. package/app/out/renderer/assets/index-5325376f-Bbs7Fbqr.js +663 -0
  127. package/app/out/renderer/assets/index-B2jip-rk.js +2489 -0
  128. package/app/out/renderer/assets/index-BKTVfokE.js +312 -0
  129. package/app/out/renderer/assets/index-BiJbFgVG.js +118 -0
  130. package/app/out/renderer/assets/index-Bn433Fat.js +83 -0
  131. package/app/out/renderer/assets/index-BqDyyRCx.js +39679 -0
  132. package/app/out/renderer/assets/index-BzFMeMPn.js +158 -0
  133. package/app/out/renderer/assets/index-C-_uCjZJ.css +2701 -0
  134. package/app/out/renderer/assets/index-C1ithNW1.js +1765 -0
  135. package/app/out/renderer/assets/index-CAJkRYkO.js +407 -0
  136. package/app/out/renderer/assets/index-CleO0-yj.js +690 -0
  137. package/app/out/renderer/assets/index-Cq4MH3sY.js +1020 -0
  138. package/app/out/renderer/assets/index-CtA0Xj22.js +705 -0
  139. package/app/out/renderer/assets/index-CvAZkqBZ.js +83 -0
  140. package/app/out/renderer/assets/index-D3UDN-5c.js +152 -0
  141. package/app/out/renderer/assets/index-D4F9R5ao.js +179 -0
  142. package/app/out/renderer/assets/index-D6RguhZ5.js +328 -0
  143. package/app/out/renderer/assets/index-DnEowqXv.js +386 -0
  144. package/app/out/renderer/assets/index-K8c8Mqdy.js +98 -0
  145. package/app/out/renderer/assets/index-Kh14gO6K.js +62 -0
  146. package/app/out/renderer/assets/index-WFd2jRnA.js +333 -0
  147. package/app/out/renderer/assets/index-WgMfkRFp.js +313 -0
  148. package/app/out/renderer/assets/index-Y4lKyF6t.js +1042 -0
  149. package/app/out/renderer/assets/index-fx307_f1.js +643 -0
  150. package/app/out/renderer/assets/infoDiagram-8eee0895-ptaVSwzq.js +511 -0
  151. package/app/out/renderer/assets/init-ZxktEp_H.js +16 -0
  152. package/app/out/renderer/assets/javascript-C3MnDRiU.js +994 -0
  153. package/app/out/renderer/assets/journeyDiagram-c64418c1-aloEGOQp.js +1184 -0
  154. package/app/out/renderer/assets/julia-Bs6JJhYG.js +407 -0
  155. package/app/out/renderer/assets/layout-ZeuHE_aY.js +2217 -0
  156. package/app/out/renderer/assets/line-CAgaGl-S.js +45 -0
  157. package/app/out/renderer/assets/linear-DIg7lTe1.js +539 -0
  158. package/app/out/renderer/assets/livescript-DmzgM3Yt.js +296 -0
  159. package/app/out/renderer/assets/lua-8cJgIlqe.js +256 -0
  160. package/app/out/renderer/assets/mathematica-DNLOL9PQ.js +110 -0
  161. package/app/out/renderer/assets/mbox-Ga7d4MMN.js +117 -0
  162. package/app/out/renderer/assets/mindmap-definition-8da855dc-B8XVoUxz.js +36054 -0
  163. package/app/out/renderer/assets/mirc-Dma3B8rS.js +107 -0
  164. package/app/out/renderer/assets/mllike-DHn7xckP.js +334 -0
  165. package/app/out/renderer/assets/modelica-0d55jYY0.js +147 -0
  166. package/app/out/renderer/assets/mscgen-DdqZYINH.js +135 -0
  167. package/app/out/renderer/assets/mumps-Btr8VblO.js +93 -0
  168. package/app/out/renderer/assets/nginx-DTDtBDVN.js +141 -0
  169. package/app/out/renderer/assets/nsis-3zG7tgur.js +62 -0
  170. package/app/out/renderer/assets/ntriples-CvgOYMpL.js +153 -0
  171. package/app/out/renderer/assets/octave-DYBj3-tl.js +200 -0
  172. package/app/out/renderer/assets/ordinal-DSZU4PqD.js +76 -0
  173. package/app/out/renderer/assets/oz-R_e8WMIi.js +231 -0
  174. package/app/out/renderer/assets/pascal-GD8iposT.js +105 -0
  175. package/app/out/renderer/assets/path-Cp2qmpkd.js +109 -0
  176. package/app/out/renderer/assets/perl-DL9mHpoi.js +1105 -0
  177. package/app/out/renderer/assets/pieDiagram-a8764435-DlwoeBU2.js +770 -0
  178. package/app/out/renderer/assets/pig-C_4T4YIV.js +101 -0
  179. package/app/out/renderer/assets/powershell-B0suO7Vd.js +328 -0
  180. package/app/out/renderer/assets/properties-BR-vP1aU.js +58 -0
  181. package/app/out/renderer/assets/protobuf-BxgpyhoW.js +77 -0
  182. package/app/out/renderer/assets/pug-By0kVCfm.js +405 -0
  183. package/app/out/renderer/assets/puppet-Bdao66PW.js +137 -0
  184. package/app/out/renderer/assets/python-CvWbmiX4.js +427 -0
  185. package/app/out/renderer/assets/q-CrbCVq4a.js +131 -0
  186. package/app/out/renderer/assets/quadrantDiagram-1e28029f-BaSi1XB4.js +1200 -0
  187. package/app/out/renderer/assets/r-V7nswm59.js +170 -0
  188. package/app/out/renderer/assets/requirementDiagram-08caed73-D3EFyegZ.js +1092 -0
  189. package/app/out/renderer/assets/rpm-C-DLY-If.js +109 -0
  190. package/app/out/renderer/assets/ruby-JDKLJNK0.js +330 -0
  191. package/app/out/renderer/assets/sankeyDiagram-a04cb91d-Cv44AsnM.js +1174 -0
  192. package/app/out/renderer/assets/sas-D2UG-yhZ.js +207 -0
  193. package/app/out/renderer/assets/scheme-BKzrkGJD.js +222 -0
  194. package/app/out/renderer/assets/sequenceDiagram-c5b8d532-CuUBu-x4.js +3337 -0
  195. package/app/out/renderer/assets/shell-BlsXDxCn.js +222 -0
  196. package/app/out/renderer/assets/sieve-CjwBwOY5.js +135 -0
  197. package/app/out/renderer/assets/simple-mode-DMneyfDu.js +130 -0
  198. package/app/out/renderer/assets/smalltalk-BOIGQuhN.js +121 -0
  199. package/app/out/renderer/assets/solr-CwD7U71z.js +69 -0
  200. package/app/out/renderer/assets/sparql-DYskk2vE.js +249 -0
  201. package/app/out/renderer/assets/spreadsheet-Bgtt3oLP.js +87 -0
  202. package/app/out/renderer/assets/sql-BSrOzCRI.js +354 -0
  203. package/app/out/renderer/assets/stateDiagram-1ecb1508-BOU34Zp4.js +454 -0
  204. package/app/out/renderer/assets/stateDiagram-v2-c2b004d7-BgRoffou.js +326 -0
  205. package/app/out/renderer/assets/stex-B6LNC55o.js +231 -0
  206. package/app/out/renderer/assets/styles-b4e223ce-BMr9TPuj.js +1483 -0
  207. package/app/out/renderer/assets/styles-ca3715f6-DgbNw99p.js +1363 -0
  208. package/app/out/renderer/assets/styles-d45a18b0-DtRYKYKf.js +574 -0
  209. package/app/out/renderer/assets/stylus-BkS-boTH.js +565 -0
  210. package/app/out/renderer/assets/svgDrawCommon-b86b1483-Bein03PD.js +100 -0
  211. package/app/out/renderer/assets/swift-FRZi1uvB.js +291 -0
  212. package/app/out/renderer/assets/tcl-CUcaCdmq.js +114 -0
  213. package/app/out/renderer/assets/textile-BnFpjsrl.js +414 -0
  214. package/app/out/renderer/assets/tiddlywiki-CjprD-Qp.js +218 -0
  215. package/app/out/renderer/assets/tiki-B4EPSQ1G.js +265 -0
  216. package/app/out/renderer/assets/timeline-definition-faaaa080-BlWpLE_4.js +1212 -0
  217. package/app/out/renderer/assets/toml-BOuWGMcf.js +76 -0
  218. package/app/out/renderer/assets/troff-E1bJ0PPL.js +61 -0
  219. package/app/out/renderer/assets/ttcn-cfg-Dc39-fIP.js +133 -0
  220. package/app/out/renderer/assets/ttcn-tKd4HLu4.js +192 -0
  221. package/app/out/renderer/assets/turtle-Dq7-1WAf.js +124 -0
  222. package/app/out/renderer/assets/vb-Dp90gtsv.js +196 -0
  223. package/app/out/renderer/assets/vbscript-CI6_mxxU.js +479 -0
  224. package/app/out/renderer/assets/velocity-BwIZK1TH.js +149 -0
  225. package/app/out/renderer/assets/verilog-DDCYnHN8.js +430 -0
  226. package/app/out/renderer/assets/vhdl-DCkMIyT9.js +158 -0
  227. package/app/out/renderer/assets/webidl-BTLTThCm.js +204 -0
  228. package/app/out/renderer/assets/xquery-BgiOC5Ce.js +525 -0
  229. package/app/out/renderer/assets/xychartDiagram-f5964ef8-Bhga-YXm.js +1799 -0
  230. package/app/out/renderer/assets/yacas-b5lAVEIl.js +130 -0
  231. package/app/out/renderer/assets/z80-BZV19vqv.js +93 -0
  232. package/app/out/renderer/index.html +13 -0
  233. package/app/out/skills/community-builtin/README.md +29 -0
  234. package/app/out/skills/community-builtin/document-docx/SKILL.md +44 -0
  235. package/app/out/skills/community-builtin/document-docx/scripts/docx-to-markdown.sh +20 -0
  236. package/app/out/skills/community-builtin/document-docx/scripts/extract-docx-text.sh +28 -0
  237. package/app/out/skills/community-builtin/document-docx/scripts/init-docx-template.sh +32 -0
  238. package/app/out/skills/community-builtin/document-docx/scripts/setup-docx-tools.sh +10 -0
  239. package/app/out/skills/community-builtin/markitdown/SKILL.md +105 -0
  240. package/app/out/skills/community-builtin/markitdown/scripts/batch-convert.sh +40 -0
  241. package/app/out/skills/community-builtin/markitdown/scripts/convert-file.sh +24 -0
  242. package/app/out/skills/community-builtin/markitdown/scripts/setup-markitdown.sh +10 -0
  243. package/app/out/skills/community-builtin/repo-quick-audit/SKILL.md +27 -0
  244. package/app/out/skills/community-builtin/repo-quick-audit/scripts/audit-basics.sh +19 -0
  245. package/app/out/skills/research-pilot-default-project-skills/README.md +23 -0
  246. package/app/out/skills/research-pilot-default-project-skills/citation-management/SKILL.md +39 -0
  247. package/app/out/skills/research-pilot-default-project-skills/citation-management/scripts/doi-to-bibtex.sh +25 -0
  248. package/app/out/skills/research-pilot-default-project-skills/citation-management/scripts/normalize-bibtex-keys.sh +51 -0
  249. package/app/out/skills/research-pilot-default-project-skills/citation-management/scripts/setup-citation-tools.sh +10 -0
  250. package/app/out/skills/research-pilot-default-project-skills/citation-management/scripts/validate-bib.sh +31 -0
  251. package/app/out/skills/research-pilot-default-project-skills/matplotlib/SKILL.md +34 -0
  252. package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/api_reference.md +412 -0
  253. package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/common_issues.md +563 -0
  254. package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/plot_types.md +476 -0
  255. package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/styling_guide.md +589 -0
  256. package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/subagent_quickstart.md +30 -0
  257. package/app/out/skills/research-pilot-default-project-skills/matplotlib/scripts/plot_template.py +401 -0
  258. package/app/out/skills/research-pilot-default-project-skills/matplotlib/scripts/style_configurator.py +409 -0
  259. package/app/out/skills/research-pilot-default-project-skills/research-grants/SKILL.md +38 -0
  260. package/app/out/skills/research-pilot-default-project-skills/research-grants/scripts/check-grant-compliance.sh +40 -0
  261. package/app/out/skills/research-pilot-default-project-skills/research-grants/scripts/grant-summary-card.sh +32 -0
  262. package/app/out/skills/research-pilot-default-project-skills/research-grants/scripts/init-grant-structure.sh +70 -0
  263. package/app/package.json +77 -0
  264. package/bin/cli.mjs +56 -0
  265. package/lib/README.md +145 -0
  266. package/lib/skills/_generated.ts +13 -0
  267. package/lib/skills/builtin/brainstorming-research-ideas/SKILL.md +280 -0
  268. package/lib/skills/builtin/coding/SKILL.md +114 -0
  269. package/lib/skills/builtin/creative-thinking-for-research/SKILL.md +273 -0
  270. package/lib/skills/builtin/matplotlib/SKILL.md +361 -0
  271. package/lib/skills/builtin/matplotlib/references/api_reference.md +412 -0
  272. package/lib/skills/builtin/matplotlib/references/common_issues.md +563 -0
  273. package/lib/skills/builtin/matplotlib/references/plot_types.md +476 -0
  274. package/lib/skills/builtin/matplotlib/references/styling_guide.md +589 -0
  275. package/lib/skills/builtin/matplotlib/scripts/plot_template.py +401 -0
  276. package/lib/skills/builtin/matplotlib/scripts/style_configurator.py +409 -0
  277. package/lib/skills/builtin/paper-writing/SKILL.md +554 -0
  278. package/lib/skills/builtin/paper-writing/references/checklists.md +524 -0
  279. package/lib/skills/builtin/paper-writing/references/citation-workflow.md +562 -0
  280. package/lib/skills/builtin/paper-writing/references/reviewer-guidelines.md +462 -0
  281. package/lib/skills/builtin/paper-writing/references/sources.md +189 -0
  282. package/lib/skills/builtin/paper-writing/references/systems-conferences.md +260 -0
  283. package/lib/skills/builtin/paper-writing/references/writing-guide.md +476 -0
  284. package/lib/skills/builtin/paper-writing/templates/README.md +408 -0
  285. package/lib/skills/builtin/paper-writing/templates/aaai2026/README.md +534 -0
  286. package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026-unified-supp.tex +144 -0
  287. package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026-unified-template.tex +952 -0
  288. package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026.bib +111 -0
  289. package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026.bst +1493 -0
  290. package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026.sty +315 -0
  291. package/lib/skills/builtin/paper-writing/templates/acl/README.md +50 -0
  292. package/lib/skills/builtin/paper-writing/templates/acl/acl.sty +312 -0
  293. package/lib/skills/builtin/paper-writing/templates/acl/acl_latex.tex +377 -0
  294. package/lib/skills/builtin/paper-writing/templates/acl/acl_lualatex.tex +101 -0
  295. package/lib/skills/builtin/paper-writing/templates/acl/acl_natbib.bst +1940 -0
  296. package/lib/skills/builtin/paper-writing/templates/acl/anthology.bib.txt +26 -0
  297. package/lib/skills/builtin/paper-writing/templates/acl/custom.bib +70 -0
  298. package/lib/skills/builtin/paper-writing/templates/acl/formatting.md +326 -0
  299. package/lib/skills/builtin/paper-writing/templates/asplos2027/main.tex +459 -0
  300. package/lib/skills/builtin/paper-writing/templates/asplos2027/references.bib +135 -0
  301. package/lib/skills/builtin/paper-writing/templates/colm2025/README.md +3 -0
  302. package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.bib +11 -0
  303. package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.bst +1440 -0
  304. package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.pdf +0 -0
  305. package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.sty +218 -0
  306. package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.tex +305 -0
  307. package/lib/skills/builtin/paper-writing/templates/colm2025/fancyhdr.sty +485 -0
  308. package/lib/skills/builtin/paper-writing/templates/colm2025/math_commands.tex +508 -0
  309. package/lib/skills/builtin/paper-writing/templates/colm2025/natbib.sty +1246 -0
  310. package/lib/skills/builtin/paper-writing/templates/iclr2026/fancyhdr.sty +485 -0
  311. package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.bib +24 -0
  312. package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.bst +1440 -0
  313. package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.pdf +0 -0
  314. package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.sty +246 -0
  315. package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.tex +414 -0
  316. package/lib/skills/builtin/paper-writing/templates/iclr2026/math_commands.tex +508 -0
  317. package/lib/skills/builtin/paper-writing/templates/iclr2026/natbib.sty +1246 -0
  318. package/lib/skills/builtin/paper-writing/templates/icml2026/algorithm.sty +79 -0
  319. package/lib/skills/builtin/paper-writing/templates/icml2026/algorithmic.sty +201 -0
  320. package/lib/skills/builtin/paper-writing/templates/icml2026/example_paper.bib +75 -0
  321. package/lib/skills/builtin/paper-writing/templates/icml2026/example_paper.pdf +0 -0
  322. package/lib/skills/builtin/paper-writing/templates/icml2026/example_paper.tex +662 -0
  323. package/lib/skills/builtin/paper-writing/templates/icml2026/fancyhdr.sty +864 -0
  324. package/lib/skills/builtin/paper-writing/templates/icml2026/icml2026.bst +1443 -0
  325. package/lib/skills/builtin/paper-writing/templates/icml2026/icml2026.sty +767 -0
  326. package/lib/skills/builtin/paper-writing/templates/icml2026/icml_numpapers.pdf +0 -0
  327. package/lib/skills/builtin/paper-writing/templates/neurips2025/Makefile +36 -0
  328. package/lib/skills/builtin/paper-writing/templates/neurips2025/extra_pkgs.tex +53 -0
  329. package/lib/skills/builtin/paper-writing/templates/neurips2025/main.tex +38 -0
  330. package/lib/skills/builtin/paper-writing/templates/neurips2025/neurips.sty +382 -0
  331. package/lib/skills/builtin/paper-writing/templates/nsdi2027/main.tex +426 -0
  332. package/lib/skills/builtin/paper-writing/templates/nsdi2027/references.bib +151 -0
  333. package/lib/skills/builtin/paper-writing/templates/nsdi2027/usenix-2020-09.sty +83 -0
  334. package/lib/skills/builtin/paper-writing/templates/osdi2026/main.tex +429 -0
  335. package/lib/skills/builtin/paper-writing/templates/osdi2026/references.bib +150 -0
  336. package/lib/skills/builtin/paper-writing/templates/osdi2026/usenix-2020-09.sty +83 -0
  337. package/lib/skills/builtin/paper-writing/templates/sosp2026/main.tex +532 -0
  338. package/lib/skills/builtin/paper-writing/templates/sosp2026/references.bib +148 -0
  339. package/lib/skills/builtin/research-grants/SKILL.md +958 -0
  340. package/lib/skills/builtin/research-grants/assets/budget_justification_template.md +453 -0
  341. package/lib/skills/builtin/research-grants/assets/nih_specific_aims_template.md +166 -0
  342. package/lib/skills/builtin/research-grants/assets/nsf_project_summary_template.md +92 -0
  343. package/lib/skills/builtin/research-grants/references/README.md +285 -0
  344. package/lib/skills/builtin/research-grants/references/broader_impacts.md +392 -0
  345. package/lib/skills/builtin/research-grants/references/darpa_guidelines.md +636 -0
  346. package/lib/skills/builtin/research-grants/references/doe_guidelines.md +586 -0
  347. package/lib/skills/builtin/research-grants/references/nih_guidelines.md +851 -0
  348. package/lib/skills/builtin/research-grants/references/nsf_guidelines.md +570 -0
  349. package/lib/skills/builtin/research-grants/references/nstc_guidelines.md +733 -0
  350. package/lib/skills/builtin/research-grants/references/specific_aims_guide.md +458 -0
  351. package/lib/skills/builtin/rewrite-humanize/SKILL.md +116 -0
  352. package/lib/skills/builtin/rewrite-humanize/references/cs-venue-tone.md +57 -0
  353. package/lib/skills/builtin/rewrite-humanize/references/lexicon.md +50 -0
  354. package/lib/skills/builtin/scholar-evaluation/SKILL.md +300 -0
  355. package/lib/skills/builtin/scholar-evaluation/references/evaluation_framework.md +663 -0
  356. package/lib/skills/builtin/scholar-evaluation/scripts/calculate_scores.py +379 -0
  357. package/lib/skills/builtin/scientific-schematics/SKILL.md +603 -0
  358. package/lib/skills/builtin/scientific-schematics/references/QUICK_REFERENCE.md +182 -0
  359. package/lib/skills/builtin/scientific-schematics/references/README.md +292 -0
  360. package/lib/skills/builtin/scientific-schematics/references/best_practices.md +560 -0
  361. package/lib/skills/builtin/scientific-schematics/scripts/__pycache__/generate_schematic.cpython-312.pyc +0 -0
  362. package/lib/skills/builtin/scientific-schematics/scripts/__pycache__/generate_schematic_ai.cpython-312.pyc +0 -0
  363. package/lib/skills/builtin/scientific-schematics/scripts/example_usage.sh +85 -0
  364. package/lib/skills/builtin/scientific-schematics/scripts/generate_schematic.py +141 -0
  365. package/lib/skills/builtin/scientific-schematics/scripts/generate_schematic_ai.py +910 -0
  366. package/lib/skills/builtin/scientific-visualization/SKILL.md +749 -0
  367. package/lib/skills/builtin/scientific-visualization/assets/color_palettes.py +197 -0
  368. package/lib/skills/builtin/scientific-visualization/assets/nature.mplstyle +63 -0
  369. package/lib/skills/builtin/scientific-visualization/assets/presentation.mplstyle +61 -0
  370. package/lib/skills/builtin/scientific-visualization/assets/publication.mplstyle +68 -0
  371. package/lib/skills/builtin/scientific-visualization/references/color_palettes.md +348 -0
  372. package/lib/skills/builtin/scientific-visualization/references/journal_requirements.md +320 -0
  373. package/lib/skills/builtin/scientific-visualization/references/matplotlib_examples.md +620 -0
  374. package/lib/skills/builtin/scientific-visualization/references/publication_guidelines.md +205 -0
  375. package/lib/skills/builtin/scientific-visualization/scripts/figure_export.py +343 -0
  376. package/lib/skills/builtin/scientific-visualization/scripts/style_presets.py +416 -0
  377. package/lib/skills/builtin/scientific-writing/SKILL.md +745 -0
  378. package/lib/skills/builtin/scientific-writing/assets/REPORT_FORMATTING_GUIDE.md +574 -0
  379. package/lib/skills/builtin/scientific-writing/assets/scientific_report.sty +606 -0
  380. package/lib/skills/builtin/scientific-writing/assets/scientific_report_template.tex +449 -0
  381. package/lib/skills/builtin/scientific-writing/references/citation_styles.md +720 -0
  382. package/lib/skills/builtin/scientific-writing/references/figures_tables.md +806 -0
  383. package/lib/skills/builtin/scientific-writing/references/imrad_structure.md +686 -0
  384. package/lib/skills/builtin/scientific-writing/references/professional_report_formatting.md +664 -0
  385. package/lib/skills/builtin/scientific-writing/references/reporting_guidelines.md +748 -0
  386. package/lib/skills/builtin/scientific-writing/references/writing_principles.md +824 -0
  387. package/lib/skills/builtin/seaborn/SKILL.md +674 -0
  388. package/lib/skills/builtin/seaborn/references/examples.md +822 -0
  389. package/lib/skills/builtin/seaborn/references/function_reference.md +770 -0
  390. package/lib/skills/builtin/seaborn/references/objects_interface.md +964 -0
  391. package/lib/skills/data-analysis/SKILL.md +285 -0
  392. package/lib/skills/generate-skill-content.mjs +58 -0
  393. package/lib/skills/index.ts +34 -0
  394. package/lib/skills/loader.ts +452 -0
  395. package/package.json +62 -0
@@ -0,0 +1,1174 @@
1
+ import { J as setDiagramTitle, H as getDiagramTitle, m as setAccDescription, n as getAccDescription, q as setAccTitle, o as getAccTitle, r as getConfig, K as defaultConfig, u as select, ak as setupGraphViewbox$1, M as clear$1, C as common$1 } from "./MilkdownMarkdownEditor-bLPxrCVb.js";
2
+ import { o as ordinal } from "./ordinal-DSZU4PqD.js";
3
+ import { s as schemeTableau10 } from "./Tableau10-BqnYsPR6.js";
4
+ import "./index-BqDyyRCx.js";
5
+ import "./init-ZxktEp_H.js";
6
+ function max(values, valueof) {
7
+ let max2;
8
+ if (valueof === void 0) {
9
+ for (const value2 of values) {
10
+ if (value2 != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) {
11
+ max2 = value2;
12
+ }
13
+ }
14
+ } else {
15
+ let index = -1;
16
+ for (let value2 of values) {
17
+ if ((value2 = valueof(value2, ++index, values)) != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) {
18
+ max2 = value2;
19
+ }
20
+ }
21
+ }
22
+ return max2;
23
+ }
24
+ function min(values, valueof) {
25
+ let min2;
26
+ if (valueof === void 0) {
27
+ for (const value2 of values) {
28
+ if (value2 != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) {
29
+ min2 = value2;
30
+ }
31
+ }
32
+ } else {
33
+ let index = -1;
34
+ for (let value2 of values) {
35
+ if ((value2 = valueof(value2, ++index, values)) != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) {
36
+ min2 = value2;
37
+ }
38
+ }
39
+ }
40
+ return min2;
41
+ }
42
+ function sum(values, valueof) {
43
+ let sum2 = 0;
44
+ if (valueof === void 0) {
45
+ for (let value2 of values) {
46
+ if (value2 = +value2) {
47
+ sum2 += value2;
48
+ }
49
+ }
50
+ } else {
51
+ let index = -1;
52
+ for (let value2 of values) {
53
+ if (value2 = +valueof(value2, ++index, values)) {
54
+ sum2 += value2;
55
+ }
56
+ }
57
+ }
58
+ return sum2;
59
+ }
60
+ function targetDepth(d) {
61
+ return d.target.depth;
62
+ }
63
+ function left(node) {
64
+ return node.depth;
65
+ }
66
+ function right(node, n) {
67
+ return n - 1 - node.height;
68
+ }
69
+ function justify(node, n) {
70
+ return node.sourceLinks.length ? node.depth : n - 1;
71
+ }
72
+ function center(node) {
73
+ return node.targetLinks.length ? node.depth : node.sourceLinks.length ? min(node.sourceLinks, targetDepth) - 1 : 0;
74
+ }
75
+ function constant$1(x2) {
76
+ return function() {
77
+ return x2;
78
+ };
79
+ }
80
+ function ascendingSourceBreadth(a, b) {
81
+ return ascendingBreadth(a.source, b.source) || a.index - b.index;
82
+ }
83
+ function ascendingTargetBreadth(a, b) {
84
+ return ascendingBreadth(a.target, b.target) || a.index - b.index;
85
+ }
86
+ function ascendingBreadth(a, b) {
87
+ return a.y0 - b.y0;
88
+ }
89
+ function value(d) {
90
+ return d.value;
91
+ }
92
+ function defaultId(d) {
93
+ return d.index;
94
+ }
95
+ function defaultNodes(graph) {
96
+ return graph.nodes;
97
+ }
98
+ function defaultLinks(graph) {
99
+ return graph.links;
100
+ }
101
+ function find(nodeById, id) {
102
+ const node = nodeById.get(id);
103
+ if (!node) throw new Error("missing: " + id);
104
+ return node;
105
+ }
106
+ function computeLinkBreadths({ nodes: nodes2 }) {
107
+ for (const node of nodes2) {
108
+ let y0 = node.y0;
109
+ let y1 = y0;
110
+ for (const link2 of node.sourceLinks) {
111
+ link2.y0 = y0 + link2.width / 2;
112
+ y0 += link2.width;
113
+ }
114
+ for (const link2 of node.targetLinks) {
115
+ link2.y1 = y1 + link2.width / 2;
116
+ y1 += link2.width;
117
+ }
118
+ }
119
+ }
120
+ function Sankey() {
121
+ let x0 = 0, y0 = 0, x1 = 1, y1 = 1;
122
+ let dx = 24;
123
+ let dy = 8, py;
124
+ let id = defaultId;
125
+ let align = justify;
126
+ let sort;
127
+ let linkSort;
128
+ let nodes2 = defaultNodes;
129
+ let links2 = defaultLinks;
130
+ let iterations = 6;
131
+ function sankey() {
132
+ const graph = { nodes: nodes2.apply(null, arguments), links: links2.apply(null, arguments) };
133
+ computeNodeLinks(graph);
134
+ computeNodeValues(graph);
135
+ computeNodeDepths(graph);
136
+ computeNodeHeights(graph);
137
+ computeNodeBreadths(graph);
138
+ computeLinkBreadths(graph);
139
+ return graph;
140
+ }
141
+ sankey.update = function(graph) {
142
+ computeLinkBreadths(graph);
143
+ return graph;
144
+ };
145
+ sankey.nodeId = function(_) {
146
+ return arguments.length ? (id = typeof _ === "function" ? _ : constant$1(_), sankey) : id;
147
+ };
148
+ sankey.nodeAlign = function(_) {
149
+ return arguments.length ? (align = typeof _ === "function" ? _ : constant$1(_), sankey) : align;
150
+ };
151
+ sankey.nodeSort = function(_) {
152
+ return arguments.length ? (sort = _, sankey) : sort;
153
+ };
154
+ sankey.nodeWidth = function(_) {
155
+ return arguments.length ? (dx = +_, sankey) : dx;
156
+ };
157
+ sankey.nodePadding = function(_) {
158
+ return arguments.length ? (dy = py = +_, sankey) : dy;
159
+ };
160
+ sankey.nodes = function(_) {
161
+ return arguments.length ? (nodes2 = typeof _ === "function" ? _ : constant$1(_), sankey) : nodes2;
162
+ };
163
+ sankey.links = function(_) {
164
+ return arguments.length ? (links2 = typeof _ === "function" ? _ : constant$1(_), sankey) : links2;
165
+ };
166
+ sankey.linkSort = function(_) {
167
+ return arguments.length ? (linkSort = _, sankey) : linkSort;
168
+ };
169
+ sankey.size = function(_) {
170
+ return arguments.length ? (x0 = y0 = 0, x1 = +_[0], y1 = +_[1], sankey) : [x1 - x0, y1 - y0];
171
+ };
172
+ sankey.extent = function(_) {
173
+ return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], sankey) : [[x0, y0], [x1, y1]];
174
+ };
175
+ sankey.iterations = function(_) {
176
+ return arguments.length ? (iterations = +_, sankey) : iterations;
177
+ };
178
+ function computeNodeLinks({ nodes: nodes3, links: links3 }) {
179
+ for (const [i, node] of nodes3.entries()) {
180
+ node.index = i;
181
+ node.sourceLinks = [];
182
+ node.targetLinks = [];
183
+ }
184
+ const nodeById = new Map(nodes3.map((d, i) => [id(d, i, nodes3), d]));
185
+ for (const [i, link2] of links3.entries()) {
186
+ link2.index = i;
187
+ let { source, target } = link2;
188
+ if (typeof source !== "object") source = link2.source = find(nodeById, source);
189
+ if (typeof target !== "object") target = link2.target = find(nodeById, target);
190
+ source.sourceLinks.push(link2);
191
+ target.targetLinks.push(link2);
192
+ }
193
+ if (linkSort != null) {
194
+ for (const { sourceLinks, targetLinks } of nodes3) {
195
+ sourceLinks.sort(linkSort);
196
+ targetLinks.sort(linkSort);
197
+ }
198
+ }
199
+ }
200
+ function computeNodeValues({ nodes: nodes3 }) {
201
+ for (const node of nodes3) {
202
+ node.value = node.fixedValue === void 0 ? Math.max(sum(node.sourceLinks, value), sum(node.targetLinks, value)) : node.fixedValue;
203
+ }
204
+ }
205
+ function computeNodeDepths({ nodes: nodes3 }) {
206
+ const n = nodes3.length;
207
+ let current = new Set(nodes3);
208
+ let next = /* @__PURE__ */ new Set();
209
+ let x2 = 0;
210
+ while (current.size) {
211
+ for (const node of current) {
212
+ node.depth = x2;
213
+ for (const { target } of node.sourceLinks) {
214
+ next.add(target);
215
+ }
216
+ }
217
+ if (++x2 > n) throw new Error("circular link");
218
+ current = next;
219
+ next = /* @__PURE__ */ new Set();
220
+ }
221
+ }
222
+ function computeNodeHeights({ nodes: nodes3 }) {
223
+ const n = nodes3.length;
224
+ let current = new Set(nodes3);
225
+ let next = /* @__PURE__ */ new Set();
226
+ let x2 = 0;
227
+ while (current.size) {
228
+ for (const node of current) {
229
+ node.height = x2;
230
+ for (const { source } of node.targetLinks) {
231
+ next.add(source);
232
+ }
233
+ }
234
+ if (++x2 > n) throw new Error("circular link");
235
+ current = next;
236
+ next = /* @__PURE__ */ new Set();
237
+ }
238
+ }
239
+ function computeNodeLayers({ nodes: nodes3 }) {
240
+ const x2 = max(nodes3, (d) => d.depth) + 1;
241
+ const kx = (x1 - x0 - dx) / (x2 - 1);
242
+ const columns = new Array(x2);
243
+ for (const node of nodes3) {
244
+ const i = Math.max(0, Math.min(x2 - 1, Math.floor(align.call(null, node, x2))));
245
+ node.layer = i;
246
+ node.x0 = x0 + i * kx;
247
+ node.x1 = node.x0 + dx;
248
+ if (columns[i]) columns[i].push(node);
249
+ else columns[i] = [node];
250
+ }
251
+ if (sort) for (const column of columns) {
252
+ column.sort(sort);
253
+ }
254
+ return columns;
255
+ }
256
+ function initializeNodeBreadths(columns) {
257
+ const ky = min(columns, (c) => (y1 - y0 - (c.length - 1) * py) / sum(c, value));
258
+ for (const nodes3 of columns) {
259
+ let y2 = y0;
260
+ for (const node of nodes3) {
261
+ node.y0 = y2;
262
+ node.y1 = y2 + node.value * ky;
263
+ y2 = node.y1 + py;
264
+ for (const link2 of node.sourceLinks) {
265
+ link2.width = link2.value * ky;
266
+ }
267
+ }
268
+ y2 = (y1 - y2 + py) / (nodes3.length + 1);
269
+ for (let i = 0; i < nodes3.length; ++i) {
270
+ const node = nodes3[i];
271
+ node.y0 += y2 * (i + 1);
272
+ node.y1 += y2 * (i + 1);
273
+ }
274
+ reorderLinks(nodes3);
275
+ }
276
+ }
277
+ function computeNodeBreadths(graph) {
278
+ const columns = computeNodeLayers(graph);
279
+ py = Math.min(dy, (y1 - y0) / (max(columns, (c) => c.length) - 1));
280
+ initializeNodeBreadths(columns);
281
+ for (let i = 0; i < iterations; ++i) {
282
+ const alpha = Math.pow(0.99, i);
283
+ const beta = Math.max(1 - alpha, (i + 1) / iterations);
284
+ relaxRightToLeft(columns, alpha, beta);
285
+ relaxLeftToRight(columns, alpha, beta);
286
+ }
287
+ }
288
+ function relaxLeftToRight(columns, alpha, beta) {
289
+ for (let i = 1, n = columns.length; i < n; ++i) {
290
+ const column = columns[i];
291
+ for (const target of column) {
292
+ let y2 = 0;
293
+ let w = 0;
294
+ for (const { source, value: value2 } of target.targetLinks) {
295
+ let v = value2 * (target.layer - source.layer);
296
+ y2 += targetTop(source, target) * v;
297
+ w += v;
298
+ }
299
+ if (!(w > 0)) continue;
300
+ let dy2 = (y2 / w - target.y0) * alpha;
301
+ target.y0 += dy2;
302
+ target.y1 += dy2;
303
+ reorderNodeLinks(target);
304
+ }
305
+ if (sort === void 0) column.sort(ascendingBreadth);
306
+ resolveCollisions(column, beta);
307
+ }
308
+ }
309
+ function relaxRightToLeft(columns, alpha, beta) {
310
+ for (let n = columns.length, i = n - 2; i >= 0; --i) {
311
+ const column = columns[i];
312
+ for (const source of column) {
313
+ let y2 = 0;
314
+ let w = 0;
315
+ for (const { target, value: value2 } of source.sourceLinks) {
316
+ let v = value2 * (target.layer - source.layer);
317
+ y2 += sourceTop(source, target) * v;
318
+ w += v;
319
+ }
320
+ if (!(w > 0)) continue;
321
+ let dy2 = (y2 / w - source.y0) * alpha;
322
+ source.y0 += dy2;
323
+ source.y1 += dy2;
324
+ reorderNodeLinks(source);
325
+ }
326
+ if (sort === void 0) column.sort(ascendingBreadth);
327
+ resolveCollisions(column, beta);
328
+ }
329
+ }
330
+ function resolveCollisions(nodes3, alpha) {
331
+ const i = nodes3.length >> 1;
332
+ const subject = nodes3[i];
333
+ resolveCollisionsBottomToTop(nodes3, subject.y0 - py, i - 1, alpha);
334
+ resolveCollisionsTopToBottom(nodes3, subject.y1 + py, i + 1, alpha);
335
+ resolveCollisionsBottomToTop(nodes3, y1, nodes3.length - 1, alpha);
336
+ resolveCollisionsTopToBottom(nodes3, y0, 0, alpha);
337
+ }
338
+ function resolveCollisionsTopToBottom(nodes3, y2, i, alpha) {
339
+ for (; i < nodes3.length; ++i) {
340
+ const node = nodes3[i];
341
+ const dy2 = (y2 - node.y0) * alpha;
342
+ if (dy2 > 1e-6) node.y0 += dy2, node.y1 += dy2;
343
+ y2 = node.y1 + py;
344
+ }
345
+ }
346
+ function resolveCollisionsBottomToTop(nodes3, y2, i, alpha) {
347
+ for (; i >= 0; --i) {
348
+ const node = nodes3[i];
349
+ const dy2 = (node.y1 - y2) * alpha;
350
+ if (dy2 > 1e-6) node.y0 -= dy2, node.y1 -= dy2;
351
+ y2 = node.y0 - py;
352
+ }
353
+ }
354
+ function reorderNodeLinks({ sourceLinks, targetLinks }) {
355
+ if (linkSort === void 0) {
356
+ for (const { source: { sourceLinks: sourceLinks2 } } of targetLinks) {
357
+ sourceLinks2.sort(ascendingTargetBreadth);
358
+ }
359
+ for (const { target: { targetLinks: targetLinks2 } } of sourceLinks) {
360
+ targetLinks2.sort(ascendingSourceBreadth);
361
+ }
362
+ }
363
+ }
364
+ function reorderLinks(nodes3) {
365
+ if (linkSort === void 0) {
366
+ for (const { sourceLinks, targetLinks } of nodes3) {
367
+ sourceLinks.sort(ascendingTargetBreadth);
368
+ targetLinks.sort(ascendingSourceBreadth);
369
+ }
370
+ }
371
+ }
372
+ function targetTop(source, target) {
373
+ let y2 = source.y0 - (source.sourceLinks.length - 1) * py / 2;
374
+ for (const { target: node, width } of source.sourceLinks) {
375
+ if (node === target) break;
376
+ y2 += width + py;
377
+ }
378
+ for (const { source: node, width } of target.targetLinks) {
379
+ if (node === source) break;
380
+ y2 -= width;
381
+ }
382
+ return y2;
383
+ }
384
+ function sourceTop(source, target) {
385
+ let y2 = target.y0 - (target.targetLinks.length - 1) * py / 2;
386
+ for (const { source: node, width } of target.targetLinks) {
387
+ if (node === source) break;
388
+ y2 += width + py;
389
+ }
390
+ for (const { target: node, width } of source.sourceLinks) {
391
+ if (node === target) break;
392
+ y2 -= width;
393
+ }
394
+ return y2;
395
+ }
396
+ return sankey;
397
+ }
398
+ var pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon;
399
+ function Path() {
400
+ this._x0 = this._y0 = // start of current subpath
401
+ this._x1 = this._y1 = null;
402
+ this._ = "";
403
+ }
404
+ function path() {
405
+ return new Path();
406
+ }
407
+ Path.prototype = path.prototype = {
408
+ constructor: Path,
409
+ moveTo: function(x2, y2) {
410
+ this._ += "M" + (this._x0 = this._x1 = +x2) + "," + (this._y0 = this._y1 = +y2);
411
+ },
412
+ closePath: function() {
413
+ if (this._x1 !== null) {
414
+ this._x1 = this._x0, this._y1 = this._y0;
415
+ this._ += "Z";
416
+ }
417
+ },
418
+ lineTo: function(x2, y2) {
419
+ this._ += "L" + (this._x1 = +x2) + "," + (this._y1 = +y2);
420
+ },
421
+ quadraticCurveTo: function(x1, y1, x2, y2) {
422
+ this._ += "Q" + +x1 + "," + +y1 + "," + (this._x1 = +x2) + "," + (this._y1 = +y2);
423
+ },
424
+ bezierCurveTo: function(x1, y1, x2, y2, x3, y3) {
425
+ this._ += "C" + +x1 + "," + +y1 + "," + +x2 + "," + +y2 + "," + (this._x1 = +x3) + "," + (this._y1 = +y3);
426
+ },
427
+ arcTo: function(x1, y1, x2, y2, r) {
428
+ x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
429
+ var x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
430
+ if (r < 0) throw new Error("negative radius: " + r);
431
+ if (this._x1 === null) {
432
+ this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
433
+ } else if (!(l01_2 > epsilon)) ;
434
+ else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
435
+ this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
436
+ } else {
437
+ var x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;
438
+ if (Math.abs(t01 - 1) > epsilon) {
439
+ this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
440
+ }
441
+ this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
442
+ }
443
+ },
444
+ arc: function(x2, y2, r, a0, a1, ccw) {
445
+ x2 = +x2, y2 = +y2, r = +r, ccw = !!ccw;
446
+ var dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x2 + dx, y0 = y2 + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
447
+ if (r < 0) throw new Error("negative radius: " + r);
448
+ if (this._x1 === null) {
449
+ this._ += "M" + x0 + "," + y0;
450
+ } else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
451
+ this._ += "L" + x0 + "," + y0;
452
+ }
453
+ if (!r) return;
454
+ if (da < 0) da = da % tau + tau;
455
+ if (da > tauEpsilon) {
456
+ this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x2 - dx) + "," + (y2 - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
457
+ } else if (da > epsilon) {
458
+ this._ += "A" + r + "," + r + ",0," + +(da >= pi) + "," + cw + "," + (this._x1 = x2 + r * Math.cos(a1)) + "," + (this._y1 = y2 + r * Math.sin(a1));
459
+ }
460
+ },
461
+ rect: function(x2, y2, w, h) {
462
+ this._ += "M" + (this._x0 = this._x1 = +x2) + "," + (this._y0 = this._y1 = +y2) + "h" + +w + "v" + +h + "h" + -w + "Z";
463
+ },
464
+ toString: function() {
465
+ return this._;
466
+ }
467
+ };
468
+ function constant(x2) {
469
+ return function constant2() {
470
+ return x2;
471
+ };
472
+ }
473
+ function x(p) {
474
+ return p[0];
475
+ }
476
+ function y(p) {
477
+ return p[1];
478
+ }
479
+ var slice = Array.prototype.slice;
480
+ function linkSource(d) {
481
+ return d.source;
482
+ }
483
+ function linkTarget(d) {
484
+ return d.target;
485
+ }
486
+ function link(curve) {
487
+ var source = linkSource, target = linkTarget, x$1 = x, y$1 = y, context = null;
488
+ function link2() {
489
+ var buffer, argv = slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);
490
+ if (!context) context = buffer = path();
491
+ curve(context, +x$1.apply(this, (argv[0] = s, argv)), +y$1.apply(this, argv), +x$1.apply(this, (argv[0] = t, argv)), +y$1.apply(this, argv));
492
+ if (buffer) return context = null, buffer + "" || null;
493
+ }
494
+ link2.source = function(_) {
495
+ return arguments.length ? (source = _, link2) : source;
496
+ };
497
+ link2.target = function(_) {
498
+ return arguments.length ? (target = _, link2) : target;
499
+ };
500
+ link2.x = function(_) {
501
+ return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant(+_), link2) : x$1;
502
+ };
503
+ link2.y = function(_) {
504
+ return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), link2) : y$1;
505
+ };
506
+ link2.context = function(_) {
507
+ return arguments.length ? (context = _ == null ? null : _, link2) : context;
508
+ };
509
+ return link2;
510
+ }
511
+ function curveHorizontal(context, x0, y0, x1, y1) {
512
+ context.moveTo(x0, y0);
513
+ context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
514
+ }
515
+ function linkHorizontal() {
516
+ return link(curveHorizontal);
517
+ }
518
+ function horizontalSource(d) {
519
+ return [d.source.x1, d.y0];
520
+ }
521
+ function horizontalTarget(d) {
522
+ return [d.target.x0, d.y1];
523
+ }
524
+ function sankeyLinkHorizontal() {
525
+ return linkHorizontal().source(horizontalSource).target(horizontalTarget);
526
+ }
527
+ var parser = function() {
528
+ var o = function(k, v, o2, l) {
529
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
530
+ ;
531
+ return o2;
532
+ }, $V0 = [1, 9], $V1 = [1, 10], $V2 = [1, 5, 10, 12];
533
+ var parser2 = {
534
+ trace: function trace() {
535
+ },
536
+ yy: {},
537
+ symbols_: { "error": 2, "start": 3, "SANKEY": 4, "NEWLINE": 5, "csv": 6, "opt_eof": 7, "record": 8, "csv_tail": 9, "EOF": 10, "field[source]": 11, "COMMA": 12, "field[target]": 13, "field[value]": 14, "field": 15, "escaped": 16, "non_escaped": 17, "DQUOTE": 18, "ESCAPED_TEXT": 19, "NON_ESCAPED_TEXT": 20, "$accept": 0, "$end": 1 },
538
+ terminals_: { 2: "error", 4: "SANKEY", 5: "NEWLINE", 10: "EOF", 11: "field[source]", 12: "COMMA", 13: "field[target]", 14: "field[value]", 18: "DQUOTE", 19: "ESCAPED_TEXT", 20: "NON_ESCAPED_TEXT" },
539
+ productions_: [0, [3, 4], [6, 2], [9, 2], [9, 0], [7, 1], [7, 0], [8, 5], [15, 1], [15, 1], [16, 3], [17, 1]],
540
+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
541
+ var $0 = $$.length - 1;
542
+ switch (yystate) {
543
+ case 7:
544
+ const source = yy.findOrCreateNode($$[$0 - 4].trim().replaceAll('""', '"'));
545
+ const target = yy.findOrCreateNode($$[$0 - 2].trim().replaceAll('""', '"'));
546
+ const value2 = parseFloat($$[$0].trim());
547
+ yy.addLink(source, target, value2);
548
+ break;
549
+ case 8:
550
+ case 9:
551
+ case 11:
552
+ this.$ = $$[$0];
553
+ break;
554
+ case 10:
555
+ this.$ = $$[$0 - 1];
556
+ break;
557
+ }
558
+ },
559
+ table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, { 5: [1, 3] }, { 6: 4, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 1: [2, 6], 7: 11, 10: [1, 12] }, o($V1, [2, 4], { 9: 13, 5: [1, 14] }), { 12: [1, 15] }, o($V2, [2, 8]), o($V2, [2, 9]), { 19: [1, 16] }, o($V2, [2, 11]), { 1: [2, 1] }, { 1: [2, 5] }, o($V1, [2, 2]), { 6: 17, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 15: 18, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 18: [1, 19] }, o($V1, [2, 3]), { 12: [1, 20] }, o($V2, [2, 10]), { 15: 21, 16: 7, 17: 8, 18: $V0, 20: $V1 }, o([1, 5, 10], [2, 7])],
560
+ defaultActions: { 11: [2, 1], 12: [2, 5] },
561
+ parseError: function parseError(str, hash) {
562
+ if (hash.recoverable) {
563
+ this.trace(str);
564
+ } else {
565
+ var error = new Error(str);
566
+ error.hash = hash;
567
+ throw error;
568
+ }
569
+ },
570
+ parse: function parse(input) {
571
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
572
+ var args = lstack.slice.call(arguments, 1);
573
+ var lexer2 = Object.create(this.lexer);
574
+ var sharedState = { yy: {} };
575
+ for (var k in this.yy) {
576
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
577
+ sharedState.yy[k] = this.yy[k];
578
+ }
579
+ }
580
+ lexer2.setInput(input, sharedState.yy);
581
+ sharedState.yy.lexer = lexer2;
582
+ sharedState.yy.parser = this;
583
+ if (typeof lexer2.yylloc == "undefined") {
584
+ lexer2.yylloc = {};
585
+ }
586
+ var yyloc = lexer2.yylloc;
587
+ lstack.push(yyloc);
588
+ var ranges = lexer2.options && lexer2.options.ranges;
589
+ if (typeof sharedState.yy.parseError === "function") {
590
+ this.parseError = sharedState.yy.parseError;
591
+ } else {
592
+ this.parseError = Object.getPrototypeOf(this).parseError;
593
+ }
594
+ function lex() {
595
+ var token;
596
+ token = tstack.pop() || lexer2.lex() || EOF;
597
+ if (typeof token !== "number") {
598
+ if (token instanceof Array) {
599
+ tstack = token;
600
+ token = tstack.pop();
601
+ }
602
+ token = self.symbols_[token] || token;
603
+ }
604
+ return token;
605
+ }
606
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
607
+ while (true) {
608
+ state = stack[stack.length - 1];
609
+ if (this.defaultActions[state]) {
610
+ action = this.defaultActions[state];
611
+ } else {
612
+ if (symbol === null || typeof symbol == "undefined") {
613
+ symbol = lex();
614
+ }
615
+ action = table[state] && table[state][symbol];
616
+ }
617
+ if (typeof action === "undefined" || !action.length || !action[0]) {
618
+ var errStr = "";
619
+ expected = [];
620
+ for (p in table[state]) {
621
+ if (this.terminals_[p] && p > TERROR) {
622
+ expected.push("'" + this.terminals_[p] + "'");
623
+ }
624
+ }
625
+ if (lexer2.showPosition) {
626
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
627
+ } else {
628
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
629
+ }
630
+ this.parseError(errStr, {
631
+ text: lexer2.match,
632
+ token: this.terminals_[symbol] || symbol,
633
+ line: lexer2.yylineno,
634
+ loc: yyloc,
635
+ expected
636
+ });
637
+ }
638
+ if (action[0] instanceof Array && action.length > 1) {
639
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
640
+ }
641
+ switch (action[0]) {
642
+ case 1:
643
+ stack.push(symbol);
644
+ vstack.push(lexer2.yytext);
645
+ lstack.push(lexer2.yylloc);
646
+ stack.push(action[1]);
647
+ symbol = null;
648
+ {
649
+ yyleng = lexer2.yyleng;
650
+ yytext = lexer2.yytext;
651
+ yylineno = lexer2.yylineno;
652
+ yyloc = lexer2.yylloc;
653
+ }
654
+ break;
655
+ case 2:
656
+ len = this.productions_[action[1]][1];
657
+ yyval.$ = vstack[vstack.length - len];
658
+ yyval._$ = {
659
+ first_line: lstack[lstack.length - (len || 1)].first_line,
660
+ last_line: lstack[lstack.length - 1].last_line,
661
+ first_column: lstack[lstack.length - (len || 1)].first_column,
662
+ last_column: lstack[lstack.length - 1].last_column
663
+ };
664
+ if (ranges) {
665
+ yyval._$.range = [
666
+ lstack[lstack.length - (len || 1)].range[0],
667
+ lstack[lstack.length - 1].range[1]
668
+ ];
669
+ }
670
+ r = this.performAction.apply(yyval, [
671
+ yytext,
672
+ yyleng,
673
+ yylineno,
674
+ sharedState.yy,
675
+ action[1],
676
+ vstack,
677
+ lstack
678
+ ].concat(args));
679
+ if (typeof r !== "undefined") {
680
+ return r;
681
+ }
682
+ if (len) {
683
+ stack = stack.slice(0, -1 * len * 2);
684
+ vstack = vstack.slice(0, -1 * len);
685
+ lstack = lstack.slice(0, -1 * len);
686
+ }
687
+ stack.push(this.productions_[action[1]][0]);
688
+ vstack.push(yyval.$);
689
+ lstack.push(yyval._$);
690
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
691
+ stack.push(newState);
692
+ break;
693
+ case 3:
694
+ return true;
695
+ }
696
+ }
697
+ return true;
698
+ }
699
+ };
700
+ var lexer = /* @__PURE__ */ function() {
701
+ var lexer2 = {
702
+ EOF: 1,
703
+ parseError: function parseError(str, hash) {
704
+ if (this.yy.parser) {
705
+ this.yy.parser.parseError(str, hash);
706
+ } else {
707
+ throw new Error(str);
708
+ }
709
+ },
710
+ // resets the lexer, sets new input
711
+ setInput: function(input, yy) {
712
+ this.yy = yy || this.yy || {};
713
+ this._input = input;
714
+ this._more = this._backtrack = this.done = false;
715
+ this.yylineno = this.yyleng = 0;
716
+ this.yytext = this.matched = this.match = "";
717
+ this.conditionStack = ["INITIAL"];
718
+ this.yylloc = {
719
+ first_line: 1,
720
+ first_column: 0,
721
+ last_line: 1,
722
+ last_column: 0
723
+ };
724
+ if (this.options.ranges) {
725
+ this.yylloc.range = [0, 0];
726
+ }
727
+ this.offset = 0;
728
+ return this;
729
+ },
730
+ // consumes and returns one char from the input
731
+ input: function() {
732
+ var ch = this._input[0];
733
+ this.yytext += ch;
734
+ this.yyleng++;
735
+ this.offset++;
736
+ this.match += ch;
737
+ this.matched += ch;
738
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
739
+ if (lines) {
740
+ this.yylineno++;
741
+ this.yylloc.last_line++;
742
+ } else {
743
+ this.yylloc.last_column++;
744
+ }
745
+ if (this.options.ranges) {
746
+ this.yylloc.range[1]++;
747
+ }
748
+ this._input = this._input.slice(1);
749
+ return ch;
750
+ },
751
+ // unshifts one char (or a string) into the input
752
+ unput: function(ch) {
753
+ var len = ch.length;
754
+ var lines = ch.split(/(?:\r\n?|\n)/g);
755
+ this._input = ch + this._input;
756
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
757
+ this.offset -= len;
758
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
759
+ this.match = this.match.substr(0, this.match.length - 1);
760
+ this.matched = this.matched.substr(0, this.matched.length - 1);
761
+ if (lines.length - 1) {
762
+ this.yylineno -= lines.length - 1;
763
+ }
764
+ var r = this.yylloc.range;
765
+ this.yylloc = {
766
+ first_line: this.yylloc.first_line,
767
+ last_line: this.yylineno + 1,
768
+ first_column: this.yylloc.first_column,
769
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
770
+ };
771
+ if (this.options.ranges) {
772
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
773
+ }
774
+ this.yyleng = this.yytext.length;
775
+ return this;
776
+ },
777
+ // When called from action, caches matched text and appends it on next action
778
+ more: function() {
779
+ this._more = true;
780
+ return this;
781
+ },
782
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
783
+ reject: function() {
784
+ if (this.options.backtrack_lexer) {
785
+ this._backtrack = true;
786
+ } else {
787
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
788
+ text: "",
789
+ token: null,
790
+ line: this.yylineno
791
+ });
792
+ }
793
+ return this;
794
+ },
795
+ // retain first n characters of the match
796
+ less: function(n) {
797
+ this.unput(this.match.slice(n));
798
+ },
799
+ // displays already matched input, i.e. for error messages
800
+ pastInput: function() {
801
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
802
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
803
+ },
804
+ // displays upcoming input, i.e. for error messages
805
+ upcomingInput: function() {
806
+ var next = this.match;
807
+ if (next.length < 20) {
808
+ next += this._input.substr(0, 20 - next.length);
809
+ }
810
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
811
+ },
812
+ // displays the character position where the lexing error occurred, i.e. for error messages
813
+ showPosition: function() {
814
+ var pre = this.pastInput();
815
+ var c = new Array(pre.length + 1).join("-");
816
+ return pre + this.upcomingInput() + "\n" + c + "^";
817
+ },
818
+ // test the lexed token: return FALSE when not a match, otherwise return token
819
+ test_match: function(match, indexed_rule) {
820
+ var token, lines, backup;
821
+ if (this.options.backtrack_lexer) {
822
+ backup = {
823
+ yylineno: this.yylineno,
824
+ yylloc: {
825
+ first_line: this.yylloc.first_line,
826
+ last_line: this.last_line,
827
+ first_column: this.yylloc.first_column,
828
+ last_column: this.yylloc.last_column
829
+ },
830
+ yytext: this.yytext,
831
+ match: this.match,
832
+ matches: this.matches,
833
+ matched: this.matched,
834
+ yyleng: this.yyleng,
835
+ offset: this.offset,
836
+ _more: this._more,
837
+ _input: this._input,
838
+ yy: this.yy,
839
+ conditionStack: this.conditionStack.slice(0),
840
+ done: this.done
841
+ };
842
+ if (this.options.ranges) {
843
+ backup.yylloc.range = this.yylloc.range.slice(0);
844
+ }
845
+ }
846
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
847
+ if (lines) {
848
+ this.yylineno += lines.length;
849
+ }
850
+ this.yylloc = {
851
+ first_line: this.yylloc.last_line,
852
+ last_line: this.yylineno + 1,
853
+ first_column: this.yylloc.last_column,
854
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
855
+ };
856
+ this.yytext += match[0];
857
+ this.match += match[0];
858
+ this.matches = match;
859
+ this.yyleng = this.yytext.length;
860
+ if (this.options.ranges) {
861
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
862
+ }
863
+ this._more = false;
864
+ this._backtrack = false;
865
+ this._input = this._input.slice(match[0].length);
866
+ this.matched += match[0];
867
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
868
+ if (this.done && this._input) {
869
+ this.done = false;
870
+ }
871
+ if (token) {
872
+ return token;
873
+ } else if (this._backtrack) {
874
+ for (var k in backup) {
875
+ this[k] = backup[k];
876
+ }
877
+ return false;
878
+ }
879
+ return false;
880
+ },
881
+ // return next match in input
882
+ next: function() {
883
+ if (this.done) {
884
+ return this.EOF;
885
+ }
886
+ if (!this._input) {
887
+ this.done = true;
888
+ }
889
+ var token, match, tempMatch, index;
890
+ if (!this._more) {
891
+ this.yytext = "";
892
+ this.match = "";
893
+ }
894
+ var rules = this._currentRules();
895
+ for (var i = 0; i < rules.length; i++) {
896
+ tempMatch = this._input.match(this.rules[rules[i]]);
897
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
898
+ match = tempMatch;
899
+ index = i;
900
+ if (this.options.backtrack_lexer) {
901
+ token = this.test_match(tempMatch, rules[i]);
902
+ if (token !== false) {
903
+ return token;
904
+ } else if (this._backtrack) {
905
+ match = false;
906
+ continue;
907
+ } else {
908
+ return false;
909
+ }
910
+ } else if (!this.options.flex) {
911
+ break;
912
+ }
913
+ }
914
+ }
915
+ if (match) {
916
+ token = this.test_match(match, rules[index]);
917
+ if (token !== false) {
918
+ return token;
919
+ }
920
+ return false;
921
+ }
922
+ if (this._input === "") {
923
+ return this.EOF;
924
+ } else {
925
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
926
+ text: "",
927
+ token: null,
928
+ line: this.yylineno
929
+ });
930
+ }
931
+ },
932
+ // return next match that has a token
933
+ lex: function lex() {
934
+ var r = this.next();
935
+ if (r) {
936
+ return r;
937
+ } else {
938
+ return this.lex();
939
+ }
940
+ },
941
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
942
+ begin: function begin(condition) {
943
+ this.conditionStack.push(condition);
944
+ },
945
+ // pop the previously active lexer condition state off the condition stack
946
+ popState: function popState() {
947
+ var n = this.conditionStack.length - 1;
948
+ if (n > 0) {
949
+ return this.conditionStack.pop();
950
+ } else {
951
+ return this.conditionStack[0];
952
+ }
953
+ },
954
+ // produce the lexer rule set which is active for the currently active lexer condition state
955
+ _currentRules: function _currentRules() {
956
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
957
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
958
+ } else {
959
+ return this.conditions["INITIAL"].rules;
960
+ }
961
+ },
962
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
963
+ topState: function topState(n) {
964
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
965
+ if (n >= 0) {
966
+ return this.conditionStack[n];
967
+ } else {
968
+ return "INITIAL";
969
+ }
970
+ },
971
+ // alias for begin(condition)
972
+ pushState: function pushState(condition) {
973
+ this.begin(condition);
974
+ },
975
+ // return the number of states currently on the stack
976
+ stateStackSize: function stateStackSize() {
977
+ return this.conditionStack.length;
978
+ },
979
+ options: { "case-insensitive": true },
980
+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
981
+ switch ($avoiding_name_collisions) {
982
+ case 0:
983
+ this.pushState("csv");
984
+ return 4;
985
+ case 1:
986
+ return 10;
987
+ case 2:
988
+ return 5;
989
+ case 3:
990
+ return 12;
991
+ case 4:
992
+ this.pushState("escaped_text");
993
+ return 18;
994
+ case 5:
995
+ return 20;
996
+ case 6:
997
+ this.popState("escaped_text");
998
+ return 18;
999
+ case 7:
1000
+ return 19;
1001
+ }
1002
+ },
1003
+ rules: [/^(?:sankey-beta\b)/i, /^(?:$)/i, /^(?:((\u000D\u000A)|(\u000A)))/i, /^(?:(\u002C))/i, /^(?:(\u0022))/i, /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i, /^(?:(\u0022)(?!(\u0022)))/i, /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],
1004
+ conditions: { "csv": { "rules": [1, 2, 3, 4, 5, 6, 7], "inclusive": false }, "escaped_text": { "rules": [6, 7], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7], "inclusive": true } }
1005
+ };
1006
+ return lexer2;
1007
+ }();
1008
+ parser2.lexer = lexer;
1009
+ function Parser() {
1010
+ this.yy = {};
1011
+ }
1012
+ Parser.prototype = parser2;
1013
+ parser2.Parser = Parser;
1014
+ return new Parser();
1015
+ }();
1016
+ parser.parser = parser;
1017
+ const parser$1 = parser;
1018
+ let links = [];
1019
+ let nodes = [];
1020
+ let nodesMap = {};
1021
+ const clear = () => {
1022
+ links = [];
1023
+ nodes = [];
1024
+ nodesMap = {};
1025
+ clear$1();
1026
+ };
1027
+ class SankeyLink {
1028
+ constructor(source, target, value2 = 0) {
1029
+ this.source = source;
1030
+ this.target = target;
1031
+ this.value = value2;
1032
+ }
1033
+ }
1034
+ const addLink = (source, target, value2) => {
1035
+ links.push(new SankeyLink(source, target, value2));
1036
+ };
1037
+ class SankeyNode {
1038
+ constructor(ID) {
1039
+ this.ID = ID;
1040
+ }
1041
+ }
1042
+ const findOrCreateNode = (ID) => {
1043
+ ID = common$1.sanitizeText(ID, getConfig());
1044
+ if (!nodesMap[ID]) {
1045
+ nodesMap[ID] = new SankeyNode(ID);
1046
+ nodes.push(nodesMap[ID]);
1047
+ }
1048
+ return nodesMap[ID];
1049
+ };
1050
+ const getNodes = () => nodes;
1051
+ const getLinks = () => links;
1052
+ const getGraph = () => ({
1053
+ nodes: nodes.map((node) => ({ id: node.ID })),
1054
+ links: links.map((link2) => ({
1055
+ source: link2.source.ID,
1056
+ target: link2.target.ID,
1057
+ value: link2.value
1058
+ }))
1059
+ });
1060
+ const db = {
1061
+ nodesMap,
1062
+ getConfig: () => getConfig().sankey,
1063
+ getNodes,
1064
+ getLinks,
1065
+ getGraph,
1066
+ addLink,
1067
+ findOrCreateNode,
1068
+ getAccTitle,
1069
+ setAccTitle,
1070
+ getAccDescription,
1071
+ setAccDescription,
1072
+ getDiagramTitle,
1073
+ setDiagramTitle,
1074
+ clear
1075
+ };
1076
+ const _Uid = class _Uid2 {
1077
+ static next(name) {
1078
+ return new _Uid2(name + ++_Uid2.count);
1079
+ }
1080
+ constructor(id) {
1081
+ this.id = id;
1082
+ this.href = `#${id}`;
1083
+ }
1084
+ toString() {
1085
+ return "url(" + this.href + ")";
1086
+ }
1087
+ };
1088
+ _Uid.count = 0;
1089
+ let Uid = _Uid;
1090
+ const alignmentsMap = {
1091
+ left,
1092
+ right,
1093
+ center,
1094
+ justify
1095
+ };
1096
+ const draw = function(text, id, _version, diagObj) {
1097
+ const { securityLevel, sankey: conf } = getConfig();
1098
+ const defaultSankeyConfig = defaultConfig.sankey;
1099
+ let sandboxElement;
1100
+ if (securityLevel === "sandbox") {
1101
+ sandboxElement = select("#i" + id);
1102
+ }
1103
+ const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
1104
+ const svg = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`);
1105
+ const width = (conf == null ? void 0 : conf.width) ?? defaultSankeyConfig.width;
1106
+ const height = (conf == null ? void 0 : conf.height) ?? defaultSankeyConfig.width;
1107
+ const useMaxWidth = (conf == null ? void 0 : conf.useMaxWidth) ?? defaultSankeyConfig.useMaxWidth;
1108
+ const nodeAlignment = (conf == null ? void 0 : conf.nodeAlignment) ?? defaultSankeyConfig.nodeAlignment;
1109
+ const prefix = (conf == null ? void 0 : conf.prefix) ?? defaultSankeyConfig.prefix;
1110
+ const suffix = (conf == null ? void 0 : conf.suffix) ?? defaultSankeyConfig.suffix;
1111
+ const showValues = (conf == null ? void 0 : conf.showValues) ?? defaultSankeyConfig.showValues;
1112
+ const graph = diagObj.db.getGraph();
1113
+ const nodeAlign = alignmentsMap[nodeAlignment];
1114
+ const nodeWidth = 10;
1115
+ const sankey$1 = Sankey().nodeId((d) => d.id).nodeWidth(nodeWidth).nodePadding(10 + (showValues ? 15 : 0)).nodeAlign(nodeAlign).extent([
1116
+ [0, 0],
1117
+ [width, height]
1118
+ ]);
1119
+ sankey$1(graph);
1120
+ const colorScheme = ordinal(schemeTableau10);
1121
+ svg.append("g").attr("class", "nodes").selectAll(".node").data(graph.nodes).join("g").attr("class", "node").attr("id", (d) => (d.uid = Uid.next("node-")).id).attr("transform", function(d) {
1122
+ return "translate(" + d.x0 + "," + d.y0 + ")";
1123
+ }).attr("x", (d) => d.x0).attr("y", (d) => d.y0).append("rect").attr("height", (d) => {
1124
+ return d.y1 - d.y0;
1125
+ }).attr("width", (d) => d.x1 - d.x0).attr("fill", (d) => colorScheme(d.id));
1126
+ const getText = ({ id: id2, value: value2 }) => {
1127
+ if (!showValues) {
1128
+ return id2;
1129
+ }
1130
+ return `${id2}
1131
+ ${prefix}${Math.round(value2 * 100) / 100}${suffix}`;
1132
+ };
1133
+ svg.append("g").attr("class", "node-labels").attr("font-family", "sans-serif").attr("font-size", 14).selectAll("text").data(graph.nodes).join("text").attr("x", (d) => d.x0 < width / 2 ? d.x1 + 6 : d.x0 - 6).attr("y", (d) => (d.y1 + d.y0) / 2).attr("dy", `${showValues ? "0" : "0.35"}em`).attr("text-anchor", (d) => d.x0 < width / 2 ? "start" : "end").text(getText);
1134
+ const link2 = svg.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", 0.5).selectAll(".link").data(graph.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply");
1135
+ const linkColor = (conf == null ? void 0 : conf.linkColor) || "gradient";
1136
+ if (linkColor === "gradient") {
1137
+ const gradient = link2.append("linearGradient").attr("id", (d) => (d.uid = Uid.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (d) => d.source.x1).attr("x2", (d) => d.target.x0);
1138
+ gradient.append("stop").attr("offset", "0%").attr("stop-color", (d) => colorScheme(d.source.id));
1139
+ gradient.append("stop").attr("offset", "100%").attr("stop-color", (d) => colorScheme(d.target.id));
1140
+ }
1141
+ let coloring;
1142
+ switch (linkColor) {
1143
+ case "gradient":
1144
+ coloring = (d) => d.uid;
1145
+ break;
1146
+ case "source":
1147
+ coloring = (d) => colorScheme(d.source.id);
1148
+ break;
1149
+ case "target":
1150
+ coloring = (d) => colorScheme(d.target.id);
1151
+ break;
1152
+ default:
1153
+ coloring = linkColor;
1154
+ }
1155
+ link2.append("path").attr("d", sankeyLinkHorizontal()).attr("stroke", coloring).attr("stroke-width", (d) => Math.max(1, d.width));
1156
+ setupGraphViewbox$1(void 0, svg, 0, useMaxWidth);
1157
+ };
1158
+ const renderer = {
1159
+ draw
1160
+ };
1161
+ const prepareTextForParsing = (text) => {
1162
+ const textToParse = text.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, "\n").trim();
1163
+ return textToParse;
1164
+ };
1165
+ const originalParse = parser$1.parse.bind(parser$1);
1166
+ parser$1.parse = (text) => originalParse(prepareTextForParsing(text));
1167
+ const diagram = {
1168
+ parser: parser$1,
1169
+ db,
1170
+ renderer
1171
+ };
1172
+ export {
1173
+ diagram
1174
+ };