@sjcrh/proteinpaint-client 2.74.2 → 2.76.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 (307) hide show
  1. package/dist/{2dmaf-b2d78c57.js → 2dmaf-74b99126.js} +1 -1
  2. package/dist/AppHeader-cecb39c2.js +1 -0
  3. package/dist/{ColorScale-9c76aef3.js → ColorScale-21cab8d2.js} +1 -1
  4. package/dist/DEanalysis-95bad59a.js +1 -0
  5. package/dist/Disco-a6e921a0.js +1 -0
  6. package/dist/Disco.UI-9ad999ed.js +1 -0
  7. package/dist/{DragControls-586f72db.js → DragControls-e3b6a937.js} +1 -1
  8. package/dist/{DziViewer-6311327c.js → DziViewer-354a790d.js} +1 -1
  9. package/dist/FilterRxComp-701a1480.js +1 -0
  10. package/dist/{FilterStateless-046081c2.js → FilterStateless-54c0b763.js} +1 -1
  11. package/dist/{HicApp-40e44cba.js → HicApp-d5a946bf.js} +1 -1
  12. package/dist/{OrbitControls-0cda1772.js → OrbitControls-694652cd.js} +1 -1
  13. package/dist/WSIViewer-dc7f8eb0.js +1 -0
  14. package/dist/adSandbox-f438e388.js +1 -0
  15. package/dist/app-3320ab6f.js +1 -0
  16. package/dist/app-649f8357.js +1 -0
  17. package/dist/app-b369b169.js +1 -0
  18. package/dist/app.js +1 -1
  19. package/dist/bam-431875ef.js +1 -0
  20. package/dist/barchart-8277ed43.js +1 -0
  21. package/dist/barchart.events-da29c90d.js +1 -0
  22. package/dist/{bars.renderer-5f7a4174.js → bars.renderer-dcfdd59b.js} +1 -1
  23. package/dist/block-6aedd569.js +1 -0
  24. package/dist/block.lazyload-87b12654.js +1 -0
  25. package/dist/block.legend-d3f61ef7.js +1 -0
  26. package/dist/{block.mds-effc078d.js → block.mds-3ad17dfa.js} +1 -1
  27. package/dist/{block.mds.cnv-ec861a26.js → block.mds.cnv-857ba868.js} +1 -1
  28. package/dist/{block.mds.expressionrank-a2ad7c80.js → block.mds.expressionrank-7e3b208c.js} +1 -1
  29. package/dist/{block.mds.expressionstat-31dc5595.js → block.mds.expressionstat-f2d31c86.js} +1 -1
  30. package/dist/{block.mds.geneboxplot-3ca857ce.js → block.mds.geneboxplot-f0fbaf12.js} +1 -1
  31. package/dist/{block.mds.junction-debba938.js → block.mds.junction-7f87f48f.js} +1 -1
  32. package/dist/{block.mds.svcnv-8dc5abdf.js → block.mds.svcnv-ac035c12.js} +1 -1
  33. package/dist/{block.mds.svcnv.share-81e62600.js → block.mds.svcnv.share-886d9479.js} +1 -1
  34. package/dist/block.mds2-7852c1ee.js +1 -0
  35. package/dist/{block.svg-9121e8e7.js → block.svg-9b916fa6.js} +1 -1
  36. package/dist/{block.tk.aicheck-c1b478e9.js → block.tk.aicheck-6770e333.js} +1 -1
  37. package/dist/{block.tk.ase-0f6ded48.js → block.tk.ase-ee807e59.js} +1 -1
  38. package/dist/{block.tk.bam-7cd06aee.js → block.tk.bam-00fba6e8.js} +1 -1
  39. package/dist/{block.tk.bedgraphdot-3ef8b94e.js → block.tk.bedgraphdot-7fda78e9.js} +1 -1
  40. package/dist/{block.tk.bigwig.ui-d1248810.js → block.tk.bigwig.ui-cc1a42f3.js} +1 -1
  41. package/dist/{block.tk.hicstraw-ee731e55.js → block.tk.hicstraw-526470e3.js} +1 -1
  42. package/dist/{block.tk.junction-4d8cab4d.js → block.tk.junction-b43a4cda.js} +1 -1
  43. package/dist/{block.tk.junction.textmatrixui-a6430b27.js → block.tk.junction.textmatrixui-a60ed78a.js} +1 -1
  44. package/dist/{block.tk.ld-8429a18b.js → block.tk.ld-d15bde41.js} +1 -1
  45. package/dist/{block.tk.menu-3f31f958.js → block.tk.menu-3aeb93c6.js} +1 -1
  46. package/dist/{block.tk.pgv-07e46705.js → block.tk.pgv-9af2bd64.js} +1 -1
  47. package/dist/boxplot-e17a17b7.js +1 -0
  48. package/dist/brainImaging-bf2ceee9.js +1 -0
  49. package/dist/{brush-c386fe3d.js → brush-aa175142.js} +1 -1
  50. package/dist/categorical-a52014a1.js +1 -0
  51. package/dist/condition-c646e357.js +1 -0
  52. package/dist/controls-287e6efa.js +1 -0
  53. package/dist/{controls.btns-1cb2bfab.js → controls.btns-79b805dd.js} +1 -1
  54. package/dist/controls.config-28d6d6a8.js +1 -0
  55. package/dist/cuminc-9e275854.js +1 -0
  56. package/dist/{customdata.inputui-cbd712ea.js → customdata.inputui-dc49d94b.js} +1 -1
  57. package/dist/dataDownload-3a3d4f33.js +1 -0
  58. package/dist/databrowser.ui-d8d3f8fd.js +1 -0
  59. package/dist/{density-19266ebf.js → density-a82a8b1c.js} +1 -1
  60. package/dist/dictionary-c5a19d90.js +1 -0
  61. package/dist/{drag-0b968811.js → drag-7b30ba17.js} +1 -1
  62. package/dist/{e2pca-b8752945.js → e2pca-82765817.js} +1 -1
  63. package/dist/{ep-a86b185a.js → ep-d017ec2f.js} +1 -1
  64. package/dist/facet-a9b44ef3.js +1 -0
  65. package/dist/{fusion.parse-244b2b97.js → fusion.parse-d40d0b9d.js} +1 -1
  66. package/dist/geneExpClustering-34c3f518.js +1 -0
  67. package/dist/geneExpression-0d1b7244.js +1 -0
  68. package/dist/{geneExpression-e0430f2e.js → geneExpression-589f485b.js} +1 -1
  69. package/dist/{geneExpression-387205bf.js → geneExpression-7d14983f.js} +1 -1
  70. package/dist/geneORA-903a780f.js +1 -0
  71. package/dist/{geneVariant-7de021b6.js → geneVariant-89601b34.js} +1 -1
  72. package/dist/geneVariant-92c4e870.js +1 -0
  73. package/dist/{genefusion.ui-a331de19.js → genefusion.ui-7e22e811.js} +1 -1
  74. package/dist/{genesearch-ea59f5d4.js → genesearch-a4e19f0d.js} +1 -1
  75. package/dist/geneset-108a39d2.js +1 -0
  76. package/dist/genomeBrowser-12f86a36.js +1 -0
  77. package/dist/genomeBrowser.controls-d5067811.js +1 -0
  78. package/dist/{groupsetting-20ffef77.js → groupsetting-b4416a96.js} +1 -1
  79. package/dist/gsea-543dab25.js +1 -0
  80. package/dist/hierCluster-26e14090.js +1 -0
  81. package/dist/hierCluster.config-98e82dff.js +1 -0
  82. package/dist/{hierCluster.interactivity-9b433033.js → hierCluster.interactivity-e56f6542.js} +1 -1
  83. package/dist/hierCluster.renderers-74a64cf5.js +1 -0
  84. package/dist/{html.legend-abb5452e.js → html.legend-a3f4ebfe.js} +1 -1
  85. package/dist/imagePlot-b9eae4ae.js +1 -0
  86. package/dist/{lasso-55cf4057.js → lasso-f767f634.js} +1 -1
  87. package/dist/launch.adhoc-abca6af3.js +1 -0
  88. package/dist/leftlabel.sample-24c2388d.js +1 -0
  89. package/dist/legacyDataset-e0e201ab.js +1 -0
  90. package/dist/{log-cf45fcf2.js → log-99af3443.js} +1 -1
  91. package/dist/{lollipop-c5b6e615.js → lollipop-806f8fa4.js} +1 -1
  92. package/dist/{maf-7535f1f9.js → maf-b06579e4.js} +1 -1
  93. package/dist/{maftimeline-1292ab62.js → maftimeline-4840a380.js} +1 -1
  94. package/dist/matrix-00bb50ff.js +1 -0
  95. package/dist/matrix.cells-914dd0c6.js +1 -0
  96. package/dist/{matrix.cluster-168bc96b.js → matrix.cluster-783ceab0.js} +1 -1
  97. package/dist/matrix.config-6ce74dfe.js +1 -0
  98. package/dist/matrix.controls-7b2a6f95.js +1 -0
  99. package/dist/{matrix.data-b1d0febe.js → matrix.data-dac4f1b7.js} +1 -1
  100. package/dist/{matrix.dom-00defa30.js → matrix.dom-4e10bbe9.js} +1 -1
  101. package/dist/matrix.groups-b9fca14a.js +1 -0
  102. package/dist/matrix.interactivity-84169b43.js +1 -0
  103. package/dist/{matrix.layout-c2345231.js → matrix.layout-dd5a44fd.js} +1 -1
  104. package/dist/matrix.legend-ac6d45e6.js +1 -0
  105. package/dist/matrix.renderers-78010275.js +1 -0
  106. package/dist/matrix.serieses-9b4fd744.js +1 -0
  107. package/dist/matrix.sort-014d798d.js +1 -0
  108. package/dist/{matrix.sorterUi-a741ba2e.js → matrix.sorterUi-9bf7e6f9.js} +1 -1
  109. package/dist/{mavb-92136d17.js → mavb-c6be46fc.js} +1 -1
  110. package/dist/{mds.fimo-c03115b4.js → mds.fimo-bff6a1ed.js} +1 -1
  111. package/dist/mds.samplescatterplot-9a02b9fb.js +1 -0
  112. package/dist/{mds.survivalplot-366db380.js → mds.survivalplot-055549f4.js} +1 -1
  113. package/dist/{metaboliteIntensity-ddb6e480.js → metaboliteIntensity-fac92f8b.js} +1 -1
  114. package/dist/niceNumLabels-238aabce.js +1 -0
  115. package/dist/{nodrag-2c046d31.js → nodrag-16ad4b03.js} +1 -1
  116. package/dist/{notify-44ebc0df.js → notify-224cccbd.js} +1 -1
  117. package/dist/{numeric-918d4686.js → numeric-b0b17185.js} +1 -1
  118. package/dist/numeric.binary-1f9e93f2.js +1 -0
  119. package/dist/numeric.continuous-ebcd0567.js +1 -0
  120. package/dist/numeric.discrete-7b97044a.js +1 -0
  121. package/dist/numeric.spline-1be88f3d.js +1 -0
  122. package/dist/numeric.toggle-7fa2a770.js +1 -0
  123. package/dist/oncomatrix-351af2a0.js +1 -0
  124. package/dist/{parseData-e66308cd.js → parseData-21fe9822.js} +1 -1
  125. package/dist/partjson.esm-b3f1fc21.js +1 -0
  126. package/dist/{plot.2dvaf-73dbfbd1.js → plot.2dvaf-18a35e4b.js} +1 -1
  127. package/dist/plot.app-30c4b8e5.js +1 -0
  128. package/dist/plot.barplot-7c4865a2.js +1 -0
  129. package/dist/{plot.boxplot-641da058.js → plot.boxplot-fe3046c6.js} +1 -1
  130. package/dist/plot.brainImaging-2ceb6023.js +1 -0
  131. package/dist/plot.disco-6011f87f.js +1 -0
  132. package/dist/{plot.dzi-41ea26e5.js → plot.dzi-6728a7c8.js} +1 -1
  133. package/dist/plot.ssgq-5581dc56.js +1 -0
  134. package/dist/{plot.vaf2cov-80e58833.js → plot.vaf2cov-b2284c64.js} +1 -1
  135. package/dist/{plot.wsi-51cc48ef.js → plot.wsi-9a9d4034.js} +1 -1
  136. package/dist/profileBarchart-0476f1f8.js +1 -0
  137. package/dist/profileHome-32eb9b50.js +1 -0
  138. package/dist/profilePlot-c7e099e8.js +1 -0
  139. package/dist/profilePolar-6b981e63.js +1 -0
  140. package/dist/profileRadar-bca1cc03.js +1 -0
  141. package/dist/profileRadarFacility-bbb1ecd8.js +1 -0
  142. package/dist/profileSummary-b114204f.js +1 -0
  143. package/dist/recover-49e09de0.js +1 -0
  144. package/dist/regression.inputs-a761f40d.js +1 -0
  145. package/dist/regression.inputs.values.table-5929d25a.js +1 -0
  146. package/dist/regression.results-69bc42d0.js +1 -0
  147. package/dist/{renderPvalueTable-895a72c2.js → renderPvalueTable-dc5d15f2.js} +1 -1
  148. package/dist/sampleScatter-2d0ed680.js +1 -0
  149. package/dist/{sampleScatter.rendererThree-5e686004.js → sampleScatter.rendererThree-0b12ac61.js} +2 -2
  150. package/dist/sampleView-484ab133.js +1 -0
  151. package/dist/samplelst-689796e6.js +1 -0
  152. package/dist/{samplematrix-2a1d7d82.js → samplematrix-2b137a05.js} +1 -1
  153. package/dist/scatter-205e013f.js +1 -0
  154. package/dist/{select2Terms-b4fffc50.js → select2Terms-b21e184a.js} +1 -1
  155. package/dist/{selectGenomeWithTklst-acf7e568.js → selectGenomeWithTklst-466995b4.js} +1 -1
  156. package/dist/singleCellCellType-5db730bb.js +1 -0
  157. package/dist/{singleCellGeneExpression-6de17162.js → singleCellGeneExpression-7147a2d0.js} +1 -1
  158. package/dist/singleCellPlot-73b2738f.js +1 -0
  159. package/dist/{singlecell-f76c856a.js → singlecell-24409b72.js} +1 -1
  160. package/dist/singlecell-bca774ed.js +1 -0
  161. package/dist/{snp-9590a1b4.js → snp-37d06246.js} +1 -1
  162. package/dist/snp-a8388ce4.js +1 -0
  163. package/dist/snplocus-7a1ea8c9.js +1 -0
  164. package/dist/{snplst-007a1926.js → snplst-6865d7c7.js} +1 -1
  165. package/dist/{spliceevent.a53ss.diagram-63dfef69.js → spliceevent.a53ss.diagram-e2eab72b.js} +1 -1
  166. package/dist/{spliceevent.exonskip.diagram-76fa9af8.js → spliceevent.exonskip.diagram-4d5df3a1.js} +1 -1
  167. package/dist/spliceevent.exonskip.getdefault-a94aad6e.js +1 -0
  168. package/dist/{spliceevent.noeventdiagram-64a099e0.js → spliceevent.noeventdiagram-ea97b0fb.js} +1 -1
  169. package/dist/{spliceevent.phrase-770c8cac.js → spliceevent.phrase-c5832470.js} +1 -1
  170. package/dist/{stattable-f1189f0f.js → stattable-7c5ecc2f.js} +1 -1
  171. package/dist/{style.gdc-89cfdb0f.js → style.gdc-131f3c77.js} +1 -1
  172. package/dist/summary-5ec455d3.js +1 -0
  173. package/dist/{sunburst-d5379952.js → sunburst-533902a7.js} +1 -1
  174. package/dist/survival-92250664.js +1 -0
  175. package/dist/survival-e16e068f.js +1 -0
  176. package/dist/{svg.download-86850940.js → svg.download-35926549.js} +1 -1
  177. package/dist/{svg.legend-a94b0697.js → svg.legend-8d490df2.js} +1 -1
  178. package/dist/{svgraph-c57b9ae3.js → svgraph-6fac8cbc.js} +1 -1
  179. package/dist/{svmr-cf6f1b27.js → svmr-d07ff695.js} +1 -1
  180. package/dist/table-29d5a973.js +1 -0
  181. package/dist/table-ad744310.js +1 -0
  182. package/dist/termInfo-bf99a37e.js +1 -0
  183. package/dist/{termdb.bins-9faa5170.js → termdb.bins-8b656cc3.js} +1 -1
  184. package/dist/termsetting-33ea66f1.js +1 -0
  185. package/dist/tk-071a7550.js +1 -0
  186. package/dist/{toggleButtons-002aeda1.js → toggleButtons-dbdbad01.js} +1 -1
  187. package/dist/tp.ui-9c2e9fc5.js +1 -0
  188. package/dist/tslib.es6-c3c2d88f.js +1 -0
  189. package/dist/tvs.density-f6128793.js +1 -0
  190. package/dist/{tvs.geneVariant-3a65ad94.js → tvs.geneVariant-ca4bdbb1.js} +1 -1
  191. package/dist/tvs.numeric-0260a825.js +1 -0
  192. package/dist/{tvs.samplelst-1eeb586b.js → tvs.samplelst-cb71b3bf.js} +1 -1
  193. package/dist/{uiUtils-1336bad7.js → uiUtils-f1bd2bcc.js} +1 -1
  194. package/dist/{variantBrowser-f0c812c1.js → variantBrowser-7c540224.js} +1 -1
  195. package/dist/{vcf-c4a23924.js → vcf-5cc55588.js} +1 -1
  196. package/dist/violin-2ba509eb.js +1 -0
  197. package/dist/violin.interactivity-4da6d7a9.js +1 -0
  198. package/dist/{violin.renderer-dafd89fa.js → violin.renderer-ce024265.js} +1 -1
  199. package/dist/{violinRenderer-8215f40d.js → violinRenderer-f7c96a60.js} +1 -1
  200. package/dist/{viridis-ffd14c4d.js → viridis-01ab20c5.js} +1 -1
  201. package/dist/{y-dd197cc9.js → y-67939f83.js} +1 -1
  202. package/dist/{zoom-9c63e74c.js → zoom-25dce8b9.js} +1 -1
  203. package/package.json +6 -4
  204. package/dist/AppHeader-a2a7e518.js +0 -1
  205. package/dist/DEanalysis-a6b50e49.js +0 -1
  206. package/dist/Disco-1c71b7dd.js +0 -1
  207. package/dist/Disco.UI-4c16ee50.js +0 -1
  208. package/dist/FilterRxComp-242f4615.js +0 -1
  209. package/dist/WSIViewer-d90032d7.js +0 -1
  210. package/dist/adSandbox-3528c372.js +0 -1
  211. package/dist/app-07dee349.js +0 -1
  212. package/dist/app-a8c4854a.js +0 -1
  213. package/dist/app-ade9c62a.js +0 -1
  214. package/dist/bam-92483a98.js +0 -1
  215. package/dist/barchart-3e69d094.js +0 -1
  216. package/dist/barchart.events-9b11d97e.js +0 -1
  217. package/dist/block-dcb130fb.js +0 -1
  218. package/dist/block.lazyload-9f031cac.js +0 -1
  219. package/dist/block.legend-b2987cd9.js +0 -1
  220. package/dist/block.mds2-de6e0986.js +0 -1
  221. package/dist/boxplot-1178fffc.js +0 -1
  222. package/dist/brainImaging-98ed7aa2.js +0 -1
  223. package/dist/categorical-26528ce8.js +0 -1
  224. package/dist/condition-b0d74550.js +0 -1
  225. package/dist/controls-0bacec22.js +0 -1
  226. package/dist/controls.config-0ccc9d79.js +0 -1
  227. package/dist/controls.divide-a9fe9466.js +0 -1
  228. package/dist/controls.overlay-fe20d41d.js +0 -1
  229. package/dist/controls.term1-faa2efcf.js +0 -1
  230. package/dist/cuminc-7e2cac2d.js +0 -1
  231. package/dist/dataDownload-ade8d840.js +0 -1
  232. package/dist/databrowser.ui-716f0519.js +0 -1
  233. package/dist/dictionary-3f83ce63.js +0 -1
  234. package/dist/facet-6850cfed.js +0 -1
  235. package/dist/geneExpClustering-7fd3c87e.js +0 -1
  236. package/dist/geneExpression-6462537d.js +0 -1
  237. package/dist/geneORA-7eb818c4.js +0 -1
  238. package/dist/geneVariant-b58e924a.js +0 -1
  239. package/dist/geneset-9f69ad3f.js +0 -1
  240. package/dist/genomeBrowser-1b2b83f7.js +0 -1
  241. package/dist/genomeBrowser.controls-cd8ddeb1.js +0 -1
  242. package/dist/gsea-36376589.js +0 -1
  243. package/dist/hierCluster-f1e30c19.js +0 -1
  244. package/dist/hierCluster.config-da3510b1.js +0 -1
  245. package/dist/hierCluster.renderers-610d8860.js +0 -1
  246. package/dist/imagePlot-7089bdff.js +0 -1
  247. package/dist/launch.adhoc-d229fd55.js +0 -1
  248. package/dist/leftlabel.sample-a919168c.js +0 -1
  249. package/dist/legacyDataset-1cbcb67d.js +0 -1
  250. package/dist/matrix-0614794d.js +0 -1
  251. package/dist/matrix.cells-819d4991.js +0 -1
  252. package/dist/matrix.config-c54ca273.js +0 -1
  253. package/dist/matrix.controls-5eca7822.js +0 -1
  254. package/dist/matrix.groups-4660dd70.js +0 -1
  255. package/dist/matrix.interactivity-23d83183.js +0 -1
  256. package/dist/matrix.legend-2e647224.js +0 -1
  257. package/dist/matrix.renderers-43445f4f.js +0 -1
  258. package/dist/matrix.serieses-972fbe5d.js +0 -1
  259. package/dist/matrix.sort-80d9b788.js +0 -1
  260. package/dist/mds.samplescatterplot-1623e6d0.js +0 -1
  261. package/dist/niceNumLabels-6cfc1508.js +0 -1
  262. package/dist/numeric.binary-80467e8b.js +0 -1
  263. package/dist/numeric.continuous-69a62a15.js +0 -1
  264. package/dist/numeric.discrete-86181905.js +0 -1
  265. package/dist/numeric.spline-1b07fd13.js +0 -1
  266. package/dist/numeric.toggle-37c4bee8.js +0 -1
  267. package/dist/oncomatrix-475271da.js +0 -1
  268. package/dist/plot.app-aa916e0e.js +0 -1
  269. package/dist/plot.barplot-8b440a2b.js +0 -1
  270. package/dist/plot.brainImaging-2f796b0c.js +0 -1
  271. package/dist/plot.disco-43e18d2f.js +0 -1
  272. package/dist/plot.ssgq-e49cb70b.js +0 -1
  273. package/dist/profileBarchart-91463ab6.js +0 -1
  274. package/dist/profileHome-d37a6821.js +0 -1
  275. package/dist/profilePlot-9ca577cb.js +0 -1
  276. package/dist/profilePolar-19c7da5b.js +0 -1
  277. package/dist/profileRadar-8bf094e3.js +0 -1
  278. package/dist/profileRadarFacility-f9fd8971.js +0 -1
  279. package/dist/profileSummary-93999c14.js +0 -1
  280. package/dist/recover-36ada47f.js +0 -1
  281. package/dist/regression.inputs-cb57ece6.js +0 -1
  282. package/dist/regression.inputs.values.table-908bb37a.js +0 -1
  283. package/dist/regression.results-c186a8dc.js +0 -1
  284. package/dist/roundValue-b0d0517c.js +0 -1
  285. package/dist/sampleScatter-9d5b3630.js +0 -1
  286. package/dist/sampleView-2d895023.js +0 -1
  287. package/dist/samplelst-9f8343ff.js +0 -1
  288. package/dist/scatter-b4992f64.js +0 -1
  289. package/dist/singleCellCellType-84a0c2cf.js +0 -1
  290. package/dist/singleCellPlot-2f2b8619.js +0 -1
  291. package/dist/singlecell-90567dde.js +0 -1
  292. package/dist/snp-79ec95ba.js +0 -1
  293. package/dist/snplocus-cb629be1.js +0 -1
  294. package/dist/spliceevent.exonskip.getdefault-31d2950c.js +0 -1
  295. package/dist/summary-b77bef3c.js +0 -1
  296. package/dist/survival-61ab375a.js +0 -1
  297. package/dist/survival-80a0ade9.js +0 -1
  298. package/dist/table-79e3e776.js +0 -1
  299. package/dist/table-eee91e14.js +0 -1
  300. package/dist/termInfo-f851b415.js +0 -1
  301. package/dist/tk-75566002.js +0 -1
  302. package/dist/tp.ui-02911b56.js +0 -1
  303. package/dist/tslib.es6-1f85f553.js +0 -1
  304. package/dist/tvs.density-026fca97.js +0 -1
  305. package/dist/tvs.numeric-3f3d9919.js +0 -1
  306. package/dist/violin-1515c3e6.js +0 -1
  307. package/dist/violin.interactivity-8e2f480d.js +0 -1
