loom-browser 0.0.1
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.
- package/LICENSE +21 -0
- package/README.md +287 -0
- package/dist/igv.d.ts +667 -0
- package/dist/igv.esm.js +76708 -0
- package/dist/igv.esm.min.js +26 -0
- package/dist/igv.esm.min.js.map +1 -0
- package/dist/igv.js +76716 -0
- package/dist/igv.min.js +26 -0
- package/dist/igv.min.js.map +1 -0
- package/dist/loom.d.ts +667 -0
- package/dist/loom.esm.js +14927 -0
- package/dist/loom.esm.min.js +2 -0
- package/dist/loom.esm.min.js.map +1 -0
- package/dist/loom.js +15114 -0
- package/dist/loom.min.js +2 -0
- package/dist/loom.min.js.map +1 -0
- package/dist/types/agent/index.d.ts +4 -0
- package/dist/types/agent/stateProjection.d.ts +115 -0
- package/dist/types/agent/trackSelector.d.ts +31 -0
- package/dist/types/baseTrackCanvas.d.ts +62 -0
- package/dist/types/bigwig/binaryParser.d.ts +25 -0
- package/dist/types/bigwig/bpTree.d.ts +40 -0
- package/dist/types/bigwig/bwReader.d.ts +69 -0
- package/dist/types/bigwig/chromTree.d.ts +28 -0
- package/dist/types/bigwig/index.d.ts +66 -0
- package/dist/types/bigwig/inflate.d.ts +9 -0
- package/dist/types/bigwig/rangeReader.d.ts +48 -0
- package/dist/types/bigwig/rpTree.d.ts +27 -0
- package/dist/types/canvasProvider.d.ts +36 -0
- package/dist/types/commandDispatcher.d.ts +199 -0
- package/dist/types/contextMenu.d.ts +64 -0
- package/dist/types/contextMenuProvider.d.ts +25 -0
- package/dist/types/data/cachedSequence.d.ts +19 -0
- package/dist/types/data/ucscApi.d.ts +21 -0
- package/dist/types/data/ucscSequence.d.ts +19 -0
- package/dist/types/dataLifecycle.d.ts +16 -0
- package/dist/types/dataSources/bigWigDataSource.d.ts +24 -0
- package/dist/types/dataSources/dataSourceCacheKey.d.ts +9 -0
- package/dist/types/dataSources/dynseqDataSource.d.ts +20 -0
- package/dist/types/dataSources/featureSourceFactory.d.ts +46 -0
- package/dist/types/dataSources/geneDataSource.d.ts +16 -0
- package/dist/types/dataSources/gtxDataSource.d.ts +42 -0
- package/dist/types/dataSources/sequenceDataSource.d.ts +15 -0
- package/dist/types/dataSources/textFeatureSource.d.ts +63 -0
- package/dist/types/decode/bed.d.ts +64 -0
- package/dist/types/decode/bedpe.d.ts +36 -0
- package/dist/types/decode/exonUtils.d.ts +29 -0
- package/dist/types/decode/gff.d.ts +58 -0
- package/dist/types/decode/interact.d.ts +19 -0
- package/dist/types/decode/ucsc.d.ts +56 -0
- package/dist/types/dynseqRenderer.d.ts +37 -0
- package/dist/types/events.d.ts +23 -0
- package/dist/types/export/canvas2svg.d.ts +166 -0
- package/dist/types/export/index.d.ts +2 -0
- package/dist/types/featureCache.d.ts +69 -0
- package/dist/types/formats/featureParser.d.ts +72 -0
- package/dist/types/formats/formatDetection.d.ts +46 -0
- package/dist/types/geneRenderer.d.ts +17 -0
- package/dist/types/geneThemes.d.ts +11 -0
- package/dist/types/geneTrackCanvas.d.ts +46 -0
- package/dist/types/genome/chromAlias.d.ts +46 -0
- package/dist/types/genome/chromSizes.d.ts +53 -0
- package/dist/types/genome/genome.d.ts +51 -0
- package/dist/types/genomeBrowser.d.ts +189 -0
- package/dist/types/gtx/fetchCoordinator.d.ts +34 -0
- package/dist/types/gtx/gtxReader.d.ts +144 -0
- package/dist/types/gtx/index.d.ts +40 -0
- package/dist/types/gtx/zstdWasm.d.ts +22 -0
- package/dist/types/headlessGenomeBrowser.d.ts +450 -0
- package/dist/types/index.d.ts +123 -0
- package/dist/types/intervalTree.d.ts +56 -0
- package/dist/types/io/binaryParser.d.ts +25 -0
- package/dist/types/io/index.d.ts +7 -0
- package/dist/types/io/rangeReader.d.ts +48 -0
- package/dist/types/locusUtils.d.ts +37 -0
- package/dist/types/pack.d.ts +41 -0
- package/dist/types/popupProvider.d.ts +22 -0
- package/dist/types/remoteProtocol.d.ts +79 -0
- package/dist/types/renderTheme.d.ts +72 -0
- package/dist/types/renderThemePresets.d.ts +16 -0
- package/dist/types/roi/index.d.ts +3 -0
- package/dist/types/roi/roiRenderer.d.ts +24 -0
- package/dist/types/roi/roiSet.d.ts +41 -0
- package/dist/types/rulerRenderer.d.ts +14 -0
- package/dist/types/rulerTrackCanvas.d.ts +32 -0
- package/dist/types/sequence/sequenceUtils.d.ts +44 -0
- package/dist/types/session.d.ts +55 -0
- package/dist/types/src/bigwig/index.d.ts +66 -0
- package/dist/types/src/canvasProvider.d.ts +36 -0
- package/dist/types/src/commandDispatcher.d.ts +220 -0
- package/dist/types/src/contextMenu.d.ts +64 -0
- package/dist/types/src/contextMenuProvider.d.ts +25 -0
- package/dist/types/src/data/cachedSequence.d.ts +19 -0
- package/dist/types/src/data/ucscApi.d.ts +21 -0
- package/dist/types/src/data/ucscSequence.d.ts +19 -0
- package/dist/types/src/dataLifecycle.d.ts +16 -0
- package/dist/types/src/dataSources/bigWigDataSource.d.ts +24 -0
- package/dist/types/src/dataSources/dataSourceCacheKey.d.ts +9 -0
- package/dist/types/src/dataSources/featureSourceFactory.d.ts +46 -0
- package/dist/types/src/dataSources/geneDataSource.d.ts +16 -0
- package/dist/types/src/dataSources/gtxDataSource.d.ts +42 -0
- package/dist/types/src/dataSources/sequenceDataSource.d.ts +15 -0
- package/dist/types/src/dataSources/textFeatureSource.d.ts +63 -0
- package/dist/types/src/decode/bed.d.ts +64 -0
- package/dist/types/src/decode/bedpe.d.ts +36 -0
- package/dist/types/src/decode/exonUtils.d.ts +29 -0
- package/dist/types/src/decode/gff.d.ts +58 -0
- package/dist/types/src/decode/interact.d.ts +19 -0
- package/dist/types/src/decode/ucsc.d.ts +56 -0
- package/dist/types/src/events.d.ts +23 -0
- package/dist/types/src/export/canvas2svg.d.ts +166 -0
- package/dist/types/src/export/index.d.ts +2 -0
- package/dist/types/src/featureCache.d.ts +69 -0
- package/dist/types/src/formats/featureParser.d.ts +72 -0
- package/dist/types/src/formats/formatDetection.d.ts +46 -0
- package/dist/types/src/genome/chromAlias.d.ts +46 -0
- package/dist/types/src/genome/chromSizes.d.ts +53 -0
- package/dist/types/src/genome/genome.d.ts +51 -0
- package/dist/types/src/genomeBrowser.d.ts +189 -0
- package/dist/types/src/gtx/fetchCoordinator.d.ts +34 -0
- package/dist/types/src/gtx/gtxReader.d.ts +144 -0
- package/dist/types/src/gtx/index.d.ts +40 -0
- package/dist/types/src/gtx/zstdWasm.d.ts +22 -0
- package/dist/types/src/headlessGenomeBrowser.d.ts +450 -0
- package/dist/types/src/index.d.ts +123 -0
- package/dist/types/src/intervalTree.d.ts +56 -0
- package/dist/types/src/io/binaryParser.d.ts +25 -0
- package/dist/types/src/io/index.d.ts +7 -0
- package/dist/types/src/io/rangeReader.d.ts +48 -0
- package/dist/types/src/locusUtils.d.ts +37 -0
- package/dist/types/src/pack.d.ts +41 -0
- package/dist/types/src/popupProvider.d.ts +22 -0
- package/dist/types/src/remoteProtocol.d.ts +81 -0
- package/dist/types/src/roi/index.d.ts +3 -0
- package/dist/types/src/roi/roiRenderer.d.ts +24 -0
- package/dist/types/src/roi/roiSet.d.ts +41 -0
- package/dist/types/src/sequence/sequenceUtils.d.ts +44 -0
- package/dist/types/src/session.d.ts +55 -0
- package/dist/types/src/stateProjection.d.ts +115 -0
- package/dist/types/src/tabix/index.d.ts +48 -0
- package/dist/types/src/themes/index.d.ts +3 -0
- package/dist/types/src/themes/renderTheme.d.ts +86 -0
- package/dist/types/src/themes/renderThemePresets.d.ts +16 -0
- package/dist/types/src/trackRegistry.d.ts +81 -0
- package/dist/types/src/trackSelector.d.ts +31 -0
- package/dist/types/src/tracks/annotation/annotationRenderer.d.ts +17 -0
- package/dist/types/src/tracks/annotation/annotationThemes.d.ts +11 -0
- package/dist/types/src/tracks/annotation/annotationTrackCanvas.d.ts +58 -0
- package/dist/types/src/tracks/annotation/index.d.ts +4 -0
- package/dist/types/src/tracks/axis/axisRenderer.d.ts +19 -0
- package/dist/types/src/tracks/axis/index.d.ts +1 -0
- package/dist/types/src/tracks/baseTrackCanvas.d.ts +113 -0
- package/dist/types/src/tracks/dynseq/dynseqRenderer.d.ts +38 -0
- package/dist/types/src/tracks/dynseq/index.d.ts +1 -0
- package/dist/types/src/tracks/index.d.ts +7 -0
- package/dist/types/src/tracks/interaction/index.d.ts +4 -0
- package/dist/types/src/tracks/interaction/interactionRenderer.d.ts +52 -0
- package/dist/types/src/tracks/interaction/interactionTrackCanvas.d.ts +54 -0
- package/dist/types/src/tracks/ruler/index.d.ts +3 -0
- package/dist/types/src/tracks/ruler/rulerRenderer.d.ts +25 -0
- package/dist/types/src/tracks/ruler/rulerTrackCanvas.d.ts +43 -0
- package/dist/types/src/tracks/sequence/index.d.ts +5 -0
- package/dist/types/src/tracks/sequence/sequenceRenderer.d.ts +34 -0
- package/dist/types/src/tracks/sequence/sequenceThemes.d.ts +11 -0
- package/dist/types/src/tracks/sequence/sequenceTrackCanvas.d.ts +67 -0
- package/dist/types/src/tracks/wig/index.d.ts +5 -0
- package/dist/types/src/tracks/wig/wigRenderer.d.ts +15 -0
- package/dist/types/src/tracks/wig/wigSummary.d.ts +31 -0
- package/dist/types/src/tracks/wig/wigThemes.d.ts +15 -0
- package/dist/types/src/tracks/wig/wigTrackCanvas.d.ts +82 -0
- package/dist/types/src/types.d.ts +885 -0
- package/dist/types/src/ui/components/LoomBrowserShell.d.ts +52 -0
- package/dist/types/src/ui/components/LoomChromosomeSelect.d.ts +18 -0
- package/dist/types/src/ui/components/LoomContextMenu.d.ts +39 -0
- package/dist/types/src/ui/components/LoomExportControls.d.ts +13 -0
- package/dist/types/src/ui/components/LoomInputDialog.d.ts +27 -0
- package/dist/types/src/ui/components/LoomLocusInput.d.ts +18 -0
- package/dist/types/src/ui/components/LoomNavbar.d.ts +15 -0
- package/dist/types/src/ui/components/LoomPopup.d.ts +32 -0
- package/dist/types/src/ui/components/LoomWindowSize.d.ts +14 -0
- package/dist/types/src/ui/components/LoomZoomControls.d.ts +10 -0
- package/dist/types/src/ui/index.d.ts +21 -0
- package/dist/types/src/ui/themes.d.ts +14 -0
- package/dist/types/src/worker/nodeWorkerProvider.d.ts +28 -0
- package/dist/types/src/worker/taskHandler.d.ts +15 -0
- package/dist/types/src/worker/webWorkerProvider.d.ts +51 -0
- package/dist/types/src/worker/workerScript.d.ts +11 -0
- package/dist/types/src/workerProvider.d.ts +76 -0
- package/dist/types/stateProjection.d.ts +115 -0
- package/dist/types/tabix/bgzBlockLoader.d.ts +60 -0
- package/dist/types/tabix/bgzf.d.ts +43 -0
- package/dist/types/tabix/index.d.ts +48 -0
- package/dist/types/tabix/tabixIndex.d.ts +85 -0
- package/dist/types/tabix/tabixReader.d.ts +60 -0
- package/dist/types/tabix/virtualOffset.d.ts +41 -0
- package/dist/types/test/src/mockCanvasProvider.d.ts +67 -0
- package/dist/types/test/src/testBedDecode.d.ts +1 -0
- package/dist/types/test/src/testCanvas2SVG.d.ts +7 -0
- package/dist/types/test/src/testChromAlias.d.ts +1 -0
- package/dist/types/test/src/testCommandDispatcher.d.ts +1 -0
- package/dist/types/test/src/testData.d.ts +7 -0
- package/dist/types/test/src/testDataLifecycle.d.ts +1 -0
- package/dist/types/test/src/testDataSourceCacheKey.d.ts +1 -0
- package/dist/types/test/src/testDataSources.d.ts +5 -0
- package/dist/types/test/src/testDecodeUcsc.d.ts +1 -0
- package/dist/types/test/src/testEvents.d.ts +1 -0
- package/dist/types/test/src/testFeatureCache.d.ts +1 -0
- package/dist/types/test/src/testFeatureParser.d.ts +1 -0
- package/dist/types/test/src/testFormatDetection.d.ts +1 -0
- package/dist/types/test/src/testGffDecode.d.ts +1 -0
- package/dist/types/test/src/testHeadlessBrowser.d.ts +1 -0
- package/dist/types/test/src/testInteractionDecoder.d.ts +1 -0
- package/dist/types/test/src/testIntervalTree.d.ts +1 -0
- package/dist/types/test/src/testLocusUtils.d.ts +1 -0
- package/dist/types/test/src/testPack.d.ts +1 -0
- package/dist/types/test/src/testROI.d.ts +1 -0
- package/dist/types/test/src/testRemoteProtocol.d.ts +1 -0
- package/dist/types/test/src/testRenderTheme.d.ts +1 -0
- package/dist/types/test/src/testSVGExport.d.ts +5 -0
- package/dist/types/test/src/testSequence.d.ts +1 -0
- package/dist/types/test/src/testSession.d.ts +1 -0
- package/dist/types/test/src/testTrackSelector.d.ts +1 -0
- package/dist/types/test/src/testTrackSerialize.d.ts +1 -0
- package/dist/types/test/src/testWigSummary.d.ts +1 -0
- package/dist/types/test/src/testWorkerDispatch.d.ts +9 -0
- package/dist/types/themes/index.d.ts +3 -0
- package/dist/types/themes/renderTheme.d.ts +86 -0
- package/dist/types/themes/renderThemePresets.d.ts +16 -0
- package/dist/types/trackRegistry.d.ts +81 -0
- package/dist/types/trackSelector.d.ts +31 -0
- package/dist/types/tracks/annotation/annotationRenderer.d.ts +17 -0
- package/dist/types/tracks/annotation/annotationThemes.d.ts +11 -0
- package/dist/types/tracks/annotation/annotationTrackCanvas.d.ts +58 -0
- package/dist/types/tracks/annotation/index.d.ts +4 -0
- package/dist/types/tracks/axis/axisRenderer.d.ts +19 -0
- package/dist/types/tracks/axis/index.d.ts +1 -0
- package/dist/types/tracks/baseTrackCanvas.d.ts +113 -0
- package/dist/types/tracks/dynseq/dynseqRenderer.d.ts +38 -0
- package/dist/types/tracks/dynseq/index.d.ts +1 -0
- package/dist/types/tracks/gene/geneRenderer.d.ts +17 -0
- package/dist/types/tracks/gene/geneThemes.d.ts +11 -0
- package/dist/types/tracks/gene/geneTrackCanvas.d.ts +58 -0
- package/dist/types/tracks/gene/index.d.ts +4 -0
- package/dist/types/tracks/index.d.ts +7 -0
- package/dist/types/tracks/interaction/index.d.ts +4 -0
- package/dist/types/tracks/interaction/interactionRenderer.d.ts +52 -0
- package/dist/types/tracks/interaction/interactionTrackCanvas.d.ts +54 -0
- package/dist/types/tracks/ruler/index.d.ts +3 -0
- package/dist/types/tracks/ruler/rulerRenderer.d.ts +25 -0
- package/dist/types/tracks/ruler/rulerTrackCanvas.d.ts +43 -0
- package/dist/types/tracks/sequence/index.d.ts +5 -0
- package/dist/types/tracks/sequence/sequenceRenderer.d.ts +34 -0
- package/dist/types/tracks/sequence/sequenceThemes.d.ts +11 -0
- package/dist/types/tracks/sequence/sequenceTrackCanvas.d.ts +67 -0
- package/dist/types/tracks/wig/index.d.ts +5 -0
- package/dist/types/tracks/wig/wigRenderer.d.ts +15 -0
- package/dist/types/tracks/wig/wigSummary.d.ts +31 -0
- package/dist/types/tracks/wig/wigThemes.d.ts +15 -0
- package/dist/types/tracks/wig/wigTrackCanvas.d.ts +82 -0
- package/dist/types/types.d.ts +885 -0
- package/dist/types/ui/components/IgvBrowserShell.d.ts +52 -0
- package/dist/types/ui/components/IgvChromosomeSelect.d.ts +18 -0
- package/dist/types/ui/components/IgvExportControls.d.ts +13 -0
- package/dist/types/ui/components/IgvLocusInput.d.ts +18 -0
- package/dist/types/ui/components/IgvNavbar.d.ts +15 -0
- package/dist/types/ui/components/IgvWindowSize.d.ts +14 -0
- package/dist/types/ui/components/IgvZoomControls.d.ts +10 -0
- package/dist/types/ui/components/LoomBrowserShell.d.ts +52 -0
- package/dist/types/ui/components/LoomChromosomeSelect.d.ts +18 -0
- package/dist/types/ui/components/LoomContextMenu.d.ts +39 -0
- package/dist/types/ui/components/LoomExportControls.d.ts +13 -0
- package/dist/types/ui/components/LoomInputDialog.d.ts +27 -0
- package/dist/types/ui/components/LoomLocusInput.d.ts +18 -0
- package/dist/types/ui/components/LoomNavbar.d.ts +15 -0
- package/dist/types/ui/components/LoomPopup.d.ts +32 -0
- package/dist/types/ui/components/LoomWindowSize.d.ts +14 -0
- package/dist/types/ui/components/LoomZoomControls.d.ts +10 -0
- package/dist/types/ui/index.d.ts +21 -0
- package/dist/types/ui/themes.d.ts +14 -0
- package/dist/types/wigRenderer.d.ts +15 -0
- package/dist/types/wigSummary.d.ts +31 -0
- package/dist/types/wigThemes.d.ts +15 -0
- package/dist/types/wigTrackCanvas.d.ts +46 -0
- package/dist/types/worker/decodeWig.d.ts +20 -0
- package/dist/types/worker/nodeWorkerProvider.d.ts +28 -0
- package/dist/types/worker/taskHandler.d.ts +15 -0
- package/dist/types/worker/webWorkerProvider.d.ts +51 -0
- package/dist/types/worker/workerScript.d.ts +11 -0
- package/dist/types/workerProvider.d.ts +76 -0
- package/package.json +102 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function t(t){const e=document.createElement("div");return e.innerHTML=t,e.firstElementChild}function e(t){return i("div",t)}function i(t,e){const i=document.createElement(t);return e&&(e.class&&i.classList.add(e.class),e.id&&(i.id=e.id),e.style&&function(t,e){for(let i of Object.keys(e))t.style[i]=e[i]}(i,e.style)),i}function r(t){const e=getComputedStyle(t);"none"!==e.display&&(t._initialDisplay=e.display),t.style.display="none"}function s(t){const e=t._initialDisplay||"block";t.style.display=e}function o(t){if(t.type.startsWith("touch")){const e=t.touches[0];return{x:e.pageX,y:e.pageY}}return{x:t.pageX,y:t.pageY}}function n(){return("0000"+(Math.random()*Math.pow(36,4)|0).toString(36)).slice(-4)}function a(t,e){const{clientX:i,clientY:r}=t;return((t,{clientX:e,clientY:i})=>{const{left:r,top:s,width:o,height:n}=t.getBoundingClientRect(),a=e-r,c=i-s;return{x:a,y:c,xNormalized:a/o,yNormalized:c/n,width:o,height:n}})(e,{clientX:i,clientY:r})}class c{constructor(){this.elem=i("div",{class:"igv-ui-panel-column"})}add(t){if(t instanceof Node)this.elem.appendChild(t);else if("object"==typeof t)this.elem.appendChild(t.elem);else{const i=e();i.innerHTML=t,this.elem.appendChild(i),this.html=i}}}function l(t,e){return h(t,e)}function h(t,e){e=e||"currentColor";let i=d[t];i||(console.error(`No icon named: ${t}`),i=d.question);const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttributeNS(null,"viewBox","0 0 "+i[0]+" "+i[1]);const s=document.createElementNS("http://www.w3.org/2000/svg","path");return s.setAttributeNS(null,"fill",e),s.setAttributeNS(null,"d",i[4]),r.appendChild(s),r}const d={check:[512,512,[],"f00c","M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"],cog:[512,512,[],"f013","M444.788 291.1l42.616 24.599c4.867 2.809 7.126 8.618 5.459 13.985-11.07 35.642-29.97 67.842-54.689 94.586a12.016 12.016 0 0 1-14.832 2.254l-42.584-24.595a191.577 191.577 0 0 1-60.759 35.13v49.182a12.01 12.01 0 0 1-9.377 11.718c-34.956 7.85-72.499 8.256-109.219.007-5.49-1.233-9.403-6.096-9.403-11.723v-49.184a191.555 191.555 0 0 1-60.759-35.13l-42.584 24.595a12.016 12.016 0 0 1-14.832-2.254c-24.718-26.744-43.619-58.944-54.689-94.586-1.667-5.366.592-11.175 5.459-13.985L67.212 291.1a193.48 193.48 0 0 1 0-70.199l-42.616-24.599c-4.867-2.809-7.126-8.618-5.459-13.985 11.07-35.642 29.97-67.842 54.689-94.586a12.016 12.016 0 0 1 14.832-2.254l42.584 24.595a191.577 191.577 0 0 1 60.759-35.13V25.759a12.01 12.01 0 0 1 9.377-11.718c34.956-7.85 72.499-8.256 109.219-.007 5.49 1.233 9.403 6.096 9.403 11.723v49.184a191.555 191.555 0 0 1 60.759 35.13l42.584-24.595a12.016 12.016 0 0 1 14.832 2.254c24.718 26.744 43.619 58.944 54.689 94.586 1.667 5.366-.592 11.175-5.459 13.985L444.788 220.9a193.485 193.485 0 0 1 0 70.2zM336 256c0-44.112-35.888-80-80-80s-80 35.888-80 80 35.888 80 80 80 80-35.888 80-80z"],exclamation:[192,512,[],"f12a","M176 432c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80zM25.26 25.199l13.6 272C39.499 309.972 50.041 320 62.83 320h66.34c12.789 0 23.331-10.028 23.97-22.801l13.6-272C167.425 11.49 156.496 0 142.77 0H49.23C35.504 0 24.575 11.49 25.26 25.199z"],"exclamation-circle":[512,512,[],"f06a","M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"],"exclamation-triangle":[576,512,[],"f071","M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"],minus:[448,512,[],"f068","M424 318.2c13.3 0 24-10.7 24-24v-76.4c0-13.3-10.7-24-24-24H24c-13.3 0-24 10.7-24 24v76.4c0 13.3 10.7 24 24 24h400z"],"minus-circle":[512,512,[],"f056","M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zM124 296c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h264c6.6 0 12 5.4 12 12v56c0 6.6-5.4 12-12 12H124z"],"minus-square":[448,512,[],"f146","M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM92 296c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h264c6.6 0 12 5.4 12 12v56c0 6.6-5.4 12-12 12H92z"],plus:[448,512,[],"f067","M448 294.2v-76.4c0-13.3-10.7-24-24-24H286.2V56c0-13.3-10.7-24-24-24h-76.4c-13.3 0-24 10.7-24 24v137.8H24c-13.3 0-24 10.7-24 24v76.4c0 13.3 10.7 24 24 24h137.8V456c0 13.3 10.7 24 24 24h76.4c13.3 0 24-10.7 24-24V318.2H424c13.3 0 24-10.7 24-24z"],"plus-circle":[512,512,[],"f055","M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"],"plus-square":[448,512,[],"f0fe","M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-32 252c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92H92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"],question:[384,512,[],"f128","M202.021 0C122.202 0 70.503 32.703 29.914 91.026c-7.363 10.58-5.093 25.086 5.178 32.874l43.138 32.709c10.373 7.865 25.132 6.026 33.253-4.148 25.049-31.381 43.63-49.449 82.757-49.449 30.764 0 68.816 19.799 68.816 49.631 0 22.552-18.617 34.134-48.993 51.164-35.423 19.86-82.299 44.576-82.299 106.405V320c0 13.255 10.745 24 24 24h72.471c13.255 0 24-10.745 24-24v-5.773c0-42.86 125.268-44.645 125.268-160.627C377.504 66.256 286.902 0 202.021 0zM192 373.459c-38.196 0-69.271 31.075-69.271 69.271 0 38.195 31.075 69.27 69.271 69.27s69.271-31.075 69.271-69.271-31.075-69.27-69.271-69.27z"],save:[448,512,[],"f0c7","M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"],search:[512,512,[],"f002","M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"],share:[512,512,[],"f064","M503.691 189.836L327.687 37.851C312.281 24.546 288 35.347 288 56.015v80.053C127.371 137.907 0 170.1 0 322.326c0 61.441 39.581 122.309 83.333 154.132 13.653 9.931 33.111-2.533 28.077-18.631C66.066 312.814 132.917 274.316 288 272.085V360c0 20.7 24.3 31.453 39.687 18.164l176.004-152c11.071-9.562 11.086-26.753 0-36.328z"],spinner:[512,512,[],"f110","M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"],square:[448,512,[],"f0c8","M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z"],"square-full":[512,512,[],"f45c","M512 512H0V0h512v512z"],times:[384,512,[],"f00d","M323.1 441l53.9-53.9c9.4-9.4 9.4-24.5 0-33.9L279.8 256l97.2-97.2c9.4-9.4 9.4-24.5 0-33.9L323.1 71c-9.4-9.4-24.5-9.4-33.9 0L192 168.2 94.8 71c-9.4-9.4-24.5-9.4-33.9 0L7 124.9c-9.4 9.4-9.4 24.5 0 33.9l97.2 97.2L7 353.2c-9.4 9.4-9.4 24.5 0 33.9L60.9 441c9.4 9.4 24.5 9.4 33.9 0l97.2-97.2 97.2 97.2c9.3 9.3 24.5 9.3 33.9 0z"],"times-circle":[512,512,[],"f057","M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"],wrench:[512,512,[],"f0ad","M481.156 200c9.3 0 15.12 10.155 10.325 18.124C466.295 259.992 420.419 288 368 288c-79.222 0-143.501-63.974-143.997-143.079C223.505 65.469 288.548-.001 368.002 0c52.362.001 98.196 27.949 123.4 69.743C496.24 77.766 490.523 88 481.154 88H376l-40 56 40 56h105.156zm-171.649 93.003L109.255 493.255c-24.994 24.993-65.515 24.994-90.51 0-24.993-24.994-24.993-65.516 0-90.51L218.991 202.5c16.16 41.197 49.303 74.335 90.516 90.503zM104 432c0-13.255-10.745-24-24-24s-24 10.745-24 24 10.745 24 24 24 24-10.745 24-24z"]};function u(t,e){var i=document.createElement("div");t.appendChild(i),i.appendChild(l("times")),i.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation(),e()})}let f;function p(t,e,i){e.addEventListener("mousedown",function(t){t.stopPropagation(),t.preventDefault();const e=g.bind(this),r=m.bind(this),s=getComputedStyle(this),o=this.getBoundingClientRect();f={constraint:i,dragFunction:e,dragEndFunction:r,screenX:t.screenX,screenY:t.screenY,minDy:-o.top,minDx:-o.left,top:parseInt(s.top.replace("px","")),left:parseInt(s.left.replace("px",""))},document.addEventListener("mousemove",e),document.addEventListener("mouseup",r),document.addEventListener("mouseleave",r),document.addEventListener("mouseexit",r)}.bind(t))}function g(t){if(!f)return void console.error("No drag data!");t.stopPropagation(),t.preventDefault();const e=Math.max(f.minDx,t.screenX-f.screenX),i=Math.max(f.minDy,t.screenY-f.screenY),r=f.left+e,s=f.top+i;this.style.left=`${r}px`,this.style.top=`${s}px`}function m(t){if(!f)return void console.error("No drag data!");t.stopPropagation(),t.preventDefault();const e=f.dragFunction,i=f.dragEndFunction;document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",i),document.removeEventListener("mouseleave",i),document.removeEventListener("mouseexit",i),f=void 0}class w{constructor({parent:t,label:i,content:r,okHandler:s,cancelHandler:o}){this.parent=t;const n=()=>{this.elem.style.display="none","function"==typeof o&&o(this)};this.elem=e(),this.elem.classList.add("igv-ui-generic-dialog-container","igv-ui-center-fixed");const a=e({class:"igv-ui-generic-dialog-header"});if(this.elem.appendChild(a),u(a,n),i){const t=e({class:"igv-ui-dialog-one-liner"});this.elem.appendChild(t),t.innerHTML=i}r.elem.style.margin="16px",this.elem.appendChild(r.elem),this.content=r;const c=e({class:"igv-ui-generic-dialog-ok-cancel"});this.elem.appendChild(c),this.ok=e(),c.appendChild(this.ok),this.ok.textContent="OK",this.cancel=e(),c.appendChild(this.cancel),this.cancel.textContent="Cancel",this.callback=void 0,this.ok.addEventListener("click",t=>{this.elem.style.display="none","function"==typeof s?s(this):this.callback&&"function"==typeof this.callback&&this.callback(this)}),this.cancel.addEventListener("click",n),p(this.elem,a),this.elem.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation()})}present(t,e){if(t.label&&this.label&&(this.label.textContent=t.label),t.html){const e=this.content.html;e&&(e.innerHTML=t.html)}if(t.text){const e=this.content.html;e&&(e.innerText=t.text)}t.value&&this.input&&(this.input.value=t.value),t.callback&&(this.callback=t.callback);const i=e.currentTarget,{top:r}=i.parentElement.getBoundingClientRect();this.elem.style.top=`${r}px`,this.elem.style.display="flex"}}function b(t){return"string"==typeof t||t instanceof String}function F(t){var e=String(t).split(/[.,]/);return e[0].split("").reverse().reduce(function(t,e,i){return i%3==0?t+","+e:t+e}).split("").reverse().join("")+(e[1]?"."+e[1]:"")}const v=function(t){return t.split(/\n|\r\n|\r/g)};function y(t,e){var i,r,s=[],o=t.length,n=0,a=!1;if(o>0)for(s[n]=t.charAt(0),i=1;i<o;i++)'"'===(r=t.charAt(i))?a=!a:a||r!==e?s[n]+=r:s[++n]="";return s}function A(t){return void 0===t||((t.startsWith("'")||t.startsWith('"'))&&(t=t.substring(1)),(t.endsWith("'")||t.endsWith('"'))&&(t=t.substring(0,t.length-1))),t}function C(t){return t.length>0?t.charAt(0).toUpperCase()+t.slice(1):t}function _(t){if(void 0!==t.name)return t.name;if(b(t)){let e=t.lastIndexOf("/"),i=e<0?t:t.substr(e+1);return e=i.indexOf("?"),e>0&&(i=i.substr(0,e)),i}throw Error("Expected File or string, got "+typeof t)}function x(t){return!!t&&("function"!=typeof t&&(t instanceof File||t.hasOwnProperty("name")&&"function"==typeof t.slice&&"function"==typeof t.arrayBuffer))}function k(t,e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("download",t),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}function I(t){for(var e=S,i=e.parser.loose.exec(t),r={},s=14;s--;)r[e.key[s]]=i[s]||"";return r[e.q.name]={},r[e.key[12]].replace(e.q.parser,function(t,i,s){i&&(r[e.q.name][i]=s)}),r}"object"==typeof process&&"undefined"==typeof window&&(global.atob=function(t){return Buffer.from(t,"base64").toString("binary")});const S={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};function E(t){let e=t.length;for(;--e>=0;)t[e]=0}const N=256,M=286,R=30,D=15,B=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),T=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),L=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),P=new Array(576);E(P);const O=new Array(60);E(O);const H=new Array(512);E(H);const U=new Array(256);E(U);const V=new Array(29);E(V);const q=new Array(R);function Q(t,e,i,r,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=s,this.has_stree=t&&t.length}let G,W,j;function $(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}E(q);const K=t=>t<256?H[t]:H[256+(t>>>7)],Z=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Y=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<<t.bi_valid&65535,Z(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=i)},X=(t,e,i)=>{Y(t,i[2*e],i[2*e+1])},J=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},tt=(t,e,i)=>{const r=new Array(16);let s,o,n=0;for(s=1;s<=D;s++)n=n+i[s-1]<<1,r[s]=n;for(o=0;o<=e;o++){let e=t[2*o+1];0!==e&&(t[2*o]=J(r[e]++,e))}},et=t=>{let e;for(e=0;e<M;e++)t.dyn_ltree[2*e]=0;for(e=0;e<R;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},it=t=>{t.bi_valid>8?Z(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},rt=(t,e,i,r)=>{const s=2*e,o=2*i;return t[s]<t[o]||t[s]===t[o]&&r[e]<=r[i]},st=(t,e,i)=>{const r=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s<t.heap_len&&rt(e,t.heap[s+1],t.heap[s],t.depth)&&s++,!rt(e,r,t.heap[s],t.depth));)t.heap[i]=t.heap[s],i=s,s<<=1;t.heap[i]=r},ot=(t,e,i)=>{let r,s,o,n,a=0;if(0!==t.sym_next)do{r=255&t.pending_buf[t.sym_buf+a++],r+=(255&t.pending_buf[t.sym_buf+a++])<<8,s=t.pending_buf[t.sym_buf+a++],0===r?X(t,s,e):(o=U[s],X(t,o+N+1,e),n=B[o],0!==n&&(s-=V[o],Y(t,s,n)),r--,o=K(r),X(t,o,i),n=T[o],0!==n&&(r-=q[o],Y(t,r,n)))}while(a<t.sym_next);X(t,256,e)},nt=(t,e)=>{const i=e.dyn_tree,r=e.stat_desc.static_tree,s=e.stat_desc.has_stree,o=e.stat_desc.elems;let n,a,c,l=-1;for(t.heap_len=0,t.heap_max=573,n=0;n<o;n++)0!==i[2*n]?(t.heap[++t.heap_len]=l=n,t.depth[n]=0):i[2*n+1]=0;for(;t.heap_len<2;)c=t.heap[++t.heap_len]=l<2?++l:0,i[2*c]=1,t.depth[c]=0,t.opt_len--,s&&(t.static_len-=r[2*c+1]);for(e.max_code=l,n=t.heap_len>>1;n>=1;n--)st(t,i,n);c=o;do{n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],st(t,i,1),a=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=a,i[2*c]=i[2*n]+i[2*a],t.depth[c]=(t.depth[n]>=t.depth[a]?t.depth[n]:t.depth[a])+1,i[2*n+1]=i[2*a+1]=c,t.heap[1]=c++,st(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,r=e.max_code,s=e.stat_desc.static_tree,o=e.stat_desc.has_stree,n=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,c=e.stat_desc.max_length;let l,h,d,u,f,p,g=0;for(u=0;u<=D;u++)t.bl_count[u]=0;for(i[2*t.heap[t.heap_max]+1]=0,l=t.heap_max+1;l<573;l++)h=t.heap[l],u=i[2*i[2*h+1]+1]+1,u>c&&(u=c,g++),i[2*h+1]=u,h>r||(t.bl_count[u]++,f=0,h>=a&&(f=n[h-a]),p=i[2*h],t.opt_len+=p*(u+f),o&&(t.static_len+=p*(s[2*h+1]+f)));if(0!==g){do{for(u=c-1;0===t.bl_count[u];)u--;t.bl_count[u]--,t.bl_count[u+1]+=2,t.bl_count[c]--,g-=2}while(g>0);for(u=c;0!==u;u--)for(h=t.bl_count[u];0!==h;)d=t.heap[--l],d>r||(i[2*d+1]!==u&&(t.opt_len+=(u-i[2*d+1])*i[2*d],i[2*d+1]=u),h--)}})(t,e),tt(i,l,t.bl_count)},at=(t,e,i)=>{let r,s,o=-1,n=e[1],a=0,c=7,l=4;for(0===n&&(c=138,l=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)s=n,n=e[2*(r+1)+1],++a<c&&s===n||(a<l?t.bl_tree[2*s]+=a:0!==s?(s!==o&&t.bl_tree[2*s]++,t.bl_tree[32]++):a<=10?t.bl_tree[34]++:t.bl_tree[36]++,a=0,o=s,0===n?(c=138,l=3):s===n?(c=6,l=3):(c=7,l=4))},ct=(t,e,i)=>{let r,s,o=-1,n=e[1],a=0,c=7,l=4;for(0===n&&(c=138,l=3),r=0;r<=i;r++)if(s=n,n=e[2*(r+1)+1],!(++a<c&&s===n)){if(a<l)do{X(t,s,t.bl_tree)}while(0!==--a);else 0!==s?(s!==o&&(X(t,s,t.bl_tree),a--),X(t,16,t.bl_tree),Y(t,a-3,2)):a<=10?(X(t,17,t.bl_tree),Y(t,a-3,3)):(X(t,18,t.bl_tree),Y(t,a-11,7));a=0,o=s,0===n?(c=138,l=3):s===n?(c=6,l=3):(c=7,l=4)}};let lt=!1;const ht=(t,e,i,r)=>{Y(t,0+(r?1:0),3),it(t),Z(t,i),Z(t,~i),i&&t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i};var dt=(t,e,i,r)=>{let s,o,n=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<N;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),nt(t,t.l_desc),nt(t,t.d_desc),n=(t=>{let e;for(at(t,t.dyn_ltree,t.l_desc.max_code),at(t,t.dyn_dtree,t.d_desc.max_code),nt(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*z[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,o=t.static_len+3+7>>>3,o<=s&&(s=o)):s=o=i+5,i+4<=s&&-1!==e?ht(t,e,i,r):4===t.strategy||o===s?(Y(t,2+(r?1:0),3),ot(t,P,O)):(Y(t,4+(r?1:0),3),((t,e,i,r)=>{let s;for(Y(t,e-257,5),Y(t,i-1,5),Y(t,r-4,4),s=0;s<r;s++)Y(t,t.bl_tree[2*z[s]+1],3);ct(t,t.dyn_ltree,e-1),ct(t,t.dyn_dtree,i-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,n+1),ot(t,t.dyn_ltree,t.dyn_dtree)),et(t),r&&it(t)},ut={_tr_init:t=>{lt||((()=>{let t,e,i,r,s;const o=new Array(16);for(i=0,r=0;r<28;r++)for(V[r]=i,t=0;t<1<<B[r];t++)U[i++]=r;for(U[i-1]=r,s=0,r=0;r<16;r++)for(q[r]=s,t=0;t<1<<T[r];t++)H[s++]=r;for(s>>=7;r<R;r++)for(q[r]=s<<7,t=0;t<1<<T[r]-7;t++)H[256+s++]=r;for(e=0;e<=D;e++)o[e]=0;for(t=0;t<=143;)P[2*t+1]=8,t++,o[8]++;for(;t<=255;)P[2*t+1]=9,t++,o[9]++;for(;t<=279;)P[2*t+1]=7,t++,o[7]++;for(;t<=287;)P[2*t+1]=8,t++,o[8]++;for(tt(P,287,o),t=0;t<R;t++)O[2*t+1]=5,O[2*t]=J(t,5);G=new Q(P,B,257,M,D),W=new Q(O,T,0,R,D),j=new Q(new Array(0),L,0,19,7)})(),lt=!0),t.l_desc=new $(t.dyn_ltree,G),t.d_desc=new $(t.dyn_dtree,W),t.bl_desc=new $(t.bl_tree,j),t.bi_buf=0,t.bi_valid=0,et(t)},_tr_stored_block:ht,_tr_flush_block:dt,_tr_tally:(t,e,i)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(U[i]+N+1)]++,t.dyn_dtree[2*K(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{Y(t,2,3),X(t,256,P),(t=>{16===t.bi_valid?(Z(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}};var ft=(t,e,i,r)=>{let s=65535&t,o=t>>>16&65535,n=0;for(;0!==i;){n=i>2e3?2e3:i,i-=n;do{s=s+e[r++]|0,o=o+s|0}while(--n);s%=65521,o%=65521}return s|o<<16};const pt=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var gt=(t,e,i,r)=>{const s=pt,o=r+i;t^=-1;for(let i=r;i<o;i++)t=t>>>8^s[255&(t^e[i])];return-1^t},mt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},wt={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:bt,_tr_stored_block:Ft,_tr_flush_block:vt,_tr_tally:yt,_tr_align:At}=ut,{Z_NO_FLUSH:Ct,Z_PARTIAL_FLUSH:_t,Z_FULL_FLUSH:xt,Z_FINISH:kt,Z_BLOCK:It,Z_OK:St,Z_STREAM_END:Et,Z_STREAM_ERROR:Nt,Z_DATA_ERROR:Mt,Z_BUF_ERROR:Rt,Z_DEFAULT_COMPRESSION:Dt,Z_FILTERED:Bt,Z_HUFFMAN_ONLY:Tt,Z_RLE:Lt,Z_FIXED:zt,Z_DEFAULT_STRATEGY:Pt,Z_UNKNOWN:Ot,Z_DEFLATED:Ht}=wt,Ut=258,Vt=262,qt=42,Qt=113,Gt=666,Wt=(t,e)=>(t.msg=mt[e],e),jt=t=>2*t-(t>4?9:0),$t=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Kt=t=>{let e,i,r,s=t.w_size;e=t.hash_size,r=e;do{i=t.head[--r],t.head[r]=i>=s?i-s:0}while(--e);e=s,r=e;do{i=t.prev[--r],t.prev[r]=i>=s?i-s:0}while(--e)};let Zt=(t,e,i)=>(e<<t.hash_shift^i)&t.hash_mask;const Yt=t=>{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},Xt=(t,e)=>{vt(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Yt(t.strm)},Jt=(t,e)=>{t.pending_buf[t.pending++]=e},te=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},ee=(t,e,i,r)=>{let s=t.avail_in;return s>r&&(s=r),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=ft(t.adler,e,s,i):2===t.state.wrap&&(t.adler=gt(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},ie=(t,e)=>{let i,r,s=t.max_chain_length,o=t.strstart,n=t.prev_length,a=t.nice_match;const c=t.strstart>t.w_size-Vt?t.strstart-(t.w_size-Vt):0,l=t.window,h=t.w_mask,d=t.prev,u=t.strstart+Ut;let f=l[o+n-1],p=l[o+n];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(i=e,l[i+n]===p&&l[i+n-1]===f&&l[i]===l[o]&&l[++i]===l[o+1]){o+=2,i++;do{}while(l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&o<u);if(r=Ut-(u-o),o=u-Ut,r>n){if(t.match_start=e,n=r,r>=a)break;f=l[o+n-1],p=l[o+n]}}}while((e=d[e&h])>c&&0!==--s);return n<=t.lookahead?n:t.lookahead},re=t=>{const e=t.w_size;let i,r,s;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Vt)&&(t.window.set(t.window.subarray(e,e+e-r),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Kt(t),r+=e),0===t.strm.avail_in)break;if(i=ee(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=Zt(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=Zt(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<Vt&&0!==t.strm.avail_in)},se=(t,e)=>{let i,r,s,o=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,n=0,a=t.strm.avail_in;do{if(i=65535,s=t.bi_valid+42>>3,t.strm.avail_out<s)break;if(s=t.strm.avail_out-s,r=t.strstart-t.block_start,i>r+t.strm.avail_in&&(i=r+t.strm.avail_in),i>s&&(i=s),i<o&&(0===i&&e!==kt||e===Ct||i!==r+t.strm.avail_in))break;n=e===kt&&i===r+t.strm.avail_in?1:0,Ft(t,0,0,n),t.pending_buf[t.pending-4]=i,t.pending_buf[t.pending-3]=i>>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,Yt(t.strm),r&&(r>i&&(r=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+r),t.strm.next_out),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r,t.block_start+=r,i-=r),i&&(ee(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(0===n);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),n?4:e!==Ct&&e!==kt&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(s=t.window_size-t.strstart,t.strm.avail_in>s&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,s+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),s>t.strm.avail_in&&(s=t.strm.avail_in),s&&(ee(t.strm,t.window,t.strstart,s),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.high_water<t.strstart&&(t.high_water=t.strstart),s=t.bi_valid+42>>3,s=t.pending_buf_size-s>65535?65535:t.pending_buf_size-s,o=s>t.w_size?t.w_size:s,r=t.strstart-t.block_start,(r>=o||(r||e===kt)&&e!==Ct&&0===t.strm.avail_in&&r<=s)&&(i=r>s?s:r,n=e===kt&&0===t.strm.avail_in&&i===r?1:0,Ft(t,t.block_start,i,n),t.block_start+=i,Yt(t.strm)),n?3:1)},oe=(t,e)=>{let i,r;for(;;){if(t.lookahead<Vt){if(re(t),t.lookahead<Vt&&e===Ct)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=Zt(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-Vt&&(t.match_length=ie(t,i)),t.match_length>=3)if(r=yt(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=Zt(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Zt(t,t.ins_h,t.window[t.strstart+1]);else r=yt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(Xt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===kt?(Xt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Xt(t,!1),0===t.strm.avail_out)?1:2},ne=(t,e)=>{let i,r,s;for(;;){if(t.lookahead<Vt){if(re(t),t.lookahead<Vt&&e===Ct)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=Zt(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length<t.max_lazy_match&&t.strstart-i<=t.w_size-Vt&&(t.match_length=ie(t,i),t.match_length<=5&&(t.strategy===Bt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,r=yt(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=Zt(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!==--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,r&&(Xt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(r=yt(t,0,t.window[t.strstart-1]),r&&Xt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=yt(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===kt?(Xt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Xt(t,!1),0===t.strm.avail_out)?1:2};function ae(t,e,i,r,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=r,this.func=s}const ce=[new ae(0,0,0,0,se),new ae(4,4,8,4,oe),new ae(4,5,16,8,oe),new ae(4,6,32,32,oe),new ae(4,4,16,16,ne),new ae(8,16,32,32,ne),new ae(8,16,128,128,ne),new ae(8,32,128,256,ne),new ae(32,128,258,1024,ne),new ae(32,258,258,4096,ne)];function le(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ht,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),$t(this.dyn_ltree),$t(this.dyn_dtree),$t(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),$t(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),$t(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const he=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==qt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Qt&&e.status!==Gt?1:0},de=t=>{if(he(t))return Wt(t,Nt);t.total_in=t.total_out=0,t.data_type=Ot;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?qt:Qt,t.adler=2===e.wrap?0:1,e.last_flush=-2,bt(e),St},ue=t=>{const e=de(t);var i;return e===St&&((i=t.state).window_size=2*i.w_size,$t(i.head),i.max_lazy_match=ce[i.level].max_lazy,i.good_match=ce[i.level].good_length,i.nice_match=ce[i.level].nice_length,i.max_chain_length=ce[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e},fe=(t,e,i,r,s,o)=>{if(!t)return Nt;let n=1;if(e===Dt&&(e=6),r<0?(n=0,r=-r):r>15&&(n=2,r-=16),s<1||s>9||i!==Ht||r<8||r>15||e<0||e>9||o<0||o>zt||8===r&&1!==n)return Wt(t,Nt);8===r&&(r=9);const a=new le;return t.state=a,a.strm=t,a.status=qt,a.wrap=n,a.gzhead=null,a.w_bits=r,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=s+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<s+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=e,a.strategy=o,a.method=i,ue(t)};var pe=(t,e)=>{let i=e.length;if(he(t))return Nt;const r=t.state,s=r.wrap;if(2===s||1===s&&r.status!==qt||r.lookahead)return Nt;if(1===s&&(t.adler=ft(t.adler,e,i,0)),r.wrap=0,i>=r.w_size){0===s&&($t(r.head),r.strstart=0,r.block_start=0,r.insert=0);let t=new Uint8Array(r.w_size);t.set(e.subarray(i-r.w_size,i),0),e=t,i=r.w_size}const o=t.avail_in,n=t.next_in,a=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,re(r);r.lookahead>=3;){let t=r.strstart,e=r.lookahead-2;do{r.ins_h=Zt(r,r.ins_h,r.window[t+3-1]),r.prev[t&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=t,t++}while(--e);r.strstart=t,r.lookahead=2,re(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,t.next_in=n,t.input=a,t.avail_in=o,r.wrap=s,St},ge={deflateInit:(t,e)=>fe(t,e,Ht,15,8,Pt),deflateInit2:fe,deflateReset:ue,deflateResetKeep:de,deflateSetHeader:(t,e)=>he(t)||2!==t.state.wrap?Nt:(t.state.gzhead=e,St),deflate:(t,e)=>{if(he(t)||e>It||e<0)return t?Wt(t,Nt):Nt;const i=t.state;if(!t.output||0!==t.avail_in&&!t.input||i.status===Gt&&e!==kt)return Wt(t,0===t.avail_out?Rt:Nt);const r=i.last_flush;if(i.last_flush=e,0!==i.pending){if(Yt(t),0===t.avail_out)return i.last_flush=-1,St}else if(0===t.avail_in&&jt(e)<=jt(r)&&e!==kt)return Wt(t,Rt);if(i.status===Gt&&0!==t.avail_in)return Wt(t,Rt);if(i.status===qt&&0===i.wrap&&(i.status=Qt),i.status===qt){let e=Ht+(i.w_bits-8<<4)<<8,r=-1;if(r=i.strategy>=Tt||i.level<2?0:i.level<6?1:6===i.level?2:3,e|=r<<6,0!==i.strstart&&(e|=32),e+=31-e%31,te(i,e),0!==i.strstart&&(te(i,t.adler>>>16),te(i,65535&t.adler)),t.adler=1,i.status=Qt,Yt(t),0!==i.pending)return i.last_flush=-1,St}if(57===i.status)if(t.adler=0,Jt(i,31),Jt(i,139),Jt(i,8),i.gzhead)Jt(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Jt(i,255&i.gzhead.time),Jt(i,i.gzhead.time>>8&255),Jt(i,i.gzhead.time>>16&255),Jt(i,i.gzhead.time>>24&255),Jt(i,9===i.level?2:i.strategy>=Tt||i.level<2?4:0),Jt(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Jt(i,255&i.gzhead.extra.length),Jt(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=gt(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Jt(i,0),Jt(i,0),Jt(i,0),Jt(i,0),Jt(i,0),Jt(i,9===i.level?2:i.strategy>=Tt||i.level<2?4:0),Jt(i,3),i.status=Qt,Yt(t),0!==i.pending)return i.last_flush=-1,St;if(69===i.status){if(i.gzhead.extra){let e=i.pending,r=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+r>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>e&&(t.adler=gt(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex+=s,Yt(t),0!==i.pending)return i.last_flush=-1,St;e=0,r-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+r),i.pending),i.pending+=r,i.gzhead.hcrc&&i.pending>e&&(t.adler=gt(t.adler,i.pending_buf,i.pending-e,e)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let e,r=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>r&&(t.adler=gt(t.adler,i.pending_buf,i.pending-r,r)),Yt(t),0!==i.pending)return i.last_flush=-1,St;r=0}e=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,Jt(i,e)}while(0!==e);i.gzhead.hcrc&&i.pending>r&&(t.adler=gt(t.adler,i.pending_buf,i.pending-r,r)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let e,r=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>r&&(t.adler=gt(t.adler,i.pending_buf,i.pending-r,r)),Yt(t),0!==i.pending)return i.last_flush=-1,St;r=0}e=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,Jt(i,e)}while(0!==e);i.gzhead.hcrc&&i.pending>r&&(t.adler=gt(t.adler,i.pending_buf,i.pending-r,r))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Yt(t),0!==i.pending))return i.last_flush=-1,St;Jt(i,255&t.adler),Jt(i,t.adler>>8&255),t.adler=0}if(i.status=Qt,Yt(t),0!==i.pending)return i.last_flush=-1,St}if(0!==t.avail_in||0!==i.lookahead||e!==Ct&&i.status!==Gt){let r=0===i.level?se(i,e):i.strategy===Tt?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(re(t),0===t.lookahead)){if(e===Ct)return 1;break}if(t.match_length=0,i=yt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(Xt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===kt?(Xt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Xt(t,!1),0===t.strm.avail_out)?1:2})(i,e):i.strategy===Lt?((t,e)=>{let i,r,s,o;const n=t.window;for(;;){if(t.lookahead<=Ut){if(re(t),t.lookahead<=Ut&&e===Ct)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,r=n[s],r===n[++s]&&r===n[++s]&&r===n[++s])){o=t.strstart+Ut;do{}while(r===n[++s]&&r===n[++s]&&r===n[++s]&&r===n[++s]&&r===n[++s]&&r===n[++s]&&r===n[++s]&&r===n[++s]&&s<o);t.match_length=Ut-(o-s),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=yt(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=yt(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(Xt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===kt?(Xt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Xt(t,!1),0===t.strm.avail_out)?1:2})(i,e):ce[i.level].func(i,e);if(3!==r&&4!==r||(i.status=Gt),1===r||3===r)return 0===t.avail_out&&(i.last_flush=-1),St;if(2===r&&(e===_t?At(i):e!==It&&(Ft(i,0,0,!1),e===xt&&($t(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Yt(t),0===t.avail_out))return i.last_flush=-1,St}return e!==kt?St:i.wrap<=0?Et:(2===i.wrap?(Jt(i,255&t.adler),Jt(i,t.adler>>8&255),Jt(i,t.adler>>16&255),Jt(i,t.adler>>24&255),Jt(i,255&t.total_in),Jt(i,t.total_in>>8&255),Jt(i,t.total_in>>16&255),Jt(i,t.total_in>>24&255)):(te(i,t.adler>>>16),te(i,65535&t.adler)),Yt(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?St:Et)},deflateEnd:t=>{if(he(t))return Nt;const e=t.state.status;return t.state=null,e===Qt?Wt(t,Mt):St},deflateSetDictionary:pe,deflateInfo:"pako deflate (from Nodeca project)"};const me=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var we=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)me(i,e)&&(t[e]=i[e])}}return t},be=t=>{let e=0;for(let i=0,r=t.length;i<r;i++)e+=t[i].length;const i=new Uint8Array(e);for(let e=0,r=0,s=t.length;e<s;e++){let s=t[e];i.set(s,r),r+=s.length}return i};let Fe=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(QA){Fe=!1}const ve=new Uint8Array(256);for(let GA=0;GA<256;GA++)ve[GA]=GA>=252?6:GA>=248?5:GA>=240?4:GA>=224?3:GA>=192?2:1;ve[254]=ve[254]=1;var ye=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,r,s,o,n=t.length,a=0;for(s=0;s<n;s++)i=t.charCodeAt(s),55296==(64512&i)&&s+1<n&&(r=t.charCodeAt(s+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),s++)),a+=i<128?1:i<2048?2:i<65536?3:4;for(e=new Uint8Array(a),o=0,s=0;o<a;s++)i=t.charCodeAt(s),55296==(64512&i)&&s+1<n&&(r=t.charCodeAt(s+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),s++)),i<128?e[o++]=i:i<2048?(e[o++]=192|i>>>6,e[o++]=128|63&i):i<65536?(e[o++]=224|i>>>12,e[o++]=128|i>>>6&63,e[o++]=128|63&i):(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63,e[o++]=128|i>>>6&63,e[o++]=128|63&i);return e},Ae=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let r,s;const o=new Array(2*i);for(s=0,r=0;r<i;){let e=t[r++];if(e<128){o[s++]=e;continue}let n=ve[e];if(n>4)o[s++]=65533,r+=n-1;else{for(e&=2===n?31:3===n?15:7;n>1&&r<i;)e=e<<6|63&t[r++],n--;n>1?o[s++]=65533:e<65536?o[s++]=e:(e-=65536,o[s++]=55296|e>>10&1023,o[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&Fe)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let r=0;r<e;r++)i+=String.fromCharCode(t[r]);return i})(o,s)},Ce=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+ve[t[i]]>e?i:e};var _e=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const xe=Object.prototype.toString,{Z_NO_FLUSH:ke,Z_SYNC_FLUSH:Ie,Z_FULL_FLUSH:Se,Z_FINISH:Ee,Z_OK:Ne,Z_STREAM_END:Me,Z_DEFAULT_COMPRESSION:Re,Z_DEFAULT_STRATEGY:De,Z_DEFLATED:Be}=wt;function Te(t){this.options=we({level:Re,method:Be,chunkSize:16384,windowBits:15,memLevel:8,strategy:De},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _e,this.strm.avail_out=0;let i=ge.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Ne)throw new Error(mt[i]);if(e.header&&ge.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?ye(e.dictionary):"[object ArrayBuffer]"===xe.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=ge.deflateSetDictionary(this.strm,t),i!==Ne)throw new Error(mt[i]);this._dict_set=!0}}function Le(t,e){const i=new Te(e);if(i.push(t,!0),i.err)throw i.msg||mt[i.err];return i.result}Te.prototype.push=function(t,e){const i=this.strm,r=this.options.chunkSize;let s,o;if(this.ended)return!1;for(o=e===~~e?e:!0===e?Ee:ke,"string"==typeof t?i.input=ye(t):"[object ArrayBuffer]"===xe.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),(o===Ie||o===Se)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=ge.deflate(i,o),s===Me)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=ge.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Ne;if(0!==i.avail_out){if(o>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Te.prototype.onData=function(t){this.chunks.push(t)},Te.prototype.onEnd=function(t){t===Ne&&(this.result=be(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var ze=function(t,e){return(e=e||{}).raw=!0,Le(t,e)},Pe=function(t,e){return(e=e||{}).gzip=!0,Le(t,e)},Oe={Deflate:Te,deflate:Le,deflateRaw:ze,gzip:Pe,constants:wt};const He=16209;var Ue=function(t,e){let i,r,s,o,n,a,c,l,h,d,u,f,p,g,m,w,b,F,v,y,A,C,_,x;const k=t.state;i=t.next_in,_=t.input,r=i+(t.avail_in-5),s=t.next_out,x=t.output,o=s-(e-t.avail_out),n=s+(t.avail_out-257),a=k.dmax,c=k.wsize,l=k.whave,h=k.wnext,d=k.window,u=k.hold,f=k.bits,p=k.lencode,g=k.distcode,m=(1<<k.lenbits)-1,w=(1<<k.distbits)-1;t:do{f<15&&(u+=_[i++]<<f,f+=8,u+=_[i++]<<f,f+=8),b=p[u&m];e:for(;;){if(F=b>>>24,u>>>=F,f-=F,F=b>>>16&255,0===F)x[s++]=65535&b;else{if(!(16&F)){if(64&F){if(32&F){k.mode=16191;break t}t.msg="invalid literal/length code",k.mode=He;break t}b=p[(65535&b)+(u&(1<<F)-1)];continue e}for(v=65535&b,F&=15,F&&(f<F&&(u+=_[i++]<<f,f+=8),v+=u&(1<<F)-1,u>>>=F,f-=F),f<15&&(u+=_[i++]<<f,f+=8,u+=_[i++]<<f,f+=8),b=g[u&w];;){if(F=b>>>24,u>>>=F,f-=F,F=b>>>16&255,16&F){if(y=65535&b,F&=15,f<F&&(u+=_[i++]<<f,f+=8,f<F&&(u+=_[i++]<<f,f+=8)),y+=u&(1<<F)-1,y>a){t.msg="invalid distance too far back",k.mode=He;break t}if(u>>>=F,f-=F,F=s-o,y>F){if(F=y-F,F>l&&k.sane){t.msg="invalid distance too far back",k.mode=He;break t}if(A=0,C=d,0===h){if(A+=c-F,F<v){v-=F;do{x[s++]=d[A++]}while(--F);A=s-y,C=x}}else if(h<F){if(A+=c+h-F,F-=h,F<v){v-=F;do{x[s++]=d[A++]}while(--F);if(A=0,h<v){F=h,v-=F;do{x[s++]=d[A++]}while(--F);A=s-y,C=x}}}else if(A+=h-F,F<v){v-=F;do{x[s++]=d[A++]}while(--F);A=s-y,C=x}for(;v>2;)x[s++]=C[A++],x[s++]=C[A++],x[s++]=C[A++],v-=3;v&&(x[s++]=C[A++],v>1&&(x[s++]=C[A++]))}else{A=s-y;do{x[s++]=x[A++],x[s++]=x[A++],x[s++]=x[A++],v-=3}while(v>2);v&&(x[s++]=x[A++],v>1&&(x[s++]=x[A++]))}break}if(64&F){t.msg="invalid distance code",k.mode=He;break t}b=g[(65535&b)+(u&(1<<F)-1)]}}break}}while(i<r&&s<n);v=f>>3,i-=v,f-=v<<3,u&=(1<<f)-1,t.next_in=i,t.next_out=s,t.avail_in=i<r?r-i+5:5-(i-r),t.avail_out=s<n?n-s+257:257-(s-n),k.hold=u,k.bits=f};const Ve=15,qe=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Qe=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ge=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),We=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var je=(t,e,i,r,s,o,n,a)=>{const c=a.bits;let l,h,d,u,f,p,g=0,m=0,w=0,b=0,F=0,v=0,y=0,A=0,C=0,_=0,x=null;const k=new Uint16Array(16),I=new Uint16Array(16);let S,E,N,M=null;for(g=0;g<=Ve;g++)k[g]=0;for(m=0;m<r;m++)k[e[i+m]]++;for(F=c,b=Ve;b>=1&&0===k[b];b--);if(F>b&&(F=b),0===b)return s[o++]=20971520,s[o++]=20971520,a.bits=1,0;for(w=1;w<b&&0===k[w];w++);for(F<w&&(F=w),A=1,g=1;g<=Ve;g++)if(A<<=1,A-=k[g],A<0)return-1;if(A>0&&(0===t||1!==b))return-1;for(I[1]=0,g=1;g<Ve;g++)I[g+1]=I[g]+k[g];for(m=0;m<r;m++)0!==e[i+m]&&(n[I[e[i+m]]++]=m);if(0===t?(x=M=n,p=20):1===t?(x=qe,M=Qe,p=257):(x=Ge,M=We,p=0),_=0,m=0,g=w,f=o,v=F,y=0,d=-1,C=1<<F,u=C-1,1===t&&C>852||2===t&&C>592)return 1;for(;;){S=g-y,n[m]+1<p?(E=0,N=n[m]):n[m]>=p?(E=M[n[m]-p],N=x[n[m]-p]):(E=96,N=0),l=1<<g-y,h=1<<v,w=h;do{h-=l,s[f+(_>>y)+h]=S<<24|E<<16|N}while(0!==h);for(l=1<<g-1;_&l;)l>>=1;if(0!==l?(_&=l-1,_+=l):_=0,m++,0===--k[g]){if(g===b)break;g=e[i+n[m]]}if(g>F&&(_&u)!==d){for(0===y&&(y=F),f+=w,v=g-y,A=1<<v;v+y<b&&(A-=k[v+y],!(A<=0));)v++,A<<=1;if(C+=1<<v,1===t&&C>852||2===t&&C>592)return 1;d=_&u,s[d]=F<<24|v<<16|f-o}}return 0!==_&&(s[f+_]=g-y<<24|64<<16),a.bits=F,0};const{Z_FINISH:$e,Z_BLOCK:Ke,Z_TREES:Ze,Z_OK:Ye,Z_STREAM_END:Xe,Z_NEED_DICT:Je,Z_STREAM_ERROR:ti,Z_DATA_ERROR:ei,Z_MEM_ERROR:ii,Z_BUF_ERROR:ri,Z_DEFLATED:si}=wt,oi=16180,ni=16190,ai=16191,ci=16192,li=16194,hi=16199,di=16200,ui=16206,fi=16209,pi=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function gi(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const mi=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<oi||e.mode>16211?1:0},wi=t=>{if(mi(t))return ti;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=oi,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Ye},bi=t=>{if(mi(t))return ti;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,wi(t)},Fi=(t,e)=>{let i;if(mi(t))return ti;const r=t.state;return e<0?(i=0,e=-e):(i=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?ti:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,bi(t))},vi=(t,e)=>{if(!t)return ti;const i=new gi;t.state=i,i.strm=t,i.window=null,i.mode=oi;const r=Fi(t,e);return r!==Ye&&(t.state=null),r};let yi,Ai,Ci=!0;const _i=t=>{if(Ci){yi=new Int32Array(512),Ai=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(je(1,t.lens,0,288,yi,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;je(2,t.lens,0,32,Ai,0,t.work,{bits:5}),Ci=!1}t.lencode=yi,t.lenbits=9,t.distcode=Ai,t.distbits=5},xi=(t,e,i,r)=>{let s;const o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(o.window.set(e.subarray(i-o.wsize,i),0),o.wnext=0,o.whave=o.wsize):(s=o.wsize-o.wnext,s>r&&(s=r),o.window.set(e.subarray(i-r,i-r+s),o.wnext),(r-=s)?(o.window.set(e.subarray(i-r,i),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0};var ki={inflateReset:bi,inflateReset2:Fi,inflateResetKeep:wi,inflateInit:t=>vi(t,15),inflateInit2:vi,inflate:(t,e)=>{let i,r,s,o,n,a,c,l,h,d,u,f,p,g,m,w,b,F,v,y,A,C,_=0;const x=new Uint8Array(4);let k,I;const S=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(mi(t)||!t.output||!t.input&&0!==t.avail_in)return ti;i=t.state,i.mode===ai&&(i.mode=ci),n=t.next_out,s=t.output,c=t.avail_out,o=t.next_in,r=t.input,a=t.avail_in,l=i.hold,h=i.bits,d=a,u=c,C=Ye;t:for(;;)switch(i.mode){case oi:if(0===i.wrap){i.mode=ci;break}for(;h<16;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(2&i.wrap&&35615===l){0===i.wbits&&(i.wbits=15),i.check=0,x[0]=255&l,x[1]=l>>>8&255,i.check=gt(i.check,x,2,0),l=0,h=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&l)<<8)+(l>>8))%31){t.msg="incorrect header check",i.mode=fi;break}if((15&l)!==si){t.msg="unknown compression method",i.mode=fi;break}if(l>>>=4,h-=4,A=8+(15&l),0===i.wbits&&(i.wbits=A),A>15||A>i.wbits){t.msg="invalid window size",i.mode=fi;break}i.dmax=1<<i.wbits,i.flags=0,t.adler=i.check=1,i.mode=512&l?16189:ai,l=0,h=0;break;case 16181:for(;h<16;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(i.flags=l,(255&i.flags)!==si){t.msg="unknown compression method",i.mode=fi;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=fi;break}i.head&&(i.head.text=l>>8&1),512&i.flags&&4&i.wrap&&(x[0]=255&l,x[1]=l>>>8&255,i.check=gt(i.check,x,2,0)),l=0,h=0,i.mode=16182;case 16182:for(;h<32;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}i.head&&(i.head.time=l),512&i.flags&&4&i.wrap&&(x[0]=255&l,x[1]=l>>>8&255,x[2]=l>>>16&255,x[3]=l>>>24&255,i.check=gt(i.check,x,4,0)),l=0,h=0,i.mode=16183;case 16183:for(;h<16;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}i.head&&(i.head.xflags=255&l,i.head.os=l>>8),512&i.flags&&4&i.wrap&&(x[0]=255&l,x[1]=l>>>8&255,i.check=gt(i.check,x,2,0)),l=0,h=0,i.mode=16184;case 16184:if(1024&i.flags){for(;h<16;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}i.length=l,i.head&&(i.head.extra_len=l),512&i.flags&&4&i.wrap&&(x[0]=255&l,x[1]=l>>>8&255,i.check=gt(i.check,x,2,0)),l=0,h=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(A=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(r.subarray(o,o+f),A)),512&i.flags&&4&i.wrap&&(i.check=gt(i.check,r,f,o)),a-=f,o+=f,i.length-=f),i.length))break t;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===a)break t;f=0;do{A=r[o+f++],i.head&&A&&i.length<65536&&(i.head.name+=String.fromCharCode(A))}while(A&&f<a);if(512&i.flags&&4&i.wrap&&(i.check=gt(i.check,r,f,o)),a-=f,o+=f,A)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===a)break t;f=0;do{A=r[o+f++],i.head&&A&&i.length<65536&&(i.head.comment+=String.fromCharCode(A))}while(A&&f<a);if(512&i.flags&&4&i.wrap&&(i.check=gt(i.check,r,f,o)),a-=f,o+=f,A)break t}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;h<16;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(4&i.wrap&&l!==(65535&i.check)){t.msg="header crc mismatch",i.mode=fi;break}l=0,h=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ai;break;case 16189:for(;h<32;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}t.adler=i.check=pi(l),l=0,h=0,i.mode=ni;case ni:if(0===i.havedict)return t.next_out=n,t.avail_out=c,t.next_in=o,t.avail_in=a,i.hold=l,i.bits=h,Je;t.adler=i.check=1,i.mode=ai;case ai:if(e===Ke||e===Ze)break t;case ci:if(i.last){l>>>=7&h,h-=7&h,i.mode=ui;break}for(;h<3;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}switch(i.last=1&l,l>>>=1,h-=1,3&l){case 0:i.mode=16193;break;case 1:if(_i(i),i.mode=hi,e===Ze){l>>>=2,h-=2;break t}break;case 2:i.mode=16196;break;case 3:t.msg="invalid block type",i.mode=fi}l>>>=2,h-=2;break;case 16193:for(l>>>=7&h,h-=7&h;h<32;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if((65535&l)!=(l>>>16^65535)){t.msg="invalid stored block lengths",i.mode=fi;break}if(i.length=65535&l,l=0,h=0,i.mode=li,e===Ze)break t;case li:i.mode=16195;case 16195:if(f=i.length,f){if(f>a&&(f=a),f>c&&(f=c),0===f)break t;s.set(r.subarray(o,o+f),n),a-=f,o+=f,c-=f,n+=f,i.length-=f;break}i.mode=ai;break;case 16196:for(;h<14;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(i.nlen=257+(31&l),l>>>=5,h-=5,i.ndist=1+(31&l),l>>>=5,h-=5,i.ncode=4+(15&l),l>>>=4,h-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=fi;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;h<3;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}i.lens[S[i.have++]]=7&l,l>>>=3,h-=3}for(;i.have<19;)i.lens[S[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,k={bits:i.lenbits},C=je(0,i.lens,0,19,i.lencode,0,i.work,k),i.lenbits=k.bits,C){t.msg="invalid code lengths set",i.mode=fi;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;_=i.lencode[l&(1<<i.lenbits)-1],m=_>>>24,w=_>>>16&255,b=65535&_,!(m<=h);){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(b<16)l>>>=m,h-=m,i.lens[i.have++]=b;else{if(16===b){for(I=m+2;h<I;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(l>>>=m,h-=m,0===i.have){t.msg="invalid bit length repeat",i.mode=fi;break}A=i.lens[i.have-1],f=3+(3&l),l>>>=2,h-=2}else if(17===b){for(I=m+3;h<I;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}l>>>=m,h-=m,A=0,f=3+(7&l),l>>>=3,h-=3}else{for(I=m+7;h<I;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}l>>>=m,h-=m,A=0,f=11+(127&l),l>>>=7,h-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=fi;break}for(;f--;)i.lens[i.have++]=A}}if(i.mode===fi)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=fi;break}if(i.lenbits=9,k={bits:i.lenbits},C=je(1,i.lens,0,i.nlen,i.lencode,0,i.work,k),i.lenbits=k.bits,C){t.msg="invalid literal/lengths set",i.mode=fi;break}if(i.distbits=6,i.distcode=i.distdyn,k={bits:i.distbits},C=je(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,k),i.distbits=k.bits,C){t.msg="invalid distances set",i.mode=fi;break}if(i.mode=hi,e===Ze)break t;case hi:i.mode=di;case di:if(a>=6&&c>=258){t.next_out=n,t.avail_out=c,t.next_in=o,t.avail_in=a,i.hold=l,i.bits=h,Ue(t,u),n=t.next_out,s=t.output,c=t.avail_out,o=t.next_in,r=t.input,a=t.avail_in,l=i.hold,h=i.bits,i.mode===ai&&(i.back=-1);break}for(i.back=0;_=i.lencode[l&(1<<i.lenbits)-1],m=_>>>24,w=_>>>16&255,b=65535&_,!(m<=h);){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(w&&!(240&w)){for(F=m,v=w,y=b;_=i.lencode[y+((l&(1<<F+v)-1)>>F)],m=_>>>24,w=_>>>16&255,b=65535&_,!(F+m<=h);){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}l>>>=F,h-=F,i.back+=F}if(l>>>=m,h-=m,i.back+=m,i.length=b,0===w){i.mode=16205;break}if(32&w){i.back=-1,i.mode=ai;break}if(64&w){t.msg="invalid literal/length code",i.mode=fi;break}i.extra=15&w,i.mode=16201;case 16201:if(i.extra){for(I=i.extra;h<I;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}i.length+=l&(1<<i.extra)-1,l>>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;_=i.distcode[l&(1<<i.distbits)-1],m=_>>>24,w=_>>>16&255,b=65535&_,!(m<=h);){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(!(240&w)){for(F=m,v=w,y=b;_=i.distcode[y+((l&(1<<F+v)-1)>>F)],m=_>>>24,w=_>>>16&255,b=65535&_,!(F+m<=h);){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}l>>>=F,h-=F,i.back+=F}if(l>>>=m,h-=m,i.back+=m,64&w){t.msg="invalid distance code",i.mode=fi;break}i.offset=b,i.extra=15&w,i.mode=16203;case 16203:if(i.extra){for(I=i.extra;h<I;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}i.offset+=l&(1<<i.extra)-1,l>>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=fi;break}i.mode=16204;case 16204:if(0===c)break t;if(f=u-c,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=fi;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),g=i.window}else g=s,p=n-i.offset,f=i.length;f>c&&(f=c),c-=f,i.length-=f;do{s[n++]=g[p++]}while(--f);0===i.length&&(i.mode=di);break;case 16205:if(0===c)break t;s[n++]=i.length,c--,i.mode=di;break;case ui:if(i.wrap){for(;h<32;){if(0===a)break t;a--,l|=r[o++]<<h,h+=8}if(u-=c,t.total_out+=u,i.total+=u,4&i.wrap&&u&&(t.adler=i.check=i.flags?gt(i.check,s,u,n-u):ft(i.check,s,u,n-u)),u=c,4&i.wrap&&(i.flags?l:pi(l))!==i.check){t.msg="incorrect data check",i.mode=fi;break}l=0,h=0}i.mode=16207;case 16207:if(i.wrap&&i.flags){for(;h<32;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(4&i.wrap&&l!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=fi;break}l=0,h=0}i.mode=16208;case 16208:C=Xe;break t;case fi:C=ei;break t;case 16210:return ii;default:return ti}return t.next_out=n,t.avail_out=c,t.next_in=o,t.avail_in=a,i.hold=l,i.bits=h,(i.wsize||u!==t.avail_out&&i.mode<fi&&(i.mode<ui||e!==$e))&&xi(t,t.output,t.next_out,u-t.avail_out),d-=t.avail_in,u-=t.avail_out,t.total_in+=d,t.total_out+=u,i.total+=u,4&i.wrap&&u&&(t.adler=i.check=i.flags?gt(i.check,s,u,t.next_out-u):ft(i.check,s,u,t.next_out-u)),t.data_type=i.bits+(i.last?64:0)+(i.mode===ai?128:0)+(i.mode===hi||i.mode===li?256:0),(0===d&&0===u||e===$e)&&C===Ye&&(C=ri),C},inflateEnd:t=>{if(mi(t))return ti;let e=t.state;return e.window&&(e.window=null),t.state=null,Ye},inflateGetHeader:(t,e)=>{if(mi(t))return ti;const i=t.state;return 2&i.wrap?(i.head=e,e.done=!1,Ye):ti},inflateSetDictionary:(t,e)=>{const i=e.length;let r,s,o;return mi(t)?ti:(r=t.state,0!==r.wrap&&r.mode!==ni?ti:r.mode===ni&&(s=1,s=ft(s,e,i,0),s!==r.check)?ei:(o=xi(t,e,i,i),o?(r.mode=16210,ii):(r.havedict=1,Ye)))},inflateInfo:"pako inflate (from Nodeca project)"};var Ii=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Si=Object.prototype.toString,{Z_NO_FLUSH:Ei,Z_FINISH:Ni,Z_OK:Mi,Z_STREAM_END:Ri,Z_NEED_DICT:Di,Z_STREAM_ERROR:Bi,Z_DATA_ERROR:Ti,Z_MEM_ERROR:Li}=wt;function zi(t){this.options=we({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _e,this.strm.avail_out=0;let i=ki.inflateInit2(this.strm,e.windowBits);if(i!==Mi)throw new Error(mt[i]);if(this.header=new Ii,ki.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=ye(e.dictionary):"[object ArrayBuffer]"===Si.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=ki.inflateSetDictionary(this.strm,e.dictionary),i!==Mi)))throw new Error(mt[i])}function Pi(t,e){const i=new zi(e);if(i.push(t),i.err)throw i.msg||mt[i.err];return i.result}zi.prototype.push=function(t,e){const i=this.strm,r=this.options.chunkSize,s=this.options.dictionary;let o,n,a;if(this.ended)return!1;for(n=e===~~e?e:!0===e?Ni:Ei,"[object ArrayBuffer]"===Si.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),o=ki.inflate(i,n),o===Di&&s&&(o=ki.inflateSetDictionary(i,s),o===Mi?o=ki.inflate(i,n):o===Ti&&(o=Di));i.avail_in>0&&o===Ri&&i.state.wrap>0&&0!==t[i.next_in];)ki.inflateReset(i),o=ki.inflate(i,n);switch(o){case Bi:case Ti:case Di:case Li:return this.onEnd(o),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||o===Ri))if("string"===this.options.to){let t=Ce(i.output,i.next_out),e=i.next_out-t,s=Ae(i.output,t);i.next_out=e,i.avail_out=r-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(o!==Mi||0!==a){if(o===Ri)return o=ki.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},zi.prototype.onData=function(t){this.chunks.push(t)},zi.prototype.onEnd=function(t){t===Mi&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=be(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Oi=function(t,e){return(e=e||{}).raw=!0,Pi(t,e)},Hi={Inflate:zi,inflate:Pi,inflateRaw:Oi,ungzip:Pi,constants:wt};const{Deflate:Ui,deflate:Vi,deflateRaw:qi,gzip:Qi}=Oe,{Inflate:Gi,inflate:Wi,inflateRaw:ji,ungzip:$i}=Hi;var Ki=qi,Zi=Wi,Yi=ji,Xi=$i;function Ji(t){const e=ArrayBuffer.isView(t)?t:new Uint8Array(t);return 31===e[0]&&139===e[1]}function tr(t){const e=ArrayBuffer.isView(t)?t:new Uint8Array(t);return 0!==(4&e[3])&&66===e[12]&&67===e[13]?er(e.buffer):Xi(e)}function er(t,e){const i=[];let r=0,s=0;for(e=e||t.byteLength-18;r<e;)try{const e=ArrayBuffer.isView(t)?t:new Uint8Array(t,r,18),o=e[11]<<8|e[10],n=(e[3],e[12],e[13],e[15],e[14],1+(e[17]<<8|e[16])),a=12+o+r,c=t.byteLength-a,l=n-o-19;if(c<l||l<=0)break;const h=new Uint8Array(t,a,l),d=Yi(h);r+=l-1+26,s+=d.byteLength,i.push(d)}catch(t){console.error(t);break}if(1===i.length)return i[0];{const t=new Uint8Array(s);let e=0;for(let r=0;r<i.length;++r){var o=new Uint8Array(i[r]);sr(o,0,t,e,o.length),e+=o.length}return t}}function ir(t){const e=ArrayBuffer.isView(t)?t:new Uint8Array(t);return 1+(e[17]<<8|e[16])}const rr="function"==typeof new Uint8Array(1).subarray;function sr(t,e,i,r,s){if(0!==s){if(!t)throw"Undef src";if(!i)throw"Undef dest";0===e&&s===t.length?or(t,i,r):rr?or(t.subarray(e,e+s),i,r):1===t.BYTES_PER_ELEMENT&&s>100?or(new Uint8Array(t.buffer,t.byteOffset+e,s),i,r):function(t,e,i,r,s){for(let o=0;o<s;++o)i[r+o]=t[e+o]}(t,e,i,r,s)}}function or(t,e,i){e.set(t,i)}function nr(t,e){const i=t.split(","),r=i[0].split(":")[1];let s=i[1];if(r.indexOf("base64")>=0){s=atob(s);const t=new Uint8Array(s.length);for(let e=0;e<s.length;e++)t[e]=s.charCodeAt(e);let i;return i=e||r.indexOf("gzip")>0?Xi(t):t,i}return decodeURIComponent(s)}const ar=(t,e,i)=>(1-i)*t+i*e,cr=function(t,e,i){return Math.min(Math.max(t,e),i)},lr=function(t){return Math.log(t)/Math.LN2};function hr(){this.content=[]}function dr(t,e){return Math.random()*(e-t)+t}hr.prototype={push:function(t){this.content.push(t),this.bubbleUp(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.sinkDown(0)),t},remove:function(t){for(var e=this.content.length,i=0;i<e;i++)if(this.content[i]===t){var r=this.content.pop();if(i===e-1)break;this.content[i]=r,this.bubbleUp(i),this.sinkDown(i);break}},size:function(){return this.content.length},bubbleUp:function(t){for(var e=this.content[t],i=e;t>0;){var r=Math.floor((t+1)/2)-1,s=this.content[r];if(i>=s)break;this.content[r]=e,this.content[t]=s,t=r}},sinkDown:function(t){for(var e=this.content.length,i=this.content[t],r=i;;){var s=2*(t+1),o=s-1,n=null;if(o<e){var a=this.content[o],c=a;a<r&&(n=o)}if(s<e)this.content[s]<(null==n?r:c)&&(n=s);if(null==n)break;this.content[t]=this.content[n],this.content[n]=i,t=n}}};const ur={rgbListFromHSV:()=>{let t=[];for(let e=1;e>=.5;e-=.1)for(let i=0;i<1;i+=1/28){const r="rgb("+ur.hsvToRgb(i,1,e).join(",")+")";t.push(r)}return t.pop(),t.push(ur.rgbColor(16,16,16)),t},rgbToHex:function(t){return(t=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===t.length?"#"+("0"+parseInt(t[1],10).toString(16)).slice(-2)+("0"+parseInt(t[2],10).toString(16)).slice(-2)+("0"+parseInt(t[3],10).toString(16)).slice(-2):""},hexToRgb:function(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);if(null!==e)return"rgb("+parseInt(e[1],16)+","+parseInt(e[2],16)+","+parseInt(e[3],16)+")"},hsvToRgb:function(t,e,i){var r,s,o,n=Math.floor(6*t),a=6*t-n,c=i*(1-e),l=i*(1-a*e),h=i*(1-(1-a)*e);switch(n%6){case 0:r=i,s=h,o=c;break;case 1:r=l,s=i,o=c;break;case 2:r=c,s=i,o=h;break;case 3:r=c,s=l,o=i;break;case 4:r=h,s=c,o=i;break;case 5:r=i,s=c,o=l}return[Math.floor(255*r),Math.floor(255*s),Math.floor(255*o)]},hslToRgb:function(t,e,i){var r,s,o;if(0===e)r=s=o=i;else{var n=i<.5?i*(1+e):i+e-i*e,a=2*i-n;r=ur.hue2rgb(a,n,t+1/3),s=ur.hue2rgb(a,n,t),o=ur.hue2rgb(a,n,t-1/3)}return[255*r,255*s,255*o]},hue2rgb:(t,e,i)=>(i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t),rgbaColor:function(t,e,i,r){return"rgba("+(t=cr(t,0,255))+","+(e=cr(e,0,255))+","+(i=cr(i,0,255))+","+(r=cr(r,0,1))+")"},rgbColor:function(t,e,i){return"rgb("+(t=cr(t,0,255))+","+(e=cr(e,0,255))+","+(i=cr(i,0,255))+")"},greyScale:function(t){var e=cr(t,0,255);return"rgb("+e+","+e+","+e+")"},randomGrey:function(t,e){t=cr(t,0,255),e=cr(e,0,255);var i=Math.round(dr(t,e)).toString(10);return"rgb("+i+","+i+","+i+")"},randomRGB:function(t,e){return t=cr(t,0,255),e=cr(e,0,255),"rgb("+Math.round(dr(t,e)).toString(10)+","+Math.round(dr(t,e)).toString(10)+","+Math.round(dr(t,e)).toString(10)+")"},randomRGBConstantAlpha:function(t,e,i){return t=cr(t,0,255),e=cr(e,0,255),"rgba("+Math.round(dr(t,e)).toString(10)+","+Math.round(dr(t,e)).toString(10)+","+Math.round(dr(t,e)).toString(10)+","+i+")"},addAlpha:function(t,e){if("0"===t||"."===t)t="rgb(0,0,0)";else{const e=this.colorNameToHex(t);e&&(t=e)}var i=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t);if(t.startsWith("rgba")){const i=t.lastIndexOf(",");return t.substring(0,i+1)+e.toString()+")"}return i&&(t=ur.hexToRgb(t)),t.startsWith("rgb")?t.replace("rgb","rgba").replace(")",", "+e+")"):(console.log(t+" is not an rgb style string"),t)},rgbComponents:function(t){if("0"===t||"."===t)return[0,0,0];if(/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t))t=ur.hexToRgb(t);else if(!t.startsWith("rgb")){const e=this.colorNameToHex(t);t=this.hexToRgb(e)}if(t.startsWith("rgb("))return t.substring(4,t.length-1).split(",").map(t=>Number.parseInt(t.trim()));if(t.startsWith("rgba("))return t.substring(5,t.length-1).split(",").map((t,e)=>(t=t.trim(),3===e?Number.parseFloat(t):Number.parseInt(t)));throw Error("Unrecognized color string: color")},getCompositeColor:function(t,e,i){return"rgb("+Math.floor(i*e[0]+(1-i)*t[0])+","+Math.floor(i*e[1]+(1-i)*t[1])+","+Math.floor(i*e[2]+(1-i)*t[2])+")"},createColorString:function(t){const e=this.createColorStringSafe(t);return e||t},createColorStringSafe:function(t){if((t=A(t)).startsWith("rgb(")&&t.endsWith(")"))return t;if(t.startsWith("#")&&t.length<8)return t;const e=this.colorNameToHex(t);if(e)return e;const i=t.split(",");return 3===i.length&&fr(i[0])&&fr(i[1])&&fr(i[2])?`rgb(${t})`:void 0},darkenLighten:function(t,e){let i,r=this.colorNameToHex(t);i=r?ur.hexToRgb(r):t.startsWith("rgb(")?t:ur.hexToRgb(t);const s=i.replace(")","").substring(4).split(","),o=Math.max(0,Math.min(255,Number.parseInt(s[0].trim())+e)),n=Math.max(0,Math.min(255,Number.parseInt(s[1].trim())+e)),a=Math.max(0,Math.min(255,Number.parseInt(s[2].trim())+e));return"rgb("+o.toString()+","+n.toString()+","+a.toString()+")"},colorNameToHex:function(t){return{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",darkgrey:"#a9a9a9",darkslategrey:"#2f4f4f",dimgrey:"#696969",grey:"#808080",lightgray:"#d3d3d3",lightslategrey:"#778899",slategrey:"#708090"}[t]}};function fr(t){const e=Number.parseInt(t);return!Number.isNaN(e)&&e>=0&&e<=255}const pr="googleapis";class gr{constructor(){this.oauthTokens={}}setToken(t,e){e=e||pr,this.oauthTokens[e]=t}getToken(t){let e;t=t||pr;for(let i of Object.keys(this.oauthTokens)){if(mr(i).test(t)){e=this.oauthTokens[i];break}}return e}removeToken(t){t=t||pr;for(let e of Object.keys(this.oauthTokens)){mr(e).test(t)&&(this.oauthTokens[e]=void 0)}}}function mr(t){return new RegExp("^"+t.split(/\*+/).map(wr).join(".*")+"$")}function wr(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")}function br(t){return t.includes("googleapis")&&!t.includes("urlshortener")||Fr(t)||vr(t)}function Fr(t){return t.startsWith("gs://")||t.startsWith("https://www.googleapis.com/storage")||t.startsWith("https://storage.cloud.google.com")||t.startsWith("https://storage.googleapis.com")}function vr(t){return t.indexOf("drive.google.com")>=0||t.indexOf("www.googleapis.com/drive")>0}function yr(t){let{bucket:e,object:i}=function(t){let e,i;if(t.startsWith("gs://")){const r=t.indexOf("/",5);if(r>=0){e=t.substring(5,r);const s=t.indexOf("?");i=s<0?t.substring(r+1):t.substring(r+1,s)}}else if(t.startsWith("https://storage.googleapis.com")||t.startsWith("https://storage.cloud.google.com")){const r=t.indexOf("/v1/b/",8);if(r>0){const s=t.indexOf("/o/",r);if(s>0){const o=t.indexOf("?",s);e=t.substring(r+6,s),i=o>0?t.substring(s+3,o):t.substring(s+3)}}else{const r=t.indexOf("/",8),s=t.indexOf("/",r+1),o=t.indexOf("?",s);s>0&&(e=t.substring(r+1,s),i=o<0?t.substring(s+1):t.substring(s+1,o))}}else if(t.startsWith("https://www.googleapis.com/storage/v1/b")){const r=t.indexOf("/v1/b/",8),s=t.indexOf("/o/",r);if(s>0){const o=t.indexOf("?",s);e=t.substring(r+6,s),i=o>0?t.substring(s+3,o):t.substring(s+3)}}if(e&&i)return{bucket:e,object:i};throw Error(`Unrecognized Google Storage URI: ${t}`)}(t);i=function(t){let e="";return t.split("").forEach(function(t){Ar.has(t)?e+=Ar.get(t):e+=t}),e}(i);const r=t.indexOf("?");return`https://storage.googleapis.com/storage/v1/b/${e}/o/${i}${r>0?t.substring(r)+"&alt=media":"?alt=media"}`}const Ar=new Map;function Cr(){return window.google&&window.google.igv}let _r;function xr(t){var e=function(t){if(t.includes("/open?id=")){const e=t.indexOf("/open?id=")+9,i=t.indexOf("&");if(e>0&&i>e)return t.substring(e,i);if(e>0)return t.substring(e)}else{if(t.includes("/file/d/")){const e=t.indexOf("/file/d/")+8,i=t.lastIndexOf("/");return t.substring(e,i)}if(t.startsWith("https://www.googleapis.com/drive")){let e=t.indexOf("/files/");const i=t.indexOf("?");if(e>0)return e+=7,i>0?t.substring(e,i):t.substring(e)}}throw Error("Unknown Google Drive url format: "+t)}(t);return e?"https://www.googleapis.com/drive/v3/files/"+e+"?alt=media&supportsTeamDrives=true":t}Ar.set("!","%21"),Ar.set("#","%23"),Ar.set("$","%24"),Ar.set("%","%25"),Ar.set("&","%26"),Ar.set("'","%27"),Ar.set("(","%28"),Ar.set(")","%29"),Ar.set("*","%2A"),Ar.set("+","%2B"),Ar.set(",","%2C"),Ar.set("/","%2F"),Ar.set(":","%3A"),Ar.set(";","%3B"),Ar.set("=","%3D"),Ar.set("?","%3F"),Ar.set("@","%40"),Ar.set("[","%5B"),Ar.set("]","%5D"),Ar.set(" ","%20");class kr{constructor(t){this.requestsPerSecond=t.requestsPerSecond||10,this.lastStartTime=0,this.queued=[]}add(t,e){var i=this;return new Promise(function(e,r){i.queued.push({resolve:e,reject:r,asyncFunction:t}),i.dequeue()})}addAll(t,e){var i=t.map(function(t){return this.add(t,e)}.bind(this));return Promise.all(i)}dequeue(){if(this.queued.length>0){var t=new Date,e=1e3/this.requestsPerSecond+1,i=t-this.lastStartTime;i>=e?this._execute():setTimeout(function(){this.dequeue()}.bind(this),e-i)}}async _execute(){this.lastStartTime=new Date;var t=this.queued.shift();const e=t.asyncFunction;try{const i=await e();t.resolve(i)}catch(e){t.reject(e)}}}function Ir(){if(Cr()){return Cr()&&google.igv.tokenResponse&&Date.now()<google.igv.tokenExpiresAt?google.igv.tokenResponse.access_token:void 0}}function Sr(t){let e;return e=Ji(t)?tr(t):new Uint8Array(t),"TextDecoder"in function(){if("undefined"!=typeof self)return self;return"undefined"!=typeof global?global:window}()?(new TextDecoder).decode(e):function(t){var e="",i=0;for(;i<t.length;){var r=t[i],s=0,o=0;if(r<=127?(s=0,o=255&r):r<=223?(s=1,o=31&r):r<=239?(s=2,o=15&r):r<=244&&(s=3,o=7&r),t.length-i-s>0)for(var n=0;n<s;)o=o<<6|63&(r=t[i+n+1]),n+=1;else o=65533,s=t.length-i;e+=String.fromCodePoint(o),i+=s+1}return e}(e)}const Er=new class{constructor(){this.apiKey=void 0,this.googleThrottle=new kr({requestsPerSecond:8}),this.RANGE_WARNING_GIVEN=!1,this.oauth=new gr}setApiKey(t){this.apiKey=t}async loadArrayBuffer(t,e){return(e=e||{}).responseType||(e.responseType="arraybuffer"),x(t)?this._loadFileSlice(t,e):this.load(t,e)}async loadByteArray(t,e){const i=await this.loadArrayBuffer(t,e);let r;return r=Ji(i)?tr(i):new Uint8Array(i),r}async loadJson(t,e){"POST"===((e=e||{}).method||(e.sendData?"POST":"GET"))&&(e.contentType="application/json");const i=await this.loadString(t,e);return i?JSON.parse(i):i}async loadString(t,e){return e=e||{},t instanceof File?this._loadStringFromFile(t,e):this._loadStringFromUrl(t,e)}async load(t,e){e=e||{};const i=typeof t;if(x(t=await("function"==typeof t?t():t)))return this._loadFileSlice(t,e);if("function"==typeof t.startsWith){if(t.startsWith("data:")){const i=nr(t).buffer;if(e.range){const t=e.range.size?e.range.start+e.range.size:i.byteLength;return i.slice(e.range.start,t)}return i}return t.startsWith("https://drive.google.com")&&(t=xr(t)),vr(t)||t.startsWith("https://www.dropbox.com")?this.googleThrottle.add(async()=>this._loadURL(t,e)):this._loadURL(t,e)}throw Error(`url must be either a 'File', 'string', 'function', or 'Promise'. Actual type: ${i}`)}async _loadURL(t,e){const i=this,r=t;t=function(t){return t.startsWith("https://www.dropbox.com")?t.replace("//www.dropbox.com","//dl.dropboxusercontent.com"):t.startsWith("https://drive.google.com")?xr(t):t.includes("//www.broadinstitute.org/igvdata")?t.replace("//www.broadinstitute.org/igvdata","//data.broadinstitute.org/igvdata"):t.includes("//igvdata.broadinstitute.org")?t.replace("//igvdata.broadinstitute.org","//s3.amazonaws.com/igv.broadinstitute.org"):t.includes("//igv.genepattern.org")?t.replace("//igv.genepattern.org","//igv-genepattern-org.s3.amazonaws.com"):t.startsWith("ftp://ftp.ncbi.nlm.nih.gov/geo")?t.replace("ftp://","https://"):t}(t);let s=(e=e||{}).oauthToken||this.getOauthToken(t);return s&&(s=await("function"==typeof s?s():s)),new Promise(function(o,n){br(t)&&!function(t){return t.indexOf("X-Goog-Signature")>-1}(t)&&(Fr(t)&&(t=yr(t)),vr(t=function(t){let e=Er.apiKey;e||"undefined"==typeof gapi||(e=gapi.apiKey);if(void 0!==e&&!t.includes("key=")){const i=t.includes("?")?"&":"?";t=t+i+"key="+e}return t}(t))&&function(t){if(t.includes("supportsTeamDrive"))return t;{const e=t.includes("?")?"&":"?";t=t+e+"supportsTeamDrive=true"}}(t),s||(s=Ir()));const a=e.headers||{};s&&function(t,e){e&&(t["Cache-Control"]="no-cache",t.Authorization="Bearer "+e)}(a,s);const c=e.range,l=new XMLHttpRequest,h=e.sendData||e.body,d=e.method||(h?"POST":"GET"),u=e.responseType,f=e.contentType,p=e.mimeType;if(l.open(d,t),e.timeout&&(l.timeout=e.timeout),c){let t="";c.size&&(t=c.start+c.size-1),l.setRequestHeader("Range","bytes="+c.start+"-"+t)}if(f&&l.setRequestHeader("Content-Type",f),p&&l.overrideMimeType(p),u&&(l.responseType=u),a)for(let t of Object.keys(a)){const e=a[t];l.setRequestHeader(t,e)}!0===e.withCredentials&&(l.withCredentials=!0),l.onload=async function(r){if(0===l.status||l.status>=200&&l.status<=300)if("HEAD"===e.method){const t=e.requestedHeaders||["content-length"],i={};for(let e of t)i[e]=l.getResponseHeader(e);o(i)}else c&&206!==l.status&&0!==c.start?(l.response.length>1e5&&!i.RANGE_WARNING_GIVEN&&alert(`Warning: Range header ignored for URL: ${t}. This can have severe performance impacts.`),o(l.response.slice(c.start,c.start+c.size))):o(l.response);else 416===l.status?g(Error("416 Unsatisfiable Range")):!Cr()||404!==l.status&&401!==l.status&&403!==l.status||!br(t)||e.retries?403===l.status?g("Access forbidden: "+t):g(l.status):m()},l.onerror=function(i){br(t)&&!e.retries?m():g("Error accessing resource: "+t+" Status: "+l.status)},l.ontimeout=function(t){g("Timed out")},l.onabort=function(t){console.log("Aborted"),n(t)};try{l.send(h)}catch(i){br(t)&&!e.retries?m():g(i)}function g(t){if(!n)throw t;n(t)}async function m(){try{const t=await async function(t){if(Cr()){const e=function(t){return vr(t)?"https://www.googleapis.com/auth/drive.file":Fr(t)?"https://www.googleapis.com/auth/devstorage.read_only":"https://www.googleapis.com/auth/userinfo.profile"}(t),i=await async function(t){if(!Cr())throw Error("Google oAuth has not been initialized");if(google.igv.tokenResponse&&Date.now()<google.igv.tokenExpiresAt&&google.accounts.oauth2.hasGrantedAllScopes(google.igv.tokenResponse,t))return google.igv.tokenResponse.access_token;{const e=google.igv.tokenClient;return _r||(_r=new Promise((i,r)=>{try{e.callback=t=>{void 0!==t.error&&r(t),google.igv.tokenResponse=t,google.igv.tokenExpiresAt=Date.now()+1e3*t.expires_in,console.log("Access token expires at "+new Date(google.igv.tokenExpiresAt)),i(t.access_token)},console.log("Requesting access token"),e.requestAccessToken({scope:t})}catch(t){console.log(t)}})),_r}}(e);return i}throw Error("Authorization is required, but Google oAuth has not been initalized. Contact your site administrator for assistance.")}(r);e.retries=1,e.oauthToken=t;const s=await i.load(r,e);o(s)}catch(t){if(t.error){const e=t.error.startsWith("popup_blocked")?"Google login popup blocked by browser.":t.error;alert(e)}else g(t)}}})}async _loadFileSlice(t,e){let i=e&&e.range?t.slice(e.range.start,e.range.start+e.range.size):t;const r=await i.arrayBuffer();return"arraybuffer"===e.responseType?r:Sr(r)}async _loadStringFromFile(t,e){const i=e.range?t.slice(e.range.start,e.range.start+e.range.size):t;return Sr(await i.arrayBuffer())}async _loadStringFromUrl(t,e){(e=e||{}).responseType="arraybuffer";return Sr(await this.load(t,e))}setOauthToken(t,e){this.oauth.setToken(t,e)}getOauthToken(t){const e=br(t)?void 0:I(t).host;let i=this.oauth.getToken(e);if(i)return i;if(void 0===e){const t=Ir();if(t&&t.expires_at>Date.now())return t.access_token}}async getContentLength(t,e){(e=e||{}).method="HEAD",e.requestedHeaders=["content-length"];const i=(await this._loadURL(t,e))["content-length"];return i?Number.parseInt(i):0}};var Nr={color:1};Nr.parent=Nr,Nr.left=Nr,Nr.right=Nr;class Mr{constructor(){this.root=Nr}insert(t,e,i){var r=new zr(new Lr(t,e,i));for(this.treeInsert(r),r.color=2;r!==this.root&&2===r.parent.color;)if(r.parent===r.parent.parent.left){let t=r.parent.parent.right;2===t.color?(r.parent.color=1,t.color=1,r.parent.parent.color=2,r=r.parent.parent):(r===r.parent.right&&(r=r.parent,Dr.call(this,r)),r.parent.color=1,r.parent.parent.color=2,Br.call(this,r.parent.parent))}else{let t=r.parent.parent.left;2===t.color?(r.parent.color=1,t.color=1,r.parent.parent.color=2,r=r.parent.parent):(r===r.parent.left&&(r=r.parent,Br.call(this,r)),r.parent.color=1,r.parent.parent.color=2,Dr.call(this,r.parent.parent))}this.root.color=1}findOverlapping(t,e){var i=new Lr(t,e,0);if(this.root===Nr)return[];var r=Rr.call(this,i,this.root,[]);return r.length>1&&r.sort(function(t,e){return t.low-e.low}),r}logIntervals(){!function t(e,i){for(var r="",s=0;s<i;s++)r+=" ";console.log(r+e.interval.low+" "+e.interval.high),i+=5,e.left!==Nr&&t(e.left,i);e.right!==Nr&&t(e.right,i)}(this.root,0)}mapIntervals(t){!function e(i){t(i.interval),i.left!==Nr&&e(i.left);i.right!==Nr&&e(i.right)}(this.root)}treeInsert(t){for(var e=this.root,i=Nr;e!==Nr;)i=e,e=t.interval.low<=e.interval.low?e.left:e.right;t.parent=i,i===Nr?(this.root=t,t.left=t.right=Nr):t.interval.low<=i.interval.low?i.left=t:i.right=t,Tr.call(this,t)}}function Rr(t,e,i){return e.interval.overlaps(t)&&i.push(e.interval),e.left!==Nr&&e.left.max>=t.low&&Rr.call(this,t,e.left,i),e.right!==Nr&&e.right.min<=t.high&&Rr.call(this,t,e.right,i),i}function Dr(t){var e=t.right;t.right=e.left,e.left!==Nr&&(e.left.parent=t),e.parent=t.parent,t.parent===Nr?this.root=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e,Tr.call(this,t)}function Br(t){var e=t.left;t.left=e.right,e.right!==Nr&&(e.right.parent=t),e.parent=t.parent,t.parent===Nr?this.root=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e,Tr.call(this,t)}function Tr(t){for(;t!==Nr;){var e=t.left.max>t.right.max?t.left.max:t.right.max,i=t.interval.high;t.max=e>i?e:i;var r=t.left.min<t.right.min?t.left.min:t.right.min,s=t.interval.low;t.min=r<s?r:s,t=t.parent}}class Lr{constructor(t,e,i){this.low=t,this.high=e,this.value=i}equals(t){return!!t&&(this===t||this.low===t.low&&this.high===t.high)}compareTo(t){return this.low<t.low?-1:this.low>t.low?1:this.high<t.high?-1:this.high>t.high?1:0}overlaps(t){return this.low<=t.high&&t.low<=this.high}}function zr(t){this.parent=Nr,this.left=Nr,this.right=Nr,this.interval=t,this.color=2}const Pr=function(t,e,i){if(t&&0!==t.length){const r=function(t){const e=new Mr,i=t.length,r=Math.max(10,Math.round(i/100));t.sort(function(t,e){return t.start===e.start?0:t.start>e.start?1:-1});for(let s=0;s<i;s+=r){const o=Math.min(i,s+r),n=t.slice(s,o),a=n[0].start;let c=a;n.forEach(function(t){c=Math.max(c,t.end)}),e.insert(a,c,n)}return e}(t),s=r.findOverlapping(e,i);return 0===s.length?[]:(t=[],s.forEach(function(r){const s=r.value,o=s.length;for(let r=0;r<o;r++){const o=s[r];if(o.start>i)break;o.end>e&&t.push(o)}}),t.sort(function(t,e){return t.start-e.start}),t)}return[]};function Or(t){if(3===(t=t.replace(/^#/,"")).length&&(t=t.split("").map(t=>t+t).join("")),6!==t.length)throw new Error("Invalid HEX color.");let e=parseInt(t,16);return`rgb(${e>>16&255}, ${e>>8&255}, ${255&e})`}const Hr={licorice:"#000000",steel:"#6e6e6e",magnesium:"#b8b8b8",mercury:"#e8e8e8",cayenne:"#891100",mocha:"#894800",aspargus:"#888501",fern:"#458401",teal:"#008688",salmon:"#ff726e",tangerine:"#ff8802",cantaloupe:"#ffce6e",lemon:"#fffa03",lime:"#83f902",honeydew:"#cefa6e",ice:"#68fdff",aqua:"#008cff",blueberry:"#002eff",midnight:"#001888",grape:"#8931ff",lavender:"#d278ff",orchid:"#6e76ff",strawberry:"#ff2987",magenta:"#ff39ff",carnation:"#ff7fd3"},Ur={cantaloupe:{r:255,g:206,b:110},honeydew:{r:206,g:250,b:110},spindrift:{r:104,g:251,b:208},sky:{r:106,g:207,b:255},lavender:{r:210,g:120,b:255},carnation:{r:255,g:127,b:211},licorice:{r:0,g:0,b:0},snow:{r:255,g:255,b:255},salmon:{r:255,g:114,b:110},banana:{r:255,g:251,b:109},flora:{r:104,g:249,b:110},ice:{r:104,g:253,b:255},orchid:{r:110,g:118,b:255},bubblegum:{r:255,g:122,b:255},lead:{r:30,g:30,b:30},mercury:{r:232,g:232,b:232},tangerine:{r:255,g:136,b:2},lime:{r:131,g:249,b:2},sea_foam:{r:3,g:249,b:135},aqua:{r:0,g:140,b:255},grape:{r:137,g:49,b:255},strawberry:{r:255,g:41,b:135},tungsten:{r:58,g:58,b:58},silver:{r:208,g:208,b:208},maraschino:{r:255,g:33,b:1},lemon:{r:255,g:250,b:3},spring:{r:5,g:248,b:2},turquoise:{r:0,g:253,b:255},blueberry:{r:0,g:46,b:255},magenta:{r:255,g:57,b:255},iron:{r:84,g:84,b:83},magnesium:{r:184,g:184,b:184},mocha:{r:137,g:72,b:0},fern:{r:69,g:132,b:1},moss:{r:1,g:132,b:72},ocean:{r:0,g:74,b:136},eggplant:{r:73,g:26,b:136},maroon:{r:137,g:22,b:72},steel:{r:110,g:110,b:110},aluminum:{r:160,g:159,b:160},cayenne:{r:137,g:17,b:0},aspargus:{r:136,g:133,b:1},clover:{r:2,g:132,b:1},teal:{r:0,g:134,b:136},midnight:{r:0,g:24,b:136},plum:{r:137,g:30,b:136},tin:{r:135,g:134,b:135},nickel:{r:136,g:135,b:135}};function Vr(t){const{r:e,g:i,b:r}=Ur[t];return`rgb(${e},${i},${r})`}const qr={Set1:["rgb(228,26,28)","rgb(55,126,184)","rgb(77,175,74)","rgb(166,86,40)","rgb(152,78,163)","rgb(255,127,0)","rgb(247,129,191)","rgb(153,153,153)","rgb(255,255,51)"],Dark2:["rgb(27,158,119)","rgb(217,95,2)","rgb(117,112,179)","rgb(231,41,138)","rgb(102,166,30)","rgb(230,171,2)","rgb(166,118,29)","rgb(102,102,102)"],Set2:["rgb(102, 194,165)","rgb(252,141,98)","rgb(141,160,203)","rgb(231,138,195)","rgb(166,216,84)","rgb(255,217,47)","rgb(229,196,148)","rgb(179,179,179)"],Set3:["rgb(141,211,199)","rgb(255,255,179)","rgb(190,186,218)","rgb(251,128,114)","rgb(128,177,211)","rgb(253,180,98)","rgb(179,222,105)","rgb(252,205,229)","rgb(217,217,217)","rgb(188,128,189)","rgb(204,235,197)","rgb(255,237,111)"],Pastel1:["rgb(251,180,174)","rgb(179,205,227)","rgb(204,235,197)","rgb(222,203,228)","rgb(254,217,166)","rgb(255,255,204)","rgb(229,216,189)","rgb(253,218,236)"],Pastel2:["rgb(173,226,207)","rgb(253,205,172)","rgb(203,213,232)","rgb(244,202,228)","rgb(230,245,201)","rgb(255,242,174)","rgb(243,225,206)"],Accent:["rgb(127,201,127)","rgb(190,174,212)","rgb(253,192,134)","rgb(255,255,153)","rgb(56,108,176)","rgb(240,2,127)","rgb(191,91,23)"]};class Qr{constructor(t){this.colors=qr[t],Array.isArray(this.colors)||(this.colors=[]),this.colorTable=new Map,this.nextIdx=0,this.colorGenerator=new Wr}getColor(t){return this.colorTable.has(t)||(this.nextIdx<this.colors.length?this.colorTable.set(t,this.colors[this.nextIdx]):this.colorTable.set(t,this.colorGenerator.get()),this.nextIdx++),this.colorTable.get(t)}}class Gr{constructor(t){this.colorTable=t||{},this.nextIdx=0,this.colorGenerator=new Wr}getColor(t){if(!this.colorTable.hasOwnProperty(t)){if(this.colorTable.hasOwnProperty("*"))return this.colorTable["*"];this.colorTable[t]=this.colorGenerator.get()}return this.colorTable[t]}}class Wr{constructor(){this.hue=Math.random(),this.goldenRatio=.618033988749895,this.hexwidth=2}hsvToRgb(t,e,i){const r=Math.floor(6*t),s=6*t-r,o=i*(1-e),n=i*(1-s*e),a=i*(1-(1-s)*e);let c=255,l=255,h=255;switch(r){case 0:c=i,l=a,h=o;break;case 1:c=n,l=i,h=o;break;case 2:c=o,l=i,h=a;break;case 3:c=o,l=n,h=i;break;case 4:c=a,l=o,h=i;break;case 5:c=i,l=o,h=n}return[Math.floor(256*c),Math.floor(256*l),Math.floor(256*h)]}padHex(t){return t.length>this.hexwidth?t:new Array(this.hexwidth-t.length+1).join("0")+t}get(t,e){this.hue+=this.goldenRatio,this.hue%=1,"number"!=typeof t&&(t=.5),"number"!=typeof e&&(e=.95);const i=this.hsvToRgb(this.hue,t,e);return"#"+this.padHex(i[0].toString(16))+this.padHex(i[1].toString(16))+this.padHex(i[2].toString(16))}}function jr(t,e,i,r){return`rgba(${t=cr(t,0,255)}, ${e=cr(e,0,255)}, ${i=cr(i,0,255)}, ${r=cr(r,0,1)})`}function $r(t,e){t=cr(t,0,255),e=cr(e,0,255);return`rgb(${Math.round(Math.random()*(e-t)+t).toString(10)},${Math.round(Math.random()*(e-t)+t).toString(10)},${Math.round(Math.random()*(e-t)+t).toString(10)})`}function Kr(t){if(t.startsWith("rgb(")){const[e,i]=t.split("("),[r]=i.split(")");return r.split(",").map(t=>parseInt(t))}}new Wr;function Zr(t,e,i){if(i<.005)return t;if(i>.995)return e;{let r,s,o,n,a,c;if(i<.5){i/=.5;const e=Kr(t),l=Kr(Vr("snow"));if(!e||!l)throw new Error(`Invalid rgb string(s): "${t}", "snow"`);[r,s,o]=e,[n,a,c]=l}else{i=(i-.5)/.5;const t=Kr(Vr("snow")),l=Kr(e);if(!t||!l)throw new Error(`Invalid rgb string(s): "snow", "${e}"`);[r,s,o]=t,[n,a,c]=l}const[l,h,d]=[Math.floor(ar(r,n,i)),Math.floor(ar(s,a,i)),Math.floor(ar(o,c,i))];return function(t,e,i){return`rgb(${t=cr(t,0,255)}, ${e=cr(e,0,255)}, ${i=cr(i,0,255)})`}(l,h,d)}}const Yr=new Set(["bedtype","alignment","annotation","variant","wig","interact","shoebox"]),Xr=new Set(["alignment","annotation","variant","eqtl","qtl","snp","shoebox","wig"]),Jr=new Set(["sequence","ruler","ideogram"]),ts={};class es{constructor(t){this.browser=t,this.initialize()}initialize(){const t=new c;t.add("...");const e={parent:this.browser.root,content:t};this.dialog=new w(e),this.browser.root.appendChild(this.dialog.elem),r(this.dialog.elem)}trackMenuItemList(t){var e,i;const r=[];return"sequence"!==(null===(e=t.track.config)||void 0===e?void 0:e.type)&&r.push(function(){const t=document.createElement("div");function e(t){const e=()=>{if(void 0!==this.browser.inputDialog.value){const t=parseInt(this.browser.inputDialog.value,10);if(t>0){const e=[],i=this.trackView;i.track.selected?e.push(...i.browser.getSelectedTrackViews().map(({track:t})=>t)):e.push(this);for(const i of e){const e=i.trackView;e.autoHeight=!1,void 0!==i.minHeight&&i.minHeight>t&&(i.minHeight=t),void 0!==i.maxHeight&&i.maxHeight<t&&(i.minHeight=t),e.setTrackHeight(t,!0),e.checkContentHeight(),e.repaintViews()}}}},i={label:"Track Height",value:this.height,callback:e};this.browser.inputDialog.present(i,t)}return t.textContent="Set track height",{element:t,dialog:e}}()),!0===function(t){const e=t.browser.getSelectedTrackViews();return e&&e.length>1&&new Set(e).has(t)}(t)?r.push(...this.multiSelectMenuItems(t)):("sequence"!==(null===(i=t.track.config)||void 0===i?void 0:i.type)&&r.push(function(){const t=document.createElement("div");function e(t){const e=()=>{let t=this.browser.inputDialog.value;t=""===t||void 0===t?"untitled":t.trim(),this.name=t,this.browser.fireEvent("tracknamechange",[this])},i={label:"Track Name",value:os(this)||"unnamed",callback:e};this.browser.inputDialog.present(i,t)}return t.textContent="Set track name",{element:t,click:e}}()),r.push(...this.defaultMenuItems(t))),!1!==t.track.removable&&(r.push("<hr/>"),r.push(function(t){const e=t.track.selected?"Remove tracks":"Remove track",i=document.createElement("div");function r(t){this.trackView.browser._removeTrack(this)}return i.textContent=e,{element:i,click:r,menuItemType:"removeTrack"}}(t))),r}defaultMenuItems(t){var e,i;const r=[];return ns(t.track)&&(r.push("<hr/>"),r.push(is(t,"Set track color","color")),r.push(rs(t,"Unset track color")),"wig"!==(null===(e=t.track.config)||void 0===e?void 0:e.type)&&"annotation"!==(null===(i=t.track.config)||void 0===i?void 0:i.type)||(r.push(is(t,"Set alt color","altColor")),r.push(ss(t,"Unset alt color")))),t.track.menuItemList&&r.push(...t.track.menuItemList()),function(t){const e=t.track;return!(!e||!e.config||void 0===e.config.visibilityWindow)||!!(e&&e.type&&Xr.has(e.type))}(t)&&(r.push("<hr/>"),r.push(function(t){const e=document.createElement("div");function i(e){const i=()=>{let t=this.browser.inputDialog.value;t=""===t||void 0===t?-1:t.trim(),this.visibilityWindow=Number.parseInt(t),this.config.visibilityWindow=Number.parseInt(t),this.trackView.updateViews()},r={label:"wig"===t?"Visibility window (bp). Enter 0 for whole chromosome, -1 for whole genome.":"Visibility window (bp). Enter 0 for whole chromosome.",value:this.visibilityWindow,callback:i};this.browser.inputDialog.present(r,e)}return e.textContent="Set visibility window",{element:e,click:i}}(t.track.type))),r}multiSelectMenuItems(t){var e,i;const r=[],s=t.browser.getSelectedTrackViews();var o;
|
|
2
|
+
/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */return!0===(o=s.map(({track:t})=>t.type),1===[...new Set(o)].length)?(r.push(...this.defaultMenuItems(t)),"wig"===t.track.type&&(r.push("<hr/>"),r.push(function(){const t=document.createElement("div");function e(t){const e=qr.Dark2,i=Math.floor(Math.random()*e.length),r=`auto-scale-group-${n()}`;ts[r]=e[i];const s=this.browser.getSelectedTrackViews();for(const{track:t}of s)t.autoscaleGroup=r;this.browser.updateViews()}return t.textContent="Group autoscale",{element:t,doAllMultiSelectedTracks:!0,click:e}}()))):ns(t.track)&&(r.push("<hr/>"),r.push(is(t,"Set track color","color")),r.push(rs(t,"Unset track color")),"wig"!==(null===(e=t.track.config)||void 0===e?void 0:e.type)&&"annotation"!==(null===(i=t.track.config)||void 0===i?void 0:i.type)||(r.push(is(t,"Set alt color","altColor")),r.push(ss(t,"Unset alt color")))),r}}function is(t,e,i){const r=document.createElement("div");return r.textContent=e,{element:r,click:function(e){t.presentColorPicker(i,e)}}}function rs(t,e){const i=document.createElement("div");return i.textContent=e,{element:i,click:()=>{t.track.color=t.track._initialColor||t.track.constructor.defaultColor,t.repaintViews()}}}function ss(t,e){const i=document.createElement("div");return i.textContent=e,{element:i,click:()=>{t.track.altColor=t.track._initialAltColor||t.track.constructor.defaultColor,t.repaintViews()}}}function os(t){return t.name||""}function ns(t){return void 0===t.type||Yr.has(t.type)&&"heatmap"!==t.graphType}const{entries:as,setPrototypeOf:cs,isFrozen:ls,getPrototypeOf:hs,getOwnPropertyDescriptor:ds}=Object;let{freeze:us,seal:fs,create:ps}=Object,{apply:gs,construct:ms}="undefined"!=typeof Reflect&&Reflect;us||(us=function(t){return t}),fs||(fs=function(t){return t}),gs||(gs=function(t,e,i){return t.apply(e,i)}),ms||(ms=function(t,e){return new t(...e)});const ws=Rs(Array.prototype.forEach),bs=Rs(Array.prototype.lastIndexOf),Fs=Rs(Array.prototype.pop),vs=Rs(Array.prototype.push),ys=Rs(Array.prototype.splice),As=Rs(String.prototype.toLowerCase),Cs=Rs(String.prototype.toString),_s=Rs(String.prototype.match),xs=Rs(String.prototype.replace),ks=Rs(String.prototype.indexOf),Is=Rs(String.prototype.trim),Ss=Rs(Object.prototype.hasOwnProperty),Es=Rs(RegExp.prototype.test),Ns=(Ms=TypeError,function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return ms(Ms,e)});var Ms;function Rs(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return gs(t,e,r)}}function Ds(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:As;cs&&cs(t,null);let r=e.length;for(;r--;){let s=e[r];if("string"==typeof s){const t=i(s);t!==s&&(ls(e)||(e[r]=t),s=t)}t[s]=!0}return t}function Bs(t){for(let e=0;e<t.length;e++){Ss(t,e)||(t[e]=null)}return t}function Ts(t){const e=ps(null);for(const[i,r]of as(t)){Ss(t,i)&&(Array.isArray(r)?e[i]=Bs(r):r&&"object"==typeof r&&r.constructor===Object?e[i]=Ts(r):e[i]=r)}return e}function Ls(t,e){for(;null!==t;){const i=ds(t,e);if(i){if(i.get)return Rs(i.get);if("function"==typeof i.value)return Rs(i.value)}t=hs(t)}return function(){return null}}const zs=us(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ps=us(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Os=us(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Hs=us(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Us=us(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Vs=us(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),qs=us(["#text"]),Qs=us(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Gs=us(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ws=us(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),js=us(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),$s=fs(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ks=fs(/<%[\w\W]*|[\w\W]*%>/gm),Zs=fs(/\$\{[\w\W]*/gm),Ys=fs(/^data-[\-\w.\u00B7-\uFFFF]+$/),Xs=fs(/^aria-[\-\w]+$/),Js=fs(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),to=fs(/^(?:\w+script|data):/i),eo=fs(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),io=fs(/^html$/i),ro=fs(/^[a-z][.\w]*(-[.\w]+)+$/i);var so=Object.freeze({__proto__:null,ARIA_ATTR:Xs,ATTR_WHITESPACE:eo,CUSTOM_ELEMENT:ro,DATA_ATTR:Ys,DOCTYPE_NAME:io,ERB_EXPR:Ks,IS_ALLOWED_URI:Js,IS_SCRIPT_OR_DATA:to,MUSTACHE_EXPR:$s,TMPLIT_EXPR:Zs});const oo=1,no=3,ao=7,co=8,lo=9,ho=function(){return"undefined"==typeof window?null:window};var uo=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ho();const i=e=>t(e);if(i.version="3.2.6",i.removed=[],!e||!e.document||e.document.nodeType!==lo||!e.Element)return i.isSupported=!1,i;let{document:r}=e;const s=r,o=s.currentScript,{DocumentFragment:n,HTMLTemplateElement:a,Node:c,Element:l,NodeFilter:h,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:p}=e,g=l.prototype,m=Ls(g,"cloneNode"),w=Ls(g,"remove"),b=Ls(g,"nextSibling"),F=Ls(g,"childNodes"),v=Ls(g,"parentNode");if("function"==typeof a){const t=r.createElement("template");t.content&&t.content.ownerDocument&&(r=t.content.ownerDocument)}let y,A="";const{implementation:C,createNodeIterator:_,createDocumentFragment:x,getElementsByTagName:k}=r,{importNode:I}=s;let S={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};i.isSupported="function"==typeof as&&"function"==typeof v&&C&&void 0!==C.createHTMLDocument;const{MUSTACHE_EXPR:E,ERB_EXPR:N,TMPLIT_EXPR:M,DATA_ATTR:R,ARIA_ATTR:D,IS_SCRIPT_OR_DATA:B,ATTR_WHITESPACE:T,CUSTOM_ELEMENT:L}=so;let{IS_ALLOWED_URI:z}=so,P=null;const O=Ds({},[...zs,...Ps,...Os,...Us,...qs]);let H=null;const U=Ds({},[...Qs,...Gs,...Ws,...js]);let V=Object.seal(ps(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),q=null,Q=null,G=!0,W=!0,j=!1,$=!0,K=!1,Z=!0,Y=!1,X=!1,J=!1,tt=!1,et=!1,it=!1,rt=!0,st=!1,ot=!0,nt=!1,at={},ct=null;const lt=Ds({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ht=null;const dt=Ds({},["audio","video","img","source","image","track"]);let ut=null;const ft=Ds({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pt="http://www.w3.org/1998/Math/MathML",gt="http://www.w3.org/2000/svg",mt="http://www.w3.org/1999/xhtml";let wt=mt,bt=!1,Ft=null;const vt=Ds({},[pt,gt,mt],Cs);let yt=Ds({},["mi","mo","mn","ms","mtext"]),At=Ds({},["annotation-xml"]);const Ct=Ds({},["title","style","font","a","script"]);let _t=null;const xt=["application/xhtml+xml","text/html"];let kt=null,It=null;const St=r.createElement("form"),Et=function(t){return t instanceof RegExp||t instanceof Function},Nt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!It||It!==t){if(t&&"object"==typeof t||(t={}),t=Ts(t),_t=-1===xt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,kt="application/xhtml+xml"===_t?Cs:As,P=Ss(t,"ALLOWED_TAGS")?Ds({},t.ALLOWED_TAGS,kt):O,H=Ss(t,"ALLOWED_ATTR")?Ds({},t.ALLOWED_ATTR,kt):U,Ft=Ss(t,"ALLOWED_NAMESPACES")?Ds({},t.ALLOWED_NAMESPACES,Cs):vt,ut=Ss(t,"ADD_URI_SAFE_ATTR")?Ds(Ts(ft),t.ADD_URI_SAFE_ATTR,kt):ft,ht=Ss(t,"ADD_DATA_URI_TAGS")?Ds(Ts(dt),t.ADD_DATA_URI_TAGS,kt):dt,ct=Ss(t,"FORBID_CONTENTS")?Ds({},t.FORBID_CONTENTS,kt):lt,q=Ss(t,"FORBID_TAGS")?Ds({},t.FORBID_TAGS,kt):Ts({}),Q=Ss(t,"FORBID_ATTR")?Ds({},t.FORBID_ATTR,kt):Ts({}),at=!!Ss(t,"USE_PROFILES")&&t.USE_PROFILES,G=!1!==t.ALLOW_ARIA_ATTR,W=!1!==t.ALLOW_DATA_ATTR,j=t.ALLOW_UNKNOWN_PROTOCOLS||!1,$=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,K=t.SAFE_FOR_TEMPLATES||!1,Z=!1!==t.SAFE_FOR_XML,Y=t.WHOLE_DOCUMENT||!1,tt=t.RETURN_DOM||!1,et=t.RETURN_DOM_FRAGMENT||!1,it=t.RETURN_TRUSTED_TYPE||!1,J=t.FORCE_BODY||!1,rt=!1!==t.SANITIZE_DOM,st=t.SANITIZE_NAMED_PROPS||!1,ot=!1!==t.KEEP_CONTENT,nt=t.IN_PLACE||!1,z=t.ALLOWED_URI_REGEXP||Js,wt=t.NAMESPACE||mt,yt=t.MATHML_TEXT_INTEGRATION_POINTS||yt,At=t.HTML_INTEGRATION_POINTS||At,V=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&Et(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&Et(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(V.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(V.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),K&&(W=!1),et&&(tt=!0),at&&(P=Ds({},qs),H=[],!0===at.html&&(Ds(P,zs),Ds(H,Qs)),!0===at.svg&&(Ds(P,Ps),Ds(H,Gs),Ds(H,js)),!0===at.svgFilters&&(Ds(P,Os),Ds(H,Gs),Ds(H,js)),!0===at.mathMl&&(Ds(P,Us),Ds(H,Ws),Ds(H,js))),t.ADD_TAGS&&(P===O&&(P=Ts(P)),Ds(P,t.ADD_TAGS,kt)),t.ADD_ATTR&&(H===U&&(H=Ts(H)),Ds(H,t.ADD_ATTR,kt)),t.ADD_URI_SAFE_ATTR&&Ds(ut,t.ADD_URI_SAFE_ATTR,kt),t.FORBID_CONTENTS&&(ct===lt&&(ct=Ts(ct)),Ds(ct,t.FORBID_CONTENTS,kt)),ot&&(P["#text"]=!0),Y&&Ds(P,["html","head","body"]),P.table&&(Ds(P,["tbody"]),delete q.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw Ns('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw Ns('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=t.TRUSTED_TYPES_POLICY,A=y.createHTML("")}else void 0===y&&(y=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let i=null;const r="data-tt-policy-suffix";e&&e.hasAttribute(r)&&(i=e.getAttribute(r));const s="dompurify"+(i?"#"+i:"");try{return t.createPolicy(s,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+s+" could not be created."),null}}(p,o)),null!==y&&"string"==typeof A&&(A=y.createHTML(""));us&&us(t),It=t}},Mt=Ds({},[...Ps,...Os,...Hs]),Rt=Ds({},[...Us,...Vs]),Dt=function(t){vs(i.removed,{element:t});try{v(t).removeChild(t)}catch(e){w(t)}},Bt=function(t,e){try{vs(i.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){vs(i.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(tt||et)try{Dt(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Tt=function(t){let e=null,i=null;if(J)t="<remove></remove>"+t;else{const e=_s(t,/^[\r\n\t ]+/);i=e&&e[0]}"application/xhtml+xml"===_t&&wt===mt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const s=y?y.createHTML(t):t;if(wt===mt)try{e=(new f).parseFromString(s,_t)}catch(t){}if(!e||!e.documentElement){e=C.createDocument(wt,"template",null);try{e.documentElement.innerHTML=bt?A:s}catch(t){}}const o=e.body||e.documentElement;return t&&i&&o.insertBefore(r.createTextNode(i),o.childNodes[0]||null),wt===mt?k.call(e,Y?"html":"body")[0]:Y?e.documentElement:o},Lt=function(t){return _.call(t.ownerDocument||t,t,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},zt=function(t){return t instanceof u&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof d)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},Pt=function(t){return"function"==typeof c&&t instanceof c};function Ot(t,e,r){ws(t,t=>{t.call(i,e,r,It)})}const Ht=function(t){let e=null;if(Ot(S.beforeSanitizeElements,t,null),zt(t))return Dt(t),!0;const r=kt(t.nodeName);if(Ot(S.uponSanitizeElement,t,{tagName:r,allowedTags:P}),Z&&t.hasChildNodes()&&!Pt(t.firstElementChild)&&Es(/<[/\w!]/g,t.innerHTML)&&Es(/<[/\w!]/g,t.textContent))return Dt(t),!0;if(t.nodeType===ao)return Dt(t),!0;if(Z&&t.nodeType===co&&Es(/<[/\w]/g,t.data))return Dt(t),!0;if(!P[r]||q[r]){if(!q[r]&&Vt(r)){if(V.tagNameCheck instanceof RegExp&&Es(V.tagNameCheck,r))return!1;if(V.tagNameCheck instanceof Function&&V.tagNameCheck(r))return!1}if(ot&&!ct[r]){const e=v(t)||t.parentNode,i=F(t)||t.childNodes;if(i&&e){for(let r=i.length-1;r>=0;--r){const s=m(i[r],!0);s.__removalCount=(t.__removalCount||0)+1,e.insertBefore(s,b(t))}}}return Dt(t),!0}return t instanceof l&&!function(t){let e=v(t);e&&e.tagName||(e={namespaceURI:wt,tagName:"template"});const i=As(t.tagName),r=As(e.tagName);return!!Ft[t.namespaceURI]&&(t.namespaceURI===gt?e.namespaceURI===mt?"svg"===i:e.namespaceURI===pt?"svg"===i&&("annotation-xml"===r||yt[r]):Boolean(Mt[i]):t.namespaceURI===pt?e.namespaceURI===mt?"math"===i:e.namespaceURI===gt?"math"===i&&At[r]:Boolean(Rt[i]):t.namespaceURI===mt?!(e.namespaceURI===gt&&!At[r])&&!(e.namespaceURI===pt&&!yt[r])&&!Rt[i]&&(Ct[i]||!Mt[i]):!("application/xhtml+xml"!==_t||!Ft[t.namespaceURI]))}(t)?(Dt(t),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!Es(/<\/no(script|embed|frames)/i,t.innerHTML)?(K&&t.nodeType===no&&(e=t.textContent,ws([E,N,M],t=>{e=xs(e,t," ")}),t.textContent!==e&&(vs(i.removed,{element:t.cloneNode()}),t.textContent=e)),Ot(S.afterSanitizeElements,t,null),!1):(Dt(t),!0)},Ut=function(t,e,i){if(rt&&("id"===e||"name"===e)&&(i in r||i in St))return!1;if(W&&!Q[e]&&Es(R,e));else if(G&&Es(D,e));else if(!H[e]||Q[e]){if(!(Vt(t)&&(V.tagNameCheck instanceof RegExp&&Es(V.tagNameCheck,t)||V.tagNameCheck instanceof Function&&V.tagNameCheck(t))&&(V.attributeNameCheck instanceof RegExp&&Es(V.attributeNameCheck,e)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(e))||"is"===e&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&Es(V.tagNameCheck,i)||V.tagNameCheck instanceof Function&&V.tagNameCheck(i))))return!1}else if(ut[e]);else if(Es(z,xs(i,T,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==ks(i,"data:")||!ht[t]){if(j&&!Es(B,xs(i,T,"")));else if(i)return!1}else;return!0},Vt=function(t){return"annotation-xml"!==t&&_s(t,L)},qt=function(t){Ot(S.beforeSanitizeAttributes,t,null);const{attributes:e}=t;if(!e||zt(t))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let s=e.length;for(;s--;){const o=e[s],{name:n,namespaceURI:a,value:c}=o,l=kt(n),h=c;let d="value"===n?h:Is(h);if(r.attrName=l,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,Ot(S.uponSanitizeAttribute,t,r),d=r.attrValue,!st||"id"!==l&&"name"!==l||(Bt(n,t),d="user-content-"+d),Z&&Es(/((--!?|])>)|<\/(style|title)/i,d)){Bt(n,t);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Bt(n,t);continue}if(!$&&Es(/\/>/i,d)){Bt(n,t);continue}K&&ws([E,N,M],t=>{d=xs(d,t," ")});const u=kt(t.nodeName);if(Ut(u,l,d)){if(y&&"object"==typeof p&&"function"==typeof p.getAttributeType)if(a);else switch(p.getAttributeType(u,l)){case"TrustedHTML":d=y.createHTML(d);break;case"TrustedScriptURL":d=y.createScriptURL(d)}if(d!==h)try{a?t.setAttributeNS(a,n,d):t.setAttribute(n,d),zt(t)?Dt(t):Fs(i.removed)}catch(e){Bt(n,t)}}else Bt(n,t)}Ot(S.afterSanitizeAttributes,t,null)},Qt=function t(e){let i=null;const r=Lt(e);for(Ot(S.beforeSanitizeShadowDOM,e,null);i=r.nextNode();)Ot(S.uponSanitizeShadowNode,i,null),Ht(i),qt(i),i.content instanceof n&&t(i.content);Ot(S.afterSanitizeShadowDOM,e,null)};return i.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,a=null,l=null;if(bt=!t,bt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!Pt(t)){if("function"!=typeof t.toString)throw Ns("toString is not a function");if("string"!=typeof(t=t.toString()))throw Ns("dirty is not a string, aborting")}if(!i.isSupported)return t;if(X||Nt(e),i.removed=[],"string"==typeof t&&(nt=!1),nt){if(t.nodeName){const e=kt(t.nodeName);if(!P[e]||q[e])throw Ns("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof c)r=Tt("\x3c!----\x3e"),o=r.ownerDocument.importNode(t,!0),o.nodeType===oo&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!tt&&!K&&!Y&&-1===t.indexOf("<"))return y&&it?y.createHTML(t):t;if(r=Tt(t),!r)return tt?null:it?A:""}r&&J&&Dt(r.firstChild);const h=Lt(nt?t:r);for(;a=h.nextNode();)Ht(a),qt(a),a.content instanceof n&&Qt(a.content);if(nt)return t;if(tt){if(et)for(l=x.call(r.ownerDocument);r.firstChild;)l.appendChild(r.firstChild);else l=r;return(H.shadowroot||H.shadowrootmode)&&(l=I.call(s,l,!0)),l}let d=Y?r.outerHTML:r.innerHTML;return Y&&P["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&Es(io,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),K&&ws([E,N,M],t=>{d=xs(d,t," ")}),y&&it?y.createHTML(d):d},i.setConfig=function(){Nt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),X=!0},i.clearConfig=function(){It=null,X=!1},i.isValidAttribute=function(t,e,i){It||Nt({});const r=kt(t),s=kt(e);return Ut(r,s,i)},i.addHook=function(t,e){"function"==typeof e&&vs(S[t],e)},i.removeHook=function(t,e){if(void 0!==e){const i=bs(S[t],e);return-1===i?void 0:ys(S[t],i,1)[0]}return Fs(S[t])},i.removeHooks=function(t){S[t]=[]},i.removeAllHooks=function(){S={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},i}();class fo{constructor(t){this.parent=t,this.container=e({class:"igv-ui-generic-dialog-container"}),t.appendChild(this.container);const i=e({class:"igv-ui-generic-dialog-header"});this.container.appendChild(i),this.label=e({class:"igv-ui-generic-dialog-one-liner"}),this.container.appendChild(this.label),this.label.textContent="Unlabeled",this.input_container=e({class:"igv-ui-generic-dialog-input"}),this.container.appendChild(this.input_container),this._input=document.createElement("input"),fo.FORM_EMBED_MODE&&fo.captureKeyInput(this._input),this.input_container.appendChild(this._input);const s=e({class:"igv-ui-generic-dialog-ok-cancel"});this.container.appendChild(s),this.ok=e(),s.appendChild(this.ok),this.ok.textContent="OK",this.cancel=e(),s.appendChild(this.cancel),this.cancel.textContent="Cancel",r(this.container),this._input.addEventListener("keyup",t=>{"Enter"===t.code&&("function"==typeof this.callback&&(this.callback(this._input.value),this.callback=void 0),this._input.value="",r(this.container)),t.stopImmediatePropagation()}),this.ok.addEventListener("click",()=>{"function"==typeof this.callback&&(this.callback(this._input.value),this.callback=void 0),this._input.value="",r(this.container)});const o=()=>{this._input.value="",r(this.container)};this.cancel.addEventListener("click",o),u(i,o),p(this.container,i)}get value(){return uo.sanitize(this._input.value)}present(t,e){this.label.textContent=t.label,this._input.value=String(t.value),this.callback=t.callback||t.click,this.container.style.display="";const{clientX:i,clientY:r}=e,{offsetWidth:s,offsetHeight:o}=this.container,{innerHeight:n}=window;let a=i-s/2,c=r-o/2;const l=document.documentElement.clientWidth-s-10;a=Math.max(10,Math.min(a,l));const h=n-o-10;c=Math.max(10,Math.min(c,h)),this.container.style.left=`${a}px`,this.container.style.top=`${c}px`}static captureKeyInput(t){t.addEventListener("mousedown",e=>{t.focus()}),t.addEventListener("keydown",e=>{e.preventDefault(),e.stopPropagation();const i=t.selectionStart,r=t.selectionEnd;if(1===e.key.length){const s=t.value;t.value=s.slice(0,i)+e.key+s.slice(r),t.selectionStart=t.selectionEnd=i+1}else"Backspace"===e.key?i===r&&i>0?(t.value=t.value.slice(0,i-1)+t.value.slice(i),t.selectionStart=t.selectionEnd=i-1):i<r&&(t.value=t.value.slice(0,i)+t.value.slice(r),t.selectionStart=t.selectionEnd=i):"Delete"===e.key?i===r&&i<t.value.length?(t.value=t.value.slice(0,i)+t.value.slice(i+1),t.selectionStart=t.selectionEnd=i):i<r&&(t.value=t.value.slice(0,i)+t.value.slice(r),t.selectionStart=t.selectionEnd=i):"ArrowLeft"===e.key?t.selectionStart=t.selectionEnd=Math.max(0,i-1):"ArrowRight"===e.key&&(t.selectionStart=t.selectionEnd=Math.min(t.value.length,i+1))},!0)}}class po{constructor(t,e){this.browser=t,this.container=document.createElement("div"),this.container.className="igv-generic-dialog-container",e.appendChild(this.container);const i=document.createElement("div");i.className="igv-generic-dialog-header",this.container.appendChild(i),u(i,()=>{this.minimumInput.value="",this.maximumInput.value="",this.hide()}),this.minimum=document.createElement("div"),this.minimum.className="igv-generic-dialog-label-input",this.container.appendChild(this.minimum);const r=document.createElement("div");r.textContent="Minimum",this.minimum.appendChild(r),this.minimumInput=document.createElement("input"),fo.FORM_EMBED_MODE&&fo.captureKeyInput(this.minimumInput),this.minimum.appendChild(this.minimumInput),this.maximum=document.createElement("div"),this.maximum.className="igv-generic-dialog-label-input",this.container.appendChild(this.maximum);const s=document.createElement("div");s.textContent="Maximum",this.maximum.appendChild(s),this.maximumInput=document.createElement("input"),fo.FORM_EMBED_MODE&&fo.captureKeyInput(this.maximumInput),this.maximum.appendChild(this.maximumInput);const o=document.createElement("div");o.className="igv-generic-dialog-ok-cancel",this.container.appendChild(o),this.okButton=document.createElement("div"),this.okButton.textContent="OK",o.appendChild(this.okButton),this.cancelButton=document.createElement("div"),this.cancelButton.textContent="Cancel",o.appendChild(this.cancelButton),this.cancelButton.addEventListener("click",()=>{this.minimumInput.value="",this.maximumInput.value="",this.hide()}),p(this.container,i),this.container.style.display="none"}configure(t){let e;if(Array.isArray(t)){e={min:Number.MAX_SAFE_INTEGER,max:-Number.MAX_SAFE_INTEGER};for(const i of t){const t=i.track.dataRange;t&&(e.min=Math.min(t.min,e.min),e.max=Math.max(t.max,e.max))}}else e=t.track.dataRange;e&&(this.minimumInput.value=String(e.min),this.maximumInput.value=String(e.max)),this.minimumInput.onkeyup=null,this.minimumInput.onkeyup=e=>{13===e.keyCode&&this.processResults(t),e.stopImmediatePropagation()},this.maximumInput.onkeyup=null,this.maximumInput.onkeyup=e=>{13===e.keyCode&&(e.stopImmediatePropagation(),this.processResults(t))},this.okButton.onclick=null,this.okButton.onclick=()=>{this.processResults(t)}}processResults(t){const e=this.minimumInput.value.trim(),i=this.maximumInput.value.trim();if(""!==e&&""!==i){const r=Number(e),s=Number(i);if(isNaN(r)||isNaN(s))this.browser.alert.present(new Error("Must input numeric values"),void 0);else{const e=Array.isArray(t)?t:[t];for(const t of e)t.track.setDataRange({min:r,max:s})}this.minimumInput.value="",this.maximumInput.value=""}this.hide()}hide(){this.container.style.top="20%",this.container.style.left="75%",this.container.style.display="none"}present(t){this.container.style.display="flex";const{clientX:e,clientY:i}=t,{offsetWidth:r,offsetHeight:s}=this.container,{innerHeight:o}=window;let n=e-r/2,a=i-s/2;const c=document.documentElement.clientWidth-r-10;n=Math.max(10,Math.min(n,c));const l=o-s-10;a=Math.max(10,Math.min(a,l)),this.container.style.left=`${n}px`,this.container.style.top=`${a}px`}}const go={configureHighDPICanvas:function(t,e,i){const r=window.devicePixelRatio;t.canvas.style.width=`${e}px`,t.canvas.width=Math.floor(r*e),t.canvas.style.height=`${i}px`,t.canvas.height=Math.floor(r*i),t.scale(r,r)},setProperties:function(t,e){for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];t[i]=r}},strokeLine:function(t,e,i,r,s,o){e=Math.floor(e)+.5,i=Math.floor(i)+.5,r=Math.floor(r)+.5,s=Math.floor(s)+.5,o&&(t.save(),go.setProperties(t,o)),t.beginPath(),t.moveTo(e,i),t.lineTo(r,s),t.stroke(),o&&t.restore()},fillRect:function(t,e,i,r,s,o){o&&(t.save(),go.setProperties(t,o)),t.fillRect(e,i,r,s),o&&t.restore()},fillPolygon:function(t,e,i,r){r&&(t.save(),go.setProperties(t,r)),mo(t,e,i),t.fill(),r&&t.restore()},strokePolygon:function(t,e,i,r){r&&(t.save(),go.setProperties(t,r)),mo(t,e,i),t.stroke(),r&&t.restore()},fillText:function(t,e,i,r,s,o){if((s||o)&&t.save(),s&&go.setProperties(t,s),o){for(var n in t.translate(i,r),o){var a=o[n];"translate"===n&&t.translate(a.x,a.y),"rotate"===n&&t.rotate(a.angle*Math.PI/180)}t.fillText(e,0,0)}else t.fillText(e,i,r);(s||o)&&t.restore()},strokeText:function(t,e,i,r,s,o){if((s||o)&&t.save(),s&&go.setProperties(t,s),o){for(var n in t.translate(i,r),o){var a=o[n];"translate"===n&&t.translate(a.x,a.y),"rotate"===n&&t.rotate(a.angle*Math.PI/180)}t.strokeText(e,0,0)}else t.strokeText(e,i,r);(s||o)&&t.restore()},strokeCircle:function(t,e,i,r,s){s&&(t.save(),go.setProperties(t,s)),t.beginPath(),t.arc(e,i,r,0,2*Math.PI),t.stroke(),s&&t.restore()},fillCircle:function(t,e,i,r,s){s&&(t.save(),go.setProperties(t,s)),t.beginPath(),t.arc(e,i,r,0,2*Math.PI),t.fill(),s&&t.restore()},drawArrowhead:function(t,e,i,r,s){t.save(),r||(r=5),s&&(t.lineWidth=s),t.beginPath(),t.moveTo(e,i-r/2),t.lineTo(e,i+r/2),t.lineTo(e+r,i),t.lineTo(e,i-r/2),t.closePath(),t.fill(),t.restore()},dashedLine:function(t,e,i,r,s,o,n={}){void 0===o&&(o=2),t.setLineDash([o,o]),go.strokeLine(t,e,i,r,s,n),t.setLineDash([])},roundRect:function(t,e,i,r,s,o,n,a){void 0===a&&(a=!0),void 0===o&&(o=5),t.beginPath(),t.moveTo(e+o,i),t.lineTo(e+r-o,i),t.quadraticCurveTo(e+r,i,e+r,i+o),t.lineTo(e+r,i+s-o),t.quadraticCurveTo(e+r,i+s,e+r-o,i+s),t.lineTo(e+o,i+s),t.quadraticCurveTo(e,i+s,e,i+s-o),t.lineTo(e,i+o),t.quadraticCurveTo(e,i,e+o,i),t.closePath(),a&&t.stroke(),n&&t.fill()},polygon:function(t,e,i,r,s){void 0===s&&(s=!0),t.beginPath();var o=e.length;t.moveTo(e[0],i[0]);for(var n=1;n<o;n++)t.lineTo(e[n],i[n]);t.closePath(),s&&t.stroke(),r&&t.fill()},drawRandomColorVerticalLines:t=>{for(let e=0;e<t.canvas.width;e++)go.fillRect(t,e,0,1,t.canvas.height,{fillStyle:$r(100,250)})},labelTransformWithContext:(t,e)=>{t.translate(e,0),t.scale(-1,1),t.translate(-e,0)}};function mo(t,e,i){var r,s=e.length;for(t.beginPath(),t.moveTo(e[0],i[0]),r=1;r<s;r++)t.lineTo(e[r],i[r]);t.closePath()}function wo(t,e,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(t):r?r.value:e.get(t)}function bo(t,e,i,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(t,i):s?s.value=i:e.set(t,i),i}"function"==typeof SuppressedError&&SuppressedError;
|
|
3
|
+
/*!
|
|
4
|
+
* vanilla-picker v2.12.3
|
|
5
|
+
* https://vanilla-picker.js.org
|
|
6
|
+
*
|
|
7
|
+
* Copyright 2017-2024 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate)
|
|
8
|
+
* Released under the ISC license.
|
|
9
|
+
*/
|
|
10
|
+
var Fo=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},vo=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}(),yo=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var i=[],r=!0,s=!1,o=void 0;try{for(var n,a=t[Symbol.iterator]();!(r=(n=a.next()).done)&&(i.push(n.value),!e||i.length!==e);r=!0);}catch(t){s=!0,o=t}finally{try{!r&&a.return&&a.return()}finally{if(s)throw o}}return i}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")};String.prototype.startsWith=String.prototype.startsWith||function(t){return 0===this.indexOf(t)},String.prototype.padStart=String.prototype.padStart||function(t,e){for(var i=this;i.length<t;)i=e+i;return i};var Ao={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function Co(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(e>0?t.toFixed(e).replace(/0+$/,"").replace(/\.$/,""):t.toString())||"0"}var _o=function(){function t(e,i,r,s){Fo(this,t);var o=this;if(void 0===e);else if(Array.isArray(e))this.rgba=e;else if(void 0===r){var n=e&&""+e;n&&function(e){if(e.startsWith("hsl")){var i=e.match(/([\-\d\.e]+)/g).map(Number),r=yo(i,4),s=r[0],n=r[1],a=r[2],c=r[3];void 0===c&&(c=1),s/=360,n/=100,a/=100,o.hsla=[s,n,a,c]}else if(e.startsWith("rgb")){var l=e.match(/([\-\d\.e]+)/g).map(Number),h=yo(l,4),d=h[0],u=h[1],f=h[2],p=h[3];void 0===p&&(p=1),o.rgba=[d,u,f,p]}else e.startsWith("#")?o.rgba=t.hexToRgb(e):o.rgba=t.nameToRgb(e)||t.hexToRgb(e)}(n.toLowerCase())}else this.rgba=[e,i,r,void 0===s?1:s]}return vo(t,[{key:"printRGB",value:function(t){var e=(t?this.rgba:this.rgba.slice(0,3)).map(function(t,e){return Co(t,3===e?3:0)});return t?"rgba("+e+")":"rgb("+e+")"}},{key:"printHSL",value:function(t){var e=[360,100,100,1],i=["","%","%",""],r=(t?this.hsla:this.hsla.slice(0,3)).map(function(t,r){return Co(t*e[r],3===r?3:1)+i[r]});return t?"hsla("+r+")":"hsl("+r+")"}},{key:"printHex",value:function(t){var e=this.hex;return t?e:e.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=t.hslToRgb(this._hsla)},set:function(t){3===t.length&&(t[3]=1),this._rgba=t,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=t.rgbToHsl(this._rgba)},set:function(t){3===t.length&&(t[3]=1),this._hsla=t,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){return"#"+this.rgba.map(function(t,e){return e<3?t.toString(16):Math.round(255*t).toString(16)}).map(function(t){return t.padStart(2,"0")}).join("")},set:function(e){this.rgba=t.hexToRgb(e)}}],[{key:"hexToRgb",value:function(t){var e=(t.startsWith("#")?t.slice(1):t).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!e.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+t);var i=e.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map(function(t){return parseInt(t,16)});return i[3]=i[3]/255,i}},{key:"nameToRgb",value:function(e){var i=e.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),r=Ao[i];return void 0===r?r:t.hexToRgb(r.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(t){var e=yo(t,4),i=e[0],r=e[1],s=e[2],o=e[3];i/=255,r/=255,s/=255;var n=Math.max(i,r,s),a=Math.min(i,r,s),c=void 0,l=void 0,h=(n+a)/2;if(n===a)c=l=0;else{var d=n-a;switch(l=h>.5?d/(2-n-a):d/(n+a),n){case i:c=(r-s)/d+(r<s?6:0);break;case r:c=(s-i)/d+2;break;case s:c=(i-r)/d+4}c/=6}return[c,l,h,o]}},{key:"hslToRgb",value:function(t){var e=yo(t,4),i=e[0],r=e[1],s=e[2],o=e[3],n=void 0,a=void 0,c=void 0;if(0===r)n=a=c=s;else{var l=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},h=s<.5?s*(1+r):s+r-s*r,d=2*s-h;n=l(d,h,i+1/3),a=l(d,h,i),c=l(d,h,i-1/3)}var u=[255*n,255*a,255*c].map(Math.round);return u[3]=o,u}}]),t}(),xo=function(){function t(){Fo(this,t),this._events=[]}return vo(t,[{key:"add",value:function(t,e,i){t.addEventListener(e,i,!1),this._events.push({target:t,type:e,handler:i})}},{key:"remove",value:function(e,i,r){this._events=this._events.filter(function(s){var o=!0;return e&&e!==s.target&&(o=!1),i&&i!==s.type&&(o=!1),r&&r!==s.handler&&(o=!1),o&&t._doRemove(s.target,s.type,s.handler),!o})}},{key:"destroy",value:function(){this._events.forEach(function(e){return t._doRemove(e.target,e.type,e.handler)}),this._events=[]}}],[{key:"_doRemove",value:function(t,e,i){t.removeEventListener(e,i,!1)}}]),t}();function ko(t,e,i){var r=!1;function s(t,e,i){return Math.max(e,Math.min(t,i))}function o(t,o,n){if(n&&(r=!0),r){t.preventDefault();var a=e.getBoundingClientRect(),c=a.width,l=a.height,h=o.clientX,d=o.clientY,u=s(h-a.left,0,c),f=s(d-a.top,0,l);i(u/c,f/l)}}function n(t,e){1===(void 0===t.buttons?t.which:t.buttons)?o(t,t,e):r=!1}function a(t,e){1===t.touches.length?o(t,t.touches[0],e):r=!1}t.add(e,"mousedown",function(t){n(t,!0)}),t.add(e,"touchstart",function(t){a(t,!0)}),t.add(window,"mousemove",n),t.add(e,"touchmove",a),t.add(window,"mouseup",function(t){r=!1}),t.add(e,"touchend",function(t){r=!1}),t.add(e,"touchcancel",function(t){r=!1})}var Io="keydown",So="mousedown",Eo="focusin";function No(t,e){return(e||document).querySelector(t)}function Mo(t){t.preventDefault(),t.stopPropagation()}function Ro(t,e,i,r,s){t.add(e,Io,function(t){i.indexOf(t.key)>=0&&(s&&Mo(t),r(t))})}var Do=function(){function t(e){Fo(this,t),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new xo,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(e)}return vo(t,[{key:"setOptions",value:function(t){var e=this;if(t){var i=this.settings;if(t instanceof HTMLElement)i.parent=t;else{i.parent&&t.parent&&i.parent!==t.parent&&(this._events.remove(i.parent),this._popupInited=!1),function(t,e,i){for(var r in t)i&&i.indexOf(r)>=0||(e[r]=t[r])}(t,i),t.onChange&&(this.onChange=t.onChange),t.onDone&&(this.onDone=t.onDone),t.onOpen&&(this.onOpen=t.onOpen),t.onClose&&(this.onClose=t.onClose);var r=t.color||t.colour;r&&this._setColor(r)}var s=i.parent;if(s&&i.popup&&!this._popupInited){var o=function(t){return e.openHandler(t)};this._events.add(s,"click",o),Ro(this._events,s,[" ","Spacebar","Enter"],o),this._popupInited=!0}else t.parent&&!i.popup&&this.show()}}},{key:"openHandler",value:function(t){if(this.show()){t&&t.preventDefault(),this.settings.parent.style.pointerEvents="none";var e=t&&t.type===Io?this._domEdit:this.domElement;setTimeout(function(){return e.focus()},100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(t){var e=t&&t.type,i=!1;if(t)if(e===So||e===Eo){var r=(this.__containedEvent||0)+100;t.timeStamp>r&&(i=!0)}else Mo(t),i=!0;else i=!0;i&&this.hide()&&(this.settings.parent.style.pointerEvents="",e!==So&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(t,e){this.closeHandler(),this.setOptions(t),e&&this.openHandler()}},{key:"setColor",value:function(t,e){this._setColor(t,{silent:e})}},{key:"_setColor",value:function(t,e){if("string"==typeof t&&(t=t.trim()),t){e=e||{};var i=void 0;try{i=new _o(t)}catch(t){if(e.failSilently)return;throw t}if(!this.settings.alpha){var r=i.hsla;r[3]=1,i.hsla=r}this.colour=this.color=i,this._setHSLA(null,null,null,null,e)}}},{key:"setColour",value:function(t,e){this.setColor(t,e)}},{key:"show",value:function(){if(!this.settings.parent)return!1;if(this.domElement){var t=this._toggleDOM(!0);return this._setPosition(),t}var e=function(t){var e=document.createElement("div");return e.innerHTML=t,e.firstElementChild}(this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>');return this.domElement=e,this._domH=No(".picker_hue",e),this._domSL=No(".picker_sl",e),this._domA=No(".picker_alpha",e),this._domEdit=No(".picker_editor input",e),this._domSample=No(".picker_sample",e),this._domOkay=No(".picker_done button",e),this._domCancel=No(".picker_cancel button",e),e.classList.add("layout_"+this.settings.layout),this.settings.alpha||e.classList.add("no_alpha"),this.settings.editor||e.classList.add("no_editor"),this.settings.cancelButton||e.classList.add("no_cancel"),this._ifPopup(function(){return e.classList.add("popup")}),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var t=this,e=this,i=this.domElement,r=this._events;function s(t,e,i){r.add(t,e,i)}s(i,"click",function(t){return t.preventDefault()}),ko(r,this._domH,function(t,i){return e._setHSLA(t)}),ko(r,this._domSL,function(t,i){return e._setHSLA(null,t,1-i)}),this.settings.alpha&&ko(r,this._domA,function(t,i){return e._setHSLA(null,null,null,1-i)});var o=this._domEdit;s(o,"input",function(t){e._setColor(this.value,{fromEditor:!0,failSilently:!0})}),s(o,"focus",function(t){var e=this;e.selectionStart===e.selectionEnd&&e.select()}),this._ifPopup(function(){var e=function(e){return t.closeHandler(e)};s(window,So,e),s(window,Eo,e),Ro(r,i,["Esc","Escape"],e);var o=function(e){t.__containedEvent=e.timeStamp};s(i,So,o),s(i,Eo,o),s(t._domCancel,"click",e)});var n=function(e){t._ifPopup(function(){return t.closeHandler(e)}),t.onDone&&t.onDone(t.colour)};s(this._domOkay,"click",n),Ro(r,i,["Enter"],n)}},{key:"_setPosition",value:function(){var t=this.settings.parent,e=this.domElement;t!==e.parentNode&&t.appendChild(e),this._ifPopup(function(i){"static"===getComputedStyle(t).position&&(t.style.position="relative");var r=!0===i?"popup_right":"popup_"+i;["popup_top","popup_bottom","popup_left","popup_right"].forEach(function(t){t===r?e.classList.add(t):e.classList.remove(t)}),e.classList.add(r)})}},{key:"_setHSLA",value:function(t,e,i,r,s){s=s||{};var o=this.colour,n=o.hsla;[t,e,i,r].forEach(function(t,e){(t||0===t)&&(n[e]=t)}),o.hsla=n,this._updateUI(s),this.onChange&&!s.silent&&this.onChange(o)}},{key:"_updateUI",value:function(t){if(this.domElement){t=t||{};var e=this.colour,i=e.hsla,r="hsl("+360*i[0]+", 100%, 50%)",s=e.hslString,o=e.hslaString,n=this._domH,a=this._domSL,c=this._domA,l=No(".picker_selector",n),h=No(".picker_selector",a),d=No(".picker_selector",c);b(0,l,i[0]),this._domSL.style.backgroundColor=this._domH.style.color=r,b(0,h,i[1]),F(0,h,1-i[2]),a.style.color=s,F(0,d,1-i[3]);var u=s,f=u.replace("hsl","hsla").replace(")",", 0)"),p="linear-gradient("+[u,f]+")";if(this._domA.style.background=p+", linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em",!t.fromEditor){var g=this.settings.editorFormat,m=this.settings.alpha,w=void 0;switch(g){case"rgb":w=e.printRGB(m);break;case"hsl":w=e.printHSL(m);break;default:w=e.printHex(m)}this._domEdit.value=w}this._domSample.style.color=o}function b(t,e,i){e.style.left=100*i+"%"}function F(t,e,i){e.style.top=100*i+"%"}}},{key:"_ifPopup",value:function(t,e){this.settings.parent&&this.settings.popup?t&&t(this.settings.popup):e&&e()}},{key:"_toggleDOM",value:function(t){var e=this.domElement;if(!e)return!1;var i=t?"":"none",r=e.style.display!==i;return r&&(e.style.display=i),r}}]),t}();class Bo{constructor({parent:t,top:i,left:r,width:s,height:o,border:n,closeHandler:a}){const c=e({class:"igv-ui-generic-container"});t.appendChild(c),this.container=c,void 0!==s&&(this.container.style.width=`${s}px`),void 0!==o&&(this.container.style.height=`${o}px`),n&&(this.container.style.border=n);const l=e();this.container.appendChild(l),u(l,()=>{"function"==typeof a&&a(),this.hide()}),p(this.container,l),this.hide()}show(){this.container.style.display="flex"}hide(){this.container.style.display="none"}dispose(){this.container.parentElement&&this.container.parentElement.removeChild(this.container)}}class To extends Bo{constructor({parent:t,width:i}){super({parent:t,width:i,border:"1px solid gray"}),this.container.classList.add("igv-ui-colorpicker-container"),this.colorSwatchContainer=e(),this.container.appendChild(this.colorSwatchContainer),this.moreColorsContainer=e(),this.container.appendChild(this.moreColorsContainer),this.recentColorsSwatches=e(),this.container.appendChild(this.recentColorsSwatches),this.recentColors=[],this.moreColorsPresentationColor=void 0}configure(t,i,r){this.moreColorsPresentationColor=r,this.colorSwatchContainer.innerHTML="",this.recentColorsSwatches.innerHTML="";const s=Object.values(Hr);for(const t of s){const r=e({class:"igv-ui-color-swatch"});this.colorSwatchContainer.appendChild(r),this.decorateSwatch(r,t,i)}if(this.recentColors.length>0)for(const t of this.recentColors){const r=e({class:"igv-ui-color-swatch"});this.recentColorsSwatches.appendChild(r),this.decorateSwatch(r,t,i)}this.decorateMoreColorsButton(this.moreColorsContainer,i)}decorateSwatch(t,e,i){t.style.backgroundColor=e,t.addEventListener("click",t=>{t.stopPropagation(),i(e),this.moreColorsPresentationColor=e}),t.addEventListener("touchend",t=>{t.stopPropagation(),i(e),this.moreColorsPresentationColor=e})}decorateMoreColorsButton(t,e){t.innerText="More Colors ...",t.addEventListener("click",i=>{i.stopPropagation(),this.createAndPresentMoreColorsPicker(t,t=>e(t))})}updateRecentColorsSwatches(t){this.recentColorsSwatches.innerHTML="";for(const i of this.recentColors){const r=e({class:"igv-ui-color-swatch"});this.recentColorsSwatches.appendChild(r),this.decorateSwatch(r,i,t)}}createAndPresentMoreColorsPicker(t,e){let i;t.innerHTML="",t.innerText="More Colors ...";const r=document.createElement("div");r.style.position="absolute",t.appendChild(r);const{width:s,height:o}=t.getBoundingClientRect();r.style.right="0px",r.style.top="0px",r.style.width=`${s}px`,r.style.height=`${o}px`,r.addEventListener("click",t=>{t.stopPropagation()}),i=new Do;const n={parent:r,popup:"top",editor:!1,editorFormat:"rgb",alpha:!1,color:this.moreColorsPresentationColor};i.setOptions(n),i.setColor(this.moreColorsPresentationColor,!0),i.onOpen=()=>{console.log("picker - onOpen")},i.onChange=e=>t.style.backgroundColor=e.rgba,i.onDone=t=>{const s=t.hex.substring(0,7);this.recentColors.unshift(s);const o=this.recentColors.slice(0);this.recentColors=[...new Set(o)].slice(0,To.maxRecentColors),e(s),this.updateRecentColorsSwatches(e),this.moreColorsPresentationColor=s,i.destroy(),r.remove()},i.show()}present(t){this.show();const{clientX:e,clientY:i}=t,{offsetWidth:r,offsetHeight:s}=this.container,{innerHeight:o}=window;let n=e-r/2,a=i;const c=document.documentElement.clientWidth-r-10;n=Math.max(10,Math.min(n,c));const l=o-s-10;a=Math.max(10,Math.min(a,l)),this.container.style.left=`${n}px`,this.container.style.top=`${a}px`}}To.maxRecentColors=10;const Lo={401:"Access unauthorized",403:"Access forbidden",404:"Not found"};class zo{constructor(t,e){this.alertProps=Object.assign({shouldFocus:!0,preventScroll:!1},e),this.container=document.createElement("div"),this.container.className="igv-ui-alert-dialog-container",t.appendChild(this.container),this.container.setAttribute("tabIndex","-1");const i=document.createElement("div");this.container.appendChild(i),this.errorHeadline=document.createElement("div"),i.appendChild(this.errorHeadline),this.errorHeadline.textContent="";let r=document.createElement("div");r.className="igv-ui-alert-dialog-body",this.container.appendChild(r),this.body=document.createElement("div"),this.body.className="igv-ui-alert-dialog-body-copy",r.appendChild(this.body);let s=document.createElement("div");this.container.appendChild(s),this.ok=document.createElement("div"),s.appendChild(this.ok),this.ok.textContent="OK";const o=()=>{"function"==typeof this.callback&&(this.callback("OK"),this.callback=void 0),this.body.innerHTML="",this.container.style.display="none"};this.ok.addEventListener("click",t=>{t.stopPropagation(),o()}),this.container.addEventListener("keypress",t=>{t.stopPropagation(),"Enter"===t.key&&o()}),p(this.container,i),this.container.style.display="none"}present(t,e){const i=t instanceof Error?t.message:void 0;this.errorHeadline.textContent=i?"ERROR":"";let r=i||t;Lo.hasOwnProperty(r)&&(r=Lo[r]),this.body.innerHTML=uo.sanitize(r),this.callback=e,this.container.style.display="flex",this.alertProps.shouldFocus&&this.container.focus({preventScroll:this.alertProps.preventScroll})}}class Po{constructor(t){this.dialog=new zo(t)}present(t,e){this.dialog.present(t,e)}}function Oo(t){if(t)switch(t.toLowerCase()){case"bw":case"bigwig":case"wig":case"bedgraph":case"tdf":return"wig";case"vcf":case"vcftabix":case"vcf.list":return"variant";case"seg":return"seg";case"mut":case"maf":return"mut";case"bam":case"cram":return"alignment";case"hiccups":case"bedpe":case"bedpe-loop":case"biginteract":case"longrange":case"hic":return"interact";case"bp":return"arc";case"gwas":return"gwas";case"bed":case"bigbed":case"bb":case"biggenepred":case"bignarrowpeak":return"bedtype";case"fasta":return"sequence";case"pytor":return"cnvpytor";case"qtl":return"qtl";default:return"annotation"}}function Ho(t){t.featureType&&(t.type=t.type||t.featureType,t.featureType=void 0),"junctions"===t.type?t.type="junction":"bed"===t.type?(t.type="annotation",t.format=t.format||"bed"):"annotations"===t.type?t.type="annotation":"alignments"===t.type?t.type="alignment":"bam"===t.type?(t.type="alignment",t.format="bam"):"vcf"===t.type||"vcftabix"===t.type?(t.type="variant",t.format="vcf"):"t2d"===t.type?t.type="gwas":"FusionJuncSpan"!==t.type||t.format?"aed"===t.type&&(t.type="annotation",t.format=t.format||"aed"):t.format="fusionjuncspan"}var Uo=Object.freeze({__proto__:null,inferTrackType:Oo,translateDeprecatedTypes:Ho});const Vo=new Set(["boolean","number","string","symbol"]);function qo(t){const e=typeof t;return void 0!==t&&(Vo.has(e)||t instanceof String||t instanceof Number)}function Qo(t,e){var i={oauthToken:t.oauthToken,headers:t.headers,withCredentials:t.withCredentials,filename:t.filename};return Object.assign(i,e)}const Go=function(t){var e,i;if(t&&t.length>0){e=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let r of t){const t=r.value;Number.isNaN(t)||(e=Math.min(e,t),i=Math.max(i,t))}i>0&&(e=Math.min(0,e)),i<0&&(i=0)}else e=0,i=100;return{min:e,max:i}},Wo=function(t,e,i){let r=e.start,s=e.end;if(void 0===s)r-=i/2,s=r+i,s>t?(s=t,r=s-i):r<0&&(r=0,s=i);else if(s-r<i){const e=(s+r)/2;e-i/2<0?(r=0,s=r+i):e+i/2>t?(s=t,r=s-i):(r=e-i/2,s=r+i)}e.start=Math.ceil(r),e.end=Math.floor(s)},jo=function(t){return"number"==typeof t?t-t===0:"string"==typeof t&&""!==t.trim()&&Number.isFinite(+t)};function $o(t){var e,i;return t>1e7?(e=" mb",i=t/1e6,Math.floor(i).toString()+e):t>1e4?(e=" kb",i=t/1e3,F(Math.floor(i))+e):F(t)+" bp"}function Ko(t){return b(t)&&t.startsWith("data:")}function Zo(t,i){const r=e({class:i});return t.appendChild(r),r}function Yo(t,e){e.parentNode.insertBefore(t,e)}function Xo(t,e){e.parentNode.insertBefore(t,e.nextSibling)}function Jo(){return"https:"===window.location.protocol||"localhost"===window.location.hostname}class tn{constructor(t,i,r,s){this.parent=t,this.popover=e({class:"igv-ui-popover"}),t.appendChild(this.popover),this.popoverHeader=e(),this.popover.appendChild(this.popoverHeader);const o=e();this.popoverHeader.appendChild(o),r&&(o.textContent=r);const n=e();this.popoverHeader.appendChild(n),n.appendChild(l("times")),n.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault(),s?s():this.dismiss()}),!0===i&&p(this.popover,this.popoverHeader,{minX:0,minY:0}),this.popoverContent=e(),this.popover.appendChild(this.popoverContent),this.popover.style.display="none"}configure(t){if(0===t.length)return;const e=rn(t,this.popover);for(const{element:t}of e)this.popoverContent.appendChild(t)}present(t){this.popover.style.display="block";const e=this.popover.parentNode,{x:i,y:r,width:s}=a(t,e);this.popover.style.top=`${r}px`;const{width:o}=this.popover.getBoundingClientRect(),n=i+o,c=n-s;this.popover.style.left=`${n>s?i-c:i}px`,this.popoverContent.style.maxWidth=`${Math.min(o,s)}px`}presentContentWithEvent(t,e){this.popover.style.display="block",this.popoverContent.innerHTML=e,en(t,this.popover,this.popoverContent)}presentMenu(t,e){if(0===e.length)return;this.popover.style.display="block";const i=rn(e,this.popover);for(let t of i)this.popoverContent.appendChild(t.element);en(t,this.popover,this.popoverContent)}dismiss(){this.popover.style.display="none"}hide(){this.popover.style.display="none",this.dispose()}dispose(){this.popover&&this.popover.parentNode.removeChild(this.popover);const t=Object.keys(this);for(let e of t)this[e]=void 0}}function en(t,e,i){const{x:r,y:s,width:o}=a(t,e.parentNode);e.style.top=`${s}px`;const{width:n}=e.getBoundingClientRect(),c=r+n,l=c-o;e.style.left=`${c>o?r-l:r}px`,i.style.maxWidth=`${Math.min(n,o)}px`}function rn(t,i){const s=t.map(function(t,s){let o;if("string"==typeof t)o=e(),o.innerHTML=t;else if(t instanceof Node)o=t;else if("function"==typeof t.init&&t.init(),"checkbox"===t.type?o=function(t,i){const r=e({class:"igv-ui-trackgear-popover-check-container"}),s=h("check",!0===i?"#444":"transparent");s.style.borderColor="gray",s.style.borderWidth="1px",s.style.borderStyle="solid",r.appendChild(s);let o=e();return o.textContent=t,r.appendChild(o),r}("Show all bases",t.value):(o=e(),"string"==typeof t.label&&(o.innerHTML=t.label)),t.click&&"color"!==t.type){function n(e){t.click(),r(i),e.preventDefault(),e.stopPropagation()}o.addEventListener("click",n),o.addEventListener("touchend",n),o.addEventListener("mouseup",function(t){t.preventDefault(),t.stopPropagation()})}return{element:o,init:t.init}});return s}const sn=[["A","T"],["G","C"],["Y","R"],["W","S"],["K","M"],["D","H"],["B","V"]],on=new Map;for(let WA of sn){const jA=WA[0],$A=WA[1];on.set(jA,$A),on.set($A,jA),on.set(jA.toLowerCase(),$A.toLowerCase()),on.set($A.toLowerCase(),jA.toLowerCase())}function nn(t){return on.has(t)?on.get(t):t}function an(t){let e="";for(let i of t)e+=on.has(i)?on.get(i):i;return e}function cn(t){let e="",i=t.length;for(;i-- >0;){const r=t[i];e+=on.has(r)?on.get(r):r}return e}class ln{constructor(t,e,i,r){this.name=t,this.order=e,this.bpLength=i,this.altNames=r}getAltName(t){return this.altNames&&this.altNames.has(t)?this.altNames.get(t):this.name}}class hn{constructor(t,e,i,r){this.chr=t,this.start=e,this.end=i,this.features=r}contains(t,e,i){return this.chr===t&&this.start<=e&&this.end>=i}containsRange(t){return this.chr===t.chr&&this.start<=t.start&&this.end>=t.end}get locusString(){return`${this.chr}:${this.start+1}-${this.end}`}}class dn extends hn{constructor(t,e,i,r){super(t,e,i,r),this.features=r}getSequence(t,e){if(t<this.start||e>this.end)return null;const i=t-this.start,r=e-t;return this.features?this.features.substring(i,i+r):null}hasSequence(t,e){return t>=this.start&&e<=this.end}}var un;const fn=v,pn=new Set(["fastaURL","indexURL","cytobandURL","indexed"]);class gn{constructor(t){un.set(this,void 0),this.chromosomes=new Map,this.sequences=new Map,this.fastaURL=t.fastaURL,this.withCredentials=t.withCredentials;const e={};for(let i in t)t.hasOwnProperty(i)&&!pn.has(i)&&(e[i]=t[i]);this.config=e}async init(){return this.loadAll()}getSequenceRecord(t){return this.chromosomes.get(t)}get chromosomeNames(){return wo(this,un,"f")||bo(this,un,Array.from(this.chromosomes.keys()),"f"),wo(this,un,"f")}getFirstChromosomeName(){return this.chromosomeNames[0]}async getSequence(t,e,i){if(0===this.sequences.size&&await this.loadAll(),!this.sequences.has(t))return;let r=this.sequences.get(t).find(t=>t.contains(e,i));if(!r&&(r=this.sequences.get(t).find(t=>t.overlaps(e,i)),!r))return;e-=r.offset,i-=r.offset;let s="";if(e<0)for(let t=e;t<Math.min(i,0);t++)s+="*";if(i<=0)return s;const o=r.sequence,n=Math.min(i,o.length);return s+o.substring(e,n)}async loadAll(){const t=(t,e)=>{const r=t.length||t.offset+t.seq.length;if(i.has(t.chr)){const e=this.chromosomes.get(t.chr);e.bpLength=Math.max(e.bpLength,r)}else this.sequences.set(t.chr,[]),this.chromosomes.set(t.chr,new ln(t.chr,e,r)),i.add(t.chr);this.sequences.get(t.chr).push(new mn(t.offset,t.seq))};let e;if(Ko(this.fastaURL)){let t=nr(this.fastaURL);e="";for(let i of t)e+=String.fromCharCode(i)}else e=await Er.load(this.fastaURL,Qo(this.config));const i=new Set,r=fn(e);let s=0,o={};for(let e of r)if(e.startsWith("#")||0===e.length);else if(e.startsWith(">")){o.seq&&o.seq.length>0&&t(o,s++),o.seq="";const i=e.substr(1).split(/\s+/);if(e.includes("@len=")){const t=i[0].split(":");if(o.chr=t[0],t.length>1&&t[1].indexOf("-")>0){const r=t[1].split("-");2===r.length&&/^[0-9]+$/.test(r[0])&&/^[0-9]+$/.test(r[1]);const s=Number.parseInt(r[0]);if(Number.parseInt(r[1]),o.offset=s-1,i.length>1&&i[1].startsWith("@len="))try{o.length=parseInt(i[1].trim().substring(5))}catch(t){o.length=void 0,console.error(`Error parsing sequence length for ${e}`)}else o.length=void 0}}else o.chr=i[0],o.offset=0}else o.seq+=e;o.seq&&o.seq.length>0&&t(o,s)}getSequenceInterval(t,e,i){const r=this.sequences.get(t);if(r)for(let s of r){const r=s.sequence,o=s.offset,n=o+r.length;if(o<=e&&n>=i)return new dn(t,o,n,r)}}}un=new WeakMap;class mn{constructor(t,e){this.offset=t,this.sequence=e}contains(t,e){return this.offset<=t&&this.end>=e}overlaps(t,e){return this.offset<e&&this.end>t}get end(){return this.offset+this.sequence.length}}var wn;const bn=v,Fn=new Set(["fastaURL","indexURL","compressedIndexURL","cytobandURL","indexed"]);class vn{constructor(t){wn.set(this,void 0),this.chromosomes=new Map,this.file=t.fastaURL,this.indexFile=t.indexURL,this.compressedIndexFile=t.compressedIndexURL,this.withCredentials=t.withCredentials;const e={};for(let i in t)t.hasOwnProperty(i)&&!Fn.has(i)&&(e[i]=t[i]);this.config=e}getSequenceRecord(t){return this.chromosomes.get(t)}async init(){return this.getIndex()}get chromosomeNames(){return wo(this,wn,"f")||bo(this,wn,Array.from(this.chromosomes.keys()),"f"),wo(this,wn,"f")}getFirstChromosomeName(){return this.chromosomeNames[0]}async getIndex(){if(this.index)return this.index;{const t=await Er.load(this.indexFile,Qo(this.config)),e=bn(t),i=e.length;let r=0,s=0;for(this.index={};r<i;){const t=e[r++].split("\t");if(5===t.length){const e=t[0],i=parseInt(t[1]),r={size:i,position:parseInt(t[2]),basesPerLine:parseInt(t[3]),bytesPerLine:parseInt(t[4])};this.index[e]=r,this.chromosomes.set(e,new ln(e,s++,i))}}return this.index}}async getCompressedIndex(){if(this.compressedIndex)return this.compressedIndex;if(!this.compressedIndexFile)return this.compressedIndex=[],this.compressedIndex;this.compressedIndex=[];const t=await Er.loadArrayBuffer(this.compressedIndexFile,Qo(this.config)),e=t.byteLength;if(e<8)return console.log("Cannot parse GZI index file: length ("+e+" bytes) is insufficient to determine content of index."),this.compressedIndex;const i=t.slice(0,8),r=Number(new DataView(i).getBigUint64(0,!0)),s=8+2*r*8;if(e!=s)return console.log("Incorrect file size of reference genome index. Expected : "+s+". Received : "+e),this.compressedIndex;this.compressedIndex.push([0,0]);for(let e=0;e<r;e++){const i=8+2*e*8,r=8+2*e*8+16,s=t.slice(i,r),o=new DataView(s),n=Number(o.getBigUint64(0,!0)),a=Number(o.getBigUint64(8,!0));this.compressedIndex.push([n,a])}return this.compressedIndex}async getRelevantCompressedBlockNumbers(t,e){if(t<0||e<0||e<t)return console.log("Incompatible query positions for reference-genome. Start:"+t+" | End:"+e),[];await this.getCompressedIndex();let i=[];const r=this.compressedIndex.length-1;if(0==this.compressedIndex.length)return console.log("Compressed index does not contain any content"),[];if(t>this.compressedIndex[r][1])return[r];let s=0,o=r,n=Math.floor(this.compressedIndex.length/2),a=this.compressedIndex.length+1,c=!1;for(let e=0;e<a;e++){const e=this.compressedIndex[n][1],i=n<this.compressedIndex.length-1?this.compressedIndex[n+1][1]:1/0;if(e<=t&&i>t){c=!0;break}e<t?s=n+1:o=n-1,n=Math.ceil((o-s)/2)+s}if(!c)return console.log("No blocks within compressed index found that correspond with query positions "+t+","+e),console.log(this.compressedIndex),[];i.push(n);for(let t=n+1;t<this.compressedIndex.length;t++){i.push(t);if(this.compressedIndex[t][1]>=e)break}const l=i[i.length-1];return l===this.compressedIndex.length-1&&this.compressedIndex[l][1]<e&&i.push(-1),i}async loadAndUncompressBlocks(t,e){if(await this.getCompressedIndex(),0==t.length)return"";let i=Array(t.length-1);for(let e=0;e<t.length-1;e++){const r=t[e],s=this.compressedIndex[r][0],o=t[e+1];let n;if(-1!=o){const t=this.compressedIndex[o][0]-s;n=await Er.loadArrayBuffer(this.file,Qo(this.config,{range:{start:s,size:t}}))}else n=await Er.loadArrayBuffer(this.file,Qo(this.config,{range:{start:s}}));const a=await er(n);i[e]=a}let r="";for(let t=0;t<i.length;t++)for(let e=0;e<i[t].length;e++){r+=String.fromCharCode(i[t][e])}const s=e-this.compressedIndex[t[0]][1];return r=r.substring(s),r}async readSequence(t,e,i){await this.getIndex(),await this.getCompressedIndex();const r=this.index[t];if(!r)return console.log("No index entry for chr: "+t),this.index[t]=null,null;const s=Math.max(0,e),o=Math.min(r.size,i),n=r.bytesPerLine,a=r.basesPerLine,c=r.position,l=n-a,h=Math.floor(s/a),d=Math.floor(o/a),u=s-h*a,f=c+h*n+u,p=c+d*n+(o-d*a)-1,g=p-f+1;if(g<=0)return console.error("No sequence for "+t+":"+e+"-"+i),null;let m;if(this.compressedIndexFile){let t=await this.getRelevantCompressedBlockNumbers(f,p);if(0===t.length)return console.log("No blocks in the compressed index that correspond with the requested byte positions ("+f+","+p+")"),null;m=await this.loadAndUncompressBlocks(t,f)}else m=await Er.load(this.file,Qo(this.config,{range:{start:f,size:g}}));if(!m)return null;let w,b="",F=0,v=m.length;for(u>0&&(w=Math.min(o-s,a-u),b+=m.substr(F,w),F+=w+l);F<v;)w=Math.min(a,v-F),b+=m.substr(F,w),F+=w+l;return b}}var yn;wn=new WeakMap;const An=v;class Cn{constructor(t){yn.set(this,void 0),this.chromosomes=new Map,this.url=t}async init(){return this.loadAll()}getSequenceRecord(t){return this.chromosomes.get(t)}get chromosomeNames(){return wo(this,yn,"f")||bo(this,yn,Array.from(this.chromosomes.keys()),"f"),wo(this,yn,"f")}async getSequence(t,e,i){return null}async loadAll(){let t;if(Ko(this.url)){let e=nr(this.url);t="";for(let i of e)t+=String.fromCharCode(i)}else t=await Er.load(this.url,{});const e=An(t);let i=0;for(let t of e){const e=t.split("\t");if(e.length>1){const t=Number.parseInt(e[1]),r=new ln(e[0],i++,t);this.chromosomes.set(e[0],r)}}}}yn=new WeakMap;class _n{constructor(t,e=!0){this.littleEndian=e,this.position=0,this.view=t,this.length=t.byteLength}dumpBytes(t=100){const e=this.position,i=[];for(let e=0;e<=t;e++)i.push(this.getByte());console.log(i.join(" ")),this.setPosition(e)}setPosition(t){this.position=t}available(){return this.length-this.position}remLength(){return this.length-this.position}hasNext(){return this.position<this.length-1}getByte(){const t=this.view.getUint8(this.position);return this.position++,t}getShort(){const t=this.view.getInt16(this.position,this.littleEndian);return this.position+=2,t}getUShort(){const t=this.view.getUint16(this.position,this.littleEndian);return this.position+=2,t}getInt(){const t=this.view.getInt32(this.position,this.littleEndian);return this.position+=4,t}getUInt(){const t=this.view.getUint32(this.position,this.littleEndian);return this.position+=4,t}getLong(){var t=[];t[0]=this.view.getUint8(this.position),t[1]=this.view.getUint8(this.position+1),t[2]=this.view.getUint8(this.position+2),t[3]=this.view.getUint8(this.position+3),t[4]=this.view.getUint8(this.position+4),t[5]=this.view.getUint8(this.position+5),t[6]=this.view.getUint8(this.position+6),t[7]=this.view.getUint8(this.position+7);let e=0;if(this.littleEndian)for(let i=t.length-1;i>=0;i--)e=256*e+t[i];else for(let i=0;i<t.length;i++)e=256*e+t[i];return this.position+=8,e}getString(t){let e,i="";for(;0!==(e=this.view.getUint8(this.position++))&&(i+=String.fromCharCode(e),!t||i.length!==t););return i}getFixedLengthString(t){let e="";for(let i=0;i<t;i++){const t=this.view.getUint8(this.position++);t>0&&(e+=String.fromCharCode(t))}return e}getFloat(){var t=this.view.getFloat32(this.position,this.littleEndian);return this.position+=4,t}getDouble(){var t=this.view.getFloat64(this.position,this.littleEndian);return this.position+=8,t}skip(t){return this.position+=t,this.position}getVPointer(){var t=this.position,e=this.view.getUint8(t+1)<<8|this.view.getUint8(t),i=4294967296*(255&this.view.getUint8(t+6))+16777216*(255&this.view.getUint8(t+5))+65536*(255&this.view.getUint8(t+4))+256*(255&this.view.getUint8(t+3))+(255&this.view.getUint8(t+2));return this.position+=8,new xn(i,e)}}class xn{constructor(t,e){this.block=t,this.offset=e}isLessThan(t){return this.block<t.block||this.block===t.block&&this.offset<t.offset}isGreaterThan(t){return this.block>t.block||this.block===t.block&&this.offset>t.offset}isEqualTo(t){return this.block===t.block&&this.offset===t.offset}print(){return this.block+":"+this.offset}}var kn,In;class Sn{static async loadBpTree(t,e,i,r,s){return new Sn(t,e,i,r,s).init()}constructor(t,e,i,r,s){kn.add(this),this.littleEndian=!0,this.type="BPTree",this.nodeCache=new Map,this.path=t,this.config=e,this.startOffset=i,r&&(this.type=r),this.loader=s||Er}async init(){const t=await wo(this,kn,"m",In).call(this,this.startOffset,32);let e=t.getInt();if(e!==Sn.magic&&(t.setPosition(0),this.littleEndian=!this.littleEndian,t.littleEndian=this.littleEndian,e=t.getInt(),e!==Sn.magic))throw Error(`Bad magic number ${e}`);const i=t.getInt(),r=t.getInt(),s=t.getInt(),o=t.getLong(),n=t.getLong(),a=this.startOffset+32;return this.header={magic:e,blockSize:i,keySize:r,valSize:s,itemCount:o,reserved:n,nodeOffset:a},this}getItemCount(){if(!this.header)throw Error("Header not initialized");return this.header.itemCount}async search(t){this.header||await this.init();const e=async i=>{const r=await this.readTreeNode(i);if(1!==r.type){let i=r.items[0].offset;for(let e=1;e<r.items.length;e++){const s=r.items[e].key;if(t.localeCompare(s)<0)break;i=r.items[e].offset}return e(i)}for(let e of r.items)if(t===e.key)return e.value};return e(this.header.nodeOffset)}async readTreeNode(t){if(this.nodeCache.has(t))return this.nodeCache.get(t);{let e=await wo(this,kn,"m",In).call(this,t,4);const i=e.getByte();e.getByte();const r=e.getUShort(),s=[],{keySize:o,valSize:n}=this.header;if(1===i){const i=r*(o+n);e=await wo(this,kn,"m",In).call(this,t+4,i);for(let t=0;t<r;t++){const t=e.getFixedLengthString(o);let i;if("BPChromTree"===this.type){i={id:e.getInt(),size:e.getInt()}}else{const t=e.getLong();if(16===n){i={offset:t,length:e.getLong()}}else i={offset:t}}s.push({key:t,value:i})}}else{const i=r*(o+8);e=await wo(this,kn,"m",In).call(this,t+4,i);for(let t=0;t<r;t++){const t=e.getFixedLengthString(o),i=e.getLong();s.push({key:t,offset:i})}}const a={type:i,count:r,items:s};return this.nodeCache.set(t,a),a}}}kn=new WeakSet,In=async function(t,e){const i=await this.loader.loadArrayBuffer(this.path,Qo(this.config,{range:{start:t,size:e}}));return new _n(new DataView(i),this.littleEndian)},Sn.magic=2026540177;
|
|
11
|
+
/**
|
|
12
|
+
* Note: Some portions of this code adapated from the GMOD two-bit.js project, @Copyright (c) 2017 Robert Buels
|
|
13
|
+
* * https://github.com/GMOD/twobit-js/blob/master/src/twoBitFile.ts*
|
|
14
|
+
*/
|
|
15
|
+
const En=["T","C","A","G"],Nn=[];for(let KA=0;KA<256;KA++)Nn.push(En[KA>>6&3]+En[KA>>4&3]+En[KA>>2&3]+En[3&KA]);const Mn=Nn.map(t=>t.toLowerCase());class Rn{constructor(t){this.metaIndex=new Map,this.url=t.twoBitURL||t.fastaURL,this.config=t,t.twoBitBptURL&&(this.bptURL=t.twoBitBptURL)}async init(){if(this.bptURL)this.index=await Sn.loadBpTree(this.bptURL,this.config,0,void 0);else{const t=await this._readIndex();this.index={search:async e=>t.has(e)?{offset:t.get(e)}:void 0}}}async readSequence(t,e,i){this.index||await this.init();const r=await this.getSequenceRecord(t);if(!r)return null;if(e<0)throw new TypeError("regionStart cannot be less than 0");(void 0===i||i>r.dnaSize)&&(i=r.dnaSize);const s=this._getOverlappingBlocks(e,i,r.nBlocks),o=this._getOverlappingBlocks(e,i,r.maskBlocks),n=Math.floor(e/4),a=r.packedPos+n,c=Math.floor(i/4)-n+1,l=await Er.loadArrayBuffer(this.url,{range:{start:a,size:c}}),h=new Uint8Array(l);let d="";for(let t=e;t<i;t+=1){for(;o.length&&o[0].end<=t;)o.shift();const e=!!(o[0]&&o[0].start<=t&&o[0].end>t);if(s[0]&&t>=s[0].start&&t<s[0].end){const e=s.shift();for(;t<e.end&&t<i;)d+="N",t++;t--}else{const i=t%4,r=h[Math.floor(t/4)-n];d+=e?Mn[r][i]:Nn[r][i]}}return d}async _readIndex(){const t=new Map;this.chromosomeNames=[];let e=await Er.loadArrayBuffer(this.url,{range:{start:0,size:64}}),i=new DataView(e),r=0;const s=i.getUint32(r,!0),o=i.getUint32(r,!1);r+=4;const n=440477507;if(s===n)this.littleEndian=!0;else{if(o!==n)throw Error(`Bad magic number ${n}`);this.littleEndian=!1}let a,c;this.version=i.getUint32(r,this.littleEndian),r+=4,this.sequenceCount=i.getUint32(r,this.littleEndian),r+=4,this.reserved=i.getUint32(r,this.littleEndian),r+=4;let l=20;for(let e=0;e<this.sequenceCount;e++){(!c||c.available()<1)&&(a=(this.sequenceCount-e)*l,c=await this._loadBinaryBuffer(r,a));const i=c.getByte();r+=1,c.available()<i+5&&(a=(this.sequenceCount-e)*l+100,c=await this._loadBinaryBuffer(r,a));const s=c.getString(i),o=c.getUInt();r+=i+4,t.set(s,o),l=Math.floor(l*(e/(e+1))+s.length/(e+1)),this.chromosomeNames.push(s)}return t}async getSequenceRecord(t){if(!this.metaIndex.has(t)){if(!this.index)throw Error("TwobitSequence object must be initialized before accessing sequence");let e=await this.index.search(t);if(!e)return;let i=e.offset,r=8,s=await this._loadBinaryBuffer(i,r);const o=s.getUInt(),n=s.getUInt();i+=r,r=8*n+4,s=await this._loadBinaryBuffer(i,r);const a=[];for(let t=0;t<n;t++)a.push(s.getUInt());const c=[];for(let t=0;t<n;t++)c.push(s.getUInt());const l=s.getUInt();i+=r,r=8*l+4,s=await this._loadBinaryBuffer(i,r);const h=[];for(let t=0;t<l;t++)h.push(s.getUInt());const d=[];for(let t=0;t<l;t++)d.push(s.getUInt());const u=[];for(let t=0;t<n;t++)u.push(new Dn(a[t],c[t]));const f=[];for(let t=0;t<l;t++)f.push(new Dn(h[t],d[t]));if(0!=s.getUInt())throw Error("Bad 2-bit file");i+=r;const p={dnaSize:o,nBlocks:u,maskBlocks:f,packedPos:i,bpLength:o};this.metaIndex.set(t,p)}return this.metaIndex.get(t)}_getOverlappingBlocks(t,e,i){const r=[];for(let s of i){if(s.start>e)break;s.end<t||r.push(s)}return r}async _loadBinaryBuffer(t,e){const i=await Er.loadArrayBuffer(this.url,{range:{start:t,size:e}});return new _n(new DataView(i),this.littleEndian)}}class Dn{constructor(t,e){this.start=t,this.size=e}get end(){return this.start+this.size}}var Bn,Tn,Ln,zn,Pn,On,Hn,Un;class Vn{constructor(t,e){Bn.add(this),zn.set(this,void 0),Pn.set(this,[]),On.set(this,10),this.sequenceReader=t,this.browser=e}get chromosomes(){return this.sequenceReader.chromosomes}async getSequenceRecord(t){return this.sequenceReader.getSequenceRecord?this.sequenceReader.getSequenceRecord(t):void 0}async getSequence(t,e,i){let r=wo(this,Pn,"f").find(r=>r.contains(t,e,i));if(r||(r=await wo(this,Bn,"m",Un).call(this,t,e,i),wo(this,Bn,"m",Hn).call(this,r),wo(this,Pn,"f").push(r)),r){const t=e-r.start,s=i-e;return r.features?r.features.substring(t,t+s):null}}getSequenceInterval(t,e,i){return wo(this,Pn,"f").find(r=>r.contains(t,e,i))}async init(){await this.sequenceReader.init()}get chromosomeNames(){return this.sequenceReader.chromosomeNames}getFirstChromosomeName(){return"function"==typeof this.sequenceReader.getFirstChromosomeName?this.sequenceReader.getFirstChromosomeName():void 0}}async function qn(t,e){let i;const r=t.format;return"chromsizes"===r?i=new Cn(t.fastaURL||t.url):"2bit"===r||t.twoBitURL?i=new Vn(new Rn(t),e):Ko(t.fastaURL)||!t.indexURL?i=new gn(t):"gbk"===r||t.gbkURL||(i=new Vn(new vn(t),e)),i&&await i.init(),i}Tn=Vn,zn=new WeakMap,Pn=new WeakMap,On=new WeakMap,Bn=new WeakSet,Hn=function(t){bo(this,Pn,wo(this,Pn,"f").filter(e=>!t.containsRange(e)),"f"),wo(this,Pn,"f").length===wo(this,On,"f")&&wo(this,Pn,"f").shift(),this.browser&&this.browser.referenceFrameList.length<100&&bo(this,Pn,wo(this,Pn,"f").filter(t=>void 0!==this.browser.referenceFrameList.find(e=>e.overlaps(t))),"f")},Un=async function(t,e,i){let r=e,s=i;if(i-e<wo(Tn,Tn,"f",Ln)){const t=i-e,o=Math.round(e+t/2);r=Math.max(0,o-wo(Tn,Tn,"f",Ln)/2),s=r+wo(Tn,Tn,"f",Ln)}const o=new dn(t,r,s,null);if(wo(this,zn,"f")&&wo(this,zn,"f")[0].contains(t,e,i))return wo(this,zn,"f")[1];{const e=new Promise(async(e,i)=>{o.features=await this.sequenceReader.readSequence(t,r,s),e(o)});return bo(this,zn,[o,e],"f"),e}},Ln={value:1e5};var Qn={color:1};Qn.parent=Qn,Qn.left=Qn,Qn.right=Qn;class Gn{constructor(){this.root=Qn}insert(t,e,i){var r=new Zn(t,e,i),s=new Yn(r);for(this.treeInsert(s),s.color=2;s!==this.root&&2===s.parent.color;)if(s.parent===s.parent.parent.left){let t=s.parent.parent.right;2===t.color?(s.parent.color=1,t.color=1,s.parent.parent.color=2,s=s.parent.parent):(s===s.parent.right&&(s=s.parent,jn.call(this,s)),s.parent.color=1,s.parent.parent.color=2,$n.call(this,s.parent.parent))}else{let t=s.parent.parent.left;2===t.color?(s.parent.color=1,t.color=1,s.parent.parent.color=2,s=s.parent.parent):(s===s.parent.left&&(s=s.parent,$n.call(this,s)),s.parent.color=1,s.parent.parent.color=2,jn.call(this,s.parent.parent))}this.root.color=1}findOverlapping(t,e){var i=new Zn(t,e,0);if(this.root===Qn)return[];var r=Wn.call(this,i,this.root,[]);return r.length>1&&r.sort(function(t,e){return t.low-e.low}),r}logIntervals(){!function t(e,i){for(var r="",s=0;s<i;s++)r+=" ";console.log(r+e.interval.low+" "+e.interval.high),i+=5,e.left!==Qn&&t(e.left,i);e.right!==Qn&&t(e.right,i)}(this.root,0)}mapIntervals(t){!function e(i){t(i.interval),i.left!==Qn&&e(i.left);i.right!==Qn&&e(i.right)}(this.root)}treeInsert(t){for(var e=this.root,i=Qn;e!==Qn;)i=e,e=t.interval.low<=e.interval.low?e.left:e.right;t.parent=i,i===Qn?(this.root=t,t.left=t.right=Qn):t.interval.low<=i.interval.low?i.left=t:i.right=t,Kn.call(this,t)}}function Wn(t,e,i){return e.interval.overlaps(t)&&i.push(e.interval),e.left!==Qn&&e.left.max>=t.low&&Wn.call(this,t,e.left,i),e.right!==Qn&&e.right.min<=t.high&&Wn.call(this,t,e.right,i),i}function jn(t){var e=t.right;t.right=e.left,e.left!==Qn&&(e.left.parent=t),e.parent=t.parent,t.parent===Qn?this.root=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e,Kn.call(this,t)}function $n(t){var e=t.left;t.left=e.right,e.right!==Qn&&(e.right.parent=t),e.parent=t.parent,t.parent===Qn?this.root=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e,Kn.call(this,t)}function Kn(t){for(;t!==Qn;){const o=t;var e=o.left.max>o.right.max?o.left.max:o.right.max,i=o.interval.high;o.max=e>i?e:i;var r=o.left.min<o.right.min?o.left.min:o.right.min,s=o.interval.low;o.min=r<s?r:s,t=o.parent}}class Zn{constructor(t,e,i){this.low=t,this.high=e,this.value=i}equals(t){return!!t&&(this===t||this.low===t.low&&this.high===t.high)}compareTo(t){return this.low<t.low?-1:this.low>t.low?1:this.high<t.high?-1:this.high>t.high?1:0}overlaps(t){return this.low<=t.high&&t.low<=this.high}}class Yn{constructor(t){this.parent=Qn,this.left=Qn,this.right=Qn,this.color=2,this.interval=t,this.max=t.high,this.min=t.low}}class Xn{constructor(t,e){t=t||[],this.treeMap=this.buildTreeMap(t),this.range=e,this.count=t.length}containsRange(t){return void 0===this.range||this.range.contains(t.chr,t.start,t.end)}findFeatures(t){const e=[];for(let i of Object.values(this.allFeatures))for(let r of i)t(r)&&e.push(r);return e}queryFeatures(t,e,i){const r=this.treeMap[t];if(!r)return[];const s=r.findOverlapping(e,i);if(0===s.length)return[];{const r=[],o=this.allFeatures[t];if(o){for(let t of s){const s=t.value;for(let t=s.start;t<s.end;t++){let s=o[t];if(s.start>i)break;s.end>=e&&r.push(s)}}r.sort(function(t,e){return t.start-e.start})}return r}}getAllFeatures(){return this.allFeatures}buildTreeMap(t){const e={},i=[];if(this.allFeatures={},t){for(let e of t){const t=e.chr;let r=this.allFeatures[t];r||(i.push(t),r=[],this.allFeatures[t]=r),r.push(e)}for(let t of i){const i=this.allFeatures[t];i.sort(function(t,e){return t.start===e.start?0:t.start>e.start?1:-1}),e[t]=Jn(i)}}return e}}function Jn(t){const e=new Gn,i=t.length,r=Math.max(10,Math.round(i/10));for(let s=0;s<i;s+=r){const o=Math.min(i,s+r),n=new ta(s,o),a=t[s].start;let c=a;for(let e=s;e<o;e++)c=Math.max(c,t[e].end);e.insert(a,c,n)}return e}class ta{constructor(t,e){this.start=t,this.end=e}}function ea(t,e){if(t.length<6)return void console.log("Skipping line: "+t.join(" "));const i={chr1:t[0],start1:Number.parseInt(t[1]),end1:Number.parseInt(t[2]),chr2:t[3],start2:Number.parseInt(t[4]),end2:Number.parseInt(t[5])};if(isNaN(i.start1)||isNaN(i.end1)||isNaN(i.start2)||isNaN(i.end2))return;e&&void 0===e.hiccups&&(e.hiccups=!!e.columnNames&&ra(e.columnNames));const r=e&&e.hiccups,s=r?6:10;if(r||(t.length>6&&"."!==t[6]&&(i.name=t[6]),t.length>7&&"."!==t[7]&&(i.score=Number(t[7])),t.length>8&&"."!==t[8]&&(i.strand1=t[8]),t.length>9&&"."!==t[9]&&(i.strand2=t[9])),e){const r=e.colorColumn;r&&r<t.length&&(i.color=ur.createColorString(t[r]));const o=e.thicknessColumn;o&&o<t.length&&(i.thickness=t[o]),t.length>s&&e.columnNames&&e.columnNames.length===t.length&&(i.extras=t.slice(s))}return i.chr1===i.chr2&&(i.chr=i.chr1,i.start=Math.min(i.start1,i.start2),i.end=Math.max(i.end1,i.end2)),i}function ia(t,e){if(!(t.length<8))return{chr:t[0],start:Number.parseInt(t[1]),end:Number.parseInt(t[2]),color:ur.createColorString(t[6]),value:Number(t[7])}}function ra(t){return t&&(t.includes("fdrDonut")||t.includes("fdr_donut"))}function sa(t,e){if(t.length<6)return void console.log("Skipping line: "+t.join(" "));return{chr:t[0],start:Number.parseInt(t[1]),end:Number.parseInt(t[2]),chr1:t[8],start1:Number.parseInt(t[9]),end1:Number.parseInt(t[10]),chr2:t[13],start2:Number.parseInt(t[14]),end2:Number.parseInt(t[15]),name:t[3],score:Number(t[4]),value:Number(t[5]),color:"."===t[7]?void 0:"0"===t[7]?"rgb(0,0,0)":t[7]}}class oa{constructor(t){this.message=t}}const na=new Map([["%09","\t"],["%0A","\n"],["%0D","\r"],["%25","%"],["%3B",";"],["%3D","="],["%26","&"],["%2C",","]]);function aa(t){if(!t.includes("%"))return t;let e="";for(let i=0;i<t.length;i++)if(37===t.charCodeAt(i)&&i<t.length-2){const r=t.substring(i,i+3);na.has(r)?e+=na.get(r):e+=r,i+=2}else e+=t.charAt(i);return e}function ca(t,e="="){const i="="===e,r=[];for(let s of t.split(";")){s=s.trim();const t=s.indexOf(e);if(t>0&&t<s.length-1){let e=aa(s.substring(0,t).trim()),o=aa(s.substring(t+1).trim());i||(e=la(e),o=la(o)),r.push([e,o])}}return r}function la(t){return t.startsWith('"')&&t.endsWith('"')&&(t=t.substr(1,t.length-2)),t}const ha=new Set(["transcript","primary_transcript","processed_transcript","mRNA","mrna","lnc_RNA","miRNA","ncRNA","rRNA","scRNA","snRNA","snoRNA","tRNA"]),da=new Set(["CDS","cds","start_codon","stop_codon"]),ua=new Set(["5UTR","3UTR","UTR","five_prime_UTR","three_prime_UTR","3'-UTR","5'-UTR"]),fa=new Set(["exon","coding-exon"]),pa=new Set;for(let ZA of[da,ua,fa])for(let YA of ZA)pa.add(YA);function ga(t){return fa.has(t)}function ma(t){return t.includes("intron")}function wa(t){return da.has(t)}function ba(t){return ua.has(t)}function Fa(t){return ha.has(t)||t.endsWith("RNA")||t.endsWith("transcript")}function va(t){return pa.has(t)||t.endsWith("RNA")||ma(t)}const ya=new Set(["id","parent","name"]);class Aa{constructor(t){Object.assign(this,t),void 0!==t.phase&&"."!==t.phase&&(this.readingFrame=(3-parseInt(String(t.phase)))%3)}popupData(t){const e=this.geneObject?this.geneObject.popupData():[];if(this.geneObject&&e.push("<hr/>"),this.name&&e.push({name:"Name",value:this.name}),e.push({name:"Type",value:this.type}),e.push({name:"Source",value:this.source}),void 0!==this.score&&e.push({name:"Score",value:String(this.score)}),e.push({name:"Phase",value:this.phase}),this.attributeString){const t=ca(this.attributeString,this.delim);for(let[i,r]of t)void 0!==r&&r.length>0&&!ya.has(i.toLowerCase())&&e.push({name:i+":",value:r})}return e.push({name:"Location",value:`${this.chr}:${F(this.start+1)}-${F(this.end)}`}),e}getAttributeValue(t){if(this.hasOwnProperty(t))return this[t];if(this._attributeCache||(this._attributeCache=new Map),this._attributeCache.has(t))return this._attributeCache.get(t);{const e=ca(this.attributeString,this.delim);let i;for(let[r,s]of e)if(r===t){i=s;break}return this._attributeCache.set(t,i),i}}}class Ca extends Aa{constructor(t){super(t),this.exons=[],this.parts=[]}addExon(t){this.exons.push(t),this.start=Math.min(this.start,t.start),this.end=Math.max(this.end,t.end)}addPart(t){this.parts.push(t)}assembleParts(){if(0===this.parts.length)return;this.parts.sort(function(t,e){return t.start-e.start});let t=this.parts[0].start,e=this.parts[0].end;for(let i=1;i<this.parts.length;i++){const r=this.parts[i];if(!ma(r.type))if(r.start<=e)e=Math.max(e,r.end);else{this.findExonContaining({start:t,end:e})||this.exons.push({start:t,end:e,psuedo:!0}),t=r.start,e=r.end}}this.findExonContaining({start:t,end:e})||(this.exons.push({start:t,end:e,psuedo:!0}),this.start=Math.min(this.start,t),this.end=Math.max(this.end,e));for(let t of this.parts){const e=t.type;wa(e)?this.addCDS(t):ba(e)&&this.addUTR(t)}}findExonContaining({start:t,end:e}){for(let i of this.exons)if(i.end>=e&&i.start<=t)return i}addCDS(t){let e;const i=this.exons;for(let r of i)if(r.start<=t.start&&r.end>=t.end){e=r;break}e?(e.cdStart=e.cdStart?Math.min(t.start,e.cdStart):t.start,e.cdEnd=e.cdEnd?Math.max(t.end,e.cdEnd):t.end,void 0!==t.readingFrame&&(void 0===e.readingFrame?e.readingFrame=t.readingFrame:"+"===this.strand||(e.readingFrame=t.readingFrame))):console.error("No exon found spanning "+t.start+"-"+t.end),this.cdStart=this.cdStart?Math.min(t.start,this.cdStart):t.start,this.cdEnd=this.cdEnd?Math.max(t.end,this.cdEnd):t.end}addTerminalCodon(t){this.addCDS(t)}addUTR(t){let e;const i=this.exons;for(let r=0;r<i.length;r++)if(i[r].start<=t.start&&i[r].end>=t.end){e=i[r];break}e?t.start===e.start&&t.end===e.end?e.utr=!0:(t.end<e.end&&(e.cdStart=t.end),(void 0===e.cdEnd||t.start>e.cdEnd)&&(e.cdEnd=t.start)):console.error("No exon found spanning "+t.start+"-"+t.end)}finish(){this.assembleParts();var t=this.cdStart,e=this.cdEnd;this.exons.sort(function(t,e){return t.start-e.start}),t&&this.exons.forEach(function(i){(i.end<t||i.start>e)&&(i.utr=!0)})}popupData(t){const e=super.popupData(t);for(let i of this.exons)if(!i.pseudo&&void 0!==t&&t>=i.start&&t<i.end&&"function"==typeof i.popupData){e.push("<hr/>");const r=i.popupData(t);for(let t of r)e.push(t)}for(let i of this.parts)if(void 0!==t&&t>=i.start&&t<i.end&&"function"==typeof i.popupData){e.push("<hr/>");const r=i.popupData(t);for(let t of r)e.push(t)}return e}}class _a{constructor(t){this.format=t.format,this.nameField=t.nameField,this.filterTypes=void 0===t.filterTypes?new Set(["chromosome"]):new Set(t.filterTypes)}combineFeatures(t,e){let i;const r=this.filterTypes;if(t=t.filter(t=>void 0===r||!r.has(t.type)),"gff3"===this.format){const e=this.combineFeaturesById(t);i=this.combineFeaturesByType(e)}else i=this.combineFeaturesByType(t);return this.numberExons(i,e),this.nameFeatures(i),i}combineFeaturesById(t){const e=new Map,i=[];for(let r of t)if(va(r.type)||Fa(r.type)||!r.id)i.push(r);else{let t=e.get(r.chr);t||(t=new Map,e.set(r.chr,t));let i=t.get(r.id);i?i.push(r):t.set(r.id,[r])}for(let t of e.values())for(let e of t.values())if(e.length>1){const t=e[0];t.exons=[];for(let i of e)t.start=Math.min(t.start,i.start),t.end=Math.max(t.end,i.end),t.exons.push({start:i.start,end:i.end});i.push(t)}else i.push(e[0]);return i}combineFeaturesByType(t){const e=t.filter(t=>"gene"===t.type||t.type.endsWith("_gene")),i=Object.create(null);for(let t of e)i[t.id]=t;const r=Object.create(null),s=[],o=new Set,n=this.filterTypes;t=t.filter(t=>void 0===n||!n.has(t.type));for(let e of t)if(Fa(e.type)){const t=e.id;if(void 0!==t){const n=new Ca(e);r[t]=n,s.push(n),o.add(e);const a=i[e.parent];a&&(n.geneObject=a,o.add(a))}}for(let e of t)if(va(e.type)){const t=c(e);if(t)for(let i of t){let n=r[i];if(!n&&"gtf"===this.format){const t=Object.assign({},e,{type:"transcript"});n=new Ca(t),r[i]=n,s.push(n)}if(void 0!==n){if(ga(e.type))if(t.length>1){const t=new Aa(e);n.addExon(t)}else n.addExon(e);else n.addPart(new Aa(e));o.add(e)}}}s.forEach(function(t){"finish"in t&&"function"==typeof t.finish&&t.finish()});const a=t.filter(t=>!o.has(t));for(let t of a)s.push(t);return s;function c(t){return t.parent&&""!==t.parent.trim()?t.parent.trim().split(","):null}}numberExons(t,e){for(const i of t){const t=i;if(t.exons&&(!e||t.end<=e.end&&t.start>e.start))for(let e=0;e<t.exons.length;e++){t.exons[e].number="-"===t.strand?t.exons.length-e:e+1}}}nameFeatures(t){for(const e of t){const t=e;if("function"==typeof t.getAttributeValue)if(this.nameField)t.name=t.getAttributeValue(this.nameField);else for(let e of _a.gffNameFields){const i=t.getAttributeValue(e);if(i){t.name=i;break}}}}}function xa(t,e,i=Number.MAX_SAFE_INTEGER){if(t.length<3)return;const r=e&&e.gffTags,s=t[0],o=parseInt(t[1]),n=t.length>2?parseInt(t[2]):o+1;if(isNaN(o)||isNaN(n))return new oa("Unparsable bed record.");const a=new Oa({chr:s,start:o,end:n,score:1e3});let c=3;try{if(t.length>3&&c++<i){if(t[3].indexOf(";")>0&&t[3].indexOf("=")>0){const i=ca(t[3],"=");a.attributes={};for(let t of i)a.attributes[t[0]]=t[1],r&&(null!=e.nameField&&t[0]===e.nameField||!a.name&&_a.gffNameFields.has(t[0]))&&(a.name=t[1])}a.name||r||(a.name="."===t[3]?"":t[3])}if(t.length>4&&c++<i&&(a.score="."===t[4]?0:Number(t[4]),isNaN(a.score)))return a;if(t.length>5&&c++<i&&(a.strand=t[5],"."!==a.strand&&"+"!==a.strand&&"-"!==a.strand))return a;if(t.length>6&&c++<i&&(a.cdStart=parseInt(t[6]),isNaN(a.cdStart)))return a;if(t.length>7&&c++<i&&(a.cdEnd=parseInt(t[7]),isNaN(a.cdEnd)))return a;if(t.length>8&&c++<i&&"."!==t[8]&&"0"!==t[8]&&(a.color=ur.createColorString(t[8])),t.length>11&&c++<i){const e=parseInt(t[9]);if(e>1e3)return a;const i=t[10].replace(/,$/,"").split(","),r=t[11].replace(/,$/,"").split(",");if(i.length!==r.length||e!==i.length)return a;const s=[];for(let t=0;t<e;t++){const e=o+parseInt(r[t]),n=e+parseInt(i[t]);s.push({start:e,end:n})}s.length>0&&(Da(s,a.cdStart,a.cdEnd),a.exons=s)}if(e){let i=e.thicknessColumn,r=e.colorColumn;r&&r<t.length&&(a.color=ur.createColorString(t[r])),i&&i<t.length&&(a.thickness=t[i])}}catch(t){}return a}function ka(t,e){const i=xa(t,e);return i&&t.length>14&&(i.signal=Number(t[12]),i.pValue=Number(t[13]),i.qValue=Number(t[14])),i}function Ia(t,e){const i=xa(t,e,9);if(i){const e=["Coverage","% Showing Methylation","N-mod","N-canonical","N-other mod","N-delete","N-fail","N-dff","N-nocall"];for(let r=9;r<t.length;r++){i[e[r-9]]=t[r]}}return i}function Sa(t,e){if(t.length<=15)return;return{swScore:Number.parseInt(t[1]),milliDiv:Number.parseInt(t[2]),milliDel:Number.parseInt(t[3]),milliIns:Number.parseInt(t[4]),chr:t[5],start:Number.parseInt(t[6]),end:Number.parseInt(t[7]),strand:t[9],repName:t[10],repClass:t[11],repFamily:t[12],repStart:Number.parseInt(t[13]),repEnd:Number.parseInt(t[14]),repLeft:Number.parseInt(t[15])}}function Ea(t,e){const i=void 0===e.shift?0:1;if(t.length<=9+i)return;const r=parseInt(t[5+i]),s=parseInt(t[6+i]),o={name:t[0+i],chr:t[1+i],strand:t[2+i],start:parseInt(t[3+i]),end:parseInt(t[4+i]),cdStart:r,cdEnd:s,id:t[0+i]},n=Ra(parseInt(t[7+i]),t[8+i],t[9+i]);return Da(n,r,s),o.exons=n,o}function Na(t,e){const i=void 0===e.shift?0:1;if(t.length<=11+i)return;const r=parseInt(t[5+i]),s=parseInt(t[6+i]),o={name:t[11+i],chr:t[1+i],strand:t[2+i],start:parseInt(t[3+i]),end:parseInt(t[4+i]),cdStart:r,cdEnd:s,id:t[0+i]},n=Ra(parseInt(t[7+i]),t[8+i],t[9+i],t[14+i]);return Da(n,r,s),o.exons=n,o}function Ma(t,e){const i=void 0===e.shift?0:1;if(t.length<=10+i)return;const r=parseInt(t[6+i]),s=parseInt(t[7+i]),o={name:t[0+i],id:t[1+i],chr:t[2+i],strand:t[3+i],start:parseInt(t[4+i]),end:parseInt(t[5+i]),cdStart:r,cdEnd:s},n=Ra(parseInt(t[8+i]),t[9+i],t[10+i]);return Da(n,r,s),o.exons=n,o}function Ra(t,e,i,r){const s=e.replace(/,$/,"").split(","),o=i.replace(/,$/,"").split(","),n=r?r.replace(/,$/,"").split(","):void 0,a=[];for(let e=0;e<t;e++){const t={start:parseInt(s[e]),end:parseInt(o[e])};if(n){const i=parseInt(n[e]);-1!==i&&(t.readingFrame=i)}a.push(t)}return a}function Da(t,e,i){for(let r of t){const t=r.end,s=r.start;t<e||s>i?r.utr=!0:(e>=s&&e<=t&&(r.cdStart=e),i>=s&&i<=t&&(r.cdEnd=i))}}function Ba(t,e){if(t.length<9)return;const i=t[0],r=parseInt(t[1]),s=parseInt(t[2]),o=t[3];let n=Number(t[4]);const a=t[5].trim(),c=Number(t[6]);return 0===n&&(n=c),{chr:i,start:r,end:s,name:o,score:n,strand:a,signal:c,pValue:Number(t[7]),qValue:Number(t[8])}}function Ta(t,e){const i=Ba(t);return i&&t.length>9&&(i.peak=Number(t[9])),i}function La(t,e){if(t.length<=3)return;const i={chr:t[0],start:parseInt(t[1]),end:parseInt(t[2]),value:Number(t[3])};if(e){let r=e.colorColumn;r&&r<t.length&&(i.color=ur.createColorString(t[r]))}return i}function za(t,e){const i=e.wig;if(i&&"fixedStep"===i.format){const e=i.index*i.step+i.start,r=e+i.span,s=Number(t[0]);return++i.index,isNaN(s)?null:{chr:i.chrom,start:e,end:r,value:s}}if(i&&"variableStep"===i.format){if(t.length<2)return null;const e=parseInt(t[0],10)-1,r=e+i.span,s=Number(t[1]);return isNaN(s)?null:{chr:i.chrom,start:e,end:r,value:s}}return La(t)}function Pa(t,e){if(t.length<6)return;const i=["bin","chr","start","end","name","score","strand","refNCBI","refUCSC","observed","molType","class","valid","avHet","avHetSE","func","locType","weight","exceptions","submitterCount","submitters","alleleFreqCount","alleles","alleleNs","alleleFreqs","bitfields"],r={chr:t[1],start:Number.parseInt(t[2]),end:Number.parseInt(t[3]),name:t[4],score:Number.parseInt(t[5])},s=Math.min(t.length,i.length);for(let e=6;e<s;e++)r[i[e]]=t[e];return r}_a.gffNameFields=new Set(["Name","transcript_id","gene_name","gene","gene_id","alias","locus","name"]);class Oa{constructor(t){Object.assign(this,t)}getAttributeValue(t){return this.hasOwnProperty(t)?this[t]:this.attributes?this.attributes[t]:void 0}}class Ha{constructor(t){Object.assign(this,t)}get score(){const t=this.tokens,e=parseInt(t[0]),i=parseInt(t[2]),r=parseInt(t[1]),s=parseInt(t[4]),o=parseInt(t[6]),n=parseInt(t[10]);return Math.floor(1e3*(e+i-r-s-o)/n)}get matches(){return this.tokens[0]}get misMatches(){return this.tokens[1]}get repMatches(){return this.tokens[2]}get nCount(){return this.tokens[3]}get qNumInsert(){return this.tokens[4]}get qBaseInsert(){return this.tokens[5]}get tNumInsert(){return this.tokens[6]}get tBaseInsert(){return this.tokens[7]}popupData(){return[{name:"chr",value:this.chr},{name:"start",value:this.start+1},{name:"end",value:this.end},{name:"strand",value:this.strand},{name:"score",value:this.score},{name:"match",value:this.matches},{name:"mis-match",value:this.misMatches},{name:"rep. match",value:this.repMatches},{name:"N's",value:this.nCount},{name:"Q gap count",value:this.qNumInsert},{name:"Q gap bases",value:this.qBaseInsert},{name:"T gap count",value:this.tNumInsert},{name:"T gap bases",value:this.tBaseInsert}]}}function Ua(t,e){const i=e.format;if(t.length<9)return;const r="gff3"===i?"=":" ";return new Aa({source:aa(t[1]),type:t[2],chr:t[0],start:parseInt(t[3])-1,end:parseInt(t[4]),score:"."===t[5]?void 0:Number(t[5]),strand:t[6],phase:"."===t[7]?".":parseInt(t[7]),attributeString:t[8],delim:r})}function Va(t,e){const i=Ua(t,e);if(!i)return;const r=ca(i.attributeString,i.delim);for(let[t,e]of r){const r=t.toLowerCase();"color"===r||"colour"===r?i.color=ur.createColorString(e):"ID"===t?i.id=e:"Parent"===t&&(i.parent=e)}return i}function qa(t,e){const i=Ua(t,e);if(!i)return;const r=ca(i.attributeString,i.delim);let s,o;switch(i.type){case"gene":s="gene_id";break;case"transcript":s="transcript_id",o="gene_id";break;default:o="transcript_id"}for(let[t,e]of r){const r=t.toLowerCase();"color"===r||"colour"===r?i.color=ur.createColorString(e):t===s?i.id=e:t===o&&(i.parent=e)}return i}function Qa(t,e){if(t.length<7)return;const i=t[0],r=t[1],s=parseInt(t[2]),o=parseInt(t[3]),n=parseInt(t[4]),a=parseInt(t[5]),c=t[6],l={chr:i,name:r,junction_left:s,junction_right:o,num_junction_reads:n,num_spanning_frags:a,spanning_frag_coords:[],start:-1,end:-1};let h=s,d=o;if(a>0){const t=c.split(",");for(let e=0;e<t.length;e++){const i=t[e].split("-"),r=parseInt(i[0]),s=parseInt(i[1]);r<h&&(h=r),s>d&&(d=s),l.spanning_frag_coords.push({left:r,right:s})}}return l.start=h,l.end=d,l}function Ga(t,e){if(t.length<7)return null;const i={chr:t[0],start:parseInt(t[1])-1,end:parseInt(t[2]),"Strongest SNP-risk allele":t[3],"Disease/Phenotype":t[4],"P-value":t[5],"Odds ratio or beta":t[6]};return t.length>6&&(i.PUBMEDID=`<a target = "blank" href = "https://www.ncbi.nlm.nih.gov/pubmed/${t[7]}">${t[7]}</a>`),i}function Wa(t,e){const i=e.customFormat;if(t.length<i.fields.length)return;const r=i.coords||0,s=t[i.chr],o=parseInt(t[i.start])-r,n={chr:s,start:o,end:void 0!==i.end?parseInt(t[i.end]):o+1};return i.fields&&i.fields.forEach(function(e,r){r!==i.chr&&r!==i.start&&r!==i.end&&(n[e]=t[r])}),n}function ja(t,e){const i=e.columnNames;if(!i)throw Error("Sample names are not defined. Missing column headers?");const r=i.length-3,s=t[0],o=parseInt(t[1]),n=parseInt(t[2]),a=t.slice(3).map(Number);return a.length==r?{chr:s,start:o,end:n,values:a}:void console.warn(`${s}:${o}-${n} row contains ${a.length} sample columns instead of the expected ${r} columns. Skipping...`)}function $a(t,e,i=Number.MAX_SAFE_INTEGER){if(t.length<4)return;const r=t[0],s=parseInt(t[1]),o=parseInt(t[2]);if(isNaN(s)||isNaN(o))return new oa("Unparsable bed record.");const n={chr:r,start:s,end:o},a=[];for(let e=3;e<t.length;e++)a.push(Number.parseFloat(t[e]));return n.values=a,n}const Ka={gwascatalog:{fields:["bin","chr","start","end","name","pubMedID","author","pubDate","journal","title","trait","initSample","replSample","region","genes","riskAllele","riskAlFreq","pValue","pValueDesc","orOrBeta","ci95","platform","cnv"]},wgrna:{fields:["bin","chr","start","end","name","score","strand","thickStart","thickEnd","type"]},cpgislandext:{fields:["bin","chr","start","end","name","length","cpgNum","gcNum","perCpg","perGc","obsExp"]},clinVarMain:{fields:["chr1","start","end","name","score","strand","thickStart","thickEnd","reserved","blockCount","blockSizes","chromStarts","origName","clinSign","reviewStatus","type","geneId","snpId","nsvId","rcvAcc","testedInGtr","phenotypeList","phenotype","origin","assembly","cytogenetic","hgvsCod","hgvsProt","numSubmit","lastEval","guidelines","otherIds"]}};function Za(t,e){if(t.length<6)return void console.log("Skipping line: "+t.join(" "));const i={chr1:t[0],start1:Number.parseInt(t[1]),end1:Number.parseInt(t[2])},r=t[3].split(",")[0].split(":");i.chr2=r[0];const s=r[1].split("-");return i.start2=Number.parseInt(s[0]),i.end2=Number.parseInt(s[1]),r.length>1&&(i.score=Number.parseFloat(r[1])),i.chr=i.chr1,i.chr1===i.chr2?(i.start=Math.min(i.start1,i.start2),i.end=Math.max(i.end1,i.end2)):(i.start=i.start1,i.end=i.end1),t.length>4&&(i.name=t[4]),t.length>5&&(i.color=t[5]),i}class Ya{constructor(t){this.delimiter="\t",this.config=t,this.header={},t.nameField&&(this.header.nameField=t.nameField),this.skipRows=0,t.decode?(this.decode=t.decode,this.delimiter=t.delimiter||"\t"):t.format&&(this.header.format=t.format.toLowerCase(),this.setDecoder(this.header.format))}async parseHeader(t){let e,i,r=this.header;for(;void 0!==(i=await t.nextLine());)if(i.startsWith("track")||i.startsWith("#track")){let t=Xa(i);Object.assign(r,t)}else if(i.startsWith("browser"));else if(i.startsWith("#columns")){let t=Ja(i);Object.assign(r,t)}else if(i.startsWith("##gff-version 3"))r.format="gff3";else if(i.startsWith("#gffTags"))r.gffTags=!0;else{if(i.startsWith("fixedStep")||i.startsWith("variableStep"))break;if(i.startsWith("#")){const t=i.split(this.delimiter||"\t");t.length>1&&(e=t)}else{this.config.decode||this.setDecoder(r.format);const t=i.split(this.delimiter||"\t");try{const i=Object.assign({columnNames:e},r);let s;if(s=this.decode(t,i)){r.firstFeature=s;break}t.length>1&&(e=t)}catch(i){t.length>1&&(e=t)}}}if(e){r.columnNames=e;for(let t=0;t<e.length;t++)"color"===e[t]||"colour"===e[t]?r.colorColumn=t:"thickness"===e[t]&&(r.thicknessColumn=t)}return this.header=r,r}async parseFeatures(t){const e=[],i=this.decode,r=this.header.format,s=this.delimiter||"\t";let o,n=0,a=0;for(;void 0!==(o=await t.nextLine());){if(n++,n<=this.skipRows)continue;if(!o||o.startsWith("track")||o.startsWith("#")||o.startsWith("browser"))continue;if("wig"===r&&o.startsWith("fixedStep")){this.header.wig=tc(o);continue}if("wig"===r&&o.startsWith("variableStep")){this.header.wig=ec(o);continue}const t=o.split(s);if(t.length<1)continue;const c=i(t,this.header);c instanceof oa?(a++,a>0&&console.error(`Error parsing line '${o}': ${c.message}`)):c&&e.push(c)}return i===ea&&function(t){if(0==t.length)return;const e=t[0];if(void 0===e.score&&void 0!==e.name){for(let e of t)if(!jo(e.name)&&"."!==e.name)return;for(let e of t)e.score=Number(e.name),delete e.name}const i=t.filter(t=>t.chr1!==t.chr2);for(let e of i){const i=Object.assign({},e);i.dup=!0,t.push(i),e.chr=e.chr1,e.start=e.start1,e.end=e.end1,i.chr=i.chr2,i.start=i.start2,i.end=i.end2}}(e),"gtf"!==this.config.format&&"gff3"!==this.config.format&&"gff"!==this.config.format||!1===this.config.assembleGFF?e:new _a(this.config).combineFeatures(e)}setDecoder(t){switch(t){case"broadpeak":case"regionpeak":case"peaks":this.decode=Ba,this.delimiter=this.config.delimiter||/\s+/;break;case"narrowpeak":this.decode=Ta,this.delimiter=this.config.delimiter||/\s+/;break;case"bedgraph":this.decode=La,this.delimiter=/\s+/;break;case"wig":this.decode=za,this.delimiter=this.config.delimiter||/\s+/;break;case"gff3":case"gff":this.decode=Va,this.delimiter="\t";break;case"gtf":this.decode=qa,this.delimiter="\t";break;case"fusionjuncspan":this.decode=Qa,this.delimiter=this.config.delimiter||/\s+/;break;case"gtexgwas":this.skipRows=1,this.decode=Ga,this.delimiter="\t";break;case"refflat":this.decode=Ma,this.delimiter=this.config.delimiter||/\s+/;break;case"genepred":this.decode=Ea,this.delimiter=this.config.delimiter||/\s+/;break;case"genepredext":this.decode=Na,this.delimiter=this.config.delimiter||/\s+/;break;case"ensgene":this.decode=Ea,this.header.shift=1,this.delimiter=this.config.delimiter||/\s+/;break;case"refgene":this.decode=Na,this.delimiter=this.config.delimiter||/\s+/,this.header.shift=1;break;case"bed":this.decode=xa,this.delimiter=this.config.delimiter||/\s+/;break;case"gappedpeak":this.decode=ka,this.delimiter=this.config.delimiter||/\s+/;break;case"bedmethyl":this.decode=Ia,this.delimiter=this.config.delimiter||/\s+/;break;case"bedpe":case"hiccups":this.decode=ea,this.delimiter=this.config.delimiter||"\t";break;case"bedpe-domain":this.decode=ia,this.headerLine=!0,this.delimiter=this.config.delimiter||"\t";break;case"bedpe-loop":this.decode=ea,this.delimiter=this.config.delimiter||"\t",this.header={colorColumn:7};break;case"interact":this.decode=sa,this.delimiter=this.config.delimiter||/\s+/;break;case"longrange":this.decode=Za,this.delimiter="\t";break;case"snp":this.decode=Pa,this.delimiter="\t";break;case"rmsk":this.decode=Sa,this.delimiter="\t";break;case"gcnv":this.decode=ja,this.delimiter="\t";break;case"shoebox":this.decode=$a,this.delimiter="\t";break;default:const e=function(t){return Ka&&Ka[t]?function(t){const e={fields:t.fields},i=["chr","start","end"];for(let t=0;t<e.fields.length;t++)for(let r of i)r===e.fields[t]&&(e[r]=t);return e}(Ka[t]):void 0}(t);void 0!==e?(this.decode=Wa,this.header.customFormat=e,this.delimiter=e.delimiter||"\t"):(this.decode=xa,this.delimiter=this.config.delimiter||/\s+/)}}}function Xa(t){const e={},i=t.split(/(?:")([^"]+)(?:")|([^\s"]+)(?=\s+|$)/g);let r;const s=[];for(let t of i)t&&0!==t.trim().length&&(t.endsWith("=")?r=t:r?(s.push(r+t),r=void 0):s.push(t));for(let t of s){if(!t)return e;var o=t.split("=",2);if(2===o.length){const t=o[0].trim(),i=o[1].trim();if(e.hasOwnProperty(t)){let r=e[t];Array.isArray(r)?r.push(i):e[t]=[r,i]}else e[t]=i}}return"interact"==e.type?e.format="interact":"longrange"==e.longrange?e.format="longrange":"gcnv"===e.type&&(e.format="gcnv"),e}function Ja(t){let e={},i=t.split(/\s+/);if(2===i.length){i[1].split(";").forEach(function(t){let i=t.split("=");"color"===i[0]?e.colorColumn=Number.parseInt(i[1])-1:"thickness"===i[0]&&(e.thicknessColumn=Number.parseInt(i[1])-1)})}return e}function tc(t){const e=t.split(/\s+/);return{format:"fixedStep",chrom:e[1].split("=")[1],start:parseInt(e[2].split("=")[1],10)-1,step:parseInt(e[3].split("=")[1],10),span:e.length>4?parseInt(e[4].split("=")[1],10):1,index:0}}function ec(t){const e=t.split(/\s+/);return{format:"variableStep",chrom:e[1].split("=")[1],span:e.length>2?parseInt(e[2].split("=")[1],10):1}}function ic(t,i){const r=e({class:"igv-menu-popup-check-container"}),s=e();r.appendChild(s);const o=l("check",!0===i?"#444":"transparent");s.appendChild(o);const n=e();return n.innerText=t,r.appendChild(n),r}function rc(t,e){e=e||Number.MAX_SAFE_INTEGER;const i=[];t.sort(function(t,e){return t.start-e.start}),i.push(-1e3);for(let r of t){let t=0;const s=Math.min(i.length,e);for(t=0;t<s;t++)if(r.start>=i[t]){r.row=t,i[t]=r.end;break}r.row=t,i[t]=r.end}}async function sc(t,e,i,r){const s=new Map,o=new Map,n=t=>{var i,r,o,n;const a=Object.assign({},t);if(a.chr="all",t.chr2&&t.end2){const o=s.get(t.chr1)||t.chr1,n=s.get(t.chr2)||t.chr2;a.start=null!==(i=e.getGenomeCoordinate(o,t.start1))&&void 0!==i?i:0,a.end=null!==(r=e.getGenomeCoordinate(n,t.end2))&&void 0!==r?r:0}else{const i=s.get(t.chr)||t.chr;a.start=null!==(o=e.getGenomeCoordinate(i,t.start))&&void 0!==o?o:0,a.end=null!==(n=e.getGenomeCoordinate(i,t.end))&&void 0!==n?n:0}return a._f=t,a.exons&&delete a.exons,a},a=new Set(e.wgChromosomeNames);if(i)for(let t of e.wgChromosomeNames){const e=await i.getAliasName(t);s.set(t,e),o.set(e,t)}const c=[];let l=0;for(let i of e.wgChromosomeNames){if(Array.isArray(t)){const i={};for(let r of t){const t=e.getChromosomeName(r.chr);i.hasOwnProperty(t)||(i[t]=[]),i[t].push(r)}t=i}const h=t[s.get(i)||i];if(h){const t=r||1e4;for(let e of h){if(e.dup)continue;const i=o.get(e.chr)||e.chr,r=e.chr2?o.get(e.chr2)||e.chr2:i;if(a.has(i)&&a.has(r))if(c.length<t)c.push(n(e));else{const i=t/(l+1);if(Math.random()<i){c[Math.floor(Math.random()*(t-1))]=n(e)}}l++}}}return c.sort(function(t,e){return t.start-e.start}),c}function oc(t,e,i){if(e=e||1e3,null==t||0===t.length)return;const r={},s=[];for(let e of t)if(i&&!i(e))e.row=void 0;else{const t=e.chr;let i=r[t];i||(i=[],r[t]=i,s.push(t)),i.push(e)}for(let t of s)rc(r[t],e)}function nc(t){return t instanceof File}function ac(t){return"string"==typeof t&&(t.includes("googleapis.com/drive")||t.includes("drive.google.com"))}const cc=t=>"string"==typeof t&&t.indexOf(",")>0&&!t.startsWith("rgb(")&&!t.startsWith("rgba(")?`rgb(${t})`:t;class lc{constructor(t,e){this.browser=e,this.init(t)}init(t){this.config=t,t.displayMode&&(t.displayMode=t.displayMode.toUpperCase());const e=Object.assign({},lc.defaults),i=this.constructor.defaults;if(i)for(let t of Object.keys(i))e[t]=i[t];for(let i of Object.keys(e))this[i]=t.hasOwnProperty(i)?t[i]:e[i],"color"!==i&&"altColor"!==i||!this[i]||(this[i]=cc(this[i]));t.name||t.label?this.name=t.name||t.label:x(t.url)?this.name=t.url.name:"string"!=typeof t.url||t.url.startsWith("data:")||(this.name=_(t.url)),this.url=t.url,this.config.type&&(this.type=this.config.type),this.id=void 0===this.config.id?this.name:this.config.id,this.order=t.order,this.autoscaleGroup=t.autoscaleGroup,this.removable=void 0===t.removable||t.removable,this.minHeight=t.minHeight||Math.min(25,this.height),this.maxHeight=t.maxHeight||Math.max(1e3,this.height),t.onclick&&(this.onclick=t.onclick,t.onclick=void 0),t.description&&("function"==typeof t.description?this.description=t.description:this.description=()=>t.description)}async postInit(){return this._initialColor=this.color||this.constructor.defaultColor,this._initialAltColor=this.altColor||this.constructor.defaultColor,this}get name(){return this._name}set name(t){this._name=t,this.trackView&&this.trackView.setTrackLabelName(t)}clearCachedFeatures(){this.trackView&&this.trackView.clearCachedFeatures()}updateViews(){this.trackView&&this.trackView.updateViews()}repaintViews(){this.trackView&&this.trackView.repaintViews()}getState(){const t={},e=Object.keys(this.config).filter(t=>{return!(void 0===(e=this.config[t])||"function"==typeof e||e instanceof Promise);var e});for(const i of e)i.startsWith("_")||(t[i]=this.config[i]);for(let e of Object.keys(t)){if(e.startsWith("_"))continue;const i=this[e];void 0===i||!qo(i)&&"boolean"!=typeof i&&"metadata"!==e||(t[e]=i)}const i=Object.assign({},lc.defaults),r=this.constructor.defaults;if(r)for(let t of Object.keys(r))i[t]=r[t];for(let e of Object.keys(i))void 0!==this[e]&&i[e]!==this[e]&&(t[e]=this[e]);return!this.autoscale&&this.dataRange&&(t.min=this.dataRange.min,t.max=this.dataRange.max),this.autoscaleGroup&&(t.autoscaleGroup=this.autoscaleGroup),t}get supportsWholeGenome(){return!0===this.config.supportsWholeGenome}hasSamples(){return!1}getGenomeId(){return this.browser.genome?this.browser.genome.id:void 0}setTrackProperties(t){if(this.disposed)return;const e={};let i;for(let r of Object.keys(t))switch(r.toLowerCase()){case"usescore":e.useScore="1"===t[r]||"on"===t[r];break;case"visibility":switch(t[r]){case"2":case"3":case"pack":case"full":e.displayMode="EXPANDED";break;case"4":case"squish":e.displayMode="SQUISHED";break;case"1":case"dense":e.displayMode="COLLAPSED"}break;case"color":case"altcolor":e[r]=t[r].startsWith("rgb(")?t[r]:"rgb("+t[r]+")";break;case"featurevisiblitywindow":case"visibilitywindow":e.visibilityWindow=Number.parseInt(t[r]);break;case"maxheightpixels":i=t[r].split(":"),3===i.length&&(e.minHeight=Number.parseInt(i[2]),e.height=Number.parseInt(i[1]),e.maxHeight=Number.parseInt(i[0]));break;case"viewlimits":if(!this.config.autoscale&&!this.config.max){i=t[r].split(":");let s,o=0;1==i.length?s=Number(i[0]):2==i.length&&(o=Number(i[0]),s=Number(i[1])),Number.isNaN(s)||Number.isNaN(o)?console.warn(`Unexpected viewLimits value in track line: ${t.viewLimits}`):(e.autoscale=!1,e.dataRange={min:o,max:s},this.viewLimitMin=o,this.viewLimitMax=s)}case"name":e[r]=t[r];break;case"url":e.infoURL=t[r];break;case"type":const s=t[r];hc.has(s)?e[r]=hc.get(s):e[r]=s;break;case"graphtype":e.graphType=t[r];break;default:e[r]=t[r]}for(let t of Object.keys(e))if(!this.config.hasOwnProperty(t)||"name"===t&&this.config._derivedName){let i=e[t];if("true"===i&&(i=!0),"false"===i&&(i=!1),this[t]=i,"height"===t&&this.trackView)try{const t=Number.parseInt(i);this.trackView.setTrackHeight(t)}catch(t){console.error(t)}}}clickedFeatures(t){const e=t.viewport.cachedFeatures;if(!e||!Array.isArray(e)||0===e.length)return[];const i=t.genomicLocation,r=t.referenceFrame.bpPerPixel>.2?3*t.referenceFrame.bpPerPixel:.2;return Pr(e,i-r,i+r)}extractPopupData(t,e){const i=new Set(["row","color","chr","start","end","cdStart","cdEnd","strand","alpha"]),r=[];let s,o;for(let e in t)if(t.hasOwnProperty(e)&&!i.has(e)&&qo(t[e])){let i=t[e];r.push({name:C(e),value:i}),"alleles"===e?s=t[e]:"alleleFreqs"===e&&(o=t[e])}if(s&&o){s.endsWith(",")&&(s=s.substr(0,s.length-1)),o.endsWith(",")&&(o=o.substr(0,o.length-1));let i=s.split(","),n=o.split(",");if(n.length>1){let s=[];for(let t=0;t<n.length;t++)s.push({a:i[t],af:Number(n[t])});s.sort(function(t,e){return t.af-e.af});let o=s[s.length-1].a;if(1===o.length)for(let i=s.length-2;i>=0;i--){let n=s[i].a;if(1===n.length){e||(e=this.getGenomeId());const i=lc.getCravatLink(t.chr,t.start+1,o,n,e);console.log(i),i&&(r.push("<hr/>"),r.push({html:i}),r.push("<hr/>"))}}}}if(t.attributes)for(let e of Object.keys(t.attributes))r.push({name:e,value:t.attributes[e]});let n=`${t.chr}:${F(t.start+1)}-${F(t.end)}`;return t.strand&&(n+=` (${t.strand})`),r.push({name:"Location",value:n}),r}description(){var t;const e=(t,e)=>{const i=document.createElement("div");i.className="igv-track-label-popover__row";const r=document.createElement("span");r.className="igv-track-label-popover__key",r.textContent=t+":";const s=document.createElement("span");return s.className="igv-track-label-popover__value",s.textContent=e,i.appendChild(r),i.appendChild(s),i},i=document.createDocumentFragment();if(!this.url){const e=document.createElement("div");return e.className="igv-track-label-popover__row",e.textContent=null!==(t=this.name)&&void 0!==t?t:null,i.appendChild(e),i}if(x(this.url)?i.appendChild(e("Filename",this.url.name)):i.appendChild(e("URL",this.url)),this.config){if(this.config.metadata)for(let t of Object.keys(this.config.metadata)){const r=this.config.metadata[t];i.appendChild(e(t,r))}for(let t of Object.keys(this.config)){if(t.startsWith("_"))continue;let r=t.substr(0,1);if(r!==r.toLowerCase()){const r=this.config[t];r&&qo(r)&&i.appendChild(e(t,r))}}}return i}getColorForFeature(t){return"function"==typeof this.color?this.color(t):this.color}numericDataMenuItems(){const t=[];if("heatmap"!==this.graphType){function e(t){this.trackView.track.selected?this.browser.dataRangeDialog.configure(this.trackView.browser.getSelectedTrackViews()):this.browser.dataRangeDialog.configure(this.trackView),this.browser.dataRangeDialog.present(t)}if(t.push("<hr/>"),t.push({label:"Set data range",dialog:e}),void 0!==this.logScale){function r(){this.logScale=!this.logScale,this.trackView.repaintViews()}t.push({element:ic("Log scale",this.logScale),click:r})}function i(){this.autoscaleGroup=void 0,this.autoscale=!this.autoscale,this.browser.updateViews()}t.push({element:ic("Autoscale",this.autoscale),click:i})}return t}setDataRange({min:t,max:e}){this.dataRange={min:t,max:e},this.autoscale=!1,this.autoscaleGroup=void 0,this.trackView.repaintViews()}async nextFeatureAfter(t,e,i){let r=this.trackView.viewports[0].cachedFeatures;if(r&&Array.isArray(r)&&r.length>0){if(this.browser.genome.getChromosomeName(r[0].chr)===t){const t=function(t,e,i=!0){const r=t=>(t.start+t.end)/2,s=i?(t,e)=>t.start-e.start+t.end-e.end:(t,e)=>e.start-t.start+e.end-t.end,o=Array.from(t);o.sort(s);let n=0,a=o.length;for(;n<a;){let t=Math.floor((n+a)/2);i?r(o[t])<=e?n=t+1:a=t:r(o[t])>=e?n=t+1:a=t}return o[n]}(r,e,i);if(t)return t}}const s=this.featureSource;if(s&&"function"==typeof s.nextFeature)return s.nextFeature(t,e,i,this.visibilityWindow)}dispose(){this.disposed=!0;for(let t of Object.keys(this))this[t]=void 0}static getCravatLink(t,e,i,r,s){if("hg38"===s||"GRCh38"===s){return`<a target="_blank" href="https://run.opencravat.org/result/nocache/variant.html?chrom=${t.startsWith("chr")?t:"chr"+t}&pos=${e}&ref_base=${i}&alt_base=${r}"><b>Cravat ${i}->${r}</b></a>`}}static prepareConfigForSession(t){const e=Object.assign({},t),i={url:"file",indexURL:"indexFile"};for(const t of["url","indexURL"])e[t]&&nc(e[t])&&(e[i[t]]=e[t].name,delete e[t]);return e}set filter(t){this._filter=t,this.trackView.repaintViews()}getInViewFeatures(){const t=[];for(let e of this.trackView.viewports)if(e.isVisible()){const i=e.referenceFrame;i.chr;const r=i.start,s=r+i.toBP(e.getWidth());if(e.cachedFeatures){const i=Pr(e.cachedFeatures,r,s);for(let e of i)this._filter&&!this._filter(e)||t.push(e)}}return t}getFilterableAttributes(){return{}}}lc.defaultColor="rgb(150,150,150)",lc.defaults={height:50,autoHeight:!1,visibilityWindow:void 0,color:void 0,altColor:void 0,supportHiDPI:!0,selected:!1};const hc=new Map([["wiggle_0","wig"],["bed","bed"],["bigBed","bigBed"],["bigWig","bigWig"]]);class dc{constructor(t){switch(this.type=t||"seg",this.type){case"mut":this.sampleColumn=3,this.chrColumn=0,this.startColumn=1,this.endColumn=2,this.dataColumn=4;break;case"maf":this.sampleColumn=15,this.chrColumn=4,this.startColumn=5,this.endColumn=6,this.dataColumn=8;break;default:this.sampleColumn=0,this.chrColumn=1,this.startColumn=2,this.endColumn=3}}async parseHeader(t){let e;for(;void 0!==(e=await t.nextLine());)if(!e.startsWith("#")){const t=e.split("\t");this.header={headings:t};break}return this.header}async parseFeatures(t){const e=[];let i;this.header||(this.header=await this.parseHeader(t)),"seg"===this.type&&(this.dataColumn=this.header.headings.length-1),this.header.headings.length>5&&(i=this.extractExtraColumns(this.header.headings));const r=this.header.headings[this.dataColumn];let s;for(;void 0!==(s=await t.nextLine());){const t=s.split("\t"),o="seg"===this.type?Number(t[this.dataColumn]):t[this.dataColumn];if(t.length>this.dataColumn){const s=new uc({sample:t[this.sampleColumn],chr:t[this.chrColumn],start:parseInt(t[this.startColumn])-1,end:parseInt(t[this.endColumn]),value:o,valueColumnName:r});if(i){const e=this.extractExtraColumns(t);s.setAttributes({names:i,values:e})}e.push(s)}}return e}extractExtraColumns(t){const e=[];for(let i=0;i<t.length;i++)i!==this.chrColumn&&i!==this.startColumn&&i!==this.endColumn&&i!==this.sampleColumn&&e.push(t[i]);return e}}class uc{constructor({sample:t,chr:e,start:i,end:r,value:s,valueColumnName:o}){this.sample=t,this.chr=e,this.start=i,this.end=r,this.value=s,this.valueColumnName=o}setAttributes({names:t,values:e}){this.attributeNames=t,this.attributeValues=e}getAttributeValue(t){if(this.attributeNames){const e=this.attributeNames.indexOf(t);if(e>=0)return this.attributeValues[e]}}popupData(t,e){const i=new Set(["chr","start","end","sample","value","row","color","sampleKey","uniqueSampleKey","sampleId","chromosome","uniquePatientKey"]),r=this.chr+":"+F(this.start+1)+"-"+F(this.end),s=[{name:"Sample",value:this.sample},{name:"Location",value:r},{name:this.valueColumnName?C(this.valueColumnName):"Value",value:this.value}];if("mut"===t&&"hg38"===e){const t=this.extractCravatLink(e);t&&(s.push("<hr/>"),s.push({html:t}),s.push("<hr/>"))}if(this.attributeNames&&this.attributeNames.length>0)for(let t=0;t<this.attributeNames.length;t++)i.has(this.attributeNames[t])||this.valueColumnName===this.attributeNames[t]||s.push({name:C(this.attributeNames[t]),value:this.attributeValues[t]});return s}extractCravatLink(t){let e,i;if(this.attributeNames&&this.attributeNames.length>0)for(let r=0;r<this.attributeNames.length;r++)if(e||"Reference_Allele"!==this.attributeNames[r]||(e=this.attributeValues[r]),!i&&this.attributeNames[r].startsWith("Tumor_Seq_Allele")&&this.attributeValues[r]!==e&&(i=this.attributeValues[r]),e&&i)return lc.getCravatLink(this.chr,this.start+1,e,i,t)}}const fc=new Map([["REF","referenceBases"],["ALT","alternateBases"],["QUAL","quality"],["FILTER","filter"]]);class pc{constructor(t){this.chr=t[0],this.pos=parseInt(t[1]),this.names=t[2],this.referenceBases=t[3],this.alternateBases=t[4],this.quality=t[5],this.filter=t[6],this.info={};const e=t[7];if(e&&"."!==e)for(let t of e.split(";")){var i=t.split("=");this.info[i[0]]=i[1]}this.init()}getAttributeValue(t){return fc.has(t)&&(t=fc.get(t)),this.hasOwnProperty(t)?this[t]:this.info[t]}init(){const t=this.referenceBases,e=this.alternateBases;if(this.info&&(this.info.VT?this.type=this.info.VT:this.info.SVTYPE?this.type="SV":this.info.PERIOD&&(this.type="STR")),void 0===this.type&&(this.type=function(t,e){const i=t.length;if(void 0===e)return"UNKNOWN";if(0===e.trim().length||"<NON_REF>"===e||"<*>"===e||"."===e)return"NONVARIANT";{const t=e.split(",").map(function(t){return 1===i&&1===t.length?"SNP":"<NON_REF>"===t?"NONVARIANT":t.length>i&&bc(t)?"INSERTION":t.length<i&&bc(t)?"DELETION":"OTHER"});let r=t[0];for(let e of t)if(e!==r)return"MIXED";return r}}(t,e)),this.info.END)this.start=this.pos-1,this.info.CHR2&&this.info.CHR2!==this.chr?this.end=this.start+1:this.end=Number.parseInt(this.info.END);else if("NONVARIANT"===this.type)this.start=this.pos-1,this.end=this.start+t.length;else{const i=e.split(",").filter(t=>t.length>0);this.alleles=[],this.start=void 0,this.end=void 0;for(let e of i)if(this.alleles.push(e),"SV"!==this.type&&bc(e)){let i=e.length,r=t.length;const s=Math.min(i,r);let o=0;for(;o<s&&t.charCodeAt(o)===e.charCodeAt(o);)o++,i--,r--;for(;i>0&&r>0;){const s=o+i-1,n=o+r-1;if(e.charCodeAt(s)!==t.charCodeAt(n))break;i--,r--}for(;i>0&&r>0;){const s=o,n=o;if(e.charCodeAt(s)!==t.charCodeAt(n))break;o++,i--,r--}const n=this.pos+o-1,a=n+r;this.start=void 0===this.start?n:Math.min(this.start,n),this.end=void 0===this.end?a:Math.max(this.end,a)}void 0===this.start&&(this.start=this.pos-1,this.end=this.pos),this.start===this.end&&(this.start-=.5,this.end+=.5)}}popupData(t,e){const i=`${F(this.pos)}`,r=this.start===this.end?`${F(this.start)} | ${F(this.start+1)}`:`${F(this.start+1)}-${F(this.end)}`,s=[{name:"Chr",value:this.chr},{name:"Pos",value:i},{name:"Loc",value:r},{name:"ID",value:this.names?this.names:""},{name:"Ref",value:this.referenceBases},{name:"Alt",value:this.alternateBases.replace("<","<")},{name:"Qual",value:this.quality},{name:"Filter",value:this.filter}];if(this.type&&s.push({name:"Type",value:this.type}),"SNP"===this.type){let t=this.referenceBases;if(1===t.length){let i=this.alternateBases.split(",");for(let r of i)if(1===r.length){let i=lc.getCravatLink(this.chr,this.pos,t,r,e);i&&(s.push("<hr/>"),s.push({html:i}))}}}const o=Object.keys(this.info);if(this.info&&o.length>0){s.push({html:'<hr style="border-top: dotted 1px;border-color: #c9c3ba" />'});for(let t of o)s.push({name:t,value:Fc(decodeURIComponent(this.info[t]))})}return s}getInfo(t){return this.info?this.info[t]:void 0}isRefBlock(){return"NONVARIANT"===this.type}isFiltered(){return!("."===this.filter||"PASS"===this.filter)}alleleFreq(){return this.info?this.info.AF:void 0}}class gc{constructor(t){this.mate=t,this.chr=t.info.CHR2,this.pos=Number.parseInt(t.info.END),this.start=this.pos-1,this.end=this.pos}get info(){return this.mate.info}get names(){return this.mate.names}get referenceBases(){return this.mate.referenceBases}get alternateBases(){return this.mate.alternateBases}get quality(){return this.mate.quality}get filter(){return this.mate.filter}get calls(){return this.mate.calls}getAttributeValue(t){return this.mate.getAttributeValue(t)}getInfo(t){return this.mate.getInfo(t)}isFiltered(){return this.mate.isFiltered()}alleleFreq(){return this.mate.alleleFreq()}popupData(t,e){const i=[];return i.push("SV Breakpoint"),i.push({name:"Chr",value:this.chr}),i.push({name:"Pos",value:`${F(this.pos)}`}),i.push({html:'<hr style="border-top: dotted 1px;border-color: #c9c3ba" />'}),i.push("SV"),i.push(...this.mate.popupData(t,e)),i}}class mc{constructor({formatFields:t,sample:e,token:i}){this.info={},this.sample=e;const r=i.split(":");for(let e=0;e<r.length;e++){const i=r[e];if(e==t.genotypeIndex){this.genotype=[];for(let t of i.split(/[\|\/]/))this.genotype.push("."===t?t:parseInt(t))}else this.info[t.fields[e]]=i}}get zygosity(){if(!this._zygosity)if(this.genotype){let t=!0,e=!0,i=!1;for(let r of this.genotype){if("."===r){i=!0;break}0!==r&&(e=!1),0===r&&(t=!1)}this._zygosity=i?"nocall":e?"homref":t?"homvar":"hetvar"}else this._zygosity="unknown";return this._zygosity}zygosityScore(){switch(this.zygosity){case"homvar":return 4;case"hetvar":return 3;case"homref":return 2;case"nocall":return 1;default:return 0}}zygosityLabel(){switch(this.zygosity){case"homref":return"Homozygous reference";case"homvar":return"Homozygous variant";case"hetvar":return"Heterozygous";default:return""}}popupData(t,e){const i=[];void 0!==this.sample&&i.push({name:"Sample",value:this.sample}),this.genotypeString&&i.push({name:"Genotype",value:this.genotypeString});const r=this.zygosityLabel();r&&i.push({name:"Zygosity",value:r});var s=Object.keys(this.info);s.length&&i.push("<hr/>");for(let t of s)i.push({name:t,value:decodeURIComponent(this.info[t])});return i}}const wc=new Set(["A","C","T","G"].map(t=>t.charCodeAt(0)));function bc(t){for(let e=0;e<t.length;e++)if(!wc.has(t.charCodeAt(e)))return!1;return!0}function Fc(t,e){return void 0===e&&(e=","),Array.isArray(t)?t.join(e):t}class vc{construtor(){}async parseHeader(t,e){const i={sequenceNames:[]};let r=await t.nextLine();if(!r.startsWith("##fileformat"))throw new Error("Invalid VCF file: missing fileformat line");for(i.version=r.substr(13);void 0!==(r=await t.nextLine())&&r.startsWith("#");){let t;const o={};if(r.startsWith("##")){if(r.startsWith("##INFO")||r.startsWith("##FILTER")||r.startsWith("##FORMAT")){const e=r.indexOf("<"),n=r.lastIndexOf(">");if(!(e>2&&n>0)){console.log("Malformed VCF header line: "+r);continue}const a=r.substring(2,e-1);i[a]||(i[a]={});const c=y(r.substring(e+1,n-1),",");for(let e of c){var s=e.split("=");s.length>1&&("ID"===s[0]?t=s[1]:o[s[0]]=s[1])}t&&(i[a][t]=o)}else if(r.startsWith("##contig")&&e){const t=r.indexOf("<ID=");let e=r.indexOf(",",t);-1==e&&(e=r.indexOf(">",t));const s=r.substring(t+4,e);i.sequenceNames.push(s)}}else if(r.startsWith("#CHROM")){const t=r.split("\t");if(t.length>8){i.sampleNameMap=new Map;for(let e=9;e<t.length;e++)i.sampleNameMap.set(t[e],e-9)}}}return this.header=i,i}async parseFeatures(t){var e;const i=[],r=(null===(e=this.header)||void 0===e?void 0:e.sampleNameMap)?Array.from(this.header.sampleNameMap.keys()):void 0,s=8+(r?r.length+1:0);let o;for(;void 0!==(o=await t.nextLine());)if(o&&!o.startsWith("#")){const t=o.trim().split("\t");if(t.length===s){const e=new pc(t);if(e.header=this.header,i.push(e),t.length>9){const s=yc(t[8].split(":"));e.calls=[];for(let i=9;i<t.length;i++){const o=r[i-9],n=t[i],a=new mc({formatFields:s,sample:o,token:n});e.calls.push(a)}e.info&&e.info.CHR2&&e.info.END&&i.push(Ac(e))}}}return i}}function yc(t){const e={genotypeIndex:-1,fields:t};for(let i=0;i<t.length;i++)"GT"===t[i]&&(e.genotypeIndex=i);return e}function Ac(t){return new gc(t)}const Cc=Math.log10(Number.MIN_VALUE);class _c{constructor(t){if(this.columns=[],this.config=t,t.columns){if(void 0===t.columns.chromosome||void 0===t.columns.position||void 0===t.columns.value)throw Error("columns property must define chrCol, posCol, and valueCol");this.posCol=t.columns.position-1,this.chrCol=t.columns.chromosome-1,this.valueCol=t.columns.value-1}else this.posCol=2,this.chrCol=1,this.valueCol=3}async parseHeader(t){const e=await t.nextLine();return this.parseHeaderLine(e)}parseHeaderLine(t){if(this.columns=t.split(/\t/),!this.config.columns)for(let t=0;t<this.columns.length;t++){switch(this.columns[t].toLowerCase()){case"chr":case"chromosome":case"chr_id":this.chrCol=t;break;case"bp":case"pos":case"position":case"chr_pos":this.posCol=t;break;case"p":case"pval":case"pvalue":case"p-value":case"p.value":this.valueCol=t}}return this.columns}async parseFeatures(t){const e=[],i=t.nextLine();let r;this.columns||this.parseHeaderLine(i);const s=t=>{const e=t.indexOf("E");if(e>0){if(Number.parseInt(t.substring(e+1))<Cc)return Number.MIN_VALUE}return Number(t)};for(;void 0!==(r=t.nextLine());){const t=r.split(/\t/);if(t.length===this.columns.length){const i=t[this.posCol];if(i.indexOf(";")>0||0==i.length||i.indexOf("x")>0)continue;const o=t[this.chrCol],n=s(t[this.valueCol]),a=parseInt(i)-1,c=a+1;e.push(new xc({chr:o,start:a,end:c,value:n,line:r,columns:this.columns}))}}return e}static isGWAS(t){const e=t.split("\t");if(e.length<5)return!1;const i=[["chr","chromosome","chr_id","chrom"],["bp","pos","position","chr_pos","chromEnd"],["p","pval","p-value","p.value"]];for(let t of i)if(!e.some(e=>t.includes(e.toLowerCase())))return!1;return!0}}class xc{constructor({chr:t,start:e,end:i,value:r,line:s,columns:o}){this.chr=t,this.start=e,this.end=i,this.value=r,this.line=s,this.columns=o}popupData(){const t=this.line.split(/\t/);return this.columns.map(function(e,i){return{name:e,value:t[i]}})}getAttributeValue(t){const e=this.line.split(/\t/);for(let i=0;i<this.columns.length;i++)if(this.columns[i]===t)return e[i]}}var kc=new RegExp("([^:]*)\\(([^)]*)\\)"),Ic=new RegExp("([^:]*):([^(]*)\\(([^)]*)\\)");class Sc{constructor(t){const e=t?t.decode:void 0;this.nameField=t?t.nameField:void 0,this.skipRows=0,this.decode=e||Bc,this.delimiter="\t"}async parseHeader(t){let e,i;for(;(e=await t.nextLine())&&(e.startsWith("track")||e.startsWith("#")||e.startsWith("browser"));)if(e.startsWith("track")||e.startsWith("#track")){let t=Mc(e);i?Object.assign(i,t):i=t}else if(e.startsWith("#columns")){let t=Rc(e);i?Object.assign(i,t):i=t}else e.startsWith("##gff-version 3")&&(this.format="gff3",i||(i={}),i.format="gff3");return this.header=i,i}async parseFeatures(t){const e=[],i=this.decode,r=this.delimiter||"\t";let s,o=0;for(;void 0!==(s=t.nextLine());){if(o++,o<=this.skipRows||s.startsWith("track")||s.startsWith("#")||s.startsWith("browser"))continue;let t=n();if(t.length<1)continue;if(!this.aed){this.aed=Nc(t);continue}const r=i.call(this,t,undefined);r&&e.push(r)}return e;function n(){for(var t,e,i=[],o="",n=!1;s||""===s;){for(t=0;t<s.length;t++)(e=s.charAt(t))===r?n?o+=e:(i.push(o),o=""):'"'===e?t+1<s.length&&'"'===s.charAt(t+1)?(n&&(o+='"'),t++):n=!n:o+=e;if(!n)break;o+="\n",s=void 0}return i.push(o),i}}}function Ec(t){var e=Ic.exec(t);if(e)return{namespace:e[1],name:e[2],type:e[3]};if(e=kc.exec(t))return{namespace:"?",name:e[1],type:e[2]};throw new Error("Error parsing the header row of AED file - column not in ns:name(ns:type) format")}function Nc(t){var e,i,r;for(e={columns:[],metadata:{}},i=0;i<t.length;i++)r=Ec(t[i]),e.columns.push(r);return e}function Mc(t){const e={},i=t.split(/(?:")([^"]+)(?:")|([^\s"]+)(?=\s+|$)/g);let r;const s=[];for(let t of i)t&&0!==t.trim().length&&(t.endsWith("=")?r=t:r?(s.push(r+t),r=void 0):s.push(t));for(let t of s){if(!t)return e;var o=t.split("=",2);if(2===o.length){const t=o[0].trim(),i=o[1].trim();e[t]=i}}return e}function Rc(t){let e={},i=t.split(/\s+/);if(2===i.length){i[1].split(";").forEach(function(t){let i=t.split("=");"color"===i[0]?e.colorColumn=Number.parseInt(i[1])-1:"thickness"===i[0]&&(e.thicknessColumn=Number.parseInt(i[1])-1)})}return e}function Dc(t,e){var i,r,s=t.columns;this.aed=t,this.allColumns=e,this.chr=null,this.start=null,this.end=null,this.score=1e3,this.strand=".",this.cdStart=null,this.cdEnd=null,this.name=null,this.color=null;for(let t=0;t<e.length;t++)if(i=e[t]){"aed:Integer"===(r=s[t]).type&&(i=parseInt(i));var o=[];if(r.namespace.length>0)for(let t=0;t<r.namespace.length;t++)o.push(r.namespace.charCodeAt(t));"bio"===r.namespace.trim()?"sequence"===r.name?this.chr=i:"start"===r.name?this.start=i:"end"===r.name?this.end=i:"cdsMin"===r.name?this.cdStart=i:"cdsMax"===r.name?this.cdEnd=i:"strand"===r.name&&(this.strand=i):"aed"===r.namespace?"name"===r.name&&(this.name=i):"style"===r.namespace&&"color"===r.name&&(this.color=ur.createColorString(i))}}function Bc(t,e){var i,r,s,o,n,a,c=0,l=this.aed.columns;if(t.length===l.length){for(a=0;a<t.length;a++)o=l[a],""!==(s=t[a])&&c++,"name"===o.name&&"aed"===o.namespace?i=s:"value"===o.name&&"aed"===o.namespace&&(r=s);if(2===c&&i&&r)return n=Ec(i),this.aed.metadata[n.namespace]||(this.aed.metadata[n.namespace]={}),void(this.aed.metadata[n.namespace][n.name]||(this.aed.metadata[n.namespace][n.name]={type:n.type,value:r}));var h=new Dc(this.aed,t);if(h.chr&&(h.start||0===h.start)&&h.end)return h;console.log("Cannot parse feature: "+t.join(","))}else console.log("Corrupted AED file row: "+t.join(","))}function Tc(t,e){if(0===t.length)return t;if(t.sort(function(t,e){const i=t.minv.block-e.minv.block;return 0!==i?i:t.minv.offset-e.minv.offset}),t.length<=1)return t;e&&(t=t.filter(t=>t.maxv.isGreaterThan(e)));const i=[];let r;for(let e of t)r&&Lc(r,e)?e.maxv.isGreaterThan(r.maxv)&&(r.maxv=e.maxv):(i.push(e),r=e);return i}function Lc(t,e){const i=e.minv.block-t.maxv.block;return e.maxv.block-t.minv.block<5e6&&i<65e3}Dc.prototype.popupData=function(){for(var t=[],e=this.aed,i=0;i<this.allColumns.length;i++){var r=this.allColumns[i],s=e.columns[i].name;"sequence"!==s&&"color"!==s&&r&&t.push({name:s,value:r})}return t};class zc{constructor(){this.tabix=!0}parse(t){const e=new _n(new DataView(t)),i=e.getInt();if(21582659!==i)throw 38359875===i?Error("CSI version 2 is not supported. Please enter an issue at https://github.com/igvteam/igv.js"):Error("Not a CSI index");this.indices=[],this.blockMin=Number.MAX_SAFE_INTEGER,this.sequenceIndexMap={},this.minShift=e.getInt(),this.depth=e.getInt();const r=[];let s=0;if(e.getInt()>=28){e.getInt(),e.getInt(),e.getInt(),e.getInt(),e.getInt(),e.getInt();const t=e.getInt(),i=e.position+t;let s=0;for(;e.position<i;){let t=e.getString();this.sequenceIndexMap[t]=s,r[s]=t,s++}}const o=this.bin_limit()+1,n=e.getInt();for(let t=0;t<n;t++){const i={},r=[],n=e.getInt();for(let t=0;t<n;t++){const t=e.getInt();if(r[t]=e.getVPointer(),t>o)e.getInt(),e.getVPointer(),e.getVPointer(),e.getLong(),e.getLong();else{i[t]=[];const r=e.getInt();for(let o=0;o<r;o++){const r=e.getVPointer(),o=e.getVPointer();r&&o&&(r.block<this.blockMin&&(this.blockMin=r.block),o.block>s&&(s=o.block),i[t].push([r,o]))}}}n>0&&(this.indices[t]={binIndex:i,loffset:r})}this.lastBlockPosition=s}get sequenceNames(){return Object.keys(this.sequenceIndexMap)}chunksForRange(t,e,i){const r=this.indices[t];if(r){const t=this.reg2bins(e,i);if(0==t.length)return[];const s=[];for(let e of t)for(let t=e[0];t<=e[1];t++)if(r.binIndex[t]){const e=r.binIndex[t];for(let t of e){const e=t[0],i=t[1];s.push({minv:e,maxv:i})}}let o=t[this.depth][0];do{if(r.binIndex[o])break;o>1+(this.getParentBin(o)<<3)?o--:o=this.getParentBin(o)}while(0!=o);const n=r.loffset[o];return Tc(s,null!=n?n:void 0)}return[]}getParentBin(t){return 0==t?0:t-1>>3}reg2bins(t,e){(t-=1)<1&&(t=1),e>2**34&&(e=2**34),e-=1;let i=0,r=0,s=this.minShift+3*this.depth;const o=[];for(;i<=this.depth;s-=3,r+=1<<3*i,i+=1){const i=r+(t>>s),n=r+(e>>s);o.push([i,n])}return o}bin_limit(){return((1<<3*(this.depth+1))-1)/7}}class Pc{constructor(){}async parse(t,e){const i=[];let r=Number.MAX_SAFE_INTEGER,s=0;const o=new _n(new DataView(t)),n=o.getInt(),a={};if(!(21578050===n||e&&21578324===n))throw new Error("Not a valid "+(e?"tabix":"bai")+" file");{const t=o.getInt();if(e){o.getInt(),o.getInt(),o.getInt(),o.getInt(),o.getInt(),o.getInt(),o.getInt();for(let e=0;e<t;e++){a[o.getString()]=e}}for(let e=0;e<t;e++){const t={},n=[],a=o.getInt();for(let e=0;e<a;e++){const e=o.getInt();if(37450===e)o.getInt(),o.getVPointer(),o.getVPointer(),o.getLong(),o.getLong();else{t[e]=[];const i=o.getInt();for(let n=0;n<i;n++){const i=o.getVPointer(),n=o.getVPointer();i&&n&&(i.block<r&&(r=i.block),n.block>s&&(s=n.block),t[e].push([i,n]))}}}const c=o.getInt();for(let t=0;t<c;t++){const t=o.getVPointer();n.push(t)}a>0&&(i[e]={binIndex:t,linearIndex:n})}this.firstBlockPosition=r,this.lastBlockPosition=s,this.indices=i,this.sequenceIndexMap=a,this.tabix=e}}get sequenceNames(){return Object.keys(this.sequenceIndexMap)}chunksForRange(t,e,i){const r=this.indices[t];if(r){const t=function(t,e){const i=[];e>=1<<29&&(e=1<<29);return--e,i.push([0,0]),i.push([1+(t>>26),1+(e>>26)]),i.push([9+(t>>23),9+(e>>23)]),i.push([73+(t>>20),73+(e>>20)]),i.push([585+(t>>17),585+(e>>17)]),i.push([4681+(t>>14),4681+(e>>14)]),i}(e,i),s=[];for(let e of t)for(let t=e[0];t<=e[1];t++)if(r.binIndex[t]){const e=r.binIndex[t];for(let t of e){const e=t[0],i=t[1];s.push({minv:e,maxv:i})}}const o=r.linearIndex.length;let n;const a=Math.min(e>>14,o-1),c=Math.min(i>>14,o-1);for(let t=a;t<=c;t++){const e=r.linearIndex[t];if(e){n=e;break}}return Tc(s,n)}return[]}}class Oc{constructor(){this.tribble=!0,this.chrIndex={},this.lastBlockPosition=0}async parse(t){let e=0;this.chrIndex={},this.lastBlockPosition=0;const i=new _n(new DataView(t));!function(t){t.getInt(),t.getInt();const e=t.getInt();if(t.getString(),t.getLong(),t.getLong(),t.getString(),t.getInt(),e>=3){let e=t.getInt();for(;e-- >0;)t.getString(),t.getString()}}(i);let r=i.getInt();for(;r-- >0;){let t=i.getString();const r=i.getInt(),s=i.getInt(),o=i.getInt();i.getInt(),i.getInt();let n=i.getLong();const a=[];for(let t=0;t<s;t++){const t=i.getLong();a.push({min:n,max:t}),n=t,t>e&&(e=t)}this.chrIndex[t]={chr:t,blocks:a,longestFeature:o,binWidth:r}}this.lastBlockPosition=e}get sequenceNames(){return Object.keys(this.chrIndex)}chunksForRange(t,e,i){const r=this.chrIndex[t];if(r){const t=r.blocks,s=r.longestFeature,o=r.binWidth,n=Math.max(e-s,0),a=Math.floor(n/o);if(a>=t.length)return[];{const e=Math.min(Math.floor((i-1)/o),t.length-1),r=t[a].min,s=t[e].max;if(0===s-r)return[];return[{minv:{block:r,offset:0},maxv:{block:s,offset:0}}]}}}}async function Hc(t,e){let i=await Er.loadArrayBuffer(t,Qo(e)),r=new DataView(i);if(31===r.getUint8(0)&&139===r.getUint8(1)){i=er(i).buffer,r=new DataView(i)}switch(r.getInt32(0,!0)){case 21578050:return async function(t){const e=new Pc;return await e.parse(t,!1),e}(i);case 21578324:return async function(t){const e=new Pc;return await e.parse(t,!0),e}(i);case 21582659:return async function(t){const e=new zc;return e.parse(t),e}(i);case 1480870228:return async function(t){const e=new Oc;return e.parse(t),e}(i);case 38359875:throw Error("CSI version 2 is not supported.");default:throw Error(`Unrecognized index type: ${t}`)}}function Uc(t){return"string"==typeof t||t instanceof String?new Vc(t):new qc(t)}class Vc{constructor(t){this.data=t,this.ptr=0}nextLine(){var t=this.ptr,e=this.data.indexOf("\n",t),i=this.data;if(e>0)return this.ptr=e+1,e>t&&"\r"===i.charAt(e-1)?i.substring(t,e-1):i.substring(t,e);var r=i.length;return this.ptr=r,t>=r?void 0:i.substring(t)}}class qc{constructor(t){this.data=t,this.length=this.data.length,this.ptr=0}nextLine(){if(this.ptr>=this.data.length)return;let t=this.ptr;const e=this.data;let i="",r=!1;for(;t<e.length;){let s=e[t],o=0,n=0;if(s<=127?(o=0,n=255&s):s<=223?(o=1,n=31&s):s<=239?(o=2,n=15&s):s<=244&&(o=3,n=7&s),e.length-t-o>0){let i=0;for(;i<o;)s=e[t+i+1],n=n<<6|63&s,i+=1}else n=65533,o=e.length-t;t+=o+1;const a=String.fromCodePoint(n);if("\r"===a)r=!0;else{if("\n"===a)break;r&&(i+="\r",r=!1),i+=a}}return this.ptr=t,i}}class Qc{constructor(t){this.config=t,this.filePtr=0,this.bufferPtr=0,this.buffer=void 0,this.eof=!1}async nextLine(){let t;try{for(;;){const e=this.buffer?this.buffer.length:0;for(;this.bufferPtr<e;){const e=String.fromCharCode(this.buffer[this.bufferPtr++]);if("\r"!==e){if("\n"===e)return t;t=t?t+e:e}}if(this.eof)return t;await this.readNextBlock()}}catch(e){return console.warn(e),this.eof=!0,t}}async readNextBlock(){const t=Qo(this.config,{range:{start:this.filePtr,size:26}}),e=ir(await Er.loadArrayBuffer(this.config.url,t));if(0===e)this.eof=!0,this.buffer=void 0;else{const t=Qo(this.config,{range:{start:this.filePtr,size:e}}),i=await Er.loadArrayBuffer(this.config.url,t);i.byteLength<e&&(this.eof=!0),this.buffer=er(i),0==this.buffer.byteLength&&(this.eof=!0),this.bufferPtr=0,this.filePtr+=i.byteLength}}}const Gc=t=>{const e=ArrayBuffer.isView(t)?t:new Uint8Array(t);return 1+(e[17]<<8|e[16])};class Wc{constructor(t){this.config=t,this.cacheBlocks=0!=t.cacheBlocks,this.cache=void 0}async getData(t,e){const i=t.block,r=e.block,s=0===e.offset,o=await this.getInflatedBlocks(i,r,s);if(1===o.length)return o[0];let n=0;for(const t of o)n+=t.byteLength;const a=new Uint8Array(n);let c=0;for(const t of o)a.set(t,c),c+=t.byteLength;return a}async getInflatedBlocks(t,e,i){if(this.cacheBlocks){const r=this.cache;if(r&&r.startBlock<=t&&(r.endBlock>=e||i&&r.nextEndBlock===e)){const i=t-r.startBlock,s=e-r.startBlock;return $c(r.buffer,i,s)}{let s;if(!r||r.startBlock>e||r.endBlock<t)s=await this.loadBLockData(t,e,{skipEnd:i});else{const o=[];if(t<r.startBlock){const e=await this.loadBLockData(t,r.startBlock,{skipEnd:!0});o.push(e)}let n;if(t<=r.startBlock&&e>=r.endBlock)n=r.buffer;else{const i=Math.max(0,t-r.startBlock);let s;if(e>=r.endBlock)s=r.buffer.byteLength;else{const t=jc(r.buffer);for(let i=0;i<t.length-1;i++)if(r.startBlock+t[i]===e){s=t[i+1];break}}n=r.buffer.slice(i,s)}if(o.push(n),e>r.endBlock){const t=await this.loadBLockData(r.endBlock,e,{skipStart:!0,skipEnd:i});o.push(t)}s=function(t){if(1===t.length)return t[0];let e=0;for(const i of t)e+=i.byteLength;const i=new Uint8Array(e);let r=0;for(const e of t)i.set(new Uint8Array(e),r),r+=e.byteLength;return i.buffer}(o)}let o=e;if(i){const t=jc(s);e=t[t.length-1]}return this.cache={startBlock:t,endBlock:e,nextEndBlock:o,buffer:s},$c(s)}}return $c(await this.loadBLockData(t,e,{skipEnd:i}))}async loadBLockData(t,e,i){const r=this.config,s=r.url,o=i&&i.skipStart;let n=0;if(!(i&&i.skipEnd)){const t=Qo(r,{range:{start:e,size:26}}),i=await Er.loadArrayBuffer(s,t);n=Gc(i)}if(o){const e=Qo(r,{range:{start:t,size:26}}),i=await Er.loadArrayBuffer(s,e);t+=Gc(i)}const a=Qo(r,{range:{start:t,size:e+n-t}});return Er.loadArrayBuffer(s,a)}}function jc(t){const e=t.byteLength;let i=0;const r=[0];for(;i<e;){const s=new Uint8Array(t,i);i+=1+(s[17]<<8|s[16]),i<e&&r.push(i)}return r}function $c(t,e,i){const r=[];let s=e=e||0;const o=t.byteLength-18;for(;s<o;)try{const e=new Uint8Array(t,s,18),o=e[11]<<8|e[10],n=e[17]<<8|e[16],a=12+o+s,c=t.byteLength-a,l=n-o-18;if(c<l||l<=0)break;const h=new Uint8Array(t,a,l),d=Yi(h);if(r.push(d),i===s)break;s+=n+1}catch(t){console.error(t);break}return r}const Kc=Math.log10(Number.MIN_VALUE);class Zc{constructor(t){this.chrCol=-1,this.snpCol=-1,this.posCol=-1,this.pValueCol=-1,this.phenotypeColumn=-1,this.delimiter="\t",this.columns=[],this.chrColumn=-1,this.snpColumn=-1,this.posColumn=-1,this.pValueColumn=-1,this.config=t}async parseHeader(t){const e=this.config;e.delimiter&&(this.delimiter=e.delimiter);const i=await t.nextLine();if(!i)return[];const r=this.parseHeaderLine(i);return e.chrColumn&&(this.chrColumn=e.chrColumn-1),e.snpColumn&&(this.snpColumn=e.snpColumn-1),e.posColumn&&(this.posColumn=e.posColumn-1),e.pValueColumn&&(this.pValueColumn=e.pValueColumn-1),e.phenotypeColumn&&(this.phenotypeColumn=e.phenotypeColumn-1),r}parseHeaderLine(t){this.columns=t.split(this.delimiter);for(let t=0;t<this.columns.length;t++){switch(this.columns[t].toLowerCase()){case"chr":case"chromosome":case"chr_id":case"chrom":this.chrColumn=t;break;case"bp":case"pos":case"position":case"chr_pos":case"chromEnd":this.posColumn=t;break;case"p":case"pval":case"pvalue":case"p-value":case"p.value":this.pValueColumn=t;break;case"rsid":case"variant":case"snp":this.snpColumn=t;break;case"phenotype":case"gene":case"gene_id":case"molecular_trait_id":this.phenotypeColumn=t}}return this.columns}async parseFeatures(t){const e=[],i=t.nextLine();let r;!this.columns&&i&&this.parseHeaderLine(i);const s=t=>{const e=t.indexOf("E");if(e>0){if(Number.parseInt(t.substring(e+1))<Kc)return Number.MIN_VALUE}return Number(t)};for(;void 0!==(r=t.nextLine());){const t=r.split(this.delimiter);if(t.length===this.columns.length){const i=t[this.posColumn];if(i.indexOf(";")>0||0==i.length||i.indexOf("x")>0)continue;const r=t[this.chrColumn],o=s(t[this.pValueColumn]),n=parseInt(i)-1,a=n+1,c=t[this.snpColumn],l=t[this.phenotypeColumn],h=new Yc({chr:r,start:n,end:a,pValue:o,snp:c,phenotype:l},this.columns,t);e.push(h)}}return e}static isQTL(t){const e=t.split("\t");if(e.length<5)return!1;const i=[["chr","chromosome","chr_id","chrom"],["bp","pos","position","chr_pos","chromEnd"],["p","pval","p-value","p.value"],["rsid","variant","snp"],["phenotype","gene","gene_id","molecular_trait_id"]];for(let t of i)if(!e.some(e=>t.includes(e.toLowerCase())))return!1;return!0}}class Yc{constructor({chr:t,start:e,end:i,pValue:r,snp:s,phenotype:o},n,a){this.chr=t,this.start=e,this.end=i,this.pValue=r,this.snp=s,this.phenotype=o,this.headers=n,this.tokens=a}popupData(){const t=[];for(let e=0;e<this.headers.length;e++)t.push({name:this.headers[e],value:this.tokens[e]});return t}}class Xc{constructor(t,e){if(this.config=t||{},this.genome=e,this.indexURL=t.indexURL,this.indexed=t.indexed||void 0!==this.indexURL,this.queryable=this.indexed,x(this.config.url))this.filename=this.config.url.name;else if(Ko(this.config.url))this.indexed=!1,this.dataURI=t.url;else{const e=I(this.config.url);this.filename=t.filename||e.file}this.parser=this.getParser(this.config),"vcf"!==this.config.format||this.config.indexURL||console.warn("Warning: index file not specified. The entire vcf file will be loaded.")}async defaultVisibilityWindow(){if(this.config.indexURL){const t=await this.getIndex();if(t&&t.lastBlockPosition){let e=0;const i=1e4;for(let i of t.sequenceNames){const t=this.genome.getChromosome(i);t&&(e+=t.bpLength)}return Math.round(e/t.lastBlockPosition*i)}}}async readFeatures(t,e,i){let r;this.dataURI||this.header||await this.readHeader();return await this.getIndex()?(this.indexed=!0,r=await this.loadFeaturesWithIndex(t,e,i)):this.dataURI?(this.indexed=!1,r=await this.loadFeaturesFromDataURI()):"service"===this.config.sourceType?r=await this.loadFeaturesFromService(t,e,i):(this.indexed=!1,r=await this.loadFeaturesNoIndex()),r.sort(function(t,e){return t.chr===e.chr?t.start-e.start:t.chr.localeCompare(e.chr)}),r}async readHeader(){if(this.dataURI)return await this.loadFeaturesFromDataURI(),this.header;if(this.config.indexURL){const t=await this.getIndex();if(!t)throw new Error("Unable to load index: "+this.config.indexURL);let e;if(this.sequenceNames=new Set(t.sequenceNames),t.tabix)this._blockLoader=new Wc(this.config),e=new Qc(this.config);else{const i=Object.values(t.chrIndex).flatMap(t=>t.blocks).map(t=>t.max).reduce((t,e)=>Math.min(t,e),Number.MAX_SAFE_INTEGER),r=Qo(this.config,{bgz:t.tabix,range:{start:0,size:i}});e=Uc(await Er.loadString(this.config.url,r))}return this.header=await this.parser.parseHeader(e),this.header}if("service"!==this.config.sourceType){let t;if(this.indexed=!1,this.config._filecontents)t=this.config._filecontents,delete this.config._filecontents;else{const e=Qo(this.config);t=await Er.loadByteArray(this.config.url,e)}t.length<5e8&&(t=(new TextDecoder).decode(t));let e=Uc(t);return this.header=await this.parser.parseHeader(e),e=Uc(t),this.features=await this.parser.parseFeatures(e),this.sequenceNames=new Set(this.features.map(t=>t.chr)),this.header}if(this.config.seqnamesURL){const t=Qo(this.config,{}),e=await Er.loadString(this.config.seqnamesURL,t);e&&(this.sequenceNames=new Set(e.split(",").map(t=>t.trim()).filter(t=>t)))}if(this.config.headerURL){const t=Qo(this.config,{}),e=Uc(await Er.loadString(this.config.headerURL,t));return this.header=await this.parser.parseHeader(e),this.header}}getParser(t){switch(t.format){case"vcf":case"vcftabix":return new vc;case"seg":return new dc("seg");case"mut":return new dc("mut");case"maf":return new dc("maf");case"gwas":return new _c(t);case"qtl":return new Zc(t);case"aed":return new Sc(t);default:return new Ya(t)}}async loadFeaturesNoIndex(){if(this.features){const t=this.features;return delete this.features,t}{const t=Qo(this.config),e=await Er.loadByteArray(this.config.url,t);if(!this.header){const t=Uc(e);this.header=await this.parser.parseHeader(t)}const i=Uc(e),r=[];return await this._parse(r,i),r}}async loadFeaturesWithIndex(t,e,i){const r=this.config;this.parser;const s=this.index.tabix,o=s?this.index.sequenceIndexMap[t]:t;if(void 0===o)return[];const n=this.index.chunksForRange(o,e,i);if(n&&0!==n.length){const o=[];for(let a of n){let n;if(s)n=await this._blockLoader.getData(a.minv,a.maxv);else{const t=Qo(r,{range:{start:a.minv.block,size:a.maxv.block-a.minv.block+1}});n=await Er.loadString(r.url,t)}const c=Uc(a.minv.offset?n.slice(a.minv.offset):n);await this._parse(o,c,t,i,e)}return o}return[]}async loadFeaturesFromService(t,e,i){let r;r="function"==typeof this.config.url?this.config.url({chr:t,start:e,end:i}):this.config.url.replace("$CHR",t).replace("$START",String(e)).replace("$END",String(i));const s=Qo(this.config),o=Uc(await Er.loadString(r,s)),n=[];return await this._parse(n,o),n}async _parse(t,e,i,r,s){let o=await this.parser.parseFeatures(e);if(o.sort(function(t,e){return t.chr===e.chr?t.start-e.start:t.chr.localeCompare(e.chr)}),void 0===i)for(let e of o)t.push(e);else{let e=!1;for(let n=0;n<o.length;n++){const a=o[n];if(a.chr===i){if(a.start>r){t.push(a);break}a.end>=s&&a.start<=r&&(e||(e=!0,n>0&&t.push(o[n-1])),t.push(a))}}}}async getIndex(){return this.index?this.index:this.config.indexURL?(this.index=await this.loadIndex(),this.index):void 0}async loadIndex(){return Hc(this.config.indexURL,this.config)}async loadFeaturesFromDataURI(){if(this.features){const t=this.features;return delete this.features,t}{const t=nr(this.dataURI);let e=Uc(t);this.header=await this.parser.parseHeader(e),this.header instanceof String&&this.header.startsWith("##gff-version 3")&&(this.format="gff3"),e=Uc(t);const i=[];return await this._parse(i,e),i}}}const Jc=b;class tl{constructor(t){this.config=t}async readFeatures(t,e,i){let r;r="function"==typeof this.config.url?this.config.url({chr:t,start:e,end:i}):this.config.url.replace("$CHR",t).replace("$START",String(e)).replace("$END",String(i));let s=Object.assign({},this.config);void 0!==this.config.body&&("function"==typeof this.config.body?s.body=this.config.body({chr:t,start:e,end:i}):s.body=this.config.body.replace("$CHR",t).replace("$START",String(e)).replace("$END",String(i)));let o=[];const n=await Er.load(r,s);if(n&&(o="function"==typeof this.config.parser?this.config.parser(n):Jc(n)?JSON.parse(n):n),this.config.mappings){let t=Object.keys(this.config.mappings);for(let e of o)for(let i of t)e[i]=e[this.config.mappings[i]]}return o}}class el{constructor(t,e){this.config=t,this.genome=e,this.expandQueryInterval=!1}readFeatures(t,e,i){const r=Math.max(0,Math.floor(e));let s=Math.ceil(i);if(this.genome){const e=this.genome.getChromosome(t);e&&s>e.bpLength&&(s=e.bpLength)}const o=this.config.url+"?db="+this.config.db+"&table="+this.config.tableName+"&chr="+t+"&start="+r+"&end="+s;return Er.loadJson(o,this.config).then(function(t){return t?(t.forEach(function(t){t.hasOwnProperty("exonStarts")&&t.hasOwnProperty("exonEnds")&&t.hasOwnProperty("exonCount")&&t.hasOwnProperty("cdsStart")&&t.hasOwnProperty("cdsEnd")&&function(t){var e,i,r,s,o,n;e=t.exonCount,i=t.exonStarts.split(","),r=t.exonEnds.split(","),s=[];for(var a=0;a<e;a++){var c={start:o=parseInt(i[a]),end:n=parseInt(r[a])};(t.cdsStart>n||t.cdsEnd<t.cdsStart)&&(c.utr=!0),t.cdsStart>=o&&t.cdsStart<=n&&(c.cdStart=t.cdsStart),t.cdsEnd>=o&&t.cdsEnd<=n&&(c.cdEnd=t.cdsEnd),s.push(c)}t.exons=s}(t)}),t):null})}}class il{constructor(t){this.gtexChrs=new Set(["chr1","chr10","chr11","chr12","chr13","chr14","chr15","chr16","chr17","chr18","chr19","chr2","chr20","chr21","chr22","chr3","chr4","chr5","chr6","chr7","chr8","chr9","chrM","chrX","chrY"]),this.config=t,this.url=t.url,this.tissueId=t.tissueSiteDetailId,this.datasetId=t.datasetId||"gtex_v8"}async readFeatures(t,e,i){const r=t.startsWith("chr")?t:"MT"===t?"chrM":"chr"+t;if(!this.gtexChrs.has(r))return[];const s=Math.floor(e),o=Math.ceil(i),n=this.datasetId,a=this.url+"?chromosome="+r+"&start="+s+"&end="+o+"&tissueSiteDetailId="+this.tissueId+"&datasetId="+n,c=await Er.loadJson(a,{withCredentials:this.config.withCredentials});return c&&c.singleTissueEqtl?c.singleTissueEqtl.map(t=>new rl(t)):[]}}class rl{constructor(t){this.chr=t.chromosome,this.start=t.pos-1,this.end=this.start+1,this.snp=t.snpId,this.phenotype=t.geneSymbol,this.pValue=t.pValue,this.json=t}popupData(){return Object.keys(this.json).map(t=>({name:t,value:this.json[t]}))}}class sl{constructor(t,e){if(this.config=t,this.genome=e,!t.format)throw Error('Format is required, and must be either "bam" or "cram"');if(this.format=t.format.toUpperCase(),"BAM"!==this.format&&"VCF"!==this.format)throw Error(`htsget format ${t.format} is not supported`)}async readHeaderData(){const t=`${ol(this.config)}?class=header&format=${this.format}`,e=await Er.loadJson(t,Qo(this.config));return await this.loadUrls(e.htsget.urls)}async readData(t,e,i){const r=`${ol(this.config)}?format=${this.format}&referenceName=${t}&start=${Math.floor(e)}&end=${Math.ceil(i)}`,s=await Er.loadJson(r,Qo(this.config));return this.loadUrls(s.htsget.urls)}async loadUrls(t){const e=[];for(let i of t)if(i.url.startsWith("data:"))e.push(Promise.resolve(nl(i.url)));else{const t={headers:i.headers||{}};e.push(Er.loadArrayBuffer(i.url,t))}return function(t){let e=0;for(let i of t)e+=i.byteLength;let i=0;const r=new Uint8Array(e);for(let e of t){const t=new Uint8Array(e);r.set(t,i),i+=t.length}return r}(await Promise.all(e))}static async inferFormat(t){try{const e=ol(t),i=`${e}${e.includes("?")?"&":"?"}class=header`,r=await Er.loadJson(i,Qo(t));if(r.htsget){const e=r.htsget.format;if("BAM"!==e&&"VCF"!==e)throw Error(`htsget format ${e} is not supported`);t.format=e.toLowerCase(),t.sourceType="htsget",t.name||(t.name=_(t.url))}}catch(t){}}}function ol(t){if(t.url&&t.endpoint&&t.id)return t.url+t.endpoint+t.id;if(t.endpoint&&t.id)return t.endpoint+t.id;if(t.url)return t.url.startsWith("htsget://")?t.url.replace("htsget://","https://"):t.url;throw Error("Must specify either 'url', or 'endpoint' and 'id")}function nl(t){const e=t.split(","),i=e[0].split(":")[1];let r=e[1];r=i.indexOf("base64")>=0?atob(r):decodeURI(r);const s=new Uint8Array(r.length);for(let t=0;t<r.length;t++)s[t]=r.charCodeAt(t);return s.buffer}class al{constructor(t,e){this.chrAliasTable=new Map,this.sequenceNames=new Set(t),this.genome=e}async getAliasName(t){if(!this.genome)return t;if(!this.chrAliasTable.has(t)){const e=this.genome.getAliasRecord?await this.genome.getAliasRecord(t):void 0;if(e){const i=Object.keys(e).filter(t=>"start"!==t&&"end"!==t).map(t=>e[t]).filter(t=>this.sequenceNames.has(t));i.length>0?this.chrAliasTable.set(t,i[0]):this.chrAliasTable.set(t,t)}else this.chrAliasTable.set(t,t)}return this.chrAliasTable.get(t)}}class cl extends sl{constructor(t,e){super(t,e),this.parser=new vc}async readHeader(){if(!this.header){const t=await this.readHeaderData();let e=t;Ji(t.buffer)&&(e=new Uint8Array(tr(t.buffer)));const i=Uc(e);this.header=await this.parser.parseHeader(i,this.genome),this.header.sequenceNames&&this.header.sequenceNames.length>0&&(this.chromAliasManager=new al(this.header.sequenceNames,this.genome))}return this.header}async readFeatures(t,e,i){if("all"===t)return[];if(this.config.format&&"VCF"!==this.config.format.toUpperCase())throw Error(`htsget format ${this.config.format} is not supported`);this.header||await this.readHeader();let r=this.chromAliasManager?await this.chromAliasManager.getAliasName(t):t;const s=await this.readData(r,e,i);let o=s;Ji(s.buffer)&&(o=new Uint8Array(tr(s.buffer)));const n=Uc(o);return this.parser.parseFeatures(n)}}class ll{constructor(t){this.genome=t}async nextFeature(t,e,i,r){let s=this.genome.chromosomeNames||[t],o=s.indexOf(t);if(o<0)return;const n=Math.min(1e4,r||1e4);let a=i?e:Math.max(e-n,0);for(;o<s.length&&o>=0;){t=s[o];const c=this.genome.getChromosome(t).bpLength;for(;a<c&&a>=0;){let s=i?a+n:Math.min(e,a+n);const o=await this.getFeatures({chr:t,start:a,end:s,visibilityWindow:r});if(o){const t=(t,e)=>t.start-e.start+t.end-e.end,r=Array.from(o);r.sort(t);let s=i?0:r.length-1;for(;s>=0&&s<r.length;){const t=r[s],o=(t.start+t.end)/2;if(i){if(o>e)return t;s++}else{if(o<e)return t;s--}}}a=i?s:a-n}if(i)o++,a=0,e=0;else{if(o--,o<0)break;a=(e=this.genome.getChromosome(s[o]).bpLength)-n}}}async getFeatures(t){throw new Error("getFeatures not implemented")}}function hl(t,e,i,r="mean"){if(i<=1||!t||0===t.length||"none"===r)return t;const s=t[0].chr,o=i,n=[],a=t=>{const i=e+t.bin*o,a=i+o;let c;switch(r){case"mean":c=t.sumData/t.count;break;case"max":c=t.max;break;case"min":c=t.min;break;default:throw Error(`Unknown window function: ${r}`)}const l=`${r} of ${t.count} values`;n.push({chr:s,start:i,end:a,value:c,description:l})};let c;for(let i of t){let t=Math.floor((i.start-e)/o);const r=Math.floor((i.end-e)/o);if(c&&t===c.bin&&(c.add(i),t++),!c||r>c.bin){if(c&&a(c),r>t){const t=e+r*o;n.push({chr:s,start:i.start,end:t,value:i.value})}c=new dl(r,i)}}c&&a(c);const l=[];let h=n[0];for(let t of n)h.value===t.value&&t.start<=h.end?h.end=t.end:(l.push(h),h=t);return l.push(h),l}class dl{constructor(t,e){this.bin=t,this.sumData=e.value,this.count=1,this.min=e.value,this.max=e.value}add(t){this.sumData+=t.value,this.max=Math.max(t.value,this.max),this.min=Math.min(t.value,this.min),this.count++}get mean(){return this.sumData/this.count}}class ul extends ll{constructor(t,e){super(e),this.config=t||{},this.genome=e,this.sourceType=void 0===t.sourceType?"file":t.sourceType,this.maxWGCount=t.maxWGCount||1e4,this.windowFunctions=["mean","min","max","none"];const i=new Set(["bigwig","bw","bigbed","bb","biginteract","biggenepred","bignarrowpeak","tdf"]);if(this.queryable=!(!t.indexURL&&!0!==t.queryable),t.reader)this.reader=t.reader,this.queryable=!1!==t.queryable;else{if("ga4gh"===t.sourceType)throw Error("Unsupported source type 'ga4gh'");"eqtl"!==t.type&&"qtl"!==t.type||"gtex-ws"!==t.sourceType?"htsget"===t.sourceType?(this.reader=new cl(t,e),this.queryable=!0,this.supportsWholeGenome=()=>!1):"ucscservice"===t.sourceType?(this.reader=new el(t.source),this.queryable=!0):"custom"===t.sourceType?(this.reader=new tl(t.source),this.queryable=!1!==t.source.queryable):"service"===t.sourceType?(this.reader=new Xc(t,e),this.queryable=!0):(this.reader=new Xc(t,e),void 0!==t.queryable?this.queryable=t.queryable:(t.format&&i.has(t.format)||this.reader.indexed)&&(this.queryable=!0)):(this.reader=new il(t),this.queryable=!0)}this.searchable=!1!==t.searchable}async defaultVisibilityWindow(){if(this.reader&&"function"==typeof this.reader.defaultVisibilityWindow)return this.reader.defaultVisibilityWindow()}async trackType(){const t=await this.getHeader();return t?t.type:void 0}async getHeader(){if(!this.header)if(this.reader&&"function"==typeof this.reader.readHeader){const t=await this.reader.readHeader();t?(this.header=t,t.format&&(this.config.format=t.format)):this.header={}}else this.header={};return this.header}async getFeatures({chr:t,start:e,end:i,bpPerPixel:r,visibilityWindow:s,windowFunction:o}){const n="all"===t.toLowerCase();if(e=e||0,i=i||Number.MAX_SAFE_INTEGER,(n&&!this.wgFeatures&&this.supportsWholeGenome()||this.config.disableCache||!this.featureCache||!this.featureCache.containsRange(new hn(t,e,i,void 0)))&&await this.loadFeatures(t,e,i,s),n){if(!this.wgFeatures)if(this.supportsWholeGenome())if("wig"===this.config.type){const t=await sc(this.featureCache.getAllFeatures(),this.genome,this.chromAliasManager,1e6);this.wgFeatures=hl(t,0,r,o)}else this.wgFeatures=await sc(this.featureCache.getAllFeatures(),this.genome,this.chromAliasManager,this.maxWGCount);else this.wgFeatures=[];return this.wgFeatures}{const r=this.chromAliasManager?await this.chromAliasManager.getAliasName(t):t;return this.featureCache.queryFeatures(r,e,i)}}async findFeatures(t){return this.featureCache?this.featureCache.findFeatures(t):[]}supportsWholeGenome(){return!this.queryable}getAllFeatures(){return this.queryable||!this.featureCache?[]:this.featureCache.getAllFeatures()}async loadFeatures(t,e,i,r){await this.getHeader();const s=this.reader;let o=e,n=i,a=t;if(!this.chromAliasManager&&this.reader&&this.reader.sequenceNames&&this.reader.sequenceNames.size>0&&(this.chromAliasManager=new al([...this.reader.sequenceNames],this.genome)),this.chromAliasManager&&(a=await this.chromAliasManager.getAliasName(t)),(!r||r<=0)&&!1!==this.config.expandQuery){const e=this.genome?this.genome.getChromosome(t):void 0;o=0,n=Math.max(e?e.bpLength:Number.MAX_SAFE_INTEGER,i)}else if(r&&r>i-e&&!1!==this.config.expandQuery){let t=Math.min(4.1*(i-e),r);this.config.minQuerySize&&t<this.config.minQuerySize&&(t=this.config.minQuerySize),o=Math.max(0,(e+i-t)/2),n=o+t}let c=await s.readFeatures(a,o,n);void 0===this.queryable&&(this.queryable=s.indexed);const l=this.queryable?new hn(a,o,n,void 0):void 0;if(c){if("wig"!==this.config.format&&"junctions"!==this.config.type){oc(c,this.config.maxRows||Number.MAX_SAFE_INTEGER)}this.featureCache=new Xn(c,l),this.searchable&&this.addFeaturesToDB(c,this.config)}else this.featureCache=new Xn([],l)}addFeaturesToDB(t,e){this.featureMap||(this.featureMap=new Map);const i=e.searchableFields||["name","transcript_id","gene_id","gene_name","id"];for(let e of t)for(let t of i){let i;if(e.hasOwnProperty(t))i=e[t];else if("function"==typeof e.getAttributeValue){const r=e.getAttributeValue(t);i=void 0!==r?String(r):void 0}if(i){if(i=i.replace(/ /g,"+").toUpperCase(),this.featureMap.has(i)){const t=this.featureMap.get(i);if(e.end-e.start<t.end-t.start)continue}this.featureMap.set(i,e)}}}search(t){if(this.featureMap)return this.featureMap.get(t.toUpperCase())}}var fl,pl;class gl{constructor(t,e,i,r){fl.add(this),this.littleEndian=!0,this.nodeCache=new Map,this.path=t,this.config=e,this.startOffset=i,this.loader=r||Er}async init(){const t=await wo(this,fl,"m",pl).call(this,this.startOffset,48);let e=t.getInt();if(e!==gl.magic&&(t.setPosition(0),this.littleEndian=!this.littleEndian,t.littleEndian=this.littleEndian,e=t.getInt(),e!==gl.magic))throw Error(`Bad magic number ${e}`);const i=t.getUInt(),r=t.getLong(),s=t.getUInt(),o=t.getUInt(),n=t.getUInt(),a=t.getUInt(),c=t.getLong(),l=t.getUInt(),h=t.getUInt(),d=this.startOffset+48;return this.header={magic:e,blockSize:i,itemCount:r,startChromIx:s,startBase:o,endChromIx:n,endBase:a,endFileOffset:c,itemsPerSlot:l,reserved:h,rootNodeOffset:d},this}async findLeafItemsOverlapping(t,e,i,r){const s=[],o=async n=>{const a=await this.readNode(n);for(let n of a.items)ml(n,t,e,i,r)&&(1===a.type?s.push(n):await o(n.childOffset))};return await o(this.header.rootNodeOffset),s}async readNode(t){const e=t;if(this.nodeCache.has(e))return this.nodeCache.get(e);let i=await wo(this,fl,"m",pl).call(this,t,4);const r=i.getByte(),s=1===r;i.getByte();const o=i.getUShort();let n=o*(s?32:24);i=await wo(this,fl,"m",pl).call(this,t+4,n);const a=[];for(let t=0;t<o;t++){let t={isLeaf:s,startChrom:i.getInt(),startBase:i.getInt(),endChrom:i.getInt(),endBase:i.getInt(),childOffset:i.getLong()};s&&(t.dataSize=i.getLong(),t.dataOffset=t.childOffset),a.push(t)}const c={type:r,items:a};return this.nodeCache.set(e,c),c}}function ml(t,e,i,r,s){return t?(r>t.startChrom||r===t.startChrom&&s>=t.startBase)&&(e<t.endChrom||e===t.endChrom&&i<=t.endBase):(console.log("null item for "+e+" "+i+" "+s),!1)}function wl(t){return Math.min(1,.11+t/779*.89).toString()}fl=new WeakSet,pl=async function(t,e){const i=await this.loader.loadArrayBuffer(this.path,Qo(this.config,{range:{start:t,size:e}}));return new _n(new DataView(i),this.littleEndian)},gl.magic=610839776;class bl{constructor(t,e){this.bufferCache=new Map,this.ixFile=e,this.ixxFile=t}async search(t,e){const i=t.split(" ")[0].toLowerCase(),r=await this._getBuffer(i,e);if(!r)return;const s=r.slice(0,r.lastIndexOf("\n")).split("\n").filter(t=>!!t),o=[];for(let t of s){const e=t.split(" ")[0];if(e.startsWith(i)&&o.push(t),e.slice(0,i.length)>i)break}if(0!==o.length){const t=new Map;for(let e of o){const[i,...r]=e.split(" ");t.set(i,r.map(t=>t.split(",")[0]))}return t}}async getIndex(t){return this.index||(this.index=await this._readIndex()),this.index}async _readIndex(){return(await Er.loadString(this.ixxFile)).split("\n").filter(t=>!!t).map(t=>{const e=t.length-10,i=t.slice(0,e),r=t.slice(e);return[i,Number.parseInt(r,16)]})}async _getBuffer(t,e){let i=0,r=65536;const s=await this.getIndex(e);for(let e=0;e<s.length;e++){const[o,n]=s[e],a=Math.min(o.length,t.length);o.slice(0,a)<t&&(i=n,r=n+65536)}const o=r-i;if(!(o<0)){if(this.bufferCache.has(i))return this.bufferCache.get(i);{const t=await Er.loadString(this.ixFile,{range:{start:i,size:o}});return this.bufferCache.set(i,t),t}}}}class Fl{constructor(t,e,i,r){this.nameToId=new Map,this.idToName=new Map,this.path=t,this.config=e,this.startOffset=i,this.bpTree=new Sn(t,e,i,"BPChromTree",r)}async init(){return this.bpTree.init()}getItemCount(){return this.bpTree.getItemCount()}async getIdForName(t){if(this.nameToId.has(t))return this.nameToId.get(t);try{const e=await this.bpTree.search(t);if(e){const i=e.id;return this.nameToId.set(t,i),i}return}catch(t){throw new Error(String(t))}}async getNameForId(t){if(this.idToName.has(t))return this.idToName.get(t);{const e=await this.searchForName(t);if(null!==e)return this.idToName.set(t,e),e}return null}async searchForName(t){const e=async(t,i)=>{const r=await this.bpTree.readTreeNode(t);let s=null;if(1===r.type){for(const t of r.items){const e=t.key,r=t.value.id;r===i&&(s=e),this.nameToId.set(e,r),this.idToName.set(r,e)}return s}for(const t of r.items)if(s=await e(t.offset,i),null!==s)break;return s};try{return e(this.startOffset+32,t)}catch(t){throw new Error(String(t))}}async estimateGenomeSize(){try{const t={total:0,count:0};await this.accumulateSize(this.startOffset+32,t,1e4);return this.getItemCount()/t.count*t.total}catch(t){return console.error("Error estimating genome size",t),-1}}async accumulateSize(t,e,i){const r=await this.bpTree.readTreeNode(t);if(1===r.type)for(const t of r.items){const i=t.value;e.total+=i.size,e.count+=1}else{const t=r.items.slice().sort(()=>Math.random()-.5);for(const r of t)if(await this.accumulateSize(r.offset,e,i),e.count>i)break}return e}}var vl,yl,Al;class Cl{constructor(t,e){vl.add(this),this.chrAliasTable=new Map,this.rpTreeCache=new Map,this.path=t.url,this.format=t.format||"bigwig",this.genome=e,this.config=t,this.bufferSize=512e3,this.loader=Ko(this.path)?new Nl(nr(this.path).buffer):Er;const i=t.trixURL||t.searchTrix;i&&(this._trix=new bl(`${i}x`,i))}async preload(){const t=await Er.loadArrayBuffer(this.path);this.loader=new Nl(t);for(let t of this.rpTreeCache.values())t.loader=this.loader;if(this._searchTrees)for(let t of this._searchTrees)t.loader=this.loader}async readWGFeatures(t,e,i){await this.loadHeader();let r,s,o=Number.MAX_SAFE_INTEGER,n=-1;for(const e of t){const t=await this.getIdForChr(e);null!=t&&(t<o&&(o=t,r=e),t>n&&(n=t,s=e))}return this.readFeatures(r,0,s,Number.MAX_VALUE,e,i)}async readFeatures(t,e,i,r,s,o="mean"){e||(e=0),r||(r=Number.MAX_SAFE_INTEGER),await this.loadHeader();const n=await this.getIdForChr(t),a=await this.getIdForChr(i);if(void 0===n||void 0===a)return[];let c,l;if("bigwig"===this.type){const t=await this.getZoomHeaders();let e=s?function(t,e){let i;for(let r=0;r<e.length;r++){const s=e[r];if(s.reductionLevel<t){i=s;break}}return i}(s,t):void 0;e&&"none"!=o?(c=e.indexOffset,l=El):(c=this.header.fullIndexOffset,l=Il)}else c=this.header.fullIndexOffset,l=Sl.call(this);const h=await this.loadRPTree(c),d=await h.findLeafItemsOverlapping(n,e,a,r);if(d&&0!==d.length){let t=Number.MAX_VALUE,i=0;for(let e of d)t=Math.min(t,e.dataOffset),i=Math.max(i,e.dataOffset+e.dataSize);const s=i-t,c=await this.loader.loadArrayBuffer(this.config.url,Qo(this.config,{range:{start:t,size:s}})),h=[];for(let i of d){const s=new Uint8Array(c,i.dataOffset-t,i.dataSize);let d;d=this.header.uncompressBuffSize>0?Zi(s):s,await l.call(this,new DataView(d.buffer),n,e,a,r,h,o)}return h.sort(function(t,e){return t.start-e.start}),h}return[]}async getIdForChr(t){var e,i;if(this.chrAliasTable.has(t)&&!(t=this.chrAliasTable.get(t)))return;let r=await this.chromTree.getIdForName(t);if(void 0===r&&this.genome){const s=await(null===(i=(e=this.genome).getAliasRecord)||void 0===i?void 0:i.call(e,t));let o;if(s)for(let e of Object.keys(s))if("start"!==e&&"end"!==e&&(o=s[e],o!==t&&(r=await this.chromTree.getIdForName(o),void 0!==r)))break;this.chrAliasTable.set(t,o)}return r}get searchable(){return"bigbed"===this.type}async search(t){if(this.header||await this.loadHeader(),!this.header||!this.header.extraIndexCount)return;const e=await this._searchForRegions(t);if(e){const i=await this._loadFeaturesForRange(e.offset,e.length);if(i){const e=i.filter(e=>{for(let i of Object.keys(e)){const r=e[i];if(b(r)&&r.toLowerCase()===t.toLowerCase())return!0}return!1});return e.length>0?e.reduce((t,e)=>t.end-t.start>e.end-e.start?t:e,e[0]):void 0}}}async _searchForRegions(t){const e=await wo(this,vl,"m",yl).call(this);if(e){if(this._trix){const e=t.toLowerCase(),i=await this._trix.search(e);i&&i.has(e)&&(t=i.get(e)[0])}for(let i of e){const e=await i.search(t);if(e)return e}}}async getZoomHeaders(){return this.zoomLevelHeaders||await this.loadHeader(),this.zoomLevelHeaders}async loadHeader(){if(this.header)return this.header;{let t,e=await this.loader.loadArrayBuffer(this.path,Qo(this.config,{range:{start:0,size:64}}));this.littleEndian=!0;const i=new _n(new DataView(e),this.littleEndian);let r=i.getUInt();if(2291137574===r)this.type="bigwig";else if(2273964779===r)this.type="bigbed";else{this.littleEndian=!1,i.littleEndian=!1,i.position=0;let t=i.getUInt();654085990===t?this.type="bigwig":3958540679===t&&(this.type="bigbed")}t={bwVersion:i.getUShort(),nZoomLevels:i.getUShort(),chromTreeOffset:i.getLong(),fullDataOffset:i.getLong(),fullIndexOffset:i.getLong(),fieldCount:i.getUShort(),definedFieldCount:i.getUShort(),autoSqlOffset:i.getLong(),totalSummaryOffset:i.getLong(),uncompressBuffSize:i.getInt(),extensionOffset:i.getLong()};const s=64;let o={start:s,size:t.totalSummaryOffset>0?t.totalSummaryOffset-s+40:Math.min(t.fullDataOffset,t.chromTreeOffset)-s};e=await this.loader.loadArrayBuffer(this.path,Qo(this.config,{range:o}));const n=new _n(new DataView(e),this.littleEndian),a=t.nZoomLevels;this.zoomLevelHeaders=[],this.firstZoomDataOffset=Number.MAX_SAFE_INTEGER;for(let t=1;t<=a;t++){const e=a-t,i=new _l(e,n);this.firstZoomDataOffset=Math.min(i.dataOffset,this.firstZoomDataOffset),this.zoomLevelHeaders[e]=i}if(t.autoSqlOffset>0){n.position=t.autoSqlOffset-s;const e=n.getString();e&&(this.autoSql=function(t){let e;const i=[];let r=!1;const s=t.trim().split(/\s*[\r\n]+\s*/g);for(let t of s)if(t=t.trim(),t.length>0){if(t.startsWith("#"))continue;if(t.startsWith("table"))e=t.split(/\s+/)[1].trim();else if(t.startsWith("("))r=!0;else if(t.startsWith(")"));else if(r){const e=t.indexOf(";");if(e>0){const r=t.substring(0,e).split(/\s+/),s=t.substring(e+1).replace(/"/g,"").trim();i.push({type:r[0],name:r[1],description:s})}}}return{table:e,fields:i}}(e))}if(t.totalSummaryOffset>0&&(n.position=t.totalSummaryOffset-s,this.totalSummary=new xl(n)),this.chromTree=new Fl(this.path,this.config,t.chromTreeOffset,this.loader),await this.chromTree.init(),"bigbed"===this.type){const e=await wo(this,vl,"m",Al).call(this,t.fullDataOffset);this.featureDensity=e/await this.chromTree.estimateGenomeSize()}return this.header=t,t.extensionOffset>0&&await this.loadExtendedHeader(t.extensionOffset),this.header}}async loadExtendedHeader(t){let e=await this.loader.loadArrayBuffer(this.path,Qo(this.config,{range:{start:t,size:64}})),i=new _n(new DataView(e),this.littleEndian);i.getUShort();const r=i.getUShort(),s=i.getLong();if(0===r)return;let o=56*r;e=await this.loader.loadArrayBuffer(this.path,Qo(this.config,{range:{start:s,size:o}})),i=new _n(new DataView(e),this.littleEndian);const n=[],a=[],c=[];for(let t=0;t<r;t++){n.push(i.getUShort());const t=i.getUShort();c.push(i.getLong()),a.push(i.getInt());for(let e=0;e<t;e++)i.getUShort(),a.push(i.getUShort())}this.header.extraIndexCount=r,this.header.extraIndexOffsets=c}async loadRPTree(t){let e=this.rpTreeCache.get(t);return e||(e=new gl(this.path,this.config,t,this.loader),await e.init(),this.rpTreeCache.set(t,e),e)}async getType(){return await this.loadHeader(),this.type}async getTrackType(){return await this.loadHeader(),"bigwig"===this.type?"wig":!this.autoSql||"interact"!==this.autoSql.table&&"chromatinInteract"!==this.autoSql.table?"annotation":"interact"}async _loadFeaturesForRange(t,e){const i=await this.loader.loadArrayBuffer(this.config.url,Qo(this.config,{range:{start:t,size:e}})),r=new Uint8Array(i),s=this.header.uncompressBuffSize>0?Zi(r):r,o=Sl.call(this),n=[];return await o.call(this,new DataView(s.buffer),0,0,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,n),n}}vl=new WeakSet,yl=async function(){if(void 0===this._searchTrees&&this.header.extraIndexOffsets&&this.header.extraIndexOffsets.length>0){this._searchTrees=[];for(let t of this.header.extraIndexOffsets){const e=void 0,i=await Sn.loadBpTree(this.path,this.config,t,e,this.loader);this._searchTrees.push(i)}}return this._searchTrees},Al=async function(t){const e=await this.loader.loadArrayBuffer(this.path,Qo(this.config,{range:{start:t,size:4}}));return new _n(new DataView(e),this.littleEndian).getInt()};class _l{constructor(t,e){this.index=t,this.reductionLevel=e.getUInt(),this.reserved=e.getInt(),this.dataOffset=e.getLong(),this.indexOffset=e.getLong()}}class xl{constructor(t){t?(this.basesCovered=t.getLong(),this.minVal=t.getDouble(),this.maxVal=t.getDouble(),this.sumData=t.getDouble(),this.sumSquares=t.getDouble(),this.mean=0,this.stddev=0,kl.call(this)):(this.basesCovered=0,this.minVal=0,this.maxVal=0,this.sumData=0,this.sumSquares=0,this.mean=0,this.stddev=0)}}function kl(){let t=this.basesCovered;if(t>0){this.mean=this.sumData/t,this.stddev=Math.sqrt(this.sumSquares/(t-1));let e=this.minVal<0?this.mean-2*this.stddev:0,i=this.maxVal>0?this.mean+2*this.stddev:0;this.defaultRange={min:e,max:i}}}async function Il(t,e,i,r,s,o,n,a){const c=new _n(t,a),l=c.getInt(),h=c.getInt();let d=h,u=c.getInt();const f=c.getInt(),p=c.getInt(),g=c.getByte();c.getByte();let m=c.getUShort();if(l>=e&&l<=r){let t=0;for(;m-- >0;){let n;switch(g){case 1:d=c.getInt(),u=c.getInt(),n=c.getFloat();break;case 2:d=c.getInt(),n=c.getFloat(),u=d+p;break;case 3:n=c.getFloat(),d=h+t*f,u=d+p,t++}if(!(l<e||l===e&&u<i)){if(l>r||l===r&&d>=s)break;if(Number.isFinite(n)){const t=await this.chromTree.getNameForId(l);t&&o.push({chr:t,start:d,end:u,value:n})}}}}}function Sl(){const t=function(t,e,i,r){if("biginteract"===r||i&&("chromatinInteract"===i.table||"interact"===i.table))return function(t,e){t.chr1=e[5],t.start1=Number.parseInt(e[6]),t.end1=Number.parseInt(e[7]),t.chr2=e[10],t.start2=Number.parseInt(e[11]),t.end2=Number.parseInt(e[12]),t.name=e[0],t.score=Number(e[1]),t.value=Number(e[2]),t.color="."===e[4]?void 0:"0"===e[4]?"rgb(0,0,0)":e[4]};{const r=t-3;return function(s,o){if(r>0&&(s.name=o[0]),r>1&&(s.score=Number(o[1])),r>2&&(s.strand=o[2]),r>3&&(s.cdStart=parseInt(o[3])),r>4&&(s.cdEnd=parseInt(o[4])),r>5&&"."!==o[5]&&"0"!==o[5]&&"-1"!==o[5]){const t=ur.createColorString(o[5]);s.color=t.startsWith("rgb")?t:void 0}if(r>8){const t=parseInt(o[6]),e=o[7].split(","),i=o[8].split(","),r=[];for(let o=0;o<t;o++){const t=s.start+parseInt(i[o]),n=t+parseInt(e[o]);r.push({start:t,end:n})}!function(t,e,i){for(let r of t){const t=r.end,s=r.start;t<e||s>i?r.utr=!0:(e>=s&&e<=t&&(r.cdStart=e),i>=s&&i<=t&&(r.cdEnd=i))}}(r,s.cdStart,s.cdEnd),s.exons=r}if(i)for(let r=t;r<e;r++)if(r<i.fields.length){const t=i.fields[r].name;if("exonFrames"===t){const t=o[r-3].replace(/,$/,"").split(",");for(let e=0;e<s.exons.length;e++){const i=s.exons[e],r=parseInt(t[e]);-1!==r&&(i.readingFrame=r)}}else{const e=o[r-3];s[t]=e}}}}}(this.header.definedFieldCount,this.header.fieldCount,this.autoSql,this.format);return async function(e,i,r,s,o,n){const a=new _n(e,this.littleEndian);for(;a.remLength()>=13;){const e=a.getInt(),c=await this.chromTree.getNameForId(e),l=a.getInt(),h=a.getInt(),d=a.getString();if(!(e<i||e===i&&h<r)){if(e>s||e===s&&l>=o)break;if(h>0&&c){const e={chr:c,start:l,end:h,value:0};n.push(e);const i=d.split("\t");t&&t(e,i)}}}}}async function El(t,e,i,r,s,o,n,a){const c=new _n(t,a);for(;c.remLength()>=32;){const t=c.getInt(),a=c.getInt(),l=c.getInt(),h=c.getInt(),d=c.getFloat(),u=c.getFloat(),f=c.getFloat();let p;switch(c.getFloat(),n){case"min":p=d;break;case"max":p=u;break;default:p=0===h?0:f/h}if(!(t<e||t===e&&l<i)){if(t>r||t===r&&a>=s)break;if(Number.isFinite(p)){const e=await this.chromTree.getNameForId(t);e&&o.push({chr:e,start:a,end:l,value:p})}}}}class Nl{constructor(t){this.data=t}loadArrayBuffer(t,e){const i=e.range,r=i?this.data.slice(i.start,i.start+i.size):this.data;return Promise.resolve(r)}async dataViewForRange(t,e){const i=Math.min(this.data.byteLength-t.start,t.size);return e?new Uint8Array(this.data,t.start,i):new DataView(this.data,t.start,i)}}var Ml;class Rl extends ll{constructor(t,e){super(e),this.queryable=!0,Ml.set(this,{}),this.windowFunctions=["mean","min","max","none"],this.reader=new Cl(t,e),this.genome=e,this.format=t.format||"bigwig"}async getFeatures({chr:t,start:e,end:i,bpPerPixel:r,windowFunction:s}){await this.reader.loadHeader();const o="bigwig"===this.reader.type;let n;if("all"===t.toLowerCase()){const t=this.genome.wgChromosomeNames;n=o&&t?await this.getWGValues(t,null!=s?s:"mean",r):[]}else n=await this.reader.readFeatures(t,e,t,i,r,s);return o||rc(n),n}async getHeader(){return this.reader.loadHeader()}async defaultVisibilityWindow(){return"bigwig"===this.reader.type?-1:this.reader.featureDensity?Math.floor(1e4/this.reader.featureDensity):-1}async getWGValues(t,e,i){var r;const s=this.genome,o=wo(this,Ml,"f")[e];if(o&&o.bpPerPixel>.8*i&&o.bpPerPixel<1.2*i)return o.values;{const o=await this.reader.readWGFeatures(t,i,e);let n=[];for(let t of o){const e=t.chr,i=null===(r=s.getCumulativeOffset)||void 0===r?void 0:r.call(s,e);if(void 0===i)continue;const o=Object.assign({},t);o.chr="all",o.start=i+t.start,o.end=i+t.end,o._f=t,n.push(o)}return n.sort((t,e)=>t.start-e.start),wo(this,Ml,"f")[e]={values:n,bpPerPixel:i},n}}supportsWholeGenome(){return"bigwig"===this.reader.type}async trackType(){return this.reader.getTrackType()}get searchable(){return this.reader.searchable}async search(t){return this.reader.search(t)}}Ml=new WeakMap;class Dl{constructor(t,e){this.config=t,this.genome=e,this.path=t.url,this.groupCache={},this.datasetCache={}}async readHeader(){if(void 0!==this.magic)return this;let t=await Er.loadArrayBuffer(this.path,Qo(this.config,{range:{start:0,size:64e3}})),e=new _n(new DataView(t));if(this.magic=e.getInt(),this.version=e.getInt(),this.indexPos=e.getLong(),this.indexSize=e.getInt(),e.getInt(),this.version>=2){let t=e.getInt();for(this.windowFunctions=[];t-- >0;)this.windowFunctions.push(e.getString())}this.trackType=e.getString(),this.trackLine=e.getString();let i=e.getInt();for(this.trackNames=[];i-- >0;)this.trackNames.push(e.getString());this.genomeID=e.getString(),this.flags=e.getInt(),this.compressed=!!(1&this.flags),t=await Er.loadArrayBuffer(this.path,Qo(this.config,{range:{start:this.indexPos,size:this.indexSize}})),e=new _n(new DataView(t)),this.datasetIndex={};let r=e.getInt();for(;r-- >0;){const t=e.getString(),i=e.getLong(),r=e.getInt();this.datasetIndex[t]={position:i,size:r}}for(this.groupIndex={},r=e.getInt();r-- >0;){const t=e.getString(),i=e.getLong(),r=e.getInt();this.groupIndex[t]={position:i,size:r}}return this}async readDataset(t,e,i){const r=t+"_"+e+"_"+i;if(this.datasetCache[r])return this.datasetCache[r];{await this.readHeader();const s=this.version<2?"":"/"+e,o="all"===t.toLowerCase()||void 0===i?"0":i.toString();let n;n="raw"===e?"/"+t+"/raw":"/"+t+"/z"+o+s;const a=this.datasetIndex[n];if(void 0===a)return;const c=await Er.loadArrayBuffer(this.path,Qo(this.config,{range:{start:a.position,size:a.size}}));if(!c)return;const l=new _n(new DataView(c));let h=l.getInt();const d={};for(;h-- >0;)d[l.getString()]=l.getString();const u=l.getString(),f=l.getFloat();let p=l.getInt();const g=[];for(;p-- >0;)g.push({position:l.getLong(),size:l.getInt()});const m={name:n,attributes:d,dataType:u,tileWidth:f,tiles:g};return this.datasetCache[r]=m,m}}async readRootGroup(){const t=this.genome,e=this.groupCache["/"];if(e)return e;{const e=await this.readGroup("/"),i=e.chromosomes,r=e.maxZoom;r&&(this.maxZoom=Number(r));const s=e.totalCount;s&&(e.totalCount=Number(s));const o={};return i&&i.split(",").forEach(function(e){const i=t.getChromosomeName(e);o[i]=e}),this.chrAliasTable=o,this.groupCache["/"]=e,e}}async readGroup(t){const e=this.groupCache[t];if(e)return e;{await this.readHeader();const e=this.groupIndex[t];if(void 0===e)return;const i=await Er.loadArrayBuffer(this.path,Qo(this.config,{range:{start:e.position,size:e.size}}));if(!i)return;const r=new _n(new DataView(i)),s={name:t};let o=r.getInt();for(;o-- >0;){const t=r.getString(),e=r.getString();s[t]=e}return this.groupCache[t]=s,s}}async readTiles(t,e){if(t.sort(function(t,e){return t.position-e.position}),0===(t=t.filter(function(t){return t.size>0})).length)return[];const i=[];for(let r of t){const t=await Er.loadArrayBuffer(this.path,Qo(this.config,{range:{start:r.position,size:r.size}}));let s;try{s=this.compressed?Zi(t).buffer:t}catch(t){console.error(t);continue}const o=new _n(new DataView(s)),n=o.getString();let a;switch(n){case"fixedStep":a=Bl(o,e);break;case"variableStep":a=Tl(o,e);break;case"bed":case"bedWithName":a=Ll(o,e,n);break;default:throw"Unknown tile type: "+n}i.push(a)}return i}async readTile(t,e){let i=await Er.loadArrayBuffer(this.path,Qo(this.config,{range:{start:t.position,size:t.size}}));if(this.compressed){i=Zi(i).buffer}const r=new _n(new DataView(i)),s=r.getString();switch(s){case"fixedStep":return Bl(r,e);case"variableStep":return Tl(r,e);case"bed":case"bedWithName":return Ll(r,e,s);default:throw"Unknown tile type: "+s}}}function Bl(t,e){const i=t.getInt(),r=t.getInt(),s=t.getFloat(),o=[];let n=e;for(;n-- >0;){let e=i;const r=[];for(;e-- >0;)r.push(t.getFloat());o.push(r)}return{type:"fixedStep",start:r,span:s,data:o,nTracks:e,nPositions:i}}function Tl(t,e){const i=t.getInt(),r=t.getFloat(),s=t.getInt(),o=[];let n=s;for(;n-- >0;)o.push(t.getInt());t.getInt();const a=[];let c=e;for(;c-- >0;){n=s;const e=[];for(;n-- >0;)e.push(t.getFloat());a.push(e)}return{type:"variableStep",tileStart:i,span:r,start:o,data:a,nTracks:e,nPositions:s}}function Ll(t,e,i){const r=t.getInt();let s=r;const o=[];for(;s-- >0;)o.push(t.getInt());s=r;const n=[];for(;s-- >0;)n.push(t.getInt());t.getInt();const a=[];let c=e;for(;c-- >0;){let e=r;const i=[];for(;e-- >0;)i.push(t.getFloat());a.push(i)}if("bedWithName"===i){s=r;const e=[];for(;s-- >0;)e.push(t.getString())}return{type:i,start:o,end:n,data:a,nTracks:e,nPositions:r}}var zl;class Pl extends ll{constructor(t,e){super(e),zl.set(this,{}),this.searchable=!1,this.genome=e,this.reader=new Dl(t,e),this.queryable=!0}async getFeatures({chr:t,start:e,end:i,bpPerPixel:r,windowFunction:s="mean"}){return"all"===t.toLowerCase()?this.getWGValues(s,r):this._getFeatures(t,e,i,r,s)}async _getFeatures(t,e,i,r,s){const o=new hn(t,e,i,void 0),n=this.genome;if(!this.rootGroup&&(this.rootGroup=await this.reader.readRootGroup(),!this.normalizationFactor)){const t=this.rootGroup.totalCount;t&&(this.normalizationFactor=1e6/t)}o.bpPerPixel=r;const a=function(t,e,i){const r=i.getChromosome(t).bpLength;return Math.ceil(Math.log(Math.max(0,r/(700*e)))/Vl)}(t,r,n);let c=this.reader.chrAliasTable[t],l=this.reader.maxZoom;void 0===c&&(c=t),void 0===l&&(l=-1);const h=a>l?"raw":s,d=await this.reader.readDataset(c,h,a);if(null==d)return[];const u=d.tileWidth,f=Math.floor(e/u),p=Math.floor(i/u),g=await this.reader.readTiles(d.tiles.slice(f,p+1),1),m=[];for(let s of g)switch(s.type){case"bed":Ol(s,t,e,i,r,m);break;case"variableStep":Hl(s,t,e,i,r,m);break;case"fixedStep":Ul(s,t,e,i,r,m);break;default:throw"Unknown tile type: "+s.type}return m.sort(function(t,e){return t.start-e.start}),m}get supportsWholeGenome(){return!0}get windowFunctions(){return this.reader.windowFunctions}async getWGValues(t,e){var i,r;const s=wo(this,zl,"f")[t];if(s&&s.bpPerPixel>.8*e&&s.bpPerPixel<1.2*e)return s.values;{const s=[],o=this.genome;if(this.genome.wgChromosomeNames)for(let n of o.wgChromosomeNames){const a=o.getChromosome(n).bpLength;e=a/1e3;const c=await this._getFeatures(n,0,a,e,t);if(c)for(let t of c){const e=Object.assign({},t);e.chr="all",e.start=null!==(i=o.getGenomeCoordinate(t.chr,t.start))&&void 0!==i?i:0,e.end=null!==(r=o.getGenomeCoordinate(t.chr,t.end))&&void 0!==r?r:0,e._f=t,s.push(e)}}return wo(this,zl,"f")[t]={values:s,bpPerPixel:e},s}}}function Ol(t,e,i,r,s,o){const n=t.nPositions,a=t.start,c=t.end,l=t.data[0];for(let t=0;t<n;t++){const s=a[t],n=c[t];if(!(n<i)){if(s>r)break;o.push({chr:e,start:s,end:n,value:l[t]})}}}function Hl(t,e,i,r,s,o){const n=t.nPositions,a=t.start,c=t.span,l=t.data[0];for(let t=0;t<n;t++){const s=a[t],n=s+c;if(!(n<i)){if(s>r)break;o.push({chr:e,start:s,end:n,value:l[t]})}}}function Ul(t,e,i,r,s,o){const n=t.nPositions;let a=t.start;const c=t.span,l=t.data[0];for(let t=0;t<n;t++){const s=a+c;if(a>r)break;s>=i&&(Number.isNaN(l[t])||o.push({chr:e,start:a,end:s,value:l[t]})),a=s}}zl=new WeakMap;const Vl=Math.log(2);class ql extends ll{constructor(t,e){super(e),this.config=t,this.queryable=!1,this.searchable=!1!==t.searchable,this.updateFeatures(t.features)}updateFeatures(t){oc(t=function(t,e){if(e&&e.getChromosomeName)for(let i of t)i.chr=e.getChromosomeName(i.chr);return t}(t,this.genome)),this.config.mappings&&function(t,e){let i=Object.keys(e);t.forEach(function(t){i.forEach(function(i){t[i]=t[e[i]]})})}(t,this.config.mappings),this.chromAliasManager=this.genome?new al(t.map(t=>t.chr),this.genome):void 0,this.featureCache=new Xn(t),(this.searchable||this.config.searchableFields)&&this.addFeaturesToDB(t,this.config)}async getFeatures({chr:t,start:e,end:i,bpPerPixel:r,visibilityWindow:s}){const o=this.chromAliasManager?await this.chromAliasManager.getAliasName(t):t;return"all"===o.toLowerCase()?await sc(this.featureCache.getAllFeatures(),this.genome,this.chromAliasManager,this.maxWGCount):this.featureCache.queryFeatures(o,e,i)}getAllFeatures(){return this.featureCache.getAllFeatures()}supportsWholeGenome(){return!0}addFeaturesToDB(t,e){this.featureMap||(this.featureMap=new Map);const i=e.searchableFields||["name"];for(let e of t)for(let t of i){let i;if("function"==typeof e.getAttributeValue){const r=e.getAttributeValue(t);i=void 0!==r?String(r):void 0}if(i||(i=e[t]),i){i=i.replace(/ /g,"+");const t=this.featureMap.get(i.toUpperCase());if(t&&t.end-t.start>e.end-e.start)continue;this.featureMap.set(i.toUpperCase(),e)}}}search(t){if(this.featureMap)return this.featureMap.get(t.toUpperCase())}}class Ql{constructor({chr:t,locus:e,accession:i,aliases:r,features:s,sequence:o}){this.chr=t,this.locus=e,this.accession=i,this.aliases=r,this.features=s,this.sequence=o,this.bpLength=o.length}toJSON(){return{gbkURL:this.url}}getSequenceRecord(t){return{chr:this.chr,bpLength:this.bpLength}}get chromosomeNames(){return[this.chr]}getFirstChromosomeName(){return this.chr}get id(){return this.accession}get name(){return this.locus}get initialLocus(){return this.chr}get description(){return this.locus}get infoURL(){return this.url}showWholeGenomeView(){return!1}getHomeChromosomeName(){return this.chr}getChromosomeName(t){return t}getChromosomeDisplayName(t){return this.chr}getChromosome(t){if(t===this.chr)return{name:this.chr,bpLength:this.bpLength}}async loadChromosome(t){return this.getChromosome(t)}async getAliasRecord(t){}getCytobands(t){return[]}getChromosomes(){return[this.getChromosome(this.chr)]}get wgChromosomeNames(){}getGenomeCoordinate(t,e){if(t===this.chr)return e}getChromosomeCoordinate(t){return{chr:this.chr,position:t}}getCumulativeOffset(t){return 0}getGenomeLength(){return this.bpLength}async getSequence(t,e,i){return t===this.chr?this.sequence.substring(e,i):void 0}getSequenceInterval(t,e,i){return t===this.chr?new dn(this.chr,0,this.sequence.length,this.sequence):void 0}}const Gl=/\s+/,Wl=new Map;async function jl(t){let e=Wl.get(t);if(!e){e=function(t){if(!t)return null;const e=Uc(t);let i=e.nextLine();const r=i.split(/\s+/);if("LOCUS"!==r[0].toUpperCase())throw Error("Expected `LOCUS` line. Found: "+i);const s=r[1].trim();let o,n;do{if(i=e.nextLine(),i.startsWith("ACCESSION")){const t=i.split(Gl);if(t.length<2)throw Error("Genbank file missing ACCESSION number.");o=t[1].trim()}else if(i.startsWith("ALIASES")){const t=i.split(Gl);t.length>1&&(n=t[1].split(","))}}while(i&&!i.startsWith("FEATURES"));const a=o||s,c=function(t,e){const i=[];let r,s,o,n=0;for(;;)if(s=e.nextLine(),""!==s){if(!s||s.startsWith("ORIGIN"))break;if(s.length<6)n<10&&console.log("Unexpected line in genbank file (skipping): "+s),n++;else if(" "!==s.charAt(5)){let e=s.substring(5,21).trim();o={chr:t,type:e,attributes:{},getAttributeValue:function(t){return this.attributes[t]}},r=s.substring(21),"source"!==e.toLowerCase()&&i.push(o)}else{let e=s.substring(21).trim();if(e.length>0)if(47===e.charCodeAt(0)){if(47===r.charCodeAt(0)){let t=r.split("=",2);if(t.length>1){let e=t[0].length>1?t[0].substring(1):"",i=Kl(t[1]);o.attributes[e]=i}}else{const e=r.includes("complement")?"-":"+";o.strand=e;let i=r.replace("join","").replace("order","").replace("complement","").replace("(","").replace(")","");if(i.includes("..")){i=i.replace("<","").replace(">","");const r=$l(i,t,e),s=r[0];o.start=s.start;const n=r[r.length-1];o.end=n.end,r.length>1&&(o.exons=r)}else o.start=parseInt(i)-1,o.end=o.start+1}r=e}else r+=e}}return i}(a,e),l=function(t){let e,i="";for(;(e=t.nextLine())&&!e.startsWith("//");){e=e.trim();const t=e.split(/\s+/);for(let e=1;e<t.length;e++)i+=t[e]}return i}(e);return new Ql({chr:a,locus:s,accession:null!=o?o:s,aliases:n,features:c,sequence:l})}(await Er.loadString(t,{})),e.url=t,Wl.set(t,e)}return e}function $l(t,e,i){const r=t.split(","),s=[];for(const t of r){const r=t.split("..");let o=0;try{o=parseInt(r[0])-1}catch(t){console.error(t)}let n=o+1;r.length>1&&(n=parseInt(r[1])),s.push({chr:e,start:o,end:n,strand:i})}return s.sort(function(t,e){return t.start-e.start}),s}function Kl(t){return t.startsWith('"')&&t.endsWith('"')&&(t=t.substring(1,t.length-1)),t}class Zl extends ll{constructor(t,e){super(e),this.config=t,this.searchable=!0}async getFeatures({chr:t,start:e,end:i,bpPerPixel:r,visibilityWindow:s}){if(!this.featureSource){const t=await jl(this.config.url);this.featureSource=new ql({genome:this.config.genome,features:t.features,searchableFields:["gene","db_xref","locus_tag","transcript_id"]},void 0)}return this.featureSource.getFeatures({chr:t,start:e,end:i})}supportsWholeGenome(){return!1}search(t){var e;return null===(e=this.featureSource)||void 0===e?void 0:e.search(t)}}class Yl extends ll{constructor(t,e,i){super(e),this.config=t,this.featureSourceFactory=i,this.featureSourceMap=null,this.header=null}async getHeader(){if(!this.header){this.featureSourceMap||await this.init();const t=this.featureSourceMap.values().next().value;t&&t.getHeader?this.header=t.getHeader():this.header=Promise.resolve(void 0)}return this.header}async getFeatures({chr:t,start:e,end:i,bpPerPixel:r,visibilityWindow:s}){this.featureSourceMap||await this.init();const o=this.featureSourceMap.get(t);return o?o.getFeatures({chr:t,start:e,end:i,bpPerPixel:r,visibilityWindow:s}):[]}async init(){this.featureSourceMap=new Map;const t=Qo(this.config),e=Uc(await Er.loadByteArray(this.config.url,t));let i;for(;void 0!==(i=e.nextLine());){const t=i.trim();if(!t.startsWith("#")){const e=t.split(/\s+/);if(e.length>1){const t=e[0],i=e[1],r=Object.assign({},this.config);r.url=i,i.endsWith(".vcf.gz")&&(r.format="vcf",r.indexURL=i+".tbi"),this.featureSourceMap.set(t,this.featureSourceFactory(r,this.genome))}}}}supportWholeGenome(){return!1}}var Xl={Huffman:{},Util:{},CRC32:{},CompressionMethod:{DEFLATE:8,RESERVED:15},Zip:function(t){t=t||{},this.files=[],this.comment=t.comment,this.password}};Xl.Zip.CompressionMethod={STORE:0,DEFLATE:8},Xl.Zip.OperatingSystem={MSDOS:0,UNIX:3,MACINTOSH:7},Xl.Zip.Flags={ENCRYPT:1,DESCRIPTOR:8,UTF8:2048},Xl.Zip.FileHeaderSignature=[80,75,1,2],Xl.Zip.LocalFileHeaderSignature=[80,75,3,4],Xl.Zip.CentralDirectorySignature=[80,75,5,6],Xl.Zip.prototype.addFile=function(t,e){var i;(e=e||{}).filename;var r=t.length,s=0;if(t instanceof Array&&(t=new Uint8Array(t)),"number"!=typeof e.compressionMethod&&(e.compressionMethod=Xl.Zip.CompressionMethod.DEFLATE),e.compress)switch(e.compressionMethod){case Xl.Zip.CompressionMethod.STORE:break;case Xl.Zip.CompressionMethod.DEFLATE:s=Xl.CRC32.calc(t),t=this.deflateWithOption(t,e),i=!0;break;default:throw new Error("unknown compression method:"+e.compressionMethod)}this.files.push({buffer:t,option:e,compressed:i,encrypted:!1,size:r,crc32:s})},Xl.Zip.prototype.setPassword=function(t){this.password=t},Xl.Zip.prototype.compress=function(){var t,e,i,r,s,o,n,a,c,l,h,d,u,f,p,g,m,w,b,F,v,y,A,C,_,x,k=this.files,I=0,S=0;for(A=0,C=k.length;A<C;++A){if(f=(t=k[A]).option.filename?t.option.filename.length:0,p=t.option.extraField?t.option.extraField.length:0,g=t.option.comment?t.option.comment.length:0,!t.compressed)switch(t.crc32=Xl.CRC32.calc(t.buffer),t.option.compressionMethod){case Xl.Zip.CompressionMethod.STORE:break;case Xl.Zip.CompressionMethod.DEFLATE:t.buffer=this.deflateWithOption(t.buffer,t.option),t.compressed=!0;break;default:throw new Error("unknown compression method:"+t.option.compressionMethod)}if(void 0!==t.option.password||void 0!==this.password){for(y=this.createEncryptionKey(t.option.password||this.password),F=t.buffer,(v=new Uint8Array(F.length+12)).set(F,12),F=v,_=0;_<12;++_)F[_]=this.encode(y,11===A?255&t.crc32:256*Math.random()|0);for(x=F.length;_<x;++_)F[_]=this.encode(y,F[_]);t.buffer=F}I+=30+f+t.buffer.length,S+=46+f+g}for(o=22+(this.comment?this.comment.length:0),e=new Uint8Array(I+S+o),i=0,s=(r=I)+S,A=0,C=k.length;A<C;++A)f=(t=k[A]).option.filename?t.option.filename.length:0,p=0,g=t.option.comment?t.option.comment.length:0,n=i,e[i++]=Xl.Zip.LocalFileHeaderSignature[0],e[i++]=Xl.Zip.LocalFileHeaderSignature[1],e[i++]=Xl.Zip.LocalFileHeaderSignature[2],e[i++]=Xl.Zip.LocalFileHeaderSignature[3],e[r++]=Xl.Zip.FileHeaderSignature[0],e[r++]=Xl.Zip.FileHeaderSignature[1],e[r++]=Xl.Zip.FileHeaderSignature[2],e[r++]=Xl.Zip.FileHeaderSignature[3],e[r++]=20,e[r++]=t.option.os||Xl.Zip.OperatingSystem.MSDOS,e[i++]=e[r++]=20,e[i++]=e[r++]=0,a=0,(t.option.password||this.password)&&(a|=Xl.Zip.Flags.ENCRYPT),e[i++]=e[r++]=255&a,e[i++]=e[r++]=a>>8&255,c=t.option.compressionMethod,e[i++]=e[r++]=255&c,e[i++]=e[r++]=c>>8&255,l=t.option.date||new Date,e[i++]=e[r++]=(7&l.getMinutes())<<5|l.getSeconds()/2,e[i++]=e[r++]=l.getHours()<<3|l.getMinutes()>>3,e[i++]=e[r++]=(l.getMonth()+1&7)<<5|l.getDate(),e[i++]=e[r++]=(l.getFullYear()-1980&127)<<1|l.getMonth()+1>>3,h=t.crc32,e[i++]=e[r++]=255&h,e[i++]=e[r++]=h>>8&255,e[i++]=e[r++]=h>>16&255,e[i++]=e[r++]=h>>24&255,d=t.buffer.length,e[i++]=e[r++]=255&d,e[i++]=e[r++]=d>>8&255,e[i++]=e[r++]=d>>16&255,e[i++]=e[r++]=d>>24&255,u=t.size,e[i++]=e[r++]=255&u,e[i++]=e[r++]=u>>8&255,e[i++]=e[r++]=u>>16&255,e[i++]=e[r++]=u>>24&255,e[i++]=e[r++]=255&f,e[i++]=e[r++]=f>>8&255,e[i++]=e[r++]=255&p,e[i++]=e[r++]=p>>8&255,e[r++]=255&g,e[r++]=g>>8&255,e[r++]=0,e[r++]=0,e[r++]=0,e[r++]=0,e[r++]=0,e[r++]=0,e[r++]=0,e[r++]=0,e[r++]=255&n,e[r++]=n>>8&255,e[r++]=n>>16&255,e[r++]=n>>24&255,(m=t.option.filename)&&(e.set(m,i),e.set(m,r),i+=f,r+=f),(w=t.option.extraField)&&(e.set(w,i),e.set(w,r),i+=p,r+=p),(b=t.option.comment)&&(e.set(b,r),r+=g),e.set(t.buffer,i),i+=t.buffer.length;return e[s++]=Xl.Zip.CentralDirectorySignature[0],e[s++]=Xl.Zip.CentralDirectorySignature[1],e[s++]=Xl.Zip.CentralDirectorySignature[2],e[s++]=Xl.Zip.CentralDirectorySignature[3],e[s++]=0,e[s++]=0,e[s++]=0,e[s++]=0,e[s++]=255&C,e[s++]=C>>8&255,e[s++]=255&C,e[s++]=C>>8&255,e[s++]=255&S,e[s++]=S>>8&255,e[s++]=S>>16&255,e[s++]=S>>24&255,e[s++]=255&I,e[s++]=I>>8&255,e[s++]=I>>16&255,e[s++]=I>>24&255,g=this.comment?this.comment.length:0,e[s++]=255&g,e[s++]=g>>8&255,this.comment&&(e.set(this.comment,s),s+=g),e},Xl.Zip.prototype.deflateWithOption=function(t,e){return new Xl.RawDeflate(t,e.deflateOption).compress()},Xl.Zip.prototype.getByte=function(t){var e=65535&t[2]|2;return e*(1^e)>>8&255},Xl.Zip.prototype.encode=function(t,e){var i=this.getByte(t);return this.updateKeys(t,e),i^e},Xl.Zip.prototype.updateKeys=function(t,e){t[0]=Xl.CRC32.single(t[0],e),t[1]=(6681*(20173*(t[1]+(255&t[0]))>>>0)>>>0)+1>>>0,t[2]=Xl.CRC32.single(t[2],t[1]>>>24)},Xl.Zip.prototype.createEncryptionKey=function(t){var e,i,r=[305419896,591751049,878082192];for(r=new Uint32Array(r),e=0,i=t.length;e<i;++e)this.updateKeys(r,255&t[e]);return r},Xl.Huffman.buildHuffmanTable=function(t){var e,i,r,s,o,n,a,c,l,h,d,u=t.length,f=0,p=Number.POSITIVE_INFINITY;for(c=0,l=u;c<l;++c)t[c]>f&&(f=t[c]),t[c]<p&&(p=t[c]);for(e=1<<f,i=new Uint32Array(e),r=1,s=0,o=2;r<=f;){for(c=0;c<u;++c)if(t[c]===r){for(n=0,a=s,h=0;h<r;++h)n=n<<1|1&a,a>>=1;for(d=r<<16|c,h=n;h<e;h+=o)i[h]=d;++s}++r,s<<=1,o<<=1}return[i,f,p]};var Jl=Xl.Huffman.buildHuffmanTable;Xl.RawInflate=function(t,e){switch(this.buffer,this.blocks=[],this.bufferSize=32768,this.totalpos=0,this.ip=0,this.bitsbuf=0,this.bitsbuflen=0,this.input=new Uint8Array(t),this.output,this.op,this.bfinal=!1,this.bufferType=Xl.RawInflate.BufferType.ADAPTIVE,this.resize=!1,!e&&(e={})||(e.index&&(this.ip=e.index),e.bufferSize&&(this.bufferSize=e.bufferSize),e.bufferType&&(this.bufferType=e.bufferType),e.resize&&(this.resize=e.resize)),this.bufferType){case Xl.RawInflate.BufferType.BLOCK:this.op=Xl.RawInflate.MaxBackwardLength,this.output=new Uint8Array(Xl.RawInflate.MaxBackwardLength+this.bufferSize+Xl.RawInflate.MaxCopyLength);break;case Xl.RawInflate.BufferType.ADAPTIVE:this.op=0,this.output=new Uint8Array(this.bufferSize);break;default:throw new Error("invalid inflate mode")}},Xl.RawInflate.BufferType={BLOCK:0,ADAPTIVE:1},Xl.RawInflate.prototype.decompress=function(){for(;!this.bfinal;)this.parseBlock();switch(this.bufferType){case Xl.RawInflate.BufferType.BLOCK:return this.concatBufferBlock();case Xl.RawInflate.BufferType.ADAPTIVE:return this.concatBufferDynamic();default:throw new Error("invalid inflate mode")}},Xl.RawInflate.MaxBackwardLength=32768,Xl.RawInflate.MaxCopyLength=258,Xl.RawInflate.Order=new Uint16Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xl.RawInflate.LengthCodeTable=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258]),Xl.RawInflate.LengthExtraTable=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0]),Xl.RawInflate.DistCodeTable=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577]),Xl.RawInflate.DistExtraTable=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Xl.RawInflate.FixedLiteralLengthTable=function(){var t,e,i=new Uint8Array(288);for(t=0,e=i.length;t<e;++t)i[t]=t<=143?8:t<=255?9:t<=279?7:8;return Jl(i)}(),Xl.RawInflate.FixedDistanceTable=function(){var t,e,i=new Uint8Array(30);for(t=0,e=i.length;t<e;++t)i[t]=5;return Jl(i)}(),Xl.RawInflate.prototype.parseBlock=function(){var t=this.readBits(3);switch(1&t&&(this.bfinal=!0),t>>>=1){case 0:this.parseUncompressedBlock();break;case 1:this.parseFixedHuffmanBlock();break;case 2:this.parseDynamicHuffmanBlock();break;default:throw new Error("unknown BTYPE: "+t)}},Xl.RawInflate.prototype.readBits=function(t){var e,i=this.bitsbuf,r=this.bitsbuflen,s=this.input,o=this.ip;if(o+(t-r+7>>3)>=s.length)throw new Error("input buffer is broken");for(;r<t;)i|=s[o++]<<r,r+=8;return e=i&(1<<t)-1,i>>>=t,r-=t,this.bitsbuf=i,this.bitsbuflen=r,this.ip=o,e},Xl.RawInflate.prototype.readCodeByTable=function(t){for(var e,i,r=this.bitsbuf,s=this.bitsbuflen,o=this.input,n=this.ip,a=o.length,c=t[0],l=t[1];s<l&&!(n>=a);)r|=o[n++]<<s,s+=8;if((i=(e=c[r&(1<<l)-1])>>>16)>s)throw new Error("invalid code length: "+i);return this.bitsbuf=r>>i,this.bitsbuflen=s-i,this.ip=n,65535&e},Xl.RawInflate.prototype.parseUncompressedBlock=function(){var t,e,i=this.input,r=this.ip,s=this.output,o=this.op,n=i.length,a=s.length;if(this.bitsbuf=0,this.bitsbuflen=0,r+1>=n)throw new Error("invalid uncompressed block header: LEN");if(t=i[r++]|i[r++]<<8,r+1>=n)throw new Error("invalid uncompressed block header: NLEN");if(t===~(i[r++]|i[r++]<<8))throw new Error("invalid uncompressed block header: length verify");if(r+t>i.length)throw new Error("input buffer is broken");switch(this.bufferType){case Xl.RawInflate.BufferType.BLOCK:for(;o+t>s.length;)t-=e=a-o,s.set(i.subarray(r,r+e),o),o+=e,r+=e,this.op=o,s=this.expandBufferBlock(),o=this.op;break;case Xl.RawInflate.BufferType.ADAPTIVE:for(;o+t>s.length;)s=this.expandBufferAdaptive({fixRatio:2});break;default:throw new Error("invalid inflate mode")}s.set(i.subarray(r,r+t),o),o+=t,r+=t,this.ip=r,this.op=o,this.output=s},Xl.RawInflate.prototype.parseFixedHuffmanBlock=function(){switch(this.bufferType){case Xl.RawInflate.BufferType.ADAPTIVE:this.decodeHuffmanAdaptive(Xl.RawInflate.FixedLiteralLengthTable,Xl.RawInflate.FixedDistanceTable);break;case Xl.RawInflate.BufferType.BLOCK:this.decodeHuffmanBlock(Xl.RawInflate.FixedLiteralLengthTable,Xl.RawInflate.FixedDistanceTable);break;default:throw new Error("invalid inflate mode")}},Xl.RawInflate.prototype.parseDynamicHuffmanBlock=function(){var t,e,i,r,s,o,n,a,c,l=this.readBits(5)+257,h=this.readBits(5)+1,d=this.readBits(4)+4,u=new Uint8Array(Xl.RawInflate.Order.length);for(a=0;a<d;++a)u[Xl.RawInflate.Order[a]]=this.readBits(3);for(t=Jl(u),r=new Uint8Array(l+h),a=0,c=l+h;a<c;)switch(s=this.readCodeByTable(t)){case 16:for(n=3+this.readBits(2);n--;)r[a++]=o;break;case 17:for(n=3+this.readBits(3);n--;)r[a++]=0;o=0;break;case 18:for(n=11+this.readBits(7);n--;)r[a++]=0;o=0;break;default:r[a++]=s,o=s}switch(e=Jl(r.subarray(0,l)),i=Jl(r.subarray(l)),this.bufferType){case Xl.RawInflate.BufferType.ADAPTIVE:this.decodeHuffmanAdaptive(e,i);break;case Xl.RawInflate.BufferType.BLOCK:this.decodeHuffmanBlock(e,i);break;default:throw new Error("invalid inflate mode")}},Xl.RawInflate.prototype.decodeHuffmanBlock=function(t,e){var i=this.output,r=this.op;this.currentLitlenTable=t;for(var s,o,n,a,c=i.length-Xl.RawInflate.MaxCopyLength,l=Xl.RawInflate.LengthCodeTable,h=Xl.RawInflate.LengthExtraTable,d=Xl.RawInflate.DistCodeTable,u=Xl.RawInflate.DistExtraTable;256!==(s=this.readCodeByTable(t));)if(s<256)r>=c&&(this.op=r,i=this.expandBufferBlock(),r=this.op),i[r++]=s;else for(a=l[o=s-257],h[o]>0&&(a+=this.readBits(h[o])),n=d[s=this.readCodeByTable(e)],u[s]>0&&(n+=this.readBits(u[s])),r>=c&&(this.op=r,i=this.expandBufferBlock(),r=this.op);a--;)i[r]=i[r++-n];for(;this.bitsbuflen>=8;)this.bitsbuflen-=8,this.ip--;this.op=r},Xl.RawInflate.prototype.decodeHuffmanAdaptive=function(t,e){var i=this.output,r=this.op;this.currentLitlenTable=t;for(var s,o,n,a,c=i.length,l=Xl.RawInflate.LengthCodeTable,h=Xl.RawInflate.LengthExtraTable,d=Xl.RawInflate.DistCodeTable,u=Xl.RawInflate.DistExtraTable;256!==(s=this.readCodeByTable(t));)if(s<256)r>=c&&(c=(i=this.expandBufferAdaptive()).length),i[r++]=s;else for(a=l[o=s-257],h[o]>0&&(a+=this.readBits(h[o])),n=d[s=this.readCodeByTable(e)],u[s]>0&&(n+=this.readBits(u[s])),r+a>c&&(c=(i=this.expandBufferAdaptive()).length);a--;)i[r]=i[r++-n];for(;this.bitsbuflen>=8;)this.bitsbuflen-=8,this.ip--;this.op=r},Xl.RawInflate.prototype.expandBufferBlock=function(t){var e=new Uint8Array(this.op-Xl.RawInflate.MaxBackwardLength),i=this.op-Xl.RawInflate.MaxBackwardLength,r=this.output;return e.set(r.subarray(Xl.RawInflate.MaxBackwardLength,e.length)),this.blocks.push(e),this.totalpos+=e.length,r.set(r.subarray(i,i+Xl.RawInflate.MaxBackwardLength)),this.op=Xl.RawInflate.MaxBackwardLength,r},Xl.RawInflate.prototype.expandBufferAdaptive=function(t){var e,i,r,s=this.input.length/this.ip+1|0,o=this.input,n=this.output;return t&&("number"==typeof t.fixRatio&&(s=t.fixRatio),"number"==typeof t.addRatio&&(s+=t.addRatio)),i=s<2?(r=(o.length-this.ip)/this.currentLitlenTable[2]/2*258|0)<n.length?n.length+r:n.length<<1:n.length*s,(e=new Uint8Array(i)).set(n),this.output=e,this.output},Xl.RawInflate.prototype.concatBufferBlock=function(){var t,e,i,r,s,o=0,n=this.totalpos+(this.op-Xl.RawInflate.MaxBackwardLength),a=this.output,c=this.blocks,l=new Uint8Array(n);if(0===c.length)return this.output.subarray(Xl.RawInflate.MaxBackwardLength,this.op);for(e=0,i=c.length;e<i;++e)for(r=0,s=(t=c[e]).length;r<s;++r)l[o++]=t[r];for(e=Xl.RawInflate.MaxBackwardLength,i=this.op;e<i;++e)l[o++]=a[e];return this.blocks=[],this.buffer=l,this.buffer},Xl.RawInflate.prototype.concatBufferDynamic=function(){var t,e=this.op;return this.resize?(t=new Uint8Array(e)).set(this.output.subarray(0,e)):t=this.output.subarray(0,e),this.buffer=t,this.buffer};var th;Jl=Xl.Huffman.buildHuffmanTable;Xl.RawInflateStream=function(t,e,i){this.blocks=[],this.bufferSize=i||ZLIB_STREAM_RAW_INFLATE_BUFFER_SIZE,this.totalpos=0,this.ip=void 0===e?0:e,this.bitsbuf=0,this.bitsbuflen=0,this.input=new Uint8Array(t),this.output=new Uint8Array(this.bufferSize),this.op=0,this.bfinal=!1,this.blockLength,this.resize=!1,this.litlenTable,this.distTable,this.sp=0,this.status=Xl.RawInflateStream.Status.INITIALIZED,this.ip_,this.bitsbuflen_,this.bitsbuf_},Xl.RawInflateStream.BlockType={UNCOMPRESSED:0,FIXED:1,DYNAMIC:2},Xl.RawInflateStream.Status={INITIALIZED:0,BLOCK_HEADER_START:1,BLOCK_HEADER_END:2,BLOCK_BODY_START:3,BLOCK_BODY_END:4,DECODE_BLOCK_START:5,DECODE_BLOCK_END:6},Xl.RawInflateStream.prototype.decompress=function(t,e){var i=!1;for(void 0!==t&&(this.input=t),void 0!==e&&(this.ip=e);!i;)switch(this.status){case Xl.RawInflateStream.Status.INITIALIZED:case Xl.RawInflateStream.Status.BLOCK_HEADER_START:this.readBlockHeader()<0&&(i=!0);break;case Xl.RawInflateStream.Status.BLOCK_HEADER_END:case Xl.RawInflateStream.Status.BLOCK_BODY_START:switch(this.currentBlockType){case Xl.RawInflateStream.BlockType.UNCOMPRESSED:this.readUncompressedBlockHeader()<0&&(i=!0);break;case Xl.RawInflateStream.BlockType.FIXED:this.parseFixedHuffmanBlock()<0&&(i=!0);break;case Xl.RawInflateStream.BlockType.DYNAMIC:this.parseDynamicHuffmanBlock()<0&&(i=!0)}break;case Xl.RawInflateStream.Status.BLOCK_BODY_END:case Xl.RawInflateStream.Status.DECODE_BLOCK_START:switch(this.currentBlockType){case Xl.RawInflateStream.BlockType.UNCOMPRESSED:this.parseUncompressedBlock()<0&&(i=!0);break;case Xl.RawInflateStream.BlockType.FIXED:case Xl.RawInflateStream.BlockType.DYNAMIC:this.decodeHuffman()<0&&(i=!0)}break;case Xl.RawInflateStream.Status.DECODE_BLOCK_END:this.bfinal?i=!0:this.status=Xl.RawInflateStream.Status.INITIALIZED}return this.concatBuffer()},Xl.RawInflateStream.MaxBackwardLength=32768,Xl.RawInflateStream.MaxCopyLength=258,Xl.RawInflateStream.Order=new Uint16Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xl.RawInflateStream.LengthCodeTable=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258]),Xl.RawInflateStream.LengthExtraTable=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0]),Xl.RawInflateStream.DistCodeTable=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577]),Xl.RawInflateStream.DistExtraTable=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Xl.RawInflateStream.FixedLiteralLengthTable=function(){var t,e,i=new Uint8Array(288);for(t=0,e=i.length;t<e;++t)i[t]=t<=143?8:t<=255?9:t<=279?7:8;return Jl(i)}(),Xl.RawInflateStream.FixedDistanceTable=function(){var t,e,i=new Uint8Array(30);for(t=0,e=i.length;t<e;++t)i[t]=5;return Jl(i)}(),Xl.RawInflateStream.prototype.readBlockHeader=function(){var t;if(this.status=Xl.RawInflateStream.Status.BLOCK_HEADER_START,this.save_(),(t=this.readBits(3))<0)return this.restore_(),-1;switch(1&t&&(this.bfinal=!0),t>>>=1){case 0:this.currentBlockType=Xl.RawInflateStream.BlockType.UNCOMPRESSED;break;case 1:this.currentBlockType=Xl.RawInflateStream.BlockType.FIXED;break;case 2:this.currentBlockType=Xl.RawInflateStream.BlockType.DYNAMIC;break;default:throw new Error("unknown BTYPE: "+t)}this.status=Xl.RawInflateStream.Status.BLOCK_HEADER_END},Xl.RawInflateStream.prototype.readBits=function(t){for(var e,i=this.bitsbuf,r=this.bitsbuflen,s=this.input,o=this.ip;r<t;){if(s.length<=o)return-1;i|=(e=s[o++])<<r,r+=8}return e=i&(1<<t)-1,i>>>=t,r-=t,this.bitsbuf=i,this.bitsbuflen=r,this.ip=o,e},Xl.RawInflateStream.prototype.readCodeByTable=function(t){for(var e,i,r=this.bitsbuf,s=this.bitsbuflen,o=this.input,n=this.ip,a=t[0],c=t[1];s<c;){if(o.length<=n)return-1;r|=o[n++]<<s,s+=8}if((i=(e=a[r&(1<<c)-1])>>>16)>s)throw new Error("invalid code length: "+i);return this.bitsbuf=r>>i,this.bitsbuflen=s-i,this.ip=n,65535&e},Xl.RawInflateStream.prototype.readUncompressedBlockHeader=function(){var t,e=this.input,i=this.ip;if(this.status=Xl.RawInflateStream.Status.BLOCK_BODY_START,i+4>=e.length)return-1;if((t=e[i++]|e[i++]<<8)===~(e[i++]|e[i++]<<8))throw new Error("invalid uncompressed block header: length verify");this.bitsbuf=0,this.bitsbuflen=0,this.ip=i,this.blockLength=t,this.status=Xl.RawInflateStream.Status.BLOCK_BODY_END},Xl.RawInflateStream.prototype.parseUncompressedBlock=function(){var t=this.input,e=this.ip,i=this.output,r=this.op,s=this.blockLength;for(this.status=Xl.RawInflateStream.Status.DECODE_BLOCK_START;s--;){if(r===i.length&&(i=this.expandBuffer({fixRatio:2})),e>=t.length)return this.ip=e,this.op=r,this.blockLength=s+1,-1;i[r++]=t[e++]}return s<0&&(this.status=Xl.RawInflateStream.Status.DECODE_BLOCK_END),this.ip=e,this.op=r,0},Xl.RawInflateStream.prototype.parseFixedHuffmanBlock=function(){return this.status=Xl.RawInflateStream.Status.BLOCK_BODY_START,this.litlenTable=Xl.RawInflateStream.FixedLiteralLengthTable,this.distTable=Xl.RawInflateStream.FixedDistanceTable,this.status=Xl.RawInflateStream.Status.BLOCK_BODY_END,0},Xl.RawInflateStream.prototype.save_=function(){this.ip_=this.ip,this.bitsbuflen_=this.bitsbuflen,this.bitsbuf_=this.bitsbuf},Xl.RawInflateStream.prototype.restore_=function(){this.ip=this.ip_,this.bitsbuflen=this.bitsbuflen_,this.bitsbuf=this.bitsbuf_},Xl.RawInflateStream.prototype.parseDynamicHuffmanBlock=function(){var t,e,i,r,s=new Uint8Array(Xl.RawInflateStream.Order.length);if(this.status=Xl.RawInflateStream.Status.BLOCK_BODY_START,this.save_(),t=this.readBits(5)+257,e=this.readBits(5)+1,i=this.readBits(4)+4,t<0||e<0||i<0)return this.restore_(),-1;try{(function(){var o,n,a,c,l,h,d=0;for(l=0;l<i;++l){if((o=this.readBits(3))<0)throw new Error("not enough input");s[Xl.RawInflateStream.Order[l]]=o}for(r=Jl(s),c=new Uint8Array(t+e),l=0,h=t+e;l<h;){if((n=this.readCodeByTable(r))<0)throw new Error("not enough input");switch(n){case 16:if((o=this.readBits(2))<0)throw new Error("not enough input");for(a=3+o;a--;)c[l++]=d;break;case 17:if((o=this.readBits(3))<0)throw new Error("not enough input");for(a=3+o;a--;)c[l++]=0;d=0;break;case 18:if((o=this.readBits(7))<0)throw new Error("not enough input");for(a=11+o;a--;)c[l++]=0;d=0;break;default:c[l++]=n,d=n}}this.litlenTable=Jl(c.subarray(0,t)),this.distTable=Jl(c.subarray(t))}).call(this)}catch(t){return this.restore_(),-1}return this.status=Xl.RawInflateStream.Status.BLOCK_BODY_END,0},Xl.RawInflateStream.prototype.decodeHuffman=function(){var t,e,i,r,s,o=this.output,n=this.op,a=this.litlenTable,c=this.distTable,l=o.length;for(this.status=Xl.RawInflateStream.Status.DECODE_BLOCK_START;;){if(this.save_(),(t=this.readCodeByTable(a))<0)return this.op=n,this.restore_(),-1;if(256===t)break;if(t<256)n===l&&(l=(o=this.expandBuffer()).length),o[n++]=t;else{if(e=t-257,r=Xl.RawInflateStream.LengthCodeTable[e],Xl.RawInflateStream.LengthExtraTable[e]>0){if((s=this.readBits(Xl.RawInflateStream.LengthExtraTable[e]))<0)return this.op=n,this.restore_(),-1;r+=s}if((t=this.readCodeByTable(c))<0)return this.op=n,this.restore_(),-1;if(i=Xl.RawInflateStream.DistCodeTable[t],Xl.RawInflateStream.DistExtraTable[t]>0){if((s=this.readBits(Xl.RawInflateStream.DistExtraTable[t]))<0)return this.op=n,this.restore_(),-1;i+=s}for(n+r>=l&&(l=(o=this.expandBuffer()).length);r--;)o[n]=o[n++-i];if(this.ip===this.input.length)return this.op=n,-1}}for(;this.bitsbuflen>=8;)this.bitsbuflen-=8,this.ip--;this.op=n,this.status=Xl.RawInflateStream.Status.DECODE_BLOCK_END},Xl.RawInflateStream.prototype.expandBuffer=function(t){var e,i,r,s=this.input.length/this.ip+1|0,o=this.input,n=this.output;return t&&("number"==typeof t.fixRatio&&(s=t.fixRatio),"number"==typeof t.addRatio&&(s+=t.addRatio)),i=s<2?(r=(o.length-this.ip)/this.litlenTable[2]/2*258|0)<n.length?n.length+r:n.length<<1:n.length*s,(e=new Uint8Array(i)).set(n),this.output=e,this.output},Xl.RawInflateStream.prototype.concatBuffer=function(){var t,e,i=this.op;return t=this.resize?new Uint8Array(this.output.subarray(this.sp,i)):this.output.subarray(this.sp,i),this.sp=i,i>Xl.RawInflateStream.MaxBackwardLength+this.bufferSize&&(this.op=this.sp=Xl.RawInflateStream.MaxBackwardLength,e=this.output,this.output=new Uint8Array(this.bufferSize+Xl.RawInflateStream.MaxBackwardLength),this.output.set(e.subarray(i-Xl.RawInflateStream.MaxBackwardLength,i))),t},Xl.Inflate=function(t,e){var i,r;if(this.input=t,this.ip=0,this.rawinflate,this.verify,!e&&(e={})||(e.index&&(this.ip=e.index),e.verify&&(this.verify=e.verify)),i=t[this.ip++],r=t[this.ip++],(15&i)!==Xl.CompressionMethod.DEFLATE)throw new Error("unsupported compression method");if(this.method=Xl.CompressionMethod.DEFLATE,((i<<8)+r)%31!=0)throw new Error("invalid fcheck flag:"+((i<<8)+r)%31);if(32&r)throw new Error("fdict flag is not supported");this.rawinflate=new Xl.RawInflate(t,{index:this.ip,bufferSize:e.bufferSize,bufferType:e.bufferType,resize:e.resize})},Xl.Inflate.BufferType=Xl.RawInflate.BufferType,Xl.Inflate.prototype.decompress=function(){var t,e=this.input;if(t=this.rawinflate.decompress(),this.ip=this.rawinflate.ip,this.verify&&(e[this.ip++]<<24|e[this.ip++]<<16|e[this.ip++]<<8|e[this.ip++])>>>0!==Xl.Adler32(t))throw new Error("invalid adler-32 checksum");return t},Xl.InflateStream=function(t){this.input=void 0===t?new Uint8Array:t,this.ip=0,this.rawinflate=new Xl.RawInflateStream(this.input,this.ip),this.method,this.output=this.rawinflate.output},Xl.InflateStream.prototype.decompress=function(t){var e;if(void 0!==t){var i=new Uint8Array(this.input.length+t.length);i.set(this.input,0),i.set(t,this.input.length),this.input=i}return void 0===this.method&&this.readHeader()<0?new Uint8Array:(e=this.rawinflate.decompress(this.input,this.ip),0!==this.rawinflate.ip&&(this.input=this.input.subarray(this.rawinflate.ip),this.ip=0),e)},Xl.InflateStream.prototype.readHeader=function(){var t=this.ip,e=this.input,i=e[t++],r=e[t++];if(void 0===i||void 0===r)return-1;if((15&i)!==Xl.CompressionMethod.DEFLATE)throw new Error("unsupported compression method");if(this.method=Xl.CompressionMethod.DEFLATE,((i<<8)+r)%31!=0)throw new Error("invalid fcheck flag:"+((i<<8)+r)%31);if(32&r)throw new Error("fdict flag is not supported");this.ip=t},Xl.Gunzip=function(t,e){this.input=t,this.ip=0,this.member=[],this.decompressed=!1},Xl.Gunzip.prototype.getMembers=function(){return this.decompressed||this.decompress(),this.member.slice()},Xl.Gunzip.prototype.decompress=function(){for(var t=this.input.length;this.ip<t;)this.decodeMember();return this.decompressed=!0,this.concatMember()},Xl.Gunzip.prototype.decodeMember=function(){var t,e,i,r,s,o,n,a,c,l=new Xl.GunzipMember,h=this.input,d=this.ip;if(l.id1=h[d++],l.id2=h[d++],31!==l.id1||139!==l.id2)throw new Error("invalid file signature:"+l.id1+","+l.id2);if(l.cm=h[d++],8!==l.cm)throw new Error("unknown compression method: "+l.cm);if(l.flg=h[d++],a=h[d++]|h[d++]<<8|h[d++]<<16|h[d++]<<24,l.mtime=new Date(1e3*a),l.xfl=h[d++],l.os=h[d++],(l.flg&Xl.Gzip.FlagsMask.FEXTRA)>0&&(l.xlen=h[d++]|h[d++]<<8,d=this.decodeSubField(d,l.xlen)),(l.flg&Xl.Gzip.FlagsMask.FNAME)>0){for(n=[],o=0;(s=h[d++])>0;)n[o++]=String.fromCharCode(s);l.name=n.join("")}if((l.flg&Xl.Gzip.FlagsMask.FCOMMENT)>0){for(n=[],o=0;(s=h[d++])>0;)n[o++]=String.fromCharCode(s);l.comment=n.join("")}if((l.flg&Xl.Gzip.FlagsMask.FHCRC)>0&&(l.crc16=65535&Xl.CRC32.calc(h,0,d),l.crc16!==(h[d++]|h[d++]<<8)))throw new Error("invalid header crc16");if(t=h[h.length-4]|h[h.length-3]<<8|h[h.length-2]<<16|h[h.length-1]<<24,h.length-d-4-4<512*t&&(r=t),e=new Xl.RawInflate(h,{index:d,bufferSize:r}),l.data=i=e.decompress(),d=e.ip,l.crc32=c=(h[d++]|h[d++]<<8|h[d++]<<16|h[d++]<<24)>>>0,Xl.CRC32.calc(i)!==c)throw new Error("invalid CRC-32 checksum: 0x"+Xl.CRC32.calc(i).toString(16)+" / 0x"+c.toString(16));if(l.isize=t=(h[d++]|h[d++]<<8|h[d++]<<16|h[d++]<<24)>>>0,(4294967295&i.length)!==t)throw new Error("invalid input size: "+(4294967295&i.length)+" / "+t);this.member.push(l),this.ip=d},Xl.Gunzip.prototype.decodeSubField=function(t,e){return t+e},Xl.Gunzip.prototype.concatMember=function(){var t,e,i,r=this.member,s=0,o=0;for(t=0,e=r.length;t<e;++t)o+=r[t].data.length;for(i=new Uint8Array(o),t=0;t<e;++t)i.set(r[t].data,s),s+=r[t].data.length;return i},Xl.GunzipMember=function(){this.id1,this.id2,this.cm,this.flg,this.mtime,this.xfl,this.os,this.crc16,this.xlen,this.crc32,this.isize,this.name,this.comment,this.data},Xl.GunzipMember.prototype.getName=function(){return this.name},Xl.GunzipMember.prototype.getData=function(){return this.data},Xl.GunzipMember.prototype.getMtime=function(){return this.mtime},Xl.Gzip=function(t,e){this.input=t,this.ip=0,this.output,this.op=0,this.flags={},this.filename,this.comment,this.deflateOptions,e&&(e.flags&&(this.flags=e.flags),"string"==typeof e.filename&&(this.filename=e.filename),"string"==typeof e.comment&&(this.comment=e.comment),e.deflateOptions&&(this.deflateOptions=e.deflateOptions)),this.deflateOptions||(this.deflateOptions={})},Xl.Gzip.DefaultBufferSize=32768,Xl.Gzip.prototype.compress=function(){var t,e,i,r,s,o,n,a,c=new Uint8Array(Xl.Gzip.DefaultBufferSize),l=0,h=this.input,d=this.ip,u=this.filename,f=this.comment;if(c[l++]=31,c[l++]=139,c[l++]=8,t=0,this.flags.fname&&(t|=Xl.Gzip.FlagsMask.FNAME),this.flags.fcomment&&(t|=Xl.Gzip.FlagsMask.FCOMMENT),this.flags.fhcrc&&(t|=Xl.Gzip.FlagsMask.FHCRC),c[l++]=t,e=(Date.now?Date.now():+new Date)/1e3|0,c[l++]=255&e,c[l++]=e>>>8&255,c[l++]=e>>>16&255,c[l++]=e>>>24&255,c[l++]=0,c[l++]=Xl.Gzip.OperatingSystem.UNKNOWN,void 0!==this.flags.fname){for(n=0,a=u.length;n<a;++n)(o=u.charCodeAt(n))>255&&(c[l++]=o>>>8&255),c[l++]=255&o;c[l++]=0}if(this.flags.comment){for(n=0,a=f.length;n<a;++n)(o=f.charCodeAt(n))>255&&(c[l++]=o>>>8&255),c[l++]=255&o;c[l++]=0}return this.flags.fhcrc&&(i=65535&Xl.CRC32.calc(c,0,l),c[l++]=255&i,c[l++]=i>>>8&255),this.deflateOptions.outputBuffer=c,this.deflateOptions.outputIndex=l,c=(s=new Xl.RawDeflate(h,this.deflateOptions)).compress(),(l=s.op)+8>c.buffer.byteLength?(this.output=new Uint8Array(l+8),this.output.set(new Uint8Array(c.buffer)),c=this.output):c=new Uint8Array(c.buffer),r=Xl.CRC32.calc(h),c[l++]=255&r,c[l++]=r>>>8&255,c[l++]=r>>>16&255,c[l++]=r>>>24&255,a=h.length,c[l++]=255&a,c[l++]=a>>>8&255,c[l++]=a>>>16&255,c[l++]=a>>>24&255,this.ip=d,l<c.length&&(this.output=c=c.subarray(0,l)),c},Xl.Gzip.OperatingSystem={FAT:0,AMIGA:1,VMS:2,UNIX:3,VM_CMS:4,ATARI_TOS:5,HPFS:6,MACINTOSH:7,Z_SYSTEM:8,CP_M:9,TOPS_20:10,NTFS:11,QDOS:12,ACORN_RISCOS:13,UNKNOWN:255},Xl.Gzip.FlagsMask={FTEXT:1,FHCRC:2,FEXTRA:4,FNAME:8,FCOMMENT:16},Xl.Heap=function(t){this.buffer=new Uint16Array(2*t),this.length=0},Xl.Heap.prototype.getParent=function(t){return 2*((t-2)/4|0)},Xl.Heap.prototype.getChild=function(t){return 2*t+2},Xl.Heap.prototype.push=function(t,e){var i,r,s,o=this.buffer;for(i=this.length,o[this.length++]=e,o[this.length++]=t;i>0&&(r=this.getParent(i),o[i]>o[r]);)s=o[i],o[i]=o[r],o[r]=s,s=o[i+1],o[i+1]=o[r+1],o[r+1]=s,i=r;return this.length},Xl.Heap.prototype.pop=function(){var t,e,i,r,s,o=this.buffer;for(e=o[0],t=o[1],this.length-=2,o[0]=o[this.length],o[1]=o[this.length+1],s=0;!((r=this.getChild(s))>=this.length)&&(r+2<this.length&&o[r+2]>o[r]&&(r+=2),o[r]>o[s]);)i=o[s],o[s]=o[r],o[r]=i,i=o[s+1],o[s+1]=o[r+1],o[r+1]=i,s=r;return{index:t,value:e,length:this.length}},Xl.RawDeflate=function(t,e){this.compressionType=Xl.RawDeflate.CompressionType.DYNAMIC,this.lazy=0,this.freqsLitLen,this.freqsDist,this.input=t instanceof Array?new Uint8Array(t):t,this.output,this.op=0,e&&(e.lazy&&(this.lazy=e.lazy),"number"==typeof e.compressionType&&(this.compressionType=e.compressionType),e.outputBuffer&&(this.output=e.outputBuffer instanceof Array?new Uint8Array(e.outputBuffer):e.outputBuffer),"number"==typeof e.outputIndex&&(this.op=e.outputIndex)),this.output||(this.output=new Uint8Array(32768))},Xl.RawDeflate.CompressionType={NONE:0,FIXED:1,DYNAMIC:2,RESERVED:3},Xl.RawDeflate.Lz77MinLength=3,Xl.RawDeflate.Lz77MaxLength=258,Xl.RawDeflate.WindowSize=32768,Xl.RawDeflate.MaxCodeLength=16,Xl.RawDeflate.HUFMAX=286,Xl.RawDeflate.FixedHuffmanTable=function(){var t,e=[];for(t=0;t<288;t++)switch(!0){case t<=143:e.push([t+48,8]);break;case t<=255:e.push([t-144+400,9]);break;case t<=279:e.push([t-256+0,7]);break;case t<=287:e.push([t-280+192,8]);break;default:throw"invalid literal: "+t}return e}(),Xl.RawDeflate.prototype.compress=function(){var t,e,i,r=this.input;switch(this.compressionType){case Xl.RawDeflate.CompressionType.NONE:for(e=0,i=r.length;e<i;)e+=(t=r.subarray(e,e+65535)).length,this.makeNocompressBlock(t,e===i);break;case Xl.RawDeflate.CompressionType.FIXED:this.output=this.makeFixedHuffmanBlock(r,!0),this.op=this.output.length;break;case Xl.RawDeflate.CompressionType.DYNAMIC:this.output=this.makeDynamicHuffmanBlock(r,!0),this.op=this.output.length;break;default:throw"invalid compression type"}return this.output},Xl.RawDeflate.prototype.makeNocompressBlock=function(t,e){var i,r,s,o,n=this.output,a=this.op;for(n=new Uint8Array(this.output.buffer);n.length<=a+t.length+5;)n=new Uint8Array(n.length<<1);return n.set(this.output),i=e?1:0,r=Xl.RawDeflate.CompressionType.NONE,n[a++]=i|r<<1,o=65536+~(s=t.length)&65535,n[a++]=255&s,n[a++]=s>>>8&255,n[a++]=255&o,n[a++]=o>>>8&255,n.set(t,a),a+=t.length,n=n.subarray(0,a),this.op=a,this.output=n,n},Xl.RawDeflate.prototype.makeFixedHuffmanBlock=function(t,e){var i,r,s,o=new Xl.BitStream(new Uint8Array(this.output.buffer),this.op);return i=e?1:0,r=Xl.RawDeflate.CompressionType.FIXED,o.writeBits(i,1,!0),o.writeBits(r,2,!0),s=this.lz77(t),this.fixedHuffman(s,o),o.finish()},Xl.RawDeflate.prototype.makeDynamicHuffmanBlock=function(t,e){var i,r,s,o,n,a,c,l,h,d,u,f,p,g,m,w,b,F=new Xl.BitStream(new Uint8Array(this.output.buffer),this.op),v=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],y=new Array(19);for(i=e?1:0,r=Xl.RawDeflate.CompressionType.DYNAMIC,F.writeBits(i,1,!0),F.writeBits(r,2,!0),s=this.lz77(t),c=this.getLengths_(this.freqsLitLen,15),l=this.getCodesFromLengths_(c),h=this.getLengths_(this.freqsDist,7),d=this.getCodesFromLengths_(h),o=286;o>257&&0===c[o-1];o--);for(n=30;n>1&&0===h[n-1];n--);for(u=this.getTreeSymbols_(o,c,n,h),f=this.getLengths_(u.freqs,7),w=0;w<19;w++)y[w]=f[v[w]];for(a=19;a>4&&0===y[a-1];a--);for(p=this.getCodesFromLengths_(f),F.writeBits(o-257,5,!0),F.writeBits(n-1,5,!0),F.writeBits(a-4,4,!0),w=0;w<a;w++)F.writeBits(y[w],3,!0);for(w=0,b=u.codes.length;w<b;w++)if(g=u.codes[w],F.writeBits(p[g],f[g],!0),g>=16){switch(w++,g){case 16:m=2;break;case 17:m=3;break;case 18:m=7;break;default:throw"invalid code: "+g}F.writeBits(u.codes[w],m,!0)}return this.dynamicHuffman(s,[l,c],[d,h],F),F.finish()},Xl.RawDeflate.prototype.dynamicHuffman=function(t,e,i,r){var s,o,n,a,c,l,h,d;for(c=e[0],l=e[1],h=i[0],d=i[1],s=0,o=t.length;s<o;++s)if(n=t[s],r.writeBits(c[n],l[n],!0),n>256)r.writeBits(t[++s],t[++s],!0),a=t[++s],r.writeBits(h[a],d[a],!0),r.writeBits(t[++s],t[++s],!0);else if(256===n)break;return r},Xl.RawDeflate.prototype.fixedHuffman=function(t,e){var i,r,s;for(i=0,r=t.length;i<r;i++)if(s=t[i],Xl.BitStream.prototype.writeBits.apply(e,Xl.RawDeflate.FixedHuffmanTable[s]),s>256)e.writeBits(t[++i],t[++i],!0),e.writeBits(t[++i],5),e.writeBits(t[++i],t[++i],!0);else if(256===s)break;return e},Xl.RawDeflate.Lz77Match=function(t,e){this.length=t,this.backwardDistance=e},Xl.RawDeflate.Lz77Match.LengthCodeTable=(th=function(){var t,e,i=[];for(t=3;t<=258;t++)e=r(t),i[t]=e[2]<<24|e[1]<<16|e[0];function r(t){switch(!0){case 3===t:return[257,t-3,0];case 4===t:return[258,t-4,0];case 5===t:return[259,t-5,0];case 6===t:return[260,t-6,0];case 7===t:return[261,t-7,0];case 8===t:return[262,t-8,0];case 9===t:return[263,t-9,0];case 10===t:return[264,t-10,0];case t<=12:return[265,t-11,1];case t<=14:return[266,t-13,1];case t<=16:return[267,t-15,1];case t<=18:return[268,t-17,1];case t<=22:return[269,t-19,2];case t<=26:return[270,t-23,2];case t<=30:return[271,t-27,2];case t<=34:return[272,t-31,2];case t<=42:return[273,t-35,3];case t<=50:return[274,t-43,3];case t<=58:return[275,t-51,3];case t<=66:return[276,t-59,3];case t<=82:return[277,t-67,4];case t<=98:return[278,t-83,4];case t<=114:return[279,t-99,4];case t<=130:return[280,t-115,4];case t<=162:return[281,t-131,5];case t<=194:return[282,t-163,5];case t<=226:return[283,t-195,5];case t<=257:return[284,t-227,5];case 258===t:return[285,t-258,0];default:throw"invalid length: "+t}}return i}(),new Uint32Array(th)),Xl.RawDeflate.Lz77Match.prototype.getDistanceCode_=function(t){var e;switch(!0){case 1===t:e=[0,t-1,0];break;case 2===t:e=[1,t-2,0];break;case 3===t:e=[2,t-3,0];break;case 4===t:e=[3,t-4,0];break;case t<=6:e=[4,t-5,1];break;case t<=8:e=[5,t-7,1];break;case t<=12:e=[6,t-9,2];break;case t<=16:e=[7,t-13,2];break;case t<=24:e=[8,t-17,3];break;case t<=32:e=[9,t-25,3];break;case t<=48:e=[10,t-33,4];break;case t<=64:e=[11,t-49,4];break;case t<=96:e=[12,t-65,5];break;case t<=128:e=[13,t-97,5];break;case t<=192:e=[14,t-129,6];break;case t<=256:e=[15,t-193,6];break;case t<=384:e=[16,t-257,7];break;case t<=512:e=[17,t-385,7];break;case t<=768:e=[18,t-513,8];break;case t<=1024:e=[19,t-769,8];break;case t<=1536:e=[20,t-1025,9];break;case t<=2048:e=[21,t-1537,9];break;case t<=3072:e=[22,t-2049,10];break;case t<=4096:e=[23,t-3073,10];break;case t<=6144:e=[24,t-4097,11];break;case t<=8192:e=[25,t-6145,11];break;case t<=12288:e=[26,t-8193,12];break;case t<=16384:e=[27,t-12289,12];break;case t<=24576:e=[28,t-16385,13];break;case t<=32768:e=[29,t-24577,13];break;default:throw"invalid distance"}return e},Xl.RawDeflate.Lz77Match.prototype.toLz77Array=function(){var t,e=this.length,i=this.backwardDistance,r=[],s=0;return t=Xl.RawDeflate.Lz77Match.LengthCodeTable[e],r[s++]=65535&t,r[s++]=t>>16&255,r[s++]=t>>24,t=this.getDistanceCode_(i),r[s++]=t[0],r[s++]=t[1],r[s++]=t[2],r},Xl.RawDeflate.prototype.lz77=function(t){var e,i,r,s,o,n,a,c,l,h={},d=Xl.RawDeflate.WindowSize,u=new Uint16Array(2*t.length),f=0,p=0,g=new Uint32Array(286),m=new Uint32Array(30),w=this.lazy;function b(t,e){var i,r,s=t.toLz77Array();for(i=0,r=s.length;i<r;++i)u[f++]=s[i];g[s[0]]++,m[s[3]]++,p=t.length+e-1,c=null}for(g[256]=1,e=0,i=t.length;e<i;++e){for(o=0,r=0,s=Xl.RawDeflate.Lz77MinLength;r<s&&e+r!==i;++r)o=o<<8|t[e+r];if(void 0===h[o]&&(h[o]=[]),n=h[o],p-- >0)n.push(e);else{for(;n.length>0&&e-n[0]>d;)n.shift();if(e+Xl.RawDeflate.Lz77MinLength>=i){for(c&&b(c,-1),r=0,s=i-e;r<s;++r)l=t[e+r],u[f++]=l,++g[l];break}n.length>0?(a=this.searchLongestMatch_(t,e,n),c?c.length<a.length?(l=t[e-1],u[f++]=l,++g[l],b(a,0)):b(c,-1):a.length<w?c=a:b(a,0)):c?b(c,-1):(l=t[e],u[f++]=l,++g[l]),n.push(e)}}return u[f++]=256,g[256]++,this.freqsLitLen=g,this.freqsDist=m,u.subarray(0,f)},Xl.RawDeflate.prototype.searchLongestMatch_=function(t,e,i){var r,s,o,n,a,c,l=0,h=t.length;t:for(n=0,c=i.length;n<c;n++){if(r=i[c-n-1],o=Xl.RawDeflate.Lz77MinLength,l>Xl.RawDeflate.Lz77MinLength){for(a=l;a>Xl.RawDeflate.Lz77MinLength;a--)if(t[r+a-1]!==t[e+a-1])continue t;o=l}for(;o<Xl.RawDeflate.Lz77MaxLength&&e+o<h&&t[r+o]===t[e+o];)++o;if(o>l&&(s=r,l=o),o===Xl.RawDeflate.Lz77MaxLength)break}return new Xl.RawDeflate.Lz77Match(l,e-s)},Xl.RawDeflate.prototype.getTreeSymbols_=function(t,e,i,r){var s,o,n,a,c,l,h=new Uint32Array(t+i),d=new Uint32Array(316),u=new Uint8Array(19);for(o=0,s=0;s<t;s++)h[o++]=e[s];for(s=0;s<i;s++)h[o++]=r[s];for(c=0,s=0,a=h.length;s<a;s+=o){for(o=1;s+o<a&&h[s+o]===h[s];++o);if(n=o,0===h[s])if(n<3)for(;n-- >0;)d[c++]=0,u[0]++;else for(;n>0;)(l=n<138?n:138)>n-3&&l<n&&(l=n-3),l<=10?(d[c++]=17,d[c++]=l-3,u[17]++):(d[c++]=18,d[c++]=l-11,u[18]++),n-=l;else if(d[c++]=h[s],u[h[s]]++,--n<3)for(;n-- >0;)d[c++]=h[s],u[h[s]]++;else for(;n>0;)(l=n<6?n:6)>n-3&&l<n&&(l=n-3),d[c++]=16,d[c++]=l-3,u[16]++,n-=l}return{codes:d.subarray(0,c),freqs:u}},Xl.RawDeflate.prototype.getLengths_=function(t,e){var i,r,s,o,n,a=t.length,c=new Xl.Heap(2*Xl.RawDeflate.HUFMAX),l=new Uint8Array(a);for(o=0;o<a;++o)t[o]>0&&c.push(o,t[o]);if(i=new Array(c.length/2),r=new Uint32Array(c.length/2),1===i.length)return l[c.pop().index]=1,l;for(o=0,n=c.length/2;o<n;++o)i[o]=c.pop(),r[o]=i[o].value;for(s=this.reversePackageMerge_(r,r.length,e),o=0,n=i.length;o<n;++o)l[i[o].index]=s[o];return l},Xl.RawDeflate.prototype.reversePackageMerge_=function(t,e,i){var r,s,o,n,a,c=new Uint16Array(i),l=new Uint8Array(i),h=new Uint8Array(e),d=new Array(i),u=new Array(i),f=new Array(i),p=(1<<i)-e,g=1<<i-1;function m(t){var i=u[t][f[t]];i===e?(m(t+1),m(t+1)):--h[i],++f[t]}for(c[i-1]=e,s=0;s<i;++s)p<g?l[s]=0:(l[s]=1,p-=g),p<<=1,c[i-2-s]=(c[i-1-s]/2|0)+e;for(c[0]=l[0],d[0]=new Array(c[0]),u[0]=new Array(c[0]),s=1;s<i;++s)c[s]>2*c[s-1]+l[s]&&(c[s]=2*c[s-1]+l[s]),d[s]=new Array(c[s]),u[s]=new Array(c[s]);for(r=0;r<e;++r)h[r]=i;for(o=0;o<c[i-1];++o)d[i-1][o]=t[o],u[i-1][o]=o;for(r=0;r<i;++r)f[r]=0;for(1===l[i-1]&&(--h[0],++f[i-1]),s=i-2;s>=0;--s){for(r=0,n=0,a=f[s+1],o=0;o<c[s];o++)(n=d[s+1][a]+d[s+1][a+1])>t[r]?(d[s][o]=n,u[s][o]=e,a+=2):(d[s][o]=t[r],u[s][o]=r,++r);f[s]=0,1===l[s]&&m(s)}return h},Xl.RawDeflate.prototype.getCodesFromLengths_=function(t){var e,i,r,s,o=new Uint16Array(t.length),n=[],a=[],c=0;for(e=0,i=t.length;e<i;e++)n[t[e]]=1+(0|n[t[e]]);for(e=1,i=Xl.RawDeflate.MaxCodeLength;e<=i;e++)a[e]=c,c+=0|n[e],c<<=1;for(e=0,i=t.length;e<i;e++)for(c=a[t[e]],a[t[e]]+=1,o[e]=0,r=0,s=t[e];r<s;r++)o[e]=o[e]<<1|1&c,c>>>=1;return o},Xl.Unzip=function(t,e){e=e||{},this.input=t instanceof Array?new Uint8Array(t):t,this.ip=0,this.eocdrOffset,this.numberOfThisDisk,this.startDisk,this.totalEntriesThisDisk,this.totalEntries,this.centralDirectorySize,this.centralDirectoryOffset,this.commentLength,this.comment,this.fileHeaderList,this.filenameToIndex,this.verify=e.verify||!1,this.password=e.password},Xl.Unzip.CompressionMethod=Xl.Zip.CompressionMethod,Xl.Unzip.FileHeaderSignature=Xl.Zip.FileHeaderSignature,Xl.Unzip.LocalFileHeaderSignature=Xl.Zip.LocalFileHeaderSignature,Xl.Unzip.CentralDirectorySignature=Xl.Zip.CentralDirectorySignature,Xl.Unzip.FileHeader=function(t,e){this.input=t,this.offset=e,this.length,this.version,this.os,this.needVersion,this.flags,this.compression,this.time,this.date,this.crc32,this.compressedSize,this.plainSize,this.fileNameLength,this.extraFieldLength,this.fileCommentLength,this.diskNumberStart,this.internalFileAttributes,this.externalFileAttributes,this.relativeOffset,this.filename,this.extraField,this.comment},Xl.Unzip.FileHeader.prototype.parse=function(){var t=this.input,e=this.offset;if(t[e++]!==Xl.Unzip.FileHeaderSignature[0]||t[e++]!==Xl.Unzip.FileHeaderSignature[1]||t[e++]!==Xl.Unzip.FileHeaderSignature[2]||t[e++]!==Xl.Unzip.FileHeaderSignature[3])throw new Error("invalid file header signature");this.version=t[e++],this.os=t[e++],this.needVersion=t[e++]|t[e++]<<8,this.flags=t[e++]|t[e++]<<8,this.compression=t[e++]|t[e++]<<8,this.time=t[e++]|t[e++]<<8,this.date=t[e++]|t[e++]<<8,this.crc32=(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)>>>0,this.compressedSize=(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)>>>0,this.plainSize=(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)>>>0,this.fileNameLength=t[e++]|t[e++]<<8,this.extraFieldLength=t[e++]|t[e++]<<8,this.fileCommentLength=t[e++]|t[e++]<<8,this.diskNumberStart=t[e++]|t[e++]<<8,this.internalFileAttributes=t[e++]|t[e++]<<8,this.externalFileAttributes=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,this.relativeOffset=(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)>>>0,this.filename=String.fromCharCode.apply(null,t.subarray(e,e+=this.fileNameLength)),this.extraField=t.subarray(e,e+=this.extraFieldLength),this.comment=t.subarray(e,e+this.fileCommentLength),this.length=e-this.offset},Xl.Unzip.LocalFileHeader=function(t,e){this.input=t,this.offset=e,this.length,this.needVersion,this.flags,this.compression,this.time,this.date,this.crc32,this.compressedSize,this.plainSize,this.fileNameLength,this.extraFieldLength,this.filename,this.extraField},Xl.Unzip.LocalFileHeader.Flags=Xl.Zip.Flags,Xl.Unzip.LocalFileHeader.prototype.parse=function(){var t=this.input,e=this.offset;if(t[e++]!==Xl.Unzip.LocalFileHeaderSignature[0]||t[e++]!==Xl.Unzip.LocalFileHeaderSignature[1]||t[e++]!==Xl.Unzip.LocalFileHeaderSignature[2]||t[e++]!==Xl.Unzip.LocalFileHeaderSignature[3])throw new Error("invalid local file header signature");this.needVersion=t[e++]|t[e++]<<8,this.flags=t[e++]|t[e++]<<8,this.compression=t[e++]|t[e++]<<8,this.time=t[e++]|t[e++]<<8,this.date=t[e++]|t[e++]<<8,this.crc32=(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)>>>0,this.compressedSize=(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)>>>0,this.plainSize=(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)>>>0,this.fileNameLength=t[e++]|t[e++]<<8,this.extraFieldLength=t[e++]|t[e++]<<8,this.filename=String.fromCharCode.apply(null,t.subarray(e,e+=this.fileNameLength)),this.extraField=t.subarray(e,e+=this.extraFieldLength),this.length=e-this.offset},Xl.Unzip.prototype.searchEndOfCentralDirectoryRecord=function(){var t,e=this.input;for(t=e.length-12;t>0;--t)if(e[t]===Xl.Unzip.CentralDirectorySignature[0]&&e[t+1]===Xl.Unzip.CentralDirectorySignature[1]&&e[t+2]===Xl.Unzip.CentralDirectorySignature[2]&&e[t+3]===Xl.Unzip.CentralDirectorySignature[3])return void(this.eocdrOffset=t);throw new Error("End of Central Directory Record not found")},Xl.Unzip.prototype.parseEndOfCentralDirectoryRecord=function(){var t,e=this.input;if(this.eocdrOffset||this.searchEndOfCentralDirectoryRecord(),t=this.eocdrOffset,e[t++]!==Xl.Unzip.CentralDirectorySignature[0]||e[t++]!==Xl.Unzip.CentralDirectorySignature[1]||e[t++]!==Xl.Unzip.CentralDirectorySignature[2]||e[t++]!==Xl.Unzip.CentralDirectorySignature[3])throw new Error("invalid signature");this.numberOfThisDisk=e[t++]|e[t++]<<8,this.startDisk=e[t++]|e[t++]<<8,this.totalEntriesThisDisk=e[t++]|e[t++]<<8,this.totalEntries=e[t++]|e[t++]<<8,this.centralDirectorySize=(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0,this.centralDirectoryOffset=(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0,this.commentLength=e[t++]|e[t++]<<8,this.comment=e.subarray(t,t+this.commentLength)},Xl.Unzip.prototype.parseFileHeader=function(){var t,e,i,r,s=[],o={};if(!this.fileHeaderList){for(void 0===this.centralDirectoryOffset&&this.parseEndOfCentralDirectoryRecord(),t=this.centralDirectoryOffset,i=0,r=this.totalEntries;i<r;++i)(e=new Xl.Unzip.FileHeader(this.input,t)).parse(),t+=e.length,s[i]=e,o[e.filename]=i;if(this.centralDirectorySize<t-this.centralDirectoryOffset)throw new Error("invalid file header size");this.fileHeaderList=s,this.filenameToIndex=o}},Xl.Unzip.prototype.getFileData=function(t,e){e=e||{};var i,r,s,o,n,a,c,l,h=this.input,d=this.fileHeaderList;if(d||this.parseFileHeader(),void 0===d[t])throw new Error("wrong index");if(r=d[t].relativeOffset,(i=new Xl.Unzip.LocalFileHeader(this.input,r)).parse(),r+=i.length,s=i.compressedSize,0!==(i.flags&Xl.Unzip.LocalFileHeader.Flags.ENCRYPT)){if(!e.password&&!this.password)throw new Error("please set password");for(a=this.createDecryptionKey(e.password||this.password),c=r,l=r+12;c<l;++c)this.decode(a,h[c]);for(c=r+=12,l=r+(s-=12);c<l;++c)h[c]=this.decode(a,h[c])}switch(i.compression){case Xl.Unzip.CompressionMethod.STORE:o=this.input.subarray(r,r+s);break;case Xl.Unzip.CompressionMethod.DEFLATE:o=new Xl.RawInflate(this.input,{index:r,bufferSize:i.plainSize}).decompress();break;default:throw new Error("unknown compression type")}if(this.verify&&(n=Xl.CRC32.calc(o),i.crc32!==n))throw new Error("wrong crc: file=0x"+i.crc32.toString(16)+", data=0x"+n.toString(16));return o},Xl.Unzip.prototype.getFilenames=function(){var t,e,i,r=[];for(this.fileHeaderList||this.parseFileHeader(),t=0,e=(i=this.fileHeaderList).length;t<e;++t)r[t]=i[t].filename;return r},Xl.Unzip.prototype.decompress=function(t,e){var i;if(this.filenameToIndex||this.parseFileHeader(),void 0===(i=this.filenameToIndex[t]))throw new Error(t+" not found");return this.getFileData(i,e)},Xl.Unzip.prototype.setPassword=function(t){this.password=t},Xl.Unzip.prototype.decode=function(t,e){return e^=this.getByte(t),this.updateKeys(t,e),e},Xl.Unzip.prototype.updateKeys=Xl.Zip.prototype.updateKeys,Xl.Unzip.prototype.createDecryptionKey=Xl.Zip.prototype.createEncryptionKey,Xl.Unzip.prototype.getByte=Xl.Zip.prototype.getByte,Xl.Util.stringToByteArray=function(t){var e,i,r=t.split("");for(e=0,i=r.length;e<i;e++)r[e]=(255&r[e].charCodeAt(0))>>>0;return r},Xl.Adler32=function(t){return"string"==typeof t&&(t=Xl.Util.stringToByteArray(t)),Xl.Adler32.update(1,t)},Xl.Adler32.update=function(t,e){for(var i,r=65535&t,s=t>>>16&65535,o=e.length,n=0;o>0;){o-=i=o>Xl.Adler32.OptimizationParameter?Xl.Adler32.OptimizationParameter:o;do{s+=r+=e[n++]}while(--i);r%=65521,s%=65521}return(s<<16|r)>>>0},Xl.Adler32.OptimizationParameter=1024,Xl.BitStream=function(t,e){if(this.index="number"==typeof e?e:0,this.bitindex=0,this.buffer=t instanceof Uint8Array?t:new Uint8Array(Xl.BitStream.DefaultBlockSize),2*this.buffer.length<=this.index)throw new Error("invalid index");this.buffer.length<=this.index&&this.expandBuffer()},Xl.BitStream.DefaultBlockSize=32768,Xl.BitStream.prototype.expandBuffer=function(){var t=this.buffer,e=t.length,i=new Uint8Array(e<<1);return i.set(t),this.buffer=i},Xl.BitStream.prototype.writeBits=function(t,e,i){var r,s=this.buffer,o=this.index,n=this.bitindex,a=s[o];if(i&&e>1&&(t=e>8?function(t){return Xl.BitStream.ReverseTable[255&t]<<24|Xl.BitStream.ReverseTable[t>>>8&255]<<16|Xl.BitStream.ReverseTable[t>>>16&255]<<8|Xl.BitStream.ReverseTable[t>>>24&255]}(t)>>32-e:Xl.BitStream.ReverseTable[t]>>8-e),e+n<8)a=a<<e|t,n+=e;else for(r=0;r<e;++r)a=a<<1|t>>e-r-1&1,8===++n&&(n=0,s[o++]=Xl.BitStream.ReverseTable[a],a=0,o===s.length&&(s=this.expandBuffer()));s[o]=a,this.buffer=s,this.bitindex=n,this.index=o},Xl.BitStream.prototype.finish=function(){var t=this.buffer,e=this.index;return this.bitindex>0&&(t[e]<<=8-this.bitindex,t[e]=Xl.BitStream.ReverseTable[t[e]],e++),t.subarray(0,e)},Xl.BitStream.ReverseTable=function(){var t,e=new Uint8Array(256);for(t=0;t<256;++t)e[t]=function(t){var e=t,i=7;for(t>>>=1;t;t>>>=1)e<<=1,e|=1&t,--i;return(e<<i&255)>>>0}(t);return e}(),Xl.CRC32.calc=function(t,e,i){return Xl.CRC32.update(t,0,e,i)},Xl.CRC32.update=function(t,e,i,r){var s=Xl.CRC32.Table,o="number"==typeof i?i:i=0,n="number"==typeof r?r:t.length;for(e^=4294967295,o=7&n;o--;++i)e=e>>>8^s[255&(e^t[i])];for(o=n>>3;o--;i+=8)e=(e=(e=(e=(e=(e=(e=(e=e>>>8^s[255&(e^t[i])])>>>8^s[255&(e^t[i+1])])>>>8^s[255&(e^t[i+2])])>>>8^s[255&(e^t[i+3])])>>>8^s[255&(e^t[i+4])])>>>8^s[255&(e^t[i+5])])>>>8^s[255&(e^t[i+6])])>>>8^s[255&(e^t[i+7])];return(4294967295^e)>>>0},Xl.CRC32.single=function(t,e){return(Xl.CRC32.Table[255&(t^e)]^t>>>8)>>>0},Xl.CRC32.Table_=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],Xl.CRC32.Table=new Uint32Array(Xl.CRC32.Table_),Xl.Deflate=function(t,e){this.input=t,this.output=new Uint8Array(Xl.Deflate.DefaultBufferSize),this.compressionType=Xl.Deflate.CompressionType.DYNAMIC,this.rawDeflate;var i,r={};for(i in!e&&(e={})||"number"==typeof e.compressionType&&(this.compressionType=e.compressionType),e)r[i]=e[i];r.outputBuffer=this.output,this.rawDeflate=new Xl.RawDeflate(this.input,r)},Xl.Deflate.DefaultBufferSize=32768,Xl.Deflate.CompressionType=Xl.RawDeflate.CompressionType,Xl.Deflate.compress=function(t,e){return new Xl.Deflate(t,e).compress()},Xl.Deflate.prototype.compress=function(){var t,e,i,r,s,o,n=0;if(o=this.output,(t=Xl.CompressionMethod.DEFLATE)!==Xl.CompressionMethod.DEFLATE)throw new Error("invalid compression method");if(e=Math.LOG2E*Math.log(Xl.RawDeflate.WindowSize)-8<<4|t,o[n++]=e,t!==Xl.CompressionMethod.DEFLATE)throw new Error("invalid compression method");switch(this.compressionType){case Xl.Deflate.CompressionType.NONE:r=0;break;case Xl.Deflate.CompressionType.FIXED:r=1;break;case Xl.Deflate.CompressionType.DYNAMIC:r=2;break;default:throw new Error("unsupported compression type")}return i=r<<6,i|=31-(256*e+i)%31,o[n++]=i,s=Xl.Adler32(this.input),this.rawDeflate.op=n,n=(o=this.rawDeflate.compress()).length,(o=new Uint8Array(o.buffer)).length<=n+4&&(this.output=new Uint8Array(o.length+4),this.output.set(o),o=this.output),(o=o.subarray(0,n+4))[n++]=s>>24&255,o[n++]=s>>16&255,o[n++]=s>>8&255,o[n++]=255&s,o};class eh{constructor(t){this.file=t}async read(t,e){const i=this.file;return void 0!==t?i.slice(t,t+e).arrayBuffer():i.arrayBuffer()}}"undefined"!=typeof process&&null!=process.versions&&process.versions.node;class ih{constructor(t){var e;this.config=t,this.url=(e=t.path||t.url).includes("//www.dropbox.com")?e.replace("//www.dropbox.com","//dl.dropboxusercontent.com"):e.startsWith("ftp://ftp.ncbi.nlm.nih.gov")?e.replace("ftp://","https://"):e}async read(t,e){e=Math.ceil(e);const i=this.config.headers||{},r="bytes="+t+"-"+(t+e-1);i.Range=r;let s=this.url.slice();if(i["User-Agent"]="IGV",this.config.oauthToken){const t=async function(t){return"function"==typeof t?await Promise.resolve(t()):t}(this.config.oauthToken);i.Authorization=`Bearer ${t}`}this.config.apiKey&&(s=function(t,e,i){const r=t.includes("?")?"&":"?";return t+r+e+"="+i}(s,"key",this.config.apiKey));const o=await fetch(s,{method:"GET",headers:i,redirect:"follow",mode:"cors"}),n=o.status;if(n>=400){console.error(`${n} ${this.config.url}`);const t=Error(o.statusText);throw t.code=n,t}return o.arrayBuffer()}}class rh{constructor(t,e){this.file=t,this.rateLimiter=e}async read(t,e){const i=this.file,r=this.rateLimiter;return new Promise(function(s,o){r.limiter(async function(i){try{const r=await i.read(t,e);s(r)}catch(t){o(t)}})(i)})}}class sh{constructor(t){this.file=t.file,this.size=t.size||64e3,this.position=0,this.bufferStart=0,this.bufferLength=0,this.buffer=void 0}async read(t,e){const i=t,r=t+e,s=this.bufferStart,o=this.bufferStart+this.bufferLength;if(e>this.size)return this.buffer=void 0,this.bufferStart=0,this.bufferLength=0,this.file.read(t,e);if(i>=s&&r<=o){const t=i-s,r=t+e;return this.buffer.slice(t,r)}if(i<s&&r>s){const r=s-i,o=await this.file.read(t,r),n=e-r;if(n>0){const t=this.buffer.slice(0,n);return oh(o,t)}return o}if(!(i<o&&r>o))return this.buffer=await this.file.read(t,this.size),this.bufferStart=t,this.bufferLength=this.buffer.byteLength,this.buffer.slice(0,e);{const t=o-i,r=this.bufferLength-t,s=this.buffer.slice(r,this.bufferLength),n=e-t;if(!(n>0))return s;try{this.buffer=await this.file.read(o,this.size),this.bufferStart=o,this.bufferLength=this.buffer.byteLength;const t=this.buffer.slice(0,n);return oh(s,t)}catch(t){if(t.code&&416===t.code)return s;throw t}}}}var oh=function(t,e){var i=new Uint8Array(t.byteLength+e.byteLength);return i.set(new Uint8Array(t),0),i.set(new Uint8Array(e),t.byteLength),i.buffer};const nh=function(t,e){this.littleEndian=void 0===e||e,this.position=0,this.view=t,this.length=t.byteLength};function ah(t,e){this.block=t,this.offset=e}nh.prototype.available=function(){return this.length-this.position},nh.prototype.remLength=function(){return this.length-this.position},nh.prototype.hasNext=function(){return this.position<this.length-1},nh.prototype.getByte=function(){var t=this.view.getUint8(this.position,this.littleEndian);return this.position++,t},nh.prototype.getShort=function(){var t=this.view.getInt16(this.position,this.littleEndian);return this.position+=2,t},nh.prototype.getUShort=function(){var t=this.view.getUint16(this.position,this.littleEndian);return this.position+=2,t},nh.prototype.getInt=function(){var t=this.view.getInt32(this.position,this.littleEndian);return this.position+=4,t},nh.prototype.getUInt=function(){var t=this.view.getUint32(this.position,this.littleEndian);return this.position+=4,t},nh.prototype.getLong=function(){var t=[];t[0]=this.view.getUint8(this.position),t[1]=this.view.getUint8(this.position+1),t[2]=this.view.getUint8(this.position+2),t[3]=this.view.getUint8(this.position+3),t[4]=this.view.getUint8(this.position+4),t[5]=this.view.getUint8(this.position+5),t[6]=this.view.getUint8(this.position+6),t[7]=this.view.getUint8(this.position+7);var e=0;if(this.littleEndian)for(var i=t.length-1;i>=0;i--)e=256*e+t[i];else for(i=0;i<t.length;i++)e=256*e+t[i];return this.position+=8,e},nh.prototype.getString=function(t){for(var e,i="";0!=(e=this.view.getUint8(this.position++))&&(i+=String.fromCharCode(e),!t||i.length!=t););return i},nh.prototype.getFixedLengthString=function(t){var e,i,r="";for(e=0;e<t;e++)(i=this.view.getUint8(this.position++))>0&&(r+=String.fromCharCode(i));return r},nh.prototype.getFixedLengthTrimmedString=function(t){var e,i,r="";for(e=0;e<t;e++)(i=this.view.getUint8(this.position++))>32&&(r+=String.fromCharCode(i));return r},nh.prototype.getFloat=function(){var t=this.view.getFloat32(this.position,this.littleEndian);return this.position+=4,t},nh.prototype.getDouble=function(){var t=this.view.getFloat64(this.position,this.littleEndian);return this.position+=8,t},nh.prototype.skip=function(t){return this.position+=t,this.position},nh.prototype.getVPointer=function(){var t=this.position,e=this.view.getUint8(t+1)<<8|this.view.getUint8(t),i=4294967296*(255&this.view.getUint8(t+6))+16777216*(255&this.view.getUint8(t+5))+65536*(255&this.view.getUint8(t+4))+256*(255&this.view.getUint8(t+3))+(255&this.view.getUint8(t+2));return this.position+=8,new ah(i,e)},ah.prototype.isLessThan=function(t){return this.block<t.block||this.block===t.block&&this.offset<t.offset},ah.prototype.isGreaterThan=function(t){return this.block>t.block||this.block===t.block&&this.offset>t.offset},ah.prototype.print=function(){return this.block+":"+this.offset};class ch{constructor(t,e){this.chr1=t,this.chr2=e}getKey(){return this.chr1.name+"_"+this.chr2.name+"_"+this.zoom.unit+"_"+this.zoom.binSize}getBlockNumbers(t,e,i){if(t.chr==this.chr2&&e.chr===this.chr1){const i=t;t=e,e=i}const r=this.chr1===this.chr2,s=this.zoom.binSize,o=this.blockBinCount,n=this.blockColumnCount;return i<9||!r?function(){const i=t.start/s,a=t.end/s,c=e.start/s,l=e.end/s,h=Math.floor(i/o),d=Math.floor((a-1)/o),u=Math.floor(c/o),f=Math.floor((l-1)/o),p=[];for(let t=u;t<=f;t++)for(let e=h;e<=d;e++){let i;i=r&&t<e?e*n+t:t*n+e,p.includes(i)||p.push(i)}return p}():function(){const i=t.start/s,r=t.end/s,a=e.start/s,c=e.end/s,l=Math.floor((i+a)/2/o),h=Math.floor((r+c)/2/o),d=Math.floor(Math.log2(1+Math.abs(i-c)/Math.sqrt(2)/o)),u=Math.floor(Math.log2(1+Math.abs(r-a)/Math.sqrt(2)/o)),f=(r-a)*(i-c)<0?0:Math.min(d,u),p=Math.max(d,u),g=[];for(let t=f;t<=p;t++)for(let e=l;e<=h;e++){const i=t*n+e;g.push(i)}return g}()}static parseMatrixZoomData(t,e,i){const r=new ch(t,e),s=i.getString(),o=i.getInt(),n=i.getFloat(),a=i.getFloat(),c=i.getFloat(),l=i.getFloat(),h=i.getInt();r.blockBinCount=i.getInt(),r.blockColumnCount=i.getInt();const d=i.getInt();r.zoom={index:o,unit:s,binSize:h},r.blockIndex=new lh(d,i);const u=n/(t.size/h)/(e.size/h);return r.averageCount=u,r.sumCounts=n,r.stdDev=c,r.occupiedCellCount=a,r.percent95=l,r}}class lh{constructor(t,e){for(this.blockIndex={};t-- >0;){const t=e.getInt(),i=e.getLong(),r=e.getInt();this.blockIndex[t]={filePosition:i,size:r}}}getBlockIndexEntry(t){return this.blockIndex[t]}}class hh{constructor(t,e,i){this.chr1=t,this.chr2=e,this.bpZoomData=[],this.fragZoomData=[];for(let t of i)"BP"===t.zoom.unit?this.bpZoomData.push(t):this.fragZoomData.push(t)}findZoomForResolution(t,e){const i="FRAG"===e?this.fragZoomData:this.bpZoomData;for(let e=1;e<i.length;e++){if(i[e].zoom.binSize<t)return e-1}return i.length-1}getZoomData(t,e){const i="BP"===(e=e||"BP")?this.bpZoomData:this.fragZoomData;for(let e=0;e<i.length;e++){var r=i[e];if(t===r.zoom.binSize)return r}}getZoomDataByIndex(t,e){return("FRAG"===e?this.fragZoomData:this.bpZoomData)[t]}static getKey(t,e){if(t>e){const i=t;t=e,e=i}return`${t}_${e}`}static parseMatrix(t,e){const i=new nh(new DataView(t)),r=i.getInt(),s=i.getInt(),o=e[r],n=e[s];let a=i.getInt();const c=[];for(;a-- >0;){const t=ch.parseMatrixZoomData(o,n,i);c.push(t)}return new hh(r,s,c)}}class dh{constructor(t,e,i){this.bin1=t,this.bin2=e,this.counts=i}getKey(){return this.bin1+"_"+this.bin2}}class uh{constructor(t=10){this.max=t,this.map=new Map}get(t){let e=this.map.get(t);return e&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){this.map.has(t)?this.map.delete(t):this.map.size===this.max&&this.map.delete(this.first()),this.map.set(t,e)}has(t){return this.map.has(t)}clear(){this.map.clear()}first(){return this.map.keys().next().value}}class fh{constructor(t,e,i,r){this.file=t,this.filePosition=e,this.nValues=i,this.dataType=r,this.cache=void 0}async getValues(t,e){if(!this.cache||t<this.cache.start||e>this.cache.end){const i=Math.max(0,t-1e3),r=Math.min(this.nValues,e+1e3),s=this.filePosition+i*this.dataType,o=r-i,n=o*this.dataType,a=await this.file.read(s,n);if(!a)return;const c=new nh(new DataView(a)),l=[];for(let t=0;t<o;t++)l[t]=8===this.dataType?c.getDouble():c.getFloat();this.cache={start:i,end:r,values:l}}const i=t-this.cache.start,r=i+(e-t);return this.cache.values.slice(i,r)}getKey(){return fh.getKey(this.type,this.chrIdx,this.unit,this.resolution)}static getNormalizationVectorKey(t,e,i,r){return t+"_"+e+"_"+i+"_"+r}}var ph={"hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2Fcombined.hic":"54386046426,55860","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2Fprimary.hic":"33860030033,37504","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2Freplicate.hic":"30849652794,55832","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2Fmaternal.hic":"1380542661,17185","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2Fpaternal.hic":"1389001777,17185","hicfiles.s3.amazonaws.com%2Fhiseq%2Fimr90%2Fin-situ%2Fcombined.hic":"13433880319,35723","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC001.hic":"3409347253,35975","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC002.hic":"4529947083,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC003.hic":"6894962500,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC004.hic":"3395593338,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC005.hic":"5204128636,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC006.hic":"3278363811,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC007.hic":"3585547340,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC008.hic":"4134197273,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC009.hic":"2851728310,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC010.hic":"1754216102,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC011.hic":"1716829574,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC012.hic":"4367980375,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC013.hic":"2309654671,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC014.hic":"5324950266,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC015.hic":"3132333594,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC016.hic":"3159154704,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC017.hic":"3262554627,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC018.hic":"3014216364,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC019.hic":"5025753246,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC020.hic":"5861584507,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC021.hic":"3542263275,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC022.hic":"5061949378,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC023.hic":"4816423919,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC024.hic":"2683781104,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC025.hic":"6522701781,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC026.hic":"6748846520,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC027.hic":"5642693007,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC028.hic":"2098921691,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC029.hic":"3886454027,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fagar%2FHIC030.hic":"2288984204,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fagar%2FHIC031.hic":"2115342419,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fpellet%2FHIC032.hic":"2063314324,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fsupernatant%2FHIC033.hic":"1933908457,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fdilution%2FHIC034.hic":"13555514595,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fdilution%2FHIC035.hic":"6129650900,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fdilution%2FHIC036.hic":"4307445019,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fdilution%2FHIC037.hic":"9375139867,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fdilution%2Fcombined.hic":"11664249584,33929","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2Fcombined_DpnII.hic":"7003537290,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC038.hic":"2099825544,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC039.hic":"2096900138,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC040.hic":"2593642141,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC041.hic":"2263919098,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC042.hic":"2684774693,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2Fcombined_noXlink.hic":"5574807456,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC043.hic":"2986114347,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC044.hic":"1916378621,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC045.hic":"746463126,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC046.hic":"2338476164,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC047.hic":"1167496250,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC048.hic":"2231690794,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fin-situ%2FHIC049.hic":"2782308678,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fimr90%2Fin-situ%2FHIC050.hic":"3633531346,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fimr90%2Fin-situ%2FHIC051.hic":"4063486444,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fimr90%2Fin-situ%2FHIC052.hic":"929756278,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fimr90%2Fin-situ%2FHIC053.hic":"2489657204,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fimr90%2Fin-situ%2FHIC054.hic":"4036419444,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fimr90%2Fin-situ%2FHIC055.hic":"4284185549,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fimr90%2Fin-situ%2FHIC056.hic":"4410546240,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fimr90%2Fdilution%2FHIC057.hic":"1491998259,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhmec%2Fin-situ%2Fcombined.hic":"7266425111,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhmec%2Fin-situ%2FHIC058.hic":"6532635593,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhmec%2Fin-situ%2FHIC059.hic":"400684530,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhmec%2Fin-situ%2FHIC060.hic":"645352187,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhmec%2Fin-situ%2FHIC061.hic":"736291871,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhmec%2Fin-situ%2FHIC062.hic":"762731037,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhmec%2Fin-situ%2FHIC063.hic":"682917431,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhmec%2Fdilution%2FHIC064.hic":"4550171307,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fnhek%2Fin-situ%2Fcombined.hic":"11897184911,35789","hicfiles.s3.amazonaws.com%2Fhiseq%2Fnhek%2Fin-situ%2FHIC065.hic":"5425943567,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fnhek%2Fin-situ%2FHIC066.hic":"5942869818,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fnhek%2Fin-situ%2FHIC067.hic":"5191049261,35647","hicfiles.s3.amazonaws.com%2Fhiseq%2Fnhek%2Fdilution%2FHIC068.hic":"2713318801,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fk562%2Fin-situ%2Fcombined.hic":"12641555389,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fk562%2Fin-situ%2FHIC069.hic":"5630177461,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fk562%2Fin-situ%2FHIC070.hic":"5926611269,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fk562%2Fin-situ%2FHIC071.hic":"2486191351,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fk562%2Fin-situ%2FHIC072.hic":"2281343366,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fk562%2Fin-situ%2FHIC073.hic":"2173074239,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fk562%2Fin-situ%2FHIC074.hic":"2463700999,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fkbm7%2Fin-situ%2Fcombined.hic":"14661922519,35639","hicfiles.s3.amazonaws.com%2Fhiseq%2Fkbm7%2Fin-situ%2FHIC075.hic":"3685310515,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fkbm7%2Fin-situ%2FHIC076.hic":"5833658487,35891","hicfiles.s3.amazonaws.com%2Fhiseq%2Fkbm7%2Fin-situ%2FHIC077.hic":"2406346486,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fkbm7%2Fin-situ%2FHIC078.hic":"5241454987,35919","hicfiles.s3.amazonaws.com%2Fhiseq%2Fkbm7%2Fin-situ%2FHIC079.hic":"6297234263,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhuvec%2Fin-situ%2Fcombined.hic":"9193858096,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhuvec%2Fin-situ%2FHIC080.hic":"5171405536,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhuvec%2Fin-situ%2FHIC081.hic":"3489767688,35891","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhuvec%2Fin-situ%2FHIC082.hic":"4243339375,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhuvec%2Fdilution%2FHIC083.hic":"1497495406,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhela%2Fin-situ%2Fcombined.hic":"7923332224,35593","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhela%2Fin-situ%2FHIC084.hic":"867699123,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhela%2Fin-situ%2FHIC085.hic":"3669518514,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhela%2Fin-situ%2FHIC086.hic":"5306474712,35595","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhela%2Fin-situ%2FHIC087.hic":"1490963755,36397","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2Fcombined.hic":"8956382853,50248","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC088.hic":"1874185366,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC089.hic":"1301165236,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC090.hic":"1105246282,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC091.hic":"1338325770,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC092.hic":"1307918730,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC093.hic":"755136918,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC094.hic":"1606583694,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC095.hic":"2039711245,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC096.hic":"1909573053,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC097.hic":"1826710712,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC098.hic":"1998793575,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC099.hic":"1007740962,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC100.hic":"736464120,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC101.hic":"980505082,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fin-situ%2FHIC102.hic":"1116083646,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fdilution%2FHIC103.hic":"1096994310,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fch12-lx-b-lymphoblasts%2Fdilution%2FHIC104.hic":"841063882,32102","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC105.hic":"107742864,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC106.hic":"134295912,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC107.hic":"110228014,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC108.hic":"102761401,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC109.hic":"100461491,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC110.hic":"88828472,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC111.hic":"81471064,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC112.hic":"92297035,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC113.hic":"65503916,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC114.hic":"49181188,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC115.hic":"46471102,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC116.hic":"64284432,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC117.hic":"60434076,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC118.hic":"45248563,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC119.hic":"60288782,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC120.hic":"136888414,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC121.hic":"125009003,33681","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC122.hic":"154011688,34127","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC123.hic":"177663372,35293","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC124.hic":"382186226,35245","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC125.hic":"158160717,35271","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC127.hic":"110261177,34659","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC128.hic":"246131875,35509","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC129.hic":"260160119,35667","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC130.hic":"117479562,34681","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC131.hic":"81508929,34673","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC132.hic":"105959102,34895","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC133.hic":"91504812,33451","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC134.hic":"52222546,33737","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC135.hic":"57763085,34159","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC136.hic":"50618489,33731","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC137.hic":"193163606,33363","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC138.hic":"229876152,33777","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC139.hic":"201783666,33571","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC140.hic":"281163862,34125","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC141.hic":"275969727,33935","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC142.hic":"275020431,34125","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC144.hic":"223834810,34177","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC145.hic":"296632653,33937","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC146.hic":"290945216,33961","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC147.hic":"234459964,34231","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC148.hic":"295457850,34039","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC149.hic":"113569632,35695","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC150.hic":"304381897,33963","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC151.hic":"289314545,33805","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC152.hic":"284320182,33803","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC153.hic":"401393947,34659","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC154.hic":"188065488,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC155.hic":"299157119,33967","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC156.hic":"279289244,33787","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC157.hic":"254852119,33917","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC158.hic":"195969660,33477","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC159.hic":"185720388,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC160.hic":"227709279,33599","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC161.hic":"157225076,33209","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC162.hic":"105703444,32033","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC163.hic":"122665658,32121","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC164.hic":"228048231,33761","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC165.hic":"114440819,32011","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC166.hic":"285147558,33891","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC167.hic":"363116754,33943","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC168.hic":"119592158,31937","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC169.hic":"236853872,33785","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC170.hic":"195187639,33395","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC171.hic":"208044058,33309","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC172.hic":"144645916,32877","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC173.hic":"119115941,32203","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC175.hic":"178030481,33525","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC176.hic":"117220136,32169","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC177.hic":"128586196,32659","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC178.hic":"191419141,33629","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC179.hic":"141556748,32959","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC180.hic":"199825102,33185","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC181.hic":"301022688,33783","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC182.hic":"185384453,33205","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC183.hic":"202189264,36367","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC184.hic":"37464475,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC185.hic":"161938278,36099","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC186.hic":"133853166,36179","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC188.hic":"128068030,36237","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC189.hic":"148053886,36177","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC190.hic":"198946958,35803","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC191.hic":"226584564,36063","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC192.hic":"194412797,36341","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC193.hic":"176408194,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC194.hic":"207215649,36055","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC195.hic":"175185530,36315","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC196.hic":"168969337,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC197.hic":"121231252,36339","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC198.hic":"92713752,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC199.hic":"105130500,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC200.hic":"114526350,36479","hicfiles.s3.amazonaws.com%2Fmiseq%2Frh2014%2FHIC201.hic":"122689717,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fhap1%2Fin-situ%2Fcombined.hic":"9614983328,36479","s3.amazonaws.com%2Fhicfiles%2Fexternal%2Fctbp_8_4_17%2Fall_intra_megabase_michrom.hic":"154205644,10960","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2Fdel-Xa-combined.hic":"8843305329,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FdelXa-chrX-diploid.hic":"11173520,1498","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FWT-combined.hic":"13365182403,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FWT-chrX-diploid.hic":"17343459,1498","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FHIC002.hic":"4279298739,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FHIC003.hic":"3027365532,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FHIC004.hic":"2896130835,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FHIC005.hic":"4717830071,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FHIC006.hic":"5066210154,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FHIC007.hic":"3069516128,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2Fdel-Xi-combined.hic":"14551096423,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FdelXi-chrX-diploid.hic":"17362477,1498","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FHIC008.hic":"2572386655,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FHIC009.hic":"2935931663,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FHIC010.hic":"2019085070,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FHIC011.hic":"6087610814,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FHIC012.hic":"2809618194,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Frpe1%2FDarrowHuntley-2015%2FHIC013.hic":"2572386655,36479","hicfiles.s3.amazonaws.com%2Fhiseq%2Fpatski%2FDarrowHuntley-2015%2Fcombined.hic":"6950423609,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fpatski%2FDarrowHuntley-2015%2Fpaternal.hic":"220592749,15691","hicfiles.s3.amazonaws.com%2Fhiseq%2Fpatski%2FDarrowHuntley-2015%2Fmaternal.hic":"323233095,15691","hicfiles.s3.amazonaws.com%2Fhiseq%2Fpatski%2FDarrowHuntley-2015%2FHIC014.hic":"3183235800,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fpatski%2FDarrowHuntley-2015%2FHIC015.hic":"1739539801,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fpatski%2FDarrowHuntley-2015%2FHIC016.hic":"1105912758,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fpatski%2FDarrowHuntley-2015%2FHIC017.hic":"1060773319,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fpatski%2FDarrowHuntley-2015%2FHIC018.hic":"1203679874,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fpatski%2FDarrowHuntley-2015%2FHIC019.hic":"3321955269,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Frhesus%2FDarrowHuntley-2015%2FHIC020.hic":"7108980626,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2Fgm12878%2Fcola%2FDarrowHuntley-2015%2FHIC021.hic":"3906448676,34955","hicfiles.s3.amazonaws.com%2Fhiseq%2Fassembly%2Faedes%2Fcombined.hic":"390780490,2245","hicfiles.s3.amazonaws.com%2Fhiseq%2Fassembly%2Fhs2-hic.hic":"1960284186,33561","hicfiles.s3.amazonaws.com%2Fhiseq%2Fassembly%2FCpipJ3.hic":"766279097,4381","s3.amazonaws.com%2Fhicfiles%2Fexternal%2Fphanstiel%2Fupdated_O%2FSnyder_O.hic":"8046980555,18679","s3.amazonaws.com%2Fhicfiles%2Fexternal%2Fphanstiel%2FA_inter.hic":"10986005145,18679","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Funsynchronized%2Fcombined.hic":"30439217680,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Funsynchronized%2Fcombined.hic":"33255540403,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2Fdeep%2F20min_withdraw_combined.hic":"11078436933,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2Fdeep%2F40min_withdraw_combined.hic":"11031830038,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2Fdeep%2F60min_withdraw_combined.hic":"10312725340,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2Fdeep%2F180min_withdraw_combined.hic":"10038610214,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Funsynchronized%2FHIC001.hic":"8004335785,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Funsynchronized%2FHIC002.hic":"8453215933,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Funsynchronized%2FHIC003.hic":"9118406189,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Funsynchronized%2FHIC004.hic":"5973342894,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Funsynchronized%2FHIC005.hic":"6846576837,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Funsynchronized%2FHIC006.hic":"6075148017,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Funsynchronized%2FHIC007.hic":"8192366992,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Funsynchronized%2FHIC008.hic":"6844159653,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Funsynchronized%2FHIC009.hic":"7282063059,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Funsynchronized%2FHIC010.hic":"10410578833,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Funsynchronized%2FHIC011.hic":"8192366992,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Funsynchronized%2FHIC012.hic":"7223422850,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Funsynchronized%2FHIC013.hic":"7435986997,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Funsynchronized%2FHIC014.hic":"9120113605,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Fsynchronized%2Fcombined.hic":"4170577904,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Fsynchronized%2FHIC015.hic":"1504084990,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Fsynchronized%2FHIC016.hic":"1686244500,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Fsynchronized%2FHIC017.hic":"1804802410,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Funtreated%2Fsynchronized%2FHIC018.hic":"1533942067,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Fsynchronized%2Fcombined.hic":"4572390198,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Fsynchronized%2FHIC019.hic":"1543609666,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Fsynchronized%2FHIC020.hic":"1814133288,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Fsynchronized%2FHIC021.hic":"1942698243,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftreated_6hr%2Fsynchronized%2FHIC022.hic":"1873587413,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2Funtreated%2FRao-2017-HIC049.hic":"405127557,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2Funtreated%2FRao-2017-HIC060.hic":"326681741,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2Funtreated%2FRao-2017-HIC061.hic":"300908673,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_20min%2FRao-2017-HIC050.hic":"481758242,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_20min%2FRao-2017-HIC051.hic":"417577401,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_40min%2FRao-2017-HIC052.hic":"419353227,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_40min%2FRao-2017-HIC053.hic":"411554953,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_60min%2FRao-2017-HIC054.hic":"386655891,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_60min%2FRao-2017-HIC055.hic":"402170701,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_240min%2FRao-2017-HIC057.hic":"735906308,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min%2FRao-2017-HIC058.hic":"443789827,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min%2FRao-2017-HIC059.hic":"491422615,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min%2FRao-2017-HIC062.hic":"320261375,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min%2FRao-2017-HIC063.hic":"306590499,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_20min%2FRao-2017-HIC032S.hic":"367051742,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_20min%2FRao-2017-HIC033S.hic":"344555339,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_40min%2FRao-2017-HIC036S.hic":"349392947,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_40min%2FRao-2017-HIC037S.hic":"317714554,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_60min%2FRao-2017-HIC040S.hic":"266786397,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_60min%2FRao-2017-HIC041S.hic":"279445530,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_180min%2FRao-2017-HIC044S.hic":"898418269,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_180min%2FRao-2017-HIC045S.hic":"961006347,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_360min%2FRao-2017-HIC064.hic":"833576408,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_360min%2FRao-2017-HIC065.hic":"840881418,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_1080min%2FRao-2017-HIC066.hic":"980958864,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_1080min%2FRao-2017-HIC067.hic":"882023129,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_1440min%2FRao-2017-HIC068.hic":"1110292630,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fdegron%2Ftime_course%2FAuxin_treated_360min_withdraw_1440min%2FRao-2017-HIC069.hic":"1001747023,36479","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fexternal%2Frowley_nichols_mol_cell_2017%2FCP190_HiChIP.hic":"144107588,6976","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fexternal%2Frowley_nichols_mol_cell_2017%2FH3K27ac_HiChIP_combined.hic":"43171370,5233","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fexternal%2Frowley_nichols_mol_cell_2017%2FH3K27me3_HiChIP_combined.hic":"42906472,5233","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fexternal%2Frowley_nichols_mol_cell_2017%2FPol2_ChIAPET.hic":"41992430,6976","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fexternal%2Frowley_nichols_mol_cell_2017%2FPol2S2_HiChIP.hic":"145842743,6976","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fexternal%2Frowley_nichols_mol_cell_2017%2FArabidopsis_Wang2015_Liu2016.hic":"1134391078,4984","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fexternal%2Frowley_nichols_mol_cell_2017%2FElegans_Crane2015.hic":"387127568,8758","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fexternal%2Frowley_nichols_mol_cell_2017%2FNcrassa_Galazka2016.hic":"26555511,27725","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fexternal%2Frowley_nichols_mol_cell_2017%2FPfalciparum_trophozoite_Ay2014.hic":"15640893,13948","hicfiles.s3.amazonaws.com%2Fexternal%2Fduan%2FE-Me-A.hic":"6897251,23348","hicfiles.s3.amazonaws.com%2Fexternal%2Fduan%2FE-Me-B.hic":"4959088,23348","hicfiles.s3.amazonaws.com%2Fexternal%2Fduan%2FE-Mp-A.hic":"5232286,23348","hicfiles.s3.amazonaws.com%2Fexternal%2Fduan%2FE-Mp-B.hic":"5105292,23348","hicfiles.s3.amazonaws.com%2Fexternal%2Fduan%2FH-Me-A.hic":"6900072,23348","hicfiles.s3.amazonaws.com%2Fexternal%2Fduan%2FH-Me-B.hic":"8653258,23348","hicfiles.s3.amazonaws.com%2Fexternal%2Fduan%2FH-Mp-A.hic":"7999058,23348","hicfiles.s3.amazonaws.com%2Fexternal%2Fduan%2FH-Mp-B.hic":"8774657,23348","hicfiles.s3.amazonaws.com%2Fexternal%2Fdekker%2F4dn%2Fh1hesc.hic":"23671753603,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fdekker%2F4dn%2Fh1hesc_rep1.hic":"23671754721,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fdekker%2F4dn%2Fh1hesc_rep2.hic":"22269909910,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fdekker%2F4dn%2Fhffc6_rep1.hic":"19016661622,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Flieberman_aiden_van_berkum%2FGM06990_NcoI.hic":"480725203,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Flieberman_aiden_van_berkum%2F302NH.hic":"99948617,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Flieberman_aiden_van_berkum%2FK562.hic":"470263605,36151","hicfiles.s3.amazonaws.com%2Fexternal%2Flieberman_aiden_van_berkum%2FGM06990_HindIII.hic":"293706559,36289","hicfiles.s3.amazonaws.com%2Fexternal%2Flieberman_aiden_van_berkum%2FGM06990_rep_HindIII.hic":"309673862,36087","hicfiles.s3.amazonaws.com%2Fexternal%2Frudan%2Fcanis-lupus-rep1.hic":"1531151371,56905","hicfiles.s3.amazonaws.com%2Fexternal%2Frudan%2Fcanis-lupus-rep2.hic":"2851437676,56905","hicfiles.s3.amazonaws.com%2Fexternal%2Frudan%2Fmouse-rep1.hic":"582052544,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Frudan%2Fmacaque-rep1.hic":"698509182,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Frudan%2Fmacaque-rep2.hic":"461410393,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Frudan%2Frabbit-rep1.hic":"691045338,33561","hicfiles.s3.amazonaws.com%2Fexternal%2Frudan%2Frabbit-rep2.hic":"668888336,33561","hicfiles.s3.amazonaws.com%2Fexternal%2Fsexton%2Fcombined.hic":"50650087,4486","hicfiles.s3.amazonaws.com%2Fexternal%2Fkalhor%2Ftcc-hindiii.hic":"1071142023,16500","hicfiles.s3.amazonaws.com%2Fexternal%2Fkalhor%2Ftcc-mboi.hic":"1508851093,16448","hicfiles.s3.amazonaws.com%2Fexternal%2Fkalhor%2Fnon-tcc-hindiii.hic":"395179229,36093","hicfiles.s3.amazonaws.com%2Fexternal%2Fkalhor%2Ftcc-combined.hic":"1050423847,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fdixon%2Fmm9-hindiii%2Fsplit-read-run.hic":"9599984876,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fdixon%2Fhesc-hindiii.hic":"1952555632,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fdixon%2Fimr90-hindiii.hic":"9691260435,18679","hicfiles.s3.amazonaws.com%2Fexternal%2Fdixon%2Fmm9-cortex.hic":"3712072953,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fzhang%2Fatm-i-scei-chr18.hic":"2083350075,16438","hicfiles.s3.amazonaws.com%2Fexternal%2Fzhang%2Fatm-i-scei-chr2.hic":"3362049644,16360","hicfiles.s3.amazonaws.com%2Fexternal%2Fzhang%2Fatm-i-scei-chr7.hic":"1658399854,16438","hicfiles.s3.amazonaws.com%2Fexternal%2Fzhang%2Fwt-i-scei-chr15.hic":"866691249,16438","hicfiles.s3.amazonaws.com%2Fexternal%2Fzhang%2Fwt-i-scei-chr2.hic":"3304782795,16386","hicfiles.s3.amazonaws.com%2Fexternal%2Fnagano%2Fcell-1.hic":"23673506,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fnagano%2Fcell-2.hic":"26873280,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fnagano%2Fcell-3.hic":"31066362,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fnagano%2Fcell-4.hic":"16807724,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fnagano%2Fcell-5.hic":"28665065,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fnagano%2Fcell-6.hic":"13124158,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fnagano%2Fcell-7.hic":"15118945,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fnagano%2Fcell-8.hic":"68316814,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fnagano%2Fcell-9.hic":"18965101,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fnagano%2Fcell-10.hic":"17020666,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90%2Fcombined.hic":"6526601242,36427","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90%2Frep1.hic":"1861562891,36401","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90%2Frep2.hic":"3061013635,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90%2Frep3.hic":"1564588211,35969","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90%2Frep4.hic":"1255543175,36153","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90%2Frep5.hic":"974683253,36179","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90%2Frep6.hic":"1040805629,36053","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90-tnf-alpha%2Fcombined.hic":"8424080116,36401","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90-tnf-alpha%2Frep1.hic":"2697976702,36295","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90-tnf-alpha%2Frep3.hic":"1718610467,36159","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90-tnf-alpha%2Frep4.hic":"2029519405,36101","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90-tnf-alpha%2Frep5.hic":"985310855,36069","hicfiles.s3.amazonaws.com%2Fexternal%2Fjin%2Fimr90-tnf-alpha%2Frep6.hic":"1418750480,35967","hicfiles.s3.amazonaws.com%2Fexternal%2Fcheng%2Fmhh-call-4-cell-line.hic":"538380253,35351","hicfiles.s3.amazonaws.com%2Fexternal%2Fcheng%2Fprimary-b-all.hic":"773764191,35793","hicfiles.s3.amazonaws.com%2Fexternal%2Fcheng%2Fnormal-b-cell-line.hic":"336271459,35005","hicfiles.s3.amazonaws.com%2Fexternal%2Fcheng%2Frl-cell-line.hic":"484807998,35351","hicfiles.s3.amazonaws.com%2Fexternal%2Fhou%2Fkc167-biorep.hic":"135932435,8758","hicfiles.s3.amazonaws.com%2Fexternal%2Fhou%2Fkc167-techrep1.hic":"160355961,8758","hicfiles.s3.amazonaws.com%2Fexternal%2Fhou%2Fkc167-techrep2.hic":"188809887,8758","hicfiles.s3.amazonaws.com%2Fexternal%2Flin%2Fpre-prob-egs.hic":"2237792858,15483","hicfiles.s3.amazonaws.com%2Fexternal%2Flin%2Fprob-egs.hic":"5744720377,16438","hicfiles.s3.amazonaws.com%2Fexternal%2Flin%2Fprob-fa.hic":"2174866215,16438","hicfiles.s3.amazonaws.com%2Fexternal%2Fli%2Fhct116-rnapii-pilot.hic":"396366166,35999","hicfiles.s3.amazonaws.com%2Fexternal%2Fli%2Fhela-rnapii-pilot.hic":"882516759,35107","hicfiles.s3.amazonaws.com%2Fexternal%2Fli%2Fk562-rnapii-pilot.hic":"1131576189,35969","hicfiles.s3.amazonaws.com%2Fexternal%2Fli%2Fk562-rnapii-saturated.hic":"571583828,36291","hicfiles.s3.amazonaws.com%2Fexternal%2Fli%2Fmcf7-rnapii-saturated.hic":"1282547841,36035","hicfiles.s3.amazonaws.com%2Fexternal%2Fli%2Fnb4-rnapii-pilot.hic":"761614686,34861","hicfiles.s3.amazonaws.com%2Fexternal%2Fjung%2Fmouse_sperm.hic":"1730231642,29184","hicfiles.s3.amazonaws.com%2Fexternal%2Ftang%2Fgm12878.hic":"1953518212,20505","hicfiles.s3.amazonaws.com%2Fexternal%2Frutledge%2FSRR1791299.hic":"5723484,11956","hicfiles.s3.amazonaws.com%2Fexternal%2Frutledge%2FSRR1791297.hic":"16534743,23348","hicfiles.s3.amazonaws.com%2Fexternal%2Fzuin%2Fhek293t-rad21cv-hrv.hic":"5094525579,36289","hicfiles.s3.amazonaws.com%2Fexternal%2Fzuin%2Fhek293t-rad21cv-hrv-rep1.hic":"2574358912,36373","hicfiles.s3.amazonaws.com%2Fexternal%2Fzuin%2Fhek293t-rad21cv-hrv-rep2.hic":"3417099433,36243","hicfiles.s3.amazonaws.com%2Fexternal%2Fzuin%2Fhek293t-rad21cv-tev.hic":"4785157552,36323","hicfiles.s3.amazonaws.com%2Fexternal%2Fzuin%2Fhek293t-rad21cv-tev-rep1.hic":"2648268465,36321","hicfiles.s3.amazonaws.com%2Fexternal%2Fzuin%2Fhek293t-rad21cv-tev-rep2.hic":"2994727980,36107","hicfiles.s3.amazonaws.com%2Fexternal%2Fzuin%2Fhek293t-sirna-ctcf.hic":"5391791815,36063","hicfiles.s3.amazonaws.com%2Fexternal%2Fzuin%2Fhek293t-sirna-ctcf-rep1.hic":"3325842095,36269","hicfiles.s3.amazonaws.com%2Fexternal%2Fzuin%2Fhek293t-sirna-ctcf-rep2.hic":"3096215920,36167","hicfiles.s3.amazonaws.com%2Fexternal%2Fzuin%2Fhek293t-sirna-ctrl.hic":"3830902383,36167","hicfiles.s3.amazonaws.com%2Fexternal%2Fzuin%2Fhek293t-sirna-ctrl-rep1.hic":"1346712252,36079","hicfiles.s3.amazonaws.com%2Fexternal%2Fzuin%2Fhek293t-sirna-ctrl_rep2.hic":"3098067367,36271","hicfiles.s3.amazonaws.com%2Fexternal%2Fay%2Fp-falciparum-3d7-0h-hiseq.hic":"38174042,21889","hicfiles.s3.amazonaws.com%2Fexternal%2Fay%2Fp-falciparum-3d7-18h-hiseq.hic":"26506099,21889","hicfiles.s3.amazonaws.com%2Fexternal%2Fay%2Fp-falciparum-3d7-18h-hiseq-non-crosslinked_control.hic":"3545496,21889","hicfiles.s3.amazonaws.com%2Fexternal%2Fay%2Fp-falciparum-3d7-36h-hiseq.hic":"70754194,21889","hicfiles.s3.amazonaws.com%2Fexternal%2Fnaumova%2Fhelas3%2Fg1mid-r1.hic":"200863476,17185","hicfiles.s3.amazonaws.com%2Fexternal%2Fnaumova%2Fhelas3%2Fm-r1.hic":"249021190,17185","hicfiles.s3.amazonaws.com%2Fexternal%2Fnaumova%2Fhelas3%2Fm-r2.hic":"212341157,17185","hicfiles.s3.amazonaws.com%2Fexternal%2Fnaumova%2Fhelas3ccl2p2%2Fg1-0-25fa.hic":"583572265,17185","hicfiles.s3.amazonaws.com%2Fexternal%2Fnaumova%2Fhelas3ccl2p2%2Fg1-1fa.hic":"354502306,17185","hicfiles.s3.amazonaws.com%2Fexternal%2Fnaumova%2Fhelas3ccl2p2%2Fm-0-25fa.hic":"149308791,17185","hicfiles.s3.amazonaws.com%2Fexternal%2Fnaumova%2Fhelas3ccl2p2%2Fm-98percent.hic":"778175225,17185","hicfiles.s3.amazonaws.com%2Fexternal%2Fnaumova%2Fhelas3ccl2p2%2Fm-1fa.hic":"158091047,17185","hicfiles.s3.amazonaws.com%2Fexternal%2Fnaumova%2Fhff1%2Fcchic-hff1-ns-r1.hic":"801670039,17185","hicfiles.s3.amazonaws.com%2Fexternal%2Fnaumova%2Fhff1%2Fcchic-hff1-m-r1.hic":"875922086,17185","hicfiles.s3.amazonaws.com%2Fexternal%2Fnaumova%2Fk562%2Fm-r1.hic":"130959943,17185","hicfiles.s3.amazonaws.com%2Fexternal%2Fnaumova%2Fk562%2Fm-r2.hic":"237861106,17185","hicfiles.s3.amazonaws.com%2Fexternal%2Fsofueva%2FmAST-WT.hic":"496104039,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fsofueva%2FmAST-WT-adv-cre.hic":"438608517,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fsofueva%2FmAST-floxed-rep1.hic":"446205712,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fsofueva%2FmAST-floxed-rep2.hic":"386354767,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fsofueva%2FmAST-deleted-rep1.hic":"621998722,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fsofueva%2FmAST-deleted-rep2.hic":"583840829,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fsofueva%2FmNSC-floxed-rep1.hic":"801290988,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fsofueva%2FmNSC-floxed-rep2.hic":"819406658,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fsofueva%2FmNSC-deleted-rep1.hic":"792825269,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fsofueva%2FmNSC-deleted-rep2.hic":"746189884,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fsofueva%2FmNSC-WT.hic":"309353372,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fsofueva%2FmNSC-WT-OHT.hic":"274229679,30643","hicfiles.s3.amazonaws.com%2Fexternal%2Fseitan%2FTcell-Rad21KO-R1.hic":"1490362251,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fseitan%2FTcell-Rad21KO-R3.hic":"2403664421,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fseitan%2FTcell-Rad21WT-R1.hic":"1377124538,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fseitan%2FTcell-Rad21WT-R3.hic":"2646201369,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fmoissiard%2Fcrh6-mutant.hic":"105261071,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Fmoissiard%2FWT.hic":"127506388,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Fgrob%2FCol.hic":"153638500,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Fgrob%2Fcrwn1.hic":"211213220,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Fgrob%2Fcrwn4.hic":"134236837,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Fxie%2Fprimary.hic":"92936173,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Ffeng%2F6wt-control6wt337.hic":"318737891,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Ffeng%2F6wt-control6wt67.hic":"348123956,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Ffeng%2F6wt337.hic":"251107279,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Ffeng%2F6wt67.hic":"351840994,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Ffeng%2FCol0.hic":"345969497,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Ffeng%2Fclf28-swn7.hic":"299585025,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Ffeng%2Fcmt3-11.hic":"253427706,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Ffeng%2Fddm1-2.hic":"303626924,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Ffeng%2Fmet1-3.hic":"347697973,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Ffeng%2Fsuvh4-suvh5-suvh6.hic":"263122019,10217","hicfiles.s3.amazonaws.com%2Fexternal%2Fma%2FDNase-HiC-WG-K562.hic":"892955840,18679","hicfiles.s3.amazonaws.com%2Fexternal%2Fma%2FDNaseHiC-WG-H1.hic":"696922695,18679","hicfiles.s3.amazonaws.com%2Fexternal%2Fma%2FtargetedDNaseHiC-lincRNA-K562-rep1.hic":"341917716,18679","hicfiles.s3.amazonaws.com%2Fexternal%2Fma%2FtargeredDNaseHiC-lincRNA-K562-rep2.hic":"214841185,18679","hicfiles.s3.amazonaws.com%2Fexternal%2Fma%2FtargetedDNaseHiC-lincRNA-H1-rep1.hic":"616326137,18679","hicfiles.s3.amazonaws.com%2Fexternal%2Fma%2FtargetedDNaseHiC-lincRNA-H1-rep2.hic":"579654013,18679","hicfiles.s3.amazonaws.com%2Fexternal%2Fma%2FtargetedDNaseHiC-pe-H1-rep1.hic":"519810544,18679","hicfiles.s3.amazonaws.com%2Fexternal%2Fma%2FtargetedDNaseHiC-pe-K562-rep1.hic":"199553123,18679","hicfiles.s3.amazonaws.com%2Fexternal%2Frowley%2FKc167_DpnII.hic":"1319373594,6976","hicfiles.s3.amazonaws.com%2Fexternal%2Frowley%2FKc167_HinfI.hic":"1465493873,6976","hicfiles.s3.amazonaws.com%2Fexternal%2Frowley%2FKc167_DpnII_HinfI_combo.hic":"753062558,5814","hicfiles.s3.amazonaws.com%2Fexternal%2Fbarutcu%2FMCF-10A.hic":"2784956115,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fbarutcu%2FMCF-7.hic":"2700457411,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fbatullin%2Fsperm.hic":"501052169,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fminajigi%2FWT_hiC_rep1.hic":"1450697530,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fminajigi%2FWT_hiC_rep2.hic":"1189371558,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fminajigi%2Fcombined.hic":"2262007875,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fminajigi%2Finactive.hic":"4444564,751","hicfiles.s3.amazonaws.com%2Fexternal%2Fminajigi%2Factive.hic":"3993495,751","hicfiles.s3.amazonaws.com%2Fexternal%2Fdeng%2Fpatski_rep1.hic":"1650838357,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fdeng%2Fpatski_rep2.hic":"1258038606,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fdeng%2Fpatski.hic":"499827296,16438","hicfiles.s3.amazonaws.com%2Fexternal%2Fdeng%2Fpatski_active.hic":"79175714,15691","hicfiles.s3.amazonaws.com%2Fexternal%2Fdeng%2Fpatski_inactive.hic":"98947881,15691","hicfiles.s3.amazonaws.com%2Fexternal%2Fdeng%2Fbrain_dnase.hic":"4298088401,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fdeng%2Fbrain_in_situ_dnase.hic":"609321852,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fdeng%2Fbrain.hic":"1028196506,16438","hicfiles.s3.amazonaws.com%2Fexternal%2Fdeng%2Fbrain_active.hic":"79175714,15691","hicfiles.s3.amazonaws.com%2Fexternal%2Fdeng%2Fbrain_inactive.hic":"98947881,15691","hicfiles.s3.amazonaws.com%2Fexternal%2Fle%2FBglII_rep1.hic":"1283306,1463","hicfiles.s3.amazonaws.com%2Fexternal%2Fle%2FBglII_rep2.hic":"1263227,1463","hicfiles.s3.amazonaws.com%2Fexternal%2Fle%2FNcoI_rep1.hic":"4380906,1463","hicfiles.s3.amazonaws.com%2Fexternal%2Feagen%2FGSE89112_Kc167combined.hic":"1829549643,25624","hicfiles.s3.amazonaws.com%2Fexternal%2Feagen%2FGSE89112_Kc167combined_randomized.hic":"1859742654,25624","hicfiles.s3.amazonaws.com%2Fexternal%2Fmumbach%2FGSE80820_HiChIP_GM_cohesin.hic":"1231264781,17932","hicfiles.s3.amazonaws.com%2Fexternal%2Fmumbach%2FGSE80820_HiChIP_mES_cohesin_all.hic":"1152008628,16438","hicfiles.s3.amazonaws.com%2Fexternal%2Fmumbach%2FGSE80820_HiChIP_mES_Oct4.hic":"912828146,16438","s3.amazonaws.com%2Fhicfiles%2Fexternal%2Fwapl_hic%2FSCC4KO.hic":"1767906138,18679","s3.amazonaws.com%2Fhicfiles%2Fexternal%2Fwapl_hic%2FDKO.hic":"1487228787,18679","s3.amazonaws.com%2Fhicfiles%2Fexternal%2Fwapl_hic%2FWaplKO_1.14.hic":"1189751862,18679","s3.amazonaws.com%2Fhicfiles%2Fexternal%2Fwapl_hic%2FWaplKO_3.3.hic":"1155057696,18679","s3.amazonaws.com%2Fhicfiles%2Fexternal%2Fwapl_hic%2FWT.hic":"1522401568,18679","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fskfuwi4fnsjkdf9jekrw2%2Fmega_Liverpool%2Fmega.hic":"2612171975,4381","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fskfuwi4fnsjkdf9jekrw2%2FHIC2836_Liverpool1%2FLiverpool1.hic":"191729195,2245","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fskfuwi4fnsjkdf9jekrw2%2FHIC2861_Liverpool2%2FLiverpool2.hic":"1637096030,4381","s3.amazonaws.com%2Fhicfiles%2Fhiseq%2Fskfuwi4fnsjkdf9jekrw2%2FHIC2862_Liverpool3%2FLiverpool3.hic":"1160045602,4381","s3.amazonaws.com%2Fhicfiles%2Fexternal%2Fgoodell%2FHSPC.hic":"11857786247,36479","s3.amazonaws.com%2Fhicfiles%2Fexternal%2Fgoodell%2FHSPC_CanyonDel.hic":"8139168836,36479","s3.amazonaws.com%2Fhicfiles%2Fexternal%2Fgoodell%2Ftcell.hic":"9871547081,36479","s3.amazonaws.com%2Fhicfiles%2Fexternal%2Fgoodell%2Fep.hic":"17479335373,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fnagano%2FTh1_ensemble.hic":"1690592868,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fbonev%2FES_mapq30.hic":"32930498831,32386","hicfiles.s3.amazonaws.com%2Fexternal%2Fbonev%2FNPC_mapq30.hic":"55053730986,32386","hicfiles.s3.amazonaws.com%2Fexternal%2Fbonev%2FCN_mapq30.hic":"53138031154,32386","hicfiles.s3.amazonaws.com%2Fhiseq%2FKieffer-Kwon_et_al_2017%2FMain_maps%2FKieffer-Kwon-2017-activated_B_cells_72_hours_WT.hic":"16492991184,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2FKieffer-Kwon_et_al_2017%2FMain_maps%2FKieffer-Kwon-2017-resting_B_cells_WT.hic":"23057795398,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2FKieffer-Kwon_et_al_2017%2FMain_maps%2FKieffer-Kwon-2017-activated_B_cells_24_hours_MYC_KO.hic":"21245554876,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2FKieffer-Kwon_et_al_2017%2FMain_maps%2FKieffer-Kwon-2017-resting_B_cells_TSA.hic":"13933346059,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2FKieffer-Kwon_et_al_2017%2FMain_maps%2FKieffer-Kwon-2017-activated_B_cells_24_hours_oligomycin.hic":"21902506832,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2FKieffer-Kwon_et_al_2017%2FMain_maps%2FKieffer-Kwon-2017-mES_WT.hic":"9451969795,32102","hicfiles.s3.amazonaws.com%2Fhiseq%2FVian_et_al_2018%2FMain_maps%2FVian-2018-activated_B_cells_24_hours_WT.hic":"3600188564,16438","hicfiles.s3.amazonaws.com%2Fhiseq%2FVian_et_al_2018%2FMain_maps%2FVian-2018-activated_B_cells_30_hours_WT.hic":"1309503359,16438","hicfiles.s3.amazonaws.com%2Fhiseq%2FVian_et_al_2018%2FMain_maps%2FVian-2018-activated_B_cells_30_hours_HU_treated.hic":"1477252396,16438","hicfiles.s3.amazonaws.com%2Fhiseq%2FVian_et_al_2018%2FMain_maps%2FVian-2018-activated_B_cells_24_hours_flavopiridol.hic":"15711773490,32102","hicfiles.s3.amazonaws.com%2Fexternal%2Fpgp%2FPGP1F_mega_090118%2FPGP1F_mega_090118_30.hic":"24786676166,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fpgp%2FHIC7145%2FHIC7145_30.hic":"4554644616,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fpgp%2FHIC7146%2FHIC7146_30.hic":"4174848944,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fpgp%2FHIC7147%2FHIC7147_30.hic":"5062229182,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fpgp%2FHIC7862%2FHIC7862_30.hic":"4520990620,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fpgp%2FHIC7863%2FHIC7863_30.hic":"4330354773,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fpgp%2FHIC7864%2FHIC7864_30.hic":"5880640268,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fpgp%2FHIC7865%2FHIC7865_30.hic":"4431632469,36479","hicfiles.s3.amazonaws.com%2Fexternal%2Fpgp%2FHIC7866%2FHIC7866_30.hic":"4686000222,36479","encode-public.s3.amazonaws.com%2F2018%2F10%2F19%2Fb122542b-306c-4631-bdc3-2e155e89af55%2FENCFF718AWL.hic":"39544267907,58932","encode-public.s3.amazonaws.com%2F2019%2F02%2F15%2F8e787cd8-e388-4bc2-a236-7a5e6f39e0c0%2FENCFF999YXX.hic":"9255069996,56883","encode-public.s3.amazonaws.com%2F2019%2F02%2F08%2Ffc1d9d5d-8fa0-4e29-9080-3da674d9490d%2FENCFF543USQ.hic":"5005263062,36479","s3.us-east-1.wasabisys.com%2Fhicfiles%2Finternal%2FLCL_mega_42B_500bp_30.hic":"106482584851,22829","www.encodeproject.org%2Ffiles%2FENCFF925QIF%2F%40%40download%2FENCFF925QIF.hic":"51712684396,54779","www.encodeproject.org%2Ffiles%2FENCFF259YUS%2F%40%40download%2FENCFF259YUS.hic":"24640030444,54779","www.encodeproject.org%2Ffiles%2FENCFF783KQI%2F%40%40download%2FENCFF783KQI.hic":"27209249856,54779","www.encodeproject.org%2Ffiles%2FENCFF318JAP%2F%40%40download%2FENCFF318JAP.hic":"28636979242,54779","www.encodeproject.org%2Ffiles%2FENCFF512PQA%2F%40%40download%2FENCFF512PQA.hic":"28124104361,54779","www.encodeproject.org%2Ffiles%2FENCFF591MHA%2F%40%40download%2FENCFF591MHA.hic":"37373387202,54779","www.encodeproject.org%2Ffiles%2FENCFF197OWW%2F%40%40download%2FENCFF197OWW.hic":"41826180893,54779","www.encodeproject.org%2Ffiles%2FENCFF317OIA%2F%40%40download%2FENCFF317OIA.hic":"34741636038,54779","www.encodeproject.org%2Ffiles%2FENCFF522YLZ%2F%40%40download%2FENCFF522YLZ.hic":"24064692329,54779","www.encodeproject.org%2Ffiles%2FENCFF420JTA%2F%40%40download%2FENCFF420JTA.hic":"21202405177,54779","www.encodeproject.org%2Ffiles%2FENCFF871ZDJ%2F%40%40download%2FENCFF871ZDJ.hic":"10124815680,18679","www.encodeproject.org%2Ffiles%2FENCFF349RZY%2F%40%40download%2FENCFF349RZY.hic":"4446702705,36479","www.encodeproject.org%2Ffiles%2FENCFF738YON%2F%40%40download%2FENCFF738YON.hic":"3338049584,35947","www.encodeproject.org%2Ffiles%2FENCFF406KJN%2F%40%40download%2FENCFF406KJN.hic":"4132875306,36479","www.encodeproject.org%2Ffiles%2FENCFF081NPN%2F%40%40download%2FENCFF081NPN.hic":"34495587443,54779","www.encodeproject.org%2Ffiles%2FENCFF946RZW%2F%40%40download%2FENCFF946RZW.hic":"34571955193,54779","www.encodeproject.org%2Ffiles%2FENCFF602CHT%2F%40%40download%2FENCFF602CHT.hic":"30674798032,54779","www.encodeproject.org%2Ffiles%2FENCFF150DKS%2F%40%40download%2FENCFF150DKS.hic":"12618769864,36479","www.encodeproject.org%2Ffiles%2FENCFF614IPZ%2F%40%40download%2FENCFF614IPZ.hic":"42450060331,54779","www.encodeproject.org%2Ffiles%2FENCFF571ZQR%2F%40%40download%2FENCFF571ZQR.hic":"15230068871,47429","www.encodeproject.org%2Ffiles%2FENCFF705MKK%2F%40%40download%2FENCFF705MKK.hic":"38686554702,54779","www.encodeproject.org%2Ffiles%2FENCFF658KTB%2F%40%40download%2FENCFF658KTB.hic":"13195884405,47429","www.encodeproject.org%2Ffiles%2FENCFF435JYN%2F%40%40download%2FENCFF435JYN.hic":"17192139674,54779","www.encodeproject.org%2Ffiles%2FENCFF016JKX%2F%40%40download%2FENCFF016JKX.hic":"37266736642,54779","www.encodeproject.org%2Ffiles%2FENCFF294GFP%2F%40%40download%2FENCFF294GFP.hic":"36389843399,54779","www.encodeproject.org%2Ffiles%2FENCFF700CYI%2F%40%40download%2FENCFF700CYI.hic":"60482012152,54779","www.encodeproject.org%2Ffiles%2FENCFF962EDB%2F%40%40download%2FENCFF962EDB.hic":"39394328182,54779","www.encodeproject.org%2Ffiles%2FENCFF467OGP%2F%40%40download%2FENCFF467OGP.hic":"35572788855,54779","www.encodeproject.org%2Ffiles%2FENCFF556RLR%2F%40%40download%2FENCFF556RLR.hic":"34826921187,54779","www.encodeproject.org%2Ffiles%2FENCFF309UNV%2F%40%40download%2FENCFF309UNV.hic":"48510618174,54779","www.encodeproject.org%2Ffiles%2FENCFF653HCO%2F%40%40download%2FENCFF653HCO.hic":"41079007620,54779","www.encodeproject.org%2Ffiles%2FENCFF120DSV%2F%40%40download%2FENCFF120DSV.hic":"12790195576,47429","www.encodeproject.org%2Ffiles%2FENCFF284OEA%2F%40%40download%2FENCFF284OEA.hic":"46007570339,54779","www.encodeproject.org%2Ffiles%2FENCFF035BLF%2F%40%40download%2FENCFF035BLF.hic":"63868871985,54779","www.encodeproject.org%2Ffiles%2FENCFF094KKX%2F%40%40download%2FENCFF094KKX.hic":"42151419971,54779","www.encodeproject.org%2Ffiles%2FENCFF965BPU%2F%40%40download%2FENCFF965BPU.hic":"42717376107,54779","www.encodeproject.org%2Ffiles%2FENCFF842DUO%2F%40%40download%2FENCFF842DUO.hic":"39553892515,54779","www.encodeproject.org%2Ffiles%2FENCFF417GBZ%2F%40%40download%2FENCFF417GBZ.hic":"45544785452,54779","www.encodeproject.org%2Ffiles%2FENCFF499BVX%2F%40%40download%2FENCFF499BVX.hic":"40900674170,54779","www.encodeproject.org%2Ffiles%2FENCFF136XCV%2F%40%40download%2FENCFF136XCV.hic":"47700392974,54779","www.encodeproject.org%2Ffiles%2FENCFF224HKR%2F%40%40download%2FENCFF224HKR.hic":"40426005932,54779","www.encodeproject.org%2Ffiles%2FENCFF711XSR%2F%40%40download%2FENCFF711XSR.hic":"41434581949,54779","www.encodeproject.org%2Ffiles%2FENCFF660JWA%2F%40%40download%2FENCFF660JWA.hic":"54201632697,54779","www.encodeproject.org%2Ffiles%2FENCFF081PMO%2F%40%40download%2FENCFF081PMO.hic":"53428285130,54779","www.encodeproject.org%2Ffiles%2FENCFF799QGA%2F%40%40download%2FENCFF799QGA.hic":"1228682189,36479","www.encodeproject.org%2Ffiles%2FENCFF473CAA%2F%40%40download%2FENCFF473CAA.hic":"1077514950,36479","www.encodeproject.org%2Ffiles%2FENCFF663FRL%2F%40%40download%2FENCFF663FRL.hic":"39843938245,54779","www.encodeproject.org%2Ffiles%2FENCFF341WOY%2F%40%40download%2FENCFF341WOY.hic":"34792598619,54779","www.encodeproject.org%2Ffiles%2FENCFF515ZBF%2F%40%40download%2FENCFF515ZBF.hic":"41779230923,54779","www.encodeproject.org%2Ffiles%2FENCFF545GBW%2F%40%40download%2FENCFF545GBW.hic":"38351980358,54779","www.encodeproject.org%2Ffiles%2FENCFF252ANV%2F%40%40download%2FENCFF252ANV.hic":"37668839771,54779","www.encodeproject.org%2Ffiles%2FENCFF912NDK%2F%40%40download%2FENCFF912NDK.hic":"21196851956,54779","www.encodeproject.org%2Ffiles%2FENCFF683PLM%2F%40%40download%2FENCFF683PLM.hic":"21849338763,54779","www.encodeproject.org%2Ffiles%2FENCFF355NFJ%2F%40%40download%2FENCFF355NFJ.hic":"47880627268,54779","www.encodeproject.org%2Ffiles%2FENCFF507WEW%2F%40%40download%2FENCFF507WEW.hic":"35777782924,54779","www.encodeproject.org%2Ffiles%2FENCFF241MSL%2F%40%40download%2FENCFF241MSL.hic":"22507408288,54779","www.encodeproject.org%2Ffiles%2FENCFF135MUT%2F%40%40download%2FENCFF135MUT.hic":"24168734040,54779","www.encodeproject.org%2Ffiles%2FENCFF459FRB%2F%40%40download%2FENCFF459FRB.hic":"37166770103,54779","www.encodeproject.org%2Ffiles%2FENCFF705YZH%2F%40%40download%2FENCFF705YZH.hic":"44679182442,54779","www.encodeproject.org%2Ffiles%2FENCFF395INO%2F%40%40download%2FENCFF395INO.hic":"56727346538,54779","www.encodeproject.org%2Ffiles%2FENCFF736ITL%2F%40%40download%2FENCFF736ITL.hic":"49036286185,54779","www.encodeproject.org%2Ffiles%2FENCFF546TZN%2F%40%40download%2FENCFF546TZN.hic":"33195126348,54779","www.encodeproject.org%2Ffiles%2FENCFF706SFK%2F%40%40download%2FENCFF706SFK.hic":"3271831702,36479","www.encodeproject.org%2Ffiles%2FENCFF922ERE%2F%40%40download%2FENCFF922ERE.hic":"12476647122,36479","www.encodeproject.org%2Ffiles%2FENCFF876OWE%2F%40%40download%2FENCFF876OWE.hic":"1538692704,47429","www.encodeproject.org%2Ffiles%2FENCFF227XJZ%2F%40%40download%2FENCFF227XJZ.hic":"1925617685,36479","www.encodeproject.org%2Ffiles%2FENCFF053BXY%2F%40%40download%2FENCFF053BXY.hic":"1032237652,36479","www.encodeproject.org%2Ffiles%2FENCFF014VMM%2F%40%40download%2FENCFF014VMM.hic":"1564021703,36479","www.encodeproject.org%2Ffiles%2FENCFF563XES%2F%40%40download%2FENCFF563XES.hic":"1489180508,36479","www.encodeproject.org%2Ffiles%2FENCFF482LGO%2F%40%40download%2FENCFF482LGO.hic":"1208778887,36479","www.encodeproject.org%2Ffiles%2FENCFF216QQM%2F%40%40download%2FENCFF216QQM.hic":"6293163571,47429","www.encodeproject.org%2Ffiles%2FENCFF256UOW%2F%40%40download%2FENCFF256UOW.hic":"6293163571,47429","www.encodeproject.org%2Ffiles%2FENCFF791UZC%2F%40%40download%2FENCFF791UZC.hic":"37029615181,54779","www.encodeproject.org%2Ffiles%2FENCFF911AHQ%2F%40%40download%2FENCFF911AHQ.hic":"34246649165,54779","www.encodeproject.org%2Ffiles%2FENCFF491AOR%2F%40%40download%2FENCFF491AOR.hic":"558663570,36479","www.encodeproject.org%2Ffiles%2FENCFF307PDL%2F%40%40download%2FENCFF307PDL.hic":"525321519,36479","www.encodeproject.org%2Ffiles%2FENCFF773ITV%2F%40%40download%2FENCFF773ITV.hic":"295464771,36479","www.encodeproject.org%2Ffiles%2FENCFF198SSL%2F%40%40download%2FENCFF198SSL.hic":"500142476,36479","www.encodeproject.org%2Ffiles%2FENCFF251UEF%2F%40%40download%2FENCFF251UEF.hic":"567443575,36479","www.encodeproject.org%2Ffiles%2FENCFF942LTN%2F%40%40download%2FENCFF942LTN.hic":"4430960222,36479","www.encodeproject.org%2Ffiles%2FENCFF543USQ%2F%40%40download%2FENCFF543USQ.hic":"5005263062,36479","www.encodeproject.org%2Ffiles%2FENCFF434XQU%2F%40%40download%2FENCFF434XQU.hic":"25506511674,54779","www.encodeproject.org%2Ffiles%2FENCFF318GOM%2F%40%40download%2FENCFF318GOM.hic":"44750824314,54779","www.encodeproject.org%2Ffiles%2FENCFF004TKY%2F%40%40download%2FENCFF004TKY.hic":"20705661833,54779","www.encodeproject.org%2Ffiles%2FENCFF493YNC%2F%40%40download%2FENCFF493YNC.hic":"53407154984,54779","www.encodeproject.org%2Ffiles%2FENCFF334XXU%2F%40%40download%2FENCFF334XXU.hic":"14341194962,47429","www.encodeproject.org%2Ffiles%2FENCFF569RJM%2F%40%40download%2FENCFF569RJM.hic":"1922066634,36479","www.encodeproject.org%2Ffiles%2FENCFF076LWH%2F%40%40download%2FENCFF076LWH.hic":"39406255845,54779","www.encodeproject.org%2Ffiles%2FENCFF977XWK%2F%40%40download%2FENCFF977XWK.hic":"20563512962,54779","www.encodeproject.org%2Ffiles%2FENCFF127TPS%2F%40%40download%2FENCFF127TPS.hic":"21032070512,54779","www.encodeproject.org%2Ffiles%2FENCFF480KLP%2F%40%40download%2FENCFF480KLP.hic":"33115569647,54779","www.encodeproject.org%2Ffiles%2FENCFF281ILS%2F%40%40download%2FENCFF281ILS.hic":"28236353584,54779","www.encodeproject.org%2Ffiles%2FENCFF129LMU%2F%40%40download%2FENCFF129LMU.hic":"35247096013,54779","www.encodeproject.org%2Ffiles%2FENCFF759YCW%2F%40%40download%2FENCFF759YCW.hic":"16058537743,32102","www.encodeproject.org%2Ffiles%2FENCFF045YOM%2F%40%40download%2FENCFF045YOM.hic":"19775445828,32102","www.encodeproject.org%2Ffiles%2FENCFF013TGD%2F%40%40download%2FENCFF013TGD.hic":"4208420532,36479","www.encodeproject.org%2Ffiles%2FENCFF929RPW%2F%40%40download%2FENCFF929RPW.hic":"1974260276,36479","www.encodeproject.org%2Ffiles%2FENCFF996XEO%2F%40%40download%2FENCFF996XEO.hic":"2072918865,36479","www.encodeproject.org%2Ffiles%2FENCFF097SKJ%2F%40%40download%2FENCFF097SKJ.hic":"1983524001,36479","www.encodeproject.org%2Ffiles%2FENCFF464KRA%2F%40%40download%2FENCFF464KRA.hic":"1957300131,36479","www.encodeproject.org%2Ffiles%2FENCFF406HHC%2F%40%40download%2FENCFF406HHC.hic":"3854527235,36479","www.encodeproject.org%2Ffiles%2FENCFF080DPJ%2F%40%40download%2FENCFF080DPJ.hic":"19953768024,47429","www.encodeproject.org%2Ffiles%2FENCFF621AIY%2F%40%40download%2FENCFF621AIY.hic":"26781700010,54779","www.encodeproject.org%2Ffiles%2FENCFF366ERB%2F%40%40download%2FENCFF366ERB.hic":"1049184239,36479","www.encodeproject.org%2Ffiles%2FENCFF997RGL%2F%40%40download%2FENCFF997RGL.hic":"2521167549,36479","www.encodeproject.org%2Ffiles%2FENCFF029MPB%2F%40%40download%2FENCFF029MPB.hic":"1854711185,36479","www.encodeproject.org%2Ffiles%2FENCFF043EEE%2F%40%40download%2FENCFF043EEE.hic":"2924133032,36479","www.encodeproject.org%2Ffiles%2FENCFF920CJR%2F%40%40download%2FENCFF920CJR.hic":"3011577886,36479","www.encodeproject.org%2Ffiles%2FENCFF928NJV%2F%40%40download%2FENCFF928NJV.hic":"2778936244,36479","www.encodeproject.org%2Ffiles%2FENCFF894GLR%2F%40%40download%2FENCFF894GLR.hic":"2831733099,36479","www.encodeproject.org%2Ffiles%2FENCFF303PCK%2F%40%40download%2FENCFF303PCK.hic":"688704435,36479","www.encodeproject.org%2Ffiles%2FENCFF999YXX%2F%40%40download%2FENCFF999YXX.hic":"9255069996,56883","www.encodeproject.org%2Ffiles%2FENCFF685BLG%2F%40%40download%2FENCFF685BLG.hic":"16797022992,47429","www.encodeproject.org%2Ffiles%2FENCFF188SSH%2F%40%40download%2FENCFF188SSH.hic":"16797023050,47429","www.encodeproject.org%2Ffiles%2FENCFF465ESX%2F%40%40download%2FENCFF465ESX.hic":"13489465953,32102","www.encodeproject.org%2Ffiles%2FENCFF493SFI%2F%40%40download%2FENCFF493SFI.hic":"30033046818,54779","www.encodeproject.org%2Ffiles%2FENCFF235LCO%2F%40%40download%2FENCFF235LCO.hic":"38572174589,54779","www.encodeproject.org%2Ffiles%2FENCFF625VNK%2F%40%40download%2FENCFF625VNK.hic":"45202258438,54779","www.encodeproject.org%2Ffiles%2FENCFF304HMS%2F%40%40download%2FENCFF304HMS.hic":"36994445315,54779","www.encodeproject.org%2Ffiles%2FENCFF605CEN%2F%40%40download%2FENCFF605CEN.hic":"40358346301,54779","www.encodeproject.org%2Ffiles%2FENCFF086ORS%2F%40%40download%2FENCFF086ORS.hic":"22650781304,54779","www.encodeproject.org%2Ffiles%2FENCFF237UKR%2F%40%40download%2FENCFF237UKR.hic":"41516707246,54779","www.encodeproject.org%2Ffiles%2FENCFF004YZQ%2F%40%40download%2FENCFF004YZQ.hic":"71900665326,54779","www.encodeproject.org%2Ffiles%2FENCFF104THR%2F%40%40download%2FENCFF104THR.hic":"15172410632,54779","www.encodeproject.org%2Ffiles%2FENCFF807IRK%2F%40%40download%2FENCFF807IRK.hic":"17346637451,54779","www.encodeproject.org%2Ffiles%2FENCFF193CQL%2F%40%40download%2FENCFF193CQL.hic":"55726903245,54779","www.encodeproject.org%2Ffiles%2FENCFF700DEX%2F%40%40download%2FENCFF700DEX.hic":"20231399798,54779","www.encodeproject.org%2Ffiles%2FENCFF234MDO%2F%40%40download%2FENCFF234MDO.hic":"24635312640,54779","www.encodeproject.org%2Ffiles%2FENCFF181ROW%2F%40%40download%2FENCFF181ROW.hic":"26883606497,54779","www.encodeproject.org%2Ffiles%2FENCFF896OFN%2F%40%40download%2FENCFF896OFN.hic":"36952196833,54779","www.encodeproject.org%2Ffiles%2FENCFF573OPJ%2F%40%40download%2FENCFF573OPJ.hic":"36685546919,54779","www.encodeproject.org%2Ffiles%2FENCFF028RXH%2F%40%40download%2FENCFF028RXH.hic":"31053919206,54779","www.encodeproject.org%2Ffiles%2FENCFF156GGD%2F%40%40download%2FENCFF156GGD.hic":"35284134289,54779","www.encodeproject.org%2Ffiles%2FENCFF496GEU%2F%40%40download%2FENCFF496GEU.hic":"44659660933,54779","www.encodeproject.org%2Ffiles%2FENCFF945TUH%2F%40%40download%2FENCFF945TUH.hic":"3898570191,35639","www.encodeproject.org%2Ffiles%2FENCFF698KFV%2F%40%40download%2FENCFF698KFV.hic":"4427896684,35751","www.encodeproject.org%2Ffiles%2FENCFF239BHZ%2F%40%40download%2FENCFF239BHZ.hic":"1718552021,36479","www.encodeproject.org%2Ffiles%2FENCFF277LAN%2F%40%40download%2FENCFF277LAN.hic":"4542391336,36479","www.encodeproject.org%2Ffiles%2FENCFF397CMD%2F%40%40download%2FENCFF397CMD.hic":"2832016430,36479","www.encodeproject.org%2Ffiles%2FENCFF778OYA%2F%40%40download%2FENCFF778OYA.hic":"14067187484,47429","www.encodeproject.org%2Ffiles%2FENCFF775VSU%2F%40%40download%2FENCFF775VSU.hic":"14067187484,47429","www.encodeproject.org%2Ffiles%2FENCFF812THZ%2F%40%40download%2FENCFF812THZ.hic":"9667720429,36479","www.encodeproject.org%2Ffiles%2FENCFF777KBU%2F%40%40download%2FENCFF777KBU.hic":"5058284320,36479","www.encodeproject.org%2Ffiles%2FENCFF688KOY%2F%40%40download%2FENCFF688KOY.hic":"4198695833,36479","www.encodeproject.org%2Ffiles%2FENCFF223UBX%2F%40%40download%2FENCFF223UBX.hic":"1206064037,36479","www.encodeproject.org%2Ffiles%2FENCFF273XBU%2F%40%40download%2FENCFF273XBU.hic":"44085607579,54779","www.encodeproject.org%2Ffiles%2FENCFF952JZV%2F%40%40download%2FENCFF952JZV.hic":"44728845246,54779","www.encodeproject.org%2Ffiles%2FENCFF643NDM%2F%40%40download%2FENCFF643NDM.hic":"35877886780,54779","www.encodeproject.org%2Ffiles%2FENCFF586MQY%2F%40%40download%2FENCFF586MQY.hic":"71158037547,54779","www.encodeproject.org%2Ffiles%2FENCFF251VFA%2F%40%40download%2FENCFF251VFA.hic":"40089479399,54779","www.encodeproject.org%2Ffiles%2FENCFF033WGK%2F%40%40download%2FENCFF033WGK.hic":"30802023728,54779","www.encodeproject.org%2Ffiles%2FENCFF649OHR%2F%40%40download%2FENCFF649OHR.hic":"28203184265,54779","www.encodeproject.org%2Ffiles%2FENCFF782WVZ%2F%40%40download%2FENCFF782WVZ.hic":"37248221674,54779","www.encodeproject.org%2Ffiles%2FENCFF579CAR%2F%40%40download%2FENCFF579CAR.hic":"39662025395,54779","www.encodeproject.org%2Ffiles%2FENCFF514XWQ%2F%40%40download%2FENCFF514XWQ.hic":"1319613701,36479","www.encodeproject.org%2Ffiles%2FENCFF666USK%2F%40%40download%2FENCFF666USK.hic":"15051670107,32102","www.encodeproject.org%2Ffiles%2FENCFF047SDP%2F%40%40download%2FENCFF047SDP.hic":"1357076705,16438","www.encodeproject.org%2Ffiles%2FENCFF584LEP%2F%40%40download%2FENCFF584LEP.hic":"9314176858,36479","www.encodeproject.org%2Ffiles%2FENCFF671SOE%2F%40%40download%2FENCFF671SOE.hic":"3273732256,16438","www.encodeproject.org%2Ffiles%2FENCFF702LAP%2F%40%40download%2FENCFF702LAP.hic":"1800427500,31682","www.encodeproject.org%2Ffiles%2FENCFF339PON%2F%40%40download%2FENCFF339PON.hic":"5394351199,31514","www.encodeproject.org%2Ffiles%2FENCFF741QPR%2F%40%40download%2FENCFF741QPR.hic":"4271510019,30139","www.encodeproject.org%2Ffiles%2FENCFF103ANX%2F%40%40download%2FENCFF103ANX.hic":"4439745804,30083","www.encodeproject.org%2Ffiles%2FENCFF395SBC%2F%40%40download%2FENCFF395SBC.hic":"1596732351,31850","www.encodeproject.org%2Ffiles%2FENCFF289WNN%2F%40%40download%2FENCFF289WNN.hic":"8632980535,32102","www.encodeproject.org%2Ffiles%2FENCFF381EAU%2F%40%40download%2FENCFF381EAU.hic":"1702476311,36479","www.encodeproject.org%2Ffiles%2FENCFF976FEY%2F%40%40download%2FENCFF976FEY.hic":"1448279040,36479","www.encodeproject.org%2Ffiles%2FENCFF485LVS%2F%40%40download%2FENCFF485LVS.hic":"1593610856,36479","www.encodeproject.org%2Ffiles%2FENCFF143VJV%2F%40%40download%2FENCFF143VJV.hic":"1422312076,36479","www.encodeproject.org%2Ffiles%2FENCFF588NHX%2F%40%40download%2FENCFF588NHX.hic":"3943637009,36479","www.encodeproject.org%2Ffiles%2FENCFF768UBD%2F%40%40download%2FENCFF768UBD.hic":"24786676166,36479","www.encodeproject.org%2Ffiles%2FENCFF965PEE%2F%40%40download%2FENCFF965PEE.hic":"29387092778,47429","www.encodeproject.org%2Ffiles%2FENCFF702IFC%2F%40%40download%2FENCFF702IFC.hic":"29387092778,47429","www.encodeproject.org%2Ffiles%2FENCFF288DNV%2F%40%40download%2FENCFF288DNV.hic":"10313429504,36479","www.encodeproject.org%2Ffiles%2FENCFF698HWZ%2F%40%40download%2FENCFF698HWZ.hic":"10962849269,47429","www.encodeproject.org%2Ffiles%2FENCFF355OWW%2F%40%40download%2FENCFF355OWW.hic":"3219571601,36479","www.encodeproject.org%2Ffiles%2FENCFF177TYX%2F%40%40download%2FENCFF177TYX.hic":"10325679706,36479","www.encodeproject.org%2Ffiles%2FENCFF542BHD%2F%40%40download%2FENCFF542BHD.hic":"11085397879,47429","www.encodeproject.org%2Ffiles%2FENCFF684IFW%2F%40%40download%2FENCFF684IFW.hic":"11085397879,47429","www.encodeproject.org%2Ffiles%2FENCFF592UHE%2F%40%40download%2FENCFF592UHE.hic":"21363948089,32102","www.encodeproject.org%2Ffiles%2FENCFF779XIS%2F%40%40download%2FENCFF779XIS.hic":"9517383271,36479","www.encodeproject.org%2Ffiles%2FENCFF518PSL%2F%40%40download%2FENCFF518PSL.hic":"7500581463,36479","www.encodeproject.org%2Ffiles%2FENCFF275GBB%2F%40%40download%2FENCFF275GBB.hic":"7889407162,36479","www.encodeproject.org%2Ffiles%2FENCFF634KXI%2F%40%40download%2FENCFF634KXI.hic":"6430702966,36479","www.encodeproject.org%2Ffiles%2FENCFF337QPM%2F%40%40download%2FENCFF337QPM.hic":"8529733887,36479","www.encodeproject.org%2Ffiles%2FENCFF162KMP%2F%40%40download%2FENCFF162KMP.hic":"5615896908,36479","www.encodeproject.org%2Ffiles%2FENCFF992VTE%2F%40%40download%2FENCFF992VTE.hic":"7328975027,36479","www.encodeproject.org%2Ffiles%2FENCFF464WXY%2F%40%40download%2FENCFF464WXY.hic":"5715339664,36479","www.encodeproject.org%2Ffiles%2FENCFF752EGH%2F%40%40download%2FENCFF752EGH.hic":"1733758743,36479","www.encodeproject.org%2Ffiles%2FENCFF474UJM%2F%40%40download%2FENCFF474UJM.hic":"222309548,18679","www.encodeproject.org%2Ffiles%2FENCFF531UPZ%2F%40%40download%2FENCFF531UPZ.hic":"1827756846,36479","www.encodeproject.org%2Ffiles%2FENCFF022VHA%2F%40%40download%2FENCFF022VHA.hic":"244983451,18679","www.encodeproject.org%2Ffiles%2FENCFF732NGR%2F%40%40download%2FENCFF732NGR.hic":"1679484567,36479","www.encodeproject.org%2Ffiles%2FENCFF513VSF%2F%40%40download%2FENCFF513VSF.hic":"28397932940,36479","www.encodeproject.org%2Ffiles%2FENCFF750AOC%2F%40%40download%2FENCFF750AOC.hic":"36471430712,47429","www.encodeproject.org%2Ffiles%2FENCFF219YOB%2F%40%40download%2FENCFF219YOB.hic":"2859767211,26979","www.encodeproject.org%2Ffiles%2FENCFF604YDD%2F%40%40download%2FENCFF604YDD.hic":"3549694085,26979","www.encodeproject.org%2Ffiles%2FENCFF746AMV%2F%40%40download%2FENCFF746AMV.hic":"2954867135,26979","www.encodeproject.org%2Ffiles%2FENCFF845ZEB%2F%40%40download%2FENCFF845ZEB.hic":"2763039282,26979","www.encodeproject.org%2Ffiles%2FENCFF570LWS%2F%40%40download%2FENCFF570LWS.hic":"2861588289,26979","www.encodeproject.org%2Ffiles%2FENCFF883YVR%2F%40%40download%2FENCFF883YVR.hic":"2433679887,26979","www.encodeproject.org%2Ffiles%2FENCFF056VLK%2F%40%40download%2FENCFF056VLK.hic":"2502986910,26979","www.encodeproject.org%2Ffiles%2FENCFF532DUQ%2F%40%40download%2FENCFF532DUQ.hic":"3172615899,26979","www.encodeproject.org%2Ffiles%2FENCFF723PYJ%2F%40%40download%2FENCFF723PYJ.hic":"10292839095,36479","www.encodeproject.org%2Ffiles%2FENCFF991SGJ%2F%40%40download%2FENCFF991SGJ.hic":"13072407683,32102","www.encodeproject.org%2Ffiles%2FENCFF885UZI%2F%40%40download%2FENCFF885UZI.hic":"1201881201,16438","www.encodeproject.org%2Ffiles%2FENCFF287KXA%2F%40%40download%2FENCFF287KXA.hic":"14705801988,32102","www.encodeproject.org%2Ffiles%2FENCFF335HYI%2F%40%40download%2FENCFF335HYI.hic":"20366756545,32102","www.encodeproject.org%2Ffiles%2FENCFF121YPY%2F%40%40download%2FENCFF121YPY.hic":"2760104016,26979","www.encodeproject.org%2Ffiles%2FENCFF675SJE%2F%40%40download%2FENCFF675SJE.hic":"3751779995,26979","www.encodeproject.org%2Ffiles%2FENCFF876LAW%2F%40%40download%2FENCFF876LAW.hic":"4032376256,26979","www.encodeproject.org%2Ffiles%2FENCFF740KVX%2F%40%40download%2FENCFF740KVX.hic":"3202490322,26979","www.encodeproject.org%2Ffiles%2FENCFF977OQV%2F%40%40download%2FENCFF977OQV.hic":"2919735477,26979","www.encodeproject.org%2Ffiles%2FENCFF525EFN%2F%40%40download%2FENCFF525EFN.hic":"2394748073,26979","www.encodeproject.org%2Ffiles%2FENCFF690QRC%2F%40%40download%2FENCFF690QRC.hic":"3183023394,26979","www.encodeproject.org%2Ffiles%2FENCFF452FWS%2F%40%40download%2FENCFF452FWS.hic":"2951805127,26979","www.encodeproject.org%2Ffiles%2FENCFF089KBG%2F%40%40download%2FENCFF089KBG.hic":"2531936700,26979","www.encodeproject.org%2Ffiles%2FENCFF939ARM%2F%40%40download%2FENCFF939ARM.hic":"3066385212,26979","www.encodeproject.org%2Ffiles%2FENCFF401ZAN%2F%40%40download%2FENCFF401ZAN.hic":"3008677144,26979","www.encodeproject.org%2Ffiles%2FENCFF378RZT%2F%40%40download%2FENCFF378RZT.hic":"2830232168,26979","www.encodeproject.org%2Ffiles%2FENCFF304AVD%2F%40%40download%2FENCFF304AVD.hic":"6164439305,50358","www.encodeproject.org%2Ffiles%2FENCFF453DBX%2F%40%40download%2FENCFF453DBX.hic":"6775246670,36479","www.encodeproject.org%2Ffiles%2FENCFF590VOM%2F%40%40download%2FENCFF590VOM.hic":"6443478922,36479","www.encodeproject.org%2Ffiles%2FENCFF246DOF%2F%40%40download%2FENCFF246DOF.hic":"6837914659,36479","www.encodeproject.org%2Ffiles%2FENCFF125FXX%2F%40%40download%2FENCFF125FXX.hic":"9736232550,36479","www.encodeproject.org%2Ffiles%2FENCFF241RAY%2F%40%40download%2FENCFF241RAY.hic":"7686758397,36479","www.encodeproject.org%2Ffiles%2FENCFF415XWQ%2F%40%40download%2FENCFF415XWQ.hic":"6973092068,36479","www.encodeproject.org%2Ffiles%2FENCFF374EBH%2F%40%40download%2FENCFF374EBH.hic":"8557459058,36479","www.encodeproject.org%2Ffiles%2FENCFF263YWR%2F%40%40download%2FENCFF263YWR.hic":"331586820,18679","www.encodeproject.org%2Ffiles%2FENCFF280CGS%2F%40%40download%2FENCFF280CGS.hic":"1743569614,36479","www.encodeproject.org%2Ffiles%2FENCFF553ZNS%2F%40%40download%2FENCFF553ZNS.hic":"1717253636,36479","www.encodeproject.org%2Ffiles%2FENCFF451VOI%2F%40%40download%2FENCFF451VOI.hic":"1626927468,36479","www.encodeproject.org%2Ffiles%2FENCFF420MQO%2F%40%40download%2FENCFF420MQO.hic":"31055961677,36479","www.encodeproject.org%2Ffiles%2FENCFF301BWY%2F%40%40download%2FENCFF301BWY.hic":"38902429246,47429","www.encodeproject.org%2Ffiles%2FENCFF606XNW%2F%40%40download%2FENCFF606XNW.hic":"1009699327,36479","www.encodeproject.org%2Ffiles%2FENCFF439ZOU%2F%40%40download%2FENCFF439ZOU.hic":"12381714313,36479","www.encodeproject.org%2Ffiles%2FENCFF499SYK%2F%40%40download%2FENCFF499SYK.hic":"13182654663,47429","www.encodeproject.org%2Ffiles%2FENCFF532LFI%2F%40%40download%2FENCFF532LFI.hic":"8286030286,36479","www.encodeproject.org%2Ffiles%2FENCFF020DPP%2F%40%40download%2FENCFF020DPP.hic":"23521952420,47429","www.encodeproject.org%2Ffiles%2FENCFF306VTV%2F%40%40download%2FENCFF306VTV.hic":"23521952480,47429","www.encodeproject.org%2Ffiles%2FENCFF399IHE%2F%40%40download%2FENCFF399IHE.hic":"10216571232,36479","www.encodeproject.org%2Ffiles%2FENCFF944AII%2F%40%40download%2FENCFF944AII.hic":"12567308552,47429","www.encodeproject.org%2Ffiles%2FENCFF230HVV%2F%40%40download%2FENCFF230HVV.hic":"8629849711,36479","www.encodeproject.org%2Ffiles%2FENCFF174LAF%2F%40%40download%2FENCFF174LAF.hic":"9446506633,47429","www.encodeproject.org%2Ffiles%2FENCFF898HRO%2F%40%40download%2FENCFF898HRO.hic":"9446506633,47429","www.encodeproject.org%2Ffiles%2FENCFF429MOR%2F%40%40download%2FENCFF429MOR.hic":"1455757398,36479","www.encodeproject.org%2Ffiles%2FENCFF061NXV%2F%40%40download%2FENCFF061NXV.hic":"1710915891,36479","www.encodeproject.org%2Ffiles%2FENCFF434PYS%2F%40%40download%2FENCFF434PYS.hic":"1832274903,36479","www.encodeproject.org%2Ffiles%2FENCFF704HHX%2F%40%40download%2FENCFF704HHX.hic":"1768142834,36479","www.encodeproject.org%2Ffiles%2FENCFF349DPM%2F%40%40download%2FENCFF349DPM.hic":"4316041260,36479","www.encodeproject.org%2Ffiles%2FENCFF718AWL%2F%40%40download%2FENCFF718AWL.hic":"39544267907,58932","www.encodeproject.org%2Ffiles%2FENCFF065LSP%2F%40%40download%2FENCFF065LSP.hic":"24929805283,55874","www.encodeproject.org%2Ffiles%2FENCFF632MFV%2F%40%40download%2FENCFF632MFV.hic":"22333105467,55798","www.encodeproject.org%2Ffiles%2FENCFF179HVU%2F%40%40download%2FENCFF179HVU.hic":"2659219603,36479","www.encodeproject.org%2Ffiles%2FENCFF791SPZ%2F%40%40download%2FENCFF791SPZ.hic":"2537491657,36479","www.encodeproject.org%2Ffiles%2FENCFF211ZWF%2F%40%40download%2FENCFF211ZWF.hic":"3512141227,36479","www.encodeproject.org%2Ffiles%2FENCFF614BNU%2F%40%40download%2FENCFF614BNU.hic":"5252155462,36479","www.encodeproject.org%2Ffiles%2FENCFF891DLM%2F%40%40download%2FENCFF891DLM.hic":"2549095612,36479","www.encodeproject.org%2Ffiles%2FENCFF056EXT%2F%40%40download%2FENCFF056EXT.hic":"2219014704,36479","www.encodeproject.org%2Ffiles%2FENCFF776DSS%2F%40%40download%2FENCFF776DSS.hic":"3920308353,36479","www.encodeproject.org%2Ffiles%2FENCFF814LQF%2F%40%40download%2FENCFF814LQF.hic":"1349480197,36479","www.encodeproject.org%2Ffiles%2FENCFF513ZNA%2F%40%40download%2FENCFF513ZNA.hic":"2638868195,36479","www.encodeproject.org%2Ffiles%2FENCFF692IOL%2F%40%40download%2FENCFF692IOL.hic":"3106768498,36479","www.encodeproject.org%2Ffiles%2FENCFF294WZY%2F%40%40download%2FENCFF294WZY.hic":"2211089761,36479","www.encodeproject.org%2Ffiles%2FENCFF339UWS%2F%40%40download%2FENCFF339UWS.hic":"2142759055,36479","www.encodeproject.org%2Ffiles%2FENCFF835FSK%2F%40%40download%2FENCFF835FSK.hic":"3919821739,36479","www.encodeproject.org%2Ffiles%2FENCFF328BMB%2F%40%40download%2FENCFF328BMB.hic":"2550686152,36479","www.encodeproject.org%2Ffiles%2FENCFF897RTY%2F%40%40download%2FENCFF897RTY.hic":"1323294397,36479","www.encodeproject.org%2Ffiles%2FENCFF306MWH%2F%40%40download%2FENCFF306MWH.hic":"1665386199,36479","www.encodeproject.org%2Ffiles%2FENCFF039YUJ%2F%40%40download%2FENCFF039YUJ.hic":"2335679939,36479","www.encodeproject.org%2Ffiles%2FENCFF468QIN%2F%40%40download%2FENCFF468QIN.hic":"3352516594,36479","www.encodeproject.org%2Ffiles%2FENCFF364WXU%2F%40%40download%2FENCFF364WXU.hic":"3959043175,36479","www.encodeproject.org%2Ffiles%2FENCFF373MSH%2F%40%40download%2FENCFF373MSH.hic":"4429550624,36479","www.encodeproject.org%2Ffiles%2FENCFF959EGQ%2F%40%40download%2FENCFF959EGQ.hic":"2475218228,36479","www.encodeproject.org%2Ffiles%2FENCFF624XMK%2F%40%40download%2FENCFF624XMK.hic":"3527855681,36479","www.encodeproject.org%2Ffiles%2FENCFF445OKS%2F%40%40download%2FENCFF445OKS.hic":"3369125589,36479","www.encodeproject.org%2Ffiles%2FENCFF239QDV%2F%40%40download%2FENCFF239QDV.hic":"1960069888,36479","www.encodeproject.org%2Ffiles%2FENCFF645AVM%2F%40%40download%2FENCFF645AVM.hic":"4969006589,36479","www.encodeproject.org%2Ffiles%2FENCFF494IPI%2F%40%40download%2FENCFF494IPI.hic":"1565483792,36479","www.encodeproject.org%2Ffiles%2FENCFF753IXE%2F%40%40download%2FENCFF753IXE.hic":"2892400648,36479","www.encodeproject.org%2Ffiles%2FENCFF731GXX%2F%40%40download%2FENCFF731GXX.hic":"5131381303,36479","www.encodeproject.org%2Ffiles%2FENCFF369CAQ%2F%40%40download%2FENCFF369CAQ.hic":"4236629448,36479","www.encodeproject.org%2Ffiles%2FENCFF053VBX%2F%40%40download%2FENCFF053VBX.hic":"54305946375,47429","www.encodeproject.org%2Ffiles%2FENCFF555ISR%2F%40%40download%2FENCFF555ISR.hic":"54305946434,47429","www.encodeproject.org%2Ffiles%2FENCFF964RSP%2F%40%40download%2FENCFF964RSP.hic":"12065485229,36479","www.encodeproject.org%2Ffiles%2FENCFF234MZQ%2F%40%40download%2FENCFF234MZQ.hic":"17507142760,47429","www.encodeproject.org%2Ffiles%2FENCFF994CEG%2F%40%40download%2FENCFF994CEG.hic":"17507142760,47429","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb068e787-bbdd-49e2-9f6d-7a0e9f065d6e%2F4DNFIHSUIRFY.hic":"2701182442,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3768b89a-e124-40eb-8acd-94a4fdd35807%2F4DNFIXTAS6EE.hic":"3283740601,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9c513602-5abb-4088-8415-c827c381ab0d%2F4DNFIC3JD6O2.hic":"4896075767,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fde954dad-1849-4c23-beb4-bf893b7d76c9%2F4DNFIGY85S4W.hic":"3364151996,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe1befa6e-8067-4296-8db2-67d2a2458985%2F4DNFI2LTNXME.hic":"3699291418,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbb3307fd-7162-477a-87c5-52f12d03befc%2F4DNFID162B9J.hic":"3576428773,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8597cdae-8319-42d9-9175-3f77aaee34e1%2F4DNFIQWS3632.hic":"4022561190,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F327f091d-6a63-47c4-9752-2dff303a13d9%2F4DNFI6GFHB6G.hic":"4239331168,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd70dc3b8-48a7-42c2-bd23-80bc44fc2266%2F4DNFIS5F6EBL.hic":"4404671861,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F77df7bf8-6a3d-407a-8968-4ca1e78d2269%2F4DNFIF2D3TL9.hic":"4793989394,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc8f7cc35-d2ef-4717-9009-c02154050fbf%2F4DNFI6EIFUZI.hic":"3370273763,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F98449d79-30d1-4e32-801d-07435819a42f%2F4DNFIRKGMZRQ.hic":"4669813207,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd4fe1844-2493-4722-8b98-34a93a4bb7d8%2F4DNFIQWD8ZYD.hic":"5379889057,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1ee40499-1de4-47ff-b540-d9a65943c6b8%2F4DNFIX7H3CE2.hic":"4857679239,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fac016170-23a7-4111-8773-353d6c150f34%2F4DNFIO21YDCV.hic":"4695989644,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1faea4e7-9a32-466e-a826-0bfdab6cd915%2F4DNFIUE5RAS6.hic":"4788044799,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fcbd396ed-11bb-404f-aed9-ef10abc258e6%2F4DNFIFI6NIKJ.hic":"2069414927,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Faf3f78db-ae92-4215-bcae-76d30c617e5d%2F4DNFIL5K3MA1.hic":"2585598247,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F66fc2893-224e-48b4-bdb0-25e022dedd03%2F4DNFIPV5KFMK.hic":"2060965679,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2b39781d-aadc-434f-abe3-562d61308fdd%2F4DNFIW8TIFI5.hic":"1694424195,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb6d28f7b-27d3-486f-b5ac-32567416560d%2F4DNFIA6NSSBJ.hic":"2219532611,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F08785616-722e-46bb-ade2-2fdd21324e11%2F4DNFIBKZK63V.hic":"2429136232,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F904b13d3-1203-42a4-812c-963e80c159b1%2F4DNFI3CFMRID.hic":"1233390166,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb0ed4afe-5ecf-451d-bb1f-444697e3f558%2F4DNFIYIAUEPW.hic":"1753567534,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4bb9a9b3-12a8-4d2f-8071-4722294c88ea%2F4DNFIC3HAU11.hic":"2271375254,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5abf9c36-c1d1-44dc-8197-74d860d896c0%2F4DNFIM2BMJ33.hic":"1770471113,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa68475db-7816-4cec-b2da-d4ce4a0c7a0e%2F4DNFIBY3UHJB.hic":"2095528423,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F07c40943-0d0b-4b3e-94a0-8583b0e00b47%2F4DNFIWZEN3FF.hic":"1558559508,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd8a39553-2718-4866-9b2a-45d8e9c5ac6f%2F4DNFIE5TEYK7.hic":"1323063102,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F294b61ef-5565-4f04-ade9-f921a6686cce%2F4DNFI7H4II2V.hic":"1436947982,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F87a70ad7-7d34-4302-9c03-eb824bd4e633%2F4DNFIAS8LV1C.hic":"1263105698,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9db804c6-5a91-4cf5-8ae9-e054223afb77%2F4DNFIBXWIH8J.hic":"1587059951,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd1e55906-ec8f-444b-8ce1-2de22a431a76%2F4DNFIO2HBDAI.hic":"1666436393,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7a4b9b37-8e38-470c-8190-fd4d513c0bbb%2F4DNFIXWCLD4M.hic":"1513511880,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6c7615b2-5310-4bbf-a605-98761d3a3079%2F4DNFINASC4NQ.hic":"1420358914,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F20454014-49cd-4e2d-93da-f40ad52776d5%2F4DNFIZF1KI43.hic":"1377041630,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5df04e86-ee2a-45f2-b878-bf1648e2cca5%2F4DNFIQBHR9XC.hic":"1179502734,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9d1cc910-bb3f-4106-802a-73184c58d5ba%2F4DNFIQVMVRP6.hic":"1811976991,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe431986b-0732-460f-92ff-0abd1694d2d0%2F4DNFIJ7OAIFQ.hic":"1685503856,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F56d0c575-4962-4ea3-92c3-55bd0e17c096%2F4DNFIE8E4ANZ.hic":"1598369564,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fdb1502fb-a989-4ef9-b800-7eaa7be172ae%2F4DNFIOUSETUP.hic":"1493294709,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Facc2f1c3-8c96-4d21-814a-3a8ba81e7741%2F4DNFIVJ3IIQL.hic":"1472376655,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F037fb4c3-8641-4953-a977-cc71f2137582%2F4DNFIHN2QSMX.hic":"1179632606,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F16d2c3c0-6d29-4815-b074-b142af90b615%2F4DNFIILDWK8M.hic":"2280059989,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F31789849-e4db-45d8-9730-66a048c02d8a%2F4DNFI6XD6JAQ.hic":"2253961696,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fff04947e-e6e8-4d62-8374-ef2ee4104809%2F4DNFIALNLR78.hic":"1914687914,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F53e6c1e7-9410-4158-84e6-57c2e683b095%2F4DNFIBT4EAKN.hic":"2296378356,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0127900a-258f-4815-97d2-6fd2b043d853%2F4DNFIDJ2JZ7Q.hic":"2558945393,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F89f95693-3d28-44eb-9d45-14932f8e258c%2F4DNFI8JFOAJT.hic":"1726440253,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd803d818-b0d4-4796-8d61-a9f3943f3b10%2F4DNFIRZA6EV6.hic":"1805017504,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff9165fb1-0782-4757-a740-5b929e0252bb%2F4DNFIB7QTIMH.hic":"2541020707,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff8d916b2-b58e-4cdf-894c-ffcb3bf6ebd9%2F4DNFIJ5DQZVK.hic":"2445734043,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F14066a5b-e01a-43c2-a468-b18826174df3%2F4DNFISTWNV9C.hic":"2499319890,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd0692151-7f9a-4475-b059-f8802616dded%2F4DNFIBN9K4V9.hic":"1591570769,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F70a7ef36-a514-4e45-918f-47c4e9e30ef4%2F4DNFIR8OU6QJ.hic":"1689882108,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F180306cd-8593-413a-ae83-24f19209c5d2%2F4DNFIDSWKFF5.hic":"1596696630,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6e7b9be7-f465-4434-8e9c-68d1e44a76af%2F4DNFIV239W4L.hic":"2345867406,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F55df948c-941d-4930-854c-6a07557a0c1d%2F4DNFIREVU1Z5.hic":"2254683002,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3f590cb7-df3a-498f-81c3-d5ed4179b8ad%2F4DNFIFHU75I5.hic":"2497670883,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8f064770-6008-4f74-bfca-268d4a22d745%2F4DNFIMROE6N4.hic":"9850583704,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa93d0588-76b7-4ccf-933c-4325876b0a53%2F4DNFI5SUHCGZ.hic":"10364705187,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2f5f0d6b-0b22-4936-93c9-0944d49c037b%2F4DNFII84FBKM.hic":"8836986129,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F12e90fc5-0b76-4e42-b346-58d267f9ad6e%2F4DNFI2J1ODWB.hic":"13410858286,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff2702a45-3e8b-4980-bcd5-6bb0e291614f%2F4DNFIJWBWE41.hic":"20515676755,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa0859349-5f06-4ad3-b56f-b1166b34a9eb%2F4DNFIIMZB6Y9.hic":"15350325963,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F12685c57-d54a-46fa-9efb-acf34ed77574%2F4DNFICJECID5.hic":"1525002266,26979","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd101a58e-89aa-44fd-96c5-6bf1e2476272%2F4DNFIR6UW2QA.hic":"1264999913,26979","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3d8c73bf-1335-4af4-b124-e3622d48c5f6%2F4DNFIGOEKBUZ.hic":"1905947578,26979","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fcd2477cf-6ed0-4d7b-b4e9-88fb38b0df48%2F4DNFIMDNAEW4.hic":"996444147,26979","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0f03953e-29da-4f2e-8c05-572d0edf4525%2F4DNFI5OSZ3JC.hic":"369361754,22829","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F29d95dbb-005a-4ae1-8b9c-0fec9ec0bbd0%2F4DNFI7KOUGFM.hic":"1227434049,26979","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa441ab7b-afbe-437d-bf98-b6b916558642%2F4DNFIGKX4A32.hic":"883933242,26979","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F941b2f94-2fff-4d3c-aceb-fee4a5ae41a9%2F4DNFI1ORHOTA.hic":"1140970677,26979","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8720ede9-093f-4c00-912f-373283260a16%2F4DNFIWSVLZED.hic":"458091151,26979","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe9e17155-2b62-4a68-afb2-31dfa674e169%2F4DNFI6H926RO.hic":"3552863515,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F22f22778-987a-4dc0-97bc-f26eae0156d9%2F4DNFIKTYSPOF.hic":"2939475400,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F40f40192-0acb-44cb-8778-8d21afe593fb%2F4DNFIZ4S52BV.hic":"3067438113,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd8767374-7018-4e11-9226-bf5612d39ebb%2F4DNFI3APMXHF.hic":"3258874744,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8c5140ec-a65a-4186-8c59-2927233eecaa%2F4DNFIQLIKDSD.hic":"2746398416,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8cdedda6-d7d8-4231-a85b-d56fcd962366%2F4DNFIKYXMF1E.hic":"14442148774,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Faa4d4497-7c6c-4dad-8040-be13ba07ea32%2F4DNFI9815EEJ.hic":"17960817603,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe9b7b95f-190b-49fe-8047-ef4a8fc59746%2F4DNFIQ2687RT.hic":"15954277087,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F59863d3a-8d7c-49c7-9a41-7f2a58ad24d1%2F4DNFIYDBBSE3.hic":"16499534862,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3e80ca41-b3e0-4f4f-a05e-8f95fe96d938%2F4DNFIMOCN1YS.hic":"863725312,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F96f97a01-0020-4f09-93e8-fc8a9fd07218%2F4DNFI6558CM8.hic":"1597967345,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fce9e9334-ee0b-4549-a845-110470ba5986%2F4DNFIQZRKS7Y.hic":"907626411,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fdaac8209-1015-48da-9e31-2e252dfd8fe0%2F4DNFIX4DLXSE.hic":"1369766288,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F268b7d52-9655-474c-9467-8ba31bb2195c%2F4DNFII3JV8I1.hic":"856656441,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9681f9b5-335a-4f56-afa1-15b58bbb41e8%2F4DNFI5IAH9H1.hic":"1495185175,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3e082eab-95aa-4677-88ed-9d7adcc1effb%2F4DNFIK5HY1GP.hic":"2135337789,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F31af1ead-4520-4669-957e-424b4b197c33%2F4DNFIFA89L5B.hic":"1975593640,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fcc2b78fd-52d4-4e0c-ac93-b84ee82daf7e%2F4DNFICXCFGEI.hic":"2628202920,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff54efece-280f-46ca-95e3-1f8a3cd18820%2F4DNFIK4CECUH.hic":"1901129375,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1181c0c4-afb7-4b6a-9fdc-d868fb2253fc%2F4DNFI1EYIGOC.hic":"1947135384,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1d3e2905-b9b9-4b91-bcb4-8d34746e78f6%2F4DNFI7TLEWUI.hic":"1185758726,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Faba3d42f-39cd-4a85-9d3f-835aefb5c803%2F4DNFIVCJKHMN.hic":"687240974,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F27f54fcb-54fe-41a4-b25a-2f8944c89044%2F4DNFIN8F14CS.hic":"1304082029,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb75fedb5-88f4-4bc0-8e38-298df7847a7f%2F4DNFI5LCW273.hic":"12497258313,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2f22b2a0-3712-496e-92d2-63775ec0e421%2F4DNFIVSCH2CH.hic":"12594733778,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F07e47261-5863-44f5-9198-76e263081bea%2F4DNFIZ268JGC.hic":"1499059135,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F682b1ae1-3ac3-40e4-a330-c49f63946952%2F4DNFIJ1P4HBI.hic":"1190211725,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F197e7c89-ea73-41de-8cb2-8c0b1e3bb945%2F4DNFITEGKBIW.hic":"2061501971,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F191f6928-c9a8-44b2-8516-ee4d6005f24b%2F4DNFIE1P6RVH.hic":"1711447310,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F94435086-3701-4b28-a6d0-4a59b24d7615%2F4DNFICJ6I4DO.hic":"1557899940,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Faa9ac173-d233-41c7-8985-ca91949664e4%2F4DNFIKUG8MEW.hic":"1339072088,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fba6d8ab6-ee18-4ba2-8da9-d631888dd50a%2F4DNFICFZGFAV.hic":"1261083478,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F87a3ab04-7094-4673-81e4-ac8c9add8eb5%2F4DNFIQXCZVVA.hic":"1084913802,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbc1ff488-82af-4579-9424-959184edb139%2F4DNFIB6PJFJ3.hic":"1114571343,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1f7026ee-987a-41e7-8a61-45510ee3f86b%2F4DNFIX97731O.hic":"1246860402,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6186787c-2e72-4925-9729-02121e2e4597%2F4DNFIYQYZOTO.hic":"1212210849,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3b98a946-0109-4efa-a13e-cc7a36772125%2F4DNFIPXU7V25.hic":"1696288217,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fea17d041-c6ed-43a1-8047-535f3d19ad44%2F4DNFIL39PR76.hic":"1719284710,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F72774afe-f166-42ac-9849-4070b0dadf6d%2F4DNFIYLJ3R3B.hic":"1106419640,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4a45e733-55f8-4a8e-be24-2ef34c976e25%2F4DNFIL51WBN6.hic":"1327651164,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F086c62b0-a26f-41ae-a5ff-88b8be2bd2aa%2F4DNFI6SFPUDA.hic":"1336964405,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4d9b79c7-af62-4070-84a9-b953903f2732%2F4DNFI2KM22QR.hic":"953067310,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3c9889d1-f49e-4639-8e15-2d99d6cd22e7%2F4DNFIVF8Q45U.hic":"984193565,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa080dd7b-b7bb-4eae-a275-572a8b45b2d0%2F4DNFI2RN3WFP.hic":"1046525527,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb81860ca-c227-4b68-a298-1907fd32300a%2F4DNFI4TJTL7A.hic":"1160373401,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F74ab47dc-7b52-421c-845e-6feb33457adf%2F4DNFIYJ4TWB8.hic":"1268416204,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc6582128-a930-4bcc-941e-5c0733bdd4d5%2F4DNFIM6RGKPV.hic":"863347067,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F11a75514-4450-4295-9eda-18e3678a575a%2F4DNFIL2VWWL5.hic":"860731581,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5eb52a8c-bf14-4225-bf34-14a0aa47c369%2F4DNFIX6ZXCA8.hic":"893462267,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F66aaa4c0-1f62-4040-8ecc-4e95da23cd18%2F4DNFIEVR81FS.hic":"879736207,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F821c6e7f-96f7-47de-b7d9-4970562b3c8e%2F4DNFIAUI6BBI.hic":"996313881,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9252c362-31ab-413d-a47a-cc97bdbf243a%2F4DNFIAFEE9G2.hic":"1103265750,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc1a0bf52-2e65-4deb-871f-ede736babd41%2F4DNFIPZBEXCP.hic":"1081257762,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F729f5ce3-d7e0-466d-b781-d18049e63bfa%2F4DNFIWPKRZGU.hic":"973779283,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F80b769ee-a717-4825-9db0-dca86f913173%2F4DNFIMD9QNDX.hic":"1158688208,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F266290c0-2767-4158-85ab-7274368905b9%2F4DNFIATA1HD5.hic":"1073361089,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc46f18a8-eb24-4d35-b112-36db72bde2f5%2F4DNFIH9U4I7I.hic":"1111124316,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fec91a79e-7de7-49f7-9b3d-d28313aeddc8%2F4DNFIZ95S6TR.hic":"1242494051,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9e9390b9-da20-43bb-a8f4-9830f354ddf9%2F4DNFI5ERM9J7.hic":"1271051397,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fee8ea82e-b9e4-41ad-bced-5f4fbdaa4fec%2F4DNFI15FPSQL.hic":"1216714120,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbed7eb86-8990-42f2-b3ee-5992d6361f7c%2F4DNFIJ3DZPGM.hic":"1035089437,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fdaa8a324-3bf8-424c-8a86-b8ad325cc20d%2F4DNFINW9P6XF.hic":"1215712740,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F70631758-6bf8-47a0-92b6-132574886faa%2F4DNFITS16HW8.hic":"1105283847,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe473304b-7bc8-49b8-bba1-ecb9f06914ee%2F4DNFIS3DIH4V.hic":"1036056660,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F10f9224a-111c-402a-ac25-e221ad0af9ef%2F4DNFIY3KDHP6.hic":"1071761024,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F17519b96-2bdd-4294-98f0-1535f1aef28e%2F4DNFIO8HVKOL.hic":"953793750,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ffb18f896-4730-4909-86a3-867fc8e76cd6%2F4DNFIMF6CFOM.hic":"708717889,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fcfee4d87-0873-40b0-b79f-35dcc8669c1c%2F4DNFIZZ77KD2.hic":"732668723,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb8b5d909-8a1b-41bb-bcdd-d108a0bde762%2F4DNFIOLO226X.hic":"951271932,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9ce81f6e-b9cf-4ec9-8bd3-517539e4b662%2F4DNFIJMS2ODT.hic":"932509067,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F506aa952-5d41-49ff-b658-916bcf88a395%2F4DNFI49F3LJ4.hic":"1208494817,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe4dc392d-ca36-4bdf-a27d-173cae34f520%2F4DNFI65MQOIJ.hic":"854630155,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F149ef8d7-e0b4-4e4f-b7e5-7226e2603746%2F4DNFIM4KEPRD.hic":"882790622,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa436f0a8-4f9a-4524-90ac-795c5b8491cf%2F4DNFIIXBIZFC.hic":"848244425,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbc8a05dc-7449-4b01-8330-a55db37ca8e6%2F4DNFIWDOOBVE.hic":"1116239020,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Faef8b881-28fe-4694-9a95-1d31940e6726%2F4DNFIDT9EB5M.hic":"888289053,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff66f3162-a53d-46f2-8800-3752935d5400%2F4DNFIX2VUNV8.hic":"1226661451,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F36c782e6-2c48-4298-aa43-bd6624da003d%2F4DNFIEQHTV1R.hic":"804665819,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff15d571e-605d-4bcc-a359-0350b57a6815%2F4DNFIFW7GA64.hic":"901568712,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc2aa2e8b-ac7f-4acb-b4b5-ac5f845840fe%2F4DNFIXGXD67I.hic":"970995551,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F71b6fd7d-b249-4d65-a597-b80b95845399%2F4DNFIA7GB1NB.hic":"956785837,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6cbb1418-34db-427f-9273-5174eac81529%2F4DNFIVOJGWNP.hic":"890415052,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc69c2ee7-b6c3-4a62-8d4f-913491c9dab8%2F4DNFIW22BNB5.hic":"1075499540,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa268f28f-c6d9-4324-8989-75d2d317af1b%2F4DNFIIFBC8WN.hic":"1045459440,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6c7361d4-60a6-440b-b5be-072cada98663%2F4DNFI9ZBEBJH.hic":"759395398,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fcceaad1a-e01e-4430-8bd6-24ffa6891802%2F4DNFID4SLU53.hic":"921288444,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9eee5854-b33e-4d5a-9ba8-ceffd47e7488%2F4DNFIODI1NUJ.hic":"733159777,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5e1089b0-42e8-441c-99bb-4be99bcec28b%2F4DNFIJL26LFN.hic":"723567970,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F298a429e-ea29-49d3-bfed-fa851e1e7c4c%2F4DNFI5KTF553.hic":"2213661745,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F965d29f0-e4a3-477c-8ae4-faf4a654e69a%2F4DNFIYSPGFGV.hic":"2274989349,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd88acbc1-37b9-4266-9f97-d8fed576d0f3%2F4DNFILOR6D2D.hic":"2595459358,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7b6ddbce-0ed1-4272-b8ae-32793e4ea4e4%2F4DNFI1WMMPJQ.hic":"2262433890,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fedc0c8c4-97d8-4372-9a4f-5e0cdf09d7d0%2F4DNFI47P5978.hic":"2146314403,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0edcc389-43a4-44d7-b946-fe3496f93d56%2F4DNFI7XGW6IH.hic":"2302805723,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0a802926-e235-4c80-b521-83a1774dfb46%2F4DNFIK1EJG8I.hic":"2374943035,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3c36aedb-6a58-4aa2-9b11-bb440ec174f1%2F4DNFIDQ3THN9.hic":"2341188249,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F846123cd-8828-4e51-8b8a-27deaf293858%2F4DNFI3WPNFWT.hic":"775145629,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbd06e3ad-0e37-48a3-8367-c7d5912cab03%2F4DNFI9DCUOQ1.hic":"870487824,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc2eaf9bf-9584-4cec-8685-bd74038a6c01%2F4DNFIU8AF5ZY.hic":"1276224366,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F219497b5-3f35-473b-9d4e-e1cf21c69561%2F4DNFIHW8NTQX.hic":"28864787856,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4be13558-114a-4f2d-abca-7598e2ff4757%2F4DNFI4OUMWZ8.hic":"17061013588,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F49aed637-87a1-4d4d-ae68-e5da82aec05b%2F4DNFIEYQ5ZIR.hic":"13555272651,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa2f48779-4eff-44a6-8a9d-96435aca1ddc%2F4DNFIDZT7PR8.hic":"13425047093,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb6ec6b71-27b8-4891-b10a-ab06a5270468%2F4DNFIEJEFCAM.hic":"15394960208,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F68b9a7b5-8413-44fc-8c2d-59a67b1c4166%2F4DNFIJ8JKKWJ.hic":"17012681779,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F294d45a4-8b5e-456f-a9cb-1cbbbad3a7d2%2F4DNFINEQY95T.hic":"13966775978,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbd7f3a48-b822-41e2-bd9c-f52b3aff7b6a%2F4DNFII6AN691.hic":"12367300362,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7da44594-0dc8-4e74-8e10-a957aeaea51a%2F4DNFIDBIEXI7.hic":"2015474981,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F085a0453-3784-4eba-80b2-3556e53e2f52%2F4DNFIDKJFK2S.hic":"1983111659,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc370c78c-0a99-4c3f-a29b-2dfafc6a3e86%2F4DNFIPAF4PYT.hic":"3041434294,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F907ce45f-baa5-416d-92de-e86db4bacff1%2F4DNFIWIYYNQ5.hic":"7082321112,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff13afc6b-cf69-4c9d-881f-eed4dd3c28ee%2F4DNFIHMCILEN.hic":"1739157603,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7575d891-0e3d-4a77-896a-3e1b3a8d330b%2F4DNFIJBJ6QVH.hic":"5213499748,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff0daa830-60d5-4c7c-a2e1-a4ee70b3fee7%2F4DNFIH2A7IKF.hic":"4099503507,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff4970a25-91d8-49a7-9a4a-fe0f12cb2b0f%2F4DNFIOL8KGQ2.hic":"2256042055,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F879f1850-d175-4a86-8a97-12658482e3d1%2F4DNFIWILLD6C.hic":"5476286356,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F787f538e-d619-4c8f-985b-78753fb7e57c%2F4DNFIZBXXJAF.hic":"5946467856,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb8ee785f-1016-4989-9e64-78352621d32f%2F4DNFI8PZOJHN.hic":"8307204961,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3d8997fa-528c-4531-b25b-a412de6bd472%2F4DNFIGXAMSJY.hic":"6577588285,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F87aede55-7610-4283-af0e-c6840429a31e%2F4DNFIWNNO89O.hic":"2871061417,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F93b8e020-b337-4685-81dc-40cc8a12b5e9%2F4DNFIXU2KPNQ.hic":"3401717686,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ffb5cf1bd-59d6-46fe-857d-b86d9756029d%2F4DNFIHBGD6N6.hic":"840028421,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2d1bc088-d838-49b8-85fc-fea78a7353c4%2F4DNFI7J8NI4A.hic":"675705256,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F21a27b63-fd67-401b-9aa2-2798e6588d21%2F4DNFISFM9VFK.hic":"800145922,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F656c0a9d-7058-4c4b-a3ce-701d929561c1%2F4DNFIJU5XBK7.hic":"966593603,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2efacfbd-9c81-4e62-8df7-847d1ab774d5%2F4DNFIPKY8ED1.hic":"3401629450,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa50b6a26-56b5-43f2-b525-fa219fd716f1%2F4DNFIQRTP7NM.hic":"5358852759,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff5dc7a59-b998-4490-8a76-afbf3b258a49%2F4DNFIBCIA62Q.hic":"5779049277,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F62b2b237-cb02-45f7-89d9-616cf9ffb678%2F4DNFIV56OFE3.hic":"5818844506,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8ac79b4f-cfbf-4b2a-9fc2-898ed6c3e5e1%2F4DNFILIM6FDL.hic":"19637469163,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1cff8afa-5a13-4ad4-bcad-91fc3ced759c%2F4DNFIP71EWXC.hic":"17934647326,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F000789fe-9a22-4280-a71c-7ad228fd4cac%2F4DNFIM7ZVQOQ.hic":"700134697,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8d78457f-0c2b-4358-b08c-4d4ef4d9f59d%2F4DNFIS6EYHCX.hic":"628314484,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8ca3b4a0-2478-49c9-b4a2-a28430417a32%2F4DNFIKKCMS1Q.hic":"584050634,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff5041473-18ec-439d-92b1-8ad98c9b25c0%2F4DNFIBIV8OUN.hic":"522632731,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fcf474ec6-abd4-431e-a21c-252fcf5ee6b3%2F4DNFIAUMRM2S.hic":"313395531,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2bb1c73e-fb0f-41c4-8620-a938cc8d24a0%2F4DNFI9ZUXG61.hic":"332217525,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F26dfa41e-7e4f-457a-a3ac-72daf8059f3c%2F4DNFIDBFENL7.hic":"359604894,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8ed2e68b-189e-4988-bb6d-94e63240a231%2F4DNFI7XAZNNQ.hic":"5312422266,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6f2b1ce0-5205-4680-981e-d91b694dc3e4%2F4DNFISNGDB53.hic":"2008546759,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F73c8147f-bc7d-4d33-8a10-a9e7b413ecc6%2F4DNFI1CIGHYC.hic":"2221847625,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F526ae3e3-32cc-4670-970f-1faa9cfafd4d%2F4DNFIQD2DP2F.hic":"5295591503,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6e803530-47f8-4c56-bb19-fbdcd578d2f0%2F4DNFINHT8P7C.hic":"3159499486,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ffe705f38-903f-47b7-9b38-f80ebd18a479%2F4DNFIGF8EM7M.hic":"3490552542,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Faa197328-d6da-4299-a0fd-409ac9892668%2F4DNFIUPG2ZBJ.hic":"5382003751,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ffe5d52c4-2be7-4812-bca0-cd4bb3025e6b%2F4DNFIH3OTR14.hic":"3224693110,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F21935f61-daa8-4df2-aa69-fcd27953b405%2F4DNFIUATRW3Z.hic":"3835865655,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F72147527-e3e8-4967-bc45-8251249d76c9%2F4DNFI6V7ZQAE.hic":"4382708138,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F589f0919-f54d-49ff-a482-e2f453ef7f34%2F4DNFICKMT1CY.hic":"4479068191,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F861946ca-bad8-4a87-96e1-b2eb20b9ef10%2F4DNFIF9BDCNI.hic":"3698151402,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff76346ac-97ec-4893-8984-2b75ce1cdc51%2F4DNFIG5O1OQS.hic":"5704288175,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe8b43826-f049-4c3f-b83a-e75fa7aacc85%2F4DNFIHS2SVBQ.hic":"990025510,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F46316260-f555-4dd4-9e40-8ae06ca52822%2F4DNFIU95B69H.hic":"1275878544,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff62ef491-a3ae-4f66-ab33-c5673c9e0b65%2F4DNFIYRROFCR.hic":"1522530503,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1cd617e1-fad4-4fdc-8b4e-cb277650123c%2F4DNFIF7JN3IU.hic":"1463443128,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fdb20fe2a-0078-4d4a-8a52-d76043d06f40%2F4DNFIB2RYULQ.hic":"1269529700,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3d386fcf-1d22-47de-a0d6-0c3a641ca174%2F4DNFIMVDK3SI.hic":"1185489599,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F00e470bd-c533-41b1-923a-4b471824da12%2F4DNFIRLOTXSC.hic":"978217499,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb8774fb3-d0c5-43cc-a6c9-eb0ca39841fb%2F4DNFIZAPX6J8.hic":"1100356082,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fab3b826e-614c-448b-860f-a3ebef68a82f%2F4DNFIQD5VCSD.hic":"1322319877,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F66c78d2b-993a-4937-95ed-9e2d302ceb3e%2F4DNFIIF6VAGN.hic":"868885799,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5d106fe1-2d80-466e-87aa-46b38ba142c5%2F4DNFI86IEZXH.hic":"751443267,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc99490b6-faf9-413f-9c38-3f53018089d6%2F4DNFIP881SR2.hic":"754427927,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F39c7e387-e710-4b1d-b757-357dec03f6ad%2F4DNFI42NNCW8.hic":"1166392978,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4742a211-43b1-4325-af6f-82490aeb766b%2F4DNFIEV4PKP6.hic":"1102227476,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Feaa73842-1c86-4ad9-8a9e-c189c0b4c01d%2F4DNFIF1DUQHE.hic":"1206699207,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd25f24df-0298-4079-bb6f-1c8e1e32392b%2F4DNFIGW55EAY.hic":"1033358104,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc57a7ab5-2778-4fe2-9d64-9a4e95135f12%2F4DNFISZRU6I4.hic":"1539570262,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd89f494a-27ca-46b6-89be-7583f3f6d18c%2F4DNFIBKKDTAP.hic":"350372180,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F06725280-cb24-4f22-a267-18b434bfa79e%2F4DNFIJSRQW24.hic":"314361467,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8fe5c3c5-006f-425b-ac6d-ea475e29be78%2F4DNFI3REN89E.hic":"299665258,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc8b6ac5c-13b4-427e-9158-cec0b890b6d8%2F4DNFIF5XLHKM.hic":"235668364,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F01ff33fc-fc23-48aa-a6c6-b720d6fe0768%2F4DNFIB6Q538N.hic":"316494853,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F552978c8-abbc-424a-9187-3e34cf802a97%2F4DNFI3ST3F7Y.hic":"296298411,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F72e66520-5170-4f2e-844a-fbfd0e23b480%2F4DNFIQT4M6UI.hic":"307691265,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb3eb3953-ffe8-4d5a-970c-a16f3b7b9ec3%2F4DNFIFNCC7M2.hic":"364160436,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F37d413fb-afab-41ff-99aa-1678830f7dde%2F4DNFITM9MDJL.hic":"252412426,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Faf5db92c-aaf1-4086-a0d2-79b28648f172%2F4DNFI3NTD7B3.hic":"227586640,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff6892f7b-1f8a-4d7d-9605-c67932cd5654%2F4DNFIBED48O1.hic":"328344868,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd64afb07-5ab1-4c4f-8438-2fee37afa86a%2F4DNFISATK9PF.hic":"379669025,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fad11bb63-8692-461c-b698-89c601451321%2F4DNFISRP84FE.hic":"298491537,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F63710ec5-35d2-47dd-bf9a-08d3daa83d67%2F4DNFI2LY7B73.hic":"303150299,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F76077d9e-ca75-4301-ab79-88aa49bda495%2F4DNFIXEB4UZO.hic":"711757090,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F34dd4c0e-3487-4fb4-b95f-c4bb66e0fa31%2F4DNFIQWWATGK.hic":"221304476,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F48a8cf86-3248-4a8e-8e85-472ec219d49c%2F4DNFI44JLUSL.hic":"284772724,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fee399fbf-2a9e-46e2-8364-457713bff508%2F4DNFIM7Q2FQQ.hic":"330729464,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F124d191a-c5c7-49b6-b84b-0d1bad8bef2b%2F4DNFIZK7W8GZ.hic":"293166018,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe351f7cc-7a2c-4515-ae0b-3bb2f91c986a%2F4DNFIMIMLMD3.hic":"240094740,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ffd1ae249-57b1-41d6-81a6-16b21dcd8f12%2F4DNFI7QUSU5J.hic":"681762505,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F46c92c5c-9ad8-4d49-beba-f35c5cd99208%2F4DNFINXUOI5H.hic":"375594313,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd7350d40-4e9e-4131-9151-bb539d39b431%2F4DNFIIJR2296.hic":"331322302,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbfacf37b-1665-45f3-a046-e29e1544e9b0%2F4DNFIJMZUTXR.hic":"361313244,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F234e18fb-9990-43bf-9a48-f72722cfa232%2F4DNFIZQPT9EL.hic":"540421873,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4b35ab09-2e79-4876-b2bc-d3a8faa26257%2F4DNFIZIXSZ9J.hic":"545066813,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2ae5118e-807a-46e0-8e92-143d4b282b3d%2F4DNFIDD9IF9T.hic":"237409149,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb34d7f6f-73f7-4b6b-80c7-c8af0f991549%2F4DNFIVC8OQPG.hic":"355121712,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9ab169fd-cbdd-4f60-8553-a4c6912ad89e%2F4DNFITUPI4HA.hic":"313085022,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4e53712b-d0d9-40c5-afe1-ffa0fad71e59%2F4DNFI5IZNXIO.hic":"341863906,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7a91477f-45eb-4a16-affb-fc131f9326b8%2F4DNFII16KXA7.hic":"248904495,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F153729de-0eca-43cc-9b61-61aa8d775b38%2F4DNFIAAH19VM.hic":"668047244,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F879fd78a-7165-43d9-a0de-ca158b53df30%2F4DNFIVKIY3KV.hic":"247571318,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F67f901a4-040b-4b04-9fff-94a1780423cd%2F4DNFIVVCWL6C.hic":"198355985,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd5b30c5a-654a-463c-9474-39bdc3ce4500%2F4DNFIJRF2273.hic":"343971277,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7070280a-8f03-40d0-9fef-e9d9f4d3dae7%2F4DNFI6FCC9ZA.hic":"312013061,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F47049719-9407-4d76-9048-26231045f642%2F4DNFI1CPQ4O3.hic":"352923267,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F862c2b5f-44c2-4bd7-9264-b3ca032d3d8d%2F4DNFISXFEDE9.hic":"271745977,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Feffbe052-39ff-4217-9871-44199ed90818%2F4DNFIF9L6QEQ.hic":"668409334,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa7791854-1b35-4258-90fb-603c55f24642%2F4DNFIPKASX1Q.hic":"312727920,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F79cccad6-a78e-4de9-9fe7-08f7e8df663d%2F4DNFIWXZ4JQZ.hic":"151808553,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7e86e0cc-d6f1-4ce0-aba4-c36c6ebb3c4c%2F4DNFIEMQ1O8V.hic":"700533280,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4a1b58d3-9ae6-43e4-91cf-49f1fcbbab33%2F4DNFIYWONU7A.hic":"729050356,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F67bff264-0b0c-4c5c-9d4d-ff5abef2bbe4%2F4DNFISNIE5FH.hic":"7987657997,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3a6a943f-2cc0-4433-a27d-c89f3fdd3309%2F4DNFIV8MLWJB.hic":"6646216171,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9e235711-ba90-404d-b4ac-b15990ea8e33%2F4DNFIXSTDPHL.hic":"3146468238,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0c89f4bc-e9fc-4ecf-b868-26108dbb7bb2%2F4DNFIQJNOH8U.hic":"2919703928,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1856ff9e-de7a-4fa1-ae0b-3e04b837b5e1%2F4DNFI57XB4A8.hic":"13417594377,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F099bb5b9-6315-4650-8f78-d603f5a046b3%2F4DNFIQ7UKVZV.hic":"9016468637,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Faf3c7a30-0fc4-410d-8d41-247da3eb105d%2F4DNFIWJY8GHD.hic":"7921314766,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fda99f429-20ab-4d91-bbfe-f8bdea8ed7b1%2F4DNFIN8NKRNF.hic":"4247121358,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0ca0f4e3-30ca-4332-b735-e32dce08e1a4%2F4DNFIZYGEHNZ.hic":"4910404663,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F243f48b0-6b59-4f37-ad39-a12e0986f530%2F4DNFIRPYGAV8.hic":"4220073636,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F49f1a890-d458-42a6-9c78-99c38b6c7a8f%2F4DNFI6MZTDM1.hic":"375035361,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F76bd4768-9343-44ba-a99d-5500e184e39d%2F4DNFIG3BCGPL.hic":"2422923206,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9d1ed866-eaf6-4906-aa8c-9e39616dde38%2F4DNFIS9YPJ3L.hic":"1593271574,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1e7a5636-bdb6-45fb-85d8-87a7e908de43%2F4DNFIOWGA9AX.hic":"1632314387,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5ecc552a-0a6b-49a9-9aa5-9f3fd9b535fd%2F4DNFINKEDSBF.hic":"1458761024,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6c03f1d2-bb25-4c94-b5f5-d5cdd01c14b6%2F4DNFIVIXVUK7.hic":"1504818271,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1a4616ff-6d04-4a6a-9773-b80e81da2471%2F4DNFIANHFY16.hic":"1850724180,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd2231870-a78d-4c8b-9cfd-084f2468acb1%2F4DNFIJ67ZFBI.hic":"1473864703,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F859c2dd3-df8a-42b7-86ea-bf6524f75e80%2F4DNFIG3YQQ4V.hic":"1539822829,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8bad667e-6003-4828-9a20-07585fa9c811%2F4DNFIOLKEOME.hic":"3036353747,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F92ea551b-5779-4d31-a0f5-621e4bd0eb21%2F4DNFIVLN8WJE.hic":"2710426318,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F61ee79fa-0617-4083-b121-f92ef3a8905c%2F4DNFI2111XQA.hic":"2589549183,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F83ebb98d-e5db-403d-aa23-875293156c0e%2F4DNFI88HXX7D.hic":"2462367030,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6d63671a-8f1d-4159-82c0-931b43464772%2F4DNFIUBM6QK8.hic":"2486020469,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fcccb9014-ce15-4032-81ac-222b3d621cb4%2F4DNFIVILEERC.hic":"2052537210,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F21a07867-4007-4ca5-b066-25d3168208dc%2F4DNFIF7Q43N4.hic":"2091773428,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff738de0f-358b-44bf-97dd-644c8d9b1b1c%2F4DNFID56VJGW.hic":"878913568,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fda97c1d4-bb92-4a77-92a7-f7960f88b9dc%2F4DNFIYUR29KO.hic":"983915575,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F54ea363a-99e7-4f55-861e-1644acab7939%2F4DNFIUDPGHO8.hic":"905253594,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fdcd66a07-55ee-48d9-a157-419cf4ee3eef%2F4DNFISWC2N8T.hic":"1233576358,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F40363837-7466-4a1d-b20d-a66d1670b700%2F4DNFICMPHDMI.hic":"516590777,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0b3fa4e6-caeb-40b4-8942-e9c0b03dfe4f%2F4DNFIKMKN736.hic":"634310295,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb6a34050-d52b-4880-91cf-d3fe4b0ce982%2F4DNFIN5NLS49.hic":"650451131,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8e63a47b-9fd4-4772-8b0c-10ee589ffb16%2F4DNFI4P8UBRL.hic":"705655033,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7d92b666-30cc-4838-9d46-c1f11cee3d3c%2F4DNFISNC3LAI.hic":"176146197,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F17f7dc63-a1bc-4970-b389-87d9ee93b753%2F4DNFIVBWPFD7.hic":"749678512,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff8897333-4791-4a83-9444-a653e24aee13%2F4DNFITMQRXB7.hic":"254477361,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8712bf31-33d0-4562-ab0b-a1e9cf4fd30c%2F4DNFIUYD3HBY.hic":"995625724,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbfaf6383-9cc6-4b5c-9b20-d3bf2e8c3495%2F4DNFIRRSC7P9.hic":"1149985362,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb0b70598-5d17-4e0a-8831-6cbe697e69e2%2F4DNFIWKR8FP6.hic":"1151628407,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fccc094a8-23ce-4fd8-9c4a-41f07c045c8f%2F4DNFIQ74RSUY.hic":"931695969,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8eda16f3-af5e-4f1f-b46d-c74df44b76aa%2F4DNFI9IIO5PW.hic":"1077740364,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff283637b-cf2c-4412-ba00-0e3d7e279fad%2F4DNFI8WGJG19.hic":"812086456,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7ad8438f-d3d9-42d8-88bf-42845a0dc2d0%2F4DNFIQ5CCESJ.hic":"652559720,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F70e3bdcc-caf4-4822-b9c5-85234873db7a%2F4DNFIWTZHB4H.hic":"760694196,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F56ed767d-cd8a-4d38-8047-ed1e8bc8cd19%2F4DNFIENYQCDP.hic":"1159428005,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa912fff9-5f90-42b1-a3a6-cbb9eb2cf861%2F4DNFIFATZWPD.hic":"1033325746,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F21338ea5-fdee-4ad8-b61c-608fc6cec4bc%2F4DNFI7YRXKEO.hic":"388142539,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff0f88647-5631-437b-b48a-4603915e3714%2F4DNFIUY3J7EW.hic":"407344788,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F16926af8-ac3b-4f32-97d5-6c0dc6f1596a%2F4DNFIRKUYKP4.hic":"893352368,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F93e39aec-6cde-4c5b-bcdf-283faa3163a2%2F4DNFIAQDBJZP.hic":"489922022,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0dc0b1ba-5509-4464-9814-dfe103ff09a0%2F4DNFIC1CLPK7.hic":"565748333,37769","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb50964c7-b025-49d9-b1ed-289bedb59678%2F4DNFI3A3VYWU.hic":"4597459343,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff4390cea-b330-4022-88c1-9ff8c0a786f7%2F4DNFI6JJQKFJ.hic":"3678393678,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F70c0f730-5da1-4863-9b7a-6cdd31066cff%2F4DNFIK61ILGM.hic":"3324300994,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F14b14ac4-ab59-4754-9c43-eacd9d0638e2%2F4DNFIYD8LO9Z.hic":"3227227120,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7386f953-8da9-47b0-acb2-931cba810544%2F4DNFIOTPSS3L.hic":"253942497,7557","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff6b5d8bd-27dc-4415-a320-53405a16db85%2F4DNFI525PKU5.hic":"305089653,7557","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1f922dbc-637b-4c43-b816-f604f0e79ad1%2F4DNFI8Y9SRP2.hic":"1438589609,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6a36d686-716c-4ba8-a9c3-fa8311791d3c%2F4DNFIP25GZGA.hic":"1419100109,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0e535542-2cf2-46e4-ba10-7a0b946a7fb2%2F4DNFITPO1WTY.hic":"3885296184,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0c17d228-5052-4c83-880e-af05118e6929%2F4DNFIG4X5Z5F.hic":"2159245890,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc3977c00-525b-4556-9a27-061707f8cb76%2F4DNFIXLYR32S.hic":"587852728,21916","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3f856506-cbc5-4211-a29d-48a7530c622e%2F4DNFIWI3V5LI.hic":"2318237793,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F38f77979-5eb7-4b6f-9a60-c2451185db98%2F4DNFI2DGL7LH.hic":"2068150664,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe0992a75-7727-405e-95ac-aa97141b51c1%2F4DNFI1VSO8JP.hic":"1807949651,21916","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe925f1aa-2e7b-44e7-bfa8-2084a613ab13%2F4DNFIV5O2ZYO.hic":"2242134377,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F803a6d3c-3972-4939-8ff2-d195c5192090%2F4DNFIEWEWQ8D.hic":"2981341325,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F25104375-a588-46e6-a382-663cee6c332f%2F4DNFICSTCJQZ.hic":"14592996888,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F927aa8a5-24a5-43b7-807a-1e99ac321459%2F4DNFICEGAHRC.hic":"15431307603,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8c380474-12cd-41f4-b86f-2a29faf12eec%2F4DNFIY3XPKPO.hic":"2550999291,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F77da562e-d0ec-45a8-8764-14fa16d995a1%2F4DNFIK9PS9GM.hic":"3401011629,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F11b26222-d480-40a7-8d53-3ad8500396cb%2F4DNFIF4Y74JR.hic":"2127593378,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F93df02c6-1047-43f6-afae-d3598b61eeea%2F4DNFIBBKG9KD.hic":"5724446278,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6cd4378a-8f51-4e65-99eb-15f5c80abf8d%2F4DNFIT4I5C6Z.hic":"5419655766,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F067881e5-563d-40de-a9e3-caccad887fbc%2F4DNFI2U38HCE.hic":"14749043471,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fcb3da9ad-7afe-4d0c-9c2d-261181e7a95c%2F4DNFIETP228R.hic":"9401474797,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F185b7bcc-7bb7-41b7-9ebe-92d4fe159431%2F4DNFIXKC48TK.hic":"11624295594,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F18459b84-dd43-4af6-a05f-bcb773096322%2F4DNFIFPGOWJ6.hic":"2843730862,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ffde1e48c-4a0d-4bb1-b84a-e0e45f9a0aa3%2F4DNFIIRMBE8Y.hic":"5820677927,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbabed539-1f0f-4e87-8815-fde596e6024c%2F4DNFIVUGNDD7.hic":"5170782436,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7d00531a-e616-469b-af52-5b028270e2ce%2F4DNFIFLJLIS5.hic":"18917549985,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7a9dad53-b8af-4cb6-9ce3-5c38e4a855c7%2F4DNFIOX3BGNE.hic":"5482775936,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F82fd7b7e-5f47-48d5-bf0d-daaa48a4674d%2F4DNFISPUVQHA.hic":"2177864938,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4c6680f3-9cf6-452f-9dc5-ecebf376775d%2F4DNFI8649RQJ.hic":"3288850368,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2395f001-19d9-4000-9f00-dae3dea708d6%2F4DNFIE8T8JZ8.hic":"1383191843,21916","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F24464fa8-bf96-483c-8e9a-c2f626ad6e19%2F4DNFIBM714BP.hic":"1765204569,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F918fc048-fa27-41d2-a63a-d50c511fbb9a%2F4DNFI6CWNUFL.hic":"2431120602,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7ff5a0d1-8e54-4cf0-9fe7-339f147c78da%2F4DNFIZ4F74QR.hic":"3211825957,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F355f0412-cb17-452a-b15c-aba16c5a742c%2F4DNFIOUVOX3R.hic":"5547401083,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3cac91c5-160a-4b91-a91e-edc309318dd5%2F4DNFIVTDXW6X.hic":"4797344498,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe9ac9ec5-6221-4f39-951a-1c5054fc9f1c%2F4DNFICA8Y9TN.hic":"4277557869,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F46f62222-b50a-428b-938b-5444951600eb%2F4DNFIDWM3HN5.hic":"4374808431,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F50e4f2a1-9cb6-4192-8199-64d354bfdf96%2F4DNFIBK5TB3N.hic":"3757387253,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe4cdd5a8-1a45-4c6a-906b-a9603260d4c8%2F4DNFI3JYF9VS.hic":"5260534916,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc8164e99-5778-427d-be26-f0e1b62400f0%2F4DNFIP1GNKUO.hic":"7589365689,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0d72e78a-fc87-4716-8b8e-6dc5650ff2ef%2F4DNFIQYQWPF5.hic":"22022259901,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fac58fc15-48c2-4eec-a689-23b677b4b6e7%2F4DNFIW6H9U3S.hic":"6810897169,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F31811e40-e3ca-4456-8ba6-2ee66d6c7104%2F4DNFI7J8BQ4P.hic":"7188744676,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F62d81a52-d2cb-4bbd-8510-0fe120e786e0%2F4DNFIA3AKFSU.hic":"1763730692,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fae0b7513-d1a0-4f27-a9d3-348837f42cb6%2F4DNFID68JQY9.hic":"2422880133,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fae6a1a7e-1d2d-4fd2-a89f-1799abac8a9c%2F4DNFIL1FQDXE.hic":"1543814834,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F80d343c9-bd60-468a-803d-c3e351a958bc%2F4DNFITSIPCSK.hic":"2344682115,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff2d61195-a3a6-4d50-b928-546ca67546cb%2F4DNFIJ88LYHR.hic":"3362742962,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F31052aba-773a-4500-961b-e0a518245b0c%2F4DNFIJIPWD63.hic":"2529548812,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc93d0710-3fbf-40cc-b0eb-878e2aa659e4%2F4DNFIZUP2BBI.hic":"491996147,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8660baeb-5be1-4ba5-93e4-66499e9a4587%2F4DNFIEBC4AF3.hic":"2993048734,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff6d08fbc-b836-4776-82ad-8b1b277ae837%2F4DNFI5VO3E1W.hic":"1949322679,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3af004a2-a6fa-46dc-8be8-898b847a77be%2F4DNFIFDGVWLU.hic":"2456400803,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbd613b4b-2422-492c-8d8f-8afba9c8a182%2F4DNFITVGFNYZ.hic":"1411204423,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc340694f-14f3-4638-b09b-98220c20039a%2F4DNFIOW9TTC1.hic":"2611370588,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3effa71b-6aa3-4265-87ba-f8d709d778d7%2F4DNFIOAA3ZEQ.hic":"3123195980,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fde75cf8b-9ce1-44fc-8b7b-ca0adea6bae9%2F4DNFIA5ID1S6.hic":"3496246968,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F714f775d-a5a4-4314-83f8-016b9d73200b%2F4DNFIZYU7V81.hic":"4245592042,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5ca518af-6e1e-4777-b67b-0fe7f039ce58%2F4DNFIRV6PVUX.hic":"3981520466,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc29b57d5-c263-4372-b396-ab4f55682f5d%2F4DNFIMEANFBY.hic":"3999623376,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4196d3ef-161a-4c18-a57e-005165c6b32a%2F4DNFIGLGQXLC.hic":"4105683321,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe10828b5-9519-4ceb-81e7-7228bfd890de%2F4DNFILS2HLXC.hic":"3804942111,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Feaac88c7-9bdc-4b1e-aa9f-e675520dfffa%2F4DNFIQS8853L.hic":"5287726781,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Faab371b1-bc8d-4e83-998e-5bb977c443ca%2F4DNFIVBYCYGS.hic":"4657988157,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fdb116add-af8c-4a3b-b106-9f704ba0a175%2F4DNFIE4WWHMF.hic":"5116727268,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F033366e2-05a2-4381-9d48-90122892a9e0%2F4DNFIKDUUC3C.hic":"45638237,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7284a446-442d-4a46-aae5-84987e75a7af%2F4DNFIJ5HIRA2.hic":"62201052,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F876649a3-6dd3-463a-8b17-5752a98a89c5%2F4DNFIXDFC7EM.hic":"69878143,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3cb4ce4d-d474-459f-8b8a-2159d8df8068%2F4DNFIO35EOVR.hic":"70153114,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5c5612fa-18c2-47fb-8074-693b1054e254%2F4DNFI57QGL6U.hic":"54605055,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F70c1472d-cf3a-41d7-8682-cd03b7cc978d%2F4DNFI2AGEBE5.hic":"67930121,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2bf4cce8-6e03-422b-a190-e51d4a07d501%2F4DNFI1E6NJQJ.hic":"4893181511,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0eb3aa56-8a23-435d-a07b-8bb545e8d708%2F4DNFI2DNFM1A.hic":"60466977,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1201682a-a223-482d-913d-3c3972b8eb65%2F4DNFIIRIHBR2.hic":"48961678,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6aee7913-6356-43cf-affa-f2b60dd478f6%2F4DNFIKXNMT46.hic":"39095246,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F357139a3-c9a5-4343-b0a4-b41c45fd03fd%2F4DNFIRV7IRJP.hic":"70916718,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F76be3061-6259-42be-a917-19dcba41517b%2F4DNFIFX1XYKZ.hic":"229197441,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff60c348a-a62c-43c3-ac85-f6c28b5f823f%2F4DNFI64CJUZ5.hic":"112428610,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbd0b0a14-9703-49af-bb36-2359f96d4d0e%2F4DNFIBPL2HL1.hic":"73972428,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F79ac278d-83f7-4c1f-91b2-05c8018c1426%2F4DNFIBRSIPE4.hic":"415430378,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0c3b8141-8e67-4211-80dd-3bae88f9e537%2F4DNFIDLDVY14.hic":"112747303,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2ae703d2-d85c-4ac4-9ce1-14d653927675%2F4DNFI4R1II4P.hic":"210565448,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F76e641af-90be-49f8-b126-12c20f856159%2F4DNFINMLRY95.hic":"1590865292,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3b416382-ae5d-469f-9e9a-85a3e2ce9793%2F4DNFI8KBXYNL.hic":"4626496956,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa27589a6-86b2-43a2-8218-1f2232d551e6%2F4DNFI53R5IKA.hic":"1536016455,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fdd3999f5-b36e-4154-a6b9-446656959a3a%2F4DNFIAWVDQ8C.hic":"2210273411,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc377953b-0e61-426b-a905-abab2d5a3002%2F4DNFI9VXTBE2.hic":"3384365692,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2dbe0377-1db2-4aae-af2b-d87dff728035%2F4DNFIT96Z365.hic":"7692311974,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fdcfcb009-f006-4ab8-a4c7-af72be58c12c%2F4DNFITUOMFUQ.hic":"6592120312,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F67f9073d-b2c5-474e-b3d5-7d72cde555cd%2F4DNFIHLQKDN8.hic":"2647703964,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F76968cc8-fb9f-485b-85b2-c9289067194b%2F4DNFIL9M97T2.hic":"6186798917,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F87d9330b-8d2c-4e9d-85bb-02e572de7a68%2F4DNFIDWGZLHX.hic":"4379708168,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ffc01b381-3665-4225-88ee-2e5e9ecb7324%2F4DNFIMEG1QIC.hic":"3587146533,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3144a03c-15c3-4bf9-95f8-ffad2640a1bf%2F4DNFIWSB66VX.hic":"1529739069,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd7d3aac0-ba66-494b-ba0c-147631084b98%2F4DNFIH7TH4MF.hic":"6896300679,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4b13bd19-fbd1-4c68-8855-4f0158d1ce47%2F4DNFIHKWIZ9T.hic":"1954878455,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3d04e286-30d4-4add-a806-7a929d36419e%2F4DNFIZBBX795.hic":"1350142414,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Faa26f261-a88a-4cac-9118-ff8e90ab6f61%2F4DNFI9ZWZ5BS.hic":"3410552807,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F24e516ce-0b49-4476-b818-cc96471d8765%2F4DNFIPAI8XB5.hic":"4168518737,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fac3b06b5-46d4-4c1e-97e9-9a4f353473a7%2F4DNFI1OUWFSC.hic":"10766406904,21916","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F76c6aa27-895f-4e82-8ed8-7a85aca84490%2F4DNFIX4PJKXZ.hic":"1463157350,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe6fbe03a-997b-4d72-a3cc-f1ed7bd88a92%2F4DNFIZGCA8AH.hic":"1597664180,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F61d99a87-4ec6-4116-be99-b483999641c4%2F4DNFI5CGQ46V.hic":"2870576870,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F271ea8cd-53b9-44c9-9fff-1bb5c444b54c%2F4DNFIOCW5AEM.hic":"2463600138,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa98ca64a-861a-4a8c-92e9-586af457b1fb%2F4DNFI1UEG1HD.hic":"22480709268,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5809b32e-0aea-4cf5-a174-cf162d591a35%2F4DNFI9YAVTI1.hic":"3141182061,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3be17688-cbce-4ef9-9b94-8571c20a858e%2F4DNFI916JQ1Y.hic":"5153550498,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbad90d57-68ae-441f-84b6-3da0e4b3f1b7%2F4DNFI5R1ECZI.hic":"5256843748,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F78d90bcc-64c1-40c4-83bf-39f981f7d6d4%2F4DNFISUPDO3A.hic":"6141911776,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc16b5fd8-b0a0-4daa-915f-dea88d56b95d%2F4DNFIMV6MPGH.hic":"4646473940,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ffe25da0b-0e94-426f-9e5c-25ea7ac560dc%2F4DNFI111EI3K.hic":"6360540164,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6db70d70-1248-4ef1-b734-247d39ce3a5a%2F4DNFIVWXJQR1.hic":"3567402729,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3ad46cc4-505e-4a5d-9dee-e8d362f73a9c%2F4DNFI14FXOOU.hic":"3750091538,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2334c531-2d0b-46b3-98c6-c7ed35b9f20d%2F4DNFIS1SRPWR.hic":"1888598768,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F32278b04-8c3a-4111-9992-1a40a7139731%2F4DNFI8LDZDN9.hic":"1908203928,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa844f39f-3aa7-4e21-ba09-7683e1d91ab2%2F4DNFIH1NZ1M8.hic":"5303565251,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3e727bd0-bab5-484e-8fdc-54a4a666d2ab%2F4DNFIK9TW97H.hic":"4844444289,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5a84c606-1f3d-47c5-9be3-8112144cd5dd%2F4DNFI7ST3KR1.hic":"4076139611,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd2a326a8-1f3f-4acc-8b9b-a449a2cdd7a0%2F4DNFIIMDXANO.hic":"5886279116,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fede4b21a-1f17-43d1-970f-ac874ef01bb0%2F4DNFIXF2GL4C.hic":"5623357020,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc4812c8a-74ac-4ee9-ac9e-abf5abd59318%2F4DNFI8I2WYXS.hic":"7575864220,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa9ad9939-6297-48c4-a6a7-5fad70ddeb2c%2F4DNFI7C5YXNX.hic":"4723998471,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1cb2e17f-58aa-4b2a-92f4-a6fb53654f1c%2F4DNFI1P2EP7L.hic":"3517327113,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4cb9794d-a3f7-4fa8-8e62-ff8a50f2fa5c%2F4DNFIF78U26G.hic":"4524490522,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd03c2ad3-74de-4ae3-8ebf-f305309b51bd%2F4DNFIH6ANSX9.hic":"4704398892,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F93ec4ac1-0654-4548-9130-332e48fa9919%2F4DNFI8QUAO51.hic":"6410633809,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb36abbf5-e7d4-45e6-b11d-3b4a5c918189%2F4DNFIWZYSI2D.hic":"4979199288,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9fd6c29e-7e41-44f7-bceb-d04f6c3ef430%2F4DNFI7PCOZ9I.hic":"4460433802,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7ef01bb0-d114-48b5-8836-d8e5f0aaaa08%2F4DNFIWUZLEWY.hic":"4312740986,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fcc0accc9-a89f-4b40-bac6-de754a7f77c9%2F4DNFILI6XOB5.hic":"6360373541,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F61f0e53d-a1da-4cc0-8f5f-052ae61ab161%2F4DNFI7EETNXL.hic":"1412854116,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fcc5ab0e6-f193-4bf9-91df-a7b9c4bbbc64%2F4DNFII7EADPT.hic":"1991748717,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fefd1d3b2-b437-40af-9b36-4e957762032a%2F4DNFIOCDW18J.hic":"2009478680,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6c2a1de5-accb-4a43-85a0-cbf57318fd45%2F4DNFI9RMTGX1.hic":"2294307288,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa9a8ab76-0fc3-48dc-a487-d8a5921477df%2F4DNFIQ7YSRDA.hic":"4617097967,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff7062f5e-9a08-4d87-a7fa-19f3208e6f80%2F4DNFIU7JYUQJ.hic":"1591654523,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9b71b9d0-257d-48a5-9116-d0dae0c83c68%2F4DNFIMG5T456.hic":"1536982846,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F14bf1e4b-6713-46e8-9c8f-fdfafa6ff3bd%2F4DNFIFZW7GEE.hic":"2489628475,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0995fd1b-023d-4ec2-a95d-64e108ec36ea%2F4DNFIIHISWB1.hic":"1526894394,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F74ad588d-edec-48a5-af16-f857ceacb0aa%2F4DNFIC6OQBN7.hic":"2654265474,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1c97b8c3-31b4-41ad-924e-bf2d2cb94b74%2F4DNFIXDTO63C.hic":"2013309944,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F15ba1e34-3e22-4b31-beb7-417683011858%2F4DNFI31H3OGV.hic":"6361414603,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa6d18f0f-df0d-4d47-8cdc-032f3c7ef221%2F4DNFIUPVQ5UH.hic":"6834216978,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6fe30df7-5f0d-4638-8ec0-483a8b86ecdf%2F4DNFIVEMIOK8.hic":"773338173,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1d57bbab-562a-4dea-99c4-3c3bb021adcc%2F4DNFINZ25U3U.hic":"6039407224,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0098fa29-fc36-4a23-a63f-cda9616a6f89%2F4DNFIRU3N6DB.hic":"6590434017,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F77ab3250-4dc6-4163-9db2-2b847efce7ce%2F4DNFIBXBN6UB.hic":"676470326,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4551206a-231b-402e-9570-88a10effb7bc%2F4DNFIA1PDKM5.hic":"446073443,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F785d3cfc-5dcf-4c01-97b1-f58a48cc9ee8%2F4DNFIGBHDKL7.hic":"924249200,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbb76eb3b-0267-4161-b8e4-ef9fb0089c4a%2F4DNFISBPIB52.hic":"1032187300,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F043852cb-2967-4d40-b03e-e8542760714a%2F4DNFIBA73Y4Z.hic":"5574486826,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1cc48d9b-9735-42a0-888f-7f105af8640c%2F4DNFII4ADLYY.hic":"840451609,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F56e64332-25ec-4390-b66a-266d710486e5%2F4DNFI2CZIRZ4.hic":"3831692686,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fae9ba47a-6bb9-48d7-94df-2e8be961eb09%2F4DNFIAYXT1F3.hic":"4954772594,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3089d432-f2ab-4c0f-97fb-adab86471125%2F4DNFIX15LQDY.hic":"857822311,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1b5fb4f9-9f63-4443-80ca-7c60ba12c4fe%2F4DNFIGX5LN49.hic":"5175938352,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F18026766-9e0e-4c15-9610-44c0e4dbf3e5%2F4DNFI9I6O19H.hic":"895448286,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8e6fa044-7936-462f-8d37-aa0275cae3ca%2F4DNFIB4OS99H.hic":"855810083,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F84911760-df97-44c1-8b36-97e388f9c62a%2F4DNFI8IYNWGT.hic":"777249574,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe15079bb-ccdc-4248-87af-d0173eb76011%2F4DNFIVB7692N.hic":"853178496,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7e5c1e85-d4a5-40d4-964d-198947907abd%2F4DNFI5QJW5YD.hic":"5028458350,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ffbaf75a9-0155-4125-bf86-d31d9c3b90d5%2F4DNFIET12997.hic":"6645726944,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4e576005-7475-4d39-8fcb-9d4561b970f0%2F4DNFIYQ224EZ.hic":"4757808094,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe5f70a70-7d02-41cf-b27c-cacaaf754fa6%2F4DNFI1FK394F.hic":"4459181136,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ffaa95c6c-db4a-47ba-8c3c-d6b7d9d70fce%2F4DNFIE7KYLR5.hic":"1190688479,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8e76dc76-e36f-4464-b65a-9897aae10b65%2F4DNFIEC5NWVF.hic":"3342948701,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe4ff6b8c-f46f-4d57-8dcc-7ff0500f922a%2F4DNFIZBG3V9V.hic":"2118010954,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd32e7242-9629-45f4-9d1a-0237a5b9e869%2F4DNFITDGTIUK.hic":"1681141685,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6cab57d3-8ca4-4d79-94b4-1c4395fc7d7e%2F4DNFIAKOG8CW.hic":"1630820744,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fa49824e1-6a92-4ffc-b6e9-52f35549406a%2F4DNFIX8FUVN6.hic":"2540960336,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fd3741fb2-a4ea-454c-a6b2-da1c6cef5f92%2F4DNFIA7CEMNT.hic":"2100106035,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7af7afcd-e66e-460e-b6eb-be26eb594f69%2F4DNFI5YVPH8H.hic":"1910838419,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2261e6df-f141-44cc-b916-12779a98d6e8%2F4DNFIR2YF7S1.hic":"84456840,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3d5d54ea-1fe7-48d8-a1f2-c0bc078eb91c%2F4DNFIAQVXT8S.hic":"5876011800,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F462680da-3e24-49b7-b967-d195198a198d%2F4DNFI9V5G78Z.hic":"80293794,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7b3ce521-89b9-41d4-ace2-1cab7804bcc2%2F4DNFIPZCCTV6.hic":"4917429800,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6112b96e-78e9-4b99-b9d7-f15ae5c79466%2F4DNFIHTFIMGG.hic":"4363292659,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbdb01c16-6acb-4b44-bbef-c67300dfa26f%2F4DNFIXWT5U42.hic":"3771883844,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0e66d31c-fda3-42b8-ba69-3f1ca7377665%2F4DNFIY1TCVLX.hic":"4392772657,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3400c4d3-4446-4fb9-96fa-b499dd00861d%2F4DNFI5EAPQTI.hic":"3882696477,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F34f2a636-012a-4079-81b5-53b40f29e73f%2F4DNFICPL7RPE.hic":"75287233,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F232ae04a-86c9-48af-b5c6-4c33e080c76e%2F4DNFI5O2WB24.hic":"6118504627,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F502b0485-ce03-4f5e-aa06-e6e0011e14b7%2F4DNFIC4GB8UM.hic":"4060758124,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0290c7cb-0b4a-482d-9e5c-f141e21096e7%2F4DNFILL624WG.hic":"3895589825,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F56df20f8-4aea-4245-b875-23b2a618801e%2F4DNFICF2Z2TG.hic":"3667006741,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2b7cf7ec-37fd-40b7-83e1-f777284a97fc%2F4DNFI7T93SHL.hic":"3211370872,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F826b1d10-6d89-4b23-a1b5-dfcbcb8031bf%2F4DNFIP9EJSOM.hic":"3636533438,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F20194877-57b7-4abe-8116-3a6a5c548846%2F4DNFIHG8BK98.hic":"86813098,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff2fea329-d8fd-4975-9266-03e5556151bf%2F4DNFI6JKPJGO.hic":"79846427,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F293f248f-1962-4476-b3ae-eb6e2b778f70%2F4DNFIYYPB1UI.hic":"72601205,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe8695158-70a2-4442-a9c8-b655163dc694%2F4DNFI35AE3O3.hic":"829193620,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc51bc383-04e0-40cf-a72f-589524efd8f7%2F4DNFIXB4O92R.hic":"644232107,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9e0bb1ce-4e61-4791-9479-d0a20ee304fa%2F4DNFIFZM3CWZ.hic":"2647900849,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F28143491-848b-4a7b-90e0-1ae60fe61a2e%2F4DNFIXEHCB3R.hic":"2632375995,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc3e15131-f768-42aa-9959-75547704b3fb%2F4DNFI1HWXE8A.hic":"2340946204,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8a97b975-ee5a-4efc-a137-e393b3315260%2F4DNFIASIXTZM.hic":"2230584547,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9bc0a720-f0da-41a5-9289-34c2ef33f412%2F4DNFI6SETG5U.hic":"2909425254,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F27527ede-b4a7-44e1-b959-8ef427a75727%2F4DNFIM7ACSX2.hic":"2807145365,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F891bb2e9-1d08-4c15-b544-4125fec3e6d3%2F4DNFIATBSBS3.hic":"2551006282,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F94b4c17a-9038-4947-9f9a-d7031405c379%2F4DNFIKR8L3O5.hic":"2467302957,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fae0abe8b-41c6-455e-a466-96cda0b2583b%2F4DNFI6C7TKI7.hic":"2357341855,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8ea50b3a-b753-426f-bcde-d438bb046ca9%2F4DNFIAXX5DW8.hic":"2753362470,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4900dce0-61a6-447f-ac6c-ab305018b9c7%2F4DNFIBY3K18K.hic":"4559946251,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7da49fc1-76aa-4c98-98a0-5d3c2b038b48%2F4DNFIOYBTKML.hic":"3184716393,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F15555ede-38ed-41bc-8360-b7199ef78905%2F4DNFI1AM5YH5.hic":"2297316945,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F03bdcf69-274b-4032-9f97-c3801eaff73c%2F4DNFICF19STL.hic":"1147374802,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F38cdfddb-14e4-4975-aa40-32d8755c1c3f%2F4DNFIJOJW15R.hic":"3691597417,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F9590c872-52ad-4b3f-acb2-c53adedba82a%2F4DNFIM391G1I.hic":"1440905789,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe576ec24-0e4f-45eb-8a1a-a3224a4745b0%2F4DNFIDB95IFX.hic":"1297694240,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F52a81c80-1e92-4f6a-86d9-55e5c51f6a1a%2F4DNFIN5ROA5D.hic":"1518878546,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fef1c70d3-7183-4d68-89f3-84f40be4754a%2F4DNFI4WHVND7.hic":"905267421,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F07a2daaa-eceb-413f-9db8-a29804f60e47%2F4DNFIQEYK87U.hic":"1887807641,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fff393095-88d1-474d-8147-b170895f49e5%2F4DNFIIHXG8KW.hic":"990948025,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F14475927-663a-46ea-87e5-262b2b63d4cd%2F4DNFI7RGXYFY.hic":"1995218925,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe801f002-d414-42ff-a4d6-5fb41700f8ef%2F4DNFI3NN1U8T.hic":"1411001640,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff0d46aa0-ddf5-4cda-af89-52f94a5e2e71%2F4DNFIKCEWMIA.hic":"2428803282,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbf511667-f8a9-447f-939a-2f4a6be9e375%2F4DNFII78SGLC.hic":"1346970600,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fbb09b17a-4913-4b9e-a012-e9479fc61486%2F4DNFIQBPRZZD.hic":"6069682291,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fba6ff162-dd84-4b2c-ba2d-f07a0b2e4b3f%2F4DNFIRLG5UWL.hic":"2403291005,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2b047495-6f82-4500-b544-a1aa76997e28%2F4DNFIGEI2UJ5.hic":"1172022205,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5608ab84-424a-4959-a8ff-d30e02b2f7f6%2F4DNFIR3Y85FX.hic":"2506972674,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F87b3ffac-31fd-453d-848c-701d7f6cfc59%2F4DNFIGXWABZ8.hic":"1822988545,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0d791b5a-804c-43a0-b1ff-29934f743de0%2F4DNFIAZ2BC1Z.hic":"2418357843,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F140f5862-a950-4d6d-b73c-0c25aa3c4625%2F4DNFINL956G3.hic":"2822207807,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe1286ed7-6935-45d6-a551-4e23b0f04ab0%2F4DNFIPJBFDS7.hic":"2549466943,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ffb268240-1da9-45e0-bdf3-322e8f83479f%2F4DNFI6OVJGRB.hic":"3977878338,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fae8036e4-c01f-4685-aad1-c9165ea20da9%2F4DNFIY9S5ZOF.hic":"4376491213,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe1f7e790-ec33-40bb-a487-da303818d806%2F4DNFI9S2EX2W.hic":"2018000408,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fb1005a45-2702-4e42-8da0-725cc3b7bd5e%2F4DNFISAAJ8ZA.hic":"1969820347,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Ff94abe7a-4241-4127-9e4e-ad5c9e097537%2F4DNFIEHRX3PO.hic":"1812900014,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc280624f-895f-4ae1-bf79-7dc3b9f3b7b0%2F4DNFID9DXKIA.hic":"725923849,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fcab608ee-4a04-4778-ac76-6f35f749cf77%2F4DNFIYZY8FRZ.hic":"1740798405,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Faf129845-3b27-4ef1-9d06-c1874d96678f%2F4DNFI7TWN65F.hic":"734312298,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fda348dd8-6e9d-42f6-a4f3-33ccee122b5d%2F4DNFIQY1WZG2.hic":"709100099,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F201f494f-44a5-47b4-84f1-a51589e20475%2F4DNFI1OAGRV3.hic":"687695123,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F54ba0756-0e28-4362-a6c8-305484c80352%2F4DNFINROFYOA.hic":"701869003,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3d1254c1-c8b5-450b-8829-1f410da9411f%2F4DNFII9NVNO3.hic":"9088194137,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1a1cc3cc-15a7-4ddf-9eea-b96400def819%2F4DNFIGU793GK.hic":"10224339103,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F91a5a87a-7e53-4170-9f98-8df880205806%2F4DNFIYU853WO.hic":"5831941450,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0695c0b4-8b0e-4a78-a4f9-be8e148eaade%2F4DNFISDI5IAS.hic":"6338256623,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2118aed0-8a60-43c7-b204-b326c5ec063e%2F4DNFINR2MFSM.hic":"6918790050,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3e956c4d-9520-4275-9d54-480add2831e9%2F4DNFI9FI1WN4.hic":"6077420687,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F7f902a51-7a0a-41d8-acfa-c29b3420faac%2F4DNFIM351CAA.hic":"7415860197,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8c304c3b-71f3-4302-8fe8-989d881d32ae%2F4DNFI176BGDG.hic":"7148579858,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F74dd94fb-47ea-47e7-94cf-a909e521dc9a%2F4DNFI76TVWF9.hic":"4335721284,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fce6512f3-2c5e-441a-9e20-d025629fddbe%2F4DNFIU8ET5TP.hic":"5420195714,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F4ea59850-2c40-4a92-a245-76a7893001f2%2F4DNFI6XB8HB4.hic":"5192691591,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5d254a61-9894-4c88-a005-31c08155aa14%2F4DNFI6QRXTH3.hic":"3969529135,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F0fe92b41-3a75-4665-86cf-b39f4cf94aa6%2F4DNFIPVMIIRE.hic":"8681423658,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F8538b53a-eb26-40cb-9ec3-a61028f43e2b%2F4DNFIPTFHCFP.hic":"8285769882,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2232012c-4627-439b-9ce7-ad10a2bc3334%2F4DNFIESB8H1S.hic":"8654573338,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F07c7a44f-cb01-4901-b591-051913e91353%2F4DNFIK3NAVTO.hic":"8415503170,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fcabde890-f7cd-4916-a749-902673f6a716%2F4DNFIOTFSJFL.hic":"3455979876,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F1878f6d9-cb86-4be3-baa6-9300d32a6b46%2F4DNFINCBG8I4.hic":"3356575145,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F49813dc5-38c1-41d3-ad6a-b27e11f925fc%2F4DNFISZ88WZA.hic":"7739704623,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F3fd4b6e2-2002-4897-91c1-ebea81ac7f56%2F4DNFI42A55E5.hic":"6954360693,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F931eb1f3-c388-40c7-89e0-e995851650da%2F4DNFIJQO4MRF.hic":"16726884852,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fe6ecfcb8-9ca6-44c3-9e27-b4e475a382e4%2F4DNFIZX79UT2.hic":"13334742903,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2Fc62048ee-843f-40ee-81ad-f78d20266f7d%2F4DNFICZG2DYC.hic":"16057986680,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F6694b1fb-7fdd-4c1d-9fc6-8dfc8f6b5b58%2F4DNFIK6TSF51.hic":"13887898680,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F2ce3bdb5-84cb-4d31-abfa-e92a39889972%2F4DNFI1GY4LKB.hic":"15320828542,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F10758c5f-f49a-4da5-9e4e-25907afe27e2%2F4DNFI86G6QZJ.hic":"13911815900,25900","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F15e818b8-346b-4f90-a321-b7dd72abb7dc%2F4DNFINFK9D35.hic":"17494323050,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F5501e4db-e6a4-41da-85d4-9114ca5ba28e%2F4DNFIBFXR38K.hic":"17172205445,22663","4dn-open-data-public.s3.amazonaws.com%2Ffourfront-webprod%2Fwfoutput%2F378a1641-5894-475e-8614-bd016e8529d5%2F4DNFIMBPX8Q1.hic":"17880333903,22663"};const gh="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,mh=new class{constructor(t){this.wait=void 0===t?100:t,this.isCalled=!1,this.calls=[]}limiter(t){const e=this;let i=function(){e.calls.length&&!e.isCalled&&(e.isCalled=!0,e.calls.shift().call(),setTimeout(function(){e.isCalled=!1,i()},e.wait))};return function(){e.calls.push(t.bind(this,...arguments)),i()}}}(100);class wh{constructor(t){if(t.alert&&(this.alert=t.alert),this.config=t,this.loadFragData=t.loadFragData,this.fragmentSitesCache={},this.normVectorCache=new uh(10),this.normalizationTypes=["NONE"],this.matrixCache=new uh(10),this.blockCache=new vh,this.normVectorIndexPosition=-1,this.normVectorIndexSize=-1,t.file)this.file=t.file;else if(t.blob)this.file=new eh(t.blob);else{if(!(t.url||t.path&&!gh))throw t.path?Error("path property is deprecated, use NodeLocalFile"):Error("Arguments must include file, blob, url, or path");{this.url=t.url||this.path,this.remote=!0;const i=new ih(t);(e=this.url).indexOf("drive.google.com")>=0||e.indexOf("www.googleapis.com/drive")>0?this.file=new rh(i,mh):this.file=i}}var e}async init(){this.initialized||(await this.readHeaderAndFooter(),this.initialized=!0)}async getVersion(){if(void 0===this.version){const t=await this.file.read(0,128);if(!t)return;const e=new nh(new DataView(t));return this.magic=e.getString(),this.version=e.getInt(),this.version}return this.version}async getMetaData(){return await this.init(),this.meta}async readHeaderAndFooter(){let t=await this.file.read(0,16);if(!t||0===t.byteLength)throw Error("File content is empty");let e=new nh(new DataView(t));if(this.magic=e.getString(),this.version=e.getInt(),this.version<5)throw Error("Unsupported hic version: "+this.version);this.footerPosition=e.getLong(),await this.readFooter();const i=Object.values(this.masterIndex).reduce((t,e)=>Math.min(t,e.start),Number.MAX_VALUE),r=i-16;t=await this.file.read(16,r),e=new nh(new DataView(t)),this.genomeId=e.getString(),this.version>=9&&(this.normVectorIndexPosition=e.getLong(),this.normVectorIndexSize=e.getLong()),this.attributes={};let s=e.getInt();for(;s-- >0;)this.attributes[e.getString()]=e.getString();this.chromosomes=[],this.chromosomeIndexMap={};let o=e.getInt(),n=0;for(;o-- >0;){const t={index:n,name:e.getString(),size:this.version<9?e.getInt():e.getLong()};"all"===t.name.toLowerCase()&&(this.wholeGenomeChromosome=t,this.wholeGenomeResolution=Math.round(2*t.size)),this.chromosomes.push(t),this.chromosomeIndexMap[t.name]=t.index,n++}this.bpResolutions=[];let a=e.getInt();for(;a-- >0;)this.bpResolutions.push(e.getInt());if(this.loadFragData){this.fragResolutions=[];let t=e.getInt();if(t>0)for(;t-- >0;)this.fragResolutions.push(e.getInt())}this.chrAliasTable={};for(let t of Object.keys(this.chromosomeIndexMap))t.startsWith("chr")?this.chrAliasTable[t.substr(3)]=t:"MT"===t?this.chrAliasTable.chrM=t:this.chrAliasTable["chr"+t]=t;this.meta={version:this.version,genome:this.genomeId,chromosomes:this.chromosomes,resolutions:this.bpResolutions}}async readFooter(){const t=this.version<9?8:12;let e=await this.file.read(this.footerPosition,t);if(!e)return null;let i=new nh(new DataView(e));const r=this.version<9?i.getInt():i.getLong();let s=i.getInt();const o=196*s;for(e=await this.file.read(this.footerPosition+t,Math.min(o,r)),i=new nh(new DataView(e)),this.masterIndex={};s-- >0;){const t=i.getString(),e=i.getLong(),r=i.getInt();this.masterIndex[t]={start:e,size:r}}if(this.expectedValueVectors={},this.version>5){const t=this.version<9?4:8;this.normExpectedValueVectorsPosition=this.footerPosition+t+r}return this}async printIndexStats(){let t,e=0,i=0;await await this.init();for(let r of Object.keys(this.masterIndex)){const s=this.masterIndex[r];e+=s.size,s.size>i&&(i=s.size,t=r)}console.log(`${i} ${t} ${this.config.url}`)}async getMatrix(t,e){const i=hh.getKey(t,e);if(this.matrixCache.has(i))return this.matrixCache.get(i);{const r=await this.readMatrix(t,e);return this.matrixCache.set(i,r),r}}async readMatrix(t,e){if(await this.init(),t>e){const i=t;t=e,e=i}const i=hh.getKey(t,e),r=this.masterIndex[i];if(!r)return;const s=await this.file.read(r.start,r.size);return s?hh.parseMatrix(s,this.chromosomes):void 0}async getContactRecords(t,e,i,r,s,o=!1){await this.init();const n=this.chromosomeIndexMap[this.getFileChrName(e.chr)],a=this.chromosomeIndexMap[this.getFileChrName(i.chr)];if(n>a||n===a&&e.start>=i.end){const t=e;e=i,i=t}const c=await this.getBlocks(e,i,r,s);if(!c||0===c.length)return[];const l=[],h=e.start/s,d=e.end/s,u=i.start/s,f=i.end/s,p=Math.floor(h),g=Math.ceil(d),m=Math.floor(u),w=Math.ceil(f);for(let n of c)if(n){let a,c,b=t&&"NONE"!==t;const F=this.getFileChrName(e.chr),v=this.getFileChrName(i.chr);if(b){const e=await this.getNormalizationVector(t,F,r,s),i=F===v?e:await this.getNormalizationVector(t,v,r,s);e&&i?(a=await e.getValues(p,g),c=await i.getValues(m,w)):b=!1}for(let t of n.records)if(o||t.bin1>=h&&t.bin1<d&&t.bin2>=u&&t.bin2<f)if(b){const e=t.bin1,i=t.bin2,r=a[e-p]*c[i-m];if(0!==r&&!isNaN(r)){const s=t.counts/r;l.push(new dh(e,i,s))}}else l.push(t)}return l}async getBlocks(t,e,i,r){const s=(t,e)=>`${e.getKey()}_${t}`;await this.init();const o=this.getFileChrName(t.chr),n=this.getFileChrName(e.chr),a=this.chromosomeIndexMap[o],c=this.chromosomeIndexMap[n];if(void 0===a)return console.log("No chromosome named: "+t.chr),[];if(void 0===c)return console.log("No chromosome named: "+e.chr),[];const l=await this.getMatrix(a,c);if(!l)return console.log("No matrix for "+t.chr+"-"+e.chr),[];const h=l.getZoomData(r,i);if(!h){let i=`No data available for resolution: ${r} for map ${t.chr}-${e.chr}`;throw new Error(i)}const d=h.getBlockNumbers(t,e,this.version),u=[],f=[];for(let t of d){const e=s(t,h);this.blockCache.has(r,e)?u.push(this.blockCache.get(r,e)):f.push(t)}const p=f.map(t=>this.readBlock(t,h)),g=await Promise.all(p);for(let t of g)t&&this.blockCache.set(r,s(t.blockNumber,h),t);return u.concat(g)}async readBlock(t,e){const i=await e.blockIndex.getBlockIndexEntry(t);if(i){let r=await this.file.read(i.filePosition,i.size);if(!r)return;r=new Xl.Inflate(new Uint8Array(r)).decompress().buffer;const s=new nh(new DataView(r)),o=s.getInt(),n=[];if(this.version<7)for(let t=0;t<o;t++){const t=s.getInt(),e=s.getInt(),i=s.getFloat();n.push(new dh(t,e,i))}else{const t=s.getInt(),e=s.getInt(),i=1===s.getByte(),r=!(this.version<9)&&1==s.getByte(),o=!(this.version<9)&&1==s.getByte(),a=s.getByte();if(1===a){const a=o?s.getInt():s.getShort();for(let c=0;c<a;c++){const a=e+(o?s.getInt():s.getShort()),c=r?s.getInt():s.getShort();for(let e=0;e<c;e++){const e=t+(r?s.getInt():s.getShort()),o=i?s.getFloat():s.getShort();n.push(new dh(e,a,o))}}}else{if(2!=a)throw new Error("Unknown block type: "+a);{const r=s.getInt(),o=s.getShort();for(let a=0;a<r;a++){const r=Math.floor(a/o),c=t+(a-r*o),l=e+r;if(i){const t=s.getFloat();isNaN(t)||n.push(new dh(c,l,t))}else{const t=s.getShort();-32768!=t&&n.push(new dh(c,l,t))}}}}}return new Fh(t,e,n,i)}}async hasNormalizationVector(t,e,i,r){let s;if(await this.init(),Number.isInteger(e))s=e;else{const t=this.getFileChrName(e);s=this.chromosomeIndexMap[t]}const o=bh(t,s,i.toString(),r),n=await this.getNormVectorIndex();return n&&n[o]}async isNormalizationValueAvailableAtResolution(t,e,i,r){let s;if(Number.isInteger(e))s=e;else{const t=this.getFileChrName(e);s=this.chromosomeIndexMap[t]}return void 0!==(await this.getNormVectorIndex())[bh(t,s,i.toString(),r)]}async getNormalizationVector(t,e,i,r){let s;if(await this.init(),Number.isInteger(e))s=e;else{const t=this.getFileChrName(e);s=this.chromosomeIndexMap[t]}const o=bh(t,s,i.toString(),r);if(this.normVectorCache.has(o))return this.normVectorCache.get(o);const n=await this.getNormVectorIndex();if(!n)return void console.log("Normalization vectors not present in this file");if(!1===await this.isNormalizationValueAvailableAtResolution(t,e,i,r)){const e=`Normalization option ${t} not available at resolution ${r}. Will use NONE.`;return console.log(e),void(this.alert&&this.alert(e))}const a=n[o],c=await this.file.read(a.filePosition,8);if(!c)return;const l=new nh(new DataView(c)),h=this.version<9?l.getInt():l.getLong(),d=this.version<9?8:4,u=this.version<9?a.filePosition+4:a.filePosition+8,f=new fh(this.file,u,h,d);return this.normVectorCache.set(o,f),f}async getNormVectorIndex(){if(!(this.version<6)){if(this.normVectorIndex)return this.normVectorIndex;if(this.normVectorIndexPosition>0&&this.normVectorIndexSize>0){const t={start:this.normVectorIndexPosition,size:this.normVectorIndexSize};return this.readNormVectorIndex(t)}if(!this.config.nvi&&this.remote&&this.url){const t=new URL(this.url),e=encodeURIComponent(t.hostname+t.pathname);ph.hasOwnProperty(e)&&(this.config.nvi=ph[e])}if(this.config.nvi){const t=decodeURIComponent(this.config.nvi).split(","),e={start:parseInt(t[0]),size:parseInt(t[1])};return this.readNormVectorIndex(e)}try{return await this.readNormExpectedValuesAndNormVectorIndex(),this.normVectorIndex}catch(t){"416"===t.code||416===t.code?this.normExpectedValueVectorsPosition=void 0:console.error(t)}}}async getNormalizationOptions(){return await this.getNormVectorIndex(),this.normalizationTypes}async readNormVectorIndex(t){await this.init(),this.normalizationVectorIndexRange=t;const e=await this.file.read(t.start,t.size),i=new nh(new DataView(e));this.normVectorIndex={};let r=i.getInt();for(;r-- >0;)this.parseNormVectorEntry(i);return this.normVectorIndex}async readNormExpectedValuesAndNormVectorIndex(){if(await this.init(),void 0===this.normExpectedValueVectorsPosition)return;const t=await this.skipExpectedValues(this.normExpectedValueVectorsPosition);let e=4,i=await this.file.read(t,4);if(0===i.byteLength)return;const r=new nh(new DataView(i)).getInt(),s={start:t+e,size:30*r};i=await this.file.read(s.start,s.size),this.normalizedExpectedValueVectors={},this.normVectorIndex={},await async function i(r,s){const o=new nh(new DataView(s));for(;r-- >0;){if(o.available()<100){r++,e+=o.position;const s=Math.max(1e3,30*r),n={start:t+e,size:s},a=await this.file.read(n.start,n.size);return i.call(this,r,a)}this.parseNormVectorEntry(o)}e+=o.position}.call(this,r,i),this.config.nvi=t.toString()+","+e}async skipExpectedValues(t){const e=this.version,i=new sh({file:this.file,size:256e3}),r={start:t,size:4},s=await i.read(r.start,r.size),o=new nh(new DataView(s)).getInt();return 0===o?t+4:async function t(r,s){let o={start:r,size:500},n=0,a=r,c=await i.read(o.start,o.size),l=new nh(new DataView(c));l.getString(),l.getString(),l.getInt();const h=e<9?l.getInt():l.getLong();n+=l.position+h*(e<9?8:4),o={start:r+n,size:4},c=await i.read(o.start,o.size),l=new nh(new DataView(c));const d=l.getInt();return n+=4+d*(4+(e<9?8:4)),s--,0===s?a+n:t(a+n,s)}(t+4,o)}getZoomIndexForBinSize(t,e){let i;if("BP"===(e=e||"BP"))i=this.bpResolutions;else{if("FRAG"!==e)throw new Error("Invalid unit: "+e);i=this.fragResolutions}for(let e=0;e<i.length;e++)if(i[e]===t)return e;return-1}parseNormVectorEntry(t){const e=t.getString(),i=t.getInt(),r=t.getString(),s=t.getInt(),o=t.getLong(),n=this.version<9?t.getInt():t.getLong(),a=e+"_"+i+"_"+r+"_"+s;this.normalizationTypes.includes(e)||this.normalizationTypes.push(e),this.normVectorIndex[a]={filePosition:o,size:n}}getFileChrName(t){return this.chrAliasTable.hasOwnProperty(t)?this.chrAliasTable[t]:t}}function bh(t,e,i,r){return t+"_"+e+"_"+i+"_"+r}class Fh{constructor(t,e,i,r){this.blockNumber=t,this.zoomData=e,this.records=i,this.idx=r}}class vh{constructor(){this.resolution=void 0,this.map=new uh(6)}set(t,e,i){this.resolution!==t&&this.map.clear(),this.resolution=t,this.map.set(e,i)}get(t,e){return this.resolution===t?this.map.get(e):void 0}has(t,e){return this.resolution===t&&this.map.has(e)}}class yh{constructor(t=10){this.max=t,this.map=new Map}get(t){let e=this.map.get(t);return e&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){this.map.has(t)?this.map.delete(t):this.map.size===this.max&&this.map.delete(this.first()),this.map.set(t,e)}has(t){return this.map.has(t)}clear(){this.map.clear()}first(){return this.map.keys().next().value}}class Ah{constructor(t,e){this.config=t,this.genome=e,this.hicFile=t._hicFile?t._hicFile:new wh(t),t._hicFile=void 0,this.binThreshold=t.binThreshold||5,this.percentileThreshold=t.percentileThreshold||80,this.recordCache=new Map,this.normVectorCache=new yh(10)}async getHeader(){return await this.hicFile.init(),this.normalizationOptions=await this.hicFile.getNormalizationOptions(),this.hicFile}async getFeatures({chr:t,start:e,end:i,bpPerPixel:r,visibilityWindow:s,normalization:o}){this.hicFile.initialized||await this.hicFile.init();const n=this.hicFile.bpResolutions;let a=-1;for(let t=n.length-1;t>=0;t--)if(n[t]>=r){a=t;break}const c=n[-1!==a?a:0],l=await this.getRecords(t,e,i,c),h=this.binThreshold;let d,u,f,p;if(o&&"NONE"!==o){const r=await this.getNormalizationVector(o,t,c);d=Math.floor(e/c),u=Math.floor(e/c),f=await r.getValues(d,Math.ceil(i/c)),p=await r.getValues(u,Math.ceil(i/c))}const g=[];for(let t of l)if(Math.abs(t.bin1-t.bin2)>h){const{bin1:e,bin2:i,counts:r}=t;let s=r;if(o&&"NONE"!==o){const t=f[e-d]*p[i-u];if(0===t||isNaN(t))continue;s/=t}g.push(s)}const[m,w,b]=g.length<1e3?[0,0,0]:function(t,e,i=5e4){if(0===t.length)return[0,0,0];t.sort(function(t,e){return t-e});const r=Math.max(Math.floor(t.length*(e/100)),Math.max(0,t.length-i)),s=r+Math.floor(.05*(t.length-r)),o=r+Math.floor(.95*(t.length-r));return[t[r],t[s],t[o]]}(g,this.percentileThreshold,5e4),F=[];for(let e of l){const{bin1:i,bin2:r,counts:s}=e;if(Math.abs(i-r)<=h)continue;let n=s;if(o&&"NONE"!==o){const t=f[i-d]*p[r-u];if(0===t||isNaN(t))continue;n/=t}if(n<m)continue;const a=this.genome.getChromosomeName(t),l=i*c,g=i*c+c,v=r*c,y=r*c+c;F.push({chr:a,chr1:a,chr2:a,start:Math.min(l,v),end:Math.max(g,y),start1:l,end1:g,start2:v,end2:y,value:n,score:b>w?Math.round(200+600*Math.min(Math.max((n-w)/(b-w),0),1)):800})}return F.sort((t,e)=>t.start-e.start),F}async getNormalizationVector(t,e,i){const r=`${t}_${e}_${i}`;if(this.normVectorCache.has(r))return this.normVectorCache.get(r);const s=await this.hicFile.getNormalizationVector(t,e,"BP",i);return this.normVectorCache.set(r,s),s}async getRecords(t,e,i,r){const s=`${t}_${r}`;if(this.recordCache.has(s)){const t=this.recordCache.get(s);if(e>=t.start&&i<=t.end)return t.records}const o=Math.floor((e+1)/r)*r,n=Math.ceil((i-1)/r)*r,a=await this.hicFile.getContactRecords(void 0,{chr:t,start:o,end:n},{chr:t,start:o,end:n},"BP",r);return this.recordCache.clear(),this.recordCache.set(s,{start:o,end:n,records:a}),a}supportsWholeGenome(){return!1}}const Ch=new Set(["bigwig","bw","bigbed","bb","biginteract","biggenepred","bignarrowpeak"]);function _h(t,e){const i=t.format?t.format.toLowerCase():void 0;return t.features?new ql(t,e):i&&Ch.has(i)?new Rl(t,e):"tdf"===i?new Pl(t,e):"gbk"===i?new Zl(t,e):"vcf.list"===i?new Yl(t,e,_h):"hic"===i?new Ah(t,e):new ul(t,e)}function xh(t){return(3-t.readingFrame)%3}function kh(t){return t.cdStart||t.start}function Ih(t){return t.cdEnd||t.end}function Sh(t){if(t.utr)return 0;const e=t.cdStart||t.start;return(t.cdEnd||t.end)-e}const Eh={TTT:"F",TTC:"F",TTA:"L",TTG:"L",CTT:"L",CTC:"L",CTA:"L",CTG:"L",ATT:"I",ATC:"I",ATA:"I",ATG:"M",GTT:"V",GTC:"V",GTA:"V",GTG:"V",TCT:"S",TCC:"S",TCA:"S",TCG:"S",CCT:"P",CCC:"P",CCA:"P",CCG:"P",ACT:"T",ACC:"T",ACA:"T",ACG:"T",GCT:"A",GCC:"A",GCA:"A",GCG:"A",TAT:"Y",TAC:"Y",TAA:"STOP",TAG:"STOP",CAT:"H",CAC:"H",CAA:"Q",CAG:"Q",AAT:"N",AAC:"N",AAA:"K",AAG:"K",GAT:"D",GAC:"D",GAA:"E",GAG:"E",TGT:"C",TGC:"C",TGA:"STOP",TGG:"W",CGT:"R",CGC:"R",CGA:"R",CGG:"R",AGT:"S",AGC:"S",AGA:"R",AGG:"R",GGT:"G",GGC:"G",GGA:"G",GGG:"G"},Nh=.25;function Mh(t,e,i){let r=(t.start-e)/i,s=(t.end-e)/i,o=s-r;return o<3&&(o=3,r-=1.5),{px:r,px1:s,pw:o}}function Rh(t,e,i,r,s,o){try{s.save(),s.fillStyle=this.color,s.strokeStyle=this.color;const r=this.getColorForFeature(t);let n,a;s.fillStyle=r,s.strokeStyle=r,"SQUISHED"===this.displayMode&&void 0!==t.row?(n=this.featureHeight/2,a=this.margin+this.squishedRowHeight*t.row):"EXPANDED"===this.displayMode&&void 0!==t.row?(n=this.featureHeight,a=this.margin+this.expandedRowHeight*t.row):(n=this.featureHeight,a=this.margin);const c=o.pixelWidth,l=a+n/2,h=n/2,d=l-h/2,u=t.exons?t.exons.length:0,f=Mh(t,e,i),p=this.arrowSpacing,g="+"===t.strand?1:"-"===t.strand?-1:0;if(0===u){const t=Math.max(0,f.px),e=Math.min(c,f.px1),i=e-t;if(s.fillRect(t,a,i,n),0!==g){s.fillStyle="white",s.strokeStyle="white";for(let i=t+p/2;i<e;i+=p)go.strokeLine(s,i-2*g,l-2,i,l),go.strokeLine(s,i-2*g,l+2,i,l);s.fillStyle=r,s.strokeStyle=r}}else{go.strokeLine(s,f.px+1,l,f.px1-1,l);const u=Math.max(0,f.px)+p/2,m=Math.min(c,f.px1);for(let t=u;t<m;t+=p)go.strokeLine(s,t-2*g,l-2,t,l),go.strokeLine(s,t-2*g,l+2,t,l);for(let u=0;u<t.exons.length;u++){const f=t.exons[u];let m,w=Math.round((f.start-e)/i),b=Math.round((f.end-e)/i),F=Math.max(1,b-w);if(!(w+F<0)){if(w>c)break;if(f.utr)s.fillRect(w,d,F,h);else{if(f.cdStart&&(m=Math.round((f.cdStart-e)/i),s.fillRect(w,d,m-w,h),F-=m-w,w=m),f.cdEnd&&(m=Math.round((f.cdEnd-e)/i),s.fillRect(m,d,b-m,h),F-=b-m,b=m),F=Math.max(F,1),s.fillRect(w,a,F,n),void 0!==f.readingFrame&&o.bpPerPixel<Nh&&o.sequenceInterval){const i=u>0&&void 0!==t.exons[u-1].readingFrame?t.exons[u-1]:void 0,r=u<t.exons.length-1&&void 0!==t.exons[u+1].readingFrame?t.exons[u+1]:void 0;Dh.call(this,s,t.strand,i,f,r,e,o.bpPerPixel,a,n,o.sequenceInterval)}if(F>p+5&&0!==g&&o.bpPerPixel>Nh){s.fillStyle="white",s.strokeStyle="white";for(let t=w+p/2;t<b;t+=p)go.strokeLine(s,t-2*g,l-2,t,l),go.strokeLine(s,t-2*g,l+2,t,l);s.fillStyle=r,s.strokeStyle=r}}}}}o.drawLabel&&"SQUISHED"!==this.displayMode&&Bh.call(this,s,t,f.px,f.px1,a,o.referenceFrame,o)}finally{s.restore()}}function Dh(t,e,i,r,s,o,n,a,c,l){const h=["rgb(124,124,204)","rgb(12, 12, 120)"];t.save();const d=(e,i,r,s,d,u)=>{const f=Math.round((i-o)/n),p=Math.round((r-o)/n)-f;let g;if(void 0===s){if(l.hasSequence(i,r)){const t=l.getSequence(i,r);if(t&&3===t.length){const i="+"===e?t:an(t.split("").reverse().join(""));g=Eh[i]}}}else g=s;t.fillStyle="M"===s||"M"===g&&0===u?"#83f902":"STOP"===g?"#ff2101":h[d],t.fillRect(f,a,p,c),g&&(t.save(),((e,i,r,s,o)=>{"STOP"===o&&(o="*");const n=t.measureText(o).width;go.fillText(t,o,r+(i-n)/2,s-4,{fillStyle:"#ffffff"})})(0,p,f,a+c,g),t.restore());const m=r-i;return m>0&&m<3?{start:i,end:r}:void 0},u=xh(r);let f,p,g,m,w,b=kh(r),F=Ih(r),v=1;if("+"===e){for(u>0&&(b+=u),v=1,w=0,f=b;f<F;w++,f+=3)m=v%2,p=Math.min(F,f+3),g=d(e,f,p,void 0,v%2,w),++v;if(u>0||g){const t=u>0?Th.call(this,e,u,b-u,b,g,i,r,s,l):Th.call(this,e,void 0,void 0,void 0,g,i,r,s,l);if(t){const{left:i,rite:r}=t;i&&d(e,b-u,b,i.aminoAcidLetter,0,void 0),r&&d(e,g.start,g.end,r.aminoAcidLetter,m,void 0)}}}else{for(u>0&&(F-=u),v=1,w=0,w=0,p=F;p>b;w++,p-=3)m=v%2,f=Math.max(b,p-3),g=d(e,f,p,void 0,v%2,w),++v;if(u>0||g){const t=u>0?Th.call(this,e,u,F,F+u,g,i,r,s,l):Th.call(this,e,void 0,void 0,void 0,g,i,r,s,l);if(t){const{left:i,rite:r}=t;r&&d(e,F,F+u,r.aminoAcidLetter,0,void 0),i&&d(e,g.start,g.end,i.aminoAcidLetter,m,void 0)}}}t.restore()}function Bh(t,e,i,r,s,o,n){try{t.save();let o=e[this.config.labelField?this.config.labelField:"name"];if(void 0===o&&e.gene&&(o=e.gene.name),void 0===o&&(o=e.id||e.ID),!o||"."===o)return;let a=n.pixelXOffset||0;const c=Math.max(i,-a);let l,h=(c+Math.min(r,-a+n.viewportWidth))/2;"COLLAPSED"===this.displayMode&&"SLANT"===this.labelDisplayMode&&(l={rotate:{angle:45}});const d=function(t,e){return e?t+20:t+25}(s,l);let u=this.getColorForFeature(e),f=this.browser.qtlSelections.hasPhenotype(e.name);const p={textAlign:"SLANT"===this.labelDisplayMode?void 0:"center",fillStyle:u,strokeStyle:u},g=t.measureText(o),m=h-g.width/2,w=h+g.width/2,b=n.rowLastLabelX[e.row]||-Number.MAX_SAFE_INTEGER;(n.labelAllFeatures||m>b||f)&&(n.rowLastLabelX[e.row]=w,t.clearRect(h-g.width/2-1,d-g.actualBoundingBoxAscent-1,g.width+2,g.actualBoundingBoxAscent+g.actualBoundingBoxDescent+2),go.fillText(t,o,h,d,p,l))}finally{t.restore()}}function Th(t,e,i,r,s,o,n,a,c){let l,h,d="",u="",f="";const p={left:void 0,rite:void 0};if("+"===t){if(e){if(u=c.getSequence(i,r),!u)return;if([l,h]=[Ih(o)-(3-e),Ih(o)],d=c.getSequence(l,h),!d)return;f=d+u,p.left={triplet:f,aminoAcidLetter:Eh[f]}}if(s){if(!a)return;if(d=c.getSequence(s.start,s.end),!d)return;const t=xh(a),e=kh(a);if(u=c.getSequence(e,e+t),!u)return;f=d+u,p.rite={triplet:f,aminoAcidLetter:Eh[f]}}}else{if(e){if(d=c.getSequence(i,r),!d)return;if([l,h]=[kh(a),kh(a)+(3-e)],u=c.getSequence(l,h),!u)return;f=d+u,f=an(f.split("").reverse().join("")),p.rite={triplet:f,aminoAcidLetter:Eh[f]}}if(s){if(u=c.getSequence(s.start,s.end),!u)return;const t=xh(o),e=Ih(o);if(d=c.getSequence(e-t,e),!d)return;f=d+u,f=an(f.split("").reverse().join("")),p.left={triplet:f,aminoAcidLetter:Eh[f]}}}return p}const Lh=new Set(["nonsense","missense","stop-loss","frameshift","cds-indel"]),zh=new Set(["coding-synon"]),Ph=new Set(["splice-3","splice-5"]),Oh=new Set(["untranslated-5","untranslated-3"]);function Hh(t,e,i,r,s){var o,n,a,c,l,h=Mh(t,e,i),d=this.margin,u=this.snpColors.length,f=0;switch(o="squished"===this.displayMode?this.squishedRowHeight:this.expandedRowHeight,this.colorBy){case"function":a=t.func,l=a.split(","),c=l.map(function(t){return Lh.has(t)||Ph.has(t)?u-1:zh.has(t)?u-2:Oh.has(t)?u-3:0}),f=c.reduce(function(t,e){return Math.max(t,e)});break;case"class":f="deletion"===(n=t.class)?u-1:"mnp"===n?u-2:"microsatellite"===n||"named"===n?u-3:0}s.fillStyle=this.snpColors[f],s.fillRect(h.px,d,h.pw,o)}function Uh(t,e,i,r,s){const o="EXPANDED"===this.displayMode?this.expandedRowHeight:this.squishedRowHeight;let n=this.margin;"COLLAPSED"!==this.displayMode&&void 0!==t.row&&(n+=t.row*o);const a=n+.5*o,c=a-.5*o,l=a+.5*o,h=Math.round((t.junction_left-e)/i),d=Math.round((t.junction_right-e)/i);s.beginPath(),s.moveTo(h,a),s.bezierCurveTo(h,c,d,c,d,a),s.lineWidth=1+Math.log(t.num_junction_reads)/Math.log(2),s.strokeStyle="blue",s.stroke();const u=t.spanning_frag_coords;for(let t=0;t<u.length;t++){const r=u[t],o=Math.round((r.left-e)/i),n=Math.round((r.right-e)/i);s.beginPath(),s.moveTo(o,a),s.bezierCurveTo(o,l,n,l,n,a),s.lineWidth=1,s.strokeStyle="purple",s.stroke()}}class Vh extends lc{constructor(t,e){super(t,e)}init(t){super.init(t),this.labelDisplayMode=t.labelDisplayMode,t._featureSource?(this.featureSource=t._featureSource,delete t._featureSource):"blat"!==t.type&&(this.featureSource=t.featureSource?t.featureSource:_h(t,this.browser.genome)),"FusionJuncSpan"===t.type?(this.render=t.render||Uh,this.squishedRowHeight=t.squishedRowHeight||50,this.expandedRowHeight=t.expandedRowHeight||50,this.height=t.height||this.margin+2*this.expandedRowHeight):"snp"===t.type?(this.render=t.render||Hh,this.snpColors=["rgb(0,0,0)","rgb(0,0,255)","rgb(0,255,0)","rgb(255,0,0)"],this.colorBy="function",this.expandedRowHeight=t.expandedRowHeight||10,this.squishedRowHeight=t.squishedRowHeight||5,this.height=t.height||30):(this.render=t.render||Rh,this.arrowSpacing=30,function(t){function e(){t.trackView&&"SQUISHED"!==t.displayMode&&t.trackView.repaintViews()}t.browser.on&&t.browser.on("trackdragend",e)}(this),this.squishedRowHeight=t.squishedRowHeight||15,this.expandedRowHeight=t.expandedRowHeight||30,this.height=t.height||this.margin+2*this.expandedRowHeight,t.colorBy&&(t.colorBy.field&&(t.colorTable=t.colorBy.pallete||t.colorBy.palette,t.colorBy=t.colorBy.field),this.colorBy=t.colorBy),t.colorTable?this.colorTable=new Gr(t.colorTable):this.colorTable=new Qr("Set1"))}async postInit(){if("function"!=typeof this.featureSource.getHeader||(this.header=await this.featureSource.getHeader(),!this.disposed))return this.header&&this.setTrackProperties(this.header),void 0===this.visibilityWindow&&"function"==typeof this.featureSource.defaultVisibilityWindow&&(this.visibilityWindow=await this.featureSource.defaultVisibilityWindow()),this._initialColor=this.color||this.constructor.defaultColor,this._initialAltColor=this.altColor||this.constructor.defaultColor,this}get searchable(){return this.featureSource.searchable}async search(t){return this.featureSource&&this.featureSource.searchable?this.featureSource.search(t):void 0}get supportsWholeGenome(){return void 0!==this.config.supportsWholeGenome?this.config.supportsWholeGenome:this.featureSource&&"function"==typeof this.featureSource.supportsWholeGenome?this.featureSource.supportsWholeGenome():!(void 0!==this.visibilityWindow||!1!==this.config.indexed&&this.config.indexURL)||void 0}async getFeatures(t,e,i,r){const s=this.visibilityWindow;return this.featureSource.getFeatures({chr:t,start:e,end:i,bpPerPixel:r,visibilityWindow:s})}computePixelHeight(t){if("COLLAPSED"===this.displayMode)return this.margin+this.expandedRowHeight;{let e=0;if(t&&"function"==typeof t.forEach)for(let i of t)i.row&&i.row>e&&(e=i.row);return this.margin+(e+1)*("SQUISHED"===this.displayMode?this.squishedRowHeight:this.expandedRowHeight)}}draw(t){const{features:e,context:i,bpPerPixel:r,bpStart:s,bpEnd:o,pixelWidth:n,pixelHeight:a,referenceFrame:c}=t,l=e;if(r<Nh){const e=this.browser.genome.getChromosome(c.chr).bpLength;t.sequenceInterval=this.browser.genome.getSequenceInterval(c.chr,s>0?s:0,o>e?e:o)}if(this.isMergedTrack||go.fillRect(i,0,t.pixelTop,n,a,{fillStyle:"rgb(255, 255, 255)"}),l){const e=[];t.rowLastX=[],t.rowLastLabelX=[];for(let i of l)if((!this._filter||this._filter(i))&&i.start>s&&i.end<o){const r="COLLAPSED"===this.displayMode?0:i.row||0;e[r]?e[r]++:e[r]=1,t.rowLastX[r]=-Number.MAX_SAFE_INTEGER,t.rowLastLabelX[r]=-Number.MAX_SAFE_INTEGER}const c=n/Math.max(1,Math.max(...e.filter(t=>!isNaN(t))));let h=[];const d=[];for(let e of l){if(this._filter&&!this._filter(e))continue;if(e.end<s)continue;if(e.start>o)break;"COLLAPSED"===this.displayMode&&e.name&&this.browser.qtlSelections.hasPhenotype(e.name)&&d.push(e);const n="COLLAPSED"===this.displayMode?0:e.row;t.drawLabel=t.labelAllFeatures||c>10;const l=Math.ceil((e.end-s)/r),u=h[n];if(!u||l>u){this.render.call(this,e,s,r,a,i,t);const o=Math.floor((e.start-s)/r);u&&o-u<=0&&(i.globalAlpha=.5,go.strokeLine(i,o,0,o,a,{strokeStyle:"rgb(255, 255, 255)"}),i.globalAlpha=1),h[n]=l}}for(let e of d)t.drawLabel=!0,this.render.call(this,e,s,r,a,i,t)}else console.log("No feature list")}clickedFeatures(t){const e=t.y-this.margin,i=super.clickedFeatures(t);let r;switch(this.displayMode){case"SQUISHED":r=Math.floor(e/this.squishedRowHeight);break;case"EXPANDED":r=Math.floor(e/this.expandedRowHeight);break;default:r=void 0}return i.filter(function(t){return void 0===r||void 0===t.row||r===t.row})}popupData(t,e){void 0===e&&(e=this.clickedFeatures(t));const i=t.genomicLocation,r=[];for(let t of e){const e=t._f||t,s="function"==typeof e.popupData?e.popupData(i):this.extractPopupData(e,void 0);if(s){r.length>0&&r.push("<hr/><hr/>");const o=this.infoURL||this.config.infoURL;for(let e of s)if(r.push(e),o&&e.name&&"name"===e.name.toLowerCase()&&e.value&&b(e.value)&&!e.value.startsWith("<")){const i=o.replace("$$",t.name);e.value=`<a target=_blank href=${i}>${e.value}</a>`}const n="gff"===this.config.format||"gff3"===this.config.format||"gtf"===this.config.format;if(e.exons&&e.exons.length>1)for(let t=0;t<e.exons.length;t++){const s=e.exons[t];if(i>=s.start&&i<=s.end){const i=n?s.number:"-"===e.strand?e.exons.length-t:t+1;i&&(r.push("<hr/>"),r.push({name:"Exon Number",value:i}));break}}}}return r}menuItemList(){const t=[];if(this.render===Hh){t.push("<hr/>");for(const i of["function","class"]){function r(){this.colorBy=i,this.trackView.repaintViews()}t.push({element:ic(`Color by ${i}`,i===this.colorBy),click:r})}}t.push("<hr/>");const e={COLLAPSED:"Collapse",SQUISHED:"Squish",EXPANDED:"Expand"};for(const s of["COLLAPSED","SQUISHED","EXPANDED"]){function o(){this.displayMode=s,this.config.displayMode=s,this.trackView.checkContentHeight(),this.trackView.repaintViews()}t.push({element:ic(e[s],s===this.displayMode),click:o})}return t}contextMenuItemList(t){const e=this.clickedFeatures(t);if(void 0===e||0===e.length)return;e.length>1&&e.sort((t,e)=>e.end-e.start-(t.end-t.start));const i=e[0];if(i.end-i.start<=1e6){const t=[{label:"View feature sequence",click:async()=>{let t=await this.browser.genome.getSequence(i.chr,i.start,i.end);t?"-"===i.strand&&(t=cn(t)):t="Unknown sequence",this.browser.alert.present(t)}}];return Jo()&&void 0!==navigator.clipboard&&t.push({label:"Copy feature sequence",click:async()=>{let t=await this.browser.genome.getSequence(i.chr,i.start,i.end);t?"-"===i.strand&&(t=cn(t)):t="Unknown sequence";try{await navigator.clipboard.writeText(t)}catch(t){console.error(t),this.browser.alert.present(`error copying sequence to clipboard ${t}`)}}}),t.push("<hr/>"),t}}description(){if(Hh===this.render){let t="<html>"+this.name+"<hr/>";return t+="<em>Color By Function:</em><br>",t+='<span style="color:red">Red</span>: Coding-Non-Synonymous, Splice Site<br>',t+='<span style="color:green">Green</span>: Coding-Synonymous<br>',t+='<span style="color:blue">Blue</span>: Untranslated<br>',t+='<span style="color:black">Black</span>: Intron, Locus, Unknown<br><br>',t+="<em>Color By Class:</em><br>",t+='<span style="color:red">Red</span>: Deletion<br>',t+='<span style="color:green">Green</span>: MNP<br>',t+='<span style="color:blue">Blue</span>: Microsatellite, Named<br>',t+='<span style="color:black">Black</span>: Indel, Insertion, SNP',t+="</html>",t}return super.description()}getColorForFeature(t){const e=t._f||t;let i;if(t.name&&this.browser.qtlSelections.hasPhenotype(t.name))i=this.browser.qtlSelections.colorForGene(t.name);else if(this.altColor&&"-"===e.strand)i="function"==typeof this.altColor?this.altColor(e):this.altColor;else if(this.color)i="function"==typeof this.color?this.color(e):this.color;else if(this.colorBy){const t=e.getAttributeValue?e.getAttributeValue(this.colorBy):e[this.colorBy];i=this.colorTable.getColor(t)}else e.color&&(i=e.color);if(i||(i=Vh.defaultColor),e.alpha&&1!==e.alpha)i=ur.addAlpha(i,e.alpha);else if(this.useScore&&e.score&&!Number.isNaN(e.score)){const t=function(t,e,i){const r=(e-t)/9,s=Math.floor((i-t)/r);return Math.min(1,.2+.8*s/9)}(this.config.min?this.config.min:this.viewLimitMin?this.viewLimitMin:0,this.config.max?this.config.max:this.viewLimitMax?this.viewLimitMax:1e3,e.score);e.alpha=t,i=ur.addAlpha(i,t)}return i}dispose(){this.trackView=void 0}}Vh.defaultColor="rgb(0,0,150)",Vh.defaults={type:"annotation",maxRows:1e3,displayMode:"EXPANDED",margin:10,featureHeight:14,useScore:!1};class qh{constructor(t){if(this.config=t,this.browser=t.browser,this.columnFormat=t.columnFormat,this.tableRowSelectionList=[],this.tableDOM=e({class:"igv-roi-table"}),t.width){const[e]=t.width.split("px"),i=parseInt(e,10);this.tableDOM.style.width=`${Math.min(i,1600)}px`}t.parent.appendChild(this.tableDOM),this.headerDOM=t,this.tableColumnTitles=this.tableDOM,this.tableRowContainer=this.tableDOM,this.footerDOM=t.gotoButtonHandler}set headerDOM({browser:t,parent:i,headerTitle:r,dismissHandler:s}){const o=e();this.tableDOM.appendChild(o);const n=e();o.appendChild(n),n.innerHTML=r;const a=e();o.appendChild(a),a.appendChild(l("times")),this.boundDismissHandler=function(t){t.stopPropagation(),s()}.bind(this),a.addEventListener("click",this.boundDismissHandler);const{y:c}=t.root.getBoundingClientRect(),{y:h}=i.getBoundingClientRect(),d=-(h-c);p(this.tableDOM,o,{minX:0,minY:d}),this.tableDOM.style.display="none",this._headerDOM=o}set tableColumnTitles(t){const i=e({class:"igv-roi-table-column-titles"});t.appendChild(i);for(const{label:t,width:r}of this.columnFormat){const s=e();i.appendChild(s),s.style.width=r,s.innerText=t}this._tableColumnTitlesDOM=i}get tableColumnTitles(){return this._tableColumnTitlesDOM}set tableRowContainer(t){const i=e({class:"igv-roi-table-row-container"});t.appendChild(i),this._tableRowContainerDOM=i}get tableRowContainer(){return this._tableRowContainerDOM}set footerDOM(t){const i=e();this.tableDOM.appendChild(i);const r=e({class:"igv-roi-table-button"});i.appendChild(r),r.id="igv-roi-table-view-button",r.textContent="Go To",r.style.pointerEvents="none",this._footerDOM=i,this.gotoButton=r,this.boundGotoButtonHandler=t.bind(this),this.gotoButton.addEventListener("click",this.boundGotoButtonHandler)}tableRowDOMHelper(t){t.addEventListener("mousedown",e=>{e.stopPropagation(),t.classList.toggle("igv-roi-table-row-selected"),t.classList.contains("igv-roi-table-row-selected")?t.classList.remove("igv-roi-table-row-hover"):t.classList.add("igv-roi-table-row-hover"),this.setTableRowSelectionState(t.classList.contains("igv-roi-table-row-selected"))}),t.addEventListener("mouseover",e=>{t.classList.contains("igv-roi-table-row-selected")?t.classList.remove("igv-roi-table-row-hover"):t.classList.add("igv-roi-table-row-hover")}),t.addEventListener("mouseout",e=>{t.classList.remove("igv-roi-table-row-hover")})}clearTable(){const t=this.tableRowContainer.querySelectorAll(".igv-roi-table-row");for(let e of t)e.remove()}setTableRowSelectionState(t){t?this.tableRowSelectionList.push(1):this.tableRowSelectionList.pop(),this.gotoButton.style.pointerEvents=this.tableRowSelectionList.length>0?"auto":"none"}present(){this.tableDOM.style.left="0px";const{y:t}=this.browser.root.getBoundingClientRect(),{y:e}=this.config.parent.getBoundingClientRect();this.tableDOM.style.top=t-e+"px",this.tableDOM.style.display="flex"}dismiss(){this.tableDOM.style.display="none"}isVisible(){return"none"!==this.tableDOM.style.display}dispose(){this.tableDOM.innerHTML="",this.tableDOM.remove();for(const t of Object.keys(this))this[t]=void 0;document.removeEventListener("click",this.boundDismissHandler)}}class Qh extends qh{constructor(t){super(Object.assign({width:"1024px"},t)),this.descriptionDOM=t}set descriptionDOM(t){if(t.description){let i;i=e({class:"igv-roi-table-description"}),this.tableDOM.insertBefore(i,this.tableColumnTitles),i.style.height="auto",i.innerHTML="BLAT result for query sequence:",i=e({class:"igv-roi-table-description"}),this.tableDOM.insertBefore(i,this.tableColumnTitles),i.style.height="auto",i.style.maxHeight="128px",i.innerHTML=t.description,i=e({class:"igv-roi-table-goto-explainer"}),this.tableDOM.insertBefore(i,this.tableColumnTitles),i.innerHTML="Select one or more rows and click Go To to view the regions"}}tableRowDOM(t){const i=e({class:"igv-roi-table-row"}),r=t.map(t=>"number"==typeof t&&isFinite(t)?F(t):t);for(let t=0;t<r.length;t++){const s=e();i.appendChild(s);const o=this.columnFormat[t];s.style.width=o.width||"fit-content",s.innerText=String(r[t])}return this.tableRowDOMHelper(i),i}renderTable(t){if(Array.from(this.tableRowContainer.querySelectorAll(".igv-roi-table-row")).forEach(t=>t.remove()),t.length>0)for(let e of t){const t=this.tableRowDOM(e);this.tableRowContainer.appendChild(t)}}static getColumnFormatConfiguration(){return[{label:"chr",width:"7%"},{label:"start",width:"12%"},{label:"end",width:"12%"},{label:"strand",width:"5%"},{label:"score",width:"5%"},{label:"match",width:"5%"},{label:"mis-match",width:"7%"},{label:"rep. match",width:"7%"},{label:"N's",width:"3%"},{label:"Q gap count",width:"9%"},{label:"Q gap bases",width:"9%"},{label:"T gap count",width:"9%"},{label:"T gap bases",width:"9%"}]}static gotoButtonHandler(t){t.stopPropagation();const e=this.tableDOM.querySelectorAll(".igv-roi-table-row-selected"),i=[];for(const t of e){const e=[];t.querySelectorAll("div").forEach(t=>e.push(t.innerText));const[r,s,o]=e;i.push(`${r}:${s}-${o}`)}for(const t of this.tableDOM.querySelectorAll(".igv-roi-table-row"))t.classList.remove("igv-roi-table-row-selected");this.setTableRowSelectionState(!1),this.browser.search(i.join(" "))}}async function Gh({url:t,userSeq:e,db:i}){if(t=t||"https://igv.org/services/blatUCSC.php",!i)throw Error("Blat database is not defined");const r=await async function(t="",e,i){const r=new URLSearchParams;r.append("userSeq",e),r.append("db",i);const s=await fetch(t,{method:"post",body:r});return s.json()}(t,e,i);return r.blat.map(t=>function(t){if(t.length<21)return;const e=t[13],i=parseInt(t[15]),r=parseInt(t[16]),s=t[8].charAt(0),o=parseInt(t[17]),n=[],a=t[20].replace(/,$/,"").split(","),c=t[18].replace(/,$/,"").split(",");for(let t=0;t<o;t++){const e=parseInt(a[t]),i=e+parseInt(c[t]);n.push({start:e,end:i})}return new Ha({chr:e,start:i,end:r,strand:s,exons:n,tokens:t})}(t)).filter(t=>void 0!==t)}const Wh=25e3;class jh extends Vh{constructor(t,e){super(t,e),this.name||(this.name="Blat Results"),this.sequence=t.sequence,this.table=void 0,t.features&&(this._features=t.features,this.featureSource=new ql({features:t.features},this.browser.genome),delete t.features)}async postInit(){if(!this.featureSource){const t=this.browser.genome.ucscID,e=this.browser.config.blatServerURL,i=await Gh({url:e,userSeq:this.sequence,db:t});this._features=i,this.featureSource=new ql({features:i},this.browser.genome)}return this._initialColor=this.color||this.constructor.defaultColor,this._initialAltColor=this.altColor||this.constructor.defaultColor,this}openTableView(){if(void 0===this.table){const t=this._features.map(t=>[this.browser.genome.getChromosomeDisplayName(t.chr),t.start+1,t.end,t.strand,t.score,t.matches,t.misMatches,t.repMatches,t.nCount,t.qNumInsert,t.qBaseInsert,t.tNumInsert,t.tBaseInsert]),e={browser:this.browser,parent:this.browser.columnContainer,headerTitle:this.config.title,description:this.sequence,dismissHandler:()=>{this.table.dismiss(),this.table.dispose(),this.table=void 0},columnFormat:Qh.getColumnFormatConfiguration(),gotoButtonHandler:Qh.gotoButtonHandler};this.table=new Qh(e),this.table.renderTable(t)}this.table.present()}menuItemList(){const t=super.menuItemList();t.push("<hr/>");const e=this,i=document.createElement("div");return i.textContent="Open table view",t.push({element:i,click(){e.openTableView()}}),t}dispose(){super.dispose(),this.table&&this.table.popover.parentElement.removeChild(this.table.popover)}}async function $h({sequence:t,browser:e,name:i,title:r}){if(t.length>Wh)e.alert.present(`Sequence size exceeds maximum allowed length (${t.length} > 25000)`);else try{const s=e.genome.ucscID,o=e.config.blatServerURL||"https://igv.org/services/blatUCSC.php",n={type:"blat",name:i||"blat results",title:r||"blat results",sequence:t,altColor:"rgb(176, 176, 236)",color:"rgb(236, 176, 176)",searchable:!1,features:await Gh({url:o,userSeq:t,db:s})},a=(await e.loadTrackList([n]))[0];a&&a.openTableView()}catch(t){e.alert.present(`Error performing blat search: ${t}`)}}const Kh=Number.MIN_SAFE_INTEGER,Zh={},Yh=["A","G","C","T","Y","R","W","S","K","M","D","V","H","B","N","X"],Xh=["T","C","G","A","R","Y","W","S","M","K","H","B","D","V","N","X"];for(let XA=0;XA<Yh.length;XA++)Zh[Yh[XA]]=Xh[XA],Zh[Yh[XA].toLowerCase()]=Xh[XA].toLowerCase();const Jh=115;class td{constructor(t,e){this.config=t,this.browser=e,this.type="sequence",this.removable=!0===t.removable,this.name=t.name||"",this.id=t.id||"",this.sequenceType=t.sequenceType||"dna",this.disableButtons=!1,this.order=t.order||Kh,this.ignoreTrackMenu=!1,this.reversed=!0===t.reversed,this.frameTranslate=!0===t.frameTranslate,this.height=this.frameTranslate?Jh:25,t.url&&(t.fastaURL=t.url),t.fastaURL||(this.id=t.id||"sequence")}menuItemList(){return[{name:this.reversed?"Forward":"Reverse",click:()=>{this.reversed=!this.reversed,this.trackView.repaintViews()}},{name:this.frameTranslate?"Close Translation":"Three-frame Translate",click:()=>{if(this.frameTranslate=!this.frameTranslate,this.frameTranslate){for(let t of this.trackView.viewports)t.setContentHeight(Jh);this.trackView.setTrackHeight(Jh)}else{for(let t of this.trackView.viewports)t.setContentHeight(25);this.trackView.setTrackHeight(25)}this.trackView.repaintViews()}}]}contextMenuItemList(t){const e=t.viewport;if(e.referenceFrame.bpPerPixel<=1){const t=e.getWidth()*e.referenceFrame.bpPerPixel,i=e.referenceFrame.chr,r=Math.floor(e.referenceFrame.start),s=Math.ceil(r+t),o=[{label:this.reversed?"View visible sequence (reversed)...":"View visible sequence...",click:async()=>{let t=await this.browser.genome.getSequence(i,r,s);t?this.reversed&&(t=cn(t)):t="Unknown sequence",this.browser.alert.present(t)}}];return Jo()&&o.push({label:"Copy visible sequence",click:async()=>{let t=await this.browser.genome.getSequence(i,r,s);t?this.reversed&&(t=cn(t)):t="Unknown sequence";try{await navigator.clipboard.writeText(t)}catch(t){console.error(t),this.browser.alert.present(`error copying sequence to clipboard ${t}`)}}}),o.push({label:"BLAT visible sequence",click:async()=>{let t=await this.browser.genome.getSequence(i,r,s);if(t){this.reversed&&(t=cn(t));const e=`blat: ${i}:${r+1}-${s}`,o=`blat: ${i}:${r+1}-${s}`;$h({sequence:t,browser:this.browser,name:e,title:o})}}}),o.push("<hr/>"),o}}translateSequence(t){const e=[[],[],[]];for(let i of[0,1,2]){let r=i;for(;t.length-r>=3;){let s=t.slice(r,r+3);this.reversed&&(s=s.split("").reverse().join(""));const o=Eh[s.toUpperCase()]||"";e[i].push({codons:s,aminoA:o}),r+=3}}return e}async getSequenceSource(){return this.config.fastaURL?(this.fasta||(this.fasta=new ed(this.config,this.browser.genome),await this.fasta.init()),this.fasta):this.browser.genome}async getFeatures(t,e,i,r){if(e=Math.floor(e),i=Math.floor(i),r&&r>10)return null;{const r=await this.getSequenceSource();return{bpStart:e,sequence:await r.getSequence(t,e,i)}}}draw(t){const e=t.context,i=t.features;if(i){let r=i.sequence;if(!r)return;this.reversed&&(r=r.split("").map(function(t){return Zh[t]}).join(""));const s=i.bpStart,o=1+t.bpStart+t.pixelWidth*t.bpPerPixel;for(let i=Math.floor(t.bpStart);i<=o;i++){const o=Math.floor(i-s);if(o>=0&&o<r.length){const s=(i-t.bpStart)/t.bpPerPixel,n=1/t.bpPerPixel,a=r[o],c=this.fillColor(a.toUpperCase());if(t.bpPerPixel>.1)go.fillRect(e,s,5,n,10,{fillStyle:c});else{const i=s+.5*(n-e.measureText(a).width);"y"===t.axis?(e.save(),go.labelTransformWithContext(e,i),go.strokeText(e,a,i,15,{strokeStyle:c}),e.restore()):go.strokeText(e,a,i,15,{strokeStyle:c})}}}if(this.frameTranslate){let i=25;const o=this.translateSequence(r);for(let r=0;r<o.length;r++){const n=o[r];for(let o=0;o<n.length;o++){let a=0==o%2?"rgb(160,160,160)":"rgb(224,224,224)";const c=n[o],l=s+r+3*o-t.bpStart,h=Math.floor(l/t.bpPerPixel),d=Math.floor((l+3)/t.bpPerPixel),u=Math.round((h+d)/2);if(d<0)continue;if(h>t.pixelWidth)break;let f=c.aminoA;c.aminoA.indexOf("STOP")>-1?(a="rgb(255, 0, 0)",f="STOP"):"M"===c.aminoA&&(a="rgb(0, 153, 0)",f="START"),go.fillRect(e,h,i,d-h,25,{fillStyle:a}),t.bpPerPixel<=.1&&go.strokeText(e,f,u-e.measureText(f).width/2,i+15)}i+=30}}}}get supportsWholeGenome(){return!1}computePixelHeight(t){return this.height=this.frameTranslate?Jh:25,this.height}fillColor(t){return this.color?this.color:"dna"===this.sequenceType?this.browser.nucleotideColors[t]||"gray":"rgb(0, 0, 150)"}getState(){const t={type:"sequence"};return this.order!==Kh&&(t.order=this.order),this.reversed&&(t.revealed=!0),t}}class ed{constructor(t,e){this.chrNameMap=new Map,this.config=t,this.genome=e}async init(){this.fasta=await qn(this.config),this.chrNameMap=new Map;for(let t of this.fasta.chromosomeNames||[])this.chrNameMap.set(this.genome.getChromosomeName(t),t)}async getSequence(t,e,i){const r=this.chrNameMap.has(t)?this.chrNameMap.get(t):t;return this.fasta.getSequence(r,e,i)}}class id{constructor(t,e,i,r){this.guid=n(),this.trackView=t,this.referenceFrame=i,this.browser=t.browser,this.viewportElement=document.createElement("div"),this.viewportElement.className="igv-viewport",e.appendChild(this.viewportElement),t.track.height&&this.setHeight(t.track.height);const s=t.track.type||"untyped";this.viewportElement.setAttribute("data-track-type",s),t.track instanceof td&&(this.alert=new zo(this.viewportElement)),this.contentTop=0,this.contentHeight=this.viewportElement.clientHeight,void 0!==r&&this.setWidth(r),this.initializationHelper()}initializationHelper(){}showMessage(t){this.messageDiv||(this.messageDiv=document.createElement("div"),this.messageDiv.className="igv-viewport-message",this.viewportElement.appendChild(this.messageDiv)),this.messageDiv.textContent=t,this.messageDiv.style.display="inline-block"}hideMessage(){this.messageDiv&&(this.messageDiv.style.display="none")}setTrackLabel(t){}startSpinner(){}stopSpinner(){}checkZoomIn(){return!0}shift(){}setTop(t){this.contentTop=t}async loadFeatures(){}clearCache(){}repaint(){}draw(t,e,i){console.log("Viewport - draw(drawConfiguration, features, roiFeatures)")}checkContentHeight(t){const e=this.trackView.track;if(t=t||this.cachedFeatures,"FILL"===e.displayMode)this.setContentHeight(this.viewportElement.clientHeight);else if("function"==typeof e.computePixelHeight&&t&&Array.isArray(t)&&t.length>0){const i=e.computePixelHeight(t,this.referenceFrame.bpPerPixel);i!==this.contentHeight&&this.setContentHeight(i)}}getContentHeight(){return this.contentHeight}setContentHeight(t){this.contentHeight=t}isLoading(){return!1}saveSVG(){}isVisible(){return this.viewportElement.clientWidth>0}setWidth(t){this.viewportElement.style.width=`${t}px`}getWidth(){return this.viewportElement.clientWidth}setHeight(t){this.viewportElement.style.height=`${t}px`}getContentTop(){return this.contentTop}containsPosition(t,e){console.log("Viewport - containsPosition(chr, position)")}addMouseHandlers(){}dispose(){this.viewportElement.remove();for(const t in this)this.hasOwnProperty(t)&&(this[t]=void 0)}}function rd(t,e){var i,r=Object.keys(e);for(i=0;i<r.length;i++)t=t.replace(new RegExp("\\{"+r[i]+"\\}","gi"),e[r[i]]);return t}function sd(t){var e,i,r;if(!t)throw new Error("cannot create a random attribute name for an undefined object");e="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",i="";do{for(i="",r=0;r<12;r++)i+=e[Math.floor(51*Math.random())]}while(t[i]);return i}function od(t){var e={alphabetic:"alphabetic",hanging:"hanging",top:"text-before-edge",bottom:"text-after-edge",middle:"central"};return e[t]||e.alphabetic}function nd(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]}const ad=function(t,e){var i,r,s,o={};for(t=t.split(","),e=e||10,i=0;i<t.length;i+=2)r="&"+t[i+1]+";",s=parseInt(t[i],e),o[r]="&#"+s+";";return o["\\xa0"]=" ",o}("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),cd={strokeStyle:{svgAttr:"stroke",canvas:"#000000",svg:"none",apply:"stroke"},fillStyle:{svgAttr:"fill",canvas:"#000000",svg:null,apply:"fill"},lineCap:{svgAttr:"stroke-linecap",canvas:"butt",svg:"butt",apply:"stroke"},lineJoin:{svgAttr:"stroke-linejoin",canvas:"miter",svg:"miter",apply:"stroke"},miterLimit:{svgAttr:"stroke-miterlimit",canvas:10,svg:4,apply:"stroke"},lineWidth:{svgAttr:"stroke-width",canvas:1,svg:1,apply:"stroke"},globalAlpha:{svgAttr:"opacity",canvas:1,svg:1,apply:"fill stroke"},font:{canvas:"10px sans-serif"},shadowColor:{canvas:"#000000"},shadowOffsetX:{canvas:0},shadowOffsetY:{canvas:0},shadowBlur:{canvas:0},textAlign:{canvas:"start"},textBaseline:{canvas:"alphabetic"},lineDash:{svgAttr:"stroke-dasharray",canvas:[],svg:null,apply:"stroke"}};class ld{constructor(t,e){this.__root=t,this.__ctx=e}addColorStop(t,e){var i,r=this.__ctx.__createElement("stop");r.setAttribute("offset",t),e&&-1!==e.indexOf("rgba")?(i=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(e),r.setAttribute("stop-color",rd("rgb({r},{g},{b})",{r:i[1],g:i[2],b:i[3]})),r.setAttribute("stop-opacity",i[4])):r.setAttribute("stop-color",e),this.__root.appendChild(r)}}class hd{constructor(t,e){this.__root=t,this.__ctx=e}}class dd{constructor(t){if(!(this instanceof dd))return new dd(t);if(this.config=t,this.width=t.width,this.height=t.height,this.enableMirroring=t.enableMirroring||!1,this.canvas=this,this.__document=document,t.ctx?this.__ctx=t.ctx:(this.__canvas=this.__document.createElement("canvas"),this.__ctx=this.__canvas.getContext("2d")),this.isSVG=!0,this.__setDefaultStyles(),this.__stack=[this.__getStyleState()],this.__groupStack=[],this.__root=this.__createElement("svg"),this.__root.setAttribute("width",this.width),this.__root.setAttribute("height",this.height),this.__root.setAttribute("overflow","visible"),t.viewbox){const e=t.viewbox.x+" "+t.viewbox.y+" "+t.viewbox.width+" "+t.viewbox.height;this.__root.setAttribute("viewBox",e),this.viewbox=t.viewbox}this.__ids={},this.__defs=this.__createElement("defs"),this.__root.appendChild(this.__defs),this.multiLocusGap=t.multiLocusGap;let e={id:"svg_output_backdrop",width:"100%",height:"100%",fill:t.backdropColor||"white"},i=this.__createElement("rect",e);this.__root.appendChild(i),this.__rootGroup=this.__createElement("g",{id:"root-group"}),this.__root.appendChild(this.__rootGroup),this.__currentElement=this.__rootGroup}setWidth(t){this.width=t,this.__root.setAttribute("width",this.width);const e=this.config.viewbox.x+" "+this.config.viewbox.y+" "+t+" "+this.config.viewbox.height;this.__root.setAttribute("viewBox",e)}setHeight(t){this.height=t,this.__root.setAttribute("height",this.height);const e=this.config.viewbox.x+" "+this.config.viewbox.y+" "+this.config.viewbox.width+" "+t;this.__root.setAttribute("viewBox",e)}__createElement(t,e,i){void 0===e&&(e={});let r=this.__document.createElementNS("http://www.w3.org/2000/svg",t);i&&(r.setAttribute("fill","none"),r.setAttribute("stroke","none"));for(let t of Object.keys(e))r.setAttribute(t,e[t]);return r}__setDefaultStyles(){var t,e,i=Object.keys(cd);for(t=0;t<i.length;t++)this[e=i[t]]=cd[e].canvas}__applyStyleState(t){var e,i,r=Object.keys(t);for(e=0;e<r.length;e++)this[i=r[e]]=t[i]}__getStyleState(){var t,e,i={},r=Object.keys(cd);for(t=0;t<r.length;t++)i[e=r[t]]=this[e];return i}__applyStyleToCurrentElement(t){var e=this.__currentElement,i=this.__currentElementsToStyle;i&&(e.setAttribute(t,""),e=i.element,i.children.forEach(function(e){e.setAttribute(t,"")}));var r,s,o,n,a,c=Object.keys(cd);for(r=0;r<c.length;r++)if(s=cd[c[r]],o=this[c[r]],s.apply)if(o instanceof hd){if(o.__ctx)for(;o.__ctx.__defs.childNodes.length;)n=o.__ctx.__defs.childNodes[0].getAttribute("id"),this.__ids[n]=n,this.__defs.appendChild(o.__ctx.__defs.childNodes[0]);e.setAttribute(s.apply,rd("url(#{id})",{id:o.__root.getAttribute("id")}))}else if(o instanceof ld)e.setAttribute(s.apply,rd("url(#{id})",{id:o.__root.getAttribute("id")}));else if(s&&-1!==s.apply.indexOf(t)&&s.svg!==o)if("stroke"!==s.svgAttr&&"fill"!==s.svgAttr||!o||-1===o.indexOf("rgba")){var l=s.svgAttr;if("globalAlpha"===c[r]&&(l=t+"-"+s.svgAttr,e.getAttribute(l)))continue;e.setAttribute(l,o)}else{a=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi.exec(o),e.setAttribute(s.svgAttr,rd("rgb({r},{g},{b})",{r:a[1],g:a[2],b:a[3]}));var h=a[4],d=this.globalAlpha;null!=d&&(h*=d),e.setAttribute(s.svgAttr+"-opacity",h)}}__closestGroupOrSvg(t){return"g"===(t=t||this.__currentElement).nodeName||"svg"===t.nodeName?t:this.__closestGroupOrSvg(t.parentNode)}getSerializedSvg(t){var e,i,r,s,o,n=(new XMLSerializer).serializeToString(this.__root);if(t)for(e=Object.keys(ad),i=0;i<e.length;i++)r=e[i],s=ad[r],(o=new RegExp(r,"gi")).test(n)&&(n=n.replace(o,s));return n}getSvg(){return this.__root}saveWithTranslationAndClipRect(t,e,i,r,s,o){const n=`${t}_clip_rect`;let a=this.__createElement("clipPath",{id:n});this.__defs.appendChild(a);const c={x:"0",y:o.toString(),width:r.toString(),height:s.toString()};a.appendChild(this.__createElement("rect",c));const l=this.__createElement("g");l.setAttribute("transform",rd("translate({x},{y})",{x:e,y:i})),l.setAttribute("clip-path",rd("url(#{id})",{id:n}));const h=this.__closestGroupOrSvg();h.appendChild(l),this.__groupStack.push(h),this.__currentElement=l,this.__stack.push(this.__getStyleState())}save(){var t=this.__createElement("g"),e=this.__closestGroupOrSvg();this.__groupStack.push(e),e.appendChild(t),this.__currentElement=t,this.__stack.push(this.__getStyleState())}restore(){this.__currentElement=this.__groupStack.pop(),this.__currentElementsToStyle=null,this.__currentElement||(this.__currentElement=this.__root.childNodes[1]);var t=this.__stack.pop();this.__applyStyleState(t)}__addTransform(t){var e=this.__closestGroupOrSvg();if(e.childNodes.length>0){"path"===this.__currentElement.nodeName&&(this.__currentElementsToStyle||(this.__currentElementsToStyle={element:e,children:[]}),this.__currentElementsToStyle.children.push(this.__currentElement),this.__applyCurrentDefaultPath());var i=this.__createElement("g");e.appendChild(i),this.__currentElement=i}var r=this.__currentElement.getAttribute("transform");r?r+=" ":r="",r+=t,this.__currentElement.setAttribute("transform",r)}addTrackGroupWithTranslationAndClipRect(t,e,i,r,s,o){const n=t+"_clip_rect";let a=this.__createElement("clipPath",{id:n});this.__defs.appendChild(a),a.appendChild(this.__createElement("rect",{x:"0",y:o.toString(),width:r.toString(),height:s.toString()}));let c=this.__createElement("g");this.__rootGroup.appendChild(c),c.setAttribute("transform",rd("translate({x},{y})",{x:e,y:i})),c.setAttribute("id",t+"_group"),c.setAttribute("clip-path",rd("url(#{id})",{id:n})),this.__currentElement=c}scale(t,e){void 0===e&&(e=t),this.__addTransform(rd("scale({x},{y})",{x:t,y:e}))}rotate(t){var e=180*t/Math.PI;this.__addTransform(rd("rotate({angle},{cx},{cy})",{angle:e,cx:0,cy:0}))}translate(t,e){this.__addTransform(rd("translate({x},{y})",{x:t,y:e}))}transform(t,e,i,r,s,o){this.__addTransform(rd("matrix({a},{b},{c},{d},{e},{f})",{a:t,b:e,c:i,d:r,e:s,f:o}))}beginPath(){var t;this.__currentDefaultPath="",this.__currentPosition={},t=this.__createElement("path",{},!0),this.__closestGroupOrSvg().appendChild(t),this.__currentElement=t}__applyCurrentDefaultPath(){var t=this.__currentElement;"path"===t.nodeName?t.setAttribute("d",this.__currentDefaultPath):console.error("Attempted to apply path command to node",t.nodeName)}__addPathCommand(t){this.__currentDefaultPath+=" ",this.__currentDefaultPath+=t}moveTo(t,e){"path"!==this.__currentElement.nodeName&&this.beginPath(),this.__currentPosition={x:t,y:e},this.__addPathCommand(rd("M {x} {y}",{x:t,y:e}))}closePath(){this.__currentDefaultPath&&this.__addPathCommand("Z")}lineTo(t,e){this.__currentPosition={x:t,y:e},this.__currentDefaultPath&&this.__currentDefaultPath.indexOf("M")>-1?this.__addPathCommand(rd("L {x} {y}",{x:t,y:e})):this.__addPathCommand(rd("M {x} {y}",{x:t,y:e}))}bezierCurveTo(t,e,i,r,s,o){this.__currentPosition={x:s,y:o},this.__addPathCommand(rd("C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}",{cp1x:t,cp1y:e,cp2x:i,cp2y:r,x:s,y:o}))}quadraticCurveTo(t,e,i,r){this.__currentPosition={x:i,y:r},this.__addPathCommand(rd("Q {cpx} {cpy} {x} {y}",{cpx:t,cpy:e,x:i,y:r}))}arcTo(t,e,i,r,s){var o=this.__currentPosition&&this.__currentPosition.x,n=this.__currentPosition&&this.__currentPosition.y;if(void 0!==o&&void 0!==n){if(s<0)throw new Error("IndexSizeError: The radius provided ("+s+") is negative.");if(o===t&&n===e||t===i&&e===r||0===s)this.lineTo(t,e);else{var a=nd([o-t,n-e]),c=nd([i-t,r-e]);if(a[0]*c[1]!==a[1]*c[0]){var l=a[0]*c[0]+a[1]*c[1],h=Math.acos(Math.abs(l)),d=nd([a[0]+c[0],a[1]+c[1]]),u=s/Math.sin(h/2),f=t+u*d[0],p=e+u*d[1],g=[-a[1],a[0]],m=[c[1],-c[0]],w=function(t){var e=t[0];return t[1]>=0?Math.acos(e):-Math.acos(e)},b=w(g),F=w(m);this.lineTo(f+g[0]*s,p+g[1]*s),this.arc(f,p,s,b,F)}else this.lineTo(t,e)}}}stroke(){"path"===this.__currentElement.nodeName&&this.__currentElement.setAttribute("paint-order","fill stroke markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("stroke")}fill(){"path"===this.__currentElement.nodeName&&this.__currentElement.setAttribute("paint-order","stroke fill markers"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement("fill")}rect(t,e,i,r){"path"!==this.__currentElement.nodeName&&this.beginPath(),this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+r),this.lineTo(t,e+r),this.lineTo(t,e),this.closePath()}fillRect(t,e,i,r){r<0&&(e+=r,r=-r),i<0&&(t+=i,i=-i);var s,o,n,a={x:t,y:e,width:i,height:r};(!this.viewbox||(s=this.viewbox,o=a,s.x<o.x+o.width&&s.x+s.width>o.x&&s.y<o.y+o.height&&s.y+s.height>o.y))&&(n=this.__createElement("rect",a,!0),this.__closestGroupOrSvg().appendChild(n),this.__currentElement=n,this.__applyStyleToCurrentElement("fill"))}strokeRect(t,e,i,r){var s;s=this.__createElement("rect",{x:t,y:e,width:i,height:r},!0),this.__closestGroupOrSvg().appendChild(s),this.__currentElement=s,this.__applyStyleToCurrentElement("stroke")}strokeEllipse(t,e,i,r,s,o,n,a){this.__ellipse(t,e,i,r,s,o,n,a,"stroke")}fillEllipse(t,e,i,r,s,o,n,a){this.__ellipse(t,e,i,r,s,o,n,a,"fill")}__ellipse(t,e,i,r,s,o,n,a,c){const l={cx:t,cy:e,rx:i,ry:r},h=this.__createElement("ellipse",l,!0);this.__closestGroupOrSvg().appendChild(h),this.__currentElement=h,this.__applyStyleToCurrentElement(c)}__clearCanvas(){for(var t=this.__closestGroupOrSvg().getAttribute("transform"),e=this.__root.childNodes[1],i=e.childNodes,r=i.length-1;r>=0;r--)i[r]&&e.removeChild(i[r]);this.__currentElement=e,this.__groupStack=[],t&&this.__addTransform(t)}clearRect(t,e,i,r){if(0!==t||0!==e||i!==this.width||r!==this.height){var s,o=this.__closestGroupOrSvg();s=this.__createElement("rect",{x:t,y:e,width:i,height:r,fill:"#FFFFFF"},!0),o.appendChild(s)}else this.__clearCanvas()}createLinearGradient(t,e,i,r){var s=this.__createElement("linearGradient",{id:sd(this.__ids),x1:t+"px",x2:i+"px",y1:e+"px",y2:r+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(s),new ld(s,this)}createRadialGradient(t,e,i,r,s,o){var n=this.__createElement("radialGradient",{id:sd(this.__ids),cx:r+"px",cy:s+"px",r:o+"px",fx:t+"px",fy:e+"px",gradientUnits:"userSpaceOnUse"},!1);return this.__defs.appendChild(n),new ld(n,this)}__parseFont(){var t=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\'\"\sa-z0-9]+?)\s*$/i.exec(this.font),e={style:t[1]||"normal",size:t[4]||"10px",family:t[6]||"sans-serif",weight:t[3]||"normal",decoration:t[2]||"normal",href:null};return"underline"===this.__fontUnderline&&(e.decoration="underline"),this.__fontHref&&(e.href=this.__fontHref),e}__wrapTextLink(t,e){if(t.href){var i=this.__createElement("a");return i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t.href),i.appendChild(e),i}return e}__applyText(t,e,i,r){var s,o,n=this.__parseFont(),a=this.__closestGroupOrSvg(),c=this.__createElement("text",{"font-family":n.family,"font-size":n.size,"font-style":n.style,"font-weight":n.weight,"text-decoration":n.decoration,x:e,y:i,"text-anchor":(s=this.textAlign,o={left:"start",right:"end",center:"middle",start:"start",end:"end"},o[s]||o.start),"dominant-baseline":od(this.textBaseline)},!0);c.appendChild(this.__document.createTextNode(t)),this.__currentElement=c,this.__applyStyleToCurrentElement(r),a.appendChild(this.__wrapTextLink(n,c))}fillText(t,e,i){this.__applyText(t,e,i,"fill")}strokeText(t,e,i){this.__applyText(t,e,i,"stroke")}measureText(t){return this.__ctx.font=this.font,this.__ctx.measureText(t)}arc(t,e,i,r,s,o){if(r!==s){(r%=2*Math.PI)===(s%=2*Math.PI)&&(s=(s+2*Math.PI-.001*(o?-1:1))%(2*Math.PI));var n=t+i*Math.cos(s),a=e+i*Math.sin(s),c=t+i*Math.cos(r),l=e+i*Math.sin(r),h=o?0:1,d=0,u=s-r;u<0&&(u+=2*Math.PI),d=o?u>Math.PI?0:1:u>Math.PI?1:0,this.lineTo(c,l),this.__addPathCommand(rd("A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}",{rx:i,ry:i,xAxisRotation:0,largeArcFlag:d,sweepFlag:h,endX:n,endY:a})),this.__currentPosition={x:n,y:a}}}clip(){var t=this.__closestGroupOrSvg(),e=this.__createElement("clipPath"),i=sd(this.__ids),r=this.__createElement("g");this.__applyCurrentDefaultPath(),t.removeChild(this.__currentElement),e.setAttribute("id",i),e.appendChild(this.__currentElement),this.__defs.appendChild(e),t.setAttribute("clip-path",rd("url(#{id})",{id:i})),t.appendChild(r),this.__currentElement=r}drawImage(){var t,e,i,r,s,o,n,a,c,l,h,d,u,f=Array.prototype.slice.call(arguments),p=f[0],g=0,m=0;if(3===f.length)t=f[1],e=f[2],i=s=p.width,r=o=p.height;else if(5===f.length)t=f[1],e=f[2],i=f[3],r=f[4],s=p.width,o=p.height;else{if(9!==f.length)throw new Error("Invalid number of arguments passed to drawImage: "+arguments.length);g=f[1],m=f[2],s=f[3],o=f[4],t=f[5],e=f[6],i=f[7],r=f[8]}n=this.__closestGroupOrSvg(),this.__currentElement;var w="translate("+t+", "+e+")";if(p instanceof dd){if((a=p.getSvg().cloneNode(!0)).childNodes&&a.childNodes.length>1){for(c=a.childNodes[0];c.childNodes.length;)u=c.childNodes[0].getAttribute("id"),this.__ids[u]=u,this.__defs.appendChild(c.childNodes[0]);if(l=a.childNodes[1]){var b,F=l.getAttribute("transform");b=F?F+" "+w:w,l.setAttribute("transform",b),n.appendChild(l)}}}else"CANVAS"!==p.nodeName&&"IMG"!==p.nodeName||((h=this.__createElement("image")).setAttribute("width",i),h.setAttribute("height",r),h.setAttribute("preserveAspectRatio","none"),(g||m||s!==p.width||o!==p.height)&&((d=this.__document.createElement("canvas")).width=i,d.height=r,d.getContext("2d").drawImage(p,g,m,s,o,0,0,i,r),p=d),h.setAttribute("transform",w),h.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","CANVAS"===p.nodeName?p.toDataURL():p.getAttribute("src")),n.appendChild(h))}createPattern(t,e){let i,r=this.__document.__createElement("pattern"),s=sd(this.__ids);return r.setAttribute("id",s),r.setAttribute("width",t.width),r.setAttribute("height",t.height),"CANVAS"===t.nodeName||"IMG"===t.nodeName?(i=this.__createElement("image"),i.setAttribute("width",t.width),i.setAttribute("height",t.height),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","CANVAS"===t.nodeName?t.toDataURL():t.getAttribute("src")),r.appendChild(i),this.__defs.appendChild(r)):t instanceof dd&&(r.appendChild(t.__root.childNodes[1]),this.__defs.appendChild(r)),new hd(r,this)}setLineDash(t){t&&t.length>0?this.lineDash=t.join(","):this.lineDash=null}drawFocusRing(){}createImageData(){}getImageData(){}putImageData(){}globalCompositeOperation(){}setTransform(){}}function ud(t){if(t.startsWith("GCF")||t.startsWith("GCA")&&t.length>=13){return"https://hgdownload.soe.ucsc.edu/hubs/"+t.substring(0,3)+"/"+t.substring(4,7)+"/"+t.substring(7,10)+"/"+t.substring(10,13)+"/"+t+"/hub.txt"}}class fd{constructor(t,e,i,r){this.name=t,this.priority=i,this.label=e,this.defaultOpen=r,this.tracks=[],this.children=[]}isEmpty(){return 0===this.tracks.length&&(!this.children||0===this.children.length||this.children.every(t=>t.isEmpty()))}map(t){this.tracks.forEach(t),this.children.forEach(e=>e.map(t))}findTracks(t){const e=[];return this._find(e,t),e}_find(t,e){this.tracks.forEach(i=>{e(i)&&t.push(i)}),this.children.forEach(i=>i._find(t,e))}countTracks(){return this.tracks.length+this.children.reduce((t,e)=>t+e.countTracks(),0)}countSelectedTracks(){return this.tracks.filter(t=>t.visible).length+this.children.reduce((t,e)=>t+e.countSelectedTracks(),0)}trim(){this.children=this.children.filter(t=>!t.isEmpty()),this.children.forEach(t=>t.trim())}setTrackVisibility(t){this.tracks.forEach(e=>{e.visible=t.has(e.url)}),this.children.forEach(e=>e.setTrackVisibility(t))}}var pd,gd;const md=new Set(["bigbed","bigwig","biggenepred","vcftabix","refgene","bam","sampleinfo","vcf.list","ucscsnp","bed","tdf","gff","gff3","gtf","vcf","vcfphasedtrio","bigdbsnp","rmask","genepred","wig","bedgraph","interact","broadpeak","narrowpeak","gappedpeak","gistic","seg","mut, bigrmsk","longrange","longrangecolor"]),wd=new Set(["cytoBandIdeo","assembly","gap","gapOverlap","allGaps","cpgIslandExtUnmasked","windowMasker"]),bd=new Map([["pack","EXPANDED"],["full","EXPANDED"],["squish","SQUISHED"],["dense","COLLAPSED"]]),Fd=new Map([["vcftabix","vcf"],["vcfphasedtrio","vcf"],["bigdbsnp","bigbed"],["genepred","refgene"]]);class vd{constructor(t,e){pd.add(this),this.groupStanzas=e,this.trackStanzas=t}getSupportedTrackCount(){let t=0;for(const e of this.trackStanzas)!wd.has(e.name)&&e.hasProperty("bigDataUrl")&&e.format&&md.has(e.format.toLowerCase())&&t++;return t}getGroupedTrackConfigurations(){if(!this.groupTrackConfigs){this.groupTrackConfigs=[];const t=new Map,e=new fd("","",0,!0);this.groupTrackConfigs.push(e);const i=this.groupStanzas&&this.groupStanzas.length>0;if(i)for(const e of this.groupStanzas){const i=e.getProperty("name"),r="0"===e.getProperty("defaultIsClosed"),s=e.hasProperty("priority")?Ad(e.getProperty("priority")):Number.MAX_SAFE_INTEGER-1,o=new fd(i,e.getProperty("label"),s,r);t.set(i,o),this.groupTrackConfigs.push(o)}for(let r of this.trackStanzas){const s=r.hasOwnProperty("superTrack")&&!r.hasOwnProperty("bigDataUrl")||r.hasOwnProperty("compositeTrack")||r.hasOwnProperty("view")||r.hasOwnProperty("container")&&"multiWig"===r.getOwnProperty("container");let o;if(r.hasOwnProperty("parent")&&(o=t.get(r.getOwnProperty("parent"))),!o&&i&&r.hasProperty("group")){const e=r.getProperty("group");if(t.has(e))o=t.get(e);else{const i=new fd(e,e,1e3,!0);t.set(e,i),this.groupTrackConfigs.push(i),o=i}}if(s){const e=r.getProperty("track"),i=r.hasProperty("priority")?Ad(r.getProperty("priority")):Number.MAX_SAFE_INTEGER-1,s="0"===r.getProperty("defaultIsClosed"),n=r.getOwnProperty("longLabel"),a=(n&&n.length<50?n:r.getOwnProperty("shortLabel"))||"",c=new fd(e,a,i,s);if(t.has(e))throw new Error(`Duplicate track container: ${e}`);t.set(e,c),o?o.children.push(c):this.groupTrackConfigs.push(c)}else if(!wd.has(r.name)&&r.hasProperty("bigDataUrl")&&r.format&&md.has(r.format.toLowerCase())){const t=wo(this,pd,"m",gd).call(this,r);o?o.tracks.push(t):e.tracks.push(t)}}}return this.groupTrackConfigs.forEach(t=>t.trim()),this.groupTrackConfigs=this.groupTrackConfigs.filter(t=>!t.isEmpty()),this.groupTrackConfigs.sort((t,e)=>t.priority-e.priority),this.groupTrackConfigs}}function yd(t){const e=t.indexOf(">"),i=t.indexOf("<",e);return e>0&&i>e?t.substring(e+1,i):t}function Ad(t){try{const e=t.trim().split(".");let i=100*parseInt(e[0],10);return e.length>1&&(i+=10*parseInt(e[1],10)),e.length>2&&(i+=parseInt(e[2],10)),i}catch(e){return console.error(`Error parsing priority string: ${t}`,e),Number.MAX_SAFE_INTEGER}}pd=new WeakSet,gd=function(t){const e=Fd.get(t.format)||t.format,i={id:t.getProperty("track"),name:t.getProperty("shortLabel"),format:e,url:t.getProperty("bigDataUrl")};if("vcfTabix"===e&&(i.indexURL=i.url+".tbi"),t.hasProperty("longLabel")&&t.hasProperty("html")?(i.description&&(i.description+="<br/>"),i.description=`<a target="_blank" href="${t.getProperty("html")}">${t.getProperty("longLabel")}</a>`):t.hasProperty("longLabel")&&(i.description=t.getProperty("longLabel")),t.hasProperty("autoScale")&&(i.autoscale="on"===t.getProperty("autoScale").toLowerCase()),t.hasProperty("maxHeightPixels")){const e=t.getProperty("maxHeightPixels").split(":");i.maxHeight=Number.parseInt(e[0]),i.height=Number.parseInt(e[1]),i.minHeight=Number.parseInt(e[2])}if(t.hasProperty("color")){const e=t.getProperty("color");i.color=e.indexOf(",")>0?`rgb(${e})`:e}if(t.hasProperty("altColor")){const e=t.getProperty("altColor");i.altColor=e.indexOf(",")>0?`rgb(${e})`:e}if(t.hasProperty("viewLimits")){const e=t.getProperty("viewLimits").split(":");let r,s;e.length>1&&(r=Number.parseInt(e[0]),s=Number.parseInt(e[1])),Number.isNaN(s)||Number.isNaN(r)?console.warn(`Unexpected viewLimits value in track line: ${t.getProperty("viewLimits")}`):(i.min=r,i.max=s)}if(t.hasProperty("itemRgb"),t.hasProperty("visibility")&&("hide"===t.getProperty("visibility")?i.visible=!1:i.displayMode=bd.get(t.getProperty("visibility"))||"COLLAPSED"),t.hasProperty("url")&&(i.infoURL=t.getProperty("url")),t.hasProperty("searchIndex")&&(i.searchIndex=t.getProperty("searchIndex")),t.hasProperty("searchTrix")&&(i.trixURL=t.getProperty("searchTrix")),t.hasProperty("html")&&(i.html=t.getProperty("html")),t.hasProperty("group")&&(i._group=t.getProperty("group"),this.groupPriorityMap&&this.groupPriorityMap.has(i._group))){const t=this.groupPriorityMap.get(i._group)+1;i.order=t,this.groupPriorityMap.set(i._group,t)}if(t.hasProperty("metadata")&&(i.attributes=function(t){const e=new Map;let i=-1;for(;t&&t.length>0;)try{if(t.length===i)break;i=t.length;let r,s=t.indexOf("=");if(-1===s||s===t.length-1)break;const o=C(A(t.substring(0,s)));let n;if('"'===t.charAt(s+1)?(s++,r=t.indexOf('" ',s+1),n=r>0?t.substring(s+1,r):t.substring(s+1),r++):(r=t.indexOf(" ",s+1),-1===r&&(r=t.length),n=t.substring(s+1,r)),n=A(n),n.endsWith('"')&&(n=n.substring(0,n.length-1)),n.startsWith("<")&&n.endsWith(">")&&(n=yd(n)),e.set(o,n),r===t.length)break;t=r>0?t.substring(r+1).trim():""}catch(t){}return e}(t.getProperty("metadata"))),t.hasProperty("maxWindowToDraw")){let e=parseInt(t.getProperty("maxWindowToDraw"),10);e>Number.MAX_SAFE_INTEGER&&(e=Number.MAX_SAFE_INTEGER),i.visibilityWindow=e}if(t.hasProperty("maxWindowCoverage")){let e=parseInt(t.getProperty("maxWindowCoverage"),10);e>Number.MAX_SAFE_INTEGER&&(e=Number.MAX_SAFE_INTEGER),i.visibilityWindow=e}return i};const Cd=new Set(["visibility","priority","group"]),_d=new Set(["track","type","shortLabel","longLabel","bigDataUrl","parent","superTrack","priority","view","compositeContainer","compositeTrack"]);class xd{constructor(t,e){this.properties=new Map,this.type=t,this.name=e}setProperty(t,e){this.properties.set(t,e)}getProperty(t){return this.properties.has("noInherit")?this.properties.get(t):this.parent&&Cd.has(t)&&this.parent.hasProperty(t)?this.parent.getProperty(t):this.properties.has(t)?this.properties.get(t):this.parent&&!_d.has(t)?this.parent.getProperty(t):void 0}hasProperty(t){return null!==this.getProperty(t)&&void 0!==this.getProperty(t)}hasOwnProperty(t){return this.properties.has(t)}getOwnProperty(t){return this.properties.get(t)}removeProperty(t){this.properties.delete(t)}get format(){const t=this.getProperty("type");if(t)return function(t){const e=t.indexOf(" ");return e>0?t.substring(0,e):t}(t)}get displayMode(){let t=this.getProperty("visibility");if(!t)return"COLLAPSED";switch(t=t.toLowerCase(),t){case"dense":default:return"COLLAPSED";case"pack":return"EXPANDED";case"squish":return"SQUISHED"}}}const kd=new Set(["descriptionUrl","desriptionUrl","twoBitPath","blat","chromAliasBb","twoBitBptURL","twoBitBptUrl","htmlPath","bigDataUrl","genomesFile","trackDb","groups","include","html","searchTrix","groups","chromSizes"]);async function Id(t){const e=t.lastIndexOf("/"),i=t.substring(0,e+1),r=function(t){let e;if(t.startsWith("https://")||t.startsWith("http://"))try{const i=new URL(t);e=`${i.protocol}//${i.host}`}catch(t){throw console.error("Error parsing base URL host",t),t}else e="";return e}(t),s=(await Er.loadString(t,{})).split(/\n|\r\n|\r/g),o=[];let n,a=!0;for(let t=0;t<s.length;t++){let e=s[t].trim();if(0==e.length)a=!0;else{if(e.startsWith("#"))continue;for(;e.endsWith("\\")&&(t++,!(t>=s.length));)e=e.substring(0,e.length-1)+s[t].trim();if(e.startsWith("include")){const t=Ed(e.substring(8).trim(),r,i),s=await Id(t);for(let t of s)o.push(t)}const c=e.indexOf(" "),l=e.substring(0,c).trim();let h=e.substring(c+1).trim();if("type"===l){const t=h.split(/\s+/);if(h=t[0],"bigWig"===h&&3===t.length){const e=t[1],i=t[2];n&&(n.setProperty("min",e),n.setProperty("max",i))}}else if(!["shortLabel","longLabel","metadata","label"].includes(l)){const t=h.split(/\s+/);h=t[0]}(kd.has(l)||h.endsWith("URL")||h.endsWith("Url"))&&(h=Ed(h,r,i)),a&&(n=new xd(l,h),o.push(n),a=!1),n.setProperty(l,h)}}return function(t){const e=new Map;for(let i of t)e.set(i.name,i);for(let i of t)if(i.properties.has("parent")){const t=Sd(i.properties.get("parent"));i.parent=e.get(t)}return t}(o)}function Sd(t){const e=t.indexOf(" ");return e>0?t.substring(0,e):t}function Ed(t,e,i){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("gs://")||t.startsWith("s3://")?t:t.startsWith("/")?e+t:i+t}var Nd,Md,Rd,Dd,Bd,Td;const Ld=new Map([["hg38","GCF_000001405.40"],["hg38_1kg","GCF_000001405.40"],["mm39","GCF_000001635.27"],["mm10","GCF_000001635.26"],["bosTau9","GCF_002263795.1"],["canFam4","GCF_011100685.1"],["canFam6","GCF_000002285.5"],["ce11","GCF_000002985.6"],["dm6","GCF_000001215.4"],["galGal6","GCF_000002315.6"],["gorGor6","GCF_008122165.1"],["macFas5","GCA_000364345.1"],["panTro6","GCA_002880755.3"],["rn6","GCF_000001895.5"],["rn7","GCF_015227675.2"],["sacCer3","GCF_000146045.2"],["sacCer2","GCF_000146045.2"],["susScr11","GCF_000003025.6"],["taeGut1","GCF_000002275.3"],["tetNig2","GCF_000002275.3"],["xenTro10","GCF_000002035.6"],["xenTro9","GCF_000002035.6"],["tair10","GCF_000001735.4"]]);class zd{constructor(t,e,i,r,s){if(Nd.add(this),this.url=t,this.hubStanza=e,this.genomeStanzas=i,this.trackStanzas=r,this.groupStanzas=s,this.cytobandStanza=null,this.trackHubMap=new Map,r){const t=i[0].getProperty("genome");this.trackHubMap.set(t,new vd(r,s)),this.cytobandStanza=this.trackStanzas.find(t=>"cytoBandIdeo"===t.name&&t.hasProperty("bigDataUrl"))||null}}getName(){return this.hubStanza.getProperty("hub")}getShortLabel(){return this.hubStanza.getProperty("shortLabel")}getLongLabel(){return this.hubStanza.getProperty("longLabel")}getDescriptionUrl(){return this.hubStanza.getProperty("descriptionUrl")}getGenomeConfig(t){const e=t?this.genomeStanzas.find(e=>e.getProperty("genome")===t):this.genomeStanzas[0];if(!e)throw new Error(`Genome not found in hub: ${t}`);return wo(this,Nd,"m",Rd).call(this,e)}async getGroupedTrackConfigurations(t){let e=await wo(this,Nd,"m",Dd).call(this,t);return!e&&Ld.has(t)&&(e=await wo(this,Nd,"m",Dd).call(this,Ld.get(t))),e||console.log(`Warning: no trackDB found for genomeId ${t}.`),e?e.getGroupedTrackConfigurations():[]}}Md=zd,Nd=new WeakSet,Rd=function(t){const e=t.getProperty("genome"),i=this.hubStanza.getProperty("shortLabel")||t.getProperty("scientificName")||t.getProperty("organism")||t.getProperty("description"),r={id:e,name:i+(i?` (${e})`:` ${e}`),twoBitURL:t.getProperty("twoBitPath"),nameSet:"ucsc",hubs:[this.url]};if(t.hasProperty("chromSizes")?r.chromSizesURL=t.getProperty("chromSizes"):(r.wholeGenomeView=!1,r.showChromosomeWidget=!1),t.hasProperty("defaultPos")){const e=t.getProperty("defaultPos");r.locus=e}t.hasProperty("blat")&&(r.blat=t.getProperty("blat")),t.hasProperty("chromAliasBb")&&(r.chromAliasBbURL=t.getProperty("chromAliasBb")),t.hasProperty("chromAlias")&&(r.aliasURL=t.getProperty("chromAlias")),t.hasProperty("twoBitBptURL")&&(r.twoBitBptURL=t.getProperty("twoBitBptURL")),t.hasProperty("twoBitBptUrl")&&(r.twoBitBptURL=t.getProperty("twoBitBptUrl")),this.cytobandStanza&&(r.cytobandBbURL=this.cytobandStanza.getProperty("bigDataUrl")),this.hubStanza.hasProperty("longLabel")?r.description=this.hubStanza.getProperty("longLabel").replace("/","\n"):(r.description=r.id,t.hasProperty("description")&&(r.description+=`\n${t.getProperty("description")}`),t.hasProperty("organism")&&(r.description+=`\n${t.getProperty("organism")}`),t.hasProperty("scientificName")&&(r.description+=`\n${t.getProperty("scientificName")}`),t.hasProperty("htmlPath")&&(r.infoURL=t.getProperty("htmlPath")));return r.tracks=wo(this,Nd,"m",Bd).call(this,t=>!Md.filterTracks.has(t.name)&&"hide"!==t.getProperty("visibility")),r},Dd=async function(t){let e=this.trackHubMap.get(t);if(!e)for(let i of this.genomeStanzas)if(t===i.getProperty("genome")){try{const r=i.getProperty("trackDb"),s=await Id(r);e=new vd(s,this.groupStanzas),this.trackHubMap.set(t,e)}catch(t){console.error(`Error loading trackDb file: ${i.getProperty("trackDb")}`,t)}break}return e},Bd=function(t){return this.trackStanzas?this.trackStanzas.filter(e=>Md.supportedTypes.has(e.format)&&e.hasProperty("bigDataUrl")&&(!t||t(e))).map(t=>wo(this,Nd,"m",Td).call(this,t)):[]},Td=function(t){const e=t.format,i={id:t.getProperty("track"),name:t.getProperty("shortLabel"),format:e,url:t.getProperty("bigDataUrl"),displayMode:t.displayMode};if("vcfTabix"===e&&(i.indexURL=i.url+".tbi"),t.hasProperty("longLabel")&&t.hasProperty("html")?(i.description&&(i.description+="<br/>"),i.description=`<a target="_blank" href="${t.getProperty("html")}">${t.getProperty("longLabel")}</a>`):t.hasProperty("longLabel")&&(i.description=t.getProperty("longLabel")),t.hasProperty("autoScale")&&(i.autoscale="on"===t.getProperty("autoScale").toLowerCase()),t.hasProperty("maxHeightPixels")){const e=t.getProperty("maxHeightPixels").split(":");i.maxHeight=Number.parseInt(e[0]),i.height=Number.parseInt(e[1]),i.minHeight=Number.parseInt(e[2])}if(t.hasProperty("color")){const e=t.getProperty("color");i.color=e.indexOf(",")>0?`rgb(${e})`:e}if(t.hasProperty("altColor")){const e=t.getProperty("altColor");i.altColor=e.indexOf(",")>0?`rgb(${e})`:e}if(t.hasProperty("viewLimits")){const e=t.getProperty("viewLimits").split(":");let r,s;e.length>1&&(r=Number.parseInt(e[0]),s=Number.parseInt(e[1])),Number.isNaN(s)||Number.isNaN(r)?console.warn(`Unexpected viewLimits value in track line: ${t.getProperty("viewLimits")}`):(i.min=r,i.max=s)}if(t.hasProperty("itemRgb"),"hide"===t.getProperty("visibility")&&(i.visible=!1),t.hasProperty("url")&&(i.infoURL=t.getProperty("url")),t.hasProperty("searchIndex")&&(i.searchIndex=t.getProperty("searchIndex")),t.hasProperty("searchTrix")&&(i.trixURL=t.getProperty("searchTrix")),t.hasProperty("group")&&(i._group=t.getProperty("group"),this.groupPriorityMap&&this.groupPriorityMap.has(i._group))){const t=this.groupPriorityMap.get(i._group)+1;i.order=t,this.groupPriorityMap.set(i._group,t)}const r=t.hasProperty("defaultLabelFields")?t.getProperty("defaultLabelFields"):t.getProperty("labelFields");return r&&(i.labelField=r.split(",")[0]),i},zd.supportedTypes=new Set(["bigBed","bigWig","bigGenePred","vcfTabix"]),zd.filterTracks=new Set(["cytoBandIdeo","assembly","gap","gapOverlap","allGaps","cpgIslandExtUnmasked","windowMasker"]);const Pd=new Map;async function Od(t,e){if(Pd.has(t))return Pd.get(t);const i=await Id(t);if(i.length<1)throw new Error("Empty hub file");const r=i[0];if("hub"!==r.type)throw new Error("First stanza must be a hub stanza");let s,o;if("on"===r.getProperty("useOneFile")){if("genome"!==i[1].type)throw new Error("Unexpected hub file -- expected 'genome' stanza but found "+i[1].type);const t=i[1];if(s=[t],o=i.slice(2),t.hasOwnProperty("chromSizes")){const e=t.getProperty("chromSizes");try{await Er.getContentLength(e)>1e5&&t.removeProperty("chromSizes")}catch(t){console.error(`Error getting content length for chromSizes ${e}`,t)}}}else{if(!r.hasProperty("genomesFile"))throw new Error("hub.txt must specify 'genomesFile'");s=await Id(r.getProperty("genomesFile"))}const n=new Set;s.forEach(t=>{const e=t.getProperty("groups");e&&n.add(e)});const a=[],c=Array.from(n).map(async t=>await Id(t));(await Promise.all(c)).forEach(t=>a.push(...t));const l=new zd(t,r,s,o,a);return Pd.set(t,l),l}const Hd={KNOWN_GENOMES:void 0,initializeGenomes:async function(t){if(!Hd.KNOWN_GENOMES){let e={};const i=(t,e)=>(t.forEach(function(t){e[t.id]=t}),e);if(!1!==t.loadDefaultGenomes)try{i(await Er.loadJson("https://igv.org/genomes/genomes3.json",{timeout:2e3}),e)}catch(t){try{console.error("Error initializing default genomes:",t);i(await Er.loadJson("https://raw.githubusercontent.com/igvteam/igv-data/refs/heads/main/genomes/web/genomes.json",{timeout:1e4}),e)}catch(e){console.error("Error initializing backup genomes:",t)}}const r=t.genomeList||t.genomes;if(r)if("string"==typeof r){i(await Er.loadJson(r,{}),e)}else i(r,e);Hd.KNOWN_GENOMES=e}},isWholeGenomeView:function(t){return"all"===t.toLowerCase()},expandReference:async function(t,e){if(b(e)&&e.startsWith("{"))try{e=JSON.parse(e)}catch(t){}let i;if(b(e)?i=e:e.genome?i=e.genome:void 0===e.id||e.fastaURL||e.twobitURL||(i=e.id),i){const e=Hd.KNOWN_GENOMES;let r=e?e[i]:void 0;if(!r){if((i.startsWith("GCA_")||i.startsWith("GCF_"))&&i.length>=13)try{const t=ud(i);r=(await Od(t)).getGenomeConfig(i)}catch(t){console.error(t)}r||t.present(new Error(`Unknown genome id: ${i}`),void 0)}return r}return e}};let Ud,Vd,qd=0,Qd=[];class Gd extends id{constructor(t,e,i,r){super(t,e,i,r),this.loading=!1}initializationHelper(){this.spinnerElement=document.createElement("div"),this.spinnerElement.className="igv-loading-spinner-container",this.viewportElement.appendChild(this.spinnerElement),this.spinnerElement.appendChild(document.createElement("div")),this.overlayElement=document.createElement("div"),this.overlayElement.style.position="absolute",this.overlayElement.style.width="100%",this.overlayElement.style.height="100%",this.viewportElement.appendChild(this.overlayElement);const t=this.trackView.track;"sequence"!==t.type&&(this.zoomInNoticeElement=Gd.createZoomInNotice(this.viewportElement)),"sequence"!==t.id&&(this.trackLabelElement=document.createElement("div"),this.trackLabelElement.className="igv-track-label",this.viewportElement.appendChild(this.trackLabelElement),this.setTrackLabel(t.name||""),!1===this.browser.doShowTrackLabels&&(this.trackLabelElement.style.display="none"),this.trackView.track.height&&this.setHeight(this.trackView.track.height)),this.doRenderBucketLabels=new Set(["seg","mut"]).has(this.trackView.track.type||""),this.stopSpinner(),this.addMouseHandlers()}didPresentZoomInNotice(){const t=!(void 0===this.zoomInNoticeElement);return!1===t?t:"flex"===this.zoomInNoticeElement.style.display}setContentHeight(t){super.setContentHeight(t),this.featureCache&&(this.featureCache.redraw=!0)}setTrackLabel(t){this.trackLabelElement.innerHTML="",this.trackLabelElement.innerHTML=t;const e=this.trackLabelElement.textContent;this.trackLabelElement.setAttribute("title",e||"")}startSpinner(){this.spinnerElement&&(this.spinnerElement.style.display="flex")}stopSpinner(){this.spinnerElement&&(this.spinnerElement.style.display="none")}checkZoomIn(){if(this.trackView.track&&"sequence"===this.trackView.track.type&&this.referenceFrame.bpPerPixel>10)return this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas=void 0,!1;if(!this.viewIsReady())return!1;if((()=>{if("all"===this.referenceFrame.chr.toLowerCase())return!this.trackView.track.supportsWholeGenome;{const t=this.trackView.track.visibilityWindow;return void 0!==t&&t>0&&this.referenceFrame.bpPerPixel*this.viewportElement.clientWidth>t}})()){if(this.canvas&&this.canvas.parentNode&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=void 0),this.trackView.track.autoHeight){const t=this.trackView.minHeight||0;this.setContentHeight(t)}return this.zoomInNoticeElement&&(this.zoomInNoticeElement.style.display="flex"),!1}return this.zoomInNoticeElement&&(this.zoomInNoticeElement.style.display="none"),!0}shift(){const t=this.referenceFrame;this.canvas&&this.canvas._data&&this.canvas._data.referenceFrame.chr===this.referenceFrame.chr&&this.canvas._data.bpPerPixel===t.bpPerPixel&&(this.canvas._data.pixelShift=Math.round((this.canvas._data.bpStart-t.start)/t.bpPerPixel),this.canvas.style.left=this.canvas._data.pixelShift+"px")}genomicRange(){return{start:this.referenceFrame.start,end:this.referenceFrame.start+this.referenceFrame.bpPerPixel*this.viewportElement.clientWidth}}setTop(t){if(super.setTop(t),this.overlayElement.style.top=`-${t}px`,this.checkZoomIn()){if(this.canvas){const e=this.viewportElement.clientHeight,i=this.canvas._data.pixelTop-t,r=i+this.canvas._data.pixelHeight;(i>0||r<e)&&this.repaint()}else this.repaint();if(this.canvas){let e=this.canvas._data.pixelTop-t;this.canvas.style.top=`${e}px`}}}setHeight(t){super.setHeight(t);const e=this.viewportElement.querySelector(".igv-track-label");e&&(t<30?(e.style.margin="0",e.style.top="50%",e.style.transform="translateY(-50%)",e.style["-ms-transform"]="translateY(-50%)"):(e.style.removeProperty("margin"),e.style.removeProperty("top"),e.style.removeProperty("transform"),e.style.removeProperty("-ms-transform")))}async loadFeatures(){try{const t=this.referenceFrame,e=t.chr,i=await this.browser.genome.loadChromosome(e),r=i?i.bpLength:Number.MAX_SAFE_INTEGER,s=this.viewportElement.clientWidth*t.bpPerPixel,o=Math.floor(Math.max(0,t.start-s)),n=Math.ceil(Math.min(r,t.start+s+s));if(this.loading&&this.loading.start===o&&this.loading.end===n)return;this.loading={start:o,end:n},this.startSpinner();const a=this.trackView.track,c=await this.getFeatures(a,e,o,n,t.bpPerPixel);if(c){let i=[];if(a.roiSets&&a.roiSets.length>0)for(let r of a.roiSets){const s=await r.getFeatures(e,o,n,t.bpPerPixel);i.push({track:r,features:s})}const r=!(!a||!a.resolutionAware),s=this.windowFunction;return this.featureCache=new Wd(e,o,n,t.bpPerPixel,c,i,r,s),this.loading=!1,this.hideMessage(),this.stopSpinner(),this.browser.fireEvent("featuresloaded",[this]),this.featureCache}}catch(t){this.trackView&&!0!==this.trackView.disposed&&(this.showMessage("Error loading track data"),this.browser.alert.present(t),console.error(t))}finally{this.loading=!1,this.stopSpinner()}}get track(){return this.trackView.track}get windowFunction(){return this.track?this.track.windowFunction:void 0}repaintDimensions(){const t=Hd.isWholeGenomeView(this.referenceFrame.chr),e=t?this.viewportElement.clientWidth:3*this.viewportElement.clientWidth,i=this.referenceFrame.bpPerPixel;return{bpStart:this.referenceFrame.start-(t?0:this.viewportElement.clientWidth*i),bpEnd:t?Number.MAX_SAFE_INTEGER:this.referenceFrame.start+2*this.viewportElement.clientWidth*i+1,pixelWidth:e}}repaint(){if(void 0===this.featureCache)return;const{features:t,roiFeatures:e}=this.featureCache,{bpStart:i,bpEnd:r,pixelWidth:s}=this.repaintDimensions(),o=this.viewportElement.clientHeight,n=this.getContentHeight(),a=e?Math.max(n,o):n,c=Math.min(a,3*o);if(0===s||0===c)return void(this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas));const l=Math.max(0,this.contentTop-Math.floor(c/3)),h=this.referenceFrame.bpPerPixel,d=Math.round((i-this.referenceFrame.start)/h),u=l-(this.contentTop||0),f=document.createElement("canvas");f.style.position="relative",f.style.display="block",f.style.width=s+"px",f.style.height=c+"px",f.style.left=d+"px",f.style.top=u+"px";const p="FILL"===this.trackView.track.displayMode||!1!==this.trackView.track.supportHiDPI?window.devicePixelRatio:1;f.width=p*s,f.height=p*c;const g=f.getContext("2d");g.scale(p,p),g.translate(0,-l);const m={context:g,contentTop:this.contentTop,pixelXOffset:d,pixelWidth:s,pixelHeight:c,pixelTop:l,bpStart:i,bpEnd:r,bpPerPixel:h,pixelShift:d,windowFunction:this.windowFunction,referenceFrame:this.referenceFrame,selection:this.selection,viewport:this,viewportWidth:this.viewportElement.clientWidth};this.draw(m,t,e),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),f._data=m,this.canvas=f,this.viewportElement.appendChild(f)}refresh(){if(!(this.canvas&&this.canvas._data&&this.featureCache))return;const t=this.canvas._data;t.context.clearRect(0,0,this.canvas.width,this.canvas.height);const{features:e,roiFeatures:i}=this.featureCache;this.draw(t,e,i)}draw(t,e,i){if(e&&(t.features=e,this.trackView.track.draw(t)),i&&i.length>0)for(let e of i)t.features=e.features,e.track.draw(t)}containsPosition(t,e){return this.referenceFrame.chr===t&&e>=this.referenceFrame.start&&e<=this.referenceFrame.calculateEnd(this.getWidth())}isLoading(){return this.loading}savePNG(){if(!this.canvas)return;const t=this.viewportElement.clientWidth*window.devicePixelRatio,e=this.viewportElement.clientHeight*window.devicePixelRatio,i=-this.canvas.offsetLeft*window.devicePixelRatio,r=this.canvas._data,s=r?r.pixelTop:0,o=(this.contentTop-s)*window.devicePixelRatio,n=this.canvas.getContext("2d").getImageData(i,o,t,e),a=document.createElement("canvas"),c=a.getContext("2d");a.width=n.width,a.height=n.height,c.putImageData(n,0,0);k((this.trackLabelElement&&this.trackLabelElement.textContent?this.trackLabelElement.textContent:"image")+".png",a.toDataURL("image/png"))}saveSVG(){let{width:t,height:e}=this.browser.columnContainer.getBoundingClientRect();const i=new dd({width:t,height:8e3,backdropColor:"white",multiLocusGap:0,viewbox:{x:0,y:0,width:t,height:8e3}}),r={deltaX:32,deltaY:32};this.renderSVGContext(i,r,!1),i.setHeight(e);const s=(this.trackView.track.name||this.trackView.track.id||"").replace(/\W/g,""),o=this.browser.referenceFrameList.indexOf(this.referenceFrame),a=i.getSerializedSvg(!0),c=URL.createObjectURL(new Blob([a],{type:"application/octet-stream"}));k(`${`${s}_referenceFrame_${o}_guid_${n()}`}.svg`,c)}renderSVGContext(t,{deltaX:e,deltaY:i},r=!0){if(!1===this.didPresentZoomInNotice()){const{width:r,height:s}=this.viewportElement.getBoundingClientRect(),o=`${(this.trackView.track.name||this.trackView.track.id||"").replace(/\W/g,"")}_referenceFrame_${this.browser.referenceFrameList.indexOf(this.referenceFrame)}_guid_${n()}`,a=e,c=i-this.contentTop,l=this.contentTop;t.saveWithTranslationAndClipRect(o,a,c,r,s,l);const{start:h,bpPerPixel:d}=this.referenceFrame,u=Math.round((h-this.referenceFrame.start)/d),f={context:t,contentTop:this.contentTop,pixelXOffset:u,pixelWidth:r,pixelHeight:s,pixelTop:l,bpStart:h,bpEnd:h+r*d,bpPerPixel:d,pixelShift:u,referenceFrame:this.referenceFrame,selection:this.selection,viewport:this,viewportWidth:this.viewportElement.clientWidth},p=this.featureCache?this.featureCache.features:void 0,g=this.featureCache?this.featureCache.roiFeatures:void 0;this.draw(f,p,g),t.restore()}if(r&&this.trackLabelElement&&this.browser.doShowTrackLabels){const{x:r,y:s,width:o,height:n}=this.viewportElement.getBoundingClientRect(),{x:a,y:c,width:l,height:h}=this.trackLabelElement.getBoundingClientRect(),d=a-r,u=c-s,f=l,p=h;this.renderTrackLabelSVG(t,e+d,i+u,f,p)}}renderTrackLabelSVG(t,e,i,r,s){const o=`${(this.trackView.track.name||this.trackView.track.id||"").replace(/\W/g,"")}_track_label_guid_${n()}`,a=this.trackLabelElement.textContent||"",{width:c}=t.measureText(a),l=.25*(r-c),h=.7*(s-12);this.renderElementSVG(t,o,e,i,r,s,a,l,h)}renderElementSVG(t,e,i,r,s,o,n,a,c){t.saveWithTranslationAndClipRect(e,i,r,s,o,0),t.fillStyle="white",t.fillRect(0,0,s,o),t.font="12px Arial",t.fillStyle="rgb(68, 68, 68)",t.fillText(n,a,o-c),t.strokeStyle="rgb(68, 68, 68)",t.strokeRect(0,0,s,o),t.restore()}get cachedFeatures(){return this.featureCache?this.featureCache.features:[]}clearCache(){this.featureCache=void 0,this.canvas&&(this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas=void 0)}async getFeatures(t,e,i,r,s){if(this.featureCache&&this.featureCache.containsRange(e,i,r,s,this.windowFunction))return this.featureCache.features;if("function"==typeof t.getFeatures){const o=await t.getFeatures(e,i,r,s,this);return this.checkContentHeight(o),o}}needsRepaint(){if(!this.canvas)return!0;const t=this.canvas._data;return!t||this.referenceFrame.start<t.bpStart||this.referenceFrame.end>t.bpEnd||this.referenceFrame.chr!==t.referenceFrame.chr||this.referenceFrame.bpPerPixel!==t.bpPerPixel||this.windowFunction!==t.windowFunction}needsReload(){if(!this.featureCache)return!0;const{chr:t,bpPerPixel:e}=this.referenceFrame,{bpStart:i,bpEnd:r}=this.repaintDimensions();return!this.featureCache.containsRange(t,i,r,e,this.windowFunction)}static createZoomInNotice(t){const e=document.createElement("div");e.className="igv-zoom-in-notice-container",t.appendChild(e);const i=document.createElement("div");return e.appendChild(i),i.textContent="Zoom in to see features",e.style.display="none",e}viewIsReady(){return!!(this.browser&&this.browser.referenceFrameList&&this.referenceFrame)}addMouseHandlers(){var t;this.addViewportContextMenuHandler(this.viewportElement);const e=t=>{this.enableClick=!0,this.browser.mouseDownOnViewport(t,this),o(t)};this.viewportElement.addEventListener("mousedown",e),this.viewportElement.addEventListener("touchstart",e);const i=t=>{this.browser.dragObject||this.browser.isScrolling?(this.browser.cancelTrackPan(),this.enableClick=!1):(this.browser.cancelTrackPan(),this.browser.endTrackDrag())};if(this.viewportElement.addEventListener("mouseup",i),this.viewportElement.addEventListener("touchend",i),"function"==typeof this.trackView.track.hoverText){let t=0;this.viewportElement.addEventListener("mousemove",e=>{const i=Date.now();if(0===e.buttons&&i-t>100){t=i;const r=this.createClickState(e);if(r){const t=this.trackView.track.hoverText(r);t?this.viewportElement.setAttribute("title",t):this.viewportElement.removeAttribute("title")}}})}this.addViewportClickHandler(this.viewportElement),this.trackView.track.name&&"sequence"!==(null===(t=this.trackView.track.config)||void 0===t?void 0:t.type)&&this.addTrackLabelClickHandler(this.trackLabelElement)}addViewportContextMenuHandler(t){t.addEventListener("contextmenu",t=>{if(this.browser.dragObject)return!1;const e=this.createClickState(t);if(void 0===e)return!1;t.preventDefault(),t.stopPropagation();let i=[];if("function"==typeof this.trackView.track.contextMenuItemList){const t=this.trackView.track.contextMenuItemList(e);t&&(i=t)}i.length>0&&i.push({label:document.createElement("hr")}),i.push({label:"Save Image (PNG)",click:()=>this.savePNG()}),i.push({label:"Save Image (SVG)",click:()=>this.saveSVG()}),this.browser.menuPopup.presentTrackContextMenu(t,i)})}addViewportClickHandler(t){t.addEventListener("click",t=>{if(this.enableClick&&this.canvas){if(3===t.which||t.ctrlKey)return;if(this.browser.dragObject||this.browser.isScrolling)return;t.preventDefault();const e=a(t,this.viewportElement).x,i=a(t,this.canvas).x,r=this.referenceFrame;Math.floor(r.start+r.toBP(i));const s=Date.now();if(s-qd<this.browser.constants.doubleClickDelay){Ud&&(window.clearTimeout(Ud),Ud=void 0);const i=Math.round(r.start+r.toBP(e));let s;if("all"===this.referenceFrame.chr.toLowerCase()){const t=this.browser.genome.getChromosomeCoordinate(i).chr;if(1===this.browser.referenceFrameList.length)s=t;else{const e=this.browser.referenceFrameList.map(t=>t.locusSearchString||"");e[this.browser.referenceFrameList.indexOf(this.referenceFrame)]=t||"",s=e.join(" ")}this.browser.search(s)}else t.shiftKey?this.browser.zoomWithScaleFactor(2,i,this.referenceFrame):this.browser.zoomWithScaleFactor(.5,i,this.referenceFrame)}else"function"==typeof this.trackView.track.popupData&&(Ud=setTimeout(async()=>{const e=await this.handleTrackClick(t);if(e)if(!1===t.shiftKey){if(Vd&&Vd.dispose(),Qd.length>0){for(const t of Qd)t.dispose();Qd.length=0}Vd=new tn(this.viewportElement.parentElement,!0,void 0,()=>{Vd.dispose()}),Vd.presentContentWithEvent(t,e)}else{let i=new tn(this.viewportElement.parentElement,!0,void 0,()=>{const t=Qd.indexOf(i);Qd.splice(t,1),i.dispose()});Qd.push(i),i.presentContentWithEvent(t,e)}window.clearTimeout(Ud),Ud=void 0},this.browser.constants.doubleClickDelay));qd=s}})}addTrackLabelClickHandler(t){t.addEventListener("click",t=>{t.stopPropagation(),this.removeTrackLabelPopover();const{track:e}=this.trackView;let i;if("function"==typeof e.description){const t=e.description();if("string"==typeof t){const e=document.createElement("div");e.className="igv-track-label-popover__row",e.textContent=t,i=e}else i=t}else if(e.description){const t=document.createElement("div");t.className="igv-track-label-popover__row",t.textContent=e.description,i=t}i&&this.showTrackLabelPopover(t,i,e.name||"")})}showTrackLabelPopover(t,e,i){const r=document.createElement("div");r.className="igv-track-label-popover";const s=document.createElement("div");s.className="igv-track-label-popover__header";const o=document.createElement("div");o.className="igv-track-label-popover__title",o.textContent=i;const n=document.createElement("div");n.className="igv-track-label-popover__close",n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Close"),n.appendChild(l("times")),n.addEventListener("click",()=>this.removeTrackLabelPopover()),s.appendChild(o),s.appendChild(n);const a=document.createElement("div");a.className="igv-track-label-popover__body",a.appendChild(e),r.appendChild(s),r.appendChild(a);const c=this.trackLabelElement.getBoundingClientRect(),h=this.browser.columnContainer.getBoundingClientRect(),d=c.left-h.left,u=c.bottom-h.top+5;r.style.left=`${d}px`,r.style.top=`${u}px`,r.style.position="absolute",this._trackLabelPopover=r,this.browser.columnContainer.appendChild(r),p(r,s,{minX:0,minY:0})}removeTrackLabelPopover(){this._trackLabelPopover&&(this._trackLabelPopover.remove(),this._trackLabelPopover=null,this._trackLabelPopoverListener&&(document.removeEventListener("mousedown",this._trackLabelPopoverListener),this._trackLabelPopoverListener=null))}createClickState(t){if(!this.canvas)return;const e=this.referenceFrame,i=a(t,this.viewportElement),r=a(t,this.canvas),s=e.start+e.toBP(i.x);return{event:t,viewport:this,referenceFrame:e,genomicLocation:s,y:i.y+this.contentTop,canvasX:r.x,canvasY:r.y}}async handleTrackClick(t){const e=this.createClickState(t);if(void 0===e)return;let i=this.trackView.track;const r="annotation"===i.type?i.clickedFeatures(e):void 0,s=await i.popupData(e,r),o=this.browser.fireEvent("trackclick",[i,s,e.genomicLocation,r]);let n;return void 0===o||!0===o?s&&s.length>0&&(n=function(t){const e=t.map(t=>{var e,i;if("string"==typeof t)return t;if(t.name){const e=`<span>${t.name}</span>   ${t.value}`;return`<div title="${t.value}">${e}</div>`}return t.html?t.html:`<div title="${null!==(e=t.value)&&void 0!==e?e:""}">${null!==(i=t.value)&&void 0!==i?i:""}</div>`});return e.join("")}(s)):"string"==typeof o&&(n=o),n}dispose(){this.popover&&this.popover.dispose(),super.dispose()}}class Wd{constructor(t,e,i,r,s,o,n,a){this.chr=t,this.bpStart=e,this.bpEnd=i,this.bpPerPixel=r,this.features=s,this.roiFeatures=o,this.multiresolution=n,this.windowFunction=a}containsRange(t,e,i,r,s){if(s&&s!==this.windowFunction)return!1;const o=this.multiresolution?this.bpPerPixel/r:1;return e>=this.bpStart&&i<=this.bpEnd&&t===this.chr&&o>.5&&o<2}overlapsRange(t,e,i){return this.chr===t&&i>=this.bpStart&&e<=this.bpEnd}}const jd=1/16,$d=function(t,e){const{r:i,g:r,b:s}=Ur[t];return`rgba(${i},${r},${s},${e})`}("nickel",jd),Kd=$d;class Zd{constructor(t,e){if(this.url=t.url,t.name&&(this.name=t.name),this.isUserDefined=t.isUserDefined,t.featureSource)this.featureSource=t.featureSource;else if(t.features){for(let e of t.features)e.description&&!e.name&&(e.name=e.description);this.featureSource=new Xd(t.features,e)}else{if(!t.format)throw Error("ROI configuration must define either features or file format");this.featureSource=_h(t,e)}if(t.color&&!t.color.startsWith("rgba")&&(t.color=ur.addAlpha(t.color,jd)),!0===this.isUserDefined)this.color=t.color||Kd,this.headerColor="rgba(155,185,129)";else{this.color=t.color||$d,this.headerColor="rgb(190,190,190)";const[e,i,r,s]=function(t){if(t.startsWith("rgba(")){const[e,i]=t.split("("),[r]=i.split(")");return r.split(",").map((t,e)=>e<3?parseInt(t):parseFloat(t))}}(this.color);this.headerColor=`rgba(${e},${i},${r},1)`}delete t.isVisible}async getFeatures(t,e,i){return this.featureSource.getFeatures({chr:t,start:e,end:i})}async getAllFeatures(){return"function"==typeof this.featureSource.getAllFeatures?await this.featureSource.getAllFeatures():{}}addFeature(t){this.featureSource.addFeature(t)}removeFeature(t){this.featureSource.removeFeature(t)}toJSON(){if(this.url)return{name:this.name,color:this.color,url:this.url,isUserDefined:this.isUserDefined,isVisible:this.isVisible};{const t=this.featureSource.getAllFeatures(),e=[];for(let i of Object.keys(t))for(let r of t[i])e.push(r);return{name:this.name,color:this.color,features:e,isUserDefined:this.isUserDefined,isVisible:this.isVisible}}}dispose(){for(let t of Object.keys(this))this[t]=void 0}}function Yd(t,e,i,r){let s=Math.round((t-i)/r);let o=Math.round((e-i)/r)-s;return o<3&&(o=3,s-=1),{x:s,width:o}}class Xd{constructor(t,e){this.featureMap={},this.genome=e;for(let i of t){const t=e?e.getChromosomeName(i.chr):i.chr;let r=this.featureMap[t];r||(r=[],this.featureMap[t]=r),r.push(i)}for(let t of Object.keys(this.featureMap))this.featureMap[t].sort((t,e)=>t.start-e.start)}async getFeatures({chr:t,start:e,end:i}){if("all"===t.toLowerCase())return await sc(this.featureMap,this.genome,void 0);{const r=this.featureMap[t];return r?r.filter(t=>t.end>e&&t.start<i):[]}}getAllFeatures(){return this.featureMap}supportsWholeGenome(){return!0}addFeature(t){let e=this.featureMap[t.chr];e||(e=[],this.featureMap[t.chr]=e),e.push(t),e.sort((t,e)=>t.start-e.start)}removeFeature({chr:t,start:e,end:i}){if(this.featureMap[t]){const r=`${t}-${e}-${i}`;this.featureMap[t]=this.featureMap[t].filter(t=>r!==`${t.chr}-${t.start}-${t.end}`),0===this.featureMap[t].length&&delete this.featureMap[t]}}}class Jd{constructor(t,i,r,s){this.rulerViewport=t,this.rulerSweeper=e({class:"igv-ruler-sweeper"}),i.appendChild(this.rulerSweeper),this.browser=r,this.referenceFrame=s,this.isMouseHandlers=void 0,this.addBrowserObserver()}addBrowserObserver(){this.boundObserverHandler=(()=>{this.referenceFrame&&(Hd.isWholeGenomeView(this.referenceFrame.chr)?this.removeMouseHandlers():this.addMouseHandlers())}).bind(this),this.browser.on("locuschange",this.boundObserverHandler)}removeBrowserObserver(){this.browser.off("locuschange",this.boundObserverHandler)}addMouseHandlers(){if(!0===this.isMouseHandlers)return;let t,e,i,r,s,o;this.boundContentMouseDownHandler=function(o){t=!0,e=!0;const{x:n}=a(o,this.rulerViewport.contentDiv);r=i=n,s=1,this.rulerSweeper.style.display="block",this.rulerSweeper.style.backgroundColor=!0===o.shiftKey?Kd:"rgba(68, 134, 247, 0.25)",this.rulerSweeper.style.left=`${r}px`,this.rulerSweeper.style.width=`${s}px`}.bind(this),this.rulerViewport.contentDiv.addEventListener("mousedown",this.boundContentMouseDownHandler),this.boundDocumentMouseMoveHandler=function(n){let c;if(t&&e){const{x:t}=a(n,this.rulerViewport.contentDiv);c=Math.max(Math.min(t,this.rulerViewport.contentDiv.clientWidth),0),o=c-i,s=Math.abs(o),this.rulerSweeper.style.width=`${s}px`,o<0&&(r=i+o,this.rulerSweeper.style.left=`${r}px`)}}.bind(this),document.addEventListener("mousemove",this.boundDocumentMouseMoveHandler),this.boundDocumentMouseUpHandler=function(i){let o;if(!0===t&&!0===e&&(t=e=void 0,this.rulerSweeper.style.display="none",s>1)){o={start:Math.floor(this.referenceFrame.calculateEnd(r)),end:Math.floor(this.referenceFrame.calculateEnd(r+s))};!0===i.shiftKey?this.browser.roiManager.updateUserDefinedROISet(Object.assign({chr:this.referenceFrame.chr},o)):(Wo(this.browser.genome.getChromosome(this.referenceFrame.chr).bpLength,o,this.browser.minimumBases()),function(t,e,i){t.start=Math.round(e.start),t.end=Math.round(e.end),t.bpPerPixel=(t.end-t.start)/i}(this.referenceFrame,o,this.rulerViewport.contentDiv.clientWidth),this.browser.updateViews())}}.bind(this),document.addEventListener("mouseup",this.boundDocumentMouseUpHandler),this.isMouseHandlers=!0}removeMouseHandlers(){this.rulerViewport.contentDiv.removeEventListener("mousedown",this.boundContentMouseDownHandler),document.removeEventListener("mousemove",this.boundDocumentMouseMoveHandler),document.removeEventListener("mouseup",this.boundDocumentMouseUpHandler),this.isMouseHandlers=!1}dispose(){this.removeBrowserObserver(),this.removeMouseHandlers(),this.rulerSweeper.remove()}}function tu(t){if(eu[t])return eu[t];if(eu["chr"+t]){const e=eu["chr"+t];return eu[t]=e,e}{const e=ur.randomRGB(0,255);return eu[t]=e,e}}const eu={chrX:"rgb(204, 153, 0)",chrY:"rgb(153, 204, 0)",chrUn:"rgb(50, 50, 50)",chr1:"rgb(80, 80, 255)",chrI:"rgb(139, 155, 187)",chr2:"rgb(206, 61, 50)",chrII:"rgb(206, 61, 50)",chr2a:"rgb(216, 71, 60)",chr2b:"rgb(226, 81, 70)",chr3:"rgb(116, 155, 88)",chrIII:"rgb(116, 155, 88)",chr4:"rgb(240, 230, 133)",chrIV:"rgb(240, 230, 133)",chr5:"rgb(70, 105, 131)",chr6:"rgb(186, 99, 56)",chr7:"rgb(93, 177, 221)",chr8:"rgb(128, 34, 104)",chr9:"rgb(107, 215, 107)",chr10:"rgb(213, 149, 167)",chr11:"rgb(146, 72, 34)",chr12:"rgb(131, 123, 141)",chr13:"rgb(199, 81, 39)",chr14:"rgb(213, 143, 92)",chr15:"rgb(122, 101, 165)",chr16:"rgb(228, 175, 105)",chr17:"rgb(59, 27, 83)",chr18:"rgb(205, 222, 183)",chr19:"rgb(97, 42, 121)",chr20:"rgb(174, 31, 99)",chr21:"rgb(231, 199, 111)",chr22:"rgb(90, 101, 94)",chr23:"rgb(204, 153, 0)",chr24:"rgb(153, 204, 0)",chr25:"rgb(51, 204, 0)",chr26:"rgb(0, 204, 51)",chr27:"rgb(0, 204, 153)",chr28:"rgb(0, 153, 204)",chr29:"rgb(10, 71, 255)",chr30:"rgb(71, 117, 255)",chr31:"rgb(255, 194, 10)",chr32:"rgb(255, 209, 71)",chr33:"rgb(153, 0, 51)",chr34:"rgb(153, 26, 0)",chr35:"rgb(153, 102, 0)",chr36:"rgb(128, 153, 0)",chr37:"rgb(51, 153, 0)",chr38:"rgb(0, 153, 26)",chr39:"rgb(0, 153, 102)",chr40:"rgb(0, 128, 153)",chr41:"rgb(0, 51, 153)",chr42:"rgb(26, 0, 153)",chr43:"rgb(102, 0, 153)",chr44:"rgb(153, 0, 128)",chr45:"rgb(214, 0, 71)",chr46:"rgb(255, 20, 99)",chr47:"rgb(0, 214, 143)",chr48:"rgb(20, 255, 177)"};let iu,ru;class su extends Gd{constructor(t,e,i,r){super(t,e,i,r)}get contentDiv(){return this.viewportElement}initializationHelper(){this.multiLocusCloseButton=document.createElement("div"),this.multiLocusCloseButton.className="igv-multi-locus-close-button",this.viewportElement.appendChild(this.multiLocusCloseButton);const t=l("times-circle");this.multiLocusCloseButton.appendChild(t),this.multiLocusCloseButton.addEventListener("click",()=>{this.browser.removeMultiLocusPanel(this.referenceFrame)}),this.rulerLabel=document.createElement("div"),this.rulerLabel.className="igv-multi-locus-ruler-label",this.viewportElement.appendChild(this.rulerLabel);const e=document.createElement("div");this.rulerLabel.appendChild(e),this.rulerLabel.addEventListener("click",async t=>{t.stopPropagation(),await this.browser.gotoMultilocusPanel(this.referenceFrame)}),this.tooltip=document.createElement("div"),this.tooltip.className="igv-ruler-tooltip",this.tooltip.style.height=`${this.viewportElement.clientHeight}px`,this.viewportElement.appendChild(this.tooltip),this.tooltipContent=document.createElement("div"),this.tooltip.appendChild(this.tooltipContent),this.rulerSweeper=new Jd(this,this.viewportElement.parentElement,this.browser,this.referenceFrame),this.attachMouseHandlers(Hd.isWholeGenomeView(this.referenceFrame.chr)),this.tooltip.style.display="none",this.dismissLocusLabel()}presentLocusLabel(t){this.multiLocusCloseButton.style.display="block",this.rulerLabel.style.display="block",this.rulerLabel.style.backgroundColor=tu(this.referenceFrame.chr);const e=this.rulerLabel.querySelector("div"),{width:i}=this.rulerLabel.getBoundingClientRect();e.innerHTML=`${this.referenceFrame.getMultiLocusLabel(t)}`;const{width:r}=e.getBoundingClientRect();r/i>.5&&(e.innerHTML=`${this.referenceFrame.getMultiLocusLabelBPLengthOnly(t)}`)}dismissLocusLabel(){this.rulerLabel.style.display="none",this.multiLocusCloseButton.style.display="none"}attachMouseHandlers(t){!0===t?(this.viewportElement.addEventListener("click",t=>{const{x:e}=a(t,this.viewportElement),i=Math.round(this.referenceFrame.start+this.referenceFrame.toBP(e));let r;const{chr:s}=this.browser.genome.getChromosomeCoordinate(i);if(1===this.browser.referenceFrameList.length)r=s;else{const t=this.browser.referenceFrameList.indexOf(this.referenceFrame),e=this.browser.referenceFrameList.map(t=>t.locusSearchString);e[t]=s,r=e.join(" ")}this.browser.search(r)}),this.viewportElement.style.cursor="pointer"):this.viewportElement.style.cursor="default"}mouseMove(t){if(this.browser.doShowCursorGuide){void 0===ru?(ru=this,this.tooltip.style.display="block"):ru.guid!==this.guid?(ru.tooltip&&(ru.tooltip.style.display="none"),this.tooltip.style.display="block",ru=this):this.tooltip.style.display="block";if(this.browser.isMultiLocusWholeGenomeView()||Hd.isWholeGenomeView(this.referenceFrame.chr))return void(this.tooltip.style.display="none");const{x:e}=a(t,this.viewportElement),{start:i,end:r,bpPerPixel:s}=this.referenceFrame,o=Math.round(.5+i+Math.max(0,e)*s);this.tooltipContent.textContent=F(o);const n=this.tooltipContent.getBoundingClientRect(),c=this.viewportElement.getBoundingClientRect(),l=cr(e,0,c.width-n.width);return this.tooltip.style.left=`${l}px`,clearTimeout(iu),iu=setTimeout(()=>{this.tooltip&&(this.tooltip.style.display="none")},1e4),{start:i,bp:o,end:r}}}startSpinner(){}stopSpinner(){}dispose(){this.rulerSweeper.dispose(),super.dispose()}}let ou;class nu extends Gd{constructor(t,e,i,r){super(t,e,i,r),this.featureCache=new au}initializationHelper(){var t;this.canvas=document.createElement("canvas"),this.canvas.className="igv-ideogram-canvas",this.viewportElement.appendChild(this.canvas),this.ideogram_ctx=null!==(t=this.canvas.getContext("2d"))&&void 0!==t?t:void 0,this.tooltip=document.createElement("div"),this.tooltip.className="igv-cytoband-tooltip",this.tooltip.style.height=`${this.viewportElement.clientHeight}px`,this.viewportElement.appendChild(this.tooltip),this.tooltipContent=document.createElement("div"),this.tooltip.appendChild(this.tooltipContent),this.tooltip.style.display="none",this.addMouseHandlers()}async getFeatures(t,e,i,r){return this.featureCache.containsRange(t)?this.featureCache.get(t):this.loadFeatures()}async loadFeatures(){const t=this.referenceFrame.chr,e=await this.referenceFrame.genome.getCytobands(t);return this.featureCache.set(t,e),e}repaint(){if(void 0===this.featureCache)return;const{width:t,height:e}=this.viewportElement.getBoundingClientRect();go.configureHighDPICanvas(this.ideogram_ctx,t,e);const i=this.referenceFrame.chr,r=this.featureCache.get(i),s={context:this.ideogram_ctx,pixelWidth:t,pixelHeight:e,referenceFrame:this.referenceFrame,features:r};this.trackView.track.draw(s)}addMouseHandlers(){this.addViewportClickHandler(this.viewportElement),this.trackView.track.showCytobandNames&&(this.viewportElement.addEventListener("mousemove",this.mouseMove.bind(this)),this.viewportElement.addEventListener("mouseleave",this.mouseLeave.bind(this)))}mouseMove(t){const{x:e}=a(t,this.viewportElement),i=this.featureCache.get(this.referenceFrame.chr);if(i){const{width:t}=this.viewportElement.getBoundingClientRect(),r=t/i[i.length-1].end;let s=!1;for(let o=0;o<i.length;o++){const n=i[o],a=n.start*r,c=n.end*r;if(e>=a&&e<=c){this.tooltipContent.textContent=n.name;const{width:e}=this.tooltipContent.getBoundingClientRect();const i=cr((a+c)/2-e/2,0,t-e);this.tooltip.style.left=`${i}px`,clearTimeout(ou),ou=setTimeout(()=>{this.tooltip&&(this.tooltip.style.display="none")},1e4),this.tooltip.style.display="block",s=!0;break}}if(s)return}this.tooltip.style.display="none"}mouseLeave(t){this.tooltip.style.display="none"}addViewportClickHandler(t){this.boundClickHandler=function(t){const{xNormalized:e,width:i}=a(t,this.ideogram_ctx.canvas),{bpLength:r}=this.browser.genome.getChromosome(this.referenceFrame.chr),s=this.referenceFrame.bpPerPixel*i/r;let o=e;o-s/2<0&&(o=s/2);o+s/2>1&&(o=1-s/2);const n=Math.round((o-s/2)*r),c=Math.round((o+s/2)*r);this.referenceFrame.start=n,this.referenceFrame.end=c,this.referenceFrame.bpPerPixel=(c-n)/i,this.browser.updateViews(!0)}.bind(this),t.addEventListener("click",this.boundClickHandler)}setWidth(t){this.viewportElement.style.width=t+"px"}renderSVGContext(t,{deltaX:e,deltaY:i},r=!0){const{width:s,height:o}=this.viewportElement.getBoundingClientRect(),a=`ideogram_referenceFrame_${this.browser.referenceFrameList.indexOf(this.referenceFrame)}_guid_${n()}`,c=e,l=this.contentTop+i,h=-this.contentTop;t.saveWithTranslationAndClipRect(a,c,l,s,o,h),this.trackView.track.draw({context:t,pixelWidth:s,pixelHeight:o,referenceFrame:this.referenceFrame,features:this.featureCache.get(this.referenceFrame.chr)}),t.restore()}startSpinner(){}stopSpinner(){}}class au{constructor(){this.features=new Map}containsRange(t){return this.features.has(t)}set(t,e){this.features.set(t,e)}get(t){return this.features.get(t)}}function cu(t,e,i,r){if("ruler"===t.track.type)return new su(t,e,i,r);if("ideogram"===t.track.id)return new nu(t,e,i,r);{const s=new Gd(t,e,i,r);return i.viewport=s,s}}const lu=["rgb(255, 0, 0)","rgb(0, 255, 0)","rgb(0, 0, 255)","rgb(255, 0, 255)","rgb(0, 255, 255)","rgb(128, 0, 128)","rgb(255, 165, 0)","rgb(255, 105, 180)","rgb(255, 127, 80)","rgb(220, 20, 60)","rgb(255, 99, 71)","rgb(173, 216, 230)","rgb(144, 238, 144)","rgb(224, 255, 255)","rgb(250, 250, 210)","rgb(152, 251, 152)","rgb(70, 130, 180)","rgb(102, 205, 170)"].map(t=>{const[e,i,r]=t.split(","),[s,o]=e.split("("),[n,a]=r.split(")");return[o,i,n]});var hu,du,uu,fu,pu,gu;class mu{constructor(t){var e;hu.add(this);t.tracks.some(t=>"function"==typeof t.getSamples)&&(null===(e=t.sampleInfoControl)||void 0===e||e.setButtonVisibility(!0)),this.initialize()}initialize(){this.sampleInfoFiles=[],this.attributeNames=[],this.sampleDictionary={},this.sampleMappingDictionary={},this.colorDictionary={},this.attributeRangeLUT={},this.initialized=!1}get attributeCount(){return this.attributeNames?this.attributeNames.length:0}isInitialized(){return this.initialized}hasAttributes(){return this.attributeCount>0}getAttributes(t){const e=this.sampleMappingDictionary[t]||t;return this.sampleDictionary[e]}getAttributeValue(t,e){const i=this.getAttributes(t);return i?i[e]:void 0}async loadSampleInfo(t){if(t.url)await this.loadSampleInfoFile(t.url);else{const e={};for(const[i,r]of Object.entries(t))"url"!==i&&"object"==typeof r&&null!==r&&(e[i]=du.toNumericalRepresentation(r));const[i]=Object.values(e),r=Object.keys(i);this.loadSampleInfoHelper(r,e)}this.initialized=!0}loadSampleInfoHelper(t,e){const i=function(t,e){const i={};for(const r of Object.values(e))for(const e of t){let t=r[e];void 0===i[e]&&(i[e]=[]),i[e].push(t)}const r=t=>"number"==typeof t,s=t=>"string"==typeof t;for(const t of Object.keys(i)){const e=i[t],o=new Set(e),n=Array.from(o);if(!0===n.some(s)&&!0===n.some(r)?i[t]=n.filter(t=>!s(t)):i[t]=n,!i[t].some(s)){const e=i[t];i[t]=[Math.min(...e),Math.max(...e)]}}return i}(t,e);wu(this.attributeRangeLUT,i);const r=new Set(this.attributeNames);for(const e of t)r.has(e)||this.attributeNames.push(e);wu(this.sampleDictionary,e)}async loadSampleInfoFile(t){const e=await Er.loadString(t);wo(this,hu,"m",uu).call(this,e),this.sampleInfoFiles.push(t)}discard(){this.initialize()}getAttributeColor(t,e){let i;if("-"===e)i=Vr("snow");else if("string"==typeof e&&this.colorDictionary[e])i=this.colorDictionary[e]();else if(this.colorDictionary[t])i=this.colorDictionary[t](e);else if("string"==typeof e)i="NA"===e?du.colorForNA:du.stringToRGBString(e);else{const[r,s]=this.attributeRangeLUT[t],o=.2,n=Math.max((e-r)/(s-r),o),[a,c,l]=lu[Object.keys(this.attributeRangeLUT).indexOf(t)];i=`rgba(${a},${c},${l},${n})`}return i}sortSampleKeysByAttribute(t,e,i){const r=t.filter(t=>{const i=this.getAttributes(t);if(void 0===i)return!1;return"number"==typeof i[e]}),s=t.filter(t=>{const i=this.getAttributes(t);if(void 0===i)return!1;return"string"==typeof i[e]}),o=(t,r)=>{const s=this.getAttributes(t)[e],o=this.getAttributes(r)[e];return"string"==typeof s&&"string"==typeof o?i*s.localeCompare(o):"number"==typeof s&&"number"==typeof o?i*(s-o):0};return r.sort(o),s.sort(o),-1===i?[...r,...s]:[...s,...r]}static toNumericalRepresentation(t){const e=Object.assign({},t);for(const[t,i]of Object.entries(e))"string"!=typeof i||isNaN(Number(i))||(e[t]=Number(i));return e}static stringToRGBString(t){let e=0;for(let i=0;i<t.length;i++)e=t.charCodeAt(i)+((e<<5)-e);let i=[];for(let t=0;t<3;t++){const r=e>>8*t&255;i.push(r)}return`rgb(${i.join(", ")})`}export(){const t={},e=Object.fromEntries(Object.entries(this.sampleMappingDictionary).map(([t,e])=>[e,t]));for(const i of Object.keys(this.sampleDictionary)){const r=e[i]||i,s=this.getAttributes(i);s&&(t[r]=s)}console.log(JSON.stringify(t,null,2))}}function wu(t,e){for(const[i,r]of Object.entries(e))i in t&&t[i]===r||(t[i]=r)}du=mu,hu=new WeakSet,uu=function(t){const e=function(t){const e={},i=t.split(/\r?\n|\r/).map(t=>t.trim()).filter(t=>""!==t);let r;mu.sampleInfoFileHeaders.includes(i[0])||(r="#sampleTable",e[r]=[]);for(const t of i)mu.sampleInfoFileHeaders.includes(t)?(r=t,e[r]=[]):r&&!1===t.startsWith("#")&&e[r].push(t);return e}(t);for(const[t,i]of Object.entries(e))switch(t){case"#sampleTable":wo(this,hu,"m",fu).call(this,i);break;case"#sampleMapping":wo(this,hu,"m",pu).call(this,i);break;case"#colors":wo(this,hu,"m",gu).call(this,i)}},fu=function(t){const e=t.shift().split("\t").filter(t=>t.length>0);e.shift();const i=e.map(t=>t.split(" ").join(du.emptySpaceReplacement)),r=t.filter(t=>t.length>0);let s;for(const t of r){const e=t.split("\t"),r=e.shift();void 0===s&&(s={}),s[r]={};for(let t=0;t<e.length;t++){const o={};""===e[t]?o[i[t]]="-":o[i[t]]=e[t],Object.assign(s[r],o)}}for(const[t,e]of Object.entries(s))s[t]=du.toNumericalRepresentation(e);this.loadSampleInfoHelper(i,s)},pu=function(t){for(const e of t){const[t,i]=e.split("\t");this.sampleMappingDictionary[t]=i}},gu=function(t){const e=(t,e,i)=>{let r;switch(e){case 0:r=t.split(" ").join(du.emptySpaceReplacement);break;case 1:r=t.includes(":")?t.split(":").map(t=>parseFloat(t)):t;break;case 2:case 3:r=`rgb(${t})`;break;default:r=t}return r},i=t.map(t=>t.split("\t").map(e)),r=i.filter(t=>3===t.length&&!t.includes("*")).filter(([t,e,i])=>!Array.isArray(e)),s={};for(const t of r){const e=t[0],i=t[1],r=t[2];void 0===s[e]&&(s[e]={}),s[e][i.toUpperCase()]=r}for(const[t,e]of Object.entries(s)){const i=Object.assign({},e);this.colorDictionary[t]=t=>{const e=String(t).toUpperCase();return i[e]||Vr("snow")}}const o=i.filter(t=>Array.isArray(t[1]));for(const t of o){const[e,i]=t[1],r=t[0];if(3===t.length){const[s,o,n]=Kr(t[2]);this.colorDictionary[r]=t=>{const r=cr(t,e,i);return jr(s,o,n,(r-e)/(i-e))}}else if(4===t.length){const[e,i]=t[1],r=t[0],s=t[2],o=t[3];this.colorDictionary[r]=t=>{const r=cr(t,e,i);return Zr(s,o,(r-e)/(i-e))}}}const n=i.filter(t=>3===t.length&&t.includes("*"));for(const t of n)if("*"===t[1]){const e=t[0],i=t[2];this.colorDictionary[e]=t=>{if("NA"===t)return du.colorForNA;{const[r,s]=this.attributeRangeLUT[e],o=(t-r)/(s-r),[n,a,c]=Kr(i);return jr(n,a,c,o)}}}else if("*"===t[0]){const e=t[1],i=t[2];this.colorDictionary[e]=()=>i}},mu.emptySpaceReplacement="|",mu.colorForNA=Vr("magnesium"),mu.sampleInfoFileHeaders=["#sampleTable","#sampleMapping","#colors"];const bu=16,Fu=F;class vu{constructor(t){this.browser=t,this.height=40,this.name="",this.disableButtons=!0,this.ignoreTrackMenu=!0,this.order=.01*Number.MIN_SAFE_INTEGER,this.removable=!1,this.type="ruler",this.id="ruler"}async getFeatures(t,e,i){return[]}computePixelHeight(t){return this.height}draw({context:t,referenceFrame:e,pixelWidth:i,pixelHeight:r,bpPerPixel:s,bpStart:o}){Hd.isWholeGenomeView(e.chr)?this.drawWholeGenome({context:t,pixelWidth:i,pixelHeight:r,bpPerPixel:s}):this.doDraw({context:t,referenceFrame:e,pixelWidth:i,pixelHeight:r,bpStart:o})}drawWholeGenome({context:t,pixelWidth:e,pixelHeight:i,bpPerPixel:r}){t.save(),go.fillRect(t,0,0,e,i,{fillStyle:"white"});for(let e of this.browser.genome.wgChromosomeNames){let s=this.browser.genome.getCumulativeOffset(e),o=this.browser.genome.getChromosome(e).bpLength,n=Math.round(s/r),a=Math.round(o/r);this.renderChromosomeRect(t,n,0,a,i,e)}t.restore()}doDraw({context:t,referenceFrame:e,pixelWidth:i,pixelHeight:r,bpStart:s}){t.clearRect(0,0,i,r);const o=function(t,e){if(t<10)return new yu(1,"bp",1);const i=Math.floor(Math.log10(t));let r="bp",s=1;i>9?(r="gb",s=1e9):i>6?(r="mb",s=1e6):i>3&&(r="kb",s=1e3);const o=Math.pow(10,i-1),n=t/o,a=75,c=Math.pow(10,i-1),l=Math.pow(10,i)/2;return new yu(n<a&&!0!==e?c:l,r,s)}(Math.floor(e.toBP(i)),!!t.isSVG);let n=Math.floor(s/o.majorTick)-1;const{tickDelta:a,labelLength:c}=function(t,e,i,r,s){const o=l(e,c(1+r,s),i)-l(e,c(r,s),i),n=`${F(Math.floor(c(r,s)/s.unitMultiplier))} ${s.majorUnit}`,a=Math.floor(t.measureText(n).width);return{tickDelta:o,labelLength:a};function c(t,e){return Math.floor(t*e.majorTick)}function l(t,e,i){return Math.round(t.toPixels(e-1-i+.5))}}(t,e,s,n,o);let l,h;this.browser.referenceFrameList.indexOf(e);let d=a;const u=.25*c;do{h=Math.floor(n*o.majorTick);const i=`${F(Math.floor(h/o.unitMultiplier))} ${o.majorUnit}`;l=Math.round(e.toPixels(h-1-s+.5));const r=Math.round(l-t.measureText(i).width/2);r>0&&u+c<=d&&(go.fillText(t,i,r,this.height-8),d=0),l>0&&go.strokeLine(t,l,this.height-6,l,this.height-2),h=Math.floor((1+n)*o.majorTick);let f=l+(Math.round(e.toPixels(h-1-s+.5))-l)/2;f>0&&go.strokeLine(t,f,this.height-6,f,this.height-2),++n,d+=a}while(l<i);go.strokeLine(t,0,this.height-2,i,this.height-2)}renderChromosomeRect(t,e,i,r,s,o){t.textAlign="center",t.textBaseline="middle",t.font="12px sans-serif",go.strokeLine(t,e+r,i,e+r,i+s,{strokeStyle:ur.greyScale(191)});const n=(o=this.browser.genome.getChromosomeDisplayName(o)).startsWith("chr")?o.substring(3):o;r>t.measureText(n).width&&go.fillText(t,n,e+r/2,i+s/2,{fillStyle:ur.greyScale(68)})}get supportsWholeGenome(){return!0}dispose(){}}class yu{constructor(t,e,i){this.majorTick=t,this.minorTick=t/10,this.majorUnit=e,this.unitMultiplier=i}description(t){console.log((t||"")+" tick "+Fu(this.majorTick)+" label width "+Fu(this.labelWidthBP)+" multiplier "+this.unitMultiplier)}}const Au=16;function Cu(t,e){const i=new Set(t.attributeNames),r=e[0];if(void 0===t.getAttributes(r))return!1;{const e=Object.keys(t.getAttributes(r));for(const t of e)if(!1===i.has(t))return!1}return!0}function _u(t,e,i,r,s,o,n){if(!n||0===n.size)return;const a=e+r;t.save(),t.fillStyle="black";let c=s+8;c>e&&go.dashedLine(t,0,c,i,c);for(const r of n.values()){if(c+=r.count*o+Au,c>a)break;c>e&&go.dashedLine(t,0,c,i,c)}t.restore()}class xu{constructor(t,i,r){this.guid=n(),this.trackView=t,this.isIdeogram="ideogram"===t.track.type,this.browser=t.browser,this.viewport=e({class:"igv-viewport"}),i.appendChild(this.viewport),this.viewport.style.height=`${t.track.height}px`,this.isIdeogram&&(this.viewport.style.zIndex="16",this.viewport.style.overflow="visible"),this.canvas=document.createElement("canvas"),this.viewport.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d"),this.ctx.font="10px verdana",this.contentTop=0,this.hitList=void 0,this.setWidth(r),this.addMouseHandlers()}resizeCanvas(){var t,e;const i=window.devicePixelRatio,r=this.browser.getSampleInfoViewportWidth();let s;if(this.browser.trackViews.length>1&&this.isIdeogram){const[i,r]=[this.browser.ideogramTrackView.track,this.browser.rulerTrackView.track];s=(null!==(t=i.height)&&void 0!==t?t:0)+(null!==(e=r.height)&&void 0!==e?e:0)}else s=this.viewport.clientHeight;if(this.canvas.width!==r*i||this.canvas.height!==s*i){const t=this.canvas;t.width=r*i,t.height=s*i,t.style.width=`${r}px`,t.style.height=`${s}px`,this.ctx=this.canvas.getContext("2d"),this.ctx.scale(i,i),this.isIdeogram&&go.fillRect(this.ctx,0,0,this.ctx.canvas.width,this.ctx.canvas.height,{fillStyle:Vr("snow")})}}setTop(t){"function"==typeof this.trackView.track.getSamples&&(this.contentTop=t,this.repaint())}setWidth(t){this.viewport.innerWidth=t,this.resizeCanvas()}setHeight(t){const e=this.browser.getSampleInfoViewportWidth();this.viewport.style.width=`${e}px`,this.viewport.style.height=`${t}px`;const i=window.devicePixelRatio;this.canvas.width=e*i,this.canvas.height=t*i,this.canvas.style.width=`${e}px`,this.canvas.style.height=`${t}px`,this.ctx=this.canvas.getContext("2d"),this.ctx.scale(i,i),this.isIdeogram&&go.fillRect(this.ctx,0,0,this.ctx.canvas.width,this.ctx.canvas.height,{fillStyle:Vr("snow")})}repaint(){if(this.resizeCanvas(),this.isIdeogram&&(this.browser.rulerTrackView&&this.browser.rulerTrackView.setTrackHeight(!0===this.browser.sampleInfoControl.showSampleInfo?this.calculateSampleInfoColumnHeight():40,!0),this.renderSampleInfoColumns(this.ctx)),"function"==typeof this.trackView.track.getSamples){const t=this.trackView.track.getSamples();t.names&&t.names.length>0&&this.draw({context:this.ctx,samples:t})}}calculateSampleInfoColumnHeight(){const t=this.browser.sampleInfo.attributeNames.map(t=>this.ctx.measureText(t).width);return 4+Math.min(Math.max(...t),128)}draw({context:t,samples:e}){t.clearRect(0,0,t.canvas.width,t.canvas.height),t.fillStyle=Vr("snow"),t.fillRect(0,0,t.canvas.width,t.canvas.height);const i=this.viewport.getBoundingClientRect().height,r=this.viewport.getBoundingClientRect().width;if(e&&e.names.length>0){const s=this.browser.sampleInfo.attributeNames;let o=1;const n=e.height;o=n-2*o<=1?0:1;let a=e.yOffset-this.contentTop,c=0;this.hitList={};for(const r of e.names){const l=this.browser.sampleInfo.getAttributes(r);if(l){let r=a+o;if(e.groupIndeces&&e.groups&&e.groups.size>0&&(r+=(e.groupIndeces[c]+1)*Au),r>i)break;if(r+n>0){const e=n-2*o,i=Object.entries(l);for(const o of i){const[i,n]=o,a=8+s.indexOf(i)*bu;t.fillStyle=this.browser.sampleInfo.getAttributeColor(i,n),t.fillRect(a,r,15,e);const c=`${Math.floor(a)}#${Math.floor(r)}#16#${Math.ceil(e)}`;this.hitList[c]=`${i}#${n}`}}}a+=n,c++}_u(t,0,r,i,e.yOffset-this.contentTop,e.height,e.groups)}}renderSampleInfoColumns(t){const e=(t,e,i,r,s,o)=>{t.save(),t.font="10px verdana",t.translate(i+s/2,r+o),t.rotate(-Math.PI/2),t.textAlign="left",t.fillStyle=Vr("lead"),t.fillText(e,2,2),t.restore()},i=this.browser.sampleInfo.attributeNames;this.hitList={};for(let r=0;r<i.length;r++){const s=8+r*bu,o=15,n=Math.round(t.canvas.height/window.devicePixelRatio);go.fillRect(t,s,0,o,n,{fillStyle:Vr("snow")}),e(t,i[r],s,0,o,n);const a=`${Math.floor(s)}#0#${o}#${Math.ceil(n)}`;this.hitList[a]=`${i[r]}`}}renderSVGContext(t,{deltaX:e,deltaY:i}){if("function"==typeof this.trackView.track.getSamples){const r=this.trackView.track.getSamples(),s=0,{width:o,height:a}=this.viewport.getBoundingClientRect(),c=`${(this.trackView.track.name||this.trackView.track.id||"").replace(/\W/g,"")}_sample_names_guid_${n()}`;t.saveWithTranslationAndClipRect(c,e,i+s,o,a,-s),this.draw({context:t,samples:r}),t.restore()}}addMouseHandlers(){this.addMouseMoveHandler(),this.addMouseClickHandler()}addMouseMoveHandler(){this.boundMouseMoveHandler=function(t){if(this.hitList){const e=Object.entries(this.hitList);if(this.isIdeogram){const i=(e,i)=>{const{marginTop:r}=window.getComputedStyle(i),{x:s,y:o}=a(t,this.browser.columnContainer.querySelector(".igv-sample-info-column"));return{x:Math.floor(s),y:Math.floor(o-parseInt(r,10))}},r=this.browser.columnContainer.querySelector(".igv-sample-info-column"),{x:s,y:o}=i(r,this.viewport);r.setAttribute("title","");for(const[t,i]of e){const[e,n,a,c]=t.split("#").map(t=>parseInt(t,10));if(!(s<e||s>e+a||o<n||o>n+c)){r.setAttribute("title",`${i}`);break}}}else{const{x:i,y:r}=a(t,this.viewport);this.viewport.setAttribute("title","");for(const[t,s]of e){const[e,o,n,a]=t.split("#").map(t=>parseInt(t,10));if(!(i<e||i>e+n||r<o||r>o+a)){const[t,e]=s.split("#");this.viewport.setAttribute("title",`${t.split(mu.emptySpaceReplacement).join(" ")}: ${"-"===e?"":e}`);break}}}}}.bind(this),this.viewport.addEventListener("mousemove",this.boundMouseMoveHandler)}addMouseClickHandler(){this.boundMouseClickHandler=function(t){if(this.hitList){const e=Object.entries(this.hitList);if(this.isIdeogram){const i=(e,i)=>{const{marginTop:r}=window.getComputedStyle(i),{x:s,y:o}=a(t,this.browser.columnContainer.querySelector(".igv-sample-info-column"));return{x:Math.floor(s),y:Math.floor(o-parseInt(r,10))}},r=this.browser.columnContainer.querySelector(".igv-sample-info-column"),{x:s,y:o}=i(r,this.viewport);for(const[t,i]of e){const[e,r,n,a]=t.split("#").map(t=>parseInt(t,10));if(!(s<e||s>e+n||o<r||o>r+a)){const t=this.browser.findTracks(t=>"function"==typeof t.sortByAttribute);for(const e of t)e.sortByAttribute(i);break}}}else{const{x:i,y:r}=a(t,this.viewport);for(const[t,s]of e){const[e,o,n,a]=t.split("#").map(t=>parseInt(t,10));if(!(i<e||i>e+n||r<o||r>o+a)){s.split("#");break}}}}}.bind(this),this.viewport.addEventListener("click",this.boundMouseClickHandler)}removeMouseHandlers(){this.viewport.removeEventListener("mousemove",this.boundMouseMoveHandler),this.viewport.removeEventListener("click",this.boundMouseClickHandler)}dispose(){this.removeMouseHandlers(),this.viewport.remove()}show(){this.viewport.style.display="block"}hide(){this.viewport.style.display="none"}}class ku{constructor(t,i,r,s){this.guid=n(),this.trackView=t,this.browser=t.browser,this.viewport=e({class:"igv-viewport"}),i.appendChild(this.viewport),t.track.height&&(this.viewport.style.height=`${t.track.height}px`),this.canvas=document.createElement("canvas"),this.viewport.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d"),this.contentTop=0,this.hitList=void 0,this.setWidth(s),this.addMouseHandlers()}checkCanvas(){let t=0;!0===this.browser.showSampleNames&&(t=void 0===this.browser.sampleNameViewportWidth?0:this.browser.sampleNameViewportWidth),this.ctx.canvas.width=t*window.devicePixelRatio,this.ctx.canvas.style.width=`${t}px`,this.ctx.canvas.height=this.viewport.clientHeight*window.devicePixelRatio,this.ctx.canvas.style.height=`${this.viewport.clientHeight}px`,this.ctx.scale(window.devicePixelRatio,window.devicePixelRatio)}setTop(t){if("function"==typeof this.trackView.track.getSamples){this.contentTop=t;const e=this.trackView.track.getSamples();this.repaint(e)}}setWidth(t){this.viewport.innerWidth=t,this.checkCanvas()}async repaint(t){if(t.names.length>0&&!0===this.browser.showSampleNames&&(this.checkCanvas(),this.draw({context:this.ctx,samples:t}),void 0===this.browser.sampleNameViewportWidth)){const e=t.names.map(t=>this.ctx.measureText(t).width);this.browser.sampleNameViewportWidth=Math.min(200,4+Math.ceil(Math.max(...e))),this.browser.layoutChange()}}draw({context:t,samples:e}){if(go.fillRect(t,0,0,t.canvas.width,e.height,{fillStyle:Vr("snow")}),e&&e.names.length>0){const i=this.viewport.getBoundingClientRect().height,r=e.height,s=r-2<=1?0:1;let o=e.yOffset-this.contentTop,n=0;this.hitList={};for(const a of e.names){const c=0;let l=o+s;if(e.groupIndeces&&e.groups&&e.groups.size>0&&(l+=(e.groupIndeces[n]+1)*Au),l+r>0){const e=r-2*s;Iu(t,a,c+2,l,t.canvas.width,e)}if(o+=r,n++,o>i)break}_u(t,0,t.canvas.width,t.canvas.height,e.yOffset-this.contentTop,e.height,e.groups)}}renderSVGContext(t,{deltaX:e,deltaY:i}){if("function"==typeof this.trackView.track.getSamples){const r=this.trackView.track.getSamples(),s=0,{width:o,height:a}=this.viewport.getBoundingClientRect(),c=`${(this.trackView.track.name||this.trackView.track.id||"").replace(/\W/g,"")}_sample_names_guid_${n()}`;t.saveWithTranslationAndClipRect(c,e,i+s,o,a,-s),this.draw({context:t,samples:r}),t.restore()}}addMouseHandlers(){this.boundClickHandler=function(t){t.preventDefault();const e={label:"Name Panel Width",value:this.browser.sampleNameViewportWidth||0,callback:t=>{this.browser.sampleNameViewportWidth=parseInt(t),this.browser.layoutChange()}};this.browser.inputDialog.present(e,t)}.bind(this),this.viewport.addEventListener("contextmenu",this.boundClickHandler),this.boundMouseMoveHandler=function(t){if(this.hitList){const e=Object.entries(this.hitList),{x:i,y:r}=a(t,this.viewport);this.viewport.setAttribute("title","");for(const[t,s]of e){const[e,o,n,a]=t.split("#").map(t=>parseInt(t,10));if(!(i<e||i>e+n||r<o||r>o+a)){this.viewport.setAttribute("title",`${s}`);break}}}}.bind(this),this.viewport.addEventListener("mousemove",this.boundMouseMoveHandler)}removeMouseHandlers(){this.viewport.removeEventListener("contextmenu",this.boundClickHandler),this.viewport.removeEventListener("mousemove",this.boundMouseMoveHandler)}dispose(){this.removeMouseHandlers(),this.viewport.remove()}}function Iu(t,e,i,r,s,o){const n=Math.min(o,10);t.font=`${n}px sans-serif`,t.textAlign="start",t.fillStyle=Vr("lead");const a=i,c=t.measureText(e),l=r+o/2+(c.actualBoundingBoxAscent+c.actualBoundingBoxDescent)/2;t.fillText(e,a,l)}class Su{constructor(t){this.popover=e({class:"igv-menu-popup"}),t.appendChild(this.popover),this.parent=t;const i=e({class:"igv-menu-popup-header"});this.popover.appendChild(i),u(i,()=>this.popover.style.display="none"),this.popoverContent=e(),this.popover.appendChild(this.popoverContent),p(this.popover,i),i.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault()}),this.popover.style.display="none"}presentMenuList(t,e,i){if(Eu(this.parent),e.length>0){this.popoverContent.innerHTML="";const r=this.parseMenuList(t,e);for(let t of r)t.init&&t.init(),0===r.indexOf(t)&&t.element.classList.remove("igv-track-menu-border-top"),t.element.classList.contains("igv-track-menu-border-top")||t.element.classList.contains("igv-menu-popup-check-container")||"div"===t.element.tagName.toLowerCase()&&t.element.classList.add("igv-menu-popup-shim"),this.popoverContent.appendChild(t.element);this.popover.style.display="flex";const{width:s}=this.popover.getBoundingClientRect();"left"===i.gearColumnPosition?this.popover.style.right=`${s}px`:this.popover.style.left=-s+"px",this.popover.style.top="0px"}}parseMenuList(t,e){return e.map((e,i)=>{let r;if("string"!=typeof e&&e.name)r=document.createElement("div"),r.textContent=e.name;else if("string"!=typeof e&&e.element)r=e.element;else if("string"!=typeof e&&"string"==typeof e.label)r=document.createElement("div"),r.innerHTML=e.label;else if("string"==typeof e)if(e.startsWith("<")){const t=document.createElement("div");t.innerHTML=e,r=t.firstChild}else r=document.createElement("div"),r.textContent=e;if(0===i&&r.classList.add("igv-track-menu-border-top"),"string"!=typeof e&&(e.click||e.dialog)){const i=i=>{if(i.preventDefault(),i.stopPropagation(),e.click)if(t.track.selected){const r=t.browser.getSelectedTrackViews();if(!0===e.doAllMultiSelectedTracks)e.click.call(t.track,i);else if("removeTrack"===e.menuItemType){const s=()=>{t.browser.overlayTrackButton.setVisibility(!1);for(const{track:t}of r)e.click.call(t,i)},o={html:`Are you sure you want to delete ${r.length} tracks?`,callback:s};t.browser.menuUtils.dialog.present(o,i)}else for(const{track:t}of r)e.click.call(t,i)}else e.click.call(t.track,i);else e.dialog&&e.dialog.call(t.track,i);this.popover.style.display="none"};void 0===r&&console.log("element is undefined"),r.addEventListener("click",i),r.addEventListener("touchend",t=>i(t)),r.addEventListener("mouseup",function(t){t.preventDefault(),t.stopPropagation()})}return{element:r,init:("string"!=typeof e?e.init:void 0)||void 0}})}presentTrackContextMenu(t,i){this.popoverContent.innerHTML="";const s=function(t,i){return t.map(t=>{let s;if("string"==typeof t&&"<hr/>"===t)s=document.createElement("hr");else if("string"==typeof t)s=e({class:"context-menu"}),s.innerHTML=t;else if(t instanceof Node)s=t;else if("function"==typeof t.init&&t.init(),"checkbox"===t.type?s=ic("Show all bases",t.value):(s=e({class:"context-menu"}),"string"==typeof t.label&&(s.innerHTML=t.label)),t.click&&"color"!==t.type){function o(e){t.click(e),r(i),e.preventDefault(),e.stopPropagation()}s.addEventListener("click",o),s.addEventListener("touchend",o),s.addEventListener("mouseup",function(t){t.preventDefault(),t.stopPropagation()})}return{el:s,init:t.init}})}(i,this.popover);for(let{el:t}of s)this.popoverContent.appendChild(t);!function(t,e){e.style.display="flex";const{x:i,y:r}=a(t,e.parentNode),{width:s}=e.getBoundingClientRect(),o=i+s,{width:n}=e.parentNode.getBoundingClientRect();e.style.left=`${o>n?i-(o-n):i}px`,e.style.top=`${r}px`}(t,this.popover)}hide(){this.popover.style.display="none"}dispose(){this.popoverContent.innerHTML="",this.popover.innerHTML="",Object.keys(this).forEach(t=>{this[t]=void 0})}}const Eu=t=>{const e=t.querySelectorAll(".igv-menu-popup");for(const t of e)t.style.display="none"};class Nu{constructor(t,i,r,s,o,n,a){this.browser=i,this.button=e({class:"igv-navbar-text-button"}),t.appendChild(this.button),Array.isArray(r)?(this.textContent=r[0],this.title=r[1]):this.textContent=this.title=r,this.buttonLabel=s,this.imageDictionary={image:`url("data:image/svg+xml,${encodeURIComponent(o)}")`,imageHover:`url("data:image/svg+xml,${encodeURIComponent(n)}")`},this.responsiveKey="text",this.configureButton(this.textContent,this.title),this.setState(a),i.on("navbar-resize",t=>{this.navbarResizeHandler(t)})}navbarResizeHandler(t){const e="igv-navbar-icon-button"===t?"image":"text";e!==this.responsiveKey&&(this.responsiveKey=e,this.configureButton(this.textContent,this.title),this.setState(void 0))}configureButton(t,e){this.groupElement=void 0,this.button.title=e,this.button.innerHTML="",this.button.style.backgroundImage="none",this.button.classList.remove("igv-navbar-icon-button"),this.button.classList.remove("igv-navbar-text-button"),"text"===this.responsiveKey?this.configureTextButton(t):this.configureIconButton()}configureTextButton(t){this.button.classList.add("igv-navbar-text-button");const e=document.createElement("div");e.innerHTML=this.buttonLabel;const i=e.firstChild;this.button.appendChild(i),this.groupElement=i.querySelector("#igv-navbar-button-group");i.querySelector("#igv-navbar-button-label").textContent=t}configureIconButton(){this.button.classList.add("igv-navbar-icon-button")}setState(t){void 0!==t&&(this.doHover=t),"text"===this.responsiveKey?this.setTextButtonState(this.doHover):this.setIconButtonState(this.doHover)}setTextButtonState(t){this.groupElement.classList.remove(...this.groupElement.classList);const e=!0===t?"igv-navbar-text-button-svg-hover":"igv-navbar-text-button-svg-inactive";this.groupElement.classList.add(e)}setIconButtonState(t){this.button.style.backgroundImage=!0===t?this.imageDictionary.imageHover:this.imageDictionary.image}show(){this.button.style.display=""}hide(){this.button.style.display="none"}setVisibility(t){!0===t?this.show():this.hide()}}const Mu='<svg width="80px" height="18px" viewBox="0 0 80 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="igv-navbar-button-group">\n <rect id="Rectangle" x="0.5" y="0.5" width="79" height="17" rx="6"></rect>\n <text id="igv-text-button-label" x="50%" y="50%" dy=".1em" font-family="Helvetica" font-size="12" font-weight="normal" letter-spacing="-0.372">\n <tspan id="igv-navbar-button-label"></tspan>\n </text>\n </g>\n </g>\n</svg>',Ru=.01;function Du(t,e,i,r){var s;let o=null!==(s=this.axisMin)&&void 0!==s?s:0,n=this.axisMax;if(void 0===n&&this.dataRange&&(o=this.dataRange.min||0,n=this.dataRange.max),void 0===n)return;go.fillRect(t,0,0,e,i,{fillStyle:"white"}),r&&go.fillRect(t,e-4-2,0,4,i,{fillStyle:r});const a=void 0!==this.flipAxis&&this.flipAxis,c=.95*e-8-5,l=.95*e-5,h={font:"normal 10px Arial",textAlign:"right",fillStyle:"black",strokeStyle:"black"};go.strokeLine(t,c,Ru*i,l,Ru*i,h),go.fillText(t,u(a?o:n),c+4,Ru*i+12,h);const d=.99*i;function u(t){return Number.isInteger(t)||t%1==0?t.toString():Math.abs(t)>=10?t.toFixed():Math.abs(t)>=1?t.toFixed(1):Math.abs(t)>=.1?t.toFixed(2):t.toExponential(1)}go.strokeLine(t,c,d,l,d,h),go.fillText(t,u(a?n:o),c+4,d-4,h),go.strokeLine(t,l,Ru*i,l,d,h)}class Bu extends lc{constructor(t,e,i){super(t,e),this.type="merged",this.paintAxis=Du,this.graphType=t.graphType,this.tracks=i||[]}async postInit(){if(this.config.tracks){for(let t of this.config.tracks){const e=await this.browser.createTrack(t);e?(this.tracks.push(e),"function"==typeof e.postInit&&await e.postInit()):console.warn("Could not create track "+t)}this.config.tracks.every(t=>void 0!==t.autoscale||void 0!==t.max)||(this.config.autoscale=void 0===this.config.max)}for(let t of this.tracks)t.isMergedTrack=!0;if(this.config.autoscale?this.autoscale=this.config.autoscale:void 0!==this.config.max&&this.setDataRange({min:this.config.min||0,max:this.config.max}),void 0!==this.config.flipAxis)for(let t of this.tracks)t.flipAxis=this.config.flipAxis;if(void 0!==this.config.logScale)for(let t of this.tracks)t.logScale=this.config.logScale;return this.resolutionAware=this.tracks.some(t=>t.resolutionAware),this}set flipAxis(t){this.config.flipAxis=t;for(let e of Lu(this.tracks))e.flipAxis=t}get flipAxis(){return Lu(this.tracks).every(t=>t.flipAxis)}set logScale(t){this.config.logScale=t;for(let e of Lu(this.tracks))e.logScale=t}get logScale(){return Lu(this.tracks).every(t=>t.logScale)}get height(){return this._height}set height(t){if(this.config.height=t,this._height=t,this.tracks)for(let e of this.tracks)e.height=t,e.config.height=t}set autoscale(t){if(this._autoscale=t,!1===t&&this.tracks)for(let t of this.tracks)t.autoscale=!1}get autoscale(){return this._autoscale}set autoscaleGroup(t){if(this.tracks)for(let e of this.tracks)e.autoscaleGroup=t}get autoscaleGroup(){if(this.tracks&&this.tracks.length>0){const t=this.tracks[0].autoscaleGroup;return this.tracks.some(e=>t!==e.autoscaleGroup)?void 0:t}}setDataRange({min:t,max:e}){this.autoscale=!1;for(const i of Lu(this.tracks))i.dataRange={min:t,max:e},i.autoscale=!1,i.autoscaleGroup=!1}set dataRange({min:t,max:e}){for(const i of Lu(this.tracks))i.dataRange={min:t,max:e}}get dataRange(){if(this.tracks){const t=Lu(this.tracks);if(t.length>0){const e=t[0].dataRange;if(t.every(t=>t.dataRange&&t.dataRange.min===e.min&&t.dataRange.max===e.max))return e}}}menuItemList(){const t=[];return Lu(this.tracks).length>0&&(void 0!==this.flipAxis&&t.push({label:"Flip y-axis",click:function(){this.flipAxis=!this.flipAxis,this.trackView.repaintViews()}}),t.push(...this.numericDataMenuItems())),t.push("<hr/>"),t.push(this.overlayTrackAlphaAdjustmentMenuItem()),t.push(this.trackSeparationMenuItem()),t}async getFeatures(t,e,i,r){const s=this.tracks.map(s=>s.getFeatures(t,e,i,r)),o=await Promise.all(s);if(o.every(t=>0===t.length))return new Tu([],[]);{const t=this.tracks.map(t=>t.name);return new Tu(o,t)}}draw(t){const e=t.features;for(let i=0,r=this.tracks.length;i<r;i++){const r=Object.assign({},t);r.features=e.featureArrays[i],r.alpha=this.alpha,this.graphType&&(this.tracks[i].graphType=this.graphType),this.tracks[i].draw(r)}}popupData(t){const e=this.clickedFeatures(t);if(e&&e.length===this.tracks.length){const i=[];let r=!0;for(let s=0;s<e.length;s++)if(s>0&&i.push("<hr/>"),i.push(`<div style=background-color:rgb(245,245,245);border-bottom-style:dashed;border-bottom-width:1px;padding-bottom:5px;padding-top:10px;font-weight:bold;font-size:larger >${e[s].trackName}</div>`),e[s].features.length>0){r=!1;const o=this.tracks[s].popupData(t,e[s].features);i.push(...o)}else i.push("Missing or 0 value(s)");return!0===r?[]:i}}clickedFeatures(t){const e=t.viewport.cachedFeatures;if(!e||!e.featureArrays||!Array.isArray(e.featureArrays)||0===e.featureArrays.length)return[];const i=t.genomicLocation,r=[],s=t.referenceFrame.bpPerPixel>.2?3*t.referenceFrame.bpPerPixel:.2,o=i-s,n=i+s;for(let t=0;t<e.featureArrays.length;t++){const i=Pr(e.featureArrays[t],o,n);r.push({trackName:e.trackNames[t],features:i})}return r}get supportsWholeGenome(){return this.tracks.every(t=>t.supportsWholeGenome)}getState(){const t=super.getState(),e=[];for(let t of this.tracks)e.push(t.getState());return t.tracks=e,t}updateScales(t){let e;if(this.autoscale){e=!0;let i=[];for(let e of t){if(e.featureCache&&e.featureCache.features){const t=e.referenceFrame,r=t.start,s=r+t.toBP(e.getWidth()),o=e.featureCache.features;this.autoscale&&(i.push({value:o.getMax(r,s)}),i.push({value:o.getMin(r,s)}))}const t=Go(i);for(const e of Lu(this.tracks))e.dataRange=t}}else{let i=-1;for(let r of this.tracks)if(++i,r.autoscale){e=!0;let s=[];for(let e of t)if(e.featureCache&&e.featureCache.features){const t=e.referenceFrame,r=t.start,o=r+t.toBP(e.getWidth()),n=e.featureCache.features.featureArrays[i];if(n)for(let t of n)if(!(t.end<r)){if(t.start>o)break;s.push(t)}}r.dataRange=Go(s)}}return e}overlayTrackAlphaAdjustmentMenuItem(){const t=e();return t.innerText="Set transparency",{element:t,dialog:function(t){const e={label:"Transparency",value:this.alpha,min:0,max:1,scaleFactor:1e3,callback:t=>{this.alpha=Math.max(.001,t),this.repaintViews()}};this.browser.sliderDialog.present(e,t)}}}trackSeparationMenuItem(){let t=document.createElement("div");return t.textContent="Separate tracks",{element:t,click:async function(){const t=this.autoscale,e=this.name,i=this.tracks,r=this.browser,s=this.order;r.removeTrack(this);for(let o of i)o.order=s,t&&(o.autoscaleGroup=e),o.isMergedTrack=!1,await r.addTrack(o);await r.updateViews(),r.reorderTracks()}}}}Bu.defaults={autoscale:void 0,alpha:.5,height:50};class Tu{constructor(t,e){this.featureArrays=t,this.trackNames=e}getMax(t,e){let i=-Number.MAX_VALUE;for(let r of this.featureArrays)if(Array.isArray(r))for(let s of r)if(!(void 0===s.value||Number.isNaN(s.value)||s.end<t)){if(s.start>e)break;i=Math.max(i,s.value)}return i!==-Number.MAX_VALUE?i:100}getMin(t,e){let i=0;for(let r of this.featureArrays)if(Array.isArray(r))for(let s of r)if(void 0!==s.value&&!Number.isNaN(s.value)){if(s.end<t)continue;if(s.start>e)break;i=Math.min(i,s.value)}return i}}const Lu=t=>t?t.filter(t=>void 0!==t.dataRange||void 0!==t.autoscale||void 0!==t.autoscaleGroup):[];class zu extends Nu{constructor(t,e){super(t,e,"Overlay Tracks",Mu,'<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>Overlay Tracks</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="Overlay-Tracks">\n <rect id="backdrop" stroke="#737373" stroke-width="12" fill="#FFFFFF" x="6" y="6" width="613" height="613" rx="135"></rect>\n <g id="layer-group" transform="translate(3, 127)">\n <rect id="a" stroke="#737373" stroke-width="24" fill="#A1A1A1" x="12" y="12" width="332" height="139"></rect>\n <rect id="a---hold-out" fill="#A1A1A1" x="9" y="25" width="324" height="115"></rect>\n <rect id="b" stroke="#737373" stroke-width="24" fill="#C9C9C9" x="81" y="103" width="474" height="139"></rect>\n <rect id="c" stroke="#737373" stroke-width="24" fill="#ECECEC" x="238" y="214" width="372" height="139"></rect>\n <rect id="c---hold-out" fill="#ECECEC" x="250" y="226" width="372" height="115"></rect>\n </g>\n <rect id="over-border" stroke="#737373" stroke-width="12" x="6" y="6" width="613" height="613" rx="135"></rect>\n </g>\n </g>\n</svg>','<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>Overlay Tracks Hover</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="Overlay-Tracks-Hover">\n <rect id="backdrop-copy" stroke="#737373" stroke-width="12" fill="#737373" x="6" y="6" width="613" height="613" rx="135"></rect>\n <g id="layer-group" transform="translate(3, 127)">\n <rect id="a" stroke="#FFFFFF" stroke-width="24" fill="#A1A1A1" x="12" y="12" width="332" height="139"></rect>\n <rect id="a---hold-out" fill="#A1A1A1" x="9" y="25" width="324" height="115"></rect>\n <rect id="b" stroke="#FFFFFF" stroke-width="24" fill="#C9C9C9" x="81" y="103" width="474" height="139"></rect>\n <rect id="c" stroke="#FFFFFF" stroke-width="24" fill="#ECECEC" x="238" y="214" width="372" height="139"></rect>\n <rect id="c---hold-out" fill="#ECECEC" x="250" y="226" width="372" height="115"></rect>\n </g>\n <rect id="over-border-copy" stroke="#737373" stroke-width="12" x="6" y="6" width="613" height="613" rx="135"></rect>\n </g>\n </g>\n</svg>',!1),this.button.addEventListener("mouseenter",()=>this.setState(!0)),this.button.addEventListener("mouseleave",()=>this.setState(!1));this.boundMouseClickHandler=(()=>{this.setVisibility(!1),this.trackOverlayClickHandler()}).bind(this),this.button.addEventListener("click",this.boundMouseClickHandler),this.setVisibility(!0)}async trackOverlayClickHandler(){if(!0===Pu(this.browser)){const t=this.browser.getSelectedTrackViews().map(({track:t})=>t);for(const e of t)e.selected=!1;const e=[];for(let i of t)"merged"===i.type?e.push(...i.tracks):e.push(i);const i={name:"Overlay",type:"merged",autoscale:!1,alpha:.5,height:Math.max(...t.map(t=>t.height)),order:Math.min(...t.map(t=>t.order))},r=new Bu(i,this.browser,e);for(const e of t){const t=this.browser.trackViews.indexOf(e.trackView);this.browser.trackViews.splice(t,1),e.trackView.dispose()}await this.browser.addTrack(r),await r.trackView.updateViews(),this.browser.reorderTracks()}}}function Pu(t){const e=t.getSelectedTrackViews();if(e&&e.length>1){const t=new Set(["wig","merged"]);return e.filter(({track:e})=>t.has(e.type)).length>1}return!1}const Ou=new Set(["sequence","ruler","ideogram"]),Hu=new Set(["ruler","sequence","ideogram"]);class Uu{constructor(t,e,i){this.namespace=`trackview-${n()}`,this.browser=t,this.track=i,i.trackView=this,this.addDOMToColumnContainer(t,e,t.referenceFrameList)}startSpinner(){this.viewports&&this.viewports.length>0&&this.viewports[0].startSpinner()}stopSpinner(){this.viewports&&this.viewports.length>0&&this.viewports[0].stopSpinner()}addDOMToColumnContainer(t,e,i){this.axis=this.createAxis(t,this.track),this.createViewports(t,e,i),this.sampleInfoViewport=new xu(this,t.columnContainer.querySelector(".igv-sample-info-column"),t.getSampleInfoViewportWidth()),this.sampleNameViewport=new ku(this,t.columnContainer.querySelector(".igv-sample-name-column"),void 0,t.getSampleNameViewportWidth()),this.createTrackScrollbar(t),this.createTrackDragHandle(t),this.createTrackGearPopup(t)}createViewports(t,e,i){this.viewports=[];const r=t.calculateViewportWidth(i.length),s=e.querySelectorAll(".igv-column");for(let t=0;t<s.length;t++){const e=cu(this,s[t],i[t],r);this.viewports.push(e)}"function"==typeof this.track.createGroupLabels&&this.track.createGroupLabels()}getLastViewport(){return this.viewports&&this.viewports.length>0?this.viewports[this.viewports.length-1]:void 0}createAxis(t,i){const r=t.columnContainer.querySelector(".igv-axis-column");if(!r)return;const s=e();if(this.axis=s,r.appendChild(s),s.dataset.tracktype=i.type,s.style.height=`${i.height}px`,"function"==typeof i.paintAxis){const{width:t,height:e}=s.getBoundingClientRect();this.axisCanvas=document.createElement("canvas"),this.axisCanvas.style.width=`${t}px`,this.axisCanvas.style.height=`${e}px`,s.appendChild(this.axisCanvas)}if(!1===Jr.has(this.track.type||"")){this.trackSelectionContainer=e(),s.appendChild(this.trackSelectionContainer);const t='<input type="checkbox" name="track-select">',i=document.createRange().createContextualFragment(t).firstChild;this.trackSelectionContainer.appendChild(i),i.checked=this.track.selected||!1,i.addEventListener("change",t=>{t.preventDefault(),t.stopPropagation(),this.track.selected=t.target.checked,this.setDragHandleSelectionState(t.target.checked),this.browser.overlayTrackButton.setVisibility(Pu(this.browser))}),this.enableTrackSelection(!1)}return s}resizeAxisCanvas(t,e){this.axis.style.width=`${t}px`,this.axis.style.height=`${e}px`,"function"==typeof this.track.paintAxis&&(this.axisCanvas.style.width=`${t}px`,this.axisCanvas.style.height=`${e}px`)}renderSVGContext(t,{deltaX:e,deltaY:i}){!function(t,e,i,r,s){if("function"==typeof e.paintAxis){const{y:o,width:a,height:c}=i.getBoundingClientRect(),l=`${(e.name||e.id||"").replace(/\W/g,"")}_axis_guid_${n()}`;t.saveWithTranslationAndClipRect(l,r,o+s,a,c,0),e.paintAxis(t,a,c),t.restore()}}(t,this.track,this.axisCanvas,e,i);const{width:r}=this.axis.getBoundingClientRect(),{y:s}=this.viewports[0].viewportElement.getBoundingClientRect();let o={deltaX:r+e,deltaY:s+i};for(let e of this.viewports){e.renderSVGContext(t,o);const{width:i}=e.viewportElement.getBoundingClientRect();o.deltaX+=i}if(!0===this.browser.sampleInfo.isInitialized()&&!0===this.browser.sampleInfoControl.showSampleInfo){this.sampleInfoViewport.renderSVGContext(t,o);const{width:e}=this.sampleInfoViewport.viewport.getBoundingClientRect();o.deltaX+=e}!0===this.browser.showSampleNames&&this.sampleNameViewport.renderSVGContext(t,o)}presentColorPicker(t,e){if(!1===Hu.has(this.track.type||"")){let i,r;i="color"===t?this.track._initialColor||this.track.constructor.defaultColor||"":this.track._initialAltColor||this.track.constructor.defaultColor||"";const s=this.browser.getSelectedTrackViews();r=s.length>0&&new Set(s).has(this)?{color:t=>{for(const e of s)e.track.color=t,e.repaintViews()},altColor:t=>{for(const e of s)e.track.altColor=t,e.repaintViews()}}:{color:t=>{this.track.color=Or(t),this.repaintViews()},altColor:t=>{this.track.altColor=Or(t),this.repaintViews()}};const o="string"==typeof this.track.color?this.track.color:void 0,n=("color"===t?o||this.track.constructor.defaultColor:this.track.altColor||this.track.constructor.defaultColor)||"";this.browser.genericColorPicker.configure(i,r[t],n),this.browser.genericColorPicker.present(e)}}setTrackHeight(t,e){e||(this.track.minHeight&&(t=Math.max(this.track.minHeight,t)),this.track.maxHeight&&(t=Math.min(this.track.maxHeight,t))),this.track.height=t,this.resizeAxisCanvas(this.axis.clientWidth,this.track.height),"function"==typeof this.track.paintAxis&&this.paintAxis();for(let e of this.viewports)e.setHeight(t);if(this.sampleInfoViewport.setHeight(t),this.sampleNameViewport.viewport.style.height=`${t}px`,"function"!=typeof this.track.computePixelHeight)for(let e of this.viewports)e.setContentHeight(t);this.repaintViews(),this.updateScrollbar(),this.dragHandle.style.height=`${t}px`,this.gearContainer.style.height=`${t}px`,this.browser.fireEvent("trackheightchange",[this])}updateScrollbar(){const t=this.viewports[0].viewportElement.clientHeight;if(this.outerScroll.style.height=`${t}px`,!1===Ou.has(this.track.type||"")){const e=this.maxViewportContentHeight(),i=Math.round(t/e*t);e>t?(this.innerScroll.style.display="block",this.innerScroll.style.height=`${i}px`):this.innerScroll.style.display="none"}}setTop(t){for(let e of this.viewports)e.setTop(t);this.sampleInfoViewport.setTop(t),this.sampleNameViewport.setTop(t)}moveScroller(t){const e=this.innerScroll.offsetTop+t,i=Math.min(Math.max(0,e),this.outerScroll.clientHeight-this.innerScroll.clientHeight);this.innerScroll.style.top=`${i}px`;const r=this.maxViewportContentHeight(),s=Math.round(i*(r/this.viewports[0].viewportElement.clientHeight));this.setTop(s)}scrollByPixels(t){const e=this.viewports[0].getContentTop(),i=this.maxViewportContentHeight(),r=i-this.viewports[0].viewportElement.clientHeight,s=Math.min(Math.max(0,e+t),r);if(this.setTop(s),this.innerScroll){const t=this.viewports[0].viewportElement.clientHeight,e=Math.round(s*(t/i));this.innerScroll.style.top=`${e}px`}}repaintViews(){for(let t of this.viewports)t.isVisible()&&t.repaint();"function"==typeof this.track.paintAxis&&this.paintAxis(),this.repaintSampleInfo(),this.repaintSamples()}repaintSampleInfo(){this.sampleInfoViewport.repaint()}repaintSamples(){if("function"==typeof this.track.getSamples){const t=this.track.getSamples();t.names&&t.names.length>0&&this.sampleNameViewport.repaint(t)}}setTrackLabelName(t){this.viewports.forEach(e=>e.setTrackLabel(t))}resize(t){for(let e of this.viewports)e.setWidth(t)}async updateViews(){if(!this.browser||!this.browser.referenceFrameList)return;const t=this.viewports.filter(t=>t.isVisible()&&t.checkZoomIn());if(t.forEach(t=>t.shift()),this.browser.dragObject)return;const e=t,i=e.filter(t=>t.needsRepaint()),r=e.filter(t=>t.needsReload());for(let t of r)await t.loadFeatures();if(this.disposed)return;if(this.track&&"function"==typeof this.track.variantRowCount&&r.length>0){let t=0;for(let e of this.viewports)if(e.featureCache&&e.featureCache.features){const i=e.featureCache.features;t=Math.max(t,i.reduce((t,e)=>Math.max(t,e.row||0),0))}if(this.track.nVariantRows!==t+1){this.track.variantRowCount(t+1);for(let t of this.viewports)t.checkContentHeight()}}let s;if("merged"===this.track.type)s=this.track.updateScales(t);else if(this.track.autoscale){let t=[];for(let i of e){const e=i.referenceFrame,r=e.start,s=r+e.toBP(i.getWidth());if(i.featureCache&&i.featureCache.features){const e=i.featureCache.features;if("function"==typeof e.getMax){const i=e.getMax(r,s);if(t.push({value:i}),"function"==typeof e.getMin){const i=e.getMin(r,s);t.push({value:i})}}else{const e=Pr(i.featureCache.features,r,s);for(let i of e)t.push(i)}}}"function"==typeof this.track.doAutoscale?this.track.dataRange=this.track.doAutoscale(t):this.track.dataRange=Go(t)}const o=this.track.autoscale||this.track.autoscaleGroup||"ruler"===this.track.type||s||this.track.groupBy;for(let t of e)i.includes(t)?t.repaint():o&&t.refresh();this.adjustTrackHeight(),this.repaintSampleInfo(),this.repaintSamples(),this.updateRulerViewportLabels()}clearCachedFeatures(){for(let t of this.viewports)t.clearCache()}updateRulerViewportLabels(){const t=this.browser.calculateViewportWidth(this.viewports.length);for(let e of this.viewports)if("ruler"===this.track.type){const i=e;this.viewports.length>1?i.presentLocusLabel(t):i.dismissLocusLabel()}}async getInViewFeatures(){if(!this.browser||!this.browser.referenceFrameList)return[];let t=[];const e=this.viewports.filter(t=>t.isVisible());for(let i of e){const e=i.referenceFrame,{chr:r,start:s,bpPerPixel:o}=i.referenceFrame,n=s+e.toBP(i.getWidth());if((!i.featureCache||!i.featureCache.containsRange(r,s,n,o))&&await i.loadFeatures(),i.featureCache&&i.featureCache.features){const e=i.featureCache.features;if("function"==typeof e.getMax){const i=e.getMax(s,n);t.push({value:i})}else{const e=i.featureCache,o="function"==typeof e.queryFeatures?e.queryFeatures(r,s,n):Pr(i.featureCache.features,s,n);t=t.concat(o)}}}return t}checkContentHeight(){for(let t of this.viewports)t.checkContentHeight();this.adjustTrackHeight()}adjustTrackHeight(){var t=this.maxViewportContentHeight();if(this.track.autoHeight?this.setTrackHeight(t,!1):this.track.paintAxis&&this.paintAxis(),!1===Ou.has(this.track.type||"")){const e=this.viewports[0].getContentTop(),i=this.viewports[0].viewportElement.clientHeight,r=Math.min(0,i-t);e<r&&this.setTop(r),this.updateScrollbar(),this.moveScroller(0)}}createTrackScrollbar(t){const i=e();if(t.columnContainer.querySelector(".igv-scrollbar-column").appendChild(i),i.style.height=`${this.track.height}px`,this.outerScroll=i,!1===Ou.has(this.track.type||"")){const r=e();i.appendChild(r),this.innerScroll=r,this.addTrackScrollMouseHandlers(t)}}createTrackDragHandle(t){"sequence"!==this.track.type&&!0===Jr.has(this.track.type||"")?this.dragHandle=e({class:"igv-track-drag-shim"}):(this.dragHandle=e({class:"igv-track-drag-handle"}),this.dragHandle.classList.add("igv-track-drag-handle-color")),t.columnContainer.querySelector(".igv-track-drag-column").appendChild(this.dragHandle),this.dragHandle.style.height=`${this.track.height}px`,this.addTrackDragMouseHandlers(t)}createTrackGearPopup(t){if(this.gearContainer=e(),t.columnContainer.querySelector(".igv-gear-menu-column").appendChild(this.gearContainer),this.gearContainer.style.height=`${this.track.height}px`,!0===this.track.ignoreTrackMenu);else{this.gear=e(),this.gearContainer.appendChild(this.gear);const i=l("cog");function r(e){if(e.preventDefault(),e.stopPropagation(),"none"===this.trackGearPopup.popover.style.display){for(const e of t.trackViews.filter(t=>t!==this&&void 0!==t.trackGearPopup))e.trackGearPopup.popover.style.display="none";this.trackGearPopup.presentMenuList(this,t.menuUtils.trackMenuItemList(this),t.config)}else this.trackGearPopup.popover.style.display="none"}!1===t.config.showGearColumn&&(i.style.color="white"),this.gear.appendChild(i),this.trackGearPopup=new Su(this.gear),this.boundTrackGearClickHandler=r.bind(this),this.gear.addEventListener("click",this.boundTrackGearClickHandler)}}addTrackScrollMouseHandlers(t){this.boundTrackScrollMouseDownHandler=function(e){e.stopPropagation();const{y:i}=o(e);this.innerScroll.dataset.yDown=i.toString(),this.boundColumnContainerMouseMoveHandler=function(t){t.stopPropagation();const{y:e}=o(t);this.moveScroller(e-parseInt(this.innerScroll.dataset.yDown)),this.innerScroll.dataset.yDown=e.toString()}.bind(this),t.columnContainer.addEventListener("mousemove",this.boundColumnContainerMouseMoveHandler)}.bind(this),this.innerScroll.addEventListener("mousedown",this.boundTrackScrollMouseDownHandler),this.boundColumnContainerMouseUpHandler=function(e){t.columnContainer.removeEventListener("mousemove",this.boundColumnContainerMouseMoveHandler)}.bind(this),t.columnContainer.addEventListener("mouseup",this.boundColumnContainerMouseUpHandler),t.columnContainer.addEventListener("mouseleave",this.boundColumnContainerMouseUpHandler)}removeTrackScrollMouseHandlers(){!1===Ou.has(this.track.type||"")&&(this.innerScroll.removeEventListener("mousedown",this.boundTrackScrollMouseDownHandler),this.browser.columnContainer.removeEventListener("mouseup",this.boundColumnContainerMouseUpHandler),this.browser.columnContainer.removeEventListener("mousemove",this.boundColumnContainerMouseMoveHandler),this.browser.columnContainer.removeEventListener("mouseleave",this.boundColumnContainerMouseMoveHandler))}addTrackDragMouseHandlers(t){if("sequence"===this.track.type||!1===Jr.has(this.track.type||"")){let e;function i(i){i.preventDefault(),e=i.target,!1!==this.track.selected&&"sequence"!==this.track.type||(e.classList.remove("igv-track-drag-handle-color"),e.classList.add("igv-track-drag-handle-hover-color")),t.startTrackDrag(this)}function r(i){t.endTrackDrag(),e&&i.target!==e&&(!1!==this.track.selected&&"sequence"!==this.track.type||(e.classList.remove("igv-track-drag-handle-hover-color"),e.classList.add("igv-track-drag-handle-color"))),e=void 0}function s(i){i.preventDefault(),void 0===e&&(!1!==this.track.selected&&"sequence"!==this.track.type||(i.target.classList.remove("igv-track-drag-handle-color"),i.target.classList.add("igv-track-drag-handle-hover-color"))),t.updateTrackDrag(this)}function o(t){t.preventDefault(),void 0===e&&(!1!==this.track.selected&&"sequence"!==this.track.type||(t.target.classList.remove("igv-track-drag-handle-hover-color"),t.target.classList.add("igv-track-drag-handle-color")))}this.boundTrackDragMouseDownHandler=i.bind(this),this.dragHandle.addEventListener("mousedown",this.boundTrackDragMouseDownHandler),this.boundDocumentTrackDragMouseUpHandler=r.bind(this),document.addEventListener("mouseup",this.boundDocumentTrackDragMouseUpHandler),this.boundTrackDragMouseEnterHandler=s.bind(this),this.dragHandle.addEventListener("mouseenter",this.boundTrackDragMouseEnterHandler),this.dragHandle.addEventListener("mouseout",t=>{t.preventDefault(),void 0===e&&(!1!==this.track.selected&&"sequence"!==this.track.type||(t.target.classList.remove("igv-track-drag-handle-hover-color"),t.target.classList.add("igv-track-drag-handle-color")))}),this.boundTrackDragMouseOutHandler=o.bind(this),this.dragHandle.addEventListener("mouseout",this.boundTrackDragMouseOutHandler)}}removeTrackDragMouseHandlers(){"ideogram"===this.track.type||"ruler"===this.track.type||(this.dragHandle.removeEventListener("mousedown",this.boundTrackDragMouseDownHandler),document.removeEventListener("mouseup",this.boundDocumentTrackDragMouseUpHandler),this.dragHandle.removeEventListener("mouseup",this.boundTrackDragMouseEnterHandler),this.dragHandle.removeEventListener("mouseout",this.boundTrackDragMouseOutHandler))}removeTrackGearMouseHandlers(){!0===this.track.ignoreTrackMenu||this.gear.removeEventListener("click",this.boundTrackGearClickHandler)}removeDOMFromColumnContainer(){this.axis.remove(),this.removeViewportsFromColumnContainer(),this.sampleInfoViewport.dispose(),this.sampleNameViewport.dispose(),this.removeTrackScrollMouseHandlers(),this.outerScroll.remove(),this.removeTrackDragMouseHandlers(),this.dragHandle.remove(),this.removeTrackGearMouseHandlers(),this.gearContainer.remove()}removeViewportsFromColumnContainer(){for(let t of this.viewports)t.viewportElement.remove()}dispose(){this.axis.remove();for(let t of this.viewports)t.dispose();this.sampleInfoViewport.dispose(),this.sampleNameViewport.dispose(),this.removeTrackScrollMouseHandlers(),this.outerScroll.remove(),this.removeTrackDragMouseHandlers(),this.dragHandle.remove(),this.removeTrackGearMouseHandlers(),this.gearContainer.remove(),"function"==typeof this.track.dispose&&this.track.dispose();for(let t of Object.keys(this))this[t]=void 0;this.alert&&this.alert.container.remove(),this.disposed=!0}paintAxis(){if("function"==typeof this.track.paintAxis){const{width:t,height:e}=this.axisCanvas.getBoundingClientRect(),i=window.devicePixelRatio||1;this.axisCanvas.height=i*e,this.axisCanvas.width=i*t;const r=this.axisCanvas.getContext("2d");if(r.scale(i,i),this.track.autoscaleGroup){if(void 0===ts[this.track.autoscaleGroup]){const t=qr.Dark2,e=Math.floor(Math.random()*qr.Dark2.length);ts[this.track.autoscaleGroup]=t[e]}const i=ur.addAlpha(ts[this.track.autoscaleGroup],.75);this.track.paintAxis(r,t,e,i)}else this.track.paintAxis(r,t,e,void 0)}}maxViewportContentHeight(){return Math.max(...this.viewports.map(t=>t.getContentHeight()))}enableTrackSelection(t){const e=this.trackSelectionContainer;if(e&&!Jr.has(this.track.type||""))if(!1!==t)e.style.display="grid";else{this.track.selected=!1;e.querySelector("[name=track-select]").checked=this.track.selected,this.dragHandle&&this.setDragHandleSelectionState(!1),e.style.display="none"}}setDragHandleSelectionState(t){const e=this.dragHandle;t?(e.classList.remove("igv-track-drag-handle-color"),e.classList.remove("igv-track-drag-handle-hover-color"),e.classList.add("igv-track-drag-handle-selected-color")):(e.classList.remove("igv-track-drag-handle-hover-color"),e.classList.remove("igv-track-drag-handle-selected-color"),e.classList.add("igv-track-drag-handle-color"))}}const Vu=t=>{switch(t.type){case"gradient":return new Wu(t);case"doubleGradient":case"diverging":return new ju(t);default:throw Error("Unknown color scale type: "+t)}},qu=function(t,e){return new Wu({type:"doubleGradient",min:t,max:e,minColor:"rgb(46,56,183)",maxColor:"rgb(164,0,30)"})},Qu=function(t,e,i){return new ju({type:"doubleGradient",min:0,mid:.25,max:.5,minColor:"rgb(46,56,183)",midColor:"white",maxColor:"rgb(164,0,30)"})};class Gu{constructor(t){this.thresholds=t.thresholds,this.colors=t.colors}getColor(t){for(let e=0;e<this.thresholds.length;e++)if(t<this.thresholds[e])return this.colors[e];return this.colors[this.colors.length-1]}}class Wu{constructor(t){var e,i;this.type="gradient",this.setProperties({min:null!==(e=void 0!==t.min?t.min:t.low)&&void 0!==e?e:0,max:null!==(i=void 0!==t.max?t.max:t.high)&&void 0!==i?i:0,minColor:t.minColor||t.lowColor||"rgb(0,0,255)",maxColor:t.maxColor||t.highColor||"rgb(255,0,0)"})}setProperties({min:t,max:e,minColor:i,maxColor:r}){this.type="gradient",this.min=t,this.max=e,this._lowColor=i,this._highColor=r,this.lowComponents=ur.rgbComponents(i),this.highComponents=ur.rgbComponents(r)}get minColor(){return this._lowColor}set minColor(t){this._lowColor=t,this.lowComponents=ur.rgbComponents(t)}get maxColor(){return this._highColor}set maxColor(t){this._highColor=t,this.highComponents=ur.rgbComponents(t)}getColor(t){if(t<=this.min)return this.minColor;if(t>=this.max)return this.maxColor;const e=(t-this.min)/(this.max-this.min);return"rgb("+Math.floor(this.lowComponents[0]+e*(this.highComponents[0]-this.lowComponents[0]))+","+Math.floor(this.lowComponents[1]+e*(this.highComponents[1]-this.lowComponents[1]))+","+Math.floor(this.lowComponents[2]+e*(this.highComponents[2]-this.lowComponents[2]))+")"}toJson(){return{type:this.type,min:this.min,max:this.max,minColor:this.minColor,maxColor:this.maxColor}}clone(){return new Wu(this.toJson())}}class ju{constructor(t){this.type="diverging",this.lowGradientScale=new Wu({minColor:t.minColor||t.lowColor,maxColor:t.midColor,min:void 0!==t.min?t.min:t.low,max:t.mid}),this.highGradientScale=new Wu({minColor:t.midColor,maxColor:t.maxColor||t.highColor,min:t.mid,max:void 0!==t.max?t.max:t.high})}getColor(t){return t<this.mid?this.lowGradientScale.getColor(t):this.highGradientScale.getColor(t)}get min(){return this.lowGradientScale.min}set min(t){this.lowGradientScale.min=t}get max(){return this.highGradientScale.max}set max(t){this.highGradientScale.max=t}get mid(){return this.lowGradientScale.max}set mid(t){this.lowGradientScale.max=t,this.highGradientScale.min=t}get minColor(){return this.lowGradientScale.minColor}set minColor(t){this.lowGradientScale.minColor=t}get maxColor(){return this.highGradientScale.maxColor}set maxColor(t){this.highGradientScale.maxColor=t}get midColor(){return this.lowGradientScale.maxColor}set midColor(t){this.lowGradientScale.maxColor=t,this.highGradientScale.minColor=t}toJson(){return{type:this.type,min:this.min,mid:this.mid,max:this.max,minColor:this.minColor,midColor:this.midColor,maxColor:this.maxColor}}clone(){const t=this.toJson();return new ju(t)}}class $u{constructor(t){this.color=t}getColor(){return this.color}}const Ku={display:"flex",flexDirection:"row",alignItems:"center",backgroundColor:"transparent"};class Zu{constructor({selected:t,label:i,onchange:r}){this.state=t,this.onchange=r,this.elem=e({style:Ku});const s=e({style:{width:"14px",height:"14px",borderColor:"gray",borderWidth:"1px",borderStyle:"solid"}});if(this.svg=l("check",!0===t?"#444":"transparent"),this.svg.style.width="12px",this.svg.style.height="12px",s.appendChild(this.svg),this.elem.appendChild(s),i){const t=e({style:{marginLeft:"5px"}});t.textContent=i,this.elem.appendChild(t)}const o=t=>{t.preventDefault(),t.stopPropagation();const e=!this.state;this.selected=e,"function"==typeof this.onchange&&this.onchange(e)};this.elem.addEventListener("click",o),this.elem.addEventListener("touchend",o)}set selected(t){this.state=t;this.svg.querySelector("path").setAttributeNS(null,"fill",!0===t?"#444":"transparent")}get selected(){return this.state}}function Yu(t,e){const i=t.getContext("2d"),r=t.width,s=(e.max-e.min)/r;for(let o=0;o<r;o++){const r=e.min+o*s,n=e.getColor(r);i.fillStyle=n,i.fillRect(o,0,1,t.height)}}class Xu{static open(t,e,i){let r=t.clone();const o=document.createElement("table"),n=document.createElement("canvas");n.style.height="20px",n.style.width="100%",n.style.marginTop="10px",n.style.border="1px solid black";const a=new tf({label:"Min value",value:r.min.toString(),onchange:t=>{r.min=Number.parseFloat(t),Yu(n,r)}});o.appendChild(a.row);const c=new tf({label:"Mid value",value:(r.mid||r.min).toString(),onchange:t=>{r.mid=Number.parseFloat(t),Yu(n,r)}});o.appendChild(c.row);const l=new tf({label:"Max value",value:r.max.toString(),onchange:t=>{r.max=Number.parseFloat(t),Yu(n,r)}});o.appendChild(l.row);const h=new ef({label:"Min color",value:r.minColor,onchange:t=>{r.minColor=t,Yu(n,r)}});o.appendChild(h.row);const d=new ef({label:"Mid color",value:r.midColor||r.minColor,onchange:t=>{r.midColor=t,Yu(n,r)}});o.appendChild(d.row);const u=new ef({label:"Max color",value:r.maxColor,onchange:t=>{r.maxColor=t,Yu(n,r)}});o.appendChild(u.row);const f=new Zu({selected:"diverging"===t.type,label:"Diverging Scale",onchange:t=>{t?(r.mid=r.min<0&&r.max>0?0:(r.min+r.max)/2,r.midColor="rgb(255,255,255)",r=new ju(r),c.value=String(r.mid),c.show(),d.value=r.midColor,d.show(),Yu(n,r)):(r=new Wu(r),c.hide(),d.hide(),Yu(n,r))}});f.elem.style.marginBottom="20px","diverging"!==t.type&&(c.hide(),d.hide());const p=document.createElement("div");p.appendChild(f.elem),p.appendChild(o),p.appendChild(n);const g=new w({parent:e,content:{elem:p},okHandler:()=>{i&&i(r)}});e.appendChild(g.elem),s(g.elem),Yu(n,r)}}class Ju{constructor({label:t,value:e,onchange:i}){this.row=document.createElement("tr");const r=document.createElement("td");this.row.appendChild(r);const s=document.createElement("div");s.innerHTML=t,r.appendChild(s)}hide(){this.row.style.display="none"}show(){this.row.style.display="table-row"}}class tf extends Ju{constructor({label:t,value:e,onchange:i}){super({label:t,value:e,onchange:i});const r=document.createElement("td");this.row.appendChild(r),this.input=document.createElement("input"),e=e||"0",this.input.value=uo.sanitize(e),r.appendChild(this.input),i&&this.input.addEventListener("change",t=>i(this.input.value))}get value(){return this.input.value}set value(t){this.input.value=t}}class ef extends Ju{constructor({label:t,value:e,onchange:i}){super({label:t,value:e,onchange:i});const r=document.createElement("td");this.row.appendChild(r);const s=document.createElement("div");r.appendChild(s),s.style.width="20px",s.style.height="20px",s.style.border="1px solid black",this.colorButton=s,e=e||"white",s.style.background=e;const o=new Do(s);o.setOptions({alpha:!1,color:e}),o.onDone=t=>{s.style.background=t.rgbString,i&&i(t.rgbString)}}set value(t){this.colorButton.style.background=t}}class rf extends lc{constructor(t,e){super(t,e)}init(t){super.init(t),this.type="wig",this.featureType="numeric",this.resolutionAware=!0,this._paintAxis=Du.bind(this);const e=t.format?t.format.toLowerCase():t.format;t.featureSource?(this.featureSource=t.featureSource,delete t.featureSource):this.featureSource="bigwig"===e?new Rl(t,this.browser.genome):"tdf"===e?new Pl(t,this.browser.genome):_h(t,this.browser.genome),void 0===t.max||!0===t.autoscale?this.autoscale=!0:this.dataRange={min:t.min||0,max:t.max},t.colorScale&&(this._colorScale=Vu(t.colorScale)),"heatmap"!==t.graphType||t.height||(this.height=20)}async postInit(){const t=await this.getHeader();this.disposed||(t&&this.setTrackProperties(t),this._initialColor=this.color||this.constructor.defaultColor,this._initialAltColor=this.altColor||this.constructor.defaultColor)}get supportsWholeGenome(){return!this.config.indexURL&&!1!==this.config.supportsWholeGenome}get paintAxis(){return"heatmap"===this.graphType?()=>{}:this._paintAxis}get colorScale(){return this._colorScale}async getFeatures(t,e,i,r){const s=this.windowFunction,o=await this.featureSource.getFeatures({chr:t,start:e,end:i,bpPerPixel:r,visibilityWindow:this.visibilityWindow,windowFunction:s});if(this.normalize&&this.featureSource.normalizationFactor){const t=this.featureSource.normalizationFactor;for(let e of o)e.value*=t}if(this.scaleFactor){const t=this.scaleFactor;for(let e of o)e.value*=t}if("dynseq"===this.graphType&&o&&o.length>0)for(let t of o)try{t.sequence=await this.browser.genome.getSequence(t.chr,Math.floor(t.start),Math.floor(t.end))}catch(e){console.warn(`Failed to get sequence for feature at chr: ${t.chr}, start: ${t.start}, end: ${t.end}. Error:`,e),t.sequence=null}return!this.summarize||"mean"!==s&&"min"!==s&&"max"!==s?o:hl(o,e,r,s)}menuItemList(){const t=[];return"heatmap"===this.graphType?(t.push("<hr>"),t.push({label:"Set color scale",click:function(){Xu.open(this.colorScale,this.browser.columnContainer,t=>{this._colorScale=t,this.trackView.repaintViews()})}})):void 0!==this.flipAxis&&(t.push("<hr>"),t.push({label:"Flip y-axis",click:function(){this.flipAxis=!this.flipAxis,this.trackView.repaintViews()}})),t.push(...this.graphTypeItems()),this.featureSource.windowFunctions&&t.push(...this.wigSummarizationItems()),t.push(...this.numericDataMenuItems()),t}wigSummarizationItems(){const t=this.featureSource.windowFunctions,e=[];e.push("<hr/>"),e.push("<div>Windowing function</div>");for(const i of t){function r(){this.windowFunction=i,this.trackView.updateViews()}e.push({element:ic(i,this.windowFunction===i),click:r})}return e}graphTypeItems(){const t=["bar","line","points","heatmap","dynseq"],e=[];e.push("<hr/>"),e.push("<div>Graph type</div>");for(const i of t){function r(){this.graphType=i,this.trackView.repaintViews()}e.push({element:ic(i,this.graphType===i),click:r})}return e}async getHeader(){return"function"==typeof this.featureSource.getHeader&&(this.header=await this.featureSource.getHeader()),this.header}getScaleFactor(t,e,i,r){const s=!0===r?t<0?-Math.log10(Math.abs(t)+1):Math.log10(Math.abs(t)+1):t;return i/((!0===r?Math.log10(Math.abs(e)+1):e)-s)}computeYPixelValue(t,e){return(this.flipAxis?t-this.dataRange.min:this.dataRange.max-t)*e}computeYPixelValueInLogScale(t,e){let i=this.dataRange.max,r=this.dataRange.min;return r=r<0?-Math.log10(Math.abs(r)+1):Math.log10(Math.abs(r)+1),i=i<0?-Math.log10(Math.abs(i)+1):Math.log10(Math.abs(i)+1),t=t<0?-Math.log10(Math.abs(t)+1):Math.log10(t+1),(this.flipAxis?t-r:i-t)*e}draw(t){const e=t.features,i=t.context,r=t.bpPerPixel,s=t.bpStart,o=t.pixelWidth,n=t.pixelHeight-1,a=s+o*r+1,c=this.getScaleFactor(this.dataRange.min,this.dataRange.max,n,this.logScale),l=t=>this.logScale?this.computeYPixelValueInLogScale(t,c):this.computeYPixelValue(t,c);if(e&&e.length>0&&(void 0===this.dataRange.min&&(this.dataRange.min=0),this.dataRange.max>this.dataRange.min)){let o,c=-1;const h=l(0);for(let d of e){if(d.end<s)continue;if(d.start>a)break;const e=(d.start-s)/r;if(Number.isNaN(e))continue;let u=l(d.value);const f=(d.end-s)/r-e,p=t.alpha?ur.addAlpha(this.getColorForFeature(d),t.alpha):this.getColorForFeature(d);if("line"===this.graphType)void 0!==o&&go.strokeLine(i,c,o,e,u,{fillStyle:p,strokeStyle:p}),go.strokeLine(i,e,u,e+f,u,{fillStyle:p,strokeStyle:p});else if("points"===this.graphType){const t=this.config.pointSize||3,r=e+f/2;go.fillCircle(i,r,u,t/2,{fillStyle:p,strokeStyle:p}),d.value>this.dataRange.max?go.fillCircle(i,r,t/2,t/2,{fillStyle:this.overflowColor}):d.value<this.dataRange.min&&go.fillCircle(i,r,n-t/2,t/2,{fillStyle:this.overflowColor})}else if("heatmap"===this.graphType){this._colorScale||(this._colorScale=this.dataRange.min<0&&this.dataRange.max>0?Qu(this.dataRange.min,0,this.dataRange.max):qu(this.dataRange.min,this.dataRange.max));const t=this._colorScale.getColor(d.value);go.fillRect(i,e,0,f,n,{fillStyle:t})}else if("dynseq"===this.graphType&&r<2)this.renderDynSeq(i,d,e,f,u,h,n);else{const t=Math.min(n,u-h);go.fillRect(i,e,h,f,t,{fillStyle:p}),d.value>this.dataRange.max?go.fillRect(i,e,0,f,3,{fillStyle:this.overflowColor}):d.value<this.dataRange.min&&go.fillRect(i,e,n-2,f,3,{fillStyle:this.overflowColor})}c=e+f,o=u}if(this.dataRange.min<0){let e=this.dataRange.max,r=this.dataRange.min;r=!0===this.logScale?r<0?-Math.log10(Math.abs(r)+1):Math.log10(Math.abs(r)+1):r,e=!0===this.logScale?e<0?-Math.log10(Math.abs(e)+1):Math.log10(Math.abs(e)+1):e;const s=e/(e-r),o=this.flipAxis?(1-s)*n:s*n;go.strokeLine(i,0,o,t.pixelWidth,o,{strokeStyle:this.baselineColor})}}if(this.config.hasOwnProperty("guideLines"))for(let e of this.config.guideLines)if(e.hasOwnProperty("color")&&e.hasOwnProperty("y")&&e.hasOwnProperty("dotted")){let i=l(e.y),r={strokeStyle:e.color,strokeWidth:2};e.dotted?go.dashedLine(t.context,0,i,t.pixelWidth,i,5,r):go.strokeLine(t.context,0,i,t.pixelWidth,i,r)}}renderDynSeq(t,e,i,r,s,o,n){const a=e.sequence;if(!a){const a=Math.min(n,s-o),c=this.getColorForFeature(e);return void go.fillRect(t,i,o,r,a,{fillStyle:c})}const c=Math.min(s,o),l=Math.max(1,Math.abs(s-o)),h=r/a.length,d=e.value<0;for(let e=0;e<a.length;e++){const r=i+e*h,s=a[e].toUpperCase(),o=this.browser.nucleotideColors[s]||"gray";this.drawLetterGlyph(t,s,r,c,h,l,o,d)}e.value>this.dataRange.max?go.fillRect(t,i,0,r,3,{fillStyle:this.overflowColor}):e.value<this.dataRange.min&&go.fillRect(t,i,n-2,r,3,{fillStyle:this.overflowColor})}drawLetterGlyph(t,e,i,r,s,o,n,a=!1){const c={A:{main:"M 0 100 L 33 0 L 66 0 L 100 100 L 75 100 L 66 75 L 33 75 L 25 100 L 0 100",overlay:"M 41 55 L 50 25 L 58 55 L 41 55"},C:{main:"M 100 28 C 100 -13 0 -13 0 50 C 0 113 100 113 100 72 L 75 72 C 75 90 30 90 30 50 C 30 10 75 10 75 28 L 100 28"},G:{main:"M 100 28 C 100 -13 0 -13 0 50 C 0 113 100 113 100 72 L 100 48 L 55 48 L 55 72 L 75 72 C 75 90 30 90 30 50 C 30 10 75 5 75 28 L 100 28"},T:{main:"M 0 0 L 0 20 L 35 20 L 35 100 L 65 100 L 65 20 L 100 20 L 100 0 L 0 0"},N:{main:"M 0 100 L 0 0 L 20 0 L 80 75 L 80 0 L 100 0 L 100 100 L 80 100 L 20 25 L 20 100 L 0 100"}},l=c[e]||c.N;t.save(),t.fillStyle=n,a&&(t.translate(i+s/2,r+o/2),t.scale(1,-1),t.translate(-(i+s/2),-(r+o/2))),this.drawSVGPath(t,l.main,i,r,s,o),l.overlay&&(t.fillStyle="#ffffff",this.drawSVGPath(t,l.overlay,i,r,s,o)),t.restore()}drawSVGPath(t,e,i,r,s,o){const n=s/100,a=o/100;t.beginPath();const c=e.match(/[MLC][^MLC]*/g)||[];for(let e of c){const s=e[0],o=e.slice(1).trim().split(/[\s,]+/).map(Number);"M"===s?t.moveTo(i+o[0]*n,r+o[1]*a):"L"===s?t.lineTo(i+o[0]*n,r+o[1]*a):"C"===s&&o.length>=6&&t.bezierCurveTo(i+o[0]*n,r+o[1]*a,i+o[2]*n,r+o[3]*a,i+o[4]*n,r+o[5]*a)}t.closePath(),t.fill()}popupData(t,e){if(void 0===e&&(e=this.clickedFeatures(t)),e&&e.length>0){const i=t.genomicLocation,r=[];e.sort(function(t,e){return Math.abs((t.start+t.end)/2-i)-Math.abs((e.start+e.end)/2-i)});const s=e.length>10?e.slice(0,10):e;s.sort(function(t,e){return t.start-e.start});for(let t of s)if(t){r.length>0&&r.push("<hr/>");let e=t.end-t.start===1?F(Math.floor(t.start)+1):F(Math.floor(t.start)+1)+"-"+F(Math.floor(t.end));r.push({name:"Position:",value:e}),r.push({name:"Value: ",value:F(t.value.toFixed(4))})}return s.length<e.length&&r.push("<hr/>..."),r}return[]}getColorForFeature(t){let e=t.value<0&&this.altColor?this.altColor:this.color||rf.defaultColor;return"function"==typeof e?e(t.value):e}getState(){const t=super.getState();return this._colorScale&&(t.colorScale=this._colorScale.toJson()),t}dispose(){this.trackView=void 0}}rf.defaultColor="rgb(150, 150, 150)",rf.defaults={height:50,flipAxis:!1,logScale:!1,windowFunction:"mean",graphType:"bar",normalize:void 0,scaleFactor:void 0,overflowColor:"rgb(255, 32, 255)",baselineColor:"lightGray",summarize:!0,visibilityWindow:void 0};const sf={threshold:2e3,r:0,g:0,b:255};class of{constructor(t){t=t||sf,this.threshold=t.threshold,this.r=t.r,this.g=t.g,this.b=t.b,this.cache=[],this.nbins=2e3,this.binsize=this.threshold/this.nbins}setThreshold(t){this.threshold=t,this.cache=[],this.binsize=this.threshold/this.nbins}getThreshold(){return this.threshold}setColorComponents(t){this.r=t.r,this.g=t.g,this.b=t.b,this.cache=[]}getColorComponents(){return{r:this.r,g:this.g,b:this.b}}equals(t){return JSON.stringify(this)===JSON.stringify(t)}getColor(t){const e=Math.floor(Math.min(this.threshold,t)/this.binsize);if(void 0===this.cache[e]){const i=(cr(t,0,this.threshold)-0)/(this.threshold-0);this.cache[e]=`rgba(${this.r},${this.g},${this.b}, ${i})`}return this.cache[e]}stringify(){return this.threshold+","+this.r+","+this.g+","+this.b}static parse(t){if(t.startsWith("R:")){const i=t.substring(2).split(":"),r=new RatioColorScale(Number.parseFloat(i[0]));return r.positiveScale=e(i[1]),r.negativeScale=e(i[2]),r}return e(t);function e(t){const e=t.split(","),i={threshold:Number(e[0]),r:Number(e[1]),g:Number(e[2]),b:Number(e[3])};return new of(i)}}}const nf="None";class af extends lc{constructor(t,e){super(t,e),this.groups=new Map}init(t){if(super.init(t),"maf"===this.type&&(this.type="mut"),this.sortDirections=new Map,this.sampleKeys=[],this.groups=new Map,this.sampleHeight=this.squishedRowHeight,t.samples){for(let e of t.samples)this.sampleKeys.push(e);this.explicitSamples=!0}t.color?this.color=t.color:t.colorTable?this.colorTable=new Gr(t.colorTable):"mut"===this.type?this.colorTable=new Gr(hf):(this.posColorScale=new Wu(t.posColorScale||cf),this.negColorScale=new Wu(t.negColorScale||lf));const e=Object.assign({},this.config);e.maxWGCount=e.maxWGCount||Number.MAX_SAFE_INTEGER,this.featureSource=_h(e,this.browser.genome),this.initialSort=t.sort}async postInit(){"function"==typeof this.featureSource.getHeader&&(this.header=await this.featureSource.getHeader(),this.disposed)||(this.header&&this.setTrackProperties(this.header),this._initialColor=this.color||this.constructor.defaultColor,this._initialAltColor=this.altColor||this.constructor.defaultColor,this.didTrackDragEnd=void 0,this.browser.on("trackdragend",()=>this.didTrackDragEnd=!0))}menuItemList(){const t=[];if(!0===Cu(this.browser.sampleInfo,this.sampleKeys)){t.push("<hr/>"),t.push("Sort by attribute:");for(const r of this.browser.sampleInfo.attributeNames){if(this.sampleKeys.some(t=>{const e=this.browser.sampleInfo.getAttributes(t);return e&&e[r]})){const s=document.createElement("div");function o(){this.sortByAttribute(r)}s.innerHTML=` ${r.split(mu.emptySpaceReplacement).join(" ")}`,t.push({element:s,click:o})}}}t.push("<hr/>"),t.push("Group by attribute:");for(const n of[nf,...this.browser.sampleInfo.attributeNames]){let a=!1;a=nf===n?nf===this.groupBy:n===this.groupBy;const c=ic(n,a);t.push({element:c,click:function(){this.groupByAttribute(n)}})}const e={SQUISHED:"Squish",EXPANDED:"Expand",FILL:"Fill"};t.push("<hr/>"),t.push("DisplayMode:");const i="seg"===this.type?["SQUISHED","EXPANDED","FILL"]:["SQUISHED","EXPANDED"];for(let l of i)t.push({element:ic(e[l],l===this.displayMode),click:function(){this.displayMode=l,this.config.displayMode=l,this.trackView.checkContentHeight(),this.trackView.repaintViews(),this.createGroupLabels()}});return t}hasSamples(){return!0}getSamples(){const t=nf!==this.groupBy?this.sampleKeys.map(t=>this.getGroupIndex(t)):void 0;return{names:this.sampleKeys||[],height:this.sampleHeight,yOffset:0,groups:this.groups,groupIndeces:t,groupMarginHeight:Au}}filter(t){const e=this._trackFilterObjects||[];if(0===e.length)return!0;for(const i of e){const e=(i.scores||{})[t];if("seg"===this.type){if(">"===i.op){if(!(e>i.value))return!1}else if("<"===i.op&&!(e<i.value))return!1}else if("mut"===this.type||"maf"===this.type){if(!("HAS"===i.op?e:!e))return!1}}return!0}getState(){const t=super.getState();if(this._trackFilterObjects&&this._trackFilterObjects.length>0){const e=this._trackFilterObjects.map(t=>{const{scores:e,...i}=t;return i});t.filters=e}return t}async getFeatures(t,e,i){const r=await this.featureSource.getFeatures({chr:t,start:e,end:i});if(this.updateSampleKeys(r),this.initialSort){const s=this.initialSort;if(void 0===s.option||"VALUE"===s.option.toUpperCase()){const o=s.chr===t&&s.start>=e&&s.end<=i?r:void 0;this.sortByValue(s,o)}else if("ATTRIBUTE"===s.option.toUpperCase()&&s.attribute){const t="DESC"===s.direction?1:-1;this.sortByAttribute(s.attribute,t)}this.initialSort=void 0}return r}draw({context:t,pixelTop:e,pixelWidth:i,pixelHeight:r,features:s,bpPerPixel:o,bpStart:n}){if(go.fillRect(t,0,e,i,r,{fillStyle:"rgb(255, 255, 255)"}),s&&s.length>0){if(this.checkForLog(s),"shoebox"===this.type&&!this.sbColorScale){const t=this.featureSource.hicFile.percentile95||2e3;this.sbColorScale=new of({threshold:t,r:0,g:0,b:255})}const a={};let c;switch(this.sampleKeys.forEach(function(t,e){a[t]=e}),this.displayMode){case"FILL":this.sampleHeight=(r-(this.groups.size+1)*Au)/this.sampleKeys.length,c=0;break;case"SQUISHED":this.sampleHeight=this.squishedRowHeight,c=0;break;default:this.sampleHeight=this.expandedRowHeight,c=1}const l=this.sampleHeight;for(let t of s)t.pixelRect=void 0;const h=e+r,d=n+i*o+1,u=o;this.sampleYStart=void 0;for(let i of s){if(i.end<n||i.start>d)continue;const r=i.sampleKey||i.sample;i.row=a[r];let s=i.row*l;this.groups.size>1&&(s+=(this.getGroupIndex(r)+1)*Au),void 0===this.sampleYStart&&(this.sampleYStart=s);if(s+l<e||s>h)continue;const o=Math.max(i.start,n);let f=Math.round((o-n)/u);const p=Math.min(i.end,d),g=Math.round((p-n)/u);let m,w,b=Math.max(1,g-f);if(this.color?m="function"==typeof this.color?this.color(i):this.color:this.colorTable&&(m=this.colorTable.getColor(i.value.toLowerCase())),"mut"===this.type)w=l-2*c,b<3&&(b=3,f-=1);else{let t=i.value;this.isLog||(t=lr(t/2)),m=t<-.1?this.negColorScale.getColor(t):t>.1?this.posColorScale.getColor(t):"white";let e=l;if(l<.25){const i=.1+2*Math.abs(t);e=Math.min(1,i*l)}w=e-2*c}i.pixelRect={x:f,y:s,w:b,h:w},t.fillStyle=m,t.fillRect(f,s,b,w)}nf!==this.groupBy&&_u(t,e,i,r,0,this.sampleHeight,this.groups)}}getGroupIndex(t){const e=this.browser.sampleInfo.getAttributeValue(t,this.groupBy)||"";return this.groups.has(e)?this.groups.get(e).index:this.groups.size}checkForLog(t){if(void 0===this.isLog){this.isLog=!1;for(let e of t)if(e.value<0)return void(this.isLog=!0)}}computePixelHeight(t){if(!t)return 0;const e="SQUISHED"===this.displayMode?this.squishedRowHeight:this.expandedRowHeight;return this.sampleKeys.length*e+(this.groups.size>1?(this.groups.size+1)*Au:0)}async sortByValue(t,e){const i=t.chr,r=void 0!==t.position?t.position-1:t.start,s=void 0===t.end?r+1:t.end,o=await this.computeRegionScores({chr:i,start:r,end:s},e),n="ASC"===t.direction?1:-1;this.sampleKeys.sort(function(t,e){let i=o?o[t]:void 0,r=o?o[e]:void 0;return i||(i=n*Number.MAX_VALUE),r||(r=n*Number.MAX_VALUE),i===r?0:i>r?n:-1*n}),nf!==this.groupBy&&(this.sampleKeys=this.browser.sampleInfo.sortSampleKeysByAttribute(this.sampleKeys,this.groupBy,1)),this.config.sort=t,this.trackView.repaintViews()}async computeRegionScores(t,e){const i=t.chr;let r,s;if(t.position?(r=t.position-1,s=r+1):(r=t.start,s=t.end),e||(e=await this.featureSource.getFeatures({chr:i,start:r,end:s})),!e)return;this.updateSampleKeys(e);const o={},n=s-r+1;for(let t of e){if(t.end<r)continue;if(t.start>s)break;const e=t.sampleKey||t.sample;if("mut"===this.type)o[e]=(o[e]||0)+1;else{const i=Math.max(r,t.start),a=(Math.min(s,t.end)-i)/n;o[e]=(o[e]||0)+a*t.value}}return o}sortByAttribute(t,e){e=e||this.sortDirections.get(t)||1,this.sampleKeys=this.browser.sampleInfo.sortSampleKeysByAttribute(this.sampleKeys,t,e),nf!==this.groupBy&&(this.sampleKeys=this.browser.sampleInfo.sortSampleKeysByAttribute(this.sampleKeys,this.groupBy,1)),this.config.sort={option:"ATTRIBUTE",attribute:t,direction:1===e?"ASC":"DESC"},this.sortDirections.set(t,-1*e),this.trackView.repaintViews()}groupByAttribute(t){if(this.groupBy=t,this.groups.clear(),nf!==t){this.sampleKeys=this.browser.sampleInfo.sortSampleKeysByAttribute(this.sampleKeys,t,1);const e=this.sampleKeys;for(let i of e){const e=this.browser.sampleInfo.getAttributeValue(i,t)||"";e&&(this.groups.has(e)?this.groups.get(e).count+=1:this.groups.set(e,{index:this.groups.size,count:1}))}}this.trackView.checkContentHeight(),this.trackView.repaintViews(),this.createGroupLabels()}createGroupLabels(){const t=this.trackView.getLastViewport();if(t.overlayElement.innerHTML="",0===this.groups.size)return;let e;switch(this.displayMode){case"EXPANDED":e=this.expandedRowHeight;break;case"SQUISHED":e=this.squishedRowHeight;break;default:e=(t.viewportElement.getBoundingClientRect().height-(this.groups.size-1)*Au)/this.sampleKeys.length}let i=Au;for(const r of this.groups.keys()){const s=document.createElement("div");s.className="igv-attribute-group-label",t.overlayElement.appendChild(s),s.innerText=r,s.style.top=`${i}px`,i+=this.groups.get(r).count*e+Au}}clickedFeatures(t){const e=super.clickedFeatures(t),i=t.y;return e.filter(function(t){const e=t.pixelRect;return e&&i>=e.y&&i<=e.y+e.h})}hoverText(t){const e=this.clickedFeatures(t);if(e&&e.length>0)return`${e[0].sample}: ${e[0].value}`}popupData(t,e){void 0===e&&(e=this.clickedFeatures(t));const i=[];for(let t of e){i.length>0&&(i.push("<hr/>"),i.push("<hr/>"));const e=t._f||t,r="function"==typeof e.popupData?e.popupData(this.type,this.browser.genome.id):this.extractPopupData(e,void 0);Array.prototype.push.apply(i,r)}return i}contextMenuItemList(t){const{genomicLocation:e,referenceFrame:i,viewport:r}=t,s=t=>{const e=r.cachedFeatures;this.sortByValue(t,e)},o=i.toBP(2.5),n=["DESC","ASC"].map(t=>{const r="DESC"===t?"descending":"ascending";return{label:"seg"===this.type||"shoebox"===this.type?`Sort by value (${r})`:`Sort by count (${r})`,click:()=>{const r={option:"VALUE",direction:t,chr:i.chr,start:Math.floor(e-o),end:Math.floor(e+o)};s(r)}}});return n.push("<hr/>"),n}get supportsWholeGenome(){return(!1===this.config.indexed||!this.config.indexURL)&&!1!==this.config.supportsWholeGenome}updateSampleKeys(t){if(this.explicitSamples)return;let e=!1;const i=new Set(this.sampleKeys);for(let r of t){const t=r.sampleKey||r.sample;if(!i.has(t)){const r=this.sampleKeys;r.push(t),this.sampleKeys=r,i.add(t),e=!0}}e&&nf!==this.groupBy&&this.groupByAttribute(this.groupBy)}}af.defaults={type:"seg",groupBy:nf,isLog:void 0,displayMode:"EXPANDED",height:300,maxHeight:500,squishedRowHeight:2,expandedRowHeight:13};const cf={low:.1,high:1.5,lowColor:"rgb(255,255,255)",highColor:"rgb(255,0,0)"},lf={low:-1.5,high:-.1,lowColor:"rgb(0,0,255)",highColor:"rgb(255,255,255)"},hf={indel:"rgb(0,200,0)","targeted region":"rgb(236,155,43)",truncating:"rgb(\t150,0,0)","non-coding transcript":"rgb(0,0,150)",synonymous:"rgb(109,165,95)",silent:"rgb(109,135,80)",missense_mutation:"rgb(72,130,187)",missense:"rgb(72,130,187)","splice site":"rgb(143,83,155)",splice_region:"rgb(143,83,155)",nonsense:"rgb(216, 57,81)",nonsense_mutation:"rgb(216, 57,81)",frame_shift_del:"rgb(226,135,65)",frame_shift_ins:"rgb(226,135,65)",in_frame_del:"rgb(247,235,94)",in_frame_ins:"rgb(247,235,94)","*other*":"rgb(159,91,50)"},df={fr:{F1R2:"LR",F2R1:"LR",F1F2:"LL",F2F1:"LL",R1R2:"RR",R2R1:"RR",R1F2:"RL",R2F1:"RL"},rf:{R1F2:"LR",R2F1:"LR",R1R2:"LL",R2R1:"LL",F1F2:"RR",F2F1:"RR",F1R2:"RL",F2R1:"RL"},ff:{F2F1:"LR",R1R2:"LR",F2R1:"LL",R1F2:"LL",R2F1:"RR",F1R2:"RR",R2R1:"RL",F1F2:"RL"}};class uf{constructor(t){this.paired=!0,this.firstAlignment=t,this.chr=t.chr,this.readName=t.readName;const e=t.mate.position;t.start<e?(this.start=t.start,this.scStart=t.scStart,this.connectingStart=t.start+t.lengthOnRef,this.connectingEnd=e):(this.start=e,this.scStart=this.start,this.connectingStart=e,this.connectingEnd=t.start),this.end=Math.max(e,t.start+t.lengthOnRef),this.lengthOnRef=this.end-this.start;let i=Math.max(this.end,t.scStart+t.scLengthOnRef);this.scLengthOnRef=i-this.scStart}setSecondAlignment(t){this.secondAlignment=t;const e=this.firstAlignment;t.start>e.start?this.connectingEnd=t.start:this.connectingStart=t.start+t.lengthOnRef,this.start=Math.min(e.start,t.start),this.end=Math.max(e.start+e.lengthOnRef,t.start+t.lengthOnRef),this.lengthOnRef=this.end-this.start,this.scStart=Math.min(e.scStart,t.scStart);const i=Math.max(e.scStart+e.scLengthOnRef,t.scStart+t.scLengthOnRef);this.scLengthOnRef=i-this.scStart}containsLocation(t,e){const i=e?this.scStart:this.start,r=e?this.scLengthOnRef:this.lengthOnRef;return t>=i&&t<=i+r}alignmentContaining(t,e){return this.firstAlignment.containsLocation(t,e)?this.firstAlignment:this.secondAlignment&&this.secondAlignment.containsLocation(t,e)?this.secondAlignment:void 0}async popupData(t,e,i){let r=await this.firstAlignment.popupData(t,e,i);return this.secondAlignment&&(r.push("-------------------------------"),r=r.concat(await this.secondAlignment.popupData(t,e,i))),r}isPaired(){return!0}isMateMapped(){return!0}isProperPair(){return this.firstAlignment.isProperPair()}isFirstOfPair(){return this.firstAlignment.isFirstOfPair()}isSecondOfPair(){return this.firstAlignment.isSecondOfPair()}isSecondary(){return!1}isSupplementary(){return!1}get strand(){return this.firstAlignment.strand}get mq(){return this.firstAlignment.mq}getBaseModificationSets(){return null}get fragmentLength(){return Math.abs(this.firstAlignment.fragmentLength)}get firstOfPairStrand(){return this.firstAlignment.isFirstOfPair()?this.firstAlignment.strand:this.secondAlignment&&this.secondAlignment.isFirstOfPair()?this.secondAlignment.strand:""}get pairOrientation(){return this.firstAlignment.pairOrientation}hasTag(t){return this.firstAlignment.hasTag(t)||!(!this.secondAlignment||!this.secondAlignment.hasTag(t))}getTag(t){const e=this.firstAlignment.getTag(t),i=this.secondAlignment?this.secondAlignment.getTag(t):void 0;return void 0!==e&&void 0!==i&&e!==i?`${e} / ${i}`:void 0!==e?e:i}getAlignmentAtGenomicLocation(t){return this.firstAlignment.containsLocation(t)?this.firstAlignment:this.secondAlignment&&this.secondAlignment.containsLocation(t)?this.secondAlignment:void 0}getGroupValue(t,e){var i,r,s;let o,n,a;if(t.startsWith("tag:"))o=t.substring(4),t="tag";else if(t.startsWith("base:")||t.startsWith("insertion:")){const e=t.split(":");3===e.length&&(t=e[0],n=e[1],a=Number.parseInt(e[2].replace(/,/g,""))-1)}switch(t){case"strand":return String(this.firstAlignment.strand)+(this.secondAlignment?String(this.secondAlignment.strand):"");case"firstOfPairStrand":return String(this.firstOfPairStrand);case"mateChr":case"readOrder":default:return"";case"pairOrientation":return(null===(i=df[e])||void 0===i?void 0:i[this.pairOrientation])||"";case"chimeric":return this.hasTag("SA")?"chimeric":"";case"supplementary":return this.firstAlignment.isSupplementary()||this.secondAlignment&&this.secondAlignment.isSupplementary()?"supplementary":"";case"phase":return String(null!==(r=this.getTag("HP"))&&void 0!==r?r:"");case"tag":return String(null!==(s=this.getTag(o))&&void 0!==s?s:"");case"base":if(n&&void 0!==a){const t=this.getAlignmentAtGenomicLocation(a);if(t&&t.readBaseAt){const e=t.readBaseAt(a);return e||"GAP"}}return"";case"insertion":if(n&&void 0!==a){const t=this.getAlignmentAtGenomicLocation(a);if(t&&t.insertionAtGenomicLocation&&t.seq){const e=t.insertionAtGenomicLocation(a);return e?t.seq.substring(e.seqOffset,e.seqOffset+e.len):""}}return""}}}class ff{static getKey(t,e,i){const r=""+t+e+i;return ff.instances.has(r)||ff.instances.set(r,new ff(t,e,i)),ff.instances.get(r)}constructor(t,e,i){this.base=t,this.strand=e,this.modification=i,this.canonicalBase="+"===this.strand?this.base:nn(this.base)}getCanonicalBase(){return this.canonicalBase}toString(){return""+this.base+this.strand+this.modification}static compare(t,e){const i=t.modification,r=e.modification;return i===r?t.strand.charCodeAt(0)-e.strand.charCodeAt(0):pf.has(i)&&pf.has(r)?pf.get(i)-pf.get(r):pf.has(i)?1:pf.has(r)?-1:i>r?1:-1}}ff.instances=new Map;const pf=new Map(["NONE_C","NONE_T","NONE_G","NONE_A","m","h","f","c","C","g","e","b","T","U","a","A","o","G","n","N"].map((t,e)=>[t,e]));class gf{constructor(t,e,i,r){this.base=t,this.modification=i,this.strand=e,this.likelihoods=r,this.canonicalBase="+"==this.strand?this.base:nn(this.base),this.key=ff.getKey(t,e,i)}containsPosition(t){return this.likelihoods.has(t)}is5mC(){return"m"===this.modification&&("C"===this.base&&"+"===this.strand||"G"===this.base&&"-"===this.strand)}fullName(){return mf.get(this.modification)||this.modification}}const mf=new Map;mf.set("m","5mC"),mf.set("h","5hmC"),mf.set("f","5fC"),mf.set("c","5caC"),mf.set("g","5hmU"),mf.set("e","5fU"),mf.set("b","5caU"),mf.set("a","6mA"),mf.set("o","8xoG"),mf.set("n","Xao"),mf.set("C","Unknown C"),mf.set("T","Unknown T"),mf.set("A","Unknown A"),mf.set("G","Unknown G"),mf.set("N","Unknown");const wf=new Map([["m","5mC"],["h","5hmC"],["f","5fC"],["c","5caC"],["g","5hmU"],["e","5fU"],["b","5caU"],["a","6mA"],["o","8xoG"],["n","Xao"],["C","Unknown C"],["T","Unknown T"],["A","Unknown A"],["G","Unknown G"],["N","Unknown"]]),bf=new Set;function Ff(t){return wf.has(t)?wf.get(t):"Unknown"}function vf(t){if(!t)return!1;const e=t.length;if(0==e)return!1;for(let i=0;i<e;i++){const e=t.charAt(i);if(e<"0"||e>"9")return!1}return!0}function yf(t){return t<0?t+256:t}class Af{constructor(){this.allModifications=new Set,this.simplexModifications=new Set,this.maxLikelihoods=new Map,this.nomodLikelihoods=new Map}incrementCounts(t){if(!t.blocks)return;const e=t.getBaseModificationSets();if(e&&e instanceof Array)for(let i of t.blocks)if("S"!==i.type)for(let t=0;t<i.len;t++){let r,s=t+i.seqOffset,o=0,n=-1,a=255;for(let t of e){const e=ff.getKey(t.base,t.strand,t.modification);this.allModifications.add(e);const i=t.likelihoods;if(t.containsPosition(s)){const c=yf(i.get(s));a-=c,c>n&&(o=t.canonicalBase,n=c,r=e)}}if(0!=o){const e=i.start+t,s=ff.getKey(o,"+","NONE_"+o);this.allModifications.add(s);const c=(t,e,i,r)=>{let s=r.get(i);s||(s=new Map,r.set(i,s));let o=s.get(t);o||(o=[],s.set(t,o)),o.push(e)};c(e,n,r,this.maxLikelihoods),a>n?c(e,a,s,this.nomodLikelihoods):c(e,n,r,this.nomodLikelihoods)}}}getCount(t,e,i,r){this.lastThreshold=i;const s=255*i,o=r?this.nomodLikelihoods.get(e):this.maxLikelihoods.get(e);if(!o)return 0;const n=o.get(t);if(n){let t=0;for(let e of n){yf(e)>=s&&t++}return t}return 0}getLikelihoodSum(t,e,i,r){this.lastThreshold=i;const s=255*i,o=(r?this.nomodLikelihoods.get(e):this.maxLikelihoods.get(e)).get(t);if(o){let t=0;for(let e of o){const i=yf(e);i>=s&&(t+=i)}return t}return 0}popupData(t,e){const i=[];i.push("<b>Modifications with likelihood > "+100*this.lastThreshold+"%</b>");for(let r of this.maxLikelihoods.keys()){if(this.maxLikelihoods.get(r).has(t)){let s="basemod2"===e;const o=this.getCount(t,r,this.lastThreshold,s);if(o>0){const e=this.getLikelihoodSum(t,r,this.lastThreshold,s)/o*.3921568,n=Ff(r.modification);i.push(n+" ("+r.base+r.strand+"): "+o+" @ average likelihood "+Math.round(e)+"%")}}}return i}computeSimplex(){const t=new Set(Array.from(this.allModifications).filter(t=>"-"===t.strand).map(t=>t.modification));for(let e of this.allModifications)"+"!==e.strand||t.has(e.modification)||(this.simplexModifications.add(e.modification),this.simplexModifications.add("NONE_"+e.getCanonicalBase()))}}class Cf{constructor(){this.alignments=[],this.score=void 0}findAlignment(t,e=!1){const i=(t,i)=>i>=t.start&&i<t.start+(e?t.fragmentLength:t.lengthOnRef);let r;for(let s=0;s<this.alignments.length;s++){const o=this.alignments[s];if(t>=o.start&&t<o.start+(e?o.fragmentLength:o.lengthOnRef)){o.paired?o.firstAlignment&&i(o.firstAlignment,t)?r=o.firstAlignment:o.secondAlignment&&i(o.secondAlignment,t)&&(r=o.secondAlignment):r=o;break}}return r}getSortValue({position:t,option:e,tag:i,sortAsPairs:r},s){e||(e="BASE");const o=this.findAlignment(t,r);if(void 0===o)return Number.MAX_VALUE;switch(e){case"NUCLEOTIDE":case"BASE":return function(t,e,i){var r;let s;const o=Math.floor(i)-e.start;e.sequence&&o<e.sequence.length&&(s=e.sequence.charAt(o));if(!s)return 0;const n=t.readBaseAt(i),a=null!==(r=t.readBaseQualityAt(i))&&void 0!==r?r:30,c=e.coverageMap,l=Math.floor(i-c.bpStart),h=c.coverage[l];let d=0;if(t.insertions)for(let e of t.insertions)e.start===i&&(d=-h.ins);if(n)if(s=s.toUpperCase(),"N"===n&&0===d)d=2;else if(s!==n&&"="!==n||0!==d){if("X"===n||s!==n){d-=h["pos"+n]+h["neg"+n]+a/1e3}}else d=4-a/1e3;else{const t=h.del;t>0?d-=t:0===d&&(d=1)}return d}(o,s,t);case"strand":return o.strand?1:-1;case"START":return o.start;case"TAG":{const t=o.getTag(i);return null==t||Array.isArray(t)?void 0:t}case"READ_NAME":return o.readName;case"INSERT_SIZE":return-Math.abs(o.fragmentLength);case"GAP_SIZE":return-o.gapSizeAt(t);case"MATE_CHR":return o.mate?o.mate.chr:Number.MAX_VALUE;case"MQ":return void 0===o.mq?Number.MAX_VALUE:-o.mq;case"ALIGNED_READ_LENGTH":return-o.lengthOnRef;default:return Number.MAX_VALUE}}}var _f;class xf{constructor(t,e,i,{samplingWindowSize:r,samplingDepth:s,alleleFreqThreshold:o,colorBy:n}){_f.set(this,[]),this.baseModificationKeys=new Set,this.alleleFreqThreshold=void 0===o?.2:o,this.samplingWindowSize=r||100,this.samplingDepth=s||1e3,this.chr=t,this.start=Math.floor(e),this.end=Math.ceil(i),this.length=i-e,this.coverageMap=new If(t,e,i,this.alleleFreqThreshold),this.downsampledIntervals=[],n&&n.startsWith("basemod")&&(this.baseModCounts=new Af),this.alignments=[],this.pairsCache=new Map,this.downsampledReads=new Set,this.currentBucket=new kf(this.start,this.start+this.samplingWindowSize,this),this.hasPairs=!1}pack({viewAsPairs:t,showSoftClips:e,expectedPairOrientation:i,groupBy:r,displayMode:s}){let o=this.allAlignments();o=t?function(t){const e=new Map,i=t.map(t=>{if(Mf(t)){let i=e.get(t.readName);return i?(i.setSecondAlignment(t),e.delete(t.readName),i):(i=new uf(t),e.set(t.readName,i),i)}return t});return i}(o):function(t){return t.flatMap(t=>t instanceof uf?[t.firstAlignment,t.secondAlignment].filter(t=>!!t):[t])}(o),this.packAlignmentRows(o,e,i,r,s),this.alignments&&delete this.alignments}packAlignmentRows(t,e,i,r,s){bo(this,_f,[],"f");const o=(t,i)=>{t.sort(function(t,i){return e?t.scStart-i.scStart:t.start-i.start});const r=new Nf(i);let s,o=0,n=0;const a=new Set,c=()=>{s=new Cf,r.push(s),o=0,n=0,a.clear()};for(c();t.length>0;)if(n>=0&&n<t.length){const i=t[n];a.add(i),s.alignments.push(i),o=e?i.scStart+i.scLengthOnRef+2:i.start+i.lengthOnRef+2,n=Rf(t,t=>(e?t.scStart:t.start)>o,n)}else t=t.filter(t=>!a.has(t)),c();return r},n=(t,e)=>{t.sort(function(t,e){return t.start-e.start});const i=new Nf(e),{start:r,end:s}=this.viewport.genomicRange();for(let e of t)if(e.end<r||e.start>s)wo(this,_f,"f").push(e);else{const t=new Cf;t.alignments.push(e),i.push(t)}return i};if(t&&0!==t.length){const e=new Map;if(r)for(let s of t){const t=s.getGroupValue(r,i)||"";e.has(t)||e.set(t,[]),e.get(t).push(s)}else e.set("",t);const a=new Map,c=Array.from(e.keys()).sort(function(t){switch(t){case"pairOrientation":return function(){const t=["LL","RR","RL","LR",""];return(e,i)=>t.indexOf(e)-t.indexOf(i)}();case"strand":case"firstOfPairStrand":return Tf;default:return t&&t.startsWith("base:")?Bf:Lf}}(r));for(let t of c){const i=e.get(t),r="FULL"===s?n(i,t):o(i,t);a.set(t,r)}this.packedGroups=a}}push(t){this.hasPairs=this.hasPairs||t.isPaired(),this.coverageMap.incCounts(t);const e=t.getBaseModificationSets();if(e)for(let t of e)this.baseModificationKeys.add(t.key);this.baseModCounts&&this.baseModCounts.incrementCounts(t),this.downsampledReads.has(t.readName)?this.currentBucket.downsampledCount++:(t.start>=this.currentBucket.end&&(this.finishBucket(),this.currentBucket=new kf(t.start,t.start+this.samplingWindowSize,this)),this.currentBucket.addAlignment(t))}finish(){void 0!==this.currentBucket&&this.finishBucket(),this.hasAlignments=this.alignments.length>0,this.alignments.sort(function(t,e){return t.start-e.start}),this.baseModCounts&&this.baseModCounts.computeSimplex(),delete this.currentBucket,delete this.pairsCache,delete this.downsampledReads}contains(t,e,i){return this.chr===t&&this.start<=e&&this.end>=i}hasDownsampledIntervals(){return this.downsampledIntervals&&this.downsampledIntervals.length>0}finishBucket(){this.alignments=this.alignments.concat(this.currentBucket.alignments),this.currentBucket.downsampledCount>0&&this.downsampledIntervals.push(new Ef(this.currentBucket.start,this.currentBucket.end,this.currentBucket.downsampledCount))}allAlignments(){if(this.alignments)return this.alignments;if(this.packedGroups){const t=Array.from(this.packedGroups.values()).flatMap(t=>t.rows.flatMap(t=>t.alignments));if(wo(this,_f,"f")&&wo(this,_f,"f").length>0)for(let e of wo(this,_f,"f"))t.push(e);return t}return[]}getMax(t,e){return this.coverageMap.getMax(t,e)}sortRows(t){if(this.packedGroups)for(let e of this.packedGroups.values())e.sortRows(t,this)}}_f=new WeakMap;class kf{constructor(t,e,{samplingDepth:i,downsampledReads:r,pairsCache:s}){this.start=t,this.end=e,this.alignments=[],this.downsampledCount=0,this.samplingDepth=i,this.downsampledReads=r,this.pairsCache=s,this.hasPairs=!1}addAlignment(t){this.hasPairs=this.hasPairs||t.isPaired();const e=this.hasPairs?Math.ceil(this.samplingDepth/2):this.samplingDepth;if(Mf(t)){const e=this.pairsCache.get(t.readName);if(e)return e.setSecondAlignment(t),void this.pairsCache.delete(t.readName)}if(this.alignments.length<e)if(Mf(t)){const e=new uf(t);this.pairsCache.set(t.readName,e),this.alignments.push(e)}else this.alignments.push(t);else{const i=Math.floor(Math.random()*(e+this.downsampledCount-1));if(i<e){const e=this.alignments[i];if(this.pairsCache.has(e.readName)&&this.pairsCache.delete(e.readName),Mf(t)){const e=new uf(t);this.pairsCache.set(t.readName,e),this.alignments[i]=e}else this.alignments[i]=t;this.downsampledReads.add(e.readName)}else this.downsampledReads.add(t.readName);this.downsampledCount++}}}class If{constructor(t,e,i,r){this.chr=t,this.bpStart=e,this.length=i-e,this.coverage=new Array(this.length),this.maximum=0,this.threshold=r,this.qualityWeight=!0}getMax(t,e){let i=0;const r=this.coverage.length;for(let s=0;s<r;s++){const r=this.bpStart+s;if(r>e)break;const o=this.coverage[s];r>=t&&o&&(i=Math.max(i,o.total))}return i}incCounts(t){const e=this;if(void 0===t.blocks?i(t):t.blocks.forEach(function(t){i(t)}),t.gaps)for(let i of t.gaps)if("D"===i.type){const t=i.start-e.bpStart;for(let r=t;r<t+i.len;r++)r<0||(this.coverage[r]||(this.coverage[r]=new Sf(e.threshold)),this.coverage[r].del++)}if(t.insertions)for(let i of t.insertions){const t=i.start-this.bpStart;t<0||(this.coverage[t]||(this.coverage[t]=new Sf(e.threshold)),this.coverage[t].ins++)}function i(i){if("S"===i.type)return;const r=t.seq,s=t.qual,o=i.seqOffset;for(let n=i.start-e.bpStart,a=0;a<i.len;n++,a++){e.coverage[n]||(e.coverage[n]=new Sf(e.threshold));const i=null==r?"N":r.charAt(o+a),c=t.strand?"pos"+i:"neg"+i,l=Array.isArray(s)&&o+a<s.length?s[o+a]:30;e.coverage[n][c]+=1,e.coverage[n]["qual"+i]+=l,e.coverage[n].total+=1,e.coverage[n].qual+=l,e.maximum=Math.max(e.coverage[n].total,e.maximum)}}}getPosCount(t,e){const i=t-this.bpStart;if(i<0||i>=this.coverage.length)return 0;const r=this.coverage[i];if(!r)return 0;switch(e){case"A":case"a":return r.posA;case"C":case"c":return r.posC;case"T":case"t":return r.posT;case"G":case"g":return r.posG;case"N":case"n":return r.posN;default:return 0}}getNegCount(t,e){const i=t-this.bpStart;if(i<0||i>=this.coverage.length)return 0;const r=this.coverage[i];if(!r)return 0;switch(e){case"A":case"a":return r.negA;case"C":case"c":return r.negC;case"T":case"t":return r.negT;case"G":case"g":return r.negG;case"N":case"n":return r.negN;default:return 0}}getCount(t,e){return this.getPosCount(t,e)+this.getNegCount(t,e)}getTotalCount(t){const e=t-this.bpStart;return e>=0&&e<this.coverage.length&&this.coverage[e]?this.coverage[e].total:0}}class Sf{constructor(t){this.posA=0,this.negA=0,this.posT=0,this.negT=0,this.posC=0,this.negC=0,this.posG=0,this.negG=0,this.posN=0,this.negN=0,this.pos=0,this.neg=0,this.qualA=0,this.qualT=0,this.qualC=0,this.qualG=0,this.qualN=0,this.qual=0,this.total=0,this.del=0,this.ins=0,this.qualityWeight=!0,this.threshold=t}hoverText(){const t=this.posA+this.posT+this.posC+this.posG+this.posN,e=this.negA+this.negT+this.negC+this.negG+this.negN;return`${this.total} (${t}+, ${e}-)`}isMismatch(t){const e=this.threshold*(this.qualityWeight&&this.qual?this.qual:this.total);let i=0;for(let e of["A","T","C","G"])e!==t&&(i+=this.qualityWeight&&this.qual?this["qual"+e]:this["pos"+e]+this["neg"+e]);return i>=e}}class Ef{constructor(t,e,i){this.start=t,this.end=e,this.counts=i}popupData(t){return[{name:"start",value:Math.floor(this.start+1)},{name:"end",value:this.end},{name:"# downsampled:",value:this.counts}]}}class Nf{constructor(t){this.pixelTop=0,this.pixelBottom=0,this.rows=[],this.name=t}push(t){this.rows.push(t)}get length(){return this.rows.length}sortRows(t,e){const i=[],r=[];for(let e of this.rows){void 0!==e.findAlignment(t.position,t.sortAsPairs)?i.push(e):r.push(e)}i.sort((i,r)=>{const s=t.direction,o=i.getSortValue(t,e),n=r.getSortValue(t,e);if(void 0===o&&void 0!==n)return 1;if(void 0!==o&&void 0===n)return-1;const a=o>n?1:o<n?-1:0;return!0===s?a:-a});for(let t of r)i.push(t);this.rows=i}}function Mf(t){return t.isPaired()&&null!=t.mate&&t.isMateMapped()&&t.chr===t.mate.chr&&(t.isFirstOfPair()||t.isSecondOfPair())&&!(t.isSecondary()||t.isSupplementary())}function Rf(t,e,i){let r=i-1,s=t.length;for(;1+r<s;){const i=r+(s-r>>1);e(t[i])?s=i:r=i}return s}const Df=new Map([["A",1],["T",2],["C",3],["G",4],["N",5],["GAP",5],["",7]]);function Bf(t,e){return Df.has(t)&&Df.has(e)?Df.get(t)-Df.get(e):t.localeCompare(e,void 0,{sensitivity:"base"})}function Tf(t,e){return t===e?0:t&&e?-t.localeCompare(e):t?1:-1}function Lf(t,e){if(t||e){if(t){if(e){if(t===e)return 0;if(jo(t)&&jo(e))return Number.parseFloat(t)-Number.parseFloat(e);{let i=t.toString(),r=e.toString();return i.localeCompare(r,void 0,{sensitivity:"base"})}}return-1}return 1}return 0}class zf{constructor(t){const e=t.split(",");this.chr=e[0],this.start=parseInt(e[1]),this.strand=e[2].charAt(0),this.mapQ=parseInt(e[4]),this.numMismatches=parseInt(e[5]),this.lenOnRef=function(t){let e=0,i="";for(let r=0;r<t.length;r++){const s=t.charCodeAt(r);if(s>47&&s<58)i+=t.charAt(r);else{switch(s){case 78:case 68:case 77:case 61:case 88:e+=parseInt(i.toString())}i=""}}return e}(e[3])}printString(){return this.chr+":"+F(this.start)+"-"+F(this.start+this.lenOnRef)+" ("+this.strand+") = "+F(this.lenOnRef)+"bp @MAPQ: "+this.mapQ+" NM: "+this.numMismatches}}function Pf(t){return t.split(";").filter(t=>t.length>0).map(t=>new zf(t))}const Of={timeout:5e3,type:"plain",url:"https://igv.org/genomes/locus.php?genome=$GENOME$&name=$FEATURE$",coords:0};async function Hf(t,e){const i=t.searchConfig||Of;let r;if(e=e.toUpperCase(),r=await t.genome.getManeTranscript(e),r)return r;const s=t.tracks.filter(t=>t.searchable);for(let t of s){const i=await t.search(e);if(i)return i}if(t.config&&!1!==t.config.search)try{return r=await async function(t,e,i){let r=i.url.replace("$FEATURE$",e.toUpperCase());r.indexOf("$GENOME$")>-1&&(r=r.replace("$GENOME$",t.genome.id?t.genome.id:"hg19"));const s=i.timeout?{timeout:i.timeout}:void 0,o=await Er.loadString(r,s);return await async function(t,e,i){let r;r="plain"===i.type?await async function(t,e){const i=[],r=v(e);for(let e of r){const r=e.split("\t");if(r.length>=3){const e=r[1].split(":"),s=e[1].split("-");i.push({chromosome:t.genome.getChromosomeName(e[0].trim()),start:parseInt(s[0].replace(/,/g,"")),end:parseInt(s[1].replace(/,/g,"")),name:r[0].toUpperCase()})}}return i}(t,e):JSON.parse(e);i.resultsField&&(r=r[i.resultsField]);if(!r||Array.isArray(r)&&0===r.length)return;{const t=i.chromosomeField||"chromosome",e=i.startField||"start",s=i.endField||"end",o=i.coords||1;let n;n=Array.isArray(r)?r[0]:r,n.hasOwnProperty(t)&&n.hasOwnProperty(e)||console.error("Search service results must include chromosome and start fields: "+n);const a=n[t];let c=n[e]-o,l=n[s];void 0===l&&(l=c+1);const h={chr:a,start:c,end:l};if(i.geneField&&i.snpField){const t=n[i.geneField]||n[i.snpField];t&&(h.name=t.toUpperCase())}return h}}(t,o,i)}(t,e,i),r}catch(t){console.log("Search service not available "+t)}}const Uf=console;function Vf(t){if(!t)return!1;return new RegExp("^[A-Za-z0-9_.]+(?:\\([^)]+\\))?:(?:g\\.\\d+.*|c\\.[-*]?\\d+.*|n\\.-?\\d+.*|p\\.[A-Za-z*]*\\d+.*)$").test(t)}async function qf(t,e){return Hf(t,e)}function Qf(t,e){if(e<=0){const i=Math.abs(e);return"+"===t.strand?t.getStart()-i:t.getEnd()+i}const i=t.exons;if(!i||0===i.length)return"+"===t.strand?t.getStart()+e-1:t.getEnd()-e+1;const r="+"===t.strand;let s=0;const o=i.slice();r?o.sort((t,e)=>t.start-e.start):o.sort((t,e)=>e.start-t.start);for(const t of o){const i=t.end-t.start;if(s+i>=e){const i=e-s-1;return r?t.start+i:t.end-i-1}s+=i}return-1}function Gf(t,e){if(e<=0)return-1;const i=e-1,r=t.exons;if(!r)return-1;const s="+"===t.strand;let o=0;for(let t=0;t<r.length;t++){const e=s?r[t]:r[r.length-1-t],n=Sh(e);if(o+n>i){const t=i-o;return s?kh(e)+t:Ih(e)-1-t}o+=n}return-1}function Wf(t){return{A:"T",T:"A",C:"G",G:"C"}[t]||t}function jf(t,e,i){if(i){let r=0;for(let s=0;s<i.length;s++){const o=e?i[s]:i[i.length-1-s];if(o.start<=t&&o.end>t){return r+(e?t-kh(o):Ih(o)-t-1)}r+=Sh(o)}}return-1}const $f={isValidHGVS:Vf,search:async function(t,e){if(!Vf(t))return null;const i=e.genome,r=t.indexOf(":g."),s=t.indexOf(":c."),o=t.indexOf(":p."),n=t.indexOf(":n.");let a,c;if(r>=0)a="g",c=r;else if(s>=0)a="c",c=s;else if(n>=0)a="n",c=n;else{if(!(o>=0))return null;a="p",c=o}let l=t.substring(0,c);if(l.endsWith(")")){const t=l.lastIndexOf("(");t>0&&(l=l.substring(0,t))}const h=t.substring(c+3);if("g"===a){if(!h)return null;const t=h.match(/^\(?(\d+)(?:_(\d+|\?))?/);if(!t)return null;const e=parseInt(t[1],10),r=t[2],s=r&&"?"!==r?parseInt(r,10):e,o=await i.getAliasRecord(l);return{chr:o?o.chr:l,start:e-1,end:s}}if("p"===a)return null;if("n"===a){const t=await qf(e,l);if(!t)return null;const i=h.match(/^(-?\d+)(?:_(-?\d+))?([+-]\d+)?/);if(!i)return null;const r=parseInt(i[1],10),s=i[2],o=null!=s?parseInt(s,10):r;let n=Qf(t,r),a=Qf(t,o);if(n<=0||a<=0)return null;const c=i[3];if(c){let e=parseInt(c,10);"-"===t.strand&&(e=-e),n+=e,a+=e}const d=Math.min(n,a),u=Math.max(n,a)+1;return{chr:t.chr,start:d,end:u}}{const t=await qf(e,l);if(t){const e=h.match(/^-(\d+)(?:_-(\d+))?([+-]\d+)?/);if(e){const i=parseInt(e[1],10),r=e[2],s=null!=r?parseInt(r,10):null,o=Gf(t,1);if(o>0){let r="+"===t.strand?o-i:o+i,n=r;null!=s&&(n="+"===t.strand?o-s:o+s);const a=e[3];if(a){let e=parseInt(a,10);"-"===t.strand&&(e=-e),r+=e,n+=e}const c=Math.min(r,n),l=Math.max(r,n)+1;return{resultType:"LOCUS",chr:t.chr,start:c,end:l}}return null}const i=h.match(/^\*(\d+)(?:_\*(\d+))?([+-]\d+)?/);if(i){const e=parseInt(i[1],10),r=i[2],s=null!=r?parseInt(r,10):null;let o=0;if(t.exons)for(const e of t.exons)o+=Sh(e);if(o>0){const r=Gf(t,o);if(r>0){let o="+"===t.strand?r+e:r-e,n=o;null!=s&&(n="+"===t.strand?r+s:r-s);const a=i[3];if(a){let e=parseInt(a,10);"-"===t.strand&&(e=-e),o+=e,n+=e}const c=Math.min(o,n),l=Math.max(o,n)+1;return{resultType:"LOCUS",chr:t.chr,start:c,end:l}}}return null}const r=h.match(/^(\d+)(?:_(\d+))?/);if(!r)return null;const s=parseInt(r[1],10),o=r[2],n=null!=o?parseInt(o,10):s;let a=Gf(t,s),c=Gf(t,n);if(a<=0||c<=0)return null;const l=h.match(/^(\d+)([+-]\d+)?(?:_(\d+)([+-]\d+)?)?/);if(l){const e=l[2],i=l[4];if(e){let i=parseInt(e,10);"-"===t.strand&&(i=-i),a+=i}if(i){let e=parseInt(i,10);"-"===t.strand&&(e=-e),c+=e}}null==o&&(c=a);const d=Math.min(a,c),u=Math.max(a,c)+1;return{chr:t.chr,start:d,end:u}}return null}},getHGVSPosition:async function(t,e,i){try{const r=await t.getAliasRecord(e);let s=null;if(r)for(const t of Object.values(r))if(t.startsWith("NC_")||t.startsWith("NT_")||t.startsWith("NW_")||t.startsWith("NG_")||t.startsWith("NM_")||t.startsWith("NR_")||t.startsWith("NP_")){s=t;break}return s||(s=e),`${s}:g.${i}`}catch(t){return void Uf.error("Error getting HGVS position",t)}},createHGVSAnnotation:async function(t,e,i,r,s){try{const o=await t.getManeTranscriptAt(e,i);if(o&&o.exons){r=r.toUpperCase(),s=s.toUpperCase(),"-"===o.strand&&(r=Wf(r),s=Wf(s));let t="",e=o.name;for(const t of Object.keys(o)){const i=o[t];if("string"==typeof i&&(i.startsWith("NM_")||i.startsWith("NR_"))){e=i;break}}if(e){let r=!1;for(const t of o.exons)if(i>=t.start&&i<t.end){r=!0;break}const s="+"===o.strand;if(r){const r=jf(i,s,o.exons);if(r>=0)t=`${e}:c.${r+1}`;else{const r=Gf(o,1);if(r>0){let n=0;for(const t of o.exons)n+=Sh(t);const a=Gf(o,n);if(s&&i<r||!s&&i>r){t=`${e}:c.-${Math.abs(i-r)}`}else if(s&&i>=a||!s&&i<=a){t=`${e}:c.*${Math.abs(i-a)+1}`}}}}else{let r=-1,n=-1,a=Number.MAX_SAFE_INTEGER;for(const t of o.exons){if(0===Sh(t))continue;const e=Math.abs(i-t.start);e>0&&e<a&&(a=e,r=t.start,n=jf(kh(t),s,o.exons));const c=Math.abs(i-(t.end-1));c>0&&c<a&&(a=c,r=t.end-1,n=jf(Ih(t)-1,s,o.exons))}if(n>=0){let o=i-r;s||(o=-o);t=`${e}:c.${n+1}${o>=0?"+":""}${o}`}}}return t+r+">"+s}const n=await t.getAliasRecord(e);let a=e;if(n)for(const t of Object.values(n))if(t.startsWith("NC_")||t.startsWith("NT_")||t.startsWith("NW_")||t.startsWith("NG_")||t.startsWith("NM_")||t.startsWith("NR_")||t.startsWith("NP_")){a=t;break}return`${a}:g.${i+1}${r}>${s}`}catch(t){return void Uf.error("Error creating HGVS annotation",t)}}};const Kf={getClinVarURL:async function(t){try{const e=`https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=clinvar&term=${encodeURIComponent(t)}&retmode=json`,i=await fetch(e,{headers:{"User-Agent":"igv.js"}});if(!i.ok)return console.error(`HTTP error! status: ${i.status}`),null;const r=(await i.json()).esearchresult;if(r.count>0){return`https://www.ncbi.nlm.nih.gov/clinvar/variation/${r.idlist[0]}/`}return null}catch(t){return console.error("Error fetching ClinVar URL",t),null}}};class Zf{constructor(){this.hidden=!1}isMapped(){return!(4&this.flags)}isPaired(){return!!(1&this.flags)}isProperPair(){return!!(2&this.flags)}isFirstOfPair(){return!!(64&this.flags)}isSecondOfPair(){return!!(128&this.flags)}isSecondary(){return!!(256&this.flags)}isSupplementary(){return!!(2048&this.flags)}isFailsVendorQualityCheck(){return!!(512&this.flags)}isDuplicate(){return!!(1024&this.flags)}isMateMapped(){return!(8&this.flags)}isNegativeStrand(){return!!(16&this.flags)}isMateNegativeStrand(){return!!(32&this.flags)}hasTag(t){return this.tagDict.hasOwnProperty(t)}getTag(t){return this.tagDict[t]}get firstOfPairStrand(){if(this.isPaired()){if(this.isFirstOfPair())return this.strand;if(this.isMateMapped())return this.mate.strand}}containsLocation(t,e){const i=e?this.scStart:this.start,r=e?this.scLengthOnRef:this.lengthOnRef;return t>=i&&t<=i+r}async popupData(t,e,i,r,s){const o=[];if(t=Math.floor(t),this.insertions){const e=this.seq;for(let i of this.insertions){var n=i.start;if(t===n||t===n-1)return o.push({name:"Insertion",value:e.substr(i.seqOffset,i.len)}),o.push({name:"Location",value:n}),o}}o.push({name:"Read Name",value:this.readName});const a=this.readBaseAt(t);if(r&&a&&a!==r&&"*"!==a){const e=await $f.createHGVSAnnotation(s,this.chr,t,r,a);if(e){const t=await Kf.getClinVarURL(e);t?o.push({name:"ClinVar",value:`<a href='${t}' target='_blank'>${e}</a>`}):o.push({name:"HGVS",value:e})}}o.push("<hr/>"),o.push({name:"Alignment Start",value:F(1+this.start),borderTop:!0}),o.push({name:"Read Strand",value:!0===this.strand?"(+)":"(-)",borderTop:!0});let c=this.cigar;if(c&&c.length>50){const t=25;c=`${c.substring(0,t-2)} ... ${c.substring(c.length-t+2)}`}o.push({name:"Cigar",value:c}),o.push({name:"Mapping Quality",value:this.mq}),o.push({name:"Secondary",value:d(this.isSecondary())}),o.push({name:"Supplementary",value:d(this.isSupplementary())}),o.push({name:"Duplicate",value:d(this.isDuplicate())}),o.push({name:"Failed QC",value:d(this.isFailsVendorQualityCheck())}),this.isPaired()&&(o.push("<hr/>"),o.push({name:"First in Pair",value:d(!this.isSecondOfPair()),borderTop:!0}),o.push({name:"Mate is Mapped",value:d(this.isMateMapped())}),this.pairOrientation&&o.push({name:"Pair Orientation",value:this.pairOrientation}),this.isMateMapped()&&(o.push({name:"Mate Chromosome",value:this.mate.chr}),o.push({name:"Mate Start",value:this.mate.position+1}),o.push({name:"Mate Strand",value:!0===this.mate.strand?"(+)":"(-)"}),o.push({name:"Insert Size",value:this.fragmentLength})));const l=this.tagDict;if(l.hasOwnProperty("SA")){o.push("<hr/>"),o.push({name:"Supplementary Alignments",value:""});const t=Pf(l.SA);if(t){o.push("<ul>");for(let e of t)o.push(`<li>${e.printString()}</li>`);o.push("</ul>")}}o.push("<hr/>");for(let t in l){const r=l[t],s=Array.isArray(r)?r.join(", "):null!=r?r:"";(null==i?void 0:i.has(t))?o.push({name:t,value:s}):i?e.add(t):e.has(t)||o.push({name:t,value:s})}e&&e.size>0&&o.push({name:"Hidden Tags",value:Array.from(e).join(", ")}),o.push("<hr/>"),o.push({name:"Genomic Location: ",value:F(1+t)}),o.push({name:"Read Base:",value:a}),o.push({name:"Base Quality:",value:this.readBaseQualityAt(t)});const h=this.getBaseModificationSets();if(h){const e=this.positionToReadIndex(t);if(void 0!==e){let t=!1;for(let i of h)if(i.containsPosition(e)){t||(o.push("<hr/>"),o.push("<b>Base modifications:</b>"),t=!0);const r=Math.round(100/255*yf(i.likelihoods.get(e)));o.push(`${i.fullName()} @ likelihood = ${r}%`)}}}return o;function d(t){return t?"Yes":"No"}}readBaseAt(t){const e=this.blockAtGenomicLocation(t);if(e){if("*"===this.seq)return"*";{const i=e.seqIndexAt(t);return this.seq[i]}}}readBaseQualityAt(t){const e=this.blockAtGenomicLocation(t);if(e){if("*"===this.qual)return 30;{const i=e.seqIndexAt(t);return i>=0&&this.qual&&i<this.qual.length?this.qual[i]:30}}}gapSizeAt(t){if(this.gaps)for(let e of this.gaps)if(t>=e.start&&t<e.start+e.len)return e.len;return 0}softClippedBlocks(){let t,e,i=!1;for(let r of this.blocks)"S"===r.type?i?e=r:t=r:"H"!==r.type&&(i=!0);return{left:t,right:e}}getBaseModificationSets(){if(!this.baseModificationSets&&(this.tagDict.MM||this.tagDict.Mm)){const t=this.tagDict.MM||this.tagDict.Mm,e=this.tagDict.ML||this.tagDict.Ml;!b(t)||e&&!Array.isArray(e)||(0===t.length?this.baseModificationSets=Yf:this.baseModificationSets=function(t,e,i,r){if(!i)return bf;r&&(i=cn(i));const s=[],o=t.split(";");let n=0;for(let t of o){const o=t.split(","),a=o[0].charAt(0),c=o[0].charAt(1),l=o[0].endsWith(".");if(1==o.length);else{const t=o[0].endsWith(".")||o[0].endsWith("?")?o[0].substring(2,o[0].length-1):o[0].substring(2);let h=[];if(t.length>1)if(vf(t))h.push(t);else for(let e=0;e<t.length;e++)h.push(t.substring(e,e+1));else h.push(t);const d=new Map;for(let t of h)d.set(t,new Map);let u=1,f=Number.parseInt(o[u++]),p=0,g=0;for(;p<i.length;){if("N"===a||i[p]===a){const t=r?i.length-1-p:p;if(g===f){for(let i of h){const r=e?e[n++]:255;d.get(i).set(t,r)}if(u<o.length)f=Number.parseInt(o[u++]),g=0;else{if(!l)break;f=-1}}else{if(l)for(let e of h)d.get(e).set(t,0);g++}}p++}for(let t of h)s.push(new gf(a,c,t,d.get(t)))}}return s}(t,e,this.seq,this.isNegativeStrand()))}return this.baseModificationSets}positionToReadIndex(t){const e=this.blockAtGenomicLocation(t);return e?t-e.start+e.seqOffset:void 0}blockAtGenomicLocation(t){const e=this.blocks;for(let i=0;i<e.length;i++){const r=e[i];if(t>=r.start&&t<r.start+r.len)return r}}insertionAtGenomicLocation(t){if(this.insertions)for(let e of this.insertions){if(t===e.start)return e}}getGroupValue(t,e){var i,r,s;let o,n,a;if(t.startsWith("tag:"))o=t.substring(4),t="tag";else if(t.startsWith("base:")||t.startsWith("insertion:")){const e=t.split(":");3===e.length&&(t=e[0],n=e[1],a=Number.parseInt(e[2].replace(/,/g,""))-1)}switch(t){case"strand":return this.strand?"+":"-";case"firstOfPairStrand":{const t=this.firstOfPairStrand;return void 0===t?"":t?"+":"-"}case"mateChr":return this.mate&&this.isMateMapped()?this.mate.chr:"";case"pairOrientation":return(null===(i=df[e])||void 0===i?void 0:i[this.pairOrientation])||"";case"chimeric":return this.hasTag("SA")?"chimeric":"";case"supplementary":return this.isSupplementary()?"supplementary":"";case"readOrder":return this.isPaired()&&this.isFirstOfPair()?"first":this.isPaired()&&this.isSecondOfPair()?"second":"";case"phase":return String(null!==(r=this.getTag("HP"))&&void 0!==r?r:"");case"tag":return String(null!==(s=this.getTag(o))&&void 0!==s?s:"");case"base":if(this.chr===n&&this.start<=a&&this.end>a){const t=this.readBaseAt(a);return t||"GAP"}return"";case"insertion":if(this.chr===n&&this.start<=a&&this.end>a){const t=this.insertionAtGenomicLocation(a);return t?this.seq.substring(t.seqOffset,t.seqOffset+t.len):""}return"";default:return}}}const Yf=new Set;class Xf{constructor(t){t&&Object.assign(this,t)}seqIndexAt(t){return Math.floor(t)-this.start+this.seqOffset}}class Jf{constructor(t){t=t||{},this.vendorFailed=!1!==t.vendorFailed;const e=void 0!==t.duplicate?t.duplicate:t.duplicates;this.duplicate=!1!==e,this.secondary=t.secondary||!1,this.supplementary=t.supplementary||!1,this.mq=t.mq||0,t.readgroups&&(this.readgroups=new Set(t.readgroups))}pass(t){if(!t.isMapped())return!1;if(this.vendorFailed&&t.isFailsVendorQualityCheck())return!1;if(this.duplicate&&t.isDuplicate())return!1;if(this.secondary&&t.isSecondary())return!1;if(this.supplementary&&t.isSupplementary())return!1;if(t.mq<this.mq)return!1;if(this.readgroups){const e=t.getTag("RG");return this.readgroups.has(e)}return!0}}const tp=ap(new Uint8Array([66,65,77,1]),0),ep=["=","A","C","M","G","R","S","V","T","W","Y","H","K","D","B","N"],ip=["M","I","D","N","S","H","P","=","X","?","?","?","?","?","?","?"],rp={c:1,C:1,s:2,S:2,i:4,I:4,f:4},sp=1e4,op={readHeader:async function(t,e,i){const r=er(await Er.loadArrayBuffer(t,e));return op.decodeBamHeader(r,i)},decodeBamHeader:function(t,e){const i=ap(t,0);if(i!==tp)throw new Error("BAM header errror: bad magic number. This could be caused by either a corrupt or missing file.");const r=ap(t,4);let s="";for(var o=0;o<r;++o)s+=String.fromCharCode(t[o+8]);const n=ap(t,r+8);let a=r+12;const c={},l=[];for(o=0;o<n;++o){const e=ap(t,a);let i="";for(var h=0;h<e-1;++h)i+=String.fromCharCode(t[a+4+h]);c[i]=o,l[o]=i,a=a+8+e}return{magicNumber:i,size:a,chrNames:l,chrToIndex:c}},bam_tag2cigar:function(t,e,i,r,s,o){function n(t){return"C"===t||"c"===t||"A"===t?1:"S"===t||"s"===t?2:"I"===t||"i"===t||"f"===t?4:0}if(1!==o.length||s.start<0)return!1;for(var a=i+(r+1>>1)+r;a+4<e;){if("CG"===String.fromCharCode(t[a])+String.fromCharCode(t[a+1]))break;var c=String.fromCharCode(t[a+2]);if("B"===c)a+=8+n(c=String.fromCharCode(t[a+3]))*ap(t,a+4);else if("Z"===c||"H"===c)for(a+=3;0!==t[a++];);else a+=3+n(c)}if(a>=e)return!1;if("B"!==String.fromCharCode(t[a+2])||"I"!==String.fromCharCode(t[a+3]))return!1;var l=ap(t,a+4),h=a+8;if(h+4*l>e)return!1;var d="",u=0;o.length=0,a=h;for(var f=0;f<l;++f,a+=4){var p=ap(t,a),g=p>>4,m=ip[15&p];"M"!==m&&"EQ"!==m&&"X"!==m&&"D"!==m&&"N"!==m&&"="!==m||(u+=g),d=d+g+m,o.push({len:g,ltr:m})}return s.cigar=d,s.lengthOnRef=u,!0},decodeBamRecords:function(t,e,i,r,s,o,n,a){for(;e<t.length;){const u=e+ap(t,e)+4,f=new Zf,p=ap(t,e+4),g=ap(t,e+8);if(u>t.length)return;if(p<0){e=u;continue}if(void 0!==s&&(p>s||p===s&&g>n))return!0;if(void 0!==s&&p<s){e=u;continue}const m=ap(t,e+12),w=(65280&m)>>8,b=255&m,F=ap(t,e+16),v=(4294901760&F)>>16,y=65535&F,A=ap(t,e+20),C=ap(t,e+24),_=ap(t,e+28),x=ap(t,e+32);let k=[];for(let i=0;i<b-1;++i)k.push(String.fromCharCode(t[e+36+i]));k=k.join("");let I=0,S="",E=e+36+b;const N=[];let M;for(let e=0;e<y;++e){var c=ap(t,E),l=c>>4,h=ip[15&c];"M"!==h&&"EQ"!==h&&"X"!==h&&"D"!==h&&"N"!==h&&"="!==h||(I+=l),S=S+l+h,E+=4,M={len:l,ltr:h},N.push(M)}if(f.chr=r[p],f.start=g,f.flags=v,f.strand=!(16&v),f.readName=k,f.cigar=S,f.lengthOnRef=I,f.fragmentLength=x,f.mq=w,op.bam_tag2cigar(t,u,E,A,f,N),f.end=f.start+f.lengthOnRef,f.end<o){e=u;continue}let R=[];const D=A+1>>1;for(let e=0;e<D;++e){var d=t[E+e];R.push(ep[(240&d)>>4]),R.push(ep[15&d])}R=R.slice(0,A).join(""),E+=D;const B=[];for(let e=0;e<A;++e)B.push(t[E+e]);E+=A,C>=0&&(f.mate={chr:r[C],position:_,strand:!(32&v)}),f.seq=R,f.qual=B;const T=new Uint8Array(t.buffer.slice(E,u));f.tagDict=dp(T),this.setPairOrientation(f),(void 0===a||a.pass(f))&&(np(f,N),i.push(f)),e=u}},decodeSamRecords:function(t,e,i,r,s,o){var n,a,c,l,h,d,u,f,p,g;for(l=(n=v(t)).length,a=0;a<l;a++)if(h=n[a].split("\t"),(p=new Zf).chr=h[2],p.start=Number.parseInt(h[3])-1,p.flags=Number.parseInt(h[1]),p.readName=h[0],p.strand=!(16&p.flags),p.mq=Number.parseInt(h[4]),p.cigar=h[5],p.fragmentLength=Number.parseInt(h[8]),p.seq=h[9],"*"!==p.chr&&p.isMapped()&&p.chr===i){if(p.start>s)break;if(f=0,(g=cp(p.cigar)).forEach(function(t){var e=t.len,i=t.ltr;"M"!==i&&"EQ"!==i&&"X"!==i&&"D"!==i&&"N"!==i&&"="!==i||(f+=e)}),p.lengthOnRef=f,!(p.start+f<r)){for(d=h[10],p.qual=[],c=0;c<d.length;c++)p.qual[c]=d.charCodeAt(c)-33;p.tagDict=h.length<11?{}:hp(h.slice(11)),p.isMateMapped()&&(u=h[6],p.mate={chr:"="===u?p.chr:u,position:Number.parseInt(h[7]),strand:!(32&p.flags)}),this.setPairOrientation(p),(void 0===o||o.pass(p))&&(np(p,g),e.push(p))}}},setReaderDefaults:function(t,e){t.filter="function"==typeof e.filter?{pass:e.filter}:new Jf(e.filter),e.readgroup&&(t.filter.readgroups=new Set([e.readgroup])),t.alleleFreqThreshold=void 0===e.alleleFreqThreshold?.2:e.alleleFreqThreshold,t.samplingWindowSize=void 0===e.samplingWindowSize?100:e.samplingWindowSize,t.samplingDepth=void 0===e.samplingDepth?500:e.samplingDepth,t.samplingDepth>sp&&(console.log("Warning: attempt to set sampling depth > maximum value of "+sp),t.samplingDepth=sp)},setPairOrientation:function(t){if(t.isMapped()&&t.mate&&t.isMateMapped()&&t.mate.chr===t.chr){var e=t.strand?"F":"R",i=t.mate,r=i.strand?"F":"R",s=" ",o=" ";t.isFirstOfPair()?(s="1",o="2"):t.isSecondOfPair()&&(s="2",o="1");var n=[],a=t.fragmentLength,c=t.end-t.start;if(0===a)a=(t.start<i.position?i.position+c:i.position-c)-t.start;a>0?(n[0]=e,n[1]=s,n[2]=r,n[3]=o):(n[2]=e,n[3]=s,n[0]=r,n[1]=o),t.pairOrientation=n.join("")}}};function np(t,e){const i=[];let r,s,o=0,n=t.start;t.scStart=t.start,t.scLengthOnRef=t.lengthOnRef;for(let a of e){let e;switch(a.ltr){case"H":case"P":break;case"S":e=n,t.scLengthOnRef+=a.len,0===i.length&&(t.scStart-=a.len,e-=a.len),i.push(new Xf({start:e,seqOffset:o,len:a.len,type:"S"})),o+=a.len;break;case"N":case"D":void 0===s&&(s=[]),s.push({start:n,len:a.len,type:a.ltr}),n+=a.len;break;case"I":void 0===r&&(r=[]),r.push(new Xf({start:n,len:a.len,seqOffset:o,type:"I"})),o+=a.len;break;case"M":case"EQ":case"=":case"X":i.push(new Xf({start:n,seqOffset:o,len:a.len,type:"M"})),o+=a.len,n+=a.len;break;default:console.log("Error processing cigar element: "+a.len+a.ltr)}}t.blocks=i,t.insertions=r,t.gaps=s}function ap(t,e){return t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}function cp(t){var e,i,r,s,o,n,a,c;for(e=[],i=[],o=null,s=t.length,r=0;r<s;r++)lp(n=t.charAt(r))?i.push(n):(a=n,c=Number.parseInt(i.join("")),i=[],null!==o&&o.ltr===a?o.len+=c:(o={len:c,ltr:a},e.push(o)));return e}function lp(t){var e=t.charCodeAt(0);return e>=48&&e<=57}function hp(t){var e={};return t.forEach(function(t){var i=t.split(":");e[i[0]]=i[2]}),e}function dp(t){let e=0;const i=t.length,r={},s=new DataView(t.buffer);for(;e<i;){const i=String.fromCharCode(t[e])+String.fromCharCode(t[e+1]);e+=2;const n=String.fromCharCode(t[e++]);let a;if("A"===n)a=String.fromCharCode(t[e]),e++;else if("i"===n||"I"===n)a=s.getInt32(e,!0),e+=4;else if("c"===n)a=s.getInt8(e),e++;else if("C"===n)a=s.getUint8(e),e++;else if("s"===n||"S"===n)a=s.getInt16(e,!0),e+=2;else if("f"===n)a=s.getFloat32(e,!0),e+=4;else if("Z"===n){let i="";for(;;){var o=t[e++];if(0===o)break;i+=String.fromCharCode(o)}a=i}else{if("B"!==n){a="Error unknown type: "+n,r[i]=a;break}{const o=String.fromCharCode(t[e++]);let n=rp[o];if(void 0===n){r[i]=`Error: unknown element type '${o}'`;break}const c=s.getInt32(e,!0);e+=4;const l=e+c*n,h=[];for(;e<l;){switch(o){case"c":h.push(s.getInt8(e));break;case"C":h.push(s.getUint8(e));break;case"s":h.push(s.getInt16(e,!0));break;case"S":h.push(s.getUint16(e,!0));break;case"i":h.push(s.getInt32(e,!0));break;case"I":h.push(s.getUint32(e,!0));break;case"f":h.push(s.getFloat32(e,!0))}e+=n}a=h}}r[i]=a}return r}var up,fp,pp,gp,mp;class wp{constructor(t,e){up.add(this),this.chrAliasTable=new Map,this.config=t,this.genome=e,this.bamPath=t.url,this.isDataUri=Ko(t.url),op.setReaderDefaults(this,t)}async postInit(){await wo(this,up,"m",fp).call(this)}async readAlignments(t,e,i){this.alignmentCache||await wo(this,up,"m",fp).call(this);const r=this.chromAliasManager?await this.chromAliasManager.getAliasName(t):t,s=this.alignmentCache.queryFeatures(r,e,i),o=new xf(t,e,i,this.config);for(let t of s)o.push(t);return o.finish(),o}}up=new WeakSet,fp=async function(){let t;if(this.isDataUri){t=er(function(t){const e=t.split(","),i=e[0].split(":")[1];let r=e[1];r=i.indexOf("base64")>=0?atob(r):decodeURI(r);const s=new Uint8Array(r.length);for(var o=0;o<r.length;o++)s[o]=r.charCodeAt(o);return s}(this.bamPath).buffer)}else{t=er(await Er.loadArrayBuffer(this.bamPath,Qo(this.config)))}const e=wo(this,up,"m",pp).call(this,t);this.alignmentCache=new Xn(e)},pp=function(t){const e=[];return this.header=op.decodeBamHeader(t),this.chromAliasManager=this.genome?new al(this.header.chrNames,this.genome):null,op.decodeBamRecords(t,this.header.size,e,this.header.chrNames,void 0,0,Number.MAX_SAFE_INTEGER,this.filter),e};class bp{constructor(t,e){gp.add(this),this.chrAliasTable=new Map,this.config=t,this.genome=e,this.bamPath=t.url,this.baiPath=t.indexURL,op.setReaderDefaults(this,t),this._blockLoader=new Wc(t)}async postInit(){await this.getHeader()}async readAlignments(t,e,i){var r;const s=await wo(this,gp,"m",mp).call(this,t),o=new xf(t,e,i,this.config);if(void 0===s)return o;{const t=(await this.getIndex()).chunksForRange(s,e,i);if(!t||0===t.length)return o;for(let n of t){const t=await this._blockLoader.getData(n.minv,n.maxv);if(null!==(r=op.decodeBamRecords(t,n.minv.offset,o,this.header.chrNames,s,e,i,this.filter))&&void 0!==r&&r)break}return o.finish(),o}}async getHeader(){if(!this.header){const t=await this.getIndex();let e;if(t.firstBlockPosition){const i=Qo(this.config,{range:{start:t.firstBlockPosition,size:26}}),r=ir(await Er.loadArrayBuffer(this.bamPath,i));e=t.firstBlockPosition+r}else e=64e3;const i=Qo(this.config,{range:{start:0,size:e}});this.header=await op.readHeader(this.bamPath,i,this.genome)}return this.header}async getIndex(){return this.index||(this.index=await Hc(this.baiPath,this.config)),this.index}async getChrIndex(){if(this.chrToIndex)return this.chrToIndex;{const t=await this.getHeader();return this.chrToIndex=t.chrToIndex,this.indexToChr=t.chrNames,this.chrNames=new Set(t.chrNames),this.chrToIndex}}}gp=new WeakSet,mp=async function(t){var e,i;if(await this.getHeader(),this.chrAliasTable.has(t)&&void 0===(t=this.chrAliasTable.get(t)))return;let r=this.header.chrToIndex[t];if(void 0===r){const s=await(null===(i=(e=this.genome).getAliasRecord)||void 0===i?void 0:i.call(e,t));let o;if(s){const t=Object.keys(s).filter(t=>"start"!==t&&"end"!==t).map(t=>s[t]).filter(t=>void 0!==this.header.chrToIndex[t]);t.length>0&&(o=t[0],r=this.header.chrToIndex[t[0]])}this.chrAliasTable.set(t,o)}return r};class Fp{constructor(t,e){this.config=t,this.genome=e;const i={};t.sources.sequences.forEach(function(r){var s,o;const n=null!==(o=null===(s=null==e?void 0:e.getChromosomeName)||void 0===s?void 0:s.call(e,r))&&void 0!==o?o:r;i[n]=function(t,e,i){const r={url:t.sources.url.replace("$CHR",i)};t.sources.indexURL&&(r.indexURL=t.sources.indexURL.replace("$CHR",i));const s=Object.assign({},t,r);return new bp(s,e)}(t,e,r)}),this.bamReaders=i,op.setReaderDefaults(this,t)}async readAlignments(t,e,i){if(this.bamReaders.hasOwnProperty(t)){let r=this.bamReaders[t];return await r.readAlignments(t,e,i)}return new xf(t,e,i,this.config)}}class vp{constructor(t,e){this.config=t,this.genome=e,op.setReaderDefaults(this,t)}async readAlignments(t,e,i){const r=await this.getHeader(),s=r.chrAliasTable.hasOwnProperty(t)?r.chrAliasTable[t]:t,o=this.config.url+"?reference="+this.config.referenceFile+"&file="+this.config.alignmentFile+"®ion="+s+":"+e+"-"+i,n=await Er.loadString(o,Qo(this.config)),a=new xf(t,e,i,this.config);return op.decodeSamRecords(n,a,s,e,i,this.filter),a}async getHeader(){if(this.header)return this.header;const t=this.config.url+"?file="+this.config.alignmentFile+"&options=-b,-H",e=Qo(this.config),i=await op.readHeader(t,e,this.genome);return this.header=i,i}}class yp extends sl{constructor(t,e){super(t,e),this.chrNames=new Set,this.chromAliasManager=null,op.setReaderDefaults(this,t)}async readAlignments(t,e,i){if("all"===t)return[];if(!this.header){const t=er((await this.readHeaderData()).buffer);this.header=op.decodeBamHeader(t,this.genome);for(let t of this.header.chrNames)this.chrNames.add(t);this.chromAliasManager=this.genome?new al(this.header.chrNames,this.genome):null}let r=t;if(this.chrNames.size>0&&!this.chrNames.has(t)&&this.chromAliasManager&&(r=await this.chromAliasManager.getAliasName(t)),!this.chrNames.has(r))return console.warn("Chromosome "+t+" not found in BAM header"),new xf(t,e,i,this.config);const s=er((await this.readData(r,e,i)).buffer);this.header=op.decodeBamHeader(s,this.genome);const o=this.header.chrToIndex[t],n=new xf(t,e,i,this.config);return op.decodeBamRecords(s,this.header.size,n,this.header.chrNames,o,e,i,this.filter),n.finish(),n}}
|
|
16
|
+
/*! For license information please see cram-bundle.js.LICENSE.txt */var Ap,Cp,_p,xp,kp=(Ap={24:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.toHex=function(t){let e="";for(let i=0,s=t.length;i<s;i++)e+=r[t[i]];return e};const i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],r=new Array(256);for(let t=0;t<256;t++)r[t]=`${i[t>>>4&15]}${i[15&t]}`},78:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const r=i(24),s=[0,1,3,7,15,31,63,127,255];e.default=class{constructor(t){this.stream=t,this.bitOffset=0,this.curByte=0,this.hasByte=!1}_ensureByte(){this.hasByte||(this.curByte=this.stream.readByte(),this.hasByte=!0)}read(t){let e=0;for(;t>0;){this._ensureByte();const i=8-this.bitOffset;if(t>=i)e<<=i,e|=s[i]&this.curByte,this.hasByte=!1,this.bitOffset=0,t-=i;else{e<<=t;const r=i-t;e|=(this.curByte&s[t]<<r)>>r,this.bitOffset+=t,t=0}}return e}seek(t){const e=t%8,i=(t-e)/8;this.bitOffset=e,this.stream.seek(i),this.hasByte=!1}pi(){const t=new Uint8Array(6);for(let e=0;e<t.length;e++)t[e]=this.read(8);return(0,r.toHex)(t)}}},86:(t,e,i)=>{const r=i(1308).A;t.exports=r,t.exports.default=r},500:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=i(6272),o=i(6761),n=r(i(588)),a=r(i(9685)),c=r(i(7480)),l=i(7580),h=i(2549);function d(t,e,i,r){const o=!!(r.mate||void 0!==r.mateRecordNumber&&r.mateRecordNumber!==e);i.readName||(i.readName=String(i.uniqueId),r.readName=i.readName),i.mate={sequenceId:r.sequenceId,alignmentStart:r.alignmentStart,uniqueId:r.uniqueId},r.readName&&(i.mate.readName=r.readName),r.mate||void 0!==r.mateRecordNumber||(r.mate={sequenceId:i.sequenceId,alignmentStart:i.alignmentStart,uniqueId:i.uniqueId},i.readName&&(r.mate.readName=i.readName)),i.flags|=n.default.BAM_FPAIRED,r.flags&n.default.BAM_FUNMAP&&(i.flags|=n.default.BAM_FMUNMAP),i.flags&n.default.BAM_FUNMAP&&(r.flags|=n.default.BAM_FMUNMAP),r.flags&n.default.BAM_FREVERSE&&(i.flags|=n.default.BAM_FMREVERSE),i.flags&n.default.BAM_FREVERSE&&(r.flags|=n.default.BAM_FMREVERSE),void 0===i.templateLength&&(o?function(t,e,i){const r=function e(i){const r=[i];if(void 0!==i.mateRecordNumber&&i.mateRecordNumber>=0){const o=t[i.mateRecordNumber];if(!o)throw new s.CramMalformedError("intra-slice mate record not found, this file seems malformed");r.push(...e(o))}return r}(i),o=r.map(t=>t.alignmentStart),n=r.map(t=>t.alignmentStart+t.readLength-1),a=Math.max(...n)-Math.min(...o)+1;a>=0&&r.forEach(t=>{if(void 0!==t.templateLength)throw new s.CramMalformedError("mate pair group has some members that have template lengths already, this file seems malformed");t.templateLength=a})}(t,0,i):function(t,e){const i=Math.min(t.alignmentStart,e.alignmentStart),r=Math.max(t.alignmentStart+t.readLength-1,e.alignmentStart+e.readLength-1)-i+1;t.templateLength=r,e.templateLength=r}(i,r)),i.mateRecordNumber=void 0}class u{constructor(t,e,i){this.container=t,this.containerPosition=e,this.sliceSize=i,this.file=t.file}async getHeader(){const{majorVersion:t}=await this.file.getDefinition(),e=(0,l.getSectionParsers)(t),i=await this.container.getHeader(),r=await this.file.readBlock(i._endPosition+this.containerPosition);if("MAPPED_SLICE_HEADER"===r.contentType){const t=(0,h.parseItem)(r.content,e.cramMappedSliceHeader.parser,0,i._endPosition);return{...r,parsedContent:t}}if("UNMAPPED_SLICE_HEADER"===r.contentType){const t=(0,h.parseItem)(r.content,e.cramUnmappedSliceHeader.parser,0,i._endPosition);return{...r,parsedContent:t}}throw new s.CramMalformedError(`error reading slice header block, invalid content type ${r.contentType}`)}async getBlocks(){const t=await this.getHeader();let e=t._endPosition;const i=new Array(t.parsedContent.numBlocks);for(let t=0;t<i.length;t++){const r=await this.file.readBlock(e);i[t]=r,e=i[t]._endPosition}return i}async getCoreDataBlock(){return(await this.getBlocks())[0]}async _getBlocksContentIdIndex(){const t=await this.getBlocks(),e={};return t.forEach(t=>{"EXTERNAL_DATA"===t.contentType&&(e[t.contentId]=t)}),e}async getBlockByContentId(t){return(await this._getBlocksContentIdIndex())[t]}async getReferenceRegion(){const t=new TextDecoder("utf8"),e=(await this.getHeader()).parsedContent;if(!(0,l.isMappedSliceHeader)(e))throw new Error("slice header not mapped");if(e.refSeqId<0)return;const i=await this.container.getCompressionScheme();if(void 0===i)throw new Error("compression scheme undefined");if(e.refBaseBlockId>=0){const i=await this.getBlockByContentId(e.refBaseBlockId);if(!i)throw new s.CramMalformedError("embedded reference specified, but reference block does not exist");return{seq:t.decode(i.data),start:e.refSeqStart,end:e.refSeqStart+e.refSeqSpan-1,span:e.refSeqSpan}}if(i.referenceRequired||this.file.fetchReferenceSequenceCallback){if(!this.file.fetchReferenceSequenceCallback)throw new Error("reference sequence not embedded, and seqFetch callback not provided, cannot fetch reference sequence");const t=await this.file.fetchReferenceSequenceCallback(e.refSeqId,e.refSeqStart,e.refSeqStart+e.refSeqSpan-1);if(t.length!==e.refSeqSpan)throw new s.CramArgumentError("seqFetch callback returned a reference sequence of the wrong length");return{seq:t,start:e.refSeqStart,end:e.refSeqStart+e.refSeqSpan-1,span:e.refSeqSpan}}}getAllRecords(){return this.getRecords(()=>!0)}async _fetchRecords(){var t,e;const{majorVersion:i}=await this.file.getDefinition(),r=await this.container.getCompressionScheme();if(void 0===r)throw new Error("compression scheme undefined");const n=await this.getHeader(),u=await this._getBlocksContentIdIndex();if(i>1&&this.file.options.checkSequenceMD5&&(0,l.isMappedSliceHeader)(n.parsedContent)&&n.parsedContent.refSeqId>=0&&"0000000000000000"!==(null===(t=n.parsedContent.md5)||void 0===t?void 0:t.join(""))){const t=await this.getReferenceRegion();if(t){const{seq:i,start:r,end:o}=t,a=(0,h.sequenceMD5)(i),c=null===(e=n.parsedContent.md5)||void 0===e?void 0:e.map(t=>(t<16?"0":"")+t.toString(16)).join("");if(a!==c)throw new s.CramMalformedError(`MD5 checksum reference mismatch for ref ${n.parsedContent.refSeqId} pos ${r}..${o}. recorded MD5: ${c}, calculated MD5: ${a}`)}}const f=await this.getCoreDataBlock(),p={lastAlignmentStart:(0,l.isMappedSliceHeader)(n.parsedContent)?n.parsedContent.refSeqStart:0,coreBlock:{bitPosition:7,bytePosition:0},externalBlocks:{map:new Map,getCursor(t){let e=this.map.get(t);return void 0===e&&(e={bitPosition:7,bytePosition:0},this.map.set(t,e)),e}}},g=t=>{const e=r.getCodecForDataSeries(t);if(!e)throw new s.CramMalformedError(`no codec defined for ${t} data series`);return e.decode(this,f,u,p)},m=new Array(n.parsedContent.numRecords);for(let t=0;t<m.length;t+=1)try{const e=(0,a.default)(this,g,r,n,f,u,p,i,t);m[t]=new c.default({...e,uniqueId:n.contentPosition+n.parsedContent.recordCounter+t+1})}catch(i){if(i instanceof o.CramBufferOverrunError){console.warn("read attempted beyond end of buffer, file seems truncated.");break}throw i}for(let t=0;t<m.length;t+=1){const e=m[t];if(e){const{mateRecordNumber:i}=e;void 0!==i&&i>=0&&m[i]&&d(m,t,e,m[i])}}return m}async getRecords(t){const e=this.container.filePosition+this.containerPosition;let i=this.file.featureCache.get(e.toString());i||(i=this._fetchRecords(),this.file.featureCache.set(e.toString(),i));const r=(await i).filter(t);if(r.length&&this.file.fetchReferenceSequenceCallback){const t=await this.getHeader();if((0,l.isMappedSliceHeader)(t.parsedContent)&&(t.parsedContent.refSeqId>=0||-2===t.parsedContent.refSeqId)){const e=t.parsedContent.refSeqId>=0?t.parsedContent.refSeqId:void 0,i=await this.container.getCompressionScheme();if(void 0===i)throw new Error("compression scheme undefined");const s={};for(const t of r){const i=void 0!==e?e:t.sequenceId;let r=s[i];r||(r={id:i,start:t.alignmentStart,end:Number.NEGATIVE_INFINITY,seq:null},s[i]=r);const o=t.alignmentStart+(t.lengthOnRef||t.readLength)-1;o>r.end&&(r.end=o),t.alignmentStart<r.start&&(r.start=t.alignmentStart)}await Promise.all(Object.values(s).map(async t=>{-1!==t.id&&t.start<=t.end&&this.file.fetchReferenceSequenceCallback&&(t.seq=await this.file.fetchReferenceSequenceCallback(t.id,t.start,t.end))}));for(const t of r){const r=s[void 0!==e?e:t.sequenceId];if(null==r?void 0:r.seq){const e=r.seq;t.addReferenceSequence({...r,seq:e},i)}}}}return r}}e.default=u,"getHeader getBlocks _getBlocksContentIdIndex".split(" ").forEach(t=>{(0,h.tinyMemoize)(u,t)})},588:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={CRAM_FLAG_PRESERVE_QUAL_SCORES:1,CRAM_FLAG_DETACHED:2,CRAM_FLAG_MATE_DOWNSTREAM:4,CRAM_FLAG_NO_SEQ:8,CRAM_FLAG_MASK:15,CRAM_M_REVERSE:1,CRAM_M_UNMAP:2,BAM_FPAIRED:1,BAM_FPROPER_PAIR:2,BAM_FUNMAP:4,BAM_FMUNMAP:8,BAM_FREVERSE:16,BAM_FMREVERSE:32,BAM_FREAD1:64,BAM_FREAD2:128,BAM_FSECONDARY:256,BAM_FQCFAIL:512,BAM_FDUP:1024,BAM_FSUPPLEMENTARY:2048,BAM_CMATCH:0,BAM_CINS:1,BAM_CDEL:2,BAM_CREF_SKIP:3,BAM_CSOFT_CLIP:4,BAM_CHARD_CLIP:5,BAM_CPAD:6,BAM_CEQUAL:7,BAM_CDIFF:8,BAM_CBACK:9,BAM_CIGAR_STR:"MIDNSHP:XB",BAM_CIGAR_SHIFT:4,BAM_CIGAR_MASK:15,BAM_CIGAR_TYPE:246183}},632:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(i(4141)),o=i(6761),n=i(6272);class a extends s.default{constructor(t,e){if(super(t,e),"int"!==this.dataType)throw new n.CramUnimplementedError(`${this.dataType} decoding not yet implemented by GAMMA codec`)}decode(t,e,i,r){let s=1;for(;0===(0,o.getBits)(e.content,r.coreBlock,1);)s+=1;return((0,o.getBits)(e.content,r.coreBlock,s-1)|1<<s-1)-this.parameters.offset}}e.default=a},652:t=>{function e(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}t.exports=function(t){return null!=t&&(e(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&e(t.slice(0,0))}(t)||!!t._isBuffer)}},772:()=>{},807:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(i(4141)),o=i(6761),n=i(6272);class a extends s.default{constructor(t,e){if(super(t,e),"int"!==this.dataType)throw new n.CramUnimplementedError(`${this.dataType} decoding not yet implemented by BETA codec`)}decode(t,e,i,r){return(0,o.getBits)(e.content,r.coreBlock,this.parameters.length)-this.parameters.offset}}e.default=a},870:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.decode=function(t,e,i){const r=u(t),s=f(e),o=new d(r,s);for(;!("eof"in r)||!r.eof();)if(o._init_block())o._read_bunzip();else{const t=o.reader.read(32)>>>0;if(t!==o.streamCRC&&h(c.DATA_ERROR,"Bad stream CRC (got "+o.streamCRC.toString(16)+" expected "+t.toString(16)+")"),!i||!("eof"in r)||r.eof())break;o._start_bunzip(r,s)}if("getBuffer"in s)return s.getBuffer()};const s=r(i(78)),o=r(i(8761)),n=r(i(6612)),a=function(t,e){const i=t[e];for(let i=e;i>0;i--)t[i]=t[i-1];return t[0]=i,i},c={OK:0,LAST_BLOCK:-1,NOT_BZIP_DATA:-2,UNEXPECTED_INPUT_EOF:-3,UNEXPECTED_OUTPUT_EOF:-4,DATA_ERROR:-5,OUT_OF_MEMORY:-6,OBSOLETE_INPUT:-7,END_OF_BLOCK:-8},l={};l[c.LAST_BLOCK]="Bad file checksum",l[c.NOT_BZIP_DATA]="Not bzip data",l[c.UNEXPECTED_INPUT_EOF]="Unexpected input EOF",l[c.UNEXPECTED_OUTPUT_EOF]="Unexpected output EOF",l[c.DATA_ERROR]="Data error",l[c.OUT_OF_MEMORY]="Out of memory",l[c.OBSOLETE_INPUT]="Obsolete (pre 0.9.5) bzip format not supported.";const h=function(t,e){let i=l[t]||"unknown error";e&&(i+=": "+e);const r=new TypeError(i);throw r.errorCode=t,r};class d{constructor(t,e){this.writePos=this.writeCurrent=this.writeCount=0,this._start_bunzip(t,e)}_init_block(){return this._get_next_block()?(this.blockCRC=new o.default,!0):(this.writeCount=-1,!1)}_start_bunzip(t,e){const i=new Uint8Array(4);4===t.read(i,0,4)&&"BZh"===String.fromCharCode(i[0],i[1],i[2])||h(c.NOT_BZIP_DATA,"bad magic");const r=i[3]-48;(r<1||r>9)&&h(c.NOT_BZIP_DATA,"level out of range"),this.reader=new s.default(t),this.dbufSize=1e5*r,this.nextoutput=0,this.outputStream=e,this.streamCRC=0}_get_next_block(){let t,e,i;const r=this.reader,s=r.pi();if("177245385090"===s)return!1;"314159265359"!==s&&h(c.NOT_BZIP_DATA),this.targetBlockCRC=r.read(32)>>>0,this.streamCRC=(this.targetBlockCRC^(this.streamCRC<<1|this.streamCRC>>>31))>>>0,r.read(1)&&h(c.OBSOLETE_INPUT);const o=r.read(24);o>this.dbufSize&&h(c.DATA_ERROR,"initial position out of bounds");let n=r.read(16),l=new Uint8Array(256),d=0;for(t=0;t<16;t++)if(n&1<<15-t){const s=16*t;for(i=r.read(16),e=0;e<16;e++)i&1<<15-e&&(l[d++]=s+e)}const u=r.read(3);(u<2||u>6)&&h(c.DATA_ERROR);const f=r.read(15);0===f&&h(c.DATA_ERROR);const p=new Uint8Array(256);for(t=0;t<u;t++)p[t]=t;const g=new Uint8Array(f);for(t=0;t<f;t++){for(e=0;r.read(1);e++)e>=u&&h(c.DATA_ERROR);g[t]=a(p,e)}let m,w=d+2,b=[];for(e=0;e<u;e++){const e=new Uint8Array(w),i=new Uint16Array(21);for(n=r.read(5),t=0;t<w;t++){for(;(n<1||n>20)&&h(c.DATA_ERROR),r.read(1);)r.read(1)?n--:n++;e[t]=n}var F,v;for(F=v=e[0],t=1;t<w;t++)e[t]>v?v=e[t]:e[t]<F&&(F=e[t]);m={},b.push(m),m.permute=new Uint16Array(258),m.limit=new Uint32Array(22),m.base=new Uint32Array(21),m.minLen=F,m.maxLen=v;let s=0;for(t=F;t<=v;t++)for(i[t]=m.limit[t]=0,n=0;n<w;n++)e[n]===t&&(m.permute[s++]=n);for(t=0;t<w;t++)i[e[t]]++;for(s=n=0,t=F;t<v;t++)s+=i[t],m.limit[t]=s-1,s<<=1,n+=i[t],m.base[t+1]=s-n;m.limit[v+1]=Number.MAX_VALUE,m.limit[v]=s+i[v]-1,m.base[F]=0}const y=new Uint32Array(256);for(t=0;t<256;t++)p[t]=t;let A,C=0,_=0,x=0;const k=this.dbuf=new Uint32Array(this.dbufSize);for(w=0;;){for(w--||(w=49,x>=f&&h(c.DATA_ERROR),m=b[g[x++]]),t=m.minLen,e=r.read(t);t>m.maxLen&&h(c.DATA_ERROR),!(e<=m.limit[t]);t++)e=e<<1|r.read(1);e-=m.base[t],(e<0||e>=258)&&h(c.DATA_ERROR);const i=m.permute[e];if(0!==i&&1!==i){if(C)for(C=0,_+n>this.dbufSize&&h(c.DATA_ERROR),A=l[p[0]],y[A]+=n;n--;)k[_++]=A;if(i>d)break;_>=this.dbufSize&&h(c.DATA_ERROR),t=i-1,A=a(p,t),A=l[A],y[A]++,k[_++]=A}else C||(C=1,n=0),n+=0===i?C:2*C,C<<=1}for((o<0||o>=_)&&h(c.DATA_ERROR),e=0,t=0;t<256;t++)i=e+y[t],y[t]=e,e=i;for(t=0;t<_;t++)A=255&k[t],k[y[A]]|=t<<8,y[A]++;let I=0,S=0,E=0;return _&&(I=k[o],S=255&I,I>>=8,E=-1),this.writePos=I,this.writeCurrent=S,this.writeCount=_,this.writeRun=E,!0}_read_bunzip(t,e){let i,r,s;if(this.writeCount<0)return 0;let o=this.dbuf,n=this.writePos,a=this.writeCurrent,l=this.writeCount,d=(this.outputsize,this.writeRun);for(;l;){for(l--,r=a,n=o[n],a=255&n,n>>=8,3===d++?(i=a,s=r,a=-1):(i=1,s=a),this.blockCRC.updateCRCRun(s,i);i--;)this.outputStream.writeByte(s),this.nextoutput++;a!=r&&(d=0)}return this.writeCount=l,this.blockCRC.getCRC()!==this.targetBlockCRC&&h(c.DATA_ERROR,"Bad block CRC (got "+this.blockCRC.getCRC().toString(16)+" expected "+this.targetBlockCRC.toString(16)+")"),this.nextoutput}}const u=function(t){if("readByte"in t)return t;const e=new n.default;return e.pos=0,e.readByte=function(){return t[this.pos++]},e.seek=function(t){this.pos=t},e.eof=function(){return this.pos>=t.length},e},f=function(t){const e=new n.default;let i=!0;if(t)if("number"==typeof t)e.buffer=new Uint8Array(t),i=!1;else{if("writeByte"in t)return t;e.buffer=t,i=!1}else e.buffer=new Uint8Array(16384);return e.pos=0,e.writeByte=function(t){if(i&&this.pos>=this.buffer.length){const t=new Uint8Array(2*this.buffer.length);t.set(this.buffer),this.buffer=t}this.buffer[this.pos++]=t},e.getBuffer=function(){if(this.pos!==this.buffer.length){if(!i)throw new TypeError("outputsize does not match decoded input");const t=new Uint8Array(this.pos);t.set(this.buffer.slice(0,this.pos)),this.buffer=t}return this.buffer},e._coerced=!0,e};e.default=d},1064:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{constructor(t){this.blob=t,this.size=t.size}async read(t,e=0){if(!t)return new Uint8Array(0);const i=e,r=i+t;return new Uint8Array(await this.blob.slice(i,r).arrayBuffer())}async readFile(t){const e="string"==typeof t?t:null==t?void 0:t.encoding;if("utf8"===e)return this.blob.text();if(e)throw new Error(`unsupported encoding: ${e}`);return new Uint8Array(await this.blob.arrayBuffer())}async stat(){return{size:this.size}}async close(){}}},1307:function(t,e,i){var r;r=t=>(()=>{var e=[,t=>{t.exports="data:application/wasm;base64,AGFzbQEAAAABOApgAX8Bf2ABfwBgAABgA39/fwF/YAABf2ACf38AYAN/f34BfmACf38Bf2AEf39/fwF/YAN/f38AAyEgAAABAgMDAwMEAQUAAgMCBgcIBwUDAAMHAQcABwcBAwkFAwEAAgYIAX8BQfCgBAsHTgUGbWVtb3J5AgAOY3JlYXRlX2NvbnRleHQACA9kZXN0cm95X2NvbnRleHQACQxzdXBwbHlfaW5wdXQACg9nZXRfbmV4dF9vdXRwdXQACwqNYCDfAgEFf0EAIQECQCAAQQdqIgJBEEkNAEEBIQEgAkEDdiIDQQJGDQBBAiEBIAJBIEkNAEEDIQEgA0EERg0AQQQhASACQTBJDQBBBSEBIANBBkYNAEEGIQEgAkHIAEkNAEEHIQEgAkHYAEkNAEEIIQEgAkGIAUkNAEEJIQEgAkGIAkkNACAAEIGAgIAAIgBBCGpBACAAGw8LAkACQCABQQJ0QcCIgIAAaiIEKAIAIgANAEEAIQACQAJAQQAoAuSIgIAAIgJFDQBBACACKAIANgLkiICAAAwBC0EAEIGAgIAAIgJFDQILIAJBgIB8cSIAIAJBCHZB/wFxIgJyIAE6AAAgAkEIdCAAckGAAmohAEEAIQJBACABQQJ0QYCIgIAAaigCACIDayEFIAMhAQNAIAAgBWoiACACNgIAIAAhAiABIANqIgFBgQJJDQALIAQgADYCAAsgBCAAKAIANgIACyAAC+4HAQd/AkACQAJAAkACQEEALQC0iICAAEUNAEEAQQA6ALSIgIAAQQAoArCIgIAAIgFFDQFBsIiAgAAhAgNAAkACQCABQQhqIgMgASgCBCIEaiIFQQh2Qf8BcSIGDQAgASECDAELAkADQCAFQYCAfHEgBmotAABB/gFHDQFBsIiAgAAhBgNAIAYiBygCACIGIAVHDQALIAcgBSgCADYCACABIAQgBSgCBGpBCGoiBDYCBCAHIAIgAiAFRhshAiADIARqIgVBCHZB/wFxIgYNAAsLIAIoAgAhAgsgAigCACIBDQALC0EAKAKwiICAACIFRQ0AIABBhwJqQYB+cSEDQX8hAkGwiICAACEEQQAhAUGwiICAACEGA0AgBiEHAkAgBSIGKAIEIgUgAEkNACAFIAJPDQAgBSECIAchBCAGIQEgBUEIaiADRw0AIAchBCAFIQIgBiEBDAQLIAYoAgAiBQ0ACyABDQIMAQtBsIiAgAAhBAs/AEEQdCEBIABBiAJqIQdBACEDAkACQEEAKAK4iICAACICRQ0AQQAhBSABIQYMAQtBACABQfCghIAAQf//A2pBgIB8cSIGayICNgK4iICAACACIQULAkAgByAFTQ0AIAcgBWsiByACQQF2IgIgAiAHSRtB//8DaiIHQRB2QABBf0YNAkEAQQAoAriIgIAAIAdBgIB8cSIDajYCuIiAgAALIAZFDQEgBkH/AToAASAGQQAoArCIgIAANgKAAiAGQYQCaiADIAVqQYCAfHFB+H1qIgI2AgAgBkGAAmohAQsgAUGAgHxxIgYgAUEIdkH/AXFyQf8BOgAAIAQgASgCADYCAAJAIAIgAGtBgH5xIgUNACABDwsgASEDAkAgBiABQQhqIgQgAmoiByAFQX9zakGAgHxxRg0AIARB//8DcSEFAkAgAEH3/QNLDQAgBiAEQQh2Qf8BcWpB/gE6AAAgAUEAKAKwiICAADYCACABQYCABCAFayIFNgIEQQAgATYCsIiAgAAQg4CAgAAgBkGEggRqIAIgBWtB+H1qIgU2AgAgBkGBgARqQf8BOgAAIAZBgIIEaiEDIAUgAGtBgH5xIQUMAQsgAiAFaiAAIAVqQX9qQYCAfHFrQYCAfGohBSABIQMLIAMgAygCBCAFazYCBCAFQfgBaiEGIAcgBWtBCHZB/wFxIQUCQANAIAYiB0GAfmohBiAFIgQNAUEBIQUgB0H4AUcNAAsLAkAgB0H4AUYNACACIAFqIAZrQYCAfHEiBSAEakH+AToAACAFIARBCHRqIgVBACgCsIiAgAA2AgAgBSAGNgIEQQAgBTYCsIiAgAAQg4CAgAALIAMPC0EAC3wBAn8CQCAARQ0AAkAgAEGAgHxxIABBCHZB/wFxciIBLQAAIgJB/wFHDQAgAEF4aiIAQQAoArCIgIAANgIAQQAgADYCsIiAgAAgAUH+AToAAEEAQQE6ALSIgIAADwsgACACQQJ0QcCIgIAAaiICKAIANgIAIAIgADYCAAsLawECfwJAQQAoArCIgIAAIgAoAgRB/wFLDQAgAEGAgHxxIgEgAEEIdkH/AXEiAHJBCToAAEEAQQAoArCIgIAAKAIANgKwiICAACABIABBCHRyIgBBACgC5IiAgAA2AgBBACAANgLkiICAAAsLTgECfwJAIAAgAUYNACACRQ0AA0ACQCAALQAAIgMgAS0AACIERg0AQQFBfyADIARLGw8LIAFBAWohASAAQQFqIQAgAkF/aiICDQALC0EAC3gBAX8CQAJAIAAgAU8NACACRQ0BIAAhAwNAIAMgAS0AADoAACABQQFqIQEgA0EBaiEDIAJBf2oiAg0ADAILCyAAIAFNDQAgAkUNACABQX9qIQEgAEF/aiEDA0AgAyACaiABIAJqLQAAOgAAIAJBf2oiAg0ACwsgAAssAQF/AkAgAkUNACAAIQMDQCADIAE6AAAgA0EBaiEDIAJBf2oiAg0ACwsgAAuCAQEBfwJAAkAgAEEDcQ0AIAEgAnJBA3ENACACQQRJDQEgAkECdiECIAAhAwNAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIAJBf2oiAg0ADAILCyACRQ0AIAAhAwNAIAMgAS0AADoAACABQQFqIQEgA0EBaiEDIAJBf2oiAg0ACwsgAAuIAQECfwJAQQAtAOiIgIAADQBBAEEBOgDoiICAABCMgICAABCOgICAAAtBoIAIEICAgIAAIgBBgIAENgIAQQJBgICAIBCXgICAACEBIABBFGpCgICAgICAwAA3AgAgAEEQaiAAQaCABGo2AgAgAEEIakIANwMAIAAgAEEgajYCBCAAIAE2AhwgAAsVACAAKAIcEJiAgIAAIAAQgoCAgAALFgAgAEEMaiABNgIAIABBCGpBADYCAAsbACAAKAIcIABBBGogAEEMaigCAEUQloCAgAALVAEDf0EAIQADQEEIIQEgACECA0BBACACQQFxa0GghuLtfnEgAkEBdnMhAiABQX9qIgENAAsgAEECdEHwiICAAGogAjYCACAAQQFqIgBBgAJHDQALC0oAIAJBf3MhAgJAIAFFDQADQCACQf8BcSAALQAAc0ECdEHwiICAAGooAgAgAkEIdnMhAiAAQQFqIQAgAUF/aiIBDQALCyACQX9zC10DAX4BfwF+QgAhAANAQQghASAAIQIDQEIAIAJCAYN9QsKenLzd8pW2SYMgAkIBiIUhAiABQX9qIgENAAsgAKdBA3RB8JCAgABqIAI3AwAgAEIBfCIAQoACUg0ACwtLACACQn+FIQICQCABRQ0AA0AgAkL/AYMgADEAAIWnQQN0QfCQgIAAaikDACACQgiIhSECIABBAWohACABQX9qIgENAAsLIAJCf4UL1RACDH8CfgJAAkAgACgCJEUNACAAKAIAIQIMAQtBACECIABBADoAKCAAQgA3AwAgAEIANwMYIABByABqQQBB5AAQhoCAgAAaIABBrAFqQQw2AgALIAAgASgCBCIDNgIQIABBsAFqIQQgAEHgAGohBSAAQcgAaiEGIABBtgFqIQcgAEGoAWohCCABKAIQIQkCQAJAAkACQANAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIAIOCgECAAQFBgcICQoPCyABKAIAIQogACgCqAEhAiAAKAKsASELIAEoAgQhDCABKAIIIQ0MAgsgCCAAKAKoASIMakEIaiABKAIAIAEoAgQiAmogASgCCCACayICIAAoAqwBIAxrIgwgAiAMSRsiAhCHgICAABogASABKAIEIAJqNgIEQQAhDCAAQQAgACgCqAEgAmoiAiACIAAoAqwBIgtGGzYCqAEgAiALRw0RIABBATYCAAJAIARBqIiAgABBBhCEgICAAEUNAEEFIQwMEgsgB0ECQQAQjYCAgAAgACgAuAFHDRBBBiEMIActAAANESAAIAAtALcBIgI2AiAgAkEESw0RQQEgAnRBE3FFDRELIAEoAgQiDCABKAIIIg1GDQ4CQCABKAIAIgogDGotAAAiCw0AIAAgDDYCECABIAxBAWo2AgRBBiECDAwLQQAhAiAAQQA2AqgBIABBAjYCACAAIAtBAnRBBGoiCzYCrAEgACALNgJACyAIIAJqQQhqIAogDGogDSAMayIMIAsgAmsiAiAMIAJJGyICEIeAgIAAGiABIAIgASgCBGo2AgRBACEMIABBACAAKAKoASACaiICIAIgACgCrAEiC0YbNgKoASACIAtHDQ8gACACQXxqIgI2AqwBQQchDCAEIAJBABCNgICAACAAIAAoAqwBIgtqQbABaigAAEcNDyAAQQI2AqgBIAAtALEBIgJBP3ENDAJAAkAgAkHAAHFFDQAgACAEIAggCxCRgICAAEEBRw0RIAAgACkDCDcDMCAALQCxASECDAELIABCfzcDMAtCfyEOAkAgAkEYdEEYdUF/Sg0AIAAgBCAIIAAoAqwBEJGAgIAAQQFHDRAgACkDCCEOCyAAIA43AzggACgCrAEiDSAAKAKoASICa0ECSQ0PIAAgAkEBaiIKNgKoASAIIAJqQQhqLQAAQSFHDQwgACACQQJqIgs2AqgBIAggCmpBCGotAABBAUcNDCANIAtGDQ8gACACQQNqNgKoASAAKAKwCSAIIAtqQQhqLQAAEJyAgIAAIgwNDyAAKAKoASIMIAAoAqwBIgIgDCACSxshDQJAA0AgDSAMRg0BIAggDEEBaiICNgIAIAQgDGohCyACIQwgCy0AAA0ODAALCyAGQgA3AwAgAEEANgKoASAAQQM2AgAgBkEIakIANwMACyAAIAEoAgQ2AhAgACABKAIQNgIUIAAoArAJIAEQmYCAgAAhDCAAIAApA0ggASgCBCAAKAIQa618Ig43A0ggACAAKQNQIAEoAhAgACgCFCICayILrXwiDzcDUCAOIAApAzBWDQ0gDyAAKQM4Vg0NAkACQAJAAkAgACgCIEF/ag4EAAMDAQMLIAEoAgwgAmogCyAAKAIYEI2AgIAArSEODAELIAEoAgwgAmogCyAAKQMYEI+AgIAAIQ4LIAAgDjcDGAsgDEEBRw0OAkAgACkDMCIOQn9RDQAgDiAGKQMAUg0OCwJAIAApAzgiDkJ/UQ0AQQchDCAOIAApA1BSDQ8LIAAgACkDSCAANQJAfCAAKQNgfCIPNwNgQgQhDgJAAkACQCAAKAIgQX9qDgQBAgIAAgtCCCEOCyAFIA4gD3w3AwALIAAgACkDaCAAKQNQfDcDaCAAIAVBGCAAKAJwEI2AgIAANgJwIABBBDYCACAAIAApA1hCAXw3A1gLAkAgBikDACIOQgODUA0AIA5CAXwhDiABKAIEIQwgASgCCCELA0AgCyAMRg0NIAEgDEEBaiICNgIEIAEoAgAgDGotAAANDiAGIA43AwAgDkIDgyEPIA5CAXwhDiACIQwgD0IAUg0ACwsgAEEFNgIAC0EBIQIgACgCIEF/ag4EBgcHBQcLIAAgARCSgICAACIMQQFHDQsgAEEHNgIAC0EAIAAoAhBrIQggAEGAAWopAwAhDiABKAIEIQwCQANAIA4gCCAMaq18QgODUA0BAkAgDCABKAIIRw0AIAAgARCTgICAAAwLCyABIAxBAWoiAjYCBCABKAIAIAxqIQsgAiEMIAstAAANCwwACwsgACABEJOAgIAAQQchDCAFIABBkAFqQRgQhICAgAANCiAAQQg2AgALIAAgAUEgEJSAgIAAIgxBAUcNCSAAQQk2AgBBDCELIABBDDYCrAEMAQsgACgCrAEhCwsgAEGoAWogACgCqAEiDGpBCGogASgCACABKAIEIgJqIAEoAgggAmsiAiALIAxrIgwgAiAMSRsiAhCHgICAABogASABKAIEIAJqNgIEQQAhDCAAQQAgACgCqAEgAmoiAiACIAAoAqwBIgtGGzYCqAEgAiALRw0HIAAQlYCAgAAhDAwHC0EBIQIgACABQcAAEJSAgIAAIgxBAUcNBgwBC0EBIQIgACABQSAQlICAgAAiDEEBRw0FCyAAIAI2AgAMAAsLQQYhDAwCC0EAIQwMAQtBByEMCwJAAkAgACgCJA0AAkACQCAMDgIAAwELQQdBCCABKAIEIAEoAghGGyEMCyABIAk2AhAgASADNgIEIAwPCwJAIAwNACADIAEoAgRHDQAgCSABKAIQRw0AIAAtACghASAAQQE6ACggAUEDdA8LIABBADoAKAsgDAuaAQEDfwJAIAAoAgQiBA0AIABCADcDCAsgAigCACEFA0ACQCAFIANJDQBBAA8LIAEgBWotAAAhBiACIAVBAWoiBTYCACAAIAZB/wBxrSAErYYgACkDCIQ3AwgCQAJAIAZBgAFxDQACQCAGDQBBByEGIAQNAgsgAEEANgIEQQEPC0EHIQYgACAEQQdqIgQ2AgQgBEE/Rw0BCwsgBguhAgIDfwF+IABBkAFqIQIgAUEEaiEDA0ACQCAAIAEoAgAgAyABKAIIEJGAgIAAIgRBAUYNACAAQYABaiIDIAMpAwAgASgCBCAAKAIQIgNrIgKtfDcDACAAIAMgASgCAGogAiAAKAIYEI2AgIAArTcDGCAEDwsCQAJAAkACQAJAIAAoAngOAwACAQMLIAAgACkDCCIFNwOIAQJAIAUgACkDWFENAEEHDwsgAEEBNgJ4DAMLIAAgACkDmAEgACkDCHw3A5gBIAAgAkEYIAAoAqABEI2AgIAANgKgASAAQQE2AnggACAAKQOIAUJ/fCIFNwOIAQwCCyAAQQI2AnggACAAKQOQASAAKQMIfDcDkAELIAApA4gBIQULIAVCAFINAAtBAQtAAQJ/IABBgAFqIgIgAikDACABKAIEIAAoAhAiAmsiA618NwMAIAAgAiABKAIAaiADIAAoAhgQjYCAgACtNwMYC3wBBH8gASgCBCEDIAEoAgghBANAAkAgBCADRw0AQQAPCyABIANBAWoiBTYCBAJAIAEoAgAgA2otAAAgACkDGCAAKAIEIgOtiKdB/wFxRg0AQQcPCyAAIANBCGoiBjYCBCAFIQMgBiACSQ0ACyAAQQA2AgQgAEIANwMYQQELbwEBf0EHIQECQCAAQboBai8AAEHZtAFHDQAgAEG0AWpBBkEAEI2AgIAAIABBsAFqKAAARw0AIABBgAFqKQMAQgKIIAA1ALQBUg0AIABBuAFqLQAADQBBAUEHIAAoAiAgAEG5AWotAABGGyEBCyABC7QCAQR/AkACQCAAKAIkRQ0AIAAoAgAhAwwBC0EAIQMgAEEAOgAoIABCADcDACAAQgA3AxggAEHIAGpBAEHkABCGgICAABogAEGsAWpBDDYCAEEBIQILIABByABqIQQCQAJAA0ACQCADQQpHDQAgASgCBCIDIAEoAggiBUYNAiABKAIAIQYCQANAIAYgA2otAAANASABIANBAWoiAzYCBCAAIAAoAgRBAWpBA3E2AgQgBSADRg0EDAALCwJAIAAoAgRFDQBBBw8LIAAoAiRFDQAgAEEAOgAoIABCADcDACAAQgA3AxggBEEAQeQAEIaAgIAAGiAAQQw2AqwBCyAAIAEQkICAgAAiA0EBRw0CQQohAyAAQQo2AgAMAAsLAkAgAg0AQQAPC0EHQQEgACgCBBshAwsgAwt1AQF/AkBBuAkQgICAgAAiAkUNACACIAA2AiQgAiAAIAEQm4CAgAAiADYCsAkCQCAARQ0AIAJBADoAKCACQgA3AwAgAkIANwMYIAJByABqQQBB5AAQhoCAgAAaIAJBrAFqQQw2AgAgAg8LIAIQgoCAgAALQQALHgACQCAARQ0AIAAoArAJEJ2AgIAAIAAQgoCAgAALC4ARAQx/IABB6N0BaiECIABB1ABqIQMgAEEcaiIEQQhqIQUCQAJAA0AgACgCQCEGAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgASgCBCIHIAEoAggiCEkNACAGQQdGDQEMEgsgBg4JAQIDBAUGBwAJDwsgACgCTCEGDAcLQQEhCSABIAdBAWo2AgQgASgCACAHai0AACIHRQ0IAkACQCAHQd8BSw0AIAdBAUcNAQsgAEGAAjsBUAJAIAAoAjwNACAAIAEoAgwgASgCECIGajYCGCAAIAEoAhQgBms2AiwLIARCADcCACAFQgA3AgAMCwsgAC0AUEUNCgwOCyABIAdBAWo2AgQgASgCACAHai0AACEHIABBAjYCQCAAIAdBCHQgACgCSGo2AkgMDAsgASAHQQFqNgIEIAEoAgAgB2otAAAhByAAQQM2AkAgACAHIAAoAkhqQQFqNgJIDAsLIAEgB0EBajYCBCABKAIAIAdqLQAAIQcgAEEENgJAIAAgB0EIdDYCTAwKCyABIAdBAWo2AgQgASgCACAHai0AACEHIAAgACgCRDYCQCAAIAcgACgCTGpBAWo2AkwMCQsgASAHQQFqNgIEQQchCSABKAIAIAdqLQAAIgdB4AFLDQNBACEGAkACQCAHQS1PDQBBACEIDAELIAdBU2oiByAHQf8BcUEtbiIIQS1sayEHIAhBAWohCAsgAEF/IAh0QX9zNgJ0AkAgB0H/AXFBCUkNACAHQXdqIgcgB0H/AXFBCW4iBkEJbGshByAGQQFqIQYLIAAgBjYCcCAAIAdB/wFxIgc2AmwgBiAHakEESw0DIANCADcCACADQQhqQgA3AgAgA0EQakEANgIAIABBfyAGdEF/czYCcEH4ACEHA0AgACAHakGACDsBACAHQQJqIgdB5N0BRw0ACyAAQQY2AkAgAEEFNgIIIABC/////w83AgALIAAoAkwiCUEFSQ0IAkAgACgCCCIHRQ0AIAdBf2ohBiABKAIEIQcgASgCCCEKA0AgCiAHRg0LIAEgB0EBaiIINgIEIAEoAgAgB2otAAAhByAAIAY2AgggACAHIAAoAgRBCHRyNgIEIAghByAGQX9qIgZBf0cNAAsLIABBBzYCQCAAIAlBe2oiBjYCTAsgACAAKAIgIgcgASgCFCABKAIQayIIIAAoAkgiCiAIIApJGyIIaiAAKAIsIgogCiAHayAISxs2AiggASgCCCIJIAEoAgQiCGshBwJAAkACQCAAKALk3QEiCg0AIAYNAUEAIQYLIABB5N0BaiILIApqQQRqIAEoAgAgCGogByAGIAprIgZBKiAKayIIIAggBksbIgYgBiAHSxsiBxCHgICAABoCQAJAIAcgACgC5N0BIghqIgYgACgCTEcNACALIAhqIAdqQQRqQQBBPyAGaxCGgICAABogACgC5N0BIAdqIQYMAQsCQCAGQRRLDQAgACAGNgLk3QEgASABKAIEIAdqNgIEDAMLIAZBa2ohBgsgAEEANgIQIAAgAjYCDCAAIAY2AhRBByEJIAAQmoCAgABFDQMgACgCECIIIAAoAuTdASIKIAdqSw0DIAAgACgCTCAIayIGNgJMAkAgCiAITQ0AIAAgCiAIayIHNgLk3QEgAiALIAhqQQRqIAcQhYCAgAAaDAILIABBADYC5N0BIAEgASgCBCAIIApraiIINgIEIAEoAggiCSAIayEHCwJAIAdBFUkNACAAIAg2AhAgACABKAIANgIMIAAgCUFraiAIIAZqIAcgBkEVakkbNgIUQQchCSAAEJqAgIAARQ0DIAAoAkwiByAAKAIQIgggASgCBGsiBkkNAyABIAg2AgQgACAHIAZrIgY2AkwgASgCCCAIayIHQRRLDQELIAIgASgCACAIaiAGIAcgByAGSxsiBxCHgICAABogACAHNgLk3QEgASABKAIEIAdqNgIECyAAKAIgIgYgACgCHCIIayEHAkAgACgCPEUNAAJAIAYgACgCLEcNACAAQQA2AiALIAEoAgwgASgCEGogACgCGCAIaiAHEIeAgIAAGiAAKAIgIQYLIAAgBjYCHCABIAEoAhAgB2oiBjYCECAAIAAoAkggB2siBzYCSAJAIAcNAEEHIQkgACgCTA0CIAAoAmgNAiAAKAIEDQIgAEEANgJADAULQQAhCSAGIAEoAhRGDQEgASgCBCABKAIIRw0GIAAoAuTdASAAKAJMTw0GDAELIAAoAkwiCkUNAUEAIQkgCCAHTQ0AA0AgASgCFCIGIAEoAhAiC00NASAAIAogCiAAKAIsIAAoAiAiDGsiDSAIIAdrIgggBiALayIGIAggBkkbIgYgBiANSxsiBiAGIApLGyIGazYCTCAMIAAoAhhqIAEoAgAgB2ogBhCFgICAABogACAAKAIgIAZqIgc2AiACQCAAKAIkIAdPDQAgACAHNgIkCwJAIAAoAjxFDQACQCAHIAAoAixHDQAgAEEANgIgCyABKAIMIAEoAhBqIAEoAgAgASgCBGogBhCFgICAABogACgCICEHCyAAIAc2AhwgASABKAIQIAZqNgIQIAEgASgCBCAGaiIHNgIEIAAoAkwiCkUNAiABKAIIIgggB0sNAAsLIAkPCyAAQQA2AkAMAwsgB0EYdEEYdUF/Sg0BIABBATYCQCAAIAdBEHRBgID8AHE2AkgCQCAHQcABSQ0AIABBBTYCRCAAQQA6AFEMAwsgAC0AUQ0DIABBBjYCRCAHQaABSQ0CIANCADcCACADQRBqQQA2AgAgA0EIakIANwIAQfgAIQcDQCAAIAdqQYAIOwEAIAdBAmoiB0Hk3QFHDQALCyAAQQU2AgggAEL/////DzcCAAwBCyAHQQJLDQEgAEKDgICAgAE3AkAMAAsLQQcPC0EAC/8XARJ/IABBGGohAQJAIABBIGooAgAiAiAAQShqKAIAIgNPDQAgAEHoAGoiBCgCAEUNACABIAQgACgCVBCegICAABogACgCKCEDIAAoAiAhAgsCQCACIANPDQAgAEHcDWohBSAAQegAaiEGIABB4BVqIQcgAEHUAGohCANAIAAoAhAiCSAAKAIUSw0BIAAgACgCZCIKQQV0aiAAKAJ0IAJxIgtBAXRqIgxB+ABqIQ0CQAJAIAAoAgAiBEGAgIAISQ0AIAAoAgQhDgwBCyAAIARBCHQiBDYCACAAIAlBAWoiAzYCECAAIAAoAgRBCHQgACgCDCAJai0AAHIiDjYCBCADIQkLAkACQCAOIARBC3YgDS8BACIPbCIDTw0AIAAgAzYCACANIA9BgBAgD2tBBXZqOwEAIAJBf2ohBAJAIAINACAAKAIsIARqIQQLAkACQCAAKAIkIg8NAEEAIQQMAQsgACgCGCAEai0AACEECyAAKAJwIAJxIAAoAmwiDXQgBEEIIA1rdmohDAJAAkAgCkEGSw0AQQEhBANAIAAgDEGADGxqIARBAXQiBGpB5B1qIQ0CQAJAIANB////B00NACADIQoMAQsgACADQQh0Igo2AgAgACAJQQFqIgM2AhAgACAOQQh0IAAoAgwgCWotAAByIg42AgQgAyEJCwJAAkAgDiAKQQt2IA0vAQAiD2wiA0kNACAAIA4gA2siDjYCBCAAIAogA2siAzYCACANIA8gD0EFdms7AQAgBEEBciEEDAELIAAgAzYCACANIA9BgBAgD2tBBXZqOwEACyAEQYACSQ0ADAILCyACIAAoAlQiDUF/c2ohBAJAIAIgDUsNACAAKAIsIARqIQQLAkACQCAPDQBBACEQDAELIAAoAhggBGotAAAhEAtBASEEQYACIQ0DQCAAIAxBgAxsaiAQQQF0IhAgDXEiESANaiAEakEBdGpB5B1qIQ8CQAJAIANB////B00NACADIQsMAQsgACADQQh0Igs2AgAgACAJQQFqIgM2AhAgACAOQQh0IAAoAgwgCWotAAByIg42AgQgAyEJCwJAAkAgDiALQQt2IA8vAQAiCmwiA08iEg0AIAAgAzYCACAKQYAQIAprQQV2aiEKDAELIAAgDiADayIONgIEIAAgCyADayIDNgIAIAogCkEFdmshCkEAIQ0LIA8gCjsBACANIBFzIQ0gBEEBdCASciIEQYACSQ0ACwsgACACQQFqNgIgIAAoAhggAmogBDoAAAJAIAAoAiQgACgCICICTw0AIAAgAjYCJAtBACEDAkAgACgCZCIEQQRJDQACQCAEQQlLDQAgBEF9aiEDDAELIARBemohAwsgACADNgJkDAELIAAgDiADayIONgIEIAAgBCADayIDNgIAIA0gDyAPQQV2azsBACAAIApBAXRqIg9B+ANqIQQCQAJAIANB////B00NACAJIQoMAQsgACADQQh0IgM2AgAgACAJQQFqIgo2AhAgACAOQQh0IAAoAgwgCWotAAByIg42AgQLAkACQCAOIANBC3YgBC8BACINbCIJSQ0AIAAgDiAJayIONgIEIAAgAyAJayIDNgIAIAQgDSANQQV2azsBACAPQZAEaiENAkACQCADQf///wdNDQAgCiEQDAELIAAgA0EIdCIDNgIAIAAgCkEBaiIQNgIQIAAgDkEIdCAAKAIMIApqLQAAciIONgIECwJAAkAgDiADQQt2IA0vAQAiCWwiBE8NACANIAlBgBAgCWtBBXZqOwEAIAxB2ARqIQMCQCAEQf///wdLDQAgACAEQQh0IgQ2AgAgACAQQQFqNgIQIAAgDkEIdCAAKAIMIBBqLQAAciIONgIECwJAIA4gBEELdiADLwEAIg1sIglJDQAgACAOIAlrNgIEIAAgBCAJazYCACADIA0gDUEFdms7AQAMAgsgAyANQYAQIA1rQQV2ajsBACAAIAk2AgAgAEEBNgJoIABBCUELIAAoAmRBB0kbNgJkDAMLIAAgDiAEayIONgIEIA0gCSAJQQV2azsBACAPQagEaiENAkACQCADIARrIgNB////B00NACAQIQoMAQsgACADQQh0IgM2AgAgACAQQQFqIgo2AhAgACAOQQh0IAAoAgwgEGotAAByIg42AgQLAkACQCAOIANBC3YgDS8BACIEbCIJTw0AIAAgCTYCACANIARBgBAgBGtBBXZqOwEAIAAoAlghAwwBCyAAIA4gCWsiDjYCBCANIAQgBEEFdms7AQAgD0HABGohBAJAIAMgCWsiA0H///8HSw0AIAAgA0EIdCIDNgIAIAAgCkEBajYCECAAIA5BCHQgACgCDCAKai0AAHIiDjYCBAsCQAJAIA4gA0ELdiAELwEAIg1sIglPDQAgACAJNgIAIAQgDUGAECANa0EFdmo7AQAgACgCXCEDDAELIAAgDiAJazYCBCAAIAMgCWs2AgAgACgCYCEDIAAgACgCXDYCYCAEIA0gDUEFdms7AQALIAAgACgCWDYCXAsgACAAKAJUNgJYIAAgAzYCVAsgAEEIQQsgACgCZEEHSRs2AmQgACAHIAsQn4CAgAAMAQsgBCANQYAQIA1rQQV2ajsBACAAIAk2AgAgACAAKAJcNgJgIAAgACkCVDcCWCAAQQdBCiAAKAJkQQdJGzYCZCAAIAUgCxCfgICAACAAKAJoIgNBfmpBAyADQQZJGyEKIAAoAgAhA0EBIQ4DQCAAIApBB3RqIA5BAXQiDmpB2AdqIQ0CQAJAIANBgICACEkNACAAKAIEIQQMAQsgACADQQh0IgM2AgAgACAAKAIQIgRBAWo2AhAgACAAKAIEQQh0IAQgACgCDGotAAByIgQ2AgQLAkACQCAEIANBC3YgDS8BACIJbCIPSQ0AIAAgBCAPayIENgIEIAAgAyAPayIDNgIAIA0gCSAJQQV2azsBACAOQQFyIQ4MAQsgACAPNgIAIA0gCUGAECAJa0EFdmo7AQAgDyEDCyAOQcAASQ0ACwJAIA5BQGoiCUEDSw0AIAAgCTYCVAwBCyAAIA5BAXFBAnIiDTYCVCAJQQF2IQ8CQCAJQQ1LDQAgACANIA9Bf2oiDHQiCzYCVEEBIQ0gCCALQQF0akGEC2ohEEE/IA5rIRFBACEPA0AgECARIA1qQQF0aiEOAkACQCADQf///wdNDQAgAyEKDAELIAAgA0EIdCIKNgIAIAAgACgCECIDQQFqNgIQIAAgBEEIdCADIAAoAgxqLQAAciIENgIECwJAAkAgBCAKQQt2IA4vAQAiCWwiA0kNACAAIAQgA2siBDYCBCAAIAogA2siAzYCACAOIAkgCUEFdms7AQAgAEEBIA90IAtqIgs2AlQgDUEBdEEBciENDAELIAAgAzYCACAOIAlBgBAgCWtBBXZqOwEAIA1BAXQhDQsgDCAPQQFqIg9HDQAMAgsLIA9Be2ohDgNAAkAgA0H///8HSw0AIAAgA0EIdCIDNgIAIAAgACgCECIJQQFqNgIQIARBCHQgCSAAKAIMai0AAHIhBAsgACADQQF2IgM2AgAgACAEIANrIgRBH3UiCSANQQF0akEBaiINNgJUIAAgCSADcSAEaiIENgIEIA5Bf2oiDg0ACyAAIA1BBHQiCzYCVEEAIQ9BASEOA0AgACAOQQF0Ig5qQbwNaiENAkACQCADQf///wdNDQAgAyEKDAELIAAgA0EIdCIKNgIAIAAgACgCECIDQQFqNgIQIAAgBEEIdCADIAAoAgxqLQAAciIENgIECwJAAkAgBCAKQQt2IA0vAQAiCWwiA0kNACAAIAQgA2siBDYCBCAAIAogA2siAzYCACANIAkgCUEFdms7AQAgAEEBIA90IAtqIgs2AlQgDkEBciEODAELIAAgAzYCACANIAlBgBAgCWtBBXZqOwEACyAPQQFqIg9BBEcNAAsLAkAgASAGIAAoAlQQnoCAgAANAEEADwsgACgCICECCyACIAAoAihJDQALC0EBIQMCQCAAKAIAIgRB////B0sNACAAIARBCHQ2AgBBASEDIAAgACgCECIEQQFqNgIQIAAgACgCBEEIdCAEIAAoAgxqLQAAcjYCBAsgAwtwAQF/AkBBqN4BEICAgIAAIgJFDQAgAkE0aiABNgIAIAJBPGogADYCAAJAAkACQCAAQX9qDgIAAQILIAIgARCAgICAACIANgIYIAANASACEIKAgIAADAILIAJBADYCGCACQThqQQA2AgALIAIPC0EAC9IBAQJ/QQYhAgJAIAFBJ0sNACAAQTBqIAFBAXFBAnIgAUEBdkELanQiATYCAAJAAkAgAEE8aigCACIDRQ0AQQQhAiABIABBNGooAgBLDQIgAEEsaiABNgIAIANBAkcNACAAQThqIgMoAgAgAU8NACAAIAE2AjggACgCGBCCgICAACAAIAAoAjAQgICAgAAiATYCGCABDQBBAyECDAELQQAhAiAAQQA2AkAgAEHQAGpBAToAACAAQegAakEANgIAIABB5N0BaiEDCyADQQA2AgALIAILIwACQCAAQTxqKAIARQ0AIAAoAhgQgoCAgAALIAAQgoCAgAAL9QEBBH9BACEDAkAgACgCDCACTQ0AIAAoAhggAk0NACABIAEoAgAiBCAAKAIQIAAoAggiBWsiBiAEIAYgBEkbIgRrNgIAIAUgAkF/c2ohAQJAIAUgAksNACAAKAIUIAFqIQELIAAoAgAiAiABai0AACEGQQEhAyAAIAVBAWo2AgggAiAFaiAGOgAAAkAgBEF/aiICRQ0AA0AgACgCACIFQQAgAUEBaiIBIAEgACgCFEYbIgFqLQAAIQQgACAAKAIIIgZBAWo2AgggBSAGaiAEOgAAIAJBf2oiAg0ACwsgACgCDCAAKAIIIgFPDQAgACABNgIMCyADC8gEAQd/AkACQCAAKAIAIgNBgICACEkNACAAKAIEIQQMAQsgACADQQh0IgM2AgAgACAAKAIQIgVBAWo2AhAgACAAKAIEQQh0IAUgACgCDGotAAByIgQ2AgQLAkACQCAEIANBC3YgAS8BACIGbCIFTw0AIAEgBkGAECAGa0EFdmo7AQAgASACQQR0akEEaiEHQQghCEECIQkMAQsgACAEIAVrIgQ2AgQgASAGIAZBBXZrOwEAAkAgAyAFayIDQf///wdLDQAgACADQQh0IgM2AgAgACAAKAIQIgVBAWo2AhAgACAEQQh0IAUgACgCDGotAAByIgQ2AgQLAkAgBCADQQt2IAEvAQIiBmwiBU8NACABIAZBgBAgBmtBBXZqOwECIAEgAkEEdGpBhAJqIQdBCCEIQQohCQwBCyAAIAQgBWsiBDYCBCABIAYgBkEFdms7AQIgAUGEBGohByADIAVrIQVBgAIhCEESIQkLIABB6ABqIAk2AgBBASEBA0AgByABQQF0IgFqIQMCQAJAIAVB////B00NACAFIQIMAQsgACAFQQh0IgI2AgAgACAAKAIQIgVBAWo2AhAgACAEQQh0IAUgACgCDGotAAByIgQ2AgQLAkACQCAEIAJBC3YgAy8BACIGbCIFSQ0AIAAgBCAFayIENgIEIAAgAiAFayIFNgIAIAMgBiAGQQV2azsBACABQQFyIQEMAQsgACAFNgIAIAMgBkGAECAGa0EFdmo7AQALIAEgCEkNAAsgAEHoAGogASAIayAJajYCAAsLNQEAQYAICy4IAAAAEAAAABgAAAAgAAAAKAAAADAAAABAAAAAUAAAAIAAAAAAAQAA/Td6WFoA"},e=>{e.exports=t}],i={};function r(t){var s=i[t];if(void 0!==s)return s.exports;var o=i[t]={exports:{}};return e[t](o,o.exports,r),o.exports}r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return(()=>{r.r(s),r.d(s,{XzReadableStream:()=>o});var t=r(1);const e=globalThis.ReadableStream||r(2).ReadableStream;class i{constructor(t){this.exports=t.exports,this.memory=this.exports.memory,this.ptr=this.exports.create_context(),this._refresh(),this.bufSize=this.mem32[0],this.inStart=this.mem32[1]-this.ptr,this.inEnd=this.inStart+this.bufSize,this.outStart=this.mem32[4]-this.ptr}supplyInput(t){this._refresh(),this.mem8.subarray(this.inStart,this.inEnd).set(t,0),this.exports.supply_input(this.ptr,t.byteLength),this._refresh()}getNextOutput(){const t=this.exports.get_next_output(this.ptr);if(this._refresh(),0!==t&&1!==t)throw new Error(`get_next_output failed with error code ${t}`);return{outChunk:this.mem8.slice(this.outStart,this.outStart+this.mem32[5]),finished:1===t}}needsMoreInput(){return this.mem32[2]===this.mem32[3]}outputBufferIsFull(){return this.mem32[5]===this.bufSize}resetOutputBuffer(){this.outPos=this.mem32[5]=0}dispose(){this.exports.destroy_context(this.ptr),this.exports=null}_refresh(){var t;this.memory.buffer!==(null===(t=this.mem8)||void 0===t?void 0:t.buffer)&&(this.mem8=new Uint8Array(this.memory.buffer,this.ptr),this.mem32=new Uint32Array(this.memory.buffer,this.ptr))}}class o extends e{static async _getModuleInstance(){const e=t.replace("data:application/wasm;base64,",""),i=Uint8Array.from(atob(e),t=>t.charCodeAt(0)).buffer,r=await WebAssembly.instantiate(i,{});o._moduleInstance=r.instance}constructor(t){let e,r=null;const s=t.getReader();super({async start(t){o._moduleInstance||await(o._moduleInstancePromise||(o._moduleInstancePromise=o._getModuleInstance())),e=new i(o._moduleInstance)},async pull(t){if(e.needsMoreInput()){if(null===r||0===r.byteLength){const{done:t,value:e}=await s.read();t||(r=e)}const t=Math.min(e.bufSize,r.byteLength);e.supplyInput(r.subarray(0,t)),r=r.subarray(t)}const i=e.getNextOutput();t.enqueue(i.outChunk),e.resetOutputBuffer(),i.finished&&(e.dispose(),t.close())},cancel:()=>(e.dispose(),s.cancel())})}}})(),s})(),t.exports=r(i(772))},1308:(t,e)=>{let i=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(i=new Int32Array(i)),e.A=(t,e)=>{let r=0===e?0:-1^e;for(let e=0;e<t.length;e++)r=i[255&(r^t[e])]^r>>>8;return-1^r}},1447:(t,e,i)=>{var r=i(9805),s=i(3269),o=i(4823),n=i(7293),a=i(1998),c=-2,l=12,h=30;function d(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function u(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(852),e.distcode=e.distdyn=new r.Buf32(592),e.sane=1,e.back=-1,0):c}function p(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,f(t)):c}function g(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?c:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,p(t))):c}function m(t,e){var i,r;return t?(r=new u,t.state=r,r.window=null,0!==(i=g(t,e))&&(t.state=null),i):c}var w,b,F=!0;function v(t){if(F){var e;for(w=new r.Buf32(512),b=new r.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(a(1,t.lens,0,288,w,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;a(2,t.lens,0,32,b,0,t.work,{bits:5}),F=!1}t.lencode=w,t.lenbits=9,t.distcode=b,t.distbits=5}function y(t,e,i,s){var o,n=t.state;return null===n.window&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new r.Buf8(n.wsize)),s>=n.wsize?(r.arraySet(n.window,e,i-n.wsize,n.wsize,0),n.wnext=0,n.whave=n.wsize):((o=n.wsize-n.wnext)>s&&(o=s),r.arraySet(n.window,e,i-s,o,n.wnext),(s-=o)?(r.arraySet(n.window,e,i-s,s,0),n.wnext=s,n.whave=n.wsize):(n.wnext+=o,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=o))),0}e.inflateReset=p,e.inflateReset2=g,e.inflateResetKeep=f,e.inflateInit=function(t){return m(t,15)},e.inflateInit2=m,e.inflate=function(t,e){var i,u,f,p,g,m,w,b,F,A,C,_,x,k,I,S,E,N,M,R,D,B,T,L,z=0,P=new r.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return c;(i=t.state).mode===l&&(i.mode=13),g=t.next_out,f=t.output,w=t.avail_out,p=t.next_in,u=t.input,m=t.avail_in,b=i.hold,F=i.bits,A=m,C=w,B=0;t:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;F<16;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}if(2&i.wrap&&35615===b){i.check=0,P[0]=255&b,P[1]=b>>>8&255,i.check=o(i.check,P,2,0),b=0,F=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&b)<<8)+(b>>8))%31){t.msg="incorrect header check",i.mode=h;break}if(8!=(15&b)){t.msg="unknown compression method",i.mode=h;break}if(F-=4,D=8+(15&(b>>>=4)),0===i.wbits)i.wbits=D;else if(D>i.wbits){t.msg="invalid window size",i.mode=h;break}i.dmax=1<<D,t.adler=i.check=1,i.mode=512&b?10:l,b=0,F=0;break;case 2:for(;F<16;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}if(i.flags=b,8!=(255&i.flags)){t.msg="unknown compression method",i.mode=h;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=h;break}i.head&&(i.head.text=b>>8&1),512&i.flags&&(P[0]=255&b,P[1]=b>>>8&255,i.check=o(i.check,P,2,0)),b=0,F=0,i.mode=3;case 3:for(;F<32;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}i.head&&(i.head.time=b),512&i.flags&&(P[0]=255&b,P[1]=b>>>8&255,P[2]=b>>>16&255,P[3]=b>>>24&255,i.check=o(i.check,P,4,0)),b=0,F=0,i.mode=4;case 4:for(;F<16;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}i.head&&(i.head.xflags=255&b,i.head.os=b>>8),512&i.flags&&(P[0]=255&b,P[1]=b>>>8&255,i.check=o(i.check,P,2,0)),b=0,F=0,i.mode=5;case 5:if(1024&i.flags){for(;F<16;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}i.length=b,i.head&&(i.head.extra_len=b),512&i.flags&&(P[0]=255&b,P[1]=b>>>8&255,i.check=o(i.check,P,2,0)),b=0,F=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((_=i.length)>m&&(_=m),_&&(i.head&&(D=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),r.arraySet(i.head.extra,u,p,_,D)),512&i.flags&&(i.check=o(i.check,u,_,p)),m-=_,p+=_,i.length-=_),i.length))break t;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===m)break t;_=0;do{D=u[p+_++],i.head&&D&&i.length<65536&&(i.head.name+=String.fromCharCode(D))}while(D&&_<m);if(512&i.flags&&(i.check=o(i.check,u,_,p)),m-=_,p+=_,D)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===m)break t;_=0;do{D=u[p+_++],i.head&&D&&i.length<65536&&(i.head.comment+=String.fromCharCode(D))}while(D&&_<m);if(512&i.flags&&(i.check=o(i.check,u,_,p)),m-=_,p+=_,D)break t}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;F<16;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}if(b!==(65535&i.check)){t.msg="header crc mismatch",i.mode=h;break}b=0,F=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=l;break;case 10:for(;F<32;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}t.adler=i.check=d(b),b=0,F=0,i.mode=11;case 11:if(0===i.havedict)return t.next_out=g,t.avail_out=w,t.next_in=p,t.avail_in=m,i.hold=b,i.bits=F,2;t.adler=i.check=1,i.mode=l;case l:if(5===e||6===e)break t;case 13:if(i.last){b>>>=7&F,F-=7&F,i.mode=27;break}for(;F<3;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}switch(i.last=1&b,F-=1,3&(b>>>=1)){case 0:i.mode=14;break;case 1:if(v(i),i.mode=20,6===e){b>>>=2,F-=2;break t}break;case 2:i.mode=17;break;case 3:t.msg="invalid block type",i.mode=h}b>>>=2,F-=2;break;case 14:for(b>>>=7&F,F-=7&F;F<32;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}if((65535&b)!=(b>>>16^65535)){t.msg="invalid stored block lengths",i.mode=h;break}if(i.length=65535&b,b=0,F=0,i.mode=15,6===e)break t;case 15:i.mode=16;case 16:if(_=i.length){if(_>m&&(_=m),_>w&&(_=w),0===_)break t;r.arraySet(f,u,p,_,g),m-=_,p+=_,w-=_,g+=_,i.length-=_;break}i.mode=l;break;case 17:for(;F<14;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}if(i.nlen=257+(31&b),b>>>=5,F-=5,i.ndist=1+(31&b),b>>>=5,F-=5,i.ncode=4+(15&b),b>>>=4,F-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=h;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;F<3;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}i.lens[O[i.have++]]=7&b,b>>>=3,F-=3}for(;i.have<19;)i.lens[O[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,T={bits:i.lenbits},B=a(0,i.lens,0,19,i.lencode,0,i.work,T),i.lenbits=T.bits,B){t.msg="invalid code lengths set",i.mode=h;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;S=(z=i.lencode[b&(1<<i.lenbits)-1])>>>16&255,E=65535&z,!((I=z>>>24)<=F);){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}if(E<16)b>>>=I,F-=I,i.lens[i.have++]=E;else{if(16===E){for(L=I+2;F<L;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}if(b>>>=I,F-=I,0===i.have){t.msg="invalid bit length repeat",i.mode=h;break}D=i.lens[i.have-1],_=3+(3&b),b>>>=2,F-=2}else if(17===E){for(L=I+3;F<L;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}F-=I,D=0,_=3+(7&(b>>>=I)),b>>>=3,F-=3}else{for(L=I+7;F<L;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}F-=I,D=0,_=11+(127&(b>>>=I)),b>>>=7,F-=7}if(i.have+_>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=h;break}for(;_--;)i.lens[i.have++]=D}}if(i.mode===h)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=h;break}if(i.lenbits=9,T={bits:i.lenbits},B=a(1,i.lens,0,i.nlen,i.lencode,0,i.work,T),i.lenbits=T.bits,B){t.msg="invalid literal/lengths set",i.mode=h;break}if(i.distbits=6,i.distcode=i.distdyn,T={bits:i.distbits},B=a(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,T),i.distbits=T.bits,B){t.msg="invalid distances set",i.mode=h;break}if(i.mode=20,6===e)break t;case 20:i.mode=21;case 21:if(m>=6&&w>=258){t.next_out=g,t.avail_out=w,t.next_in=p,t.avail_in=m,i.hold=b,i.bits=F,n(t,C),g=t.next_out,f=t.output,w=t.avail_out,p=t.next_in,u=t.input,m=t.avail_in,b=i.hold,F=i.bits,i.mode===l&&(i.back=-1);break}for(i.back=0;S=(z=i.lencode[b&(1<<i.lenbits)-1])>>>16&255,E=65535&z,!((I=z>>>24)<=F);){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}if(S&&!(240&S)){for(N=I,M=S,R=E;S=(z=i.lencode[R+((b&(1<<N+M)-1)>>N)])>>>16&255,E=65535&z,!(N+(I=z>>>24)<=F);){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}b>>>=N,F-=N,i.back+=N}if(b>>>=I,F-=I,i.back+=I,i.length=E,0===S){i.mode=26;break}if(32&S){i.back=-1,i.mode=l;break}if(64&S){t.msg="invalid literal/length code",i.mode=h;break}i.extra=15&S,i.mode=22;case 22:if(i.extra){for(L=i.extra;F<L;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}i.length+=b&(1<<i.extra)-1,b>>>=i.extra,F-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;S=(z=i.distcode[b&(1<<i.distbits)-1])>>>16&255,E=65535&z,!((I=z>>>24)<=F);){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}if(!(240&S)){for(N=I,M=S,R=E;S=(z=i.distcode[R+((b&(1<<N+M)-1)>>N)])>>>16&255,E=65535&z,!(N+(I=z>>>24)<=F);){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}b>>>=N,F-=N,i.back+=N}if(b>>>=I,F-=I,i.back+=I,64&S){t.msg="invalid distance code",i.mode=h;break}i.offset=E,i.extra=15&S,i.mode=24;case 24:if(i.extra){for(L=i.extra;F<L;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}i.offset+=b&(1<<i.extra)-1,b>>>=i.extra,F-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=h;break}i.mode=25;case 25:if(0===w)break t;if(_=C-w,i.offset>_){if((_=i.offset-_)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=h;break}_>i.wnext?(_-=i.wnext,x=i.wsize-_):x=i.wnext-_,_>i.length&&(_=i.length),k=i.window}else k=f,x=g-i.offset,_=i.length;_>w&&(_=w),w-=_,i.length-=_;do{f[g++]=k[x++]}while(--_);0===i.length&&(i.mode=21);break;case 26:if(0===w)break t;f[g++]=i.length,w--,i.mode=21;break;case 27:if(i.wrap){for(;F<32;){if(0===m)break t;m--,b|=u[p++]<<F,F+=8}if(C-=w,t.total_out+=C,i.total+=C,C&&(t.adler=i.check=i.flags?o(i.check,f,C,g-C):s(i.check,f,C,g-C)),C=w,(i.flags?b:d(b))!==i.check){t.msg="incorrect data check",i.mode=h;break}b=0,F=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;F<32;){if(0===m)break t;m--,b+=u[p++]<<F,F+=8}if(b!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=h;break}b=0,F=0}i.mode=29;case 29:B=1;break t;case h:B=-3;break t;case 31:return-4;default:return c}return t.next_out=g,t.avail_out=w,t.next_in=p,t.avail_in=m,i.hold=b,i.bits=F,(i.wsize||C!==t.avail_out&&i.mode<h&&(i.mode<27||4!==e))&&y(t,t.output,t.next_out,C-t.avail_out)?(i.mode=31,-4):(A-=t.avail_in,C-=t.avail_out,t.total_in+=A,t.total_out+=C,i.total+=C,i.wrap&&C&&(t.adler=i.check=i.flags?o(i.check,f,C,t.next_out-C):s(i.check,f,C,t.next_out-C)),t.data_type=i.bits+(i.last?64:0)+(i.mode===l?128:0)+(20===i.mode||15===i.mode?256:0),(0===A&&0===C||4===e)&&0===B&&(B=-5),B)},e.inflateEnd=function(t){if(!t||!t.state)return c;var e=t.state;return e.window&&(e.window=null),t.state=null,0},e.inflateGetHeader=function(t,e){var i;return t&&t.state&&2&(i=t.state).wrap?(i.head=e,e.done=!1,0):c},e.inflateSetDictionary=function(t,e){var i,r=e.length;return t&&t.state?0!==(i=t.state).wrap&&11!==i.mode?c:11===i.mode&&s(1,e,r,0)!==i.check?-3:y(t,e,r,r)?(i.mode=31,-4):(i.havedict=1,0):c},e.inflateInfo="pako inflate (from Nodeca project)"},1492:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(i(4141)),o=i(6761),n=i(6272);class a extends s.default{constructor(t,e){if(super(t,e),"int"!==this.dataType)throw new n.CramUnimplementedError(`${this.dataType} decoding not yet implemented by SUBEXP codec`)}decode(t,e,i,r){let s,n,a=0;for(;(0,o.getBits)(e.content,r.coreBlock,1);)a+=1;return 0===a?(s=this.parameters.K,n=(0,o.getBits)(e.content,r.coreBlock,s)):(s=a+this.parameters.K-1,n=1<<s|(0,o.getBits)(e.content,r.coreBlock,s)),n-this.parameters.offset}}e.default=a},1558:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,i,r){let a=t.getInt(),c=t.getInt(),l=t.getInt(),h=t.getInt();const d=r.remaining(),u=-4&d;for(let s=0;s<u;s+=4){const d=e.R[n.default.get(a,o.TF_SHIFT)],u=e.R[n.default.get(c,o.TF_SHIFT)],f=e.R[n.default.get(l,o.TF_SHIFT)],p=e.R[n.default.get(h,o.TF_SHIFT)];r.putAt(s,d),r.putAt(s+1,u),r.putAt(s+2,f),r.putAt(s+3,p),a=n.default.advanceSymbolStep(a,i[255&d],o.TF_SHIFT),c=n.default.advanceSymbolStep(c,i[255&u],o.TF_SHIFT),l=n.default.advanceSymbolStep(l,i[255&f],o.TF_SHIFT),h=n.default.advanceSymbolStep(h,i[255&p],o.TF_SHIFT),a=n.default.renormalize(a,t),c=n.default.renormalize(c,t),l=n.default.renormalize(l,t),h=n.default.renormalize(h,t)}let f;switch(r.setPosition(u),3&d){case 0:break;case 1:f=e.R[n.default.get(a,o.TF_SHIFT)],n.default.advanceSymbol(a,t,i[255&f],o.TF_SHIFT),r.put(f);break;case 2:f=e.R[n.default.get(a,o.TF_SHIFT)],n.default.advanceSymbol(a,t,i[255&f],o.TF_SHIFT),r.put(f),f=e.R[n.default.get(c,o.TF_SHIFT)],n.default.advanceSymbol(c,t,i[255&f],o.TF_SHIFT),r.put(f);break;case 3:f=e.R[n.default.get(a,o.TF_SHIFT)],n.default.advanceSymbol(a,t,i[255&f],o.TF_SHIFT),r.put(f),f=e.R[n.default.get(c,o.TF_SHIFT)],n.default.advanceSymbol(c,t,i[255&f],o.TF_SHIFT),r.put(f),f=e.R[n.default.get(l,o.TF_SHIFT)],n.default.advanceSymbol(l,t,i[255&f],o.TF_SHIFT),r.put(f);break;default:throw new s.CramMalformedError("invalid output size encountered during rANS decoding")}r.setPosition(0)};const s=i(6272),o=i(7151),n=r(i(9301))},1609:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.instantiateCodec=function t(e,i){const r=(s="ignore"===i?0:e.codecId,u[s]);var s;if(!r)throw new d.CramUnimplementedError(`no codec implemented for codec ID ${e.codecId}`);return new r(e.parameters,i,t)};const s=r(i(807)),o=r(i(7934)),n=r(i(8006)),a=r(i(8930)),c=r(i(632)),l=r(i(4056)),h=r(i(1492)),d=i(6272),u={1:a.default,3:l.default,4:o.default,5:n.default,6:s.default,7:h.default,9:c.default}},1668:(t,e,i)=>{var r={};(0,i(9805).assign)(r,i(3303),i(7083),i(9681)),t.exports=r},1739:function(t,e,i){var r,s=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=this&&this.__importStar||(r=function(t){return r=Object.getOwnPropertyNames||function(t){var e=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[e.length]=i);return e},r(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i=r(t),n=0;n<i.length;n++)"default"!==i[n]&&s(e,t,i[n]);return o(e,t),e}),a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.decode=function(t,e,i){(t=new h.default(t)).ReadUint32();const r=t.ReadUint32(),s=t.ReadByte(),o=function(t,e,i,r){let s=-1;const o=new Array(256);for(;!t.EOF();){const e=t.ReadByte(),n=128&e,a=64&e,l=63&e;if(n&&(s++,o[s]=new Array(13)),l!=f&&n){const t=new Array(r-1).fill(A);o[s][f]=new h.default((0,c.concatUint8Array)([new Uint8Array(l),t]))}if(a){const e=t.ReadByte(),i=t.ReadByte();o[s][l]=new h.default(o[e][i].buf)}else{const e=t.ReadUint7(),r=t.ReadData(e);o[s][l]=i?u.decode(r):d.decode(r),o[s][l]=new h.default(o[s][l])}}return o}(t,0,s,r),n=new Array(r),a=new Array(r);let l="";void 0===i&&(i="\n");for(let t=0;t<r;t++)l+=x(o,n,a,t)+i;return l};const c=i(6951),l=a(i(9505)),h=a(i(3088)),d=n(i(9313)),u=new l.default,f=0,p=1,g=2,m=3,w=4,b=5,F=7,v=8,y=9,A=10,C=12;function _(t,e){let i=t+"";for(;i.length<e;)i="0"+i;return i}function x(t,e,i,r){let s=t[0][f].ReadByte();const o=r-t[0][s].ReadUint32();if(s==b)return e[r]=e[o],i[r]=i[o],e[r];let n=1;e[r]="",i[r]=new Array(256);do{switch(s=t[n][f].ReadByte(),s){case g:i[r][n]=t[n][g].ReadChar();break;case p:i[r][n]=t[n][p].ReadString();break;case F:i[r][n]=t[n][F].ReadUint32();break;case m:var a=t[n][m].ReadUint32(),c=t[n][w].ReadByte();i[r][n]=_(a,c);break;case v:i[r][n]=(0|i[o][n])+t[n][v].ReadByte();break;case y:a=(0|i[o][n])+t[n][y].ReadByte(),c=i[o][n].length,i[r][n]=_(a,c);break;case A:i[r][n]=i[o][n];break;default:i[r][n]=""}e[r]+=i[r][n++]}while(s!=C);return e[r]}},1996:(t,e,i)=>{var r=i(9805),s=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(t){s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){o=!1}for(var n=new r.Buf8(256),a=0;a<256;a++)n[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function c(t,e){if(e<65534&&(t.subarray&&o||!t.subarray&&s))return String.fromCharCode.apply(null,r.shrinkBuf(t,e));for(var i="",n=0;n<e;n++)i+=String.fromCharCode(t[n]);return i}n[254]=n[254]=1,e.string2buf=function(t){var e,i,s,o,n,a=t.length,c=0;for(o=0;o<a;o++)55296==(64512&(i=t.charCodeAt(o)))&&o+1<a&&56320==(64512&(s=t.charCodeAt(o+1)))&&(i=65536+(i-55296<<10)+(s-56320),o++),c+=i<128?1:i<2048?2:i<65536?3:4;for(e=new r.Buf8(c),n=0,o=0;n<c;o++)55296==(64512&(i=t.charCodeAt(o)))&&o+1<a&&56320==(64512&(s=t.charCodeAt(o+1)))&&(i=65536+(i-55296<<10)+(s-56320),o++),i<128?e[n++]=i:i<2048?(e[n++]=192|i>>>6,e[n++]=128|63&i):i<65536?(e[n++]=224|i>>>12,e[n++]=128|i>>>6&63,e[n++]=128|63&i):(e[n++]=240|i>>>18,e[n++]=128|i>>>12&63,e[n++]=128|i>>>6&63,e[n++]=128|63&i);return e},e.buf2binstring=function(t){return c(t,t.length)},e.binstring2buf=function(t){for(var e=new r.Buf8(t.length),i=0,s=e.length;i<s;i++)e[i]=t.charCodeAt(i);return e},e.buf2string=function(t,e){var i,r,s,o,a=e||t.length,l=new Array(2*a);for(r=0,i=0;i<a;)if((s=t[i++])<128)l[r++]=s;else if((o=n[s])>4)l[r++]=65533,i+=o-1;else{for(s&=2===o?31:3===o?15:7;o>1&&i<a;)s=s<<6|63&t[i++],o--;o>1?l[r++]=65533:s<65536?l[r++]=s:(s-=65536,l[r++]=55296|s>>10&1023,l[r++]=56320|1023&s)}return c(l,r)},e.utf8border=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+n[t[i]]>e?i:e}},1998:(t,e,i)=>{var r=i(9805),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],n=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(t,e,i,c,l,h,d,u){var f,p,g,m,w,b,F,v,y,A=u.bits,C=0,_=0,x=0,k=0,I=0,S=0,E=0,N=0,M=0,R=0,D=null,B=0,T=new r.Buf16(16),L=new r.Buf16(16),z=null,P=0;for(C=0;C<=15;C++)T[C]=0;for(_=0;_<c;_++)T[e[i+_]]++;for(I=A,k=15;k>=1&&0===T[k];k--);if(I>k&&(I=k),0===k)return l[h++]=20971520,l[h++]=20971520,u.bits=1,0;for(x=1;x<k&&0===T[x];x++);for(I<x&&(I=x),N=1,C=1;C<=15;C++)if(N<<=1,(N-=T[C])<0)return-1;if(N>0&&(0===t||1!==k))return-1;for(L[1]=0,C=1;C<15;C++)L[C+1]=L[C]+T[C];for(_=0;_<c;_++)0!==e[i+_]&&(d[L[e[i+_]]++]=_);if(0===t?(D=z=d,b=19):1===t?(D=s,B-=257,z=o,P-=257,b=256):(D=n,z=a,b=-1),R=0,_=0,C=x,w=h,S=I,E=0,g=-1,m=(M=1<<I)-1,1===t&&M>852||2===t&&M>592)return 1;for(;;){F=C-E,d[_]<b?(v=0,y=d[_]):d[_]>b?(v=z[P+d[_]],y=D[B+d[_]]):(v=96,y=0),f=1<<C-E,x=p=1<<S;do{l[w+(R>>E)+(p-=f)]=F<<24|v<<16|y}while(0!==p);for(f=1<<C-1;R&f;)f>>=1;if(0!==f?(R&=f-1,R+=f):R=0,_++,0===--T[C]){if(C===k)break;C=e[i+d[_]]}if(C>I&&(R&m)!==g){for(0===E&&(E=I),w+=x,N=1<<(S=C-E);S+E<k&&!((N-=T[S+E])<=0);)S++,N<<=1;if(M+=1<<S,1===t&&M>852||2===t&&M>592)return 1;l[g=R&m]=I<<24|S<<16|w-h}}return 0!==R&&(l[w+R]=C-E<<24|64<<16),u.bits=I,0}},2151:t=>{var e={utf8:{stringToBytes:function(t){return e.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(e.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],i=0;i<t.length;i++)e.push(255&t.charCodeAt(i));return e},bytesToString:function(t){for(var e=[],i=0;i<t.length;i++)e.push(String.fromCharCode(t[i]));return e.join("")}}};t.exports=e},2169:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.unzip=function(t){return(0,r.inflate)(t)};const r=i(1668)},2324:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{constructor(t=256){this.total_freq=t,this.max_sym=t-1,this.S=[],this.F=[];for(let t=0;t<=this.max_sym;t++)this.S[t]=t,this.F[t]=1}ModelDecode(t,e){const i=e.RangeGetFrequency(this.total_freq);let r=0,s=0;for(;r+this.F[s]<=i;)r+=this.F[s++];e.RangeDecode(t,r,this.F[s],this.total_freq),this.F[s]+=16,this.total_freq+=16,this.total_freq>65519&&this.ModelRenormalise();const o=this.S[s];if(s>0&&this.F[s]>this.F[s-1]){let t=this.F[s];this.F[s]=this.F[s-1],this.F[s-1]=t,t=this.S[s],this.S[s]=this.S[s-1],this.S[s-1]=t}return o}ModelRenormalise(){this.total_freq=0;for(let t=0;t<=this.max_sym;t++)this.F[t]-=Math.floor(this.F[t]/2),this.total_freq+=this.F[t]}ModelEncode(t,e,i){let r=0;for(var s=0;this.S[s]!=i;s++)r+=this.F[s];if(e.RangeEncode(t,r,this.F[s],this.total_freq),this.F[s]+=16,this.total_freq+=16,this.total_freq>65519&&this.ModelRenormalise(),i=this.S[s],s>0&&this.F[s]>this.F[s-1]){let t=this.F[s];this.F[s]=this.F[s-1],this.F[s-1]=t,t=this.S[s],this.S[s]=this.S[s-1],this.S[s-1]=t}}}},2549:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TWO_PWR_56_DBL=e.TWO_PWR_24_DBL=e.TWO_PWR_64_DBL=e.TWO_PWR_32_DBL=e.TWO_PWR_16_DBL=void 0,e.itf8Size=function(t){return-128&t?-16384&t?-2097152&t?-268435456&t?5:4:3:2:1},e.parseItf8=function(t,e){let i=e;const r=t[i];let s;return r<128?(s=r,i+=1):r<192?(s=(63&r)<<8|t[i+1],i+=2):r<224?(s=(31&r)<<16|t[i+1]<<8|t[i+2],i+=3):r<240?(s=(15&r)<<24|t[i+1]<<16|t[i+2]<<8|t[i+3],i+=4):(s=(15&r)<<28|t[i+1]<<20|t[i+2]<<12|t[i+3]<<4|15&t[i+4],i+=5),[s,i-e]},e.parseLtf8=function(t,i){let r=i;const s=t[r];let o;return s<128?(o=s,r+=1):s<192?(o=16383&(s<<8|t[r+1]),r+=2):s<224?(o=(63&s)<<16|t[r+1]<<8|t[r+2],r+=3):s<240?(o=(31&s)<<24|t[r+1]<<16|t[r+2]<<8|t[r+3],r+=4):s<248?(o=(15&t[r])*e.TWO_PWR_32_DBL+(t[r+1]<<24|t[r+2]<<16|t[r+3]<<8|t[r+4]),r+=5):s<252?(o=((7&t[r])<<8|t[r+1])*e.TWO_PWR_32_DBL+(t[r+2]<<24|t[r+3]<<16|t[r+4]<<8|t[r+5]),r+=6):s<254?(o=((3&t[r])<<16|t[r+1]<<8|t[r+2])*e.TWO_PWR_32_DBL+(t[r+3]<<24|t[r+4]<<16|t[r+5]<<8|t[r+6]),r+=7):s<255?(o=(t[r+1]<<24|t[r+2]<<16|t[r+3]<<8|t[r+4])*e.TWO_PWR_32_DBL+(t[r+5]<<24|t[r+6]<<16|t[r+7]<<8|t[r+8]),r+=8):(o=t[r+1]*e.TWO_PWR_56_DBL+(t[r+2]<<24|t[r+3]<<16|t[r+4]<<8|t[r+5])*e.TWO_PWR_32_DBL+(t[r+6]<<24|t[r+7]<<16|t[r+8]<<8|t[r+9]),r+=9),[o,r-i]},e.parseItem=function(t,e,i=0,r=0){const{offset:s,value:o}=e(t,i);return{...o,_endPosition:s+r,_size:s-i}},e.tinyMemoize=function(t,e){const i=t.prototype[e],r=`_memo_${e}`;t.prototype[e]=function(){if(!(r in this)){const t=i.call(this);this[r]=t,Promise.resolve(t).catch(()=>{delete this[r]})}return this[r]}},e.sequenceMD5=function(t){return(0,s.default)(t.toUpperCase().replaceAll(/[^\u0021-\u007e]/g,""))};const s=r(i(3503));e.TWO_PWR_16_DBL=65536,e.TWO_PWR_32_DBL=e.TWO_PWR_16_DBL*e.TWO_PWR_16_DBL,e.TWO_PWR_64_DBL=e.TWO_PWR_32_DBL*e.TWO_PWR_32_DBL,e.TWO_PWR_24_DBL=1<<24,e.TWO_PWR_56_DBL=e.TWO_PWR_24_DBL*e.TWO_PWR_32_DBL},2616:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const r=i(9846);e.default=class{constructor(t,e={}){this.filename=t}async read(t,e=0){const i=new Uint8Array(t),s=await(0,r.open)(this.filename,"r"),o=await s.read(i,0,t,e);return await s.close(),o.buffer.subarray(0,o.bytesRead)}async readFile(t){const e=await(0,r.readFile)(this.filename,t);return"string"==typeof e?e:new Uint8Array(e)}async stat(){return(0,r.stat)(this.filename)}async close(){}}},2660:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.decode=function(t,e){return function(t,e){const i=t.ReadUint7(),r=function(t){const e={max_sym:0};if(5!=t.ReadByte())return void console.error("Invalid FQZComp version number");const i=t.ReadByte(),r=i&g?t.ReadByte():1;let s=i.nparam>1?i.nparam-1:0;const o=new Array(256);if(i&m)s=t.ReadByte(),a(t,o,256);else{for(var n=0;n<r;n++)o[n]=n;for(;n<256;n++)o[n]=r-1}e.do_rev=i&w,e.stab=o,e.max_sel=s,e.params=new Array(e.nparam);for(let i=0;i<r;i++)e.params[i]=F(t),e.max_sym<e.params[i].max_sym&&(e.max_sym=e.params[i].max_sym);return e}(t);if(!r)return;var n=r.params;const c=new Array(e.length),l=function(t){const e={};e.qual=new Array(65536);for(var i=0;i<65536;i++)e.qual[i]=new o.default(t.max_sym+1);for(e.len=new Array(4),i=0;i<4;i++)e.len[i]=new o.default(256);return e.rev=new o.default(2),e.dup=new o.default(2),t.max_sel>0&&(e.sel=new o.default(t.max_sel+1)),e}(r),h=new s.default(t);h.RangeStartDecode(t);const d=new Uint8Array(i),u={qctx:0,prevq:0,delta:0,p:0,s:0,x:0,len:0,is_dup:0,rec:0};let f=0;for(;f<i;){if(0==u.p){if(v(t,h,r,l,u,c),u.is_dup>0&&l.dup.ModelDecode(t,h)){for(let t=0;t<len;t++)d[f+t]=d[f+t-u.len];f+=u.len,u.p=0;continue}e.push(u.len);var p=(n=r.params[u.x]).context}const i=l.qual[p].ModelDecode(t,h);d[f++]=n.qmap[i],p=b(n,u,i)}return r.do_rev&&function(t,e,i,r){let s=0,o=0;for(;o<e;){if(i[s]){let e=0,i=r[s]-1;for(;e<i;){const r=t[o+e];t[o+e]=t[o+i],t[o+i]=r,e++,i--}}o+=r[s++]}}(d,i,c,e),d}(new n.default(t),e)};const s=r(i(4652)),o=r(i(2324)),n=r(i(3088));function a(t,e,i){let r=0,s=0,o=-1;const n=new Array(1024);for(;s<i;){const e=t.ReadByte();if(n[r++]=e,s+=e,e==o){let i=t.ReadByte();for(s+=e*i;i--;)n[r++]=e}o=e}let a=0;for(r=0,s=0;s<i;){let t=0;do{var c=n[r++];t+=c}while(255==c);for(;t--;)e[s++]=a;a++}}const c=2,l=4,h=8,d=16,u=32,f=64,p=128,g=1,m=2,w=4;function b(t,e,i){let r=t.context;return e.qctx=(e.qctx<<t.qshift)+t.qtab[i],r+=(e.qctx&(1<<t.qbits)-1)<<t.qloc,t.do_pos&&(r+=t.ptab[Math.min(e.p,1023)]<<t.ploc),t.do_delta&&(r+=t.dtab[Math.min(e.delta,255)]<<t.dloc,e.delta+=e.prevq!=i?1:0,e.prevq=i),t.do_sel&&(r+=e.s<<t.sloc),e.p--,65535&r}function F(t){const e={};e.context=t.ReadUint16(),e.pflags=t.ReadByte(),e.do_dedup=e.pflags&c,e.fixed_len=e.pflags&l,e.do_sel=e.pflags&h,e.do_qmap=e.pflags&d,e.do_pos=e.pflags&u,e.do_delta=e.pflags&f,e.do_qtab=e.pflags&p,e.max_sym=t.ReadByte();let i=t.ReadByte();if(e.qbits=i>>4,e.qshift=15&i,i=t.ReadByte(),e.qloc=i>>4,e.sloc=15&i,i=t.ReadByte(),e.ploc=i>>4,e.dloc=15&i,e.qmap=new Array(256),e.pflags&d)for(var r=0;r<e.max_sym;r++)e.qmap[r]=t.ReadByte();else for(r=0;r<256;r++)e.qmap[r]=r;if(e.qtab=new Array(1024),e.qbits>0&&e.pflags&p)a(t,e.qtab,256);else for(r=0;r<256;r++)e.qtab[r]=r;return e.ptab=new Array(1024),e.pflags&u&&a(t,e.ptab,1024),e.dtab=new Array(256),e.pflags&f&&a(t,e.dtab,256),e}function v(t,e,i,r,s,o){s.s=i.max_sel>0?r.sel.ModelDecode(t,e):0,s.x=i.stab[s.s];const n=i.params[s.x];if(n.fixed_len>=0){var a=r.len[0].ModelDecode(t,e);a|=r.len[1].ModelDecode(t,e)<<8,a|=r.len[2].ModelDecode(t,e)<<16,a|=r.len[3].ModelDecode(t,e)<<24,n.fixed_len>0&&(n.fixed_len=-a)}else a=-n.fixed_len;s.len=a,i.do_rev&&(o[s.rec]=r.rev.ModelDecode(t,e)),s.is_dup=0,n.pflags&c&&r.dup.ModelDecode(t,e)&&(s.is_dup=1),s.p=a,s.delta=0,s.qctx=0,s.prevq=0,s.rec++}},2670:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,i=0){if(0===t.length)return e.fill(0),e;const r=new h(t,i),d=r.get();if(0!==d&&1!==d)throw new s.CramMalformedError(`Invalid rANS order ${d}`);if(r.getInt()!==r.remaining()-l)throw new s.CramMalformedError("Incorrect input length.");const u=r.getInt(),f=new h(e||new Uint8Array(u));if(f.length<u)throw new s.CramMalformedError(`Output buffer too small to fit ${u} bytes.`);switch(d){case 0:return function(t,e){const i=new a.default.AriDecoder,r=new Array(256);for(let t=0;t<r.length;t+=1)r[t]=new a.default.DecodingSymbol;return(0,c.readStatsO0)(t,i,r),(0,o.default)(t,i,r,e),e}(r,f);case 1:return function(t,e){const i=new Array(256);for(let t=0;t<i.length;t+=1)i[t]=new a.default.AriDecoder;const r=new Array(256);for(let t=0;t<r.length;t+=1){r[t]=new Array(256);for(let e=0;e<r[t].length;e+=1)r[t][e]=new a.default.DecodingSymbol}return(0,c.readStatsO1)(t,i,r),(0,n.default)(t,e,i,r),e}(r,f);default:throw new s.CramMalformedError(`Invalid rANS order: ${d}`)}};const s=i(6272),o=r(i(1558)),n=r(i(2867)),a=r(i(9301)),c=i(6268),l=4;class h{constructor(t,e=0){this._buffer=t,this._dataView=new DataView(t.buffer),this._position=e,this.length=t.length}get(){const t=this._buffer[this._position];return this._position+=1,t}getByte(){return this.get()}getByteAt(t){return this._buffer[t]}position(){return this._position}put(t){return this._buffer[this._position]=t,this._position+=1,t}putAt(t,e){return this._buffer[t]=e,e}setPosition(t){return this._position=t,t}getInt(){const t=this._dataView.getInt32(this._position,!0);return this._position+=4,t}remaining(){return this._buffer.length-this._position}}},2845:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=i(6272),o=r(i(500)),n=i(2549),a=r(i(8700)),c=i(7580);class l{constructor(t,e){this.file=t,this.filePosition=e}getHeader(){return this._readContainerHeader(this.filePosition)}async getCompressionHeaderBlock(){if(!(await this.getHeader()).numRecords)return null;const{majorVersion:t}=await this.file.getDefinition(),e=(0,c.getSectionParsers)(t),i=await this.getFirstBlock();if("COMPRESSION_HEADER"!==i.contentType)throw new s.CramMalformedError(`invalid content type ${i.contentType} in compression header block`);const r=(0,n.parseItem)(i.content,e.cramCompressionHeader.parser,0,i.contentPosition);return{...i,parsedContent:r}}async getFirstBlock(){const t=await this.getHeader();return this.file.readBlock(t._endPosition)}async getCompressionScheme(){const t=await this.getCompressionHeaderBlock();if(t)return new a.default(t.parsedContent)}getSlice(t,e){return new o.default(this,t,e)}async _readContainerHeader(t){const{majorVersion:e}=await this.file.getDefinition(),i=(0,c.getSectionParsers)(e),{cramContainerHeader1:r,cramContainerHeader2:s}=i,o=await this.file.read(r.maxLength,t),a=(0,n.parseItem)(o,r.parser),l=(0,n.itf8Size)(a.numLandmarks),h=await this.file.read(s.maxLength(a.numLandmarks),t+a._size-l),d=(0,n.parseItem)(h,s.parser);return this.file.validateChecksums&&void 0!==d.crc32&&await this.file.checkCrc32(t,a._size+d._size-l-4,d.crc32,`container header beginning at position ${t}`),{...a,...d,_size:a._size+d._size-l,_endPosition:a._size+d._size-l+t}}}e.default=l,"getHeader getCompressionHeaderBlock getCompressionScheme".split(" ").forEach(t=>{(0,n.tinyMemoize)(l,t)})},2867:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,i,r){const n=e.remaining();let a=t.getInt(),c=t.getInt(),l=t.getInt(),h=t.getInt();const d=n>>2;let u=0,f=d,p=2*d,g=3*d,m=0,w=0,b=0,F=0;for(;u<d;u+=1,f+=1,p+=1,g+=1){const n=255&i[m].R[o.default.get(a,s.TF_SHIFT)],d=255&i[w].R[o.default.get(c,s.TF_SHIFT)],v=255&i[b].R[o.default.get(l,s.TF_SHIFT)],y=255&i[F].R[o.default.get(h,s.TF_SHIFT)];e.putAt(u,n),e.putAt(f,d),e.putAt(p,v),e.putAt(g,y),a=o.default.advanceSymbolStep(a,r[m][n],s.TF_SHIFT),c=o.default.advanceSymbolStep(c,r[w][d],s.TF_SHIFT),l=o.default.advanceSymbolStep(l,r[b][v],s.TF_SHIFT),h=o.default.advanceSymbolStep(h,r[F][y],s.TF_SHIFT),a=o.default.renormalize(a,t),c=o.default.renormalize(c,t),l=o.default.renormalize(l,t),h=o.default.renormalize(h,t),m=n,w=d,b=v,F=y}for(;g<n;g+=1){const n=255&i[F].R[o.default.get(h,s.TF_SHIFT)];e.putAt(g,n),h=o.default.advanceSymbol(h,t,r[F][n],s.TF_SHIFT),F=n}};const s=i(7151),o=r(i(9301))},3088:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{constructor(t,e=0,i=0){0!==i?(this.buf=new Uint8Array(i),this.length=i):(this.buf=t,this.length=t.length),this.dataView=new DataView(this.buf.buffer),this.pos=e}EOF(){return this.pos>=this.length}ReadData(t){const e=this.buf.slice(this.pos,this.pos+t);return this.pos+=t,e}ReadByte(){const t=this.buf[this.pos];return this.pos++,t}ReadChar(){const t=this.buf[this.pos];return this.pos++,String.fromCharCode(t)}ReadUint16(){let t=this.ReadByte();return t|=this.ReadByte()<<8,t}ReadUint32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}ReadString(){let t,e="";do{t=this.buf[this.pos++],t&&(e+=String.fromCharCode(t))}while(t);return e}ReadUint7(){let t,e=0;do{t=this.ReadByte(),e=e<<7|127&t}while(128&t);return e}ReadITF8(){let t=this.buf[this.pos];return this.pos++,t>=240?(t=(15&t)<<28,t+=(this.buf[this.pos+0]<<20)+(this.buf[this.pos+1]<<12)+(this.buf[this.pos+2]<<4)+(this.buf[this.pos+3]>>4),this.pos+=4):t>=224?(t=(15&t)<<24,t+=(this.buf[this.pos+0]<<16)+(this.buf[this.pos+1]<<8)+(0|this.buf[this.pos+2]),this.pos+=3):t>=192?(t=(31&t)<<16,t+=(this.buf[this.pos+0]<<8)+(0|this.buf[this.pos+1]),this.pos+=2):t>=128&&(t=(63&t)<<8,t+=this.buf[this.pos],this.pos++),t}}},3269:t=>{t.exports=function(t,e,i,r){for(var s=65535&t,o=t>>>16&65535,n=0;0!==i;){i-=n=i>2e3?2e3:i;do{o=o+(s=s+e[r++]|0)|0}while(--n);s%=65521,o%=65521}return s|o<<16}},3303:(t,e,i)=>{var r=i(8411),s=i(9805),o=i(1996),n=i(4674),a=i(4442),c=Object.prototype.toString;function l(t){if(!(this instanceof l))return new l(t);this.options=s.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var i=r.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(0!==i)throw new Error(n[i]);if(e.header&&r.deflateSetHeader(this.strm,e.header),e.dictionary){var h;if(h="string"==typeof e.dictionary?o.string2buf(e.dictionary):"[object ArrayBuffer]"===c.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(i=r.deflateSetDictionary(this.strm,h)))throw new Error(n[i]);this._dict_set=!0}}function h(t,e){var i=new l(e);if(i.push(t,!0),i.err)throw i.msg||n[i.err];return i.result}l.prototype.push=function(t,e){var i,n,a=this.strm,l=this.options.chunkSize;if(this.ended)return!1;n=e===~~e?e:!0===e?4:0,"string"==typeof t?a.input=o.string2buf(t):"[object ArrayBuffer]"===c.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new s.Buf8(l),a.next_out=0,a.avail_out=l),1!==(i=r.deflate(a,n))&&0!==i)return this.onEnd(i),this.ended=!0,!1;0!==a.avail_out&&(0!==a.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(o.buf2binstring(s.shrinkBuf(a.output,a.next_out))):this.onData(s.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||0===a.avail_out)&&1!==i);return 4===n?(i=r.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==n||(this.onEnd(0),a.avail_out=0,!0)},l.prototype.onData=function(t){this.chunks.push(t)},l.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=l,e.deflate=h,e.deflateRaw=function(t,e){return(e=e||{}).raw=!0,h(t,e)},e.gzip=function(t,e){return(e=e||{}).gzip=!0,h(t,e)}},3503:(t,e,i)=>{var r,s,o,n,a;r=i(3939),s=i(2151).utf8,o=i(652),n=i(2151).bin,(a=function(t,e){t.constructor==String?t=e&&"binary"===e.encoding?n.stringToBytes(t):s.stringToBytes(t):o(t)?t=Array.prototype.slice.call(t,0):Array.isArray(t)||t.constructor===Uint8Array||(t=t.toString());for(var i=r.bytesToWords(t),c=8*t.length,l=1732584193,h=-271733879,d=-1732584194,u=271733878,f=0;f<i.length;f++)i[f]=16711935&(i[f]<<8|i[f]>>>24)|4278255360&(i[f]<<24|i[f]>>>8);i[c>>>5]|=128<<c%32,i[14+(c+64>>>9<<4)]=c;var p=a._ff,g=a._gg,m=a._hh,w=a._ii;for(f=0;f<i.length;f+=16){var b=l,F=h,v=d,y=u;l=p(l,h,d,u,i[f+0],7,-680876936),u=p(u,l,h,d,i[f+1],12,-389564586),d=p(d,u,l,h,i[f+2],17,606105819),h=p(h,d,u,l,i[f+3],22,-1044525330),l=p(l,h,d,u,i[f+4],7,-176418897),u=p(u,l,h,d,i[f+5],12,1200080426),d=p(d,u,l,h,i[f+6],17,-1473231341),h=p(h,d,u,l,i[f+7],22,-45705983),l=p(l,h,d,u,i[f+8],7,1770035416),u=p(u,l,h,d,i[f+9],12,-1958414417),d=p(d,u,l,h,i[f+10],17,-42063),h=p(h,d,u,l,i[f+11],22,-1990404162),l=p(l,h,d,u,i[f+12],7,1804603682),u=p(u,l,h,d,i[f+13],12,-40341101),d=p(d,u,l,h,i[f+14],17,-1502002290),l=g(l,h=p(h,d,u,l,i[f+15],22,1236535329),d,u,i[f+1],5,-165796510),u=g(u,l,h,d,i[f+6],9,-1069501632),d=g(d,u,l,h,i[f+11],14,643717713),h=g(h,d,u,l,i[f+0],20,-373897302),l=g(l,h,d,u,i[f+5],5,-701558691),u=g(u,l,h,d,i[f+10],9,38016083),d=g(d,u,l,h,i[f+15],14,-660478335),h=g(h,d,u,l,i[f+4],20,-405537848),l=g(l,h,d,u,i[f+9],5,568446438),u=g(u,l,h,d,i[f+14],9,-1019803690),d=g(d,u,l,h,i[f+3],14,-187363961),h=g(h,d,u,l,i[f+8],20,1163531501),l=g(l,h,d,u,i[f+13],5,-1444681467),u=g(u,l,h,d,i[f+2],9,-51403784),d=g(d,u,l,h,i[f+7],14,1735328473),l=m(l,h=g(h,d,u,l,i[f+12],20,-1926607734),d,u,i[f+5],4,-378558),u=m(u,l,h,d,i[f+8],11,-2022574463),d=m(d,u,l,h,i[f+11],16,1839030562),h=m(h,d,u,l,i[f+14],23,-35309556),l=m(l,h,d,u,i[f+1],4,-1530992060),u=m(u,l,h,d,i[f+4],11,1272893353),d=m(d,u,l,h,i[f+7],16,-155497632),h=m(h,d,u,l,i[f+10],23,-1094730640),l=m(l,h,d,u,i[f+13],4,681279174),u=m(u,l,h,d,i[f+0],11,-358537222),d=m(d,u,l,h,i[f+3],16,-722521979),h=m(h,d,u,l,i[f+6],23,76029189),l=m(l,h,d,u,i[f+9],4,-640364487),u=m(u,l,h,d,i[f+12],11,-421815835),d=m(d,u,l,h,i[f+15],16,530742520),l=w(l,h=m(h,d,u,l,i[f+2],23,-995338651),d,u,i[f+0],6,-198630844),u=w(u,l,h,d,i[f+7],10,1126891415),d=w(d,u,l,h,i[f+14],15,-1416354905),h=w(h,d,u,l,i[f+5],21,-57434055),l=w(l,h,d,u,i[f+12],6,1700485571),u=w(u,l,h,d,i[f+3],10,-1894986606),d=w(d,u,l,h,i[f+10],15,-1051523),h=w(h,d,u,l,i[f+1],21,-2054922799),l=w(l,h,d,u,i[f+8],6,1873313359),u=w(u,l,h,d,i[f+15],10,-30611744),d=w(d,u,l,h,i[f+6],15,-1560198380),h=w(h,d,u,l,i[f+13],21,1309151649),l=w(l,h,d,u,i[f+4],6,-145523070),u=w(u,l,h,d,i[f+11],10,-1120210379),d=w(d,u,l,h,i[f+2],15,718787259),h=w(h,d,u,l,i[f+9],21,-343485551),l=l+b>>>0,h=h+F>>>0,d=d+v>>>0,u=u+y>>>0}return r.endian([l,h,d,u])})._ff=function(t,e,i,r,s,o,n){var a=t+(e&i|~e&r)+(s>>>0)+n;return(a<<o|a>>>32-o)+e},a._gg=function(t,e,i,r,s,o,n){var a=t+(e&r|i&~r)+(s>>>0)+n;return(a<<o|a>>>32-o)+e},a._hh=function(t,e,i,r,s,o,n){var a=t+(e^i^r)+(s>>>0)+n;return(a<<o|a>>>32-o)+e},a._ii=function(t,e,i,r,s,o,n){var a=t+(i^(e|~r))+(s>>>0)+n;return(a<<o|a>>>32-o)+e},a._blocksize=16,a._digestsize=16,t.exports=function(t,e){if(null==t)throw new Error("Illegal argument "+t);var i=r.wordsToBytes(a(t,e));return e&&e.asBytes?i:e&&e.asString?n.bytesToString(i):r.bytesToHex(i)}},3665:(t,e,i)=>{var r=i(9805);function s(t){for(var e=t.length;--e>=0;)t[e]=0}var o=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],n=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],c=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],l=new Array(576);s(l);var h=new Array(60);s(h);var d=new Array(512);s(d);var u=new Array(256);s(u);var f=new Array(29);s(f);var p,g,m,w=new Array(30);function b(t,e,i,r,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=s,this.has_stree=t&&t.length}function F(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function v(t){return t<256?d[t]:d[256+(t>>>7)]}function y(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function A(t,e,i){t.bi_valid>16-i?(t.bi_buf|=e<<t.bi_valid&65535,y(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=i)}function C(t,e,i){A(t,i[2*e],i[2*e+1])}function _(t,e){var i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1}function x(t,e,i){var r,s,o=new Array(16),n=0;for(r=1;r<=15;r++)o[r]=n=n+i[r-1]<<1;for(s=0;s<=e;s++){var a=t[2*s+1];0!==a&&(t[2*s]=_(o[a]++,a))}}function k(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function I(t){t.bi_valid>8?y(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function S(t,e,i,r){var s=2*e,o=2*i;return t[s]<t[o]||t[s]===t[o]&&r[e]<=r[i]}function E(t,e,i){for(var r=t.heap[i],s=i<<1;s<=t.heap_len&&(s<t.heap_len&&S(e,t.heap[s+1],t.heap[s],t.depth)&&s++,!S(e,r,t.heap[s],t.depth));)t.heap[i]=t.heap[s],i=s,s<<=1;t.heap[i]=r}function N(t,e,i){var r,s,a,c,l=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*l]<<8|t.pending_buf[t.d_buf+2*l+1],s=t.pending_buf[t.l_buf+l],l++,0===r?C(t,s,e):(C(t,(a=u[s])+256+1,e),0!==(c=o[a])&&A(t,s-=f[a],c),C(t,a=v(--r),i),0!==(c=n[a])&&A(t,r-=w[a],c))}while(l<t.last_lit);C(t,256,e)}function M(t,e){var i,r,s,o=e.dyn_tree,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,c=e.stat_desc.elems,l=-1;for(t.heap_len=0,t.heap_max=573,i=0;i<c;i++)0!==o[2*i]?(t.heap[++t.heap_len]=l=i,t.depth[i]=0):o[2*i+1]=0;for(;t.heap_len<2;)o[2*(s=t.heap[++t.heap_len]=l<2?++l:0)]=1,t.depth[s]=0,t.opt_len--,a&&(t.static_len-=n[2*s+1]);for(e.max_code=l,i=t.heap_len>>1;i>=1;i--)E(t,o,i);s=c;do{i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],E(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,o[2*s]=o[2*i]+o[2*r],t.depth[s]=(t.depth[i]>=t.depth[r]?t.depth[i]:t.depth[r])+1,o[2*i+1]=o[2*r+1]=s,t.heap[1]=s++,E(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var i,r,s,o,n,a,c=e.dyn_tree,l=e.max_code,h=e.stat_desc.static_tree,d=e.stat_desc.has_stree,u=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,p=e.stat_desc.max_length,g=0;for(o=0;o<=15;o++)t.bl_count[o]=0;for(c[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;i<573;i++)(o=c[2*c[2*(r=t.heap[i])+1]+1]+1)>p&&(o=p,g++),c[2*r+1]=o,r>l||(t.bl_count[o]++,n=0,r>=f&&(n=u[r-f]),a=c[2*r],t.opt_len+=a*(o+n),d&&(t.static_len+=a*(h[2*r+1]+n)));if(0!==g){do{for(o=p-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[p]--,g-=2}while(g>0);for(o=p;0!==o;o--)for(r=t.bl_count[o];0!==r;)(s=t.heap[--i])>l||(c[2*s+1]!==o&&(t.opt_len+=(o-c[2*s+1])*c[2*s],c[2*s+1]=o),r--)}}(t,e),x(o,l,t.bl_count)}function R(t,e,i){var r,s,o=-1,n=e[1],a=0,c=7,l=4;for(0===n&&(c=138,l=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)s=n,n=e[2*(r+1)+1],++a<c&&s===n||(a<l?t.bl_tree[2*s]+=a:0!==s?(s!==o&&t.bl_tree[2*s]++,t.bl_tree[32]++):a<=10?t.bl_tree[34]++:t.bl_tree[36]++,a=0,o=s,0===n?(c=138,l=3):s===n?(c=6,l=3):(c=7,l=4))}function D(t,e,i){var r,s,o=-1,n=e[1],a=0,c=7,l=4;for(0===n&&(c=138,l=3),r=0;r<=i;r++)if(s=n,n=e[2*(r+1)+1],!(++a<c&&s===n)){if(a<l)do{C(t,s,t.bl_tree)}while(0!==--a);else 0!==s?(s!==o&&(C(t,s,t.bl_tree),a--),C(t,16,t.bl_tree),A(t,a-3,2)):a<=10?(C(t,17,t.bl_tree),A(t,a-3,3)):(C(t,18,t.bl_tree),A(t,a-11,7));a=0,o=s,0===n?(c=138,l=3):s===n?(c=6,l=3):(c=7,l=4)}}s(w);var B=!1;function T(t,e,i,s){A(t,0+(s?1:0),3),function(t,e,i){I(t),y(t,i),y(t,~i),r.arraySet(t.pending_buf,t.window,e,i,t.pending),t.pending+=i}(t,e,i)}e._tr_init=function(t){B||(function(){var t,e,i,r,s,c=new Array(16);for(i=0,r=0;r<28;r++)for(f[r]=i,t=0;t<1<<o[r];t++)u[i++]=r;for(u[i-1]=r,s=0,r=0;r<16;r++)for(w[r]=s,t=0;t<1<<n[r];t++)d[s++]=r;for(s>>=7;r<30;r++)for(w[r]=s<<7,t=0;t<1<<n[r]-7;t++)d[256+s++]=r;for(e=0;e<=15;e++)c[e]=0;for(t=0;t<=143;)l[2*t+1]=8,t++,c[8]++;for(;t<=255;)l[2*t+1]=9,t++,c[9]++;for(;t<=279;)l[2*t+1]=7,t++,c[7]++;for(;t<=287;)l[2*t+1]=8,t++,c[8]++;for(x(l,287,c),t=0;t<30;t++)h[2*t+1]=5,h[2*t]=_(t,5);p=new b(l,o,257,286,15),g=new b(h,n,0,30,15),m=new b(new Array(0),a,0,19,7)}(),B=!0),t.l_desc=new F(t.dyn_ltree,p),t.d_desc=new F(t.dyn_dtree,g),t.bl_desc=new F(t.bl_tree,m),t.bi_buf=0,t.bi_valid=0,k(t)},e._tr_stored_block=T,e._tr_flush_block=function(t,e,i,r){var s,o,n=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),M(t,t.l_desc),M(t,t.d_desc),n=function(t){var e;for(R(t,t.dyn_ltree,t.l_desc.max_code),R(t,t.dyn_dtree,t.d_desc.max_code),M(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*c[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),s=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=s&&(s=o)):s=o=i+5,i+4<=s&&-1!==e?T(t,e,i,r):4===t.strategy||o===s?(A(t,2+(r?1:0),3),N(t,l,h)):(A(t,4+(r?1:0),3),function(t,e,i,r){var s;for(A(t,e-257,5),A(t,i-1,5),A(t,r-4,4),s=0;s<r;s++)A(t,t.bl_tree[2*c[s]+1],3);D(t,t.dyn_ltree,e-1),D(t,t.dyn_dtree,i-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,n+1),N(t,t.dyn_ltree,t.dyn_dtree)),k(t),r&&I(t)},e._tr_tally=function(t,e,i){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(u[i]+256+1)]++,t.dyn_dtree[2*v(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){A(t,2,3),C(t,256,l),function(t){16===t.bi_valid?(y(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},3939:t=>{var e,i;e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i={rotl:function(t,e){return t<<e|t>>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&i.rotl(t,8)|4278255360&i.rotl(t,24);for(var e=0;e<t.length;e++)t[e]=i.endian(t[e]);return t},randomBytes:function(t){for(var e=[];t>0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],i=0,r=0;i<t.length;i++,r+=8)e[r>>>5]|=t[i]<<24-r%32;return e},wordsToBytes:function(t){for(var e=[],i=0;i<32*t.length;i+=8)e.push(t[i>>>5]>>>24-i%32&255);return e},bytesToHex:function(t){for(var e=[],i=0;i<t.length;i++)e.push((t[i]>>>4).toString(16)),e.push((15&t[i]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],i=0;i<t.length;i+=2)e.push(parseInt(t.substr(i,2),16));return e},bytesToBase64:function(t){for(var i=[],r=0;r<t.length;r+=3)for(var s=t[r]<<16|t[r+1]<<8|t[r+2],o=0;o<4;o++)8*r+6*o<=8*t.length?i.push(e.charAt(s>>>6*(3-o)&63)):i.push("=");return i.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var i=[],r=0,s=0;r<t.length;s=++r%4)0!=s&&i.push((e.indexOf(t.charAt(r-1))&Math.pow(2,-2*s+8)-1)<<2*s|e.indexOf(t.charAt(r))>>>6-2*s);return i}},t.exports=i},4056:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(i(4141)),o=i(6761),n=i(6272);class a extends s.default{constructor(t,e){if(super(t,e),this.codes={},this.codeBook={},this.sortedCodes=[],this.sortedValuesByBitCode=[],this.sortedBitCodes=[],this.sortedBitLengthsByBitCode=[],this.bitCodeToValue=[],!["byte","int"].includes(this.dataType))throw new TypeError(`${this.dataType} decoding not yet implemented by HUFFMAN_INT codec`);this.buildCodeBook(),this.buildCodes(),this.buildCaches(),0===this.sortedCodes[0].bitLength&&(this._decode=this._decodeZeroLengthCode)}buildCodeBook(){let t=new Array(this.parameters.numCodes);for(let e=0;e<this.parameters.numCodes;e++)t[e]={symbol:this.parameters.symbols[e],bitLength:this.parameters.bitLengths[e]};t=t.sort((t,e)=>t.bitLength-e.bitLength||t.symbol-e.symbol),this.codeBook={},t.forEach(t=>{this.codeBook[t.bitLength]||(this.codeBook[t.bitLength]=[]),this.codeBook[t.bitLength].push(t.symbol)})}buildCodes(){this.codes={};let t=0,e=-1;Object.entries(this.codeBook).forEach(([i,r])=>{const s=Number.parseInt(i,10);r.forEach(i=>{const r={bitLength:s,value:i,bitCode:0};e+=1;const o=s-t;if(e<<=o,r.bitCode=e,t+=o,function(t){let e=t-(t>>1)&1431655765;return e=(858993459&e)+(e>>2&858993459),16843009*(e+(e>>4)&252645135)>>24}(e)>s)throw new n.CramMalformedError("Symbol out of range");this.codes[i]=r})})}buildCaches(){this.sortedCodes=Object.values(this.codes).sort((t,e)=>t.bitLength-e.bitLength||t.bitCode-e.bitCode),this.sortedValuesByBitCode=this.sortedCodes.map(t=>t.value),this.sortedBitCodes=this.sortedCodes.map(t=>t.bitCode),this.sortedBitLengthsByBitCode=this.sortedCodes.map(t=>t.bitLength);const t=Math.max(...this.sortedBitCodes);this.bitCodeToValue=new Array(t+1).fill(-1);for(let t=0;t<this.sortedBitCodes.length;t+=1)this.bitCodeToValue[this.sortedCodes[t].bitCode]=t}decode(t,e,i,r){return this._decode(t,e,r.coreBlock)}_decodeZeroLengthCode(){return this.sortedCodes[0].value}_decode(t,e,i){const r=e.content;let s=0,a=0;for(let t=0;t<this.sortedCodes.length;t+=1){const e=this.sortedCodes[t].bitLength;a<<=e-s,a|=(0,o.getBits)(r,i,e-s),s=e;{const i=this.bitCodeToValue[a];if(i>-1&&this.sortedBitLengthsByBitCode[i]===e)return this.sortedValuesByBitCode[i];for(let i=t;this.sortedCodes[i+1].bitLength===e&&i<this.sortedCodes.length;i+=1)t+=1}}throw new n.CramMalformedError("Huffman symbol not found.")}}e.default=a},4141:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{constructor(t,e){this.parameters=t,this.dataType=e}}},4442:t=>{t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},4562:function(t,e,i){var r,s=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=this&&this.__importStar||(r=function(t){return r=Object.getOwnPropertyNames||function(t){var e=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[e.length]=i);return e},r(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i=r(t),n=0;n<i.length;n++)"default"!==i[n]&&s(e,t,i[n]);return o(e,t),e}),a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.r4x8_uncompress=function(t){return h.decode(t)},e.r4x16_uncompress=function(t){return d.decode(t)},e.arith_uncompress=function(t){return(new c.default).decode(t)},e.fqzcomp_uncompress=function(t){return l.decode(t,[])},e.tok3_uncompress=function(t){const e=u.decode(t,0,"\0");return Uint8Array.from(Array.from(e).map(t=>t.charCodeAt(0)))};const c=a(i(9505)),l=n(i(2660)),h=n(i(8594)),d=n(i(9313)),u=n(i(1739))},4652:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{constructor(t){this.low=0,this.range=4294967295,this.code=0,this.FFnum=0,this.carry=0,this.cache=0}RangeStartDecode(t){for(let e=0;e<5;e++)this.code=(this.code<<8)+t.ReadByte();this.code&=4294967295,this.code>>>=0}RangeGetFrequency(t){return this.range=Math.floor(this.range/t),Math.floor(this.code/this.range)}RangeDecode(t,e,i,r){for(this.code-=e*this.range,this.range*=i;this.range<1<<24;)this.range*=256,this.code=256*this.code+t.ReadByte()}RangeShiftLow(t){if(this.low<4278190080|this.carry){for(t.WriteByte(this.cache+this.carry);this.FFnum;)t.WriteByte(this.carry-1),this.FFnum--;this.cache=this.low>>>24,this.carry=0}else this.FFnum++;this.low<<=8,this.low>>>=0}RangeEncode(t,e,i,r){const s=this.low;for(this.range=Math.floor(this.range/r),this.low+=e*this.range,this.low>>>=0,this.range*=i,this.low<s&&(0!=this.carry&&console.log("ERROR: Multiple carry"),this.carry=1);this.range<1<<24;)this.range*=256,this.RangeShiftLow(t)}RangeFinishEncode(t){for(let e=0;e<5;e++)this.RangeShiftLow(t)}}},4674:t=>{t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},4823:t=>{var e=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();t.exports=function(t,i,r,s){var o=e,n=s+r;t^=-1;for(var a=s;a<n;a++)t=t>>>8^o[255&(t^i[a])];return-1^t}},4997:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.CramRecord=void 0;var s=i(7480);Object.defineProperty(e,"CramRecord",{enumerable:!0,get:function(){return r(s).default}});var o=i(8751);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r(o).default}})},5011:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseHeaderText=function(t){const e=t.split(/\r?\n/),i=[];for(const t of e){const[e,...r]=t.split(/\t/);e&&i.push({tag:e.slice(1),data:r.map(t=>{const e=t.indexOf(":");return-1!==e?{tag:t.slice(0,e),value:t.slice(e+1)}:{tag:t,value:""}})})}return i}},5159:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.IndexedCramFile=e.CraiIndex=e.CramFile=e.CramRecord=void 0;var s=i(4997);Object.defineProperty(e,"CramRecord",{enumerable:!0,get:function(){return s.CramRecord}}),Object.defineProperty(e,"CramFile",{enumerable:!0,get:function(){return r(s).default}});var o=i(6638);Object.defineProperty(e,"CraiIndex",{enumerable:!0,get:function(){return r(o).default}});var n=i(8223);Object.defineProperty(e,"IndexedCramFile",{enumerable:!0,get:function(){return r(n).default}})},6268:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.readStatsO0=function(t,e,i){let r=0,s=0,c=255&t.get();do{null==e.fc[c]&&(e.fc[c]=new n.default.FC),e.fc[c].F=255&t.get(),e.fc[c].F>=128&&(e.fc[c].F&=-129,e.fc[c].F=(127&e.fc[c].F)<<8|255&t.get()),e.fc[c].C=s,n.default.symbolInit(i[c],e.fc[c].C,e.fc[c].F),e.R||(e.R=new Array(o.TOTFREQ)),e.R.fill(c,s,s+e.fc[c].F),s+=e.fc[c].F,0===r&&c+1===(255&t.getByteAt(t.position()))?(c=255&t.get(),r=255&t.get()):0!==r?(r-=1,c+=1):c=255&t.get()}while(0!==c);a(s<o.TOTFREQ)},e.readStatsO1=function(t,e,i){let r=0,s=255&t.get();do{let c=0,l=0,h=255&t.get();null==e[s]&&(e[s]=new n.default.AriDecoder);do{null==e[s].fc[h]&&(e[s].fc[h]=new n.default.FC),e[s].fc[h].F=255&t.get(),e[s].fc[h].F>=128&&(e[s].fc[h].F&=-129,e[s].fc[h].F=(127&e[s].fc[h].F)<<8|255&t.get()),e[s].fc[h].C=l,0===e[s].fc[h].F&&(e[s].fc[h].F=o.TOTFREQ),null==i[s][h]&&(i[s][h]=new n.default.RansDecSymbol),n.default.symbolInit(i[s][h],e[s].fc[h].C,e[s].fc[h].F),null==e[s].R&&(e[s].R=new Array(o.TOTFREQ)),e[s].R.fill(h,l,l+e[s].fc[h].F),l+=e[s].fc[h].F,a(l<=o.TOTFREQ),0===c&&h+1===(255&t.getByteAt(t.position()))?(h=255&t.get(),c=255&t.get()):0!==c?(c-=1,h+=1):h=255&t.get()}while(0!==h);0===r&&s+1===(255&t.getByteAt(t.position()))?(s=255&t.get(),r=255&t.get()):0!==r?(r-=1,s+=1):s=255&t.get()}while(0!==s)};const s=i(6272),o=i(7151),n=r(i(9301));function a(t){if(!t)throw new s.CramMalformedError("assertion failed")}},6272:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CramArgumentError=e.CramSizeLimitError=e.CramMalformedError=e.CramUnimplementedError=e.CramError=void 0;class i extends Error{}e.CramError=i;class r extends Error{}e.CramUnimplementedError=r,e.CramMalformedError=class extends i{},e.CramSizeLimitError=class extends i{},e.CramArgumentError=class extends i{}},6612:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{readByte(){throw new Error("abstract method readByte() not implemented")}read(t,e,i){let r=0;for(;r<i;){const i=this.readByte();if(i<0)return 0===r?-1:r;t[e++]=i,r++}return r}writeByte(t){throw new Error("abstract method readByte() not implemented")}seek(t){throw new Error("abstract method seek() not implemented")}write(t,e,i){let r;for(r=0;r<i;r++)this.writeByte(t[e++]);return i}flush(){}}},6638:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const r=i(6272),s=i(6727),o=i(2169);function n(t,e){const[i,r,s,o,n,a]=e,c=i;t[c]||(t[c]=[]),t[c].push({start:r,span:s,containerStart:o,sliceStart:n,sliceBytes:a})}e.default=class{constructor(t){this.filehandle=(0,s.open)(t.url,t.path,t.filehandle)}async parseIndex(){const t={},e=31===(i=await this.filehandle.readFile())[0]&&139===i[1]?(0,o.unzip)(i):i;var i;const s=new DataView(e.buffer);if(e.length>4&&21578050===s.getUint32(0,!0))throw new r.CramMalformedError("invalid .crai index file. note: file appears to be a .bai index. this is technically legal but please open a github issue if you need support");let a=[],c="";for(const i of e)if(i>=48&&i<=57||!c&&45===i)c+=String.fromCharCode(i);else if(9===i)a.push(Number.parseInt(c,10)),c="";else if(10===i)a.push(Number.parseInt(c,10)),c="",n(t,a),a=[];else if(13!==i&&32!==i)throw new r.CramMalformedError("invalid .crai index file");return c&&a.push(Number.parseInt(c,10)),6===a.length&&n(t,a),Object.entries(t).forEach(([e,i])=>{const r=i;t[e]=r.sort((t,e)=>t.start-e.start||t.span-e.span)}),t}getIndex(){return this.parseIndexP||(this.parseIndexP=this.parseIndex().catch(t=>{throw this.parseIndexP=void 0,t})),this.parseIndexP}async hasDataForReferenceSequence(t){return!!(await this.getIndex())[t]}async getEntriesForRange(t,e,i){const r=(await this.getIndex())[t];if(!r)return[];const s=t=>{const r=t.start,s=t.start+t.span;return r>i?-1:s<=e?1:0},o=[];for(const t of r)0===s(t)&&o.push(t);return o}}},6727:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RemoteFile=e.LocalFile=void 0,e.open=function(t,e,i){if(i)return i;if(t)return new r.RemoteFile(t);if(e)return new r.LocalFile(e);throw new Error("no url, path, or filehandle provided, cannot open")};const r=i(8301);var s=i(8301);Object.defineProperty(e,"LocalFile",{enumerable:!0,get:function(){return s.LocalFile}}),Object.defineProperty(e,"RemoteFile",{enumerable:!0,get:function(){return s.RemoteFile}})},6761:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CramBufferOverrunError=void 0,e.getBits=function(t,e,r){let s=0;if(e.bytePosition+(7-e.bitPosition+r)/8>t.length)throw new i("read error during decoding. the file seems to be truncated.");for(let i=r;i;i--)s<<=1,s|=t[e.bytePosition]>>e.bitPosition&1,e.bitPosition-=1,e.bitPosition<0&&(e.bytePosition+=1),e.bitPosition&=7;return s};class i extends Error{}e.CramBufferOverrunError=i},6951:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.concatUint8Array=function(t){const e=new Uint8Array(function(t){let e=0;for(const i of t)e+=i.length;return e}(t));let i=0;for(const r of t)e.set(r,i),i+=r.length;return e}},7083:(t,e,i)=>{var r=i(1447),s=i(9805),o=i(1996),n=i(9681),a=i(4674),c=i(4442),l=i(7414),h=Object.prototype.toString;function d(t){if(!(this instanceof d))return new d(t);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=r.inflateInit2(this.strm,e.windowBits);if(i!==n.Z_OK)throw new Error(a[i]);if(this.header=new l,r.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=o.string2buf(e.dictionary):"[object ArrayBuffer]"===h.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=r.inflateSetDictionary(this.strm,e.dictionary))!==n.Z_OK))throw new Error(a[i])}function u(t,e){var i=new d(e);if(i.push(t,!0),i.err)throw i.msg||a[i.err];return i.result}d.prototype.push=function(t,e){var i,a,c,l,d,u=this.strm,f=this.options.chunkSize,p=this.options.dictionary,g=!1;if(this.ended)return!1;a=e===~~e?e:!0===e?n.Z_FINISH:n.Z_NO_FLUSH,"string"==typeof t?u.input=o.binstring2buf(t):"[object ArrayBuffer]"===h.call(t)?u.input=new Uint8Array(t):u.input=t,u.next_in=0,u.avail_in=u.input.length;do{if(0===u.avail_out&&(u.output=new s.Buf8(f),u.next_out=0,u.avail_out=f),(i=r.inflate(u,n.Z_NO_FLUSH))===n.Z_NEED_DICT&&p&&(i=r.inflateSetDictionary(this.strm,p)),i===n.Z_BUF_ERROR&&!0===g&&(i=n.Z_OK,g=!1),i!==n.Z_STREAM_END&&i!==n.Z_OK)return this.onEnd(i),this.ended=!0,!1;u.next_out&&(0!==u.avail_out&&i!==n.Z_STREAM_END&&(0!==u.avail_in||a!==n.Z_FINISH&&a!==n.Z_SYNC_FLUSH)||("string"===this.options.to?(c=o.utf8border(u.output,u.next_out),l=u.next_out-c,d=o.buf2string(u.output,c),u.next_out=l,u.avail_out=f-l,l&&s.arraySet(u.output,u.output,c,l,0),this.onData(d)):this.onData(s.shrinkBuf(u.output,u.next_out)))),0===u.avail_in&&0===u.avail_out&&(g=!0)}while((u.avail_in>0||0===u.avail_out)&&i!==n.Z_STREAM_END);return i===n.Z_STREAM_END&&(a=n.Z_FINISH),a===n.Z_FINISH?(i=r.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===n.Z_OK):a!==n.Z_SYNC_FLUSH||(this.onEnd(n.Z_OK),u.avail_out=0,!0)},d.prototype.onData=function(t){this.chunks.push(t)},d.prototype.onEnd=function(t){t===n.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=d,e.inflate=u,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,u(t,e)},e.ungzip=u},7151:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TOTFREQ=e.TF_SHIFT=e.RANS_BYTE_L=void 0,e.TF_SHIFT=12,e.TOTFREQ=4096,e.RANS_BYTE_L=1<<23},7293:t=>{t.exports=function(t,e){var i,r,s,o,n,a,c,l,h,d,u,f,p,g,m,w,b,F,v,y,A,C,_,x,k;i=t.state,r=t.next_in,x=t.input,s=r+(t.avail_in-5),o=t.next_out,k=t.output,n=o-(e-t.avail_out),a=o+(t.avail_out-257),c=i.dmax,l=i.wsize,h=i.whave,d=i.wnext,u=i.window,f=i.hold,p=i.bits,g=i.lencode,m=i.distcode,w=(1<<i.lenbits)-1,b=(1<<i.distbits)-1;t:do{p<15&&(f+=x[r++]<<p,p+=8,f+=x[r++]<<p,p+=8),F=g[f&w];e:for(;;){if(f>>>=v=F>>>24,p-=v,0==(v=F>>>16&255))k[o++]=65535&F;else{if(!(16&v)){if(64&v){if(32&v){i.mode=12;break t}t.msg="invalid literal/length code",i.mode=30;break t}F=g[(65535&F)+(f&(1<<v)-1)];continue e}for(y=65535&F,(v&=15)&&(p<v&&(f+=x[r++]<<p,p+=8),y+=f&(1<<v)-1,f>>>=v,p-=v),p<15&&(f+=x[r++]<<p,p+=8,f+=x[r++]<<p,p+=8),F=m[f&b];;){if(f>>>=v=F>>>24,p-=v,16&(v=F>>>16&255)){if(A=65535&F,p<(v&=15)&&(f+=x[r++]<<p,(p+=8)<v&&(f+=x[r++]<<p,p+=8)),(A+=f&(1<<v)-1)>c){t.msg="invalid distance too far back",i.mode=30;break t}if(f>>>=v,p-=v,A>(v=o-n)){if((v=A-v)>h&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(C=0,_=u,0===d){if(C+=l-v,v<y){y-=v;do{k[o++]=u[C++]}while(--v);C=o-A,_=k}}else if(d<v){if(C+=l+d-v,(v-=d)<y){y-=v;do{k[o++]=u[C++]}while(--v);if(C=0,d<y){y-=v=d;do{k[o++]=u[C++]}while(--v);C=o-A,_=k}}}else if(C+=d-v,v<y){y-=v;do{k[o++]=u[C++]}while(--v);C=o-A,_=k}for(;y>2;)k[o++]=_[C++],k[o++]=_[C++],k[o++]=_[C++],y-=3;y&&(k[o++]=_[C++],y>1&&(k[o++]=_[C++]))}else{C=o-A;do{k[o++]=k[C++],k[o++]=k[C++],k[o++]=k[C++],y-=3}while(y>2);y&&(k[o++]=k[C++],y>1&&(k[o++]=k[C++]))}break}if(64&v){t.msg="invalid distance code",i.mode=30;break t}F=m[(65535&F)+(f&(1<<v)-1)]}}break}}while(r<s&&o<a);r-=y=p>>3,f&=(1<<(p-=y<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r<s?s-r+5:5-(r-s),t.avail_out=o<a?a-o+257:257-(o-a),i.hold=f,i.bits=p}},7392:t=>{class e{constructor(t={}){if(!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=t.maxSize,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(t,e){this.cache.set(t,e),this._size++,this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache=new Map)}get(t){if(this.cache.has(t))return this.cache.get(t);if(this.oldCache.has(t)){const e=this.oldCache.get(t);return this.oldCache.delete(t),this._set(t,e),e}}set(t,e){return this.cache.has(t)?this.cache.set(t,e):this._set(t,e),this}has(t){return this.cache.has(t)||this.oldCache.has(t)}peek(t){return this.cache.has(t)?this.cache.get(t):this.oldCache.has(t)?this.oldCache.get(t):void 0}delete(t){const e=this.cache.delete(t);return e&&this._size--,this.oldCache.delete(t)||e}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(const[t]of this)yield t}*values(){for(const[,t]of this)yield t}*[Symbol.iterator](){for(const t of this.cache)yield t;for(const t of this.oldCache){const[e]=t;this.cache.has(e)||(yield t)}}get size(){let t=0;for(const e of this.oldCache.keys())this.cache.has(e)||t++;return this._size+t}}t.exports=e},7414:t=>{t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},7480:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MateFlagsDecoder=e.CramFlagsDecoder=e.BamFlagsDecoder=e.MateFlags=e.CramFlags=e.BamFlags=void 0;const s=r(i(588)),o={a:0,A:0,c:1,C:1,g:2,G:2,t:3,T:3,n:4,N:4};function n(t){const e={};for(const[i,r]of t)e[`is${r}`]=t=>!!(t&i),e[`set${r}`]=t=>t|i;return e}e.BamFlags=[[1,"Paired"],[2,"ProperlyPaired"],[4,"SegmentUnmapped"],[8,"MateUnmapped"],[16,"ReverseComplemented"],[32,"MateReverseComplemented"],[64,"Read1"],[128,"Read2"],[256,"Secondary"],[512,"FailedQc"],[1024,"Duplicate"],[2048,"Supplementary"]],e.CramFlags=[[1,"PreservingQualityScores"],[2,"Detached"],[4,"WithMateDownstream"],[8,"DecodeSequenceAsStar"]],e.MateFlags=[[1,"OnNegativeStrand"],[2,"Unmapped"]],e.BamFlagsDecoder=n(e.BamFlags),e.CramFlagsDecoder=n(e.CramFlags),e.MateFlagsDecoder=n(e.MateFlags),e.default=class{constructor({flags:t,cramFlags:e,readLength:i,mappingQuality:r,lengthOnRef:s,qualityScores:o,mateRecordNumber:n,readBases:a,readFeatures:c,mateToUse:l,readGroupId:h,readName:d,sequenceId:u,uniqueId:f,templateSize:p,alignmentStart:g,tags:m}){this.flags=t,this.cramFlags=e,this.readLength=i,this.mappingQuality=r,this.lengthOnRef=s,this.qualityScores=o,a&&(this.readBases=a),this.readGroupId=h,this.readName=d,this.sequenceId=u,this.uniqueId=f,this.templateSize=p,this.alignmentStart=g,this.tags=m,c&&(this.readFeatures=c),l&&(this.mate={flags:l.mateFlags,readName:l.mateReadName,sequenceId:l.mateSequenceId,alignmentStart:l.mateAlignmentStart}),n&&(this.mateRecordNumber=n)}isPaired(){return!!(this.flags&s.default.BAM_FPAIRED)}isProperlyPaired(){return!!(this.flags&s.default.BAM_FPROPER_PAIR)}isSegmentUnmapped(){return!!(this.flags&s.default.BAM_FUNMAP)}isMateUnmapped(){return!!(this.flags&s.default.BAM_FMUNMAP)}isReverseComplemented(){return!!(this.flags&s.default.BAM_FREVERSE)}isMateReverseComplemented(){return!!(this.flags&s.default.BAM_FMREVERSE)}isRead1(){return!!(this.flags&s.default.BAM_FREAD1)}isRead2(){return!!(this.flags&s.default.BAM_FREAD2)}isSecondary(){return!!(this.flags&s.default.BAM_FSECONDARY)}isFailedQc(){return!!(this.flags&s.default.BAM_FQCFAIL)}isDuplicate(){return!!(this.flags&s.default.BAM_FDUP)}isSupplementary(){return!!(this.flags&s.default.BAM_FSUPPLEMENTARY)}isDetached(){return!!(this.cramFlags&s.default.CRAM_FLAG_DETACHED)}hasMateDownStream(){return!!(this.cramFlags&s.default.CRAM_FLAG_MATE_DOWNSTREAM)}isPreservingQualityScores(){return!!(this.cramFlags&s.default.CRAM_FLAG_PRESERVE_QUAL_SCORES)}isUnknownBases(){return!!(this.cramFlags&s.default.CRAM_FLAG_NO_SEQ)}getReadBases(){if(!this.readBases&&this._refRegion){const t=function(t,e){if(!t.lengthOnRef&&!t.readLength)return null;if(t.isUnknownBases())return null;const i=t.alignmentStart-e.start;if(!t.readFeatures)return e.seq.slice(i,i+(t.lengthOnRef||0)).toUpperCase();let r="",s=i,o=0;for(;r.length<t.readLength;)if(o<t.readFeatures.length){const i=t.readFeatures[o];if("Q"===i.code||"q"===i.code)o+=1;else if(i.pos===r.length+1)if(o+=1,"b"===i.code){const t=i.data;r+=t,s+=t.length}else"B"===i.code?(r+=i.data[0],s+=1):"X"===i.code?(r+=i.sub,s+=1):"I"===i.code?r+=i.data:"D"===i.code?s+=i.data:"i"===i.code?r+=i.data:"N"===i.code?s+=i.data:"S"===i.code?r+=i.data:"P"===i.code||i.code;else if(o<t.readFeatures.length){const t=e.seq.slice(s,s+i.pos-r.length-1);r+=t,s+=t.length}}else{const i=e.seq.slice(s,s+t.readLength-r.length);r+=i,s+=i.length}return r.toUpperCase()}(this,this._refRegion);t&&(this.readBases=t)}return this.readBases}getPairOrientation(){if(!this.isSegmentUnmapped()&&this.isPaired()&&!this.isMateUnmapped()&&this.mate&&this.sequenceId===this.mate.sequenceId){const t=this.isReverseComplemented()?"R":"F",e=this.isMateReverseComplemented()?"R":"F";let i=" ",r=" ";this.isRead1()?(i="1",r="2"):this.isRead2()&&(i="2",r="1");const s=[];let o=this.templateLength||this.templateSize;if(void 0===o)throw new Error("One of templateSize and templateLength must be set");return this.alignmentStart>this.mate.alignmentStart&&o>0&&(o=-o),o>0?(s[0]=t,s[1]=i,s[2]=e,s[3]=r):(s[2]=t,s[3]=i,s[0]=e,s[1]=r),s.join("")}return null}addReferenceSequence(t,e){this.readFeatures&&this.readFeatures.forEach(i=>{"X"===i.code&&function(t,e,i,r){const s=r.refPos-e.start,n=e.seq.charAt(s);n&&(r.ref=n);let a=o[n];void 0===a&&(a=4);const c=i.substitutionMatrix[a][r.data];c&&(r.sub=c)}(0,t,e,i)}),!this.readBases&&t.start<=this.alignmentStart&&t.end>=this.alignmentStart+(this.lengthOnRef||this.readLength)-1&&(this._refRegion=t)}toJSON(){const t={};return Object.keys(this).forEach(e=>{e.startsWith("_")||(t[e]=this[e])}),t.readBases=this.getReadBases(),t}}},7580:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.cramFileDefinition=s,e.cramBlockHeader=o,e.cramBlockCrc32=n,e.cramTagDictionary=c,e.cramPreservationMap=l,e.isMappedSliceHeader=function(t){return"number"==typeof t.refSeqId},e.getSectionParsers=function(t){return{cramFileDefinition:s(),cramBlockHeader:o(),cramBlockCrc32:n(),cramDataSeriesEncodingMap:p(),cramTagEncodingMap:g(),cramCompressionHeader:{parser:(t,e)=>{const{value:i,offset:r}=l().parser(t,e);e=r;const{value:s,offset:o}=p().parser(t,e);e=o;const{value:n,offset:a}=g().parser(t,e);return e=a,{value:{dataSeriesEncoding:h(s),preservation:h(i),tagEncoding:h(n)},offset:e}}},cramEncoding:{parser:(t,e)=>f(t,e)},cramUnmappedSliceHeader:d(t),cramMappedSliceHeader:u(t),cramContainerHeader1:m(t),cramContainerHeader2:w(t)}};const r=i(2549);function s(){return{parser:(t,e=0)=>{const i=new DataView(t.buffer,t.byteOffset,t.length),r=new TextDecoder("utf8");let s=0;const o=r.decode(t.subarray(s,s+4));s+=4;const n=i.getUint8(s);s+=1;const a=i.getUint8(s);s+=1;const c=r.decode(t.subarray(s,s+20)).replaceAll("\0","");return s+=20,{value:{magic:o,majorVersion:n,minorVersion:a,fileId:c},offset:s}},maxLength:26}}function o(){return{parser:(t,e=0)=>{const i=t,s=new DataView(i.buffer,i.byteOffset,i.length);let o=0;const n=s.getUint8(o),a=["raw","gzip","bzip2","lzma","rans","rans4x16","arith","fqzcomp","tok3"][n];if(!a)throw new Error(`compression method number ${n} not implemented`);o+=1;const c=s.getUint8(o),l=["FILE_HEADER","COMPRESSION_HEADER","MAPPED_SLICE_HEADER","UNMAPPED_SLICE_HEADER","EXTERNAL_DATA","CORE_DATA"][c];if(!l)throw new Error(`invalid block content type id ${c}`);o+=1;const[h,d]=(0,r.parseItf8)(t,o);o+=d;const[u,f]=(0,r.parseItf8)(t,o);o+=f;const[p,g]=(0,r.parseItf8)(t,o);return o+=g,{offset:o,value:{uncompressedSize:p,compressedSize:u,contentId:h,contentType:l,compressionMethod:a}}},maxLength:17}}function n(){return{parser:(t,e)=>{const i=t,r=new DataView(i.buffer,i.byteOffset,i.length).getUint32(e,!0);return{offset:e+=4,value:{crc32:r}}},maxLength:4}}function a(t,e,i){const r=new TextDecoder("utf8").decode(t.subarray(e,i)),s=[];for(let t=0;t<r.length;t+=3)s.push(r.slice(t,t+3));return s}function c(){return{parser:(t,e)=>{const[i,s]=(0,r.parseItf8)(t,e);e+=s;const o=t.subarray(e,e+i);e+=i;const n=[];let c=0,l=0;for(;l<o.length;l++)o[l]||(n.push(a(o,c,l)),c=l+1);return l>c&&n.push(a(o,c,l)),{value:{size:i,ents:n},offset:e}}}}function l(){return{parser:(t,e)=>{const i=t,s=new DataView(i.buffer,i.byteOffset,i.length),[o,n]=(0,r.parseItf8)(t,e);e+=n;const[a,l]=(0,r.parseItf8)(t,e);e+=l;const h=[];for(let i=0;i<a;i++){const i=String.fromCharCode(t[e])+String.fromCharCode(t[e+1]);if(e+=2,"MI"===i||"UI"===i||"PI"===i||"RN"===i||"AP"===i||"RR"===i)h.push({key:i,value:!!s.getUint8(e)}),e+=1;else if("SM"===i)h.push({key:i,value:[s.getUint8(e),s.getUint8(e+1),s.getUint8(e+2),s.getUint8(e+3),s.getUint8(e+4)]}),e+=5;else{if("TD"!==i)throw new Error(`unknown key ${i}`);{const{offset:r,value:s}=c().parser(t,e);h.push({key:i,value:s.ents}),e=r}}}return{value:{mapSize:o,mapCount:a,ents:h},offset:e}}}}function h(t){const e={};for(const{key:i,value:r}of t.ents)e[i]&&console.warn(`duplicate key ${i} in map`),e[i]=r;return e}function d(t){return{parser:(e,i)=>{const[s,o]=(0,r.parseItf8)(e,i);i+=o;let n=0;if(t>=3){const[t,s]=(0,r.parseLtf8)(e,i);i+=s,n=t}else if(2===t){const[t,s]=(0,r.parseItf8)(e,i);i+=s,n=t}else console.warn("recordCounter=0");const[a,c]=(0,r.parseItf8)(e,i);i+=c;const[l,h]=(0,r.parseItf8)(e,i);i+=h;const d=[];for(let t=0;t<l;t++){const[t,s]=(0,r.parseItf8)(e,i);i+=s,d.push(t)}let u;return t>=2&&(u=[...e.subarray(i,i+16)],i+=16),{value:{recordCounter:n,md5:u,contentIds:d,numContentIds:l,numBlocks:a,numRecords:s},offset:i}},maxLength:t=>40+5*t}}function u(t){return{parser:(e,i)=>{const[s,o]=(0,r.parseItf8)(e,i);i+=o;const[n,a]=(0,r.parseItf8)(e,i);i+=a;const[c,l]=(0,r.parseItf8)(e,i);i+=l;const[h,d]=(0,r.parseItf8)(e,i);i+=d;let u=0;if(t>=3){const[t,s]=(0,r.parseLtf8)(e,i);i+=s,u=t}else if(2===t){const[t,s]=(0,r.parseItf8)(e,i);i+=s,u=t}else console.warn("majorVersion is <2, recordCounter set to 0");const[f,p]=(0,r.parseItf8)(e,i);i+=p;const[g,m]=(0,r.parseItf8)(e,i);i+=m;const w=[];for(let t=0;t<g;t++){const[t,s]=(0,r.parseItf8)(e,i);i+=s,w.push(t)}const[b,F]=(0,r.parseItf8)(e,i);let v;return i+=F,t>=2&&(v=[...e.subarray(i,i+16)],i+=16),{value:{md5:v,numBlocks:f,numRecords:h,numContentIds:g,refSeqSpan:c,refSeqId:s,refSeqStart:n,recordCounter:u,refBaseBlockId:b,contentIds:w},offset:i}},maxLength:t=>60+5*t}}function f(t,e){const i=t,s=new DataView(i.buffer,i.byteOffset,i.length),[o,n]=(0,r.parseItf8)(t,e);e+=n;const[a,c]=(0,r.parseItf8)(t,e);e+=c;const l={};if(0===o);else if(1===o){const[i,s]=(0,r.parseItf8)(t,e);l.blockContentId=i,e+=s}else if(2===o){const[i,s]=(0,r.parseItf8)(t,e);l.offset=i,e+=s;const[o,n]=(0,r.parseItf8)(t,e);l.M=o,e+=n}else if(3===o){const i=(0,r.parseItf8)(t,e),s=i[0];e+=i[1];const o=[];for(let i=0;i<s;i++){const i=(0,r.parseItf8)(t,e);o.push(i[0]),e+=i[1]}l.symbols=o;const n=(0,r.parseItf8)(t,e),a=i[0];l.numLengths=a,l.numCodes=s,l.numLengths=a,e+=n[1];const c=[];for(let i=0;i<a;i++){const i=(0,r.parseItf8)(t,e);e+=i[1],c.push(i[0])}l.bitLengths=c}else if(4===o){const{value:i,offset:r}=f(t,e);l.lengthsEncoding=i,e=r;const{value:s,offset:o}=f(t,e);l.valuesEncoding=s,e=o}else if(5===o){l.stopByte=s.getUint8(e),e+=1;const[i,o]=(0,r.parseItf8)(t,e);l.blockContentId=i,e+=o}else if(6===o){const[i,s]=(0,r.parseItf8)(t,e);l.offset=i,e+=s;const[o,n]=(0,r.parseItf8)(t,e);l.length=o,e+=n}else if(7===o){const[i,s]=(0,r.parseItf8)(t,e);l.offset=i,e+=s;const[o,n]=(0,r.parseItf8)(t,e);l.K=o,e+=n}else if(8===o){const[i,s]=(0,r.parseItf8)(t,e);l.offset=i,e+=s;const[o,n]=(0,r.parseItf8)(t,e);l.log2m=o,e+=n}else{if(9!==o)throw new Error(`unknown codecId ${o}`);{const[i,s]=(0,r.parseItf8)(t,e);l.offset=i,e+=s}}return{value:{codecId:o,parametersBytes:a,parameters:l},offset:e}}function p(){return{parser:(t,e)=>{const[i,s]=(0,r.parseItf8)(t,e);e+=s;const[o,n]=(0,r.parseItf8)(t,e);e+=n;const a=[];for(let i=0;i<o;i++){const i=String.fromCharCode(t[e])+String.fromCharCode(t[e+1]);e+=2;const{value:r,offset:s}=f(t,e);e=s,a.push({key:i,value:r})}return{value:{mapSize:i,ents:a,mapCount:o},offset:e}}}}function g(){return{parser:(t,e)=>{const[i,s]=(0,r.parseItf8)(t,e);e+=s;const[o,n]=(0,r.parseItf8)(t,e);e+=n;const a=[];for(let i=0;i<o;i++){const[i,s]=(0,r.parseItf8)(t,e);e+=s;const o=String.fromCharCode(i>>16&255)+String.fromCharCode(i>>8&255)+String.fromCharCode(255&i),{value:n,offset:c}=f(t,e);e=c,a.push({key:o,value:n})}return{value:{mapSize:i,ents:a,mapCount:o},offset:e}}}}function m(t){return{maxLength:52,parser:(e,i)=>{const s=e,o=new DataView(s.buffer,s.byteOffset,s.length).getInt32(i,!0);i+=4;const[n,a]=(0,r.parseItf8)(e,i);i+=a;const[c,l]=(0,r.parseItf8)(e,i);i+=l;const[h,d]=(0,r.parseItf8)(e,i);i+=d;const[u,f]=(0,r.parseItf8)(e,i);i+=f;let p,g=0;if(t>=3){const[t,s]=(0,r.parseLtf8)(e,i);g=t,i+=s}else if(2===t){const[t,s]=(0,r.parseItf8)(e,i);g=t,i+=s}else console.warn("setting recordCounter=0");if(t>1){const[t,s]=(0,r.parseLtf8)(e,i);p=t,i+=s}const[m,w]=(0,r.parseItf8)(e,i);i+=w;const[b,F]=(0,r.parseItf8)(e,i);return{value:{length:o,refSeqId:n,refSeqStart:c,alignmentSpan:h,numBlocks:m,numLandmarks:b,numBases:p,recordCounter:g,numRecords:u},offset:i+=F}}}}function w(t){return{parser:(e,i)=>{const s=e,o=new DataView(s.buffer,s.byteOffset,s.length),[n,a]=(0,r.parseItf8)(e,i);i+=a;const c=[];for(let t=0;t<n;t++){const[t,s]=(0,r.parseItf8)(e,i);i+=s,c.push(t)}let l;return t>=3&&(l=o.getUint32(i,!0),i+=4),{value:{...void 0===l?{}:{crc32:l},numLandmarks:n,landmarks:c},offset:i}},maxLength:t=>5+5*t+4}}},7593:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},7934:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(i(4141)),o=i(2549);class n extends s.default{constructor(t,e,i){super(t,e),this.instantiateCodec=i}decode(t,e,i,r){const s=this._getLengthCodec().decode(t,e,i,r)||0,o=this._getDataCodec(),n=new Uint8Array(s);for(let a=0;a<s;a+=1)n[a]=o.decode(t,e,i,r)||0;return n}_getLengthCodec(){const t=this.parameters.lengthsEncoding;return this.instantiateCodec(t,"int")}_getDataCodec(){const t=this.parameters.valuesEncoding;return this.instantiateCodec(t,"byte")}}e.default=n,"_getLengthCodec _getDataCodec".split(" ").forEach(t=>{(0,o.tinyMemoize)(n,t)})},8006:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(i(4141)),o=i(6272),n=i(6761);class a extends s.default{decode(t,e,i,r){const{blockContentId:s}=this.parameters,n=i[s];if(!n)throw new o.CramMalformedError(`no block found with content ID ${s}`);const a=r.externalBlocks.getCursor(s);return this._decodeByteArray(n,a)}_decodeByteArray(t,e){const i=t.content,{stopByte:r}=this.parameters,s=e.bytePosition;let o=e.bytePosition;for(;i[o]!==r&&o<i.length;){if(o===i.length)throw new n.CramBufferOverrunError("byteArrayStop reading beyond length of data buffer?");o+=1}return e.bytePosition=o+1,i.subarray(s,o)}}e.default=a},8223:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(i(4997)),o=i(6272);e.default=class{constructor(t){var e;if(this.cram=null!==(e=t.cram)&&void 0!==e?e:new s.default({url:t.cramUrl,path:t.cramPath,filehandle:t.cramFilehandle,seqFetch:t.seqFetch,checkSequenceMD5:t.checkSequenceMD5,cacheSize:t.cacheSize}),!(this.cram instanceof s.default))throw new Error("invalid arguments: no cramfile");this.index=t.index}async getRecordsForRange(t,e,i,r={}){if(r.viewAsPairs=r.viewAsPairs||!1,r.pairAcrossChr=r.pairAcrossChr||!1,r.maxInsertSize=r.maxInsertSize||2e5,"string"==typeof t)throw new o.CramUnimplementedError("string sequence names not yet supported");const s=t,n=await this.index.getEntriesForRange(s,e,i),a=await Promise.all(n.map(r=>this.getRecordsInSlice(r,r=>r.sequenceId===t&&r.alignmentStart<=i&&void 0!==r.lengthOnRef&&r.alignmentStart+r.lengthOnRef-1>=e)));let c=Array.prototype.concat(...a);if(r.viewAsPairs){const t={},e={};for(const i of c){const r=i.readName;if(void 0===r)throw new Error("readName undefined");const s=i.uniqueId;t[r]||(t[r]=0),t[r]+=1,e[s]=1}const i={};Object.entries(t).forEach(([t,e])=>{1===e&&(i[t]=!0)});const o=[];for(const t of c){const e=t.readName;if(void 0===e)throw new Error("readName undefined");if(i[e]&&t.mate&&(t.mate.sequenceId===s||r.pairAcrossChr)&&Math.abs(t.alignmentStart-t.mate.alignmentStart)<r.maxInsertSize){const e=this.index.getEntriesForRange(t.mate.sequenceId,t.mate.alignmentStart,t.mate.alignmentStart+1);o.push(e)}}const n=await Promise.all(o);let a=[];for(const t of n)a.push(...t);a=a.sort((t,e)=>t.toString().localeCompare(e.toString())).filter((t,e,i)=>!e||t.toString()!==i[e-1].toString());const l=[];for(const t of a){let r=this.cram.featureCache.get(t.toString());r||(r=this.getRecordsInSlice(t,()=>!0),this.cram.featureCache.set(t.toString(),r));const s=r.then(t=>{const r=[];for(const s of t){if(void 0===s.readName)throw new Error("readName undefined");i[s.readName]&&!e[s.uniqueId]&&r.push(s)}return r});l.push(s)}const h=await Promise.all(l);if(h.length){const t=h.reduce((t,e)=>t.concat(e));c=c.concat(t)}}return c}getRecordsInSlice({containerStart:t,sliceStart:e,sliceBytes:i},r){return this.cram.getContainerAtPosition(t).getSlice(e,i).getRecords(r)}hasDataForReferenceSequence(t){return this.index.hasDataForReferenceSequence(t)}}},8301:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.LocalFile=e.RemoteFile=e.BlobFile=void 0,e.fromUrl=c,e.open=function(t,e,i,r={}){if(void 0!==i)return i;if(void 0!==t)return c(t,r);if(void 0!==e)return new n.default(e,r);throw new Error("no url, path, or filehandle provided, cannot open")};const n=o(i(2616)),a=o(i(8485));function c(t,e={}){return new a.default(t,e)}s(i(7593),e);var l=i(1064);Object.defineProperty(e,"BlobFile",{enumerable:!0,get:function(){return o(l).default}});var h=i(8485);Object.defineProperty(e,"RemoteFile",{enumerable:!0,get:function(){return o(h).default}});var d=i(2616);Object.defineProperty(e,"LocalFile",{enumerable:!0,get:function(){return o(d).default}})},8411:(t,e,i)=>{var r,s=i(9805),o=i(3665),n=i(3269),a=i(4823),c=i(4674),l=-2,h=258,d=262,u=103,f=113,p=666;function g(t,e){return t.msg=c[e],e}function m(t){return(t<<1)-(t>4?9:0)}function w(t){for(var e=t.length;--e>=0;)t[e]=0}function b(t){var e=t.state,i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(s.arraySet(t.output,e.pending_buf,e.pending_out,i,t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))}function F(t,e){o._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,b(t.strm)}function v(t,e){t.pending_buf[t.pending++]=e}function y(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function A(t,e,i,r){var o=t.avail_in;return o>r&&(o=r),0===o?0:(t.avail_in-=o,s.arraySet(e,t.input,t.next_in,o,i),1===t.state.wrap?t.adler=n(t.adler,e,o,i):2===t.state.wrap&&(t.adler=a(t.adler,e,o,i)),t.next_in+=o,t.total_in+=o,o)}function C(t,e){var i,r,s=t.max_chain_length,o=t.strstart,n=t.prev_length,a=t.nice_match,c=t.strstart>t.w_size-d?t.strstart-(t.w_size-d):0,l=t.window,u=t.w_mask,f=t.prev,p=t.strstart+h,g=l[o+n-1],m=l[o+n];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(l[(i=e)+n]===m&&l[i+n-1]===g&&l[i]===l[o]&&l[++i]===l[o+1]){o+=2,i++;do{}while(l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&l[++o]===l[++i]&&o<p);if(r=h-(p-o),o=p-h,r>n){if(t.match_start=e,n=r,r>=a)break;g=l[o+n-1],m=l[o+n]}}}while((e=f[e&u])>c&&0!==--s);return n<=t.lookahead?n:t.lookahead}function _(t){var e,i,r,o,n,a=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=a+(a-d)){s.arraySet(t.window,t.window,a,a,0),t.match_start-=a,t.strstart-=a,t.block_start-=a,e=i=t.hash_size;do{r=t.head[--e],t.head[e]=r>=a?r-a:0}while(--i);e=i=a;do{r=t.prev[--e],t.prev[e]=r>=a?r-a:0}while(--i);o+=a}if(0===t.strm.avail_in)break;if(i=A(t.strm,t.window,t.strstart+t.lookahead,o),t.lookahead+=i,t.lookahead+t.insert>=3)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=(t.ins_h<<t.hash_shift^t.window[n+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[n+3-1])&t.hash_mask,t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<d&&0!==t.strm.avail_in)}function x(t,e){for(var i,r;;){if(t.lookahead<d){if(_(t),t.lookahead<d&&0===e)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-d&&(t.match_length=C(t,i)),t.match_length>=3)if(r=o._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(F(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(F(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(F(t,!1),0===t.strm.avail_out)?1:2}function k(t,e){for(var i,r,s;;){if(t.lookahead<d){if(_(t),t.lookahead<d&&0===e)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length<t.max_lazy_match&&t.strstart-i<=t.w_size-d&&(t.match_length=C(t,i),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,r=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!==--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,r&&(F(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((r=o._tr_tally(t,0,t.window[t.strstart-1]))&&F(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=o._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(F(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(F(t,!1),0===t.strm.avail_out)?1:2}function I(t,e,i,r,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=r,this.func=s}function S(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(1146),this.dyn_dtree=new s.Buf16(122),this.bl_tree=new s.Buf16(78),w(this.dyn_ltree),w(this.dyn_dtree),w(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(16),this.heap=new s.Buf16(573),w(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(573),w(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function E(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:f,t.adler=2===e.wrap?0:1,e.last_flush=0,o._tr_init(e),0):g(t,l)}function N(t){var e,i=E(t);return 0===i&&((e=t.state).window_size=2*e.w_size,w(e.head),e.max_lazy_match=r[e.level].max_lazy,e.good_match=r[e.level].good_length,e.nice_match=r[e.level].nice_length,e.max_chain_length=r[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),i}function M(t,e,i,r,o,n){if(!t)return l;var a=1;if(-1===e&&(e=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),o<1||o>9||8!==i||r<8||r>15||e<0||e>9||n<0||n>4)return g(t,l);8===r&&(r=9);var c=new S;return t.state=c,c.strm=t,c.wrap=a,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=o+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+3-1)/3),c.window=new s.Buf8(2*c.w_size),c.head=new s.Buf16(c.hash_size),c.prev=new s.Buf16(c.w_size),c.lit_bufsize=1<<o+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new s.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=e,c.strategy=n,c.method=i,N(t)}r=[new I(0,0,0,0,function(t,e){var i=65535;for(i>t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(_(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+i;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,F(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-d&&(F(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(F(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(F(t,!1),t.strm.avail_out),1)}),new I(4,4,8,4,x),new I(4,5,16,8,x),new I(4,6,32,32,x),new I(4,4,16,16,k),new I(8,16,32,32,k),new I(8,16,128,128,k),new I(8,32,128,256,k),new I(32,128,258,1024,k),new I(32,258,258,4096,k)],e.deflateInit=function(t,e){return M(t,e,8,15,8,0)},e.deflateInit2=M,e.deflateReset=N,e.deflateResetKeep=E,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?l:(t.state.gzhead=e,0):l},e.deflate=function(t,e){var i,s,n,c;if(!t||!t.state||e>5||e<0)return t?g(t,l):l;if(s=t.state,!t.output||!t.input&&0!==t.avail_in||s.status===p&&4!==e)return g(t,0===t.avail_out?-5:l);if(s.strm=t,i=s.last_flush,s.last_flush=e,42===s.status)if(2===s.wrap)t.adler=0,v(s,31),v(s,139),v(s,8),s.gzhead?(v(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),v(s,255&s.gzhead.time),v(s,s.gzhead.time>>8&255),v(s,s.gzhead.time>>16&255),v(s,s.gzhead.time>>24&255),v(s,9===s.level?2:s.strategy>=2||s.level<2?4:0),v(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(v(s,255&s.gzhead.extra.length),v(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(t.adler=a(t.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=69):(v(s,0),v(s,0),v(s,0),v(s,0),v(s,0),v(s,9===s.level?2:s.strategy>=2||s.level<2?4:0),v(s,3),s.status=f);else{var d=8+(s.w_bits-8<<4)<<8;d|=(s.strategy>=2||s.level<2?0:s.level<6?1:6===s.level?2:3)<<6,0!==s.strstart&&(d|=32),d+=31-d%31,s.status=f,y(s,d),0!==s.strstart&&(y(s,t.adler>>>16),y(s,65535&t.adler)),t.adler=1}if(69===s.status)if(s.gzhead.extra){for(n=s.pending;s.gzindex<(65535&s.gzhead.extra.length)&&(s.pending!==s.pending_buf_size||(s.gzhead.hcrc&&s.pending>n&&(t.adler=a(t.adler,s.pending_buf,s.pending-n,n)),b(t),n=s.pending,s.pending!==s.pending_buf_size));)v(s,255&s.gzhead.extra[s.gzindex]),s.gzindex++;s.gzhead.hcrc&&s.pending>n&&(t.adler=a(t.adler,s.pending_buf,s.pending-n,n)),s.gzindex===s.gzhead.extra.length&&(s.gzindex=0,s.status=73)}else s.status=73;if(73===s.status)if(s.gzhead.name){n=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>n&&(t.adler=a(t.adler,s.pending_buf,s.pending-n,n)),b(t),n=s.pending,s.pending===s.pending_buf_size)){c=1;break}c=s.gzindex<s.gzhead.name.length?255&s.gzhead.name.charCodeAt(s.gzindex++):0,v(s,c)}while(0!==c);s.gzhead.hcrc&&s.pending>n&&(t.adler=a(t.adler,s.pending_buf,s.pending-n,n)),0===c&&(s.gzindex=0,s.status=91)}else s.status=91;if(91===s.status)if(s.gzhead.comment){n=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>n&&(t.adler=a(t.adler,s.pending_buf,s.pending-n,n)),b(t),n=s.pending,s.pending===s.pending_buf_size)){c=1;break}c=s.gzindex<s.gzhead.comment.length?255&s.gzhead.comment.charCodeAt(s.gzindex++):0,v(s,c)}while(0!==c);s.gzhead.hcrc&&s.pending>n&&(t.adler=a(t.adler,s.pending_buf,s.pending-n,n)),0===c&&(s.status=u)}else s.status=u;if(s.status===u&&(s.gzhead.hcrc?(s.pending+2>s.pending_buf_size&&b(t),s.pending+2<=s.pending_buf_size&&(v(s,255&t.adler),v(s,t.adler>>8&255),t.adler=0,s.status=f)):s.status=f),0!==s.pending){if(b(t),0===t.avail_out)return s.last_flush=-1,0}else if(0===t.avail_in&&m(e)<=m(i)&&4!==e)return g(t,-5);if(s.status===p&&0!==t.avail_in)return g(t,-5);if(0!==t.avail_in||0!==s.lookahead||0!==e&&s.status!==p){var A=2===s.strategy?function(t,e){for(var i;;){if(0===t.lookahead&&(_(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,i=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(F(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(F(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(F(t,!1),0===t.strm.avail_out)?1:2}(s,e):3===s.strategy?function(t,e){for(var i,r,s,n,a=t.window;;){if(t.lookahead<=h){if(_(t),t.lookahead<=h&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(r=a[s=t.strstart-1])===a[++s]&&r===a[++s]&&r===a[++s]){n=t.strstart+h;do{}while(r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&s<n);t.match_length=h-(n-s),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=o._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(F(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(F(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(F(t,!1),0===t.strm.avail_out)?1:2}(s,e):r[s.level].func(s,e);if(3!==A&&4!==A||(s.status=p),1===A||3===A)return 0===t.avail_out&&(s.last_flush=-1),0;if(2===A&&(1===e?o._tr_align(s):5!==e&&(o._tr_stored_block(s,0,0,!1),3===e&&(w(s.head),0===s.lookahead&&(s.strstart=0,s.block_start=0,s.insert=0))),b(t),0===t.avail_out))return s.last_flush=-1,0}return 4!==e?0:s.wrap<=0?1:(2===s.wrap?(v(s,255&t.adler),v(s,t.adler>>8&255),v(s,t.adler>>16&255),v(s,t.adler>>24&255),v(s,255&t.total_in),v(s,t.total_in>>8&255),v(s,t.total_in>>16&255),v(s,t.total_in>>24&255)):(y(s,t.adler>>>16),y(s,65535&t.adler)),b(t),s.wrap>0&&(s.wrap=-s.wrap),0!==s.pending?0:1)},e.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&e!==u&&e!==f&&e!==p?g(t,l):(t.state=null,e===f?g(t,-3):0):l},e.deflateSetDictionary=function(t,e){var i,r,o,a,c,h,d,u,f=e.length;if(!t||!t.state)return l;if(2===(a=(i=t.state).wrap)||1===a&&42!==i.status||i.lookahead)return l;for(1===a&&(t.adler=n(t.adler,e,f,0)),i.wrap=0,f>=i.w_size&&(0===a&&(w(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new s.Buf8(i.w_size),s.arraySet(u,e,f-i.w_size,i.w_size,0),e=u,f=i.w_size),c=t.avail_in,h=t.next_in,d=t.input,t.avail_in=f,t.next_in=0,t.input=e,_(i);i.lookahead>=3;){r=i.strstart,o=i.lookahead-2;do{i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++}while(--o);i.strstart=r,i.lookahead=2,_(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=h,t.input=d,t.avail_in=c,i.wrap=a,0},e.deflateInfo="pako deflate (from Nodeca project)"},8485:(t,e)=>{function i(t){return("object"==typeof t&&null!==t&&"message"in t?t.message:`${t}`).replace(/\.$/,"")}Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{constructor(t,e={}){this.baseOverrides={},this.url=t;const i=e.fetch||globalThis.fetch.bind(globalThis);e.overrides&&(this.baseOverrides=e.overrides),this.fetchImplementation=i}async fetch(t,e){let r;try{r=await this.fetchImplementation(t,e)}catch(s){if(!`${s}`.includes("Failed to fetch"))throw new Error(`${i(s)} fetching ${t}`,{cause:s});console.warn(`generic-filehandle: refetching ${t} to attempt to work around chrome CORS header caching bug`);try{r=await this.fetchImplementation(t,{...e,cache:"reload"})}catch(e){throw new Error(`${i(e)} fetching ${t}`,{cause:e})}}return r}async read(t,e,i={}){const{headers:r={},signal:s,overrides:o={}}=i;t<1/0?r.range=`bytes=${e}-${e+t}`:t===1/0&&0!==e&&(r.range=`bytes=${e}-`);const n=await this.fetch(this.url,{...this.baseOverrides,...o,headers:{...r,...o.headers,...this.baseOverrides.headers},method:"GET",redirect:"follow",mode:"cors",signal:s});if(!n.ok)throw new Error(`HTTP ${n.status} fetching ${this.url}`);if(200===n.status&&0===e||206===n.status){const e=await n.arrayBuffer(),i=n.headers.get("content-range"),r=/\/(\d+)$/.exec(i||"");return(null==r?void 0:r[1])&&(this._stat={size:parseInt(r[1],10)}),new Uint8Array(e.slice(0,t))}throw 200===n.status?new Error(`${this.url} fetch returned status 200, expected 206`):new Error(`HTTP ${n.status} fetching ${this.url}`)}async readFile(t={}){let e,i;"string"==typeof t?(e=t,i={}):(e=t.encoding,i=t,delete i.encoding);const{headers:r={},signal:s,overrides:o={}}=i,n=await this.fetch(this.url,{headers:r,method:"GET",redirect:"follow",mode:"cors",signal:s,...this.baseOverrides,...o});if(200!==n.status)throw new Error(`HTTP ${n.status} fetching ${this.url}`);if("utf8"===e)return n.text();if(e)throw new Error(`unsupported encoding: ${e}`);return new Uint8Array(await n.arrayBuffer())}async stat(){if(!this._stat&&(await this.read(10,0),!this._stat))throw new Error(`unable to determine size of file at ${this.url}`);return this._stat}async close(){}}},8594:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.decode=function(t){const e=new s.default(t),i=e.ReadByte(),r=(e.ReadUint32(),e.ReadUint32());return 0==i?function(t,e){const i=new Array(256),r=new Array(256);h(t,i,r);const s=a(r),n=new Array(4);for(var d=0;d<4;d++)n[d]=t.ReadUint32();const u=new Uint8Array(e);for(d=0;d<e;d++){const e=d%4,a=s[o(n[e])];u[d]=a,n[e]=c(n[e],r[a],i[a]),n[e]=l(t,n[e])}return u}(e,r):function(t,e){const i=new Array(256),r=new Array(256);!function(t,e,i){for(let t=0;t<256;t++){e[t]=new Array(256),i[t]=new Array(256);for(let i=0;i<256;i++)e[t][i]=0}let r=t.ReadByte(),s=r,o=0;do{h(t,e[r],i[r]),o>0?(o--,r++):(r=t.ReadByte(),r==s+1&&(o=t.ReadByte())),s=r}while(0!=r)}(t,i,r);const s=new Array(256);for(var d=0;d<256;d++)s[d]=a(r[d]);const u=new Array(4),f=new Array(4);for(var p=0;p<4;p++)u[p]=t.ReadUint32(),f[p]=0;const g=new Uint8Array(e),m=Math.floor(e/4);for(d=0;d<m;d++)for(p=0;p<4;p++){var w=o(u[p]),b=s[f[p]][w];g[d+p*m]=b,u[p]=c(u[p],r[f[p]][b],i[f[p]][b]),u[p]=l(t,u[p]),f[p]=b}for(d*=4;d<e;)w=o(u[3]),b=n(r[f[3]],w),g[d++]=b,u[3]=c(u[3],r[f[3]][b],i[f[3]][b]),u[3]=l(t,u[3]),f[3]=b;return g}(e,r)};const s=r(i(3088));function o(t){return 4095&t}function n(t,e){let i=0;for(;e>=t[i+1];)i++;return i}function a(t){const e=new Array(4096);let i=0;for(let r=0;r<4096;r++){for(;r>=t[i+1];)i++;e[r]=i}return e}function c(t,e,i){return i*(t>>12)+(4095&t)-e}function l(t,e){for(;e<1<<23;)e=(e<<8)+t.ReadByte();return e}function h(t,e,i){for(var r=0;r<256;r++)e[r]=0;let s=t.ReadByte(),o=s,n=0;do{const i=t.ReadITF8();e[s]=i,n>0?(n--,s++):(s=t.ReadByte(),s==o+1&&(n=t.ReadByte())),o=s}while(0!=s);for(i[0]=0,r=0;r<=255;r++)i[r+1]=i[r]+e[r]}},8700:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const r=i(6272),s=i(1609),o={BF:"int",CF:"int",RI:"int",RL:"int",AP:"int",RG:"int",MF:"int",NS:"int",NP:"int",TS:"int",NF:"int",TC:"byte",TN:"int",FN:"int",FC:"byte",FP:"int",BS:"byte",IN:"byteArray",SC:"byteArray",DL:"int",BA:"byte",BB:"byteArray",RS:"int",PD:"int",HC:"int",MQ:"int",RN:"byteArray",QS:"byte",QQ:"byteArray",TL:"int"};e.default=class{constructor(t){this.dataSeriesCodecCache={},this.tagCodecCache={},this.tagEncoding={},this.readNamesIncluded=t.preservation.RN,this.APdelta=t.preservation.AP,this.referenceRequired=!!t.preservation.RR,this.tagIdsDictionary=t.preservation.TD,this.substitutionMatrix=function(t){const e=new Array(5);for(let t=0;t<5;t+=1)e[t]=new Array(4);return e[0][t[0]>>6&3]="C",e[0][t[0]>>4&3]="G",e[0][t[0]>>2&3]="T",e[0][3&t[0]]="N",e[1][t[1]>>6&3]="A",e[1][t[1]>>4&3]="G",e[1][t[1]>>2&3]="T",e[1][3&t[1]]="N",e[2][t[2]>>6&3]="A",e[2][t[2]>>4&3]="C",e[2][t[2]>>2&3]="T",e[2][3&t[2]]="N",e[3][t[3]>>6&3]="A",e[3][t[3]>>4&3]="C",e[3][t[3]>>2&3]="G",e[3][3&t[3]]="N",e[4][t[4]>>6&3]="A",e[4][t[4]>>4&3]="C",e[4][t[4]>>2&3]="G",e[4][3&t[4]]="T",e}(t.preservation.SM),this.dataSeriesEncoding=t.dataSeriesEncoding,this.tagEncoding=t.tagEncoding}getCodecForTag(t){const e=this.tagCodecCache[t];if(e)return e;{const e=this.tagEncoding[t];if(!e)throw new Error("Error, no tag encoding");const i=(0,s.instantiateCodec)(e,"byteArray");return this.tagCodecCache[t]=i,i}}getTagNames(t){return this.tagIdsDictionary[t]}getCodecForDataSeries(t){let e=this.dataSeriesCodecCache[t];if(void 0===e){const i=this.dataSeriesEncoding[t];if(i){const n=o[t];if(!n)throw new r.CramMalformedError(`data series name ${t} not defined in file compression header`);e=(0,s.instantiateCodec)(i,n),this.dataSeriesCodecCache[t]=e}}return e}toJSON(){const t={};return Object.keys(this).forEach(e=>{e.endsWith("Cache")||(t[e]=this[e])}),t}}},8751:function(t,e,i){var r,s=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=this&&this.__importStar||(r=function(t){return r=Object.getOwnPropertyNames||function(t){var e=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[e.length]=i);return e},r(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i=r(t),n=0;n<i.length;n++)"default"!==i[n]&&s(e,t,i[n]);return o(e,t),e}),a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const c=a(i(86)),l=a(i(7392)),h=i(1307),d=i(6272),u=n(i(4562)),f=i(6727),p=a(i(2670)),g=i(5011),m=i(870),w=i(2169),b=a(i(2845)),F=i(7580),v=i(2549);class y{constructor(t){var e;if(this.file=(0,f.open)(t.url,t.path,t.filehandle),this.validateChecksums=!0,this.fetchReferenceSequenceCallback=t.seqFetch,this.options={checkSequenceMD5:t.checkSequenceMD5,cacheSize:null!==(e=t.cacheSize)&&void 0!==e?e:2e4},this.featureCache=new l.default({maxSize:this.options.cacheSize}),function(){const t=new Uint32Array([287454020]),e=new Uint8Array(t.buffer);return 68===e[0]?0:17===e[0]?1:2}()>0)throw new Error("Detected big-endian machine, may be unable to run")}read(t,e){return this.file.read(t,e)}async getDefinition(){const{maxLength:t,parser:e}=(0,F.cramFileDefinition)(),i=e(await this.file.read(t,0)).value;if(2!==i.majorVersion&&3!==i.majorVersion)throw new d.CramUnimplementedError(`CRAM version ${i.majorVersion} not supported`);return i}async getSamHeader(){const t=await this.getContainerById(0);if(!t)throw new d.CramMalformedError("file contains no containers");const e=(await t.getFirstBlock()).content,i=new DataView(e.buffer).getInt32(0,!0),r=new TextDecoder("utf8").decode(e.subarray(4,4+i));return this.header=r,(0,g.parseHeaderText)(r)}async getHeaderText(){return await this.getSamHeader(),this.header}async getContainerById(t){const{majorVersion:e}=await this.getDefinition();let i,r=(0,F.getSectionParsers)(e).cramFileDefinition.maxLength;for(let e=0;e<=t;e++){i=this.getContainerAtPosition(r);const t=await i.getHeader();if(0===e){r=t._endPosition;for(let e=0;e<t.numBlocks;e++)r=(await this.readBlock(r))._endPosition}else r+=t._size+t.length}return i}async checkCrc32(t,e,i,r){const s=await this.file.read(e,t),o=(0,c.default)(s)>>>0;if(o!==i)throw new d.CramMalformedError(`crc mismatch in ${r}: recorded CRC32 = ${i}, but calculated CRC32 = ${o}`)}async containerCount(){const{majorVersion:t}=await this.getDefinition();let e=0,i=(0,F.getSectionParsers)(t).cramFileDefinition.maxLength;try{for(;;){const t=await this.getContainerAtPosition(i).getHeader();if(0===e){i=t._endPosition;for(let e=0;e<t.numBlocks;e++)i=(await this.readBlock(i))._endPosition}else i+=t._size+t.length;e+=1}}catch(t){e--}return e}getContainerAtPosition(t){return new b.default(this,t)}async readBlockHeader(t){const{majorVersion:e}=await this.getDefinition(),i=(0,F.getSectionParsers)(e),{cramBlockHeader:r}=i,s=await this.file.read(r.maxLength,t);return(0,v.parseItem)(s,r.parser,0,t)}async _parseSection(t,e,i=t.maxLength,r){const s=null!=r?r:await this.file.read(i,e),o=(0,v.parseItem)(s,t.parser,0,e);if(o._size!==i)throw new d.CramMalformedError(`section read error: requested size ${i} does not equal parsed size ${o._size}`);return o}async _uncompressPre(t,e,i){if("gzip"===t)return(0,w.unzip)(e);if("bzip2"===t)return(0,m.decode)(e);if("lzma"===t){const t=new Response(new h.XzReadableStream((r=e,new ReadableStream({start(t){t.enqueue(r),t.close()}}))));return new Uint8Array(await t.arrayBuffer())}if("rans"===t){const t=new Uint8Array(i);return(0,p.default)(e,t),t}if("rans4x16"===t)return u.r4x16_uncompress(e);if("arith"===t)return u.arith_uncompress(e);if("fqzcomp"===t)return u.fqzcomp_uncompress(e);if("tok3"===t)return u.tok3_uncompress(e);throw new d.CramUnimplementedError(`${t} decompression not yet implemented`);var r}async _uncompress(t,e,i){const r=await this._uncompressPre(t,e,i);if(r.length!==i){const t=new Uint8Array(i);return t.set(r,0),t}return r}async readBlock(t){const{majorVersion:e}=await this.getDefinition(),i=(0,F.getSectionParsers)(e),r=await this.readBlockHeader(t),s=r._endPosition,o=await this.file.read(r.compressedSize,s),n="raw"!==r.compressionMethod?await this._uncompress(r.compressionMethod,o,r.uncompressedSize):o,a={...r,_endPosition:s,contentPosition:s,content:n};if(e>=3){const e=await this._parseSection(i.cramBlockCrc32,s+r.compressedSize);a.crc32=e.crc32,this.validateChecksums&&await this.checkCrc32(t,r._size+r.compressedSize,e.crc32,"block data"),a._endPosition=e._endPosition,a._size=a.compressedSize+i.cramBlockCrc32.maxLength}else a._endPosition=s+a.compressedSize,a._size=a.compressedSize;return a}}e.default=y,"getDefinition getSectionParsers getSamHeader".split(" ").forEach(t=>{(0,v.tinyMemoize)(y,t)})},8761:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]);e.default=class{constructor(){this.crc=4294967295}getCRC(){return~this.crc>>>0}updateCRC(t){this.crc=this.crc<<8^i[255&(this.crc>>>24^t)]}updateCRCRun(t,e){for(;e-- >0;)this.crc=this.crc<<8^i[255&(this.crc>>>24^t)]}}},8930:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=r(i(4141)),o=i(6272),n=i(2549),a=i(6761);class c extends s.default{constructor(t,e){if(super(t,e),"int"===this.dataType)this._decodeData=this._decodeInt;else{if("byte"!==this.dataType)throw new o.CramUnimplementedError(`${this.dataType} decoding not yet implemented by EXTERNAL codec`);this._decodeData=this._decodeByte}}decode(t,e,i,r){const{blockContentId:s}=this.parameters,o=i[s];return o?this._decodeData(o,r.externalBlocks.getCursor(s)):void 0}_decodeInt(t,e){const[i,r]=(0,n.parseItf8)(t.content,e.bytePosition);return e.bytePosition=e.bytePosition+r,i}_decodeByte(t,e){if(e.bytePosition>=t.content.length)throw new a.CramBufferOverrunError("attempted to read beyond end of block. this file seems truncated.");return t.content[e.bytePosition++]}}e.default=c},9301:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const r=i(6272),s=i(7151);class o{constructor(){this.F=void 0,this.C=void 0}}function n(t,e,i,r){return i*(t>>r)+(t&(1<<r)-1)-e}e.default={FC:o,AriDecoder:class{constructor(){this.fc=new Array(256);for(let t=0;t<this.fc.length;t+=1)this.fc[t]=new o;this.R=null}},DecodingSymbol:class{constructor(){this.start=void 0,this.freq=void 0}},symbolInit:function(t,e,i){if(!(e<=65536))throw new r.CramMalformedError("assertion failed: start <= 1<<16");if(!(i<=65536-e))throw new r.CramMalformedError("assertion failed: freq <= 1<<16");t.start=e,t.freq=i},advanceStep:n,advanceSymbolStep:function(t,e,i){return n(t,e.start,e.freq,i)},get:function(t,e){return t&(1<<e)-1},advanceSymbol:function(t,e,i,r){return function(t,e,i,r,o){if((t=r*(t>>o)+(t&(1<<o)-1)-i)<s.RANS_BYTE_L)do{t=t<<8|255&e.get()}while(t<s.RANS_BYTE_L);return t}(t,e,i.start,i.freq,r)},renormalize:function(t,e){if(t<s.RANS_BYTE_L)do{t=t<<8|255&e.get()}while(t<s.RANS_BYTE_L);return t}}},9313:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.decode=function(t){return h(new s.default(t),0)};const s=r(i(3088));function o(t,e){return t&(1<<e)-1}function n(t,e){let i=0;for(;e>=t[i+1];)i++;return i}function a(t,e){const i=1<<e,r=new Array(i);let s=0;for(let e=0;e<i;e++){for(;e>=t[s+1];)s++;r[e]=s}return r}function c(t,e,i,r){return i*(t>>r)+(t&(1<<r)-1)-e}function l(t,e){return e<32768&&(e=(e<<16)+t.ReadUint16()),e}function h(t,e){const i=t.ReadByte(),r=1&i,p=8&i,g=32&i,m=64&i,w=128&i,b=4&i?32:4;if(16&i||(e=t.ReadUint7()),p)return function(t,e){const i=t.ReadByte(),r=new Array(i),s=new Array(i);for(var o=0;o<i;o++)r[o]=t.ReadUint7();const n=new Array(i);for(o=0;o<i;o++)s[o]=Math.floor(e/i)+(e%i>o),n[o]=h(t,s[o]);const a=new Uint8Array(e);for(o=0;o<i;o++)for(let t=0;t<s[o];t++)a[t*i+o]=n[o][t];return a}(t,e);if(w)var F=e,[v,y,e]=function(t){const e=t.ReadByte(),i=new Array(e);for(let r=0;r<e;r++)i[r]=t.ReadByte();return[i,e,t.ReadUint7()]}(t);if(m)var A=e,[C,_,e]=function(t,e){const i=t.ReadUint7(),r=t.ReadUint7();if(1&i)var o=t.ReadData((i-1)/2);else{const r=t.ReadUint7();o=t.ReadData(r),o=u(new s.default(o),i/2,e)}o=new s.default(o);const n=new Array(256);let a=o.ReadByte();0==a&&(a=256);for(let t=0;t<a;t++)n[o.ReadByte()]=1;return[n,o,r]}(t,b);if(g)var x=t.ReadData(e);else x=0==r?u(t,e,b):function(t,e,i){const r=(p=t.ReadByte())>>4;var h=t;if(1&p){const e=t.ReadUint7(),i=t.ReadUint7();var p=new s.default(t.ReadData(i));h=new s.default(u(p,e,4))}const g=new Array(256),m=new Array(256);!function(t,e,i,r){for(var s=0;s<256;s++){e[s]=new Array(256),i[s]=new Array(256);for(var o=0;o<256;o++)e[s][o]=0}const n=d(t);for(s=0;s<256;s++){if(!n[s])continue;let a=0;for(o=0;o<256;o++)n[o]&&(a>0?a--:(e[s][o]=t.ReadUint7(),0==e[s][o]&&(a=t.ReadByte())));for(f(e[s],r),i[s][0]=0,o=0;o<256;o++)i[s][o+1]=i[s][o]+e[s][o]}}(h,g,m,r);const w=new Array(256);for(var b=0;b<256;b++)w[b]=a(m[b],r);const F=new Array(i),v=new Array(i);for(var y=0;y<i;y++)F[y]=t.ReadUint32(),v[y]=0;const A=new Uint8Array(e),C=Math.floor(e/i);for(b=0;b<C;b++)for(y=0;y<i;y++){var _=o(F[y],r),x=w[v[y]][_];A[b+y*C]=x,F[y]=c(F[y],m[v[y]][x],g[v[y]][x],r),F[y]=l(t,F[y]),v[y]=x}for(b*=i;b<e;)_=o(F[i-1],r),x=n(m[v[i-1]],_),A[b++]=x,F[i-1]=c(F[i-1],m[v[i-1]][x],g[v[i-1]][x],r),F[i-1]=l(t,F[i-1]),v[i-1]=x;return A}(t,e,b);return m&&(x=function(t,e,i,r){new s.default(t);const o=new Uint8Array(r);let n=0;for(let s=0;n<r;s++){const r=t[s];if(e[r]){const t=i.ReadUint7();for(let e=0;e<=t;e++)o[n++]=r}else o[n++]=r}return o}(x,C,_,A)),w&&(x=function(t,e,i,r){const s=new Uint8Array(r);let o=0;if(i<=1)for(var n=0;n<r;n++)s[n]=e[0];else if(i<=2)for(n=0;n<r;n++){if(n%8==0)var a=t[o++];s[n]=e[1&a],a>>=1}else if(i<=4)for(n=0;n<r;n++)n%4==0&&(a=t[o++]),s[n]=e[3&a],a>>=2;else if(i<=16)for(n=0;n<r;n++)n%2==0&&(a=t[o++]),s[n]=e[15&a],a>>=4;return s}(x,v,y,F)),x}function d(t){const e=new Array(256);for(let t=0;t<256;t++)e[t]=0;let i=0,r=t.ReadByte(),s=r;do{e[r]=1,i>0?(i--,r++):(r=t.ReadByte(),r==s+1&&(i=t.ReadByte())),s=r}while(0!=r);return e}function u(t,e,i){const r=new Array(256),s=new Array(256);!function(t,e,i){for(var r=0;r<256;r++)e[r]=0;const s=d(t);for(r=0;r<256;r++)s[r]>0&&(e[r]=t.ReadUint7());for(f(e,12),i[0]=0,r=0;r<=255;r++)i[r+1]=i[r]+e[r]}(t,r,s);const n=a(s,12),h=new Array(i);for(var u=0;u<i;u++)h[u]=t.ReadUint32();const p=new Uint8Array(e);for(u=0;u<e;u++){const e=u&i-1,a=n[o(h[e],12)];p[u]=a,h[e]=c(h[e],s[a],r[a],12),h[e]=l(t,h[e])}return p}function f(t,e){let i=0;for(var r=0;r<256;r++)i+=t[r];if(0==i||i==1<<e)return;let s=0;for(;i<1<<e;)i*=2,s++;for(r=0;r<256;r++)t[r]<<=s}},9505:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const s=i(870),o=r(i(4652)),n=r(i(2324)),a=r(i(3088));e.default=class{decode(t){return this.stream=new a.default(t),this.decodeStream(this.stream)}decodeStream(t,e=0){const i=this.stream.ReadByte();16&i||(e=this.stream.ReadUint7());let r=e;const s=1&i;if(8&i)return this.decodeStripe(this.stream,e);var o;if(128&i&&([o,r]=this.decodePackMeta(this.stream)),32&i)var n=this.decodeCat(this.stream,r);else n=4&i?this.decodeExt(this.stream,r):64&i?s?this.decodeRLE1(this.stream,r):this.decodeRLE0(this.stream,r):s?this.decode1(this.stream,r):this.decode0(this.stream,r);return 128&i&&(n=this.decodePack(n,o,e)),n}decode0(t,e){const i=new Uint8Array(e);let r=t.ReadByte();0==r&&(r=256);const s=new n.default(r),a=new o.default(t);a.RangeStartDecode(t);for(let r=0;r<e;r++)i[r]=s.ModelDecode(t,a);return i}decode1(t,e){const i=new Uint8Array(e);let r=t.ReadByte();0==r&&(r=256);const s=new Array(r);for(var a=0;a<r;a++)s[a]=new n.default(r);const c=new o.default(t);c.RangeStartDecode(t);let l=0;for(a=0;a<e;a++)i[a]=s[l].ModelDecode(t,c),l=i[a];return i}decodeExt(t,e){return(0,s.decode)(t.buf.slice(t.pos))}decodeRLE0(t,e){const i=new Uint8Array(e);let r=t.ReadByte();0==r&&(r=256);const s=new n.default(r),a=new Array(258);for(var c=0;c<=257;c++)a[c]=new n.default(4);const l=new o.default(t);for(l.RangeStartDecode(t),c=0;c<e;){i[c]=s.ModelDecode(t,l);let e=a[i[c]].ModelDecode(t,l),r=e,o=256;for(;3==e;)e=a[o].ModelDecode(t,l),o=257,r+=e;for(let t=1;t<=r;t++)i[c+t]=i[c];c+=r+1}return i}decodeRLE1(t,e){const i=new Uint8Array(e);let r=t.ReadByte();0==r&&(r=256);const s=new Array(r);for(var a=0;a<r;a++)s[a]=new n.default(r);const c=new Array(258);for(a=0;a<=257;a++)c[a]=new n.default(4);const l=new o.default(t);l.RangeStartDecode(t);let h=0;for(a=0;a<e;){i[a]=s[h].ModelDecode(t,l),h=i[a];let e=c[i[a]].ModelDecode(t,l),r=e,o=256;for(;3==e;)e=c[o].ModelDecode(t,l),o=257,r+=e;for(let t=1;t<=r;t++)i[a+t]=i[a];a+=r+1}return i}decodePackMeta(t){this.nsym=t.ReadByte();const e=new Array(this.nsym);for(let i=0;i<this.nsym;i++)e[i]=t.ReadByte();return[e,t.ReadUint7()]}decodePack(t,e,i){const r=new Uint8Array(i);if(this.nsym<=1)for(var s=0;s<i;s++)r[s]=e[0];else if(this.nsym<=2){s=0;for(var o=0;s<i;s++){if(s%8==0)var n=t[o++];r[s]=e[1&n],n>>=1}}else if(this.nsym<=4)for(s=0,o=0;s<i;s++)s%4==0&&(n=t[o++]),r[s]=e[3&n],n>>=2;else{if(!(this.nsym<=16))return t;for(s=0,o=0;s<i;s++)s%2==0&&(n=t[o++]),r[s]=e[15&n],n>>=4}return r}packMeta(t){const e=new a.default("",0,1024),i=new Array(256);for(var r=0;r<t.length;r++)i[t[r]]=1;var s=0;for(r=0;r<256;r++)i[r]&&(i[r]=++s);for(e.WriteByte(s),r=0;r<256;r++)i[r]&&(e.WriteByte(r),i[r]--);return[e,i,s]}decodeStripe(t,e){const i=t.ReadByte(),r=new Array(i),s=new Array(i);for(var o=0;o<i;o++)r[o]=t.ReadUint7();const n=new Array(i);for(o=0;o<i;o++)s[o]=Math.floor(e/i)+(e%i>o),n[o]=this.decodeStream(t,s[o]);const a=new Uint8Array(e);for(o=0;o<i;o++)for(let t=0;t<s[o];t++)a[t*i+o]=n[o][t];return a}decodeCat(t,e){const i=new Uint8Array(e);for(let r=0;r<e;r++)i[r]=t.ReadByte();return i}}},9681:t=>{t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},9685:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,i,c,l,h,d,u,f){let p=e("BF");const g=e("CF");if(!(0,o.isMappedSliceHeader)(c.parsedContent))throw new Error("slice header not mapped");const m=u>1&&-2===c.parsedContent.refSeqId?e("RI"):c.parsedContent.refSeqId,w=e("RL");let b=e("AP");i.APdelta&&(b+=d.lastAlignmentStart),d.lastAlignmentStart=b;const F=e("RG");let v,y,A,C;if(i.readNamesIncluded&&(v=n(e("RN"))),s.CramFlagsDecoder.isDetached(g)){const t=e("MF");let r;i.readNamesIncluded||(r=n(e("RN")),v=r);const o=e("NS"),a=e("NP");(t||o>-1)&&(y={mateFlags:t,mateSequenceId:o,mateAlignmentStart:a,mateReadName:r}),A=e("TS"),s.MateFlagsDecoder.isUnmapped(t)&&(p=s.BamFlagsDecoder.setMateUnmapped(p)),s.MateFlagsDecoder.isOnNegativeStrand(t)&&(p=s.BamFlagsDecoder.setMateReverseComplemented(p))}else s.CramFlagsDecoder.isWithMateDownstream(g)&&(C=e("NF")+f+1);const _=e("TL");if(_<0)throw new r.CramMalformedError("invalid TL index");const x={},k=i.getTagNames(_),I=k.length;for(let e=0;e<I;e++){const r=k[e],s=r.slice(0,2),o=r.slice(2,3),n=i.getCodecForTag(r).decode(t,l,h,d);x[s]=void 0===n?void 0:"number"==typeof n?n:a(o,n)}let S,E,N,M,R;if(s.BamFlagsDecoder.isSegmentUnmapped(p))if(s.CramFlagsDecoder.isDecodeSequenceAsStar(g))R=null,M=null;else{const t=new Array(w);for(let i=0;i<t.length;i++)t[i]=e("BA");if(R=String.fromCharCode(...t),s.CramFlagsDecoder.isPreservingQualityScores(g)){M=new Array(w);for(let i=0;i<t.length;i++)M[i]=e("QS")}}else{const t=e("FN");if(t&&(S=function(t,e,i,s,o){let n=0,a=t-1;const c=new Array(e);function l([t,e]){const r=i(e);if("character"===t)return String.fromCharCode(r);if("string"===t){let t="";for(let e=0;e<r.byteLength;e++)t+=String.fromCharCode(r[e]);return t}return"numArray"===t?Array.from(r):r}for(let t=0;t<e;t++){const e=String.fromCharCode(i("FC")),s=i("FP"),h={B:["character","BA"],S:["string",o>1?"SC":"IN"],X:["number","BS"],D:["number","DL"],I:["string","IN"],i:["character","BA"],b:["string","BB"],q:["numArray","QQ"],Q:["number","QS"],H:["number","HC"],P:["number","PD"],N:["number","RS"]}[e];if(!h)throw new r.CramMalformedError(`invalid read feature code "${e}"`);let d=l(h);const u={B:["number","QS"]}[e];u&&(d=[d,l(u)]),n+=s;const f=n;a+=s;const p=a;"D"===e||"N"===e?a+=d:"I"===e||"S"===e?a-=d.length:"i"===e&&(a-=1),c[t]={code:e,pos:f,refPos:p,data:d}}return c}(b,t,e,0,u)),E=w,S)for(const{code:t,data:e}of S)"D"===t||"N"===t?E+=e:"I"===t||"S"===t?E-=e.length:"i"===t&&(E-=1);if(Number.isNaN(E)&&(console.warn(`${v||`${m}:${b}`} record has invalid read features`),E=w),N=e("MQ"),s.CramFlagsDecoder.isPreservingQualityScores(g)){M=new Array(w);for(let t=0;t<M.length;t++)M[t]=e("QS")}}return{readLength:w,sequenceId:m,cramFlags:g,flags:p,alignmentStart:b,readGroupId:F,readName:v,mateToUse:y,templateSize:A,mateRecordNumber:C,readFeatures:S,lengthOnRef:E,mappingQuality:N,qualityScores:M,readBases:R,tags:x}};const r=i(6272),s=i(7480),o=i(7580);function n(t){let e="";for(let i=0;i<t.length&&0!==t[i];i++)e+=String.fromCharCode(t[i]);return e}function a(t,e){if("Z"===t)return n(e);if("A"===t)return String.fromCharCode(e[0]);if("I"===t)return new Uint32Array(e.buffer)[0];if("i"===t)return new Int32Array(e.buffer)[0];if("s"===t)return new Int16Array(e.buffer)[0];if("S"===t)return new Uint16Array(e.buffer)[0];if("c"===t)return new Int8Array(e.buffer)[0];if("C"===t)return e[0];if("f"===t)return new Float32Array(e.buffer)[0];if("H"===t)return Number.parseInt(n(e).replace(/^0x/,""),16);if("B"===t)return function(t){const e=String.fromCharCode(t[0]),i=new DataView(t.buffer).getUint32(1,!0),r=new Array(i);if(t=t.slice(5),"c"===e){const e=new Int8Array(t.buffer);for(let t=0;t<i;t++)r[t]=e[t]}else if("C"===e){const e=new Uint8Array(t.buffer);for(let t=0;t<i;t++)r[t]=e[t]}else if("s"===e){const e=new Int16Array(t.buffer);for(let t=0;t<i;t++)r[t]=e[t]}else if("S"===e){const e=new Uint16Array(t.buffer);for(let t=0;t<i;t++)r[t]=e[t]}else if("i"===e){const e=new Int32Array(t.buffer);for(let t=0;t<i;t++)r[t]=e[t]}else if("I"===e){const e=new Uint32Array(t.buffer);for(let t=0;t<i;t++)r[t]=e[t]}else{if("f"!==e)throw new Error(`unknown type: ${e}`);{const e=new Float32Array(t.buffer);for(let t=0;t<i;t++)r[t]=e[t]}}return r}(e);throw new r.CramMalformedError(`Unrecognized tag type ${t}`)}},9805:(t,e)=>{var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var s in i)r(i,s)&&(t[s]=i[s])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var s={arraySet:function(t,e,i,r,s){if(e.subarray&&t.subarray)t.set(e.subarray(i,i+r),s);else for(var o=0;o<r;o++)t[s+o]=e[i+o]},flattenChunks:function(t){var e,i,r,s,o,n;for(r=0,e=0,i=t.length;e<i;e++)r+=t[e].length;for(n=new Uint8Array(r),s=0,e=0,i=t.length;e<i;e++)o=t[e],n.set(o,s),s+=o.length;return n}},o={arraySet:function(t,e,i,r,s){for(var o=0;o<r;o++)t[s+o]=e[i+o]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,s)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,o))},e.setTyped(i)},9846:()=>{}},Cp={},function t(e){var i=Cp[e];if(void 0!==i)return i.exports;var r=Cp[e]={exports:{}};return Ap[e].call(r.exports,r,r.exports,t),r.exports}(5159));class Ip{constructor(t,e){this.position=0,this.url=t,this.config=e,x(t)||!1===e.cacheFetches?this.useCache=!1:(this.useCache=!0,this.cache=new Sp({fetch:(t,e)=>this._fetch(t,e),fetchSize:e.fetchSize||1e4}))}async _fetch(t,e){const i={start:t,size:e};return await Er.loadArrayBuffer(this.url,Qo(this.config,{range:i}))}async read(t,e=0){let i;return i=this.useCache?await this.cache.get(e,t):await this._fetch(e,t),new Uint8Array(i)}async readFile(){const t=await Er.loadArrayBuffer(this.url,Qo(this.config));return new Uint8Array(t)}}class Sp{constructor({fetch:t,fetchSize:e=3e4}){this.maxChunkCount=5,this.chunks=[],this.fetch=t,this.fetchSize=e}async get(t,e){const i=t+e;for(let r of this.chunks)if(r.contains(t,i)){const i=t-r.start;return r.buffer.slice(i,i+e)}const r=Math.max(e,this.fetchSize),s=Math.max(0,t-1e3),o=t+r+1e3,n=await this.fetch(s,o-s),a=new Ep(s,o,n);this.chunks.length>this.maxChunkCount&&this.chunks.shift(),this.chunks.push(a);const c=t-a.start,l=c+e;return n.slice(c,l)}}class Ep{constructor(t,e,i){this.start=t,this.end=e,this.buffer=i}contains(t,e){return t>=this.start&&e<=this.end}}class Np{constructor(t,e,i){_p.add(this),this.chrAliasTable=new Map,this.config=t,this.browser=i,this.genome=e,this.cramFile=new kp.CramFile({filehandle:t.fileHandle?t.fileHandle:new Ip(t.url,t),seqFetch:t.seqFetch||async function(t,e,i){const r=this.genome,s=await this.getHeader(),o=r.getChromosomeName(s.indexToChr[t]);return await this.genome.getSequence(o,e-1,i)||""}.bind(this),checkSequenceMD5:void 0===t.checkSequenceMD5||t.checkSequenceMD5});const r=t.indexFileHandle?t.indexFileHandle:new Ip(t.indexURL,t);this.indexedCramFile=new kp.IndexedCramFile({cram:this.cramFile,index:new kp.CraiIndex({filehandle:r}),fetchSizeLimit:t.fetchSizeLimit||1e9}),op.setReaderDefaults(this,t)}async getHeader(){if(!this.header){const t=await this.cramFile.getSamHeader(),e={},i=[],r=[];for(let s of t)if("SQ"===s.tag){for(let t of s.data)if("SN"===t.tag){const r=t.value;e[r]=i.length,i.push(r);break}}else"RG"===s.tag&&r.push(s.data);this.header={indexToChr:i,chrToIndex:e,chrNames:Object.keys(e),readGroups:r}}return this.header}async readAlignments(t,e,i){const r=await this.getHeader(),s=await wo(this,_p,"m",xp).call(this,t),o=new xf(t,e,i,this.config);if(void 0===s)return o;try{const t=await this.indexedCramFile.getRecordsForRange(s,e,i);for(let a of t){const t=a.sequenceId,c=a.alignmentStart,l=c+a.lengthOnRef;if(t<0)continue;if(t>s||c>i)return;if(t<s)continue;if(l<e)continue;const h=n(a,r.chrNames);this.filter.pass(h)&&o.push(h)}return o.finish(),o}catch(t){let e=t instanceof Error?t.message:String(t);throw e&&e.indexOf("MD5")>=0&&(e="Sequence mismatch. Is this the correct genome for the loaded CRAM?"),this.browser.alert.present(new Error(e)),t}function n(t,e){const i=new Zf;if(i.chr=e[t.sequenceId],i.start=t.alignmentStart-1,i.lengthOnRef=t.lengthOnRef,i.flags=t.flags,i.strand=!(16&t.flags),i.fragmentLength=t.templateLength||t.templateSize||0,i.mq=t.mappingQuality,i.end=t.alignmentStart+t.lengthOnRef,i.readGroupId=t.readGroupId,t.mate&&void 0!==t.mate.sequenceId){const r=void 0!==t.mate.flags?!(1&t.mate.flags):!(32&t.flags);i.mate={chr:e[t.mate.sequenceId],position:t.mate.alignmentStart,strand:r}}return i.seq=t.getReadBases(),i.qual=t.qualityScores,i.tagDict=t.tags,i.readName=t.readName,function(t,e){const i=[];let r,s,o=0,n="";if(e.scStart=e.start,e.scLengthOnRef=e.lengthOnRef,t.readFeatures)for(let a of t.readFeatures){const t=a.code,c=a.data,l=a.pos-1,h=a.refPos-1;switch(t){case"S":case"I":case"i":case"N":case"D":if(l>o){const t=l-o;i.push(new Xf({start:h-t,seqOffset:o,len:t,type:"M"})),o+=t,n+=t+"M"}if("S"===t){const r=c;let s=h;e.scLengthOnRef+=r.length,0===l&&(e.scStart-=r.length,s-=r.length);const a=r.length;i.push(new Xf({start:s,seqOffset:o,len:a,type:"S"})),o+=a,n+=a+t}else if("I"===t||"i"===t){void 0===r&&(r=[]);const e="i"===t?1:c.length;r.push(new Xf({start:h,len:e,seqOffset:o,type:"I"})),o+=e,n+=e+t}else if("D"===t||"N"===t){s||(s=[]);const e=c;s.push({start:h,len:e,type:t}),n+=e+t}break;case"H":case"P":n+=c+t}}const a=t.readLength-o;a>0&&(i.push(new Xf({start:t.alignmentStart+t.lengthOnRef-a-1,seqOffset:o,len:a,type:"M"})),n+=a+"M");e.blocks=i,e.insertions=r,e.gaps=s,e.cigar=n}(t,i),i.mate&&i.start>i.mate.position&&i.fragmentLength>0&&(i.fragmentLength=-i.fragmentLength),op.setPairOrientation(i),i}}}_p=new WeakSet,xp=async function(t){if(await this.getHeader(),this.chrAliasTable.has(t)&&void 0===(t=this.chrAliasTable.get(t)))return;let e=this.header.chrToIndex[t];if(void 0===e){const i=await this.genome.getAliasRecord(t);let r;if(i){const t=Object.keys(i).filter(t=>"start"!==t&&"end"!==t).map(t=>i[t]).filter(t=>void 0!==this.header.chrToIndex[t]);t.length>0&&(r=t[0],e=this.header.chrToIndex[t[0]])}this.chrAliasTable.set(t,r)}return e};const Mp=2291137574,Rp=2273964779,Dp=[84,68,70,52],Bp=new Uint8Array([66,65,77,1]),Tp=[67,82,65,77],Lp=[31,139],zp=new Set(["narrowpeak","broadpeak","regionpeak","peaks","bedgraph","wig","gff3","gff","gtf","fusionjuncspan","refflat","seg","aed","bed","bedMethyl","vcf","bb","bigbed","biginteract","biggenepred","bignarrowpeak","bw","bigwig","bam","tdf","refgene","genepred","genepredext","bedpe","bp","snp","rmsk","cram","gwas","maf","mut","hiccups","fasta","fa","fna","pytor","hic","qtl"]);function Pp(t,e){const i=Math.min(t.length,e.length);if(0==i)return!1;for(let r=0;r<i;r++)if(t[r]!==e[r])return!1;return!0}async function Op(t){let e;const i=t.filename||_(t.url);return i&&(e=await function(t){if(!t)return;if((t=t.toLowerCase()).endsWith("refgene.txt.gz")||t.endsWith("refgene.txt.bgz")||t.endsWith("refgene.txt")||t.endsWith("refgene.sorted.txt.gz")||t.endsWith("refgene.sorted.txt.bgz"))return"refgene";t.endsWith(".gz")&&(t=t.substring(0,t.length-3));t.endsWith(".bgz")&&(t=t.substring(0,t.length-4));(t.endsWith(".txt")||t.endsWith(".tab")||t.endsWith(".tsv"))&&(t=t.substring(0,t.length-4));const e=t.lastIndexOf("."),i=e<0?t:t.substring(e+1);switch(i){case"bw":return"bigwig";case"bb":return"bigbed";case"fasta":case"fa":case"fna":return"fasta";default:return zp.has(i)?i:void 0}}(i)),e||(e=await async function(t){const e=t.url;let i=Qo(t,{range:{start:0,size:1e3}}),r=await Er.loadArrayBuffer(e,i),s=new Uint8Array(r);if(Pp(s,Lp)){if(0!==(4&s[3])&&66===s[12]&&67===s[13]){i=Qo(t,{range:{start:0,size:ir(r)}}),r=await Er.loadArrayBuffer(e,i),s=er(r)}else i=Qo(t,{}),r=await Er.loadArrayBuffer(e,i),s=tr(r),t._filecontents=s}if(Pp(s,Bp))return"bam";if(Pp(s,Tp))return"cram";const o=!0;let n=new _n(new DataView(r),o).getUInt();if(n===Mp)return"bigwig";if(n===Rp)return"bigbed";if(Pp(s,Dp))return"tdf";const a=new TextDecoder("utf-8").decode(s),c=a.split(/\r?\n/)[0];if(c.startsWith("##fileformat=VCF"))return"vcf";if(c.startsWith("##gff-version 3"))return"gff3";if(c.startsWith("##gff-version"))return"gff";if(c.startsWith("##fileformat="))return c.substring(13).toLowerCase();if(Zc.isQTL(c))return"qtl";if(_c.isGWAS(c))return"gwas";if(ra(c.split("\t")))return"hiccups";return null}(t)),e}class Hp{constructor(t,e){const i=e.genome;if(this.config=t,this.genome=i,Ko(t.url)&&(this.config.indexed=!1),"ga4gh"===t.sourceType)throw Error("Unsupported source type 'ga4gh'");if("pysam"===t.sourceType)this.bamReader=new vp(t,i);else if("htsget"===t.sourceType)this.bamReader=new yp(t,i);else if("shardedBam"===t.sourceType)this.bamReader=new Fp(t,i);else if("cram"===t.format)this.bamReader=new Np(t,i,e);else{if(!this.config.indexURL&&!1!==t.indexed)if(b(this.config.url)){const t=function(t,e){if(b(t)){if(t.includes("?")){const i=t.indexOf("?");return t.substring(0,i)+"."+e+t.substring(i)}return t+"."+e}}(this.config.url,"bai");t?(console.warn(`Warning: no indexURL specified for ${this.config.url}. Guessing ${t}`),this.config.indexURL=t):(console.warn(`Warning: no indexURL specified for ${this.config.url}.`),this.config.indexed=!1)}else console.warn(`Warning: no indexURL specified for ${this.config.name}.`),this.config.indexed=!1;!1!==this.config.indexed?this.bamReader=new bp(t,i):this.bamReader=new wp(t,i)}}async postInit(){"function"==typeof this.bamReader.postInit&&await this.bamReader.postInit()}async getAlignments(t,e,i){var r,s;const o=await this.bamReader.readAlignments(t,e,i);if(!o||Array.isArray(o))return new xf(t,e,i,this.config);const n=o;if(n.hasAlignments){const e=await(null===(s=(r=this.genome).getSequence)||void 0===s?void 0:s.call(r,t,n.start,n.end));if(e)return n.coverageMap.refSeq=e,n.sequence=e,n;console.error("No sequence for: "+t+":"+n.start+"-"+n.end)}return n}}class Up{constructor({chr:t,start:e,end:i}){this.chr=t,this.start=null!=e?e:0,this.end=null!=i?i:0}contains(t){return t.chr===this.chr&&t.start>=this.start&&t.end<=this.end}overlaps(t){return t.chr===this.chr&&!(t.end<this.start||t.start>this.end)}extend(t){t.chr===this.chr&&(this.start=Math.min(t.start,this.start),this.end=Math.max(t.end,this.end))}getLocusString(){if("all"===this.chr)return"all";{const t=F(Math.floor(this.start)+1),e=F(Math.round(this.end));return`${this.chr}:${t}-${e}`}}static fromLocusString(t){if("all"===t)return new Up({chr:"all"});const e=t.split(":"),i=e[0],r=e[1].split("-"),s=Number.parseInt(r[0].replace(/,/g,""))-1,o=Number.parseInt(r[1].replace(/,/g,""));return new Up({chr:i,start:s,end:o})}static isSingleBaseLocusString(t){if(!t||"string"!=typeof t)return!1;const e=t.split(":");if(e.length<=1)return!1;const i=e[1].replace(/,/g,"");if(!i)return!1;const r=i.split("-"),s=r[0],o=parseInt(s,10);if(String(o)!==s||!Number.isInteger(o))return!1;if(1===r.length)return!0;const n=r[1],a=parseInt(n,10);return!(String(a)!==n||!Number.isInteger(a))&&o===a}}
|
|
17
|
+
/*!
|
|
18
|
+
* vanilla-picker v2.12.1
|
|
19
|
+
* https://vanilla-picker.js.org
|
|
20
|
+
*
|
|
21
|
+
* Copyright 2017-2021 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate)
|
|
22
|
+
* Released under the ISC license.
|
|
23
|
+
*/var Vp=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},qp=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}(),Qp=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var i=[],r=!0,s=!1,o=void 0;try{for(var n,a=t[Symbol.iterator]();!(r=(n=a.next()).done)&&(i.push(n.value),!e||i.length!==e);r=!0);}catch(t){s=!0,o=t}finally{try{!r&&a.return&&a.return()}finally{if(s)throw o}}return i}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")};String.prototype.startsWith=String.prototype.startsWith||function(t){return 0===this.indexOf(t)},String.prototype.padStart=String.prototype.padStart||function(t,e){for(var i=this;i.length<t;)i=e+i;return i};var Gp={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function Wp(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(e>0?t.toFixed(e).replace(/0+$/,"").replace(/\.$/,""):t.toString())||"0"}var jp=function(){function t(e,i,r,s){Vp(this,t);var o=this;if(void 0===e);else if(Array.isArray(e))this.rgba=e;else if(void 0===r){var n=e&&""+e;n&&function(e){if(e.startsWith("hsl")){var i=e.match(/([\-\d\.e]+)/g).map(Number),r=Qp(i,4),s=r[0],n=r[1],a=r[2],c=r[3];void 0===c&&(c=1),s/=360,n/=100,a/=100,o.hsla=[s,n,a,c]}else if(e.startsWith("rgb")){var l=e.match(/([\-\d\.e]+)/g).map(Number),h=Qp(l,4),d=h[0],u=h[1],f=h[2],p=h[3];void 0===p&&(p=1),o.rgba=[d,u,f,p]}else e.startsWith("#")?o.rgba=t.hexToRgb(e):o.rgba=t.nameToRgb(e)||t.hexToRgb(e)}(n.toLowerCase())}else this.rgba=[e,i,r,void 0===s?1:s]}return qp(t,[{key:"printRGB",value:function(t){var e=(t?this.rgba:this.rgba.slice(0,3)).map(function(t,e){return Wp(t,3===e?3:0)});return t?"rgba("+e+")":"rgb("+e+")"}},{key:"printHSL",value:function(t){var e=[360,100,100,1],i=["","%","%",""],r=(t?this.hsla:this.hsla.slice(0,3)).map(function(t,r){return Wp(t*e[r],3===r?3:1)+i[r]});return t?"hsla("+r+")":"hsl("+r+")"}},{key:"printHex",value:function(t){var e=this.hex;return t?e:e.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=t.hslToRgb(this._hsla)},set:function(t){3===t.length&&(t[3]=1),this._rgba=t,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=t.rgbToHsl(this._rgba)},set:function(t){3===t.length&&(t[3]=1),this._hsla=t,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){return"#"+this.rgba.map(function(t,e){return e<3?t.toString(16):Math.round(255*t).toString(16)}).map(function(t){return t.padStart(2,"0")}).join("")},set:function(e){this.rgba=t.hexToRgb(e)}}],[{key:"hexToRgb",value:function(t){var e=(t.startsWith("#")?t.slice(1):t).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!e.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+t);var i=e.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map(function(t){return parseInt(t,16)});return i[3]=i[3]/255,i}},{key:"nameToRgb",value:function(e){var i=e.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),r=Gp[i];return void 0===r?r:t.hexToRgb(r.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(t){var e=Qp(t,4),i=e[0],r=e[1],s=e[2],o=e[3];i/=255,r/=255,s/=255;var n=Math.max(i,r,s),a=Math.min(i,r,s),c=void 0,l=void 0,h=(n+a)/2;if(n===a)c=l=0;else{var d=n-a;switch(l=h>.5?d/(2-n-a):d/(n+a),n){case i:c=(r-s)/d+(r<s?6:0);break;case r:c=(s-i)/d+2;break;case s:c=(i-r)/d+4}c/=6}return[c,l,h,o]}},{key:"hslToRgb",value:function(t){var e=Qp(t,4),i=e[0],r=e[1],s=e[2],o=e[3],n=void 0,a=void 0,c=void 0;if(0===r)n=a=c=s;else{var l=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},h=s<.5?s*(1+r):s+r-s*r,d=2*s-h;n=l(d,h,i+1/3),a=l(d,h,i),c=l(d,h,i-1/3)}var u=[255*n,255*a,255*c].map(Math.round);return u[3]=o,u}}]),t}(),$p=function(){function t(){Vp(this,t),this._events=[]}return qp(t,[{key:"add",value:function(t,e,i){t.addEventListener(e,i,!1),this._events.push({target:t,type:e,handler:i})}},{key:"remove",value:function(e,i,r){this._events=this._events.filter(function(s){var o=!0;return e&&e!==s.target&&(o=!1),i&&i!==s.type&&(o=!1),r&&r!==s.handler&&(o=!1),o&&t._doRemove(s.target,s.type,s.handler),!o})}},{key:"destroy",value:function(){this._events.forEach(function(e){return t._doRemove(e.target,e.type,e.handler)}),this._events=[]}}],[{key:"_doRemove",value:function(t,e,i){t.removeEventListener(e,i,!1)}}]),t}();function Kp(t,e,i){var r=!1;function s(t,e,i){return Math.max(e,Math.min(t,i))}function o(t,o,n){if(n&&(r=!0),r){t.preventDefault();var a=e.getBoundingClientRect(),c=a.width,l=a.height,h=o.clientX,d=o.clientY,u=s(h-a.left,0,c),f=s(d-a.top,0,l);i(u/c,f/l)}}function n(t,e){1===(void 0===t.buttons?t.which:t.buttons)?o(t,t,e):r=!1}function a(t,e){1===t.touches.length?o(t,t.touches[0],e):r=!1}t.add(e,"mousedown",function(t){n(t,!0)}),t.add(e,"touchstart",function(t){a(t,!0)}),t.add(window,"mousemove",n),t.add(e,"touchmove",a),t.add(window,"mouseup",function(t){r=!1}),t.add(e,"touchend",function(t){r=!1}),t.add(e,"touchcancel",function(t){r=!1})}var Zp="keydown",Yp="mousedown",Xp="focusin";function Jp(t,e){return(e||document).querySelector(t)}function tg(t){t.preventDefault(),t.stopPropagation()}function eg(t,e,i,r,s){t.add(e,Zp,function(t){i.indexOf(t.key)>=0&&(s&&tg(t),r(t))})}var ig=function(){function t(e){Vp(this,t),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new $p,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(e)}return qp(t,[{key:"setOptions",value:function(t){var e=this;if(t){var i=this.settings;if(t instanceof HTMLElement)i.parent=t;else{i.parent&&t.parent&&i.parent!==t.parent&&(this._events.remove(i.parent),this._popupInited=!1),function(t,e,i){for(var r in t)i&&i.indexOf(r)>=0||(e[r]=t[r])}(t,i),t.onChange&&(this.onChange=t.onChange),t.onDone&&(this.onDone=t.onDone),t.onOpen&&(this.onOpen=t.onOpen),t.onClose&&(this.onClose=t.onClose);var r=t.color||t.colour;r&&this._setColor(r)}var s=i.parent;if(s&&i.popup&&!this._popupInited){var o=function(t){return e.openHandler(t)};this._events.add(s,"click",o),eg(this._events,s,[" ","Spacebar","Enter"],o),this._popupInited=!0}else t.parent&&!i.popup&&this.show()}}},{key:"openHandler",value:function(t){if(this.show()){t&&t.preventDefault(),this.settings.parent.style.pointerEvents="none";var e=t&&t.type===Zp?this._domEdit:this.domElement;setTimeout(function(){return e.focus()},100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(t){var e=t&&t.type,i=!1;if(t)if(e===Yp||e===Xp){var r=(this.__containedEvent||0)+100;t.timeStamp>r&&(i=!0)}else tg(t),i=!0;else i=!0;i&&this.hide()&&(this.settings.parent.style.pointerEvents="",e!==Yp&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(t,e){this.closeHandler(),this.setOptions(t),e&&this.openHandler()}},{key:"setColor",value:function(t,e){this._setColor(t,{silent:e})}},{key:"_setColor",value:function(t,e){if("string"==typeof t&&(t=t.trim()),t){e=e||{};var i=void 0;try{i=new jp(t)}catch(t){if(e.failSilently)return;throw t}if(!this.settings.alpha){var r=i.hsla;r[3]=1,i.hsla=r}this.colour=this.color=i,this._setHSLA(null,null,null,null,e)}}},{key:"setColour",value:function(t,e){this.setColor(t,e)}},{key:"show",value:function(){if(!this.settings.parent)return!1;if(this.domElement){var t=this._toggleDOM(!0);return this._setPosition(),t}var e=function(t){var e=document.createElement("div");return e.innerHTML=t,e.firstElementChild}(this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>');return this.domElement=e,this._domH=Jp(".picker_hue",e),this._domSL=Jp(".picker_sl",e),this._domA=Jp(".picker_alpha",e),this._domEdit=Jp(".picker_editor input",e),this._domSample=Jp(".picker_sample",e),this._domOkay=Jp(".picker_done button",e),this._domCancel=Jp(".picker_cancel button",e),e.classList.add("layout_"+this.settings.layout),this.settings.alpha||e.classList.add("no_alpha"),this.settings.editor||e.classList.add("no_editor"),this.settings.cancelButton||e.classList.add("no_cancel"),this._ifPopup(function(){return e.classList.add("popup")}),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var t=this,e=this,i=this.domElement,r=this._events;function s(t,e,i){r.add(t,e,i)}s(i,"click",function(t){return t.preventDefault()}),Kp(r,this._domH,function(t,i){return e._setHSLA(t)}),Kp(r,this._domSL,function(t,i){return e._setHSLA(null,t,1-i)}),this.settings.alpha&&Kp(r,this._domA,function(t,i){return e._setHSLA(null,null,null,1-i)});var o=this._domEdit;s(o,"input",function(t){e._setColor(this.value,{fromEditor:!0,failSilently:!0})}),s(o,"focus",function(t){var e=this;e.selectionStart===e.selectionEnd&&e.select()}),this._ifPopup(function(){var e=function(e){return t.closeHandler(e)};s(window,Yp,e),s(window,Xp,e),eg(r,i,["Esc","Escape"],e);var o=function(e){t.__containedEvent=e.timeStamp};s(i,Yp,o),s(i,Xp,o),s(t._domCancel,"click",e)});var n=function(e){t._ifPopup(function(){return t.closeHandler(e)}),t.onDone&&t.onDone(t.colour)};s(this._domOkay,"click",n),eg(r,i,["Enter"],n)}},{key:"_setPosition",value:function(){var t=this.settings.parent,e=this.domElement;t!==e.parentNode&&t.appendChild(e),this._ifPopup(function(i){"static"===getComputedStyle(t).position&&(t.style.position="relative");var r=!0===i?"popup_right":"popup_"+i;["popup_top","popup_bottom","popup_left","popup_right"].forEach(function(t){t===r?e.classList.add(t):e.classList.remove(t)}),e.classList.add(r)})}},{key:"_setHSLA",value:function(t,e,i,r,s){s=s||{};var o=this.colour,n=o.hsla;[t,e,i,r].forEach(function(t,e){(t||0===t)&&(n[e]=t)}),o.hsla=n,this._updateUI(s),this.onChange&&!s.silent&&this.onChange(o)}},{key:"_updateUI",value:function(t){if(this.domElement){t=t||{};var e=this.colour,i=e.hsla,r="hsl("+360*i[0]+", 100%, 50%)",s=e.hslString,o=e.hslaString,n=this._domH,a=this._domSL,c=this._domA,l=Jp(".picker_selector",n),h=Jp(".picker_selector",a),d=Jp(".picker_selector",c);b(0,l,i[0]),this._domSL.style.backgroundColor=this._domH.style.color=r,b(0,h,i[1]),F(0,h,1-i[2]),a.style.color=s,F(0,d,1-i[3]);var u=s,f=u.replace("hsl","hsla").replace(")",", 0)"),p="linear-gradient("+[u,f]+")";if(this._domA.style.background=p+", linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em",!t.fromEditor){var g=this.settings.editorFormat,m=this.settings.alpha,w=void 0;switch(g){case"rgb":w=e.printRGB(m);break;case"hsl":w=e.printHSL(m);break;default:w=e.printHex(m)}this._domEdit.value=w}this._domSample.style.color=o}function b(t,e,i){e.style.left=100*i+"%"}function F(t,e,i){e.style.top=100*i+"%"}}},{key:"_ifPopup",value:function(t,e){this.settings.parent&&this.settings.popup?t&&t(this.settings.popup):e&&e()}},{key:"_toggleDOM",value:function(t){var e=this.domElement;if(!e)return!1;var i=t?"":"none",r=e.style.display!==i;return r&&(e.style.display=i),r}}]),t}(),rg=document.createElement("style");function sg(t){if(og[t])return og[t];if(og["chr"+t]){const e=og["chr"+t];return og[t]=e,e}{const s=(e=Math.round(255*Math.random()).toString(10),i=Math.round(255*Math.random()).toString(10),r=Math.round(255*Math.random()).toString(10),"rgb("+e+","+i+","+r+")");return og[t]=s,s}var e,i,r}rg.textContent='.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}',document.documentElement.firstElementChild.appendChild(rg),ig.StyleElement=rg;const og={chrX:"rgb(204, 153, 0)",chrY:"rgb(153, 204, 0",chrUn:"rgb(50, 50, 50)",chr1:"rgb(80, 80, 255)",chrI:"rgb(139, 155, 187)",chr2:"rgb(206, 61, 50)",chrII:"rgb(206, 61, 50)",chr2a:"rgb(216, 71, 60)",chr2b:"rgb(226, 81, 70)",chr3:"rgb(116, 155, 88)",chrIII:"rgb(116, 155, 88)",chr4:"rgb(240, 230, 133)",chrIV:"rgb(240, 230, 133)",chr5:"rgb(70, 105, 131)",chr6:"rgb(186, 99, 56)",chr7:"rgb(93, 177, 221)",chr8:"rgb(128, 34, 104)",chr9:"rgb(107, 215, 107)",chr10:"rgb(213, 149, 167)",chr11:"rgb(146, 72, 34)",chr12:"rgb(131, 123, 141)",chr13:"rgb(199, 81, 39)",chr14:"rgb(213, 143, 92)",chr15:"rgb(122, 101, 165)",chr16:"rgb(228, 175, 105)",chr17:"rgb(59, 27, 83)",chr18:"rgb(205, 222, 183)",chr19:"rgb(97, 42, 121)",chr20:"rgb(174, 31, 99)",chr21:"rgb(231, 199, 111)",chr22:"rgb(90, 101, 94)",chr23:"rgb(204, 153, 0)",chr24:"rgb(153, 204, 0)",chr25:"rgb(51, 204, 0)",chr26:"rgb(0, 204, 51)",chr27:"rgb(0, 204, 153)",chr28:"rgb(0, 153, 204)",chr29:"rgb(10, 71, 255)",chr30:"rgb(71, 117, 255)",chr31:"rgb(255, 194, 10)",chr32:"rgb(255, 209, 71)",chr33:"rgb(153, 0, 51)",chr34:"rgb(153, 26, 0)",chr35:"rgb(153, 102, 0)",chr36:"rgb(128, 153, 0)",chr37:"rgb(51, 153, 0)",chr38:"rgb(0, 153, 26)",chr39:"rgb(0, 153, 102)",chr40:"rgb(0, 128, 153)",chr41:"rgb(0, 51, 153)",chr42:"rgb(26, 0, 153)",chr43:"rgb(102, 0, 153)",chr44:"rgb(153, 0, 128)",chr45:"rgb(214, 0, 71)",chr46:"rgb(255, 20, 99)",chr47:"rgb(0, 214, 143)",chr48:"rgb(20, 255, 177)"};class ng{constructor(t){this.tracks=[],this.chordSets=[]}addChordSet(t){this.chordSets=this.chordSets.filter(e=>e.name!==t.name),this.chordSets.push(t);let e=this.tracks.find(e=>t.trackName===e.name);e&&(e.chordSets=e.chordSets.filter(e=>e.name!==t.name),e.chordSets.push(t)),e||(e=new ag(t),this.tracks.push(e))}clearChords(){this.tracks=[],this.chordSets=[]}getTrack(t){return this.tracks.find(e=>t===e.name)}getChordSet(t){return this.chordSets.find(e=>t===e.name)}}class ag{constructor(t){this.name=t.trackName,this.color=t.trackColor,this.visible=!0,this.chordSets=[t],this.id=("0000"+(Math.random()*Math.pow(36,4)|0).toString(36)).slice(-4)}get chords(){if(1===this.chordSets.length)return this.chordSets[0].chords;const t=[];for(let e of this.chordSets)for(let i of e.chords)t.push(i);return t}}const cg=Math.exp(5);class lg{static isInstalled(){return void 0!==window.JBrowseReactCircularGenomeView&&void 0!==window.React&&void 0!==window.ReactDOM}constructor(t,e){if(e=e||{},this.config=e,lg.isInstalled()){this.parent=t,this.groupByTrack=!0===e.groupByTrack,this.chordManager=new ng(e);const i=document.createElement("div");i.className="igv-circview-container",t.appendChild(i),this.createControls(i),this.resetControlPanel();const r=document.createElement("div");r.className="igv-circview-circular-genome-view",i.appendChild(r),this.container=r,e.assembly&&this.setAssembly(e.assembly),this.width=e.width||500,this.height=e.height||500,this.setSize(this.width,this.height)}else console.error("JBrowse circular view is not installed")}createControls(t){const e=document.createElement("div");e.className="igv-circview-toolbar",t.appendChild(e),this.toolbar=e;const i=document.createElement("div");i.className="igv-circview-track-panel",t.appendChild(i),this.controlPanel=i,this.controlPanel.style.display="none";const r=document.createElement("div");r.className="igv-circview-toolbar-button-container",this.toolbar.appendChild(r),this.showControlsButton=document.createElement("div"),this.showControlsButton.className="igv-circview-button",r.appendChild(this.showControlsButton),this.showControlsButton.innerText="none"===this.controlPanel.style.display?"Show Controls":"Hide Controls",this.showControlsButton.addEventListener("click",t=>{this.controlPanel.querySelectorAll("div").length>0&&("none"===this.controlPanel.style.display?(this.controlPanel.style.display="flex",t.target.innerText="Hide Controls"):(this.controlPanel.style.display="none",t.target.innerText="Show Controls"))});let s=document.createElement("div");s.className="igv-circview-button",r.appendChild(s),s.innerText="Clear All",s.addEventListener("click",()=>{this.clearChords()}),!1!==this.config.showCloseButton&&(s=document.createElement("div"),s.className="igv-circview-button",r.appendChild(s),s.innerText="Close",s.addEventListener("click",()=>{this.visible=!1}))}resetControlPanel(){this.controlPanel.innerHTML="",this.controlPanel.appendChild(this.createGroupByCB());const t=this.groupByTrack?this.chordManager.tracks:this.chordManager.chordSets;for(let e of t)this.addToControlPanel(e)}createGroupByCB(){const t=document.createElement("input");t.type="checkbox",t.id="groupByCB",t.style.width="1.4em",t.style.height="1.4em",t.checked=this.groupByTrack,t.onclick=t=>{this.groupByTrack=t.target.checked,this.resetControlPanel(),this.render()};const e=document.createElement("label");e.for="groupByCB",e.innerText="Group by track",e.style.color="black",e.style.paddingLeft="10px";const i=document.createElement("div");return i.style.width="100%",i.style.paddingTop="5px",i.style.paddingBottom="5px",i.style.background="rgb(216, 230, 234)",i.appendChild(t),i.appendChild(e),i}addToControlPanel(t){const e=document.createElement("div");this.controlPanel.appendChild(e);const i=document.createElement("div");i.className="igv-circview-button",e.appendChild(i),i.innerText=!0===t.visible?"Hide":"Show",i.addEventListener("click",e=>{!0===t.visible?(this.hideChordSet(t.name),e.target.innerText="Show"):(this.showChordSet(t.name),e.target.innerText="Hide")});const r=document.createElement("input"),s=t=>200*Math.log(t*cg),o=document.createElement("div");o.className="igv-circview-button",o.innerHTML=" ",e.appendChild(o),o.style.backgroundColor=hg(t.color,1);const n={parent:o,popup:"right",editorFormat:"rgb",color:t.color,onChange:({rgbaString:e})=>{o.style.backgroundColor=hg(e,1),this.setColor(t.name,e),r.value=s(dg(t.color))}},a=new ig(n);r.setAttribute("title","Adjust transparency of arcs"),r.type="range",r.style.width="100px",r.style.marginRight="10px",r.setAttribute("class","range"),r.setAttribute("min","0"),r.setAttribute("max","1000"),r.value=s(dg(t.color)),r.oninput=()=>{const e=(i=r.value,Math.exp(i/200)/cg);var i;this.setColor(t.name,hg(t.color,e)),a.setColor(t.color)},e.appendChild(r);const c=document.createElement("div");c.style.color="black",e.appendChild(c),c.innerText=c.title=t.name}setAssembly(t){const e=this.genomeId||pg();if(this.genomeId===e)return;this.chordManager.clearChords(),this.genomeId=e,this.chrNames=new Set(t.chromosomes.map(t=>ug(t.name)));const i=[],r=[];for(let e of t.chromosomes){const t=ug(e.name);r.push(e.color||sg(t)),i.push({refName:t,uniqueId:t,start:0,end:e.bpLength})}this.assembly={name:t.name,sequence:{trackId:e,type:"ReferenceSequenceTrack",adapter:{type:"FromConfigSequenceAdapter",features:i}},refNameColors:r},this.render()}addChords(t,e={}){const i=e.name||e.track||"*",r=i.split(" ")[0].replaceAll("%20"," "),s={name:i.replaceAll("%20"," "),trackName:r,chords:t,color:e.color||"black",trackColor:e.trackColor||e.color||"black",visible:!0,id:e.id||pg()};this.chordManager.addChordSet(s),this.resetControlPanel(),this.render()}setSize(t,e){if(e=e||t,this.width=t,this.height=e,this.viewState){const i=this.viewState.session.view;i.setWidth(t),i.setHeight(e),i.setBpPerPx(i.minBpPerPx)}}getSize(){return Math.min(this.width,this.height)}clearChords(){this.chordManager.clearChords(),this.resetControlPanel(),this.render()}clearSelection(){this.viewState.pluginManager.rootModel.session.clearSelection()}show(){this.parent.style.display="block"}hide(){this.parent.style.display="none"}get visible(){return"none"!==this.parent.style.display}set visible(t){this.parent.style.display=t?"block":"none"}hideChordSet(t){let e=this.getChordSet(t);e?(e.visible=!1,this.render()):console.warn(`No track with name: ${name}`)}showChordSet(t){let e=this.getChordSet(t);e?(e.visible=!0,this.render()):console.warn(`No track with name: ${t}`)}deleteTrack(t){let e=this.tracks.findIndex(e=>t===e.name);e>=0&&this.tracks.splice(e,1),this.render()}getChordSet(t){return this.groupByTrack?this.chordManager.getTrack(t):this.chordManager.getChordSet(t)}setColor(t,e){const i=this.getChordSet(t);if(i){i.color=e;const t=i.id;for(let i of this.viewState.config.tracks)if(t===i.trackId){i.displays[0].renderer.strokeColor.set(e);break}}}render(){const{createViewState:t,JBrowseCircularGenomeView:e}=JBrowseReactCircularGenomeView;ReactDOM.unmountComponentAtNode(this.container);const i=(this.groupByTrack?this.chordManager.tracks:this.chordManager.chordSets).filter(t=>t.visible),r=[],s=[];for(let t of i)r.push({trackId:t.id,name:t.name,assemblyNames:["forIGV"],type:"VariantTrack",adapter:{type:"FromConfigAdapter",features:t.chords}}),s.push(t.color);this.viewState=t({assembly:this.assembly,tracks:r});for(let t=0;t<i.length;t++)this.viewState.config.tracks[t].displays[0].renderer.strokeColor.set(s[t]);this.element=React.createElement(e,{viewState:this.viewState}),this.setSize(this.width,this.height),ReactDOM.render(this.element,this.container);const o=this.config.onChordClick||fg;for(let t=0;t<i.length;t++)this.viewState.session.view.showTrack(this.viewState.config.tracks[t].trackId),o&&(this.viewState.pluginManager.jexl.addFunction("onChordClick",o),this.viewState.config.tracks[t].displays[0].onChordClick.set("jexl:onChordClick(feature, track, pluginManager)"))}}function hg(t,e){const[i,r,s,o]=t.split(",");return`${i},${r},${s},${e})`}function dg(t){return t.startsWith("rgba(")?Number(t.split(",")[3].replace(")","")):1}function ug(t){return t.startsWith("chr")?t.substring(3):t}function fg(t,e,i){console.log(t)}function pg(){return("0000"+(Math.random()*Math.pow(36,4)|0).toString(36)).slice(-4)}if("undefined"!=typeof document){function JA(t){for(let e of document.styleSheets)if(e=e.href?e.href.replace(/^.*[\\\/]/,""):"",e===t)return!0;return!1}JA("circular-view.css")||function(){const t=document.createElement("style");t.setAttribute("type","text/css"),t.innerHTML='.igv-circview-container {\n width: fit-content;\n height: fit-content;\n box-sizing: content-box;\n color: dimgray;\n font-family: "Open Sans", sans-serif;\n font-size: 12px;\n background-color: white;\n border-color: dimgray;\n border-style: solid;\n border-width: thin;\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n justify-content: flex-start;\n align-items: flex-start;\n}\n\n.igv-circview-toolbar {\n position: relative;\n width: 100%;\n height: 32px;\n background-color: lightgrey;\n border-bottom-style: solid;\n border-bottom-color: dimgray;\n border-bottom-width: thin;\n display: flex;\n flex-flow: row;\n flex-wrap: nowrap;\n justify-content: space-between;\n align-items: center;\n}\n\n.igv-circview-toolbar-button-container {\n height: 100%;\n width: fit-content;\n display: flex;\n flex-flow: row;\n flex-wrap: nowrap;\n justify-content: flex-start;\n align-items: center;\n}\n.igv-circview-toolbar-button-container > div {\n margin: 4px;\n}\n\n.igv-circview-track-panel {\n z-index: 1024;\n position: absolute;\n top: 33px;\n left: 0;\n width: 100%;\n height: fit-content;\n border-bottom-style: solid;\n border-bottom-color: dimgray;\n border-bottom-width: thin;\n background-color: white;\n display: flex;\n flex-flow: column;\n flex-wrap: nowrap;\n justify-content: flex-start;\n align-items: flex-start;\n}\n.igv-circview-track-panel > div {\n display: flex;\n flex-flow: row;\n flex-wrap: nowrap;\n justify-content: flex-start;\n align-items: center;\n}\n.igv-circview-track-panel > div > div {\n margin: 4px;\n}\n\n.igv-circview-swatch-button {\n cursor: pointer;\n padding: 5px;\n width: 8px;\n height: 8px;\n border: 1px solid #8d8b8b;\n border-radius: 16px;\n}\n\n.igv-circview-button {\n cursor: pointer;\n padding: 5px;\n color: #444;\n vertical-align: middle;\n text-align: center;\n font-family: "Open Sans", sans-serif;\n font-size: 12px;\n border: 1px solid #8d8b8b;\n border-radius: 4px;\n background: #efefef;\n box-shadow: 0 0 5px -1px rgba(0, 0, 0, 0.2);\n}\n\n.igv-circview-button:hover {\n background: #efefef;\n box-shadow: 0 0 5px -1px rgba(0, 0, 0, 0.6);\n}\n\n.igv-circview-button:active {\n color: #007bff;\n box-shadow: 0 0 5px -1px rgba(0, 0, 0, 0.6);\n}\n\n/*# sourceMappingURL=circular-view.css.map */\n',document.head.insertBefore(t,document.head.childNodes[document.head.childNodes.length-1])}()}const gg=t=>t.startsWith("chr")?t.substring(3):t;function mg(t){const e=[];if(t.wgChromosomeNames)for(let i of t.wgChromosomeNames){const r=t.getChromosome(i);r&&e.push({name:r.name,bpLength:r.bpLength})}return e}function wg(t,e,i,r){const s=e.color||"rgb(0,0,255)",o=ur.addAlpha("all"===i.chr?s:tu(i.chr),r),n=ur.addAlpha(s,r),a=(e.name||"").replace(/ /g,"%20"),c="all"===i.chr?a:`${a} ${i.chr}:${i.start}-${i.end}`;e.browser.circularView.addChords(t,{track:c,color:o,trackColor:n}),e.browser.circularViewVisible||(e.browser.circularViewVisible=!0)}class bg{constructor(t,{minTLENPercentile:e,maxTLENPercentile:i}){this.totalCount=0,this.frCount=0,this.rfCount=0,this.ffCount=0,this.sumF=0,this.sumF2=0,this.lp=void 0===e?.1:e,this.up=void 0===i?99.5:i,this.isizes=[],this.compute(t)}compute(t){for(let e of t)if(e.isProperPair()){const t=Math.abs(e.fragmentLength);this.sumF+=t,this.sumF2+=t*t,this.isizes.push(t);const i=e.pairOrientation;if("string"==typeof i&&4===i.length){switch(""+i.charAt(0)+i.charAt(2)){case"FF":case"RR":this.ffCount++;break;case"FR":this.frCount++;break;case"RF":this.rfCount++}}this.totalCount++}this.ffCount/this.totalCount>.9?this.orienation="ff":this.frCount/this.totalCount>.9?this.orienation="fr":this.rfCount/this.totalCount>.9&&(this.orienation="rf"),this.minTLEN=0===this.lp?0:Fg(this.isizes,this.lp),this.maxTLEN=Fg(this.isizes,this.up)}}function Fg(t,e){if(0===t.length)return;const i=Math.floor(t.length*(e/100));return t.sort(function(t,e){return t-e}),t[i]}const vg="rgb(255,0,255)",yg="rgb(0,0,255)",Ag="rgb(132, 178, 158)",Cg=new Map;Cg.set("m","rgb(255,0,0)"),Cg.set("h",vg),Cg.set("o","rgb(111, 78, 129)"),Cg.set("f","rgb(246, 200, 95)"),Cg.set("c","rgb(157, 216, 102)"),Cg.set("g","rgb(255, 160, 86)"),Cg.set("e","rgb(141, 221, 208)"),Cg.set("b","rgb(202, 71, 47)"),Cg.set("h",vg),Cg.set("a","rgb(51,0,111)"),Cg.set("NONE_A",yg),Cg.set("NONE_C",yg),Cg.set("NONE_T",yg),Cg.set("NONE_G",yg),Cg.set("NONE_N",yg);const _g=new Map;function xg(t,e,i){let r=function(t){return Cg.has(t)?Cg.get(t):Ag}(t),s=yf(e);if(s>255)return r;const o=t+s+i;if(s<0&&(s=0),!_g.has(o)){const t="basemod2"===i?Math.max(20,Math.min(255,s*s/50-4*s+200+20)):Math.max(20,Math.min(255,.006127*s*s)),[e,n,a]=ur.rgbComponents(r);_g.set(o,`rgba(${e},${n},${a},${t/255})`)}return _g.get(o)}class kg{constructor(t){}updateContext(t){this.context=t}drawModifications(t,e,i,r,s,o){const{ctx:n,pixelEnd:a,bpStart:c,bpPerPixel:l}=r,h=t.getBaseModificationSets();if(h){let r;const d=s.split(":");2==d.length&&(s=d[0],r=d[1]);for(let d of t.blocks){if("S"===d.type)continue;const t=e,u=i;let f=Math.max(1,1/l);for(let e=d.seqOffset;e<d.seqOffset+d.len;e++){let i=(d.start+(e-d.seqOffset)-c)/l;if(i>a)break;if(i+f<0)continue;let p,g=-1,m=255,w=0;for(let t of h)if((!r||t.modification===r)&&t.containsPosition(e)){const i=yf(t.likelihoods.get(e));m-=i,(!p||i>g)&&(p=t.modification,w=t.canonicalBase,g=i)}if(p){const e=255*o;let r;m>g&&"basemod2"===s&&m>=e?r=xg("NONE_"+w,m,s):g>=e&&(r=xg(p,g,s)),n.fillStyle=r,f<3&&(f=3,i--),n.fillRect(i,t,f,Math.max(1,u-2))}}}}}}const Ig=new Set(["firstOfPairStrand"]);class Sg extends lc{constructor(t,e){super(t,e),this._colorTables=new Map,this._baseModifications=new Set,(t.colorTable||t.tagColorTable)&&(this.colorTable=new Gr(t.tagColorTable)),t.showTags&&t.hideTags&&console.warn("Both showTags and hideTags specified. showTags will be used."),t.showTags?(this.showTags=new Set(t.showTags),this.hiddenTags=new Set):this.hiddenTags=new Set(t.hideTags||["SA","MD"]),t.largeFragmentLengthColor&&(this.largeTLENColor=t.largeFragmentLengthColor),t.pairOrienation&&(this.expectedPairOrientation=t.pairOrientation),t.smallFragmentLengthColor&&(this.smallTLENColor=t.smallFragmentLengthColor),t.largeFragmentLengthColor&&(this.largeTLENColor=t.largeFragmentLengthColor),t.minFragmentLength&&(this.minTLEN=t.minFragmentLength),t.maxFragmentLength&&(this.maxTLEN=t.maxFragmentLength),t.displayMode&&(this.displayMode=t.displayMode.toUpperCase()),t.colorBy&&t.colorByTag&&(this.colorBy=t.colorBy+":"+t.colorByTag),this.featureSource=this.parent.featureSource,this.top=0===t.coverageTrackHeight?0:t.coverageTrackHeight+5,this.pairColors={RL:this.rlColor,RR:this.rrColor,LL:this.llColor},t.highlightedReads&&this.setHighlightedReads(t.highlightedReads,void 0),this.hasPairs=!1,this.hasSupplemental=!1,this._groupByTags=[],this._groupByPositions=[],this._groupByInsertionPositions=[],t.groupBy&&(this.groupBy=t.groupBy,t.groupBy.startsWith("base:")?this._groupByPositions.push(t.groupBy.substring(5)):t.groupBy.startsWith("insertion:")?this._groupByInsertionPositions.push(t.groupBy.substring(5)):t.groupBy.startsWith("tag:")&&this._groupByTags.push(t.groupBy.substring(4))),this._locusChange=Ng.bind(this),this.browser.on("locuschange",this._locusChange)}init(t){this.parent=t.parent,delete t.parent,super.init(t)}dispose(){this.browser.off("locuschange",this._locusChange)}get baseModRenderer(){return this._baseModRenderer||(this._baseModRenderer=new kg(this)),this._baseModRenderer}get baseModificationThreshold(){return this.parent.baseModificationThreshold}setTop(t,e){this.top=0===t.height||!1===e?0:5+t.height}setHighlightedReads(t,e){if(!Array.isArray(t)||!t.every(t=>"string"==typeof t))throw new Error("AlignmentTrack.setHighlightedReads() only accept array of strings");e&&(this.highlightColor=e),this.highlightedReads=new Set(t)}computePixelHeight(t){if(t.packedGroups){let e=t.hasDownsampledIntervals()?15:0;const i="SQUISHED"===this.displayMode?this.squishedRowHeight:this.alignmentRowHeight;for(let r of t.packedGroups.values())e+=i*r.length+10;return e+5}return 0}draw(t){var e;const i=t.features,r=t.context,s=t.bpPerPixel,o=t.bpStart,n=t.pixelWidth,a=o+n*s+1,c=this.showSoftClips,l=this.showAllBases,h=this.browser.nucleotideColors;r.save();for(let t of i.baseModificationKeys)this._baseModifications.add(t.modification);let d=i.sequence;d&&(d=d.toUpperCase());let u=0;this.colorBy||(this.colorBy=this.hasPairs?"unexpectedPair":"none");let f=t.pixelTop-this.parent.coverageTrackHeight;this.top&&r.translate(0,this.top);const p=f+t.pixelHeight;i.hasDownsampledIntervals()?(u=15,i.downsampledIntervals.forEach(function(t){var e=(t.start-o)/s,i=(t.end-o)/s;i-e>5&&(e+=1,i-=1),go.fillRect(r,e,2,i-e,8,{fillStyle:"black"})})):u=0,this.alignmentsYOffset=u;const g="SQUISHED"===this.displayMode?this.squishedRowHeight:this.alignmentRowHeight,m=i.packedGroups;if(m){let i=u;for(let s of m.keys()){const c=m.get(s),l=c.rows,h=l.length;c.pixelTop=i;for(let t=0;t<h;t++){const e=l[t],r=g<=4?g:g-2;if(i>p)break;if(i+r<f)i+=g;else{for(let t of e.alignments)if(this.browser.circularView&&(this.hasSupplemental=this.hasSupplemental||t.hasTag("SA")),!(t.start+t.lengthOnRef<o)){if(t.start>a)break;!0!==t.hidden&&(t instanceof uf?(w.call(this,t,i,r),b.call(this,t.firstAlignment,i,r),t.secondAlignment&&b.call(this,t.secondAlignment,i,r)):b.call(this,t,i,r))}i+=g}}if(c.pixelBottom=i,this.groupBy&&s){r.save(),r.font="400 12px sans-serif";const o=r.measureText(s),a=o.width+10,l=-(null!==(e=t.pixelShift)&&void 0!==e?e:0)+t.viewportWidth-a-10,h=o.actualBoundingBoxAscent+o.actualBoundingBoxDescent+10,d=Math.min(c.pixelTop+h-1,c.pixelBottom);r.textAlign="center",r.fillStyle="white",r.strokeStyle="lightGray",go.roundRect(r,l,d-o.actualBoundingBoxAscent-5,a,h,2,!0,!0),r.fillStyle="black",r.fillText(s,l+a/2,d),go.dashedLine(r,0,i,n,i),r.restore(),i+=10}}}function w(t,e,i){var n,c=this.getConnectorColor(t.firstAlignment),l=(t.connectingStart-o)/s,h=(t.connectingEnd-o)/s,d=e+i/2;t.connectingEnd<o||t.connectingStart>a||((null!==(n=t.mq)&&void 0!==n?n:0)<=0&&(c=ur.addAlpha(c,.15)),go.setProperties(r,{fillStyle:c,strokeStyle:c}),go.strokeLine(r,l,d,h,d))}function b(t,e,u){var f;if(t.start+t.lengthOnRef<o||t.start>a)return;const p=c?t.blocks:t.blocks.filter(t=>"S"!==t.type);let m=this.getAlignmentColor(t);const w=m;(null!==(f=t.mq)&&void 0!==f?f:0)<=0&&(m=ur.addAlpha(m,.15)),go.setProperties(r,{fillStyle:m,strokeStyle:w});const b=[];for(let t=0;t<p.length;t++){const e=p[t];if(!(t!==p.length-1&&p[t+1].start<o)&&(b.push(...F.call(this,e,t)),e.start+e.len>a))break}if(t.gaps){const i=e+u/2;for(let n of t.gaps){const t=(n.start-o)/s,a=(n.start+n.len-o)/s,c=a-t,l=n.len.toString(),h=6*l.length,d=t+c/2,u="D"===n.type?this.deletionColor:this.skippedColor;if(go.strokeLine(r,t,i,a,i,{strokeStyle:u,lineWidth:2}),this.showDeletionText&&n.len>1&&c>=h+8){const t=d-h/2;go.fillRect(r,t-1,e-1,h+2,12,{fillStyle:"white"}),go.fillText(r,l,t,e+10,{font:"normal 10px monospace",fillStyle:this.deletionTextColor})}}}if(t.insertions&&this.showInsertions){let i=-1;for(let n of t.insertions){if(this.hideSmallIndels&&n.len<=this.indelSizeThreshold)continue;if(n.start<o)continue;if(n.start>a)break;const t=n.start-o,c=n.len.toString(),l=2+6*c.length,h=this.showInsertionText&&1!==n.len?Math.round(n.len/s):2,d=Math.max(Math.min(l,h),2),f=t/s-d/2;if(f-i>2){const t={fillStyle:this.insertionColor};go.fillRect(r,f-2,e,d+4,2,t),go.fillRect(r,f,e+2,d,u-4,t),go.fillRect(r,f-2,e+u-2,d+4,2,t),this.showInsertionText&&n.len>1&&h>l&&go.fillText(r,c,f+1,e+10,{font:"normal 10px monospace",fillStyle:this.insertionTextColor}),i=f}}}for(let{bbox:t,baseColor:e,readChar:i}of b){if(s<=.1&&t.height>=8){const s=Math.min(10,t.height);r.font=s+"px sans-serif";const o=t.x+t.width/2;go.strokeText(r,i,o-r.measureText(i).width/2,s-1+t.y,{strokeStyle:e})}else go.fillRect(r,t.x,t.y,t.width,t.height,{fillStyle:e})}if(this.colorBy&&this.colorBy.startsWith("basemod")){const i={ctx:r,bpPerPixel:s,bpStart:o,bpEnd:a,pixelEnd:n};this.baseModRenderer.drawModifications(t,e,u,i,this.colorBy,this.baseModificationThreshold)}function F(a,c){var f;const b=[],F=a.start-i.start,v=(a.start-o)/s,y=(a.start+a.len-o)/s,A=Math.max(1,y-v),C=100/s,_=Math.min(g/2,C/6),x="S"===a.type,k=(null!==(f=t.mq)&&void 0!==f?f:0)<=0||this.selectedReadName===t.readName||x||this.highlightedReads&&this.highlightedReads.has(t.readName);let I=w;this.selectedReadName===t.readName?I="red":x?I="rgb(50,50,50)":this.highlightedReads&&this.highlightedReads.has(t.readName)&&(I=this.highlightColor||"#00ff00");const S=!0===t.strand&&c===p.length-1,E=!1===t.strand&&0===c;if(S||E){let t,i;S?(t=[v,y,y+_,y,v,v],i=[e,e,e+u/2,e+u,e+u,e]):E&&(t=[y,v,v-_,v,y,y],i=[e,e,e+u/2,e+u,e+u,e]),go.fillPolygon(r,t,i,{fillStyle:m}),k&&go.strokePolygon(r,t,i,{strokeStyle:I})}else go.fillRect(r,v,e,A,u,{fillStyle:m}),k&&(r.save(),r.strokeStyle=I,r.strokeRect(v,e,A,u),r.restore());if(x||l||this.showMismatches&&d&&t.seq&&"*"!==t.seq){const i=t.seq?t.seq.toUpperCase():void 0,r=t.qual,c=a.seqOffset,f=Math.max(1,1/s);for(let t=0,p=a.len;t<p;t++){const p=(a.start+t-o)/s;if(p+f<0)continue;if(p>n)break;let g=i?i.charAt(c+t):"";const m=F+t>=0&&d?d.charAt(F+t):"";if("="===g&&(g=m),"X"===g||m!==g||x||l){let i=h[g]||"rgb(0,0,0)";if(!x&&Array.isArray(r)&&r.length>c+t){i=Eg(r[c+t],i)}b.push({bbox:{x:p,y:e,width:f,height:u},baseColor:i,readChar:g})}}}return b}}r.restore()}async popupData(t){const e=this.getClickedObject(t);if(e){if("chr"in e){let i;const r=t.viewport.cachedFeatures,s=null==r?void 0:r.coverageMap,o=null==s?void 0:s.refSeq;if(o){const e=Math.floor(t.genomicLocation);i=o.charAt(e-s.bpStart).toUpperCase()}return e.popupData(t.genomicLocation,this.hiddenTags,this.showTags,i,this.browser.genome)}return e.popupData(t.genomicLocation)}}menuItemList(){let e=[];e.push("<hr/>");let i=t('<div class="igv-track-menu-category">');i.innerText="Color by:",e.push({name:void 0,element:i,click:void 0,init:void 0});const r=[];r.push({key:"none",label:"none"}),r.push({key:"strand",label:"read strand"}),this.hasPairs&&(r.push({key:"firstOfPairStrand",label:"first-of-pair strand"}),r.push({key:"pairOrientation",label:"pair orientation"}),r.push({key:"tlen",label:"insert size (TLEN)"}),r.push({key:"unexpectedPair",label:"pair orientation & insert size (TLEN)"})),this.colorBy&&this.colorBy.startsWith("tag:")&&r.push({key:this.colorBy,label:this.colorBy}),r.push({key:"tag",label:"tag..."});for(let t of r){const i=void 0===this.colorBy&&"none"===t.key||this.colorBy===t.key;e.push(this.colorByCB(t,i))}const s=this._baseModifications.size;if(s>0){e.push('<hr style="border-top:1px dotted;border-bottom: none;">');let t=1===s?"base modification":"base modification (all)";if(e.push(this.basemodColorByCB({key:"basemod",label:t})),s>1)for(let t of this._baseModifications)e.push(this.basemodColorByCB({key:"basemod:"+t,label:`base modification (${Ff(t)})`}));if(e.push('<hr style="border-top:1px dotted;border-bottom: none;">'),t=1===s?"base modification 2-color":"base modification 2-color (all)",e.push(this.basemodColorByCB({key:"basemod2",label:t})),s>1)for(let t of this._baseModifications)e.push(this.basemodColorByCB({key:"basemod2:"+t,label:`base modification 2-color (${Ff(t)})`}))}e.push("<hr/>"),i=document.createElement("div"),i.className="igv-track-menu-category",i.textContent="Group by:",e.push({name:void 0,element:i,click:void 0,init:void 0});const o=[];o.push({key:"none",label:"none"}),o.push({key:"strand",label:"read strand"}),this.hasPairs&&(o.push({key:"firstOfPairStrand",label:"first-of-pair strand"}),o.push({key:"pairOrientation",label:"pair orientation"}),o.push({key:"mateChr",label:"chromosome of mate"})),o.push({key:"chimeric",label:"chimeric"}),o.push({key:"supplementary",label:"supplementary flag"}),o.push({key:"readOrder",label:"read order"});for(let t of this._groupByTags)o.push({key:`tag:${t}`,label:`tag:${t}`});for(let t of this._groupByPositions)o.push({key:`base:${t}`,label:`base:${t}`});for(let t of this._groupByInsertionPositions)o.push({key:`insertion:${t}`,label:`base:${t}`});o.push({key:"tag",label:"tag..."});for(let t of o){const i=void 0===this.groupBy&&"none"===t.key||this.groupBy===t.key;e.push(this.groupByCB(t,i))}e.push("<hr/>"),e.push({element:ic("Show all bases",this.showAllBases),click:function(){this.alignmentTrack.showAllBases=!this.alignmentTrack.showAllBases,this.trackView.repaintViews()}}),e.push({element:ic("Show mismatches",this.showMismatches),click:function(){this.alignmentTrack.showMismatches=!this.alignmentTrack.showMismatches,this.trackView.repaintViews()}}),e.push({element:ic("Show insertions",this.showInsertions),click:function(){this.alignmentTrack.showInsertions=!this.alignmentTrack.showInsertions,this.trackView.repaintViews()}}),e.push({element:ic("Show soft clips",this.showSoftClips),click:function(){this.alignmentTrack.showSoftClips=!this.alignmentTrack.showSoftClips;const t=this.getCachedAlignmentContainers();for(let e of t)e.pack(this);this.trackView.repaintViews()}}),this.hasPairs&&(e.push("<hr/>"),e.push({element:ic("View as pairs",this.viewAsPairs),click:function(){const t=!this.alignmentTrack.viewAsPairs;if(t&&this.groupBy&&!Ig.has(this.groupBy))return void this.browser.alert.present(`'View as Pairs' is incompatible with 'Group By ${this.groupBy}'`);this.alignmentTrack.viewAsPairs=t;const e=this.getCachedAlignmentContainers();for(let t of e)t.pack(this);this.trackView.checkContentHeight(),this.trackView.repaintViews()}})),this.browser.circularView&&(this.hasPairs||this.hasSupplemental)&&(e.push("<hr/>"),this.hasPairs&&e.push({label:"Add discordant pairs to circular view",click:function(){for(let t of this.trackView.viewports)this.addPairedChordsForViewport(t)}}),this.hasSupplemental&&e.push({label:"Add split reads to circular view",click:function(){for(let t of this.trackView.viewports)this.addSplitChordsForViewport(t)}})),e.push("<hr/>"),i=document.createElement("div"),i.className="igv-track-menu-category",i.textContent="Display mode:",e.push({name:void 0,element:i,click:void 0,init:void 0});for(let t of["EXPANDED","SQUISHED","FULL"])e.push({element:ic(t.toLowerCase(),this.displayMode===t),click:function(){this.alignmentTrack.setDisplayMode(t)}});return e}setDisplayMode(t){const e="FULL"===this.displayMode||"FULL"===t;if(this.displayMode=t,e){const t=this.getCachedAlignmentContainers();for(let e of t)e.pack(this)}this.trackView.checkContentHeight(),this.trackView.repaintViews()}colorByCB(t,e){const i=ic(t.label,e);if("tag"!==t.key){function r(){this.alignmentTrack.colorBy=t.key,this.trackView.repaintViews()}return{name:void 0,element:i,click:r,init:void 0}}{function s(t){const e=this.alignmentTrack.colorBy.startsWith("tag:")?this.alignmentTrack.colorBy.substring(4):"";this.browser.inputDialog.present({label:"Tag Name",value:e,callback:t=>{const e=this.alignmentTrack;t?(e.colorBy="tag:"+t,e.colorTable||(e.colorTable=new Qr("Set1"))):e.colorBy=void 0,this.trackView.repaintViews()}},t)}return{name:void 0,element:i,dialog:s,init:void 0}}}basemodColorByCB(t){const e=this.colorBy===t.key;return{name:void 0,element:ic(t.label,e),click:function(){this.alignmentTrack.colorBy=t.key,this.trackView.repaintViews()},init:void 0}}groupByCB(t,e){return{name:void 0,element:ic(t.label,e),dialog:function(e){const i=()=>this.alignmentTrack.repackAlignments();if("tag"===t.key){let t="";this.alignmentTrack.groupBy&&this.alignmentTrack.groupBy.startsWith("tag:")&&(t=this.alignmentTrack.groupBy.substring(4)),this.browser.inputDialog.present({label:"Tag Name",value:t,callback:t=>{t&&(this.alignmentTrack.groupBy="tag:"+t,this.alignmentTrack._groupByTags.push(t),i())}},e)}else"none"===t.key?this.alignmentTrack.groupBy=void 0:this.alignmentTrack.groupBy=t.key,i()},init:void 0}}repackAlignments(){const t=this.getCachedAlignmentContainers();for(let e of t)"function"==typeof e.pack&&e.pack(this);this.trackView.checkContentHeight(),this.trackView.repaintViews()}contextMenuItemList(t){const e=t.viewport,i=[],r=i=>{const r=this.sortObject,s=!r||r.position!==Math.floor(t.genomicLocation)||!r.direction,o={chr:e.referenceFrame.chr,position:Math.floor(t.genomicLocation),option:i,direction:s,sortAsPairs:e.trackView.track.viewAsPairs};this.sortObject=o,e.cachedFeatures.sortRows(o),e.repaint()};i.push("<b>Sort by...</b>"),i.push({label:" base",click:()=>r("BASE")}),i.push({label:" read strand",click:()=>r("strand")}),i.push({label:" start location",click:()=>r("START")}),i.push({label:" insert size",click:()=>r("INSERT_SIZE")}),i.push({label:" gap size",click:()=>r("GAP_SIZE")}),i.push({label:" chromosome of mate",click:()=>r("MATE_CHR")}),i.push({label:" mapping quality",click:()=>r("MQ")}),i.push({label:" read name",click:()=>r("READ_NAME")}),i.push({label:" aligned read length",click:()=>r("ALIGNED_READ_LENGTH")}),i.push({label:" tag",click:()=>{const i=this.sortObject,r=!i||i.position!==Math.floor(t.genomicLocation)||!i.direction,s={label:"Tag Name",value:this.sortByTag?this.sortByTag:"",callback:i=>{if(i){const s={chr:e.referenceFrame.chr,position:Math.floor(t.genomicLocation),option:"TAG",tag:i,direction:r};this.sortByTag=i,this.sortObject=s,e.cachedFeatures.sortRows(s),e.repaint()}}};this.browser.inputDialog.present(s,t.event)}}),i.push("<hr/>");const s=`${e.referenceFrame.chr}:${F(Math.floor(t.genomicLocation)+1)}`;i.push({label:`Group by base @${s}`,click:()=>{this._groupByPositions.push(s),this.groupBy=`base:${s}`;const t=this.getCachedAlignmentContainers();for(let e of t)e.pack(this);this.trackView.checkContentHeight(),this.trackView.repaintViews()}}),i.push({label:`Group by insertion @${s}`,click:()=>{this._groupByInsertionPositions.push(s),this.groupBy=`insertion:${s}`;const t=this.getCachedAlignmentContainers();for(let e of t)e.pack(this);this.trackView.checkContentHeight(),this.trackView.repaintViews()}}),i.push("<hr/>");const o=this.getClickedObject(t);if(o){const e=this.showSoftClips,r="alignmentContaining"in o&&"function"==typeof o.alignmentContaining?o.alignmentContaining(t.genomicLocation,e):o;if(r){r.isPaired()&&r.isMateMapped()&&i.push({label:"View mate in split screen",click:()=>{if(r.mate){const e=t.viewport.referenceFrame,i=this.browser.genome.getChromosome(r.mate.chr);if(i){this.selectedReadName=r.readName;const s=e.bpPerPixel*t.viewport.getWidth(),o=r.mate.position-s/2,n=r.mate.position+s/2;this.browser.addMultiLocusPanel(i.name,o,n,e)}else this.browser.alert.present(`Reference does not contain chromosome: ${r.mate.chr}`)}},init:void 0}),i.push("<hr/>");const e=r.softClippedBlocks();i.push({label:"View read sequence",click:()=>{const t=r.seq;this.browser.alert.present(t&&"*"!==t?t:"Read sequence: *")}}),e.left&&e.left.len>0&&i.push({label:"View left soft-clipped sequence",click:()=>{const t=r.seq.substring(e.left.seqOffset,e.left.seqOffset+e.left.len);this.browser.alert.present(t)}}),e.right&&e.right.len>0&&i.push({label:"View right soft-clipped sequence",click:()=>{const t=r.seq.substring(e.right.seqOffset,e.right.seqOffset+e.right.len);this.browser.alert.present(t)}}),i.push("<hr/>"),Jo()&&(i.push({label:"Copy read sequence",click:async()=>{try{await navigator.clipboard.writeText(r.seq)}catch(t){console.error(t),this.browser.alert.present(`error copying sequence to clipboard ${t}`)}}}),e.left&&e.left.len>0&&i.push({label:"Copy left soft-clipped sequence",click:async()=>{try{const t=r.seq.substring(e.left.seqOffset,e.left.seqOffset+e.left.len);await navigator.clipboard.writeText(t)}catch(t){console.error(t),this.browser.alert.present(`error copying sequence to clipboard ${t}`)}}}),e.right&&e.right.len>0&&i.push({label:"Copy right soft-clipped sequence",click:async()=>{try{const t=r.seq.substring(e.right.seqOffset,e.right.seqOffset+e.right.len);await navigator.clipboard.writeText(t)}catch(t){console.error(t),this.browser.alert.present(`error copying sequence to clipboard ${t}`)}}}));const s=r.seq;if(s&&"*"!==s){i.push("<hr/>"),s.length<Wh&&i.push({label:"BLAT visible sequence",click:()=>{const t=r.isNegativeStrand()?cn(s):s,e=`${r.readName} - blat`,i=`${this.name} - ${e}`;$h({sequence:t,browser:this.browser,name:e,title:i})}});const t=r.softClippedBlocks();t.left&&t.left.len>20&&t.left.len<Wh&&i.push({label:"BLAT left soft-clipped sequence",click:()=>{const e=s.substring(t.left.seqOffset,t.left.seqOffset+t.left.len),i=r.isNegativeStrand()?cn(e):e,o=`${r.readName} - blat left clip`,n=`${this.name} - ${o}`;$h({sequence:i,browser:this.browser,name:o,title:n})}}),t.right&&t.right.len>20&&t.right.len<Wh&&i.push({label:"BLAT right soft-clipped sequence",click:()=>{const e=s.substring(t.right.seqOffset,t.right.seqOffset+t.right.len),i=r.isNegativeStrand()?cn(e):e,o=`${r.readName} - blat right clip`,n=`${this.name} - ${o}`;$h({sequence:i,browser:this.browser,name:o,title:n})}})}i.push("<hr/>")}}return this.browser.circularView&&(this.hasPairs||this.hasSupplemental)&&(this.hasPairs&&i.push({label:"Add discordant pairs to circular view",click:()=>{this.addPairedChordsForViewport(e)}}),this.hasSupplemental&&i.push({label:"Add split reads to circular view",click:()=>{this.addSplitChordsForViewport(e)}}),i.push("<hr/>")),i}getClickedObject(t){let e=t.viewport.cachedFeatures;if(!e)return;const i=t.y-this.top,r=t.genomicLocation;if(e.packedGroups){let t=Number.MAX_VALUE;for(let s of e.packedGroups.values())if(t=Math.min(t,s.pixelTop),i>s.pixelTop&&i<=s.pixelBottom){const t="SQUISHED"===this.displayMode?this.squishedRowHeight:this.alignmentRowHeight;let e=Math.floor((i-s.pixelTop)/t);if(e>=0&&e<s.length){const t=s.rows[e].alignments.filter(t=>t.containsLocation(r,this.showSoftClips));if(t.length>0)return t[0]}}if(i<t&&e.downsampledIntervals)for(const t of e.downsampledIntervals)if(t.start<=r&&t.end>=r)return t}}getConnectorColor(t){if(this.pairConnectorColor)return this.pairConnectorColor;let e=this.colorBy;switch(e&&e.startsWith("tag:")&&(e.substring(4),e="tag"),e){case"strand":case"firstOfPairStrand":case"pairOrientation":case"tag":return this.color?"function"==typeof this.color?this.color(t):this.color:"rgb(200, 200, 200)";default:return this.getAlignmentColor(t)}}getAlignmentColor(t){let e;e=this.color?"function"==typeof this.color?this.color(t):this.color:"rgb(185, 185, 185)";let i,r=this.colorBy;switch(r&&r.startsWith("tag:")&&(i=r.substring(4),r="tag"),r){case"basemod":case"basemod2":e=t.strand?this.baseModPosStrandColor:this.baseModNegStrandColor;break;case"strand":e=t.strand?this.posStrandColor:this.negStrandColor;break;case"firstOfPairStrand":const s=t.firstOfPairStrand;void 0!==s&&(e=s?this.posStrandColor:this.negStrandColor);break;case"unexpectedPair":case"pairOrientation":if(t.pairOrientation){const i=df[this.expectedPairOrientation];if(i){const r=this.pairColors[i[t.pairOrientation]];if(r){e=r;break}}}if("pairOrientation"===r)break;case"tlen":case"fragmentLength":t.mate&&t.isMateMapped()&&(t.mate.chr!==t.chr?e=tu(t.mate.chr):this.minTemplateLength&&Math.abs(t.fragmentLength)<this.minTemplateLength?e=this.smallTLENColor:this.maxTemplateLength&&Math.abs(t.fragmentLength)>this.maxTemplateLength&&(e=this.largeTLENColor));break;case"tag":const o=t.getTag(i);if(void 0!==o){if("yc"===i.toLowerCase()){const t=ur.createColorStringSafe(o);if(t){e=t;break}}this.colorTable||(this.colorTable=new Qr(this.tagColorPallete)),e=this.colorTable.getColor(o)}}return e}get nucleotideColors(){return this.browser.nucleotideColors}get minTemplateLength(){return void 0!==this.minTLEN?this.minTLEN:this.parent._pairedEndStats?this.parent._pairedEndStats.minTLEN:0}get maxTemplateLength(){return void 0!==this.maxTLEN?this.maxTLEN:this.parent._pairedEndStats?this.parent._pairedEndStats.maxTLEN:1e3}getState(){const t=super.getState();return this.highlightedReads&&(t.highlightedReads=Array.from(this.highlightedReads)),t}get name(){return this.parent.name}set name(t){this.parent.name=t}get color(){return this.parent.color}set color(t){this.parent.color=t}get trackView(){return this.parent.trackView}get getCachedAlignmentContainers(){return this.parent.getCachedAlignmentContainers}get sortObject(){return this.parent.sortObject}set sortObject(t){this.parent.sortObject=t}addPairedChordsForViewport(t){return this.parent.addPairedChordsForViewport(t)}addSplitChordsForViewport(t){return this.parent.addSplitChordsForViewport(t)}}function Eg(t,e){let i;return i=t<5?.1:Math.max(.1,Math.min(1,.1+.9*(t-5)/15)),i=Math.round(10*i)/10,i<1&&(e=ur.addAlpha(e,i)),e}function Ng(){"FULL"!==this.displayMode||this.browser.isTrackPanning()||this.repackAlignments()}function Mg(t,e,i,r,s,o,n,a,c){const l=n.baseModCounts,h=n.coverageMap;if(l){let n;const d=a.split(":");2==d.length&&(a=d[0],n=d[1]);const u=Array.from(l.allModifications);u.sort(ff.compare);const f=h.getTotalCount(o);if(!u.filter(t=>n?n===t.modification:!t.modification.startsWith("NONE_")).find(t=>l.getCount(o,t,0,!1)>0))return;for(let d of u){if(d.modification.startsWith("NONE_")&&"basemod2"!==a)continue;if(n&&n!==d.modification&&!d.modification.startsWith("NONE_"))continue;const u=d.base,p=nn(u),g=h.getCount(o,u)+h.getCount(o,p),m=l.simplexModifications.has(d.modification)?h.getPosCount(o,u)+h.getNegCount(o,p):g;if(0==m)continue;const w="basemod2"===a,b=l.getCount(o,d,c,w);if(0==b)continue;const F=g/f*(b/m),v=Math.round(F*s),y=l.getLikelihoodSum(o,d,c,w)/b,A=i-v,C=xg(d.modification,y,a);t.fillStyle=C,t.fillRect(e,A,r,v),i=A}}}Sg.defaults={viewAsPairs:!1,showSoftClips:!1,showAllBases:!1,showInsertions:!0,showMismatches:!0,colorBy:void 0,groupBy:void 0,displayMode:"EXPANDED",alignmentRowHeight:14,squishedRowHeight:3,negStrandColor:"rgba(150, 150, 230, 0.75)",posStrandColor:"rgba(230, 150, 150, 0.75)",baseModPosStrandColor:"rgb(195, 195, 195)",baseModNegStrandColor:"rgb(195, 210, 195)",insertionColor:"rgb(138, 94, 161)",insertionTextColor:"white",showInsertionText:!1,deletionColor:"black",deletionTextColor:"black",showDeletionText:!1,skippedColor:"rgb(150, 170, 170)",pairConnectorColor:void 0,smallTLENColor:"rgb(0, 0, 150)",largeTLENColor:"rgb(200, 0, 0)",expectedPairOrientation:"fr",rlColor:"rgb(0, 150, 0)",rrColor:"rgb(20, 50, 200)",llColor:"rgb(0, 150, 150)",bamColorTag:"YC",hideSmallIndels:!1,indelSizeThreshold:1,highlightColor:void 0,minTLEN:void 0,maxTLEN:void 0,tagColorPallete:"Set1"};class Rg{constructor(t,e){this.featureType="numeric",this.parent=e,this.featureSource=e.featureSource,this.paintAxis=Du,this.top=0,this.autoscale=!!t.autoscale||void 0===t.max,t.coverageColor&&(this.color=t.coverageColor),this.autoscale||(this.dataRange={min:t.min||0,max:t.max})}get height(){return this.parent.coverageTrackHeight}get browser(){return this.parent.browser}draw(t){const e=t.pixelTop;t.pixelHeight;const i=this.browser.nucleotideColors;if(e>this.height)return;const r=t.context,s=t.features,o=s.coverageMap;let n;o.refSeq&&(n=o.refSeq.toUpperCase());const a=t.bpPerPixel,c=t.bpStart,l=c+t.pixelWidth*a+1;let h;h=this.color?this.color:this.parent.color&&"function"!=typeof this.parent.color?ur.darkenLighten(this.parent.color,-35):"rgb(150, 150, 150)",go.setProperties(r,{fillStyle:h,strokeStyle:h});const d=Math.max(1,1/a);for(let t=0,e=o.coverage.length;t<e;t++){const e=o.bpStart+t;if(e<c)continue;if(e>l)break;const i=o.coverage[t];if(!i)continue;const s=i.total/this.dataRange.max*this.height,n=this.height-s,h=(e-c)/a;go.fillRect(r,h,n,d,s)}if(n)for(let t=0,e=o.coverage.length;t<e;t++){const e=o.bpStart+t;if(e<c)continue;if(e>l)break;const h=o.coverage[t];if(!h)continue;const u=h.total/this.dataRange.max*this.height;let f=this.height-u;const p=Math.floor((e-c)/a),g=n[t];if(this.parent.colorBy&&this.parent.colorBy.startsWith("basemod"))Mg(r,p,this.height,d,u,e,s,this.parent.colorBy,this.parent.baseModificationThreshold);else if(h.isMismatch(g)){go.setProperties(r,{fillStyle:i[g]}),go.fillRect(r,p,f,d,u);let t=0;for(let e of["A","C","T","G"]){const s=(h["pos"+e]+h["neg"+e])/this.dataRange.max*this.height;f=this.height-s-t,t+=s,go.setProperties(r,{fillStyle:i[e]}),go.fillRect(r,p,f,d,s)}}}}getClickedObject(t){const e=t.viewport.cachedFeatures;if(!e)return;const i=Math.floor(t.genomicLocation),r=e.coverageMap,s=Math.floor(i-r.bpStart),o=r.coverage[s];return o?{reference:r.refSeq?r.refSeq.charAt(s).toUpperCase():void 0,coverage:o,baseModCounts:e.baseModCounts,hoverText:()=>r.coverage[s].hoverText()}:void 0}async popupData(t){var e;const i=[],r=this.getClickedObject(t);if(!r)return;const{reference:s,coverage:o,baseModCounts:n}=r;if(o){const r=Math.floor(t.genomicLocation),a=t.viewport.referenceFrame;i.push(a.chr+":"+F(1+r)),i.push({name:"Total Count",value:o.total}),i.push("<HR/>");for(let t of["A","C","G","T","N"]){const e=o[`pos${t}`]+o[`neg${t}`],r=e.toString()+" ("+Math.round(e/o.total*100)+"%, "+o[`pos${t}`]+"+, "+o[`neg${t}`]+"- )";i.push({name:t,value:r})}if(o.del>0&&i.push({name:"DEL",value:o.del.toString()}),o.ins>0&&i.push({name:"INS",value:o.ins.toString()}),n&&(i.push("<hr/>"),i.push(...n.popupData(r,this.parent.colorBy))),s){let t=!0;for(let n of["A","C","G","T"]){if(o[`pos${n}`]+o[`neg${n}`]>0&&s!==n){t&&(i.push("<hr/>"),t=!1);const o=null!==(e=await $f.createHGVSAnnotation(this.browser.genome,a.chr,r,s,n))&&void 0!==e?e:"",c=await Kf.getClinVarURL(o);c?i.push({name:"ClinVar",value:`<a href='${c}' target='_blank'>${o}</a>`}):i.push({name:"HGVS",value:o})}}}return i}}}class Dg extends lc{constructor(t,e){super(t,e)}init(t){this.type="alignment",this.featureSource=new Hp(t,this.browser);const e=Object.assign({parent:this},t);this.coverageTrack=new Rg(e,this);const i=Object.assign({parent:this},t);this.alignmentTrack=new Sg(i,this.browser),super.init(t),this.showAlignments||(this._height=this.coverageTrackHeight),t.sort&&(Array.isArray(t.sort)?this.assignSort(t.sort[0]):this.assignSort(t.sort))}dispose(){this.alignmentTrack.dispose()}setHighlightedReads(t,e){this.alignmentTrack.setHighlightedReads(t,e),this.updateViews()}get expectedPairOrientation(){return this.alignmentTrack.expectedPairOrientation}get viewAsPairs(){return this.alignmentTrack.viewAsPairs}get colorBy(){return this.alignmentTrack.colorBy}set height(t){this._height=t,this.showAlignments&&(this.alignmentTrack.height=this.showCoverage?t-this.coverageTrackHeight:t)}get height(){return this._height}sort(t){t=this.assignSort(t);for(let e of this.trackView.viewports)if(e.containsPosition(t.chr,t.position)){const i=e.cachedFeatures;i&&(i.sortRows(t),e.repaint())}}assignSort(t){if(t.locus){const e=function(t){const e=t.split(":"),i=e[1].split("-"),r={chr:e[0],start:Number.parseInt(i[0].replace(/,/g,""))-1};return i.length>1?r.end=Number.parseInt(i[1].replace(/,/g,"")):r.end=r.start+1,r}(t.locus);t.chr=e.chr,t.position=e.start}else t.position--;const e="ASC"===t.direction||!0===t.direction,i=this.browser.genome.getChromosomeName(t.chr);return this.sortObject={chr:i,position:t.position,option:t.option,direction:e},this.sortObject}async getFeatures(t,e,i,r,s){const o=await this.featureSource.getAlignments(t,e,i);if(o.viewport=s,o.hasPairs&&!this._pairedEndStats&&!this.config.maxFragmentLength){const t=new bg(o.allAlignments(),this.config);t.totalCount>99&&(this._pairedEndStats=t)}o.pack(this.alignmentTrack);const n=this.sortObject;return n&&n.chr===t&&n.position>=e&&n.position<=i&&o.sortRows(n),this.alignmentTrack.hasPairs=this.alignmentTrack.hasPairs||o.hasPairs,o}computePixelHeight(t){return(this.showCoverage?this.coverageTrackHeight:0)+(this.showAlignments?this.alignmentTrack.computePixelHeight(t):0)}draw(t){go.fillRect(t.context,0,t.pixelTop,t.pixelWidth,t.pixelHeight,{fillStyle:"rgb(255, 255, 255)"}),!0===this.showCoverage&&this.coverageTrackHeight>0&&!1!==this.config.showAxis?(this.trackView.axisCanvas.style.display="block",this.coverageTrack.draw(t)):this.trackView.axisCanvas.style.display="none",!0===this.showAlignments&&(this.alignmentTrack.setTop(this.coverageTrack,!!this.showCoverage),this.alignmentTrack.draw(t))}paintAxis(t,e,i){this.coverageTrack.paintAxis(t,e,this.coverageTrackHeight)}contextMenuItemList(t){return this.alignmentTrack.contextMenuItemList(t)}popupData(t){return!0===this.showCoverage&&t.y>=this.coverageTrack.top&&t.y<this.coverageTrackHeight?this.coverageTrack.popupData(t):this.alignmentTrack.popupData(t)}clickedFeatures(t){let e;return e=!0===this.showCoverage&&t.y>=this.coverageTrack.top&&t.y<this.coverageTrackHeight?this.coverageTrack.getClickedObject(t):this.alignmentTrack.getClickedObject(t),e?[e]:[]}hoverText(t){if(!0===this.showCoverage&&t.y>=this.coverageTrack.top&&t.y<this.coverageTrackHeight){const e=this.coverageTrack.getClickedObject(t);if(e&&e.hoverText)return e.hoverText()}}menuItemList(){let t=[];t=t.concat(this.numericDataMenuItems()),t=t.concat(this.alignmentTrack.menuItemList());const e=()=>{if(!this.autoHeight){const t=(this.showCoverage?this.coverageTrackHeight:0)+(this.showAlignments?this.alignmentTrack.height:0);this.trackView.setTrackHeight(t)}};t.push("<hr/>");t.push({element:ic("Show Coverage",this.showCoverage),click:()=>{this.showCoverage=!this.showCoverage,e(),this.trackView.checkContentHeight(),this.trackView.repaintViews()}});return t.push({element:ic("Show Alignments",this.showAlignments),click:()=>{this.showAlignments=!this.showAlignments,e(),this.trackView.checkContentHeight(),this.trackView.repaintViews()}}),t}getState(){const t=super.getState();return this.sortObject&&(t.sort={chr:this.sortObject.chr,position:this.sortObject.position+1,option:this.sortObject.option,direction:this.sortObject.direction?"ASC":"DESC"}),Object.assign(t,this.alignmentTrack.getState()),t}getCachedAlignmentContainers(){return this.trackView.viewports.map(t=>t.cachedFeatures)}get dataRange(){return this.coverageTrack.dataRange}set dataRange(t){this.coverageTrack.dataRange=t}get logScale(){return this.coverageTrack.logScale}set logScale(t){this.coverageTrack.logScale=t}get autoscale(){return this.coverageTrack.autoscale}set autoscale(t){this.coverageTrack.autoscale=t}addPairedChordsForViewport(t){const e=this.maxTemplateLength,i=[],r=t.referenceFrame;for(let s of t.cachedFeatures.allAlignments())s.end>=r.start&&s.start<=r.end&&(s.paired?s.end-s.start>e&&i.push(s):s.mate&&s.mate.chr&&(s.mate.chr!==s.chr||Math.max(s.fragmentLength)>e)&&i.push(s));wg((t=>{const e=[];for(let i of t)if(i.paired)i.firstAlignment&&i.secondAlignment&&e.push({uniqueId:i.readName,refName:gg(i.firstAlignment.chr),start:i.firstAlignment.start,end:i.firstAlignment.end,mate:{refName:gg(i.secondAlignment.chr),start:i.secondAlignment.start,end:i.secondAlignment.end}});else{const t=i.mate;t&&t.chr&&t.position&&e.push({uniqueId:i.readName,refName:gg(i.chr),start:i.start,end:i.end,mate:{refName:gg(t.chr),start:t.position-1,end:t.position}})}return e})(i),this,r,.02)}addSplitChordsForViewport(t){const e=[],i=t.referenceFrame;for(let r of t.cachedFeatures.allAlignments()){const t=r.hasTag("SA");r.end>=i.start&&r.start<=i.end&&t&&e.push(r)}wg((t=>{const e=t=>{const e=Pf(t.getTag("SA"));let r=0;for(let s of e)s.start!==t.start&&i.push({uniqueId:`${t.readName}_${r++}`,refName:gg(t.chr),start:t.start,end:t.end,mate:{refName:gg(s.chr),start:s.start,end:s.start+s.lenOnRef}})},i=[];for(let i of t)i.paired?(e(i.firstAlignment),i.secondAlignment&&e(i.secondAlignment)):e(i);return i})(e),this,i,.02)}}Dg.defaults={alleleFreqThreshold:.2,visibilityWindow:3e4,showCoverage:!0,showAlignments:!0,height:300,coverageTrackHeight:50,baseModificationThreshold:0};class Bg extends lc{constructor(t,e){super(t,e)}init(t){var e,i;super.init(t),!1===t.arcOrientation?this.arcOrientation="DOWN":!0===t.arcOrientation?this.arcOrientation="UP":t.arcOrientation?this.arcOrientation=t.arcOrientation.toUpperCase():this.arcOrientation="UP",this.sinTheta=Math.sin(this.theta),this.cosTheta=Math.cos(this.theta),this.arcType=function(t){if(!t.arcType)return"nested";switch(t.arcType){case"chiapet":return"inView";case"chiapetoutbound":return"partialInView";default:return t.arcType}}(t),this.painter={flipAxis:"DOWN"===this.arcOrientation,dataRange:this.dataRange,paintAxis:Du},this._hic="hic"===t.format,this._hic&&(t.useScore=!0,this.color=null!==(e=t.color)&&void 0!==e?e:"rgb(255,0,0)",this.transparency=null!==(i=t.transparency)&&void 0!==i?i:.1),t.valueColumn?(this.valueColumn=t.valueColumn,this.hasValue=!0):t.useScore&&(this.hasValue=!0,this.valueColumn="score"),t.max?(this.dataRange={min:t.min||0,max:t.max},this.autoscale=!1):this.autoscale=!0,t.colorTable?this.colorTable=new Gr(t.colorTable):t.colorBy&&(this.colorTable=new Qr("Set1")),t.featureSource?(this.featureSource=t.featureSource,delete t._featureSource):(t.features&&function(t){const e=[];for(let i of t)if(i.chr1===i.chr2)i.chr=i.chr1,i.start=Math.min(i.start1,i.start2),i.end=Math.max(i.end1,i.end2);else{i.chr=i.chr1,i.start=Math.min(i.start1,i.start2),i.end=Math.max(i.end1,i.end2);const t=Object.assign({},i);t.dup=!0,t.chr=t.chr2,t.start=t.start2,t.end=t.end2,e.push(t)}for(const i of e)t.push(i)}(t.features),this.featureSource=_h(t,this.browser.genome),this.featureSource.getWGFeatures=Og)}async postInit(){if("function"!=typeof this.featureSource.getHeader||(this.header=await this.featureSource.getHeader(),!this.disposed))return this.header&&this.setTrackProperties(this.header),void 0===this.visibilityWindow&&"function"==typeof this.featureSource.defaultVisibilityWindow&&(this.visibilityWindow=await this.featureSource.defaultVisibilityWindow(),this.featureSource.visibilityWindow=this.visibilityWindow),this._initialColor=this.color||this.constructor.defaultColor,this._initialAltColor=this.altColor||this.constructor.defaultColor,this}get supportsWholeGenome(){return"function"!=typeof this.featureSource.supportsWholeGenome||this.featureSource.supportsWholeGenome()}get resolutionAware(){return this._hic}async getFeatures(t,e,i,r){const s=this.visibilityWindow,o=await this.featureSource.getFeatures({chr:t,start:e,end:i,bpPerPixel:r,visibilityWindow:s,normalization:this.normalization});return void 0===this.hasValue&&o&&o.length>0&&(this.hasValue=void 0!==o[0].score),o}draw(t){"proportional"===this.arcType||"inView"===this.arcType||"partialInView"===this.arcType?this.drawProportional(t):this.drawNested(t)}drawNested(t){const e=t.context,i=t.pixelWidth,r=t.pixelHeight,s=t.viewportWidth,o=t.bpPerPixel,n=t.bpStart,a=o;go.fillRect(e,0,t.pixelTop,i,r,{fillStyle:"rgb(255, 255, 255)"});const c=t.features;if(c){(function(){if(this._hic)this.theta=Math.PI/3,this.sinTheta=Math.sin(this.theta),this.cosTheta=Math.cos(this.theta);else{let t=0;for(let e of c){let r=(e.start-n)/a,s=(e.end-n)/a;r>=0&&s<=i&&(t=Math.max(t,s-r))}let e=Math.min(s,t)/2;if(t>0){let t=(r-10)/e;this.theta=function(t){let e,i=[.01570925532366355,.15838444032453644,.3249196962329063,.5095254494944288,.7265425280053609,.9999999999999999],r=[.031415926535897934,.3141592653589793,.6283185307179586,.9424777960769379,1.2566370614359172,1.5707963267948966];for(e=0;e<i.length&&!(i[e]>t);e++);let s=0===e?0:i[e-1],o=e<i.length?i[e]:1,n=(t-s)/(o-s),a=0===e?0:r[e-1],c=e<r.length?r[e]:Math.PI/2;return Math.min(Math.PI/2,a+n*(c-a))}(t),this.sinTheta=Math.sin(this.theta),this.cosTheta=Math.cos(this.theta)}}}).call(this);const l="UP"===this.arcOrientation,h=l?t.pixelHeight:0;e.font="8px sans-serif",e.textAlign="center";let d=this.transparency;this._hic&&o<1e3&&(d*=3-o/500);for(let t of c){t.drawState=void 0;let r=this.getColor(t,d);if(e.fillStyle=r,e.strokeStyle=r,e.lineWidth=t.thickness||this.thickness||1,t.chr1===t.chr2||"all"===t.chr){const{m1:o,m2:c}=Tg(t,this.browser.genome);let d=Math.round((o-n)/a),u=Math.round((c-n)/a);if(u<0||d>i)continue;let f=u-d;f<3&&(f=3,d--);const p=f/2,g=p/this.sinTheta,m=this.cosTheta*g,w=d+p;let b,F,v;if(l?(b=this.height+m,F=Math.PI+Math.PI/2-this.theta,v=Math.PI+Math.PI/2+this.theta):(b=-m,F=Math.PI/2-this.theta,v=Math.PI/2+this.theta),this.showBlocks&&"all"!==t.chr){const i=(t.start1-n)/a,r=(t.end1-n)/a,s=(t.start2-n)/a,o=(t.end2-n)/a,c=l?-this.blockHeight:this.blockHeight;e.fillRect(i,h,r-i,c),e.fillRect(s,h,o-s,c)}r&&!this.config.useScore&&f>s&&(r=Pg(r,this.alpha),e.strokeStyle=r,e.fillStyle=r),e.beginPath(),e.arc(w,b,g,F,v,!1),e.stroke(),t.drawState={xc:w,yc:b,r:g}}else{let s=Math.round((t.start-n)/a),o=Math.round((t.end-n)/a);if(o<0||s>i)continue;let c=o-s;c<3&&(c=3,s--);const h=t.chr===t.chr1?t.chr2:t.chr1;e.strokeStyle=r,e.fillStyle=Pg(tu(h),.5),l?(e.fillRect(s,this.height/2,c,this.height/2),e.fillText(h,s+c/2,this.height/2-5),t.drawState={x:s,y:this.height/2,w:c,h:this.height/2}):(e.fillRect(s,0,c,this.height/2),e.fillText(h,s+c/2,this.height/2+13),t.drawState={x:s,y:0,w:c,h:this.height/2})}}}}drawProportional(t){const e=t.context,i=t.pixelWidth,r=t.pixelHeight,s=t.bpPerPixel,o=t.bpStart,n=s,a=t.referenceFrame.start,c=t.referenceFrame.end,l="UP"===this.arcOrientation;go.fillRect(e,0,t.pixelTop,i,r,{fillStyle:"rgb(255, 255, 255)"});const h=t.features;if(h&&h.length>0){const r=0,s=this.getScaleFactor(r,this.dataRange.max,t.pixelHeight-1,this.logScale),d=l?t.pixelHeight:0;for(let t of h){t.drawState=void 0;const r=this.valueColumn?t[this.valueColumn]:t.score;if(void 0===r||Number.isNaN(r))continue;const h=Math.round((this.logScale?Math.log10(r+1):r)*s);if(t.chr1===t.chr2||"all"===t.chr){const{m1:i,m2:s}=Tg(t,this.browser.genome);let u=Math.round((i-o)/n),f=Math.round((s-o)/n)-u;if(f<3&&(f=3,u--),r<this.dataRange.min||r>this.dataRange.max)continue;if("proportional"!==this.arcType){const t="partialInView"===this.arcType,e=i>=a&&s<=c;let r=!1,o=!1;if(!e&&t&&(r=a<=i&&i<=c,r||(o=a<=s&&s<=c)),!(e||r||o))continue}const p=f/2,g=u+f/2;t.drawState={xc:g,yc:d,radiusX:p,radiusY:h};const m=l,w=this.getColor(t);if(e.strokeStyle=w,e.lineWidth=t.thickness||this.thickness||1,!0===e.isSVG?e.strokeEllipse(g,d,p,h,0,0,Math.PI,m):(e.beginPath(),e.ellipse(g,d,p,h,0,0,Math.PI,m),e.stroke()),this.alpha){const i=this.config.useScore&&Number.isFinite(t.score)?Math.max(.1,Math.round(10*Number(wl(t.score)))/10):1;e.fillStyle=Pg(w,i*this.alpha),!0===e.isSVG?e.fillEllipse(g,d,p,h,0,0,Math.PI,m):e.fill()}if(this.showBlocks&&"all"!==t.chr){e.fillStyle=w;const i=(t.start1-o)/n,r=(t.end1-o)/n,s=(t.start2-o)/n,a=(t.end2-o)/n,c=l?-this.blockHeight:this.blockHeight;e.fillRect(i,d,r-i,c),e.fillRect(s,d,a-s,c)}}else{let s=Math.round((t.start-o)/n),a=Math.round((t.end-o)/n);if(a<0||s>i||r<this.dataRange.min||r>this.dataRange.max)continue;const c=Math.min(h,this.height-13);let d=a-s;d<3&&(d=3,s--);const u=t.chr===t.chr1?t.chr2:t.chr1;if(e.font="8px sans-serif",e.textAlign="center",e.fillStyle=Pg(tu(u),.5),l){const i=this.height-c;e.fillRect(s,i,d,c),e.fillText(u,s+d/2,i-5),t.drawState={x:s,y:i,w:d,h:c}}else e.fillRect(s,0,d,c),e.fillText(u,s+d/2,c+13),t.drawState={x:s,y:0,w:d,h:c}}}}}getColor(t,e=this.transparency){let i;if(this.colorBy){const e=t.getAttributeValue?t.getAttributeValue(this.colorBy):t[this.colorBy];i=this.colorTable.getColor(e)}else i="function"==typeof this.color?this.color(t):this.color||t.color||"rgb(180,25,137)";return this.config.useScore&&Number.isFinite(t.score)&&(i=Pg(i,e*Number(wl(t.score)))),i}getScaleFactor(t,e,i,r){return r?i/(Math.log10(e+1)-(t<=0?0:Math.log10(t+1))):i/(e-t)}clearAxis(t,e,i){go.fillRect(t,0,0,e,i,{fillStyle:"rgb(255, 255, 255)"})}paintAxis(t,e,i){const r={min:0,max:this.dataRange.max};"proportional"===this.arcType||"inView"===this.arcType||"partialInView"===this.arcType?(this.painter.flipAxis="DOWN"===this.arcOrientation,this.painter.dataRange=r,this.painter.paintAxis(t,e,i)):this.clearAxis(t,e,i)}menuItemList(){let t=[];if(this.hasValue&&!this._hic){t.push("<hr/>");const e={nested:"Nested",proportional:"Proportional - All",inView:"Proportional - Both Ends in View",partialInView:"Proportional - One End in View"};t.push("<b>Arc Type</b>");for(let i of["nested","proportional","inView","partialInView"])t.push({element:ic(e[i],i===this.arcType),click:function(){this.arcType=i,this.trackView.repaintViews()}})}if(t.push("<hr/>"),t.push({name:"Toggle arc direction",click:function(){this.arcOrientation="UP"===this.arcOrientation?"DOWN":"UP",this.trackView.repaintViews()}}),t.push({name:this.showBlocks?"Hide Blocks":"Show Blocks",click:function(){this.showBlocks=!this.showBlocks,this.trackView.repaintViews()}}),t.push("<hr/>"),t.push({name:"Set line thickness",click:function(t){this.browser.inputDialog.present({label:"Enter line thickness",value:this.thickness||1,callback:t=>{const e=parseFloat(t);isNaN(e)?window.alert("Invalid line thickness: "+t):(this.thickness=e,this.trackView.repaintViews())}},t)}}),this._hic?t.push(this.transparencyMenuItem()):(t.push({name:"Set alpha",click:function(t){this.browser.inputDialog.present({label:"Enter alpha transparency (0-1)",value:this.alpha,callback:t=>{const e=parseFloat(t);isNaN(e)||e<0||e>1?window.alert("Invalid alpha: "+t):(this.alpha=e,this.trackView.repaintViews())}},t)}}),this.hasValue&&t.push({element:ic("Use score",this.config.useScore),click:()=>{this.config.useScore=!this.config.useScore,this.valueColumn="score",this.trackView.repaintViews()}})),this._hic){t.push("<hr/>"),t.push("<b>Normalization</b>");for(let e of this.featureSource.normalizationOptions)t.push({element:ic(e,this.normalization===e),click:()=>{this.normalization=e,this.trackView.clearCachedFeatures(),this.trackView.updateViews()}})}return"proportional"!==this.arcType&&"inView"!==this.arcType&&"partialInView"!==this.arcType||(t=t.concat(this.numericDataMenuItems())),this.browser.circularView&&(t.push("<hr/>"),t.push({label:"Add interactions to circular view",click:function(){for(let t of this.trackView.viewports)this.addChordsForViewport(t.referenceFrame)}})),t}transparencyMenuItem(){const t=e();return t.innerText="Set transparency",{element:t,dialog:function(t){const e={label:"Transparency",value:this.transparency,min:.01,max:1,scaleFactor:1e3,color:this.color,callback:t=>{this.transparency=Math.max(.001,t),this.repaintViews()}};this.browser.sliderDialog.present(e,t)}}}contextMenuItemList(t){if(this.browser.circularView){const e=t.viewport,i=[];return i.push({label:"Add interactions to circular view",click:()=>{const t=e.referenceFrame;this.addChordsForViewport(t)}}),i.push("<hr/>"),i}}addChordsForViewport(t){let e;if("all"===t.chr)e=Object.values(this.featureSource.getAllFeatures()).flat();else{e=this.featureSource.featureCache.queryFeatures(t.chr,t.start,t.end).filter(t=>t.drawState)}if(0===e.length)return;wg(e.map(t=>{const e=t._f||t;return{uniqueId:`${e.chr1}:${e.start1}-${e.end1}_${e.chr2}:${e.start2}-${e.end2}`,refName:gg(e.chr1),start:e.start1,end:e.end1,mate:{refName:gg(e.chr2),start:e.start2,end:e.end2}}}),this,t,.5)}doAutoscale(t){let e=0;if(t)for(let i of t){const t=this.valueColumn?i[this.valueColumn]:i.score;Number.isNaN(t)||(e=Math.max(e,t))}return{min:0,max:e}}popupData(t,e){void 0===e&&(e=this.clickedFeatures(t));const i=[];for(let t of e){const e=t._||t;if(i.push({name:"Region 1",value:Lg(e.chr1,e.start1,e.end1,e.strand1)}),i.push({name:"Region 2",value:Lg(e.chr2,e.start2,e.end2,e.strand2)}),e.name&&i.push({name:"Name",value:e.name}),void 0!==e.value&&i.push({name:"Value",value:e.value}),void 0!==e.score&&i.push({name:"Score",value:e.score}),void 0!==e.type&&i.push({name:"Type",value:e.type}),e.extras&&this.header&&this.header.columnNames){const t=this.header.columnNames,r=this.header.hiccups?6:10;for(let s=r;s<t.length;s++)this.header.colorColumn!==s&&("info"===t[s]?Hg(i,e.extras[s-r]):i.push({name:t[s],value:e.extras[s-r]}))}break}return i}clickedFeatures(t){const e=t.viewport.cachedFeatures,i=[];if(e){const r="proportional"===this.arcType||"inView"===this.arcType||"partialInView"===this.arcType;for(let s of e)if(s.drawState)if(s.chr1===s.chr2||"all"===s.chr)if(r){const{xc:e,yc:r,radiusX:o,radiusY:n}=s.drawState,a=t.canvasX-e,c=t.canvasY-r,l=a/o*(a/o)+c/n*(c/n);l<=1&&i.push({score:1/l,feature:s})}else{const{xc:e,yc:r,r:o}=s.drawState,n=t.canvasX-e,a=t.canvasY-r,c=Math.abs(Math.sqrt(n*n+a*a)-o);c<5&&i.push({score:c,feature:s})}else{const{x:e,y:r,w:o,h:n}=s.drawState,a=5;if(t.canvasX>=e-a&&t.canvasX<=e+o+a&&t.canvasY>=r&&t.canvasY<=r+n){const r=-Math.abs(t.canvasX-(e+o/2));i.push({score:r,feature:s});break}}}return i.length>1&&i.sort((t,e)=>t.score-e.score),i.map(t=>t.feature)}}function Tg(t,e){var i,r;let s=(t.start1+t.end1)/2,o=(t.start2+t.end2)/2;if("all"===t.chr&&(s=null!==(i=e.getGenomeCoordinate(t.chr1,s))&&void 0!==i?i:s,o=null!==(r=e.getGenomeCoordinate(t.chr2,o))&&void 0!==r?r:o),s>o){const t=s;s=o,o=t}return{m1:s,m2:o}}function Lg(t,e,i,r){return r&&"."!==r?`${t}:${F(e+1)}-${F(i)} (${r})`:`${t}:${F(e+1)}-${F(i)}`}Bg.defaults={height:250,theta:Math.PI/4,arcOrientation:"UP",showBlocks:!0,blockHeight:3,thickness:1,alpha:.02,logScale:!0,colorBy:void 0,transparency:1,normalization:"NONE"};const zg=new Map;function Pg(t,e){const i=`${t}_${e}`;let r=zg.get(i);return r||(r=ur.addAlpha(t,e),zg.set(i,r)),r}function Og(t){var e,i;const r=t=>{var e,i;const r=Object.assign({},t);return r.chr="all",r.start=null!==(e=s.getGenomeCoordinate(t.chr1,t.start1))&&void 0!==e?e:t.start1,r.end=null!==(i=s.getGenomeCoordinate(t.chr2,t.end2))&&void 0!==i?i:t.end2,r},s=this.genome;let o,n=0;for(let i of s.wgChromosomeNames){let r=t[i];if(r)for(let t of r)t.dup||(n++,t.score&&(!o||t.score>(null!==(e=o.score)&&void 0!==e?e:0))&&(o=t))}const a=this.maxWGCount,c=null!==(i=null==o?void 0:o.score)&&void 0!==i?i:0,l=c>0&&n>a?5:1,h=Math.floor(a/l),d=c>0?Math.log(c)/l:Number.MAX_SAFE_INTEGER;let u,f=[],p=[];for(let t=0;t<l;t++)p.push(0),f.push([]);for(let e of s.wgChromosomeNames){let i=t[e];if(i)for(let t of i)if(!t.dup){const e=t.score?Math.max(0,Math.min(l-1,Math.floor(Math.log(t.score)/d))):0;if(f[e].length<h)f[e].push(r(t));else{const i=h/(p[e]+1);if(Math.random()<i){const i=Math.floor(Math.random()*(h-1));f[e][i]=r(t)}}p[e]++}}if(1===l)u=f[0];else{u=[];for(let t of f)for(let e of t)u.push(e);o&&u.push(r(o)),u.sort(function(t,e){return t.start-e.start})}return u}function Hg(t,e){const i=e.split(";");for(let e of i){const i=e.split("=");2===i.length&&t.push({name:i[0],value:i[1]})}}const Ug={},Vg=b,qg=10;class Qg extends lc{constructor(t,e){super(t,e),this._sortDirections=new Map}init(t){if(super.init(t),t.variantHeight&&(this.expandedVariantHeight=t.variantHeight),this.featureSource=_h(t,this.browser.genome),this.colorTables=new Map,t.colorTable){const e=t.colorBy||"*";this.colorTables.set(e,new Gr(t.colorTable))}if(this.strokecolor=t.strokecolor,this._context_hook=t.context_hook,t.color&&(this.colorBy=void 0),this.nVariantRows=1,t.samples)for(let e of t.samples)this.sampleKeys=t.samples;t.sort&&(this.initialSort=t.sort),this._colorByItems=new Map([["none","None"]])}async postInit(){if(this.header=await this.getHeader(),this.header.INFO){const t=new Set(Object.keys(this.header.INFO));this.config.colorBy?this.colorBy=this.config.colorBy:!this.config.color&&t.has("AF")&&(this.colorBy="AF"),t.has("AF")&&this._colorByItems.set("AF","Allele frequency"),t.has("VT")&&this._colorByItems.set("VT","Variant Type"),t.has("SVTYPE")&&this._colorByItems.set("SVTYPE","SV Type")}if(this.config.colorBy&&!this._colorByItems.has(this.config.colorBy)&&this._colorByItems.set(this.config.colorBy,this.config.colorBy),!this.disposed){if(this.header&&!this.sampleKeys&&(this.sampleKeys=this.header.sampleNameMap?Array.from(this.header.sampleNameMap.keys()):[]),void 0===this.visibilityWindow&&!1!==this.config.indexed){const t=x(this.config.url)?this.config.url.name:this.config.url;Vg(t)&&t.toLowerCase().includes("gnomad")?this.visibilityWindow=1e3:"function"==typeof this.featureSource.defaultVisibilityWindow?this.visibilityWindow=await this.featureSource.defaultVisibilityWindow():this.visibilityWindow=1e6}return this._initialColor=this.color||this.constructor.defaultColor,this._initialAltColor=this.altColor||this.constructor.defaultColor,this}}get supportsWholeGenome(){return"function"==typeof this.featureSource.supportsWholeGenome&&this.featureSource.supportsWholeGenome()||!0===this.config.supportsWholeGenome}get color(){return this._color||Qg.defaultColor}set color(t){this._color=t,t&&(this.colorBy=void 0)}async getHeader(){return this.header||"function"==typeof this.featureSource.getHeader&&(this.header=await this.featureSource.getHeader()),this.header}getSampleCount(){return this.sampleKeys?this.sampleKeys.length:0}async getFeatures(t,e,i,r){void 0===this.header&&(this.header=await this.getHeader());const s=await this.featureSource.getFeatures({chr:t,start:e,end:i,bpPerPixel:r,visibilityWindow:this.visibilityWindow});if(this.initialSort){const t=this.initialSort;if(void 0===t.option||"GENOTYPE"===t.option.toUpperCase())this.sortSamplesByGenotype(t,s);else if("ATTRIBUTE"===t.option.toUpperCase()&&t.attribute){const e="ASC"===t.direction?1:-1;this.sortByAttribute(t.attribute,e)}this.initialSort=void 0}return s}hasSamples(){return this.getSampleCount()>0}getSamples(){const t="SQUISHED"===this.displayMode?this.squishedVGap:this.expandedVGap,e="COLLAPSED"===this.displayMode?1:this.nVariantRows,i="SQUISHED"===this.displayMode?this.squishedVariantHeight:this.expandedVariantHeight,r=e*(("SQUISHED"===this.displayMode?this.squishedCallHeight:this.expandedCallHeight)+t),s=qg+e*(i+t);return{names:this.sampleKeys||[],yOffset:s,height:r}}computePixelHeight(t){if(!t||0===t.length)return qg;const e="COLLAPSED"===this.displayMode?1:this.nVariantRows,i="SQUISHED"===this.displayMode?this.squishedVGap:this.expandedVGap,r="SQUISHED"===this.displayMode?this.squishedVariantHeight:this.expandedVariantHeight,s="SQUISHED"===this.displayMode?this.squishedCallHeight:this.expandedCallHeight,o=!1===this.showGenotypes?0:this.getSampleCount()*e;return qg+e*(r+i)+i+(o+1)*(s+i)}variantRowCount(t){this.nVariantRows=t}draw({context:t,pixelWidth:e,pixelHeight:i,bpPerPixel:r,bpStart:s,pixelTop:o,features:n}){var a;go.fillRect(t,0,o,e,i,{fillStyle:"rgb(255, 255, 255)"});const c="SQUISHED"===this.displayMode?this.squishedVGap:this.expandedVGap,l="COLLAPSED"===this.displayMode?1:this.nVariantRows,h="SQUISHED"===this.displayMode?this.squishedVariantHeight:this.expandedVariantHeight;this.variantBandHeight=qg+l*(h+c);let d=this.sampleColumns;const u=this.hasSamples();if(d&&u&&!1!==this.showGenotypes&&go.strokeLine(t,0,this.variantBandHeight,e,this.variantBandHeight,{strokeStyle:"rgb(224,224,224) "}),n){const i="SQUISHED"===this.displayMode?this.squishedCallHeight:this.expandedCallHeight,o="SQUISHED"===this.displayMode?this.squishedVGap:this.expandedVGap,c=s+e*r+1;for(let e of n){if(this._filter&&!this._filter(e))continue;if(e.end<s)continue;if(e.start>c)break;const n="SQUISHED"===this.displayMode?this.squishedVariantHeight:this.expandedVariantHeight,l=qg+("COLLAPSED"===this.displayMode?0:e.row*(n+o)),h=n;let d=(e.start-s)/r,f=(e.end-s)/r,p=Math.max(1,f-d);p<3?(p=3,d-=1):p>5&&(d+=1,p-=2);const g=e._f||e;let m;try{m=g.alleleFreq()}catch(t){console.log(t)}if("AF"===this.colorBy&&m){const e=Math.min(1,Number(m))*h,i=h-e;t.fillStyle=g.isFiltered()?this.refColorFiltered:this.refColor,t.fillRect(d,l,p,i),t.fillStyle=g.isFiltered()?this.altColorFiltered:this.altColor,t.fillRect(d,l+i,p,e)}else t.fillStyle=this.getColorForFeature(g),t.fillRect(d,l,p,h);let w=this.getVariantStrokecolor(g);if(w&&(t.strokeStyle=w,t.strokeRect(d,l,p,h)),this.callContextHook(g,t,d,l,p,h),u&&!1!==this.showGenotypes){const e="COLLAPSED"===this.displayMode?1:this.nVariantRows;this.sampleYOffset=this.variantBandHeight+o,this.sampleHeight=e*(i+o);let r=0;for(let e of this.sampleKeys){const s=this.header.sampleNameMap.get(e),n=g.calls[s];if(n){const e="COLLAPSED"===this.displayMode?0:null!==(a=g.row)&&void 0!==a?a:0,s=this.sampleYOffset+r*this.sampleHeight+e*(i+o);let c=!0,l=!0,h=!1;if(n.genotype)for(let t of n.genotype){if("."===t){h=!0;break}0!==t&&(l=!1),0===t&&(c=!1)}n.genotype?t.fillStyle=h?this.noCallColor:l?this.homrefColor:c?this.homvarColor:this.hetvarColor:t.fillStyle=this.noGenotypeColor,t.fillRect(d,s,p,i)}r++}}}}else console.log("No feature list")}get refColorFiltered(){return this._refColorFiltered||(this._refColorFiltered=ur.addAlpha(this.refColor,.2)),this._refColorFiltered}get altColorFiltered(){return this._altColorFiltered||(this._altColorFiltered=ur.addAlpha(this.altColor,.2)),this._altColorFiltered}getColorForFeature(t){const e=t._f||t;let i;if(this.colorBy&&"none"!==this.colorBy){const t=e.getAttributeValue(this.colorBy);i=void 0!==t?this.getVariantColorTable(this.colorBy).getColor(t):"gray"}else i=this.color?"function"==typeof this.color?this.color(t):this.color:"NONVARIANT"===e.type?this.nonRefColor:"MIXED"===e.type?this.mixedColor:this.color;return e.isFiltered()&&(i=ur.addAlpha(i,.2)),i}getVariantStrokecolor(t){const e=t._f||t;let i;return i=this.strokecolor?"function"==typeof this.strokecolor?this.strokecolor(e):this.strokecolor:void 0,i}callContextHook(t,e,i,r,s,o){if(this._context_hook&&"function"==typeof this._context_hook){const n=t._f||t;e.save(),this._context_hook(n,e,i,r,s,o),e.restore()}}clickedFeatures(t){let e=super.clickedFeatures(t);const i="EXPANDED"===this.displayMode?this.expandedVGap:this.squishedVGap,r=i+("SQUISHED"===this.displayMode?this.squishedCallHeight:this.expandedCallHeight),s=t.y;if(s<=this.variantBandHeight){const t="SQUISHED"===this.displayMode?this.squishedVariantHeight:this.expandedVariantHeight,r=Math.floor((s-qg)/(t+i));"COLLAPSED"!==this.displayMode&&(e=e.filter(t=>t.row===r))}else if(this.sampleKeys){const t=s-this.variantBandHeight,i=Math.floor(t/this.sampleHeight);if(i>=0&&i<this.sampleKeys.length){const s=Math.floor((t-i*this.sampleHeight)/r),o="COLLAPSED"===this.displayMode?e:e.filter(t=>t.row===s),n=this.sampleKeys[i],a=this.header.sampleNameMap.get(n);return o.map(t=>{const e=t.calls[a];return e.genotypeString=function(t,e){if(t.genotype){let i="";if("."===e.alternateBases)i="No Call";else{const r=e.alternateBases.split(",");for(let s of t.genotype)if(i.length>0&&(i+=" | "),"."===s)i+=".";else if(0===s)i+=e.referenceBases;else{i+=r[s-1].replace("<","<")}}return i}}(e,t),e})}}return e}popupData(t,e){void 0===e&&(e=this.clickedFeatures(t));const i=t.genomicLocation,r=this.browser.genome.id;let s=[];for(let t of e){const e=t._f||t;if(s.length>0&&s.push({html:'<hr style="border-top-width:2px ;border-color: #c9c3ba" />'}),"function"==typeof e.popupData){const t=e.popupData(i,r);Array.prototype.push.apply(s,t)}}return s}menuItemList(){const e=[];if(this.header.INFO&&this.header.INFO){const i=this._colorByItems;e.push("<hr/>");const r=t('<div class="igv-track-menu-category igv-track-menu-border-top">');r.textContent="Color by:",e.push({name:void 0,element:r,click:void 0,init:void 0});for(let t of i.keys()){const r=this.colorBy===t;e.push(this.colorByCB({key:t,label:i.get(t)},r))}e.push(this.colorByCB({key:"info",label:"Info field..."},!1))}if(!0===Cu(this.browser.sampleInfo,this.sampleKeys)){e.push("<hr/>"),e.push("Sort by attribute:");for(const t of this.browser.sampleInfo.attributeNames)if(this.sampleKeys.some(e=>{const i=this.browser.sampleInfo.getAttributes(e);return i&&i[t]})){const i=document.createElement("div");i.innerHTML=` ${t.split(mu.emptySpaceReplacement).join(" ")}`;const r=()=>{const e=this._sortDirections.get(t)||1;this.sortByAttribute(t,e),this.config.sort={option:"ATTRIBUTE",attribute:t,direction:e>0?"ASC":"DESC"},this._sortDirections.set(t,-1*e)};e.push({element:i,click:r})}}e.push("<hr/>"),this.getSampleCount()>0&&(e.push({element:t('<div class="igv-track-menu-border-top">')}),e.push({element:ic("Show Genotypes",this.showGenotypes),click:function(){this.showGenotypes=!this.showGenotypes,this.trackView.checkContentHeight(),this.trackView.repaintViews(),this.browser.sampleNameControl.performClickWithState(this.browser,this.showGenotypes),this.browser.sampleInfoControl.performClickWithState(this.browser,this.showGenotypes)}})),e.push({element:t('<div class="igv-track-menu-border-top">')});for(let t of["COLLAPSED","SQUISHED","EXPANDED"]){e.push({element:ic({COLLAPSED:"Collapse",SQUISHED:"Squish",EXPANDED:"Expand"}[t],t===this.displayMode),click:function(){this.displayMode=t,this.trackView.checkContentHeight(),this.trackView.repaintViews()}})}return this.browser.circularView&&(e.push("<hr>"),e.push({label:"Add SVs to circular view",click:function(){for(let t of this.trackView.viewports)this.sendChordsForViewport(t)}})),this.canCovertToPytor()&&(e.push("<hr>"),e.push({label:"Convert to CNVpytor track",click:function(){this.convertToPytor()}})),e}contextMenuItemList(t){const e=[];if(this.hasSamples()&&this.showGenotypes){const i=t.viewport.referenceFrame,r=t.genomicLocation,s=i.toBP(2.5),o=this._sortDirections.get("genotype")||1;this._sortDirections.set("genotype",-1*o),e.push({label:"Sort by genotype",click:e=>{const i={direction:o,option:"genotype",chr:t.viewport.referenceFrame.chr,position:Math.floor(r),start:Math.floor(r-s),end:Math.ceil(r+s)},n=t.viewport.cachedFeatures;this.sortSamplesByGenotype(i,n),this.config.sort=i}}),e.push("<hr/>")}if(this.browser.circularView){const i=t.viewport;e.push({label:"Add SVs to Circular View",click:()=>{this.sendChordsForViewport(i)}}),e.push("<hr/>")}return e}async sortSamplesByGenotype({chr:t,position:e,start:i,end:r,direction:s},o){if(void 0===i&&(i=e-1),void 0===r&&(r=e),o||(o=await this.featureSource.getFeatures({chr:t,start:i,end:r})),!o)return;const n=new Map,a="ASC"===s?1:-1;for(let t of o)if(!(t.end<i)){if(t.start>r)break;for(let e of t.calls){const t=e.sample,i=e.zygosityScore();n.set(t,n.has(t)?n.get(t)+i:i)}}this.sampleKeys.sort(function(t,e){let i=n.get(t)||0,r=n.get(e)||0;return a*(i-r)}),this.trackView.repaintViews()}sortByAttribute(t,e){this.config.sort={option:"ATTRIBUTE",attribute:t,direction:1===e?"ASC":"DESC"},this.sampleKeys=this.browser.sampleInfo.sortSampleKeysByAttribute(this.sampleKeys,t,e),this.trackView.repaintViews()}sendChordsForViewport(t){const e=t.referenceFrame;let i;if("all"===e.chr){const t=this.featureSource.getAllFeatures(),e=Object.keys(t).map(e=>t[e]);i=[].concat(...e)}else i=this.featureSource.featureCache.queryFeatures(e.chr,e.start,e.end);wg(i.filter(t=>{const e=t._f||t;return!!(e.info&&e.info.CHR2&&e.info.END&&(e.info.CHR2!==e.chr||Math.abs(Number.parseInt(e.info.END)-e.pos)>1e6))}).map(t=>{const e=t._f||t,i=Number.parseInt(e.info.END),r=i-100,s=i+100;return{uniqueId:`${e.chr}:${e.start}-${e.end}_${e.info.CHR2}:${e.info.END}`,refName:gg(e.chr),start:e.start,end:e.end,mate:{refName:gg(e.info.CHR2),start:r,end:s}}}),this,e,.5)}colorByCB(t,e){const i=ic(t.label,e);if("info"!==t.key){function r(){const e="none"===t.key?void 0:t.key;this.colorBy=e,this.config.colorBy=e,this.trackView.repaintViews()}return{name:void 0,element:i,click:r,init:void 0}}{function s(t){this.browser.inputDialog.present({label:"Info field",value:"",callback:t=>{t?(this.colorBy=t,this._colorByItems.set(t,t)):this.colorBy=void 0,this.trackView.repaintViews()}},t)}return{name:void 0,element:i,dialog:s,init:void 0}}}getState(){const t=super.getState();return this.color&&"function"!=typeof this.color&&(t.color=this.color),t}getVariantColorTable(t){if(this.colorTables.has(t))return this.colorTables.get(t);if(this.colorTables.has("*"))return this.colorTables.get("*");{let e;if("SVTYPE"===t)e=Gg;else e=new Qr("Set1");return this.colorTables.set(t,e),e}}paintAxis(){}canCovertToPytor(){return!this.config.indexURL&&(!!this.header&&(1===Object.keys(this.sampleKeys).length&&this.header.FORMAT&&this.header.FORMAT.AD&&this.header.FORMAT.DP))}async convertToPytor(){this.variantState={...this.config,...this.getState()},this.variantState.trackHeight=this.height,this.trackView.startSpinner(),setTimeout(async()=>{try{const t=Object.assign({},this.config),e=Ug.CNVPytorTrack;Object.setPrototypeOf(this,e.prototype),this.init(t),await this.postInit(),this.trackView.clearCachedFeatures(),this.trackView.setTrackHeight(this.config.height||e.DEFAULT_TRACK_HEIGHT),this.trackView.checkContentHeight(),this.trackView.updateViews()}finally{this.trackView.stopSpinner()}},100)}getFilterableAttributes(){return this.header.INFO}_repackCachedFeatures(){for(let t of this.trackView.viewports)if(t.cachedFeatures){const e=this.config.maxRows||Number.MAX_SAFE_INTEGER;oc(t.cachedFeatures,e,this._filter)}}}Qg.defaultColor="rgb(0,0,150)",Qg.defaults={displayMode:"EXPANDED",sortDirection:"ASC",showGenotypes:!0,expandedVariantHeight:10,squishedVariantHeight:2,squishedCallHeight:1,expandedCallHeight:10,expandedVGap:2,squishedVGap:1,expandedGroupGap:10,squishedGroupGap:5,featureHeight:14,noGenotypeColor:"rgb(200,180,180)",noCallColor:"rgb(225, 225, 225)",nonRefColor:"rgb(200, 200, 215)",mixedColor:"rgb(200, 220, 200)",homrefColor:"rgb(200, 200, 200)",homvarColor:"rgb(17,248,254)",hetvarColor:"rgb(34,12,253)",refColor:"rgb(0,0,220)",altColor:"rgb(255,0,0)",visibilityWindow:void 0,labelDisplayMode:void 0,type:"variant"};const Gg=new Gr({DEL:"#ff2101",INS:"#001888",DUP:"#028401",INV:"#008688",CNV:"#8931ff",BND:"#891100","*":"#002eff"});function Wg(t,e=!1){const i=t.split("\t");if(i.length>2)try{const t=i[0],e=parseInt(i[1].replace(/,/g,""),10)-1,r=parseInt(i[2].replace(/,/g,""),10);if(!isNaN(e)&&!isNaN(r))return{chr:t,start:e,end:r}}catch(t){}const r=t.split(":"),s={chr:r[0]};if(r.length>1){let t,i=r[1].split("-");if(i.length>2){if(!r[1].startsWith("-"))return;{const t=r[1].indexOf("-",1);if(t>0){i=[r[1].substring(0,t),r[1].substring(t+1)]}}}if(t=i[0].replace(/,/g,""),isNaN(Number(t)))return;if(s.start=parseInt(t,10)-1,s.end=s.start+1,1===i.length&&(s.start-=20,s.end+=20),2===i.length){if(t=i[1].replace(/,/g,""),isNaN(Number(t)))return;if(s.end=parseInt(t,10),void 0!==s.start&&s.start<0&&!e){const t=-s.start;s.start+=t,s.end+=t}}}return s}Ug.VariantTrack=Qg;class jg extends lc{constructor(t,e){super(t,e)}init(t){super.init(t),this.type="qtl",this.name=t.name;const e=t.minLogP||t.min,i=t.maxLogP||t.max;this.dataRange={min:void 0!==e?e:3.5,max:i||25},this.autoscale=!i||t.autoscale,this.autoscalePercentile=void 0===t.autoscalePercentile?98:t.autoscalePercentile,this.background=t.background,this.divider=t.divider||"rgb(225,225,225)",this.dotSize=t.dotSize||2,this.height=t.height||100,this.disableButtons=t.disableButtons,this.featureSource=_h(t,this.browser.genome)}paintAxis(t,e,i){const r=(this.dataRange.max-this.dataRange.min)/i,s={font:"normal 10px Arial",textAlign:"right",strokeStyle:"black"};go.fillRect(t,0,0,e,i,{fillStyle:"rgb(255, 255, 255)"});const o=Math.ceil(10*(this.dataRange.max-this.dataRange.min)/i);for(let n=4;n<=this.dataRange.max;n+=o){const o=.85*e,a=o-5,c=o,l=i-(n-this.dataRange.min)/r;go.strokeLine(t,a,l,c,l,s),l>8&&go.fillText(t,String(n),a-1,l+2,s)}s.textAlign="center",go.fillText(t,"-log10(pvalue)",e/4,i/2,s,{rotate:{angle:-90}})}async getFeatures(t,e,i){const r=this.visibilityWindow;return await this.featureSource.getFeatures({chr:t,start:e,end:i,visibilityWindow:r})}draw(t){const{context:e,referenceFrame:i,pixelWidth:r,pixelHeight:s}=t;this.background&&go.fillRect(e,0,0,r,s,{fillStyle:this.background}),go.strokeLine(e,0,s-1,r,s-1,{strokeStyle:this.divider});const o=i=>{const o=i?2*this.dotSize:this.dotSize,n=t.bpStart,a=(this.dataRange.max-this.dataRange.min)/s;for(let l of t.features){const h=(l.start-n+.5)/t.bpPerPixel;if(h<0)continue;if(h>r)break;const d=l.phenotype;let u;if(u=this.browser.qtlSelections.qtl?$g(this.browser.qtlSelections.qtl,l):this.browser.qtlSelections.snps.size>0?this.browser.qtlSelections.hasSnp(l.snp)&&this.browser.qtlSelections.hasPhenotype(d):this.browser.qtlSelections.hasPhenotype(d),!i||u){var c=-Math.log(l.pValue)/Math.LN10;if(c>=this.dataRange.min){let t;c>this.dataRange.max?(c=this.dataRange.max,t=!0):t=!1;const r=Math.max(0+o,s-Math.round((c-this.dataRange.min)/a));let n;l.px=h,l.py=r,l.radius=o,i&&u?(n=this.browser.qtlSelections.colorForGene(d),go.setProperties(e,{fillStyle:n,strokeStyle:"black"})):(n=t?"rgb(150, 150, 150)":"rgb(180, 180, 180)",go.setProperties(e,{fillStyle:n,strokeStyle:n})),go.fillCircle(e,h,r,o),go.strokeCircle(e,h,r,o)}}}};o(!1),o(!0)}popupData(t,e){if(void 0===e&&(e=t.viewport.cachedFeatures),!e||0===e.length)return[];const i=this.name,r=[];for(let s of this._clickedFeatures(t,e))r.length>0&&r.push("<hr/>"),"function"==typeof s.popupData?r.push(...s.popupData(t)):r.push({name:"snp id",value:s.snp},{name:"gene id",value:s.gencodeId},{name:"gene name",value:s.geneSymbol},{name:"p value",value:s.pValue},{name:"tissue",value:i});return r}_clickedFeatures(t,e){const i=(t,e)=>Math.sqrt((t.px-e.canvasX)*(t.px-e.canvasX)+(t.py-e.canvasY)*(t.py-e.canvasY)),r=e.filter(e=>i(e,t)<6);if(r.length>1){r.sort((e,r)=>i(e,t)-i(r,t));const e=i(r[0],t);return r.filter(r=>i(r,t)<=e)}return r}contextMenuItemList(t){const e=[],i=t.viewport.cachedFeatures;if(i){const r=this._clickedFeatures(t,i);r.length>0&&(e.push({label:"Highlight associated features",click:async()=>{this.browser.qtlSelections.clear();for(let t of r)this.browser.qtlSelections.qtl=t,this.browser.qtlSelections.addPhenotype(t.phenotype);this.browser.repaintViews()}}),e.push("<hr>"))}return e}menuItemList(){const t=[];return t.push(...this.numericDataMenuItems()),t.push("<hr/>"),t.push({label:"Search for...",dialog:function(t){this.browser.inputDialog.present({label:"Search for snp or phenotype",value:"",callback:async t=>{if(t){t=t.trim().toUpperCase();const e=e=>((e.phenotype&&e.phenotype.toUpperCase())===t||e.snp&&e.snp.toUpperCase()===t)&&-Math.log(e.pValue)/Math.LN10>this.dataRange.min;let i,r,s,o=await this.featureSource.findFeatures(e);if(0==o.length){await this.browser.search(t)&&(o=await this.featureSource.findFeatures(e))}if(o.length>0){this.browser.qtlSelections.clear();const e=new Set;i=o[0].chr,r=o[0].start,s=o[0].end;for(let n of o)n.snp&&n.snp.toUpperCase()===t&&this.browser.qtlSelections.addSnp(n.snp),this.browser.qtlSelections.addPhenotype(n.phenotype),e.add(n.phenotype),n.chr===i&&(r=Math.min(r,n.start),s=Math.max(s,n.end));const n=this.browser.genome.getChromosomeName(i);for(let t of e){const e=await Hf(this.browser,t);e&&n===this.browser.genome.getChromosomeName(e.chr)&&(r=Math.min(r,e.start),s=Math.max(s,e.end))}const a=Math.floor(.1*(s-r));r=Math.max(0,r-a),s+=a,await this.browser.search(`${i}:${r}-${s}`)}}}},t)}}),t}doAutoscale(t){let e=this.config.max||25;if(t.length>0){const i=t.map(t=>-Math.log(t.pValue)/Math.LN10);i.sort((t,e)=>t-e);e=i[Math.floor(i.length*(this.autoscalePercentile/100))]}return this.dataRange.max=Math.max(e,10),this.dataRange}}function $g(t,e){return t.chr===e.chr&&t.start===e.start&&t.pValue===e.pValue}const Kg={X:"rgb(204, 153, 0)",Y:"rgb(153, 204, 0)",Un:"darkGray)",1:"rgb(80, 80, 255)",2:"rgb(206, 61, 50)","2a":"rgb(210, 65, 55)","2b":"rgb(215, 70, 60)",3:"rgb(116, 155, 88)",4:"rgb(240, 230, 133)",5:"rgb(70, 105, 131)",6:"rgb(186, 99, 56)",7:"rgb(93, 177, 221)",8:"rgb(128, 34, 104)",9:"rgb(107, 215, 107)",10:"rgb(213, 149, 167)",11:"rgb(146, 72, 34)",12:"rgb(131, 123, 141)",13:"rgb(199, 81, 39)",14:"rgb(213, 143, 92)",15:"rgb(122, 101, 165)",16:"rgb(228, 175, 105)",17:"rgb(59, 27, 83)",18:"rgb(205, 222, 183)",19:"rgb(97, 42, 121)",20:"rgb(174, 31, 99)",21:"rgb(231, 199, 111)",22:"rgb(90, 101, 94)",23:"rgb(204, 153, 0)",24:"rgb(153, 204, 0)",25:"rgb(51, 204, 0)",26:"rgb(0, 204, 51)",27:"rgb(0, 204, 153)",28:"rgb(0, 153, 204)",29:"rgb(10, 71, 255)",30:"rgb(71, 117, 255)",31:"rgb(255, 194, 10)",32:"rgb(255, 209, 71)",33:"rgb(153, 0, 51)",34:"rgb(153, 26, 0)",35:"rgb(153, 102, 0)",36:"rgb(128, 153, 0)",37:"rgb(51, 153, 0)",38:"rgb(0, 153, 26)",39:"rgb(0, 153, 102)",40:"rgb(0, 128, 153)",41:"rgb(0, 51, 153)",42:"rgb(26, 0, 153)",43:"rgb(102, 0, 153)",44:"rgb(153, 0, 128)",45:"rgb(214, 0, 71)",46:"rgb(255, 20, 99)",47:"rgb(0, 214, 143)",48:"rgb(20, 255, 177)"};for(let tC of Object.keys(Kg)){Kg["chr"+tC]=Kg[tC]}for(let eC=1;eC<=48;eC++){if(10===eC)continue;const iC=Zg(eC);iC&&(Kg[iC]=Kg[eC.toString()])}function Zg(t){if(!+t)return!1;for(var e=String(+t).split(""),i=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"],r="",s=3;s--;)r=(i[+e.pop()+10*s]||"")+r;return Array(+e.join("")+1).join("M")+r}class Yg extends lc{constructor(t,e){super(t,e)}init(t){super.init(t),this.useChrColors=void 0===t.useChrColors||t.useChrColors,this.trait=t.trait,this.posteriorProbability=t.posteriorProbability,this.valueProperty="bed"===t.format?"score":"value",this.height=t.height||100,this.autoscale=t.autoscale,this.autoscalePercentile=void 0===t.autoscalePercentile?98:t.autoscalePercentile,this.background=t.background,this.divider=t.divider||"rgb(225,225,225)",this.dotSize=t.dotSize||3,this.popoverWindow=void 0===t.popoverWindow?1e8:t.popoverWindow,this.useChrColors?this.colorScale=new Gr(t.colorTable||Kg):t.color?this.colorScale=new $u(t.color):this.colorScale=new Gu(t.colorScale||{thresholds:[5e-8,5e-4,.5],colors:["rgb(255,50,50)","rgb(251,100,100)","rgb(251,170,170)","rgb(227,238,249)"]}),this.featureSource=_h(t,this.browser.genome)}async postInit(){if("function"!=typeof this.featureSource.getHeader||(this.header=await this.featureSource.getHeader(),!this.disposed))return this.header&&this.setTrackProperties(this.header),this.autoscale||(this.posteriorProbability?this.dataRange={min:void 0===this.config.min?0:this.config.min,max:void 0===this.config.max?1:this.config.max}:this.dataRange={min:void 0===this.config.min?0:this.config.min,max:void 0===this.config.max?25:this.config.max}),this._initialColor=this.color||this.constructor.defaultColor,this._initialAltColor=this.altColor||this.constructor.defaultColor,this}get supportsWholeGenome(){return!0}async getFeatures(t,e,i){const r=this.visibilityWindow;return this.featureSource.getFeatures({chr:t,start:e,end:i,visibilityWindow:r})}draw(t){const e=t.features,i=t.context,r=t.pixelWidth,s=t.pixelHeight;if(this.background&&go.fillRect(i,0,0,r,s,{fillStyle:this.background}),go.strokeLine(i,0,s-1,r,s-1,{strokeStyle:this.divider}),e){const o=t.bpPerPixel,n=t.bpStart,a=n+r*o+1;for(let t of e){const e=t.start;if(e<n)continue;if(e>a)break;let r;if(this.posteriorProbability)r=t[this.valueProperty];else{const e=t[this.valueProperty];if(!e)continue;r=-Math.log10(e)}const c=this.useChrColors?t._f?t._f.chr:t.chr:r,l=this.colorScale.getColor(c),h=(this.dataRange.max-this.dataRange.min)/s,d=Math.round((e-n)/o),u=Math.max(this.dotSize,s-Math.round((r-this.dataRange.min)/h));l&&go.setProperties(i,{fillStyle:l,strokeStyle:"black"}),go.fillCircle(i,d,u,this.dotSize),t.px=d,t.py=u}}}paintAxis(t,e,i){go.fillRect(t,0,0,e,i,{fillStyle:"rgb(255, 255, 255)"});var r={font:"normal 10px Arial",textAlign:"right",strokeStyle:"black"};const s=(this.dataRange.max-this.dataRange.min)/i;if(this.posteriorProbability){const e=.1;for(let o=this.dataRange.min;o<this.dataRange.max;o+=e){const e=i-Math.round((o-this.dataRange.min)/s);go.strokeLine(t,45,e-2,50,e-2,r),go.fillText(t,o.toFixed(1),44,e+2,r)}}else{const e=Math.ceil(10*(this.dataRange.max-this.dataRange.min)/i);for(let o=this.dataRange.min;o<this.dataRange.max;o+=e){const e=i-Math.round((o-this.dataRange.min)/s);go.strokeLine(t,45,e,50,e,r),go.fillText(t,String(Math.floor(o)),44,e+4,r)}}r.textAlign="center",this.posteriorProbability?go.fillText(t,"PPA",e/2,i/2,r,{rotate:{angle:-90}}):go.fillText(t,"-log10(pvalue)",e/2,i/2,r,{rotate:{angle:-90}})}popupData(t,e){void 0===e&&(e=t.viewport.cachedFeatures);let i=[];const r=t.viewport.trackView.track;if(e){let s=0;for(let o of e){const e=Math.abs(t.canvasX-o.px),n=Math.abs(t.canvasY-o.py);if(e<this.dotSize&&n<this.dotSize){if(s>0&&i.push("<HR/>"),5==s){i.push("...");break}if(o=o._f||o,"function"==typeof o.popupData)i=i.concat(o.popupData(t.genomicLocation));else{const t=o[this.valueProperty],e=o.chr,s=F(o.start+1);i.push({name:"chromosome",value:e}),i.push({name:"position",value:s}),i.push({name:"name",value:o.name}),r.posteriorProbability?i.push({name:"posterior probability",value:t}):i.push({name:"pValue",value:t})}s++}}}return i}menuItemList(){return this.numericDataMenuItems()}doAutoscale(t){if(t.length>0){const e=this.valueProperty,i=this.posteriorProbability,r=t.map(function(t){const r=t[e];return{value:i?r:-Math.log(r)/Math.LN10}});this.dataRange=Go(r)}else this.posteriorProbability?this.dataRange={min:this.config.min||0,max:this.config.max||1}:this.dataRange={min:this.config.max||25,max:this.config.min||0};return this.dataRange}}Yg.defaultColor="rgb(0,0,150)";class Xg extends lc{constructor(t,e){super(t,e)}init(t){super.init(t),this.autoscale=t.autoscale||void 0===t.max,this.dataRange={min:t.min||0,max:t.max},this.windowFunction=t.windowFunction||"mean",this.paintAxis=Du,this.graphType=t.graphType||"bar",t._featureSource?(this.featureSource=t._featureSource,delete t._featureSource):this.featureSource=_h(this.config,this.browser.genome),this.visibilityWindow=-1,this.featureSource.visibilityWindow=this.visibilityWindow}async postInit(){if("function"==typeof this.featureSource.getHeader){if(this.header=await this.featureSource.getHeader(),this.disposed)return;if(this.sampleKeys=this.header.columnNames.slice(3),this.setTrackProperties(this.header),this.header.hasOwnProperty("clickToHighlight")){let t=this.header.clickToHighlight;this.config.clickToHighlight=t,this.config.samplesClickedToHighlight={}}if(this.header.hasOwnProperty("onlyHandleClicksForHighlightedSamples")&&(this.config.onlyHandleClicksForHighlightedSamples=!0),this.header.hasOwnProperty("highlight")){this.config.highlightSamples={};let t=this.header.highlight;Array.isArray(t)||(t=[t]);for(let e of t){const t=e.split(";");2===t.length&&(this.config.highlightSamples[t[0]]=t[1])}}}this._initialColor=this.color||this.constructor.defaultColor,this._initialAltColor=this.altColor||this.constructor.defaultColor}menuItemList(){return this.numericDataMenuItems()}async getFeatures(t,e,i){const r=await this.featureSource.getFeatures({chr:t,start:0,end:Number.MAX_SAFE_INTEGER,visibilityWindow:this.visibilityWindow});let s,o;for(let t=1;t<r.length-1;t++)if(void 0===s&&r[t].end>e&&(s=t-1),void 0===o&&r[t].start>i){o=t+1;break}return void 0===s&&(s=0),void 0===o&&(o=r.length),r.slice(s,o)}draw(t){const{features:e,context:i,bpPerPixel:r,bpStart:s,pixelWidth:o,pixelHeight:n}=t,a=e,c=t=>(this.dataRange.max-t)/(this.dataRange.max-this.dataRange.min)*n,l=function(t){let e=Math.floor((t-s)/r);return isNaN(e)&&console.warn("isNaN(x). feature start "+F(t)+" bp start "+F(s)),e};if(a&&a.length>0&&(void 0===this.dataRange.min&&(this.dataRange.min=0),this.dataRange.max>this.dataRange.min)){const t=this.config.highlightSamples,e=this.config.onlyHandleClicksForHighlightedSamples,r=this.config.clickToHighlight;let s=-1,o={},n=[],h=[];this.clickDetectorCache={};for(let d of a){const a=l(d.start),u=l(d.end),f=s>=0?l(s):a;if(!isNaN(a)&&!isNaN(u)){this.clickDetectorCache[a]=[],this.clickDetectorCache[u]=[];for(let s=0;s<d.values.length;s++){const l=this.sampleKeys[s],p=d.values[s],g=c(p);if(a-f>=1){const s=o[l],h=c(s),d=t&&t[l];d?n.push([f,h,a,g,d]):r&&l in this.config.samplesClickedToHighlight?n.push([f,h,a,g,this.config.samplesClickedToHighlight[l]]):go.strokeLine(i,f,h,a,g,{strokeStyle:"#D9D9D9"}),e&&!(l in t)||this.clickDetectorCache[a].push([f,h,a,g,l,d||"gray"])}if(u-a>=1){const s=t&&t[l];s?h.push([a,g,u,g,s]):r&&l in this.config.samplesClickedToHighlight?h.push([a,g,u,g,this.config.samplesClickedToHighlight[l]]):go.strokeLine(i,a,g,u,g,{strokeStyle:"gray"}),e&&!(l in t)||this.clickDetectorCache[u].push([a,g,u,g,l,s||"gray"])}o[l]=p}s=d.end}}for(let t of n)go.strokeLine(i,t[0],t[1],t[2],t[3],{strokeStyle:t[4],lineWidth:1.3});for(let t of h)go.strokeLine(i,t[0],t[1],t[2],t[3],{strokeStyle:t[4],lineWidth:2})}(t=>{if(this.config.hasOwnProperty("guideLines"))for(let e of this.config.guideLines)if(e.hasOwnProperty("color")&&e.hasOwnProperty("y")&&e.hasOwnProperty("dotted")){let i=c(e.y),r={strokeStyle:e.color,strokeWidth:2};e.dotted?go.dashedLine(t.context,0,i,t.pixelWidth,i,5,r):go.strokeLine(t.context,0,i,t.pixelWidth,i,r)}})(t)}doAutoscale(t){let e,i;return t.length>0?(e=Number.MAX_VALUE,i=-Number.MAX_VALUE,t.forEach(function(t){e=Math.min(e,...t.values),i=Math.max(i,...t.values)}),e-=.01,i+=.01):(e=0,i=100),{min:e,max:i}}clickedFeatures(t){const e=t.canvasX,i=t.canvasY;let r=null;for(r of Object.keys(this.clickDetectorCache))if(r=parseInt(r),r>=e)break;if(r){let t=Number.MAX_VALUE,n=[];const a=this.clickDetectorCache[r];for(let r of a){const s=r[0],o=r[2];if(e<s||e>o)return[];const a=r[1],c=r[3];if(i<Math.min(a,c)-10||i>Math.max(a,c)+10)continue;const l=Jg(e,i,s,a,o,c);l<t&&(n=[{name:r[4],color:r[5]}],t=l)}if(t<5){if(this.config.clickToHighlight){if(n[0].name in this.config.samplesClickedToHighlight)delete this.config.samplesClickedToHighlight[n[0].name];else if("any"===this.config.clickToHighlight){var s=["red","darkblue","green","teal","olivedrab","orange","maroon","purple","blue","gold"],o=s[Math.floor(Math.random()*(s.length+1))];this.config.samplesClickedToHighlight[n[0].name]=o}else this.config.samplesClickedToHighlight[n[0].name]=this.config.clickToHighlight;this.trackView.repaintViews()}return n}}return[]}popupData(t,e){void 0===e&&(e=this.clickedFeatures(t));const i=[];return e.forEach(function(t){for(let e of Object.keys(t))qo(t[e])&&i.push({name:e,value:t[e]})}),i}get supportsWholeGenome(){return!1}}function Jg(t,e,i,r,s,o){const n=s-i,a=o-r,c=Math.abs(n*(r-e)-(i-t)*a),l=Math.sqrt(n*n+a*a);return l>0?c/l:0}class tm extends lc{constructor(t,e){super(t,e),!1===t.arcOrientation?this.arcOrientation="DOWN":!0===t.arcOrientation?this.arcOrientation="UP":t.arcOrientation?this.arcOrientation=t.arcOrientation.toUpperCase():this.arcOrientation="UP","bp"===t.format?this.featureSource=new im(t,e.genome):this.featureSource=new ul(t,e.genome)}async getFeatures(t,e,i){const r=this.visibilityWindow;return this.featureSource.getFeatures({chr:t,start:e,end:i,visibilityWindow:r})}draw(t){const e=t.context,i=Math.PI/2,r=t.pixelWidth,s=t.pixelHeight,o=t.bpPerPixel,n=t.bpStart,a=o,c="UP"===this.arcOrientation,l=this.height;go.fillRect(e,0,t.pixelTop,r,s,{fillStyle:"rgb(255, 255, 255)"});const h=t.features;if(h){em(h,1);for(let t of h)if(t.startLeft){let r=Math.round((t.startLeft-n)/a),s=Math.round((t.startRight-n)/a),o=Math.round((t.endLeft-n)/a),h=Math.round((t.endRight-n)/a);e.fillStyle=t.color,e.strokeStyle=t.color,e.beginPath();let d=(r+h)/2,u=(h-r)/2,f=l,p=Math.PI+(Math.PI/2-i),g=2*Math.PI-(Math.PI/2-i);c?(e.arc(d,f,u,p,g),e.lineTo(o,f)):(f=0,e.arc(d,f,u,g,p),e.lineTo(h,f));const m=(s+o)/2,w=(o-s)/2,b=f;c?(e.arc(m,b,w,g,p,!0),e.lineTo(r,b)):(e.arc(m,b,w,p,g,!0),e.lineTo(o,b)),e.stroke(),e.fill(),t.drawState={x1:d,y1:f,r1:u,x2:m,y2:b,r2:w,sa:p,ea:g}}else{let r=Math.round((t.start-n)/a),s=Math.round((t.end-n)/a);e.strokeStyle=t.color,e.beginPath();let o=(r+s)/2,h=(s-r)/2,d=l,u=Math.PI+(Math.PI/2-i),f=2*Math.PI-(Math.PI/2-i);c?e.arc(o,d,h,u,f):(d=0,e.arc(o,d,h,f,u)),e.stroke(),t.drawState={x1:o,y1:d,r1:h,sa:u,ea:f}}}}clickedFeatures(t){const e=super.clickedFeatures(t),i=[];em(e,-1);for(let r of e){const e=r.drawState,s=t.canvasX-e.x1,o=t.canvasY-e.y1,n=Math.sqrt(s*s+o*o),a=e.r1+3;let c,l;if(void 0===e.x2)c=n,l=e.r1-3;else{const i=t.canvasX-e.x2,r=t.canvasY-e.y2;c=Math.sqrt(i*i+r*r),l=e.r2-3}if(n<a&&c>l){i.push(r);break}}return i}popupData(t,e){if(void 0===e&&(e=this.clickedFeatures(t)),e&&e.length>0)return this.extractPopupData(e[0],this.getGenomeId())}menuItemList(){return[{name:"Toggle arc direction",click:function(){this.arcOrientation="UP"===this.arcOrientation?"DOWN":"UP",this.trackView.repaintViews()}}]}}function em(t,e){t.sort(function(t,i){const r=void 0===t.score?-Number.MAX_VALUE:t.score,s=void 0===i.score?-Number.MAX_VALUE:i.score;return(void 0===e?1:e)*(r-s)})}tm.defaults={height:300,theta:Math.PI/2,arcOrientation:"UP"};class im{constructor(t,e){this.config=t,this.genome=e}async getFeatures({chr:t,start:e,end:i}){if(!this.featureCache){const t=Qo(this.config),e=await Er.loadByteArray(this.config.url,t);if(!e)return null;const i=Uc(e);let r,s=!0;const o=[],n=[],a=[],c=new Set;for(;void 0!==(r=i.nextLine());){const t=r.split("\t");if(s&&r.startsWith("color:")){const e="rgb("+t[1]+","+t[2]+","+t[3]+")";o.push(e),t.length>4&&n.push(t[4])}else{s=!1;const e=t[0],i=Number.parseInt(t[1])-1,r=Number.parseInt(t[2])-1,l=Number.parseInt(t[3]),h=Number.parseInt(t[4]),d=Number.parseInt(t[5]),u=o[d];let f,p,g,m;i<=h?(f=Math.min(i,r),p=Math.max(i,r),g=Math.min(l,h),m=Math.max(l,h)):(f=Math.min(l,h),p=Math.max(l,h),g=Math.min(i,r),m=Math.max(i,r));const w={chr:e,start:f,end:m,startLeft:f,startRight:p,endLeft:g,endRight:m,color:u,score:d,description:n.length>d?n[d]:void 0};c.add(e),a.push(w)}}this.chromAliasManager=new al(Array.from(c),this.genome),this.featureCache=new Xn(a)}const r=this.chromAliasManager?await this.chromAliasManager.getAliasName(t):t;return this.featureCache.queryFeatures(r,e,i)}}class rm{constructor(t){this.browser=t,this.type="ideogram",this.id="ideogram",this.height=t.config.showCytobandNames?20:16,this.order=Number.MIN_SAFE_INTEGER,this.disableButtons=!0,this.ignoreTrackMenu=!0,this.showCytobandNames=!!t.config.showCytobandNames}computePixelHeight(t){return this.height}draw({context:t,referenceFrame:e,pixelWidth:i,pixelHeight:r,features:s}){const o=e.chr,n=e.genome.getChromosome(o);if(void 0===n||i<=0||r<=0||"all"===o.toLowerCase())return;!function({ctx:t,chr:e,referenceFrame:i,genome:r,width:s,height:o,stainColors:n,features:a,showCytobandNames:c}){const l=1,h=.5*l,d=0;if(void 0===r)return;go.fillRect(t,0,0,s,o,{fillStyle:ur.greyScale(255)});const u=a;if(u){const e=d+o/2,i=[],r=[];if(0===u.length)return;const a=s/u[u.length-1].end;t.beginPath(),go.roundRect(t,h,h+d,s-2*h,o-2*h,(o-2*h)/2,!1,!0),t.clip();for(let s=0;s<u.length;s++){const h=u[s],f=a*h.start,p=a*h.end;if("c"===h.type)"p"===h.name.charAt(0)?(i[0]=f,r[0]=o+d,i[1]=f,r[1]=d,i[2]=p,r[2]=e):(i[0]=p,r[0]=o+d,i[1]=p,r[1]=d,i[2]=f,r[2]=e),t.fillStyle="rgb(150, 0, 0)",t.strokeStyle="rgb(150, 0, 0)",go.polygon(t,i,r,!0,!1);else{const e=om(n,h);t.fillStyle=e.color,go.fillRect(t,f,l+d,p-f,o-2*l),c&&sm(t,h.name,f,p,d,o,e.shade)}}}t.strokeStyle=ur.greyScale(41),go.roundRect(t,h,h+d,s-2*h,o-2*h,(o-2*h)/2,!1,!0)}({ctx:t,features:s,chr:o,referenceFrame:e,genome:e.genome,width:i,height:r,stainColors:[],showCytobandNames:this.showCytobandNames});const a=Math.round(e.bpPerPixel*i),c=e.start;let l=n.bpLength;const h=e.genome.getCytobands(o);if(h&&h.length>0&&h[h.length-1].end&&(l=Math.max(l,h[h.length-1].end),n.bpLength=l),a<l){const e=a/l,s=c/l;let o=Math.floor(s*i),n=Math.floor(e*i);o=Math.max(0,o),o=Math.min(i-n,o),t.save(),t.strokeStyle="red",t.lineWidth=n<2?1:2;const h=o+t.lineWidth/2;n=n<2?1:n-t.lineWidth;const d=t.lineWidth/2,u=r-t.lineWidth;t.strokeRect(h,d,n,u),t.restore()}}dispose(){this.trackView=void 0}}function sm(t,e,i,r,s,o,n){const a=o-4,c=r-i;let l=a-4;do{t.font=`${l}px sans-serif`;if(t.measureText(e).width<=c)break;l-=1}while(l>4);t.save(),t.beginPath(),t.rect(i,2+s,c,a),t.clip();const h=i+c/2,d=2+s+a/2+1;let u;u=null!==n?.2126*n+.7152*n+.0722*n:39.764;const f=u<128?"white":"black";go.fillText(t,e,h,d,{fillStyle:f,textAlign:"center",textBaseline:"middle",font:`${l}px sans-serif`}),t.restore()}function om(t,e){if("c"===e.type)return{color:"rgb(150, 10, 10)",shade:null};{let r=e.stain,s=230;"p"===e.type&&(s=Math.floor(230-r/100*230));var i=t[s];return i||(i="rgb("+s+","+s+","+s+")",t[s]=i),{color:i,shade:s}}}let nm=new Qr("Dark2");["GT/AG","CT/AC","GC/AG","CT/GC","AT/AC","GT/AT","non-canonical"].forEach(t=>{nm.getColor(t)});class am extends lc{constructor(t,e){super(t,e)}init(t){super.init(t),this.type=t.type||"junctions",t._featureSource?(this.featureSource=t._featureSource,delete t._featureSource):this.featureSource=t.featureSource?t.featureSource:_h(t,this.browser.genome)}async postInit(){if("function"!=typeof this.featureSource.getHeader||(this.header=await this.featureSource.getHeader(),!this.disposed))return this.header&&this.setTrackProperties(this.header),void 0===this.visibilityWindow&&"function"==typeof this.featureSource.defaultVisibilityWindow&&(this.visibilityWindow=await this.featureSource.defaultVisibilityWindow()),this._initialColor=this.color||this.constructor.defaultColor,this._initialAltColor=this.altColor||this.constructor.defaultColor,this}get supportsWholeGenome(){return!1}async getFeatures(t,e,i,r){const s=this.visibilityWindow;return this.featureSource.getFeatures({chr:t,start:e,end:i,bpPerPixel:r,visibilityWindow:s})}computePixelHeight(t){return this.height}draw(t){const e=t.features,i=t.context,r=t.bpPerPixel,s=t.bpStart,o=t.pixelWidth,n=t.pixelHeight,a=s+o*r+1;if(this.isMergedTrack||go.fillRect(i,0,t.pixelTop,o,n,{fillStyle:"rgb(255, 255, 255)"}),e){const o=t.viewport.referenceFrame,c={referenceFrame:o,referenceFrameStart:o.start,referenceFrameEnd:o.start+o.toBP(t.viewport.getWidth()),featureZoomOutTracker:{}};for(let t of e)if(!(t.end<s)){if(t.start>a)break;this.renderJunction(t,s,r,n,i,c)}}else console.log("No feature list")}renderJunction(t,e,i,r,s,o){t.isVisible=!1;const n=Math.round((t.start-e)/i),a=Math.round((t.end-e)/i),c=(n+a)/2;if(a-n<=3){if(c in o.featureZoomOutTracker)return;o.featureZoomOutTracker[c]=!0}if(this.config.hideAnnotatedJunctions&&"true"===t.attributes.annotated_junction)return;if(this.config.hideUnannotatedJunctions&&"false"===t.attributes.annotated_junction)return;if(this.config.hideMotifs&&this.config.hideMotifs.includes(t.attributes.motif))return;if(this.config.hideStrand===t.strand)return;if(this.config.minJunctionEndsVisible){let e=0;if(t.start>=o.referenceFrameStart&&t.start<=o.referenceFrameEnd&&(e+=1),t.end>=o.referenceFrameStart&&t.end<=o.referenceFrameEnd&&(e+=1),e<this.config.minJunctionEndsVisible)return}let l,h=0,d=0,u=0;if(t.attributes.uniquely_mapped){if(h=parseInt(t.attributes.uniquely_mapped),h<this.config.minUniquelyMappedReads)return;if(d=parseInt(t.attributes.multi_mapped),u=h+d,u<this.config.minTotalReads)return;if(u>0&&d/u>this.config.maxFractionMultiMappedReads)return;if(t.attributes.maximum_spliced_alignment_overhang&&parseInt(t.attributes.maximum_spliced_alignment_overhang)<this.config.minSplicedAlignmentOverhang)return}if(t.attributes.num_samples_with_this_junction){if(l=parseInt(t.attributes.num_samples_with_this_junction),this.config.minSamplesWithThisJunction&&l<this.config.minSamplesWithThisJunction)return;if(this.config.maxSamplesWithThisJunction&&l>this.config.maxSamplesWithThisJunction)return;if(t.attributes.num_samples_total&&(t.attributes.percent_samples_with_this_junction=100*l/Number(t.attributes.num_samples_total),this.config.minPercentSamplesWithThisJunction&&(t.attributes.percent_samples_with_this_junction<this.config.minPercentSamplesWithThisJunction||t.attributes.percent_samples_with_this_junction>this.config.maxPercentSamplesWithThisJunction)))return}const f=this.margin,p=r,g=f+.5*p;let m=f;const w=f+p-10,b=(n+c)/2,F=(c+a)/2;let v=1;t.attributes.line_width?v=Number(t.attributes.line_width):(void 0===this.config.thicknessBasedOn||"numUniqueReads"===this.config.thicknessBasedOn?v=h:"numReads"===this.config.thicknessBasedOn?v=u:"numSamplesWithThisJunction"===this.config.thicknessBasedOn&&void 0!==l&&(v=l),v=1+Math.log(v+1)/Math.log(12));let y,A=0;void 0===this.config.bounceHeightBasedOn||"random"===this.config.bounceHeightBasedOn?A=(t.start+t.end)%7:"distance"===this.config.bounceHeightBasedOn?A=6*(t.end-t.start)/(o.referenceFrameEnd-o.referenceFrameStart):"thickness"===this.config.bounceHeightBasedOn&&(A=2*v),m+=p*Math.max(7-A,0)/10,y=t.attributes.color?t.attributes.color:void 0===this.config.colorBy||"numUniqueReads"===this.config.colorBy?h>this.config.colorByNumReadsThreshold?"blue":"#AAAAAA":"numReads"===this.config.colorBy?u>this.config.colorByNumReadsThreshold?"blue":"#AAAAAA":"isAnnotatedJunction"===this.config.colorBy?"true"===t.attributes.annotated_junction?"#b0b0ec":"orange":"strand"===this.config.colorBy?"+"===t.strand?"#b0b0ec":"#ecb0b0":"motif"===this.config.colorBy?nm.getColor(t.attributes.motif):"#AAAAAA";let C="";t.attributes.label?C=t.attributes.label.replace(/_/g," "):void 0===this.config.labelWith||"uniqueReadCount"===this.config.labelWith?C=h:"totalReadCount"===this.config.labelWith?C=u:"numSamplesWithThisJunction"===this.config.labelWith?void 0!==l&&(C=l):"percentSamplesWithThisJunction"===this.config.labelWith?void 0!==t.attributes.percent_samples_with_this_junction&&(C=t.attributes.percent_samples_with_this_junction.toFixed(0)+"%"):"motif"===this.config.labelWith&&void 0!==t.attributes.motif&&(C+=t.attributes.motif),"uniqueReadCount"===this.config.labelWithInParen?C+=" ("+h+")":"totalReadCount"===this.config.labelWithInParen?C+=" ("+u+")":"multiMappedReadCount"===this.config.labelWithInParen?d>0&&(C+=" (+"+d+")"):"numSamplesWithThisJunction"===this.config.labelWithInParen?void 0!==l&&(C+=" ("+l+")"):"percentSamplesWithThisJunction"===this.config.labelWithInParen?void 0!==t.attributes.percent_samples_with_this_junction&&(C+=" ("+t.attributes.percent_samples_with_this_junction.toFixed(0)+"%)"):"motif"===this.config.labelWithInParen&&void 0!==t.attributes.motif&&(C+=` ${t.attributes.motif}`),t.isVisible=!0,s.beginPath(),s.moveTo(n,w),s.bezierCurveTo(b,m,F,m,a,w),s.lineWidth=v,s.strokeStyle=y,s.stroke();const _=(t,e,i,r)=>{t.beginPath(),t.moveTo(e,i),t.lineTo(e-r/2,i-r),t.lineTo(e+r/2,i-r),t.lineTo(e,i),t.closePath(),t.fill()};if(t.attributes.left_shape||t.attributes.right_shape){s.fillStyle=y;const e=s.lineWidth>2?10:7;t.attributes.left_shape&&_(s,n,w,e),t.attributes.right_shape&&_(s,a,w,e)}const x=String(C);s.fillText(x,c-s.measureText(x).width/2,(7*m+g)/8)}clickedFeatures(t){return super.clickedFeatures(t).filter(function(t){return t.isVisible&&t.attributes})}popupData(t,e){void 0===e&&(e=this.clickedFeatures(t));const i=t.genomicLocation,r=[];for(let t of e){const e="function"==typeof t.popupData?t.popupData(i):this.extractPopupData(t._f||t,this.getGenomeId());e&&(r.length>0&&r.push("<hr/><hr/>"),Array.prototype.push.apply(r,e))}return r}dispose(){this.trackView=void 0}}am.defaults={margin:10,colorByNumReadsThreshold:5,height:100};class cm{constructor(t){var e;this.config=t,this.url=(e=t.path||t.url).includes("//www.dropbox.com")?e.replace("//www.dropbox.com","//dl.dropboxusercontent.com"):e.startsWith("ftp://ftp.ncbi.nlm.nih.gov")?e.replace("ftp://","https://"):e}async read(t,e){const i=this.config.headers||{};if(void 0!==t&&e){const r="bytes="+t+"-"+(t+e-1);i.Range=r}let r=this.url.slice();if(this.config.oauthToken){const t=await async function(t){return"function"==typeof t?await Promise.resolve(t()):t}(this.config.oauthToken);i.Authorization=`Bearer ${t}`}this.config.apiKey&&(r=function(t,e,i){const r=t.includes("?")?"&":"?";return t+r+e+"="+i}(r,"key",this.config.apiKey));const s=await fetch(r,{method:"GET",headers:i,redirect:"follow",mode:"cors"}),o=s.status;if(o>=400){const t=Error(s.statusText);throw t.code=o,t}return s.arrayBuffer()}}class lm{constructor(t){this.file=t.file,this.fetchSize=t.fetchSize||16e3,this.maxSize=t.maxSize||1e6,this.buffers=[]}async read(t,e){let i=this.buffers.filter(i=>i.overlaps(t,t+e));for(let r of i)if(r.contains(t,t+e))return r.slice(t,t+e);if(0===i.length){let i=Math.max(e,this.fetchSize);this.buffers.sort((t,e)=>t.start-e.start);const r=function(t,e,i){let r=i-1,s=t.length;for(;1+r<s;){const i=r+(s-r>>1);e(t[i])?s=i:r=i}return s}(this.buffers,e=>e.start>t,0);r<this.buffers.length&&(i=Math.min(i,this.buffers[r].start-t));const s=t,o=await this.file.read(s,i),n=new hm(s,o);return this.addBuffer(n),n.slice(t,t+e)}{i.sort((t,e)=>t.start-e.start);const r=[];let s=t;for(let t of i){if(s<t.start){const e=s,i=t.start-s,o=await this.file.read(e,i),n=new hm(e,o);r.push(n)}r.push(t),s=t.end}const o=t+e;if(o>s){const t=s,e=o-t,i=await this.file.read(t,e),n=new hm(t,i);r.push(n)}const n=r[0].start,a=function(t){const e=t.reduce((t,e)=>t+e.byteLength,0),i=new Uint8Array(e);let r=0;for(let e of t)i.set(new Uint8Array(e),r),r+=e.byteLength;return i.buffer}(r.map(t=>t.buffer)),c=new hm(n,a),l=new Set(i);return this.buffers=this.buffers.filter(t=>!l.has(t)),this.addBuffer(c),c.slice(t,t+e)}}addBuffer(t){const e=this.buffers.reduce((t,e)=>t+e.size,0)+t.size;if(e>this.maxSize){const t=e-this.maxSize;this.buffers.sort((t,e)=>t.creationTime-e.creationTime);let i,r=0;for(i=0;i<this.buffers.length&&(r+=this.buffers[i].size,!(r>t));i++);this.buffers=i<this.buffers.length-1?this.buffers.slice(i):[]}t.size<=this.maxSize&&this.buffers.push(t)}}class hm{constructor(t,e){this.creationTime=Date.now(),this.start=t,this.buffer=e}slice(t,e){if(t<this.start||e-t>this.buffer.byteLength)throw Error("buffer bounds error");return this.buffer.slice(t-this.start,e-this.start)}get end(){return this.start+this.buffer.byteLength}get size(){return this.buffer.byteLength}contains(t,e){return t>=this.start&&e<=this.end}overlaps(t,e){return t>this.start&&t<this.end||e>this.start&&e<this.end}toString(){return`Buffer ${this.creationTime} ${this.start} - ${this.end}`}}class dm{constructor(t){this.file=t}async read(t,e){if(0===e)return new ArrayBuffer;return(null!=t&&e?this.file.slice(t,t+e):this.file).arrayBuffer()}}var um=Object.defineProperty,fm=(t,e,i)=>(((t,e,i)=>{e in t?um(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i})(t,"symbol"!=typeof e?e+"":e,i),i);async function pm(t,e,i=0){var r=new Map;for(let[s,o]of t.entries()){let t=await ym.unpack_from_async("<"+o,e,i);i+=ym.calcsize(o),1==t.length&&(t=t[0]),r.set(s,t)}return r}function gm(t,e,i=0){var r=new Map;for(let[s,o]of t.entries()){let t=ym.unpack_from("<"+o,e,i);i+=ym.calcsize(o),1==t.length&&(t=t[0]),r.set(s,t)}return r}function mm(t){t||t()}function wm(t){var e="<"+Array.from(t.values()).join("");return ym.calcsize(e)}function bm(t,e=8){return Math.ceil(t/e)*e}var Fm={u:"Uint",i:"Int",f:"Float"};function vm(t){var e,i,r=ym._is_big_endian(t);if(/S/.test(t))e="getString",i=0|((t.match(/S(\d*)/)||[])[1]||1);else{let[r,s,o]=t.match(/[<>=!@]?(i|u|f)(\d*)/);i=parseInt(o||4,10),e="get"+Fm[s]+(8*i).toFixed()}return[e,r,i]}var ym=new class{constructor(){this.big_endian=function(){const t=new Uint8Array(4);return!((new Uint32Array(t.buffer)[0]=1)&t[0])}(),this.getters={s:"getUint8",b:"getInt8",B:"getUint8",h:"getInt16",H:"getUint16",i:"getInt32",I:"getUint32",l:"getInt32",L:"getUint32",q:"getInt64",Q:"getUint64",f:"getFloat32",d:"getFloat64"},this.byte_lengths={s:1,b:1,B:1,h:2,H:2,i:4,I:4,l:4,L:4,q:8,Q:8,f:4,d:8};let t=Object.keys(this.byte_lengths).join("");this.fmt_size_regex="(\\d*)(["+t+"])"}calcsize(t){for(var e,i=0,r=new RegExp(this.fmt_size_regex,"g");null!==(e=r.exec(t));){let t=parseInt(e[1]||1,10),r=e[2];i+=t*this.byte_lengths[r]}return i}_is_big_endian(t){return!/^</.test(t)&&(!!/^(!|>)/.test(t)||this.big_endian)}async unpack_from_async(t,e,i){i=Number.parseInt(i||0);const r=this.calcsize(t),s=await e.slice(i,i+r);let o=0;for(var n,a=new Am(s),c=[],l=this._is_big_endian(t),h=new RegExp(this.fmt_size_regex,"g");null!==(n=h.exec(t));){let t=parseInt(n[1]||1,10),e=n[2],i=this.getters[e],r=this.byte_lengths[e];if("s"==e)c.push((new TextDecoder).decode(s.slice(o,o+t))),o+=t;else for(var d=0;d<t;d++)c.push(a[i](o,!l)),o+=r}return c}unpack_from(t,e,i){i=Number.parseInt(i||0);const r=this.calcsize(t),s=e.slice(i,i+r);let o=0;for(var n,a=new Am(s),c=[],l=this._is_big_endian(t),h=new RegExp(this.fmt_size_regex,"g");null!==(n=h.exec(t));){let t=parseInt(n[1]||1,10),e=n[2],i=this.getters[e],r=this.byte_lengths[e];if("s"==e)c.push((new TextDecoder).decode(s.slice(o,o+t))),o+=t;else for(var d=0;d<t;d++)c.push(a[i](o,!l)),o+=r}return c}};var Am=class extends DataView{getUint64(t,e){const i=BigInt(this.getUint32(t,e)),r=BigInt(this.getUint32(t+4,e));let s=e?i+(r<<32n):(i<<32n)+r;return Number.parseInt(s)}getInt64(t,e){var i,r;e?(i=this.getUint32(t,!0),r=this.getInt32(t+4,!0)):(r=this.getInt32(t,!1),i=this.getUint32(t+4,!1));let s=BigInt(i)+(BigInt(r)<<32n);return Number.parseInt(s)}getString(t,e,i){const r=this.buffer.slice(t,t+i);return(new TextDecoder).decode(r)}getVLENStruct(t,e,i){return[this.getUint32(t,e),this.getUint64(t+4,e),this.getUint32(t+12,e)]}};function Cm(t){return t.toString(2).length}function _m(t,e,i=0,r=!0){const s=e.slice(i,i+t);let o=new Uint8Array(s);r||o.reverse();let n=o.reduce((t,e,i)=>t+(e<<8*i),0);return n}var xm=class{constructor(t,e){this.buf=t,this.offset=e,this.dtype=this.determine_dtype()}async determine_dtype(){let t=await pm(km,this.buf,this.offset);this.offset+=Im;let e=15&t.get("class_and_version");if(e==Sm)return this._determine_dtype_fixed_point(t);if(e==Em)return this._determine_dtype_floating_point(t);if(e==Nm)throw"Time datatype class not supported.";if(e==Mm)return this._determine_dtype_string(t);if(e==Rm)throw"Bitfield datatype class not supported.";if(e==Dm)return{datatype_class:Dm,size:t.get("size")};if(e==Bm)return this._determine_dtype_compound(t);if(e==Tm)return["REFERENCE",t.get("size")];if(e==Lm)return this.determine_dtype();if(e==Pm)throw"Array datatype class not supported.";if(e==zm){let e=this._determine_dtype_vlen(t);if("VLEN_SEQUENCE"==e[0]){e=["VLEN_SEQUENCE",this.determine_dtype()]}return e}throw"Invalid datatype class "+e}_determine_dtype_fixed_point(t){let e=t.get("size");if(![1,2,4,8].includes(e))throw"Unsupported datatype size";var i;var r;return i=(8&t.get("class_bit_field_0"))>0?"i":"u",r=0==(1&t.get("class_bit_field_0"))?"<":">",this.offset+=4,r+i+e.toFixed()}_determine_dtype_floating_point(t){let e=t.get("size");if(![1,2,4,8].includes(e))throw"Unsupported datatype size";var i;return i=0==(1&t.get("class_bit_field_0"))?"<":">",this.offset+=12,i+"f"+e.toFixed()}_determine_dtype_string(t){return"S"+t.get("size").toFixed()}_determine_dtype_vlen(t){return 1!=(1&t.get("class_bit_field_0"))?["VLEN_SEQUENCE",0,0]:["VLEN_STRING",t.get("class_bit_field_0")>>4,1&t.get("class_bit_field_1")]}_determine_dtype_compound(t){throw"Compound type not yet implemented!"}},km=new Map([["class_and_version","B"],["class_bit_field_0","B"],["class_bit_field_1","B"],["class_bit_field_2","B"],["size","I"]]),Im=wm(km);wm(new Map([["offset","I"],["dimensionality","B"],["reserved_0","B"],["reserved_1","B"],["reserved_2","B"],["permutation","I"],["reserved_3","I"],["dim_size_1","I"],["dim_size_2","I"],["dim_size_3","I"],["dim_size_4","I"]]));var Sm=0,Em=1,Nm=2,Mm=3,Rm=4,Dm=5,Bm=6,Tm=7,Lm=8,zm=9,Pm=10;function Om(t){let e=t.length;for(;--e>=0;)t[e]=0}Om(new Array(576)),Om(new Array(60)),Om(new Array(512)),Om(new Array(256)),Om(new Array(29)),Om(new Array(30));var Hm=(t,e,i,r)=>{let s=65535&t,o=t>>>16&65535,n=0;for(;0!==i;){n=i>2e3?2e3:i,i-=n;do{s=s+e[r++]|0,o=o+s|0}while(--n);s%=65521,o%=65521}return s|o<<16},Um=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})()),Vm=(t,e,i,r)=>{const s=Um,o=r+i;t^=-1;for(let i=r;i<o;i++)t=t>>>8^s[255&(t^e[i])];return-1^t},qm={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Qm={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},Gm=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Wm=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)Gm(i,e)&&(t[e]=i[e])}}return t},jm=t=>{let e=0;for(let i=0,r=t.length;i<r;i++)e+=t[i].length;const i=new Uint8Array(e);for(let e=0,r=0,s=t.length;e<s;e++){let s=t[e];i.set(s,r),r+=s.length}return i},$m=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(rC){$m=!1}var Km=new Uint8Array(256);for(let sC=0;sC<256;sC++)Km[sC]=sC>=252?6:sC>=248?5:sC>=240?4:sC>=224?3:sC>=192?2:1;Km[254]=Km[254]=1;var Zm=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,i,r,s,o,n=t.length,a=0;for(s=0;s<n;s++)i=t.charCodeAt(s),55296==(64512&i)&&s+1<n&&(r=t.charCodeAt(s+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),s++)),a+=i<128?1:i<2048?2:i<65536?3:4;for(e=new Uint8Array(a),o=0,s=0;o<a;s++)i=t.charCodeAt(s),55296==(64512&i)&&s+1<n&&(r=t.charCodeAt(s+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),s++)),i<128?e[o++]=i:i<2048?(e[o++]=192|i>>>6,e[o++]=128|63&i):i<65536?(e[o++]=224|i>>>12,e[o++]=128|i>>>6&63,e[o++]=128|63&i):(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63,e[o++]=128|i>>>6&63,e[o++]=128|63&i);return e},Ym=(t,e)=>{const i=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let r,s;const o=new Array(2*i);for(s=0,r=0;r<i;){let e=t[r++];if(e<128){o[s++]=e;continue}let n=Km[e];if(n>4)o[s++]=65533,r+=n-1;else{for(e&=2===n?31:3===n?15:7;n>1&&r<i;)e=e<<6|63&t[r++],n--;n>1?o[s++]=65533:e<65536?o[s++]=e:(e-=65536,o[s++]=55296|e>>10&1023,o[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&$m)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let r=0;r<e;r++)i+=String.fromCharCode(t[r]);return i})(o,s)},Xm=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+Km[t[i]]>e?i:e};var Jm=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},tw=function(t,e){let i,r,s,o,n,a,c,l,h,d,u,f,p,g,m,w,b,F,v,y,A,C,_,x;const k=t.state;i=t.next_in,_=t.input,r=i+(t.avail_in-5),s=t.next_out,x=t.output,o=s-(e-t.avail_out),n=s+(t.avail_out-257),a=k.dmax,c=k.wsize,l=k.whave,h=k.wnext,d=k.window,u=k.hold,f=k.bits,p=k.lencode,g=k.distcode,m=(1<<k.lenbits)-1,w=(1<<k.distbits)-1;t:do{f<15&&(u+=_[i++]<<f,f+=8,u+=_[i++]<<f,f+=8),b=p[u&m];e:for(;;){if(F=b>>>24,u>>>=F,f-=F,F=b>>>16&255,0===F)x[s++]=65535&b;else{if(!(16&F)){if(64&F){if(32&F){k.mode=12;break t}t.msg="invalid literal/length code",k.mode=30;break t}b=p[(65535&b)+(u&(1<<F)-1)];continue e}for(v=65535&b,F&=15,F&&(f<F&&(u+=_[i++]<<f,f+=8),v+=u&(1<<F)-1,u>>>=F,f-=F),f<15&&(u+=_[i++]<<f,f+=8,u+=_[i++]<<f,f+=8),b=g[u&w];;){if(F=b>>>24,u>>>=F,f-=F,F=b>>>16&255,16&F){if(y=65535&b,F&=15,f<F&&(u+=_[i++]<<f,f+=8,f<F&&(u+=_[i++]<<f,f+=8)),y+=u&(1<<F)-1,y>a){t.msg="invalid distance too far back",k.mode=30;break t}if(u>>>=F,f-=F,F=s-o,y>F){if(F=y-F,F>l&&k.sane){t.msg="invalid distance too far back",k.mode=30;break t}if(A=0,C=d,0===h){if(A+=c-F,F<v){v-=F;do{x[s++]=d[A++]}while(--F);A=s-y,C=x}}else if(h<F){if(A+=c+h-F,F-=h,F<v){v-=F;do{x[s++]=d[A++]}while(--F);if(A=0,h<v){F=h,v-=F;do{x[s++]=d[A++]}while(--F);A=s-y,C=x}}}else if(A+=h-F,F<v){v-=F;do{x[s++]=d[A++]}while(--F);A=s-y,C=x}for(;v>2;)x[s++]=C[A++],x[s++]=C[A++],x[s++]=C[A++],v-=3;v&&(x[s++]=C[A++],v>1&&(x[s++]=C[A++]))}else{A=s-y;do{x[s++]=x[A++],x[s++]=x[A++],x[s++]=x[A++],v-=3}while(v>2);v&&(x[s++]=x[A++],v>1&&(x[s++]=x[A++]))}break}if(64&F){t.msg="invalid distance code",k.mode=30;break t}b=g[(65535&b)+(u&(1<<F)-1)]}}break}}while(i<r&&s<n);v=f>>3,i-=v,f-=v<<3,u&=(1<<f)-1,t.next_in=i,t.next_out=s,t.avail_in=i<r?r-i+5:5-(i-r),t.avail_out=s<n?n-s+257:257-(s-n),k.hold=u,k.bits=f},ew=15,iw=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),rw=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),sw=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),ow=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),nw=(t,e,i,r,s,o,n,a)=>{const c=a.bits;let l,h,d,u,f,p,g=0,m=0,w=0,b=0,F=0,v=0,y=0,A=0,C=0,_=0,x=null,k=0;const I=new Uint16Array(16),S=new Uint16Array(16);let E,N,M,R=null,D=0;for(g=0;g<=ew;g++)I[g]=0;for(m=0;m<r;m++)I[e[i+m]]++;for(F=c,b=ew;b>=1&&0===I[b];b--);if(F>b&&(F=b),0===b)return s[o++]=20971520,s[o++]=20971520,a.bits=1,0;for(w=1;w<b&&0===I[w];w++);for(F<w&&(F=w),A=1,g=1;g<=ew;g++)if(A<<=1,A-=I[g],A<0)return-1;if(A>0&&(0===t||1!==b))return-1;for(S[1]=0,g=1;g<ew;g++)S[g+1]=S[g]+I[g];for(m=0;m<r;m++)0!==e[i+m]&&(n[S[e[i+m]]++]=m);if(0===t?(x=R=n,p=19):1===t?(x=iw,k-=257,R=rw,D-=257,p=256):(x=sw,R=ow,p=-1),_=0,m=0,g=w,f=o,v=F,y=0,d=-1,C=1<<F,u=C-1,1===t&&C>852||2===t&&C>592)return 1;for(;;){E=g-y,n[m]<p?(N=0,M=n[m]):n[m]>p?(N=R[D+n[m]],M=x[k+n[m]]):(N=96,M=0),l=1<<g-y,h=1<<v,w=h;do{h-=l,s[f+(_>>y)+h]=E<<24|N<<16|M}while(0!==h);for(l=1<<g-1;_&l;)l>>=1;if(0!==l?(_&=l-1,_+=l):_=0,m++,0===--I[g]){if(g===b)break;g=e[i+n[m]]}if(g>F&&(_&u)!==d){for(0===y&&(y=F),f+=w,v=g-y,A=1<<v;v+y<b&&(A-=I[v+y],!(A<=0));)v++,A<<=1;if(C+=1<<v,1===t&&C>852||2===t&&C>592)return 1;d=_&u,s[d]=F<<24|v<<16|f-o}}return 0!==_&&(s[f+_]=g-y<<24|64<<16),a.bits=F,0},{Z_FINISH:aw,Z_BLOCK:cw,Z_TREES:lw,Z_OK:hw,Z_STREAM_END:dw,Z_NEED_DICT:uw,Z_STREAM_ERROR:fw,Z_DATA_ERROR:pw,Z_MEM_ERROR:gw,Z_BUF_ERROR:mw,Z_DEFLATED:ww}=Qm,bw=12,Fw=30,vw=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function yw(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var Aw,Cw,_w=t=>{if(!t||!t.state)return fw;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,hw},xw=t=>{if(!t||!t.state)return fw;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,_w(t)},kw=(t,e)=>{let i;if(!t||!t.state)return fw;const r=t.state;return e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?fw:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,xw(t))},Iw=(t,e)=>{if(!t)return fw;const i=new yw;t.state=i,i.window=null;const r=kw(t,e);return r!==hw&&(t.state=null),r},Sw=!0,Ew=t=>{if(Sw){Aw=new Int32Array(512),Cw=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(nw(1,t.lens,0,288,Aw,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;nw(2,t.lens,0,32,Cw,0,t.work,{bits:5}),Sw=!1}t.lencode=Aw,t.lenbits=9,t.distcode=Cw,t.distbits=5},Nw=(t,e,i,r)=>{let s;const o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(o.window.set(e.subarray(i-o.wsize,i),0),o.wnext=0,o.whave=o.wsize):(s=o.wsize-o.wnext,s>r&&(s=r),o.window.set(e.subarray(i-r,i-r+s),o.wnext),(r-=s)?(o.window.set(e.subarray(i-r,i),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0},Mw={inflateReset:xw,inflateReset2:kw,inflateResetKeep:_w,inflateInit:t=>Iw(t,15),inflateInit2:Iw,inflate:(t,e)=>{let i,r,s,o,n,a,c,l,h,d,u,f,p,g,m,w,b,F,v,y,A,C,_=0;const x=new Uint8Array(4);let k,I;const S=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return fw;i=t.state,i.mode===bw&&(i.mode=13),n=t.next_out,s=t.output,c=t.avail_out,o=t.next_in,r=t.input,a=t.avail_in,l=i.hold,h=i.bits,d=a,u=c,C=hw;t:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;h<16;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(2&i.wrap&&35615===l){i.check=0,x[0]=255&l,x[1]=l>>>8&255,i.check=Vm(i.check,x,2,0),l=0,h=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&l)<<8)+(l>>8))%31){t.msg="incorrect header check",i.mode=Fw;break}if((15&l)!==ww){t.msg="unknown compression method",i.mode=Fw;break}if(l>>>=4,h-=4,A=8+(15&l),0===i.wbits)i.wbits=A;else if(A>i.wbits){t.msg="invalid window size",i.mode=Fw;break}i.dmax=1<<i.wbits,t.adler=i.check=1,i.mode=512&l?10:bw,l=0,h=0;break;case 2:for(;h<16;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(i.flags=l,(255&i.flags)!==ww){t.msg="unknown compression method",i.mode=Fw;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=Fw;break}i.head&&(i.head.text=l>>8&1),512&i.flags&&(x[0]=255&l,x[1]=l>>>8&255,i.check=Vm(i.check,x,2,0)),l=0,h=0,i.mode=3;case 3:for(;h<32;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}i.head&&(i.head.time=l),512&i.flags&&(x[0]=255&l,x[1]=l>>>8&255,x[2]=l>>>16&255,x[3]=l>>>24&255,i.check=Vm(i.check,x,4,0)),l=0,h=0,i.mode=4;case 4:for(;h<16;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}i.head&&(i.head.xflags=255&l,i.head.os=l>>8),512&i.flags&&(x[0]=255&l,x[1]=l>>>8&255,i.check=Vm(i.check,x,2,0)),l=0,h=0,i.mode=5;case 5:if(1024&i.flags){for(;h<16;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}i.length=l,i.head&&(i.head.extra_len=l),512&i.flags&&(x[0]=255&l,x[1]=l>>>8&255,i.check=Vm(i.check,x,2,0)),l=0,h=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(f=i.length,f>a&&(f=a),f&&(i.head&&(A=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(r.subarray(o,o+f),A)),512&i.flags&&(i.check=Vm(i.check,r,f,o)),a-=f,o+=f,i.length-=f),i.length))break t;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===a)break t;f=0;do{A=r[o+f++],i.head&&A&&i.length<65536&&(i.head.name+=String.fromCharCode(A))}while(A&&f<a);if(512&i.flags&&(i.check=Vm(i.check,r,f,o)),a-=f,o+=f,A)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===a)break t;f=0;do{A=r[o+f++],i.head&&A&&i.length<65536&&(i.head.comment+=String.fromCharCode(A))}while(A&&f<a);if(512&i.flags&&(i.check=Vm(i.check,r,f,o)),a-=f,o+=f,A)break t}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;h<16;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(l!==(65535&i.check)){t.msg="header crc mismatch",i.mode=Fw;break}l=0,h=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=bw;break;case 10:for(;h<32;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}t.adler=i.check=vw(l),l=0,h=0,i.mode=11;case 11:if(0===i.havedict)return t.next_out=n,t.avail_out=c,t.next_in=o,t.avail_in=a,i.hold=l,i.bits=h,uw;t.adler=i.check=1,i.mode=bw;case bw:if(e===cw||e===lw)break t;case 13:if(i.last){l>>>=7&h,h-=7&h,i.mode=27;break}for(;h<3;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}switch(i.last=1&l,l>>>=1,h-=1,3&l){case 0:i.mode=14;break;case 1:if(Ew(i),i.mode=20,e===lw){l>>>=2,h-=2;break t}break;case 2:i.mode=17;break;case 3:t.msg="invalid block type",i.mode=Fw}l>>>=2,h-=2;break;case 14:for(l>>>=7&h,h-=7&h;h<32;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if((65535&l)!=(l>>>16^65535)){t.msg="invalid stored block lengths",i.mode=Fw;break}if(i.length=65535&l,l=0,h=0,i.mode=15,e===lw)break t;case 15:i.mode=16;case 16:if(f=i.length,f){if(f>a&&(f=a),f>c&&(f=c),0===f)break t;s.set(r.subarray(o,o+f),n),a-=f,o+=f,c-=f,n+=f,i.length-=f;break}i.mode=bw;break;case 17:for(;h<14;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(i.nlen=257+(31&l),l>>>=5,h-=5,i.ndist=1+(31&l),l>>>=5,h-=5,i.ncode=4+(15&l),l>>>=4,h-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=Fw;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;h<3;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}i.lens[S[i.have++]]=7&l,l>>>=3,h-=3}for(;i.have<19;)i.lens[S[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,k={bits:i.lenbits},C=nw(0,i.lens,0,19,i.lencode,0,i.work,k),i.lenbits=k.bits,C){t.msg="invalid code lengths set",i.mode=Fw;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;_=i.lencode[l&(1<<i.lenbits)-1],m=_>>>24,w=_>>>16&255,b=65535&_,!(m<=h);){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(b<16)l>>>=m,h-=m,i.lens[i.have++]=b;else{if(16===b){for(I=m+2;h<I;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(l>>>=m,h-=m,0===i.have){t.msg="invalid bit length repeat",i.mode=Fw;break}A=i.lens[i.have-1],f=3+(3&l),l>>>=2,h-=2}else if(17===b){for(I=m+3;h<I;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}l>>>=m,h-=m,A=0,f=3+(7&l),l>>>=3,h-=3}else{for(I=m+7;h<I;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}l>>>=m,h-=m,A=0,f=11+(127&l),l>>>=7,h-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=Fw;break}for(;f--;)i.lens[i.have++]=A}}if(i.mode===Fw)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=Fw;break}if(i.lenbits=9,k={bits:i.lenbits},C=nw(1,i.lens,0,i.nlen,i.lencode,0,i.work,k),i.lenbits=k.bits,C){t.msg="invalid literal/lengths set",i.mode=Fw;break}if(i.distbits=6,i.distcode=i.distdyn,k={bits:i.distbits},C=nw(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,k),i.distbits=k.bits,C){t.msg="invalid distances set",i.mode=Fw;break}if(i.mode=20,e===lw)break t;case 20:i.mode=21;case 21:if(a>=6&&c>=258){t.next_out=n,t.avail_out=c,t.next_in=o,t.avail_in=a,i.hold=l,i.bits=h,tw(t,u),n=t.next_out,s=t.output,c=t.avail_out,o=t.next_in,r=t.input,a=t.avail_in,l=i.hold,h=i.bits,i.mode===bw&&(i.back=-1);break}for(i.back=0;_=i.lencode[l&(1<<i.lenbits)-1],m=_>>>24,w=_>>>16&255,b=65535&_,!(m<=h);){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(w&&!(240&w)){for(F=m,v=w,y=b;_=i.lencode[y+((l&(1<<F+v)-1)>>F)],m=_>>>24,w=_>>>16&255,b=65535&_,!(F+m<=h);){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}l>>>=F,h-=F,i.back+=F}if(l>>>=m,h-=m,i.back+=m,i.length=b,0===w){i.mode=26;break}if(32&w){i.back=-1,i.mode=bw;break}if(64&w){t.msg="invalid literal/length code",i.mode=Fw;break}i.extra=15&w,i.mode=22;case 22:if(i.extra){for(I=i.extra;h<I;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}i.length+=l&(1<<i.extra)-1,l>>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;_=i.distcode[l&(1<<i.distbits)-1],m=_>>>24,w=_>>>16&255,b=65535&_,!(m<=h);){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(!(240&w)){for(F=m,v=w,y=b;_=i.distcode[y+((l&(1<<F+v)-1)>>F)],m=_>>>24,w=_>>>16&255,b=65535&_,!(F+m<=h);){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}l>>>=F,h-=F,i.back+=F}if(l>>>=m,h-=m,i.back+=m,64&w){t.msg="invalid distance code",i.mode=Fw;break}i.offset=b,i.extra=15&w,i.mode=24;case 24:if(i.extra){for(I=i.extra;h<I;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}i.offset+=l&(1<<i.extra)-1,l>>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=Fw;break}i.mode=25;case 25:if(0===c)break t;if(f=u-c,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=Fw;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),g=i.window}else g=s,p=n-i.offset,f=i.length;f>c&&(f=c),c-=f,i.length-=f;do{s[n++]=g[p++]}while(--f);0===i.length&&(i.mode=21);break;case 26:if(0===c)break t;s[n++]=i.length,c--,i.mode=21;break;case 27:if(i.wrap){for(;h<32;){if(0===a)break t;a--,l|=r[o++]<<h,h+=8}if(u-=c,t.total_out+=u,i.total+=u,u&&(t.adler=i.check=i.flags?Vm(i.check,s,u,n-u):Hm(i.check,s,u,n-u)),u=c,(i.flags?l:vw(l))!==i.check){t.msg="incorrect data check",i.mode=Fw;break}l=0,h=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;h<32;){if(0===a)break t;a--,l+=r[o++]<<h,h+=8}if(l!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=Fw;break}l=0,h=0}i.mode=29;case 29:C=dw;break t;case Fw:C=pw;break t;case 31:return gw;default:return fw}return t.next_out=n,t.avail_out=c,t.next_in=o,t.avail_in=a,i.hold=l,i.bits=h,(i.wsize||u!==t.avail_out&&i.mode<Fw&&(i.mode<27||e!==aw))&&Nw(t,t.output,t.next_out,u-t.avail_out),d-=t.avail_in,u-=t.avail_out,t.total_in+=d,t.total_out+=u,i.total+=u,i.wrap&&u&&(t.adler=i.check=i.flags?Vm(i.check,s,u,t.next_out-u):Hm(i.check,s,u,t.next_out-u)),t.data_type=i.bits+(i.last?64:0)+(i.mode===bw?128:0)+(20===i.mode||15===i.mode?256:0),(0===d&&0===u||e===aw)&&C===hw&&(C=mw),C},inflateEnd:t=>{if(!t||!t.state)return fw;let e=t.state;return e.window&&(e.window=null),t.state=null,hw},inflateGetHeader:(t,e)=>{if(!t||!t.state)return fw;const i=t.state;return 2&i.wrap?(i.head=e,e.done=!1,hw):fw},inflateSetDictionary:(t,e)=>{const i=e.length;let r,s,o;return t&&t.state?(r=t.state,0!==r.wrap&&11!==r.mode?fw:11===r.mode&&(s=1,s=Hm(s,e,i,0),s!==r.check)?pw:(o=Nw(t,e,i,i),o?(r.mode=31,gw):(r.havedict=1,hw))):fw},inflateInfo:"pako inflate (from Nodeca project)"};var Rw=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},Dw=Object.prototype.toString,{Z_NO_FLUSH:Bw,Z_FINISH:Tw,Z_OK:Lw,Z_STREAM_END:zw,Z_NEED_DICT:Pw,Z_STREAM_ERROR:Ow,Z_DATA_ERROR:Hw,Z_MEM_ERROR:Uw}=Qm;function Vw(t){this.options=Wm({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Jm,this.strm.avail_out=0;let i=Mw.inflateInit2(this.strm,e.windowBits);if(i!==Lw)throw new Error(qm[i]);if(this.header=new Rw,Mw.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Zm(e.dictionary):"[object ArrayBuffer]"===Dw.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=Mw.inflateSetDictionary(this.strm,e.dictionary),i!==Lw)))throw new Error(qm[i])}function qw(t,e){const i=new Vw(e);if(i.push(t),i.err)throw i.msg||qm[i.err];return i.result}Vw.prototype.push=function(t,e){const i=this.strm,r=this.options.chunkSize,s=this.options.dictionary;let o,n,a;if(this.ended)return!1;for(n=e===~~e?e:!0===e?Tw:Bw,"[object ArrayBuffer]"===Dw.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),o=Mw.inflate(i,n),o===Pw&&s&&(o=Mw.inflateSetDictionary(i,s),o===Lw?o=Mw.inflate(i,n):o===Hw&&(o=Pw));i.avail_in>0&&o===zw&&i.state.wrap>0&&0!==t[i.next_in];)Mw.inflateReset(i),o=Mw.inflate(i,n);switch(o){case Ow:case Hw:case Pw:case Uw:return this.onEnd(o),this.ended=!0,!1}if(a=i.avail_out,i.next_out&&(0===i.avail_out||o===zw))if("string"===this.options.to){let t=Xm(i.output,i.next_out),e=i.next_out-t,s=Ym(i.output,t);i.next_out=e,i.avail_out=r-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(o!==Lw||0!==a){if(o===zw)return o=Mw.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Vw.prototype.onData=function(t){this.chunks.push(t)},Vw.prototype.onEnd=function(t){t===Lw&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=jm(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Qw=function(t,e){return(e=e||{}).raw=!0,qw(t,e)},Gw={Inflate:Vw,inflate:qw,inflateRaw:Qw,ungzip:qw,constants:Qm},{Inflate:Ww,inflate:jw,inflateRaw:$w,ungzip:Kw}=Gw,Zw=jw,Yw=Kw;var Xw=new Map([[1,function(t,e){let i=new Uint8Array(t);return Zw(i).buffer}],[2,function(t,e){let i=t.byteLength,r=new Uint8Array(i),s=Math.floor(i/e),o=new DataView(t);for(var n=0;n<e;n++)for(var a=0;a<s;a++)r[n+a*e]=o.getUint8(n*s+a);return r.buffer}],[3,function(t,e){return function(t){for(var e=t.byteLength%2!=0,i=t.byteLength-4,r=new DataView(t),s=0,o=0,n=0;n<i-1;n+=2){o=(o+(s=(s+r.getUint16(n,!0))%65535))%65535}if(e){o=(o+(s=(s+r.getUint8(i-1))%65535))%65535}var[a,c]=ym.unpack_from(">HH",t,i);if(c%=65535,s!=(a%=65535)||o!=c)throw'ValueError("fletcher32 checksum invalid")'}(t),t.slice(0,-4)}]]),Jw=class{constructor(t,e){this.fh=t,this.offset=e,this.depth=null}async init(){this.all_nodes=new Map,await this._read_root_node(),await this._read_children()}async _read_children(){let t=this.depth;for(;t>0;){for(var e of this.all_nodes.get(t))for(var i of e.get("addresses"))this._add_node(await this._read_node(i,t-1));t--}}async _read_root_node(){let t=await this._read_node(this.offset,null);this._add_node(t),this.depth=t.get("node_level")}_add_node(t){let e=t.get("node_level");this.all_nodes.has(e)?this.all_nodes.get(e).push(t):this.all_nodes.set(e,[t])}async _read_node(t,e){let i=await this._read_node_header(t,e);return i.set("keys",[]),i.set("addresses",[]),i}async _read_node_header(t){throw"NotImplementedError: must define _read_node_header in implementation class"}},tb=class extends Jw{constructor(){super(...arguments),fm(this,"B_LINK_NODE",new Map([["signature","4s"],["node_type","B"],["node_level","B"],["entries_used","H"],["left_sibling","Q"],["right_sibling","Q"]]))}async _read_node_header(t,e){let i=await pm(this.B_LINK_NODE,this.fh,t);if(null!=e&&i.get("node_level")!=e)throw"node level does not match";return i}},eb=class extends tb{constructor(t,e){super(t,e),fm(this,"NODE_TYPE",0),this.ready=this.init()}async _read_node(t,e){let i=await this._read_node_header(t,e);t+=wm(this.B_LINK_NODE);let r=[],s=[],o=i.get("entries_used");for(var n=0;n<o;n++){let e=(await ym.unpack_from_async("<Q",this.fh,t))[0];t+=8;let i=(await ym.unpack_from_async("<Q",this.fh,t))[0];t+=8,r.push(e),s.push(i)}return r.push((await ym.unpack_from_async("<Q",this.fh,t))[0]),i.set("keys",r),i.set("addresses",s),i}symbol_table_addresses(){var t=[],e=this.all_nodes.get(0);for(var i of e)t=t.concat(i.get("addresses"));return t}},ib=class extends tb{constructor(t,e,i){super(t,e),fm(this,"NODE_TYPE",1),this.dims=i,this.ready=this.init()}async _read_node(t,e){let i=await this._read_node_header(t,e);t+=wm(this.B_LINK_NODE);var r=[],s=[];let o=i.get("entries_used");for(var n=0;n<o;n++){let[e,i]=await ym.unpack_from_async("<II",this.fh,t);t+=8;let o="<"+this.dims.toFixed()+"Q",n=ym.calcsize(o),a=await ym.unpack_from_async(o,this.fh,t);t+=n;let c=(await ym.unpack_from_async("<Q",this.fh,t))[0];t+=8,r.push(new Map([["chunk_size",e],["filter_mask",i],["chunk_offset",a]])),s.push(c)}return i.set("keys",r),i.set("addresses",s),i}async construct_data_from_chunks(t,e,i,r){var s,o,n;if(i instanceof Array){let t=i[0];if("REFERENCE"==t){if(8!=i[1])throw"NotImplementedError('Unsupported Reference type')";i="<u8",s="getUint64",o=!1,n=8}else{if("VLEN_STRING"!=t&&"VLEN_SEQUENCE"!=t)throw"NotImplementedError('datatype not implemented')";s="getVLENStruct",o=!1,n=16}}else[s,o,n]=vm(i);var a=e.reduce(function(t,e){return t*e},1),c=t.reduce(function(t,e){return t*e},1);let l=e.length;var h=1;t.slice().map(function(t){let e=h;return h*=t,e});h=1;var d=e.slice().reverse().map(function(t){let e=h;return h*=t,e}).reverse(),u=new Array(a);let f=c*n;for(var p of this.all_nodes.get(0)){let i=p.get("keys"),a=p.get("addresses"),h=i.length;for(var g=0;g<h;g++){let h=i[g],p=a[g];var m;if(null==r)m=await this.fh.slice(p,p+f);else{m=await this.fh.slice(p,p+h.get("chunk_size"));let t=h.get("filter_mask");m=this._filter_chunk(m,t,r,n)}for(var w=h.get("chunk_offset").slice(),b=w.slice(),F=b.map(function(){return 0}),v=new Am(m),y=0;y<c;y++){for(var A=l-1;A>=0&&F[A]>=t[A];A--)F[A]=0,b[A]=w[A],A>0&&(F[A-1]+=1,b[A-1]+=1);if(b.slice(0,-1).every(function(t,i){return t<e[i]})){let t=y*n,e=v[s](t,!o,n),i=b.slice(0,-1).reduce(function(t,e,i){return e*d[i]+t},0);u[i]=e}F[l-1]+=1,b[l-1]+=1}}}return u}_filter_chunk(t,e,i,r){let s=i.length,o=t.slice();for(var n=s-1;n>=0;n--){if(e&1<<n)continue;let t=i[n],s=t.get("filter_id"),a=t.get("client_data");if(!Xw.has(s))throw'NotImplementedError("Filter with id:'+s.toFixed()+' not supported")';o=Xw.get(s)(o,r,a)}return o}},rb=class extends Jw{constructor(t,e){super(t,e),fm(this,"B_TREE_HEADER",new Map([["signature","4s"],["version","B"],["node_type","B"],["node_size","I"],["record_size","H"],["depth","H"],["split_percent","B"],["merge_percent","B"],["root_address","Q"],["root_nrecords","H"],["total_nrecords","Q"]])),fm(this,"B_LINK_NODE",new Map([["signature","4s"],["version","B"],["node_type","B"]])),this.ready=this.init()}async _read_root_node(){let t=await this._read_tree_header(this.offset);this.address_formats=this._calculate_address_formats(t),this.header=t,this.depth=t.get("depth");let e=[t.get("root_address"),t.get("root_nrecords"),t.get("total_nrecords")],i=await this._read_node(e,this.depth);this._add_node(i)}async _read_tree_header(t){return await pm(this.B_TREE_HEADER,this.fh,this.offset)}_calculate_address_formats(t){let e=t.get("node_size"),i=t.get("record_size"),r=0,s=0,o=new Map,n=t.get("depth");for(var a=0;a<=n;a++){let t,c,l,h="",d="",u="";if(0==a?(t=0,c=0,l=0):1==a?(t=8,h="<Q",c=this._required_bytes(r),d=this._int_format(c),l=0):(t=8,h="<Q",c=this._required_bytes(r),d=this._int_format(c),l=this._required_bytes(s),u=this._int_format(l)),o.set(a,[t,c,l,h,d,u]),a<n){let o=t+c+l;r=this._nrecords_max(e,i,o),s>0?s*=r:s=r}}return o}_nrecords_max(t,e,i){return Math.floor((t-10-i)/(e+i))}_required_bytes(t){return Math.ceil(Cm(t)/8)}_int_format(t){return["<B","<H","<I","<Q"][t-1]}async _read_node(t,e){let[i,r,s]=t,o=this._read_node_header(i,e);i+=wm(this.B_LINK_NODE);let n=this.header.get("record_size"),a=[];for(let t=0;t<r;t++){let t=await this._parse_record(this.fh,i,n);i+=n,a.push(t)}let c=[],l=this.address_formats.get(e);if(0!=e){let[t,e,s,o,n,a]=l;for(let l=0;l<=r;l++){let r=(await ym.unpack_from_async(o,this.fh,i))[0];i+=t;let l=(await ym.unpack_from_async(n,this.fh,i))[0];i+=e;let h=l;s>0&&(h=(await ym.unpack_from_async(a,this.fh,i))[0],i+=s),c.push([r,l,h])}}return o.set("keys",a),o.set("addresses",c),o}async _read_node_header(t,e){let i=await pm(this.B_LINK_NODE,this.fh,t);return i.set("node_level",e),i}*iter_records(){for(let t of this.all_nodes.values())for(let e of t)for(let t of e.get("keys"))yield t}_parse_record(t){throw"NotImplementedError"}},sb=class extends rb{constructor(){super(...arguments),fm(this,"NODE_TYPE",5)}async _parse_record(t,e,i){let r=(await ym.unpack_from_async("<I",t,e))[0];e+=4;const s=await t.slice(e,e+7);return new Map([["namehash",r],["heapid",s]])}},ob=class extends rb{constructor(){super(...arguments),fm(this,"NODE_TYPE",6)}async _parse_record(t,e,i){let r=(await ym.unpack_from_async("<Q",t,e))[0];e+=8;const s=await t.slice(e,e+7);return new Map([["creationorder",r],["heapid",s]])}},nb=class{constructor(t,e){this.ready=this.init(t,e)}async init(t,e){let i=await ym.unpack_from_async("<B",t,e+8);var r;if(0==i)r=await pm(fb,t,e),this._end_of_sblock=e+pb;else{if(2!=i&&3!=i)throw"unsupported superblock version: "+i.toFixed();r=await pm(gb,t,e),this._end_of_sblock=e+mb}if(r.get("format_signature")!=db)throw"Incorrect file signature: "+r.get("format_signature");if(8!=r.get("offset_size")||8!=r.get("length_size"))throw"File uses non-64-bit addressing";this.version=r.get("superblock_version"),this._contents=r,this._root_symbol_table=null,this._fh=t}async get_offset_to_dataobjects(){if(0==this.version){var t=new cb(this._fh,this._end_of_sblock,!0);return await t.ready,this._root_symbol_table=t,t.group_offset}if(2==this.version||3==this.version)return this._contents.get("root_group_address");throw"Not implemented version = "+this.version.toFixed()}},ab=class{constructor(t,e){this.ready=this.init(t,e)}async init(t,e){let i=await pm(yb,t,e);mm("HEAP"==i.get("signature")),mm(0==i.get("version"));let r=i.get("address_of_data_segment"),s=await t.slice(r,r+i.get("data_segment_size"));i.set("heap_data",s),this._contents=i,this.data=s}get_object_name(t){let e=new Uint8Array(this.data).indexOf(0,t)-t;return ym.unpack_from("<"+e.toFixed()+"s",this.data,t)[0]}},cb=class{constructor(t,e,i=!1){this.ready=this.init(t,e,i)}async init(t,e,i){var r;if(i)r=new Map([["symbols",1]]);else{if("SNOD"!=(r=await pm(Fb,t,e)).get("signature"))throw"incorrect node type";e+=vb}for(var s=[],o=r.get("symbols"),n=0;n<o;n++)s.push(await pm(wb,t,e)),e+=bb;return i&&(this.group_offset=s[0].get("object_header_address")),this.entries=s,this._contents=r,this}assign_name(t){this.entries.forEach(function(e){let i=e.get("link_name_offset"),r=t.get_object_name(i);e.set("link_name",r)})}get_links(t){var e={};return this.entries.forEach(function(i){let r=i.get("cache_type"),s=i.get("link_name");if(0==r||1==r)e[s]=i.get("object_header_address");else if(2==r){let r=i.get("scratch"),n=new ArrayBuffer(4),a=new Uint8Array(n);for(var o=0;o<4;o++)a[o]=r.charCodeAt(o);let c=ym.unpack_from("<I",n,0)[0];e[s]=t.get_object_name(c)}}),e}},lb=class{constructor(t,e){this.ready=this.init(t,e)}async init(t,e){let i=await pm(Ab,t,e);e+=Cb;let r=i.get("collection_size")-Cb,s=await t.slice(e,e+r);this.heap_data=s,this._header=i,this._objects=null}get objects(){if(null==this._objects){this._objects=new Map;for(var t=0;t<=this.heap_data.byteLength-xb;){let e=gm(_b,this.heap_data,t);if(0==e.get("object_index"))break;t+=xb;let i=this.heap_data.slice(t,t+e.get("object_size"));this._objects.set(e.get("object_index"),i),t+=bm(e.get("object_size"))}}return this._objects}},hb=class{constructor(t,e){this.fh=t,this.ready=this.init(e)}async init(t){let e=await pm(kb,this.fh,t);if(t+=wm(kb),mm("FRHP"==e.get("signature")),mm(0==e.get("version")),e.get("filter_info_size")>0)throw"Filter info size not supported on FractalHeap";if(e.get("btree_address_huge_objects")!=ub)throw"Huge objects not implemented in FractalHeap";e.set("btree_address_huge_objects",null),e.get("root_block_address")==ub&&e.set("root_block_address",null);let i=e.get("log2_maximum_heap_size"),r=this._min_size_nbits(i),s=new Map([["signature","4s"],["version","B"],["heap_header_adddress","Q"],["block_offset",`${r}B`]]);this.indirect_block_header=new Map(s),this.indirect_block_header_size=wm(s),2&~e.get("flags")||s.set("checksum","I"),this.direct_block_header=s,this.direct_block_header_size=wm(s);let o=e.get("maximum_direct_block_size");this._managed_object_offset_size=this._min_size_nbits(i);let n=Math.min(o,e.get("max_managed_object_size"));this._managed_object_length_size=this._min_size_integer(n);let a=e.get("starting_block_size"),c=e.get("table_width");if(!(a>0))throw"Starting block size == 0 not implemented";let l=Number(Math.floor(Math.log2(o)));mm(1n<<BigInt(l)==o);let h=Number(Math.floor(Math.log2(a)));mm(1n<<BigInt(h)==a),this._max_direct_nrows=l-h+2;let d=Math.floor(Math.log2(c));mm(1<<d==c),this._indirect_nrows_sub=d+h-1,this.header=e,this.nobjects=e.get("managed_object_count")+e.get("huge_object_count")+e.get("tiny_object_count");let u=[],f=e.get("root_block_address"),p=0;if(null!=f&&(p=e.get("indirect_current_rows_count")),p>0)for await(let t of this._iter_indirect_block(this.fh,f,p))u.push(t);else{let t=await this._read_direct_block(this.fh,f,a);u.push(t)}let g=u.reduce((t,e)=>t+e.byteLength,0),m=new Uint8Array(g),w=0;u.forEach(t=>{m.set(new Uint8Array(t),w),w+=t.byteLength}),this.managed=m.buffer}async _read_direct_block(t,e,i){let r=await t.slice(e,e+i);return mm("FHDB"==gm(this.direct_block_header,r).get("signature")),r}get_data(t){let e=ym.unpack_from("<B",t,0)[0],i=e>>4&3,r=1;if(0==i){mm(0==e>>6);let i=this._managed_object_offset_size,s=_m(i,t,r);r+=i,i=this._managed_object_length_size;let o=_m(i,t,r);return this.managed.slice(s,s+o)}throw 1==i?"tiny objectID not supported in FractalHeap":2==i?"huge objectID not supported in FractalHeap":"unknown objectID type in FractalHeap"}_min_size_integer(t){return this._min_size_nbits(Cm(t))}_min_size_nbits(t){return Math.ceil(t/8)}async*_iter_indirect_block(t,e,i){let r=await pm(this.indirect_block_header,t,e);e+=this.indirect_block_header_size,mm("FHIB"==r.get("signature"));let s=r.get("block_offset").reduce((t,e,i)=>t+(e<<8*i),0);r.set("block_offset",s);let[o,n]=this._indirect_info(i),a=[];for(let i=0;i<o;i++){let r=(await ym.unpack_from_async("<Q",t,e))[0];if(e+=8,r==ub)break;let s=this._calc_block_size(i);a.push([r,s])}let c=[];for(let i=o;i<o+n;i++){let r=(await ym.unpack_from_async("<Q",t,e))[0];if(e+=8,r==ub)break;let s=this._calc_block_size(i),o=this._iblock_nrows_from_block_size(s);c.push([r,o])}for(let[e,i]of a){let r=await this._read_direct_block(t,e,i);yield r}for(let[e,i]of c)for await(let r of this._iter_indirect_block(t,e,i))yield r}_calc_block_size(t){let e=Math.floor(t/this.header.get("table_width"));return 2**Math.max(e-1,0)*this.header.get("starting_block_size")}_iblock_nrows_from_block_size(t){let e=Math.floor(Math.log2(t));return mm(2**e==t),e-this._indirect_nrows_sub}_indirect_info(t){let e,i,r=this.header.get("table_width"),s=t*r,o=this._max_direct_nrows*r;return t<=o?(e=s,i=0):(e=o,i=s-o),[e,i]}_int_format(t){return["B","H","I","Q"][t-1]}},db=ym.unpack_from("8s",new Uint8Array([137,72,68,70,13,10,26,10]).buffer)[0],ub=ym.unpack_from("<Q",new Uint8Array([255,255,255,255,255,255,255,255]).buffer)[0],fb=new Map([["format_signature","8s"],["superblock_version","B"],["free_storage_version","B"],["root_group_version","B"],["reserved_0","B"],["shared_header_version","B"],["offset_size","B"],["length_size","B"],["reserved_1","B"],["group_leaf_node_k","H"],["group_internal_node_k","H"],["file_consistency_flags","L"],["base_address_lower","Q"],["free_space_address","Q"],["end_of_file_address","Q"],["driver_information_address","Q"]]),pb=wm(fb),gb=new Map([["format_signature","8s"],["superblock_version","B"],["offset_size","B"],["length_size","B"],["file_consistency_flags","B"],["base_address","Q"],["superblock_extension_address","Q"],["end_of_file_address","Q"],["root_group_address","Q"],["superblock_checksum","I"]]),mb=wm(gb),wb=new Map([["link_name_offset","Q"],["object_header_address","Q"],["cache_type","I"],["reserved","I"],["scratch","16s"]]),bb=wm(wb),Fb=new Map([["signature","4s"],["version","B"],["reserved_0","B"],["symbols","H"]]),vb=wm(Fb),yb=new Map([["signature","4s"],["version","B"],["reserved","3s"],["data_segment_size","Q"],["offset_to_free_list","Q"],["address_of_data_segment","Q"]]),Ab=new Map([["signature","4s"],["version","B"],["reserved","3s"],["collection_size","Q"]]),Cb=wm(Ab),_b=new Map([["object_index","H"],["reference_count","H"],["reserved","I"],["object_size","Q"]]),xb=wm(_b),kb=new Map([["signature","4s"],["version","B"],["object_index_size","H"],["filter_info_size","H"],["flags","B"],["max_managed_object_size","I"],["next_huge_object_index","Q"],["btree_address_huge_objects","Q"],["managed_freespace_size","Q"],["freespace_manager_address","Q"],["managed_space_size","Q"],["managed_alloc_size","Q"],["next_directblock_iterator_address","Q"],["managed_object_count","Q"],["huge_objects_total_size","Q"],["huge_object_count","Q"],["tiny_objects_total_size","Q"],["tiny_object_count","Q"],["table_width","H"],["starting_block_size","Q"],["maximum_direct_block_size","Q"],["log2_maximum_heap_size","H"],["indirect_starting_rows_count","H"],["root_block_address","Q"],["indirect_current_rows_count","H"]]),Ib=class{constructor(t,e){this.ready=this.init(t,e)}async init(t,e){let i=(await ym.unpack_from_async("<B",t,e))[0];if(1==i)var[r,s,o]=await this._parse_v1_objects(t,e);else{if(i!="O".charCodeAt(0))throw"InvalidHDF5File('unknown Data Object Header')";var[r,s,o]=await this._parse_v2_objects(t,e)}this.fh=t,this.msgs=r,this.msg_data=s,this.offset=e,this._global_heaps={},this._header=o,this._filter_pipeline=null,this._chunk_params_set=!1,this._chunks=null,this._chunk_dims=null,this._chunk_address=null}get dtype(){let t=this.find_msg_type(eF)[0].get("offset_to_message");return new xm(this.fh,t).dtype}get chunks(){return this._get_chunk_params().then(()=>this._chunks)}get shape(){let t=this.find_msg_type(Jb)[0].get("offset_to_message");return async function(t,e){let i=(await ym.unpack_from_async("<B",t,e))[0];var r;if(1==i)mm(1==(r=await pm(Lb,t,e)).get("version")),e+=zb;else{if(2!=i)throw"InvalidHDF5File('unknown dataspace message version')";mm(2==(r=await pm(Pb,t,e)).get("version")),e+=Ob}let s=r.get("dimensionality");return(await ym.unpack_from_async("<"+(2*s).toFixed()+"I",t,e)).filter(function(t,e){return e%2==0})}(this.fh,t)}async get_filter_pipeline(){if(null!=this._filter_pipeline)return this._filter_pipeline;let t=this.find_msg_type(oF);if(!t.length)return this._filter_pipeline=null,this._filter_pipeline;var e=t[0].get("offset_to_message");let[i,r]=await ym.unpack_from_async("<BB",this.fh,e);e+=ym.calcsize("<BB");var s=[];if(1==i){await ym.unpack_from_async("<HI",this.fh,e),e+=ym.calcsize("<HI");for(var o=0;o<r;o++){let t=await pm(Yb,this.fh,e);e+=Xb;let i=bm(t.get("name_length"),8),r="<"+i.toFixed()+"s",o=(await ym.unpack_from_async(r,this.fh,e))[0];t.set("filter_name",o),e+=i,r="<"+t.get("client_data_values").toFixed()+"I";let n=await ym.unpack_from_async(r,this.fh,e);t.set("client_data",n),e+=4*t.get("client_data_values"),t.get("client_data_values")%2&&(e+=4),s.push(t)}}else{if(2!=i)throw`version ${i} is not supported`;for(let t=0;t<r;t++){let t=new Map,i=this.fh,r=(await ym.unpack_from_async("<H",i,e))[0];e+=2,t.set("filter_id",r);let o=0;r>255&&(o=(await ym.unpack_from_async("<H",i,e))[0],e+=2);let n=(await ym.unpack_from_async("<H",i,e))[0];e+=2;let a=(1&n)>0;t.set("optional",a);let c,l=(await ym.unpack_from_async("<H",i,e))[0];e+=2,o>0&&(c=(await ym.unpack_from_async(`${o}s`,i,e))[0],e+=o),t.set("name",c);let h=await ym.unpack_from_async(`<${l}i`,i,e);e+=4*l,t.set("client_data_values",h),s.push(t)}}return this._filter_pipeline=s,this._filter_pipeline}find_msg_type(t){return this.msgs.filter(function(e){return e.get("type")==t})}async get_attributes(){let t={},e=this.find_msg_type(nF);for(let i of e){let e=i.get("offset_to_message"),[r,s]=await this.unpack_attribute(e);t[r]=s}return t}async get_fillvalue(){var t,e=this.find_msg_type(iF)[0].get("offset_to_message");let i=(await ym.unpack_from_async("<B",this.fh,e))[0];var r,s,o;if(1==i||2==i)r=await pm(jb,this.fh,e),e+=$b,t=r.get("fillvalue_defined");else{if(3!=i)throw'InvalidHDF5File("Unknown fillvalue msg version: "'+String(i);r=await pm(Kb,this.fh,e),e+=Zb,t=32&r.get("flags")}if(t?(s=(await ym.unpack_from_async("<I",this.fh,e))[0],e+=4):s=0,s){let[t,i,r]=vm(await this.dtype);o=new Am(await this.fh.slice(e,e+r))[t](e,!i,r)}else o=0;return o}async unpack_attribute(t){let e=(await ym.unpack_from_async("<B",this.fh,t))[0];var i,r;if(1==e)mm(1==(i=await pm(Nb,this.fh,t)).get("version")),t+=Mb,r=8;else{if(3!=e)throw"unsupported attribute message version: "+e;mm(3==(i=await pm(Rb,this.fh,t)).get("version")),t+=Db,r=1}let s=i.get("name_size"),o=(await ym.unpack_from_async("<"+s.toFixed()+"s",this.fh,t))[0];var n;o=o.replace(/\x00$/,""),t+=bm(s,r);try{n=await new xm(this.fh,t).dtype}catch(t){return console.warn("Attribute "+o+" type not implemented, set to null."),[o,null]}t+=bm(i.get("datatype_size"),r);let a=await this.determine_data_shape(this.fh,t),c=a.reduce(function(t,e){return t*e},1);if(t+=bm(i.get("dataspace_size"),r),5===n.datatype_class)l=await this.fh.slice(t,t+n.size);else{var l=await this._attr_value(n,this.fh,c,t);0==a.length&&(l=l[0])}return[o,l]}async determine_data_shape(t,e){let i=(await ym.unpack_from_async("<B",t,e))[0];var r;if(1==i)mm(1==(r=await pm(Lb,t,e)).get("version")),e+=zb;else{if(2!=i)throw"unknown dataspace message version";mm(2==(r=await pm(Pb,t,e)).get("version")),e+=Ob}let s=r.get("dimensionality");return await ym.unpack_from_async("<"+s.toFixed()+"Q",t,e)}async _attr_value(t,e,i,r){var s=new Array(i);if(t instanceof Array){let l=t[0];for(var o=0;o<i;o++)if("VLEN_STRING"==l){let i=t[2];var[n,a]=await this._vlen_size_and_data(e,r);const c=new TextDecoder(0==i?"ascii":"utf-8");s[o]=c.decode(a),r+=16}else if("REFERENCE"==l){var c=await ym.unpack_from_async("<Q",e,r);s[o]=c,r+=8}else{if("VLEN_SEQUENCE"!=l)throw"NotImplementedError";{let i=t[1];var[n,a]=this._vlen_size_and_data(e,r);s[o]=this._attr_value(i,a,n,0),r+=16}}}else{let[n,a,c]=vm(t);const l=await e.slice(r,r+i*c);let h=new Am(l,0),d=0;for(o=0;o<i;o++)s[o]=h[n](d,!a,c),d+=c}return s}async _vlen_size_and_data(t,e){let i=(await ym.unpack_from_async("<I",t,e))[0],r=await pm(Eb,t,e+4),s=r.get("collection_address");var o;return mm(r.get("collection_address")<Number.MAX_SAFE_INTEGER),s in this._global_heaps||(o=new lb(this.fh,s),await o.ready,this._global_heaps[s]=o),[i,(o=this._global_heaps[s]).objects.get(r.get("object_index"))]}async _parse_v1_objects(t,e){let i=await pm(Bb,t,e);mm(1==i.get("version"));let r=i.get("total_header_messages");for(var s=i.get("object_header_size"),o=e+wm(Bb),n=await t.slice(o,o+s),a=[[o,s]],c=0,l=0,h=new Array(r),d=0;d<r;d++){l>=s&&([o,s]=a[++c],l=0);let e=await pm(Hb,t,o+l),i=o+l+Ub;if(e.set("offset_to_message",i),e.get("type")==aF){var[u,f]=await ym.unpack_from_async("<QQ",t,i);a.push([u,f])}l+=Ub+e.get("size"),h[d]=e}return[h,n,i]}async _parse_v2_objects(t,e){var[i,r,s]=await this._parse_v2_header(t,e);e=s;for(var o=[],n=i.get("size_of_chunk_0"),a=t.slice(e,e+=n),c=[[s,n]],l=0,h=0;;){if(h>=n-qb){let t=c[++l];if(null==t)break;[s,n]=t,h=0}let e=await pm(Vb,t,s+h),i=s+h+qb+r;if(e.set("offset_to_message",i),e.get("type")==aF){var[d,u]=await ym.unpack_from_async("<QQ",t,i);c.push([d+4,u-4])}h+=qb+e.get("size")+r,o.push(e)}return[o,a,i]}async _parse_v2_header(t,e){let i=await pm(Tb,t,e);var r;if(e+=wm(Tb),mm(2==i.get("version")),r=4&i.get("flags")?2:0,mm(!(16&i.get("flags"))),32&i.get("flags")){let r=await ym.unpack_from_async("<4I",t,e);e+=16,i.set("access_time",r[0]),i.set("modification_time",r[1]),i.set("change_time",r[2]),i.set("birth_time",r[3])}let s=["<B","<H","<I","<Q"][3&i.get("flags")];return i.set("size_of_chunk_0",(await ym.unpack_from_async(s,t,e))[0]),[i,r,e+=ym.calcsize(s)]}async find_link(t){if(this._links){for(link of this._links)if(t===link[0])return link}else{const e=[];for await(const i of this.iter_links()){if(t===i[0])return i;e.push(i)}this._links=e}}async get_links(){const t=[];for await(const e of this.iter_links())t.push(e);return Object.fromEntries(t)}async*iter_links(){for(let t of this.msgs)t.get("type")==cF?yield*this._iter_links_from_symbol_tables(t):t.get("type")==rF?yield this._get_link_from_link_msg(t):t.get("type")==tF&&(yield*this._iter_link_from_link_info_msg(t))}async*_iter_links_from_symbol_tables(t){mm(16==t.get("size"));let e=await pm(Qb,this.fh,t.get("offset_to_message"));yield*this._iter_links_btree_v1(e.get("btree_address"),e.get("heap_address"))}async*_iter_links_btree_v1(t,e){let i=new eb(this.fh,t);await i.ready;let r=new ab(this.fh,e);await r.ready;for(let t of i.symbol_table_addresses()){let e=new cb(this.fh,t);await e.ready,e.assign_name(r),yield*Object.entries(e.get_links(r))}}async _get_link_from_link_msg(t){let e=t.get("offset_to_message");return await this._decode_link_msg(this.fh,e)[1]}async _decode_link_msg(t,e){let[i,r]=await ym.unpack_from_async("<BB",t,e);e+=2,mm(1==i);let s,o,n=2**(3&r),a=(16&r)>0,c=(4&r)>0;(8&r)>0?(s=(await ym.unpack_from_async("<B",t,e))[0],e+=1):s=0,mm([0,1].includes(s)),c&&(o=(await ym.unpack_from_async("<Q",t,e))[0],e+=8);let l=0;a&&(l=(await ym.unpack_from_async("<B",t,e))[0],e+=1);let h=0==l?"ascii":"utf-8",d=["<B","<H","<I","<Q"][3&r],u=(await ym.unpack_from_async(d,t,e))[0];e+=n;let f,p=new TextDecoder(h).decode(await t.slice(e,e+u));if(e+=u,0==s)f=(await ym.unpack_from_async("<Q",t,e))[0];else if(1==s){let i=(await ym.unpack_from_async("<H",t,e))[0];e+=2,f=new TextDecoder(h).decode(await t.slice(e,e+i))}return[o,[p,f]]}async*_iter_link_from_link_info_msg(t){let e=t.get("offset_to_message"),i=await this._decode_link_info_msg(this.fh,e),r=i.get("heap_address"),s=i.get("name_btree_address"),o=i.get("order_btree_address");null!=s&&(yield*this._iter_links_btree_v2(s,o,r))}async*_iter_links_btree_v2(t,e,i){let r,s=new hb(this.fh,i);await s.ready;const o=null!=e;o?(r=new ob(this.fh,e),await r.ready):(r=new sb(this.fh,t),await r.ready);let n=new Map;for(let t of r.iter_records()){let e=s.get_data(t.get("heapid")),[i,r]=await this._decode_link_msg(e,0);const a=o?i:r[0];n.set(a,r)}let a=Array.from(n.keys()).sort();for(let t of a)yield n.get(t)}async _decode_link_info_msg(t,e){let[i,r]=await ym.unpack_from_async("<BB",t,e);mm(0==i),e+=2,(1&r)>0&&(e+=8);let s=(2&r)>0?Wb:Gb,o=await pm(s,t,e),n=new Map;for(let[t,e]of o.entries())n.set(t,e==Sb?null:e);return n}get is_dataset(){return this.find_msg_type(Jb).length>0}async get_data(){let t=this.find_msg_type(sF)[0].get("offset_to_message");var[e,i,r,s]=await this._get_data_message_properties(t);if(0==r)throw"Compact storage of DataObject not implemented";return 1==r?this._get_contiguous_data(s):2==r?this._get_chunked_data(t):void 0}async _get_data_message_properties(t){let e,i,r,[s,o,n]=await ym.unpack_from_async("<BBB",this.fh,t);return 1==s||2==s?(e=o,i=n,r=t,r+=ym.calcsize("<BBB"),r+=ym.calcsize("<BI"),mm(1==i||2==i)):3!=s&&4!=s||(i=o,r=t,r+=ym.calcsize("<BB")),mm(s>=1&&s<=4),[s,e,i,r]}async _get_contiguous_data(t){let[e]=await ym.unpack_from_async("<Q",this.fh,t);const i=await this.shape,r=await this.dtype;if(e==Sb){let t=i.reduce(function(t,e){return t*e},1);return new Array(t)}var s=i.reduce(function(t,e){return t*e},1);if(r instanceof Array){let t=r[0];if("REFERENCE"==t){if(8!=r[1])throw"NotImplementedError('Unsupported Reference type')";return await this.fh.slice(e,e+s)}if("VLEN_STRING"==t){let t=r[2];const i=new TextDecoder(0==t?"ascii":"utf-8");var o=[];for(n=0;n<s;n++){const[t,r]=await this._vlen_size_and_data(this.fh,e);o[n]=i.decode(r),e+=16}return o}throw"NotImplementedError('datatype not implemented')"}if(/[<>=!@\|]?(i|u|f|S)(\d*)/.test(r)){let[t,i,o]=vm(r),a=new Array(s);const c=await this.fh.slice(e,e+o*s);let l=new Am(c);for(var n=0;n<s;n++)a[n]=l[t](n*o,!i,o);return a}if(5===r.datatype_class)return this.fh.slice(e,e+r.size);throw"not Implemented - no proper dtype defined"}async _get_chunked_data(t){if(await this._get_chunk_params(),this._chunk_address==Sb)return[];var e=new ib(this.fh,this._chunk_address,this._chunk_dims);await e.ready;const i=await this.dtype,r=await this.shape,s=await this.chunks,o=await this.get_filter_pipeline();let n=await e.construct_data_from_chunks(s,r,i,o);if(i instanceof Array&&/^VLEN/.test(i[0])){let t=i[0];for(var a=0;a<n.length;a++){let[e,r,s]=n[a];var c;r in this._global_heaps?c=this._global_heaps[r]:(c=new lb(this.fh,r),await c.ready,this._global_heaps[r]=c);let o=c.objects.get(s);if("VLEN_STRING"==t){let t=i[2];const e=new TextDecoder(0==t?"ascii":"utf-8");n[a]=e.decode(o)}}}return n}async _get_chunk_params(){if(!this._chunk_params_set){this._chunk_params_set=!0;var t=this.find_msg_type(sF)[0].get("offset_to_message"),[e,i,r,s]=await this._get_data_message_properties(t);if(2==r){var o;if(1==e||2==e){var n=(await ym.unpack_from_async("<Q",this.fh,s))[0];o=s+ym.calcsize("<Q")}else if(3==e){var[i,n]=await ym.unpack_from_async("<BQ",this.fh,s);o=s+ym.calcsize("<BQ")}mm(e>=1&&e<=3);var a="<"+(i-1).toFixed()+"I",c=await ym.unpack_from_async(a,this.fh,o);this._chunks=c,this._chunk_dims=i,this._chunk_address=n}}}};var Sb=ym.unpack_from("<Q",new Uint8Array([255,255,255,255,255,255,255,255]).buffer),Eb=new Map([["collection_address","Q"],["object_index","I"]]);wm(Eb);var Nb=new Map([["version","B"],["reserved","B"],["name_size","H"],["datatype_size","H"],["dataspace_size","H"]]),Mb=wm(Nb),Rb=new Map([["version","B"],["flags","B"],["name_size","H"],["datatype_size","H"],["dataspace_size","H"],["character_set_encoding","B"]]),Db=wm(Rb),Bb=new Map([["version","B"],["reserved","B"],["total_header_messages","H"],["object_reference_count","I"],["object_header_size","I"],["padding","I"]]),Tb=new Map([["signature","4s"],["version","B"],["flags","B"]]),Lb=new Map([["version","B"],["dimensionality","B"],["flags","B"],["reserved_0","B"],["reserved_1","I"]]),zb=wm(Lb),Pb=new Map([["version","B"],["dimensionality","B"],["flags","B"],["type","B"]]),Ob=wm(Pb),Hb=new Map([["type","H"],["size","H"],["flags","B"],["reserved","3s"]]),Ub=wm(Hb),Vb=new Map([["type","B"],["size","H"],["flags","B"]]),qb=wm(Vb),Qb=new Map([["btree_address","Q"],["heap_address","Q"]]),Gb=new Map([["heap_address","Q"],["name_btree_address","Q"]]),Wb=new Map([["heap_address","Q"],["name_btree_address","Q"],["order_btree_address","Q"]]),jb=new Map([["version","B"],["space_allocation_time","B"],["fillvalue_write_time","B"],["fillvalue_defined","B"]]),$b=wm(jb),Kb=new Map([["version","B"],["flags","B"]]),Zb=wm(Kb),Yb=new Map([["filter_id","H"],["name_length","H"],["flags","H"],["client_data_values","H"]]),Xb=wm(Yb),Jb=1,tF=2,eF=3,iF=5,rF=6,sF=8,oF=11,nF=12,aF=16,cF=17,lF=class{constructor(t,e){null==e?(this.parent=this,this.file=this):(this.parent=e,this.file=e.file),this.name=t}async init(t){const e=this.file.index;e&&this.name in e?this._links=e[this.name]:this._links=await t.get_links(),this._dataobjects=t,this._attrs=null,this._keys=null}get keys(){return null==this._keys&&(this._keys=Object.keys(this._links)),this._keys.slice()}get values(){return this.keys.map(t=>this.get(t))}length(){return this.keys.length}_dereference(t){if(!t)throw"cannot deference null reference";let e=this.file._get_object_by_address(t);if(null==e)throw"reference not found in file";return e}async get(t){if("number"==typeof t)return this._dereference(t);var e=uF(t);if("/"==e)return this.file;if("."==e)return this;if(/^\//.test(e))return this.file.get(e.slice(1));if(""!=function(t){let e="/",i=t.lastIndexOf(e)+1,r=t.slice(0,i),s=new RegExp("^"+e+"+$"),o=new RegExp(e+"$");r&&!s.test(r)&&(r=r.replace(o,""));return r}(e))var[i,r]=e.split(/\/(.*)/);else var i=e,r=".";if(!(i in this._links))throw i+" not found in group";var s=uF(this.name+"/"+i);let o=this._links[i];if("string"==typeof o)try{return this.get(o)}catch(t){return null}var n=new Ib(this.file._fh,o);if(await n.ready,n.is_dataset){if("."!=r)throw s+" is a dataset, not a group";return new dF(s,n,this)}var a=new lF(s,this);return await a.init(n),a.get(r)}visit(t){return this.visititems((e,i)=>t(e))}visititems(t){var e=this.name.length;/\/$/.test(this.name)||(e+=1);for(var i=this.values.slice();i;){let r=i.shift();1==i.length&&console.log(r);let s=t(r.name.slice(e),r);if(null!=s)return s;r instanceof lF&&(i=i.concat(r.values))}return null}get attrs(){return null==this._attrs&&(this._attrs=this._dataobjects.get_attributes()),this._attrs}},hF=class extends lF{constructor(t,e,i){super("/",null),this.ready=this.init(t,e,i)}async init(t,e,i){var r=new nb(t,0);await r.ready;var s=await r.get_offset_to_dataobjects(),o=new Ib(t,s);if(await o.ready,this.parent=this,this.file=this,this.name="/",this._dataobjects=o,this._attrs=null,this._keys=null,this._fh=t,this.filename=e||"",this.mode="r",this.userblock_size=0,i&&i.index)this.index=i.index;else{let e;if(i&&i.indexOffset)e=i.indexOffset;else{const t=await this.attrs;if(t.hasOwnProperty("_index_offset"))e=t._index_offset;else{const t=this.indexName||"_index",i=await o.find_link(t);i&&(e=i[1])}}if(e)try{const i=new Ib(t,e);await i.ready;const r=await i.get_data(),s=Yw(r),o=(new TextDecoder).decode(s);this.index=JSON.parse(o)}catch(t){console.error(`Error loading index by offset ${t}`)}}this.index&&this.name in this.index?this._links=this.index[this.name]:this._links=await o.get_links()}_get_object_by_address(t){return this._dataobjects.offset==t?this:this.visititems(t=>{t._dataobjects.offset})}},dF=class extends Array{constructor(t,e,i){super(),this.parent=i,this.file=i.file,this.name=t,this._dataobjects=e,this._attrs=null,this._astype=null}get value(){var t=this._dataobjects.get_data();return null==this._astype?this.getValue(t):t.astype(this._astype)}get shape(){return this._dataobjects.shape}get attrs(){return this._dataobjects.get_attributes()}get dtype(){return this._dataobjects.dtype}get fillvalue(){return this._dataobjects.get_fillvalue()}async to_array(){return function(t,e){const i=t.length,r=e.reduce((t,e)=>t*e,1);i!==r&&console.warn(`shape product: ${r} does not match length of flattened array: ${i}`);let s=t;const o=e.slice(1).reverse();for(let t of o){const e=[],{length:i}=s;let r=0;for(;r<i;)e.push(s.slice(r,r+=t));s=e}return s}
|
|
24
|
+
/*! pako 2.0.4 https://github.com/nodeca/pako @license (MIT AND Zlib) */(await this.value,await this.shape)}async getValue(t){const e=await this.dtype;return("string"==typeof e||e instanceof String)&&e.startsWith("S")?(await t).map(t=>{let e=t.indexOf("\0");return e>=0?t.substring(0,e):t}):t}};function uF(t){return t.replace(/\/(\/)+/g,"/")}async function fF(t){var e;t.url&&("function"==typeof(e=t.url).slice&&"function"==typeof e.arrayBuffer)&&(t.file=t.url,t.url=void 0);const i=void 0!==t.url;let r=t.reader?t.reader:pF(t);const s=t.fetchSize||2e3,o=t.maxSize||2e5;i&&(r=new lm({file:r,fetchSize:s,maxSize:o}));const n=new gF(r),a=await async function(t){if(t.index)return t.index;{let e;if(t.indexReader)e=t.indexReader;else{let i;if(t.indexURL)i=Object.assign({url:t.indexURL},t);else if(t.indexPath)i=Object.assign({path:t.indexPath},t);else{if(!t.indexFile)return;i=Object.assign({file:t.indexFile},t)}e=pF(i)}const i=await e.read(),r=(new TextDecoder).decode(i);return JSON.parse(r)}}(t),c=t.indexOffset,l=function(t){if(t.url)return mF(t.url);if(t.path)return mF(t.path);if(t.file)return t.file.name}(t),h=new hF(n,l,{index:a,indexOffset:c});return await h.ready,h}function pF(t){if(t.url)return new cm(t);if(t.path)return new NodeLocalFile(t);if(t.file)return new dm(t.file);throw Error("One of 'url', 'path (node only)', or 'file (browser only)' must be specified")}class gF{constructor(t){this.fileReader=t}async slice(t,e){return this.fileReader.read(t,e-t)}}function mF(t){const e=t.lastIndexOf("/");return e>0?t.substring(e+1):t}class wF{constructor(t,e){this.chrom=t,this.signal_bin_size=e;this.signals={raw_RD:`his_rd_p_${this.chrom}_${this.signal_bin_size}`,gc_RD:`his_rd_p_${this.chrom}_${this.signal_bin_size}_GC`,gc_partition:`his_rd_p_${this.chrom}_${this.signal_bin_size}_partition_GC_merge`,baf:`snp_likelihood_${this.chrom}_${this.signal_bin_size}_mask`,baf_i1:`snp_i1_${this.chrom}_${this.signal_bin_size}_mask`,Mosaic_segments:`his_rd_p_${this.chrom}_${this.signal_bin_size}_partition_GC_mosaic_segments_2d`,Mosaic_calls:`his_rd_p_${this.chrom}_${this.signal_bin_size}_partition_GC_mosaic_call_2d`}}}class bF{constructor(t,e=1e5){this.config=t,this.bin_size=e,this.h5_obj=void 0,this.pytorKeys=[],this.availableBins=[],this.callers=[]}async fetch(){if(!this.h5_obj){const t=Object.assign(this.config,{fetchSize:1e6,maxSize:2e8});this.h5_obj=await fF(t)}return this.h5_obj}async get_keys(){return(await this.fetch()).keys}async get_rd_signal(t=this.bin_size,e){const i=await this.fetch();this.pytorKeys=i.keys;const r=new FF(this.pytorKeys);this.availableBins=r.getAllBins(),this.availableBins.includes(t)||(t=this.availableBins[this.availableBins.length-1]);const s=await this.getChromosomes(e);let o=await this.rd_stat(t);const n=await this.getWigFeatures(s,t,o);return this.setCallers(n),{[t]:n}}async getWigFeatures(t,e,i){const r={RD_Raw:[],RD_Raw_gc_coor:[],ReadDepth:[],"2D":[],BAF1:[],BAF2:[]};for(const s of t){const t=new wF(s,e);r.RD_Raw.push(...await this.get_chr_signal(s,e,t.signals.raw_RD,i)),r.RD_Raw_gc_coor.push(...await this.get_chr_signal(s,e,t.signals.gc_RD,i)),r.ReadDepth.push(...await this.get_chr_signal(s,e,t.signals.gc_partition,i)),r["2D"].push(...await this.rd_call_combined(s,e,i,t));const[o,n]=await this.getBafSignals(s,e,t.signals.baf_i1);r.BAF1.push(...o),r.BAF2.push(...n)}return r}async getChromosomes(t){const e=await this.h5_obj.get("rd_chromosomes"),i=await e.value;if(t){let e=new Set(t);return i.filter(t=>e.has(t))}return i}setCallers(t){this.callers=[],t.ReadDepth.length&&this.callers.push("ReadDepth"),t["2D"].length&&this.callers.push("2D")}decode_segments(t){let e=[],i=[];for(let r of t)4294967295==r?(e.push(i),i=[]):i.push(r);return e}async rd_call_combined(t,e,i,r){let s,o=[],n=r.signals.Mosaic_segments;if(this.pytorKeys.includes(n)){const t=await this.h5_obj.get(n);let e=await t.value;s=this.decode_segments(e)}let a=r.signals.Mosaic_calls;if(this.pytorKeys.includes(a)&&s){const r=await this.h5_obj.get(a);let n=await r.to_array();s.forEach((r,s)=>{r.forEach(r=>{o.push({chr:t,start:r*e,end:(r+1)*e,value:n[0][s]/i[4]*2})})})}return o}async rd_stat(t){let e,i=`rd_stat_${t}_auto`;if(this.pytorKeys.includes(i)){const t=await this.h5_obj.get(i);e=await t.value}return e}async get_chr_signal(t,e,i,r){let s=[];if(this.pytorKeys.includes(i)){const o=await this.h5_obj.get(i);(await o.value).forEach((i,o)=>{s.push({chr:t,start:o*e,end:(o+1)*e,value:i/r[4]*2})})}return s}async getBafSignals(t,e,i,r=-1){const s=[],o=[];if(this.pytorKeys.includes(i)){const n=await this.h5_obj.get(i);(await n.to_array()).forEach((i,n)=>{isNaN(i)||(s.push({chr:t,start:n*e,end:(n+1)*e,value:r*(.5-i)}),.5!==i&&o.push({chr:t,start:n*e,end:(n+1)*e,value:r*(.5+i)}))})}return[s,o]}}class FF{constructor(t){this.signals=t}getAllBins(){const t=this.getRdBins(),e=this.getSnpBins();return[...new Set([...t,...e])].sort((t,e)=>t-e)}getRdBins(){return this.extractBins(/^his_rd_p_(.*)_(\d+)$/)}getSnpBins(){return this.extractBins(/^snp_likelihood_(.*)_(\d+)_mask$/)}extractBins(t){return[...new Set(this.signals.map(e=>e.match(t)).filter(t=>null!==t).map(t=>Number(t[2])))]}}function vF(t){if(t.length<4)return t;let e,i,r,s,o,n;return e=t.slice().sort((t,e)=>t-e),e.length/4%1==0?(i=.5*(e[e.length/4]+e[e.length/4+1]),r=.5*(e[e.length*(3/4)]+e[e.length*(3/4)+1])):(i=e[Math.floor(e.length/4+1)],r=e[Math.ceil(e.length*(3/4)+1)]),s=r-i,o=r+1.5*s,n=i-1.5*s,e.filter(t=>t>=n&&t<=o)}function yF(t){let e=vF(t);const i=e.length,r=e.reduce((t,e)=>t+e)/i,s=Math.sqrt(e.map(t=>Math.pow(t-r,2)).reduce((t,e)=>t+e)/i);return[r,s]}var AF={range_function:function(t,e,i){return Array(Math.ceil((e-t)/i)).fill(t).map((t,e)=>t+e*i)},getDistParams:yF,linspace:function(t,e,i){if(void 0===i&&(i=Math.max(Math.round(e-t)+1,1)),i<2)return 1===i?[t]:[];var r=Array(i);for(let s=--i;s>=0;s--)r[s]=(s*e+(i-s)*t)/i;return r},GetFit:class{constructor(t){this.allBins=t}getValues(){return Object.values(this.allBins).reduce((t,e)=>t.concat(e.filter(t=>t.binScore>0).map(t=>t.binScore)),[])}getMean(t){return t.reduce(function(t,e){return t+e})/t.length}fit_data(){return yF(this.getValues())}histogram(t,e){const i=e[1]-e[0],r={};t.forEach(t=>{e.forEach(e=>{if(r[e]||(r[e]={count:0}),e<=t&&t<e+i)return r[e].count++,!1})});const s=[];return Object.values(r).forEach(t=>{s.push(t.count)}),s}},filterOutliers:vF};function CF(t,e){return isNaN(t)||isNaN(e)||e<=0?NaN:0===t?.5:.5+.5*(_F(.5*e,.5,1)-_F(.5*e,.5,e/(e+t*t)))*Math.sign(t)}function _F(t,e,i){if(0==i)return 0;if(1==i)return 1;{let r=SF(t+e)-SF(t)-SF(e)+t*Math.log(i)+e*Math.log(1-i);return i<(t+1)/(t+e+2)?Math.exp(r)*xF(t,e,i)/t:1-Math.exp(r)*xF(e,t,1-i)/e}}function xF(t,e,i,r=1e3){let s=1,o=1,n=1,a=t+e,c=t+1,l=t-1,h=1-a*i/c;for(let d=0;d<=r;d++){let r=parseFloat((d+1).toString()),u=r+r,f=r*(e-r)*i/((l+u)*(t+u)),p=s+f*o,g=h+f*n;f=-(t+r)*(a+r)*i/((c+u)*(t+u));let m=g+f*h,w=s;if(o=p/m,n=g/m,s=(p+f*s)/m,h=1,Math.abs(s-w)<3e-7*Math.abs(s))return s}}function kF(t){if(0==t||1==t)return 1;return t*kF(t-1)}function IF(t){let e;var i=[75122.633153,80916.6278952,36308.2951477,8687.24529705,1168.92649479,83.8676043424,2.50662827511],r=0,s=1;if(0==t)e=1e99;else if(t%1==0)e=kF(t-1);else{for(let e=0;e<i.length;e++)r+=i[e]*Math.pow(t,e),s*=t+e;e=r*Math.pow(t+5.5,t+.5)*Math.exp(-(t+5.5))/s}return e}function SF(t){return Math.log(IF(t))}var EF,NF,MF,RF={TdistributionCDF:CF,gamma:IF,t_test_1_sample:function(t,e,i,r){0==i&&(i=1);var s=(t-e)/i*Math.sqrt(r);return 1-CF(Math.abs(s),r-1)},t_test_2_samples:function(t,e,i,r,s,o){0==e&&(e=1),0==s&&(s=1);var n=(t-r)/Math.sqrt(e**2/i+s**2/o),a=(e**2/i+s**2/o)**2*(i-1)*(o-1)/(e**4*(o-1)/i**2+s**4*(i-1)/o**2);return 1-CF(Math.abs(n),parseInt((a+.5).toString()))}};const DF=Object.prototype.toString;function BF(t){return DF.call(t).endsWith("Array]")}function TF(t,e,i,r){let s=0;const o=i(e);for(let e=0;e<t.x.length;e++)s+=Math.pow(t.y[e]-o(t.x[e]),2)/r[e];return s}function LF(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach(function(i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}),e}var zF={};const PF=Object.prototype.toString;var OF=LF(Object.freeze({__proto__:null,isAnyArray:function(t){const e=PF.call(t);return e.endsWith("Array]")&&!e.includes("Big")}}));const HF=Object.prototype.toString;function UF(t){const e=HF.call(t);return e.endsWith("Array]")&&!e.includes("Big")}const VF=Object.prototype.toString;function qF(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!function(t){const e=VF.call(t);return e.endsWith("Array]")&&!e.includes("Big")}(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var i=e.fromIndex,r=void 0===i?0:i,s=e.toIndex,o=void 0===s?t.length:s;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var n=t[r],a=r+1;a<o;a++)t[a]>n&&(n=t[a]);return n}const QF=Object.prototype.toString;function GF(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!function(t){const e=QF.call(t);return e.endsWith("Array]")&&!e.includes("Big")}(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var i=e.fromIndex,r=void 0===i?0:i,s=e.toIndex,o=void 0===s?t.length:s;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var n=t[r],a=r+1;a<o;a++)t[a]<n&&(n=t[a]);return n}var WF=Object.freeze({__proto__:null,default:function(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!UF(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==i.output){if(!UF(i.output))throw new TypeError("output option must be an array if specified");e=i.output}else e=new Array(t.length);var r=GF(t),s=qF(t);if(r===s)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=i.min,n=void 0===o?i.autoMinMax?r:0:o,a=i.max,c=void 0===a?i.autoMinMax?s:1:a;if(n>=c)throw new RangeError("min option must be smaller than max option");for(var l=(c-n)/(s-r),h=0;h<t.length;h++)e[h]=(t[h]-r)*l+n;return e}}),jF=LF(WF);Object.defineProperty(zF,"__esModule",{value:!0});var $F=OF,KF=jF;const ZF=" ".repeat(2),YF=" ".repeat(4);function XF(t,e={}){const{maxRows:i=15,maxColumns:r=10,maxNumSize:s=8,padMinus:o="auto"}=e;return`${t.constructor.name} {\n${ZF}[\n${YF}${function(t,e,i,r,s){const{rows:o,columns:n}=t,a=Math.min(o,e),c=Math.min(n,i),l=[];if("auto"===s){s=!1;t:for(let e=0;e<a;e++)for(let i=0;i<c;i++)if(t.get(e,i)<0){s=!0;break t}}for(let e=0;e<a;e++){let i=[];for(let o=0;o<c;o++)i.push(JF(t.get(e,o),r,s));l.push(`${i.join(" ")}`)}c!==n&&(l[l.length-1]+=` ... ${n-i} more columns`);a!==o&&l.push(`... ${o-e} more rows`);return l.join(`\n${YF}`)}(t,i,r,s,o)}\n${ZF}]\n${ZF}rows: ${t.rows}\n${ZF}columns: ${t.columns}\n}`}function JF(t,e,i){return(t>=0&&i?` ${tv(t,e-1)}`:tv(t,e)).padEnd(e)}function tv(t,e){let i=t.toString();if(i.length<=e)return i;let r=t.toFixed(e);if(r.length>e&&(r=t.toFixed(Math.max(0,e-(r.length-e)))),r.length<=e&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let s=t.toExponential(e);return s.length>e&&(s=t.toExponential(Math.max(0,e-(s.length-e)))),s.slice(0)}function ev(t,e,i){let r=i?t.rows:t.rows-1;if(e<0||e>r)throw new RangeError("Row index out of range")}function iv(t,e,i){let r=i?t.columns:t.columns-1;if(e<0||e>r)throw new RangeError("Column index out of range")}function rv(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function sv(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function ov(t,e){if(!$F.isAnyArray(e))throw new TypeError("row indices must be an array");for(let i=0;i<e.length;i++)if(e[i]<0||e[i]>=t.rows)throw new RangeError("row indices are out of range")}function nv(t,e){if(!$F.isAnyArray(e))throw new TypeError("column indices must be an array");for(let i=0;i<e.length;i++)if(e[i]<0||e[i]>=t.columns)throw new RangeError("column indices are out of range")}function av(t,e,i,r,s){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(lv("startRow",e),lv("endRow",i),lv("startColumn",r),lv("endColumn",s),e>i||r>s||e<0||e>=t.rows||i<0||i>=t.rows||r<0||r>=t.columns||s<0||s>=t.columns)throw new RangeError("Submatrix indices are out of range")}function cv(t,e=0){let i=[];for(let r=0;r<t;r++)i.push(e);return i}function lv(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function hv(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class dv{static from1DArray(t,e,i){if(t*e!==i.length)throw new RangeError("data length does not match given dimensions");let r=new pv(t,e);for(let s=0;s<t;s++)for(let t=0;t<e;t++)r.set(s,t,i[s*e+t]);return r}static rowVector(t){let e=new pv(1,t.length);for(let i=0;i<t.length;i++)e.set(0,i,t[i]);return e}static columnVector(t){let e=new pv(t.length,1);for(let i=0;i<t.length;i++)e.set(i,0,t[i]);return e}static zeros(t,e){return new pv(t,e)}static ones(t,e){return new pv(t,e).fill(1)}static rand(t,e,i={}){if("object"!=typeof i)throw new TypeError("options must be an object");const{random:r=Math.random}=i;let s=new pv(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)s.set(i,t,r());return s}static randInt(t,e,i={}){if("object"!=typeof i)throw new TypeError("options must be an object");const{min:r=0,max:s=1e3,random:o=Math.random}=i;if(!Number.isInteger(r))throw new TypeError("min must be an integer");if(!Number.isInteger(s))throw new TypeError("max must be an integer");if(r>=s)throw new RangeError("min must be smaller than max");let n=s-r,a=new pv(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++){let e=r+Math.round(o()*n);a.set(i,t,e)}return a}static eye(t,e,i){void 0===e&&(e=t),void 0===i&&(i=1);let r=Math.min(t,e),s=this.zeros(t,e);for(let t=0;t<r;t++)s.set(t,t,i);return s}static diag(t,e,i){let r=t.length;void 0===e&&(e=r),void 0===i&&(i=e);let s=Math.min(r,e,i),o=this.zeros(e,i);for(let e=0;e<s;e++)o.set(e,e,t[e]);return o}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let i=t.rows,r=t.columns,s=new pv(i,r);for(let o=0;o<i;o++)for(let i=0;i<r;i++)s.set(o,i,Math.min(t.get(o,i),e.get(o,i)));return s}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let i=t.rows,r=t.columns,s=new this(i,r);for(let o=0;o<i;o++)for(let i=0;i<r;i++)s.set(o,i,Math.max(t.get(o,i),e.get(o,i)));return s}static checkMatrix(t){return dv.isMatrix(t)?t:new pv(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)t.call(this,e,i);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)t.push(this.get(e,i));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let i=0;i<this.columns;i++)t[e].push(this.get(e,i))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,i=-1,r=!0,s=!1;for(;t<this.rows&&r;){for(e=0,s=!1;e<this.columns&&!1===s;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>i?(s=!0,i=e):(r=!1,s=!0);t++}return r}isReducedEchelonForm(){let t=0,e=0,i=-1,r=!0,s=!1;for(;t<this.rows&&r;){for(e=0,s=!1;e<this.columns&&!1===s;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>i?(s=!0,i=e):(r=!1,s=!0);for(let i=e+1;i<this.rows;i++)0!==this.get(t,i)&&(r=!1);t++}return r}echelonForm(){let t=this.clone(),e=0,i=0;for(;e<t.rows&&i<t.columns;){let r=e;for(let s=e;s<t.rows;s++)t.get(s,i)>t.get(r,i)&&(r=s);if(0===t.get(r,i))i++;else{t.swapRows(e,r);let s=t.get(e,i);for(let r=i;r<t.columns;r++)t.set(e,r,t.get(e,r)/s);for(let r=e+1;r<t.rows;r++){let s=t.get(r,i)/t.get(e,i);t.set(r,i,0);for(let o=i+1;o<t.columns;o++)t.set(r,o,t.get(r,o)-t.get(e,o)*s)}e++,i++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,i=t.rows,r=i-1;for(;r>=0;)if(0===t.maxRow(r))r--;else{let s=0,o=!1;for(;s<i&&!1===o;)1===t.get(r,s)?o=!0:s++;for(let i=0;i<r;i++){let o=t.get(i,s);for(let n=s;n<e;n++){let e=t.get(i,n)-o*t.get(r,n);t.set(i,n,e)}}r--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:i=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(i)||i<=0)throw new TypeError("columns must be a positive integer");let r=new pv(this.rows*e,this.columns*i);for(let t=0;t<e;t++)for(let e=0;e<i;e++)r.setSubMatrix(this,this.rows*t,this.columns*e);return r}fill(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,t);return this}neg(){return this.mulS(-1)}getRow(t){ev(this,t);let e=[];for(let i=0;i<this.columns;i++)e.push(this.get(t,i));return e}getRowVector(t){return pv.rowVector(this.getRow(t))}setRow(t,e){ev(this,t),e=rv(this,e);for(let i=0;i<this.columns;i++)this.set(t,i,e[i]);return this}swapRows(t,e){ev(this,t),ev(this,e);for(let i=0;i<this.columns;i++){let r=this.get(t,i);this.set(t,i,this.get(e,i)),this.set(e,i,r)}return this}getColumn(t){iv(this,t);let e=[];for(let i=0;i<this.rows;i++)e.push(this.get(i,t));return e}getColumnVector(t){return pv.columnVector(this.getColumn(t))}setColumn(t,e){iv(this,t),e=sv(this,e);for(let i=0;i<this.rows;i++)this.set(i,t,e[i]);return this}swapColumns(t,e){iv(this,t),iv(this,e);for(let i=0;i<this.rows;i++){let r=this.get(i,t);this.set(i,t,this.get(i,e)),this.set(i,e,r)}return this}addRowVector(t){t=rv(this,t);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)+t[i]);return this}subRowVector(t){t=rv(this,t);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)-t[i]);return this}mulRowVector(t){t=rv(this,t);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)*t[i]);return this}divRowVector(t){t=rv(this,t);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)/t[i]);return this}addColumnVector(t){t=sv(this,t);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)+t[e]);return this}subColumnVector(t){t=sv(this,t);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)-t[e]);return this}mulColumnVector(t){t=sv(this,t);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)*t[e]);return this}divColumnVector(t){t=sv(this,t);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)/t[e]);return this}mulRow(t,e){ev(this,t);for(let i=0;i<this.columns;i++)this.set(t,i,this.get(t,i)*e);return this}mulColumn(t,e){iv(this,t);for(let i=0;i<this.rows;i++)this.set(i,t,this.get(i,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.get(e,i)>t[e]&&(t[e]=this.get(e,i));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.get(e,i)>t[i]&&(t[i]=this.get(e,i));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.get(e,i)>t&&(t=this.get(e,i));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){hv(this);let t=this.get(0,0),e=[0,0];for(let i=0;i<this.rows;i++)for(let r=0;r<this.columns;r++)this.get(i,r)>t&&(t=this.get(i,r),e[0]=i,e[1]=r);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.get(e,i)<t[e]&&(t[e]=this.get(e,i));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.get(e,i)<t[i]&&(t[i]=this.get(e,i));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.get(e,i)<t&&(t=this.get(e,i));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){hv(this);let t=this.get(0,0),e=[0,0];for(let i=0;i<this.rows;i++)for(let r=0;r<this.columns;r++)this.get(i,r)<t&&(t=this.get(i,r),e[0]=i,e[1]=r);return e}maxRow(t){if(ev(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let i=1;i<this.columns;i++)this.get(t,i)>e&&(e=this.get(t,i));return e}maxRowIndex(t){ev(this,t),hv(this);let e=this.get(t,0),i=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r),i[1]=r);return i}minRow(t){if(ev(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let i=1;i<this.columns;i++)this.get(t,i)<e&&(e=this.get(t,i));return e}minRowIndex(t){ev(this,t),hv(this);let e=this.get(t,0),i=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r),i[1]=r);return i}maxColumn(t){if(iv(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let i=1;i<this.rows;i++)this.get(i,t)>e&&(e=this.get(i,t));return e}maxColumnIndex(t){iv(this,t),hv(this);let e=this.get(0,t),i=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t),i[0]=r);return i}minColumn(t){if(iv(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let i=1;i<this.rows;i++)this.get(i,t)<e&&(e=this.get(i,t));return e}minColumnIndex(t){iv(this,t),hv(this);let e=this.get(0,t),i=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t),i[0]=r);return i}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let i=0;i<t;i++)e.push(this.get(i,i));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)t+=this.get(e,i),this.set(e,i,t);return this}dot(t){dv.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let i=0;for(let r=0;r<e.length;r++)i+=e[r]*t[r];return i}mmul(t){t=pv.checkMatrix(t);let e=this.rows,i=this.columns,r=t.columns,s=new pv(e,r),o=new Float64Array(i);for(let n=0;n<r;n++){for(let e=0;e<i;e++)o[e]=t.get(e,n);for(let t=0;t<e;t++){let e=0;for(let r=0;r<i;r++)e+=this.get(t,r)*o[r];s.set(t,n,e)}}return s}mpow(t){if(!this.isSquare())throw new RangeError("Matrix must be square");if(!Number.isInteger(t)||t<0)throw new RangeError("Exponent must be a non-negative integer");let e=pv.eye(this.rows),i=this;for(let r=t;r>1;r/=2)1&r&&(e=e.mmul(i)),i=i.mmul(i);return e}strassen2x2(t){t=pv.checkMatrix(t);let e=new pv(2,2);const i=this.get(0,0),r=t.get(0,0),s=this.get(0,1),o=t.get(0,1),n=this.get(1,0),a=t.get(1,0),c=this.get(1,1),l=t.get(1,1),h=(i+c)*(r+l),d=(n+c)*r,u=i*(o-l),f=c*(a-r),p=(i+s)*l,g=h+f-p+(s-c)*(a+l),m=u+p,w=d+f,b=h-d+u+(n-i)*(r+o);return e.set(0,0,g),e.set(0,1,m),e.set(1,0,w),e.set(1,1,b),e}strassen3x3(t){t=pv.checkMatrix(t);let e=new pv(3,3);const i=this.get(0,0),r=this.get(0,1),s=this.get(0,2),o=this.get(1,0),n=this.get(1,1),a=this.get(1,2),c=this.get(2,0),l=this.get(2,1),h=this.get(2,2),d=t.get(0,0),u=t.get(0,1),f=t.get(0,2),p=t.get(1,0),g=t.get(1,1),m=t.get(1,2),w=t.get(2,0),b=t.get(2,1),F=t.get(2,2),v=(i-o)*(-u+g),y=(-i+o+n)*(d-u+g),A=(o+n)*(-d+u),C=i*d,_=(-i+c+l)*(d-f+m),x=(-i+c)*(f-m),k=(c+l)*(-d+f),I=(-s+l+h)*(g+w-b),S=(s-h)*(g-b),E=s*w,N=(l+h)*(-w+b),M=(-s+n+a)*(m+w-F),R=(s-a)*(m-F),D=(n+a)*(-w+F),B=C+E+r*p,T=(i+r+s-o-n-l-h)*g+y+A+C+I+E+N,L=C+_+k+(i+r+s-n-a-c-l)*m+E+M+D,z=v+n*(-d+u+p-g-m-w+F)+y+C+E+M+R,P=v+y+A+C+a*b,O=E+M+R+D+o*f,H=C+_+x+l*(-d+f+p-g-m-w+b)+I+S+E,U=I+S+E+N+c*u,V=C+_+x+k+h*F;return e.set(0,0,B),e.set(0,1,T),e.set(0,2,L),e.set(1,0,z),e.set(1,1,P),e.set(1,2,O),e.set(2,0,H),e.set(2,1,U),e.set(2,2,V),e}mmulStrassen(t){t=pv.checkMatrix(t);let e=this.clone(),i=e.rows,r=e.columns,s=t.rows,o=t.columns;function n(t,e,i){let r=t.rows,s=t.columns;if(r===e&&s===i)return t;{let r=dv.zeros(e,i);return r=r.setSubMatrix(t,0,0),r}}r!==s&&console.warn(`Multiplying ${i} x ${r} and ${s} x ${o} matrix: dimensions do not match.`);let a=Math.max(i,s),c=Math.max(r,o);return e=n(e,a,c),function t(e,i,r,s){if(r<=512||s<=512)return e.mmul(i);r%2==1&&s%2==1?(e=n(e,r+1,s+1),i=n(i,r+1,s+1)):r%2==1?(e=n(e,r+1,s),i=n(i,r+1,s)):s%2==1&&(e=n(e,r,s+1),i=n(i,r,s+1));let o=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),c=e.subMatrix(0,o-1,0,a-1),l=i.subMatrix(0,o-1,0,a-1),h=e.subMatrix(0,o-1,a,e.columns-1),d=i.subMatrix(0,o-1,a,i.columns-1),u=e.subMatrix(o,e.rows-1,0,a-1),f=i.subMatrix(o,i.rows-1,0,a-1),p=e.subMatrix(o,e.rows-1,a,e.columns-1),g=i.subMatrix(o,i.rows-1,a,i.columns-1),m=t(dv.add(c,p),dv.add(l,g),o,a),w=t(dv.add(u,p),l,o,a),b=t(c,dv.sub(d,g),o,a),F=t(p,dv.sub(f,l),o,a),v=t(dv.add(c,h),g,o,a),y=t(dv.sub(u,c),dv.add(l,d),o,a),A=t(dv.sub(h,p),dv.add(f,g),o,a),C=dv.add(m,F);C.sub(v),C.add(A);let _=dv.add(b,v),x=dv.add(w,F),k=dv.sub(m,w);k.add(b),k.add(y);let I=dv.zeros(2*C.rows,2*C.columns);return I=I.setSubMatrix(C,0,0),I=I.setSubMatrix(_,C.rows,0),I=I.setSubMatrix(x,0,C.columns),I=I.setSubMatrix(k,C.rows,C.columns),I.subMatrix(0,r-1,0,s-1)}(e,t=n(t,a,c),a,c)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:i=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(i))throw new TypeError("max must be a number");if(e>=i)throw new RangeError("min must be smaller than max");let r=new pv(this.rows,this.columns);for(let t=0;t<this.rows;t++){const s=this.getRow(t);s.length>0&&KF(s,{min:e,max:i,output:s}),r.setRow(t,s)}return r}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:i=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(i))throw new TypeError("max must be a number");if(e>=i)throw new RangeError("min must be smaller than max");let r=new pv(this.rows,this.columns);for(let t=0;t<this.columns;t++){const s=this.getColumn(t);s.length&&KF(s,{min:e,max:i,output:s}),r.setColumn(t,s)}return r}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let i=0;i<t;i++){let t=this.get(e,i),r=this.get(e,this.columns-1-i);this.set(e,i,r),this.set(e,this.columns-1-i,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let i=0;i<t;i++){let t=this.get(i,e),r=this.get(this.rows-1-i,e);this.set(i,e,r),this.set(this.rows-1-i,e,t)}return this}kroneckerProduct(t){t=pv.checkMatrix(t);let e=this.rows,i=this.columns,r=t.rows,s=t.columns,o=new pv(e*r,i*s);for(let n=0;n<e;n++)for(let e=0;e<i;e++)for(let i=0;i<r;i++)for(let a=0;a<s;a++)o.set(r*n+i,s*e+a,this.get(n,e)*t.get(i,a));return o}kroneckerSum(t){if(t=pv.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,i=t.rows,r=this.kroneckerProduct(pv.eye(i,i)),s=pv.eye(e,e).kroneckerProduct(t);return r.add(s)}transpose(){let t=new pv(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)t.set(i,e,this.get(e,i));return t}sortRows(t=uv){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=uv){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,i,r){av(this,t,e,i,r);let s=new pv(e-t+1,r-i+1);for(let o=t;o<=e;o++)for(let e=i;e<=r;e++)s.set(o-t,e-i,this.get(o,e));return s}subMatrixRow(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=this.columns-1),e>i||e<0||e>=this.columns||i<0||i>=this.columns)throw new RangeError("Argument out of range");let r=new pv(t.length,i-e+1);for(let s=0;s<t.length;s++)for(let o=e;o<=i;o++){if(t[s]<0||t[s]>=this.rows)throw new RangeError(`Row index out of range: ${t[s]}`);r.set(s,o-e,this.get(t[s],o))}return r}subMatrixColumn(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=this.rows-1),e>i||e<0||e>=this.rows||i<0||i>=this.rows)throw new RangeError("Argument out of range");let r=new pv(i-e+1,t.length);for(let s=0;s<t.length;s++)for(let o=e;o<=i;o++){if(t[s]<0||t[s]>=this.columns)throw new RangeError(`Column index out of range: ${t[s]}`);r.set(o-e,s,this.get(o,t[s]))}return r}setSubMatrix(t,e,i){if((t=pv.checkMatrix(t)).isEmpty())return this;av(this,e,e+t.rows-1,i,i+t.columns-1);for(let r=0;r<t.rows;r++)for(let s=0;s<t.columns;s++)this.set(e+r,i+s,t.get(r,s));return this}selection(t,e){ov(this,t),nv(this,e);let i=new pv(t.length,e.length);for(let r=0;r<t.length;r++){let s=t[r];for(let t=0;t<e.length;t++){let o=e[t];i.set(r,t,this.get(s,o))}}return i}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let i=0;i<t;i++)e+=this.get(i,i);return e}clone(){return this.constructor.copy(this,new pv(this.rows,this.columns))}static copy(t,e){for(const[i,r,s]of t.entries())e.set(i,r,s);return e}sum(t){switch(t){case"row":return function(t){let e=cv(t.rows);for(let i=0;i<t.rows;++i)for(let r=0;r<t.columns;++r)e[i]+=t.get(i,r);return e}(this);case"column":return function(t){let e=cv(t.columns);for(let i=0;i<t.rows;++i)for(let r=0;r<t.columns;++r)e[r]+=t.get(i,r);return e}(this);case void 0:return function(t){let e=0;for(let i=0;i<t.rows;i++)for(let r=0;r<t.columns;r++)e+=t.get(i,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=cv(t.rows,1);for(let i=0;i<t.rows;++i)for(let r=0;r<t.columns;++r)e[i]*=t.get(i,r);return e}(this);case"column":return function(t){let e=cv(t.columns,1);for(let i=0;i<t.rows;++i)for(let r=0;r<t.columns;++r)e[r]*=t.get(i,r);return e}(this);case void 0:return function(t){let e=1;for(let i=0;i<t.rows;i++)for(let r=0;r<t.columns;r++)e*=t.get(i,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:i=!0,mean:r=this.mean(t)}=e;if("boolean"!=typeof i)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!$F.isAnyArray(r))throw new TypeError("mean must be an array");return function(t,e,i){const r=t.rows,s=t.columns,o=[];for(let n=0;n<r;n++){let r=0,a=0,c=0;for(let e=0;e<s;e++)c=t.get(n,e)-i[n],r+=c,a+=c*c;e?o.push((a-r*r/s)/(s-1)):o.push((a-r*r/s)/s)}return o}(this,i,r);case"column":if(!$F.isAnyArray(r))throw new TypeError("mean must be an array");return function(t,e,i){const r=t.rows,s=t.columns,o=[];for(let n=0;n<s;n++){let s=0,a=0,c=0;for(let e=0;e<r;e++)c=t.get(e,n)-i[n],s+=c,a+=c*c;e?o.push((a-s*s/r)/(r-1)):o.push((a-s*s/r)/r)}return o}(this,i,r);case void 0:if("number"!=typeof r)throw new TypeError("mean must be a number");return function(t,e,i){const r=t.rows,s=t.columns,o=r*s;let n=0,a=0,c=0;for(let e=0;e<r;e++)for(let r=0;r<s;r++)c=t.get(e,r)-i,n+=c,a+=c*c;return e?(a-n*n/o)/(o-1):(a-n*n/o)/o}(this,i,r);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const i=this.variance(t,e);if(void 0===t)return Math.sqrt(i);for(let t=0;t<i.length;t++)i[t]=Math.sqrt(i[t]);return i}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:i=this.mean(t)}=e;switch(t){case"row":if(!$F.isAnyArray(i))throw new TypeError("center must be an array");return function(t,e){for(let i=0;i<t.rows;i++)for(let r=0;r<t.columns;r++)t.set(i,r,t.get(i,r)-e[i])}(this,i),this;case"column":if(!$F.isAnyArray(i))throw new TypeError("center must be an array");return function(t,e){for(let i=0;i<t.rows;i++)for(let r=0;r<t.columns;r++)t.set(i,r,t.get(i,r)-e[r])}(this,i),this;case void 0:if("number"!=typeof i)throw new TypeError("center must be a number");return function(t,e){for(let i=0;i<t.rows;i++)for(let r=0;r<t.columns;r++)t.set(i,r,t.get(i,r)-e)}(this,i),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let i=e.scale;switch(t){case"row":if(void 0===i)i=function(t){const e=[];for(let i=0;i<t.rows;i++){let r=0;for(let e=0;e<t.columns;e++)r+=t.get(i,e)**2/(t.columns-1);e.push(Math.sqrt(r))}return e}(this);else if(!$F.isAnyArray(i))throw new TypeError("scale must be an array");return function(t,e){for(let i=0;i<t.rows;i++)for(let r=0;r<t.columns;r++)t.set(i,r,t.get(i,r)/e[i])}(this,i),this;case"column":if(void 0===i)i=function(t){const e=[];for(let i=0;i<t.columns;i++){let r=0;for(let e=0;e<t.rows;e++)r+=t.get(e,i)**2/(t.rows-1);e.push(Math.sqrt(r))}return e}(this);else if(!$F.isAnyArray(i))throw new TypeError("scale must be an array");return function(t,e){for(let i=0;i<t.rows;i++)for(let r=0;r<t.columns;r++)t.set(i,r,t.get(i,r)/e[r])}(this,i),this;case void 0:if(void 0===i)i=function(t){const e=t.size-1;let i=0;for(let r=0;r<t.columns;r++)for(let s=0;s<t.rows;s++)i+=t.get(s,r)**2/e;return Math.sqrt(i)}(this);else if("number"!=typeof i)throw new TypeError("scale must be a number");return function(t,e){for(let i=0;i<t.rows;i++)for(let r=0;r<t.columns;r++)t.set(i,r,t.get(i,r)/e)}(this,i),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return XF(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function uv(t,e){return t-e}function fv(t){return t.every(t=>"number"==typeof t)}dv.prototype.klass="Matrix","undefined"!=typeof Symbol&&(dv.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return XF(this)}),dv.random=dv.rand,dv.randomInt=dv.randInt,dv.diagonal=dv.diag,dv.prototype.diagonal=dv.prototype.diag,dv.identity=dv.eye,dv.prototype.negate=dv.prototype.neg,dv.prototype.tensorProduct=dv.prototype.kroneckerProduct;class pv extends dv{constructor(t,e){if(super(),EF.add(this),pv.isMatrix(t))wo(this,EF,"m",NF).call(this,t.rows,t.columns),pv.copy(t,this);else if(Number.isInteger(t)&&t>=0)wo(this,EF,"m",NF).call(this,t,e);else{if(!$F.isAnyArray(t))throw new TypeError("First argument must be a positive number or an array");{const i=t;if("number"!=typeof(e=(t=i.length)?i[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let r=0;r<t;r++){if(i[r].length!==e)throw new RangeError("Inconsistent array dimensions");if(!fv(i[r]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(i[r]))}this.rows=t,this.columns=e}}}set(t,e,i){return this.data[t][e]=i,this}get(t,e){return this.data[t][e]}removeRow(t){return ev(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),ev(this,t,!0),e=Float64Array.from(rv(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){iv(this,t);for(let e=0;e<this.rows;e++){const i=new Float64Array(this.columns-1);for(let r=0;r<t;r++)i[r]=this.data[e][r];for(let r=t+1;r<this.columns;r++)i[r-1]=this.data[e][r];this.data[e]=i}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),iv(this,t,!0),e=sv(this,e);for(let i=0;i<this.rows;i++){const r=new Float64Array(this.columns+1);let s=0;for(;s<t;s++)r[s]=this.data[i][s];for(r[s++]=e[i];s<this.columns+1;s++)r[s]=this.data[i][s-1];this.data[i]=r}return this.columns+=1,this}}EF=new WeakSet,NF=function(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let i=0;i<t;i++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e},function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)+t.get(e,i));return this},t.add=function(t,i){return new e(t).add(i)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)-t.get(e,i));return this},t.sub=function(t,i){return new e(t).sub(i)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)*t.get(e,i));return this},t.mul=function(t,i){return new e(t).mul(i)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)/t.get(e,i));return this},t.div=function(t,i){return new e(t).div(i)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)%t.get(e,i));return this},t.mod=function(t,i){return new e(t).mod(i)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)&t.get(e,i));return this},t.and=function(t,i){return new e(t).and(i)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)|t.get(e,i));return this},t.or=function(t,i){return new e(t).or(i)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)^t.get(e,i));return this},t.xor=function(t,i){return new e(t).xor(i)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)<<t.get(e,i));return this},t.leftShift=function(t,i){return new e(t).leftShift(i)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)>>t.get(e,i));return this},t.signPropagatingRightShift=function(t,i){return new e(t).signPropagatingRightShift(i)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)>>>t.get(e,i));return this},t.rightShift=function(t,i){return new e(t).rightShift(i)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,i){return new e(t).pow(i)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)**t);return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let i=0;i<this.columns;i++)this.set(e,i,this.get(e,i)**t.get(e,i));return this}}(dv,pv);class gv extends dv{get size(){return wo(this,MF,"f").size}get rows(){return wo(this,MF,"f").rows}get columns(){return wo(this,MF,"f").columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return pv.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),MF.set(this,void 0),pv.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");bo(this,MF,pv.copy(t,new pv(t.rows,t.rows)),"f")}else if(Number.isInteger(t)&&t>=0)bo(this,MF,new pv(t,t),"f");else if(bo(this,MF,new pv(t),"f"),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const t=new gv(this.diagonalSize);for(const[e,i,r]of this.upperRightEntries())t.set(e,i,r);return t}toMatrix(){return new pv(this)}get(t,e){return wo(this,MF,"f").get(t,e)}set(t,e,i){return wo(this,MF,"f").set(t,e,i),wo(this,MF,"f").set(e,t,i),this}removeCross(t){return wo(this,MF,"f").removeRow(t),wo(this,MF,"f").removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);const i=e.slice();return i.splice(t,1),wo(this,MF,"f").addRow(t,i),wo(this,MF,"f").addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const e=[];for(const[i,r]of t.entries())r||e.push(i);e.reverse();for(const t of e)this.removeCross(t);return this}toCompact(){const{diagonalSize:t}=this,e=new Array(t*(t+1)/2);for(let i=0,r=0,s=0;s<e.length;s++)e[s]=this.get(r,i),++i>=t&&(i=++r);return e}static fromCompact(t){const e=t.length,i=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(i))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const r=new gv(i);for(let s=0,o=0,n=0;n<e;n++)r.set(s,o,t[n]),++s>=i&&(s=++o);return r}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;void 0){const i=this.get(t,e);yield[t,e,i],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;void 0){const i=this.get(t,e);yield i,++e>=this.diagonalSize&&(e=++t)}}}MF=new WeakMap,gv.prototype.klassType="SymmetricMatrix";class mv extends gv{static isDistanceMatrix(t){return gv.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,i){return t===e&&(i=0),super.set(t,e,i)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new gv(this)}clone(){const t=new mv(this.diagonalSize);for(const[e,i,r]of this.upperRightEntries())e!==i&&t.set(e,i,r);return t}toCompact(){const{diagonalSize:t}=this,e=new Array((t-1)*t/2);for(let i=1,r=0,s=0;s<e.length;s++)e[s]=this.get(r,i),++i>=t&&(i=1+ ++r);return e}static fromCompact(t){const e=t.length;if(0===e)return new this(0);const i=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(i))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const r=new this(i);for(let s=1,o=0,n=0;n<e;n++)r.set(s,o,t[n]),++s>=i&&(s=1+ ++o);return r}}mv.prototype.klassSubType="DistanceMatrix";class wv extends dv{constructor(t,e,i){super(),this.matrix=t,this.rows=e,this.columns=i}}class bv extends wv{constructor(t,e,i){ov(t,e),nv(t,i),super(t,e.length,i.length),this.rowIndices=e,this.columnIndices=i}set(t,e,i){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],i),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class Fv extends dv{constructor(t,e={}){const{rows:i=1}=e;if(t.length%i!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=i,this.columns=t.length/i,this.data=t}set(t,e,i){let r=this._calculateIndex(t,e);return this.data[r]=i,this}get(t,e){let i=this._calculateIndex(t,e);return this.data[i]}_calculateIndex(t,e){return t*this.columns+e}}class vv extends dv{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,i){return this.data[t][e]=i,this}get(t,e){return this.data[t][e]}}class yv{constructor(t){let e,i,r,s,o,n,a,c,l,h=(t=vv.checkMatrix(t)).clone(),d=h.rows,u=h.columns,f=new Float64Array(d),p=1;for(e=0;e<d;e++)f[e]=e;for(c=new Float64Array(d),i=0;i<u;i++){for(e=0;e<d;e++)c[e]=h.get(e,i);for(e=0;e<d;e++){for(l=Math.min(e,i),o=0,r=0;r<l;r++)o+=h.get(e,r)*c[r];c[e]-=o,h.set(e,i,c[e])}for(s=i,e=i+1;e<d;e++)Math.abs(c[e])>Math.abs(c[s])&&(s=e);if(s!==i){for(r=0;r<u;r++)n=h.get(s,r),h.set(s,r,h.get(i,r)),h.set(i,r,n);a=f[s],f[s]=f[i],f[i]=a,p=-p}if(i<d&&0!==h.get(i,i))for(e=i+1;e<d;e++)h.set(e,i,h.get(e,i)/h.get(i,i))}this.LU=h,this.pivotVector=f,this.pivotSign=p}isSingular(){let t=this.LU,e=t.columns;for(let i=0;i<e;i++)if(0===t.get(i,i))return!0;return!1}solve(t){t=pv.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let i,r,s,o=t.columns,n=t.subMatrixRow(this.pivotVector,0,o-1),a=e.columns;for(s=0;s<a;s++)for(i=s+1;i<a;i++)for(r=0;r<o;r++)n.set(i,r,n.get(i,r)-n.get(s,r)*e.get(i,s));for(s=a-1;s>=0;s--){for(r=0;r<o;r++)n.set(s,r,n.get(s,r)/e.get(s,s));for(i=0;i<s;i++)for(r=0;r<o;r++)n.set(i,r,n.get(i,r)-n.get(s,r)*e.get(i,s))}return n}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,i=t.columns;for(let r=0;r<i;r++)e*=t.get(r,r);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,i=t.columns,r=new pv(e,i);for(let s=0;s<e;s++)for(let e=0;e<i;e++)s>e?r.set(s,e,t.get(s,e)):s===e?r.set(s,e,1):r.set(s,e,0);return r}get upperTriangularMatrix(){let t=this.LU,e=t.rows,i=t.columns,r=new pv(e,i);for(let s=0;s<e;s++)for(let e=0;e<i;e++)s<=e?r.set(s,e,t.get(s,e)):r.set(s,e,0);return r}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Av(t,e){let i=0;return Math.abs(t)>Math.abs(e)?(i=e/t,Math.abs(t)*Math.sqrt(1+i*i)):0!==e?(i=t/e,Math.abs(e)*Math.sqrt(1+i*i)):0}class Cv{constructor(t){let e,i,r,s,o=(t=vv.checkMatrix(t)).clone(),n=t.rows,a=t.columns,c=new Float64Array(a);for(r=0;r<a;r++){let t=0;for(e=r;e<n;e++)t=Av(t,o.get(e,r));if(0!==t){for(o.get(r,r)<0&&(t=-t),e=r;e<n;e++)o.set(e,r,o.get(e,r)/t);for(o.set(r,r,o.get(r,r)+1),i=r+1;i<a;i++){for(s=0,e=r;e<n;e++)s+=o.get(e,r)*o.get(e,i);for(s=-s/o.get(r,r),e=r;e<n;e++)o.set(e,i,o.get(e,i)+s*o.get(e,r))}}c[r]=-t}this.QR=o,this.Rdiag=c}solve(t){t=pv.checkMatrix(t);let e=this.QR,i=e.rows;if(t.rows!==i)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let r,s,o,n,a=t.columns,c=t.clone(),l=e.columns;for(o=0;o<l;o++)for(s=0;s<a;s++){for(n=0,r=o;r<i;r++)n+=e.get(r,o)*c.get(r,s);for(n=-n/e.get(o,o),r=o;r<i;r++)c.set(r,s,c.get(r,s)+n*e.get(r,o))}for(o=l-1;o>=0;o--){for(s=0;s<a;s++)c.set(o,s,c.get(o,s)/this.Rdiag[o]);for(r=0;r<o;r++)for(s=0;s<a;s++)c.set(r,s,c.get(r,s)-c.get(o,s)*e.get(r,o))}return c.subMatrix(0,l-1,0,a-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,i=this.QR,r=i.columns,s=new pv(r,r);for(t=0;t<r;t++)for(e=0;e<r;e++)t<e?s.set(t,e,i.get(t,e)):t===e?s.set(t,e,this.Rdiag[t]):s.set(t,e,0);return s}get orthogonalMatrix(){let t,e,i,r,s=this.QR,o=s.rows,n=s.columns,a=new pv(o,n);for(i=n-1;i>=0;i--){for(t=0;t<o;t++)a.set(t,i,0);for(a.set(i,i,1),e=i;e<n;e++)if(0!==s.get(i,i)){for(r=0,t=i;t<o;t++)r+=s.get(t,i)*a.get(t,e);for(r=-r/s.get(i,i),t=i;t<o;t++)a.set(t,e,a.get(t,e)+r*s.get(t,i))}}return a}}class _v{constructor(t,e={}){if((t=vv.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let i=t.rows,r=t.columns;const{computeLeftSingularVectors:s=!0,computeRightSingularVectors:o=!0,autoTranspose:n=!1}=e;let a,c=Boolean(s),l=Boolean(o),h=!1;if(i<r)if(n){a=t.transpose(),i=a.rows,r=a.columns,h=!0;let e=c;c=l,l=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let d=Math.min(i,r),u=Math.min(i+1,r),f=new Float64Array(u),p=new pv(i,d),g=new pv(r,r),m=new Float64Array(r),w=new Float64Array(i),b=new Float64Array(u);for(let t=0;t<u;t++)b[t]=t;let F=Math.min(i-1,r),v=Math.max(0,Math.min(r-2,i)),y=Math.max(F,v);for(let t=0;t<y;t++){if(t<F){f[t]=0;for(let e=t;e<i;e++)f[t]=Av(f[t],a.get(e,t));if(0!==f[t]){a.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<i;e++)a.set(e,t,a.get(e,t)/f[t]);a.set(t,t,a.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<r;e++){if(t<F&&0!==f[t]){let r=0;for(let s=t;s<i;s++)r+=a.get(s,t)*a.get(s,e);r=-r/a.get(t,t);for(let s=t;s<i;s++)a.set(s,e,a.get(s,e)+r*a.get(s,t))}m[e]=a.get(t,e)}if(c&&t<F)for(let e=t;e<i;e++)p.set(e,t,a.get(e,t));if(t<v){m[t]=0;for(let e=t+1;e<r;e++)m[t]=Av(m[t],m[e]);if(0!==m[t]){m[t+1]<0&&(m[t]=0-m[t]);for(let e=t+1;e<r;e++)m[e]/=m[t];m[t+1]+=1}if(m[t]=-m[t],t+1<i&&0!==m[t]){for(let e=t+1;e<i;e++)w[e]=0;for(let e=t+1;e<i;e++)for(let i=t+1;i<r;i++)w[e]+=m[i]*a.get(e,i);for(let e=t+1;e<r;e++){let r=-m[e]/m[t+1];for(let s=t+1;s<i;s++)a.set(s,e,a.get(s,e)+r*w[s])}}if(l)for(let e=t+1;e<r;e++)g.set(e,t,m[e])}}let A=Math.min(r,i+1);if(F<r&&(f[F]=a.get(F,F)),i<A&&(f[A-1]=0),v+1<A&&(m[v]=a.get(v,A-1)),m[A-1]=0,c){for(let t=F;t<d;t++){for(let e=0;e<i;e++)p.set(e,t,0);p.set(t,t,1)}for(let t=F-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<d;e++){let r=0;for(let s=t;s<i;s++)r+=p.get(s,t)*p.get(s,e);r=-r/p.get(t,t);for(let s=t;s<i;s++)p.set(s,e,p.get(s,e)+r*p.get(s,t))}for(let e=t;e<i;e++)p.set(e,t,-p.get(e,t));p.set(t,t,1+p.get(t,t));for(let e=0;e<t-1;e++)p.set(e,t,0)}else{for(let e=0;e<i;e++)p.set(e,t,0);p.set(t,t,1)}}if(l)for(let t=r-1;t>=0;t--){if(t<v&&0!==m[t])for(let e=t+1;e<r;e++){let i=0;for(let s=t+1;s<r;s++)i+=g.get(s,t)*g.get(s,e);i=-i/g.get(t+1,t);for(let s=t+1;s<r;s++)g.set(s,e,g.get(s,e)+i*g.get(s,t))}for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}let C=A-1,_=Number.EPSILON;for(;A>0;){let t,e;for(t=A-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+_*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(m[t])<=e||Number.isNaN(m[t])){m[t]=0;break}}if(t===A-2)e=4;else{let i;for(i=A-1;i>=t&&i!==t;i--){let e=(i!==A?Math.abs(m[i]):0)+(i!==t+1?Math.abs(m[i-1]):0);if(Math.abs(f[i])<=_*e){f[i]=0;break}}i===t?e=3:i===A-1?e=1:(e=2,t=i)}switch(t++,e){case 1:{let e=m[A-2];m[A-2]=0;for(let i=A-2;i>=t;i--){let s=Av(f[i],e),o=f[i]/s,n=e/s;if(f[i]=s,i!==t&&(e=-n*m[i-1],m[i-1]=o*m[i-1]),l)for(let t=0;t<r;t++)s=o*g.get(t,i)+n*g.get(t,A-1),g.set(t,A-1,-n*g.get(t,i)+o*g.get(t,A-1)),g.set(t,i,s)}break}case 2:{let e=m[t-1];m[t-1]=0;for(let r=t;r<A;r++){let s=Av(f[r],e),o=f[r]/s,n=e/s;if(f[r]=s,e=-n*m[r],m[r]=o*m[r],c)for(let e=0;e<i;e++)s=o*p.get(e,r)+n*p.get(e,t-1),p.set(e,t-1,-n*p.get(e,r)+o*p.get(e,t-1)),p.set(e,r,s)}break}case 3:{const e=Math.max(Math.abs(f[A-1]),Math.abs(f[A-2]),Math.abs(m[A-2]),Math.abs(f[t]),Math.abs(m[t])),s=f[A-1]/e,o=f[A-2]/e,n=m[A-2]/e,a=f[t]/e,h=m[t]/e,d=((o+s)*(o-s)+n*n)/2,u=s*n*(s*n);let w=0;0===d&&0===u||(w=d<0?0-Math.sqrt(d*d+u):Math.sqrt(d*d+u),w=u/(d+w));let b=(a+s)*(a-s)+w,F=a*h;for(let e=t;e<A-1;e++){let s=Av(b,F);0===s&&(s=Number.MIN_VALUE);let o=b/s,n=F/s;if(e!==t&&(m[e-1]=s),b=o*f[e]+n*m[e],m[e]=o*m[e]-n*f[e],F=n*f[e+1],f[e+1]=o*f[e+1],l)for(let t=0;t<r;t++)s=o*g.get(t,e)+n*g.get(t,e+1),g.set(t,e+1,-n*g.get(t,e)+o*g.get(t,e+1)),g.set(t,e,s);if(s=Av(b,F),0===s&&(s=Number.MIN_VALUE),o=b/s,n=F/s,f[e]=s,b=o*m[e]+n*f[e+1],f[e+1]=-n*m[e]+o*f[e+1],F=n*m[e+1],m[e+1]=o*m[e+1],c&&e<i-1)for(let t=0;t<i;t++)s=o*p.get(t,e)+n*p.get(t,e+1),p.set(t,e+1,-n*p.get(t,e)+o*p.get(t,e+1)),p.set(t,e,s)}m[A-2]=b;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,l))for(let e=0;e<=C;e++)g.set(e,t,-g.get(e,t));for(;t<C&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,l&&t<r-1)for(let i=0;i<r;i++)e=g.get(i,t+1),g.set(i,t+1,g.get(i,t)),g.set(i,t,e);if(c&&t<i-1)for(let r=0;r<i;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);t++}A--}}if(h){let t=g;g=p,p=t}this.m=i,this.n=r,this.s=f,this.U=p,this.V=g}solve(t){let e=t,i=this.threshold,r=this.s.length,s=pv.zeros(r,r);for(let t=0;t<r;t++)Math.abs(this.s[t])<=i?s.set(t,t,0):s.set(t,t,1/this.s[t]);let o=this.U,n=this.rightSingularVectors,a=n.mmul(s),c=n.rows,l=o.rows,h=pv.zeros(c,l);for(let t=0;t<c;t++)for(let e=0;e<l;e++){let i=0;for(let s=0;s<r;s++)i+=a.get(t,s)*o.get(e,s);h.set(t,e,i)}return h.mmul(e)}solveForDiagonal(t){return this.solve(pv.diag(t))}inverse(){let t=this.V,e=this.threshold,i=t.rows,r=t.columns,s=new pv(i,this.s.length);for(let o=0;o<i;o++)for(let i=0;i<r;i++)Math.abs(this.s[i])>e&&s.set(o,i,t.get(o,i)/this.s[i]);let o=this.U,n=o.rows,a=o.columns,c=new pv(i,n);for(let t=0;t<i;t++)for(let e=0;e<n;e++){let i=0;for(let r=0;r<a;r++)i+=s.get(t,r)*o.get(e,r);c.set(t,e,i)}return c}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,i=this.s;for(let r=0,s=i.length;r<s;r++)i[r]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return pv.diag(this.s)}}function xv(t,e,i=!1){return t=vv.checkMatrix(t),e=vv.checkMatrix(e),i?new _v(t).solve(e):t.isSquare()?new yv(t).solve(e):new Cv(t).solve(e)}function kv(t,e){let i=[];for(let r=0;r<t;r++)r!==e&&i.push(r);return i}function Iv(t,e,i,r=1e-9,s=1e-9){if(t>s)return new Array(e.rows+1).fill(0);{let t=e.addRow(i,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<r&&t.set(e,0,0);return t.to1DArray()}}class Sv{constructor(t,e={}){const{assumeSymmetric:i=!1}=e;if(!(t=vv.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let r,s,o=t.columns,n=new pv(o,o),a=new Float64Array(o),c=new Float64Array(o),l=t,h=!1;if(h=!!i||t.isSymmetric(),h){for(r=0;r<o;r++)for(s=0;s<o;s++)n.set(r,s,l.get(r,s));!function(t,e,i,r){let s,o,n,a,c,l,h,d;for(c=0;c<t;c++)i[c]=r.get(t-1,c);for(a=t-1;a>0;a--){for(d=0,n=0,l=0;l<a;l++)d+=Math.abs(i[l]);if(0===d)for(e[a]=i[a-1],c=0;c<a;c++)i[c]=r.get(a-1,c),r.set(a,c,0),r.set(c,a,0);else{for(l=0;l<a;l++)i[l]/=d,n+=i[l]*i[l];for(s=i[a-1],o=Math.sqrt(n),s>0&&(o=-o),e[a]=d*o,n-=s*o,i[a-1]=s-o,c=0;c<a;c++)e[c]=0;for(c=0;c<a;c++){for(s=i[c],r.set(c,a,s),o=e[c]+r.get(c,c)*s,l=c+1;l<=a-1;l++)o+=r.get(l,c)*i[l],e[l]+=r.get(l,c)*s;e[c]=o}for(s=0,c=0;c<a;c++)e[c]/=n,s+=e[c]*i[c];for(h=s/(n+n),c=0;c<a;c++)e[c]-=h*i[c];for(c=0;c<a;c++){for(s=i[c],o=e[c],l=c;l<=a-1;l++)r.set(l,c,r.get(l,c)-(s*e[l]+o*i[l]));i[c]=r.get(a-1,c),r.set(a,c,0)}}i[a]=n}for(a=0;a<t-1;a++){if(r.set(t-1,a,r.get(a,a)),r.set(a,a,1),n=i[a+1],0!==n){for(l=0;l<=a;l++)i[l]=r.get(l,a+1)/n;for(c=0;c<=a;c++){for(o=0,l=0;l<=a;l++)o+=r.get(l,a+1)*r.get(l,c);for(l=0;l<=a;l++)r.set(l,c,r.get(l,c)-o*i[l])}}for(l=0;l<=a;l++)r.set(l,a+1,0)}for(c=0;c<t;c++)i[c]=r.get(t-1,c),r.set(t-1,c,0);r.set(t-1,t-1,1),e[0]=0}(o,c,a,n),function(t,e,i,r){let s,o,n,a,c,l,h,d,u,f,p,g,m,w,b,F;for(n=1;n<t;n++)e[n-1]=e[n];e[t-1]=0;let v=0,y=0,A=Number.EPSILON;for(l=0;l<t;l++){for(y=Math.max(y,Math.abs(i[l])+Math.abs(e[l])),h=l;h<t&&!(Math.abs(e[h])<=A*y);)h++;if(h>l)do{for(s=i[l],d=(i[l+1]-s)/(2*e[l]),u=Av(d,1),d<0&&(u=-u),i[l]=e[l]/(d+u),i[l+1]=e[l]*(d+u),f=i[l+1],o=s-i[l],n=l+2;n<t;n++)i[n]-=o;for(v+=o,d=i[h],p=1,g=p,m=p,w=e[l+1],b=0,F=0,n=h-1;n>=l;n--)for(m=g,g=p,F=b,s=p*e[n],o=p*d,u=Av(d,e[n]),e[n+1]=b*u,b=e[n]/u,p=d/u,d=p*i[n]-b*s,i[n+1]=o+b*(p*s+b*i[n]),c=0;c<t;c++)o=r.get(c,n+1),r.set(c,n+1,b*r.get(c,n)+p*o),r.set(c,n,p*r.get(c,n)-b*o);d=-b*F*m*w*e[l]/f,e[l]=b*d,i[l]=p*d}while(Math.abs(e[l])>A*y);i[l]=i[l]+v,e[l]=0}for(n=0;n<t-1;n++){for(c=n,d=i[n],a=n+1;a<t;a++)i[a]<d&&(c=a,d=i[a]);if(c!==n)for(i[c]=i[n],i[n]=d,a=0;a<t;a++)d=r.get(a,n),r.set(a,n,r.get(a,c)),r.set(a,c,d)}}(o,c,a,n)}else{let t=new pv(o,o),e=new Float64Array(o);for(s=0;s<o;s++)for(r=0;r<o;r++)t.set(r,s,l.get(r,s));!function(t,e,i,r){let s,o,n,a,c,l,h,d=0,u=t-1;for(l=d+1;l<=u-1;l++){for(h=0,a=l;a<=u;a++)h+=Math.abs(e.get(a,l-1));if(0!==h){for(n=0,a=u;a>=l;a--)i[a]=e.get(a,l-1)/h,n+=i[a]*i[a];for(o=Math.sqrt(n),i[l]>0&&(o=-o),n-=i[l]*o,i[l]=i[l]-o,c=l;c<t;c++){for(s=0,a=u;a>=l;a--)s+=i[a]*e.get(a,c);for(s/=n,a=l;a<=u;a++)e.set(a,c,e.get(a,c)-s*i[a])}for(a=0;a<=u;a++){for(s=0,c=u;c>=l;c--)s+=i[c]*e.get(a,c);for(s/=n,c=l;c<=u;c++)e.set(a,c,e.get(a,c)-s*i[c])}i[l]=h*i[l],e.set(l,l-1,h*o)}}for(a=0;a<t;a++)for(c=0;c<t;c++)r.set(a,c,a===c?1:0);for(l=u-1;l>=d+1;l--)if(0!==e.get(l,l-1)){for(a=l+1;a<=u;a++)i[a]=e.get(a,l-1);for(c=l;c<=u;c++){for(o=0,a=l;a<=u;a++)o+=i[a]*r.get(a,c);for(o=o/i[l]/e.get(l,l-1),a=l;a<=u;a++)r.set(a,c,r.get(a,c)+o*i[a])}}}(o,t,e,n),function(t,e,i,r,s){let o,n,a,c,l,h,d,u,f,p,g,m,w,b,F,v=t-1,y=0,A=t-1,C=Number.EPSILON,_=0,x=0,k=0,I=0,S=0,E=0,N=0,M=0;for(o=0;o<t;o++)for((o<y||o>A)&&(i[o]=s.get(o,o),e[o]=0),n=Math.max(o-1,0);n<t;n++)x+=Math.abs(s.get(o,n));for(;v>=y;){for(c=v;c>y&&(E=Math.abs(s.get(c-1,c-1))+Math.abs(s.get(c,c)),0===E&&(E=x),!(Math.abs(s.get(c,c-1))<C*E));)c--;if(c===v)s.set(v,v,s.get(v,v)+_),i[v]=s.get(v,v),e[v]=0,v--,M=0;else if(c===v-1){if(d=s.get(v,v-1)*s.get(v-1,v),k=(s.get(v-1,v-1)-s.get(v,v))/2,I=k*k+d,N=Math.sqrt(Math.abs(I)),s.set(v,v,s.get(v,v)+_),s.set(v-1,v-1,s.get(v-1,v-1)+_),u=s.get(v,v),I>=0){for(N=k>=0?k+N:k-N,i[v-1]=u+N,i[v]=i[v-1],0!==N&&(i[v]=u-d/N),e[v-1]=0,e[v]=0,u=s.get(v,v-1),E=Math.abs(u)+Math.abs(N),k=u/E,I=N/E,S=Math.sqrt(k*k+I*I),k/=S,I/=S,n=v-1;n<t;n++)N=s.get(v-1,n),s.set(v-1,n,I*N+k*s.get(v,n)),s.set(v,n,I*s.get(v,n)-k*N);for(o=0;o<=v;o++)N=s.get(o,v-1),s.set(o,v-1,I*N+k*s.get(o,v)),s.set(o,v,I*s.get(o,v)-k*N);for(o=y;o<=A;o++)N=r.get(o,v-1),r.set(o,v-1,I*N+k*r.get(o,v)),r.set(o,v,I*r.get(o,v)-k*N)}else i[v-1]=u+k,i[v]=u+k,e[v-1]=N,e[v]=-N;v-=2,M=0}else{if(u=s.get(v,v),f=0,d=0,c<v&&(f=s.get(v-1,v-1),d=s.get(v,v-1)*s.get(v-1,v)),10===M){for(_+=u,o=y;o<=v;o++)s.set(o,o,s.get(o,o)-u);E=Math.abs(s.get(v,v-1))+Math.abs(s.get(v-1,v-2)),u=f=.75*E,d=-.4375*E*E}if(30===M&&(E=(f-u)/2,E=E*E+d,E>0)){for(E=Math.sqrt(E),f<u&&(E=-E),E=u-d/((f-u)/2+E),o=y;o<=v;o++)s.set(o,o,s.get(o,o)-E);_+=E,u=f=d=.964}for(M+=1,l=v-2;l>=c&&(N=s.get(l,l),S=u-N,E=f-N,k=(S*E-d)/s.get(l+1,l)+s.get(l,l+1),I=s.get(l+1,l+1)-N-S-E,S=s.get(l+2,l+1),E=Math.abs(k)+Math.abs(I)+Math.abs(S),k/=E,I/=E,S/=E,l!==c)&&!(Math.abs(s.get(l,l-1))*(Math.abs(I)+Math.abs(S))<C*(Math.abs(k)*(Math.abs(s.get(l-1,l-1))+Math.abs(N)+Math.abs(s.get(l+1,l+1)))));)l--;for(o=l+2;o<=v;o++)s.set(o,o-2,0),o>l+2&&s.set(o,o-3,0);for(a=l;a<=v-1&&(b=a!==v-1,a!==l&&(k=s.get(a,a-1),I=s.get(a+1,a-1),S=b?s.get(a+2,a-1):0,u=Math.abs(k)+Math.abs(I)+Math.abs(S),0!==u&&(k/=u,I/=u,S/=u)),0!==u);a++)if(E=Math.sqrt(k*k+I*I+S*S),k<0&&(E=-E),0!==E){for(a!==l?s.set(a,a-1,-E*u):c!==l&&s.set(a,a-1,-s.get(a,a-1)),k+=E,u=k/E,f=I/E,N=S/E,I/=k,S/=k,n=a;n<t;n++)k=s.get(a,n)+I*s.get(a+1,n),b&&(k+=S*s.get(a+2,n),s.set(a+2,n,s.get(a+2,n)-k*N)),s.set(a,n,s.get(a,n)-k*u),s.set(a+1,n,s.get(a+1,n)-k*f);for(o=0;o<=Math.min(v,a+3);o++)k=u*s.get(o,a)+f*s.get(o,a+1),b&&(k+=N*s.get(o,a+2),s.set(o,a+2,s.get(o,a+2)-k*S)),s.set(o,a,s.get(o,a)-k),s.set(o,a+1,s.get(o,a+1)-k*I);for(o=y;o<=A;o++)k=u*r.get(o,a)+f*r.get(o,a+1),b&&(k+=N*r.get(o,a+2),r.set(o,a+2,r.get(o,a+2)-k*S)),r.set(o,a,r.get(o,a)-k),r.set(o,a+1,r.get(o,a+1)-k*I)}}}if(0===x)return;for(v=t-1;v>=0;v--)if(k=i[v],I=e[v],0===I)for(c=v,s.set(v,v,1),o=v-1;o>=0;o--){for(d=s.get(o,o)-k,S=0,n=c;n<=v;n++)S+=s.get(o,n)*s.get(n,v);if(e[o]<0)N=d,E=S;else if(c=o,0===e[o]?s.set(o,v,0!==d?-S/d:-S/(C*x)):(u=s.get(o,o+1),f=s.get(o+1,o),I=(i[o]-k)*(i[o]-k)+e[o]*e[o],h=(u*E-N*S)/I,s.set(o,v,h),s.set(o+1,v,Math.abs(u)>Math.abs(N)?(-S-d*h)/u:(-E-f*h)/N)),h=Math.abs(s.get(o,v)),C*h*h>1)for(n=o;n<=v;n++)s.set(n,v,s.get(n,v)/h)}else if(I<0)for(c=v-1,Math.abs(s.get(v,v-1))>Math.abs(s.get(v-1,v))?(s.set(v-1,v-1,I/s.get(v,v-1)),s.set(v-1,v,-(s.get(v,v)-k)/s.get(v,v-1))):(F=Ev(0,-s.get(v-1,v),s.get(v-1,v-1)-k,I),s.set(v-1,v-1,F[0]),s.set(v-1,v,F[1])),s.set(v,v-1,0),s.set(v,v,1),o=v-2;o>=0;o--){for(p=0,g=0,n=c;n<=v;n++)p+=s.get(o,n)*s.get(n,v-1),g+=s.get(o,n)*s.get(n,v);if(d=s.get(o,o)-k,e[o]<0)N=d,S=p,E=g;else if(c=o,0===e[o]?(F=Ev(-p,-g,d,I),s.set(o,v-1,F[0]),s.set(o,v,F[1])):(u=s.get(o,o+1),f=s.get(o+1,o),m=(i[o]-k)*(i[o]-k)+e[o]*e[o]-I*I,w=2*(i[o]-k)*I,0===m&&0===w&&(m=C*x*(Math.abs(d)+Math.abs(I)+Math.abs(u)+Math.abs(f)+Math.abs(N))),F=Ev(u*S-N*p+I*g,u*E-N*g-I*p,m,w),s.set(o,v-1,F[0]),s.set(o,v,F[1]),Math.abs(u)>Math.abs(N)+Math.abs(I)?(s.set(o+1,v-1,(-p-d*s.get(o,v-1)+I*s.get(o,v))/u),s.set(o+1,v,(-g-d*s.get(o,v)-I*s.get(o,v-1))/u)):(F=Ev(-S-f*s.get(o,v-1),-E-f*s.get(o,v),N,I),s.set(o+1,v-1,F[0]),s.set(o+1,v,F[1]))),h=Math.max(Math.abs(s.get(o,v-1)),Math.abs(s.get(o,v))),C*h*h>1)for(n=o;n<=v;n++)s.set(n,v-1,s.get(n,v-1)/h),s.set(n,v,s.get(n,v)/h)}for(o=0;o<t;o++)if(o<y||o>A)for(n=o;n<t;n++)r.set(o,n,s.get(o,n));for(n=t-1;n>=y;n--)for(o=y;o<=A;o++){for(N=0,a=y;a<=Math.min(n,A);a++)N+=r.get(o,a)*s.get(a,n);r.set(o,n,N)}}(o,c,a,n,t)}this.n=o,this.e=c,this.d=a,this.V=n}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,i=this.n,r=this.e,s=this.d,o=new pv(i,i);for(t=0;t<i;t++){for(e=0;e<i;e++)o.set(t,e,0);o.set(t,t,s[t]),r[t]>0?o.set(t,t+1,r[t]):r[t]<0&&o.set(t,t-1,r[t])}return o}}function Ev(t,e,i,r){let s,o;return Math.abs(i)>Math.abs(r)?(s=r/i,o=i+s*r,[(t+s*e)/o,(e-s*t)/o]):(s=i/r,o=r+s*i,[(s*t+e)/o,(s*e-t)/o])}class Nv{constructor(t){if(!(t=vv.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");let e,i,r,s=t,o=s.rows,n=new pv(o,o),a=!0;for(i=0;i<o;i++){let t=0;for(r=0;r<i;r++){let o=0;for(e=0;e<r;e++)o+=n.get(r,e)*n.get(i,e);o=(s.get(i,r)-o)/n.get(r,r),n.set(i,r,o),t+=o*o}for(t=s.get(i,i)-t,a&&(a=t>0),n.set(i,i,Math.sqrt(Math.max(t,0))),r=i+1;r<o;r++)n.set(i,r,0)}this.L=n,this.positiveDefinite=a}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=vv.checkMatrix(t);let e=this.L,i=e.rows;if(t.rows!==i)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let r,s,o,n=t.columns,a=t.clone();for(o=0;o<i;o++)for(s=0;s<n;s++){for(r=0;r<o;r++)a.set(o,s,a.get(o,s)-a.get(r,s)*e.get(o,r));a.set(o,s,a.get(o,s)/e.get(o,o))}for(o=i-1;o>=0;o--)for(s=0;s<n;s++){for(r=o+1;r<i;r++)a.set(o,s,a.get(o,s)-a.get(r,s)*e.get(r,o));a.set(o,s,a.get(o,s)/e.get(o,o))}return a}get lowerTriangularMatrix(){return this.L}}class Mv{constructor(t,e={}){t=vv.checkMatrix(t);let{Y:i}=e;const{scaleScores:r=!1,maxIterations:s=1e3,terminationCriteria:o=1e-10}=e;let n;if(i){if(i=$F.isAnyArray(i)&&"number"==typeof i[0]?pv.columnVector(i):vv.checkMatrix(i),i.rows!==t.rows)throw new Error("Y should have the same number of rows as X");n=i.getColumnVector(0)}else n=t.getColumnVector(0);let a,c,l,h,d=1;for(let e=0;e<s&&d>o;e++)l=t.transpose().mmul(n).div(n.transpose().mmul(n).get(0,0)),l=l.div(l.norm()),a=t.mmul(l).div(l.transpose().mmul(l).get(0,0)),e>0&&(d=a.clone().sub(h).pow(2).sum()),h=a.clone(),i?(c=i.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),c=c.div(c.norm()),n=i.mmul(c).div(c.transpose().mmul(c).get(0,0))):n=a;if(i){let e=t.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0));e=e.div(e.norm());let r=t.clone().sub(a.clone().mmul(e.transpose())),s=n.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),o=i.clone().sub(a.clone().mulS(s.get(0,0)).mmul(c.transpose()));this.t=a,this.p=e.transpose(),this.w=l.transpose(),this.q=c,this.u=n,this.s=a.transpose().mmul(a),this.xResidual=r,this.yResidual=o,this.betas=s}else this.w=l.transpose(),this.s=a.transpose().mmul(a).sqrt(),this.t=r?a.clone().div(this.s.get(0,0)):a,this.xResidual=t.sub(a.mmul(l.transpose()))}}zF.AbstractMatrix=dv,zF.CHO=Nv,zF.CholeskyDecomposition=Nv,zF.DistanceMatrix=mv,zF.EVD=Sv,zF.EigenvalueDecomposition=Sv,zF.LU=yv,zF.LuDecomposition=yv;var Rv=zF.Matrix=pv;zF.MatrixColumnSelectionView=class extends wv{constructor(t,e){nv(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,i){return this.matrix.set(t,this.columnIndices[e],i),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}},zF.MatrixColumnView=class extends wv{constructor(t,e){iv(t,e),super(t,t.rows,1),this.column=e}set(t,e,i){return this.matrix.set(t,this.column,i),this}get(t){return this.matrix.get(t,this.column)}},zF.MatrixFlipColumnView=class extends wv{constructor(t){super(t,t.rows,t.columns)}set(t,e,i){return this.matrix.set(t,this.columns-e-1,i),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}},zF.MatrixFlipRowView=class extends wv{constructor(t){super(t,t.rows,t.columns)}set(t,e,i){return this.matrix.set(this.rows-t-1,e,i),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}},zF.MatrixRowSelectionView=class extends wv{constructor(t,e){ov(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,i){return this.matrix.set(this.rowIndices[t],e,i),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}},zF.MatrixRowView=class extends wv{constructor(t,e){ev(t,e),super(t,1,t.columns),this.row=e}set(t,e,i){return this.matrix.set(this.row,e,i),this}get(t,e){return this.matrix.get(this.row,e)}},zF.MatrixSelectionView=bv,zF.MatrixSubView=class extends wv{constructor(t,e,i,r,s){av(t,e,i,r,s),super(t,i-e+1,s-r+1),this.startRow=e,this.startColumn=r}set(t,e,i){return this.matrix.set(this.startRow+t,this.startColumn+e,i),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}},zF.MatrixTransposeView=class extends wv{constructor(t){super(t,t.columns,t.rows)}set(t,e,i){return this.matrix.set(e,t,i),this}get(t,e){return this.matrix.get(e,t)}},zF.NIPALS=Mv,zF.Nipals=Mv,zF.QR=Cv,zF.QrDecomposition=Cv,zF.SVD=_v,zF.SingularValueDecomposition=_v,zF.SymmetricMatrix=gv,zF.WrapperMatrix1D=Fv,zF.WrapperMatrix2D=vv,zF.correlation=function(t,e=t,i={}){t=new pv(t);let r=!1;if("object"!=typeof e||pv.isMatrix(e)||$F.isAnyArray(e)?e=new pv(e):(i=e,e=t,r=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:s=!0,scale:o=!0}=i;s&&(t.center("column"),r||e.center("column")),o&&(t.scale("column"),r||e.scale("column"));const n=t.standardDeviation("column",{unbiased:!0}),a=r?n:e.standardDeviation("column",{unbiased:!0}),c=t.transpose().mmul(e);for(let e=0;e<c.rows;e++)for(let i=0;i<c.columns;i++)c.set(e,i,c.get(e,i)*(1/(n[e]*a[i]))*(1/(t.rows-1)));return c},zF.covariance=function(t,e=t,i={}){t=new pv(t);let r=!1;if("object"!=typeof e||pv.isMatrix(e)||$F.isAnyArray(e)?e=new pv(e):(i=e,e=t,r=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:s=!0}=i;s&&(t=t.center("column"),r||(e=e.center("column")));const o=t.transpose().mmul(e);for(let e=0;e<o.rows;e++)for(let i=0;i<o.columns;i++)o.set(e,i,o.get(e,i)*(1/(t.rows-1)));return o};var Dv=zF.default=pv;zF.determinant=function t(e){if((e=pv.checkMatrix(e)).isSquare()){if(0===e.columns)return 1;let i,r,s,o;if(2===e.columns)return i=e.get(0,0),r=e.get(0,1),s=e.get(1,0),o=e.get(1,1),i*o-r*s;if(3===e.columns){let o,n,a;return o=new bv(e,[1,2],[1,2]),n=new bv(e,[1,2],[0,2]),a=new bv(e,[1,2],[0,1]),i=e.get(0,0),r=e.get(0,1),s=e.get(0,2),i*t(o)-r*t(n)+s*t(a)}return new yv(e).determinant}throw Error("determinant can only be calculated for a square matrix")};var Bv=zF.inverse=function(t,e=!1){return t=vv.checkMatrix(t),e?new _v(t).inverse():xv(t,pv.eye(t.rows))};zF.linearDependencies=function(t,e={}){const{thresholdValue:i=1e-9,thresholdError:r=1e-9}=e;let s=(t=pv.checkMatrix(t)).rows,o=new pv(s,s);for(let e=0;e<s;e++){let n=pv.columnVector(t.getRow(e)),a=t.subMatrixRow(kv(s,e)).transpose(),c=new _v(a).solve(n),l=pv.sub(n,a.mmul(c)).abs().max();o.setRow(e,Iv(l,c,e,i,r))}return o},zF.pseudoInverse=function(t,e=Number.EPSILON){if((t=pv.checkMatrix(t)).isEmpty())return t.transpose();let i=new _v(t,{autoTranspose:!0}),r=i.leftSingularVectors,s=i.rightSingularVectors,o=i.diagonal;for(let t=0;t<o.length;t++)Math.abs(o[t])>e?o[t]=1/o[t]:o[t]=0;return s.mmul(pv.diag(o).mmul(r.transpose()))},zF.solve=xv,zF.wrap=function(t,e){if($F.isAnyArray(t))return t[0]&&$F.isAnyArray(t[0])?new vv(t):new Fv(t,e);throw new Error("the argument is not an array")};const Tv=Rv;Dv.Matrix&&Dv.Matrix;const Lv=Bv;function zv(t,e,i,r,s,o,n){let a=i,c=Tv.eye(e.length,e.length,a);const l=s(e);let h=new Float64Array(t.x.length);for(let e=0;e<t.x.length;e++)h[e]=l(t.x[e]);let d=function(t,e,i,r,s,o){const n=i.length,a=t.x.length;let c=Tv.zeros(n,a),l=0;for(let h=0;h<n;h++){if(0===r[h])continue;let n=r[h],d=i.slice();d[h]+=n;let u=s(d);if(o){d=i.slice(),d[h]-=n,n*=2;let e=s(d);for(let i=0;i<a;i++)c.set(l,i,(e(t.x[i])-u(t.x[i]))/n)}else for(let i=0;i<a;i++)c.set(l,i,(e[i]-u(t.x[i]))/n);l++}return c}(t,h,e,r,s,o),u=function(t,e){const i=t.x.length;let r=new Tv(i,1);for(let s=0;s<i;s++)r.set(s,0,t.y[s]-e[s]);return r}(t,h),f=Lv(c.add(d.mmul(d.transpose().scale("row",{scale:n})))),p=d.mmul(u.scale("row",{scale:n}));return{perturbations:f.mmul(p),jacobianWeigthResidualError:p}}function Pv(t,e,i={}){let{checkTimeout:r,minValues:s,maxValues:o,parameters:n,weightSquare:a,damping:c,dampingStepUp:l,dampingStepDown:h,maxIterations:d,errorTolerance:u,centralDifference:f,gradientDifference:p,improvementThreshold:g}=function(t,e,i){let{timeout:r,minValues:s,maxValues:o,initialValues:n,weights:a=1,damping:c=.01,dampingStepUp:l=11,dampingStepDown:h=9,maxIterations:d=100,errorTolerance:u=1e-7,centralDifference:f=!1,gradientDifference:p=.1,improvementThreshold:g=.001}=i;if(c<=0)throw new Error("The damping option must be a positive number");if(!t.x||!t.y)throw new Error("The data parameter must have x and y elements");if(!BF(t.x)||t.x.length<2||!BF(t.y)||t.y.length<2)throw new Error("The data parameter elements must be an array with more than 2 points");if(t.x.length!==t.y.length)throw new Error("The data parameter elements must have the same size");let m,w,b=n||new Array(e.length).fill(1),F=t.y.length,v=b.length;if(o=o||new Array(v).fill(Number.MAX_SAFE_INTEGER),s=s||new Array(v).fill(Number.MIN_SAFE_INTEGER),o.length!==s.length)throw new Error("minValues and maxValues must be the same size");if(!BF(b))throw new Error("initialValues must be an array");if("number"==typeof p)p=new Array(b.length).fill(p);else{if(!BF(p))throw new Error("gradientDifference should be a number or array with length equal to the number of parameters");p.length!==v&&(p=new Array(v).fill(p[0]))}if("number"==typeof a){let t=1/a**2;m=()=>t}else{if(!BF(a))throw new Error("weights should be a number or array with length equal to the number of data points");if(a.length<t.x.length){let t=1/a[0]**2;m=()=>t}else m=t=>1/a[t]**2}if(void 0!==r){if("number"!=typeof r)throw new Error("timeout should be a number");let t=Date.now()+1e3*r;w=()=>Date.now()>t}else w=()=>!1;let y=new Array(t.x.length);for(let t=0;t<F;t++)y[t]=m(t);return{checkTimeout:w,minValues:s,maxValues:o,parameters:b,weightSquare:y,damping:c,dampingStepUp:l,dampingStepDown:h,maxIterations:d,errorTolerance:u,centralDifference:f,gradientDifference:p,improvementThreshold:g}}(t,e,i),m=TF(t,n,e,a),w=m<=u,b=0;for(;b<d&&!w;b++){let d=m,{perturbations:b,jacobianWeigthResidualError:F}=zv(t,n,c,p,e,f,a);for(let t=0;t<n.length;t++)n[t]=Math.min(Math.max(s[t],n[t]-b.get(t,0)),o[t]);if(m=TF(t,n,e,a),isNaN(m))break;if((d-m)/b.transpose().mmul(b.mulS(c).add(F)).get(0,0)>g?c=Math.max(c/h,1e-7):(m=d,c=Math.min(c*l,1e7)),r())throw new Error(`The execution time is over to ${i.timeout} seconds`);w=m<=u}return{parameterValues:n,parameterError:m,iterations:b}}class Ov{constructor(t){this.binScores=t}get_histogram(){let t=Math.max(...this.binScores),e=Math.floor(t/1e3),i=this.range(0,Math.floor(t/e)*e+e,e);const{counts:r,bins:s}=this.histogram(this.binScores,i);return{counts:r,bins:s}}range(t,e,i){const r=[];for(let s=t;s<e;s+=i)r.push(s);return r}histogram(t,e){const i=Array(e.length).fill(0);return t.forEach(t=>{for(let r=0;r<e.length-1;r++)if(t>=e[r]&&t<e[r+1]){i[r]++;break}}),{counts:i,bins:e}}normal_distribution([t,e,i]){return r=>t*Math.exp(-Math.pow(r-e,2)/(2*Math.pow(i,2)))/(Math.sqrt(2*Math.PI)*i)}get_initial_model_values(t,e){const i=e.slice(1,-1).reduce((t,e)=>t+e,0);if(0===i)return console.debug("Problem with fit: all data points have zero value. Return zeros instead fit parameters!"),[0,0,0];const r=(t[1]-t[0])*i,s=t.reduce((t,i,r)=>t+i*e[r],0)/i,o=t.reduce((t,i,r)=>t+e[r]*Math.pow(i-s,2),0),n=Math.sqrt(o/i);return[r,s,n]}normal_fit(t,e){const i={initialValues:this.get_initial_model_values(t,e),maxIterations:100};return Pv({x:t,y:e},this.normal_distribution,i)}}class Hv{constructor(t,e){this.binSize=t,this.refGenome=e,this.gcBin=this.getGCbinSize()}getGCbinSize(){for(let t of[1e5,1e4])if(this.binSize%t==0)return t;return!1}async getBinGC(){const t={};if(!this.gcBin)return t;const e="https://storage.googleapis.com/cnvpytor_data/gcInfoData/GCinfo.json";try{const i=(await Er.loadJson(e,{timeout:5e3})).find(t=>t.id===this.refGenome);if(!i)return console.warn("GC data not found for ",this.refGenome),t;const r=i.Bins.find(t=>t.BinSize===this.gcBin);if(!r)return console.warn("GC data not found for ",this.refGenome," Bin : ",this.gcBin),t;let s=`${e.split("/").slice(0,-1).join("/")}${r.fileURL}`;(await Er.load(s,{})).split("\n").forEach(e=>{if(""!==e.trim()){const[i,r,s,o,n]=e.split("\t");t[i]||(t[i]=[]),t[i].push({start:+r,gcContent:+s,gcCount:+o,atCount:+n})}})}catch(t){console.error(t),console.warn("Errors loading GC correction data.")}return t}}class Uv extends Hv{constructor(t,e,i){super(e,i),this.globalMean=0,this.globalStd=0,this.gcData={},this.gcFlag=!1,this.binScoreField="binScore",this.wigFeatures=t,this.binSize=e,this.refGenome=i}async apply_gcCorrection(){if(!this.wigFeatures)return console.error("BinScore data is not available."),null;const t=Object.values(this.wigFeatures).reduce((t,e)=>t.concat(e.filter(t=>t.binScore>0).map(t=>t.binScore)),[]);let e=new Ov(t);const{counts:i,bins:r}=e.get_histogram();let s=e.normal_fit(r,i);this.globalMean=s.parameterValues[1],this.globalStd=s.parameterValues[2],this.gcData=await this.getBinGC(),this.gcFlag=Object.keys(this.gcData).length>0,this.binScoreField=this.gcFlag?"gcCorrectedBinScore":"binScore",this.getGcCorrectionSignal(this.globalMean)}getGcCorrectionSignal(t){let e=this.getGcCorrection(t);Object.keys(this.wigFeatures).forEach(t=>{this.wigFeatures[t].forEach(t=>{t.binScore?t.gcCorrectedBinScore=Math.round(e[t.gc]*t.binScore):t.gcCorrectedBinScore=null})})}getGcCorrection(t){const e={};if(this.gcFlag){let i=this.getGCbinSize();const r={};let s=parseInt((this.binSize/i).toString());for(let t in this.wigFeatures)for(let e=0;e<this.wigFeatures[t].length;e++){let i={AT:0,GC:0};for(let r=e*s;r<e*s+s;r++)this.gcData[t][r]&&(i.GC+=this.gcData[t][r].gcCount,i.AT+=this.gcData[t][r].atCount);let o=Math.round(100*i.GC/(i.GC+i.AT));this.wigFeatures[t][e].gc=o,r[o]||(r[o]=[]),this.wigFeatures[t][e].binScore&&r[o].push(this.wigFeatures[t][e].binScore)}Object.keys(r).forEach(i=>{let s,o=r[i];if(o.length<4)s=o.reduce((t,e)=>t+e,0)/o.length;else{let t=new Ov(r[i]);const{counts:e,bins:o}=t.get_histogram();s=t.normal_fit(o,e).parameterValues[1]}e[i]=t/s})}return e}formatDataStructure(t,e=1){const i=[];for(const[s,o]of Object.entries(this.wigFeatures))for(let s of o){var r={...s};1!=e&&(r.value=s[t]/e*2),i.push(r)}return i}formatDataStructure_BAF(t,e=-1){const i=[],r=[];for(const[s,o]of Object.entries(this.wigFeatures))o.forEach(s=>{var o={...s},n={...s};let a=s[t];.5!=a&&(n.value=e*(1-a),r.push(n)),o.value=e*a,i.push(o)});return[i,r]}}function Vv(t){return t.reduce(function(t,e){return t>e?t:e})}function qv(t,e,i,r){return e*Math.exp(-1*(t-i)**2/(2*r**2))/Math.sqrt(2*Math.PI)/r}function Qv(t,e,i,r){return Math.exp(-1*(t-i)**2/(e**2+r**2))}function Gv(t,e){let i;try{i=t.reduce((t,i,r)=>t+Math.min(i,e[r]))}catch(i){return console.log("Failed to find likelihood overlap: ",t,e),0}return i}function Wv(t,e,i,r){return 0==e&&0==r?{nl:.5*(t+i),ne:0}:{nl:(t*r*r+i*e*e)/(e*e+r*r),ne:Math.sqrt(e*e*r*r/(e*e+r*r))}}function jv(t,e){let i=parseInt((e*(t.length-1)).toString()),r=e*(t.length-1)-i;return i<t.length-1?t[i]*(1-r)+t[i+1]*r:t[i]}function $v(t){const e=t.length,i=Math.max(...t);let r=t.indexOf(i);r>Math.floor(e/2)&&(r=e-1-r);const s=(e/2-r)/(e+1),o=Math.floor((e/2+r)/2),n=e-1-o;let a=t.slice(o,n+1).reduce((t,e)=>t+e,0)/t.reduce((t,e)=>t+e,0);return r===Math.floor(e/2)&&(a=1),{mean:s,p:a}}var Kv={CombinedCaller:class extends Uv{constructor(t,e,i){super(t,e,i)}async call_2d(t=null,e=null,i="both",r=.1,s=0,o=10,n=0){await this.apply_gcCorrection();let a=this.gcFlag?"gcCorrectedBinScore":"binScore",c=null==t?.05*this.binSize/3e9:t,l=null==e?parseInt((this.binSize/1e4).toString()):e,h=[],d=[],u=[],f=[],p=[],g=[];for(const[t,e]of Object.entries(this.wigFeatures)){let t=[],i=[],o=[];e.forEach((e,r)=>{e.hets_count>4&&e.dp_count>l&&e[a]&&(t.push([r]),i.push(e[a]),o.push(e.likelihood_score),delete e.likelihood_score)});let n=[];for(let t=1;t<i.length;t++)n.push(Math.abs(i[t]-i[t-1]));let g=[0];for(let t=1;t<n.length;t++)g.push(Math.min(n[t-1],n[t]));g.push(0);let m=i.map((t,e)=>Math.sqrt(Math.sqrt(t)**2+this.globalStd**2+Math.pow(g[e]/2,2))),w=[];for(let e=0;e<t.length-1;e++){let r=0;try{r=Gv(o[e],o[e+1])}catch(i){console.log("Overlap failed: ",e,o[e],t[e+1],o[e+1])}let s=Qv(i[e],m[e],i[e+1],m[e+1]);w.push(s*r)}for(;w.length>0;){w=w.filter(t=>"number"==typeof t);let e=Vv(w);if(isNaN(e)&&console.log("NaN value",w),e<c)break;let r=w.indexOf(e),s=Wv(i[r],m[r],i[r+1],m[r+1]),n=[],a=0;try{n=o[r].map((t,e)=>t*o[r+1][e]),a=n.reduce((t,e)=>t+e)}catch(t){console.log(o),console.log("max_overlap:",e,r,w.length),console.log("likelihood: ",r,o[r],o[r+1]),console.log("nlh: ",a)}if(i[r]=s.nl,m[r]=s.ne,o[r]=n.map(function(t){return t/a}),t[r].push(...t[r+1]),i.splice(r+1,1),m.splice(r+1,1),t.splice(r+1,1),o.splice(r+1,1),w.splice(r,1),r<w.length){let t=Qv(i[r],m[r],i[r+1],m[r+1])*Gv(o[r],o[r+1]);w[r]=t}if(r>0){let t=Qv(i[r-1],m[r-1],i[r],m[r])*Gv(o[r-1],o[r]);w[r-1]=t}}let b=-1;for(;;){w=[];for(let e=0;e<i.length;e++)for(let s=e;s<i.length;s++)t[s][0]-t[e][t[e].length-1]<r*(t[e].length+t[s].length)&&w.push(Qv(i[e],m[e],i[s],m[s])*Gv(o[e],o[s]));if(0==w.length)break;let e=Vv(w);if(e<c)break;let s=0,n=1;for(;s<t.length-1;){let a=Qv(i[s],m[s],i[n],m[n])*Gv(o[s],o[n]);if(t[n][0]-t[s][t[s].length-1]<r*(t[s].length+t[n].length)&&a==e){let e=Wv(i[s],m[s],i[s+1],m[s+1]);i[s]=e.nl,m[s]=e.ne;let r=o[s].map((t,e)=>t*o[s+1][e]),a=r.reduce((t,e)=>t+e);o[s]=r.map(function(t){return t/a}),t[s].push(...t[s+1]),t[s]=t[s].sort((t,e)=>t-e),i.splice(n,1),m.splice(n,1),t.splice(n,1),o.splice(n,1),n>=t.length&&(s+=1,n=s+1)}else n+=1,n>=t.length&&(s+=1,n=s+1)}if(b==t.length)break;b=t.length}t.forEach((t,r)=>{let n=$v(o[r]);t.length>1&&(t.forEach((t,o)=>{d.push(e[t]),n.mean<=s&&h.push(e[t]),e[t].segment_score=i[r]}),u.push(i[r]),f.push(m[r]),p.push(o[r]))})}let m=parseInt((1e3*(1-n)).toString());0==m&&(m=1);let w=AF.linspace(n,1,m),b={},F={};for(let t=10;t>-1;t--)for(let e=0;e<t/2+1;e++){let r,s,o=t-e,n=w.map((e,i)=>1-e+e*t/2),a=t/2;t>0?(r=.5-e/(e+o),s=w.map((t,i)=>.5-(1-t+t*e)/(2-2*t+(e+o)*t))):(r=0,s=w.map((t,e)=>0*t));for(let i=0;i<u.length;i++){let c=qv(a*this.globalMean,1,u[i],f[i])*jv(p[i],.5+r);i in F?F[i].push([t,e,o,c,1]):F[i]=[[t,e,o,c,1]];let l=0,h=0,d=0;n.forEach((t,e)=>{if(!isNaN(s[e])){let r=qv(t*this.globalMean,1,u[i],f[i])*jv(p[i],.5+s[e]);l+=r,r>h&&(h=r,d=w[e])}}),i in b?b[i].push([t,e,o,l/w.length,d]):b[i]=[[t,e,o,l/w.length,d]]}for(let t=0;t<u.length;t++)if("germline"==i)b[t].sort((t,e)=>t[3]-e[3]);else if(b[t].sort((t,e)=>t[3]-e[3]),"both"==i&&(F[t].sort((t,e)=>t[3]-e[3]),F[t][0][3]>b[t][0][3])){let e=b[t].filter(e=>e[0]!=F[t][0][0]&&e[1]<=F[t][0][1]);b[t]=[F[t][0],...e]}for(let t=0;t<u.length;t++)b[t][0][0],b[t][0][0],u[t],this.globalMean,RF.t_test_1_sample(this.globalMean,u[t],f[t],g[t])}var v=this.formatDataStructureWig(this.wigFeatures,"binScore",this.globalMean);let y=[];return this.gcFlag&&(y=this.formatDataStructureWig(this.wigFeatures,"gcCorrectedBinScore",this.globalMean)),{binScore:v,gcCorrectedBinScore:y,segmentScore:this.formatDataStructureWig(this.wigFeatures,"segment_score",this.globalMean)}}formatDataStructureWig(t,e,i=1){const r=[];for(const[s,o]of Object.entries(t))o.forEach(t=>{var s={...t};1!=i&&(s.value=t[e]/i*2),r.push(s)});return r}}};const Zv=2871e6;function Yv(t){for(var e=1,i=1,r=1*t,s=1;s<50;s++)e*=s,r+=(i*=-1)*Math.pow(t,2*s+1)/(e*(2*s+1));return 2*r/Math.sqrt(3.14159265358979)}function Xv(t,e,i,r,s){var o=new ey(i.slice(r,s));return 0==o.std&&(o.std=e>0?e*o.mean/t:1),iy(t,o.mean,o.std,s-r)/(s-r)}function Jv(t,e,i,r,s){var o=new ey(i.slice(r,s));if(o.mean<t){var n=(o.max-o.mean)/(e*Math.sqrt(2));return Math.pow(.5*(1+Yv(n)),s-r)}n=(o.min-o.mean)/(e*Math.sqrt(2));return Math.pow(.5*(1-Yv(n)),s-r)}function ty(t,e,i,r,s,o,n=1e3){for(var a=Xv(t,e,i,r,s),c=0,l=!1;a>o&&!l&&c<n;){l=!0,c+=1;var[h,d,u,f]=[1e10,1e10,1e10,1e10];r>0&&(h=Xv(t,e,i,r-1,s)),s-r>2&&(d=Xv(t,e,i,r+1,s),u=Xv(t,e,i,r,s-1)),s<i.length&&(f=Xv(t,e,i,r,s+1));const o=Math.min(h,d,u,f);o<a&&(l=!1,h==o?(r-=1,a=h):d==o?(r+=1,a=d):u==o?(s-=1,a=u):f==o&&(s+=1,a=f))}return a<=o?[r,s]:0}class ey{constructor(t){this.data=t,this.mean=t.reduce((t,e)=>t+e)/t.length,this.std=Math.sqrt(t.reduce((t,e)=>(e-this.mean)**2)/t.length)}}function iy(t,e,i,r){0==i&&(i=1);var s=(t-e)/i*Math.sqrt(r);return 1-RF.TdistributionCDF(Math.abs(s),r-1)}function ry(t,e,i,r,s,o){0==e&&(e=1),0==s&&(s=1);var n=(t-r)/Math.sqrt(e**2/i+s**2/o),a=(e**2/i+s**2/o)**2*(i-1)*(o-1)/(e**4*(o-1)/i**2+s**4*(i-1)/o**2);return 1-RF.TdistributionCDF(Math.abs(n),parseInt((a+.5).toString()))}var sy={Partition:class{constructor(t,e,i){this.rd=t,this.mean=e,this.std=i,this.bin_bands=[2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128]}get_rd_signal_bandwidth(t){var e=[];return t.forEach((t,i)=>{var r=0;r=t>this.mean/4?this.mean/(this.std**2*t):4/this.std**2,e.push(r)}),e}meanShiftCaller(t,e=3){var i={};const r=this.rd;return Object.entries(r).forEach(([r,s])=>{var o=new Array(s.length).fill(!1),n=new Array(s.length);for(let t=0;t<s.length;t++)o[t]||(n[t]=s[t]);this.bin_bands.forEach((i,r)=>{var a=o.map((t,e)=>!t),c=[];Object.entries(s).forEach(([t,e])=>{c.push(e.binScore)});var l=[0],h=0;for(let t=0;t<o.length;t++)o[t]?h>0&&(l.push(l[l.length-1]+h-1),h=0):h+=1;l.shift();for(let t=0;t<e;t++){var d=this.get_rd_signal_bandwidth(c),u=new Array(c.length).fill(0);for(let t=0;t<c.length;t++)for(let e=t-3*i;e<=t+3*i+1;e++)if(!(e<0||e>=c.length||Math.abs(t-e)>=c.length)){var f=(e-t)*Math.exp(-.5*(e-t)**2/i**2)*Math.exp(-.5*(c[t]-c[e])**2*d[t]);u[t]+=f}for(var p=[],g=0;g<u.length-1;g++)u[g]<0&&u[g+1]>=0&&p.push(g);p.push(u.length-1),p=p.concat(l).sort((t,e)=>t-e),p=Array.from(new Set(p));var m=0;for(g=0;g<p.length;g++){var w=c.slice(m,p[g]+1),b=w.reduce((t,e)=>t+e)/w.length;c.fill(b,m,p[g]+1),m=p[g]+1}}g=0;for(var F=0;g<n.length;g++)a[g]&&(n[g]=c[F],F++);for(p=[],g=0;g<n.length-1;g++){Math.abs(n[g+1]-n[g])>.01&&p.push(g+1)}p.unshift(0),p.push(n.length),o=new Array(s.length).fill(!1);for(g=1;g<p.length;g++){var v=[p[g-1],p[g]],y=[p[g-1],p[g-1]];if(!(g>1))continue;y[0]=p[g-2];var A=[p[g],p[g]];if(!(g<p.length-1))continue;A[1]=p[g+1];var C=v[1]-v[0],_=y[1]-y[0],x=A[1]-A[0];if(C<=1)continue;var k=new ey(n.slice(v[0],v[1]));if(x<=15||_<=15||C<=15){var I=1.8*Math.sqrt(n[y[0]]/this.mean)*this.std;if(Math.abs(n[y[0]]-n[v[0]])<I)continue;if(I=1.8*Math.sqrt(n[A[0]]/this.mean)*this.std,Math.abs(n[A[0]]-n[v[0]])<I)continue}else{var S=n.slice(y[0],y[1]),E=new ey(S),N=n.slice(A[0],A[1]),M=new ey(N);if(ry(k.mean,k.std,k.data.length,E.mean,E.std,E.data.length)>.01/Zv*t*(C+_))continue;if(ry(k.mean,k.std,k.data.length,M.mean,M.std,M.data.length)>.01/Zv*t*(C+x))continue}if(iy(this.mean,k.mean,k.std,k.data.length)>.05)continue;let e=c.slice(v[0],v[1]);var R=new ey(e);o.fill(!0,v[0],v[1]),n.fill(R.mean,v[0],v[1])}}),i[r]=n}),i}call_mean_shift(t=3){const e=this.rd;for(var i=new Array(e.length).fill(!1),r=new Array(e.length),s=0;s<e.length;s++)i[s]||(r[s]=e[s]);return this.bin_bands.forEach((s,o)=>{var n=i.map((t,e)=>!t),a=[];n.forEach((t,i)=>{t&&a.push(e[i])});for(var c=[0],l=0,h=0;h<i.length;h++)i[h]?l>0&&(c.push(c[c.length-1]+l-1),l=0):l+=1;c.shift();for(var d=0;d<t;d++){var u=this.get_rd_signal_bandwidth(a),f=new Array(a.length).fill(0);for(h=0;h<a.length;h++)for(var p=h-3*s;p<=h+3*s+1;p++)if(!(p<0||p>=a.length||Math.abs(h-p)>=a.length)){var g=(p-h)*Math.exp(-.5*(p-h)**2/s**2)*Math.exp(-.5*(a[h]-a[p])**2*u[h]);f[h]+=g}var m=[];for(h=0;h<f.length-1;h++)f[h]<0&&f[h+1]>=0&&m.push(h);m.push(f.length-1),m=m.concat(c).sort((t,e)=>t-e),m=Array.from(new Set(m));var w=0;for(h=0;h<m.length;h++){var b=a.slice(w,m[h]+1),F=b.reduce((t,e)=>t+e)/b.length;a.fill(F,w,m[h]+1),w=m[h]+1}}for(h=0,p=0;h<r.length;h++)n[h]&&(r[h]=a[p],p++);for(m=[],h=0;h<r.length-1;h++){Math.abs(r[h+1]-r[h])>.01&&m.push(h+1)}m.unshift(0),m.push(r.length),i=new Array(e.length).fill(!1);for(h=1;h<m.length;h++){var v=[m[h-1],m[h]],y=[m[h-1],m[h-1]];if(h>1){y[0]=m[h-2];var A=[m[h],m[h]];if(h<m.length-1){A[1]=m[h+1];var C=v[1]-v[0],_=y[1]-y[0],x=A[1]-A[0];if(!(C<=1)){var k=new ey(r.slice(v[0],v[1]));if(x<=15||_<=15||C<=15){var I=1.8*Math.sqrt(r[y[0]]/this.mean)*this.std;if(Math.abs(r[y[0]]-r[v[0]])<I)continue;if(I=1.8*Math.sqrt(r[A[0]]/this.mean)*this.std,Math.abs(r[A[0]]-r[v[0]])<I)continue}else{var S=r.slice(y[0],y[1]),E=new ey(S),N=r.slice(A[0],A[1]),M=new ey(N);if(ry(k.mean,k.std,k.data.length,E.mean,E.std,E.data.length)>3.483106931382794e-9*(C+_))continue;if(ry(k.mean,k.std,k.data.length,M.mean,M.std,M.data.length)>3.483106931382794e-9*(C+x))continue}if(!(iy(this.mean,k.mean,k.std,k.data.length)>.05)){var R=new ey(e.slice(v[0],v[1]));i.fill(!0,v[0],v[1]),r.fill(R.mean,v[0],v[1])}}}}}}),r}cnv_calling(t=1e5){var e=.25*this.mean,i=this.mean-e,r=this.mean+e,s=2971e6,o=this.meanShiftCaller(t),n={},a=[];return Object.entries(o).forEach(([o,c])=>{for(var l=!1;!l;){l=!0;var h=new Array(1).fill(0);for(let t=0;t<c.length-1;t++){Math.abs(c[t+1]-c[t])>.01&&h.push(t+1)}h.push(c.length);for(let t=0;t<h.length-2;t++){var d=Math.abs(c[h[t]]-c[h[t+1]]);if(d<e){var u=d+1,f=d+1;if(t>0&&(u=Math.abs(c[h[t]]-c[h[t-1]])),t<h.length-3&&(f=Math.abs(c[h[t+1]]-c[h[t+2]])),d<u&&d<f){l=!1;var p=new ey(c.slice(h[t],h[t+2]));c.fill(p.mean,h[t],h[t+2]),h.splice(t+1,t+1)}}}}var g=[];this.rd[o].forEach(t=>{g.push(t.binScore)});for(var m,w=new Array(c.length).fill(""),b=0,F=.05*t/s;b<c.length;){for(var v=b,y=b;b<c.length&&c[b]<i;)b+=1;var A=b;if(A>y+1){var C=ty(this.mean,this.std,g,y,A,F);C&&([y,A]=C,w.fill("D",y,A))}for(y=b;b<c.length&&c[b]>r;)b+=1;(A=b)>y+1&&(C=ty(this.mean,this.std,g,y,A,F))&&([y,A]=C,w.fill("A",y,A)),b==v&&(b+=1)}for(b=0;b<c.length;){for(;b<c.length&&""!=w[b];)b+=1;for(y=b;b<c.length&&c[b]<i;)b+=1;(A=b)>y+1&&(Jv(this.mean,this.std,g,y,A)<1682935038707506e-26&&w.fill("d",y,A),b-=1),b+=1}(b=0)<c.length&&(m=w[b]),y=0;for(var _=[...g];b<c.length;){for(;w[b]==m&&!((b+=1)>=w.length););if(b>y){var x=new ey(_.slice(y,b));_.fill(x.mean,y,b)}b<c.length&&(m=w[b]),y=b}for(n[o]=_,b=0;b<c.length;){if(""==(m=w[b])){b+=1;continue}for(y=b;b<c.length&&m==w[b];)b+=1;let e,i=new ey(_.slice(y,b)).mean/this.mean;e="D"==m?"deletion":"duplication";let r={chr:o,start:t*y+1,end:t*b,size:t*(b-y+1),value:2*i,event_type:e};a.push(r)}}),[n,a]}},MeanShiftCaller:class extends Uv{constructor(t,e,i){super(t,e,i),this.binBands=[2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128]}async callMeanshift(t=3){await this.apply_gcCorrection();let e=this.partition();Object.entries(this.wigFeatures).forEach(([t,i])=>{i.forEach((i,r)=>{e[t]&&(i.partitionLevel=Math.trunc(e[t][r]))})});return{binScore:this.formatDataStructure("binScore",this.globalMean),gcCorrectedBinScore:this.formatDataStructure("gcCorrectedBinScore",this.globalMean),segmentsCNV:this.formatDataStructure("partitionLevel",this.globalMean)}}getRDSignalBandWidth(t){const e=this.globalMean/4,i=4/this.globalStd**2;return t.map(t=>t>e?this.globalMean/(this.globalStd**2*t):i)}partition(t=3){let e={};Object.keys(this.wigFeatures).sort((t,e)=>t.localeCompare(e,void 0,{numeric:!0})).forEach(t=>{e[t]=this.wigFeatures[t]});let i=this.gcFlag?"gcCorrectedBinScore":"binScore";var r={};for(const[n,a]of Object.entries(e)){var s=new Array(a.length).fill(!1),o=a.map((t,e)=>s[e]?0:t[i]);this.binBands.forEach((e,i)=>{var r=s.map((t,e)=>!t),n=o.filter((t,e)=>!s[e]),c=[0],l=0;s.forEach(t=>{t?l>0&&(c.push(c[c.length-1]+l-1),l=0):t||l++}),c.shift();for(let i=0;i<t;i++){var h=this.getRDSignalBandWidth(n),d=new Array(n.length).fill(0);for(let t=0;t<n.length;t++){const i=Math.max(0,t-3*e),r=Math.min(n.length-1,t+3*e+1);for(let s=i;s<=r;s++){var u=(s-t)*Math.exp(-.5*(s-t)**2/e**2)*Math.exp(-.5*(n[t]-n[s])**2*h[t]);d[t]+=u}}for(var f=[],p=0;p<d.length-1;p++)d[p]<0&&d[p+1]>=0&&f.push(p);f.push(d.length-1),f=f.concat(c).sort((t,e)=>t-e),f=Array.from(new Set(f));var g=0;for(p=0;p<f.length;p++){var m=n.slice(g,f[p]+1),w=m.reduce((t,e)=>t+e)/m.length;n.fill(w,g,f[p]+1),g=f[p]+1}}p=0;for(var b=0;p<o.length;p++)r[p]&&(o[p]=n[b],b++);for(f=[],p=0;p<o.length-1;p++){Math.abs(o[p+1]-o[p])>.01&&f.push(p+1)}f.unshift(0),f.push(o.length),s=new Array(a.length).fill(!1);for(p=1;p<f.length;p++){var F=[f[p-1],f[p]],v=[f[p-1],f[p-1]];if(!(p>1))continue;v[0]=f[p-2];var y=[f[p],f[p]];if(!(p<f.length-1))continue;y[1]=f[p+1];var A=F[1]-F[0],C=v[1]-v[0],_=y[1]-y[0];if(A<=1)continue;var x=new ey(o.slice(F[0],F[1]));if(_<=15||C<=15||A<=15){var k=1.8*Math.sqrt(o[v[0]]/this.globalMean)*this.globalStd;if(Math.abs(o[v[0]]-o[F[0]])<k)continue;if(k=1.8*Math.sqrt(o[y[0]]/this.globalMean)*this.globalStd,Math.abs(o[y[0]]-o[F[0]])<k)continue}else{var I=o.slice(v[0],v[1]),S=new ey(I),E=o.slice(y[0],y[1]),N=new ey(E);if(ry(x.mean,x.std,x.data.length,S.mean,S.std,S.data.length)>.01/Zv*this.binSize*(A+C))continue;if(ry(x.mean,x.std,x.data.length,N.mean,N.std,N.data.length)>.01/Zv*this.binSize*(A+_))continue}if(iy(this.globalMean,x.mean,x.std,x.data.length)>.05)continue;let t=n.slice(F[0],F[1]);var M=new ey(t);s.fill(!0,F[0],F[1]),o.fill(M.mean,F[0],F[1])}}),r[n]=o}return r}cnvCalling(t){var e=.25*this.globalMean,i=this.globalMean-e,r=this.globalMean+e,s=2971e6,o={},n=[];return Object.entries(t).forEach(([t,a])=>{for(var c=!1;!c;){c=!0;var l=new Array(1).fill(0);for(let t=0;t<a.length-1;t++){Math.abs(a[t+1]-a[t])>.01&&l.push(t+1)}l.push(a.length);for(let t=0;t<l.length-2;t++){var h=Math.abs(a[l[t]]-a[l[t+1]]);if(h<e){var d=h+1,u=h+1;if(t>0&&(d=Math.abs(a[l[t]]-a[l[t-1]])),t<l.length-3&&(u=Math.abs(a[l[t+1]]-a[l[t+2]])),h<d&&h<u){c=!1;var f=new ey(a.slice(l[t],l[t+2]));a.fill(f.mean,l[t],l[t+2]),l.splice(t+1,t+1)}}}}var p=[];Object.entries(this.wigFeatures[t]).forEach(([t,e])=>{p.push(e.binScore)});for(var g,m=new Array(a.length).fill(""),w=0,b=.05*this.binSize/s;w<a.length;){for(var F=w,v=w;w<a.length&&a[w]<i;)w+=1;var y=w;if(y>v+1){var A=ty(this.globalMean,this.std,p,v,y,b);A&&([v,y]=A,m.fill("D",v,y))}for(v=w;w<a.length&&a[w]>r;)w+=1;(y=w)>v+1&&(A=ty(this.globalMean,this.std,p,v,y,b))&&([v,y]=A,m.fill("A",v,y)),w==F&&(w+=1)}for(w=0;w<a.length;){for(;w<a.length&&""!=m[w];)w+=1;for(v=w;w<a.length&&a[w]<i;)w+=1;(y=w)>v+1&&(Jv(this.globalMean,this.std,p,v,y)<1682935038707506e-26&&m.fill("d",v,y),w-=1),w+=1}(w=0)<a.length&&(g=m[w]),v=0;for(var C=[...p];w<a.length;){for(;m[w]==g&&!((w+=1)>=m.length););if(w>v){var _=new ey(C.slice(v,w));C.fill(_.mean,v,w)}w<a.length&&(g=m[w]),v=w}for(o[t]=C,w=0;w<a.length;){if(""==(g=m[w])){w+=1;continue}for(v=w;w<a.length&&g==m[w];)w+=1;let e,i=new ey(C.slice(v,w)).mean/this.globalMean;e="D"==g?"deletion":"duplication";let r={chr:t,start:this.binSize*v+1,end:this.binSize*w,size:this.binSize*(w-v+1),value:2*i,event_type:e};n.push(r)}}),[o,n]}}};class oy{constructor(t,e,i){this.allVariants=t,this.rowBinSize=1e4,this.binSize=e,this.binFactor=parseInt((e/this.rowBinSize).toString()),this.refGenome=i,this.chromosomes=[]}async read_rd_baf(t="ReadDepth"){var e={};for(let t=this.allVariants.length-1;t>=0;t--){var i;let r=this.allVariants[t];this.allVariants.splice(t,1);let s=r.chr;i=Math.max(Math.floor(r.start/this.rowBinSize),0),e[s]||(e[s]=[]),e[s][i]||(e[s][i]={chr:s,start:i*this.rowBinSize,end:(i+1)*this.rowBinSize,dp_sum_score:0,dp_count:0,hets_count:0,hets:[]});const o=Object.values(r.calls);if(1!==o.length)throw Error(`Unexpected number of genotypes: ${o.length}. CNVPytor expects 1 and only 1 genotype`);const n=o[0],a=n.info.DP;a&&(e[s][i].dp_sum_score+=Number.parseInt(a),e[s][i].dp_count++);let c=n.info.AD.split(","),l=n.genotype;if(0==l[0]&&1==l[1]||1==l[0]&&0==l[1]){e[s][i].hets_count++;let t=parseInt(c[0]),r=parseInt(c[1]);e[s][i].hets.push({ref:t,alt:r})}}this.chromosomes=Object.keys(e);let r="ReadDepth"==t;var s=this.adjust_bin_size(e,r),o=[],n=[];if("ReadDepth"==t){let t=new sy.MeanShiftCaller(s,this.binSize,this.refGenome),e=await t.callMeanshift();o=[e.binScore,e.gcCorrectedBinScore,e.segmentsCNV],n=t.formatDataStructure_BAF("max_likelihood",-1)}else if("2D"==t){let t=new Kv.CombinedCaller(s,this.binSize,this.refGenome),e=await t.call_2d();o=[e.binScore,e.gcCorrectedBinScore,e.segmentScore],n=t.formatDataStructure_BAF("max_likelihood",-1)}return[o,n]}format_BAF_likelihood(t){const e=[];for(const[r,s]of Object.entries(t))for(let t of s){var i={...t};.5!=t.value&&(i.value=1-t.value,e.push(i))}return e}get_max_min_score(t){if(t.likelihood_score&&t.likelihood_score.length>0){const e=Math.max(...t.likelihood_score),i=t.likelihood_score.indexOf(e);t.value=Math.max(i/100,1-i/100),t.min_score=Math.min(i/100,1-i/100)}else t.score=0;return t}adjust_bin_size(t,e=!1){var i={};const r=this.binSize/150;for(let n of this.chromosomes){i[n]||(i[n]=[]);for(let a=0;a<t[n].length/this.binFactor;a++){const c=a;i[n][a]||(i[n][a]={chr:n,start:c*this.binSize,end:(c+1)*this.binSize,dp_count:0,hets_count:0,binScore:null,likelihood_score:[],dp_sum_score:0});for(var s=a*this.binFactor;s<this.binFactor*a+this.binFactor;s++)if(t[n][s]&&(i[n][a].dp_sum_score+=t[n][s].dp_sum_score,i[n][a].dp_count+=t[n][s].dp_count,i[n][a].hets_count+=t[n][s].hets_count,0!=t[n][s].hets.length))for(let e of t[n][s].hets)if(0==i[n][a].likelihood_score.length)i[n][a].likelihood_score=AF.linspace(0,1,100).map((t,i)=>ny(e.ref,e.alt,t));else{var o=0;i[n][a].likelihood_score=AF.linspace(0,1,100).map((t,r)=>{var s=i[n][a].likelihood_score[r]*ny(e.ref,e.alt,t);return o+=s,s}),i[n][a].likelihood_score=AF.linspace(0,1,100).map((t,e)=>i[n][a].likelihood_score[e]/o)}i[n][a].dp_count>0&&(i[n][a].binScore=i[n][a].dp_sum_score/i[n][a].dp_count*r);const l=this.get_max_min_score(i[n][a]);i[n][a].max_likelihood=l.value,e&&delete i[n][a].likelihood_score}}return i}}function ny(t,e,i,r=!0){return Math.pow(i,t)*Math.pow(1-i,e)+Math.pow(i,e)*Math.pow(1-i,t)}class ay extends lc{constructor(t,e){super(t,e)}init(t){this.featureType="numeric",this.type="cnvpytor",t.max||(this.defaultScale=!0,this.autoscale=!1),t.height||(t.height=ay.DEFAULT_TRACK_HEIGHT),this.type="cnvpytor",this.graphType=t.graphType||"points",this.bin_size=t.bin_size||1e5,this.signal_name=t.signal_name||"rd_snp",this.cnv_caller=t.cnv_caller||"2D",this.colors=t.colors||["gray","black","green","blue"],this.hasChroms={},super.init(t)}get supportsWholeGenome(){return!0}get_signals(){let t=[];return"rd_snp"==this.signal_name?t=["RD_Raw","RD_Raw_gc_coor",this.cnv_caller,"BAF1","BAF2"]:"rd"==this.signal_name?t=["RD_Raw","RD_Raw_gc_coor",this.cnv_caller]:"snp"==this.signal_name?t=["BAF1","BAF2"]:"cnh"==this.signal_name&&(t=[this.cnv_caller]),t}get_signal_colors(){return[{singal_name:"RD_Raw",color:this.colors[0]},{singal_name:"RD_Raw_gc_coor",color:this.colors[1]},{singal_name:"ReadDepth",color:this.colors[2]},{singal_name:"2D",color:this.colors[2]},{singal_name:"BAF1",color:this.colors[3]},{singal_name:"BAF2",color:this.colors[3]}]}async postInit(){if("vcf"==this.config.format){let t;this.featureSource?t=Object.values(this.featureSource.getAllFeatures()).flat():(this.featureSource=this.featureSource||_h(this.config,this.browser.genome),this.header=await this.getHeader(),t=this.featureSource.reader.features);const e=this.browser.config.genome,i=new oy(t,this.bin_size,e);let r,s,o;this.wigFeatures_obj={},this.wigFeatures_obj[this.bin_size]={},"2D"==this.cnv_caller?(o=await i.read_rd_baf("2D"),r=o[0],s=o[1],this.wigFeatures_obj[this.bin_size]["2D"]=r[2],this.available_callers=["2D"]):(o=await i.read_rd_baf(),r=o[0],s=o[1],this.wigFeatures_obj[this.bin_size].ReadDepth=r[2],this.available_callers=["ReadDepth"]),this.wigFeatures_obj[this.bin_size].RD_Raw=r[0],this.wigFeatures_obj[this.bin_size].RD_Raw_gc_coor=r[1],this.wigFeatures_obj[this.bin_size].BAF1=s[0],this.wigFeatures_obj[this.bin_size].BAF2=s[1],this.available_bins=[this.bin_size],this.set_available_callers()}else{this.cnvpytor_obj=new bF(this.config,this.bin_size);let t=[...new Set(this.browser.referenceFrameList.map(t=>t.chr))],e=this.getAliasChromsList(t);this.wigFeatures_obj=await this.cnvpytor_obj.get_rd_signal(this.bin_size,e),this.update_hasChroms(this.wigFeatures_obj,t),this.available_bins=this.cnvpytor_obj.availableBins,this.available_bins.includes(this.bin_size)||(this.bin_size=this.available_bins.at(-1)),this.available_callers=this.cnvpytor_obj.callers,this.set_available_callers()}this.tracks=[];const t=[];this.signals=this.get_signals(),this.signal_colors=this.get_signal_colors();for(let e in this.wigFeatures_obj)for(const[i,r]of Object.entries(this.wigFeatures_obj[e]))if(this.signals.includes(i)){const e={type:"wig",isMergedTrack:!0};e.features=r,e.name=i,e.color=this.signal_colors.filter(t=>t.singal_name===i).map(t=>t.color);const s=await this.browser.createTrack(e);s?(s.autoscale=!1,this.tracks.push(s),"function"==typeof s.postInit&&t.push(s.postInit())):console.warn("Could not create track "+e)}this.flipAxis=!!this.config.flipAxis&&this.config.flipAxis,this.logScale=!!this.config.logScale&&this.config.logScale,this.autoscale=this.config.autoscale,this.autoscale||(this.dataRange={min:this.config.min||0,max:this.config.max});for(let t of this.tracks)t.autoscale=!1,t.dataRange=this.dataRange;return Promise.all(t)}getAliasChromsList(t){const e=t.map(t=>{var e,i;let r=null===(i=null===(e=this.browser.genome.chromAlias)||void 0===e?void 0:e.aliasRecordCache)||void 0===i?void 0:i.get(t);return r?Object.values(r):[]});return e.flat()}set_available_callers(){this.available_callers.includes(this.cnv_caller)||(this.available_callers.length>0?this.cnv_caller=this.available_callers[0]:this.cnv_caller=null)}async getHeader(){if(!this.header){if("function"==typeof this.featureSource.getHeader){const t=await this.featureSource.getHeader();t&&(this.callSets=t.callSets||[]),this.header=t}this.sampleKeys=this.callSets?this.callSets.map(t=>t.sample):[],this.sampleNames=this.sampleKeys}return this.header}get height(){return this._height}set height(t){if(this._height=t,this.tracks)for(let e of this.tracks)e.height=t,e.config.height=t}menuItemList(){let t=[];void 0!==this.flipAxis&&t.push({label:"Flip y-axis",click:function(){this.flipAxis=!this.flipAxis,this.trackView.repaintViews()}}),t=t.concat(this.numericDataMenuItems()),t.push("<hr/>"),t.push("Bin Sizes");for(let e of this.available_bins)t.push({element:ic(e,e===this.bin_size),click:async function(){this.bin_size=e,this.trackView.startSpinner(),await this.recreate_tracks(e),this.clearCachedFeatures(),this.trackView.updateViews(),this.trackView.repaintViews()}});t.push("<hr/>"),t.push("Signal Type");let e={rd_snp:"RD and BAF Likelihood",rd:"RD Signal",snp:"BAF Likelihood"};for(let i in e)t.push({element:ic(e[i],i===this.signal_name),click:async function(){this.signal_name=i,await this.recreate_tracks(this.bin_size),this.clearCachedFeatures(),this.trackView.updateViews(),this.trackView.repaintViews()}});t.push("<hr/>"),t.push("CNV caller");for(let e of this.available_callers)t.push({element:ic(e,e===this.cnv_caller),click:async function(){this.cnv_caller=e,this.trackView.startSpinner(),await this.recreate_tracks(this.bin_size),this.clearCachedFeatures(),this.trackView.updateViews(),this.trackView.repaintViews()}});if(this.variantState){t.push("<hr/>");for(let e of this.available_callers)t.push({label:"Convert to variant track",click:()=>{this.convertToVariant()}})}return t}async recreate_tracks(t){var e;this.tracks=[];const i=[];if(!(t in this.wigFeatures_obj))if(Object.keys(this.hasChroms).length>0){let i=[...new Set(this.browser.referenceFrameList.map(t=>t.chr))];"all"==i[0]&&(i=null!==(e=this.browser.genome.chromosomeNames)&&void 0!==e?e:[]),this.wigFeatures_obj={...this.wigFeatures_obj,...await this.cnvpytor_obj.get_rd_signal(t,i)},this.update_hasChroms(this.wigFeatures_obj,i)}else this.wigFeatures_obj={...this.wigFeatures_obj,...await this.cnvpytor_obj.get_rd_signal(t)};this.signals=this.get_signals(),this.signal_colors=this.get_signal_colors();for(const[e,r]of Object.entries(this.wigFeatures_obj[t]))if(this.signals.includes(e)){const t={type:"wig",isMergedTrack:!0};t.features=r,t.name=e,t.color=this.signal_colors.filter(t=>t.singal_name===e).map(t=>t.color);const s=await this.browser.createTrack(t);s?(s.autoscale=!1,this.tracks.push(s),"function"==typeof s.postInit&&i.push(s.postInit())):console.warn("Could not create track "+t)}this.flipAxis=!!this.config.flipAxis&&this.config.flipAxis,this.logScale=!!this.config.logScale&&this.config.logScale,this.autoscale=this.config.autoscale,this.autoscale||(this.dataRange={min:this.config.min||0,max:this.config.max});for(let t of this.tracks)t.autoscale=!1,t.dataRange=this.dataRange;return Promise.all(i)}update_hasChroms(t,e){for(let i in t)this.hasChroms[i]||(this.hasChroms[i]=new Set),e.forEach(t=>this.hasChroms[i].add(t));return this.hasChroms}async getFeatures(t,e,i,r){var s;if(Object.keys(this.hasChroms).length>0&&0!=this.hasChroms[this.bin_size].size){let t=[...new Set(this.browser.referenceFrameList.map(t=>t.chr))];"all"==t[0]&&(t=null!==(s=this.browser.genome.chromosomeNames)&&void 0!==s?s:[]);let e=t.filter(t=>!this.hasChroms[this.bin_size].has(t));if(0!=e.length){let t=this.getAliasChromsList(e),i=await this.cnvpytor_obj.get_rd_signal(this.bin_size,t);this.update_hasChroms(i,e);for(let t in i)for(const[e,r]of Object.entries(i[t]))await this.wigFeatures_obj[t][e].push(...r);for(let t of this.tracks)await t.featureSource.updateFeatures(this.wigFeatures_obj[this.bin_size][t.name])}}if(this.tracks){const s=this.tracks.map(s=>s.getFeatures(t,e,i,r));return Promise.all(s)}}getScaleFactor(t,e,i,r){return r?i/(Math.log10(e+1)-(t<=0?0:Math.log10(t+1))):i/(e-t)}computeYPixelValue(t,e){return(this.flipAxis?t-this.dataRange.min:this.dataRange.max-t)*e}computeYPixelValueInLogScale(t,e){let i=this.dataRange.max,r=this.dataRange.min;return i<=0?0:(r<=-1&&(r=0),r=r<=0?0:Math.log10(r+1),i=Math.log10(i+1),t=Math.log10(t+1),(this.flipAxis?t-r:i-t)*e)}draw(t){const e=t.features;if(!e)return;if(this.defaultScale&&("rd_snp"==this.signal_name?this.dataRange={min:this.config.min||this.dataRange.min||-1,max:this.config.max||this.dataRange.max||5}:"rd"==this.signal_name?this.dataRange={min:this.config.min||this.dataRange.min||0,max:this.config.max||this.dataRange.max||5}:"snp"==this.signal_name&&(this.dataRange={min:this.config.min||this.dataRange.min||-1,max:this.config.max||this.dataRange.max||0})),this.autoscale&&(this.dataRange=function(t,e){let i=0,r=-Number.MAX_VALUE;for(let t of e)for(let e of t)void 0===e.value||Number.isNaN(e.value)||(i=Math.min(i,e.value),r=Math.max(r,e.value));return{min:i,max:r}}(t.referenceFrame.chr,e)),this.tracks)for(let i=0,r=this.tracks.length;i<r;i++){const r=Object.assign({},t);r.features=e[i],this.tracks[i].dataRange=this.dataRange,this.tracks[i].flipAxis=this.flipAxis,this.tracks[i].logScale=this.logScale,this.graphType&&(this.tracks[i].graphType=this.graphType),this.tracks[i].draw(r)}const i=this.getScaleFactor(this.dataRange.min,this.dataRange.max,t.pixelHeight,this.logScale),r=t=>this.logScale?this.computeYPixelValueInLogScale(t,i):this.computeYPixelValue(t,i);if(this.config.hasOwnProperty("guideLines"))for(let e of this.config.guideLines)if(e.hasOwnProperty("color")&&e.hasOwnProperty("y")&&e.hasOwnProperty("dotted")){let i=r(e.y),s={strokeStyle:e.color,strokeWidth:1};e.dotted?go.dashedLine(t.context,0,i,t.pixelWidth,i,5,s):go.strokeLine(t.context,0,i,t.pixelWidth,i,s)}let s=r(2);go.dashedLine(t.context,0,s,t.pixelWidth,s,5,{strokeStyle:"lightgray",strokeWidth:.5})}paintAxis(t,e,i){var r,s,o,n,a,c,l,h={font:"normal 10px Arial",textAlign:"right",strokeStyle:"black"};if(void 0===this.dataRange||void 0===this.dataRange.max||void 0===this.dataRange.min)return;let d=void 0!==this.flipAxis&&this.flipAxis;function u(t){return t<0?String(Math.abs(t)):0===t?"0":Math.abs(t)>=10||t%1==0?t.toFixed():Math.abs(t)>=1?t.toFixed(1):t.toFixed(2)}go.fillRect(t,0,0,e,i,{fillStyle:"rgb(255, 255, 255)"}),r=(l=.95*e)-8,a={x:s=l,y:o=n=.01*i},go.strokeLine(t,r,o,s,n,h),go.fillText(t,u(d?this.dataRange.min:this.dataRange.max),r+4,o+12,h),c={x:s,y:o=n=.99*i},go.strokeLine(t,r,o,s,n,h),go.fillText(t,u(d?this.dataRange.max:this.dataRange.min),r+4,o-4,h),go.strokeLine(t,a.x,a.y,c.x,c.y,h);const f=this.getScaleFactor(this.dataRange.min,this.dataRange.max,i,this.logScale),p=t=>this.logScale?this.computeYPixelValueInLogScale(t,f):this.computeYPixelValue(t,f),g=Math.ceil((this.dataRange.max-this.dataRange.min)/10);for(let e=Math.ceil(this.dataRange.min+1);e<Math.round(this.dataRange.max-.4);e+=g){const i=p(e);go.strokeLine(t,45,i,50,i,h),go.fillText(t,u(d?this.dataRange.max-e:e),44,i+4,h)}}popupData(t,e){const i=e||t.viewport.cachedFeatures;if(i&&i.length===this.tracks.length){const e=[];for(let r=0;r<this.tracks.length;r++){r>0&&e.push("<hr/>"),e.push(`<div style=background-color:rgb(245,245,245);border-bottom-style:dashed;border-bottom-width:1px;padding-bottom:5px;padding-top:10px;font-weight:bold;font-size:larger >${this.tracks[r].name}</div>`);const s=this.tracks[r].popupData(t,i[r]);e.push(...s)}return e}}async convertToVariant(){this.variantState&&(Object.setPrototypeOf(this,Ug.VariantTrack.prototype),this.init(this.variantState),await this.postInit(),this.trackView.clearCachedFeatures(),this.variantState.trackHeight&&this.trackView.setTrackHeight(this.variantState.trackHeight),this.trackView.checkContentHeight(),this.trackView.updateViews(),delete this.variantState)}}ay.DEFAULT_TRACK_HEIGHT=250,Ug.CNVPytorTrack=ay;const cy={min:0,max:3e3,color:"rgb(0,0,255)"};class ly{constructor(t){this.r=0,this.g=0,this.b=0,t=t||cy,this.max=t.max,this.min=t.min||0,this.cache=[],this.nbins=1e3,this.binsize=(this.max-this.min)/this.nbins,this.updateColor(t.color||"rgb(0,0,255)"),this.br=255,this.bg=255,this.bb=255}updateColor(t){const e=t.substring(4).replace(")","").split(",");3===e.length&&(this.r=Number.parseInt(e[0].trim()),this.g=Number.parseInt(e[1].trim()),this.b=Number.parseInt(e[2].trim())),this.cache=[]}setMinMax(t,e){this.min=t,this.max=e,this.cache=[],this.binsize=(this.max-this.min)/this.nbins}getColor(t){if(t<=this.min)return"white";if(t>=this.max)return`rgb(${this.r},${this.g},${this.b})`;const e=Math.floor((Math.min(this.max,t)-this.min)/this.binsize);if(void 0===this.cache[e]){const i=(t-this.min)/(this.max-this.min),r=1-i;this.cache[e]=`rgb(${Math.floor(i*this.r+r*this.br)},${Math.floor(i*this.g+r*this.bg)},${Math.floor(i*this.b+r*this.bb)})`}return this.cache[e]}toJson(){return{min:this.min,max:this.max,color:`rgb(${this.r},${this.g},${this.b})`}}static parse(t){const e=t.split(","),i={min:Number.parseFloat(e[0]),max:Number.parseFloat(e[1]),color:`${e[2]},${e[3]},${e[4]}`};return new ly(i)}}class hy extends lc{constructor(t,e){super(t,e)}init(t){super.init(t),this.type="shoebox",t.max&&(this.dataRange={min:t.min||0,max:t.max});const e=Object.assign({},this.config);e.format="shoebox",this.featureSource=_h(e,this.browser.genome)}async postInit(){if("function"==typeof this.featureSource.getHeader&&(this.header=await this.featureSource.getHeader(),this.disposed))return;this.header&&(this.header.scale&&(this.header.scale=Number.parseFloat(this.header.scale)),this.setTrackProperties(this.header),this.rowCount=this.header.firstFeature?this.header.firstFeature.values.length:100);const t=this.dataRange.min,e=this.dataRange.max;this.colorScale=new ly({min:t,max:e,color:this.color}),this.scale||(this.scale=1),this._initialColor=this.color||this.constructor.defaultColor,this._initialAltColor=this.altColor||this.constructor.defaultColor}get color(){return this._color||"rgb(0,0,255)"}set color(t){this._color=t,this.colorScale&&this.colorScale.updateColor(t)}menuItemList(){const t=[];t.push("<hr/>");let e=document.createElement("div");e.textContent="Set row height";const i=this.browser;return t.push({element:e,dialog:function(t){const e={label:"Row Height",value:this.rowHeight,callback:()=>{const t=parseInt(this.browser.inputDialog.value,10);if(void 0!==t){i.sampleNameViewportWidth=void 0;const e=[];this.trackView.track.selected?e.push(...this.trackView.browser.getSelectedTrackViews().map(({track:t})=>t)):e.push(this);for(const i of e)i.rowHeight=t,i.rowHeight*i.rowCount<i.height&&i.trackView.setTrackHeight(i.rowHeight*i.rowCount,!0),i.trackView.checkContentHeight(),i.trackView.repaintViews()}}};this.browser.inputDialog.present(e,t)}}),t.push("<hr/>"),e=document.createElement("div"),e.textContent="Set data range",t.push({element:e,dialog:function(t){this.trackView.track.selected?this.browser.dataRangeDialog.configure(this.trackView.browser.getSelectedTrackViews()):this.browser.dataRangeDialog.configure(this.trackView),this.browser.dataRangeDialog.present(t)}}),t}setDataRange({min:t,max:e}){this.dataRange.min=t,this.dataRange.max=e,this.colorScale.setMinMax(t,e),this.trackView.repaintViews()}async getFeatures(t,e,i,r){const s=this.visibilityWindow;return await this.featureSource.getFeatures({chr:t,start:e,end:i,bpPerPixel:r,visibilityWindow:s})}draw({context:t,pixelTop:e,pixelWidth:i,pixelHeight:r,features:s,bpPerPixel:o,bpStart:n}){if(go.fillRect(t,0,e,i,r,{fillStyle:"rgb(255, 255, 255)"}),s&&s.length>0){const a=this.rowHeight,c=e+r,l=n+i*o+1,h=a;for(let i of s){if(i.end<n||i.start>l)continue;const r=Math.floor((i.start-n)/o),s=Math.floor((i.end-n)/o),d=Math.max(1,s-r);for(let s=i.values.length-1;s>=0;s--){const o=i.values[s];if(o>=this.dataRange.min){const n=(i.values.length-1-s)*a;if(n+a<e||n>c)continue;const l=this.colorScale.getColor(o);t.fillStyle=l,t.fillRect(r,n,d,h)}}}}}paintAxis(t,e,i){var r={font:"normal 10px Arial",textAlign:"right",strokeStyle:"black"};const s=this.startSize+this.rowCount*this.stepSize,o=this.startSize,n=(s-o)/i;for(let e=50;e<=s;e+=50){const s=Math.max(10,i-Math.round((e-o)/n));go.strokeLine(t,35,s,40,s,r),e>o&&go.fillText(t,dy(e),30,s+4,r)}r.textAlign="center",r.font="normal 10px Arial",go.fillText(t,"Footprint size (bp)",10,i/2,r,{rotate:{angle:-90}})}computePixelHeight(t){return t&&0!==t.length?t[0].values.length*this.rowHeight:0}clickedFeatures(t){const e=super.clickedFeatures(t),i=t.y;return e.filter(function(t){const e=t.pixelRect;return e&&i>=e.y&&i<=e.y+e.h})}hoverText(t){const e=this.clickedFeatures(t);if(e&&e.length>0)return`${e[0].sample}: ${e[0].value}`}popupData(t,e){void 0===e&&(e=this.clickedFeatures(t));const i=[];for(let t of e){i.length>0&&(i.push("<hr/>"),i.push("<hr/>"));const e=t._f||t,r="function"==typeof e.popupData?e.popupData(this.type,this.browser.genome.id):this.extractPopupData(e,this.browser.genome.id);Array.prototype.push.apply(i,r)}return i}get supportsWholeGenome(){return!1}getState(){const t=super.getState();return t.colorScale=this.colorScale.toJson(),t}}function dy(t){return Number.isInteger(t)||t%1==0?String(t):Math.abs(t)>=10?t.toFixed():Math.abs(t)>=1?t.toFixed(1):Math.abs(t)>=.1?t.toFixed(2):t.toExponential(1)}hy.defaults={height:300,rowHeight:3,min:.5,max:3,scale:1,visibilityWindow:1e4,supportHiDPI:!1,startSize:4,stepSize:2};class uy extends lc{constructor(t,e){super(t,e),this._images=[]}init(t){if(super.init(t),!t.images)throw Error("images are required");this.locus=t.locus,this.type="image",this.resolutionAware=!0}async postInit(){this._images=[];for(let t of this.config.images){const e=new Image;e.onload=()=>{t.img=e,t.bpPerPixel=(t.end-t.start)/e.width,this._images.push(t)},e.onerror=t=>{console.error(t)},e.src=t.src}}computePixelHeight(t){return t?t.height:0}menuItemList(){return[]}async getFeatures(t,e,i,r){return this.selectImage(t,e,i,r)}selectImage(t,e,i,r){if(0==this._images.length)return null;this._images.sort((t,e)=>t.bpPerPixel<e.bpPerPixel?-1:1);for(let t of this._images)if(t.bpPerPixel>r)return t;const s=this._images[this._images.length-1];return s.chr===t?s:null}draw({context:t,pixelTop:e,pixelWidth:i,pixelHeight:r,features:s,bpPerPixel:o,bpStart:n}){const a=null==s?void 0:s.img;if(a){const e=a.width,i=a.height,r=(s.end-s.start)/e/o,c=(s.start-n)/o;t.drawImage(a,c,0,r*e,i)}}get supportsWholeGenome(){return!1}}uy.defaults={};const fy=new Map([["ideogram",(t,e)=>new rm(e)],["sequence",(t,e)=>new td(t,e)],["feature",(t,e)=>new Vh(t,e)],["seg",(t,e)=>new af(t,e)],["mut",(t,e)=>new af(t,e)],["maf",(t,e)=>new af(t,e)],["shoebox",(t,e)=>new hy(t,e)],["wig",(t,e)=>new rf(t,e)],["merged",(t,e)=>new Bu(t,e,void 0)],["alignment",(t,e)=>new Dg(t,e)],["interaction",(t,e)=>new Bg(t,e)],["interact",(t,e)=>new Bg(t,e)],["variant",(t,e)=>new Qg(t,e)],["qtl",(t,e)=>new jg(t,e)],["eqtl",(t,e)=>new jg(t,e)],["gwas",(t,e)=>new Yg(t,e)],["arc",(t,e)=>new tm(t,e)],["gcnv",(t,e)=>new Xg(t,e)],["junction",(t,e)=>new am(t,e)],["blat",(t,e)=>new jh(t,e)],["cnvpytor",(t,e)=>new ay(t,e)],["image",(t,e)=>new uy(t,e)]]);class py{constructor(t,e){const i=(new DOMParser).parseFromString(t,"text/xml");this.processRootNode(i,e);const r=i.getElementsByTagName("Resource"),s=i.getElementsByTagName("Track"),o=s&&s.length>0,n=[];this.tracks=n;const a=new Map;Array.from(r).forEach(function(t,e){var i={url:t.getAttribute("path"),indexURL:t.getAttribute("index"),order:e};a.set(i.url,i),o||n.push(i)}),o&&Array.from(s).forEach(function(t){const e=t.getElementsByTagName("Track");if(e&&e.length>0){const i={type:"merged",tracks:[]};gy(t,i),n.push(i),Array.from(e).forEach(function(t){t.processed=!0;const e=t.getAttribute("id"),r=a.get(e);r&&(i.tracks.push(r),gy(t,r),r.autoscale=!1,i.height=r.height)})}else if(!t.processed){const e=t.getAttribute("id"),i=a.get(e);i&&(n.push(i),gy(t,i))}})}processRootNode(t,e){const i=t.getElementsByTagName("Session");!i||i.length;const r=i.item(0),s=r.getAttribute("genome"),o=r.getAttribute("locus"),n=r.getAttribute("ucscID");e&&e.hasOwnProperty(s)?this.genome=s:(this.reference={fastaURL:s},n&&(this.reference.id=n)),o&&(this.locus=o)}}function gy(t,e){e.name=t.getAttribute("name");const i=t.getAttribute("color");i&&(e.color="rgb("+i+")");const r=t.getAttribute("altColor");i&&(e.altColor="rgb("+r+")");const s=t.getAttribute("height");s&&(e.height=parseInt(s));const o=t.getAttribute("autoScale");o&&(e.autoscale="true"===o);const n=t.getAttribute("autoscaleGroup");n&&(e.autoscaleGroup=n);const a=t.getAttribute("windowFunction");a&&(e.windowFunction=a);const c=t.getAttribute("visibilityWindow")||t.getAttribute("featureVisibilityWindow");c&&(e.visibilityWindow=c);const l=t.getAttribute("indexed");l&&(e.indexed="true"===l);const h=t.getAttribute("normalize");h&&(e.normalize="true"===h);const d=t.getElementsByTagName("DataRange");if(d.length>0){const t=d.item(0);e.min=Number(t.getAttribute("minimum")),e.max=Number(t.getAttribute("maximum")),e.logScale="LOG"===t.getAttribute("type")}}class my{constructor(t,e,i,r,s){this.genome=t,this.chr=e,this.start=i,this.end=r,this.bpPerPixel=s,this.id=n()}get center(){return(this.start+this.end)/2}get locusSearchString(){return`${this.chr}:${this.start+1}-${this.end}`}extend(t){const e=Math.min(t.start,this.start),i=Math.max(t.end,this.end),r=(i-e)/(this.end-this.start);this.start=e,this.end=i,this.bpPerPixel*=r}calculateEnd(t){return this.start+this.bpPerPixel*t}calculateCenter(t){return this.start+this.bpPerPixel*t/2}calculateBPP(t,e){return(t-this.start)/e}set(t){this.chr=t.chr,this.start=t.start,this.bpPerPixel=t.bpPerPixel}toPixels(t){return t/this.bpPerPixel}toBP(t){return this.bpPerPixel*t}shift(t){this.start+=t,this.end+=t}shiftPixels(t,e,i){const r=this.start,s=t*this.bpPerPixel;return this.start+=s,i&&this.clampStart(e),this.end=this.start+e*this.bpPerPixel,r!==this.start}clampStart(t){var e;const i=(null===(e=this.genome.getChromosome(this.chr))||void 0===e?void 0:e.bpStart)||0;if(this.start=Math.max(i,this.start),t){const{bpLength:e}=this.genome.getChromosome(this.chr),i=e-t*this.bpPerPixel;this.start>i&&(this.start=i)}}async zoomWithScaleFactor(t,e,i,r){const s=void 0===r?this.start+this.toBP(i/2):r,o=this.start,n=this.bpPerPixel,a=this.getChromosome().bpLength,c=e<1?t.minimumBases()/i:a/i;this.bpPerPixel=e<1?Math.max(this.bpPerPixel*e,c):Math.min(this.bpPerPixel*e,c);const l=this.bpPerPixel*i;this.start=s-.5*l,this.clampStart(i),this.end=this.start+l;(o!==this.start||n!==this.bpPerPixel)&&await t.updateViews(!0)}getChromosome(){return this.genome.getChromosome(this.chr)}updateForViewportWidth(t){const{chr:e}=this,{bpLength:i}=this.getChromosome(),r=this.toBP(t);Hd.isWholeGenomeView(e)||r>i?this.bpPerPixel=i/t:this.end=this.start+this.toBP(t)}getMultiLocusLabelBPLengthOnly(t){const e=" ",i=Math.floor(this.start)+1,r=Math.round(this.start+this.bpPerPixel*t);return`${e}${this.chr}${e}${$o(r-i)}${e}`}getMultiLocusLabelLocusOnly(t){const e=" ",{chr:i,start:r,end:s}=this.getPresentationLocusComponents(t);return`${e}${i}:${r}-${s}${e}`}getMultiLocusLabel(t){const e=" ",{chr:i,start:r,end:s}=this.getPresentationLocusComponents(t),o=Math.floor(this.start)+1;return`${e}${i}:${r}-${s}${e}${e}(${$o(Math.round(this.start+this.bpPerPixel*t)-o)})${e}`}getPresentationLocusComponents(t){if("all"===this.chr)return{chr:this.chr};{const e=F(Math.floor(this.start)+1),i=F(Math.round(this.start+this.bpPerPixel*t));return{chr:this.chr,start:e,end:i}}}getLocusString(){if("all"===this.chr)return"all";return`${this.genome.getChromosomeDisplayName(this.chr)}:${F(Math.floor(this.start)+1)}-${F(Math.round(this.end))}`}description(t){console.log(` ${t||""} referenceFrame - ${this.chr} bpp ${this.bpPerPixel.toFixed(3)} start ${F(Math.round(this.start))} end ${F(Math.round(this.end))} `)}overlaps(t){return this.chr===t.chr&&this.end>=t.start&&t.end>=this.start}}function wy(){return"0.1.2"}const by={A:"rgb( 0, 200, 0)",C:"rgb( 0,0,200)",T:"rgb(255,0,0)",G:"rgb(209,113, 5)",N:"rgb(80,80,80)"},Fy="Maximum sequence count exceeded";class vy{constructor(t,i){this.container=e({class:"igv-chromosome-select-widget-container"}),i.appendChild(this.container),this.select=document.createElement("select"),this.select.setAttribute("name","chromosome-select-widget"),this.container.appendChild(this.select),this.select.addEventListener("change",async()=>{if(this.select.blur(),""!==this.select.value&&Fy!==this.select.value)if("all"===this.select.value.trim().toLowerCase()||"*"===this.select.value){if(t.genome.wholeGenomeView){const e=t.genome.getChromosome("all");t.updateLoci([{chr:"all",start:0,end:e.bpLength}])}}else{const e=await t.genome.loadChromosome(this.select.value);t.updateLoci([{chr:e.name,start:0,end:e.bpLength}])}}),this.showAllChromosomes=!1!==t.config.showAllChromosomes,this.genome=t.genome}show(){this.container.style.display="flex"}hide(){this.container.style.display="none"}setValue(t){this.select.value=this.genome.getChromosomeDisplayName(t)}update(t){this.genome=t;const e=t.wgChromosomeNames?t.wgChromosomeNames.map(e=>t.getChromosomeDisplayName(e)):[],i=t.wgChromosomeNames?new Set(t.wgChromosomeNames):new Set;if(this.showAllChromosomes&&t.chromosomeNames.length>1){const r=new Set(e);let s=i.size;for(let o of t.chromosomeNames)if(!i.has(o)){if(1e3===++s){e.push(Fy);break}r.has(o)||(o=t.getChromosomeDisplayName(o),e.push(o))}}this.select.innerHTML="",t.showWholeGenomeView()&&e.unshift("all");for(let i of e){const e=document.createElement("option");e.setAttribute("value",i),e.innerText=t.getChromosomeDisplayName(i),this.select.appendChild(e)}}}class yy{constructor(t,i){this.container=e({class:"igv-windowsize-panel-container"}),t.appendChild(this.container),i.on("locuschange",t=>{this.updatePanel(t)}),this.browser=i}show(){this.container.style.display="block"}hide(){this.container.style.display="none"}updatePanel(t){const e=this.browser.calculateViewportWidth(this.browser.referenceFrameList.length);this.container.innerText=1===t.length?$o(Math.round(e*t[0].bpPerPixel)):""}}class Ay extends Nu{constructor(t,e,i,r){super(t,e,"Select Tracks",Mu,'<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>multi select</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="multi-select">\n <rect id="backdrop-copy-3" stroke="#737373" stroke-width="12" fill="#FFFFFF" x="6" y="6" width="613" height="613" rx="135"></rect>\n <g id="row-copy-3" transform="translate(81, 427)" fill="#737373">\n <rect id="Rectangle" x="134" y="0" width="329" height="70"></rect>\n <rect id="Rectangle-Copy-16" stroke="#737373" stroke-width="12" x="6" y="6" width="58" height="58"></rect>\n </g>\n <g id="row-copy-2" transform="translate(82, 277)">\n <rect id="Rectangle" fill-opacity="0.33" fill="#CFCECE" x="133" y="0" width="329" height="70"></rect>\n <rect id="Rectangle-Copy-16" stroke-opacity="0.32659528" stroke="#CFCECE" stroke-width="12" x="6" y="6" width="58" height="58"></rect>\n </g>\n <g id="row-copy" transform="translate(81, 119)" fill="#737373">\n <rect id="Rectangle" x="134" y="0" width="329" height="70"></rect>\n <rect id="Rectangle-Copy-17" stroke="#737373" stroke-width="12" x="6" y="6" width="58" height="58"></rect>\n </g>\n </g>\n </g>\n</svg>','<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>multi select hover</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="multi-select-hover">\n <rect id="backdrop-copy-4" stroke="#737373" stroke-width="12" fill="#737373" x="6" y="6" width="613" height="613" rx="135"></rect>\n <g id="row-copy-3" transform="translate(81, 427)" fill="#FFFFFF">\n <rect id="Rectangle" x="134" y="0" width="329" height="70"></rect>\n <rect id="Rectangle-Copy-16" stroke="#FFFFFF" stroke-width="12" x="6" y="6" width="58" height="58"></rect>\n </g>\n <g id="row-copy-2" transform="translate(82, 277)">\n <rect id="Rectangle" fill-opacity="0.33" fill="#CFCECE" x="133" y="0" width="329" height="70"></rect>\n <rect id="Rectangle-Copy-16" stroke-opacity="0.33" stroke="#CFCECE" stroke-width="12" x="6" y="6" width="58" height="58"></rect>\n </g>\n <g id="row-copy" transform="translate(81, 119)" fill="#FFFFFF">\n <rect id="Rectangle" x="134" y="0" width="329" height="70"></rect>\n <rect id="Rectangle-Copy-17" stroke="#FFFFFF" stroke-width="12" x="6" y="6" width="58" height="58"></rect>\n </g>\n </g>\n </g>\n</svg>',!1),this.navbar=i,this.enableMultiTrackSelection=!1,this.button.addEventListener("mouseenter",t=>{!1===r&&this.setState(!0)}),this.button.addEventListener("mouseleave",t=>{!1===r&&this.setState(!1)});this.boundMouseClickHandler=(()=>{this.setMultiTrackSelection(!this.enableMultiTrackSelection)}).bind(this),this.button.addEventListener("click",this.boundMouseClickHandler)}setMultiTrackSelection(t){this.enableMultiTrackSelection=t,this.setState(this.enableMultiTrackSelection),!1===this.enableMultiTrackSelection&&this.navbar.overlayTrackButton.setVisibility(!1);for(const e of this.browser.trackViews)e.enableTrackSelection(t)}}class Cy extends Nu{constructor(t,e){super(t,e,"Crosshairs",Mu,'<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>cursor</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="cursor" stroke="#737373">\n <rect id="Rectangle-Copy-3" stroke-width="12" fill="#FFFFFF" x="6" y="6" width="613" height="613" rx="135"></rect>\n <g id="Group" transform="translate(5, 9)" stroke-width="24">\n <line x1="0.5" y1="212.5" x2="614.5" y2="212.5" id="Line"></line>\n <line x1="-115.5" y1="303.5" x2="490.5" y2="303.5" id="Line-Copy" transform="translate(187.5, 303.5) scale(-1, 1) rotate(90) translate(-187.5, -303.5)"></line>\n </g>\n <circle id="Oval" stroke-width="24" cx="191.5" cy="221.5" r="88.5"></circle>\n </g>\n </g>\n</svg>','<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>cursor hover</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="cursor-hover">\n <rect id="Rectangle-Copy-5" stroke="#737373" stroke-width="12" fill="#737373" x="6" y="6" width="613" height="613" rx="135"></rect>\n <g id="Group-Copy-2" transform="translate(5, 9)" stroke="#FFFFFF" stroke-width="24">\n <line x1="0.5" y1="212.5" x2="614.5" y2="212.5" id="Line"></line>\n <line x1="-115.5" y1="303.5" x2="490.5" y2="303.5" id="Line-Copy" transform="translate(187.5, 303.5) scale(-1, 1) rotate(90) translate(-187.5, -303.5)"></line>\n </g>\n <circle id="Oval" stroke="#FFFFFF" stroke-width="24" cx="191.5" cy="221.5" r="88.5"></circle>\n </g>\n </g>\n</svg>',e.doShowCursorGuide),this.button.addEventListener("mouseenter",()=>{!1===e.doShowCursorGuide&&this.setState(!0)}),this.button.addEventListener("mouseleave",()=>{!1===e.doShowCursorGuide&&this.setState(!1)});this.boundMouseClickHandler=(()=>{e.doShowCursorGuide=!e.doShowCursorGuide,e.setCursorGuideVisibility(e.doShowCursorGuide),this.setState(e.doShowCursorGuide)}).bind(this),this.button.addEventListener("click",this.boundMouseClickHandler),this.setVisibility(e.config.showCursorTrackingGuideButton)}}class _y extends Nu{constructor(t,e){super(t,e,"Center Line",Mu,'<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>centerline</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="centerline" stroke="#737373">\n <rect id="Rectangle-Copy-2" stroke-width="12" fill="#FFFFFF" x="6" y="6" width="613" height="613" rx="135"></rect>\n <line x1="6.5" y1="312.5" x2="618.5" y2="312.5" id="Line-Copy" stroke-width="31" transform="translate(312.5, 312.5) scale(-1, 1) rotate(90) translate(-312.5, -312.5)"></line>\n </g>\n </g>\n</svg>','<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>centerline hover</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="centerline-hover">\n <rect id="Rectangle-Copy-9" stroke="#737373" stroke-width="12" fill="#737373" x="6" y="6" width="613" height="613" rx="135"></rect>\n <line x1="6.5" y1="312.5" x2="618.5" y2="312.5" id="Line-Copy" stroke="#FFFFFF" stroke-width="31" transform="translate(312.5, 312.5) scale(-1, 1) rotate(90) translate(-312.5, -312.5)"></line>\n </g>\n </g>\n</svg>',e.config.showCenterGuide),this.button.addEventListener("mouseenter",()=>{!1===e.doShowCenterLine&&this.setState(!0)}),this.button.addEventListener("mouseleave",()=>{!1===e.doShowCenterLine&&this.setState(!1)});this.boundMouseClickHandler=(()=>{e.doShowCenterLine=!e.doShowCenterLine,e.setCenterLineVisibility(e.doShowCenterLine),this.setState(e.doShowCenterLine)}).bind(this),this.button.addEventListener("click",this.boundMouseClickHandler),this.setVisibility(e.config.showCenterGuideButton)}}class xy extends Nu{constructor(t,e){super(t,e,"Track Labels",Mu,'<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>track labels</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="track-labels" fill="#FFFFFF" stroke="#737373">\n <rect id="Rectangle-Copy-27" stroke-width="12" x="6" y="6" width="613" height="613" rx="135"></rect>\n <g id="group" transform="translate(52.2778, 149.7248)" stroke-width="24">\n <path d="M448.444444,87.1189616 L448.444444,322.431462 L166.619398,322.431462 L19.2344421,204.775212 L166.619398,87.1189616 L448.444444,87.1189616 Z M244.028212,163.997434 C232.925565,163.997434 222.874656,168.493347 215.598982,175.760254 C208.318067,183.032394 203.815972,193.079106 203.815972,204.175675 C203.815972,215.272243 208.318067,225.318955 215.598982,232.591095 C222.874656,239.858002 232.925565,244.353915 244.028212,244.353915 C255.130858,244.353915 265.181767,239.858002 272.457442,232.591095 C279.738356,225.318955 284.240451,215.272243 284.240451,204.175675 C284.240451,193.079106 279.738356,183.032394 272.457442,175.760254 C265.181767,168.493347 255.130858,163.997434 244.028212,163.997434 Z" id="backdrop"></path>\n <path d="M495.232604,12 L495.232604,264.550423 L193.616935,264.550423 L35.4455183,138.275212 L193.616935,12 L495.232604,12 Z M168.133512,95.1660194 C156.441871,95.1660194 145.858581,99.8943121 138.197214,107.534302 C130.523695,115.18641 125.780417,125.758499 125.780417,137.434423 C125.780417,149.110347 130.523695,159.682435 138.197214,167.334543 C145.858581,174.974533 156.441871,179.702826 168.133512,179.702826 C179.825153,179.702826 190.408443,174.974533 198.06981,167.334543 C205.743329,159.682435 210.486607,149.110347 210.486607,137.434423 C210.486607,125.758499 205.743329,115.18641 198.06981,107.534302 C190.408443,99.8943121 179.825153,95.1660194 168.133512,95.1660194 Z" id="hero"></path>\n </g>\n </g>\n </g>\n</svg>','<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>track labels hover</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="track-labels-hover" stroke="#737373">\n <rect id="Rectangle-Copy-29" stroke-width="12" fill="#737373" x="6" y="6" width="613" height="613" rx="135"></rect>\n <g id="group" transform="translate(52.2778, 149.7248)" fill="#FFFFFF" stroke-width="24">\n <path d="M448.444444,85.1189616 L448.444444,320.431462 L166.619398,320.431462 L19.2344421,202.775212 L166.619398,85.1189616 L448.444444,85.1189616 Z M244.028212,161.997434 C232.925565,161.997434 222.874656,166.493347 215.598982,173.760254 C208.318067,181.032394 203.815972,191.079106 203.815972,202.175675 C203.815972,213.272243 208.318067,223.318955 215.598982,230.591095 C222.874656,237.858002 232.925565,242.353915 244.028212,242.353915 C255.130858,242.353915 265.181767,237.858002 272.457442,230.591095 C279.738356,223.318955 284.240451,213.272243 284.240451,202.175675 C284.240451,191.079106 279.738356,181.032394 272.457442,173.760254 C265.181767,166.493347 255.130858,161.997434 244.028212,161.997434 Z" id="backdrop"></path>\n <path d="M495.232604,12 L495.232604,264.550423 L193.616935,264.550423 L35.4455183,138.275212 L193.616935,12 L495.232604,12 Z M168.133512,95.1660194 C156.441871,95.1660194 145.858581,99.8943121 138.197214,107.534302 C130.523695,115.18641 125.780417,125.758499 125.780417,137.434423 C125.780417,149.110347 130.523695,159.682435 138.197214,167.334543 C145.858581,174.974533 156.441871,179.702826 168.133512,179.702826 C179.825153,179.702826 190.408443,174.974533 198.06981,167.334543 C205.743329,159.682435 210.486607,149.110347 210.486607,137.434423 C210.486607,125.758499 205.743329,115.18641 198.06981,107.534302 C190.408443,99.8943121 179.825153,95.1660194 168.133512,95.1660194 Z" id="hero"></path>\n </g>\n </g>\n </g>\n</svg>',e.config.showTrackLabels),this.button.addEventListener("mouseenter",()=>{!1===e.doShowTrackLabels&&this.setState(!0)}),this.button.addEventListener("mouseleave",()=>{!1===e.doShowTrackLabels&&this.setState(!1)});this.boundMouseClickHandler=(()=>{e.doShowTrackLabels=!e.doShowTrackLabels,e.setTrackLabelVisibility(e.doShowTrackLabels),this.setState(e.doShowTrackLabels)}).bind(this),this.button.addEventListener("click",this.boundMouseClickHandler),this.setVisibility(e.config.showTrackLabelButton)}}class ky extends Nu{constructor(t,e){super(t,e,["ROI","Regions of Interest Table"],Mu,'<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>roi</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="roi">\n <rect id="Rectangle-Copy-23" stroke="#737373" stroke-width="12" fill="#FFFFFF" x="6" y="6" width="613" height="613" rx="135"></rect>\n <text id="ROI" font-family="HelveticaNeue-Bold, Helvetica Neue" font-size="258" font-weight="bold" fill="#737373">\n <tspan x="81.445" y="389">ROI</tspan>\n </text>\n </g>\n </g>\n</svg>','<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>roi hover</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="roi-hover">\n <rect id="Rectangle-Copy-24" stroke="#737373" stroke-width="12" fill="#737373" x="6" y="6" width="613" height="613" rx="135"></rect>\n <text id="ROI" font-family="HelveticaNeue-Bold, Helvetica Neue" font-size="258" font-weight="bold" fill="#FFFFFF">\n <tspan x="81.445" y="389">ROI</tspan>\n </text>\n </g>\n </g>\n</svg>',!1),this.button.addEventListener("mouseenter",()=>{!1===e.doShowROITable&&this.setState(!0)}),this.button.addEventListener("mouseleave",()=>{!1===e.doShowROITable&&this.setState(!1)}),this.button.addEventListener("click",()=>this.buttonHandler(!e.doShowROITable)),this.setVisibility(!1)}buttonHandler(t){this.setState(t),this.browser.setROITableVisibility(t)}}class Iy extends Nu{constructor(t,e){super(t,e,"Sample Info",Mu,'<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>sample info</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="sample-info">\n <rect id="Rectangle-Copy-6" stroke="#737373" stroke-width="12" fill="#FFFFFF" x="6" y="6" width="613" height="613" rx="135"></rect>\n <g id="Group-2" transform="translate(8, 149)">\n <rect id="Rectangle" fill="#8DD3C7" x="0" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy" fill="#FBB4AE" x="102" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-8" fill="#7FC97F" x="204" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#ADE2CF" x="306" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#E41A1C" x="408" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#3F70AE" x="510" y="0" width="102" height="102"></rect>\n </g>\n <g id="Group-2-Copy" transform="translate(8, 251)">\n <rect id="Rectangle" fill="#E41A1C" x="0" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy" fill="#377EB8" x="102" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-8" fill="#FDB46B" x="204" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#BC80BD" x="306" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#FFFFB3" x="408" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#ADE2CF" x="510" y="0" width="102" height="102"></rect>\n </g>\n <g id="Group-2-Copy-2" transform="translate(314, 404) scale(-1, 1) translate(-314, -404)translate(8, 353)">\n <rect id="Rectangle" fill="#1B9E77" x="0" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy" fill="#377EB8" x="102" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-8" fill="#FDB46B" x="204" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#BAD1E9" x="306" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#4DAF4A" x="408" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#CBF03E" x="510" y="0" width="102" height="102"></rect>\n </g>\n <rect id="Rectangle-Copy-10" stroke="#737373" stroke-width="12" x="6" y="6" width="613" height="613" rx="135"></rect>\n </g>\n </g>\n</svg>','<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>sample info hover</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="sample-info-hover">\n <rect id="Rectangle-Copy-14" stroke="#737373" stroke-width="12" fill="#737373" x="6" y="6" width="613" height="613" rx="135"></rect>\n <g id="row-2" transform="translate(314, 404) scale(-1, 1) translate(-314, -404)translate(8, 353)">\n <rect id="Rectangle" fill="#1B9E77" x="0" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy" fill="#377EB8" x="102" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-8" fill="#FDB46B" x="204" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#BAD1E9" x="306" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#4DAF4A" x="408" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#CBF03E" x="510" y="0" width="102" height="102"></rect>\n </g>\n <g id="row-1" transform="translate(8, 251)">\n <rect id="Rectangle" fill="#E41A1C" x="0" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy" fill="#377EB8" x="102" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-8" fill="#FDB46B" x="204" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#BC80BD" x="306" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#FFFFB3" x="408" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#ADE2CF" x="510" y="0" width="102" height="102"></rect>\n </g>\n <g id="row-0" transform="translate(8, 149)">\n <rect id="Rectangle" fill="#8DD3C7" x="0" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy" fill="#FBB4AE" x="102" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-8" fill="#7FC97F" x="204" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#ADE2CF" x="306" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#E41A1C" x="408" y="0" width="102" height="102"></rect>\n <rect id="Rectangle-Copy-7" fill="#3F70AE" x="510" y="0" width="102" height="102"></rect>\n </g>\n <rect id="Rectangle-Copy-15" stroke="#737373" stroke-width="12" x="6" y="6" width="613" height="613" rx="135"></rect>\n <rect id="scrim" fill="#000000" style="mix-blend-mode: hue;" x="8" y="149" width="612" height="306"></rect>\n </g>\n </g>\n</svg>',!1),this.showSampleInfo=!1,this.button.addEventListener("mouseenter",()=>{!1===this.showSampleInfo&&this.setState(!0)}),this.button.addEventListener("mouseleave",()=>{!1===this.showSampleInfo&&this.setState(!1)}),this.button.addEventListener("click",()=>{this.performClickWithState(e,void 0)})}performClickWithState(t,e){this.showSampleInfo=void 0===e?!this.showSampleInfo:e;t.columnContainer.querySelector(".igv-sample-info-column").style.display=!1===this.showSampleInfo?"none":"flex",this.setState(this.showSampleInfo),t.layoutChange()}setButtonVisibility(t){this.showSampleInfo=t,this.setState(this.showSampleInfo),!0===this.showSampleInfo?this.show():this.hide()}}class Sy extends Nu{constructor(t,e){super(t,e,"Sample Names",'<svg width="90px" height="20px" viewBox="0 0 90 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="igv-navbar-button-group">\n <rect id="Rectangle" x="0.5" y="0.5" width="89" height="18" rx="6"></rect>\n <text id="igv-text-button-label" x="50%" y="50%" dy=".1em" font-family="Helvetica" font-size="12" font-weight="normal" letter-spacing="-0.372">\n <tspan id="igv-navbar-button-label"></tspan>\n </text>\n </g>\n </g>\n</svg>','<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>sample names</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="sample-names" stroke="#737373">\n <rect id="Rectangle-Copy-13" stroke-width="12" fill="#FFFFFF" x="6" y="6" width="613" height="613" rx="135"></rect>\n <line x1="80" y1="465" x2="541" y2="464.5" id="Line-3-Copy-3" stroke-width="32"></line>\n <line x1="80" y1="312.5" x2="542" y2="313" id="Line-3" stroke-width="32"></line>\n <line x1="80" y1="158" x2="541" y2="158" id="Line-3-Copy" stroke-width="32"></line>\n </g>\n </g>\n</svg>','<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>sample names hover</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="sample-names-hover">\n <rect id="Rectangle-Copy-18" stroke="#737373" stroke-width="12" fill="#737373" x="6" y="6" width="613" height="613" rx="135"></rect>\n <line x1="80" y1="465" x2="541" y2="464.5" id="Line-3-Copy-3" stroke="#FFFFFF" stroke-width="32" fill="#FFFFFF"></line>\n <line x1="80" y1="312.5" x2="542" y2="313" id="Line-3" stroke="#FFFFFF" stroke-width="32" fill="#FFFFFF"></line>\n <line x1="80" y1="158" x2="541" y2="158" id="Line-3-Copy" stroke="#FFFFFF" stroke-width="32" fill="#FFFFFF"></line>\n </g>\n </g>\n</svg>',e.config.showSampleNames),this.button.addEventListener("mouseenter",()=>{!1===e.showSampleNames&&this.setState(!0)}),this.button.addEventListener("mouseleave",()=>{!1===e.showSampleNames&&this.setState(!1)}),this.button.addEventListener("click",()=>{this.performClickWithState(e,void 0)}),!0===e.config.showSampleNameButton?this.show():this.hide()}performClickWithState(t,e){t.showSampleNames=void 0===e?!t.showSampleNames:e;t.columnContainer.querySelector(".igv-sample-name-column").style.display=!1===t.showSampleNames?"none":"flex",this.setState(t.showSampleNames),t.layoutChange()}}class Ey{constructor(t,i){this.parent=t,this.popover=e({class:"igv-ui-dropdown"}),t.appendChild(this.popover),this.popoverContent=e(),this.popover.appendChild(this.popoverContent),this.popover.style.display="none",this.shim=i}configure(t){if(0===t.length)return;const e=rn(t,this.popover);for(const{element:t}of e)this.popoverContent.appendChild(t)}present(t){this.popover.style.display="block";let{x:e,y:i}=a(t,this.parent);this.popover.style.left=`${e+this.shim.left}px`,this.popover.style.top=`${i+this.shim.top}px`}_present(t){this.popover.style.display="block";let{x:e,y:i,width:r}=a(t,this.parent);e+=this.shim.left,i+=this.shim.top,this.popover.style.top=`${i}px`;const{width:s}=this.popover.getBoundingClientRect(),o=e+s,n=o-r;this.popover.style.left=`${o>r?e-n:e}px`}dismiss(){this.popover.style.display="none"}}class Ny extends Nu{constructor(t,e){super(t,e,"Save Image",Mu,'<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>save image</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="save-image">\n <rect id="border" stroke="#737373" stroke-width="12" fill="#FFFFFF" x="6" y="6" width="613" height="613" rx="135"></rect>\n <g id="frame" transform="translate(66, 66)" fill="#737373" fill-rule="nonzero">\n <path d="M54.75,493 C39.69375,493 26.8046875,487.639062 16.0828125,476.917187 C5.3609375,466.195312 0,453.30625 0,438.25 L0,274 L54.75,274 L54.75,438.25 L219,438.25 L219,493 L54.75,493 Z" id="Path"></path>\n <path d="M274,493 L274,438.25 L438.25,438.25 L438.25,274 L493,274 L493,438.25 C493,453.30625 487.639062,466.195312 476.917187,476.917187 C466.195312,487.639062 453.30625,493 438.25,493 L274,493 Z" id="Path"></path>\n <path d="M0,219 L0,54.75 C0,39.69375 5.3609375,26.8046875 16.0828125,16.0828125 C26.8046875,5.3609375 39.69375,0 54.75,0 L219,0 L219,54.75 L54.75,54.75 L54.75,219 L0,219 Z" id="Path"></path>\n <path d="M438.25,219 L438.25,54.75 L274,54.75 L274,0 L438.25,0 C453.30625,0 466.195312,5.3609375 476.917187,16.0828125 C487.639062,26.8046875 493,39.69375 493,54.75 L493,219 L438.25,219 Z" id="Path"></path>\n </g>\n <rect id="border-hold-out-matte" fill="#FFFFFF" x="91" y="90" width="444" height="444" rx="38"></rect>\n <g id="artwork" transform="translate(148, 176)" fill="#737373" fill-rule="nonzero">\n <polygon id="Path" points="0 273 82.25 163.4 143.9375 245.6 226.1875 136 329 273"></polygon>\n <path d="M260,82 C248.155556,82 238.361111,78.1277778 230.616667,70.3833333 C222.872222,62.6388889 219,52.8444444 219,41 C219,29.1555556 222.872222,19.3611111 230.616667,11.6166667 C238.361111,3.87222222 248.155556,0 260,0 C271.844444,0 281.638889,3.87222222 289.383333,11.6166667 C297.127778,19.3611111 301,29.1555556 301,41 C301,52.8444444 297.127778,62.6388889 289.383333,70.3833333 C281.638889,78.1277778 271.844444,82 260,82 Z" id="Path"></path>\n </g>\n </g>\n </g>\n</svg>','<svg width="625px" height="625px" viewBox="0 0 625 625" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <title>save image</title>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g id="save-image">\n <rect id="border" stroke="#737373" stroke-width="12" fill="#FFFFFF" x="6" y="6" width="613" height="613" rx="135"></rect>\n <g id="frame" transform="translate(66, 66)" fill="#737373" fill-rule="nonzero">\n <path d="M54.75,493 C39.69375,493 26.8046875,487.639062 16.0828125,476.917187 C5.3609375,466.195312 0,453.30625 0,438.25 L0,274 L54.75,274 L54.75,438.25 L219,438.25 L219,493 L54.75,493 Z" id="Path"></path>\n <path d="M274,493 L274,438.25 L438.25,438.25 L438.25,274 L493,274 L493,438.25 C493,453.30625 487.639062,466.195312 476.917187,476.917187 C466.195312,487.639062 453.30625,493 438.25,493 L274,493 Z" id="Path"></path>\n <path d="M0,219 L0,54.75 C0,39.69375 5.3609375,26.8046875 16.0828125,16.0828125 C26.8046875,5.3609375 39.69375,0 54.75,0 L219,0 L219,54.75 L54.75,54.75 L54.75,219 L0,219 Z" id="Path"></path>\n <path d="M438.25,219 L438.25,54.75 L274,54.75 L274,0 L438.25,0 C453.30625,0 466.195312,5.3609375 476.917187,16.0828125 C487.639062,26.8046875 493,39.69375 493,54.75 L493,219 L438.25,219 Z" id="Path"></path>\n </g>\n <rect id="border-hold-out-matte" fill="#FFFFFF" x="91" y="90" width="444" height="444" rx="38"></rect>\n <g id="artwork" transform="translate(148, 176)" fill="#737373" fill-rule="nonzero">\n <polygon id="Path" points="0 273 82.25 163.4 143.9375 245.6 226.1875 136 329 273"></polygon>\n <path d="M260,82 C248.155556,82 238.361111,78.1277778 230.616667,70.3833333 C222.872222,62.6388889 219,52.8444444 219,41 C219,29.1555556 222.872222,19.3611111 230.616667,11.6166667 C238.361111,3.87222222 248.155556,0 260,0 C271.844444,0 281.638889,3.87222222 289.383333,11.6166667 C297.127778,19.3611111 301,29.1555556 301,41 C301,52.8444444 297.127778,62.6388889 289.383333,70.3833333 C281.638889,78.1277778 271.844444,82 260,82 Z" id="Path"></path>\n </g>\n </g>\n </g>\n</svg>',!1),this.button.addEventListener("mouseenter",()=>this.setState(!0)),this.button.addEventListener("mouseleave",()=>{for(const t of this.button.querySelectorAll("div"))if("block"===t.style.display)return;this.setState(!1)}),this.dropdown=new Ey(this.button.parentNode,{top:24,left:-88});const i=[{label:"Save as SVG",click:()=>{this.browser.saveSVGtoFile("igvjs.svg"),this.dropdown.dismiss()}},{label:"Save as PNG",click:()=>{this.browser.savePNGtoFile("igvjs.png"),this.dropdown.dismiss()}}];this.dropdown.configure(i),this.button.addEventListener("click",t=>{let e;if(t.target===this.button)e=!0;else if(t.target.closest("svg")){t.target.closest("div")===this.button&&(e=!0)}!0===e&&("none"===this.dropdown.popover.style.display?this.dropdown.present(t):this.dropdown.dismiss())}),this.setVisibility(e.config.showSVGButton)}navbarResizeHandler(t){this.dropdown.dismiss(),super.navbarResizeHandler(t)}}const My=function(t,i,r){const s=e({class:"igv-navbar-button"});t.appendChild(s),s.textContent=r.label,s.addEventListener("click",()=>r.callback(i))};let Ry=23,Dy=0;class By{constructor(t,i,r){this.browser=i,this.zoomContainer=e({class:"igv-zoom-widget"}),r.appendChild(this.zoomContainer),this.zoomOutButton=e(),this.zoomContainer.appendChild(this.zoomOutButton),this.zoomOutButton.appendChild(l("minus-circle")),this.zoomOutButton.addEventListener("click",()=>{i.zoomOut()});const s=e();this.zoomContainer.appendChild(s),this.slider=document.createElement("input"),this.slider.type="range",this.slider.min="0",this.slider.max=`${Ry}`,s.appendChild(this.slider),this.slider.addEventListener("change",t=>{t.preventDefault(),t.stopPropagation();const e=t.target,r=i.referenceFrameList[0],{bpLength:s}=r.genome.getChromosome(r.chr),{end:o,start:n}=r,a=o-n,c=s/Math.pow(2,e.valueAsNumber);i.zoomWithScaleFactor(c/a)}),this.zoomInButton=e(),this.zoomContainer.appendChild(this.zoomInButton),this.zoomInButton.appendChild(l("plus-circle")),this.zoomInButton.addEventListener("click",()=>{i.zoomIn()}),i.on("locuschange",(...t)=>{const e=t[0];this.browser.isMultiLocusMode()?this.disable():(this.enable(),this.update(e))})}update(t){var e;if(this.slider){const i=t[0],r=null===(e=i.genome)||void 0===e?void 0:e.getChromosome(i.chr);if(!r)return;const{bpLength:s}=r,{start:o,end:n}=i;Ry=Math.ceil(Math.log2(s/this.browser.minimumBases())),this.slider.max=`${Ry}`;const a=s/(n-o);Dy=Math.log2(a),this.slider.value=`${Math.round(Dy)}`}}enable(){this.slider&&(this.slider.disabled=!1)}disable(){this.slider&&(this.slider.disabled=!0)}hide(){this.zoomContainer.style.display="none"}show(){this.zoomContainer.style.display="block"}hideSlider(){this.slider&&(this.slider.style.display="none")}showSlider(){this.slider&&(this.slider.style.display="block")}}class Ty{constructor(t,e){this.browser=e,this.config=t,this.currentClass="igv-navbar-text-button";const i=document.createElement("div");i.className="igv-navbar",this.navigation=i;const r=document.createElement("div");r.className="igv-navbar-left-container",i.appendChild(r),this.navbarLeftContainer=r;const s=document.createElement("div");s.className="igv-logo",r.appendChild(s);const o=function(){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("width","690px"),t.setAttribute("height","324px"),t.setAttribute("viewBox","0 0 690 324"),t.setAttribute("version","1.1"),t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");const e=document.createElementNS("http://www.w3.org/2000/svg","title");e.textContent="IGV",t.appendChild(e);const i=document.createElementNS("http://www.w3.org/2000/svg","g");i.setAttribute("id","Page-1"),i.setAttribute("stroke","none"),i.setAttribute("stroke-width","1"),i.setAttribute("fill","none"),i.setAttribute("fill-rule","evenodd"),t.appendChild(i);const r=document.createElementNS("http://www.w3.org/2000/svg","g");r.setAttribute("id","IGV"),r.setAttribute("fill","#666666"),i.appendChild(r);const s=document.createElementNS("http://www.w3.org/2000/svg","polygon");s.setAttribute("id","Path"),s.setAttribute("points","379.54574 8.00169252 455.581247 8.00169252 515.564813 188.87244 532.884012 253.529506 537.108207 253.529506 554.849825 188.87244 614.833392 8.00169252 689.60164 8.00169252 582.729511 320.722144 486.840288 320.722144"),r.appendChild(s);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d","M261.482414,323.793286 C207.975678,323.793286 168.339046,310.552102 142.571329,284.069337 C116.803612,257.586572 103.919946,217.158702 103.919946,162.784513 C103.919946,108.410325 117.437235,67.8415913 144.472217,41.0770945 C171.507199,14.3125977 212.903894,0.930550071 268.663545,0.930550071 C283.025879,0.930550071 298.232828,1.84616386 314.284849,3.6774189 C330.33687,5.50867394 344.839793,7.97378798 357.794056,11.072835 L357.794056,68.968378 C339.48912,65.869331 323.578145,63.5450806 310.060654,61.9955571 C296.543163,60.4460336 284.574731,59.6712835 274.154998,59.6712835 C255.850062,59.6712835 240.502308,61.4320792 228.111274,64.9537236 C215.720241,68.4753679 205.793482,74.2507779 198.330701,82.2801269 C190.867919,90.309476 185.587729,100.87425 182.48997,113.974767 C179.392212,127.075284 177.843356,143.345037 177.843356,162.784513 C177.843356,181.942258 179.251407,198.000716 182.067551,210.960367 C184.883695,223.920018 189.671068,234.41436 196.429813,242.443709 C203.188559,250.473058 212.059279,256.178037 223.042241,259.558815 C234.025202,262.939594 247.683295,264.629958 264.01693,264.629958 C268.241146,264.629958 273.098922,264.489094 278.590403,264.207362 C284.081883,263.925631 289.643684,263.50304 295.275972,262.939577 L295.275972,159.826347 L361.595831,159.826347 L361.595831,308.579859 C344.698967,313.087564 327.239137,316.750019 309.215815,319.567334 C291.192494,322.38465 275.281519,323.793286 261.482414,323.793286 L261.482414,323.793286 L261.482414,323.793286 Z"),o.setAttribute("id","Path"),r.appendChild(o);const n=document.createElementNS("http://www.w3.org/2000/svg","polygon");return n.setAttribute("id","Path"),n.setAttribute("points","0.81355666 5.00169252 73.0472883 5.00169252 73.0472883 317.722144 0.81355666 317.722144"),r.appendChild(n),t}();o.style.width="34px",o.style.height="32px",s.appendChild(o),this.currentGenome=document.createElement("div"),this.currentGenome.className="igv-current-genome",r.appendChild(this.currentGenome),this.currentGenome.textContent="";const n=document.createElement("div");n.className="igv-navbar-genomic-location",r.appendChild(n),this.chromosomeSelectWidget=new vy(e,n),!1!==t.showChromosomeWidget?this.chromosomeSelectWidget.show():this.chromosomeSelectWidget.hide();const a=document.createElement("div");a.className="igv-locus-size-group",n.appendChild(a);const c=document.createElement("div");c.className="igv-search-container",a.appendChild(c),this.searchInput=document.createElement("input"),this.searchInput.className="igv-search-input",this.searchInput.type="text",this.searchInput.placeholder="Locus Search",c.appendChild(this.searchInput),this.searchInput.addEventListener("keyup",t=>{t.stopImmediatePropagation()}),this.searchInput.addEventListener("change",()=>{this.doSearch(this.searchInput.value)});const h=document.createElement("div");h.className="igv-search-icon-container",c.appendChild(h);const d=l("search");h.appendChild(d),h.addEventListener("click",()=>{this.doSearch(this.searchInput.value)}),this.windowSizePanel=new yy(a,e);const u=document.createElement("div");u.className="igv-navbar-right-container",i.appendChild(u),this.navbarRightContainer=u;const f=document.createElement("div");f.className="igv-navbar-toggle-button-container",u.appendChild(f),this.toggleButtonContainer=f,this.overlayTrackButton=new zu(f,e),this.overlayTrackButton.setVisibility(!1);const p=!1!==t.showMultiSelectButton;if(this.multiTrackSelectButton=new Ay(f,e,this,p),this.cursorGuideButton=new Cy(f,e),this.centerLineButton=new _y(f,e),this.trackLabelControl=new xy(f,e),this.roiTableControl=new ky(f,e),this.sampleInfoControl=new Iy(f,e),this.sampleNameControl=new Sy(f,e),!0===t.showSVGButton&&(this.saveImageControl=new Ny(f,e)),t.customButtons)for(let i of t.customButtons)new My(f,e,i);this.zoomWidget=new By(t,e,u),!1===t.showNavigation&&(this.navigation.style.display="none")}navbarDidResize(){const t=this.currentNavbarButtonClass();"igv-navbar-text-button"===t&&(this.textButtonContainerWidth=this.navbarRightContainer.getBoundingClientRect().width);const e=this.browser,i=e.isMultiLocusWholeGenomeView()||e.referenceFrameList&&Hd.isWholeGenomeView(e.referenceFrameList[0].chr);i?this.windowSizePanel.hide():this.windowSizePanel.show();const{x:r,width:s}=this.navbarLeftContainer.getBoundingClientRect(),o=r+s,{x:n}=this.navbarRightContainer.getBoundingClientRect();let a;if("igv-navbar-text-button"===t&&n-o<8)a="igv-navbar-icon-button";else if(this.textButtonContainerWidth&&"igv-navbar-icon-button"===t){this.navigation.offsetWidth-o-this.textButtonContainerWidth>8&&(a="igv-navbar-text-button")}let c;a&&t!==a&&(this.currentClass=a,this.browser.fireEvent("navbar-resize",[a])),c=i?"igv-zoom-widget-hidden":this.navigation.offsetWidth>860?"igv-zoom-widget":"igv-zoom-widget-900",this.zoomWidget.zoomContainer.className="",this.zoomWidget.zoomContainer.classList.add(c)}updateGenome(t){let e=t.id&&t.id.length<20?t.id:`${t.id.substring(0,8)}...${t.id.substring(t.id.length-8)}`;this.currentGenome.textContent=e,this.currentGenome.setAttribute("title",t.description);!1!==this.config.showChromosomeWidget&&!1!==t.showChromosomeWidget&&t.chromosomeNames&&t.chromosomeNames.length>1?(this.chromosomeSelectWidget.update(t),this.chromosomeSelectWidget.show()):this.chromosomeSelectWidget.hide()}updateLocus(t,e){this.searchInput&&(this.searchInput.value=t),this.chromosomeSelectWidget&&(this.chromosomeSelectWidget.select.value=e)}currentNavbarButtonClass(){return this.currentClass}setEnableTrackSelection(t){this.multiTrackSelectButton.setMultiTrackSelection(t)}getEnableTrackSelection(){return this.multiTrackSelectButton.enableMultiTrackSelection}hide(){this.navigation.style.display="none"}show(){this.navigation.style.display="flex"}async doSearch(t){await this.browser.search(t)||this.browser.alert.present(new Error(`Unrecognized locus: <b> ${t} </b>`))}}const Ly=(t,e)=>{const i=0===t?e.nextElementSibling:e.previousElementSibling;e.remove(),i.remove()},zy=t=>{const i=e({class:"igv-column-shim"});Xo(i,t);const r=e({class:"igv-column"});return Xo(r,i),r},Py=(t,i)=>{for(let r=0;r<i;r++){const s=e({class:"igv-column"});if(Yo(s,t),i>1&&r>0){Yo(e({class:"igv-column-shim"}),s)}}};class Oy{constructor(t,i,r){this.isVisible=!1,this.browser=t,this.referenceFrame=i,this.column=r,this.container=e({class:"igv-center-line"}),r.appendChild(this.container),t.doShowCenterLine?this.show():this.hide()}repaint(){if(this.referenceFrame){if(1/this.referenceFrame.bpPerPixel>1){const t=Math.floor(this.referenceFrame.toPixels(1));this.container.style.width=`${t}px`,this.container.classList.remove("igv-center-line-thin"),this.container.classList.add("igv-center-line-wide")}else this.container.style.width="1px",this.container.classList.remove("igv-center-line-wide"),this.container.classList.add("igv-center-line-thin")}}show(){this.isVisible=!0,this.container.style.display="block",this.repaint()}hide(){this.isVisible=!1,this.container.style.display="none"}resize(){this.repaint()}}class Hy{constructor(t,i){var r;this.button=e({class:"igv-navbar-button"}),t.appendChild(this.button),this.button.textContent="circular view",this.button.addEventListener("click",()=>{i.circularViewVisible=!i.circularViewVisible}),this.browser=i,this.setVisibility(null!==(r=i.config.showCircularViewButton)&&void 0!==r&&r),this.setState(i.circularViewVisible)}setVisibility(t){!0===t?this.show():this.hide()}setState(t){!0===t?this.button.classList.add("igv-navbar-button-clicked"):this.button.classList.remove("igv-navbar-button-clicked")}show(){this.button.style.display="block",this.setState(this.browser.circularViewVisible)}hide(){this.button.style.display="none"}}var Uy,Vy,qy,Qy,Gy,Wy;class jy{constructor(t,i){Uy.add(this),this.browser=t,this.container=e({class:"igv-roi-menu"}),i.appendChild(this.container);const r=e();this.container.appendChild(r),u(r,()=>this.container.style.display="none"),this.body=e(),this.container.appendChild(this.body),this.container.style.display="none"}async present(t,e,i,r,s,o){const n=this.menuItems(t,e,i,r,s,o);this.browser.menuPopup.presentTrackContextMenu(i,n)}menuItems(t,e,i,r,s,o){const n=t.name?[`<b>${t.name}</b><br/>`]:[];return"name"in e&&n.push(`<b>ROI Set: ${e.name}</b>`),n.length>0&&n.push("<hr/>"),e.isUserDefined&&wo(this,Uy,"m",Qy).call(this,n,t,i),Jo()&&t.end-t.start<1e6&&wo(this,Uy,"m",qy).call(this,n,t),t.end-t.start<=25e3&&wo(this,Uy,"m",Wy).call(this,n,t),wo(this,Uy,"m",Gy).call(this,n,t),e.isUserDefined&&wo(this,Uy,"m",Vy).call(this,n,t,e,r,s,o),n}dispose(){this.container.innerHTML=""}}function $y(t,e,i){return`${t}-${e}-${i}`}function Ky(t){let e=t.split("-"),i=parseInt(e.pop()),r=parseInt(e.pop()),s=e.join("-");return{chr:s,start:r,end:i,locus:`${s}:${r}-${i}`,bedRecord:`${s}\t${r}\t${i}`}}Uy=new WeakSet,Vy=function(t,e,i,r,s,o){t.push("<hr/>"),t.push({label:"Delete",click:async()=>{i.removeFeature(e),r.browser.fireEvent("roiremoved",[{chr:e.chr,start:e.start,end:e.end,name:e.name}]);const t=await i.getAllFeatures();0===Object.keys(t).length&&r.deleteUserDefinedROISet(),r.deleteRegionWithKey(o.dataset.region,s),r.repaintTable()}})},qy=function(t,e){t.push({label:"Copy reference sequence",click:async()=>{this.container.style.display="none";let t=await this.browser.genome.getSequence(e.chr,e.start,e.end);t||(t="Unknown sequence");try{await navigator.clipboard.writeText(t)}catch(t){console.error(t),this.browser.alert.present(`Failed to copy the sequence to the clipboard. (${t.message})`)}}})},Qy=function(t,e,i){t.push({label:"Set description ...",click:()=>{const t={label:"Description",value:e.name||"",callback:()=>{const t=this.browser.inputDialog.value||"";e.name=t.trim(),this.browser.roiManager.repaintTable()}};this.browser.inputDialog.present(t,i)}})},Gy=function(t,e){const i=this.browser.findTracks(t=>"function"==typeof t.sortByValue);if(i.length>0){t.push("<hr/>");const{chr:r,start:s,end:o}=e;t.push({label:"Sort by value (ascending)",click:()=>Promise.all(i.map(t=>t.sortByValue({option:"VALUE",direction:"ASC",chr:r,start:s,end:o})))}),t.push('<hr style="border: none; height: 1px; background-color: white; margin-top: 1px; margin-bottom: 1px;" />'),t.push({label:"Sort by value (descending)",click:()=>Promise.all(i.map(t=>t.sortByValue({option:"VALUE",direction:"DESC",chr:r,start:s,end:o})))})}},Wy=function(t,e){t.push({label:"BLAT reference sequence",click:async()=>{this.container.style.display="none";const{chr:t,start:i,end:r}=e;let s=await this.browser.genome.getSequence(t,i,r);if(s){const e=`blat: ${t}:${i+1}-${r}`,o=`blat: ${t}:${i+1}-${r}`;$h({sequence:s,browser:this.browser,name:e,title:o})}}})};class Zy extends qh{constructor(t){super({browser:t,parent:t.columnContainer,headerTitle:"Regions of Interest",dismissHandler:()=>t.roiTableControl.buttonHandler(!1),gotoButtonHandler:Zy.gotoButtonHandler,columnFormat:Zy.getColumnFormatConfiguration(!0),width:"640px"})}tableRowDOM(t){const i=e({class:"igv-roi-table-row"}),{setName:r,feature:s}=t;i.dataset.region=$y(s.chr,s.start,s.end);let o=[s.chr,F(s.start),F(s.end),s.name||"",r];4===this.columnFormat.length&&(o=o.slice(0,4));for(let t=0;t<o.length;t++){const r=e();i.appendChild(r),r.style.width=this.columnFormat[t].width,r.innerText=o[t]}return this.tableRowDOMHelper(i),i}renderTable(t){if(Array.from(this.tableRowContainer.querySelectorAll(".igv-roi-table-row")).forEach(t=>t.remove()),t.length>0){const e=t.sort((t,e)=>t.feature.chr.localeCompare(e.feature.chr)||t.feature.start-e.feature.start||t.feature.end-e.feature.end);for(let t of e){const e=this.tableRowDOM(t);this.tableRowContainer.appendChild(e)}}}set footerDOM(t){super.footerDOM=t,this.gotoButton.textContent="Go to selected region(s)";const i=e({class:"igv-roi-table-button"});this._footerDOM.appendChild(i),i.id="igv-roi-hide-show-button",i.textContent="Copy Sequence",i.title="One region only of max size 1 mb",this.copySequenceButton=i,Yy(this.copySequenceButton,!1),this.boundCopySequenceButtonHandler=async function(t){t.preventDefault(),t.stopPropagation();const e=this.tableDOM.querySelectorAll(".igv-roi-table-row-selected");if(e.length>0){const t=[];for(let i of e){const{locus:e}=Ky(i.dataset.region);t.push(e)}for(let t of this.tableDOM.querySelectorAll(".igv-roi-table-row"))t.classList.remove("igv-roi-table-row-selected");if(this.setTableRowSelectionState(!1),t.length>0){const e=Wg(t[0],this.browser.isSoftclipped());if(e){const{chr:t,start:i,end:r}=e,s=await this.browser.genome.getSequence(t,i,r);await navigator.clipboard.writeText(s)}}}}.bind(this),this.copySequenceButton.addEventListener("click",this.boundCopySequenceButtonHandler);const r=e({class:"igv-roi-table-button"});this._footerDOM.appendChild(r),r.id="igv-roi-hide-show-button",r.textContent="Hide Overlays",this.toggleROIButton=r,this.boundToggleDisplayButtonHandler=function(t){t.preventDefault(),t.stopPropagation(),this.roiManager.toggleROIs()}.bind(this),this.toggleROIButton.addEventListener("click",this.boundToggleDisplayButtonHandler)}get roiManager(){return this.browser.roiManager}setTableRowSelectionState(t){super.setTableRowSelectionState(t);const e=this.tableDOM.querySelectorAll(".igv-roi-table-row-selected");if(e.length>0&&e.length<2){const{locus:t}=Ky(e[0].dataset.region),i=Wg(t,this.browser.isSoftclipped());i&&void 0!==i.start&&void 0!==i.end&&Yy(this.copySequenceButton,i.end-i.start<1e6)}else Yy(this.copySequenceButton,!1)}dispose(){document.removeEventListener("click",this.boundGotoButtonHandler),document.removeEventListener("click",this.boundCopySequenceButtonHandler),document.removeEventListener("click",this.boundToggleDisplayButtonHandler),this.browser.roiTableControl.buttonHandler(!1),super.dispose()}static getColumnFormatConfiguration(t){return!0===t?[{label:"Chr",width:"20%"},{label:"Start",width:"15%"},{label:"End",width:"15%"},{label:"Description",width:"30%"},{label:"ROI Set",width:"20%"}]:[{label:"Chr",width:"25%"},{label:"Start",width:"20%"},{label:"End",width:"20%"},{label:"Description",width:"35%"}]}static gotoButtonHandler(t){t.stopPropagation();const e=this.tableDOM.querySelectorAll(".igv-roi-table-row-selected"),i=[];for(let t of e){const{locus:e}=Ky(t.dataset.region);i.push(e)}for(let t of this.tableDOM.querySelectorAll(".igv-roi-table-row"))t.classList.remove("igv-roi-table-row-selected");this.setTableRowSelectionState(!1),i.length>0&&this.browser.search(i.join(" "))}}function Yy(t,e){t.style.pointerEvents=e?"auto":"none",t.style.color=Vr(e?"licorice":"silver"),t.style.borderColor=Vr(e?"licorice":"silver")}class Xy{constructor(t){this.browser=t,this.roiMenu=new jy(t,t.columnContainer),this.roiTable=new Zy(t),this.top=0,this.roiSets=[],this.showOverlays=!0,this.boundLocusChangeHandler=Jy.bind(this),t.on("locuschange",this.boundLocusChangeHandler)}async reset(){this.roiSets.length>0&&this.browser.roiTableControl.setVisibility(!0);const t=this.roiSets.map(t=>this.renderROISet({browser:this.browser,pixelTop:this.top,roiSet:t}));t.length>0&&await Promise.all(t);const e=await this.getTableRecords();this.roiTable.renderTable(e),this.roiSets.length>0&&this.setOverlayVisibility(this.showOverlays)}setOverlayVisibility(t){const e=this.browser.columnContainer.querySelectorAll(".igv-roi-region");for(let i=0;i<e.length;i++){const r=e[i];r.style.backgroundColor=t?r.dataset.color:"rgba(0, 0, 0, 0)"}this.roiTable.toggleROIButton.textContent=!1===t?"Show Overlays":"Hide Overlays"}async loadROI(t,e){var i;const r=Array.isArray(t)?t:[t];r.length>0&&!1===r[0].isVisible&&(this.showOverlays=!1);for(let t of r)!t.name&&t.url&&(t.name=_(t.url)),t.url&&!t.format&&(t.format=null!==(i=await Op(t))&&void 0!==i?i:void 0),this.roiSets.push(new Zd(t,e));await this.reset()}clearROIs(){this.roiTable.clearTable();const t=this.browser.columnContainer.querySelectorAll(".igv-roi-region");for(let e of t)e.remove();for(let t of this.roiSets)t.dispose();this.roiSets=[]}async getTableRecords(){const t=[];for(let e of this.roiSets){const i=e.name||"",r=await e.getAllFeatures();for(let e of Object.keys(r))for(let s of r[e])t.push({setName:i,feature:s})}return t}presentTable(){this.roiTable.present()}async repaintTable(){const t=await this.getTableRecords();this.roiTable.renderTable(t)}dismissTable(){this.roiTable.dismiss()}roiTableIsVisible(){return this.roiTable.isVisible()}async updateUserDefinedROISet(t){let e=await this.getUserDefinedROISet();void 0===e&&(e=this.initializeUserDefinedROISet()),e.addFeature(t),this.browser.fireEvent("roiadded",[{chr:t.chr,start:t.start,end:t.end,name:t.name}]),this.setROITableButtonVisibility(!0),await this.renderROISet({browser:this.browser,pixelTop:this.top,roiSet:e});const i=await this.getTableRecords();this.roiTable.renderTable(i)}setROITableButtonVisibility(t){this.browser.roiTableControl.setVisibility(t)}toggleROIs(){this.showOverlays=!this.showOverlays,this.setOverlayVisibility(this.showOverlays)}async renderAllROISets(){for(let t of this.roiSets)await this.renderROISet({browser:this.browser,pixelTop:this.top,roiSet:t})}async renderROISet({browser:t,pixelTop:e,roiSet:i}){const r=t.columnContainer.querySelectorAll(".igv-column");for(let s=0;s<r.length;s++){let{chr:o,start:n,end:a,bpPerPixel:c}=t.referenceFrameList[s];const l=r[s].querySelectorAll(".igv-roi-region");for(let t of l){const e=t.dataset.region,{chr:i,start:r,end:s}=Ky(e);(i!==o||s<n||r>a)&&t.remove()}const h=await i.getFeatures(o,n,a);if(h)for(let l of h){const h=$y(o,l.start,l.end),{x:d,width:u}=Yd(Math.max(n,l.start),Math.min(a,l.end),n,c),f=r[s].querySelector(tA(h));if(f)f.style.left=`${d}px`,f.style.width=`${u}px`;else{const o=this.createRegionElement(t.columnContainer,e,d,u,i,h,l);r[s].appendChild(o)}}}}createRegionElement(t,i,r,s,o,n,c){const l=e({class:"igv-roi-region"});l.style.top=`${i}px`,l.style.left=`${r}px`,l.style.width=`${s}px`;const h=`${this.getROIRegionTopMargin()}px`;l.style.marginTop=h,l.dataset.color=o.color,l.dataset.region=n,this.showOverlays?l.style.backgroundColor=o.color:l.style.backgroundColor="rgba(0, 0, 0, 0)";const d=e();return l.appendChild(d),d.style.backgroundColor=o.headerColor,d.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),a(e,t),this.roiMenu.present(c,o,e,this,t,l)}),l}updateROIRegionPositions(){const t=`${this.getROIRegionTopMargin()}px`,e=this.browser.columnContainer.querySelectorAll(".igv-column");for(let i=0;i<e.length;i++){const r=e[i].querySelectorAll(".igv-roi-region");for(let e=0;e<r.length;e++)r[e].style.marginTop=t}}getROIRegionTopMargin(){const t=this.browser.findTracks(t=>new Set(["ideogram","ruler"]).has(t.type)),[e,i]=t.map(t=>t.trackView.viewports[0].viewportElement).map(t=>function(t){const e=window.getComputedStyle(t),i=parseInt(e.marginTop),r=parseInt(e.marginBottom),{top:s,bottom:o,height:n}=t.getBoundingClientRect();return{top:Math.floor(s)-i,bottom:Math.floor(o)+r,height:Math.floor(n)+i+r}}(t));return(e?e.height:0)+(i?i.height:0)+-.5}renderSVGContext(t,e,{deltaX:i,deltaY:r}){for(const s of t.querySelectorAll(".igv-roi-region")){const{x:t,y:o,width:n,height:a}=s.getBoundingClientRect();e.fillStyle=s.style.backgroundColor,e.fillRect(t-i,o+r,n,a);const c=s.querySelector("div"),{x:l,y:h,width:d,height:u}=c.getBoundingClientRect();e.fillStyle=c.style.backgroundColor,e.fillRect(l-i,h+r,d,u)}}getUserDefinedROISet(){return this.roiSets.find(t=>!0===t.isUserDefined)}deleteUserDefinedROISet(){this.roiSets=this.roiSets.filter(t=>!0!==t.isUserDefined)}initializeUserDefinedROISet(){const t=new Zd({name:"user defined",isUserDefined:!0,features:[]},this.browser.genome);return this.roiSets.push(t),t}async deleteRegionWithKey(t,e){e.querySelectorAll(tA(t)).forEach(t=>t.remove());0===(await this.getTableRecords()).length&&(this.browser.roiTableControl.buttonHandler(!1),this.setROITableButtonVisibility(!1))}toJSON(){return this.roiSets.map(t=>t.toJSON())}dispose(){this.browser.off("locuschange",this.boundLocusChangeHandler);const t=this.browser.columnContainer.querySelectorAll(".igv-roi-region");for(let e of t)e.remove();this.roiMenu&&this.roiMenu.dispose(),this.roiTable&&this.roiTable.dispose();for(let t of this.roiSets)t.dispose();for(let t of Object.keys(this))this[t]=void 0}}function Jy(){this.renderAllROISets()}function tA(t){return`[data-region="${t}"]`}class eA{constructor(t,e){this.name=t.name,this.featureSource=t.featureSource||_h(t,e),this.color=t.color||$d}async getFeatures(t,e,i){return this.featureSource.getFeatures({chr:t,start:e,end:i})}draw(t){const{context:e,bpPerPixel:i,bpStart:r,pixelTop:s,pixelHeight:o,pixelWidth:n,features:a}=t;if(!a)return;const c=r+n*i+1;for(let{start:t,end:n}of a){if(n<r)continue;if(t>c)break;const{x:a,width:l}=Yd(t,n,r,i);go.fillRect(e,a,s,l,o,{fillStyle:this.color})}}}class iA{constructor(t,e){this.aliasRecordCache=new Map,this.genomeID=t,this.update(t,e)}async preload(){}getChromosomeName(t){return this.aliasRecordCache.has(t)?this.aliasRecordCache.get(t).chr:t}getChromosomeAlias(t,e){const i=this.aliasRecordCache.get(t);return i&&i[e]||t}update(t,e){if(e){const i=[];for(let r of e){if(this.aliasRecordCache.has(r))continue;const e={chr:r};if(i.push(e),r.startsWith("gi|")){const t=iA.getNCBIName(r);e["ncbi-gi-versioned"]=t;const i=t.lastIndexOf(".");if(i>0){const r=t.substring(0,i);e["ncbi-gi"]=r}}else if("chrM"===r?e.ncbi="MT":"MT"===r?e.ucsc="chrM":r.toLowerCase().startsWith("chr")&&Number.isInteger(Number(r.substring(3)))?e.ncbi=r.substring(3):Number.isInteger(Number(r))&&(e.ucsc="chr"+r),t.startsWith("hg")||t.startsWith("GRCh")||"1kg_ref"===t||"b37"===t)switch(r){case"23":e.ucsc="chrX",e.assembly="X";break;case"24":e.ucsc="chrY",e.assembly="Y";break;case"chrX":e.ncbi="23",e.assembly="X";break;case"chrY":e.ncbi="24",e.assembly="Y";break;case"X":e.ucsc="chrX",e.ncbi="23";break;case"Y":e.ucsc="chrY",e.ncbi="24"}else if(t.startsWith("mm")||t.startsWith("GRCm")||t.startsWith("rheMac"))switch(r){case"21":e.ucsc="chrX",e.assembly="X";break;case"22":e.ucsc="chrY",e.assembly="Y";break;case"chrX":e.ncbi="21",e.assembly="X";break;case"chrY":e.ncbi="22",e.assembly="Y";break;case"X":e.ucsc="chrX",e.ncbi="21";break;case"Y":e.ucsc="chrY",e.ncbi="22"}}for(let t of i){iA.addCaseAliases(t);for(let e of Object.values(t))this.aliasRecordCache.set(e,t)}}}search(t){return this.aliasRecordCache.get(t)}static getNCBIName(t){const e=t.split("\\|");return e[e.length-1]}static addCaseAliases(t){const e=t.chr.toUpperCase(),i=t.chr.toLowerCase(),r=t.chr.charAt(0).toUpperCase()+t.chr.slice(1);t.chr!==e&&(t._uppercase=e),t.chr!==i&&(t._lowercase=i),t.chr!==r&&(t._cap=r);const s=t.chr.startsWith("chr")?t.chr.substring(3):"chr"+t.chr;t._chrprefix_=s}}class rA{constructor(t,e,i){this.aliasRecordCache=new Map,(e=e||{}).url=t,this.reader=new Cl(e,i)}async preload(t){await this.reader.preload();for(let e of t)await this.search(e)}getChromosomeName(t){return this.aliasRecordCache.has(t)?this.aliasRecordCache.get(t).chr:t}getChromosomeAlias(t,e){const i=this.aliasRecordCache.get(t);return i&&i[e]||t}async search(t){if(!this.aliasRecordCache.has(t)){const e=await this.reader.search(t);if(e){iA.addCaseAliases(e);for(let t of Object.keys(e))"start"!==t&&"end"!==t&&this.aliasRecordCache.set(e[t],e)}}return this.aliasRecordCache.get(t)}}class sA{constructor(t,e,i){this.aliasRecordCache=new Map,this.aliasURL=t,this.config=e,this.genome=i}async preload(t){}getChromosomeName(t){return this.aliasRecordCache.has(t)?this.aliasRecordCache.get(t).chr:t}getChromosomeAlias(t,e){const i=this.aliasRecordCache.get(t);return i&&i[e]||t}async loadAliases(){const t=await Er.loadString(this.aliasURL,Qo(this.config)),e=v(t),i=e[0];i.startsWith("#")&&(this.headings=i.substring(1).split("\t").map(t=>t.trim()),this.altNameSets=this.headings.slice(1));const r=this.genome.chromosomeNames?new Set(this.genome.chromosomeNames):new Set;for(let t of e)if(!t.startsWith("#")&&t.length>0){const e=t.split("\t");let i=e.find(t=>r.has(t));i||(i=e[0]);const s={chr:i};iA.addCaseAliases(s);for(let t=0;t<e.length;t++){s[this.headings?this.headings[t]:String(t)]=e[t]}for(let t of Object.values(s))this.aliasRecordCache.set(t,s)}}async search(t){return 0===this.aliasRecordCache.size&&await this.loadAliases(),this.aliasRecordCache.get(t)}}class oA{constructor(t,e,i,r){this.start=t,this.end=e,this.name=i,this.stain=0,"acen"===r?this.type="c":(this.type=r.charAt(1),"p"===this.type&&(this.stain=parseInt(r.substring(4))))}}var nA,aA,cA,lA;class hA{constructor(t,e,i){nA.add(this),this.cytobandMap=new Map,(e=e||{}).url=t,this.source=new Rl(e,i)}async getCytobands(t){if(this.cytobandMap.has(t))return this.cytobandMap.get(t);{let e=await wo(this,nA,"m",aA).call(this,t);return e||(e=[]),this.cytobandMap.set(t,e),e}}}nA=new WeakSet,aA=async function(t){return(await this.source.getFeatures({chr:t,start:0,end:Number.MAX_SAFE_INTEGER,bpPerPixel:1})).map(t=>new oA(t.start,t.end,t.name,t.gieStain))};class dA{constructor(t,e){cA.add(this),this.cytobands=new Map,this.url=t,this.config=e}async getCytobands(t){return 0===this.cytobands.size&&await wo(this,cA,"m",lA).call(this),this.cytobands.get(t)}}cA=new WeakSet,lA=async function(){let t,e;if(Ko(this.url)){const e=nr(this.url);t="";const i=e.length;for(let r=0;r<i;r++)t+=String.fromCharCode(e[r])}else t=await Er.loadString(this.url,Qo(this.config));let i=[];const r=v(t);for(let t of r){const r=t.split("\t"),s=r[0];if(e||(e=s),s!==e&&(this.cytobands.set(e,i),i=[],e=s),5===r.length){const t=parseInt(r[1]),e=parseInt(r[2]),s=r[3],o=r[4];i.push(new oA(t,e,s,o))}}i.length>0&&this.cytobands.set(e,i)};function uA(t){if(!function(t){return e=t.fastaURL,("string"==typeof e||e instanceof String)&&(t.fastaURL.startsWith("https://igv.org")||["igv.org.genomes","igv.broadinstitute.org","igv.genepattern.org","igvdata.broadinstitute.org","igv-genepattern-org"].some(e=>t.fastaURL.includes(e)));var e}(t)||!fA[t.id])return;const e=fA[t.id];e&&(delete t.fastaURL,t.indexURL&&delete t.indexURL,t.twoBitURL=e.twoBitURL,e.twoBitBptURL&&(t.twoBitBptURL=e.twoBitBptURL),e.chromSizesURL&&(t.chromSizesURL=e.chromSizesURL))}const fA={hs1:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/hs1/bigZips/hs1.2bit",twoBitBptURL:"https://hgdownload.soe.ucsc.edu/goldenPath/hs1/bigZips/hs1.2bit.bpt",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/hs1/bigZips/hs1.chrom.sizes.txt"},hg38:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.chrom.sizes"},hg19:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/hg19/bigZips/hg19.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/hg19/bigZips/hg19.chrom.sizes"},hg18:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/hg18/bigZips/hg18.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/hg18/bigZips/hg18.chrom.sizes"},mm39:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/mm39/bigZips/mm39.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/mm39/bigZips/mm39.chrom.sizes"},mm10:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/mm10/bigZips/mm10.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/mm10/bigZips/mm10.chrom.sizes"},mm9:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/mm9/bigZips/mm9.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/mm9/bigZips/mm9.chrom.sizes"},rn7:{twoBitURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/015/227/675/GCF_015227675.2/GCF_015227675.2.2bit",twoBitBptURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/015/227/675/GCF_015227675.2/GCF_015227675.2.2bit.bpt",chromSizesURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/015/227/675/GCF_015227675.2/GCF_015227675.2.chrom.sizes.txt"},rn6:{twoBitURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/000/001/895/GCF_000001895.5/GCF_000001895.5.2bit",twoBitBptURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/000/001/895/GCF_000001895.5/GCF_000001895.5.2bit.bpt",chromSizesURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/000/001/895/GCF_000001895.5/GCF_000001895.5.chrom.sizes.txt"},gorGor6:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/gorGor6/bigZips/gorGor6.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/gorGor6/bigZips/gorGor6.chrom.sizes"},gorGor4:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/gorGor4/bigZips/gorGor4.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/gorGor4/bigZips/gorGor4.chrom.sizes"},panTro6:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/panTro6/bigZips/panTro6.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/panTro6/bigZips/panTro6.chrom.sizes"},panTro5:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/panTro5/bigZips/panTro5.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/panTro5/bigZips/panTro5.chrom.sizes"},panTro4:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/panTro4/bigZips/panTro4.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/panTro4/bigZips/panTro4.chrom.sizes"},macFas5:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/macFas5/bigZips/macFas5.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/macFas5/bigZips/macFas5.chrom.sizes"},panPan2:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/panPan2/bigZips/panPan2.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/panPan2/bigZips/panPan2.chrom.sizes"},canFam6:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/canFam6/bigZips/canFam6.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/canFam6/bigZips/canFam6.chrom.sizes"},canFam5:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/canFam5/bigZips/canFam5.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/canFam5/bigZips/canFam5.chrom.sizes"},canFam4:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/canFam4/bigZips/canFam4.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/canFam4/bigZips/canFam4.chrom.sizes"},canFam3:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/canFam3/bigZips/canFam3.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/canFam3/bigZips/canFam3.chrom.sizes"},bosTau9:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/bosTau9/bigZips/bosTau9.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/bosTau9/bigZips/bosTau9.chrom.sizes"},bosTau8:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/bosTau8/bigZips/bosTau8.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/bosTau8/bigZips/bosTau8.chrom.sizes"},susScr11:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/susScr11/bigZips/susScr11.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/susScr11/bigZips/susScr11.chrom.sizes"},galGal6:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/galGal6/bigZips/galGal6.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/galGal6/bigZips/galGal6.chrom.sizes"},danRer11:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/danRer11/bigZips/danRer11.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/danRer11/bigZips/danRer11.chrom.sizes"},danRer10:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/danRer10/bigZips/danRer10.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/danRer10/bigZips/danRer10.chrom.sizes"},ce11:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/ce11/bigZips/ce11.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/ce11/bigZips/ce11.chrom.sizes"},dm6:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/dm6/bigZips/dm6.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/dm6/bigZips/dm6.chrom.sizes"},dm3:{twoBitURL:"https://hgdownload.soe.ucsc.edu/goldenPath/dm3/bigZips/dm3.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/goldenPath/dm3/bigZips/dm3.chrom.sizes"},sacCer3:{twoBitURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/000/146/045/GCF_000146045.2/GCF_000146045.2.2bit",twoBitBptURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/000/146/045/GCF_000146045.2/GCF_000146045.2.2bit.bpt",chromSizesURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/000/146/045/GCF_000146045.2/GCF_000146045.2.chrom.sizes.txt"},"GCF_000002945.1":{twoBitURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/000/002/945/GCF_000002945.1/GCF_000002945.1.2bit",twoBitBptURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/000/002/945/GCF_000002945.1/GCF_000002945.1.2bit.bpt",chromSizesURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/000/002/945/GCF_000002945.1/GCF_000002945.1.chrom.sizes.txt"},"GCF_009858895.2":{twoBitURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/009/858/895/GCF_009858895.2/GCF_009858895.2.2bit",twoBitBptURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/009/858/895/GCF_009858895.2/GCF_009858895.2.2bit.bpt",chromSizesURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/009/858/895/GCF_009858895.2/GCF_009858895.2.chrom.sizes.txt"},tair10:{twoBitURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/000/001/735/GCF_000001735.3/GCF_000001735.3.2bit",chromSizesURL:"https://hgdownload.soe.ucsc.edu/hubs/GCF/000/001/735/GCF_000001735.3/GCF_000001735.3.chrom.sizes.txt"},"GCA_000022165.1":{twoBitURL:"https://hgdownload.soe.ucsc.edu/hubs/GCA/000/022/165/GCA_000022165.1/GCA_000022165.1.2bit",twoBitBptURL:"https://hgdownload.soe.ucsc.edu/hubs/GCA/000/022/165/GCA_000022165.1/GCA_000022165.1.2bit.bpt",chromSizesURL:"https://hgdownload.soe.ucsc.edu/hubs/GCA/000/022/165/GCA_000022165.1/GCA_000022165.1.chrom.sizes.txt"}};var pA,gA,mA,wA;const bA=new Map([["1kg_ref","hg18"],["1kg_v37","hg19"],["b37","hg19"]]);class FA{static async createGenome(t,e){uA(t);const i=new FA(t,e);return await i.init(),i}constructor(t,e){pA.add(this),gA.set(this,void 0),mA.set(this,new Map),this.config=t,this.browser=e,this.id=t.id||function(t){return void 0!==t.id?t.id:t.fastaURL&&b(t.fastaURL)&&!t.fastaURL.startsWith("data:")?t.fastaURL:t.fastaURL&&"object"==typeof t.fastaURL&&t.fastaURL.name?t.fastaURL.name:""}(t),this.ucscID=t.ucscID||bA.get(this.id)||this.id,this.blatDB=t.blatDB||this.ucscID,this.name=t.name,this.nameSet=t.nameSet}async init(){const t=this.config;if(this.sequence=await qn(t,this.browser),!1!==t.showIdeogram&&!1!==t.wholeGenomeView&&(t.cytobandURL?this.cytobandSource=new dA(t.cytobandURL,Object.assign({},t)):t.cytobandBbURL&&(this.cytobandSource=new hA(t.cytobandBbURL,Object.assign({},t),this))),this.sequence.chromosomes?this.chromosomes=this.sequence.chromosomes:t.chromSizesURL?this.chromosomes=await async function(t){const e=new Map;let i;if(Ko(t)){let e=nr(t);i="";for(let t of e)i+=String.fromCharCode(t)}else i=await Er.load(t,{});const r=An(i);let s=0;for(let t of r){const i=t.split("\t");if(i.length>1){const t=Number.parseInt(i[1]);e.set(i[0],new ln(i[0],s++,t))}}return e}(t.chromSizesURL):this.chromosomes=new Map,this.sequence.chromosomeNames?this.chromosomeNames=this.sequence.chromosomeNames:this.chromosomes.size>0&&(this.chromosomeNames=Array.from(this.chromosomes.keys())),t.chromAliasBbURL?this.chromAlias=new rA(t.chromAliasBbURL,Object.assign({},t),this):t.aliasURL?this.chromAlias=new sA(t.aliasURL,Object.assign({},t),this):this.chromosomeNames&&(this.chromAlias=new iA(this.id,this.chromosomeNames)),!1!==t.wholeGenomeView&&this.chromosomes.size>0&&(t.chromosomeOrder?(Array.isArray(t.chromosomeOrder)?bo(this,gA,t.chromosomeOrder,"f"):bo(this,gA,t.chromosomeOrder.split(",").map(t=>t.trim()),"f"),await this.chromAlias.preload(wo(this,gA,"f")),bo(this,gA,wo(this,gA,"f").map(t=>this.getChromosomeName(t)).filter(t=>this.chromosomes.has(t)),"f")):(bo(this,gA,function(t){const e=[];let i,r=1;for(let s of t.values()){if(i){if(s.bpLength<i/100)continue;i=((r-1)*i+s.bpLength)/r,e.push(s.name)}else i=s.bpLength,e.push(s.name);r++}return e}(this.chromosomes),"f"),await this.chromAlias.preload(wo(this,gA,"f")))),this.wholeGenomeView=!1!==t.wholeGenomeView&&!!wo(this,gA,"f")&&this.chromosomes.size>1,this.wholeGenomeView){const t=wo(this,gA,"f").reduce((t,e)=>t+this.chromosomes.get(e).bpLength,0);this.chromosomes.set("all",new ln("all",0,t))}}get description(){return this.config.description||`${this.id}\n${this.name}`}get infoURL(){return this.config.infoURL}showWholeGenomeView(){return this.wholeGenomeView}toJSON(){return Object.assign({},this.config,{tracks:void 0})}get initialLocus(){return this.config.locus?this.config.locus:this.getHomeChromosomeName()}getHomeChromosomeName(){return this.showWholeGenomeView()&&this.chromosomes.has("all")?"all":this.chromosomeNames?this.chromosomeNames[0]:void 0}getChromosomeName(t){return this.chromAlias?this.chromAlias.getChromosomeName(t,this.chromosomes.keys()):t}getChromosomeDisplayName(t){return this.nameSet&&this.chromAlias&&this.chromAlias.getChromosomeAlias(t,this.nameSet)||t}getChromosome(t){return this.chromAlias&&(t=this.chromAlias.getChromosomeName(t)),this.chromosomes.get(t)}async loadChromosome(t){const e=await this.getAliasRecord(t);if(e&&(t=e.chr),!this.chromosomes.has(t)){let e;const i=await this.sequence.getSequenceRecord(t);i&&(e=new ln(t,0,i.bpLength)),this.chromosomes.set(t,e)}return this.chromosomes.get(t)}async getAliasRecord(t){if(wo(this,mA,"f").has(t))return wo(this,mA,"f").get(t);if(this.chromAlias){let e=await this.chromAlias.search(t);if(e||t===t.toLowerCase()||(e=await this.chromAlias.search(t.toLowerCase())),e){const t=e.chr.toUpperCase(),i=e.chr.toLowerCase(),r=e.chr.charAt(0).toUpperCase()+e.chr.slice(1);e.chr!==t&&(e._uppercase=t),e.chr!==i&&(e._lowercase=i),e.chr!==r&&(e._cap=r)}return wo(this,mA,"f").set(t,e),e}}async getCytobands(t){if(this.cytobandSource){const e=this.getChromosomeName(t);return await this.cytobandSource.getCytobands(e)}}getChromosomes(){return this.chromosomes}get wgChromosomeNames(){return wo(this,gA,"f")?wo(this,gA,"f").slice():void 0}get showChromosomeWidget(){return this.config.showChromosomeWidget}getGenomeCoordinate(t,e){const i=this.getCumulativeOffset(t);if(void 0!==i)return i+e}getChromosomeCoordinate(t){let e;void 0===this.cumulativeOffsets&&(this.cumulativeOffsets=wo(this,pA,"m",wA).call(this));let i=0;for(let r of wo(this,gA,"f")){const s=this.cumulativeOffsets[r];if(s>t){return{chr:e,position:t-i}}e=r,i=s}return{chr:wo(this,gA,"f")[wo(this,gA,"f").length-1],position:0}}getCumulativeOffset(t){void 0===this.cumulativeOffsets&&(this.cumulativeOffsets=wo(this,pA,"m",wA).call(this));const e=this.getChromosomeName(t);return this.cumulativeOffsets[e]}getGenomeLength(){if(!this.bpLength){let t=0;for(let e of wo(this,gA,"f")){t+=this.chromosomes.get(e).bpLength}this.bpLength=t}return this.bpLength}async getSequence(t,e,i){return t=this.getChromosomeName(t),this.sequence.getSequence(t,e,i)}getSequenceInterval(t,e,i){return this.sequence&&"getSequenceInterval"in this.sequence?this.sequence.getSequenceInterval(t,e,i):void 0}getHubURLs(){return this.config.hubs}async getManeTranscript(t){if(!this.maneFeatureSource&&this.config.maneBbURL&&this.loadManeFeatureSource(),this.maneFeatureSource){const e=await this.maneFeatureSource.search(t);if(e)return e}if(!this.rsDBFeatureSource&&this.config.rsdbURL&&(this.rsDBFeatureSource=new Rl({url:this.config.rsdbURL},this)),this.rsDBFeatureSource){const e=await this.rsDBFeatureSource.search(t);if(e)return e}return null}async getManeTranscriptAt(t,e){if(!this.maneFeatureSource&&this.config.maneBbURL&&this.loadManeFeatureSource(),this.maneFeatureSource)try{const i=e,r=e+1,s=await this.maneFeatureSource.getFeatures({chr:t,start:i,end:r,bpPerPixel:1});if(s)for(const t of s)if(t.start<=e&&t.end>=e)return t}catch(t){console.error("Error fetching MANE transcript",t)}return null}loadManeFeatureSource(){if(null!=this.config.maneBbURL){const t={url:this.config.maneBbURL};this.config.maneTrixURL&&(t.trixURL=this.config.maneTrixURL),this.maneFeatureSource=new Rl(t,this)}}}gA=new WeakMap,mA=new WeakMap,pA=new WeakSet,wA=function(){const t={};let e=0;for(let i of wo(this,gA,"f")){t[i]=Math.floor(e);e+=this.getChromosome(i).bpLength}return t};const vA={minimumBases:40,showIdeogram:!0,showCytobandNames:!1,showCircularView:!1,showCircularViewButton:!1,showTrackLabelButton:!0,showTrackLabels:!0,showCursorTrackingGuideButton:!0,showCursorGuide:!1,showCenterGuideButton:!0,showCenterGuide:!1,showSampleNames:!1,showSVGButton:!0,showControls:!0,showNavigation:!0,showRuler:!0,flanking:1e3,pairsSupported:!0,tracks:[]};function yA(t,e){void 0===e&&(e=vA);for(const i of Object.keys(e))void 0===t[i]&&(t[i]=e[i]);return t}class AA{constructor(){this.clear()}clear(){this.phenotypeColors=new Map,this.snps=new Set,this.qtl=null}isEmpty(){return 0===this.phenotypeColors.size&&0===this.snps.size&&null===this.qtl}addSnp(t){t=t.toUpperCase(),this.snps.add(t)}addPhenotype(t){t=t.toUpperCase();const e=this.phenotypeColors.size;if(!this.phenotypeColors.has(t.toUpperCase())){const i=e<CA.length?CA[e]:ur.randomRGB(0,255);this.phenotypeColors.set(t.toUpperCase(),i)}}hasSnp(t){return!!t&&this.snps.has(t.toUpperCase())}hasPhenotype(t){return!!t&&this.phenotypeColors.has(t.toUpperCase())}hasQTL(t){return!(!this.qtl||this.qtl!==t)}colorForGene(t){return t?this.phenotypeColors.get(t.toUpperCase()):"black"}toJSON(){const t={};return this.phenotypeColors.size>0&&(t.phenotypes=Array.from(this.phenotypeColors.keys())),this.snps.size>0&&(t.snps=Array.from(this.snps)),this.qtl&&(t.qtl=this.qtl),t}static fromJSON(t){const e=new AA;if(t.phenotypes)for(let i of t.phenotypes)e.addPhenotype(i);if(t.snps)for(let i of t.snps)e.addSnp(i);return t.qtl&&(e.qtl=t.qtl),e}}const CA=[];CA.push("rgb(228,26,28)"),CA.push("rgb(55,126,184)"),CA.push("rgb(77,175,74)"),CA.push("rgb(166,86,40)"),CA.push("rgb(152,78,163)"),CA.push("rgb(255,127,0)"),CA.push("rgb(247,129,191)"),CA.push("rgb(255,255,51)"),CA.push("rgb(102,194,165)"),CA.push("rgb(252,141,98)"),CA.push("rgb(141, 160, 203)"),CA.push("rgb(231, 138, 195)"),CA.push("rgb(166, 216, 84)"),CA.push("rgb(255, 217, 47)"),CA.push("rgb(229, 196, 148)"),CA.push("rgb( 141, 211, 199)"),CA.push("rgb(255, 255, 179)"),CA.push("rgb(190, 186, 218)"),CA.push("rgb(251, 128, 114)"),CA.push("rgb(128, 177, 211)"),CA.push("rgb(253, 180, 98)"),CA.push("rgb(179, 222, 105)"),CA.push("rgb(252, 205, 229)"),CA.push("rgb(188, 128, 189)"),CA.push("rgb(204, 235, 197)"),CA.push("rgb(255, 237, 111)");class _A{constructor(t,i){var r;this.browser=i,this.columnContainer=t,this.horizontalGuide=e({class:"igv-cursor-guide-horizontal"}),t.appendChild(this.horizontalGuide),this.verticalGuide=e({class:"igv-cursor-guide-vertical"}),t.appendChild(this.verticalGuide),this.addMouseHandler(i),this.setVisibility(null!==(r=i.config.showCursorGuide)&&void 0!==r&&r)}addMouseHandler(t){this.boundMouseMoveHandler=function(e){e.target.tagName;const{x:i,y:r}=a(e,this.columnContainer);if(this.horizontalGuide.style.top=`${r}px`,"CANVAS"===e.target.tagName){const r=function(t,e){for(;t.parentElement;){if(t.parentElement.classList.contains(e))return t.parentElement;t=t.parentElement}return}(e.target,"igv-viewport");if(r&&t.getRulerTrackView()){this.verticalGuide.style.left=`${i}px`;const s=t.root.querySelectorAll(".igv-column");let o;const n=r.parentElement;for(let t=0;t<s.length;t++)void 0===o&&n===s[t]&&(o=t);if(void 0!==o){const i=t.getRulerTrackView().viewports[o].mouseMove(e);if(i){const{start:t,bp:e,end:r}=i,s=(e-t)/(r-t);this.customMouseHandler&&this.customMouseHandler({start:t,bp:e,end:r,interpolant:s})}}}}}.bind(this),this.columnContainer.addEventListener("mousemove",this.boundMouseMoveHandler)}removeMouseHandler(){this.columnContainer.removeEventListener("mousemove",this.boundMouseMoveHandler)}setVisibility(t){!0===t?this.show():this.hide()}show(){this.verticalGuide.style.display="block",this.horizontalGuide.style.display="block"}hide(){this.verticalGuide.style.display="none",this.horizontalGuide.style.display="none";const t=this.browser.getRulerTrackView();if(t)for(let e of t.viewports){const t=e;t.tooltip&&(t.tooltip.style.display="none")}}}class xA{constructor(t){this._scaleFactor=1,this._precision=2,this.parent=t,this.container=e({class:"igv-ui-generic-dialog-container"}),t.appendChild(this.container);const i=e({class:"igv-ui-generic-dialog-header"});this.container.appendChild(i),this.label=e({class:"igv-ui-generic-dialog-one-liner"}),this.container.appendChild(this.label),this.label.textContent="Unlabeled",this.input_container=e({class:"igv-ui-generic-dialog-input"}),this.container.appendChild(this.input_container);let s='<input type="range" id="igv-slider-dialog-input" name="igv-slider-dialog-input" />';this._input=document.createRange().createContextualFragment(s).firstChild,this.input_container.appendChild(this._input),s='<output id="igv-slider-dialog-output" name="igv-slider-dialog-output" for="igv-slider-dialog-input"></output>',this._output=document.createRange().createContextualFragment(s).firstChild,this.input_container.appendChild(this._output);const o=e({class:"igv-ui-generic-dialog-ok-cancel"});this.container.appendChild(o),this.ok=e(),o.appendChild(this.ok),this.ok.textContent="OK",this.cancel=e(),o.appendChild(this.cancel),this.cancel.textContent="Cancel",r(this.container),this._input.addEventListener("input",function(t,e){let i=0;return(...r)=>{const s=(new Date).getTime();if(!(s-i<e))return i=s,t(...r)}}(()=>{const t=parseFloat(this._input.value)/this._scaleFactor;this.callback(t),this._output.value=`${t.toFixed(this._precision)}`},200)),this.ok.addEventListener("click",()=>{if("function"==typeof this.callback){const t=parseFloat(this._input.value)/this._scaleFactor;this.callback(t),this.callback=void 0}this._input.value="",r(this.container)});const n=()=>{this._input.value="",r(this.container)};this.cancel.addEventListener("click",n),u(i,n),p(this.container,i)}get value(){return uo.sanitize(this._input.value)}present(t,e){this.label.textContent=t.label,this._scaleFactor=t.scaleFactor,this._precision=t.precision||2;const[i,r,o]=[t.min,t.max,t.value].map(t=>Math.floor(this._scaleFactor*t).toString());this._input.min=i,this._input.max=r,this._input.value=o;const n=parseFloat(o)/this._scaleFactor;this._output.value=`${n.toFixed(this._precision)}`,this.callback=t.callback||t.click,t.color&&(this._input.style.background=`linear-gradient(to right, #fff, ${t.color})`),s(this.container),this.clampLocation(e.clientX,e.clientY)}clampLocation(t,e){const{width:i,height:r}=this.container.getBoundingClientRect(),s=window.innerHeight,o=window.innerWidth,n=Math.min(s-r,e),a=Math.min(o-i,t);this.container.style.left=`${a}px`,this.container.style.top=`${n}px`}}class kA{constructor(){this.eventHandlers=new Map}on(t,e){this.eventHandlers.has(t)||this.eventHandlers.set(t,[]),this.eventHandlers.get(t).push(e)}un(t,e){this.off(t,e)}off(t,e){if(t)if(e){const i=this.eventHandlers.get(t);if(i&&0!==i.length){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}else console.warn("No handlers to remove for event: "+t)}else this.eventHandlers.delete(t);else this.eventHandlers.clear()}emit(t,e,i){const r=this.eventHandlers.get(t);if(void 0===r||0===r.length)return;const s=i||globalThis,o=e||[];return r.map(function(t){return t.apply(s,o)})[0]}}var IA,SA,EA,NA,MA,RA;class DA{constructor(t,i){IA.add(this),this.qtlSelections=new AA,this.referenceFrameList=[],this.centerLineList=[],this.roiSets=[],this.isScrolling=!1,this.config=t,this.guid=n(),this.namespace=".browser_"+this.guid,this.parent=i,this.eventEmitter=new kA;let r=i.shadowRoot;if(!r){r=i.attachShadow({mode:"open"});const t=new CSSStyleSheet;t.replaceSync('.igv-ui-dropdown{cursor:default;position:absolute;top:0;left:0;z-index:2048;border-color:#7f7f7f;border-style:solid;border-width:1px;font-family:"Open Sans",sans-serif;font-size:small;font-weight:400;background-color:#fff}.igv-ui-dropdown>div{overflow-y:auto;overflow-x:hidden;background-color:#fff}.igv-ui-dropdown>div>div{padding:4px;width:100%;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap;border-bottom-color:#7f7f7f;border-bottom-style:solid;border-bottom-width:1px;background-color:#fff}.igv-ui-dropdown>div>div:last-child{border-bottom-color:rgba(0,0,0,0);border-bottom-width:0}.igv-ui-dropdown>div>div:hover{cursor:pointer;background-color:rgba(0,0,0,.04)}.igv-ui-popover{cursor:default;position:absolute;z-index:2048;border-color:#7f7f7f;border-radius:5px;border-style:solid;border-width:1px;font-family:"Open Sans",sans-serif;font-size:small;background-color:#fff}.igv-ui-popover>div:first-child{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;align-items:center;width:100%;height:24px;cursor:move;border-top-width:0;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-color:#7f7f7f;border-bottom-style:solid;border-bottom-width:thin;background-color:#eee}.igv-ui-popover>div:first-child>div:first-child{margin-left:4px}.igv-ui-popover>div:first-child>div:last-child{margin-right:4px;height:12px;width:12px;color:#7f7f7f}.igv-ui-popover>div:first-child>div:last-child:hover{cursor:pointer;color:#444}.igv-ui-popover>div:last-child{user-select:text;overflow-y:auto;overflow-x:hidden;max-height:400px;max-width:800px;background-color:#fff;border-bottom-width:0;border-bottom-left-radius:5px;border-bottom-right-radius:5px}.igv-ui-popover>div:last-child>div{margin-left:4px;margin-right:4px;min-width:220px;overflow-x:hidden;text-overflow:ellipsis;white-space:nowrap}.igv-ui-popover>div:last-child>div>span{font-weight:bolder}.igv-ui-popover>div:last-child hr{width:100%}.igv-track-label-popover{position:absolute;z-index:2048;border:1px solid #7f7f7f;border-radius:5px;background:#fff;font-family:"Open Sans",sans-serif;font-size:small;min-width:260px;max-width:800px;box-shadow:0 2px 8px rgba(0,0,0,.12);user-select:text}.igv-track-label-popover__header{display:flex;align-items:center;justify-content:space-between;height:24px;background:#eee;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom:1px solid #7f7f7f;padding:0 8px;cursor:move}.igv-track-label-popover__title{font-weight:bold;font-size:1em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.igv-track-label-popover__close{width:14px;height:14px;color:#7f7f7f;display:flex;align-items:center;justify-content:center;border-radius:2px;cursor:pointer;transition:background .2s,color .2s;margin-left:8px}.igv-track-label-popover__close svg{width:14px;height:14px}.igv-track-label-popover__close:hover,.igv-track-label-popover__close:focus{background:#ddd;color:#444;outline:none}.igv-track-label-popover__body{max-height:400px;overflow-y:auto;padding:8px 0;background:#fff;border-bottom-left-radius:5px;border-bottom-right-radius:5px}.igv-track-label-popover__row{display:flex;align-items:baseline;margin:0 12px 4px 12px;min-width:220px;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis}.igv-track-label-popover__key{font-weight:bold;margin-right:.5em}.igv-track-label-popover__value{font-weight:normal;flex:1 1 auto;overflow-x:hidden;text-overflow:ellipsis}.igv-track-label-popover hr{width:100%;border:none;border-top:1px solid #7f7f7f;margin:8px 0}.igv-ui-alert-dialog-container{position:fixed;top:20%;left:50%;transform:translateX(-50%);z-index:2048;box-sizing:content-box;width:400px;height:200px;border-color:#7f7f7f;border-radius:5px;border-style:solid;border-width:thin;outline:none;font-family:"Open Sans",sans-serif;font-size:15px;font-weight:400;background-color:#fff;display:flex;flex-flow:column;flex-wrap:nowrap;justify-content:space-between;align-items:center}.igv-ui-alert-dialog-container>div:first-child{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center;width:100%;height:24px;cursor:move;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-color:#7f7f7f;border-bottom-style:solid;border-bottom-width:thin;background-color:#eee}.igv-ui-alert-dialog-container>div:first-child div:first-child{padding-left:8px}.igv-ui-alert-dialog-container .igv-ui-alert-dialog-body{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;color:#373737;width:100%;height:calc(100% - 24px - 64px);overflow-y:scroll}.igv-ui-alert-dialog-container .igv-ui-alert-dialog-body .igv-ui-alert-dialog-body-copy{margin:16px;width:auto;height:auto;overflow-wrap:break-word;word-break:break-word;background-color:#fff;border:unset}.igv-ui-alert-dialog-container>div:last-child{width:100%;margin-bottom:10px;background-color:#fff;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:center;align-items:center}.igv-ui-alert-dialog-container>div:last-child div{margin:unset;width:40px;height:30px;line-height:30px;text-align:center;color:#fff;font-family:"Open Sans",sans-serif;font-size:small;font-weight:400;border-color:#2b81af;border-style:solid;border-width:thin;border-radius:4px;background-color:#2b81af}.igv-ui-alert-dialog-container>div:last-child div:hover{cursor:pointer;border-color:#25597f;background-color:#25597f}.igv-ui-generic-dialog-container{box-sizing:content-box;position:fixed;top:20%;left:75%;z-index:2048;background-color:#fff;cursor:pointer;width:300px;height:fit-content;padding-bottom:16px;border-color:#7f7f7f;border-radius:5px;border-style:solid;border-width:thin;font-family:"Open Sans",sans-serif;font-size:medium;font-weight:400;display:flex;flex-flow:column;flex-wrap:nowrap;justify-content:flex-start;align-items:center}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-header{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center;width:100%;height:24px;cursor:move;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-color:#7f7f7f;border-bottom-style:solid;border-bottom-width:thin;background-color:#eee}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-header div{margin-right:4px;margin-bottom:2px;height:12px;width:12px;color:#7f7f7f}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-header div:hover{cursor:pointer;color:#444}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-one-liner{color:#373737;width:95%;line-height:24px;text-align:left;margin-top:8px;padding-left:8px;overflow-wrap:break-word;background-color:#fff}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-label-input{margin-top:8px;width:95%;height:24px;color:#373737;line-height:24px;padding-left:8px;background-color:#fff;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-label-input>div{width:fit-content;height:100%;font-size:16px;text-align:right;padding-right:8px;background-color:#fff}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-label-input input{display:block;height:100%;width:100%;padding-left:4px;font-family:"Open Sans",sans-serif;font-weight:400;color:#373737;text-align:left;outline:none;border-style:solid;border-width:thin;border-color:#7f7f7f;background-color:#fff}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-label-input input{width:50%;font-size:16px}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-input{margin-top:8px;width:calc(100% - 16px);height:24px;color:#373737;line-height:24px;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-around;align-items:center}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-input input{display:block;height:100%;width:100%;padding-left:4px;font-family:"Open Sans",sans-serif;font-weight:400;color:#373737;text-align:left;outline:none;border-style:solid;border-width:thin;border-color:#7f7f7f;background-color:#fff}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-input input{font-size:16px}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-input input[type=range]{width:70%;-webkit-appearance:none;background:linear-gradient(90deg, white, black);outline:none;margin:0}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-input output{display:block;height:100%;width:20%;font-size:16px}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok-cancel{width:100%;height:28px;padding-top:16px;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-around;align-items:center}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok-cancel>div{color:#fff;font-family:"Open Sans",sans-serif;font-size:14px;font-weight:400;width:75px;height:28px;line-height:28px;text-align:center;border-color:rgba(0,0,0,0);border-style:solid;border-width:thin;border-radius:2px}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok-cancel>div:first-child{margin-left:32px;margin-right:0;background-color:#5ea4e0}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok-cancel>div:last-child{margin-left:0;margin-right:32px;background-color:#c4c4c4}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok-cancel>div:first-child:hover{cursor:pointer;background-color:#3b5c7f}.igv-ui-generic-dialog-container .igv-ui-generic-dialog-ok-cancel>div:last-child:hover{cursor:pointer;background-color:#7f7f7f}.igv-ui-generic-container{position:fixed;cursor:pointer;background-color:#fff;z-index:2048;box-sizing:content-box;width:300px;height:200px;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;align-items:center}.igv-ui-generic-container>div:nth-child(1){cursor:move;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center;height:24px;width:100%;background-color:#ddd}.igv-ui-generic-container>div:nth-child(1)>div{display:block;color:#5f5f5f;cursor:pointer;width:14px;height:14px;margin-right:8px;margin-bottom:4px}.igv-ui-colorpicker-container{background-color:#eee;height:fit-content;flex-direction:column;flex-wrap:nowrap}.igv-ui-colorpicker-container>div:nth-child(2){display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;align-items:center}.igv-ui-colorpicker-container>div:nth-child(3){box-sizing:border-box;position:relative;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center;padding:.5rem;font-family:"Open Sans",sans-serif;font-size:1rem;font-weight:400;width:100%;border-top-style:solid;border-top-width:thin;border-top-color:#373737}.igv-ui-colorpicker-container>div:nth-child(4){width:100%;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;align-items:center}.igv-ui-color-swatch{position:relative;box-sizing:content-box;display:flex;flex-flow:row;flex-wrap:wrap;justify-content:center;align-items:center;margin:2px;width:32px;height:32px;border-style:solid;border-width:0;border-color:#fff;border-radius:3px}.igv-ui-color-swatch-shim{cursor:pointer;position:relative;box-sizing:content-box;display:flex;flex-flow:row;flex-wrap:wrap;justify-content:center;align-items:center;width:32px;height:32px;background-color:#fff;border-style:solid;border-width:thin;border-color:#fff;border-radius:4px}.igv-ui-dialog{z-index:2048;position:fixed;width:fit-content;height:fit-content;display:flex;flex-flow:column;flex-wrap:nowrap;justify-content:flex-start;background-color:#fff;border-color:#7f7f7f;border-radius:5px;border-style:solid;border-width:thin;font-family:"Open Sans",sans-serif;font-size:medium;font-weight:400}.igv-ui-dialog .igv-ui-dialog-header{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center;width:100%;height:24px;cursor:move;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-color:#7f7f7f;border-bottom-style:solid;border-bottom-width:thin;background-color:#eee}.igv-ui-dialog .igv-ui-dialog-header div{margin-right:4px;margin-bottom:2px;height:12px;width:12px;color:#7f7f7f}.igv-ui-dialog .igv-ui-dialog-header div:hover{cursor:pointer;color:#444}.igv-ui-dialog .igv-ui-dialog-one-liner{width:95%;height:24px;line-height:24px;text-align:left;margin:8px;overflow-wrap:break-word;background-color:#fff;font-weight:bold}.igv-ui-dialog .igv-ui-dialog-ok-cancel{width:100%;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-around;align-items:center}.igv-ui-dialog .igv-ui-dialog-ok-cancel div{margin:16px;margin-top:32px;color:#fff;font-family:"Open Sans",sans-serif;font-size:14px;font-weight:400;width:75px;height:28px;line-height:28px;text-align:center;border-color:rgba(0,0,0,0);border-style:solid;border-width:thin;border-radius:2px}.igv-ui-dialog .igv-ui-dialog-ok-cancel div:first-child{background-color:#5ea4e0}.igv-ui-dialog .igv-ui-dialog-ok-cancel div:last-child{background-color:#c4c4c4}.igv-ui-dialog .igv-ui-dialog-ok-cancel div:first-child:hover{cursor:pointer;background-color:#3b5c7f}.igv-ui-dialog .igv-ui-dialog-ok-cancel div:last-child:hover{cursor:pointer;background-color:#7f7f7f}.igv-ui-dialog .igv-ui-dialog-ok{width:100%;height:36px;margin-top:32px;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-around;align-items:center}.igv-ui-dialog .igv-ui-dialog-ok div{width:98px;height:36px;line-height:36px;text-align:center;color:#fff;font-family:"Open Sans",sans-serif;font-size:medium;font-weight:400;border-color:#fff;border-style:solid;border-width:thin;border-radius:4px;background-color:#2b81af}.igv-ui-dialog .igv-ui-dialog-ok div:hover{cursor:pointer;background-color:#25597f}.igv-ui-panel,.igv-ui-panel-row,.igv-ui-panel-column{z-index:2048;background-color:#fff;font-family:"Open Sans",sans-serif;font-size:medium;font-weight:400;display:flex;justify-content:flex-start;align-items:flex-start}.igv-ui-panel-column{display:flex;flex-direction:column}.igv-ui-panel-row{display:flex;flex-direction:row}.igv-ui-textbox{background-color:#fff;font-family:"Open Sans",sans-serif;font-size:medium;font-weight:400;display:flex;justify-content:flex-start;align-items:flex-start}.igv-ui-table{background-color:#fff}.igv-ui-table thead{position:sticky;top:0}.igv-ui-table th{text-align:left}.igv-ui-table td{padding-right:20px}.igv-ui-table tr:hover{background-color:#add8e6}.igv-roi-seg-filter-dialog{box-sizing:content-box;position:fixed;top:20%;left:75%;transform:translateX(-50%);z-index:2048;background-color:#fff;cursor:pointer;width:350px;height:fit-content;padding-bottom:16px;border-color:#7f7f7f;border-radius:5px;border-style:solid;border-width:thin;font-family:"Open Sans",sans-serif;font-size:medium;font-weight:400;display:flex;flex-flow:column;flex-wrap:nowrap;justify-content:flex-start;align-items:center}.igv-roi-seg-filter-dialog__header{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center;width:100%;height:24px;cursor:move;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-color:#7f7f7f;border-bottom-style:solid;border-bottom-width:thin;background-color:#eee}.igv-roi-seg-filter-dialog__header div{margin-right:4px;margin-bottom:2px;height:12px;width:12px;color:#7f7f7f}.igv-roi-seg-filter-dialog__header div:hover{cursor:pointer;color:#444}.igv-roi-seg-filter-dialog__radio-group{margin-top:8px;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start}.igv-roi-seg-filter-dialog__radio-group label{display:flex;align-items:center;gap:4px;cursor:pointer}.igv-roi-seg-filter-dialog__radio-group input[type=radio]{cursor:pointer}.igv-roi-seg-filter-dialog__radio-group .op{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;margin-left:16px;margin-bottom:8px;gap:2px}.igv-roi-seg-filter-dialog__radio-group .op input[type=radio]{display:block;margin:0}.igv-roi-seg-filter-dialog__radio-group .op label{display:block;margin-left:4px}.igv-roi-seg-filter-dialog__one-liner{color:#373737;width:95%;line-height:24px;text-align:left;margin-top:8px;padding-left:8px;overflow-wrap:break-word;background-color:#fff}.igv-roi-seg-filter-dialog__input{margin-top:8px;width:80%;height:24px;color:#373737;line-height:24px;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-around;align-items:center}.igv-roi-seg-filter-dialog__input input{display:block;height:100%;width:100%;padding-left:4px;font-family:"Open Sans",sans-serif;font-weight:400;color:#373737;text-align:left;outline:none;border-style:solid;border-width:thin;border-color:#7f7f7f;background-color:#fff}.igv-roi-seg-filter-dialog__input input{font-size:16px}.igv-roi-seg-filter-dialog__ok-cancel{width:100%;height:28px;padding-top:16px;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-around;align-items:center}.igv-roi-seg-filter-dialog__ok-cancel>div{color:#fff;font-family:"Open Sans",sans-serif;font-size:14px;font-weight:400;width:75px;height:28px;line-height:28px;text-align:center;border-color:rgba(0,0,0,0);border-style:solid;border-width:thin;border-radius:2px}.igv-roi-seg-filter-dialog__ok-cancel>div:first-child{margin-left:32px;margin-right:0;background-color:#5ea4e0}.igv-roi-seg-filter-dialog__ok-cancel>div:last-child{margin-left:0;margin-right:32px;background-color:#c4c4c4}.igv-roi-seg-filter-dialog__ok-cancel>div:first-child:hover{cursor:pointer;background-color:#3b5c7f}.igv-roi-seg-filter-dialog__ok-cancel>div:first-child.disabled{cursor:not-allowed;background-color:#ccc;opacity:.6}.igv-roi-seg-filter-dialog__ok-cancel>div:first-child.disabled:hover{cursor:not-allowed;background-color:#ccc}.igv-roi-seg-filter-dialog__ok-cancel>div:last-child:hover{cursor:pointer;background-color:#7f7f7f}.igv-clear-filters__container{font-family:"Open Sans",sans-serif;font-size:medium;font-weight:400;display:flex;flex-direction:column;max-width:300px;background-color:#fff;padding:12px;gap:8px;border-color:#7f7f7f;border-radius:5px;border-style:solid;border-width:thin}.igv-clear-filters__row{display:flex;align-items:flex-start;padding:12px;gap:12px;cursor:pointer}.igv-clear-filters__row:last-of-type{border-bottom:none}.igv-clear-filters__track-container{border-bottom:1px solid #7f7f7f;padding-bottom:8px;margin-bottom:8px}.igv-clear-filters__track-container:last-of-type{border-bottom:none;margin-bottom:0}.igv-clear-filters__track-header{display:flex;align-items:center;padding:8px 12px;gap:12px;background-color:#f5f5f5;border-radius:4px;margin-bottom:4px;font-weight:500;font-size:14px}.igv-clear-filters__track-name{color:#333;font-weight:600}.igv-clear-filters__filter-checkbox{flex:0 0 16px;width:16px;height:16px;margin-top:2px;cursor:pointer}.igv-clear-filters__checkbox{flex:0 0 16px;width:16px;height:16px;margin-top:2px;cursor:pointer}.igv-clear-filters__content{display:flex;flex-direction:row;flex:1;gap:4px}.igv-clear-filters__description{color:#333;font-size:14px;line-height:1.4}.igv-clear-filters__region{color:#666;font-family:monospace;font-size:12px;line-height:1.4}.igv-clear-filters__button-container{display:flex;gap:8px;margin-top:8px}.igv-clear-filters__button{display:flex;align-items:center;justify-content:center;flex:1;padding:10px;background-color:#5ea4e0;color:#fff;border-color:rgba(0,0,0,0);border-style:solid;border-width:thin;border-radius:2px;cursor:pointer;font-size:14px;font-weight:400;transition:background-color .2s ease}.igv-clear-filters__button:hover{background-color:#3b5c7f}.igv-clear-filters__button--cancel{background-color:#c4c4c4}.igv-clear-filters__button--cancel:hover{background-color:#7f7f7f}.igv-navbar{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-between;align-items:center;box-sizing:border-box;width:100%;color:#444;font-size:12px;font-family:"Open Sans",sans-serif;font-weight:400;line-height:32px;padding-left:8px;padding-right:8px;margin-top:2px;margin-bottom:6px;height:32px;border-style:solid;border-radius:3px;border-width:thin;border-color:#bfbfbf;background-color:#f3f3f3}.igv-navbar .igv-navbar-left-container{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-between;align-items:center;height:32px;line-height:32px}.igv-navbar .igv-navbar-left-container .igv-logo{width:34px;height:32px;margin-right:8px}.igv-navbar .igv-navbar-left-container .igv-current-genome{height:32px;margin-left:4px;margin-right:4px;user-select:none;line-height:32px;vertical-align:middle;text-align:center}.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-between;align-items:center;height:100%}.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-chromosome-select-widget-container{display:flex;flex-flow:column;flex-wrap:nowrap;justify-content:space-around;align-items:center;height:100%;width:125px;margin-right:4px}.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-chromosome-select-widget-container select{display:block;cursor:pointer;width:100px;height:75%;outline:none;font-size:12px;font-family:"Open Sans",sans-serif;font-weight:400}.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-locus-size-group{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-between;align-items:center;margin-left:8px;height:22px}.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-locus-size-group .igv-search-container{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center;width:240px;height:22px;line-height:22px}.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-locus-size-group .igv-search-container input.igv-search-input{cursor:text;width:85%;height:22px;line-height:22px;font-size:12px;font-family:"Open Sans",sans-serif;font-weight:400;text-align:left;padding-left:8px;margin-right:8px;outline:none;border-style:solid;border-radius:3px;border-width:thin;border-color:#bfbfbf;background-color:#fff}.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-locus-size-group .igv-search-container .igv-search-icon-container{cursor:pointer;height:16px;width:16px;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:center;align-items:center}.igv-navbar .igv-navbar-left-container .igv-navbar-genomic-location .igv-locus-size-group .igv-windowsize-panel-container{margin-left:4px;user-select:none}.igv-navbar .igv-navbar-right-container{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-between;align-items:center}.igv-navbar .igv-navbar-right-container .igv-navbar-toggle-button-container{position:relative;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.igv-navbar .igv-navbar-right-container .igv-navbar-toggle-button-container-hidden{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center;height:100%}.igv-navbar .igv-navbar-right-container .igv-zoom-widget{color:#737373;font-size:18px;margin-left:8px;user-select:none;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.igv-navbar .igv-navbar-right-container .igv-zoom-widget div{cursor:pointer;margin-left:unset;margin-right:unset}.igv-navbar .igv-navbar-right-container .igv-zoom-widget div:first-child{height:20px;width:20px;margin-left:unset;margin-right:4px}.igv-navbar .igv-navbar-right-container .igv-zoom-widget div:last-child{height:20px;width:20px;margin-left:4px;margin-right:unset}.igv-navbar .igv-navbar-right-container .igv-zoom-widget div:nth-child(even){display:block;height:fit-content}.igv-navbar .igv-navbar-right-container .igv-zoom-widget input{display:block;width:125px}.igv-navbar .igv-navbar-right-container .igv-zoom-widget svg{display:block}.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900{color:#737373;font-size:18px;height:32px;line-height:32px;margin-left:8px;user-select:none;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 div{cursor:pointer;margin-left:unset;margin-right:unset}.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 div:first-child{height:20px;width:20px;margin-left:unset;margin-right:4px}.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 div:last-child{height:20px;width:20px;margin-left:4px;margin-right:unset}.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 div:nth-child(even){width:0;height:0;display:none}.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 input{width:0;height:0;display:none}.igv-navbar .igv-navbar-right-container .igv-zoom-widget-900 svg{display:block}.igv-navbar .igv-navbar-right-container .igv-zoom-widget-hidden{display:none}.igv-navbar-button{display:block;box-sizing:unset;padding-left:6px;padding-right:6px;height:18px;text-transform:capitalize;user-select:none;line-height:18px;text-align:center;vertical-align:middle;font-family:"Open Sans",sans-serif;font-size:11px;font-weight:200;color:#737373;background-color:#f3f3f3;border-color:#737373;border-style:solid;border-width:thin;border-radius:6px}.igv-navbar-button:hover{cursor:pointer}.igv-navbar-button-clicked{color:#fff;background-color:#737373}.igv-navbar-icon-button{cursor:pointer;position:relative;width:24px;height:24px;margin-left:4px;margin-right:4px;border:none;background-size:contain;background-repeat:no-repeat;background-position:center}.igv-navbar-icon-button>div:first-child{z-index:512;position:absolute;top:36px;left:-18px;width:24px;height:24px;border:none;background-size:contain;background-repeat:no-repeat;background-position:center}.igv-navbar-icon-button>div:last-child{z-index:512;position:absolute;top:36px;left:18px;width:24px;height:24px;border:none;background-size:contain;background-repeat:no-repeat;background-position:center}.igv-navbar-text-button{cursor:pointer;position:relative;margin-left:2px;margin-right:2px;border:none;display:flex;justify-content:center;align-items:center}.igv-navbar-text-button>div:nth-child(2){z-index:512;position:absolute;top:36px;left:0;width:38px;height:18px;border:none;background-size:contain;background-repeat:no-repeat;background-position:center}.igv-navbar-text-button>div:nth-child(3){z-index:512;position:absolute;top:36px;left:42px;width:38px;height:18px;border:none;background-size:contain;background-repeat:no-repeat;background-position:center}#igv-text-button-label{text-anchor:middle;dominant-baseline:middle}.igv-navbar-text-button-svg-inactive rect{stroke:#737373;fill:#fff}.igv-navbar-text-button-svg-inactive text{fill:#737373}.igv-navbar-text-button-svg-inactive tspan{dominant-baseline:middle}.igv-navbar-text-button-svg-hover rect{stroke:#737373;fill:#737373}.igv-navbar-text-button-svg-hover text{fill:#fff}.igv-navbar-text-button-svg-hover tspan{dominant-baseline:middle}#igv-save-svg-group rect{stroke:#737373;fill:#fff}#igv-save-svg-group text{fill:#737373}#igv-save-svg-group:hover rect{stroke:#737373;fill:#737373}#igv-save-svg-group:hover text{fill:#fff}#igv-save-png-group rect{stroke:#737373;fill:#fff}#igv-save-png-group text{fill:#737373}#igv-save-png-group:hover rect{stroke:#737373;fill:#737373}#igv-save-png-group:hover text{fill:#fff}.igv-zoom-in-notice-container{z-index:256;position:absolute;top:8px;left:50%;transform:translate(-50%, 0%);display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:center;align-items:center;background-color:#fff}.igv-zoom-in-notice-container>div{padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;width:100%;height:100%;font-family:"Open Sans",sans-serif;font-size:14px;font-weight:400;color:#3f3f3f}.igv-zoom-in-notice{position:absolute;top:10px;left:50%}.igv-zoom-in-notice div{position:relative;left:-50%;font-family:"Open Sans",sans-serif;font-size:medium;font-weight:400;color:#3f3f3f;background-color:hsla(0,0%,100%,.51);z-index:64}.igv-container-spinner{position:absolute;top:90%;left:50%;transform:translate(-50%, -50%);z-index:1024;width:24px;height:24px;pointer-events:none;color:#737373}.igv-multi-locus-close-button{position:absolute;top:2px;right:0;padding-left:2px;padding-right:2px;width:12px;height:12px;color:#666;background-color:#fff;z-index:1000}.igv-multi-locus-close-button>svg{vertical-align:top}.igv-multi-locus-close-button:hover{cursor:pointer;color:#434343}.igv-multi-locus-ruler-label{z-index:64;position:absolute;top:2px;left:0;width:100%;height:12px;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:center;align-items:center}.igv-multi-locus-ruler-label>div{font-family:"Open Sans",sans-serif;font-size:12px;color:#101010;background-color:#fff}.igv-multi-locus-ruler-label>div{cursor:pointer}.igv-multi-locus-ruler-label-square-dot{z-index:64;position:absolute;left:50%;top:5%;transform:translate(-50%, 0%);background-color:#fff;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center}.igv-multi-locus-ruler-label-square-dot>div:first-child{width:14px;height:14px}.igv-multi-locus-ruler-label-square-dot>div:last-child{margin-left:16px;font-family:"Open Sans",sans-serif;font-size:14px;font-weight:400;color:#101010}.igv-ruler-sweeper{display:none;pointer-events:none;position:absolute;top:26px;bottom:0;left:0;width:0;z-index:99999;background-color:rgba(68,134,247,.25)}.igv-ruler-tooltip{pointer-events:none;z-index:128;position:absolute;top:0;left:0;width:1px;height:32px;background-color:rgba(0,0,0,0);display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center}.igv-ruler-tooltip>div{pointer-events:none;width:128px;height:auto;padding:1px;color:#373737;font-size:10px;font-family:"Open Sans",sans-serif;font-weight:400;background-color:#fff;border-style:solid;border-width:thin;border-color:#373737}.igv-track-label{position:absolute;left:8px;top:8px;width:auto;height:auto;max-width:50%;padding-left:4px;padding-right:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:"Open Sans",sans-serif;font-size:small;font-weight:400;text-align:center;user-select:none;-moz-user-select:none;-webkit-user-select:none;border-color:#444;border-radius:2px;border-style:solid;border-width:thin;background-color:#fff;z-index:128;cursor:pointer}.igv-track-label:hover,.igv-track-label:focus,.igv-track-label:active{background-color:#e8e8e8}.igv-track-label-popup-shim{position:absolute;right:8px;top:8px;width:auto;height:auto;max-width:50%;padding-left:4px;padding-right:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:"Open Sans",sans-serif;font-size:small;font-weight:400;text-align:center;user-select:none;-moz-user-select:none;-webkit-user-select:none;border-color:#444;border-radius:2px;border-style:solid;border-width:thin;background-color:#fff;z-index:128}.igv-attribute-group-label{position:absolute;right:5px;z-index:128;width:auto;height:auto;max-width:50%;padding-left:4px;padding-right:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:"Open Sans",sans-serif;font-size:small;font-weight:400;text-align:center;user-select:none;-moz-user-select:none;-webkit-user-select:none;border-color:#444;border-radius:2px;border-style:solid;border-width:thin;background-color:#fff}.igv-attribute-group-line{position:absolute;left:0px;width:100%;height:1px;background-color:rgba(0,0,0,0);border-top:1px dotted #666;pointer-events:none;z-index:127}.igv-center-line{display:none;pointer-events:none;position:absolute;top:0;bottom:0;left:50%;transform:translateX(-50%);z-index:8;user-select:none;-moz-user-select:none;-webkit-user-select:none;border-left-style:dashed;border-left-width:thin;border-right-style:dashed;border-right-width:thin}.igv-center-line-wide{background-color:rgba(0,0,0,0);border-left-color:rgba(127,127,127,.51);border-right-color:rgba(127,127,127,.51)}.igv-center-line-thin{background-color:rgba(0,0,0,0);border-left-color:rgba(127,127,127,.51);border-right-color:rgba(0,0,0,0)}.igv-cursor-guide-horizontal{display:none;pointer-events:none;user-select:none;-moz-user-select:none;-webkit-user-select:none;position:absolute;left:0;right:0;top:50%;height:1px;z-index:32;margin-left:50px;margin-right:54px;border-top-style:dotted;border-top-width:thin;border-top-color:rgba(127,127,127,.76)}.igv-cursor-guide-vertical{pointer-events:none;user-select:none;-moz-user-select:none;-webkit-user-select:none;position:absolute;top:0;bottom:0;left:50%;width:1px;z-index:32;border-left-style:dotted;border-left-width:thin;border-left-color:rgba(127,127,127,.76);display:none}.igv-user-feedback{position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);width:512px;height:360px;z-index:2048;background-color:#fff;border-color:#a2a2a2;border-style:solid;border-width:thin;font-family:"Open Sans",sans-serif;font-size:medium;font-weight:400;color:#444;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:center}.igv-user-feedback div:first-child{position:relative;height:24px;width:100%;background-color:#fff;border-bottom-color:#a2a2a2;border-bottom-style:solid;border-bottom-width:thin}.igv-user-feedback div:first-child div{position:absolute;top:2px;width:16px;height:16px;background-color:rgba(0,0,0,0)}.igv-user-feedback div:first-child div:first-child{left:8px}.igv-user-feedback div:first-child div:last-child{cursor:pointer;right:8px}.igv-user-feedback div:last-child{width:100%;height:calc(100% - 24px);border-width:0}.igv-user-feedback div:last-child div{width:auto;height:auto;margin:8px}.igv-generic-dialog-container{position:fixed;top:20%;left:75%;width:300px;height:200px;border-color:#7f7f7f;border-radius:4px;border-style:solid;border-width:thin;font-family:"Open Sans",sans-serif;font-size:medium;font-weight:400;z-index:2048;background-color:#fff;display:flex;flex-flow:column;flex-wrap:nowrap;justify-content:flex-start;align-items:center}.igv-generic-dialog-container .igv-generic-dialog-header{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center;width:100%;height:24px;cursor:move;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-color:#7f7f7f;border-bottom-style:solid;border-bottom-width:thin;background-color:#eee}.igv-generic-dialog-container .igv-generic-dialog-header div{margin-right:4px;margin-bottom:2px;height:12px;width:12px;color:#7f7f7f}.igv-generic-dialog-container .igv-generic-dialog-header div:hover{cursor:pointer;color:#444}.igv-generic-dialog-container .igv-generic-dialog-one-liner{color:#373737;width:95%;height:24px;line-height:24px;text-align:left;margin-top:8px;padding-left:8px;overflow-wrap:break-word;background-color:#fff}.igv-generic-dialog-container .igv-generic-dialog-label-input{margin-top:8px;width:95%;height:24px;color:#373737;line-height:24px;padding-left:8px;background-color:#fff;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center}.igv-generic-dialog-container .igv-generic-dialog-label-input div{width:30%;height:100%;font-size:16px;text-align:right;padding-right:8px;background-color:#fff}.igv-generic-dialog-container .igv-generic-dialog-label-input input{display:block;height:100%;width:100%;padding-left:4px;font-family:"Open Sans",sans-serif;font-weight:400;color:#373737;text-align:left;outline:none;border-style:solid;border-width:thin;border-color:#7f7f7f;background-color:#fff}.igv-generic-dialog-container .igv-generic-dialog-label-input input{width:50%;font-size:16px}.igv-generic-dialog-container .igv-generic-dialog-input{margin-top:8px;width:calc(100% - 16px);height:24px;color:#373737;line-height:24px;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-around;align-items:center}.igv-generic-dialog-container .igv-generic-dialog-input input{display:block;height:100%;width:100%;padding-left:4px;font-family:"Open Sans",sans-serif;font-weight:400;color:#373737;text-align:left;outline:none;border-style:solid;border-width:thin;border-color:#7f7f7f;background-color:#fff}.igv-generic-dialog-container .igv-generic-dialog-input input{font-size:16px}.igv-generic-dialog-container .igv-generic-dialog-ok-cancel{width:100%;height:28px;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-around;align-items:center}.igv-generic-dialog-container .igv-generic-dialog-ok-cancel div{margin-top:32px;color:#fff;font-family:"Open Sans",sans-serif;font-size:14px;font-weight:400;width:75px;height:28px;line-height:28px;text-align:center;border-color:rgba(0,0,0,0);border-style:solid;border-width:thin;border-radius:2px}.igv-generic-dialog-container .igv-generic-dialog-ok-cancel div:first-child{margin-left:32px;margin-right:0;background-color:#5ea4e0}.igv-generic-dialog-container .igv-generic-dialog-ok-cancel div:last-child{margin-left:0;margin-right:32px;background-color:#c4c4c4}.igv-generic-dialog-container .igv-generic-dialog-ok-cancel div:first-child:hover{cursor:pointer;background-color:#3b5c7f}.igv-generic-dialog-container .igv-generic-dialog-ok-cancel div:last-child:hover{cursor:pointer;background-color:#7f7f7f}.igv-generic-dialog-container .igv-generic-dialog-ok{width:100%;height:36px;margin-top:32px;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-around;align-items:center}.igv-generic-dialog-container .igv-generic-dialog-ok div{width:98px;height:36px;line-height:36px;text-align:center;color:#fff;font-family:"Open Sans",sans-serif;font-size:medium;font-weight:400;border-color:#fff;border-style:solid;border-width:thin;border-radius:4px;background-color:#2b81af}.igv-generic-dialog-container .igv-generic-dialog-ok div:hover{cursor:pointer;background-color:#25597f}.igv-generic-container{position:fixed;top:20%;left:75%;transform:translateX(-50%);z-index:2048;background-color:#fff;cursor:pointer;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;align-items:center}.igv-generic-container>div:nth-child(1){cursor:move;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center;height:24px;width:100%;background-color:#ddd}.igv-generic-container>div:nth-child(1) i{display:block;color:#5f5f5f;cursor:pointer;width:14px;height:14px;margin-right:8px;margin-bottom:4px}.igv-menu-popup{position:absolute;top:0;left:0;width:max-content;max-width:400px;z-index:2048;cursor:pointer;font-family:"Open Sans",sans-serif;font-size:small;font-weight:400;color:#4b4b4b;background:#fff;border-radius:4px;border-color:#7f7f7f;border-style:solid;border-width:thin;display:flex;flex-flow:column;flex-wrap:nowrap;justify-content:flex-start;align-items:flex-end;text-align:left}.igv-menu-popup>div:not(:first-child){width:100%}.igv-menu-popup>div:not(:first-child)>div{background:#fff}.igv-menu-popup>div:not(:first-child)>div.context-menu{padding-left:4px;padding-right:4px}.igv-menu-popup>div:not(:first-child)>div:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom-color:rgba(0,0,0,0);border-bottom-style:solid;border-bottom-width:thin}.igv-menu-popup>div:not(:first-child)>div:hover{background:#efefef}.igv-menu-popup-shim{padding-left:8px;padding-right:8px;padding-bottom:1px;padding-top:1px}.igv-menu-popup-header{position:relative;width:100%;height:24px;cursor:move;border-top-color:rgba(0,0,0,0);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-color:#7f7f7f;border-bottom-style:solid;border-bottom-width:thin;background-color:#eee;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.igv-menu-popup-header div{margin-right:4px;height:12px;width:12px;color:#7f7f7f}.igv-menu-popup-header div:hover{cursor:pointer;color:#444}.igv-menu-popup-check-container{display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center;width:100%;height:20px;margin-right:4px;background-color:rgba(0,0,0,0)}.igv-menu-popup-check-container div{padding-top:2px;padding-left:8px}.igv-menu-popup-check-container div:first-child{position:relative;width:12px;height:12px}.igv-menu-popup-check-container div:first-child svg{position:absolute;width:12px;height:12px}.igv-loading-spinner-container{z-index:1024;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:32px;height:32px;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:center;align-items:center}.igv-loading-spinner-container>div{box-sizing:border-box;width:100%;height:100%;border-radius:50%;border:4px solid rgba(128,128,128,.5);border-top-color:#fff;animation:spin 1s ease-in-out infinite;-webkit-animation:spin 1s ease-in-out infinite}@keyframes spin{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes spin{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.igv-roi-menu{position:absolute;z-index:512;font-family:"Open Sans",sans-serif;font-size:small;font-weight:400;color:#4b4b4b;background-color:#fff;width:192px;border-radius:4px;border-color:#7f7f7f;border-style:solid;border-width:thin;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:stretch}.igv-roi-menu>div:first-child{height:24px;border-top-color:rgba(0,0,0,0);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-color:#7f7f7f;border-bottom-style:solid;border-bottom-width:thin;background-color:#eee;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.igv-roi-menu>div:first-child>div{margin-right:4px;height:12px;width:12px;color:#7f7f7f}.igv-roi-menu>div:first-child>div:hover{cursor:pointer;color:#444}.igv-roi-menu>div:last-child{background-color:#fff;border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom-color:rgba(0,0,0,0);border-bottom-style:solid;border-bottom-width:0;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:stretch;text-align:start;vertical-align:middle}.igv-roi-menu>div:last-child>div{height:24px;padding-left:4px;border-bottom-style:solid;border-bottom-width:thin;border-bottom-color:#7f7f7f}.igv-roi-menu>div:last-child>div:not(:first-child):hover{cursor:pointer;background-color:rgba(127,127,127,.1)}.igv-roi-menu>div:last-child div:first-child{font-style:italic;text-align:center;padding-right:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.igv-roi-menu>div:last-child>div:last-child{border-bottom-width:0;border-bottom-color:rgba(0,0,0,0)}.igv-roi-placeholder{font-style:normal;color:rgba(75,75,75,.6)}.igv-roi-table{position:absolute;z-index:1024;display:flex;flex-flow:column;flex-wrap:nowrap;justify-content:flex-start;align-items:stretch;resize:both;overflow:hidden;width:min-content;max-width:1600px;border-color:#7f7f7f;border-radius:4px;border-style:solid;border-width:thin;font-family:"Open Sans",sans-serif;font-size:12px;font-weight:400;background-color:#fff;cursor:default}.igv-roi-table>div{height:24px;font-size:14px;text-align:start;vertical-align:middle;line-height:24px}.igv-roi-table>div:first-child{border-color:rgba(0,0,0,0);border-top-left-radius:4px;border-top-right-radius:4px;border-top-width:0;border-bottom-color:#7f7f7f;border-bottom-style:solid;border-bottom-width:thin;background-color:#eee;cursor:move;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-between;align-items:center}.igv-roi-table>div:first-child>div:first-child{text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;margin-left:4px;margin-right:4px;width:calc(100% - 4px - 12px)}.igv-roi-table>div:first-child>div:last-child{margin-right:4px;margin-bottom:2px;height:12px;width:12px;color:#7f7f7f}.igv-roi-table>div:first-child>div:last-child>svg{display:block}.igv-roi-table>div:first-child>div:last-child:hover{cursor:pointer;color:#444}.igv-roi-table>.igv-roi-table-description{padding:4px;margin-left:4px;word-break:break-all;overflow-y:auto;display:flex;flex-flow:row;flex-wrap:nowrap;background-color:rgba(0,0,0,0)}.igv-roi-table>.igv-roi-table-goto-explainer{margin-top:5px;margin-left:4px;color:#7f7f7f;font-style:italic;height:24px;border-top:solid #d3d3d3;background-color:rgba(0,0,0,0)}.igv-roi-table>.igv-roi-table-column-titles{height:24px;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:stretch;align-items:stretch;padding-right:16px;background-color:#fff;border-top-color:#7f7f7f;border-top-style:solid;border-top-width:thin;border-bottom-color:#7f7f7f;border-bottom-style:solid;border-bottom-width:thin}.igv-roi-table>.igv-roi-table-column-titles>div{font-size:14px;vertical-align:middle;line-height:24px;text-align:left;margin-left:4px;height:24px;overflow:hidden;text-overflow:ellipsis;border-right-color:#7f7f7f;border-right-style:solid;border-right-width:thin}.igv-roi-table>.igv-roi-table-column-titles>div:last-child{border-right:unset}.igv-roi-table>.igv-roi-table-row-container{display:flex;flex-flow:column;flex-wrap:nowrap;justify-content:flex-start;align-items:stretch;overflow:auto;height:360px;flex:1 1 auto;background-color:rgba(0,0,0,0)}.igv-roi-table>.igv-roi-table-row-container>.igv-roi-table-row{height:24px;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:stretch;align-items:stretch}.igv-roi-table>.igv-roi-table-row-container>.igv-roi-table-row>div{font-size:14px;vertical-align:middle;line-height:24px;text-align:left;margin-left:4px;height:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border-right-color:rgba(0,0,0,0);border-right-style:solid;border-right-width:thin}.igv-roi-table>.igv-roi-table-row-container>.igv-roi-table-row>div:last-child{border-right:unset}.igv-roi-table>.igv-roi-table-row-container>.igv-roi-table-row-hover{background-color:rgba(0,0,0,.04)}.igv-roi-table>div:last-child{min-height:32px;height:32px;line-height:32px;border-top-color:#7f7f7f;border-top-style:solid;border-top-width:thin;border-bottom-color:rgba(0,0,0,0);border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom-width:0;background-color:#eee;display:flex;flex-flow:row;flex-wrap:nowrap;justify-content:space-around;align-items:center}.igv-roi-table-row-selected{background-color:rgba(0,0,0,.125)}.igv-roi-table-button{cursor:pointer;height:20px;user-select:none;line-height:20px;text-align:center;vertical-align:middle;font-family:"Open Sans",sans-serif;font-size:13px;font-weight:400;color:#000;padding-left:6px;padding-right:6px;background-color:#efefef;border-color:#000;border-style:solid;border-width:thin;border-radius:3px}.igv-roi-table-button:hover{font-weight:400;background-color:rgba(0,0,0,.13)}.igv-roi-region{z-index:64;position:absolute;top:0;bottom:0;pointer-events:none;overflow:visible;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:stretch}.igv-roi-region>div{position:relative;width:100%;height:8px;pointer-events:auto}.igv-roi-menu-row{height:24px;padding-left:8px;font-size:small;text-align:start;vertical-align:middle;line-height:24px;background-color:#fff}.igv-roi-menu-row-edit-description{width:-webkit-fill-available;font-size:small;text-align:start;vertical-align:middle;background-color:#fff;padding-left:4px;padding-right:4px;padding-bottom:4px;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:stretch;align-items:stretch}.igv-roi-menu-row-edit-description>label{margin-left:2px;margin-bottom:0;display:block;width:-webkit-fill-available}.igv-roi-menu-row-edit-description>input{display:block;margin-left:2px;margin-right:2px;margin-bottom:1px;width:-webkit-fill-available}.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}.igv-ui-center-fixed{left:50%;top:50%;transform:translate(-50%, -50%)}.igv-container{all:initial;position:relative;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:flex-start;padding-top:4px;user-select:none;-webkit-user-select:none;-ms-user-select:none;min-height:160px}.igv-viewport{position:relative;margin-top:5px;line-height:1;overflow-x:hidden;overflow-y:hidden}.igv-viewport-content{position:relative;width:100%}.igv-viewport-content>canvas{position:relative;display:block}.igv-column-container{position:relative;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-start;align-items:stretch;width:100%}.igv-column-shim{width:1px;margin-left:2px;margin-right:2px;background-color:#545453}.igv-axis-column{position:relative;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:flex-start;box-sizing:border-box;height:100%;width:50px}.igv-axis-column>div{position:relative;margin-top:5px;width:100%}.igv-axis-column>div>div{z-index:512;position:absolute;top:8px;left:8px;width:fit-content;height:fit-content;background-color:rgba(0,0,0,0);display:grid;align-items:start;justify-items:center}.igv-axis-column>div>div>input{display:block;margin:unset;cursor:pointer}.igv-column{position:relative;flex:auto;position:relative;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:flex-start;box-sizing:border-box;height:100%}.igv-sample-info-column{position:relative;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:flex-start;box-sizing:border-box;height:100%}.igv-sample-name-column{position:relative;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:flex-start;box-sizing:border-box;height:100%}.igv-scrollbar-column{position:relative;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:flex-start;box-sizing:border-box;height:100%;width:14px}.igv-scrollbar-column>div{position:relative;margin-top:5px;width:14px}.igv-scrollbar-column>div>div{cursor:pointer;position:absolute;top:0;left:2px;width:8px;border-width:1px;border-style:solid;border-color:#c4c4c4;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-bottom-right-radius:4px}.igv-scrollbar-column>div>div:hover{background-color:#c4c4c4}.igv-track-drag-column{position:relative;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:flex-start;box-sizing:border-box;height:100%;width:12px;background-color:#fff}.igv-track-drag-column>.igv-track-drag-handle{z-index:512;position:relative;cursor:pointer;margin-top:5px;width:100%;border-style:solid;border-width:0;border-top-right-radius:6px;border-bottom-right-radius:6px}.igv-track-drag-column .igv-track-drag-handle-color{background-color:#c4c4c4}.igv-track-drag-column .igv-track-drag-handle-hover-color{background-color:#787878}.igv-track-drag-column .igv-track-drag-handle-selected-color{background-color:#0963fa}.igv-track-drag-column>.igv-track-drag-shim{position:relative;margin-top:5px;width:100%;border-style:solid;border-width:0}.igv-gear-menu-column{position:relative;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:flex-start;box-sizing:border-box;height:100%;width:28px}.igv-gear-menu-column>div{display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;align-items:center;margin-top:5px;width:100%;background:#fff}.igv-gear-menu-column>div>div{position:relative;margin-top:4px;width:16px;height:16px;color:#7f7f7f}.igv-gear-menu-column>div>div:hover{cursor:pointer;color:#444}.igv-vertical-center{margin:0 !important;top:50% !important;-ms-transform:translateY(-50%) !important;transform:translateY(-50%) !important}'),r.adoptedStyleSheets=[t]}if(this.root=e({class:"igv-container"}),r.appendChild(this.root),this.alert=new Po(this.root),this.spinnerElement=document.createElement("div"),this.spinnerElement.className="igv-loading-spinner-container",this.root.appendChild(this.spinnerElement),this.spinnerElement.appendChild(document.createElement("div")),this.columnContainer=e({class:"igv-column-container"}),this.root.appendChild(this.columnContainer),this.menuPopup=new Su(this.columnContainer),this.menuUtils=new es(this),this.initialize(t),this.trackViews=[],this.constants={dragThreshold:3,scrollThreshold:5,defaultColor:"rgb(0,0,150)",doubleClickDelay:t.doubleClickDelay||500},t.listeners)for(let e of Object.keys(t.listeners))this.on(e,t.listeners[e]);this.on("trackremoved",()=>{0===this.findTracks(t=>"function"==typeof t.getSamples).length&&(this.sampleInfoControl.setButtonVisibility(!1),this.sampleNameViewportWidth=void 0,this.sampleNameControl.hide(),this.layoutChange())}),this.on("columnlayoutchange",()=>{if(Qd.length>0){const t=Qd.length;for(let e=0;e<t;e++)Qd[e].dispose();Qd.length=0}}),this.addEventHandlers(),this.sampleInfo=new mu(this),this.createStandardControls(t),this.roiManager=new Xy(this),this.previousTrackColors=[]}get doShowROITable(){return this.roiManager.roiTableIsVisible()}initialize(t){this.flanking=t.flanking,this.crossDomainProxy=t.crossDomainProxy,this.formats=t.formats,this.trackDefaults=t.trackDefaults,this.nucleotideColors=t.nucleotideColors||by;for(let t of Object.keys(this.nucleotideColors))this.nucleotideColors[t.toLowerCase()]=this.nucleotideColors[t];this.doShowTrackLabels=t.showTrackLabels,this.doShowCenterLine=t.showCenterGuide,this.doShowCursorGuide=t.showCursorGuide,this.showSampleNames=t.showSampleNames,this.sampleNameViewportWidth=void 0,t.sampleNameViewportWidth&&(this.sampleNameViewportWidth=t.sampleNameViewportWidth),t.search&&(this.searchConfig={type:"json",url:t.search.url,coords:void 0===t.search.coords?1:t.search.coords,chromosomeField:t.search.chromosomeField||"chromosome",startField:t.search.startField||"start",endField:t.search.endField||"end",geneField:t.search.geneField||"gene",snpField:t.search.snpField||"snp",resultsField:t.search.resultsField})}createStandardControls(t){var e;this.setTrackLabelVisibility(null===(e=t.showTrackLabels)||void 0===e||e),this.navbar=new Ty(t,this),this.columnContainer.parentNode.insertBefore(this.navbar.navigation,this.columnContainer),!1===t.showControls&&this.navbar.hide(),this.cursorGuide=new _A(this.columnContainer,this),this.inputDialog=new fo(this.root),this.inputDialog.container.id=`igv-input-dialog-${n()}`,this.dataRangeDialog=new po(this,this.root),this.dataRangeDialog.container.id=`igv-data-range-dialog-${n()}`,this.genericColorPicker=new To({parent:this.root,width:180}),this.genericColorPicker.container.id=`igv-track-color-picker-${n()}`,this.sliderDialog=new xA(this.root),this.sliderDialog.container.id=`igv-slider-dialog-${n()}`}getSampleNameViewportWidth(){return!1===this.showSampleNames||void 0===this.sampleNameViewportWidth?0:this.sampleNameViewportWidth}getSampleInfoViewportWidth(){return this.getSampleInfoColumnWidth()}isMultiLocusMode(){return this.referenceFrameList&&this.referenceFrameList.length>1}isMultiLocusWholeGenomeView(){if(void 0===this.referenceFrameList||1===this.referenceFrameList.length)return!1;for(let t of this.referenceFrameList)if("all"===t.chr.toLowerCase())return!0;return!1}currentLoci(){const t=t=>`${t.chr}:${t.start+1}-${t.end}`;return void 0===this.referenceFrameList||0===this.referenceFrameList.length?"":1===this.referenceFrameList.length?t(this.referenceFrameList[0]):this.referenceFrameList.map(e=>t(e))}toSVG(){const{x:t,y:e,width:i,height:r}=this.columnContainer.getBoundingClientRect(),s=Number.MAX_SAFE_INTEGER,o=new dd({width:i,height:s,backdropColor:"white",multiLocusGap:0,viewbox:{x:0,y:0,width:i,height:s}}),n={deltaX:0,deltaY:-e};for(let t of this.trackViews)t.renderSVGContext(o,n);return n.deltaX=t,o.setHeight(r),o.getSerializedSvg(!0)}saveSVGtoFile(t,e){let i=this.toSVG();if(e){const t=document.createElement("svg");t.innerHTML=i,e.appendChild(t)}const r=t||"igvjs.svg",s=URL.createObjectURL(new Blob([i],{type:"application/octet-stream"}));k(r,s),URL.revokeObjectURL(s)}savePNGtoFile(t){const e=this.toSVG(),i=new Blob([e],{type:"image/svg+xml"}),r=URL.createObjectURL(i),s=document.createElement("img");s.addEventListener("load",()=>{const e=this.columnContainer.getBoundingClientRect(),i=window.devicePixelRatio,o=e.width*i,n=e.height*i,a=document.createElement("canvas");a.width=o,a.height=n;const c=a.getContext("2d");c.scale(i,i),c.drawImage(s,0,0);const l=a.toDataURL("image/png");k(t=t||"igvjs.png",l),URL.revokeObjectURL(r)}),s.src=r}async loadSession(t){let e;this.sampleInfo.initialize(),this.roiSets=[],e=t.url||t.file?await DA.loadSessionFile(t):t,await this.loadSessionObject(e)}static async loadSessionFile(t){const e=t.url||t.file;let i;if(t.url&&b(t.url)&&(t.url.startsWith("blob:")||t.url.startsWith("data:"))){const e=DA.uncompressSession(t.url);i=JSON.parse(e)}else{let r=t.filename;if(r||(r=t.url?_(t.url):t.file.name),r.endsWith(".xml")){const t=Hd.KNOWN_GENOMES,r=await Er.loadString(e);i=new py(r,t)}else if(r.endsWith("hub.txt")){i={reference:(await Od(e)).getGenomeConfig()}}else i=await Er.loadJson(e)}return i}async loadSessionObject(t){if(yA(t,this.config),this.cleanHouseForSession(),this.config=t,t.browsers&&(t=await async function(t){const e=t.browsers[0],i={},r=new wh({url:e.url});await r.readHeaderAndFooter(),i.sampleNameViewportWidth=20,i.genome="hg38";const s=e.state.split(","),o=r.bpResolutions[Number.parseInt(s[2])],n=Number.parseInt(s[0]),a=Math.floor(Number.parseFloat(s[3])*o),c=a+Math.floor(1700*o);return i.locus=`${r.chromosomes[n].name}:${a}-${c}`,i.tracks=(e.tracks||[]).filter(t=>!("refgene"===t.format||"cellType"===t.name)),i.tracks.push({type:"shoebox",url:e.url,name:e.name,colorScale:e.colorScale,_hicFile:r}),i}(t)),this.navbar.sampleInfoControl.setButtonVisibility(!1),this.showSampleNames=t.showSampleNames||!1,this.navbar.sampleNameControl.setState(!0===this.showSampleNames),t.sampleNameViewportWidth&&(this.sampleNameViewportWidth=t.sampleNameViewportWidth),"left"===this.config.gearColumnPosition){const t=Zo(this.columnContainer,"igv-gear-menu-column");!1===this.config.showGearColumn&&(t.style.width="0px")}const e=Zo(this.columnContainer,"igv-axis-column");!1===this.config.showAxis&&(e.style.display="none"),void 0!==this.config.axisWidth&&(e.style.width=this.config.axisWidth+"px"),Zo(this.columnContainer,"igv-sample-info-column"),Zo(this.columnContainer,"igv-sample-name-column"),Zo(this.columnContainer,"igv-scrollbar-column");const i=Zo(this.columnContainer,"igv-track-drag-column");if(!1===this.config.showTrackDragHandles&&(i.style.display="none"),"left"!==this.config.gearColumnPosition){const t=Zo(this.columnContainer,"igv-gear-menu-column");!1===this.config.showGearColumn&&(t.style.width="0px")}const r=t.reference||t.genome||t.genarkAccession;if(!r)return void console.warn("No genome or reference object specified");const s=b(r)?await Hd.expandReference(this.alert,r):r;if(!s)return void console.warn("Could not resolve genome reference");const o=await this.loadReference(s,s.locus||t.locus);if(this.centerLineList=this.createCenterLineList(this.columnContainer),!1!==t.showIdeogram){const t=new rm(this),e=new Uu(this,this.columnContainer,t);this.trackViews.push(e)}if(!1!==t.showRuler){const t=new vu(this),e=new Uu(this,this.columnContainer,t);this.trackViews.push(e)}t.qtlSelections&&(this.qtlSelections=AA.fromJSON(t.qtlSelections)),void 0!==t.showROIOverlays&&(this.roiManager.showOverlays=t.showROIOverlays),this.roiManager.clearROIs(),t.roi?this.roiManager.loadROI(t.roi,o):await this.roiManager.reset();const n=[],a=[];if(t.sampleinfo){const e=Array.isArray(t.sampleinfo)?t.sampleinfo:[t.sampleinfo];for(const t of e)if(t.file)n.push(t.file.name);else{const e=wo(this,IA,"m",NA).call(this,t,"Sample info","url","filename","Google Drive file");e?a.push(e):await this.sampleInfo.loadSampleInfo(t)}}const c=s.tracks||[],l=t.tracks?c.concat(t.tracks):c;0===l.filter(t=>"sequence"===t.type&&!t.url&&!t.fastaURL).length&&!1!==this.config.showSequence&&l.push({type:"sequence",order:Kh,removable:!1});const{localFileItems:h,googleDriveItems:d}=wo(this,IA,"m",RA).call(this,l,n,a);if(h.length>0||d.length>0){let t="Local and Google Drive files cannot be loaded from a saved session. The following file(s) will not be restored with this session.\n\n";for(const e of h)t+=`Local file name: ${e.fileName}\n`,t+=`Track name: ${e.trackName}\n\n`;for(const e of d)t+=`Google Drive file name: ${e.fileName}\n`,t+=`Track name: ${e.trackName}\n\n`;alert(t)}const u=l.filter(t=>!(void 0!==t.file||void 0!==t.indexFile||t.url&&ac(t.url)||t.indexURL&&ac(t.indexURL)));let f=1;for(let t of u)void 0===t.order&&(t.order=f++);const p=u.filter(t=>!0===t.hidden);for(const t of p){const e=_h(t,this.genome);await e.getFeatures({chr:"1",start:0,end:Number.MAX_SAFE_INTEGER})}await this.loadTrackList(u),t.locus&&"string"==typeof t.locus&&Up.isSingleBaseLocusString(t.locus)&&await this.search(t.locus)}cleanHouseForSession(){for(let t of this.trackViews)t.removeDOMFromColumnContainer();this.columnContainer.querySelectorAll(".igv-axis-column, .igv-column-shim, .igv-column, .igv-sample-info-column, .igv-sample-name-column, .igv-scrollbar-column, .igv-track-drag-column, .igv-gear-menu-column").forEach(t=>t.remove()),this.trackViews=[],this.circularView&&this.circularView.clearChords()}async loadReference(t,e){let i;this.removeAllTracks(),this.roiManager.clearROIs(),this.navbar.setEnableTrackSelection(!1),i=t.gbkURL?await jl(t.gbkURL):await FA.createGenome(t,this);const r=void 0===this.genome||this.genome.id!==i.id;this.genome=i,this.navbar.updateGenome(i);let s=e||i.initialLocus;if(s&&"object"==typeof s&&"chr"in s&&"start"in s){const t=s;await this.genome.loadChromosome(t.chr),await this.updateLoci([t],!0)}else{Array.isArray(s)&&(s=s.join(" "));await this.search(s,!0)||(console.error(`Cannot set initial locus ${s}`),s!==i.initialLocus&&await this.search(i.initialLocus))}return r&&(this.fireEvent("genomechange",[{genome:i}]),this.circularView&&this.circularView.setAssembly({name:this.genome.id,id:this.genome.id,chromosomes:mg(this.genome)})),i}async expandGenarkAccession(t){const e=ud(t),i=(await Od(e)).getGenomeConfig();return i.nameSet="ucsc",i}async loadGenome(t){let e,i;if(!b(t)&&t.genarkAccession){const i=t;e=await this.expandGenarkAccession(i.genarkAccession)}else if(b(t))e=await Hd.expandReference(this.alert,t);else{const i=t;i.url&&(b(i.url)&&i.url.endsWith("/hub.txt")?(i.hubURL=i.url,delete i.url):"gbk"===function(t){let e;if(t instanceof File)e=t.name;else{if("string"!=typeof t)throw new Error("Input must be a File object or a URL string");e=t}const i=e.split(".").pop();return i.split("?")[0]}(i.url)&&(i.gbkURL=i.url,delete i.url));if(i.hubURL||i.url&&b(i.url)&&i.url.endsWith("/hub.txt")){e=(await Od(i.hubURL||i.url)).getGenomeConfig()}else e=i.url||i.fastaURL||i.twoBitURL||i.gbkURL?i:await Hd.expandReference(this.alert,i)}await this.loadReference(e),i=e.gbkURL||"gbk"===e.format?[{name:"Annotations",format:"gbk",url:e.gbkURL}]:e.tracks||[];return 0===i.filter(t=>"sequence"===t.type).length&&i.push({type:"sequence",order:Kh}),await this.loadTrackList(i),this.genome}updateUIWithReferenceFrameList(){var t;const e=this.referenceFrameList;this.isMultiLocusWholeGenomeView()||Hd.isWholeGenomeView(e[0].chr),this.navbar.navbarDidResize(),PA(this.trackViews,null!==(t=this.doShowTrackLabels)&&void 0!==t&&t),this.doShowCenterLine&&Hd.isWholeGenomeView(e[0].chr)&&this.navbar.centerLineButton.boundMouseClickHandler(),this.doShowCursorGuide&&Hd.isWholeGenomeView(e[0].chr)&&this.navbar.cursorGuideButton.boundMouseClickHandler(),this.setCenterLineAndCenterLineButtonVisibility(Hd.isWholeGenomeView(e[0].chr))}setCenterLineAndCenterLineButtonVisibility(t){var e,i;t?this.navbar.centerLineButton.setVisibility(!1):this.navbar.centerLineButton.setVisibility(null===(e=this.config.showCenterGuideButton)||void 0===e||e);for(let e of this.centerLineList)t?this.setCenterLineVisibility(!t):this.setCenterLineVisibility(null!==(i=this.doShowCenterLine)&&void 0!==i&&i)}setTrackLabelVisibility(t){PA(this.trackViews,t)}setROITableVisibility(t){!0===t?this.roiManager.presentTable():this.roiManager.dismissTable()}setCursorGuideVisibility(t){t?this.cursorGuide.show():this.cursorGuide.hide()}setCustomCursorGuideMouseHandler(t){this.cursorGuide.customMouseHandler=t}setCenterLineVisibility(t){for(let e of this.centerLineList)!0===t?(e.show(),e.repaint()):e.hide()}async loadTrackList(t){try{this.startSpinner();let e=this.trackViews.length+1;for(let i of t)void 0===i.order&&(i.order=e++);const i=[];for(const e of t)i.push(wo(this,IA,"m",SA).call(this,e));const r=await Promise.all(i);return this.trackViews.some(({track:t})=>t.selected)&&this.navbar.setEnableTrackSelection(!0),this.reorderTracks(),await BA.call(this),this.fireEvent("trackorderchanged",[this.getTrackOrder()]),r}finally{this.stopSpinner()}}async loadTrack(t){const e=await this.loadTrackList([t]);return t.autoscaleGroup&&this.updateViews(),e[0]}async addTrack(t){var e;void 0===t.order&&(t.order=this.trackViews.length),"function"==typeof t.postInit&&await t.postInit();const i=new Uu(this,this.columnContainer,t);return this.trackViews.push(i),PA(this.trackViews,null!==(e=this.doShowTrackLabels)&&void 0!==e&&e),"function"==typeof t.hasSamples&&t.hasSamples()&&(this.sampleInfo.hasAttributes()&&this.sampleInfoControl.setButtonVisibility(!0),!1!==this.config.showSampleNameButton&&this.sampleNameControl.show()),t.trackView.enableTrackSelection(this.navbar.getEnableTrackSelection()),t}async loadROI(t){return this.roiManager.loadROI(t,this.genome)}clearROIs(){this.roiManager.clearROIs()}async getUserDefinedROIs(){if(this.roiManager){const t=this.roiManager.getUserDefinedROISet();if(void 0===t)return[];const e=await t.getAllFeatures(),i=[];for(let t of Object.values(e))i.push(...t);return i}return[]}getRulerTrackView(){const t=this.trackViews.filter(({track:t})=>"ruler"===t.id);return t.length>0?t[0]:void 0}async createTrack(t){let e=await async function(t){return"function"==typeof t?t():t}
|
|
25
|
+
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */(t.url||t.fastaURL);if(b(e)&&(e=e.trim()),e)if(t.format)t.format=t.format.toLowerCase();else if(t.fastaURL)t.format="fasta";else if(t.sourceType)"htsget"===t.sourceType&&await sl.inferFormat(t);else{const e=await Op(t);e&&(t.format=e)}t.type&&Ho(t);let i=t.type?t.type.toLowerCase():void 0;if(!i){if(!t.format)throw Error(`Unrecognized track: ${JSON.stringify(t)}`);if(i=Oo(t.format),"bedtype"===i){const e=_h(t,this.genome);t._featureSource=e;const r="function"==typeof e.trackType?await e.trackType():e.trackType;i=r&&new Set(fy.keys()).has(r)?r:"annotation"}t.type=i}if(this.trackDefaults&&i){const e=this.trackDefaults[i];if(e)for(let i in e)e.hasOwnProperty(i)&&void 0===t[i]&&(t[i]=e[i])}const r=function(t,e,i){let r;switch(t){case"annotation":case"genes":case"fusionjuncspan":case"snp":r="feature";break;case"seg":case"maf":case"mut":r="seg";break;case"junctions":case"splicejunctions":r="junction";break;default:r=t}return fy.has(r)?fy.get(r)(e,i):void 0}(i,t,this);if(void 0!==r)return t.roi&&t.roi.length>0&&r instanceof lc&&(r.roiSets=t.roi.map(t=>new eA(t,this.genome))),r;this.alert.present(new Error(`Error creating track. Could not determine track type for file: ${t.url||t}`),void 0)}reorderTracks(){this.trackViews.sort(function(t,e){const i=t=>"ideogram"===t.track.id?1:"ruler"===t.track.id?2:3,r=i(t),s=i(e);if(r===s){return(t.track.order||0)-(e.track.order||0)}return r-s});for(let{axis:t,viewports:e,sampleInfoViewport:i,sampleNameViewport:r,outerScroll:s,dragHandle:o,gearContainer:n}of this.trackViews){t.remove();for(let{viewportElement:t}of e)t.parentNode.removeChild(t);i.viewport.remove(),r.viewport.remove(),s.remove(),o.remove(),n.remove()}const t=this.columnContainer.querySelectorAll(".igv-column");for(let{axis:e,viewports:i,sampleInfoViewport:r,sampleNameViewport:s,outerScroll:o,dragHandle:n,gearContainer:a}of this.trackViews){this.columnContainer.querySelector(".igv-axis-column").appendChild(e);for(let e=0;e<t.length;e++){const{viewportElement:r}=i[e];t[e].appendChild(r)}this.columnContainer.querySelector(".igv-sample-info-column").appendChild(r.viewport),this.columnContainer.querySelector(".igv-sample-name-column").appendChild(s.viewport),this.columnContainer.querySelector(".igv-scrollbar-column").appendChild(o),this.columnContainer.querySelector(".igv-track-drag-column").appendChild(n),this.columnContainer.querySelector(".igv-gear-menu-column").appendChild(a)}}getTrackOrder(){return this.trackViews.filter(t=>t.track&&t.track.name).map(t=>t.track.name)}getSelectedTrackViews(){return this.trackViews.filter(t=>!0===t.track.selected)}removeTrackByName(t){const e=this.trackViews.slice();for(let i of e)t===i.track.name&&this.removeTrack(i.track)}removeTrack(t){for(let e of this.trackViews)if(t===e.track){this._removeTrack(e.track);break}}_removeTrack(t){t.disposed||(this.trackViews.splice(this.trackViews.indexOf(t.trackView),1),this.fireEvent("trackremoved",[t]),this.fireEvent("trackorderchanged",[this.getTrackOrder()]),t.trackView&&t.trackView.dispose())}removeAllTracks(){const t=this.trackViews;this.trackViews=[];for(let e of t)"ruler"!==e.track.id&&"ideogram"!==e.track.id?(this.fireEvent("trackremoved",[e.track]),e.dispose()):this.trackViews.push(e)}get ideogramTrackView(){return this.trackViews[0]}get rulerTrackView(){return this.trackViews[1]}findTracks(t,e){let i="function"==typeof t?e=>t(e.track):i=>e===i.track[t];return this.trackViews.filter(i).map(t=>t.track)}get tracks(){return this.trackViews.map(t=>t.track).filter(t=>void 0!==t)}setTrackHeight(t){this.trackHeight=t,this.trackViews.forEach(function(e){e.setTrackHeight(t,!1)})}async visibilityChange(){this.layoutChange()}async layoutChange(){if(this.referenceFrameList.find(t=>t.bpPerPixel<0)){const t=this.calculateViewportWidth(this.referenceFrameList.length);for(let e of this.referenceFrameList)e.bpPerPixel=(e.end-e.start)/t}this.referenceFrameList&&this.navbar.navbarDidResize(),BA.call(this),this.roiManager.updateROIRegionPositions(),await this.updateViews()}async updateViews(t){const e=this.trackViews;this.updateLocusSearchWidget();for(const{bpPerPixel:t,chr:e,start:i}of this.referenceFrameList)t<=10&&await this.genome.getSequence(e,i,i+1);for(const t of this.centerLineList)t.repaint();if(this.dragObject)for(const t of e)await t.updateViews();else{const t={},i=[];for(const r of e)if(r.track.autoscaleGroup){const e=r.track.autoscaleGroup;t[e]||(t[e]=[]),t[e].push(r)}else i.push(r);if(Object.entries(t).length>0)for(const[e,i]of Object.entries(t)){const t=await Promise.all(i.map(t=>t.getInViewFeatures())),e=Go(t.flat());for(const t of i)t.track.dataRange=Object.assign({},e),t.track.autoscale=!1;await Promise.all(i.map(t=>t.updateViews()))}await Promise.all(i.map(t=>t.updateViews()))}}repaintViews(){for(let t of this.trackViews)t.repaintViews()}updateLocusSearchWidget(){if(!this.referenceFrameList)return;const t=this.referenceFrameList,e=this.calculateViewportWidth(this.referenceFrameList.length);for(let i of t)i.end=i.start+i.bpPerPixel*e;const i=this.referenceFrameList.map(t=>t.getLocusString()).join(" "),r=1===t.length?this.genome.getChromosomeDisplayName(this.referenceFrameList[0].chr):"";this.navbar.updateLocus(i,r),this.fireEvent("locuschange",[this.referenceFrameList])}calculateViewportWidth(t){let{width:e}=this.columnContainer.getBoundingClientRect();const i=this.getSampleInfoViewportWidth(),r=this.getSampleNameViewportWidth();return e-=(!1===this.config.showAxis?0:50)+i+r+14+(!1===this.config.showTrackDragHandles?0:12)+(!1===this.config.showGearColumn?0:28),e-=5*(t-1),Math.floor(e/t)}updateReferenceFrames(t){for(const e of this.referenceFrameList)e.updateForViewportWidth(t)}updateViewportElements(t){for(let e=0;e<this.referenceFrameList.length;e++){for(const{viewports:i}of this.trackViews)i[e].setWidth(t);for(const{sampleInfoViewport:t}of this.trackViews)t.setWidth(this.getSampleInfoColumnWidth()),t.repaint()}}async syncUIState(){this.updateUIWithReferenceFrameList(),await this.updateViews(!0)}minimumBases(){var t;return null!==(t=this.config.minimumBases)&&void 0!==t?t:40}zoomIn(){this.zoomWithScaleFactor(.5)}zoomOut(){this.zoomWithScaleFactor(2)}async zoomWithScaleFactor(t,e,i){if(!0===this.config.disableZoom)return;if(!this.referenceFrameList)return;const r=this.calculateViewportWidth(this.referenceFrameList.length);let s=i?[i]:this.referenceFrameList;for(let i of s)i.zoomWithScaleFactor(this,t,r,e);this.fireEvent("zoom",[s])}async addMultiLocusPanel(t,e,i,r){if(!this.referenceFrameList)return;const s=this.calculateViewportWidth(1+this.referenceFrameList.length),o=this.calculateViewportWidth(this.referenceFrameList.length)/this.calculateViewportWidth(1+this.referenceFrameList.length);for(let t of this.referenceFrameList)t.bpPerPixel*=o;const n=(i-e)/s,a=new my(this.genome,t,e,i,n),c=r?this.referenceFrameList.indexOf(r):this.referenceFrameList.length-1,l=1+c,{viewportElement:h}=this.trackViews[0].viewports[c],d=zy(h.parentElement);if(this.fireEvent("columnlayoutchange"),l===this.referenceFrameList.length){this.referenceFrameList.push(a);for(let t of this.trackViews){const e=cu(t,d,a);t.viewports.push(e)}}else{this.referenceFrameList.splice(l,0,a);for(let t of this.trackViews){const e=cu(t,d,a);t.viewports.splice(l,0,e)}}this.centerLineList=this.createCenterLineList(this.columnContainer),BA.call(this),await this.updateViews(!0)}createCenterLineList(t){const e=t.querySelectorAll(".igv-center-line");for(let t=0;t<e.length;t++)e[t].remove();const i=[],r=t.querySelectorAll(".igv-column");for(let t=0;t<r.length;t++)i.push(new Oy(this,this.referenceFrameList[t],r[t]));return i}async removeMultiLocusPanel(t){const e=this.referenceFrameList.indexOf(t),{viewportElement:i}=this.trackViews[0].viewports[e];Ly(e,i.parentElement),this.fireEvent("columnlayoutchange");for(let{viewports:t}of this.trackViews)t[e].dispose(),t.splice(e,1);this.referenceFrameList.splice(e,1);const r=this.getRulerTrackView();if(1===this.referenceFrameList.length&&r)for(let t of r.viewports)t.dismissLocusLabel();const s=this.calculateViewportWidth(1+this.referenceFrameList.length)/this.calculateViewportWidth(this.referenceFrameList.length);await this.rescaleForMultiLocus(s)}async gotoMultilocusPanel(t){const e=this.referenceFrameList.indexOf(t);this.columnContainer.querySelectorAll(".igv-column").forEach((t,i)=>{i===e||t.remove()}),this.columnContainer.querySelectorAll(".igv-column-shim").forEach(t=>t.remove());for(let t of this.trackViews){const i=t.viewports[e];t.viewports.filter((t,i)=>i!==e).forEach(t=>t.dispose()),t.viewports=[i]}const i=this.calculateViewportWidth(1);t.bpPerPixel=(t.end-t.start)/i,this.referenceFrameList=[t],this.trackViews.forEach(({viewports:t})=>t.forEach(t=>t.setWidth(i))),this.centerLineList=this.createCenterLineList(this.columnContainer),this.updateUIWithReferenceFrameList(),await this.updateViews(!0)}async rescaleForMultiLocus(t){const e=this.calculateViewportWidth(this.referenceFrameList.length);for(let e of this.referenceFrameList)e.bpPerPixel*=t;for(let{viewports:t}of this.trackViews)for(let i of t)i.setWidth(e);this.centerLineList=this.createCenterLineList(this.columnContainer),this.updateUIWithReferenceFrameList(),await this.updateViews()}async goto(t,e,i){await this.search(t+":"+e+"-"+i)}async search(t,e){const i=await async function(t,e){if(void 0===e||""===e.trim())return;const i=e.split(" ");let r=[];const s=async e=>{if($f.isValidHGVS(e)){const i=await $f.search(e,t);if(i)return i}if("all"===e.trim().toLowerCase()||"*"===e)return t.genome.wholeGenomeView?{chr:"all",start:0,end:t.genome.getChromosome("all").bpLength}:void 0;let i,r;if(e.includes(":")&&(i=Wg(e,t.isSoftclipped()),i&&(r=await t.genome.loadChromosome(i.chr))),!r){i=void 0;const s=await Hf(t,e);s&&(i={chr:s.chr,start:s.start,end:s.end,name:(s.name||e).toUpperCase()}),i||(r=await t.genome.loadChromosome(e),r&&(i={chr:r.name}))}return i&&(r=r||await t.genome.loadChromosome(i.chr),i.chr=r.name,void 0===i.start&&void 0===i.end&&(i.start=0,i.end=r.bpLength)),i};for(let t of i){const e=await s(t);e&&r.push(e)}if(0===r.length){const t=await s(e.replace(/ /g,"+"));t&&r.push(t)}return 0===r.length?void 0:r}(this,t);return this.updateLoci(null!=i?i:[],e)}async updateLoci(t,e){var i;if(t&&t.length>0){this.referenceFrameList=function(t,e,i,r,s,o){return t.map(t=>{let n;if(t.bpPerPixel)n=new my(e,t.chr,t.start,t.start+s*t.bpPerPixel,t.bpPerPixel);else{const a=Object.assign({},t);if(i&&a.name&&(a.start=Math.max(0,a.start-i),a.end+=i),!o){const t=e.getChromosome(a.chr);Wo(t.bpLength,a,r)}n=new my(e,a.chr,a.start,a.end,(a.end-a.start)/s)}return n})}(t,this.genome,null!==(i=this.flanking)&&void 0!==i?i:0,this.minimumBases(),this.calculateViewportWidth(t.length),this.isSoftclipped());for(let t of this.trackViews)t.removeViewportsFromColumnContainer();this.columnContainer.querySelectorAll(".igv-column-shim, .igv-column").forEach(t=>t.remove()),Py(this.columnContainer.querySelector(".igv-sample-info-column"),this.referenceFrameList.length),this.fireEvent("columnlayoutchange");for(let t of this.trackViews)t.createViewports(this,this.columnContainer,this.referenceFrameList);return this.centerLineList=this.createCenterLineList(this.columnContainer),this.updateUIWithReferenceFrameList(),e||await this.updateViews(),!0}return!1}async loadSampleInfo(t){await this.sampleInfo.loadSampleInfo(t),this.config.sampleinfo?this.config.sampleinfo.push(t):this.config.sampleinfo=[t];for(const{sampleInfoViewport:t}of this.trackViews)t.setWidth(this.getSampleInfoColumnWidth());const e=this.findTracks(t=>"function"==typeof t.getSamples);e.length>0&&(this.sampleInfoControl.performClickWithState(this,!0),this.sampleInfoControl.setButtonVisibility(!0));for(const{sampleInfoViewport:t}of this.trackViews)t.repaint()}async discardSampleInfo(){this.sampleInfo.discard();for(const{sampleInfoViewport:t}of this.trackViews)t.setWidth(this.getSampleInfoColumnWidth());const t=this.findTracks(t=>"function"==typeof t.getSamples);t.length>0&&(this.sampleInfoControl.performClickWithState(this,!1),this.sampleInfoControl.setButtonVisibility(!1));for(const{sampleInfoViewport:t}of this.trackViews)t.repaint();await this.layoutChange()}getSampleInfoColumnWidth(){if(this.sampleInfo.attributeCount){const t=this.findTracks(t=>"function"==typeof t.getSamples),e=t.length>0,i=this.sampleInfo.hasAttributes(),r=this.sampleInfoControl.showSampleInfo;return e&&i&&r?this.sampleInfo.attributeCount*bu+8:0}return 0}on(t,e){this.eventEmitter.on(t,e)}un(t,e){this.eventEmitter.off(t,e)}off(t,e){this.eventEmitter.off(t,e)}fireEvent(t,e,i){return this.eventEmitter.emit(t,e,i)}dispose(){this.removeEventHandlers();for(let t of this.trackViews)t.dispose();this.roiManager&&this.roiManager.dispose()}toJSON(){const t={version:"0.1.2"};void 0!==this.showSampleNames&&(t.showSampleNames=this.showSampleNames),this.sampleNameViewportWidth&&(t.sampleNameViewportWidth=this.sampleNameViewportWidth),t.reference=this.genome.toJSON();const e=[];let i=this.trackViews[0];for(let{referenceFrame:t}of i.viewports){const i=t.getLocusString();e.push(i)}t.locus=1===e.length?e[0]:e;const r=this.roiManager.toJSON();r&&(t.roi=r,this.roiManager.showOverlays||(t.showROIOverlays=!1)),this.qtlSelections.isEmpty()||(t.qtlSelections=this.qtlSelections.toJSON());const s=[],o=[];for(const{track:t}of this.trackViews)try{let e;"function"==typeof t.getState?e=lc.prepareConfigForSession(t.getState()):t.config&&(e=lc.prepareConfigForSession(t.config)),e&&(e.browser&&delete e.browser,e.order=t.order,s.push(e))}catch(e){const i=`Track: ${t.name}: ${e}`;console.error(i),o.push(i)}if(o.length>0){let t=1,e="Errors encountered saving session: </br>";for(let i of o)e+=` (${t++}) ${i.toString()} <br/>`;throw Error(e)}return t.tracks=s,this.config.sampleinfo&&(t.sampleinfo=this.config.sampleinfo),this._validateAndWarnResources(t),t}_validateAndWarnResources(t){const e=[],i=t.reference;if((null==i?void 0:i.fastaURL)&&(nc(i.fastaURL)?e.push(`Local file: ${i.fastaURL.name}`):ac(i.fastaURL)&&e.push(`Google Drive URL: ${i.fastaURL}`)),(null==i?void 0:i.indexURL)&&(nc(i.indexURL)?e.push(`Local file: ${i.indexURL.name}`):ac(i.indexURL)&&e.push(`Google Drive URL: ${i.indexURL}`)),e.length>0)throw new Error("Error: Sessions cannot include the following resources in the reference genome:\n"+e.map(t=>` - ${t}`).join("\n")+"\nThese resources require local access or authentication and will not work when the session is shared.");const r=[],s=[];if(this.config.sampleinfo)for(const t of this.sampleInfo.sampleInfoFiles){const e=lc.prepareConfigForSession({url:t});e.file&&r.push(e.file);const i=wo(this,IA,"m",NA).call(this,e,"Sample info","url","filename","Google Drive file");i&&s.push(i)}const{localFileItems:o,googleDriveItems:n}=wo(this,IA,"m",RA).call(this,t.tracks||[],r,s);if(o.length>0||n.length>0){let t="Local and Google Drive files cannot be loaded automatically when a saved session is restored. This session saves references to the following file(s) that will not be restored.\n\n";for(const e of o)t+=`Local file name: ${e.fileName}\n`,t+=`Track name: ${e.trackName}\n\n`;for(const e of n)t+=`Google Drive file name: ${e.fileName}\n`,t+=`Track name: ${e.trackName}\n\n`;alert(t)}}compressedSession(){return function(t){const e=new Uint8Array(t.length);for(var i=0;i<t.length;i++)e[i]=t.charCodeAt(i);const r=new Ki(e),s=String.fromCharCode.apply(null,r);return btoa(s).replace(/\+/g,".").replace(/\//g,"_").replace(/=/g,"-")}(JSON.stringify(this.toJSON()))}sessionURL(){const t=window.location.href.slice(),e=t.indexOf("?");return(e>0?t.substring(0,e):t)+"?sessionURL=blob:"+this.compressedSession()}mouseDownOnViewport(t,e){var i;i=o(t),this.vpMouseDown={viewport:e,lastMouseX:i.x,mouseDownX:i.x,lastMouseY:i.y,mouseDownY:i.y,referenceFrame:e.referenceFrame}}cancelTrackPan(){const t=this.dragObject;this.dragObject=void 0,this.isScrolling=!1,this.vpMouseDown=void 0,t&&t.viewport.referenceFrame.start!==t.start&&(this.updateViews(),this.fireEvent("trackdragend",[t.viewport]))}isTrackPanning(){return this.dragObject}isSoftclipped(){return void 0!==this.trackViews.find(t=>!0===t.track.showSoftClips)}startTrackDrag(t){this.dragTrack=t}updateTrackDrag(t){if(t&&this.dragTrack){const e=this.dragTrack,i=this.trackViews.indexOf(t),r=this.trackViews.indexOf(e),s=this.trackViews;s[i]=e,s[r]=t;const o=this.trackViews[i].track.order;this.trackViews[r].track.order=o;const n=s.length;let a=o;if(i<r)for(let t=i+1;t<n;t++){const e=s[t].track;if(!(e.order<=a))break;e.order=Math.min(Number.MAX_SAFE_INTEGER,a+1),a=e.order}else for(let t=i-1;t>0;t--){const e=s[t].track;if(!(e.order>=a))break;e.order=Math.max(-Number.MAX_SAFE_INTEGER,a-1),a=e.order}this.reorderTracks()}}endTrackDrag(){this.dragTrack?(this.dragTrack=void 0,this.fireEvent("trackorderchanged",[this.getTrackOrder()])):this.dragTrack=void 0}addEventHandlers(){this.addWindowResizeHandler(),this.addRootMouseUpHandler(),this.addRootMouseLeaveHandler(),this.addColumnContainerEventHandlers(),this.addKeyboardHandler()}removeEventHandlers(){this.removeWindowResizeHandler(),this.removeRootMouseUpHandler(),this.removeRootMouseLeaveHandler(),this.removeColumnContainerEventHandlers(),this.removeKeyboardHandler()}addWindowResizeHandler(){this.boundWindowResizeHandler=BA.bind(this),window.addEventListener("resize",this.boundWindowResizeHandler)}removeWindowResizeHandler(){window.removeEventListener("resize",this.boundWindowResizeHandler)}addRootMouseUpHandler(){this.boundRootMouseUpHandler=LA.bind(this),this.root.addEventListener("mouseup",this.boundRootMouseUpHandler)}removeRootMouseUpHandler(){this.root.removeEventListener("mouseup",this.boundRootMouseUpHandler)}addRootMouseLeaveHandler(){this.boundRootMouseLeaveHandler=LA.bind(this),this.root.addEventListener("mouseleave",this.boundRootMouseLeaveHandler)}removeRootMouseLeaveHandler(){this.root.removeEventListener("mouseleave",this.boundRootMouseLeaveHandler)}addColumnContainerEventHandlers(){this.boundColumnContainerMouseMoveHandler=TA.bind(this),this.boundColumnContainerTouchMoveHandler=TA.bind(this),this.boundColumnContainerMouseLeaveHandler=LA.bind(this),this.boundColumnContainerMouseUpHandler=LA.bind(this),this.boundColumnContainerTouchEndHandler=LA.bind(this),this.columnContainer.addEventListener("mousemove",this.boundColumnContainerMouseMoveHandler),this.columnContainer.addEventListener("touchmove",this.boundColumnContainerTouchMoveHandler),this.columnContainer.addEventListener("mouseleave",this.boundColumnContainerMouseLeaveHandler),this.columnContainer.addEventListener("mouseup",this.boundColumnContainerMouseUpHandler),this.columnContainer.addEventListener("touchend",this.boundColumnContainerTouchEndHandler)}removeColumnContainerEventHandlers(){this.columnContainer.removeEventListener("mousemove",this.boundColumnContainerMouseMoveHandler),this.columnContainer.removeEventListener("touchmove",this.boundColumnContainerTouchMoveHandler),this.columnContainer.removeEventListener("mouseleave",this.boundColumnContainerMouseLeaveHandler),this.columnContainer.removeEventListener("mouseup",this.boundColumnContainerMouseUpHandler),this.columnContainer.removeEventListener("touchend",this.boundColumnContainerTouchEndHandler)}addKeyboardHandler(){this.keyUpHandler=zA.bind(this),document.addEventListener("keyup",this.keyUpHandler)}removeKeyboardHandler(){console.log("Remove handler"),document.addEventListener("keyup",this.keyUpHandler)}static uncompressSession(t){let e;if(t.indexOf("/gzip;base64")>0){e=nr(t);let i="";for(let t of e)i+=String.fromCharCode(t);return i}return function(t){t=t.replace(/\./g,"+").replace(/_/g,"/").replace(/-/g,"=");const e=atob(t),i=[];for(let t=0;t<e.length;t++)i.push(e.charCodeAt(t));const r=Yi(i);let s="";for(let t of r)s+=String.fromCharCode(t);return s}(t.substring(5))}createCircularView(t,e){var i;return e=!0===e,this.circularView=(i=this,new lg(t,{onChordClick:t=>{const e=t.data,r=e.mate;function s(t){t.chr=i.genome.getChromosomeName(t.refName);let e=!1;for(let r of i.referenceFrameList){const i=Up.fromLocusString(r.getLocusString());if(i.contains(t)){e=!0;break}if(i.overlaps(t)){r.extend(t),e=!0;break}}if(!e){const e=2e3,r=(t.start+t.end)/2;i.addMultiLocusPanel(t.chr,r-e,r+e)}}s(e),r&&s(r)}})),this.circularViewControl=new Hy(this.navbar.toggleButtonContainer,this),this.circularView.setAssembly({name:this.genome.id,id:this.genome.id,chromosomes:mg(this.genome)}),this.circularViewVisible=e,this.circularView}get circularViewVisible(){return void 0!==this.circularView&&this.circularView.visible}set circularViewVisible(t){var e;this.circularView&&(this.circularView.visible=t,null===(e=this.circularViewControl)||void 0===e||e.setState(t))}get overlayTrackButton(){return this.navbar.overlayTrackButton}get roiTableControl(){return this.navbar.roiTableControl}get sampleNameControl(){return this.navbar.sampleNameControl}get sampleInfoControl(){return this.navbar.sampleInfoControl}async blat(t){return $h({sequence:t,browser:this,name:"Blat",title:"Blat"})}startSpinner(){this.spinnerElement&&(this.spinnerElement.style.display="flex")}stopSpinner(){this.spinnerElement&&(this.spinnerElement.style.display="none")}}async function BA(t){if(void 0===this.referenceFrameList||0===this.referenceFrameList.length)return;const e=this.calculateViewportWidth(this.referenceFrameList.length);this.updateReferenceFrames(e),this.updateViewportElements(e),await this.syncUIState()}function TA(t){t.preventDefault();const{x:e,y:i}=o(t);if(this.vpMouseDown){const{viewport:r,referenceFrame:s}=this.vpMouseDown,o=Math.abs(e-this.vpMouseDown.mouseDownX)>Math.abs(i-this.vpMouseDown.mouseDownY);if(!this.dragObject&&!this.isScrolling)if(o)this.vpMouseDown.mouseDownX&&Math.abs(e-this.vpMouseDown.mouseDownX)>this.constants.dragThreshold&&(this.dragObject={viewport:r,start:s.start});else if(this.vpMouseDown.mouseDownY&&Math.abs(i-this.vpMouseDown.mouseDownY)>this.constants.scrollThreshold){this.isScrolling=!0;const t=r.viewportElement.clientHeight,e=r.trackView.maxViewportContentHeight();this.vpMouseDown.r=t/e}if(this.dragObject){const i=!this.isSoftclipped();let o=this.vpMouseDown.lastMouseX-e;s.shiftPixels(o,r.viewportElement.clientWidth,i)&&this.updateViews(),this.fireEvent("trackdrag",[t])}if(this.isScrolling){const t=this.vpMouseDown.lastMouseY-i;r.trackView.scrollByPixels(t)}this.vpMouseDown.lastMouseX=e,this.vpMouseDown.lastMouseY=i}}function LA(t){this.cancelTrackPan(),this.endTrackDrag()}async function zA(t){if(this.referenceFrameList&&!(this.referenceFrameList.length>1)&&("KeyF"===t.code||"KeyB"===t.code)){const e=this.getSelectedTrackViews();if(e.length>0){const i=e[0].track;if("function"==typeof i.nextFeatureAfter){const e=this.referenceFrameList[0],r=e.viewport?e.viewport.getWidth():this.calculateViewportWidth(this.referenceFrameList.length),s="all"===e.chr.toLowerCase(),o=i.visibilityWindow;if(s||o&&o>0&&e.bpPerPixel*r>o)return;const n="KeyF"===t.code,a=e.chr,c=e.center,l=await i.nextFeatureAfter(a,c,n);if(l){const i=await this.genome.getChromosomeName(l.chr);if(a===i){const i=(l.start+l.end)/2;if(t.shiftKey){const t=this.config.minimumBases||40,s=Math.max(t,1.1*(l.end-l.start));e.start=Math.max(0,i-s/2),e.end=i+s/2,e.bpPerPixel=(e.end-e.start)/r}else e.shift(i-c);this.updateViews()}else{e.chr=i;const s=(l.start+l.end)/2;if(t.shiftKey){const t=this.config.minimumBases||40,i=Math.max(t,1.1*(l.end-l.start));e.start=Math.max(0,s-i/2),e.end=e.start+i,e.bpPerPixel=(e.end-e.start)/r}else e.start=s-r*e.bpPerPixel/2,e.end=e.start+r*e.bpPerPixel;this.updateViews()}}}}}}function PA(t,e){for(let{viewports:i}of t)for(let t of i){const r=t;r.trackLabelElement&&(0===i.indexOf(t)&&!0===e?r.trackLabelElement.style.display="block":r.trackLabelElement.style.display="none")}}function OA(t,e,i){let r,s=1e3;let o,n=!1;!function a(){const c="localhost"===t||"127.0.0.1"===t,l="https:"!==window.location.protocol||c?"ws:":"wss:";r=new WebSocket(`${l}//${t}:${e}`);const h=t=>{r.readyState===WebSocket.OPEN&&r.send(JSON.stringify(t))};r.addEventListener("open",function(t){s=1e3,h({message:"Hello from browser client"})}),r.addEventListener("message",async function(t){try{const e=JSON.parse(t.data);if("close"===e.type)return n=!0,clearTimeout(o),void(r&&r.readyState===WebSocket.OPEN&&r.close());const s=await async function(t,e){const i={uniqueID:t.uniqueID,status:"ok"};try{let r;const{type:s,args:o}=t;switch(s.toLowerCase()){case"goto":case"search":const t=o.locus||o.term;await e.search(t)?i.message=`Locus ${t} found and navigated to successfully`:(i.message=`Locus ${t} not found`,i.status="warning");break;case"currentloci":i.data=e.currentLoci(),i.message="Retrieved current loci successfully";break;case"visibilityChange":await e.visibilityChange(),i.message="Visibility change processed successfully";break;case"tojson":i.data=e.toJSON(),i.message="Session serialized to JSON successfully";break;case"compressedsession":i.data=e.compressedSession(),i.message="Session serialized and compressed successfully";break;case"tosvg":i.data=e.toSVG(),i.message="Session exported to SVG successfully";break;case"removetrackbyname":{let{trackName:t}=o;t?(r=e.findTracks(e=>!t||e.name===t),r?(r.forEach(t=>e.removeTrack(t)),i.message=`Removed track(s) ${t} for ${r.length} track(s)`):(i.message=`No tracks found matching name ${t}`,i.status="warning")):(i.message="No track name provided",i.status="warning");break}case"loadsampleinfo":e.loadSampleInfo(o),i.message="Sample info loaded successfully";break;case"discardsampleinfo":e.discardSampleInfo(),i.message="Sample info discarded successfully";break;case"loadroi":e.loadROI(o),i.message="ROI loaded successfully";break;case"clearrois":e.clearROIs(),i.message="ROIs cleared successfully";break;case"getuserdefinedrois":const n=await e.getUserDefinedROIs();i.data=n,i.message=`Retrieved ${n.length} user-defined ROIs successfully`;break;case"loadtrack":{const{url:t,indexURL:r}=o,s=await e.loadTrack({url:t,indexURL:r});i.message=`Track ${null==s?void 0:s.name} loaded successfully`;break}case"genome":const a=o.id;await e.loadGenome(a),i.message=`Genome ${a} loaded successfully`;break;case"loadsession":const c=o.url;await e.loadSession({url:c}),i.message=`Session loaded successfully from ${c}`;break;case"zoomin":await e.zoomIn(),i.message="Zoomed in successfully";break;case"zoomout":await e.zoomOut(),i.message="Zoomed out successfully";break;case"setcolor":let{color:l,trackName:h}=o;l.includes(",")&&!l.startsWith("rgb(")&&(l=`rgb(${l})`),r=e.findTracks(t=>!h||t.name===h),r?(r.forEach(t=>t.color=l),e.repaintViews(),i.message=`Set color to ${l} for ${r.length} track(s)`):(i.message=`No tracks found matching name ${h}`,i.status="warning");break;case"renametrack":const{currentName:d,newName:u}=o;r=e.findTracks(t=>d===t.name),r&&r.length>0?(r.forEach(t=>{t.name=u,e.fireEvent("tracknamechange",[t])}),i.message=`Renamed ${r.length} track(s) from ${d} to ${u}`):(i.message=`No track found with name ${d}`,i.status="warning");break;default:i.message=`Unrecognized message type: ${s}`,i.status="error"}}catch(t){i.message=t instanceof Error?t.message:String(t),i.status="error"}return i}(e,i);h(s)}catch(e){e instanceof SyntaxError?console.warn("Received non-JSON message from server:",t.data):(console.error("Error handling message:",e),h({status:"error",message:`Error handling message: ${e instanceof Error?e.message:String(e)}`}))}}),r.addEventListener("error",function(t){console.error("WebSocket error:",t)}),r.addEventListener("close",function(t){n?console.log("WebSocket closed intentionally. Not reconnecting."):(console.log("Disconnected from server. Retrying in "+s/1e3+" seconds."),clearTimeout(o),o=setTimeout(a,s),s=Math.min(1e4,2*s))})}(),window.addEventListener("beforeunload",function(t){clearTimeout(o),r&&r.readyState===WebSocket.OPEN&&r.close()})}IA=new WeakSet,SA=async function(t){const e=b(t)?JSON.parse(t):t;if(e.format&&"sampleinfo"===e.format.toLowerCase())return void await this.loadSampleInfo(e);let i;try{i=await this.createTrack(e)}catch(t){let i=t instanceof Error?t.message:String(t);const r={401:"Access unauthorized",403:"Access forbidden",404:"Not found"};r.hasOwnProperty(i)&&(i=r[i]),i=`${i} : ${x(e.url)?e.url.name:e.url}`;const s=new Error(i);throw console.error(s),s}return i?await this.addTrack(i):void 0},EA=function(t,e="Google Drive file"){return t||e},NA=function(t,e,i,r,s){const o=t[i];if(o&&ac(o)){return{trackName:e,fileName:wo(this,IA,"m",EA).call(this,t[r],s)}}return null},MA=function(t){const e=[],i=t.name||"Unnamed track",r=wo(this,IA,"m",NA).call(this,t,i,"url","filename","Google Drive file");r&&e.push(r);const s=wo(this,IA,"m",NA).call(this,t,`${i} index`,"indexURL","indexFilename","Google Drive index file");return s&&e.push(s),e},RA=function(t,e=[],i=[]){const r=[],s=[];for(const e of t){const t=e.name||"Unnamed track";e.file&&r.push({trackName:t,fileName:e.file}),e.indexFile&&r.push({trackName:`${t} index`,fileName:e.indexFile})}for(const t of e)r.push({trackName:"Sample info",fileName:t});for(const e of t){const t=wo(this,IA,"m",MA).call(this,e);s.push(...t)}return s.push(...i),{localFileItems:r,googleDriveItems:s}};let HA=[];const UA=Er.setApiKey;const VA=Er.oauth;var qA={AlertDialog:zo,TrackUtils:Uo,IGVGraphics:go,MenuUtils:es,DataRangeDialog:po,createTrack:async function(t,e){return await DA.prototype.createTrack.call(e,t)},createBrowser:async function(t,e){void 0===e&&(e={}),Hd.KNOWN_GENOMES||await Hd.initializeGenomes(e),yA(e),e.queryParametersSupported&&function(t){var e,i,r,s,o,n,a,c,l;let h,d,u;if(a=window.location.href,o={},e=a.indexOf("?"),i=a.lastIndexOf("#"),e>=0)for(i<0&&(i=a.length),r=e+1;r<i;)(s=a.indexOf("&",r))<0&&(s=i),2===(n=a.substring(r,s).split("=",2)).length?(c=n[0],l=decodeURIComponent(n[1]),"file"===c?h=l.split(","):"index"===c?d=l.split(","):"name"===c?u=l.split(","):"genome"===c?!l.startsWith("https://")&&!l.startsWith("http://")||l.endsWith(".json")?(t[c]=l,t.reference=void 0):t.reference={fastaURL:l,indexURL:l+".fai"}:("reference"===c&&(t.genome=void 0),t[c]=l),r=s+1):r++;if(h){t.tracks||(t.tracks=[]);for(let e=0;e<h.length;e++){if(h[e].endsWith(".xml")||h[e].endsWith(".json")){t.sessionURL=h[e];break}const i={url:h[e]};d&&d.length>e&&(i.indexURL=d[e]),u&&u.length>e&&(i.name=u[e]),t.tracks.push(i)}}}(e),e.apiKey&&Er.setApiKey(e.apiKey),e.oauthToken&&Er.setOauthToken(e.oauthToken),e.clientId&&!Cr()&&await async function(t){if(!google.accounts.oauth2.initTokenClient)throw new Error("Google accounts token client not loaded (https://accounts.google.com/gsi/client)");if(Cr())throw new Error("Google client is already initialized");const e={client_id:t.client_id||t.clientId,scope:t.scope||"https://www.googleapis.com/auth/userinfo.profile",state:t.state||"igv",error:t=>{throw new Error(t.type)},hint:t.hint,hosted_domain:t.hosted_domain},i=google.accounts.oauth2.initTokenClient(e);google.igv={tokenClient:i,apiKey:t.apiKey}}({client_id:e.clientId,apiKey:e.apiKey,scope:"https://www.googleapis.com/auth/userinfo.profile"}),e.formEmbedMode&&(fo.FORM_EMBED_MODE=!0);const i=new DA(e,t);HA.push(i);const r=e.sessionURL||e.session||e.hubURL;if(r?await i.loadSession({url:r}):await i.loadSessionObject(e),i.navbar.navbarDidResize(),e.enableWebSocket){OA(e.webSocketHost||"localhost",e.webSocketPort||60141,i)}return i},removeBrowser:function(t){t.dispose(),t.root.remove(),HA=HA.filter(e=>e!==t)},removeAllBrowsers:function(){for(let t of HA)t.dispose(),t.root.remove();HA=[]},visibilityChange:async function(){for(let t of HA)await t.visibilityChange()},setGoogleOauthToken:function(t){return Er.setOauthToken(t)},setOauthToken:function(t,e){return Er.setOauthToken(t,e)},setCORSProxy:function(t){Er.corsProxy=t},oauth:VA,version:wy,setApiKey:UA,TrackBase:lc,registerTrackClass:function(t,e){fy.set(t,(t,i)=>new e(t,i))},registerTrackCreatorFunction:function(t,e){fy.set(t,e)},registerFileFormats:function(t,e){Ka[t]={fields:e}},loadSessionFile:DA.loadSessionFile,loadHub:Od,uncompressSession:DA.uncompressSession,createIcon:l,createWebSocketClient:OA};export{qA as default};
|
|
26
|
+
//# sourceMappingURL=igv.esm.min.js.map
|