@@ -1 +1 @@
1
- import{V as t,C as s,H as e,W as n}from"./app-a8c4854a.js";function i(t){const s=t;if(!s||typeof s!=="object")throw"bin schema must be an object";if(!("type"in s))s.type="regular-bin";if(s.type=="custom-bin"){if(!Array.isArray(s.lst))throw"binconfig.lst must be an array";if(!s.lst.length)throw"binconfig.lst must have entries";const t=s.lst[0];const n=s.lst[s.lst.length-1];for(const i of s.lst){if(!("startinclusive"in i)&&!("stopinclusive"in i)){throw"custom bin.startinclusive and/or bin.stopinclusive must be defined"}if(i==t){if("startunbounded"in i&&!i.startunbounded){throw`a custom first bin must not set bin.startunbounded to false`}i.startunbounded=true;if("start"in i){throw"a custom first bin must not set a bin.start value"}if("start_percentile"in i){throw"the first bin must not set a bin.start_percentile value"}if(!("stop"in i)){throw`a custom first bin must define a bin.stop value`}if(!e(i.stop)){throw`a custom first bin.stop value should be numeric`}}else if(i==n){if(!("start"in i)){throw`a custom last bin must define a bin.start value`}if(!e(i.start)){throw`a custom last bin.start must be numeric`}if("stopunbounded"in i&&!i.stopunbounded){throw"a custom last bin must not set bin.stopunbounded to false"}i.stopunbounded=true;if("stop"in i){throw"a custom last bin must not set a bin.stop value"}}else{if(!e(i.start))throw"bin.start must be numeric for a non-first bin";if(!e(i.stop))throw"bin.stop must be numeric for a non-last bin"}}}else if(s.type=="regular-bin"){if(!Number.isFinite(s.bin_size))throw"non-numeric bin_size";if(s.bin_size<=0)throw"bin_size must be greater than 0";if(!s.startinclusive&&!s.stopinclusive){s.startinclusive=1;s.stopinclusive=0}if(!s.first_bin)throw"first_bin{} missing";if(typeof s.first_bin!="object")throw"first_bin{} is not an object";if(!Object.keys(s.first_bin).length)throw"first_bin is an empty object";{const t=s.first_bin;t.startunbounded=true;if(t.stop_percentile){if(!Number.isInteger(t.stop_percentile))throw"first_bin.stop_percentile should be integer";if(t.stop_percentile<=0||t.stop_percentile>=100)throw"first_bin.stop_percentile out of bound (0-100)"}else if(!Number.isFinite(t.stop)){throw"first_bin.stop not a number when stop_percentile is not set"}}if(s.last_bin){const t=s.last_bin;if(t.start_percentile){if(!Number.isInteger(t.start_percentile))throw"last_bin.start_percentile should be integer";if(t.start_percentile<=0||t.start_percentile>=100)throw"last_bin.start_percentile out of bound (0-100)"}else if(!Number.isFinite(t.start)){throw"last_bin.start not a number when start_percentile is not set"}t.stopunbounded=true;if("stop"in t){throw"a regular last bin must not set a bin.stop value"}}}else{throw`invalid binconfig.type="${s.type}"`}}function o(t,n,o){const l=t;i(l);if(l.lst){const t=s(l.lst.length);for(const s of l.lst)s.color=t(s.label)}if(l.type=="custom-bin")return JSON.parse(JSON.stringify(l.lst));if(typeof n!="function")throw"summaryfxn required for modules/termdb.bins.js compute_bins()";const b=u(l);const c=n(b);if(!c||typeof c!=="object")throw"invalid returned value by summaryfxn";l.results={summary:c};if(!l.binLabelFormatter)l.binLabelFormatter=r(l);const f=Math.floor(c.min*100)/100;const p=Math.ceil(c.max*100)/100;const _=l.first_bin.startunbounded?f:l.first_bin.start_percentile?c["p"+l.first_bin.start_percentile]:l.first_bin.start;let d=p,m,h;if(l.last_bin){d=l.last_bin.stopunbounded?p:l.last_bin.stop_percentile?c["p"+l.last_bin.stop_percentile]:e(l.last_bin.stop)&&l.last_bin.stop<=c.max?l.last_bin.stop:p;m=e(l.last_bin.start_percentile)?c["p"+l.last_bin.start_percentile]:e(l.last_bin.start)?l.last_bin.start:undefined;h=l.last_bin.stopunbounded?null:l.last_bin.stop_percentile?c["p"+l.last_bin.stop_percentile]:e(l.last_bin.stop)?l.last_bin.stop:null}else if(l.lst){const t=l.lst[l.lst.length-1];m=t.start;h="stop"in t&&!t.stopunbounded?t.stop:p;d=h}else{m=p;h=p}const v=e(d);const g=e(m);const w=e(h);if(!v&&!g)return[];const y=[];let F={startunbounded:l.first_bin.startunbounded,start:l.first_bin.startunbounded?undefined:_,stop:e(l.first_bin.stop_percentile)?+c["p"+l.first_bin.stop_percentile]:e(l.first_bin.stop)?+l.first_bin.stop:_+l.bin_size,startinclusive:l.startinclusive,stopinclusive:l.stopinclusive};if(!e(F.stop))throw"the computed first_bin.stop is non-numeric"+F.stop;const U=100;while(v&&F.stop<=d||F.startunbounded&&!y.length||F.stopunbounded){y.push(F);if(F.stop>=d){F.stopunbounded=true;if(y.length>1){delete F.stop}}F.label=a(F,l,o);if(F.stopunbounded)break;const t=F.stop+l.bin_size;const s=F.stop;F={startinclusive:l.startinclusive,stopinclusive:l.stopinclusive,start:s,stop:w&&(s==m||t>h)?h:g&&t>m&&s!=m?m:t};if(F.stop>=d){F.stop=d;if(l.last_bin&&l.last_bin.stopunbounded)F.stopunbounded=1;if(l.last_bin&&l.last_bin.stopinclusive)F.stopinclusive=1}if(g&&F.start==m){if(l.last_bin&&l.last_bin.stopunbounded)F.stopunbounded=1}if(F.start>F.stop){if(g&&F.stop==m&&l.last_bin&&l.last_bin.stopunbounded)F.stopunbounded=true;else break}if(y.length+1>=U){l.error="max_num_bins_reached";break}}delete l.binLabelFormatter;if(y.length>1){delete y[y.length-1].stop}const L=s(y.length);for(const t of y)t.color=L(t.label);return y}function r(t){return"rounding"in t?n(t.rounding):t=>t}function a(s,e,n){const i=e;if(!i.binLabelFormatter)i.binLabelFormatter=r(i);if(!s.startunbounded&&!s.stopunbounded&&!("startinclusive"in s)&&!("stopinclusive"in s)){if(i.startinclusive)s.startinclusive=true;else if(i.stopinclusive)s.stopinclusive=true}const o=i.use_as=="bins"||s.start;const a=i.use_as=="bins"||s.stop;let l=0;if("label_offset"in i){i.label_offset_ignored="bin_size"in i&&i.bin_size<i.label_offset;if(!i.label_offset_ignored)l=i.label_offset}else if(i.bin_size===1&&i.termtype=="integer"){l=1}if(s.startunbounded){const e=s.stopinclusive?"≤":"<";const o=n?t(a,n.fromUnit,n.toUnit,n.scaleFactor,true):i.binLabelFormatter(a);return e+o}if(s.stopunbounded||o===a){const e=s.startinclusive?"≥":">";const r=n?t(o,n.fromUnit,n.toUnit,n.scaleFactor,true):i.binLabelFormatter(o);return e+r}if(l&&s.startinclusive&&!s.stopinclusive){if(Number.isInteger(i.bin_size)&&Math.abs(o-a)===l){return""+(n?t(o,n.fromUnit,n.toUnit,n.scaleFactor,true):i.binLabelFormatter(o))}else{const s=n?t(o,n.fromUnit,n.toUnit,n.scaleFactor,true):i.binLabelFormatter(o);const e=n?t(a-l,n.fromUnit,n.toUnit,n.scaleFactor,true):i.binLabelFormatter(a-l);return+s>=+e?s.toString():s+" to "+e}}else{const e=s.startinclusive?"":">";const r=s.stopinclusive?"":"<";const l=n?t(o,n.fromUnit,n.toUnit,n.scaleFactor,true):Number.isInteger(o)?o:i.binLabelFormatter(o);const u=n?t(a,n.fromUnit,n.toUnit,n.scaleFactor,true):Number.isInteger(a)?a:i.binLabelFormatter(a);if(+l>=+u){const t=s.startinclusive?"≥":">";return t+l}else{return e+l+" to "+r+u}}}function l(t,s){const e='<span style="font-family:Times;font-style:italic;">x</span>';let n;const i=a(t,s);if(t.startunbounded||t.stopunbounded){n=e+"&nbsp;"+i}else if(t.startinclusive){n=i.replace("to <","≤ "+e+" <")}else if(t.stopinclusive){n=i.replace(">","").replace("to","< "+e+" ≤")}return n}function u(t){const s=[];const n=t.first_bin;if(n&&e(n.start_percentile))s.push(n.start_percentile);if(n&&e(n.stop_percentile))s.push(n.stop_percentile);const i=t.last_bin;if(i&&e(i.start_percentile))s.push(i.start_percentile);if(i&&e(i.stop_percentile))s.push(i.stop_percentile);return s}export{l as a,o as c,a as g};
1
+ import{V as t,C as s,H as e,W as n}from"./app-b369b169.js";function i(t){const s=t;if(!s||typeof s!=="object")throw"bin schema must be an object";if(!("type"in s))s.type="regular-bin";if(s.type=="custom-bin"){if(!Array.isArray(s.lst))throw"binconfig.lst must be an array";if(!s.lst.length)throw"binconfig.lst must have entries";const t=s.lst[0];const n=s.lst[s.lst.length-1];for(const i of s.lst){if(!("startinclusive"in i)&&!("stopinclusive"in i)){throw"custom bin.startinclusive and/or bin.stopinclusive must be defined"}if(i==t){if("startunbounded"in i&&!i.startunbounded){throw`a custom first bin must not set bin.startunbounded to false`}i.startunbounded=true;if("start"in i){throw"a custom first bin must not set a bin.start value"}if("start_percentile"in i){throw"the first bin must not set a bin.start_percentile value"}if(!("stop"in i)){throw`a custom first bin must define a bin.stop value`}if(!e(i.stop)){throw`a custom first bin.stop value should be numeric`}}else if(i==n){if(!("start"in i)){throw`a custom last bin must define a bin.start value`}if(!e(i.start)){throw`a custom last bin.start must be numeric`}if("stopunbounded"in i&&!i.stopunbounded){throw"a custom last bin must not set bin.stopunbounded to false"}i.stopunbounded=true;if("stop"in i){throw"a custom last bin must not set a bin.stop value"}}else{if(!e(i.start))throw"bin.start must be numeric for a non-first bin";if(!e(i.stop))throw"bin.stop must be numeric for a non-last bin"}}}else if(s.type=="regular-bin"){if(!Number.isFinite(s.bin_size))throw"non-numeric bin_size";if(s.bin_size<=0)throw"bin_size must be greater than 0";if(!s.startinclusive&&!s.stopinclusive){s.startinclusive=1;s.stopinclusive=0}if(!s.first_bin)throw"first_bin{} missing";if(typeof s.first_bin!="object")throw"first_bin{} is not an object";if(!Object.keys(s.first_bin).length)throw"first_bin is an empty object";{const t=s.first_bin;t.startunbounded=true;if(t.stop_percentile){if(!Number.isInteger(t.stop_percentile))throw"first_bin.stop_percentile should be integer";if(t.stop_percentile<=0||t.stop_percentile>=100)throw"first_bin.stop_percentile out of bound (0-100)"}else if(!Number.isFinite(t.stop)){throw"first_bin.stop not a number when stop_percentile is not set"}}if(s.last_bin){const t=s.last_bin;if(t.start_percentile){if(!Number.isInteger(t.start_percentile))throw"last_bin.start_percentile should be integer";if(t.start_percentile<=0||t.start_percentile>=100)throw"last_bin.start_percentile out of bound (0-100)"}else if(!Number.isFinite(t.start)){throw"last_bin.start not a number when start_percentile is not set"}t.stopunbounded=true;if("stop"in t){throw"a regular last bin must not set a bin.stop value"}}}else{throw`invalid binconfig.type="${s.type}"`}}function o(t,n,o){const l=t;i(l);if(l.lst){const t=s(l.lst.length);for(const s of l.lst)s.color=t(s.label)}if(l.type=="custom-bin")return JSON.parse(JSON.stringify(l.lst));if(typeof n!="function")throw"summaryfxn required for modules/termdb.bins.js compute_bins()";const b=u(l);const c=n(b);if(!c||typeof c!=="object")throw"invalid returned value by summaryfxn";l.results={summary:c};if(!l.binLabelFormatter)l.binLabelFormatter=r(l);const f=Math.floor(c.min*100)/100;const p=Math.ceil(c.max*100)/100;const _=l.first_bin.startunbounded?f:l.first_bin.start_percentile?c["p"+l.first_bin.start_percentile]:l.first_bin.start;let d=p,m,h;if(l.last_bin){d=l.last_bin.stopunbounded?p:l.last_bin.stop_percentile?c["p"+l.last_bin.stop_percentile]:e(l.last_bin.stop)&&l.last_bin.stop<=c.max?l.last_bin.stop:p;m=e(l.last_bin.start_percentile)?c["p"+l.last_bin.start_percentile]:e(l.last_bin.start)?l.last_bin.start:undefined;h=l.last_bin.stopunbounded?null:l.last_bin.stop_percentile?c["p"+l.last_bin.stop_percentile]:e(l.last_bin.stop)?l.last_bin.stop:null}else if(l.lst){const t=l.lst[l.lst.length-1];m=t.start;h="stop"in t&&!t.stopunbounded?t.stop:p;d=h}else{m=p;h=p}const v=e(d);const g=e(m);const w=e(h);if(!v&&!g)return[];const y=[];let F={startunbounded:l.first_bin.startunbounded,start:l.first_bin.startunbounded?undefined:_,stop:e(l.first_bin.stop_percentile)?+c["p"+l.first_bin.stop_percentile]:e(l.first_bin.stop)?+l.first_bin.stop:_+l.bin_size,startinclusive:l.startinclusive,stopinclusive:l.stopinclusive};if(!e(F.stop))throw"the computed first_bin.stop is non-numeric"+F.stop;const U=100;while(v&&F.stop<=d||F.startunbounded&&!y.length||F.stopunbounded){y.push(F);if(F.stop>=d){F.stopunbounded=true;if(y.length>1){delete F.stop}}F.label=a(F,l,o);if(F.stopunbounded)break;const t=F.stop+l.bin_size;const s=F.stop;F={startinclusive:l.startinclusive,stopinclusive:l.stopinclusive,start:s,stop:w&&(s==m||t>h)?h:g&&t>m&&s!=m?m:t};if(F.stop>=d){F.stop=d;if(l.last_bin&&l.last_bin.stopunbounded)F.stopunbounded=1;if(l.last_bin&&l.last_bin.stopinclusive)F.stopinclusive=1}if(g&&F.start==m){if(l.last_bin&&l.last_bin.stopunbounded)F.stopunbounded=1}if(F.start>F.stop){if(g&&F.stop==m&&l.last_bin&&l.last_bin.stopunbounded)F.stopunbounded=true;else break}if(y.length+1>=U){l.error="max_num_bins_reached";break}}delete l.binLabelFormatter;if(y.length>1){delete y[y.length-1].stop}const L=s(y.length);for(const t of y)t.color=L(t.label);return y}function r(t){return"rounding"in t?n(t.rounding):t=>t}function a(s,e,n){const i=e;if(!i.binLabelFormatter)i.binLabelFormatter=r(i);if(!s.startunbounded&&!s.stopunbounded&&!("startinclusive"in s)&&!("stopinclusive"in s)){if(i.startinclusive)s.startinclusive=true;else if(i.stopinclusive)s.stopinclusive=true}const o=i.use_as=="bins"||s.start;const a=i.use_as=="bins"||s.stop;let l=0;if("label_offset"in i){i.label_offset_ignored="bin_size"in i&&i.bin_size<i.label_offset;if(!i.label_offset_ignored)l=i.label_offset}else if(i.bin_size===1&&i.termtype=="integer"){l=1}if(s.startunbounded){const e=s.stopinclusive?"≤":"<";const o=n?t(a,n.fromUnit,n.toUnit,n.scaleFactor,true):i.binLabelFormatter(a);return e+o}if(s.stopunbounded||o===a){const e=s.startinclusive?"≥":">";const r=n?t(o,n.fromUnit,n.toUnit,n.scaleFactor,true):i.binLabelFormatter(o);return e+r}if(l&&s.startinclusive&&!s.stopinclusive){if(Number.isInteger(i.bin_size)&&Math.abs(o-a)===l){return""+(n?t(o,n.fromUnit,n.toUnit,n.scaleFactor,true):i.binLabelFormatter(o))}else{const s=n?t(o,n.fromUnit,n.toUnit,n.scaleFactor,true):i.binLabelFormatter(o);const e=n?t(a-l,n.fromUnit,n.toUnit,n.scaleFactor,true):i.binLabelFormatter(a-l);return+s>=+e?s.toString():s+" to "+e}}else{const e=s.startinclusive?"":">";const r=s.stopinclusive?"":"<";const l=n?t(o,n.fromUnit,n.toUnit,n.scaleFactor,true):Number.isInteger(o)?o:i.binLabelFormatter(o);const u=n?t(a,n.fromUnit,n.toUnit,n.scaleFactor,true):Number.isInteger(a)?a:i.binLabelFormatter(a);if(+l>=+u){const t=s.startinclusive?"≥":">";return t+l}else{return e+l+" to "+r+u}}}function l(t,s){const e='<span style="font-family:Times;font-style:italic;">x</span>';let n;const i=a(t,s);if(t.startunbounded||t.stopunbounded){n=e+"&nbsp;"+i}else if(t.startinclusive){n=i.replace("to <","≤ "+e+" <")}else if(t.stopinclusive){n=i.replace(">","").replace("to","< "+e+" ≤")}return n}function u(t){const s=[];const n=t.first_bin;if(n&&e(n.start_percentile))s.push(n.start_percentile);if(n&&e(n.stop_percentile))s.push(n.stop_percentile);const i=t.last_bin;if(i&&e(i.start_percentile))s.push(i.start_percentile);if(i&&e(i.stop_percentile))s.push(i.stop_percentile);return s}export{l as a,o as c,a as g};
@@ -0,0 +1 @@
1
+ import{a as e,b as t,_ as i}from"./tslib.es6-c3c2d88f.js";import{R as n,S as r,T as s,P as o,H as a,i as l,M as p,F as d,d as u}from"./app-b369b169.js";import c from"path";const f=1;const h={continuous:"continuous",discrete:"discrete"};const m={GENE_VARIANT:"geneVariant",GENE_EXPRESSION:"geneExpression",CATEGORICAL:"categorical",INTEGER:"integer",FLOAT:"float",SNP:"snp",SNP_LIST:"snplst",SNP_LOCUS:"snplocus",CONDITION:"condition",SURVIVAL:"survival",SAMPLELST:"samplelst",METABOLITE_INTENSITY:"metaboliteIntensity",SINGLECELL_GENE_EXPRESSION:"singleCellGeneExpression",SINGLECELL_CELLTYPE:"singleCellCellType"};const y={[m.GENE_EXPRESSION]:n,[m.METABOLITE_INTENSITY]:r};const g={[m.CATEGORICAL]:s.DICTIONARY_VARIABLES,[m.CONDITION]:s.DICTIONARY_VARIABLES,[m.FLOAT]:s.DICTIONARY_VARIABLES,[m.INTEGER]:s.DICTIONARY_VARIABLES,[m.SAMPLELST]:s.DICTIONARY_VARIABLES,[m.SURVIVAL]:s.DICTIONARY_VARIABLES,[m.GENE_VARIANT]:s.MUTATION_CNV_FUSION,[m.SNP]:s.SNP,[m.SNP_LIST]:s.SNP_LIST,[m.SNP_LOCUS]:s.SNP_LOCUS,[m.GENE_EXPRESSION]:s.GENE_EXPRESSION,[m.METABOLITE_INTENSITY]:s.METABOLITE_INTENSITY};const v=new Set([m.SNP,m.SNP_LIST,m.SNP_LOCUS,m.GENE_EXPRESSION,m.GENE_VARIANT,m.METABOLITE_INTENSITY,m.SINGLECELL_GENE_EXPRESSION,m.SINGLECELL_CELLTYPE]);const b=new Set([m.INTEGER,m.FLOAT,m.GENE_EXPRESSION,m.METABOLITE_INTENSITY,m.SINGLECELL_GENE_EXPRESSION]);const w=new Set([m.CATEGORICAL,m.SNP]);function q(e){if(!e)return false;return b.has(e.type)}function T(e){if(!e)return false;return w.has(e.type)}function x(e){return!E(e)}function E(e){if(!e)throw new Error("Type is not defined");return v.has(e)}function S(e,t){if(!e)throw new Error("First term is not defined ");if(!t)throw new Error("Second term is not defined ");if(e.type!==t.type)return false;if(x(e.type)&&x(t.type)&&e.type!=m.SAMPLELST)return e.id===t.id;switch(e.type){case m.GENE_EXPRESSION:return e.gene==t.gene;case m.METABOLITE_INTENSITY:return e.name==t.name;case m.GENE_VARIANT:return e.gene==t.gene||e.chr==t.chr&&e.start==t.start&&e.stop==t.stop;default:return false}}var _=function(e,t){var i=[];for(var n=0;n<e.length;n++){var r=t(e[n],n);if(N(r))i.push.apply(i,r);else i.push(r)}return i};var N=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};var A=I;function I(e,t,i){if(e instanceof RegExp)e=C(e,i);if(t instanceof RegExp)t=C(t,i);var n=O(e,t,i);return n&&{start:n[0],end:n[1],pre:i.slice(0,n[0]),body:i.slice(n[0]+e.length,n[1]),post:i.slice(n[1]+t.length)}}function C(e,t){var i=t.match(e);return i?i[0]:null}I.range=O;function O(e,t,i){var n,r,s,o,a;var l=i.indexOf(e);var p=i.indexOf(t,l+1);var d=l;if(l>=0&&p>0){if(e===t){return[l,p]}n=[];s=i.length;while(d>=0&&!a){if(d==l){n.push(d);l=i.indexOf(e,d+1)}else if(n.length==1){a=[n.pop(),p]}else{r=n.pop();if(r<s){s=r;o=p}p=i.indexOf(t,d+1)}d=l<p&&l>=0?l:p}if(n.length){a=[s,o]}}return a}var j=V;var k="\0SLASH"+Math.random()+"\0";var P="\0OPEN"+Math.random()+"\0";var $="\0CLOSE"+Math.random()+"\0";var M="\0COMMA"+Math.random()+"\0";var L="\0PERIOD"+Math.random()+"\0";function R(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function W(e){return e.split("\\\\").join(k).split("\\{").join(P).split("\\}").join($).split("\\,").join(M).split("\\.").join(L)}function B(e){return e.split(k).join("\\").split(P).join("{").split($).join("}").split(M).join(",").split(L).join(".")}function G(e){if(!e)return[""];var t=[];var i=A("{","}",e);if(!i)return e.split(",");var n=i.pre;var r=i.body;var s=i.post;var o=n.split(",");o[o.length-1]+="{"+r+"}";var a=G(s);if(s.length){o[o.length-1]+=a.shift();o.push.apply(o,a)}t.push.apply(t,o);return t}function V(e){if(!e)return[];if(e.substr(0,2)==="{}"){e="\\{\\}"+e.substr(2)}return H(W(e),true).map(B)}function D(e){return"{"+e+"}"}function Q(e){return/^-?0\d/.test(e)}function U(e,t){return e<=t}function Y(e,t){return e>=t}function H(e,t){var i=[];var n=A("{","}",e);if(!n||/\$$/.test(n.pre))return[e];var r=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body);var s=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body);var o=r||s;var a=n.body.indexOf(",")>=0;if(!o&&!a){if(n.post.match(/,.*\}/)){e=n.pre+"{"+n.body+$+n.post;return H(e)}return[e]}var l;if(o){l=n.body.split(/\.\./)}else{l=G(n.body);if(l.length===1){l=H(l[0],false).map(D);if(l.length===1){var p=n.post.length?H(n.post,false):[""];return p.map((function(e){return n.pre+l[0]+e}))}}}var d=n.pre;var p=n.post.length?H(n.post,false):[""];var u;if(o){var c=R(l[0]);var f=R(l[1]);var h=Math.max(l[0].length,l[1].length);var m=l.length==3?Math.abs(R(l[2])):1;var y=U;var g=f<c;if(g){m*=-1;y=Y}var v=l.some(Q);u=[];for(var b=c;y(b,f);b+=m){var w;if(s){w=String.fromCharCode(b);if(w==="\\")w=""}else{w=String(b);if(v){var q=h-w.length;if(q>0){var T=new Array(q+1).join("0");if(b<0)w="-"+T+w.slice(1);else w=T+w}}}u.push(w)}}else{u=_(l,(function(e){return H(e,false)}))}for(var x=0;x<u.length;x++){for(var E=0;E<p.length;E++){var S=d+u[x]+p[E];if(!t||o||S)i.push(S)}}return i}var X=ae;ae.Minimatch=le;var F=function(){try{return c}catch(e){}}()||{sep:"/"};ae.sep=F.sep;var z=ae.GLOBSTAR=le.GLOBSTAR={};var J={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}};var Z="[^/]";var K=Z+"*?";var ee="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";var te="(?:(?!(?:\\/|^)\\.).)*?";var ie=ne("().*{}+?[]^$\\!");function ne(e){return e.split("").reduce((function(e,t){e[t]=true;return e}),{})}var re=/\/+/;ae.filter=se;function se(e,t){t=t||{};return function(i,n,r){return ae(i,e,t)}}function oe(e,t){t=t||{};var i={};Object.keys(e).forEach((function(t){i[t]=e[t]}));Object.keys(t).forEach((function(e){i[e]=t[e]}));return i}ae.defaults=function(e){if(!e||typeof e!=="object"||!Object.keys(e).length){return ae}var t=ae;var i=function i(n,r,s){return t(n,r,oe(e,s))};i.Minimatch=function i(n,r){return new t.Minimatch(n,oe(e,r))};i.Minimatch.defaults=function i(n){return t.defaults(oe(e,n)).Minimatch};i.filter=function i(n,r){return t.filter(n,oe(e,r))};i.defaults=function i(n){return t.defaults(oe(e,n))};i.makeRe=function i(n,r){return t.makeRe(n,oe(e,r))};i.braceExpand=function i(n,r){return t.braceExpand(n,oe(e,r))};i.match=function(i,n,r){return t.match(i,n,oe(e,r))};return i};le.defaults=function(e){return ae.defaults(e).Minimatch};function ae(e,t,i){fe(t);if(!i)i={};if(!i.nocomment&&t.charAt(0)==="#"){return false}return new le(t,i).match(e)}function le(e,t){if(!(this instanceof le)){return new le(e,t)}fe(e);if(!t)t={};e=e.trim();if(!t.allowWindowsEscape&&F.sep!=="/"){e=e.split(F.sep).join("/")}this.options=t;this.set=[];this.pattern=e;this.regexp=null;this.negate=false;this.comment=false;this.empty=false;this.partial=!!t.partial;this.make()}le.prototype.debug=function(){};le.prototype.make=pe;function pe(){var e=this.pattern;var t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=true;return}if(!e){this.empty=true;return}this.parseNegate();var i=this.globSet=this.braceExpand();if(t.debug)this.debug=function e(){console.error.apply(console,arguments)};this.debug(this.pattern,i);i=this.globParts=i.map((function(e){return e.split(re)}));this.debug(this.pattern,i);i=i.map((function(e,t,i){return e.map(this.parse,this)}),this);this.debug(this.pattern,i);i=i.filter((function(e){return e.indexOf(false)===-1}));this.debug(this.pattern,i);this.set=i}le.prototype.parseNegate=de;function de(){var e=this.pattern;var t=false;var i=this.options;var n=0;if(i.nonegate)return;for(var r=0,s=e.length;r<s&&e.charAt(r)==="!";r++){t=!t;n++}if(n)this.pattern=e.substr(n);this.negate=t}ae.braceExpand=function(e,t){return ue(e,t)};le.prototype.braceExpand=ue;function ue(e,t){if(!t){if(this instanceof le){t=this.options}else{t={}}}e=typeof e==="undefined"?this.pattern:e;fe(e);if(t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)){return[e]}return j(e)}var ce=1024*64;var fe=function(e){if(typeof e!=="string"){throw new TypeError("invalid pattern")}if(e.length>ce){throw new TypeError("pattern is too long")}};le.prototype.parse=me;var he={};function me(e,t){fe(e);var i=this.options;if(e==="**"){if(!i.noglobstar)return z;else e="*"}if(e==="")return"";var n="";var r=!!i.nocase;var s=false;var o=[];var a=[];var l;var p=false;var d=-1;var u=-1;var c=e.charAt(0)==="."?"":i.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)";var f=this;function h(){if(l){switch(l){case"*":n+=K;r=true;break;case"?":n+=Z;r=true;break;default:n+="\\"+l;break}f.debug("clearStateChar %j %j",l,n);l=false}}for(var m=0,y=e.length,g;m<y&&(g=e.charAt(m));m++){this.debug("%s\t%s %s %j",e,m,n,g);if(s&&ie[g]){n+="\\"+g;s=false;continue}switch(g){case"/":{return false}case"\\":h();s=true;continue;case"?":case"*":case"+":case"@":case"!":this.debug("%s\t%s %s %j <-- stateChar",e,m,n,g);if(p){this.debug(" in class");if(g==="!"&&m===u+1)g="^";n+=g;continue}f.debug("call clearStateChar %j",l);h();l=g;if(i.noext)h();continue;case"(":if(p){n+="(";continue}if(!l){n+="\\(";continue}o.push({type:l,start:m-1,reStart:n.length,open:J[l].open,close:J[l].close});n+=l==="!"?"(?:(?!(?:":"(?:";this.debug("plType %j %j",l,n);l=false;continue;case")":if(p||!o.length){n+="\\)";continue}h();r=true;var v=o.pop();n+=v.close;if(v.type==="!"){a.push(v)}v.reEnd=n.length;continue;case"|":if(p||!o.length||s){n+="\\|";s=false;continue}h();n+="|";continue;case"[":h();if(p){n+="\\"+g;continue}p=true;u=m;d=n.length;n+=g;continue;case"]":if(m===u+1||!p){n+="\\"+g;s=false;continue}var b=e.substring(u+1,m);try{RegExp("["+b+"]")}catch(e){var w=this.parse(b,he);n=n.substr(0,d)+"\\["+w[0]+"\\]";r=r||w[1];p=false;continue}r=true;p=false;n+=g;continue;default:h();if(s){s=false}else if(ie[g]&&!(g==="^"&&p)){n+="\\"}n+=g}}if(p){b=e.substr(u+1);w=this.parse(b,he);n=n.substr(0,d)+"\\["+w[0];r=r||w[1]}for(v=o.pop();v;v=o.pop()){var q=n.slice(v.reStart+v.open.length);this.debug("setting tail",n,v);q=q.replace(/((?:\\{2}){0,64})(\\?)\|/g,(function(e,t,i){if(!i){i="\\"}return t+t+i+"|"}));this.debug("tail=%j\n %s",q,q,v,n);var T=v.type==="*"?K:v.type==="?"?Z:"\\"+v.type;r=true;n=n.slice(0,v.reStart)+T+"\\("+q}h();if(s){n+="\\\\"}var x=false;switch(n.charAt(0)){case"[":case".":case"(":x=true}for(var E=a.length-1;E>-1;E--){var S=a[E];var _=n.slice(0,S.reStart);var N=n.slice(S.reStart,S.reEnd-8);var A=n.slice(S.reEnd-8,S.reEnd);var I=n.slice(S.reEnd);A+=I;var C=_.split("(").length-1;var O=I;for(m=0;m<C;m++){O=O.replace(/\)[+*?]?/,"")}I=O;var j="";if(I===""&&t!==he){j="$"}var k=_+N+I+j+A;n=k}if(n!==""&&r){n="(?=.)"+n}if(x){n=c+n}if(t===he){return[n,r]}if(!r){return ge(e)}var P=i.nocase?"i":"";try{var $=new RegExp("^"+n+"$",P)}catch(e){return new RegExp("$.")}$._glob=e;$._src=n;return $}ae.makeRe=function(e,t){return new le(e,t||{}).makeRe()};le.prototype.makeRe=ye;function ye(){if(this.regexp||this.regexp===false)return this.regexp;var e=this.set;if(!e.length){this.regexp=false;return this.regexp}var t=this.options;var i=t.noglobstar?K:t.dot?ee:te;var n=t.nocase?"i":"";var r=e.map((function(e){return e.map((function(e){return e===z?i:typeof e==="string"?ve(e):e._src})).join("\\/")})).join("|");r="^(?:"+r+")$";if(this.negate)r="^(?!"+r+").*$";try{this.regexp=new RegExp(r,n)}catch(e){this.regexp=false}return this.regexp}ae.match=function(e,t,i){i=i||{};var n=new le(t,i);e=e.filter((function(e){return n.match(e)}));if(n.options.nonull&&!e.length){e.push(t)}return e};le.prototype.match=function e(t,i){if(typeof i==="undefined")i=this.partial;this.debug("match",t,this.pattern);if(this.comment)return false;if(this.empty)return t==="";if(t==="/"&&i)return true;var n=this.options;if(F.sep!=="/"){t=t.split(F.sep).join("/")}t=t.split(re);this.debug(this.pattern,"split",t);var r=this.set;this.debug(this.pattern,"set",r);var s;var o;for(o=t.length-1;o>=0;o--){s=t[o];if(s)break}for(o=0;o<r.length;o++){var a=r[o];var l=t;if(n.matchBase&&a.length===1){l=[s]}var p=this.matchOne(l,a,i);if(p){if(n.flipNegate)return true;return!this.negate}}if(n.flipNegate)return false;return this.negate};le.prototype.matchOne=function(e,t,i){var n=this.options;this.debug("matchOne",{this:this,file:e,pattern:t});this.debug("matchOne",e.length,t.length);for(var r=0,s=0,o=e.length,a=t.length;r<o&&s<a;r++,s++){this.debug("matchOne loop");var l=t[s];var p=e[r];this.debug(t,l,p);if(l===false)return false;if(l===z){this.debug("GLOBSTAR",[t,l,p]);var d=r;var u=s+1;if(u===a){this.debug("** at the end");for(;r<o;r++){if(e[r]==="."||e[r]===".."||!n.dot&&e[r].charAt(0)===".")return false}return true}while(d<o){var c=e[d];this.debug("\nglobstar while",e,d,t,u,c);if(this.matchOne(e.slice(d),t.slice(u),i)){this.debug("globstar found match!",d,o,c);return true}else{if(c==="."||c===".."||!n.dot&&c.charAt(0)==="."){this.debug("dot detected!",e,d,t,u);break}this.debug("globstar swallow a segment, and continue");d++}}if(i){this.debug("\n>>> no match, partial?",e,d,t,u);if(d===o)return true}return false}var f;if(typeof l==="string"){f=p===l;this.debug("string match",l,p,f)}else{f=p.match(l);this.debug("pattern match",l,p,f)}if(!f)return false}if(r===o&&s===a){return true}else if(r===o){return i}else if(s===a){return r===o-1&&e[r]===""}throw new Error("wtf?")};function ge(e){return e.replace(/\\(.)/g,"$1")}function ve(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}class be{constructor(e,t){var i;this.isAtomic=true;this.type=e.type;this.isAtomic=true;if(e.$id)this.$id=e.$id;if((i=t.addons)===null||i===void 0?void 0:i[this.type]){Object.defineProperties(this,t.addons[this.type])}}static setHiddenValues(e,t){if(e.hiddenValues)return;e.hiddenValues={};if(t.values){for(const i in t.values){if(t.values[i].uncomputable)e.hiddenValues[i]=1}}}render(e){console.log(e);throw`should implement this method in subclass code, as needed`}}var we,qe,Te,xe,Ee,Se;class _e extends be{constructor(e,t){super(e,t);this.term=e.term}static fill(e,t={}){var i;if(!e.term)throw`missing tw.term, must already be filled in`;if(e.term.type!="categorical")throw`incorrect term.type='${(i=e.term)===null||i===void 0?void 0:i.type}', expecting 'categorical'`;if(t.defaultQ!=null){t.defaultQ.isAtomic=true;o(e.q,t.defaultQ)}if(!e.q.mode)e.q.mode="discrete";if(!e.q)e.q={type:"values",isAtomic:true};if(!e.type)e.type=!e.q.type||e.q.type=="values"?"CatTWValues":e.q.type=="predefined-groupset"?"CatTWPredefinedGS":e.q.type=="custom-groupset"?"CatTWCustomGS":undefined;switch(e.type){case"CatTWValues":return Ne.fill(e);case"CatTWPredefinedGS":return Ae.fill(e);case"CatTWCustomGS":return Ie.fill(e);default:throw`tw.type='${e.type} (q.mode:q.type=${e.q.mode}:${e.q.type}' is not supported by CategoricalBase.fill()`}}}class Ne extends _e{constructor(t,i={}){super(t,i);we.set(this,void 0);qe.set(this,void 0);this.q=t.q;e(this,we,t,"f");e(this,qe,i,"f")}getTw(){return t(this,we,"f")}static fill(e){if(!e.type)e.type="CatTWValues";else if(e.type!="CatTWValues")throw`expecting tw.type='CatTWValues', got '${e.type}'`;if(e.term.type!="categorical")throw`expecting tw.term.type='categorical', got '${e.term.type}'`;const{term:t,q:i}=e;if(!i.type)i.type="values";else if(i.type!="values")throw`expecting tw.q.type='values', got ${e.q.type}`;if(!t.values)t.values={};if(i.mode=="binary"){if(Object.keys(e.term.values).length!=2)throw"term.values must have exactly two keys"}vt(i,t);return e}}we=new WeakMap,qe=new WeakMap;class Ae extends _e{constructor(i,n={}){super(i,n);Te.set(this,void 0);xe.set(this,void 0);this.q=i.q;e(this,Te,i,"f");Object.defineProperty(this,"groupset",{value:this.term.groupsetting[t(this,Te,"f").q.predefined_groupset_idx]});e(this,xe,n,"f")}getTw(){return t(this,Te,"f")}static fill(e){var t,i;if(!e.type)e.type="CatTWPredefinedGS";else if(e.type!="CatTWPredefinedGS")throw`expecting tw.type='CatTWPredefinedGS', got '${e.type}'`;if(e.term.type!="categorical")throw`expecting tw.term.type='categorical', got '${e.term.type}'`;if(e.q.type!="predefined-groupset")throw`expecting tw.q.type='predefined-groupset', got '${e.q.type}'`;const{term:n,q:r}=e;const s=r.predefined_groupset_idx;if(s!==undefined&&!Number.isInteger(s))throw`missing or invalid tw.q.predefined_groupset_idx='${s}'`;r.predefined_groupset_idx=s||0;const o=e.term.groupsetting;if(!o)throw"no term.groupsetting";if(!((t=o.lst)===null||t===void 0?void 0:t.length))throw"term.groupsetting.lst is empty";const a=(i=o.lst)===null||i===void 0?void 0:i[r.predefined_groupset_idx];if(!a)throw`no groupset entry for groupsetting.lst?.[predefined_groupset_idx=${s}]`;if(r.mode=="binary"){if(a.groups.length!=2)throw"there must be exactly two groups"}vt(r,n);return e}}Te=new WeakMap,xe=new WeakMap;class Ie extends _e{constructor(t,i={}){super(t,i);Ee.set(this,void 0);Se.set(this,void 0);this.q=t.q;Object.defineProperty(this,"groupset",{value:this.q.customset});e(this,Ee,t,"f");e(this,Se,i,"f")}getTw(){return t(this,Ee,"f")}static fill(e){if(!e.type)e.type="CatTWCustomGS";else if(e.type!="CatTWCustomGS")throw`expecting tw.type='CatTWCustomGS', got '${e.type}'`;if(e.term.type!="categorical")throw`expecting tw.term.type='categorical', got '${e.term.type}'`;if(e.q.type!="custom-groupset")throw`expecting tw.q.type='custom-groupset', got '${e.q.type}'`;const{term:t,q:i}=e;if(!i.customset)throw`missing tw.q.customset`;if(i.mode=="binary"){if(i.customset.groups.length!=2)throw"there must be exactly two groups"}vt(i,t);return e}}Ee=new WeakMap,Se=new WeakMap;function Ce(e,t){const i=Number(e);if(Number.isInteger(i))return i;if(Math.abs(i)<1)return Number(i.toPrecision(t));return Number(i.toFixed(t))}function Oe(e){const t=je(e);let i=Math.abs(e)>1?2:t>0?t+1:2;return Ce(e,i)}function je(e){const t=e.toString();const i=t.indexOf(".");if(i===-1||i===t.length-1){return 0}let n=0;for(let e=i+1;e<t.length;e++){if(t[e]==="0"){n++}else if(t[e]>="1"&&t[e]<="9"){break}}return n}var ke,Pe,$e,Me,Le,Re,We,Be;class Ge extends be{constructor(e,t){super(e,t);this.term=e.term}static fill(e,t={}){return i(this,void 0,void 0,(function*(){if(!e.term)throw`missing tw.term, must already be filled in`;if(!Ge.termTypes.has(e.term.type))throw`non-numeric term.type='${e.term.type}'`;if(t.defaultQ){t.defaultQ.isAtomic=true;e.q.isAtomic=true;if(t.defaultQ.preferredBins=="median"){if(!t.defaultQ.type)t.defaultQ.type="custom-bin";else if(t.defaultQ.type!="custom-bin")throw".type must be custom-bin when .preferredBins=median"}o(e.q,t.defaultQ)}if(!e.q.mode)e.q.mode="discrete";if(!e.q.type){if(e.q.mode=="binary")e.q.type="custom-bin";else if(e.q.mode=="discrete")He(e)}e.type=e.q.type=="regular-bin"?"NumTWRegularBin":e.q.type=="custom-bin"||e.q.mode=="binary"?"NumTWCustomBin":e.q.mode=="continuous"?"NumTWCont":e.q.mode=="spline"?"NumTWSpline":e.type;switch(e.type){case"NumTWRegularBin":return yield Ve.fill(e);case"NumTWCustomBin":return yield De.fill(e,t);case"NumTWCont":return yield Qe.fill(e);case"NumTWSpline":return yield Ue.fill(e);default:throw`tw.type='${e.type} (q.mode:q.type=${e.q.mode}:${e.q.type}' is not supported by NumericBase.fill()`}}))}}Ge.termTypes=new Set(["integer","float","geneExpression","metaboliteIntensity"]);class Ve extends Ge{constructor(t,i={}){super(t,i);ke.set(this,void 0);Pe.set(this,void 0);this.q=t.q;e(this,ke,t,"f");e(this,Pe,i,"f")}getTw(){return t(this,ke,"f")}static fill(e){var t;return i(this,void 0,void 0,(function*(){if(!e.type)e.type="NumTWRegularBin";else if(e.type!="NumTWRegularBin")throw`expecting tw.type='NumTWRegularBin', got '${e.type}'`;if(!e.q.mode)e.q.mode="discrete";else if(e.q.mode!="discrete"&&e.q.mode!="binary"&&e.q.mode!="continuous")throw`expecting tw.q.mode='discrete'|'binary'|'continous', got '${e.q.mode}'`;if(e.q.type&&e.q.type!="regular-bin")throw`expecting tw.q.type='regular-bin', got '${e.q.type}'`;if(!e.q.first_bin||!a(e.q.bin_size))He(e);if(!a(e.q.bin_size))throw`tw.q.bin_size=${e.q.bin_size} is not numeric`;if(!e.q.first_bin)throw`missing tw.q.first_bin`;if(!a((t=e.q.first_bin)===null||t===void 0?void 0:t.stop))throw`tw.q.first_bin.stop is not numeric`;be.setHiddenValues(e.q,e.term);return e}))}}ke=new WeakMap,Pe=new WeakMap;class De extends Ge{constructor(t,i={}){super(t,i);$e.set(this,void 0);Me.set(this,void 0);this.q=t.q;e(this,$e,t,"f");e(this,Me,i,"f")}getTw(){return t(this,$e,"f")}static fill(e,t={}){return i(this,void 0,void 0,(function*(){if(!e.type)e.type="NumTWCustomBin";else if(e.type!="NumTWCustomBin")throw`expecting tw.type='NumTWCustomBin', got '${e.type}'`;if(!e.q.mode)e.q.mode="discrete";else if(e.q.mode!="discrete"&&e.q.mode!="binary")throw`expecting tw.q.mode='discrete'|binary', got '${e.q.mode}'`;if(e.q.mode=="binary"&&!e.q.preferredBins)e.q.preferredBins="median";if(e.q.preferredBins=="median"){const i=yield t.vocabApi.getPercentile(e.term.id,[50]);if(!i.values)throw".values[] missing from vocab.getPercentile()";const n=Oe(i.values[0]);if(!a(n))throw"median value not a number";e.q.type="custom-bin";e.q.lst=[{startunbounded:true,stop:n,stopinclusive:false,label:"<"+n},{start:n,startinclusive:true,stopunbounded:true,label:"≥"+n}];delete e.q.preferredBins}else if(e.q.type!="custom-bin")throw`expecting tw.q.type='custom-bin', got '${e.q.type}'`;if(!Array.isArray(e.q.lst))He(e);if(!e.q.lst||!e.q.lst.length)throw`missing or empty q.lst[] for custom-bin`;if(e.q.mode=="binary"&&e.q.lst.length!=2)throw`numeric q.mode='binary' requires exactly 2 bins`;be.setHiddenValues(e.q,e.term);e.type="NumTWCustomBin";return e}))}}$e=new WeakMap,Me=new WeakMap;class Qe extends Ge{constructor(t,i={}){super(t,i);Le.set(this,void 0);Re.set(this,void 0);this.q=t.q;e(this,Le,t,"f");e(this,Re,i,"f")}getTw(){return t(this,Le,"f")}static fill(e){return i(this,void 0,void 0,(function*(){if(!e.type)e.type="NumTWCont";else if(e.type!="NumTWCont")throw`expecting tw.type='NumTWCont', got '${e.type}'`;if(e.q.mode!="continuous")throw`tw.q.mode='${e.q.mode}', expecting 'continuous'`;be.setHiddenValues(e.q,e.term);e.type="NumTWCont";return e}))}}Le=new WeakMap,Re=new WeakMap;class Ue extends Ge{constructor(t,i={}){super(t,i);We.set(this,void 0);Be.set(this,void 0);this.q=t.q;e(this,We,t,"f");e(this,Be,i,"f")}static fill(e){return i(this,void 0,void 0,(function*(){if(!e.type)e.type="NumTWSpline";else if(e.type!="NumTWSpline")throw`expecting tw.type='NumTWSpline', got '${e.type}'`;if(e.q.mode!="spline")throw`tw.q.mode='${e.q.mode}', expecting 'spline'`;if(!e.q.knots)throw`missing tw.q.knots`;if(!e.q.knots.length)throw`empty tw.q.knots[]`;be.setHiddenValues(e.q,e.term);e.type="NumTWSpline";return e}))}}We=new WeakMap,Be=new WeakMap;const Ye=new Set(["default","less","median"]);function He(e){if(!e.term.bins)throw`missing tw.term.bins`;const t=e.q.preferredBins||"default";if(!Ye.has(t))throw`invalid preferredBins='${t}'`;if(t!="median"){if(!Object.keys(e.term.bins).includes(t));const i=e.term.bins[t];if(e.q.type&&e.q.type!=i.type)throw`mismatched tw.q.type and term.bins[preferredBins].type`;const n=Object.keys(e.q);for(const[t,r]of Object.entries(i)){if(!n.includes(t))e.q[t]=r}delete e.q.preferredBins}}class Xe{constructor(e){this.opts=e}static init(e,t={}){switch(e.type){case"CatTWValues":return new Ne(e,t);case"CatTWPredefinedGS":return new Ae(e,t);case"CatTWCustomGS":return new Ie(e,t);case"NumTWRegularBin":return new Ve(e,t);case"NumTWCustomBin":return new De(e,t);case"NumTWCont":return new Qe(e,t);default:throw`unable to init(tw)`}}static initRaw(e,t={}){return i(this,void 0,void 0,(function*(){const i=yield Xe.fill(e,t);return Xe.init(i,t)}))}static fill(e,t={}){var n,r;return i(this,void 0,void 0,(function*(){yield Xe.preprocess(e,t===null||t===void 0?void 0:t.vocabApi);const i=e.term.type=="float"||e.term.type=="integer"?"numeric":e.term.type;t.defaultQ=((n=t.defaultQByTsHandler)===null||n===void 0?void 0:n[i])||null;switch(e.term.type){case"categorical":{return yield _e.fill(e,t)}case"integer":case"float":return yield Ge.fill(e,t);default:throw`unrecognized tw.term?.type='${(r=e.term)===null||r===void 0?void 0:r.type}'`}}))}static preprocess(e,t){return i(this,void 0,void 0,(function*(){const i=Object.keys(e);if(!i.length)throw`empty tw object`;if(e.id&&!e.term){yield ct([e],t);delete e.id}if(!e.q)e.q={};e.q.isAtomic=true;Xe.reshapeLegacyTw(e)}))}static reshapeLegacyTw(e){if(Object.keys(e.q).includes("groupsetting")){if(!e.q.groupsetting.inuse){e.q.type="values"}else if(e.q.type=="predefined-groupset"){e.q.predefined_groupset_idx=e.q.groupsetting.predefined_groupset_idx}else if(e.q.type=="custom-groupset"){e.q.customset=e.q.groupsetting.customset}else{throw"invalid q.type"}delete e.q["groupsetting"]}}}function Fe(e){switch(e){case"./handlers/categorical.ts":return import("./categorical-a52014a1.js");case"./handlers/condition.ts":return import("./condition-c646e357.js");case"./handlers/density.ts":return import("./density-a82a8b1c.js");case"./handlers/geneExpression.ts":return import("./geneExpression-7d14983f.js");case"./handlers/geneVariant.ts":return import("./geneVariant-92c4e870.js");case"./handlers/groupsetting.ts":return import("./groupsetting-b4416a96.js");case"./handlers/metaboliteIntensity.ts":return import("./metaboliteIntensity-fac92f8b.js");case"./handlers/numeric.binary.ts":return import("./numeric.binary-1f9e93f2.js");case"./handlers/numeric.continuous.ts":return import("./numeric.continuous-ebcd0567.js");case"./handlers/numeric.discrete.ts":return import("./numeric.discrete-7b97044a.js");case"./handlers/numeric.spline.ts":return import("./numeric.spline-1be88f3d.js");case"./handlers/numeric.toggle.ts":return import("./numeric.toggle-7fa2a770.js");case"./handlers/numeric.ts":return import("./numeric-b0b17185.js");case"./handlers/samplelst.ts":return import("./samplelst-689796e6.js");case"./handlers/singleCellCellType.ts":return import("./singleCellCellType-5db730bb.js");case"./handlers/singleCellGeneExpression.ts":return import("./singleCellGeneExpression-7147a2d0.js");case"./handlers/snp.ts":return import("./snp-a8388ce4.js");case"./handlers/snplocus.ts":return import("./snplocus-7a1ea8c9.js");case"./handlers/snplst.sampleSum.ts":return import("./snplst.sampleSum-e47d05f0.js");case"./handlers/snplst.ts":return import("./snplst-6865d7c7.js");case"./handlers/survival.ts":return import("./survival-e16e068f.js");default:return new Promise((function(t,i){(typeof queueMicrotask==="function"?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+e)))}))}}function ze(e){switch(e){case"./handlers/categorical.ts":return import("./categorical-a52014a1.js");case"./handlers/condition.ts":return import("./condition-c646e357.js");case"./handlers/density.ts":return import("./density-a82a8b1c.js");case"./handlers/geneExpression.ts":return import("./geneExpression-7d14983f.js");case"./handlers/geneVariant.ts":return import("./geneVariant-92c4e870.js");case"./handlers/groupsetting.ts":return import("./groupsetting-b4416a96.js");case"./handlers/metaboliteIntensity.ts":return import("./metaboliteIntensity-fac92f8b.js");case"./handlers/numeric.binary.ts":return import("./numeric.binary-1f9e93f2.js");case"./handlers/numeric.continuous.ts":return import("./numeric.continuous-ebcd0567.js");case"./handlers/numeric.discrete.ts":return import("./numeric.discrete-7b97044a.js");case"./handlers/numeric.spline.ts":return import("./numeric.spline-1be88f3d.js");case"./handlers/numeric.toggle.ts":return import("./numeric.toggle-7fa2a770.js");case"./handlers/numeric.ts":return import("./numeric-b0b17185.js");case"./handlers/samplelst.ts":return import("./samplelst-689796e6.js");case"./handlers/singleCellCellType.ts":return import("./singleCellCellType-5db730bb.js");case"./handlers/singleCellGeneExpression.ts":return import("./singleCellGeneExpression-7147a2d0.js");case"./handlers/snp.ts":return import("./snp-a8388ce4.js");case"./handlers/snplocus.ts":return import("./snplocus-7a1ea8c9.js");case"./handlers/snplst.sampleSum.ts":return import("./snplst.sampleSum-e47d05f0.js");case"./handlers/snplst.ts":return import("./snplst-6865d7c7.js");case"./handlers/survival.ts":return import("./survival-e16e068f.js");default:return new Promise((function(t,i){(typeof queueMicrotask==="function"?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+e)))}))}}const Je=`_ts_${(+new Date).toString().slice(-8)}`;let Ze=0;function Ke(e){return i(this,void 0,void 0,(function*(){if(!e)return`${Ze++}${Je}`;delete e.$id;return yield tt(JSON.stringify(e))}))}const et=new TextEncoder;function tt(e){return i(this,void 0,void 0,(function*(){const t=et.encode(e);const i=yield crypto.subtle.digest("SHA-1",t);const n=Array.from(new Uint8Array(i));const r=n.map((e=>e.toString(16).padStart(2,"0"))).join("");return it(r).replace("=","-")}))}function it(e){return btoa([...e].reduce(((t,i,n)=>t+=!(n-1&1)?String.fromCharCode(parseInt(e.substring(n-1,n+1),16)):""),""))}const nt={menuOptions:"edit",menuLayout:"vertical"};class rt{constructor(e){this.opts=this.validateOpts(e);this.vocabApi=e.vocabApi;this.activeCohort=e.activeCohort;this.placeholder=e.placeholder;this.durations={exit:0};this.disable_terms=e.disable_terms;this.usecase=e.usecase;this.abbrCutoff=e.abbrCutoff;this.numqByTermIdModeType={};this.dom={holder:e.holder,tip:e.tip||new p({padding:"0px",parent_menu:this.opts.holder&&this.opts.holder.node()&&this.opts.holder.node().closest(".sja_menu_div")})};this.dom.tip2=new p({padding:"0px",parent_menu:this.dom.tip.d.node()});at(this);ot(this);this.initUI();const t=pt(this);this.handlerByType={default:t};this.handler=t;this.hasError=false;this.api={main:this.main.bind(this),runCallback:this.runCallback.bind(this),showTree:this.showTree,showMenu:this.showMenu.bind(this),showGeneSearch:this.showGeneSearch,hasError:()=>this.hasError,validateQ:e=>{if(!this.handler||!this.handler.validateQ)return;try{this.handler.validateQ(e)}catch(e){this.hasError=true;throw e}}}}runCallback(e=null){var t,i;const n=this.term?{term:this.term,q:this.q,isAtomic:true}:{};if("$id"in this)n.$id=this.$id;if(((t=n.q)===null||t===void 0?void 0:t.reuseId)&&n.q.reuseId===((i=this.data.q)===null||i===void 0?void 0:i.reuseId)){if(!d(n.q,this.data.q)){delete n.q.reuseId;delete n.q.name}}const r=e?JSON.parse(JSON.stringify(e)):{};if(this.opts.callback)this.opts.callback(e?o(JSON.stringify(n),r):n)}validateOpts(e){const t=Object.assign({},nt,e);if(!t.holder&&t.renderAs!="none")throw".holder missing";if(typeof t.callback!="function")throw".callback() is not a function";if(!t.vocabApi)throw".vocabApi missing";if(typeof t.vocabApi!="object");if("placeholder"in t&&!t.placeholder&&"placeholderIcon"in t&&!t.placeholderIcon)throw"must specify a non-empty opts.placeholder and/or .placeholderIcon";if(!("placeholder"in t))t.placeholder="Select term&nbsp;";if(!("placeholderIcon"in t))t.placeholderIcon="+";if(!Number.isInteger(t.abbrCutoff))t.abbrCutoff=18;this.validateMenuOptions(t);if(!t.numericEditMenuVersion)t.numericEditMenuVersion=["discrete"];this.mayValidate_noTermPromptOptions(t);return t}main(e={}){return i(this,void 0,void 0,(function*(){try{if(this.doNotHideTipInMain){delete this.doNotHideTipInMain}else{this.dom.tip.hide()}this.hasError=false;delete this.error;this.validateMainData(e);this.data=e;this.term=e.term;this.q=JSON.parse(JSON.stringify(e.q));if("$id"in e)this.$id=e.$id;if("disable_terms"in e)this.disable_terms=e.disable_terms;if("filter"in e)this.filter=e.filter;if("activeCohort"in e)this.activeCohort=e.activeCohort;if("sampleCounts"in e)this.sampleCounts=e.sampleCounts;if("menuOptions"in e)this.opts.menuOptions=e.menuOptions;yield this.setHandler(this.term?this.term.type:null);if(e.term&&this.handler&&this.handler.validateQ)this.handler.validateQ(e);if(this.handler.postMain)yield this.handler.postMain();if(this.opts.renderAs!="none")this.updateUI()}catch(e){this.hasError=true;throw e}}))}validateMainData(e){if(e.term){if(!e.term.type)throw"data.term.type missing";if(x(e.term.type)){if(!e.term.id&&e.term.type!=m.SAMPLELST)throw"data.term.id missing";if(!e.term.name)throw"data.term.name missing"}}if(!e.q)e.q={};if(typeof e.q!="object")throw"data.q{} is not object";if(e.disable_terms){if(!Array.isArray(e.disable_terms))throw"data.disable_terms[] is not array"}this.mayValidate_noTermPromptOptions(e)}validateMenuOptions(e){if(!e.menuOptions)e.menuOptions=nt.menuOptions;if(e.menuOptions=="all")e.menuOptions="*";for(const t of["edit","replace","remove"]){if(X(t,e.menuOptions))return}throw`no matches found for termsetting opts.menuOptions='${e.menuOptions}'`}mayValidate_noTermPromptOptions(e){if(!e.noTermPromptOptions)return;if(!Array.isArray(e.noTermPromptOptions))throw"noTermPromptOptions[] is not array";for(const t of e.noTermPromptOptions){if(t.isDictionary);else{if(!t.termtype)throw"element of noTermPromptOptions[] missing both isDictionary=true and .termtype"}if(!t.text&&!t.html)throw"element of noTermPromptOptions[] missing both .text and .html";if(t.q&&typeof t.q!="object")throw"type.q{} is not object"}this.noTermPromptOptions=e.noTermPromptOptions}setHandler(e){return i(this,void 0,void 0,(function*(){if(!e){this.handler=this.handlerByType.default;return}const t=e=="integer"||e=="float"?"numeric":e;if(!this.handlerByType[t]){try{const e=yield ze(`./handlers/${t}.ts`);this.handlerByType[t]=yield e.getHandler(this)}catch(e){throw`error with handler='./handlers/${t}.ts': ${e}`}}this.handler=this.handlerByType[t]}))}}const st=l(rt);function ot(e){e.initUI=()=>{if(e.opts.$id){e.dom.tip.d.attr("id",e.opts.$id+"-ts-tip")}if(!e.dom.holder)return;e.dom.nopilldiv=e.dom.holder.append("div").style("cursor","pointer").on("click",e.clickNoPillDiv).on(`keyup.sjpp-termdb`,(t=>{if(t.key=="Enter")e.showTree(t)}));e.dom.pilldiv=e.dom.holder.append("div");if(e.opts.placeholder){e.dom.nopilldiv.append("div").html(e.placeholder).attr("class","sja_clbtext2").style("padding","3px 6px 3px 6px").style("display","inline-block")}if(e.opts.placeholderIcon){e.dom.nopilldiv.append("div").attr("class","sja_filter_tag_btn add_term_btn").style("padding","3px 6px 3px 6px").style("display","inline-block").style("border-radius","6px").style("background-color","#4888BF").text(e.opts.placeholderIcon)}e.dom.btnDiv=e.dom.holder.append("div");e.dom.content_holder=u(e.dom.holder.node().parentNode).append("div")};e.updateUI=()=>i(this,void 0,void 0,(function*(){e.dom.btnDiv.selectAll("*").remove();e.dom.content_holder.selectAll("*").remove();if(!e.term){e.dom.nopilldiv.style("display","block");e.dom.pilldiv.style("display","none");e.dom.btnDiv.style("display","none");return}if(e.term.hashtmldetail){if(e.opts.buttons&&!e.opts.buttons.includes("info"))e.opts.buttons.unshift("info");else e.opts.buttons=["info"]}else{e.opts.buttons=[]}if(e.opts.buttons.length){e.dom.btnDiv.selectAll("div").data(e.opts.buttons).enter().append("div").style("display","inline-block").style("padding","0px 5px").style("cursor","pointer").style("color","#999").style("font-size",".8em").html((e=>e.toUpperCase())).on("click",((t,i)=>{if(i=="delete")e.removeTerm();else if(i=="replace"){e.showTree(t.target)}else throw"unknown button"}));if(e.term.hashtmldetail){const t=e.dom.btnDiv.selectAll("div").filter((function(){return u(this).text()==="INFO"}));const i=yield import("./termInfo-bf99a37e.js");i.termInfoInit({vocabApi:e.opts.vocabApi,icon_holder:t,content_holder:e.dom.content_holder,id:e.term.id,state:{term:e.term}})}}e.dom.nopilldiv.style("display","none");e.dom.pilldiv.style("display",e.opts.buttons?"inline-block":"block");e.dom.btnDiv.style("display",e.opts.buttons?"inline-block":"none");const t=e.dom.pilldiv.selectAll(".ts_pill").data([e.term],(e=>e.id));t.exit().each(e.exitPill);t.transition().duration(200).each(e.updatePill);t.enter().append("div").attr("class","ts_pill").style("display","grid").style("grid-template-columns","auto").style("grid-template-areas",'"left right"').style("cursor","pointer").style("margin","2px").on("click",e.showMenu).transition().duration(200).each(e.enterPill)}));e.enterPill=function(){return i(this,void 0,void 0,(function*(){const t=u(this);e.dom.pill_termname=t.append("div").attr("class","term_name_btn sja_filter_tag_btn").attr("tabindex",0).style("display","flex").style("grid-area","left").style("position","relative").style("align-items","center").style("padding","3px 6px 3px 6px").style("border-radius","6px").html(e.handler.getPillName).on(`keyup.sjpp-termdb`,(e=>{if(e.key=="Enter")e.target.click()}));e.updatePill.call(this)}))};e.updatePill=function(){return i(this,void 0,void 0,(function*(){const t=u(this);const i=e.handler.getPillStatus()||{};e.dom.pill_termname.style("border-radius",i.text?"6px 0 0 6px":"6px").html(e.handler.getPillName);const n=t.selectAll(".ts_summary_btn").data(i.text?[{txt:i.text}]:[],(e=>e.txt));n.exit().remove();const r=n.enter().append("div").attr("class","ts_summary_btn sja_filter_tag_btn").style("display","flex").style("grid-area","right").style("position","relative").style("align-items","center").style("padding","3px 6px 3px 6px").style("border-radius","0 6px 6px 0").style("font-style","italic").html((e=>e.txt)).style("opacity",0).transition().duration(200).style("opacity",1);if(i.bgcolor){r.transition().duration(200).style("background-color",i.bgcolor)}}))};e.exitPill=function(){u(this).style("opacity",1).transition().duration(e.durations.exit).style("opacity",0).remove()}}function at(e){e.removeTerm=()=>{e.opts.callback(null)};e.cancelGroupsetting=()=>{e.opts.callback({id:e.term.id,term:e.term,q:{mode:"discrete",type:"values",isAtomic:true}})};e.clickNoPillDiv=()=>i(this,void 0,void 0,(function*(){if(!e.noTermPromptOptions||e.noTermPromptOptions.length==0){yield e.showTree(e.dom.nopilldiv.node());return}e.dom.tip.clear().showunder(e.dom.nopilldiv.node());for(const t of e.noTermPromptOptions){const n=e.dom.tip.d.append("div").attr("class","sja_menuoption sja_sharp_border").on("click",(()=>i(this,void 0,void 0,(function*(){e.dom.tip.clear();if(t.isDictionary){yield e.showTree(e.dom.tip.d.node())}else if(t.termtype){if(t.q)e.q=structuredClone(t.q);yield e.setHandler(t.termtype);if(q(e.term)&&!e.term.bins&&e.term.type!="survival"){yield e.vocabApi.setTermBins({term:e.term,q:e.q})}e.handler.showEditMenu(e.dom.tip.d)}else{throw"termtype missing"}}))));if(t.text)n.text(t.text);else if(t.html)n.html(t.html)}}));e.showTree=function(t,n){return i(this,void 0,void 0,(function*(){e.dom.tip.clear();if(t)e.dom.tip.showunder(t instanceof Element?t:this instanceof Element?this:e.dom.holder.node());else e.dom.tip.show(n.clientX,n.clientY);if(!e.usecase)e.usecase={target:"default"};const r=yield import("./app-3320ab6f.js");r.appInit({holder:e.dom.tip.d,vocabApi:e.vocabApi,state:{activeCohort:e.activeCohort,tree:{usecase:e.usecase}},tree:{disable_terms:e.disable_terms,click_term:t=>i(this,void 0,void 0,(function*(){e.dom.tip.hide();let i;if(t.term)i=t;else{const e=t;i={term:e,q:{isAtomic:true},isAtomic:true}}if(e.opts.customFillTw)e.opts.customFillTw(i);yield yt(i,e.vocabApi,e.opts.defaultQ4fillTW);e.opts.callback(i)}))}})}))};e.showMenu=(t,n=null,r=null)=>{var s,o,a;const l=e.dom.tip;l.clear();if(e.opts.renderAs=="none"&&n)e.dom.holder=u(n);if(e.dom.holder){const i=(s=e.dom.holder)===null||s===void 0?void 0:s.node();if(i)l.showunder(i);else l.show(t.clientX,t.clientY)}const p=[];if(e.q.type=="predefined-groupset"||e.q.type=="custom-groupset"){if(e.q.mode!="binary"&&e.term.type!="geneVariant"){p.push({label:"Cancel grouping",callback:e.cancelGroupsetting})}}if(e.q&&!((o=e.term.groupsetting)===null||o===void 0?void 0:o.disabled)&&X("edit",e.opts.menuOptions)){p.push({label:"Edit",callback:t=>i(this,void 0,void 0,(function*(){if(e.term&&q(e.term)&&!e.term.bins&&e.term.type!="survival"){yield e.vocabApi.setTermBins({term:e.term,q:e.q})}e.handler.showEditMenu(t)}))})}if(X("replace",e.opts.menuOptions)){p.push({label:"Replace",callback:e.showTree})}if(X("remove",e.opts.menuOptions)){p.push({label:"Remove",callback:e.removeTerm})}if(e.opts.customMenuOptions)p.push(...e.opts.customMenuOptions);e.openMenu=r||l.d;e.openMenu.selectAll("div").data(p).enter().append("div").attr("class","sja_menuoption sja_sharp_border").attr("tabindex",((e,t)=>t+1)).style("display",e.opts.menuLayout=="horizontal"?"inline-block":"block").text((e=>e.label)).on("click",((t,i)=>{e.dom.tip.clear();i.callback(e.dom.tip.d)})).on("keyup",(e=>{if(e.key=="Enter")e.target.click()}));(a=e.openMenu.select(".sja_menuoption").node())===null||a===void 0?void 0:a.focus()};e.showReuseMenu=function(t){return i(this,void 0,void 0,(function*(){const n=t.append("div");n.style("display","block").style("padding","10px").append("span").style("color","#aaa").html("Save current setting as ");const r=e.vocabApi.getCustomTermQLst(e.term);const s=n.append("input").attr("type","text").attr("placeholder",r.nextReuseId).attr("value",e.q.reuseId||r.nextReuseId);n.append("button").style("margin-left","5px").html("Save").on("click",(()=>{const t=s.property("value").trim()||r.nextReuseId;e.q.reuseId=t;e.vocabApi.cacheTermQ(e.term,e.q);e.runCallback();e.dom.tip.hide()}));const o=t.append("div").style("margin","10px");const a={term:e.term,q:{}};yield ht(a,e.vocabApi);a.q.reuseId="Default";r.push(a.q);if(r.length>1){o.append("div").style("color","#aaa").html("Previously saved settings")}o.append("table").selectAll("tr").data(r).enter().append("tr").style("margin","2px 5px").each((function(t){const n=u(this);const r=lt(e.q,t);const s=t.name||t.reuseId;n.append("td").style("min-width","180px").style("text-align","center").html(s);const o=n.append("td").style("text-align","center");if(r){o.html(`In use <span style='color:#5a5;font-weight:600'>&check;</span>`)}else{o.append("button").style("min-width","80px").html("Use").on("click",(()=>{if(t.reuseId==="Default"){delete t.reuseId;delete t.name}e.q=t;e.dom.tip.hide();e.runCallback()}))}const a=n.append("td").style("text-align","center");if(!r&&t.reuseId!="Default"){a.append("button").style("min-width","80px").html("Delete").on("click",(()=>i(this,void 0,void 0,(function*(){yield e.vocabApi.uncacheTermQ(e.term,t);e.dom.tip.hide();e.runCallback()}))))}}));t.append("div").style("margin","20px 5px 5px 5px").style("padding","5px").style("font-size","0.8em").style("color","#aaa").html(`Saving the setting will allow it to be reused at another chart.<br/>`+`The setting will be reusable in your current or saved session.`)}))};e.showGeneSearch=function(t,n){e.dom.tip.clear();if(t)e.dom.tip.showunder(t instanceof Element?t:this instanceof Element?this:e.dom.holder.node());else e.dom.tip.show(n.clientX,n.clientY);const r=new Set;const s=e.dom.tip.d.append("div").style("padding","5px");const o=s.append("label");o.append("span").text("Search: ");const a=o.append("input").attr("type","text").on("input",(()=>i(this,void 0,void 0,(function*(){const t=a.property("value");try{const i=!t?{lst:[]}:yield e.vocabApi.findTerm(t,e.activeCohort,e.usecase,"gene");l.selectAll("*").remove();l.selectAll("div").data(i.lst.filter((e=>!r.has(e)))).enter().append("div").attr("class","ts_pill sja_filter_tag_btn sja_tree_click_term").style("display","block").style("margin","2px 3px").style("width","fit-content").text((e=>e.name)).on("click",(t=>{e.dom.tip.hide();e.runCallback({term:{name:t.name,type:"geneVariant"},q:{exclude:[]}})}))}catch(e){alert("Search error: "+e)}}))));const l=e.dom.tip.d.append("div").style("margin","5px").style("padding-left","5px").style("border-left","2px solid #ccc")}}function lt(e,t){const i=[e,t].map((e=>JSON.parse(JSON.stringify(e))));for(const e of i){delete e.binLabelFormatter;if(e.reuseId==="Default")delete e.reuseId;if(e.mode==="continuous")delete e.mode;if(e.mode==="discrete"&&e.type=="custom-bin"&&e.lst){for(const t of e.lst){delete t.range}}}return d(...i)}function pt(e){return{showEditMenu(){},getPillStatus(){},getPillName(t){return dt(e,t)}}}function dt(e,t){if(!e.opts.abbrCutoff)return t.name;return t.name.length<=e.opts.abbrCutoff+2?t.name:'<label title="'+t.name+'">'+t.name.substring(0,e.opts.abbrCutoff)+"..."+"</label>"}function ut(e,t,n){return i(this,void 0,void 0,(function*(){yield ct(e,t);const i=[];for(const r of e){i.push(ht(r,t,n))}yield Promise.all(i)}))}function ct(e,t){return i(this,void 0,void 0,(function*(){const i=[];for(const t of e){if(t.term)continue;if(t.id===undefined||t.id==="")throw".id is required";i.push(t.id)}const n=i.length?yield t.getTerms(i):{};for(const t of i){if(!n[t])throw`missing dictionary term for id=${t}`;for(const t of e){if(t.id&&t.id in n)t.term=n[t.id]}}}))}console.warn("--- Using xtw ---");const ft=new Set(["categorical","integer","float"]);function ht(e,t,n){var r;return i(this,void 0,void 0,(function*(){e.isAtomic=true;if(!e.term&&e.id){yield ct([e],t)}if(ft.has((r=e.term)===null||r===void 0?void 0:r.type)){const i=yield Xe.fill(e,{vocabApi:t,defaultQByTsHandler:n});Object.assign(e,i);gt(e);if(!e.$id)e.$id=yield Ke(t.getTwMinCopy(e));if(e.q)e.q.isAtomic=true;return e}delete e.id;if(!e.q)e.q={};e.q.isAtomic=true;mt(e);yield yt(e,t,n);gt(e);if(!e.$id)e.$id=yield Ke(t.getTwMinCopy(e));return e}))}function mt(e){if(Object.keys(e.q).includes("groupsetting")){if(e.q["groupsetting"]["inuse"]){if(e.q.type=="predefined-groupset"){e.q["predefined_groupset_idx"]=e.q["groupsetting"]["predefined_groupset_idx"]}else if(e.q.type=="custom-groupset"){e.q["customset"]=e.q["groupsetting"]["customset"]}else{throw"invalid q.type"}}else{e.q.type="values"}delete e.q["groupsetting"]}}function yt(e,t,n){return i(this,void 0,void 0,(function*(){if(!e.$id)e.$id=yield Ke(t.getTwMinCopy(e));const i=e.term.type;const r=i=="float"||i=="integer"?"numeric":i;let s;if(e.term.type){try{s=yield Fe(`./handlers/${r}.ts`)}catch(e){throw`Type ${r} does not exist`}}else throw`Type not defined for ${JSON.stringify(e)}`;yield s.fillTW(e,t,n?n[r]:null)}))}function gt(e){if(!("mode"in e.q)){return}if(typeof e.q.mode!="string")throw"q.mode not string"}function vt(e,t){if(!e.hiddenValues){e.hiddenValues={};if(t.values){for(const i in t.values){if(t.values[i].uncomputable)e.hiddenValues[i]=1}}}}export{h as N,f as R,m as T,T as a,x as b,Oe as c,E as d,S as e,ht as f,Ke as g,st as h,q as i,je as j,y as k,Xe as l,ut as m,b as n,dt as o,Ce as r,vt as s,g as t};
@@ -0,0 +1 @@
1
+ import{M as t,B as e,ap as s,aq as a,ar as n,z as i,an as o,as as r,at as l,bL as c,I as d,V as f,u as m,b as u,ak as p,D as h,n as g,r as w,aN as b,d as k,be as x,aG as v,W as y,aQ as _,aR as j,aP as M,bE as A,bD as S}from"./app-b369b169.js";import{l as q}from"./block.legend-d3f61ef7.js";import{s as C,m as z}from"./regression.results-69bc42d0.js";import{a as L}from"./axisstyle-fac7f76b.js";import{c as $,b as N}from"./axis-747c801e.js";import{r as R}from"./table-29d5a973.js";import{d as O}from"./arc-3d6751aa.js";import{m as I}from"./block-6aedd569.js";import{t as D}from"./downloadTextfile-5723af95.js";import{T}from"./toggleButtons-dbdbad01.js";import{m as B}from"./radiobutton-09bff425.js";import{v as F}from"./vcf-5cc55588.js";import{n as U}from"./niceNumLabels-238aabce.js";import{f as G}from"./termsetting-33ea66f1.js";import{r as P}from"./rehydrateFilter-12d118cb.js";const E="white",H="black";const V="Unannotated";function W(e,s){if(!e.legend)e.legend={};e.legend.tip=new t({padding:"0px"});const[a,n,i]=q(s,e.name);e.legend.headTd=i;e.tr_legend=a;const o=n.append("table").style("border-spacing","5px").style("border-collapse","separate");e.legend.table=o;K(e,s);Q(e);X(e);J(e);nt(e);lt(e);dt(e)}function K(t,e){if(!t.legend.mclass)t.legend.mclass={};if(!t.legend.mclass.hiddenvalues)t.legend.mclass.hiddenvalues=new Set;t.legend.mclass.row=t.legend.table.append("tr");t.legend.mclass.row.append("td").style("text-align","right").style("opacity",.7).text(e.mclassOverride?e.mclassOverride.className||"Mutation":"Mutation");t.legend.mclass.holder=t.legend.mclass.row.append("td")}function Q(t){if(!t.variantShapeName)return;const e=t.legend.table.append("tr").append("td").attr("colspan",2);const s=t.legend.variantShapeName={};{const a=e.append("div");a.append("span").html(`<svg style="display:inline-block" width=12 height=12>\n\t\t\t<circle cx=6 cy=6 r=6 fill=gray></circle></svg> n=`);s.dotCount=a.append("span");if(t.variantShapeName.dot)a.append("span").text(", "+t.variantShapeName.dot);s.dotDiv=a}{const a=e.append("div");a.append("span").html(`<svg style="display:inline-block" width=12 height=12>\n\t\t\t<path d="M 6 0 L 0 12 h 12 Z" fill=gray></path></svg> n=`);s.triangleCount=a.append("span");if(t.variantShapeName.triangle)a.append("span").text(", "+t.variantShapeName.triangle);s.triangleDiv=a}{const a=e.append("div");a.append("span").html(`<svg style="display:inline-block" width=13 height=13>\n\t\t\t<circle cx=6.5 cy=6.5 r=6 stroke=gray fill=none></circle></svg> n=`);s.circleCount=a.append("span");if(t.variantShapeName.circle)a.append("span").text(", "+t.variantShapeName.circle);s.circleDiv=a}}function X(t){if(!t.mds.bcf?.info)return;const e=[];for(const s in t.mds.bcf.info){const a=t.mds.bcf.info[s];if(a.categories){e.push(s)}}if(!e.length)return;if(!t.legend.bcfInfo)t.legend.bcfInfo={};for(const s of e){const e=t.legend.table.append("tr");e.append("td").style("text-align","right").style("opacity",.7).text(t.mds.bcf.info[s].name||s);t.legend.bcfInfo[s]={hiddenvalues:new Set,row:e,holder:e.append("td")}}}function J(t){if(!t.mds.bcf?.format)return;const e=[];for(const s in t.mds.bcf.format){if(t.mds.bcf.format[s].isFilter)e.push(s)}if(!e.length)return;if(!t.legend.formatFilter)t.legend.formatFilter={};for(const s of e){const e=t.legend.table.append("tr");e.append("td").style("text-align","right").style("opacity",.7).text(t.mds.bcf.format[s].Description);t.legend.formatFilter[s]={hiddenvalues:new Set,row:e,holder:e.append("td")}}}function Y(t,e){if(!e.legend.formatFilter)return;if(!t.skewer){console.log("data.skewer[] is not present and cannot show INFO legend");return}for(const s in e.legend.formatFilter){e.legend.formatFilter[s].holder.selectAll("*").remove();const a=new Map;let n=0;for(const e of t.skewer){if(!e.formatK2count?.[s])continue;for(const t in e.formatK2count[s].v2c){a.set(t,e.formatK2count[s].v2c[t]+(a.get(t)||0))}n+=e.formatK2count[s].unannotatedCount||0}const i=[...a];i.sort(((t,e)=>e[1]-t[1]));if(n){i.push([V,n])}for(const[t,a]of i){const n=e.legend.formatFilter[s].holder.append("div").attr("class","sja_clb").style("display","inline-block").on("click",(()=>{e.legend.tip.clear().showunder(n.node()).d.append("div").attr("class","sja_menuoption").text("Hide").on("click",(()=>{e.legend.formatFilter[s].hiddenvalues.add(t);Z(e)}));e.legend.tip.d.append("div").attr("class","sja_menuoption").text("Show only").on("click",(()=>{for(const t of i){e.legend.formatFilter[s].hiddenvalues.add(t[0])}e.legend.formatFilter[s].hiddenvalues.delete(t);Z(e)}));if(e.legend.formatFilter[s].hiddenvalues.size){e.legend.tip.d.append("div").attr("class","sja_menuoption").text("Show all").on("click",(()=>{e.legend.formatFilter[s].hiddenvalues.clear();Z(e)}))}}));n.append("div").style("display","inline-block").attr("class","sja_mcdot").style("background","#aaa").style("margin-right","5px").html(a>1?a:"&nbsp;");n.append("div").style("display","inline-block").text(t)}for(const t of e.legend.formatFilter[s].hiddenvalues){let a=false;e.legend.formatFilter[s].holder.append("div").style("display","inline-block").attr("class","sja_clb").style("text-decoration","line-through").style("opacity",.7).text(t).on("click",(async()=>{if(a)return;a=true;e.legend.formatFilter[s].hiddenvalues.delete(t);Z(e)}))}}}function Z(t){t.legend.tip.hide();t.load()}function tt(t,e,s){if(!e.legend){return}e.legend.mclass.currentData=t.mclass2variantcount;at(e);et(t,e);st(t,e);Y(t,e);ot(t,e);ct(e);ft(e)}function et(t,e){if(!e.variantShapeName)return;let s=0,a=0,n=0;for(const e of t.skewer){if(e.shapeTriangle)a++;else if(e.shapeCircle)n++;else s++}const i=e.legend.variantShapeName;i.dotDiv.style("display",s?"block":"none");i.triangleDiv.style("display",a?"block":"none");i.circleDiv.style("display",n?"block":"none");i.dotCount.text(s);i.triangleCount.text(a);i.circleCount.text(n)}function st(t,e){if(!e.legend.bcfInfo)return;if(!t.skewer){console.log("data.skewer[] is not present and cannot show INFO legend");return}for(const s in e.legend.bcfInfo){e.legend.bcfInfo[s].holder.selectAll("*").remove();if(e.mds.bcf.info[s].Type=="String"){const a=new Map;for(const e of t.skewer){const t=s in e.info?e.info[s]:V;if(Array.isArray(t)){for(const e of t){a.set(e,1+(a.get(e)||0))}}else{a.set(t,1+(a.get(t)||0))}}const n=[...a].sort(((t,e)=>e[1]-t[1]));for(const[t,a]of n){const i=e.legend.bcfInfo[s].holder.append("div").attr("class","sja_clb").style("display","inline-block").on("click",(()=>{e.legend.tip.clear().showunder(i.node()).d.append("div").attr("class","sja_menuoption").text("Hide").on("click",(()=>{e.legend.bcfInfo[s].hiddenvalues.add(t);Z(e)}));e.legend.tip.d.append("div").attr("class","sja_menuoption").text("Show only").on("click",(()=>{for(const t of n){e.legend.bcfInfo[s].hiddenvalues.add(t[0])}e.legend.bcfInfo[s].hiddenvalues.delete(t);Z(e)}));if(e.legend.bcfInfo[s].hiddenvalues.size){e.legend.tip.d.append("div").attr("class","sja_menuoption").text("Show all").on("click",(()=>{e.legend.bcfInfo[s].hiddenvalues.clear();Z(e)}))}const a=e.mds.bcf.info[s].categories?.[t]?.desc;if(a){e.legend.tip.d.append("div").style("padding","10px").style("font-size",".8em").style("width","150px").html(a)}}));i.append("div").style("display","inline-block").attr("class","sja_mcdot").style("background",e.mds.bcf.info[s].categories?.[t]?.color||E).html(a>1?a:"&nbsp;");i.append("div").style("display","inline-block").style("color",e.mds.bcf.info[s].categories?.[t]?.color||H).style("padding-left","5px").text(e.mds.bcf.info[s].categories?.[t]?.label||t)}for(const t of e.legend.bcfInfo[s].hiddenvalues){let a=false;e.legend.bcfInfo[s].holder.append("div").style("display","inline-block").attr("class","sja_clb").style("text-decoration","line-through").text(t).on("click",(async()=>{if(a)return;a=true;e.legend.bcfInfo[s].hiddenvalues.delete(t);Z(e)}))}}}}function at(t){if(!t.legend.mclass.currentData||t.legend.mclass.currentData.length==0)return;t.legend.mclass.holder.selectAll("*").remove();const c=[],d=[];for(const[e,s]of t.legend.mclass.currentData){const a={k:e,count:s};if(t.legend.mclass.hiddenvalues.has(e)){d.push(a)}else{c.push(a)}}c.sort(((t,e)=>e.count-t.count));d.sort(((t,e)=>e.count-t.count));for(const e of t.legend.mclass.hiddenvalues){if(!d.find((t=>t.k==e))){d.push({k:e})}}for(const f of c){let m,u,p="#858585";if(Number.isInteger(f.k)){m=e[f.k];if(f.k==s){u="Copy number variation."}else if(f.k==a){u="Loss of heterozygosity."}else if(f.k==n){p=i[o].color;u="Internal tandem duplication."}else if(f.k==r){u="Structural variation of DNA."}else if(f.k==l){u="Fusion gene from RNA-seq."}}else{m=i[f.k].label;p=i[f.k].color;u=i[f.k].desc}const h=t.legend.mclass.holder.append("div").attr("class","sja_clb").style("display","inline-block").on("click",(e=>{t.legend.tip.clear().showunder(e.target).d.append("div").attr("class","sja_menuoption").text("Hide").on("click",(()=>{t.legend.mclass.hiddenvalues.add(f.k);Z(t)}));t.legend.tip.d.append("div").attr("class","sja_menuoption").text("Show only").on("click",(()=>{for(const e of c){t.legend.mclass.hiddenvalues.add(e.k)}t.legend.mclass.hiddenvalues.delete(f.k);Z(t)}));if(d.length){t.legend.tip.d.append("div").attr("class","sja_menuoption").text("Show all").on("click",(()=>{t.legend.mclass.hiddenvalues.clear();Z(t)}))}t.legend.tip.d.append("div").style("padding","10px").style("font-size",".8em").style("width","150px").html(u)}));h.append("div").style("display","inline-block").attr("class","sja_mcdot").style("background",p).html(f.count>1?f.count:"&nbsp;");h.append("div").style("display","inline-block").style("color",p).html("&nbsp;"+m)}for(const s of d){let a=false;t.legend.mclass.holder.append("div").style("display","inline-block").attr("class","sja_clb").style("text-decoration","line-through").style("opacity",.7).text((s.count?"("+s.count+") ":"")+(Number.isInteger(s.k)?e[s.k]:i[s.k].label)).on("click",(async e=>{if(a)return;a=true;t.legend.mclass.hiddenvalues.delete(s.k);e.target.innerHTML="Updating...";await t.load()}))}}function nt(t,e){if(!t.mds.queries?.snvindel?.skewerRim)return;const s=t.legend.skewerRim={};if(!t.mds.queries.snvindel.skewerRim.hiddenvaluelst)t.mds.queries.snvindel.skewerRim.hiddenvaluelst=[];s.row=t.legend.table.append("tr");s.headerTd=s.row.append("td").style("text-align","right").style("opacity",.7);s.holder=s.row.append("td")}function it(t){const e=t.mds.queries.snvindel.skewerRim;if(e.type=="format"){if(!e.formatKey)throw"skewerRim.formatKey missing";return t.mds.bcf?.format?.[e.formatKey]?.Description||e.formatKey}return"unknown skewerRim.type"}function ot(t,e){const s=e.mds.queries?.snvindel?.skewerRim;if(!s)return;let a=0,n=0;for(const e of t.skewer){const t=e.rim1count||0;a+=t;n+=e.occurrence-t}const i=e.legend.skewerRim;i.headerTd.text(it(e));i.holder.selectAll("*").remove();if(a>0){i.holder.append("div").attr("class","sja_clb").style("display","inline-block").html(`${rt(1)}${s.rim1value}, n=${a}`).on("click",(t=>{e.legend.tip.clear().showunder(t.target).d.append("div").attr("class","sja_menuoption").text("Hide").on("click",(()=>{s.hiddenvaluelst.push(s.rim1value);Z(e)}))}))}if(n>0){i.holder.append("div").attr("class","sja_clb").style("display","inline-block").html(`${rt()}${s.noRimValue}, n=${n}`).on("click",(t=>{e.legend.tip.clear().showunder(t.target).d.append("div").attr("class","sja_menuoption").text("Hide").on("click",(()=>{s.hiddenvaluelst.push(s.noRimValue);Z(e)}))}))}for(const t of s.hiddenvaluelst){let a=false;i.holder.append("div").style("display","inline-block").attr("class","sja_clb").style("text-decoration","line-through").style("opacity",.7).text(t).on("click",(async n=>{if(a)return;a=true;s.hiddenvaluelst.splice(s.hiddenvaluelst.indexOf(t),1);n.target.innerHTML="Updating...";await e.load()}))}}function rt(t){return'<svg width="19" height="19" style="margin-right: 5px;">'+'<circle cx="7" cy="12" r="7" fill="#b1b1b1"></circle>'+(t==1?'<path d="M6.735557395310443e-16,-11A11,11 0 0,1 11,0L9,0A9,9 0 0,0 5.51091059616309e-16,-9Z" transform="translate(7,12)" fill="#858585" stroke="none"></path>':t==2?"":"")+"</svg>"}function lt(t,e){if(!t.mds.queries?.ld)return;t.mds.queries.ld.colorScale=c(t.mds.queries.ld.overlay.color_0,t.mds.queries.ld.overlay.color_1);const s=t.legend.ld={};s.row=t.legend.table.append("tr");s.headerTd=s.row.append("td").style("text-align","right").style("opacity",.7);s.holder=s.row.append("td");s.showHolder=s.holder.append("div").style("display","none");C(s.showHolder,t.mds.queries.ld.colorScale);s.showHolder.append("span").text("Cancel overlay").style("font-size",".7em").attr("class","sja_clbtext").on("click",(()=>{delete t.mds.queries.ld.mOverlay;if(t.skewer?.hlssmid)delete t.skewer.hlssmid;t.load()}))}function ct(t){if(!t.mds.queries?.ld?.mOverlay){if(t.legend.ld){t.legend.ld.headerTd.html("");t.legend.ld.showHolder.style("display","none")}return}t.legend.ld.headerTd.html(t.mds.queries.ld.mOverlay.ldtkname+" LD r<sup>2</sup>");t.legend.ld.showHolder.style("display","block")}function dt(t,e){if(!t.cnv)return;const s=t.legend.cnv={};s.row=t.legend.table.append("tr");s.headerTd=s.row.append("td").style("text-align","right").style("opacity",.7).text("CNV");s.holder=s.row.append("td");s.showHolder=s.holder.append("div").style("display","none")}function ft(t){if(!t.cnv)return;t.legend.cnv.holder.selectAll("*").remove();const e=t.legend.cnv.holder.append("svg");const s=20;const a=15;const n=10;const i=150;L({axis:e.append("g").attr("transform","translate("+n+","+s+")").call($().scale(d().domain([-t.cnv.absoluteMax,t.cnv.absoluteMax]).range([0,i])).ticks(4)),fontsize:12});const o="grad"+Math.random();const r=e.append("defs").append("linearGradient").attr("id",o);r.append("stop").attr("offset","0%").attr("stop-color",t.cnv.lossColor);r.append("stop").attr("offset","50%").attr("stop-color","white");r.append("stop").attr("offset","100%").attr("stop-color",t.cnv.gainColor);e.append("rect").attr("x",n).attr("y",s).attr("width",i).attr("height",a).attr("fill",`url(#${o})`);e.attr("width",n*2+i).attr("height",s+a)}function mt(t){if(t.lst.length==0){return"No filter"}if(t.lst.length==1&&t.lst[0].type=="tvs"){const e=t.lst[0].tvs;if(!e)throw"f.lst[0].tvs{} missing";const s=e?.term?.type;if(s=="categorical"){if(!Array.isArray(e.values))throw"f.lst[0].tvs.values not array";const t=e.values[0]?.key;if(t==undefined)throw"f.lst[0].tvs.values[0].key missing";const s=e.term.values?.[t]?.label||t;if(e.values.length==1){if((e.term.name+s).length<20){return e.term.name+(e.isnot?"!=":": ")+s}return(e.isnot?"!":"")+(s.length<15?s:s.substring(0,13)+"...")}return`${e.isnot?"!":""}${s.length<12?s:s.substring(0,10)+"..."} (${e.values.length})`}if(s=="integer"||s=="float"||s=="geneExpression"||s=="metaboliteIntensity"){return ut(e)}throw"unknown tvs term type"}return"Filter ("+t.lst.length+")"}function ut(t){if(!Array.isArray(t.ranges))throw"tvs.ranges not array";if(!t.ranges[0])throw"tvs.ranges[] blank array";const e=t.ranges[0];let s,a;const n=t.term.valueConversion;if(n){if("start"in e)s=f(e.start,n.fromUnit,n.toUnit,n.scaleFactor,true);if("stop"in e)a=f(e.stop,n.fromUnit,n.toUnit,n.scaleFactor,true)}else{if(t.term.type=="integer"){if("start"in e)s=Math.round(e.start);if("stop"in e)a=Math.round(e.stop)}else{if("start"in e)s=e.start;if("stop"in e)a=e.stop;if("start"in e&&"stop"in e){[s,a]=U([s,a])}}}let i;if(t.isnot){if(e.startunbounded)i=`x ${e.stopinclusive?">":">="} ${a}`;else if(e.stopunbounded)i=`x ${e.startinclusive?"<":"<="} ${s}`;else i=`!(${s} ${a})`}else{if(e.startunbounded)i=`x ${e.stopinclusive?"<=":"<"} ${a}`;else if(e.stopunbounded)i=`x ${e.startinclusive?">=":">"} ${s}`;else i=`${s}${e.startinclusive?"<=":"<"}x${e.stopinclusive?"<=":"<"}${a}`}if(t.ranges.length>1)i+="...";return i}async function pt(e,s){e.subtk2height={};e.leftlabels={g:e.gleft.append("g"),doms:{},laby:0,xoff:0,maxwidth:0};e._finish=ht(e,s);e.cache={};e.itemtip=new t;e.menutip=new t({padding:""});e.load=Ct(e,s);e.mnamegetter=t=>{if(e.mds.queries?.snvindel?.vcfid4skewerName&&t.vcf_id)return t.vcf_id;const s=t.mname;if(!s)return"";if(s.length>25){return s.substr(0,20)+"..."}return s};await vt(e,s);await _t(e,s);await At(e,s);jt(e,s);Mt(e,s);wt(e);bt(e);if(e.filterObj)await Promise.all(P(e.filterObj,e.mds.termdb.vocabApi));e.tklabel.text(e.mds.label||e.name);e.clear=()=>{if(e.skewer)e.skewer.g.selectAll("*").remove()};W(e,s);xt(e);e.color4disc=t=>{if(e.mutationColorBy){if(e.mutationColorBy=="hardcode"){if(t.color)return t.color}}if(e.mds.queries?.ld?.mOverlay?.data){const s=e.mds.queries.ld.mOverlay.m;if(t.chr==s.chr&&t.pos==s.pos&&t.ref==s.ref&&t.alt==s.alt){return e.mds.queries.ld.overlay.color_1}for(const s of e.mds.queries.ld.mOverlay.data){if(s.pos==t.pos&&s.alleles==t.ref+"."+t.alt){return e.mds.queries.ld.colorScale(s.r2)}}return e.mds.queries.ld.overlay.color_0}if(e.vcfinfofilter&&e.vcfinfofilter.setidx4mclass!=undefined){const s=e.vcfinfofilter.lst[e.vcfinfofilter.setidx4mclass];const[a,n]=zt(s,t);if(a||n==undefined)return"black";for(const t of n){if(s.categories[t]){return s.categories[t].color}else{return"black"}}}if(i[t.class]){return i[t.class].color}return"black"};gt(e);if(e.hlssmid){e.skewer.hlssmid=new Set(e.hlssmid.split(","));delete e.hlssmid}try{It(e)}catch(t){console.error(t)}}function ht(t,e){return s=>{t.legend?.headTd.text(t.name+(t.filterObj?" - "+mt(t.filterObj):""));if(t.cnv){t.cnv.g.transition().attr("transform",`translate(0,${t.subtk2height.skewer||0})`)}if(s){if(s.error){t.subtk2height.skewer=40}else{let a=0;if(s.skewer)a=s.skewer.length;if(s.cnv)a+=s.cnv.length;if(a==0){let s="view range";if(e.usegm&&e.gmmode!="genomic")s=e.usegm.name||e.usegm.isoform;t.skewer.g.append("text").text("No mutation in "+s).attr("y",25).attr("x",e.width/2).attr("text-anchor","middle").attr("dominant-baseline","center");t.subtk2height.skewer=40}}}t.height_main=Math.max(t.subtk2height.leftlabels||0,t.subtk2height.skewer+(t.subtk2height.cnv||0))+t.toppad+t.bottompad;if(s){tt(s,t)}t.leftLabelMaxwidth=Math.max(t.leftlabels.maxwidth+t.leftlabels.xoff,t.skewer?t.skewer.maxwidth:0);e.tkcloakoff(t,{error:s?s.error:null});e.block_setheight();e.setllabel();if(typeof t.callbackOnRender=="function"){t.callbackOnRender(t,e)}}}function gt(t){const e=m();if(t.skewer){if(e.has("hlaachange")){t.hlaachange=e.get("hlaachange")}if(e.has("hlssmid")){t.hlssmid=e.get("hlssmid").split(",")}}}function wt(t){if(!t.mds.has_skewer)return;t.skewer={g:t.glider.append("g"),hlBoxColor:t.mds.hlBoxColor||"red",hideDotLabels:false,pointup:true};kt(t)}function bt(t){let e=t.mds.termdbConfig?.queries?.cnv;if(!e){if(t.mds.has_cnv){e={}}}if(!e)return;t.cnv={g:t.glider.append("g"),cnvMaxLength:e.cnvMaxLength,cnvGainCutoff:e.cnvGainCutoff,cnvLossCutoff:e.cnvLossCutoff,absoluteValueRenderMax:e.absoluteValueRenderMax||5,gainColor:e.gainColor||"#D6683C",lossColor:e.lossColor||"#67a9cf"}}function kt(t){t.skewer.viewModes=t.skewerModes;delete t.skewerModes;if(!t.skewer.viewModes)t.skewer.viewModes=[];const e=t.skewer.viewModes;if(!Array.isArray(e))throw"skewerModes[] is not array";if(t.mds.skewerModes){for(const s of t.mds.skewerModes)e.push(s)}if(!e.find((t=>t.type=="skewer")))e.push({type:"skewer"});for(const t of e){if(typeof t!="object")throw"one of skewerModes[] is not object";if(t.type=="skewer"){if(!t.label)t.label="lollipops"}else if(t.type=="numeric"){if(t.byAttribute){if(!t.label)t.label=t.byAttribute}else if(t.byInfo);else{throw"unknown data method for a type=numeric mode"}}else{throw"unknown type from a skewerModes[]"}}if(!e.find((t=>t.inuse)))e[0].inuse=true}function xt(t){if(t.mds.hiddenmclass){for(const e of t.mds.hiddenmclass)t.legend.mclass.hiddenvalues.add(e)}}async function vt(t,e){if(t.dslabel){const s=await u("getDataset",{body:{genome:e.genome.name,dsname:t.dslabel}});if(s.error)throw"Error: "+s.error;if(!s.ds)throw"data.ds{} missing";t.mds=s.ds;t.name=s.ds.label;return}if(!t.name)t.name="Custom data";t.mds={};if(t.bcf){if(!t.bcf.file&&!t.bcf.url)throw"file or url missing for tk.bcf{}";t.mds.has_skewer=true;await Ot(t,e.genome)}else if(t.custom_variants){Lt(t,e);Rt(t)}else{throw"unknown data source for custom track"}yt(t)}function yt(t){if(!t.sampleAnnotation)return;if(!Array.isArray(t.sampleAnnotation.terms))throw"sampleAnnotation.terms is not array";if(!t.mds.termdb)t.mds.termdb={};t.mds.termdb.terms=t.sampleAnnotation.terms;t.mds.termdb.annotations=t.sampleAnnotation.annotations}async function _t(t,e){const s=t.mds.termdb;if(!s)return;{const a={};if(t.mds.label){a.vocab={genome:e.genome.name,dslabel:t.mds.label}}else if(s.terms){a.vocab={terms:s.terms,sampleannotation:s.annotations}}else{throw"do not know how to init vocab"}const n=await import("./FilterRxComp-701a1480.js").then((function(t){return t.k}));s.vocabApi=n.vocabInit(a);if(!s.vocabApi.app){s.vocabApi.app={opts:{genome:e.genome}}}}t.mds.termdbConfig=await s.vocabApi.getTermdbConfig();if(t.mds.termdb.allowCaseDetails){t.mds.termdb.allowCaseDetails.get=async t=>{}}}function jt(t,e){if(!t.mds.queries?.snvindel?.m2csq)return;t.mds.queries.snvindel.m2csq.get=async s=>{const a={genome:e.genome.name,dslabel:t.mds.label,m2csq:1};if(t.mds.queries.snvindel.m2csq.by=="ssm_id"){a.ssm_id=s.ssm_id}else{return{error:"unknown query method"}}const n={"Content-Type":"application/json",Accept:"application/json"};if(t.token)n["X-Auth-Token"]=t.token;return await u("mds3",{body:a,headers:n},{serverData:t.cache})}}function Mt(t,e){if(!t.mds.queries?.singleSampleMutation)return;t.mds.queries.singleSampleMutation.get=async s=>{const a={genome:e.genome.name,dslabel:t.mds.label,sample:s};const n={"Content-Type":"application/json",Accept:"application/json"};if(t.token)n["X-Auth-Token"]=t.token;const i=await u("termdb/singleSampleMutation",{body:a,headers:n});if(i.error)throw i.error;if(!Array.isArray(i.mlst))throw"data.mlst is not array";return i.mlst}}async function At(t,e){if(!t.mds.variant2samples)return;if(t.custom_variants){St(t)}else{qt(t,e)}if(t.mds.variant2samples.twLst){if(!Array.isArray(t.mds.variant2samples.twLst))throw"v2s.twLst[] not array";if(!t.mds.termdb?.vocabApi)throw"mds.termdb.vocabApi should be present for initiating v2s.twLst";for(const e of t.mds.variant2samples.twLst)await G(e,t.mds.termdb.vocabApi)}}function St(t,e){t.mds.variant2samples.get=e=>{if(e.querytype==t.mds.variant2samples.type_samples){const t=[];for(const s of e.mlst){if(!s.samples)continue;for(const e of s.samples){const a=JSON.parse(JSON.stringify(e));a.ssm_id=s.ssm_id;t.push(a)}}return{samples:t}}if(e.querytype==t.mds.variant2samples.type_summary){throw"todo: summary"}if(e.querytype==t.mds.variant2samples.type_sunburst){throw"todo: sunburst"}throw"unknown querytype"};t.mds.getSamples=()=>{const e=new Map;for(const s of t.custom_variants){if(!s.samples)continue;for(const t of s.samples){if(e.has(t.sample_id)){e.get(t.sample_id).ssm_id_lst.push(s.ssm_id)}else{const a=JSON.parse(JSON.stringify(t));a.ssm_id_lst=[s.ssm_id];e.set(t.sample_id,a)}}}return{samples:[...e.values()]}}}function qt(t,e){t.mds.variant2samples.get=async s=>{const a={genome:e.genome.name,variant2samples:1,get:s.querytype};if(t.mds.label){a.dslabel=t.mds.label}else if(t.bcf){if(t.bcf.file)a.bcffile=t.bcf.file;else if(t.bcf.url)a.bcfurl=t.bcf.url;else throw"tk.bcf{}: file/url missing"}else{throw"no dslabel or tk.bcf"}if(s.groupSsmBySample){a.groupSsmBySample=1}if(s.mlst){if(t.mds.variant2samples.variantkey=="ssm_id"){a.ssm_id_lst=s.mlst.map((t=>t.ssm_id)).join(",")}else{throw"unknown variantkey for variant2samples"}}if(s.isoform){a.isoform=s.isoform}if(s.rglst){a.rglst=s.rglst}const n={"Content-Type":"application/json",Accept:"application/json"};if(t.set_id)a.set_id=t.set_id;if(t.token)n["X-Auth-Token"]=t.token;if(t.filter0)a.filter0=t.filter0;if(t.filterObj)a.filterObj=t.filterObj;if(s.tid2value)a.tid2value=s.tid2value;if(s.querytype==t.mds.variant2samples.type_sunburst){if(t.mds.variant2samples.sunburst_twLst){a.twLst=t.mds.variant2samples.sunburst_twLst}}else if(s.querytype==t.mds.variant2samples.type_samples){if(t.mds.variant2samples.twLst)a.twLst=t.mds.variant2samples.twLst}else if(s.querytype==t.mds.variant2samples.type_summary){if(t.mds.variant2samples.twLst)a.twLst=t.mds.variant2samples.twLst}else{throw"unknown querytype"}a.skewerRim=t.mds.queries.snvindel?.skewerRim;if(t.legend.formatFilter){const e={};for(const s in t.legend.formatFilter){if(t.legend.formatFilter[s].hiddenvalues.size){e[s]=[...t.legend.formatFilter[s].hiddenvalues]}}if(Object.keys(e).length){a.formatFilter=e}}if(t.legend.mclass?.hiddenvalues?.size){a.hiddenmclasslst=[...t.legend.mclass.hiddenvalues].join(",")}const i=await u("mds3",{body:a,headers:n},{serverData:t.cache});if(i.error)throw i.error;const o=i.variant2samples;if(!o)throw"result error";if(s.querytype==t.mds.variant2samples.type_sunburst){if(!Array.isArray(o.nodes))throw"nodes[] not array from return"}else if(s.querytype==t.mds.variant2samples.type_samples){if(!Array.isArray(o.samples))throw"samples[] not array from return"}else if(s.querytype==t.mds.variant2samples.type_summary){if(!Array.isArray(o.summary))throw"summary[] not array from return"}else{throw"unknown querytype"}return o};t.mds.getSamples=async(s={})=>{if(s.isSummary){s.querytype=t.mds.variant2samples.type_summary}else{s.querytype=t.mds.variant2samples.type_samples;s.groupSsmBySample=1}Cs(t,e,s);return await t.mds.variant2samples.get(s)}}function Ct(t,e){return async()=>await As(t,e)}function zt(t,e){if(t.altalleleinfo){if(!e.altinfo)return["no .altinfo"];const s=e.altinfo[t.altalleleinfo.key];if(s==undefined){if(t.numericfilter){return[null,[0]]}return[null,undefined]}let a=Array.isArray(s)?s:[s];if(t.altalleleinfo.separator){a=a[0].split(t.altalleleinfo.separator)}return[null,a]}if(t.locusinfo){if(!e.info)return["no .info"];const s=e.info[t.locusinfo.key];if(s==undefined){if(t.numericfilter){return[null,[0]]}return[null,undefined]}let a=Array.isArray(s)?s:[s];if(t.locusinfo.separator){a=a[0].split(t.locusinfo.separator)}return[null,a]}return["no trigger"]}function Lt(t,e){for(const a of t.custom_variants){if(a.dt==p){t.mds.has_skewer=true;$t(a);continue}if(a.dt==l||a.dt==r){t.mds.has_skewer=true;Nt(a,e);continue}if(a.dt==s){t.mds.has_cnv=true;a.ssm_id=a.chr+"."+a.start+"."+a.stop+"."+a.class;continue}throw"unknown dt for a custom variant"}}function $t(t){if(!t.chr)throw".chr missing for custom snvindel";if(!Number.isInteger(t.pos))throw".pos not integer for custom snvindel";if(!t.ssm_id){t.ssm_id=t.chr+"."+t.pos+"."+(t.ref&&t.alt?t.ref+"."+t.alt:t.mname)}}function Nt(t,e){if(t.pairlst);else{if(!t.chr1)throw".chr1 missing for custom sv/fusion";if(!Number.isInteger(t.pos1))throw".pos1 not integer for custom svfusion";if(t.strand1!="+"&&t.strand1!="-")throw".strand1 not +/- for custom svfusion";if(!t.chr2)throw".chr1 missing for custom sv/fusion";if(!Number.isInteger(t.pos2))throw".pos1 not integer for custom svfusion";if(t.strand2!="+"&&t.strand2!="-")throw".strand1 not +/- for custom svfusion";t.pairlst=[{a:{chr:t.chr1,pos:t.pos1,strand:t.strand1,name:t.gene1||""},b:{chr:t.chr2,pos:t.pos2,strand:t.strand2,name:t.gene2||""}}];delete t.chr1;delete t.pos1;delete t.strand1;delete t.gene1;delete t.chr2;delete t.pos2;delete t.strand2;delete t.gene2}const s=[t.dt];const a=e.seekcoord(t.pairlst[0].a.chr,t.pairlst[0].a.pos);if(a.length&&a[0].x>0&&a[0].x<e.width){s.push(...[t.pairlst[0].a.chr,t.pairlst[0].a.pos,t.pairlst[0].a.strand,0,t.pairlst[0].a.name]);t.mname=t.pairlst[0].b.name||"";t.chr=t.pairlst[0].a.chr;t.pos=t.pairlst[0].a.pos;t.pairlstIdx=0}else{const a=e.seekcoord(t.pairlst[0].b.chr,t.pairlst[0].b.pos);if(a.length&&a[0].x>0&&a[0].x<e.width){s.push(...[t.pairlst[0].b.chr,t.pairlst[0].b.pos,t.pairlst[0].b.strand,1,t.pairlst[0].b.name]);t.mname=t.pairlst[0].a.name||"";t.chr=t.pairlst[0].b.chr;t.pos=t.pairlst[0].b.pos;t.pairlstIdx=1}}t.ssm_id=s.join(".")}function Rt(t){if(t.custom_variants.find((t=>t.occurrence!=undefined))){return}for(const e of t.custom_variants){if(e.sample){e.sample_id=e.sample;delete e.sample}}if(!t.custom_variants.find((t=>t.sample_id))){return}const e=[];const s=new Map;for(const a of t.custom_variants){if(a.dt!=p){a.occurrence=1;a.samples=[{sample_id:a.sample_id}];delete a.sample_id;e.push(a);continue}const t=a.mname+"."+a.chr+"."+a.pos+"."+a.ref+"."+a.alt;const n=s.get(t);if(n){n.occurrence++;n.samples.push({sample_id:a.sample_id})}else{a.occurrence=1;a.samples=[{sample_id:a.sample_id}];delete a.sample_id;s.set(t,a)}}t.custom_variants=e;for(const e of s.values())t.custom_variants.push(e);if(!t.mds.variant2samples)t.mds.variant2samples={};const a=t.mds.variant2samples;a.type_samples="samples";a.type_summary="summary";a.type_sunburst="sunburst"}async function Ot(t,e){const s={genome:e.name};if(t.bcf.file){s.file=t.bcf.file}else{s.url=t.bcf.url;if(t.bcf.indexURL)s.indexURL=t.bcf.indexURL}const a=await u("vcfheader",{body:s});if(a.error)throw a.error;const[n,i,o,r]=F(a.metastr.split("\n"));if(r)throw"Error parsing VCF meta lines: "+r.join("; ");t.mds.bcf={info:n,format:i};if(o?.length){t.mds.bcf.samples=o;t.mds.variant2samples={type_samples:"samples",variantkey:"ssm_id"}}if(!t.mds.queries)t.mds.queries={};t.mds.queries.snvindel={forTrack:true}}function It(t){const e=t.allow2selectSamples;if(!e)return;if(!e.buttonText)e.buttonText="Select samples";if(typeof e.buttonText!="string")throw"allow2selectSamples.buttonText value is not string";if(!e.attributes)e.attributes=[{from:"sample_id",to:"sample_id"}];if(!Array.isArray(e.attributes))throw"allow2selectSamples.attributes[] is not array";if(e.attributes.length==0)throw"allow2selectSamples.attributes[] blank array";for(const t of e.attributes){if(typeof t.from!="string"||!t.from)throw"allow2selectSamples.attributes.from is not string";if(typeof t.to!="string"||!t.to)throw"allow2selectSamples.attributes.to is not string"}if(typeof e.callback!="function")throw"allow2selectSamples.callback() is not function";e._cart=[]}async function Dt(t){for(const e of t.mlst){if(e.dt!=p&&e.dt!=l&&e.dt!=r&&e.dt!=s)throw"mlst[] contains unknown dt"}if(t.mlst.length==1){await Bt(t)}else{await Ft(t)}Tt(t)}function Tt(t){if(!t.tipDiv){return}const e=[];for(const s of t.div.selectAll("div").selectAll("table")){if(s)e.push(s)}if(!e.length)return;let s=0;for(const t of e){const e=t.firstChild;if(e.tagName!="THEAD")continue;const a=e.firstChild;if(a.tagName!="TR")continue;s=Math.max(s,a.childNodes?.length)}if(s>5){t.tipDiv.style("left","50px")}}async function Bt(t){const e=h({holder:t.div});const a=t.mlst[0];if(a.dt==p){Ut(t,e)}else if(a.dt==r||a.dt==l){await Wt(t,e)}else if(a.dt==s){Kt(t,e)}else{throw"oneItem: unknown dt"}t.singleSampleDiv=e;if(t.tk.mds.variant2samples){if(a.occurrence){await Zt(t)}}}async function Ft(t){const e=t.div.append("div").style("margin-bottom","10px").style("display","none");e.append("span").html("&#8810; Back to list").attr("class","sja_clbtext").on("click",(()=>{m.style("display","");e.style("display","none");a.style("display","none")}));const a=t.div.append("div").style("display","none");const n=[{label:"Click a variant to see details"}];const o=t.mlst.some((t=>t.occurrence));if(o){n.push({label:"Occurrence"})}let c=null;if(t.tk.mds.bcf?.info){c=[];for(const e in t.tk.mds.bcf.info){if(t.tk.mds.bcf.info[e].categories){c.push(e);n.push({label:t.tk.mds.bcf.info[e].name||e})}}if(c.length==0)c=null}let d;if(t.tk.skewer){d=t.tk.skewer.viewModes.find((t=>t.inuse&&t.type=="numeric"&&t.byAttribute!="occurrence"));if(d){n.push({label:d.label})}}t.mlst.sort(((t,e)=>t.__x-e.__x));const f=[];for(const e of t.mlst){const s=[{}];if(o){s.push({value:"occurrence"in e?e.occurrence:""})}if(c){for(const a of c){const n=e.info[a];if(n==undefined){s.push({})}else{const e=t.tk.mds.bcf.info[a].categories[n];if(e?.color){s.push({html:`<span style="background:${e.color}">&nbsp;&nbsp;</span> ${e.label||n}`})}else{s.push({value:n})}}}}if(d){s.push({value:e[d.byAttribute]})}f.push(s)}const m=t.div.append("div");R({div:m,columns:n,rows:f,striped:false,resize:true});for(const[n,o]of t.mlst.entries()){const c=f[n][0].__td.append("div").attr("class","sja_menuoption").on("click",(()=>{m.style("display","none");e.style("display","");a.style("display","").selectAll("*").remove();const s=Object.assign({},t);s.mlst=[o];s.div=a;Dt(s)}));if(o.dt==p){c.append("span").text(t.tk.mnamegetter(o));c.append("span").text(i[o.class].label).style("font-size",".8em").style("margin-left","10px").style("color",i[o.class].color);c.append("span").text(`${o.chr}:${o.pos+1}${o.ref?", "+o.ref+">"+o.alt:""}`).style("font-size",".8em").style("margin-left","10px")}else if(o.dt==r||o.dt==l){c.append("span").text(i[o.class].label).style("font-size",".7em").style("margin-right","8px");Qt(o.pairlst[0],c)}else if(o.dt==s){c.append("span").style("background",t.tk.cnv.colorScale(o.value)).text(o.value).style("font-size",".8em").style("padding","0px 3px");c.append("span").style("margin-left","10px").text(`${o.chr}:${o.start}-${o.stop}`)}else{c.text("error: unknown m.dt")}}if(!t.doNotListSample4multim&&t.tk.mds.variant2samples){const e=t.mlst.reduce(((t,e)=>t+(e.occurrence||0)),0);if(e){t.div.append("div").style("margin-top","10px").append("span").attr("class","sja_clbtext").text("List all samples").on("click",(async e=>{e.target.remove();m.remove();await Zt(t);Tt(t)}))}}}function Ut({mlst:t,tk:e,block:s},a){const n=t[0];{const[t,e]=a.addRow();t.text(s.mclassOverride?s.mclassOverride.className:"Consequence");Ht(e,n)}{const[t,i]=a.addRow();t.text(n.ref&&n.alt?"Mutation":"Position");Vt(i,n,e,s)}if(n.occurrence>1){const[t,e]=a.addRow();t.text("Occurrence");e.text(n.occurrence)}Gt(n,e,a);Pt(n,e,a);Yt(n,e,a);if(n.info){for(const t in n.info){if(t=="CSQ"){continue}const[s,i]=a.addRow();s.text(t);const o=n.info[t];const r=e.mds?.bcf?.info?.[t];if(Array.isArray(o)){for(const t of o){Et(n,r,t,i)}}else{Et(n,r,o,i)}if(r?.Description){i.append("span").style("margin-left","10px").style("font-size",".8em").style("opacity",.6).text(r.Description)}}}}function Gt(t,e,s){const a=e.skewer.viewModes.find((t=>t.inuse));if(a.type!="numeric"||a.byAttribute=="occurrence")return;if(a.tooltipPrintValue){const e=a.tooltipPrintValue(t);if(Array.isArray(e)){for(const t of e){const[e,a]=s.addRow();e.text(t.k);a.text(t.v)}}else{console.log("unknown return value")}return}const[n,i]=s.addRow();n.text(a.label);i.text(t.__value_missing?"NA":t.__value_use)}function Pt(t,e,s){if(!t.htmlSections)return;if(!Array.isArray(t.htmlSections))throw"htmlSections[] is not array";for(const e of t.htmlSections){const[t,a]=s.addRow();if(e.key&&e.html){t.text(e.key);a.html(e.html)}}}function Et(t,e,s,a,n){if(!e){a.append("span").text(s);return}if(e.urlBase){a.append("a").text(s).attr("href",e.urlBase+s).attr("target","_blank");return}const i=a.append("span").text(s);if(e&&e.categories){const t=e.categories[s];if(t){i.style("padding","1px 4px").style("background",t.color);if(t.textcolor){i.style("color",t.textcolor)}}}}function Ht(t,e){t.append("span").text(e.mname);t.append("span").style("margin-left","5px").style("color",i[e.class].color).style("font-size",".8em").text(i[e.class].label.toUpperCase())}function Vt(t,e,s,a){const n=t.append("span").text(`${e.chr}:${e.pos+1} ${e.ref&&e.alt?e.ref+">"+e.alt:""}`);const i=s.mds.termdbConfig?.urlTemplates?.ssm||s.mds.queries?.snvindel?.ssmUrl;if(i){const s=z(i,e,n,a.genome.name);if(s?.length){t.append("span").style("margin-left","10px").html(s.join(" "))}}}async function Wt(t,e){await Xt(t.mlst[0],e.scrollDiv.insert("div",":first-child"),t.block);{const[s,a]=e.addRow();s.text("Data type");a.text(i[t.mlst[0].class].label)}{const[s,a]=e.addRow();s.text("Break points");for(const e of t.mlst[0].pairlst){Qt(e,a.append("div"))}}}function Kt(t,e){const s=t.mlst[0];{const[a,n]=e.addRow();a.text("Copy number change");n.html(`<span style="background:${t.tk.cnv.colorScale(s.value)}">&nbsp;&nbsp;</span> ${s.value}`)}{const[t,a]=e.addRow();t.text("Position");a.text(s.chr+":"+s.start+"-"+s.stop)}if(s.samples){const[t,a]=e.addRow();t.text("Sample");for(const t of s.samples){a.append("div").text(t.sample_id)}}}function Qt(t,e){if(t.a.name)e.append("span").text(t.a.name).style("font-weight","bold").style("margin-right","5px");e.append("span").text(`${t.a.chr}:${t.a.pos} ${t.a.strand=="+"?"forward":"reverse"} > ${t.b.chr}:${t.b.pos} ${t.b.strand=="+"?"forward":"reverse"}`);if(t.b.name)e.append("span").text(t.b.name).style("font-weight","bold").style("margin-left","5px")}async function Xt(t,e,s){const a=e.append("div").text("Loading...");try{if(!t.pairlst)throw".pairlst[] missing";const n={a:{chr:t.pairlst[0].a.chr,position:t.pairlst[0].a.pos,strand:t.pairlst[0].a.strand},b:{chr:t.pairlst[0].b.chr,position:t.pairlst[0].b.pos,strand:t.pairlst[0].b.strand}};await Jt(n.a,s);await Jt(n.b,s);a.remove();const i=await import("./svgraph-6fac8cbc.js");i.default({pairlst:[n],genome:s.genome,holder:e})}catch(t){a.text(t.message||t)}}async function Jt(t,e){const s=await u("isoformbycoord",{body:{genome:e.genome.name,chr:t.chr,pos:t.position}});if(s.error)throw s.error;const a=s.lst.find((t=>t.isdefault))||s.lst[0];if(a){t.name=a.name;t.gm={isoform:a.isoform}}}function Yt(t,e,s){if(!e.mds.queries?.ld)return;const[a,n]=s.addRow();a.text("LD overlay");const i=e.mds.queries.ld.mOverlay?.m;if(i){const s=n.append("div").style("margin-bottom","5px");if(t.ssm_id==i.ssm_id){s.html(e.mds.queries.ld.mOverlay.ldtkname+" r<sup>2</sup> values against this variant are displayed on all the other variants.")}else{let a=null;for(const s of e.mds.queries.ld.mOverlay.data||[]){if(s.pos==t.pos&&s.alleles==t.ref+"."+t.alt){a=s.r2;break}}if(a==null){s.html("No r<sup>2</sup> value is found.")}else{s.html(e.mds.queries.ld.mOverlay.ldtkname+" r<sup>2</sup> = "+a)}}}n.append("div").html("Click a button to overlay LD r<sup>2</sup> values against this variant:").style("font-size",".8em").style("opacity",.5);for(const s of e.mds.queries.ld.tracks){const a=n.append("button").text(s.name);if(i&&i.ssm_id==t.ssm_id){if(s.name==e.mds.queries.ld.mOverlay.ldtkname){a.property("disabled",true);continue}}a.on("click",(()=>{e.itemtip.hide();e.mds.queries.ld.mOverlay={ldtkname:s.name,m:{chr:t.chr,pos:t.pos,ref:t.ref,alt:t.alt,ssm_id:t.ssm_id}};e.load()}))}}async function Zt(t){const e=t.div.append("div").text("Loading...").style("padding","10px").style("color","#8AB1D4").style("font-size","1.25em").style("font-weight","bold");t.tid2value_orig=new Set;if(t.tid2value)Object.keys(t.tid2value).forEach(t.tid2value_orig.add,t.tid2value_orig);try{t.querytype=t.tk.mds.variant2samples.type_samples;const s=await t.tk.mds.variant2samples.get(t);await te(s.samples,t);e.remove()}catch(t){e.text("Error: "+(t.message||t));if(t.stack)console.log(t.stack)}}async function te(t,e){if(t.length==1){return await se(t[0],e)}const[s,a]=await oe(t,e.tk);const n={rows:a,columns:s,div:e.div,resize:a.length>10,dataTestId:"sjpp_mds3tk_sampletable"};n.columnButtons=[];if(e.tk.mds.queries?.singleSampleMutation){const s={text:"Disco",dataTestId:"sja_sample_table_disco_button",callback:async(s,a)=>{e.tk.itemtip.hide();e.tk.menutip.hide();let n;if(t[a].ssm_id_lst?.[0]){n=(e.tk.skewer.rawmlst||e.tk.custom_variants).find((e=>e.ssm_id==t[a].ssm_id_lst[0]))}await ie(e.tk,e.block,t[a],n)}};n.columnButtons.push(s)}if(e.tk.mds.queries?.singleSampleGenomeQuantification){for(const s in e.tk.mds.queries.singleSampleGenomeQuantification){const a={text:s,dataTestId:`${s}_button`,callback:async(a,n)=>{const i=g(e.tk.newChartHolder||e.block.holder0);i.header.text(t[n].sample_id);await(await import("./plot.ssgq-5581dc56.js")).plotSingleSampleGenomeQuantification(e.tk.mds,e.tk.mds.label,s,t[n],i.body.append("div").style("margin","20px"),e.block.genome,e.block.usegm?.name)}};n.columnButtons.push(a)}}if(e.tk.allow2selectSamples){n.buttons=[{text:e.tk.allow2selectSamples.buttonText,class:e.tk.allow2selectSamples.class,callback:s=>{ee(e.tk,e.block,t,s);e.tk.itemtip.hide();e.tk.menutip.hide()}}]}return R(n)}async function ee(t,e,s,a){const n=[...s];const i=a.map((t=>n[t]));t.allow2selectSamples.callback({samples:await t.mds.termdb.vocabApi.convertSampleId(i,t.allow2selectSamples.attributes),source:"Samples with "+le(e)})}async function se(t,e){const s=e.singleSampleDiv||h({holder:e.div});if(t.sample_id){const[a,n]=s.addRow();a.text(e.tk.mds.termdbConfig?.lollipop?.sample||"Sample");let i;if(t.ssm_id_lst?.[0]){i=e.tk.skewer.rawmlst.find((e=>e.ssm_id==t.ssm_id_lst[0]))}ne(t,e.tk,n,e.block,i)}if("caseIsOpenAccess"in t){const[e,a]=s.addRow();e.text("Access");a.text(t.caseIsOpenAccess?"Open":"Controlled")}if(e.tk.mds.variant2samples.twLst){for(const a of e.tk.mds.variant2samples.twLst){const[e,n]=s.addRow();e.text(a.term.name).style("text-overflow","ellipsis");n.style("text-overflow","ellipsis");if(a.term.id in t){if(Array.isArray(t[a.term.id])){if(a.baseURL){n.html(t[a.term.id].map((t=>`<a href=${a.baseURL+t} target=_blank>${t}</a>`)).join("<br>"))}else{n.html(t[a.term.id].join("<br>"))}}else{const e=ae(t,a);if(a.baseURL){n.html(`<a href=${a.baseURL+e} target=_blank>${e}</a>`)}else{n.text(e)}}}}}if(t.ssmid2format){for(const a of t.ssm_id_lst){if(t.ssm_id_lst.length>1){const[t,n]=s.addRow();n.style("padding-top","20px");const i=e.tk.skewer.rawmlst.find((t=>t.ssm_id==a));if(i){if(i.dt==p){Vt(n,i,e.tk,e.block)}else if(i.dt==r||i.dt==l){Qt(i.pairlst[0],n)}else{n.text(a)}}else{n.text(a)}}for(const n in t.ssmid2format[a]){const i=t.ssmid2format[a][n];const[o,r]=s.addRow();const l=e.tk.mds?.bcf?.format?.[n];o.text(l&&l.Description||n);r.html(re(l,i))}}}}function ae(t,e){if(!(e.term.id in t))return"";const s=t[e.term.id];if(e.term.values?.[s]?.label)return e.term.values[s].label;const a=e.term.valueConversion;if(a)return f(s,a.fromUnit,a.toUnit,a.scaleFactor);return s}function ne(t,e,s,a,n){const i=e.mds.termdbConfig?.urlTemplates?.sample;if(i){const e=s.append("a");e.attr("href",i.base+(t[i.namekey]||t.sample_id));e.attr("target","_blank");e.text(t.sample_id);e.style("word-break","break-word")}else{s.append("span").attr("class","pp_mds3_singleSampleNameSpan").text(t.sample_id)}const o=s.append("div");if(e.allow2selectSamples){const s=e.allow2selectSamples.buttonText;const n=o.append("button").style("margin-right","10px").text(s.endsWith("s")?s.substring(0,s.length-1):s).on("click",(()=>{ee(e,a,[t],[0]);e.itemtip.hide();e.menutip.hide()}));if(e.allow2selectSamples.class)n.attr("class",e.allow2selectSamples.class)}if(e.mds.queries?.singleSampleMutation){o.append("button").style("margin-right","10px").text("Disco plot").attr("data-testid","proteinpaint_disc_table_disco_button").on("click",(async()=>{e.itemtip.hide();await ie(e,a,t,n)}))}if(e.mds.queries?.singleSampleGenomeQuantification){for(const s in e.mds.queries.singleSampleGenomeQuantification){o.append("button").text(s).on("click",(async()=>{const n=g(e.newChartHolder||a.holder0);n.header.text(t.sample_id);await(await import("./plot.ssgq-5581dc56.js")).plotSingleSampleGenomeQuantification(e.mds,e.mds.label,s,t,n.body.append("div").style("margin","20px"),a.genome,a.usegm?.name)}))}}}async function ie(t,e,s,a){const n=g(t.newChartHolder||e.holder0);const i=[s.sample_id];if(a){i.push(", with ");if(e.usegm){i.push(e.usegm.name)}else{i.push(a.isoform)}i.push(" "+a.mname)}n.header.text(i.join(""));try{(await import("./plot.disco-6011f87f.js")).default(t.mds,t.mds.label,s,n.body,e.genome,{downloadImgName:i.join("")+" Disco",Disco:{prioritizeGeneLabelsByGeneSets:true}})}catch(t){n.body.append("div").text("Error: "+(t.message||t));if(t.stack)console.log(t.stack)}}async function oe(t,e){const s=t.some((t=>"caseIsOpenAccess"in t)),a=t.some((t=>t.ssm_id))||t.some((t=>t.ssm_id_lst)),n=t.some((t=>t.ssmid2format))&&e.mds?.bcf?.format;const o=new Set;const c=[{label:e.mds.termdbConfig?.lollipop?.sample||"Sample"}],d=[];if(s){c.push({label:"Access"})}if(e.mds.variant2samples.twLst){for(const t of e.mds.variant2samples.twLst){const e={label:t.term.name};c.push(e)}}if(a){c.push({label:"Mutations",isSsm:true})}if(n){for(const e of t){if(!e.ssmid2format)continue;for(const t in e.ssmid2format){for(const s in e.ssmid2format[t])o.add(s)}}for(const t in e.mds.bcf.format){if(!o.has(t))continue;const s=e.mds.bcf.format[t];c.push({label:s.Description||t})}}for(const c of t){const t=[{value:c.sample_id}];let f=c.ssm_id_lst;if(!f&&c.ssm_id)f=[c.ssm_id];{const s=e.mds.termdbConfig?.urlTemplates?.sample;if(s){t[0].url=s.base+(c[s.namekey]||c.sample_id)}}if(s){t.push({value:c.caseIsOpenAccess?"Open":"Controlled"})}if(e.mds.variant2samples.twLst){for(const s of e.mds.variant2samples.twLst){const e=ae(c,s);if(s.baseURL){t.push({html:`<a href=${s.baseURL+e} target=_blank>${e}</a>`})}else{t.push({value:e})}}}if(a){if(f){const s=[];for(const t of f){const a=[];const n=(e.skewer.rawmlst||e.custom_variants).find((e=>e.ssm_id==t));if(n){if(n.dt==p){if(e.mds.queries&&e.mds.queries.snvindel&&e.mds.queries.snvindel.url){a.push(`<a href=${e.mds.queries.snvindel.url.base+n.ssm_id} target=_blank>${n.mname}</a>`)}else{a.push(n.mname)}}else if(n.dt==r||n.dt==l){const t=n.pairlst[0];a.push(`${t.a.name||""} ${t.a.chr}:${t.a.pos} ${t.a.strand=="+"?"forward":"reverse"} > ${t.b.name||""} ${t.b.chr}:${t.b.pos} ${t.b.strand=="+"?"forward":"reverse"}`)}else{throw"unknown dt"}a.push(`<span style="color:${w(i[n.class].color).darker()};font-size:0.8em;">${i[n.class].label}</span>`);s.push(a.join(" "))}else{s.push(t)}}t.push({html:s.join("<br>")})}else{t.push({value:""})}}if(n){if(!f)throw"ssm_id_lst missing, cannot show format";for(const s in e.mds.bcf.format){if(!o.has(s))continue;if(!c.ssmid2format){t.push({value:""});continue}const a=e.mds.bcf.format[s];const n=[];for(const t of f){const e=c.ssmid2format?.[t]?.[s];n.push(re(a,e))}t.push({html:n.join("<br>")})}}d.push(t)}return[c,d]}function re(t,e){if(t&&e&&t.Number=="R"&&t.Type=="Integer"){const t=e.split(",").map(Number);if(t.length==2){const[e,s]=t;if(e>=0&&s>=0&&e+s>0){return`${b(null,{f:s/(s+e)})} <span style="font-size:.8em">${s}/${s+e}</span>`}}}return e}function le(t){if(t.gmmode=="genomic"){const e=t.rglst[0];return"mutations from "+e.chr+":"+e.start+"-"+e.stop}if(t.usegm)return"mutations in "+t.usegm.name;return"mutations"}const ce=10;async function de(t,e,s,a,n){try{if(e.click_snvindel){e.skewer.hlssmid=new Set(t.mlst.map((t=>t.ssm_id)));qe(e);e.click_snvindel(t.mlst[0]);return}if("occurrence"in t&&t.occurrence>=ce&&e.mds.variant2samples&&e.mds.variant2samples.sunburst_twLst){await fe(t,e,s,a);return}await me({mlst:t.mlst,tk:e,block:s,tippos:a})}catch(t){s.error(t.message||t);if(t.stack)console.log(t.stack)}}async function fe(t,e,s,a){e.glider.style("cursor","wait");const n=await e.mds.variant2samples.get({mlst:t.mlst,querytype:e.mds.variant2samples.type_sunburst});e.glider.style("cursor","auto");const i={nodes:n.nodes,occurrence:t.occurrence,boxyoff:e.yoff,boxheight:Math.min(800,e.height),boxwidth:s.width,svgheight:Number.parseFloat(s.svg.attr("height")),g:e.skewer.g.append("g"),pica:e.pica,click_listbutton:(n,i)=>{me({mlst:t.mlst,tk:e,block:s,tippos:a})},click_ring:async(a,n)=>{e.itemtip.clear();const i={mlst:t.mlst,tk:e,block:s,div:e.itemtip.d,tid2value:{}};i.tid2value[n.data.id0]=n.data.v0;if(n.data.id1)i.tid2value[n.data.id1]=n.data.v1;if(n.data.id2)i.tid2value[n.data.id2]=n.data.v2;i.mlst=t.mlst.map((t=>{if(e.mds.variant2samples.variantkey=="ssm_id"){return{ssm_id:t.ssm_id,occurrence:0}}throw"unknown variant2samples.variantkey"}));i.mlst[0].occurrence=n.value;const o=a.clientX;const r=a.clientY;await Zt(i);e.itemtip.show2(o,r)}};if(t.aa){i.cx=t.aa.x;i.cy=xe(t,e)+t.yoffset*(e.skewer.pointup?-1:1)}else{i.cx=t.x;i.cy=t.y+(e.skewer.pointup?1:-1)*e.skewer.stem1/2}if(t.mlst.length==1){i.chartlabel=t.mlst[0].mname}else{const e=new Set(t.mlst.map((t=>t.mname)));if(e.size==1){i.chartlabel=[...e][0]}else{i.chartlabel=t.mlst.reduce(((t,e)=>e.occurrence>t.occurrence?e:t)).mname+" etc"}}const o=await import("./sunburst-533902a7.js");o.default(i)}async function me(t){t.tk.itemtip.clear().show(t.tippos.left-10,t.tippos.top-10);t.div=t.tk.itemtip.d;t.tipDiv=t.tk.itemtip.d;await Dt(t)}const ue=0;const pe=1;const he=.3;const ge=1;const we=.6;const be="Arial";function ke(t,e){const s=t.skewer;for(const t of s.data){t.x0=t.x;if(t.xoffset!=undefined){t.x=t.x0+t.xoffset}for(const e of t.groups){e.aa=t}}const a=Math.max(14,e.width/110);let n=0;for(const t of s.data){for(const e of t.groups){n=Math.max(n,e.occurrence)}}let i=0;const o=Math.pow(a/2,2)*Math.PI;if(n<=10)i=o*n*.9;else if(n<=100)i=o*10;else if(n<=1e3)i=o*14;else i=o*20;const c=d().domain([1,n*.5,n*.6,n*.7,n*.8,n]).range([o,o+(i-o)*.8,o+(i-o)*.85,o+(i-o)*.9,o+(i-o)*.95,i]);let f=a/2;s.maxheight=0;for(const t of s.data){if(t.showmode==undefined)t.showmode=ue;if(t.slabelrotate==undefined)t.slabelrotate=false;t.maxradius=0;t.maxrimwidth=0;t.width=0;t.slabelwidth=0;for(const e of t.groups){if(e.occurrence<=1){e.radius=a/2}else{const t=e.occurrence.toString().length;e.radius=Math.max(Math.sqrt(c(e.occurrence)/Math.PI),t*5)}t.maxradius=Math.max(t.maxradius,e.radius);f=Math.max(f,e.radius);e.rimwidth=e.rim1count+e.rim2count==0?0:Math.max(2,e.radius/6);t.maxrimwidth=Math.max(t.maxrimwidth,e.rimwidth)}let e=0;for(const s of t.groups){s.yoffset=e+s.radius+s.rimwidth;e+=(s.radius+s.rimwidth)*2}s.maxheight=Math.max(s.maxheight,e)}s.selection=s.g.selectAll().data(s.data).enter().append("g").attr("class","sja_skg").each((function(t){t.skewer=this}));const m=s.selection.selectAll().data((t=>t.groups)).enter().append("g").attr("transform",(e=>"translate(0,"+(e.aa.showmode==ue?0:e.yoffset*(t.skewer.pointup?-1:1))+")")).attr("class","sja_aa_discg").each((function(t){t.g=this}));const u=m.append("circle");u.filter((t=>t.dt==p||t.dt==r||t.dt==l)).attr("fill",(e=>t.color4disc(e.mlst[0]))).attr("stroke","white").attr("r",(t=>t.radius-.5));m.filter((t=>t.dt==l||t.dt==r)).append("path").attr("fill","white").attr("stroke","none").attr("d",(t=>O()({innerRadius:0,outerRadius:t.radius-2,startAngle:t.useNterm?0:Math.PI,endAngle:t.useNterm?Math.PI:Math.PI*2})));const h=m.filter((t=>t.occurrence>1)).append("text").text((t=>t.occurrence)).attr("font-family",be).attr("class","sja_aa_discnum").attr("fill-opacity",(t=>t.aa.showmode==ue?0:1)).attr("stroke-opacity",(t=>t.aa.showmode==ue?0:1)).attr("text-anchor","middle").each((t=>{const e=t.radius*1.5;t.discnumfontsize=Math.min(e/(t.occurrence.toString().length*we),e)})).attr("font-size",(t=>t.discnumfontsize)).attr("y",(t=>t.discnumfontsize*he));h.filter((t=>t.dt==p)).attr("fill","white");h.filter((t=>t.dt==r||t.dt==l)).attr("stroke",(e=>t.color4disc(e.mlst[0]))).attr("stroke-width",.8).attr("font-weight","bold").attr("fill","white");m.append("text").text((e=>e.mnameCompact||t.mnamegetter(e.mlst[0]))).attr("font-size",(t=>{t._labfontsize=Math.max(12,t.radius*1.2);return t._labfontsize})).each((function(t){const e=this.getBBox().width;t._label_width=e;if(t.aa.groups.length==1){t.aa.slabelrotate=true;t.aa.slabelwidth=e;s.maxheight=Math.max(s.maxheight,(t.radius+t.rimwidth)*2+2+e)}})).attr("fill",(e=>t.color4disc(e.mlst[0]))).attr("x",(t=>t.radius+t.rimwidth+1)).attr("y",(t=>t._labfontsize*he)).attr("font-family",be).classed("sja_aa_disclabel",true).attr("fill-opacity",(t=>t.aa.showmode==ue?0:1)).attr("transform","scale(1) rotate(0)").on("mousedown",(t=>{t.stopPropagation()})).on("click",((s,a)=>{Se([a.aa],t);je(t,e)}));s.hlBoxG=m.append("g");for(const t of s.data){let e=0,s=0;for(const a of t.groups){e=Math.max(e,a.radius+a.rimwidth);s=Math.max(s,a.radius+a.rimwidth+ge+a._label_width)}t.width=e+s}m.append("circle").attr("r",(t=>t.radius-.5)).attr("stroke",(e=>t.color4disc(e.mlst[0]))).attr("class","sja_aa_disckick").attr("fill","white").attr("fill-opacity",0).attr("stroke-opacity",0).on("mousedown",(t=>{t.stopPropagation()})).on("mouseover",((e,s)=>{if(t.disc_mouseover){t.disc_mouseover(s,e.target)}})).on("mouseout",((e,s)=>{if(t.disc_mouseout){t.disc_mouseout(s)}})).on("click",(async(s,a)=>{de(a,t,e,s.target.getBoundingClientRect(),s.target)}));const g=O().innerRadius((t=>t.radius)).outerRadius((t=>t.radius+t.rimwidth)).startAngle(0).endAngle((t=>{t.rim1_startangle=Math.PI*2*t.rim1count/t.occurrence;return t.rim1_startangle}));m.filter((t=>t.rim1count>0)).append("path").attr("d",g).attr("fill",(e=>t.color4disc(e.mlst[0]))).attr("class","sja_aa_discrim").attr("fill-opacity",0);const w=O().innerRadius((t=>t.radius+.5)).outerRadius((t=>t.radius+.5+t.rimwidth)).startAngle((t=>t.rim1_startangle)).endAngle((t=>t.rim1_startangle+Math.PI*2*t.rim2count/t.occurrence));m.filter((t=>t.rim2count>0)).append("path").attr("d",w).attr("stroke",(e=>t.color4disc(e.mlst[0]))).attr("fill","none").attr("class","sja_aa_discrim").attr("stroke-opacity",0);{let t=0;let e=0;for(const a of s.data){if(a.x-a.maxradius-a.maxrimwidth<e){t++}e=Math.max(e,a.x+a.width-a.maxradius-a.maxrimwidth)}s.stem1=t==0?0:a;s.stem2=d().domain([0,1,s.data.length]).range([0,a,a*3])(t)}const b=a*.7;let x=0;for(const t of s.data){for(const e of t.groups){x=Math.max(x,e.occurrence)}}s.stem3=Math.max(2,b+a*Math.min(5,x));s.selection.append("circle").attr("class","sja_aa_skkick").attr("fill","white").attr("fill-opacity",0).attr("stroke","none").attr("r",(t=>t.maxradius+1)).attr("cy",(e=>(t.skewer.pointup?-1:1)*e.maxradius)).attr("transform",(t=>`scale(${t.showmode==ue?"1,1":"0.01,0.01"})`)).on("mouseover",((e,s)=>{let a=0;let n=0;const i=5;const o=t.skewer.pointup?7:14;for(const e of s.groups){e.pica_fontsize=Math.max(11,e.radius);a+=e.pica_fontsize+1;t.pica.g.append("text").text((e.mnameCompact||e.mlst[0].mname)+(e.occurrence>1?" x"+e.occurrence:"")).attr("font-size",e.pica_fontsize).each((function(){n=Math.max(n,this.getBBox().width)})).remove()}n+=i*2;const r=a+5;t.pica.g.append("rect").attr("y",t.skewer.pointup?-r:0).attr("width",n).attr("height",r).attr("fill","white").attr("fill-opacity",.8).attr("stroke","#ccc").attr("shape-rendering","crispEdges");a=0;const l=t.pica.g.selectAll().data(s.groups).enter().append("g").attr("transform",((e,s)=>{a+=e.pica_fontsize+1;return"translate("+i+","+a*(t.skewer.pointup?-1:1)+")"}));l.append("text").text((t=>t.mnameCompact||t.mlst[0].mname)).attr("font-size",(t=>t.pica_fontsize)).each((function(t){t.pica_mlabelwidth=this.getBBox().width})).attr("fill",(e=>t.color4disc(e.mlst[0]))).attr("dominant-baseline",t.skewer.pointup?"hanging":"auto");const c=s.groups[0].pica_mlabelwidth;t.pica.x=s.x-i-c/2;t.pica.y=s.y+(t.skewer.pointup?-1:1)*(s.maxradius*2+o+2);t.pica.g.attr("transform","translate("+t.pica.x+","+t.pica.y+")");l.filter((t=>t.occurrence>1)).append("text").text((t=>"x"+t.occurrence)).attr("x",(t=>t.pica_mlabelwidth+5)).attr("font-size",(t=>t.pica_fontsize)).attr("dominant-baseline",t.skewer.pointup?"hanging":"auto").attr("fill","#9e9e9e");const d=t.pica.g.append("g").attr("transform","translate("+(i+c/2)+","+(t.skewer.pointup?1:-1)+")");d.append("line").attr("y2",(t.skewer.pointup?1:-1)*o).attr("stroke","#858585").attr("shape-rendering","crispEdges");d.append("line").attr("x1",-1).attr("x2",-1).attr("y2",(t.skewer.pointup?1:-1)*o).attr("stroke","white").attr("shape-rendering","crispEdges");d.append("line").attr("x1",1).attr("x2",1).attr("y2",(t.skewer.pointup?1:-1)*o).attr("stroke","white").attr("shape-rendering","crispEdges")})).on("mouseout",((e,s)=>{t.pica.g.selectAll("*").remove()})).on("click",((s,a)=>{t.pica.g.selectAll("*").remove();_e([a],t,e)}));let v=0;for(const t of s.data){v=Math.max(v,t.occurrence)}const y=d().domain([1,v]).range([b,s.stem3-f]);s.selection.attr("transform",(e=>{e.foldyoffset=y(e.occurrence);e.y=xe(e,t);return"translate("+e.x+","+e.y+")"}));s.selection.append("path").attr("class","sja_aa_stem").attr("d",(e=>ve(e,t))).attr("stroke",(e=>t.color4disc(e.groups[0].mlst[0]))).attr("fill","none");const _=s.selection.filter((t=>t.groups.length>1));_.append("rect").attr("class","sja_aa_ssk_bg").attr("shape-rendering","crispEdges").attr("fill-opacity",0).attr("height",s.stem1).attr("fill",(e=>t.color4disc(e.groups[0].mlst[0]))).attr("width",(t=>{t.ssk_width=Math.max(t.occurrence.toString().length*8+6,2*(t.maxradius+t.maxrimwidth));return t.ssk_width})).attr("x",(t=>-t.ssk_width/2));_.append("text").attr("class","sja_aa_ssk_text").attr("fill","white").attr("fill-opacity",0).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","central").text((t=>t.occurrence)).each((t=>{t.ssk_fontsize=Math.min(s.stem1,t.ssk_width/(t.occurrence.toString().length*we))})).attr("font-size",(t=>t.ssk_fontsize));_.append("rect").attr("class","sja_aa_ssk_kick").attr("fill","white").attr("fill-opacity",0).attr("stroke","none").attr("height",s.stem1).attr("x",(t=>-t.ssk_width/2)).attr("width",(t=>t.ssk_width)).on("mouseover",((t,e)=>{const s=k(t.target.parentNode);s.selectAll(".sja_aa_disckick").transition().attr("stroke-opacity",1);s.select(".sja_aa_ssk_bg").transition().attr("fill-opacity",1).attr("stroke-opacity",1);s.select(".sja_aa_ssk_text").transition().attr("fill-opacity",1)})).on("mouseout",(function(t,e){const s=k(t.target.parentNode);s.selectAll(".sja_aa_disckick").transition().attr("stroke-opacity",0);s.select(".sja_aa_ssk_bg").transition().attr("fill-opacity",0).attr("stroke-opacity",0);s.select(".sja_aa_ssk_text").transition().attr("fill-opacity",0)})).on("click",(async(s,a)=>{de(a,t,e,s.target.getBoundingClientRect(),null,s.target)}))}function xe(t,e){if(e.skewer.pointup){if(t.showmode==ue){return e.skewer.maxheight+e.skewer.stem1+e.skewer.stem2+e.skewer.stem3-t.foldyoffset}return e.skewer.maxheight}if(t.showmode==ue)return t.foldyoffset;return e.skewer.stem1+e.skewer.stem2+e.skewer.stem3}function ve(t,e){if(e.skewer.pointup){if(t.showmode==ue){return"M0,0v0l0,0v"+t.foldyoffset}return"M0,0v"+e.skewer.stem1+"l"+(t.x0-t.x)+","+e.skewer.stem2+"v"+e.skewer.stem3}if(t.showmode==ue){return"M0,0v0l0,0v-"+t.foldyoffset}return"M0,0v-"+e.skewer.stem1+"l"+(t.x0-t.x)+",-"+e.skewer.stem2+"v-"+e.skewer.stem3}function ye(t,e){if(t.skewer.data.length==0)return;const s=0;const a=e.width;let n=0;const i=[];const o=[];for(const e of t.skewer.data){if(e.x0<s||e.x0>a){delete e.xoffset;o.push(e)}else{n+=e.slabelrotate?(e.groups[0].radius+e.groups[0].rimwidth)*2:e.width;i.push(e)}}Se(o,t);let r=[];const l=[];if(n<a-s){r=i}else{i.sort(((t,e)=>{if(e.occurrence==t.occurrence){if(e.groups.length==t.groups.length){return Math.abs(t.x0*2-s-a)-Math.abs(e.x0*2-s-a)}else{return e.groups.length-t.groups.length}}return e.occurrence-t.occurrence}));let t=0;let e=(a-s)*.8;let n=false;for(const s of i){if(n){delete s.xoffset;l.push(s);s.showmode=ue}else{if(t+s.width<e){r.push(s);t+=s.width}else{n=true;delete s.xoffset;l.push(s);s.showmode=ue}}}}Se(l,t);_e(r,t,e)}function _e(t,e,s){const a=1e3;const n=new Set;const i=new Set;let o=false;for(const s of t){if(s.showmode==pe){n.add(s.x0)}else{s.showmode=pe;i.add(s.x0);o=true;s.y=xe(s,e)}}if(o){const t=e.skewer.selection.filter((t=>i.has(t.x0)));t.transition().duration(a).attr("transform",(t=>"translate("+t.x+","+t.y+")"));t.selectAll(".sja_aa_discg").transition().duration(a).attr("transform",(t=>{t.y=t.yoffset*(e.skewer.pointup?-1:1);return"translate(0,"+t.y+")"}));setTimeout((function(){t.selectAll(".sja_aa_disckick").attr("transform","scale(1)").attr("data-testid","scale(1)")}),a);t.selectAll(".sja_aa_discnum").transition().duration(a).attr("fill-opacity",1).attr("stroke-opacity",1);t.filter((t=>t.groups.length>1)).selectAll(".sja_aa_disclabel").transition().duration(a).attr("fill-opacity",1).attr("transform","scale(1)");t.selectAll(".sja_aa_discrim").transition().duration(a).attr("fill-opacity",1).attr("stroke-opacity",1);t.selectAll(".sja_aa_ssk_kick").attr("transform","scale(1)").attr("y",e.skewer.pointup?0:-e.skewer.stem1);t.selectAll(".sja_aa_ssk_bg").attr("transform","scale(1)").attr("y",e.skewer.pointup?0:-e.skewer.stem1);t.selectAll(".sja_aa_ssk_text").attr("transform","scale(1)").attr("y",(e.skewer.pointup?1:-1)*e.skewer.stem1/2);t.selectAll(".sja_aa_skkick").attr("transform","scale(0.01,0.01)");let n=0;t.selectAll(".sja_aa_stem").transition().duration(a).attr("d",(t=>ve(t,e))).each((()=>++n)).on("end",(()=>{if(! --n){je(e,s)}}))}else{je(e,s)}}function je(t,e){const s=1e3;const a=[];const n=new Set;const i=0;const o=e.width;for(const e of t.skewer.data){if(e.x0<i||e.x0>o)continue;if(e.showmode==pe){e.x=e.x0;a.push(e);n.add(e.x0)}}if(a.length==0){return}Me(a,t,e);for(const t of a){t.xoffset=t.x-t.x0}for(let e=0;e<a.length;e++){const s=a[e];if(s.groups.length>1)continue;const n=s.groups[0];if(t.slabel_forcerotate){s.slabelrotate=true}else{const t=a[e+1];const i=t?t.x-t.maxradius-t.maxrimwidth:o;s.slabelrotate=i-s.x-n.radius-n.rimwidth-1<s.slabelwidth}s.width=(n.radius+n.rimwidth)*2+(s.slabelrotate?0:2+s.slabelwidth)}const r=t.skewer.selection.filter((t=>n.has(t.x0)));r.transition().duration(s).attr("transform",(t=>"translate("+t.x+","+t.y+")"));r.selectAll(".sja_aa_stem").transition().duration(s).attr("d",(e=>ve(e,t)));r.filter((t=>t.groups.length==1)).selectAll(".sja_aa_disclabel").transition().duration(s).attr("fill-opacity",1).attr("transform",(e=>"scale(1) rotate("+(e.aa.slabelrotate?(t.skewer.pointup?"-":"")+"90":"0")+")"));t.slabel_forcerotate=false}function Me(t,e,s){const a=0;const n=s.width;let i=a;let o=false;for(const e of t){if(e.x0<a||e.x0>n)continue;if(e.groups.length==1){e.slabelrotate=true;const t=e.groups[0];e.width=(t.radius+t.rimwidth)*2}const t=e.x-e.maxradius-e.maxrimwidth;if(t<i){o=true}if(t+e.width>n){o=true}i=Math.max(i,t+e.width)}if(!o){return false}i=a;for(const e of t){if(e.x0<a||e.x0>n)continue;e.x=i+e.maxradius+e.maxrimwidth;i+=e.width}Ae(t,s.width)}function Ae(t,e){for(let s=0;s<t.length;s++){if(t[s].x0<0)continue;if(t[s].x0>e)break;while(1){let a=0,n=0;for(let i=s;i<t.length;i++){const s=t[i];if(s.x0>e){return}a+=Math.abs(s.x-s.x0);s.x++;n+=Math.abs(s.x-s.x0)}if(t[s].x>=t[s].x0){for(let e=s;e<t.length;e++){t[e].x--}break}const i=t[t.length-1];if(i.x+i.width/2>=e){return}if(n<=a);else{for(let a=s;a<t.length;a++){if(t[a].x0>e){break}t[a].x--}break}}}}function Se(t,e){if(t.length==0)return;const s=1e3;const a=new Set;for(const s of t){s.x=s.x0;a.add(s.x0);s.showmode=ue;s.y=xe(s,e)}const n=e.skewer.selection.filter((t=>a.has(t.x0)));n.transition().duration(s).attr("transform",(t=>"translate("+t.x+","+t.y+")"));n.selectAll(".sja_aa_stem").transition().duration(s).attr("d",(t=>ve(t,e)));n.selectAll(".sja_aa_discg").transition().duration(s).attr("transform",(t=>"translate(0,"+(e.skewer.pointup?"-":"")+t.aa.maxradius+")"));n.selectAll(".sja_aa_disckick").attr("transform","scale(0)");n.selectAll(".sja_aa_discnum").transition().duration(s).attr("fill-opacity",0).attr("stroke-opacity",0);n.selectAll(".sja_aa_disclabel").transition().duration(s).attr("fill-opacity",0).attr("transform","scale(0)");n.selectAll(".sja_aa_discrim").transition().duration(s).attr("fill-opacity",0).attr("stroke-opacity",0);n.selectAll(".sja_aa_ssk_kick").attr("transform","scale(0)");n.selectAll(".sja_aa_ssk_bg").attr("transform","scale(0)");n.selectAll(".sja_aa_ssk_text").attr("transform","scale(0)");n.selectAll(".sja_aa_skkick").transition().duration(s).attr("transform","scale(1)")}function qe(t){t.skewer.hlBoxG.selectAll("*").remove();if(!t.skewer.hlssmid)return;t.skewer.hlBoxG.filter((e=>{if(e.mlst){return e.mlst.find((e=>t.skewer.hlssmid.has(e.ssm_id)))}return t.skewer.hlssmid.has(e.ssm_id)})).append("rect").attr("x",(t=>-t.radius)).attr("y",(t=>-t.radius)).attr("width",(t=>t.radius*2)).attr("height",(t=>t.radius*2)).attr("stroke",t.skewer.hlBoxColor).attr("stroke-width",(t=>t.radius>10?1.5:1)).attr("fill","none").attr("class","sja_mds3_skewer_ssmhlbox")}const Ce=4;function ze(t,e,s){Le(e,t,s);const a=new Map;for(const t of e){if(t.__x==undefined)continue;if(!a.has(t.__x)){a.set(t.__x,[])}a.get(t.__x).push(t)}const n=[];if(s.exonsf>=Ce){for(const[t,e]of a){n.push({chr:e[0].chr,pos:e[0].pos,mlst:e,x:t})}}else{if(s.usegm&&s.usegm.coding&&s.gmmode!=x.genomic){const t=new Map;for(const[e,n]of a){if(n[0].chr!=s.usegm.chr){continue}let i=undefined;for(const t of n){if(Number.isFinite(t.aapos))i=t.aapos}if(i==undefined){i=v(n[0].pos,s.usegm).aapos}if(i==undefined){console.error("data item cannot map to aaposition");console.log(n[0]);continue}a.delete(e);if(!t.has(i)){t.set(i,[])}let o=true;for(const e of t.get(i)){if(Math.abs(e[0].__x-n[0].__x)<=s.exonsf*3){for(const t of n){e.push(t)}o=false;break}}if(o){t.get(i).push(n)}}for(const e of t.values()){for(const t of e){let e=null;for(const s of t){if(Number.isFinite(s.rnapos))e=s}if(e==null){console.log("trying to map mlst to codon, but no rnapos found");for(const e of t){console.log(e)}continue}n.push({chr:t[0].chr,pos:e.pos,mlst:t,x:t[0].__x})}}}const t=[];const e=2;for(const[s,n]of a){const a=Math.floor(s/e);if(!t[a]){t[a]=[]}t[a]=[...t[a],...n]}for(const e of t){if(!e)continue;const t=e.reduce(((t,e)=>t+e.__x),0);n.push({isbin:true,chr:e[0].chr,pos:e[0].pos,mlst:e,x:t/e.length})}}n.sort(((t,e)=>t.x-e.x));return n}function Le(t,e,s){let a=0,n=0;const i=[];const o=[];for(const e of t){delete e.__x;if(s.gmmode==x.protein&&s.usegm.codingstart&&s.usegm.codingstop){if(e.pos<s.usegm.codingstart||e.pos>s.usegm.codingstop){continue}}if(!e.chr){n++;continue}if(!Number.isInteger(e.pos)){a++;continue}const t=s.seekcoord(e.chr,e.pos);if(t.length==0){i.push(e);continue}if(t.length==1){e.__x=t[0].x}else{e.__x=t[0].x}if(e.__x<-1||e.__x>s.width+1){continue}o.push(e)}if(a+n>0){s.tkerror(e,a+n+" items have no chromosome or genomic position")}if(i.length){console.error(i.length+" items not mapped to any region");for(const t of i)console.log(t)}$e(o,e,s)}function $e(t,e,s){for(const e of t){if(s.usegm){const t=v(e.pos,s.usegm);e.rnapos=t.rnapos;e.aapos=t.aapos}if(e.dt==p){continue}if(e.dt==r||e.dt==l){if(e.pairlstIdx==0){e.useNterm=true}else{e.useNterm=false}continue}throw"unknown dt: "+e.dt}}function Ne(t,e,s,a){if(!e.skewer&&!e.cnv)return;if(!e.leftlabels.doms.variants){e.leftlabels.doms.variants=Ee(e,s,a);e.leftlabels.doms.variants.attr("data-testid","sja_variants_label")}let n,i;if(e.custom_variants){n=e.custom_variants.length}else{n=e.skewer.rawmlst.length+(t.cnv?.length||0)}if(n==0){e.leftlabels.doms.variants.text("No variants").attr("class","").style("opacity",.5).on("click",null);return}i=0;if(e.skewer){const t=e.skewer.viewModes.find((t=>t.inuse));if(t.type=="skewer"){i=e.skewer.data.filter((t=>t.x>=0&&t.x<=s.width)).reduce(((t,e)=>t+e.mlst.length),0)}else if(t.type=="numeric"){i=t.data.filter((t=>t.x>=0&&t.x<=s.width)).reduce(((t,e)=>t+e.mlst.length),0)}else{throw"unknown mode type"}}if(t.cnv)i+=t.cnv.length;if(i==0){e.leftlabels.doms.variants.text("0 out of "+n+" variant"+(n>1?"s":"")).attr("class","").style("opacity",.5).on("click",null);return}e.leftlabels.doms.variants.style("opacity",1).attr("class","sja_clbtext2").text(i<n?i+" of "+n+" variants":i+" variant"+(i>1?"s":"")).on("click",(t=>{e.menutip.clear().showunder(t.target);Re(e,s)}));return}function Re(t,e){t.menutip.d.append("div").text("List").attr("class","sja_menuoption").attr("data-testid","sja_list_menuoption").style("border-radius","0px").on("click",(()=>{Oe(t,e)}));if(t.skewer){if(t.skewer.hlssmid){t.menutip.d.append("div").text("Cancel highlight").style("border-radius","0px").attr("class","sja_menuoption").on("click",(()=>{delete t.skewer.hlssmid;t.skewer.hlBoxG.selectAll("*").remove();const s=t.skewer.viewModes.find((t=>t.inuse));if(s.type=="skewer"){ye(t,e)}else if(s.type=="numeric");else{throw"unknown mode type"}t.menutip.hide()}))}const s=t.skewer.viewModes.find((t=>t.inuse));if(s.type=="skewer"){const s=t.skewer.data.reduce(((t,e)=>t+e.showmode),0);if(s>0){t.menutip.d.append("div").text("Collapse").attr("class","sja_menuoption").attr("data-testid","sja_collapse_menuoption").style("border-radius","0px").on("click",(()=>{Se(t.skewer.data,t);t.menutip.hide()}))}else if(s==0){t.menutip.d.append("div").text("Expand").attr("class","sja_menuoption").attr("data-testid","sja_expand_menuoption").style("border-radius","0px").on("click",(()=>{ye(t,e);t.menutip.hide()}))}t.menutip.d.append("div").text(t.skewer.pointup?"Point down":"Point up").attr("class","sja_menuoption").style("border-radius","0px").on("click",(()=>{t.skewer.pointup=!t.skewer.pointup;t.load();t.menutip.hide()}))}else if(s.type=="numeric"){t.menutip.d.append("div").text(t.skewer.hideDotLabels?"Show all variant labels":"Hide all variant labels").attr("class","sja_menuoption").style("border-radius","0px").on("click",(()=>{t.skewer.hideDotLabels=!t.skewer.hideDotLabels;t.load();t.menutip.hide()}))}}if(!t.custom_variants){t.menutip.d.append("div").text("Download").attr("class","sja_menuoption").attr("data-testid","sjpp_mds3tk_variantdownload_menuoption").style("border-radius","0px").on("click",(()=>{Te(t,e);t.menutip.hide()}))}Ie(t,e)}async function Oe(t,a){t.menutip.clear();const n=new Map;if(t.skewer){const e=t.skewer.viewModes.find((t=>t.inuse));let s;if(e.type=="skewer"){s=t.skewer.data.filter((t=>t.x>=0&&t.x<=a.width))}else if(e.type=="numeric"){s=e.data}else{throw"unknown mode type"}for(const t of s){for(const e of t.mlst){if(!n.has(e.dt))n.set(e.dt,[]);n.get(e.dt).push(e)}}}if(t.cnv?.cnvLst){n.set(s,t.cnv.cnvLst)}if(n.size==1){const e=t.menutip.d.append("div").style("margin","10px");await Dt({div:e,mlst:n.get([...n.keys()][0]),tk:t,block:a,doNotListSample4multim:true});return}const i=[];for(const[t,s]of n){i.push({label:s.length+" "+e[t]})}new T({holder:t.menutip.d.append("div").attr("class","sja_pp_vlb_dttabdiv").style("margin","10px"),tabs:i}).main();let o=0;for(const[e,s]of n){Dt({div:i[o++].contentHolder.append("div").style("margin-left","10px"),mlst:s,tk:t,block:a,doNotListSample4multim:true})}}function Ie(t,e){if(!t.skewer)return;if(t.skewer.viewModes.length<=1){return}const s=[];for(const[e,a]of t.skewer.viewModes.entries()){const t={label:De(a),value:e};if(a.inuse)t.checked=true;s.push(t)}B({holder:t.menutip.d.append("div").attr("class","sja_pp_vlb_viewmoderadiodiv").style("margin","10px"),options:s,callback:async s=>{for(const e of t.skewer.viewModes)e.inuse=false;t.skewer.viewModes[s].inuse=true;us({skewer:t.skewer.rawmlst},t,e);Pe(t,e);t._finish()}})}function De(t){if(!t)return"MISSING!!";if(t.type=="skewer")return"As lollipops";if(t.type=="numeric")return t.label+" as Y axis";return"unknown mode"}async function Te(t,e){if(!t.mds.variant2samples){console.log("TODO: variant-only");return}const s={querytype:"samples"};Cs(t,e,s);const a=(await t.mds.variant2samples.get(s)).samples;const[n,o]=await oe(a,t);const c=[];for(const t of n){if(t.isSsm){c.push("AAchange");c.push("Consequence");c.push("Mutation");continue}if(t.isMaf){c.push("Alternative allele depth in tumor");c.push("Total depth in tumor");continue}c.push(t.label)}const d=[];for(const[e,s]of a.entries()){let a;if(Array.isArray(s.ssm_id_lst)){a=s.ssm_id_lst}else if(s.ssm_id){a=[s.ssm_id]}else{console.log("sample obj lacks ssm_id and ssm_id_lst");continue}for(const s of a){const a=t.skewer.rawmlst.find((t=>t.ssm_id==s));if(!a){console.log("ssm not found by id: "+s);continue}const c=[];for(const[t,d]of n.entries()){if(d.isSsm){if(a.dt==p){c.push(a.mname);c.push(i[a.class].label);c.push(a.chr+":"+(a.pos+1)+" "+a.ref+">"+a.alt)}else if(a.dt==r||a.dt==l){c.push("");c.push(i[a.class].label);c.push(a.pairlst[0].a.chr+":"+a.pairlst[0].a.pos+">"+a.pairlst[0].b.chr+":"+a.pairlst[0].b.pos)}continue}const n=o[e][t];if(n.bySsmid){if(s in n.bySsmid){const t=n.bySsmid[s];if(d.isMaf){c.push(t.altTumor);c.push(t.totalTumor)}else{c.push(t)}}else{c.push("")}continue}if(d.isMaf){c.push(n.altTumor);c.push(n.totalTumor);continue}c.push(n.value)}d.push(c.join("\t"))}}D(le(e)+" "+(new Date).toLocaleDateString()+".txt",c.join("\t")+"\n"+d.join("\n"))}const Be=5;const Fe="Arial";async function Ue(t,e,s){let a=0;Ne(t,e,s,a);if(e.leftlabels.doms.variants){a+=Be+s.labelfontsize}if("sampleTotalNumber"in t||e.leftlabels.doms.samples){const n=await import("./leftlabel.sample-24c2388d.js");n.makeSampleLabel(t,e,s,a);a+=Be+s.labelfontsize;if(e.filterObj){n.makeSampleFilterLabel(t,e,s,a)}if(e.leftlabels.doms.filterObj){a+=Be+s.labelfontsize}}if(e.showCloseLeftlabel){if(!e.leftlabels.doms.close){e.leftlabels.doms.close=Ee(e,s,a).text("Close").on("click",(()=>{for(const[t,a]of s.tklst.entries()){if(a.tkid==e.tkid){s.tk_remove(t)}}}))}a+=Be+s.labelfontsize}e.leftlabels.laby=a;Pe(e,s);Ge(e);e.subtk2height.leftlabels=a+20}function Ge(t){t.leftlabels.maxwidth=t.tklabel.node().getBBox().width;for(const e in t.leftlabels.doms){t.leftlabels.maxwidth=Math.max(t.leftlabels.maxwidth,t.leftlabels.doms[e].node().getBBox().width)}}function Pe(t,e){if(t.leftlabels.laby==0){return}t.leftlabels.xoff=0;if(t.skewer){const s=t.skewer.viewModes.find((t=>t.inuse));if(s.type=="numeric"){const a=t.leftlabels.laby+Be+e.labelfontsize;if(a>s.toplabelheight+5){t.leftlabels.xoff=s.axisWidth}}}t.leftlabels.g.transition().attr("transform",`translate(-${t.leftlabels.xoff},${Be+e.labelfontsize})`)}function Ee(t,e,s){return t.leftlabels.g.append("text").attr("font-size",e.labelfontsize).attr("font-family",Fe).attr("y",e.labelfontsize/2+s).attr("text-anchor","end").attr("dominant-baseline","central").attr("class","sja_clbtext2").attr("fill","black").attr("x",e.tkleftlabel_xshift)}const He="Arial";const Ve=1;const We=.3;const Ke=5;const Qe=7;const Xe=100;const Je="#ededed";const Ye="Numeric value";function Ze(t,e,s,a){const n=ze(s,e.skewer||s.skewer.rawmlst,a).filter((t=>t.x>=0&&t.x<=a.width));t.data=n;if(!t.axisg)t.axisg=s.gleft.append("g");if(!t.axisheight)t.axisheight=150;ts(s);es(t,s,a);fs(s);return t.toplabelheight+t.maxradius+t.axisheight+t.maxradius+t.stem1+t.stem2+t.stem3+t.bottomlabelheight}function ts(t){t.skewer.g.selectAll("*").remove();if(t.skewer.nmg)t.skewer.nmg.selectAll("*").remove()}function es(t,e,s){if(!t.axisSetting){t.axisSetting={auto:1}}const a=t.data;for(const t of a){t.x0=t.x;if(t.xoffset!=undefined){t.x=t.x0+t.xoffset}}const n=Math.max(14,s.width/110);t.dotwidth=n;t.maxradius=0;for(const e of a){for(const s of e.mlst){s.radius=n/2;t.maxradius=Math.max(s.radius,t.maxradius);s.rimwidth=0;s.aa=e}}const i=ss(a,t,e,s);ls(a,t);const o=d().domain([t.minvalue,t.maxvalue]).range([0,t.axisheight]);for(const e of a){for(const s of e.mlst){if(s.__value_missing){s._y=0}else{if(s.__value_use<t.minvalue){s._y=0}else if(s.__value_use>t.maxvalue){s._y=t.axisheight}else{s._y=o(s.__value_use)}}}}if(i){t.stem1=5;t.stem2=20;t.stem3=10}else{t.stem1=0;t.stem2=0;t.stem3=0}for(const t of a){for(const s of t.mlst){e.glider.append("text").text(e.mnamegetter(s)).attr("font-family",He).attr("font-size",s.radius*2-2).each((function(){s.labwidth=this.getBBox().width})).remove()}}for(const t of a){for(const e of t.mlst){delete e.labattop;delete e.labatbottom}}if(!e.skewer.hideDotLabels){if(i){for(const t of a){if(t.mlst.length==1){const e=t.mlst[0];e.labattop=true}else{if((t.width-t.fixedgew)/(t.mlst.length-1)<Qe);else{for(const e of t.mlst){e.labattop=true}}}}}else{ns(a)}}t.toplabelheight=0;t.bottomlabelheight=0;if(t.showsamplebar||t.showgenotypebyvalue){for(const e of a){for(const s of e.mlst){t.toplabelheight=Math.max(t.toplabelheight,s.labwidth)}}}else{for(const e of a){for(const s of e.mlst){if(s.labattop){t.toplabelheight=Math.max(t.toplabelheight,s._y+s.labwidth-t.axisheight)}else if(s.labatbottom){t.bottomlabelheight=Math.max(t.bottomlabelheight,s.labwidth-s._y)}}}}{let a=s.labelfontsize+Ke+s.labelfontsize;if(e.label_stratify){a+=e.label_stratify.length*(Ke+s.labelfontsize)}t.toplabelheight=Math.max(t.toplabelheight,a)}cs(e,t,s);e.skewer.g.append("line").attr("y1",t.toplabelheight+t.maxradius).attr("y2",t.toplabelheight+t.maxradius).attr("x2",s.width).attr("stroke",Je).attr("shape-rendering","crispEdges");e.skewer.g.append("line").attr("y1",t.toplabelheight+t.maxradius+t.axisheight).attr("y2",t.toplabelheight+t.maxradius+t.axisheight).attr("x2",s.width).attr("stroke",Je).attr("shape-rendering","crispEdges");e.skewer.nmg=e.skewer.g.selectAll().data(a).enter().append("g").attr("class","sja_skg2").each((function(t){t.g=this}));e.skewer.nmg.attr("transform",(e=>"translate("+e.x+","+(t.toplabelheight+Ve+t.maxradius+t.axisheight+t.maxradius)+")"));if(i){e.skewer.nmg.append("path").attr("class","sja_aa_stem").attr("d",(e=>is(e,t))).attr("stroke",(t=>e.color4disc(t.mlst[0]))).attr("fill",(t=>t.mlst.length==1?"none":Je))}const r=e.skewer.nmg.selectAll().data((t=>t.mlst)).enter().append("g").attr("class","sja_aa_discg").each((function(t){t.g=this}));r.attr("transform",(e=>"translate("+e.xoff+","+(e._y+t.maxradius)*-1+")"));r.filter((t=>t.shapeTriangle)).append("path").attr("d",(t=>ds(t.radius))).attr("fill",(t=>e.color4disc(t))).attr("stroke","white").attr("class","sja_aa_disk_fill");r.filter((t=>t.shapeCircle)).append("circle").attr("stroke",(t=>e.color4disc(t))).attr("fill","none").attr("r",(t=>t.radius-.5)).attr("class","sja_aa_disk_fill");r.filter((t=>!t.shapeTriangle&&!t.shapeCircle)).append("circle").attr("fill",(t=>e.color4disc(t))).attr("stroke","white").attr("r",(t=>t.radius-.5)).attr("class","sja_aa_disk_fill");e.skewer.hlBoxG=r.append("g");r.filter((t=>t.shapeTriangle)).append("path").attr("d",(t=>ds(t.radius))).attr("stroke",(t=>e.color4disc(t))).attr("fill","white").attr("class","sja_aa_disckick").attr("fill-opacity",0).attr("stroke-opacity",0).on("mousedown",(t=>{t.preventDefault()})).on("mouseover",((s,a)=>{os(a,t,e)})).on("mouseout",((t,s)=>{rs(s,e)})).on("click",((t,a)=>{de({mlst:[a]},e,s,t.target.getBoundingClientRect(),t.target)}));r.filter((t=>!t.shapeTriangle)).append("circle").attr("r",(t=>t.radius-.5)).attr("stroke",(t=>e.color4disc(t))).attr("class","sja_aa_disckick").attr("fill","white").attr("fill-opacity",0).attr("stroke-opacity",0).on("mousedown",(t=>{t.preventDefault()})).on("mouseover",((s,a)=>{os(a,t,e)})).on("mouseout",((t,s)=>{rs(s,e)})).on("click",((t,a)=>{de({mlst:[a]},e,s,t.target.getBoundingClientRect(),t.target)}));r.filter((t=>t.labattop||t.labatbottom)).append("text").each((function(t){t.__svg_textlabel=this})).text((t=>e.mnamegetter(t))).attr("font-family",He).attr("font-size",(t=>{t._labfontsize=Math.max(12,t.radius*1.2);return t._labfontsize})).attr("fill",(t=>e.color4disc(t))).attr("x",(e=>t.showsamplebar||t.showgenotypebyvalue?t.axisheight+t.maxradius+4:e.radius+e.rimwidth+Ve)).attr("y",(t=>t._labfontsize*We)).attr("class","sja_aa_disclabel").attr("transform",(t=>"rotate("+(t.labattop?"-":"")+"90)")).on("mousedown",(t=>{t.preventDefault()})).on("mouseover",((s,a)=>os(a,t,e))).on("mouseout",((t,s)=>rs(s,e))).on("click",((t,a)=>{de({mlst:[a]},e,s,t.target.getBoundingClientRect(),t.target.previousSibling)}))}function ss(t,e,s,a){let n=0;for(const e of t){let t=0;for(const s of e.mlst){t+=2*(s.radius+s.rimwidth)}if(e.mlst.length==1){e.width=t}else{e.width=Math.min(Xe,t);const s=e.mlst[0];const a=e.mlst[e.mlst.length-1];e.fixedgew=s.radius+s.rimwidth+a.radius+a.rimwidth}n+=e.width}if(n<=a.width){let e=0;for(const s of t){s.x=e+s.mlst[0].radius+s.mlst[0].rimwidth;e+=s.width;if(s.mlst.length==1){s.stemw=0}else{s.stemw=s.width-s.fixedgew}}as(t,a.width);for(const e of t){e.xoffset=e.x-e.x0;if(e.mlst.length==1){e.mlst[0].xoff=0;e.stemw=0}else{e.stemw=e.width-e.fixedgew;const t=e.stemw/(e.mlst.length-1);for(let s=0;s<e.mlst.length;s++){e.mlst[s].xoff=t*s}}}return true}for(const e of t){e.x=e.x0;e.xoffset=0;for(const t of e.mlst){t.xoff=0}}return false}function as(t,e){for(let s=0;s<t.length;s++){if(t[s].x0<0)continue;if(t[s].x0>e)break;while(1){let a=0,n=0;for(let i=s;i<t.length;i++){const s=t[i];if(s.x0>e){return}a+=Math.abs(s.x-s.x0-s.stemw/2);s.x++;n+=Math.abs(s.x-s.x0-s.stemw/2)}if(t[s].x>t[s].x0-t[s].stemw/2){for(let e=s;e<t.length;e++){t[e].x--}break}const i=t[t.length-1];if(i.x+i.width/2>=e){return}if(n<=a);else{for(let a=s;a<t.length;a++){if(t[a].x0>e){break}t[a].x--}break}}}}function ns(t){const e=[];for(const s of t){for(const t of s.mlst){e.push({m:t,w:2*(t.radius+t.rimwidth),x:s.x0,y:t._y})}}e.sort(((t,e)=>e.y-t.y));for(let t=0;t<e.length;t++){const s=e[t];let a=false;for(let n=0;n<t;n++){const t=e[n];if(Math.abs(s.x-t.x)<(s.w+t.w)/2-2){a=true;break}}if(!a){s.m.labattop=true}}for(let t=e.length-1;t>=0;t--){const s=e[t];if(s.m.labattop)continue;let a=false;for(let n=e.length-1;n>t;n--){const t=e[n];if(t.m.labatbottom&&Math.abs(t.x-s.x)<(t.w+s.w)/2-2){a=true;break}}if(!a){s.m.labatbottom=true}}}function is(t,e){if(t.mlst.length==1){return"M0,0v"+e.stem1+"l"+-t.xoffset+","+e.stem2+"v"+e.stem3}return"M0,0"+"v"+e.stem1+"l"+-t.xoffset+","+e.stem2+"v"+e.stem3+"v-"+e.stem3+"l"+(t.stemw+t.xoffset-1)+",-"+e.stem2+"v-"+e.stem1}function os(t,e,s){if(t.__svg_textlabel){k(t.__svg_textlabel).attr("font-size",t._labfontsize*1.1)}s.pica.g.attr("transform","translate("+(t.aa.x+t.xoff)+","+(e.toplabelheight+e.maxradius+e.axisheight-t._y)+")");const a=10;const n=4;const i=t._labfontsize||13;const o=s.color4disc(t);const r=[];if(e.tooltipPrintValue){const s=e.tooltipPrintValue(t);if(Array.isArray(s)){r.push(...s.map((t=>`${t.k} = ${t.v}`)))}}else{r.push(e.label+" = "+(t.__value_missing?"NA":t.__value_use))}if(s.mds.queries?.ld?.mOverlay?.data){if(t.ssm_id==s.mds.queries.ld.mOverlay.m.ssm_id);else{let e="?";for(const a of s.mds.queries.ld.mOverlay.data){if(a.pos==t.pos&&a.alleles==t.ref+"."+t.alt){e=a.r2;break}}r.push("r2 = "+e)}}if(!t.labattop&&!t.labatbottom){r.push(s.mnamegetter(t))}let l=0;for(const t of r){s.pica.g.append("text").attr("font-size",i).attr("font-family",He).text(t).each((function(){l=Math.max(l,this.getBBox().width)})).remove()}const c=n*2+l;let d,f,m=true;if(c+a>t.aa.x+t.xoff){m=false;f=t.radius+t.rimwidth;d=f+a}else{f=-t.radius-t.rimwidth-a;d=f-c}const u=i*r.length;s.pica.g.append("rect").attr("x",d-2).attr("y",-2-n-u/2).attr("width",4+c).attr("height",4+n*2+u).attr("fill","white");s.pica.g.append("line").attr("x1",f).attr("x2",f+a).attr("stroke","white").attr("stroke-width",3).attr("shape-rendering","crispEdges");s.pica.g.append("line").attr("x1",f).attr("x2",f+a).attr("stroke",o).attr("shape-rendering","crispEdges");s.pica.g.append("rect").attr("x",d).attr("y",-n-u/2).attr("width",c).attr("height",n*2+u).attr("fill","none").attr("stroke",o).attr("shape-rendering","crispEdges");let p=(i-u)/2;for(const t of r){s.pica.g.append("text").text(t).attr("text-anchor",m?"end":"start").attr("font-size",i).attr("font-family",He).attr("x",m?f-n:d+n).attr("y",p).attr("fill",o).attr("dominant-baseline","central");p+=i}}function rs(t,e){if(t.__svg_textlabel){k(t.__svg_textlabel).attr("font-size",t._labfontsize)}e.pica.g.selectAll("*").remove()}function ls(t,e,s){for(const e of t){for(const t of e.mlst){delete t.__value_use;delete t.__value_missing}}if(e.byAttribute){for(const s of t){for(const t of s.mlst){const s=t[e.byAttribute];if(Number.isFinite(s)){t.__value_use=s}else{t.__value_missing=true}}}}else if(e.byInfo){for(const s of t){for(const t of s.mlst){const s=t?.info?.[e.byInfo];if(Number.isFinite(s)){t.__value_use=s}else{t.__value_missing=true}}}}else{throw"unknown method of getting value"}if(e.axisSetting.auto){e.minvalue=null;e.maxvalue=null;for(const s of t){for(const t of s.mlst){if("__value_use"in t){if(e.minvalue==null){e.minvalue=t.__value_use;e.maxvalue=t.__value_use}else{e.minvalue=Math.min(e.minvalue,t.__value_use);e.maxvalue=Math.max(e.maxvalue,t.__value_use)}}}}}else if(e.axisSetting.fixed){e.minvalue=e.axisSetting.fixed.min;e.maxvalue=e.axisSetting.fixed.max}else{throw"unknown axisSetting"}}function cs(t,e,s){e.axisg.attr("transform","translate(0,"+(e.toplabelheight+e.maxradius)+")").selectAll("*").remove();const a=d().domain([e.minvalue,e.maxvalue]).range([e.axisheight,0]);const n=N().scale(a).ticks(4);if(e.isinteger){n.tickFormat(y("d"));if(e.maxvalue-e.minvalue<3){n.ticks(e.maxvalue-e.minvalue)}}L({axis:e.axisg.call(n),showline:true,fontsize:e.dotwidth});e.axisWidth=0;e.axisg.selectAll("text").each((function(){e.axisWidth=Math.max(e.axisWidth,this.getBBox().width)}));e.axisWidth+=15;let i;e.axisg.append("text").attr("fill","black").attr("font-size",e.dotwidth).attr("dominant-baseline","central").attr("text-anchor","end").attr("class","sjpp-mds3-nm-axislabel sja_clbtext2").attr("y",e.axisheight/2).attr("x",-e.axisWidth).text(e.label||Ye).each((function(){i=this.getBBox().width})).on("click",(a=>{t.menutip.clear().showunder(a.target).d.append("div").text("Cancel").attr("class","sja_menuoption").style("border-radius","0px").on("click",(()=>{t.menutip.hide();e.inuse=false;t.skewer.viewModes.find((t=>t.type=="skewer")).inuse=true;us({skewer:t.skewer.rawmlst},t,s);Pe(t,s);t._finish()}));I({holder:t.menutip.d.append("div").style("margin","10px"),noPercentile:true,callback:a=>{e.axisSetting=a;ts(t);es(e,t,s)},setting:e.axisSetting})}));t.skewer.maxwidth=e.axisWidth+i}function ds(t){return`M 0 -${t} L ${t} ${t*.7} h -${t*2} Z`}function fs(t){const e=t.mds.queries?.ld?.mOverlay?.m;if(!e)return;t.skewer.hlssmid=new Set([e.ssm_id]);qe(t)}const ms=10;function us(t,e,s){if(!e.skewer){e.subtk2height.skewer=0;return}e.skewer.maxwidth=0;bs(e,t.skewer);ps(e,t.skewer);const a=e.skewer.viewModes.find((t=>t.inuse));if(!a)throw"no mode!!";if(t.skewer){e.skewer.rawmlst=t.skewer}if(a.type=="numeric"){e.subtk2height.skewer=Ze(a,t,e,s);qe(e);return}if(a.type!="skewer")throw'mode.type is not "skewer"';if(t&&!t.skewer&&s.usegm&&s.gmmode!="genomic"&&s.pannedpx!=undefined){hs(e,s);e.skewer.selection.attr("transform",(t=>"translate("+t.x+","+t.y+")"));ye(e,s)}else{e.skewer.g.selectAll("*").remove();e.skewer.data=gs(e,s);ke(e,s)}if(!e.skewer.data||e.skewer.data.length==0){e.subtk2height.skewer=0;e.skewer.g.selectAll("*").remove();return}if(e.skewer.hlssmid){const t=[];const a=[];for(const s of e.skewer.data){let n=false;for(const t of s.groups){for(const s of t.mlst){if(e.skewer.hlssmid.has(s.ssm_id)){n=true;break}}}if(n){a.push(s)}else{t.push(s)}}Se(t,e);_e(a,e,s);qe(e)}else{ye(e,s)}e.subtk2height.skewer=e.skewer.maxheight+e.skewer.stem1+e.skewer.stem2+e.skewer.stem3}function ps(t,e){if(!t.hlaachange||!e)return;const s=new Set(t.hlaachange.split(","));delete t.hlaachange;t.skewer.hlssmid=new Set;for(const a of e){if(s.has(a.mname))t.skewer.hlssmid.add(a.ssm_id)}}function hs(t,e){for(const s of t.skewer.data){if(s.isbin){let t=0;for(const a of s.mlst){const s=e.seekcoord(a.chr,a.pos);if(a.usehitidx!=undefined&&s[a.usehitidx]){t+=s[a.usehitidx].x}else if(s.length==1){t+=s[0].x}else{console.log("cannot map item");console.log(a)}}s.x0=t/s.mlst.length;s.x=s.x0+(s.xoffset!=undefined?s.xoffset:0)}else{const t=e.seekcoord(s.chr,s.pos);if(t.length>0){s.x0=t[0].x;s.x=s.x0+(s.xoffset!=undefined?s.xoffset:0)}else{console.log("cannot map group of item");console.log(s)}}}}function gs(t,e){const s=ze(t,t.skewer.rawmlst,e);for(const t of s){t.groups=ws(t.mlst)}if(t.skewer.data&&e.pannedpx!=undefined){const e={};for(const s of t.skewer.data){e[s.chr+"."+s.pos]={mode:s.showmode,xoffset:s.xoffset,slabelrotate:s.slabelrotate}}for(const t of s){const s=t.chr+"."+t.pos;if(e[s]){t.showmode=e[s].mode;t.xoffset=e[s].xoffset;t.slabelrotate=e[s].slabelrotate}}}for(const t of s){t.occurrence=t.groups.reduce(((t,e)=>t+e.occurrence),0)}return s}function ws(t,e){const s=new Map;for(const e of t){if(!Number.isInteger(e.dt))continue;if(!s.has(e.dt))s.set(e.dt,new Map);switch(e.dt){case p:if(!s.get(e.dt).has(e.class))s.get(e.dt).set(e.class,new Map);const t=e.mname||"";if(!s.get(e.dt).get(e.class).has(t)){s.get(e.dt).get(e.class).set(t,[])}s.get(e.dt).get(e.class).get(t).push(e);break;case r:case l:if(!s.get(e.dt).has(e.class)){s.get(e.dt).set(e.class,{use5:new Map,use3:new Map})}if(e.useNterm){if(!s.get(e.dt).get(e.class).use5.has(e.mname)){s.get(e.dt).get(e.class).use5.set(e.mname,[])}s.get(e.dt).get(e.class).use5.get(e.mname).push(e)}else{if(!s.get(e.dt).get(e.class).use3.has(e.mname)){s.get(e.dt).get(e.class).use3.set(e.mname,[])}s.get(e.dt).get(e.class).use3.get(e.mname).push(e)}break;case n:case M:case j:case _:if(!s.has(e.dt)){s.set(e.dt,[])}s.get(e.dt).push(e);break;default:console.log("unknown datatype: "+e.dt);console.log(e);return}}const a=[];for(const[t,e]of s){switch(t){case p:for(const[s,n]of e){if(n.size>ms){const e=[];for(const t of n.values())e.push(...t);a.push({dt:t,mlst:e,mnameCompact:i[s].label})}else{for(const e of n.values()){a.push({dt:t,mlst:e})}}}break;case r:case l:for(const s of e.values()){if(s.use5.size>ms){const e=[];for(const t of s.use5.values())e.push(...t);a.push({dt:t,mlst:e,useNterm:true,mnameCompact:t==r?"SV":"fusion"})}else{for(const e of s.use5.values()){a.push({dt:t,mlst:e,useNterm:true})}}if(s.use3.size>ms){const e=[];for(const t of s.use3.values())e.push(...t);a.push({dt:t,mlst:e,useNterm:false,mnameCompact:t==r?"SV":"fusion"})}else{for(const e of s.use3.values()){a.push({dt:t,mlst:e,useNterm:false})}}}break;case n:case M:case j:case _:a.push({dt:t,mlst:e})}}for(const t of a){let e=0,s=0;for(const a of t.mlst){e+=a.rim1count||0;s+=a.rim2count||0}t.rim1count=e;t.rim2count=s}if(t.some((t=>Number.isFinite(t.occurrence)))){for(const t of a)t.occurrence=t.mlst.reduce(((t,e)=>t+e.occurrence),0)}else{for(const t of a)t.occurrence=t.mlst.length}a.sort(((t,e)=>e.occurrence-t.occurrence));return a}function bs(t,e){ks(t,e);for(const e of t.skewer.viewModes){if(e.type=="numeric"&&!e.inuse&&e.axisg){e.axisg.remove();delete e.axisg}}}function ks(t,e){if(e&&e.find((t=>Number.isFinite(t.occurrence)))){if(!t.skewer.viewModes.find((t=>t.type=="numeric"&&t.byAttribute=="occurrence"))){t.skewer.viewModes.push({type:"numeric",byAttribute:"occurrence",label:"Occurrence",isinteger:true})}}}function xs(t,e,s){e.cnv?.g.selectAll("*").remove();if(!t.cnv){delete e.subtk2height.cnv;return}const[a,n,i]=vs(t,e,s);e.cnv.cnvLst=n;e.cnv.absoluteMax=i;e.cnv.colorScale=d([-i,0,i],[e.cnv.lossColor,"white",e.cnv.gainColor]).clamp(true);const[o,r]=_s(a||n);if(a){for(const t of a){for(const a of t.cnvs){js(a,t.y*(o+r),o,e,s,t)}}}else{for(const t of n){js(t,t.y*(o+r),o,e,s)}}const l=(a||n).length;e.subtk2height.cnv=l*o+(l-1)*r}function vs(t,e,s){let a=0;const n=new Map;const i=[];for(const e of t.cnv){if(!e.chr)continue;if(!Number.isFinite(e.value)){if(typeof e.class=="string"){if(e.class==A){e.value=1}else if(e.class==S){e.value=-1}else{continue}}else{continue}}if(!Number.isInteger(e.start)||!Number.isInteger(e.stop))continue;const t=s.seekcoord(e.chr,e.start)[0];if(!t)continue;const o=s.seekcoord(e.chr,e.stop)[0];if(!o)continue;const r=structuredClone(e);if(t.x>o.x){r.x1=o.x;r.x2=t.x}else{r.x1=t.x;r.x2=o.x}a=Math.max(a,Math.abs(e.value));i.push(r);if(Array.isArray(e.samples)){for(const t of e.samples){if(!n.has(t.sample_id))n.set(t.sample_id,[]);n.get(t.sample_id).push(structuredClone(r))}}}let o;if(n.size){o=[];for(const[t,e]of n){e.sort(((t,e)=>t.x1-e.x1));o.push({sample_id:t,cnvs:e,x1:Math.min(...e.map((t=>t.x1))),x2:Math.max(...e.map((t=>t.x2)))})}o.sort(((t,e)=>t.x1-e.x1));for(let t=0;t<o.length;t++)o[t].y=t}else{i.sort(((t,e)=>t.x1-e.x1));Ms(i,0)}return[o,i,Math.min(e.cnv.absoluteValueRenderMax,a)]}const ys=d([40,120],[10,1]);function _s(t){if(t.length>120)return[1,0];if(t.length<40)return[10,1];return[Math.ceil(ys(t.length)),1]}function js(t,e,s,a,n,i){const o=Math.max(0,t.x1),r=Math.min(t.x2,n.width);a.cnv.g.append("rect").attr("x",o).attr("y",e).attr("width",r-o).attr("height",s).attr("fill",a.cnv.colorScale(t.value)).on("mouseover",(e=>{e.target.setAttribute("stroke","black");a.itemtip.clear().show(e.clientX,e.clientY);const s=h({holder:a.itemtip.d});const n=structuredClone(t);if(i){n.samples=[{sample_id:i.sample_id}]}Kt({mlst:[n],tk:a},s)})).on("mouseout",(t=>{t.target.setAttribute("stroke","");a.itemtip.hide()}))}function Ms(t,e){const s=[];for(const a of t){for(let t=0;t<s.length;t++){if(s[t]+e<a.x1){s[t]=a.x2;a.y=t;break}}if(!("y"in a)){a.y=s.length;s.push(a.x2)}}}async function As(t,e){e.tkcloakon(t);e.block_setheight();try{if(!t.mds||t.uninitialized){await pt(t,e)}const s=await qs(t,e);if(t.uninitialized){t.clear();delete t.uninitialized}us(s,t,e);xs(s,t,e);await Ue(s,t,e);t._finish(s)}catch(e){if(t.clear)t.clear();if(t.subtk2height)t.subtk2height.skewer=50;if(t._finish)t._finish({error:e.message||e});if(e.stack)console.log(e.stack);return}}function Ss(t,e){const s={genome:e.genome.name,forTrack:1,skewerRim:t.mds.queries?.snvindel?.skewerRim};const a={"Content-Type":"application/json",Accept:"application/json"};if(t.mds.has_skewer){s.skewer=1}if(t.set_id){s.set_id=t.set_id}if(t.filter0){s.filter0=t.filter0}if(t.filterObj){if(t.filterObj?.lst.length){s.filterObj=t.filterObj}}if(t.token){a["X-Auth-Token"]=t.token}if(t.mds.label){s.dslabel=t.mds.label}else{if(t.bcf){if(t.bcf.file){s.bcffile=t.bcf.file}else if(t.bcf.url){s.bcfurl=t.bcf.url;if(t.bcf.indexURL)s.bcfindexURL=t.bcf.indexURL}else{throw".file and .url missing for tk.bcf{}"}}}Cs(t,e,s);if(t.legend.mclass.hiddenvalues.size){s.hiddenmclasslst=[...t.legend.mclass.hiddenvalues].join(",")}if(t.legend.bcfInfo){const e={};for(const s in t.legend.bcfInfo){if(t.legend.bcfInfo[s].hiddenvalues.size){e[s]=[...t.legend.bcfInfo[s].hiddenvalues]}}if(Object.keys(e).length){s.infoFilter=e}}if(t.legend.formatFilter){const e={};for(const s in t.legend.formatFilter){if(t.legend.formatFilter[s].hiddenvalues.size){e[s]=[...t.legend.formatFilter[s].hiddenvalues]}}if(Object.keys(e).length){s.formatFilter=e}}if(t.cnv){if(t.cnv.cnvMaxLength)s.cnvMaxLength=t.cnv.cnvMaxLength;if(t.cnv.cnvGainCutoff)s.cnvGainCutoff=t.cnv.cnvGainCutoff;if(t.cnv.cnvLossCutoff)s.cnvLossCutoff=t.cnv.cnvLossCutoff}return[s,a]}async function qs(t,e){let s;if(t.custom_variants){s=await zs(t,e)}else{const[a,n]=Ss(t,e);s=await u("mds3",{body:a,headers:n})}if(s.error)throw s.error;return s}function Cs(t,e,s){if(typeof s!="object")throw"par{} is not object";let a=[];if(e.usegm){const t={chr:e.rglst[0].chr,reverse:e.rglst[0].reverse,width:0,start:null,stop:null};for(let s=e.startidx;s<=e.stopidx;s++){const a=e.rglst[s];t.width+=a.width+e.regionspace;t.start=t.start==null?a.start:Math.min(t.start,a.start);t.stop=t.stop==null?a.stop:Math.max(t.stop,a.stop)}a.push(t);if(e.gmmode=="genomic");else{s.isoform=e.usegm.isoform;s.gene=e.usegm.name}}else{a=e.tkarg_rglst(t)}let n=0;for(const t of a){t.xoff=0;n+=t.width+e.regionspace}if(e.subpanels.length==t.subpanels.length){for(const t of e.subpanels){a.push({chr:t.chr,start:t.start,stop:t.stop,width:t.width,exonsf:t.exonsf,xoff:n});n+=t.width+t.leftpad}}s.rglst=a}async function zs(t,e){const a={skewer:[],cnv:[]};let n=null,o;for(let t=e.startidx;t<=e.stopidx;t++){if(n==null){n=e.rglst[t].start;o=e.rglst[t].stop}else{n=Math.min(n,e.rglst[t].start);o=Math.max(o,e.rglst[t].stop)}}const c=new Map;for(const d of t.custom_variants){if(d.dt==s){if(d.chr!=e.rglst[0].chr)continue;if(Math.max(d.start,n)>Math.min(d.stop,o))continue;a.cnv.push(d)}else if(d.dt==p||d.dt==r||d.dt==l){if(d.chr!=e.rglst[0].chr)continue;if(d.pos<=n||d.pos>=o)continue;if(!d.class)d.class="X";if(!i[d.class])d.class="X";if(t.legend.mclass.hiddenvalues.has(d.class))continue;a.skewer.push(d)}else{throw"unknown custom data dt"}c.set(d.class,1+(c.get(d.class)||0))}if(a.cnv.length==0)delete a.cnv;const d=new Set;if(a.skewer?.some((t=>t.samples))){for(const t of a.skewer){if(t.samples){for(const e of t.samples)d.add(e.sample_id)}}}if(a.cnv?.some((t=>t.samples))){for(const t of a.cnv){if(t.samples){for(const e of t.samples)d.add(e.sample_id)}}}if(d.size)a.sampleTotalNumber=d.size;a.mclass2variantcount=[...c];await Ls(t,a.skewer);return a}async function Ls(t){if(!t.mds.queries?.ld?.mOverlay)return;if(!t.mds.termdb?.vocabApi)return;delete t.mds.queries.ld.mOverlay.data;const e=await t.mds.termdb.vocabApi.getLDdata(t.mds.queries.ld.mOverlay.ldtkname,t.mds.queries.ld.mOverlay.m);if(e.error||!Array.isArray(e.lst))return;t.mds.queries.ld.mOverlay.data=e.lst}var $s=Object.freeze({__proto__:null,loadTk:As,rangequery_rglst:Cs});export{te as d,mt as g,Ee as m,$s as t};
@@ -1 +1 @@
1
- import{_ as t}from"./tslib.es6-1f85f553.js";import{d as i}from"./app-a8c4854a.js";class e{constructor(t){this.opts=this.validateOpts(t);this.tabs=t.tabs;this.dom={holder:t.holder};this.defaultTabWidth=90;o(this)}validateOpts(t){if(!t.holder)throw`missing opts.holder for Tabs()`;if(!Array.isArray(t.tabs))throw`invalid opts.tabs array for Tabs()`;if(!t.linePosition)t.linePosition="bottom";if(t.linePosition!="bottom"&&t.linePosition!="top"&&t.linePosition!="right"&&t.linePosition!="left")throw`Invalid .linePosition arg. Must be either bottom, top, right, or left`;if(!t.tabsPosition)t.tabsPosition="horizontal";if(t.tabsPosition!="horizontal"&&t.tabsPosition!="vertical")throw`Invalid .tabsPosition arg. Must be either vertical or horizontal`;return t}main(){return t(this,void 0,void 0,(function*(){try{yield this.render()}catch(t){if(t.stack)console.log(t.stack);else throw t}}))}}function o(e){e.render=()=>t(this,void 0,void 0,(function*(){const o=e.tabs.find((t=>t.active));if(!o)e.tabs[0].active=true;const s=e.opts.linePosition=="bottom"||e.opts.linePosition=="top"?"center":e.opts.linePosition;e.dom.tabsHolder=e.dom.holder.append("div").style(`border-${e.opts.linePosition}`,"0.5px solid #1575ad");if(!e.opts.contentHolder&&!e.opts.noContent){e.dom.contentHolder=e.dom.holder.append("div")}else e.dom.contentHolder=e.opts.contentHolder;if(e.opts.tabsPosition=="vertical"){e.dom.tabsHolder.style("display","inline-grid").style("align-items","start").style("gap",e.opts.gap||"");e.dom.contentHolder.style("display","inline-block").style("vertical-align","top").style("position","relative")}else e.dom.tabsHolder.style("display","inline-block");yield e.dom.tabsHolder.selectAll("button").data(e.tabs).enter().append("button").attr("data-testid","sja_toggle_button").attr("class","sj-toggle-button").classed("sjpp-active",(t=>t.active)).style("padding","0px").style("width",(t=>t.width?`${t.width}px`:"fit-content")).style("min-width",(t=>t.width?null:Math.max(e.defaultTabWidth))).style("border","none").style("background-color","transparent").style("display",e.opts.tabsPosition=="vertical"?"flex":"inline-grid").property("disabled",(t=>t.disabled?t.disabled():false)).each((function(o){return t(this,void 0,void 0,(function*(){o.wrapper=i(this);if(e.opts.linePosition=="right")o.wrapper.style("justify-self","end");if(e.opts.linePosition=="left")o.wrapper.style("justify-self","start");if(e.opts.linePosition=="top"||e.opts.linePosition=="left"){o.line=o.wrapper.append("div").style("display",e.opts.linePosition=="left"?"inline-flex":"flex");o.tab=o.wrapper.append("div").style("display",e.opts.linePosition=="left"?"inline-block":"block")}else{o.tab=o.wrapper.append("div").style("display",e.opts.linePosition=="right"?"inline-block":"block");o.line=o.wrapper.append("div").style("display",e.opts.linePosition=="right"?"inline-flex":"flex")}if(o.disabled&&o.isVisible){o.wrapper.style("cursor",o.disabled()==true&&o.isVisible()==true?"not-allowed":"pointer")}o.tab.style("color",o.active?"#1575ad":"#757373").style("text-align",s).style("padding","5px").html(o.label);o.line.style("background-color","#1575ad").style("visibility",o.active?"visible":"hidden");if(e.opts.linePosition=="top"||e.opts.linePosition=="bottom"){o.line.style("height","8px").style("padding","0px 5px")}else{o.line.style("align-self","stretch").style("padding","5px 0px").html('<span style="width: 8px";>&nbsp</span>')}if(e.dom.contentHolder){o.contentHolder=e.dom.contentHolder.append("div").style("display",o.active?"block":"none");if(e.opts.tabsPosition=="horizontal"&&!e.opts.noTopContentStyle){o.contentHolder.style("padding-top","10px").style("margin-top","10px")}}if(o.active&&o.callback)yield o.callback(event,o);o.wrapper.on("mouseenter",(()=>{o.tab.style("color",o.active?"#757373":"#1575ad")})).on("mouseleave",(()=>{o.tab.style("color",o.active?"#1575ad":"#757373")}))}))})).on("click",((i,o)=>t(this,void 0,void 0,(function*(){for(const t of e.tabs){t.active=t===o}const t=e.tabs.findIndex((t=>t.active));e.update(t);if(o.callback)yield o.callback(i,o)}))));const l=e.tabs.findIndex((t=>t.active));e.update(l)}));e.update=(t=0,i={})=>{e.tabs.forEach(((i,e)=>{i.active=t===e}));e.dom.tabsHolder.selectAll("button").data(e.tabs).classed("sjpp-active",(t=>t.active)).each((t=>{t.wrapper.classed("sjpp-active",t.active);if(t.isVisible)t.wrapper.style("display",(t=>i&&t.isVisible()?"":"none"));if(t.contentHolder)t.contentHolder.style("display",t.active?"block":"none");t.tab.style("color",t.active?"#1575ad":"#757373");t.line.style("visibility",t.active?"visible":"hidden")}))}}export{e as T};
1
+ import{_ as t}from"./tslib.es6-c3c2d88f.js";import{d as i}from"./app-b369b169.js";class e{constructor(t){this.opts=this.validateOpts(t);this.tabs=t.tabs;this.dom={holder:t.holder};this.defaultTabWidth=90;o(this)}validateOpts(t){if(!t.holder)throw`missing opts.holder for Tabs()`;if(!Array.isArray(t.tabs))throw`invalid opts.tabs array for Tabs()`;if(!t.linePosition)t.linePosition="bottom";if(t.linePosition!="bottom"&&t.linePosition!="top"&&t.linePosition!="right"&&t.linePosition!="left")throw`Invalid .linePosition arg. Must be either bottom, top, right, or left`;if(!t.tabsPosition)t.tabsPosition="horizontal";if(t.tabsPosition!="horizontal"&&t.tabsPosition!="vertical")throw`Invalid .tabsPosition arg. Must be either vertical or horizontal`;return t}main(){return t(this,void 0,void 0,(function*(){try{yield this.render()}catch(t){if(t.stack)console.log(t.stack);else throw t}}))}}function o(e){e.render=()=>t(this,void 0,void 0,(function*(){const o=e.tabs.find((t=>t.active));if(!o)e.tabs[0].active=true;const s=e.opts.linePosition=="bottom"||e.opts.linePosition=="top"?"center":e.opts.linePosition;e.dom.tabsHolder=e.dom.holder.append("div").style(`border-${e.opts.linePosition}`,"0.5px solid #1575ad");if(!e.opts.contentHolder&&!e.opts.noContent){e.dom.contentHolder=e.dom.holder.append("div")}else e.dom.contentHolder=e.opts.contentHolder;if(e.opts.tabsPosition=="vertical"){e.dom.tabsHolder.style("display","inline-grid").style("align-items","start").style("gap",e.opts.gap||"");e.dom.contentHolder.style("display","inline-block").style("vertical-align","top").style("position","relative")}else e.dom.tabsHolder.style("display","inline-block");yield e.dom.tabsHolder.selectAll("button").data(e.tabs).enter().append("button").attr("data-testid","sja_toggle_button").attr("class","sj-toggle-button").classed("sjpp-active",(t=>t.active)).style("padding","0px").style("width",(t=>t.width?`${t.width}px`:"fit-content")).style("min-width",(t=>t.width?null:Math.max(e.defaultTabWidth))).style("border","none").style("background-color","transparent").style("display",e.opts.tabsPosition=="vertical"?"flex":"inline-grid").property("disabled",(t=>t.disabled?t.disabled():false)).each((function(o){return t(this,void 0,void 0,(function*(){o.wrapper=i(this);if(e.opts.linePosition=="right")o.wrapper.style("justify-self","end");if(e.opts.linePosition=="left")o.wrapper.style("justify-self","start");if(e.opts.linePosition=="top"||e.opts.linePosition=="left"){o.line=o.wrapper.append("div").style("display",e.opts.linePosition=="left"?"inline-flex":"flex");o.tab=o.wrapper.append("div").style("display",e.opts.linePosition=="left"?"inline-block":"block")}else{o.tab=o.wrapper.append("div").style("display",e.opts.linePosition=="right"?"inline-block":"block");o.line=o.wrapper.append("div").style("display",e.opts.linePosition=="right"?"inline-flex":"flex")}if(o.disabled&&o.isVisible){o.wrapper.style("cursor",o.disabled()==true&&o.isVisible()==true?"not-allowed":"pointer")}o.tab.style("color",o.active?"#1575ad":"#757373").style("text-align",s).style("padding","5px").html(o.label);o.line.style("background-color","#1575ad").style("visibility",o.active?"visible":"hidden");if(e.opts.linePosition=="top"||e.opts.linePosition=="bottom"){o.line.style("height","8px").style("padding","0px 5px")}else{o.line.style("align-self","stretch").style("padding","5px 0px").html('<span style="width: 8px";>&nbsp</span>')}if(e.dom.contentHolder){o.contentHolder=e.dom.contentHolder.append("div").style("display",o.active?"block":"none");if(e.opts.tabsPosition=="horizontal"&&!e.opts.noTopContentStyle){o.contentHolder.style("padding-top","10px").style("margin-top","10px")}}if(o.active&&o.callback)yield o.callback(event,o);o.wrapper.on("mouseenter",(()=>{o.tab.style("color",o.active?"#757373":"#1575ad")})).on("mouseleave",(()=>{o.tab.style("color",o.active?"#1575ad":"#757373")}))}))})).on("click",((i,o)=>t(this,void 0,void 0,(function*(){for(const t of e.tabs){t.active=t===o}const t=e.tabs.findIndex((t=>t.active));e.update(t);if(o.callback)yield o.callback(i,o)}))));const l=e.tabs.findIndex((t=>t.active));e.update(l)}));e.update=(t=0,i={})=>{e.tabs.forEach(((i,e)=>{i.active=t===e}));e.dom.tabsHolder.selectAll("button").data(e.tabs).classed("sjpp-active",(t=>t.active)).each((t=>{t.wrapper.classed("sjpp-active",t.active);if(t.isVisible)t.wrapper.style("display",(t=>i&&t.isVisible()?"":"none"));if(t.contentHolder)t.contentHolder.style("display",t.active?"block":"none");t.tab.style("color",t.active?"#1575ad":"#757373");t.line.style("visibility",t.active?"visible":"hidden")}))}}export{e as T};
@@ -0,0 +1 @@
1
+ import{bC as t,bi as e,z as s,ak as n,ar as o,aP as a,aR as l,aQ as r,bD as i,bE as c,Z as p,ac as d,p as f,ab as m,e as u,M as h,bF as g,bG as y,j as b,ah as x,aa as w,bH as k,bI as v,bJ as j,bK as _}from"./app-b369b169.js";import{b as z}from"./block.lazyload-87b12654.js";function E(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(t.status===204||t.status===205)return;return t.json()}function R(t,e){return fetch(t,e).then(E)}function S(p,d,f){let m=true;for(const t in p.dsset){m=false}if(m){d.remove();f.remove();return null}const u=new Map;let h=0;for(const s in p.dsset){const n=p.dsset[s].bulkdata;if(!n)continue;const o=new Map;const a=new Set;const l=new Set;for(const s in n){for(const r of n[s]){const s=r.class;if(s==t){a.add((r.sample?r.sample:"")+"."+(r.sampletype?r.sampletype:"")+JSON.stringify(r.pairlst));continue}if(s==e){l.add((r.sample?r.sample:"")+"."+(r.sampletype?r.sampletype:"")+JSON.stringify(r.pairlst));continue}h++;if(!o.has(s)){o.set(s,0)}o.set(s,o.get(s)+1)}}if(a.size){o.set(t,a.size);h+=a.size}if(l.size){o.set(e,l.size);h+=l.size}u.set(s,o)}d.html(h+' <span style="font-size:.8em">VARIANTS</span>').attr("aria-label","A summary of variant hits from all genes, in descending order.");const g=f.append("table").style("margin-right","20px");const y=g.append("tr");const b=g.append("tr");const x=(t,e,s)=>{e.selectAll("*").remove();for(const n of t){const t=e.append("div").style("margin","10px");t.append("span").attr("class","sja_mcdot").style("background-color",n.color).style("padding","2px 5px").style("margin-right","5px").html(s?n.count:"&nbsp;&nbsp;");t.append("span").style("color",n.color).text(n.label)}};const w={};for(const[d,f]of u){const m=[];for(const[t,e]of f){const i=s[t];if(i.dt==n||i.dt==o||i.dt==a||i.dt==l||i.dt==r){m.push({key:t,label:i.label,color:i.color,count:e})}}m.sort(((t,e)=>e.count-t.count));for(const n of[i,c,t,e]){if(f.has(n)){const t=s[n];m.push({key:n,label:t.label,color:t.color,count:f.get(n)})}}w[d]=m;const u=b.append("td").attr("valign","top").attr("shownumber",0);x(m,u,true);const h=y.append("td").style("border-bottom","solid 1px #ccc").style("padding","5px 10px").style("color","#858585").style("font-size",".8em").text(p.dsset[d].label);h.append("button").style("margin","5px").text("Hide number").on("click",(t=>{const e=u.attr("shownumber")=="1";x(m,u,e);u.attr("shownumber",e?"0":"1");t.target.innerHTML=e?"Hide number":"Show number"}))}return h?w:null}function U(t){Promise.resolve().then((()=>{if(!t.gene)throw{message:"gene name missing"};if(!t.genome)throw{message:"genome name missing"};if(t.hostURL==undefined)throw{message:"no hostURL"};if(!t.loadgeneexpressionfromofficialds)throw{message:"loadgeneexpressionfromofficialds missing"};if(!t.loadgeneexpressionfromofficialds.dataset)throw{message:"dataset missing from loadgeneexpressionfromofficialds"};const e={genome:t.genome,dsname:t.loadgeneexpressionfromofficialds.dataset,expressiononly:1,genename:t.gene,jwt:t.jwt};return fetch(new Request(t.hostURL+"/dsdata",{method:"POST",body:JSON.stringify(e)})).then((t=>t.json())).then((t=>{if(t.error)throw{message:t.error};if(!t.data)throw{message:"cannot get data"};return t.data}))})).then((e=>{for(let s=0;s<e.length;s++){const n={data:e[s].lst,expp:e[s].config,genename:t.gene,presize:{x:t.x+40*s,y:t.y+40*s,width:350,height:650}};import("./ep-d017ec2f.js").then((t=>{new t.default(n)}))}})).catch((e=>{const s=p({x:t.x||600,y:t.y||80});s.body.append("p").text("Error getting gene expression: "+e)}))}const M=new h;function L(t,e,n,o,a,l){if(!e)return null;const r=l||"";const i={};let c=[];for(const e in t.dsset){for(const s in t.dsset[e].bulkdata){if(!(s in i)){i[s]={mcount:0,isoform:{}};c.push(s)}i[s].mcount+=t.dsset[e].bulkdata[s].length;for(const n of t.dsset[e].bulkdata[s]){const t=n.isoform;if(!t)continue;i[s].isoform[t]=1}}}let h=Math.min(100,c.length);const x=new Set(["Intron","P","S","E",g,y]);const w={};const k={};let v=true;n.html(c.length+' <span style="font-size:.8em">GENES</span>').attr("aria-label","A summary table of gene by variant type, order by number of hits in descending order.");const j=o.append("div");const _=t=>{b(j,t)};const z=o.append("div").style("margin-bottom","8px");z.append("button").style("margin-right","10px").text("Configure").on("click",(()=>{if(R.style("display")=="block"){d(R)}else{f(R)}}));z.append("button").style("margin-right","10px").text("Download").on("click",(()=>{const t=G();m("Gene summary",[{text:t}])}));z.append("input").attr("type","text").attr("size",10).attr("placeholder","Find gene").style("margin","0px 20px 0px 5px").on("keyup",(e=>{let s=e.target.value;if(s==""){M.hide();return}if(t.geneToUpper){s=s.toUpperCase()}if(e.code=="Enter"){M.hide();e.target.value="";if(s in i){W(s)}return}const n=[];for(const t in i){if(t.indexOf(s)==0){n.push({name:t,count:i[t].mcount})}}if(n.length==0){M.hide();return}n.sort(((t,e)=>e.count-t.count));M.clear().showunder(e.target);for(let t=0;t<Math.min(30,n.length);t++){const e=n[t].name;const s=M.d.append("div").attr("class","sja_menuoption_y").on("click",(()=>{W(e)}));s.append("span").text(e);s.append("span").style("font-size",".7em").text(n[t].count)}}));z.append("a").attr("href","https://docs.google.com/document/d/1NrH1H-FUWJtEKLk69V-k8uaYHOr9YO2obM9ZLZslEQ0/edit?usp=sharing").attr("target","_blank").text("Help");const E=o.append("div").style("border","solid 1px #ccc").style("margin","10px 0px");const R=E.append("div").style("display","none").style("background-color","#f1f1f1");const S=140;const L=E.append("div").style("padding-top",S+"px").style("position","relative");const T=L.append("div").style("overflow-y","scroll").style("height","400px").style("resize","vertical");const N=T.append("table").style("border-spacing","1px").style("border-collapse","separate");const C=R.append("div").style("padding","10px").style("border-bottom","dashed 1px #ccc");const O=R.append("div").style("padding","10px").style("border-bottom","dashed 1px #ccc");const B=R.append("div").style("padding","10px").style("border-bottom","dashed 1px #ccc");const H=C.append("span").style("padding-right","10px").text("Showing "+(h<c.length?"top "+h+" genes":"all genes"));C.append("button").text("more").on("click",(()=>{h=Math.min(c.length,h+10);H.text("Showing "+(h<c.length?"top "+h:"all genes"));G()}));C.append("button").text("less").on("click",(()=>{h=Math.max(1,h-10);H.text("Showing "+(h<c.length?"top "+h:"all genes"));G()}));O.append("span").text("Show subset").style("padding-right","10px");const I=O.append("textarea").attr("rows",1).attr("cols",20).attr("placeholder","enter gene names").style("margin-right","10px");O.append("button").text("Submit").on("click",(()=>{const e=I.property("value").trim();if(e=="")return;const s=e.split(/[\s\t\n]+/),n=[],o=[];for(const e of s){if(e=="")continue;const s=t.geneToUpper?e.trim().toUpperCase():e.trim();if(s in i){n.push(s)}else{o.push(e)}}if(o.length){_("No match found for "+o.join(", "))}if(n.length==0)return;c=n;h=n.length;G()}));O.append("button").text("Use default").on("click",(()=>{c=[];for(const t in i){c.push(t)}h=Math.min(100,c.length);G()}));B.append("span").html("Noncoding mutation visibility:&nbsp;");const J=B.append("select").on("change",(()=>{v=!v;for(const t of F){if(!t.atlst){continue}for(const e of t.atlst){if(!e.ismclass)continue;if(v){e.hide=false;continue}e.hide=x.has(e.key)}}G()}));J.append("option").text("show").attr("value","y");J.append("option").text("hide").attr("value","n");B.append("p").style("font-size",".8em").style("color","#858585").text("Including: silent, splice_region, exon, UTR, and intron.");const P=[];for(const e in t.dsset){const s=t.dsset[e];if(s.hassample){P.push(s)}}if(P.length){const t=R.append("div").style("padding","10px").style("border-bottom","dashed 1px #ccc");t.append("span").html("Gene recurrence (# of samples for each gene):&nbsp;");for(const e of P){t.append("button").text(P.length==1?"show":e.label).on("click",(t=>{const s=[];for(const t of c){const n={};let o=0;if(t in e.bulkdata){for(const s of e.bulkdata[t]){if(!v&&x.has(s.class))return;if(!(s.sample in n)){n[s.sample]=1;o++}}}s.push({name:t,size:o})}const n=t.target.getBoundingClientRect();A(s,"#76B38C","Number of samples"+(v?"":", excluding noncoding mutations"),n)}))}const e=R.append("div").style("padding","10px").style("border-bottom","dashed 1px #ccc");e.append("span").html("Mutation burden (# mutations for each sample):&nbsp;");for(const t of P){e.append("button").text(P.length==1?"show":t.label).on("click",(e=>{const s={};for(const e in t.bulkdata){for(const n of t.bulkdata[e]){const t=n.sample;if(t){if(!v&&x.has(n.class))continue;if(!(t in s)){s[t]=0}s[t]++}}}const n=[];for(const t in s){n.push({name:t,size:s[t]})}const o=e.target.getBoundingClientRect();A(n,"#76B38C","Mutation burden"+(v?"":", excluding noncoding mutations"),o)}))}}R.append("div").style("padding","10px").style("border-bottom","dashed 1px #ccc").text("Click on a column header to rank genes.");const F=[{label:"Name",isgenename:true}];let V=true;let q=0;for(const s in t.dsset){q++;const n={name:t.dsset[s].label,atlst:[{label:"# mutation",get:e=>{if(!(e in t.dsset[s].bulkdata))return 0;if(v){return t.dsset[s].bulkdata[e].length}let n=0;for(const o of t.dsset[s].bulkdata[e]){if(!x.has(o.class))n++}return n},rotate:true,descend:true,sort:V}]};V=false;if(t.dsset[s].hassample){n.atlst.push({label:"# sample",get:e=>{if(!(e in t.dsset[s].bulkdata))return 0;const n=new Set;for(const o of t.dsset[s].bulkdata[e]){if(!v&&x.has(o.class))continue;if(!o.sample)continue;n.add(o.sample)}return n.size},rotate:true,descend:true})}for(const o of e[s]){o.ismclass=true;o.get=e=>{if(!(e in t.dsset[s].bulkdata))return 0;let n=0;for(const a of t.dsset[s].bulkdata[e]){if(a.class==o.key)n++}return n};o.rotate=true;o.descend=true;n.atlst.push(o)}F.push(n)}const G=()=>{let e=null,n=null;for(const t of F){if(t.hide)continue;if(t.atlst){for(const s of t.atlst){if(s.hide)continue;if(s.sort){e=s;continue}if(s.secondsort){n=s;continue}}continue}if(t.sort){e=t;continue}if(t.secondsort){n=t}}if(e){c.sort(((t,s)=>{if(e.isgenename){if(t<s){return e.descend?1:-1}return e.descend?-1:1}const o=e.get(t),a=e.get(s);if(typeof o=="string"){if(o<a){return e.descend?1:-1}return e.descend?-1:1}if(o==a){if(n){const e=n.get(t),o=n.get(s);if(e==o){if(t in w){if(!(s in w))return-1}else if(s in w){return 1}}else{return o-e}}else{if(t in w){if(!(s in w))return-1}else if(s in w){return 1}}return t<s?-1:1}return e.descend?a-o:o-a}))}const o={};for(const t in k){const e={};for(let s=0;s<h;s++){const n=c[s];if(n in w&&t in w[n]){for(const s in w[n][t].class){if(!(s in e)){e[s]=0}e[s]+=w[n][t].class[s]}}}const s=[];for(const t in e){s.push({class:t,n:e[t]})}s.sort(((t,e)=>e.n-t.n));o[t]=s}const a="solid 10px white";N.selectAll("*").remove();const l=N.append("tr");l.append("td").style("height","0px").style("padding","0px");l.append("td").style("height","0px").style("padding","0px");for(const t of F){if(!t.atlst)continue;let e=0;for(const s of t.atlst){if(!s.hide)e++}l.append("td").attr("colspan",e).style("text-align","center").style("border-right",a).append("div").style("position","absolute").style("top","1px").style("border-bottom",q>1?"solid 1px black":"").text(q>1?t.name:"")}for(const e in k){const s=l.append("td").attr("colspan",2+o[e].length).style("border-right",a).append("div").style("top","2px").style("position","absolute").style("color",t.genome.datasets[e].color).style("border-bottom","solid 1px "+t.genome.datasets[e].color);s.append("span").text(t.genome.datasets[e].label+(k[e].totalsample?", "+k[e].totalsample+" total samples":""));s.append("div").style("position","absolute").style("right","0px").style("top","-5px").attr("class","sja_clb").html("&#10005;").on("click",(()=>{delete k[e];for(const t in w){delete w[t][e]}G()}))}const r=[];const i=[];const p=N.append("tr");p.append("td").style("height","0px").style("padding","0px");for(const t of F){if(t.hide)continue;let e=[];if(t.atlst){e=t.atlst}else{e=[t]}let s;for(const n of e){if(n.hide)continue;s=p.append("td").attr("class","sja_clbtext").style("font-size",".8em").style("height","0px").style("padding","0px").style("color",n.color?n.color:"black").style("white-space","nowrap");s.append("div").html(n.rotate?n.sort?(n.descend?"&#9664;":"&#9654;")+" "+n.label:n.label:n.label+(n.sort?" "+(n.descend?"&#9662;":"&#9652;"):"")).style("position","absolute").style("top",S-25+"px").style("transform",n.rotate?"translate(-3px,0px) rotate(-90deg)":"").style("width",n.rotate?"25px":"auto").on("click",(()=>{const t=n.sort;for(const t of F){if(t.atlst){for(const e of t.atlst){e.sort=false}}else{t.sort=false}}n.sort=true;if(t){n.descend=!n.descend}G()}));i.push(n.label+(t.name?"."+t.name:""))}s.style("border-right",a)}for(const t in k){p.append("td").style("font-size",".8em").style("height","0px").style("padding","0px").style("white-space","nowrap").append("div").html("# mutation").style("position","absolute").style("top",S-25+"px").style("transform","translate(-3px,0px) rotate(-90deg)").style("width","25px");i.push(t+".#mutation");p.append("td").style("font-size",".8em").style("height","0px").style("padding","0px").style("white-space","nowrap").append("div").html("# sample").style("position","absolute").style("top",S-25+"px").style("transform","translate(-3px,0px) rotate(-90deg)").style("width","25px");i.push(t+".#sample");let e;for(const n of o[t]){e=p.append("td").style("font-size","80%").style("overflow-y","hidden").style("height","0px").style("padding","0px").style("color",s[n.class].color).style("white-space","nowrap");e.append("div").html(s[n.class].label).style("position","absolute").style("top",S-25+"px").style("transform","translate(-3px,0px) rotate(-90deg)").style("width","25px");i.push(t+"."+s[n.class].label)}if(e){e.style("border-right",a)}}r.push(i.join("\t"));for(let t=0;t<h;t++){const e=c[t];const n=[e];const l=N.append("tr");l.append("td").text(t+1).style("font-size",".7em").style("text-align","right");for(const s of F){if(s.hide)continue;if(s.isgenename){l.append("td").text(c[t]).attr("class","sja_menuoption_y").style("color","black").style("display","table-cell").on("click",(()=>{W(c[t])}));continue}let o;for(const t of s.atlst){if(t.hide)continue;o=l.append("td").style("color","black").style("background-color","#f1f1f1");const s=t.get(e);if(typeof s=="number"){if(t.color){if(s>0){o.style("text-align","center").append("span").attr("class","sja_mcdot").style("background-color",t.color).html(s>1?s:"&nbsp;")}else{o.append("span").attr("class","sja_mcdot").style("margin","0px 4px").html("&nbsp;")}}else{o.text(s)}}else{o.text(s)}n.push(s)}o.style("border-right",a)}for(const t in k){let r=0,i=0,c={},p=true,d=false;if(e in w){const s=w[e][t];if(!s)continue;p=false;if(s.pending){d=true;continue}r+=s.sample;i+=s.total;for(const t in s.class){if(!(t in c)){c[t]=0}c[t]+=s.class[t]}}if(p){l.append("td").attr("colspan",2+o[t].length);continue}if(d){l.append("td").attr("colspan",2+o[t].length).text("loading ...");continue}l.append("td").text(i).style("background-color","#f1f1f1");n.push(i);l.append("td").text(r).style("background-color","#f1f1f1");n.push(r);let f;for(const e of o[t]){f=l.append("td").style("text-align","center").style("background-color","#f1f1f1");const t=c[e.class];if(t){f.append("span").attr("class","sja_mcdot").style("background-color",s[e.class].color).html(t>1?t:"&nbsp;")}else{f.append("span").attr("class","sja_mcdot").style("margin","0px 4px").html("&nbsp;")}n.push(t)}f.style("border-right",a)}r.push(n.join("\t"))}return r.join("\n")};G();function W(e){if(!(e in i))return;M.hide();const s=[];for(const e in t.dsset){s.push(e)}let n;for(const o in i[e].isoform){if(!n){n=p({x:100,y:100})}u({hostURL:r,jwt:t.jwt,holder:n.body,genome:t.genome,query:o,nopopup:true,dataset:s})}if(t.loadgeneexpressionfromofficialds){U({gene:e,genome:t.genome.name,loadgeneexpressionfromofficialds:t.loadgeneexpressionfromofficialds,hostURL:t.hostURL,jwt:t.jwt,x:1e3,y:80})}}}async function A(t,e,s,n){const o=await import("./plot.barplot-7c4865a2.js");return o.default(t,e,s,n)}new h;function T(t,e){const s=t=>{b(e,t)};if(!t.metadata)return s("no metadata");const n=t.metadata;const o=e.append("div").style("display","inline-block").style("border","solid 1px #ccc").style("margin","20px").style("padding","20px");const a=e.append("svg");if(!t.text)return s("text missing");const l=t.text.trim().split("\n");t.samples=[];const r=l[0].split("\t");for(let e=2;e<r.length;e++){t.samples.push(r[e])}if(t.samples.length==0)return s("no column names");t.items=[];for(let e=1;e<l.length;e++){const o=l[e].split("\t");const a=o[0];const r=n[a];if(!r)return s("invalid data type "+a);const i=o[1];const c=[];for(let e=2;e<o.length;e++){const n=o[e].split(";");const a=[];for(const o of n){if(!r[o]){return s("invalid value "+o+" at "+i+" and "+t.samples[e-2])}a.push(r[o].color)}c.push(a)}t.items.push({name:i,type:a,lst:c})}t.geneonrow=true;if(!t.rowh){t.rowh=20}if(!t.colw){t.colw=20}if(!t.rowspace){t.rowspace=2}if(!t.colspace){t.colspace=2}if(!t.rowlabtickspace){t.rowlabtickspace=4}if(!t.collabtickspace){t.collabtickspace=4}if(!t.rowtick){t.rowtick=5}if(!t.coltick){t.coltick=5}N(t,a,o,s)}function N(t,e,s,n){const o=t.metadata;for(const t in o){for(const e in o[t]){const s=o[t][e];if(!s.label)return n(".label missing for metadata "+t+"["+e+"]");if(!s.color)return n(".color missing for metadata "+t+"["+e+"]")}}for(const t in o){const e=s.append("div").style("display","inline-block").style("margin","20px").style("vertical-align","top");e.append("div").text(t).style("margin","5px 3px").style("font-weight","bold");const n=e.append("div").style("margin","3px");for(const e in o[t]){const s=o[t][e];const a=n.append("div").style("margin","3px");a.append("div").style("display","inline-block").style("background-color",s.color).style("width","14px").style("height","14px").style("margin-right","10px");a.append("span").text(s.label)}}const a=t.rowh-3,l=t.colw-3;let r=[];for(const e of t.items){r.push(e.name)}let i=0;for(const s of r){e.append("text").text(s).attr("font-size",t.geneonrow?a:l).attr("font-family",x).each((function(){i=Math.max(i,this.getBBox().width)})).remove()}let c=0;for(const s of t.samples){e.append("text").text(s).attr("font-size",t.geneonrow?l:a).attr("font-family",x).each((function(){c=Math.max(c,this.getBBox().width)})).remove()}const p=t.geneonrow?i:c;const d=t.geneonrow?c:i;const f=t.samples.length*(t.colw+t.colspace)-t.colspace;const m=t.items.length*(t.rowh+t.rowspace)-t.rowspace;e.attr("width",p+t.rowlabtickspace+t.rowtick+f+100).attr("height",d+t.collabtickspace+t.coltick+m);const u=p+t.rowlabtickspace+t.rowtick;const h=d+t.collabtickspace+t.coltick;let g=h;for(const s of t.items){const n=e.append("g").attr("transform","translate("+(u-t.rowlabtickspace-t.rowtick)+","+(g+t.rowh/2)+")");n.append("text").text(s.name).attr("font-size",a).attr("font-family",x).attr("fill","black").attr("text-anchor","end").attr("dominant-baseline","central");n.append("line").attr("stroke","black").attr("shape-rendering","crispEdges").attr("x1",t.rowlabtickspace).attr("x2",t.rowlabtickspace+t.rowtick);g+=t.rowh+t.rowspace}let y=u;for(const s of t.samples){const n=e.append("g").attr("transform","translate("+(y+t.colw/2)+","+d+")");n.append("text").text(s).attr("font-size",l).attr("font-family",x).attr("fill","black").attr("dominant-baseline","central").attr("transform","rotate(-90)");n.append("line").attr("stroke","black").attr("shape-rendering","crispEdges").attr("y1",t.collabtickspace).attr("y2",t.collabtickspace+t.coltick);y+=t.colw+t.colspace}g=h;for(const s of t.items){let n=u;for(let o=0;o<t.samples.length;o++){t.samples[o];const a=e.append("g").attr("transform","translate("+(n+t.colw/2)+","+(g+t.rowh/2)+")");const l=t.rowh/s.lst[o].length;const r=s.lst[o];for(let e=0;e<r.length;e++){const s=r[e];a.append("rect").attr("x",-t.colw/2).attr("y",-t.rowh/2+e*l).attr("width",t.colw).attr("height",l).attr("fill",s).attr("shape-rendering","crispEdges")}n+=t.colw+t.colspace}g+=t.rowh+t.rowspace}e.append("rect").attr("x",u).attr("y",h).attr("width",t.samples.length*(t.colw+t.colspace)-t.colspace).attr("height",t.items.length*(t.rowh+t.rowspace)-t.rowspace).attr("stroke","black").attr("fill","none").attr("shape-rendering","crispEdges")}function C(t,e){for(const s of t.e2pca.list){const n=e.append("div").style("display","inline-block").style("margin","20px").style("vertical-align","top");if(t.e2pca.list.length>1){n.style("border","solid 1px #ededed")}if(s.name){n.append("div").text(s.name).style("background-color","#f1f1f1").style("padding","5px 10px")}const o=n.append("div").style("margin","20px");R(t.hostURL+"/textfile").post(JSON.stringify({file:s.vectorfile,jwt:t.jwt}),(e=>{if(e.error){b(n,"Error getting vector file: "+e.error);return}import("./e2pca-82765817.js").then((a=>{const[l,r]=a.e2pca_plot({holder:n,toprow:o,text:e.text,mdanno:t.patientannotation,obj:s});if(l){b(n,"Error: "+l);return}a.e2pca_genesearchui({holder:o,numdata2plot:r,hostURL:t.hostURL,jwt:t.jwt,obj:s,callback:()=>{O(t,s)}});if(t.patientannotation){s.boxplotdiv=n.append("div");const e=o.append("div").style("display","inline-block").style("margin-left","10px");B(t,s,e)}}))}))}}function O(t,e){if(!t.patientannotation){return}if(!e.expressiondata){return}if(!e.usetermkey){e.usetermkey=t.patientannotation.metadata[0].key}let s=null;for(const n of t.patientannotation.metadata){if(n.key==e.usetermkey){s=n;break}}if(!s){b(e.boxplotdiv,"invalid term key "+e.usetermkey);return}const n=[];for(const t of s.values){n.push({valuekey:t.key,label:t.label,color:t.color,samples:[]})}let o=e.expressiondata[0].value;let a=e.expressiondata[0].value;const l=[];for(const s of e.expressiondata){o=Math.min(o,s.value);a=Math.max(a,s.value);if(!t.patientannotation.annotation[s.sample]){l.push(s);continue}const r=t.patientannotation.annotation[s.sample][e.usetermkey];if(r==undefined){l.push(s);continue}for(const t of n){if(t.valuekey==r){t.samples.push(s);break}}}if(l.length){n.push({label:"unannotated",color:"#858585",samples:l})}e.boxplotdiv.selectAll("*").remove();import("./plot.boxplot-fe3046c6.js").then((t=>{const s=t.default({list:n,holder:e.boxplotdiv,axislabel:e.searchedgene});if(s){b(e.boxplotdiv,"Boxplot: "+s)}}))}function B(t,e,s){const n=new h({border:"",padding:""});const o="#858585";s.append("span").text("Choose metadata").attr("class","sja_clbtext").on("click",(s=>{n.clear();n.showunder(s.target);for(const s of t.patientannotation.metadata){n.d.append("div").attr("class","sja_menuoption").text(s.label).on("click",(()=>{e.usetermkey=s.key;n.hide();e.circles.attr("fill",(e=>{const n=t.patientannotation.annotation[e.sample];if(!n)return o;const a=n[s.key];if(!a)return o;const l=t.patientannotation.mdh[s.key].values[a];if(!l){console.error("invalid value key: "+a+" at term: "+s.key);return o}return l.color}));e.legendholder.selectAll("*").remove();e.legendholder.append("div").style("margin-bottom","5px").text(s.label).style("font-weight","bold");for(const t of s.values){const s=e.legendholder.append("div").style("margin-bottom","3px");s.append("span").attr("class","sja_mcdot").style("background-color",t.color).style("margin-right","5px").html("&nbsp;");s.append("span").text(t.label)}if(e.expressiondata){O(t,e)}}))}}))}async function H(t,e,s,n={callbacks:{sjcharts:{}}}){const o=n.debugmode;if(o){window.cohort=t}if(!("hostURL"in t))t.hostURL=s;if(t.headerhtml){e.append("div").html(t.headerhtml)}let a=0;for(const e in t.p2st){a++;for(const s in t.p2st[e]){const n=t.p2st[e][s];n.sampletype=s;n.patientname=e;n.cohort=t}}const l=e.append("table").style("margin-top","20px");const r=l.append("tr");t.__tdleft=r.append("td").style("vertical-align","top").style("padding-right","20px");t.__tdright=r.append("td").style("vertical-align","top");if(t.hide_navigation){t.__tdleft.style("display","none")}if(!t.hide_addnewfile){const[n,o]=I(t);o.style("background-color","#f4f4f4").style("margin","0px 20px 20px 0px").style("padding","20px");n.html('&#43; <span style="font-size:.8em">NEW FILE</span>');const a=o.append("p");const l=o.append("div");const r=()=>{l.selectAll("*").remove();l.append("span").html("Select data type&nbsp;");const n=k(l).style("margin-right","20px");l.append("input").attr("type","file").on("change",(o=>{a.text("");const l=o.target.files[0];if(!l){r();return}if(l.size==0){a.text("Wrong file: "+l.name);r();return}const i=new FileReader;i.onload=o=>{a.text(l.name+" loaded.");const i=v(t.genome.name);if(!i){a.text("should not happen");r();return}const c=j(o.target.result,n.node().selectedIndex,i);if(c){a.text("Error with "+l.name+": "+c);r();return}let p=null;for(const e in t.dsset){p=t.dsset[e];break}if(!p){a.text("no dataset in cohort, this should not happen");r();return}const d=_({flag:i,cohort:t,flag2thisds:p});if(d){a.text("Error with "+l.name+": "+d);r();return}if(i.good==0){a.text(l.name+": no data loaded");r();return}a.text("");r();e.selectAll("*").remove();H(t,e,s)};i.onerror=function(){a.text("Error reading file "+l.name);r();return};a.text("Parsing file "+l.name+" ...");i.readAsText(l,"utf8")}))};r()}const[i,c]=I(t);const p=S(t,i,c);const m=[];for(const e in t.dsset){const s=t.genome.datasets[e];if(s.hassample){m.push(e)}if(s.hasdisease);}if(p){const[e,n]=I(t,t.show_genetable);L(t,p,e,n,a>0,s)}let h=false;if(m.length||a>0){t.patientset={};for(const e in t.p2st){t.patientset[e]={trlst:[],samples:t.p2st[e]}}if(m.length>0&&!t.hardcodemap){h=true}}if(t.show_heatmap){h=true}if(h){const[e,s]=I(t);e.text("HEATMAP").style("font-size",".8em");const a=await w();const l=(t.name?t.name+".":"")+"hm";a.heatmap({cohort:t,hassamplelst:m,blockinit:u,debugmode:o,dom:{butt:e.node(),holder:s.node()},tp_getgeneexpression:U,show_heatmap:t.show_heatmap,instanceTracker:n.instanceTracker&&n.instanceTracker.sjcharts,callbacks:n.callbacks&&n.callbacks.sjcharts&&(n.callbacks.sjcharts[l]||n.callbacks.sjcharts.hm)})}if(t.hardcodemap){const[e,s]=I(t,t.show_hardcodemap);e.text("HEATMAP").style("font-size",".8em");for(const e of t.hardcodemap){const t=s.append("div").style("display","inline-block").style("margin-bottom","20px");if(e.name){t.append("h3").text(e.name)}T(e,t)}}if(t.survivalJSON){const[e,s]=I(t,t.show_hardcodemap);e.text("SURVIVAL CURVE").style("font-size",".8em").style("border-color","transparent");const o=await w();o.survival({cohort:t,dom:{butt:e.node(),holder:s.node()},instanceTracker:n.instanceTracker&&n.instanceTracker.sjcharts,callbacks:n.callbacks&&n.callbacks.sjcharts&&n.callbacks.sjcharts.sv})}if(t.browserview){const[n,a]=I(t);n.style("font-size",".8em").text("BROWSER");let l=false;n.on("click",(()=>{if(a.style("display")=="none"){n.style("border-color","black");f(a)}else{n.style("border-color","transparent");d(a)}if(l)return;l=true;const r={holder:a,genome:t.genome,debugmode:o,dogtag:t.genome.name,hostURL:s,jwt:t.jwt,cohort:t,nobox:t.browserview.nobox,datasetqueries:t.browserview.datasetqueries,tklst:[]};if(t.browserview.position){r.chr=t.browserview.position.chr;r.start=t.browserview.position.start;r.stop=t.browserview.position.stop}if(t.browserview.nativetracks){r.nativetracks=t.browserview.nativetracks}if(t.browserview.tracks){for(const e of t.browserview.tracks){r.tklst.push(e)}}if(t.browserview.assays){if(!t.assaylst){console.error("assaylst not set!");t.assaylst=[]}for(const e in t.browserview.assays){const s=t.browserview.assays[e];if(!s.assayobj){continue}if(s.combined){if(s.combinetk){r.tklst.push(s.combinetk)}}else{for(const e in t.patientset){for(const n in t.patientset[e].samples){for(const o of t.patientset[e].samples[n].tktemplate){if(o.id==s.assayobj.id){r.tklst.push(o)}}}}}}}if(t.browserview.defaultassaytracks){const[s,n]=J(t);if(s){b(e,"error with .defaultassaytracks: "+s)}else{for(const t of n)r.tklst.push(t)}}for(const t of r.tklst){t.iscustom=true}z(r)}));if(t.show_browser){n.node().click()}}if(t.e2pca){const[e,s]=I(t);e.text(t.e2pca.label).style("font-size",".8em");let n=false;e.on("click",(()=>{if(s.style("display")=="none"){e.style("border-color","black");f(s)}else{e.style("border-color","transparent");d(s)}if(n)return;n=true;C(t,s)}));if(t.show_e2pca){e.node().click()}}}function I(t,e){const s=t.__tdleft.append("div").attr("class","sja_menuoption").style("margin-top","10px").style("white-space","nowrap");const n=t.__tdright.append("div").style("padding-bottom","20px");s.on("click",(()=>{if(n.style("display")=="block"){d(n);s.style("border","solid 1px transparent")}else{s.style("border","solid 1px #545454");f(n)}}));if(e){s.style("border","solid 1px #545454");n.style("display","block")}else{s.style("border","solid 1px transparent");n.style("display","none")}return[s,n]}function J(t){if(!t.browserview)return[null,[]];if(!t.browserview.defaultassaytracks)return[null,[]];const e=[];for(const s of t.browserview.defaultassaytracks){const n=t.p2st[s.level1];if(!n)continue;if(s.level2){const t=n[s.level2];if(!t)continue;if(!t.tktemplate)continue;for(const n of t.tktemplate){if(n.assayname==s.assay){e.push(n);if(s.justone){break}}}}else{for(const t in n){const o=n[t];if(o.tktemplate){for(const t of o.tktemplate){if(t.assayname==s.assay){e.push(t)}}}}}}return[null,e]}var P=Object.freeze({__proto__:null,default:H});export{R as d,P as t};
@@ -0,0 +1 @@
1
+ function e(e,t){var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0)r[n]=e[n];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++){if(t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o]))r[n[o]]=e[n[o]]}return r}function t(e,t,r,n){function o(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,a){function i(e){try{f(n.next(e))}catch(e){a(e)}}function c(e){try{f(n["throw"](e))}catch(e){a(e)}}function f(e){e.done?r(e.value):o(e.value).then(i,c)}f((n=n.apply(e,t||[])).next())}))}function r(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}function n(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r}export{t as _,n as a,r as b,e as c};
@@ -0,0 +1 @@
1
+ import{b as t}from"./brush-aa175142.js";import{c as n}from"./termsetting-33ea66f1.js";import{d as e}from"./app-b369b169.js";import"./pointer-c7475677.js";import"./nodrag-16ad4b03.js";import"./tslib.es6-c3c2d88f.js";import"path";function s(t,n){const s=t.num_obj.brushes;const r=t.num_obj.density_data.maxvalue;const a=t.num_obj.density_data.minvalue;const i=(r-a)/10;const u=t.tvs.term.type=="integer"?Math.floor(i):i;for(const[e,o]of t.num_obj.ranges.entries()){const t=s.find((t=>t.orig===o));let e;if(!t){e={orig:o,range:JSON.parse(JSON.stringify(o))};s.push(e)}else{e=t}if(o.start===""){if(n=="center")e.range.start=a+u*4;else e.range.start=a+u*8}if(o.stop===""){if(n=="center")e.range.stop=a+u*6;else e.range.stop=Math.floor(r)}}const d=t.num_obj.brush_g.selectAll(".range_brush").data(s,(t=>s.indexOf(t)));d.exit().remove();d.each((function(t,n){e(this).selectAll(".overlay").style("pointer-events","all")}));d.enter().append("g").attr("class","range_brush").each((function(n,e){o(t,this,n)}))}function o(n,s,o){if(!o.elem)o.elem=e(s);const a=o.range;const i=n.num_obj.plot_size;const u=n.num_obj.xscale;const d=n.num_obj.density_data.maxvalue;const l=n.num_obj.density_data.minvalue;o.d3brush=t().extent([[0,0],[i.width,i.height]]).on("brush",(function(t,e){const s=t.selection;if(!s)return;const i=o.rangeInput.getRange();if(i.value!=undefined){o.range=i;return}r(u,s,a,i,l,d,n.tvs.term.type);const c=a.startunbounded?"":i.startinclusive?`${a.start} <=`:`${a.start} <`;const p=a.stopunbounded?"":i.stopinclusive?`<= ${a.stop}`:`< ${a.stop}`;o.rangeInput.getInput().node().value=`${c} x ${p}`})).on("end",(function(){o.elem.selectAll(".overlay").style("pointer-events","none")}));const c=a.startunbounded?l:a.start;const p=a.stopunbounded?d:a.stop;o.init=()=>{if(a.value==undefined)o.elem.call(o.d3brush).call(o.d3brush.move,[c,p].map(u))};if(a.startunbounded)delete a.start;if(a.stopunbounded)delete a.stop;o.elem.selectAll(".selection").style("fill",o.orig.start===""&&o.orig.stop===""||JSON.stringify(a)!=JSON.stringify(o.orig)?"#23cba7":"#777777")}function r(t,e,s,o,r,i,u){s.start=a(t,e[0]);s.stop=a(t,e[1]);const d=n(Number(r));const l=n(Number(i));s.startunbounded=d==s.start&&o.startunbounded;s.stopunbounded=l==s.stop&&o.stopunbounded;if(u=="integer"){s.start=s.startunbounded?"":Math.round(s.start);s.stop=s.stopunbounded?"":Math.round(s.stop)}}function a(t,e){let s=Number(t.invert(e));return n(s)}function i(t,n="end",e){const o={start:"",stop:"",index:t.tvs.ranges.length};t.num_obj.ranges.push(o);const r={orig:o,range:JSON.parse(JSON.stringify(o))};t.num_obj.brushes.push(r);s(t,n);if(e)e();r.init()}export{s as addBrushes,i as addNewBrush,r as updateTempRanges};