higlass 2.3.1 → 2.3.2

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/dist/hglib.min.js CHANGED
@@ -164,7 +164,7 @@
164
164
  <use id="Rectangle" stroke="#979797" mask="url(#arrowHeadDomainsStr-mask-4)" stroke-width="22" fill="#D8D8D8" xlink:href="#arrowHeadDomainsStr-path-3"></use>
165
165
  </g>
166
166
  </svg>
167
- `,"text/xml").documentElement;function K4({theStyle:e,onClick:t}){return x.createElement("svg",{className:Kn[e],viewBox:"0 0 12 13",onClick:t,xmlns:"http://www.w3.org/2000/svg"},x.createElement("title",null,"Search"),x.createElement("g",{fill:"none",stroke:"#6c6c6c",strokeWidth:"2"},x.createElement("path",{d:"M11.29 11.71l-4-4"}),x.createElement("circle",{cx:"5",cy:"5",r:"4"})))}K4.propTypes={theStyle:q.string,onClick:q.func};const Z4={type:"osm-tiles",datatype:["map-tiles"],local:!0,orientation:"2d",hidden:!0,name:"OSM Tiles",thumbnail:f0,availableOptions:["minPos","maxPos","maxZoom","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","name"],defaultOptions:{minPos:-180,maxPos:180,maxZoom:19,labelPosition:"bottomRight",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0}},Q4={type:"mapbox-tiles",datatype:["map-tiles"],local:!0,orientation:"2d",hidden:!0,name:"Mapbox Tiles",thumbnail:f0,availableOptions:["style","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","name"],defaultOptions:{style:"mapbox.streets",labelPosition:"bottomRight",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0}},xa=[Z4,{...Z4,type:"osm"},Q4,{...Q4,type:"mapbox"},{type:"left-axis",datatype:["axis"],local:!0,orientation:"1d-vertical",name:"Left Axis",thumbnail:AX,availableOptions:["minWidth","reverseAxis"],defaultOptions:{minWidth:100,reverseAxis:!1}},{type:"top-axis",datatype:["axis"],local:!0,orientation:"1d-horizontal",name:"Top Axis",thumbnail:PX,defaultOptions:{}},{type:"horizontal-rule",datatype:["x-coord"],local:!0,orientation:"whole",name:"Horizontal Rule",thumbnail:null,availableOptions:["color"],defaultOptions:{color:"black"}},{type:"vertical-rule",datatype:["y-coord"],local:!0,orientation:"whole",name:"Vertical Rule",thumbnail:null,availableOptions:["color"],defaultOptions:{color:"black"}},{type:"cross-rule",datatype:["xy-coord"],local:!0,orientation:"whole",name:"Cross Rule",thumbnail:null,availableOptions:["color"],defaultOptions:{color:"black"}},{type:"simple-svg",datatype:[],local:!1,orientation:"2d",exportable:!0,availableOptions:["minWidth","minHeight"],defaultOptions:{minWidth:100,minHeight:100}},{type:"heatmap",datatype:["matrix"],local:!1,orientation:"2d",thumbnail:W4,exportable:!0,availableOptions:["backgroundColor","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundOpacity","colorRange","colorbarBackgroundColor","maxZoom","minWidth","minHeight","dataTransform","colorbarPosition","trackBorderWidth","trackBorderColor","heatmapValueScaling","showMousePosition","mousePositionColor","showTooltip","extent","zeroValueColor"],defaultOptions:{backgroundColor:"#eeeeee",labelPosition:"bottomRight",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!0,labelShowAssembly:!0,colorRange:["white","rgba(245,166,35,1.0)","rgba(208,2,27,1.0)","black"],colorbarBackgroundColor:"#ffffff",maxZoom:null,minWidth:100,minHeight:100,colorbarPosition:"topRight",trackBorderWidth:0,trackBorderColor:"black",heatmapValueScaling:"log",showMousePosition:!1,mousePositionColor:"#000000",showTooltip:!1,extent:"full",zeroValueColor:null},defaultOptionsByTheme:{[Qt]:{backgroundColor:"#000000",colorRange:["black","rgba(208,2,27,1.0)","rgba(245,166,35,1.0)","white"],colorbarBackgroundColor:"#000000",labelColor:"#ffffff",labelBackgroundColor:"#000000",trackBorderColor:"#ffffff",mousePositionColor:"#ffffff"}}},{type:"linear-heatmap",aliases:["horizontal-heatmap","vertical-heatmap"],datatype:["matrix"],local:!1,orientation:"1d-horizontal",rotatable:!0,thumbnail:W4,defaultOptions:{backgroundColor:"#eeeeee",labelPosition:"bottomRight",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!0,labelShowAssembly:!0,labelColor:"black",colorRange:["white","rgba(245,166,35,1.0)","rgba(208,2,27,1.0)","black"],maxZoom:null,minWidth:100,minHeight:40,trackBorderWidth:0,trackBorderColor:"black"},availableOptions:["backgroundColor","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundOpacity","colorRange","maxZoom","minWidth","minHeight","dataTransform","oneDHeatmapFlipped","colorbarPosition","trackBorderWidth","trackBorderColor","heatmapValueScaling"]},{type:"line",aliases:["horizontal-line","vertical-line"],datatype:["vector"],local:!1,orientation:"1d-horizontal",rotatable:!0,thumbnail:OX,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundColor","labelBackgroundOpacity","axisLabelFormatting","axisPositionHorizontal","axisMargin","lineStrokeWidth","lineStrokeColor","valueScaling","valueScaleMin","valueScaleMax","trackBorderWidth","trackBorderColor","trackType","showMousePosition","showTooltip","mousePositionColor","aggregationMode","minHeight"],defaultOptions:{labelColor:"black",labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelBackgroundColor:"white",labelShowResolution:!1,labelShowAssembly:!0,axisLabelFormatting:"scientific",axisPositionHorizontal:"right",lineStrokeColor:"blue",lineStrokeWidth:1,valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",labelTextOpacity:.4,showMousePosition:!1,minHeight:20,mousePositionColor:"#000000",showTooltip:!1},defaultOptionsByTheme:{[Qt]:{labelColor:"#ffffff",labelBackgroundColor:"#000000",trackBorderColor:"#ffffff",mousePositionColor:"#ffffff"}}},{type:"1d-heatmap",aliases:["horizontal-1d-heatmap","vertical-1d-heatmap"],datatype:["vector"],local:!1,orientation:"1d-horizontal",rotatable:!0,thumbnail:CX,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundOpacity","axisPositionHorizontal","axisMargin","colorRange","valueScaling","trackBorderWidth","trackBorderColor","trackType","showMousePosition","showTooltip","mousePositionColor","aggregationMode"],defaultOptions:{labelColor:"black",labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!1,labelShowAssembly:!0,axisPositionHorizontal:"right",colorRange:["white","rgba(245,166,35,1.0)","rgba(208,2,27,1.0)","black"],valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",labelTextOpacity:.4,showMousePosition:!1,mousePositionColor:"#000000",showTooltip:!1}},{type:"vector-heatmap",aliases:["horizontal-vector-heatmap","vertical-vector-heatmap"],datatype:["vector"],local:!1,orientation:"1d-horizontal",rotatable:!0,minHeight:1,thumbnail:null,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","valueScaling","labelTextOpacity","labelBackgroundOpacity","colorRange","trackBorderWidth","trackBorderColor","trackType","heatmapValueScaling"],defaultOptions:{labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!1,labelShowAssembly:!0,labelColor:"black",labelTextOpacity:.4,valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",heatmapValueScaling:"log"}},{type:"multivec",aliases:["horizontal-multivec","vertical-multivec"],datatype:["multivec"],local:!1,orientation:"1d-horizontal",rotatable:!0,thumbnail:null,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","minHeight","valueScaling","labelTextOpacity","labelBackgroundOpacity","colorRange","trackBorderWidth","trackBorderColor","trackType","heatmapValueScaling","selectRows","selectRowsAggregationMode","selectRowsAggregationWithRelativeHeight","selectRowsAggregationMethod","colorbarBackgroundColor","colorbarPosition","zeroValueColor"],defaultOptions:{labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!0,labelShowAssembly:!0,labelColor:"black",labelTextOpacity:.4,minHeight:100,valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",heatmapValueScaling:"log",selectRows:null,selectRowsAggregationMode:"mean",selectRowsAggregationWithRelativeHeight:!0,selectRowsAggregationMethod:"client",colorbarBackgroundColor:"#ffffff",colorbarPosition:"topRight",zeroValueColor:null},defaultOptionsByTheme:{[Qt]:{colorbarBackgroundColor:"#000000"}}},{type:"point",aliases:["horizontal-point","vertical-point"],datatype:["vector"],local:!1,orientation:"1d-horizontal",rotatable:!0,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundOpacity","axisLabelFormatting","axisPositionHorizontal","axisMargin","pointColor","pointSize","valueScaling","trackBorderWidth","trackBorderColor"],defaultOptions:{labelColor:"black",labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!1,labelShowAssembly:!0,axisLabelFormatting:"scientific",axisPositionHorizontal:"right",pointColor:"red",pointSize:3,valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",labelTextOpacity:.4}},{type:"divergent-bar",aliases:["horizontal-divergent-bar","vertical-divergent-bar"],datatype:["vector"],local:!1,orientation:"1d-horizontal",rotatable:!0,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundOpacity","axisLabelFormatting","axisPositionHorizontal","axisMargin","barFillColorTop","barFillColorBottom","valueScaling","trackBorderWidth","trackBorderColor","barOpacity"],defaultOptions:{labelColor:"black",labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!1,labelShowAssembly:!0,axisPositionHorizontal:"right",axisLabelFormatting:"scientific",barFillColorBottom:"red",barFillColorTop:"green",valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",labelTextOpacity:.4,barOpacity:1}},{type:"bar",aliases:["horizontal-bar","vertical-bar"],datatype:["vector"],local:!1,orientation:"1d-horizontal",rotatable:!0,availableOptions:["align","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundOpacity","axisLabelFormatting","axisPositionHorizontal","axisMargin","barFillColor","colorRange","colorRangeGradient","valueScaling","valueScaleMin","valueScaleMax","trackBorderWidth","trackBorderColor","barOpacity","showMousePosition","showTooltip","aggregationMode","zeroLineVisible","zeroLineColor","zeroLineOpacity"],defaultOptions:{align:"bottom",labelColor:"[glyph-color]",labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!1,labelShowAssembly:!0,axisLabelFormatting:"scientific",axisPositionHorizontal:"right",barFillColor:"darkgreen",valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",labelTextOpacity:.4,barOpacity:1}},{type:"2d-tiles",datatype:["matrix"],local:!1,orientation:"2d",name:"2D Tile Outlines",thumbnail:G4},{type:"1d-value-interval",aliases:["horizontal-1d-value-interval","vertical-1d-value-interval"],datatype:["bed-value"],local:!1,orientation:"1d-horizontal",rotatable:!0,name:"1D Rectangles",availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundOpacity","axisPositionHorizontal","axisMargin"],defaultOptions:{labelColor:"black",labelPosition:"bottomLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,axisPositionHorizontal:"left",lineStrokeColor:"blue",valueScaling:"linear"}},{type:"stacked-interval",aliases:["top-stacked-interval","left-stacked-interval"],datatype:["stacked-interval"],local:!1,orientation:"1d-horizontal",rotatable:!0,thumbnail:"horizontal-stacked-interval.png",availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundOpacity"]},{type:"viewport-projection-vertical",datatype:["1d-projection"],local:!0,hidden:!0,projection:!0,orientation:"1d-vertical",name:"Viewport Projection",thumbnail:"viewport-projection-center.png",availableOptions:["projectionFillColor","projectionStrokeColor","strokeWidth"],defaultOptions:{projectionFillColor:"#777",projectionStrokeColor:"#777",projectionFillOpacity:.3,projectionStrokeOpacity:.7,strokeWidth:1}},{type:"viewport-projection-horizontal",datatype:["1d-projection"],local:!0,hidden:!0,projection:!0,orientation:"1d-horizontal",name:"Viewport Projection",thumbnail:"viewport-projection-center.png",availableOptions:["projectionFillColor","projectionStrokeColor","strokeWidth"],defaultOptions:{projectionFillColor:"#777",projectionStrokeColor:"#777",projectionFillOpacity:.3,projectionStrokeOpacity:.7,strokeWidth:1}},{type:"viewport-projection-center",datatype:["2d-projection"],local:!0,hidden:!0,projection:!0,orientation:"2d",name:"Viewport Projection",thumbnail:"viewport-projection-center.png",availableOptions:["projectionFillColor","projectionStrokeColor","strokeWidth"],defaultOptions:{projectionFillColor:"#777",projectionStrokeColor:"#777",projectionFillOpacity:.3,projectionStrokeOpacity:.7,strokeWidth:1}},{type:"gene-annotations",aliases:["horizontal-gene-annotations","vertical-gene-annotations"],datatype:["gene-annotation"],local:!1,defaultHeight:90,defaultWidth:90,rotatable:!0,orientation:"1d-horizontal",name:"Gene Annotations",thumbnail:MX,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundColor","labelBackgroundOpacity","minHeight","plusStrandColor","minusStrandColor","trackBorderWidth","trackBorderColor","showMousePosition","mousePositionColor","fontSize","geneAnnotationHeight","geneLabelPosition","geneStrandSpacing"],defaultOptions:{fontSize:10,labelColor:"black",labelBackgroundColor:"#ffffff",labelPosition:"hidden",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,minHeight:24,plusStrandColor:"blue",minusStrandColor:"red",trackBorderWidth:0,trackBorderColor:"black",showMousePosition:!1,mousePositionColor:"#000000",geneAnnotationHeight:16,geneLabelPosition:"outside",geneStrandSpacing:4},defaultOptionsByTheme:{[Qt]:{labelColor:"#ffffff",labelBackgroundColor:"#000000",trackBorderColor:"#ffffff",mousePositionColor:"#ffffff",plusStrandColor:"#40a0ff"}}},{type:"arrowhead-domains",datatype:["arrowhead-domains"],local:!1,orientation:"2d",name:"Arrowhead Domains",thumbnail:Ou,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundOpacity","trackBorderWidth","trackBorderColor"],defaultOptions:{labelColor:"black",labelPosition:"hidden",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,trackBorderWidth:0,trackBorderColor:"black"}},{type:"linear-2d-rectangle-domains",aliases:["horizontal-2d-rectangle-domains","vertical-2d-rectangle-domains"],datatype:["2d-rectangle-domains"],local:!1,orientation:"1d-horizontal",rotatable:!0,name:"Horizontal 2D Rectangle Domains",thumbnail:Ou,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundOpacity","trackBorderWidth","trackBorderColor","rectangleDomainFillColor","rectangleDomainStrokeColor","rectangleDomainOpacity","minSquareSize"],defaultOptions:{labelColor:"black",labelPosition:"bottomLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,trackBorderWidth:0,trackBorderColor:"black",rectangleDomainFillColor:"grey",rectangleDomainStrokeColor:"black",rectangleDomainOpacity:.6,minSquareSize:"none"}},{type:"2d-rectangle-domains",datatype:["2d-rectangle-domains"],local:!1,orientation:"2d",name:"2D Rectangle Domains",thumbnail:Ou,availableOptions:["flipDiagonal","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundOpacity","trackBorderWidth","trackBorderColor","rectangleDomainFillColor","rectangleDomainFillOpacity","rectangleDomainStrokeColor","rectangleDomainOpacity","minSquareSize"],defaultOptions:{flipDiagonal:"none",labelColor:"black",labelPosition:"hidden",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,trackBorderWidth:0,trackBorderColor:"black",rectangleDomainFillColor:"grey",rectangleDomainFillOpacity:.4,rectangleDomainStrokeColor:"black",rectangleDomainOpacity:.6,minSquareSize:"none"}},{type:"horizontal-1d-annotations",datatype:["nothing"],local:!1,orientation:"1d-horizontal",name:"Horizontal 1D Annotations",thumbnail:null,availableOptions:["fill","fillOpacity","stroke","strokeOpacity","strokeWidth","strokePos","regions"],defaultOptions:{fill:"red",fillOpacity:.2,stroke:"red",strokeOpacity:0,strokeWidth:1,regions:[],strokePos:[]}},{type:"vertical-1d-annotations",datatype:["nothing"],local:!1,orientation:"1d-vertical",name:"Vertical 1D Annotations",thumbnail:null,availableOptions:["fill","fillOpacity","stroke","strokeOpacity","regions"],defaultOptions:{fill:"red",fillOpacity:"0.2",stroke:"red",strokeOpacity:"0",regions:[]}},{type:"2d-annotations",datatype:["2d-annotations"],local:!1,orientation:"2d",name:"2D Annotations",thumbnail:Ou,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundOpacity","trackBorderWidth","trackBorderColor","rectangleDomainFillColor","rectangleDomainStrokeColor","rectangleDomainOpacity","minSquareSize","isClickable","hoverColor","selectColor","exclude","trackBorderBgWidth","trackBorderBgColor","trackBorderBgAlpha"],defaultOptions:{labelColor:"black",labelPosition:"hidden",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,trackBorderWidth:0,trackBorderColor:"black",rectangleDomainFillColor:"grey",rectangleDomainStrokeColor:"black",rectangleDomainOpacity:.6,minSquareSize:"none",isClickable:!1,hoverColor:"orange",selectColor:"fuchsia",exclude:[],trackBorderBgWidth:0,trackBorderBgColor:"black",trackBorderBgAlpha:.33}},{type:"square-markers",datatype:["bedpe"],local:!1,orientation:"2d",name:"Square Markers",thumbnail:Ou,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor"],defaultOptions:{labelColor:"black",labelPosition:"hidden",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,trackBorderWidth:0,trackBorderColor:"black"}},{type:"combined",datatype:"any",local:!0,orientation:"any"},{type:"horizontal-chromosome-grid",datatype:["chromsizes"],local:!1,orientation:"1d-horizontal",name:"Chromosome Grid",chromInfoPath:"//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv",thumbnail:null,availableOptions:["lineStrokeWidth","lineStrokeColor","showMousePosition"],defaultOptions:{lineStrokeWidth:1,lineStrokeColor:"grey",showMousePosition:!1}},{type:"vertical-chromosome-grid",datatype:["chromsizes"],local:!1,orientation:"1d-vertical",name:"Chromosome Grid",chromInfoPath:"//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv",thumbnail:null,availableOptions:["lineStrokeWidth","lineStrokeColor","showMousePosition"],defaultOptions:{lineStrokeWidth:1,lineStrokeColor:"grey",showMousePosition:!1}},{type:"2d-chromosome-grid",datatype:["chromsizes"],local:!1,orientation:"2d",name:"Chromosome Grid",chromInfoPath:"//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv",thumbnail:null,availableOptions:["lineStrokeWidth","lineStrokeColor"],defaultOptions:{lineStrokeWidth:1,lineStrokeColor:"grey"}},{type:"2d-chromosome-annotations",datatype:["chromsizes"],local:!0,orientation:"2d",name:"2D Chromosome Annotations",thumbnail:null,hidden:!0},{type:"2d-chromosome-labels",datatype:["chromsizes"],local:!0,orientation:"2d",name:"Pairwise Chromosome Labels",thumbnail:null},{type:"chromosome-labels",aliases:["horizontal-chromosome-labels","vertical-chromosome-labels"],datatype:["chromsizes"],orientation:"1d-horizontal",rotatable:!0,minHeight:35,defaultHeight:30,name:"Chromosome Axis",thumbnail:null,availableOptions:["color","stroke","fontSize","fontIsLeftAligned","showMousePosition","mousePositionColor","tickPositions","tickFormat","reverseOrientation"],defaultOptions:{color:"#808080",stroke:"#ffffff",fontSize:12,fontIsLeftAligned:!1,showMousePosition:!1,mousePositionColor:"#000000",reverseOrientation:!1},defaultOptionsByTheme:{[Qt]:{color:"#808080",stroke:"#000000",mousePositionColor:"#ffffff"}}},{type:"vertical-1d-tiles",datatype:["1d-tiles"],local:!1,orientation:"1d-vertical",name:"Vertical 1D Tile Outlines",thumbnail:RX},{type:"horizontal-1d-tiles",datatype:["vector","stacked-interval","gene-annotation"],local:!1,orientation:"1d-horizontal",name:"Horizontal 1D Tile Outlines",thumbnail:IX},{type:"osm-2d-tile-ids",datatype:["map-tiles"],local:!1,orientation:"2d",name:"OSM Tile Outlines",thumbnail:G4,availableOptions:["minPos","maxPos","maxZoom","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","name"],defaultOptions:{minPos:-180,maxPos:180,maxZoom:19,labelPosition:"bottomRight",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0}},{type:"raster-tiles",datatype:["map-tiles"],local:!0,orientation:"2d",hidden:!0,name:"Raster Tiles",thumbnail:f0,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","name"],defaultOptions:{labelPosition:"bottomRight",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0}},{type:"image-tiles",datatype:["image-tiles"],local:!0,orientation:"2d",hidden:!0,name:"Image Tiles",thumbnail:null},{type:"bedlike",datatype:["bedlike"],aliases:["vertical-bedlike"],local:!1,orientation:"1d-horizontal",rotatable:!0,name:"BED-like track",thumbnail:null,availableOptions:["alternating","annotationHeight","annotationStyle","fillColor","fillOpacity","fontColor","fontSize","minusStrandColor","plusStrandColor","labelBottomMargin","labelColor","labelLeftMargin","labelPosition","labelRightMargin","labelTopMargin","labelTextOpacity","labelBackgroundOpacity","maxAnnotationHeight","minHeight","trackBorderWidth","trackBorderColor","valueColumn","colorEncoding","colorRange","colorEncodingRange","separatePlusMinusStrands","showTexts","axisPositionHorizontal","axisMargin"],defaultOptions:{alternating:!1,annotationStyle:"box",fillColor:"blue",fillOpacity:.3,fontSize:"10",axisPositionHorizontal:"right",labelColor:"black",labelPosition:"hidden",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,minHeight:20,maxAnnotationHeight:null,trackBorderWidth:0,trackBorderColor:"black",valueColumn:null,colorEncoding:"itemRgb",showTexts:!1,colorRange:["#000000","#652537","#bf5458","#fba273","#ffffe0"],colorEncodingRange:!1,separatePlusMinusStrands:!0,annotationHeight:16}},{type:"empty",datatype:[],orientation:"1d-horizontal",name:"Empty track",thumbnail:null,availableOptions:[],defaultOptions:{}}],h0=e=>{const t={},n=r=>!!(r.orientation===e||e==="1d-vertical"&&r.orientation==="1d-horizontal"&&r.rotatable);return xa.filter(n).forEach(r=>{let i=r.datatype;Array.isArray(r.datatype)||(i=[i]),i.forEach(o=>{o in t||(t[o]=[]),t[o].push(r)})}),t.none=[],t},Is=[[0,0,0,255],[35,0,0,255],[52,0,0,255],[60,0,0,255],[63,1,0,255],[64,2,0,255],[68,5,0,255],[69,6,0,255],[72,8,0,255],[74,10,0,255],[77,12,0,255],[78,14,0,255],[81,16,0,255],[83,17,0,255],[85,19,0,255],[86,20,0,255],[89,22,0,255],[91,24,0,255],[92,25,0,255],[94,26,0,255],[95,28,0,255],[98,30,0,255],[100,31,0,255],[102,33,0,255],[103,34,0,255],[105,35,0,255],[106,36,0,255],[108,38,0,255],[109,39,0,255],[111,40,0,255],[112,42,0,255],[114,43,0,255],[115,44,0,255],[117,45,0,255],[119,47,0,255],[119,47,0,255],[120,48,0,255],[122,49,0,255],[123,51,0,255],[125,52,0,255],[125,52,0,255],[126,53,0,255],[128,54,0,255],[129,56,0,255],[129,56,0,255],[131,57,0,255],[132,58,0,255],[134,59,0,255],[134,59,0,255],[136,61,0,255],[137,62,0,255],[137,62,0,255],[139,63,0,255],[139,63,0,255],[140,65,0,255],[142,66,0,255],[142,66,0,255],[143,67,0,255],[143,67,0,255],[145,68,0,255],[145,68,0,255],[146,70,0,255],[146,70,0,255],[148,71,0,255],[148,71,0,255],[149,72,0,255],[149,72,0,255],[151,73,0,255],[151,73,0,255],[153,75,0,255],[153,75,0,255],[154,76,0,255],[154,76,0,255],[154,76,0,255],[156,77,0,255],[156,77,0,255],[157,79,0,255],[157,79,0,255],[159,80,0,255],[159,80,0,255],[159,80,0,255],[160,81,0,255],[160,81,0,255],[162,82,0,255],[162,82,0,255],[163,84,0,255],[163,84,0,255],[165,85,0,255],[165,85,0,255],[166,86,0,255],[166,86,0,255],[166,86,0,255],[168,87,0,255],[168,87,0,255],[170,89,0,255],[170,89,0,255],[171,90,0,255],[171,90,0,255],[173,91,0,255],[173,91,0,255],[174,93,0,255],[174,93,0,255],[176,94,0,255],[176,94,0,255],[177,95,0,255],[177,95,0,255],[179,96,0,255],[179,96,0,255],[180,98,0,255],[182,99,0,255],[182,99,0,255],[183,100,0,255],[183,100,0,255],[185,102,0,255],[185,102,0,255],[187,103,0,255],[187,103,0,255],[188,104,0,255],[188,104,0,255],[190,105,0,255],[191,107,0,255],[191,107,0,255],[193,108,0,255],[193,108,0,255],[194,109,0,255],[196,110,0,255],[196,110,0,255],[197,112,0,255],[197,112,0,255],[199,113,0,255],[200,114,0,255],[200,114,0,255],[202,116,0,255],[202,116,0,255],[204,117,0,255],[205,118,0,255],[205,118,0,255],[207,119,0,255],[208,121,0,255],[208,121,0,255],[210,122,0,255],[211,123,0,255],[211,123,0,255],[213,124,0,255],[214,126,0,255],[214,126,0,255],[216,127,0,255],[217,128,0,255],[217,128,0,255],[219,130,0,255],[221,131,0,255],[221,131,0,255],[222,132,0,255],[224,133,0,255],[224,133,0,255],[225,135,0,255],[227,136,0,255],[227,136,0,255],[228,137,0,255],[230,138,0,255],[230,138,0,255],[231,140,0,255],[233,141,0,255],[233,141,0,255],[234,142,0,255],[236,144,0,255],[236,144,0,255],[238,145,0,255],[239,146,0,255],[241,147,0,255],[241,147,0,255],[242,149,0,255],[244,150,0,255],[244,150,0,255],[245,151,0,255],[247,153,0,255],[247,153,0,255],[248,154,0,255],[250,155,0,255],[251,156,0,255],[251,156,0,255],[253,158,0,255],[255,159,0,255],[255,159,0,255],[255,160,0,255],[255,161,0,255],[255,163,0,255],[255,163,0,255],[255,164,0,255],[255,165,0,255],[255,167,0,255],[255,167,0,255],[255,168,0,255],[255,169,0,255],[255,169,0,255],[255,170,0,255],[255,172,0,255],[255,173,0,255],[255,173,0,255],[255,174,0,255],[255,175,0,255],[255,177,0,255],[255,178,0,255],[255,179,0,255],[255,181,0,255],[255,181,0,255],[255,182,0,255],[255,183,0,255],[255,184,0,255],[255,187,7,255],[255,188,10,255],[255,189,14,255],[255,191,18,255],[255,192,21,255],[255,193,25,255],[255,195,29,255],[255,197,36,255],[255,198,40,255],[255,200,43,255],[255,202,51,255],[255,204,54,255],[255,206,61,255],[255,207,65,255],[255,210,72,255],[255,211,76,255],[255,214,83,255],[255,216,91,255],[255,219,98,255],[255,221,105,255],[255,223,109,255],[255,225,116,255],[255,228,123,255],[255,232,134,255],[255,234,142,255],[255,237,149,255],[255,239,156,255],[255,240,160,255],[255,243,167,255],[255,246,174,255],[255,248,182,255],[255,249,185,255],[255,252,193,255],[255,253,196,255],[255,255,204,255],[255,255,207,255],[255,255,211,255],[255,255,218,255],[255,255,222,255],[255,255,225,255],[255,255,229,255],[255,255,233,255],[255,255,236,255],[255,255,240,255],[255,255,244,255],[255,255,247,255],[255,255,255,0]],Gt=xa.reduce((e,t)=>{if(e[t.type]=t,t.aliases)for(const n of t.aliases)e[n]=t;return e},{}),DX=xa.reduce((e,t)=>{for(let n=0;n<t.datatype.length;n++){const r=t.datatype[n];return e[r]?e[r].add(t.orientation):e[r]=new Set,e}return{}},{}),Ca={chromsizes:{center:"2d-chromosome-grid",top:"chromosome-labels",left:"chromosome-labels",bottom:"chromosome-labels",right:"chromosome-labels"},matrix:{center:"heatmap",top:"linear-heatmap",left:"linear-heatmap",right:"linear-heatmap",bottom:"linear-heatmap"},vector:{top:"bar",bottom:"bar",left:"bar",right:"bar"},"geo-json":{center:"geo-json"},"gene-annotation":{top:"gene-annotations",bottom:"gene-annotations",left:"gene-annotations",right:"gene-annotations"},bedlike:{top:"bedlike",bottom:"bedlike",left:"vertical-bedlike",right:"vertical-bedlike"}},Rp=(e,t)=>{const n=h0(t);let r=new Set(Object.values(n).flat());for(const i of e){const o=new Set(i);r=new Set([...r].filter(a=>a.datatype.filter(s=>o.has(s)).length>0))}return[...r]},J4=8,p0=8,d0="default",Dp="bounded",Np="overflow",Rs="bounded-overflow",Oa="scroll",NX=Object.freeze(Object.defineProperty({__proto__:null,AVAILABLE_TRACK_TYPES:Rp,DATATYPE_TO_TRACK_TYPE:h0,DEFAULT_CONTAINER_PADDING_X:$4,DEFAULT_CONTAINER_PADDING_Y:j4,DEFAULT_SERVER:u0,DEFAULT_TRACKS_FOR_DATATYPE:Ca,DEFAULT_VIEW_MARGIN:Su,DEFAULT_VIEW_PADDING:Eu,GLOBALS:Ye,HEATED_OBJECT_MAP:Is,LOCATION_LISTENER_PREFIX:Cu,LONG_DRAG_TIMEOUT:xu,MAX_CLICK_DELAY:kX,MIN_HORIZONTAL_HEIGHT:q4,MIN_VERTICAL_WIDTH:U4,MOUSE_TOOL_MOVE:Pp,MOUSE_TOOL_SELECT:Xn,MOUSE_TOOL_TRACK_SELECT:ku,NUM_PRECOMP_SUBSETS_PER_1D_TTILE:J4,NUM_PRECOMP_SUBSETS_PER_2D_TTILE:p0,POSITIONS_BY_DATATYPE:DX,SHORT_DRAG_TIMEOUT:B4,SIZE_MODE_BOUNDED:Dp,SIZE_MODE_BOUNDED_OVERFLOW:Rs,SIZE_MODE_DEFAULT:d0,SIZE_MODE_OVERFLOW:Np,SIZE_MODE_SCROLL:Oa,THEME_DARK:Qt,THEME_DEFAULT:V4,THEME_LIGHT:Ip,TILE_FETCH_DEBOUNCE:c0,TRACKS_INFO:xa,TRACKS_INFO_BY_TYPE:Gt,TRACK_LOCATIONS:Mp,VIEW_HEADER_MED_WIDTH_SEARCH_BAR:H4,VIEW_HEADER_MIN_WIDTH_SEARCH_BAR:F4,ZOOM_DEBOUNCE:Ap,ZOOM_TRANSITION_DURATION:z4},Symbol.toStringTag,{value:"Module"})),eA=e=>{const t=["top","bottom","gallery"],n=["left","right","gallery"];return e.center??=[],e.left??=[],e.right??=[],e.top??=[],e.bottom??=[],e.whole??=[],e.gallery??=[],t.map(r=>e[r]).forEach(r=>(r??[]).forEach(i=>{const o=Gt[i.type],a=o?.defaultOptions||{},s=i.options?{...a,...i.options}:a;s.minHeight!==void 0&&i.height===void 0&&(i.height=s.minHeight),i.height===void 0&&(i.height=o?.defaultHeight||q4)})),n.map(r=>e[r]).forEach(r=>(r??[]).forEach(i=>{const o=Gt[i.type],a=o?.defaultOptions||{},s=i.options?{...a,...i.options}:a;s.minWidth!==void 0&&i.width===void 0&&(i.width=s.minWidth),i.width===void 0&&(i.width=o?.defaultWidth||U4)})),e},tA=(e,t)=>n=>n.reduce(e,t),LX=tA((e,t)=>e.concat(t),[]),$X=e=>t=>Array.prototype.forEach.call(t,e),Lp=(e,t)=>{t.dispatchEvent(D4(e))},jX=(e,t)=>[Tu(e[0],e[1],t),Tu(e[2],e[3],t)];function BX(e,t,n,r,i){const{chr:o,pos:a}=t,{chr:s,pos:c}=n,l=[];if(o===s){const u=o,f=Math.floor(a/r),h=Math.min(f+i,Math.ceil(c/r));l.push([u,f,h])}else{let u=i;const f=e.findIndex(([p])=>p===o),h=e.findIndex(([p])=>p===s);for(let p=f;p<=h;p++){let d,g;const[y,b]=e[p];p<h?(p===f?d=a:d=0,g=b):(d=0,g=c);const m=Math.floor(d/r),v=Math.min(m+u,Math.ceil(g/r));l.push([y,m,v]),u-=v-m}}return l}function zX(e,t){return Ca[e]!==void 0?Ca[e][t]:void 0}const g0=(e,t,n)=>{if(n.length===0)return;if(n.length===1)return n[0];let r=n[0];const i=zX(e,t);return i!==void 0&&(r=n.find(o=>o.type===i)||r),r},m0=e=>(L7.listen(),[e.clientWidth,e.clientHeight]),rn=(e,t)=>{let n=null;const r=i=>(i.uid===t&&(n=i),i.type.substr(0,8)==="combined"&&i.contents.forEach(r),null);return Object.keys(e).map(i=>e[i]).filter(i=>i.filter).reduce((i,o)=>i.concat(o),[]).forEach(r),n},HX=(e,t,n)=>{const i=e.state.views[t];if(!i)return null;let o=null;const a=c=>(c.uid===n&&(o=c),c.type.substr(0,8)==="combined"&&c.contents.forEach(a),null),s=i.tracks;return Object.keys(s).map(c=>s[c]).filter(c=>c.filter).reduce((c,l)=>c.concat(l),[]).forEach(a),o},Ds=(e,t,n)=>{const r=t?e[t]:Object.values(e)[0];if(!r){console.warn(t?`Could't find view with id "${t}"`:"No views available.");return}let i=r.trackRenderer.trackDefObjects[n];return i?i=i.trackObject:Object.values(r.trackRenderer.trackDefObjects).map(o=>o.trackObject).filter(o=>o.childTracks).forEach(o=>{o.createdTracks[n]&&(i=o.createdTracks[n])}),i};function Pu(e){return"contents"in e&&e.type==="combined"}function FX(e){return"deltaY"in e&&"deltaMode"in e}function $p(e){return e!==null&&typeof e=="object"}function jp(e){return $p(e)&&"max_width"in e}function Au(e){return $p(e)&&"resolutions"in e}function qX(e){return $p(e)&&!("error"in e)}const v0=(e,t,n=!0,r=null)=>e.forEach(i=>{n&&Pu(i)&&v0(i.contents,t,n,r),t(i,r)}),oo=(e,t,n=!0)=>{const r=[];for(const[i,o]of Object.entries(e))v0(o,t,n,i),r.push(...o);return r},Mu=(e,t)=>{let n=null;return oo(e,(r,i)=>{r.uid===t&&(n=i)}),n},y0=e=>t=>Array.prototype.map.call(t,e),rA=()=>[window,y0(e=>e.charCodeAt(0))("2.3.1").map(e=>e<=999?`00${e}`.slice(-3):e).join("")],nA=(e,t=1,n=100,r=0,i=0,o=0,a=100)=>{const s=document.createElement("canvas");s.width=t,s.height=n;const c=s.getContext("2d");if(!c)throw new Error("Could not get canvas context");const l=c.createLinearGradient(r,i,o,a);return e.forEach(u=>{l.addColorStop(u.from,u.color)}),c.fillStyle=l,c.fillRect(0,0,t,n),s},iA=(e,t)=>{let n=e;for(;n&&n!==t&&n.tagName!=="HTML";)n=n.parentNode;return n===t},oA=e=>Number.parseInt(e.replace(/^#/,""),16),aA=()=>{};function UX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VX(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,WX(r.key),r)}}function GX(e,t,n){return t&&VX(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function WX(e){var t=YX(e,"string");return typeof t=="symbol"?t:t+""}function YX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}let b0=function(){function e(t){UX(this,e),this.context=t;const{tracks:n,createTrackObject:r}=t;this.childTracks=n.map(r),this.createdTracks={},this.uid=Mt.nice(),this.childTracks.forEach((i,o)=>{this.createdTracks[n[o].uid]=i});for(let i=0;i<this.childTracks.length;i++)this.childTracks[i]||console.error("Empty child track in CombinedTrack:",this)}return GX(e,[{key:"updateContents",value:function(n,r){const i=[],o=new Set;n.forEach(c=>{if(o.add(c.uid),c.uid in this.createdTracks)i.push(this.createdTracks[c.uid]);else{const l=r(c);l.setPosition(this.position),l.setDimensions(this.dimensions),i.push(l),l.zoomed(this._xScale,this._yScale),this.createdTracks[c.uid]=l}}),this.childTracks=i;const a=new Set(Object.keys(this.createdTracks));return[...new Set([...a].filter(c=>!o.has(c)))].forEach(c=>{this.createdTracks[c].remove(),delete this.createdTracks[c]}),this}},{key:"setPosition",value:function(n){this.position=n;for(let r=0;r<this.childTracks.length;r++)this.childTracks[r].setPosition(n)}},{key:"setDimensions",value:function(n){this.dimensions=n;for(let r=0;r<this.childTracks.length;r++)this.childTracks[r].setDimensions(n)}},{key:"zoomed",value:function(n,r,i,o,a,s,c){this._xScale=n,this._yScale=r;for(let l=0;l<this.childTracks.length;l++)this.childTracks[l].zoomed(n,r,i,o,a,s,c)}},{key:"clickOutside",value:function(){for(let n=0;n<this.childTracks.length;n++)this.childTracks[n].clickOutside()}},{key:"click",value:function(...n){for(let r=0;r<this.childTracks.length;r++)this.childTracks[r].click(...n)}},{key:"draw",value:function(){}},{key:"refScalesChanged",value:function(n,r){for(let i=0;i<this.childTracks.length;i++)this.childTracks[i].refScalesChanged(n,r)}},{key:"remove",value:function(){for(let n=0;n<this.childTracks.length;n++)this.childTracks[n].remove()}},{key:"exportSVG",value:function(){const n=document.createElement("g");for(const r of this.childTracks)r.exportSVG&&n.appendChild(r.exportSVG()[0]);return[n,n]}},{key:"rerender",value:function(n){}},{key:"minValue",value:function(n){if(arguments.length===0){const r=this.childTracks.filter(i=>i.minValue).map(i=>i.minValue()).filter(i=>i);return Math.min(...r)}for(const r of this.childTracks)r.minValue&&r.minValue(n)}},{key:"maxValue",value:function(n){if(arguments.length===0){const r=this.childTracks.filter(i=>i.maxValue).map(i=>i.maxValue()).filter(i=>i);return Math.max(...r)}for(const r of this.childTracks)r.maxValue&&r.maxValue(n)}},{key:"respondsToPosition",value:function(n,r){return n>=this.position[0]&&n<=this.dimensions[0]+this.position[0]&&r>=this.position[1]&&r<=this.dimensions[1]+this.position[1]}},{key:"stopHover",value:function(){for(const n of this.childTracks)n.stopHover&&n.stopHover()}},{key:"getMouseOverHtml",value:function(n,r){let i="";for(const o of this.childTracks)if(o.getMouseOverHtml){const a=o.getMouseOverHtml(n,r);a?.length&&(i+=a,i+="<br/>")}return i}},{key:"getMouseOverUids",value:function(n,r){const i=[];for(const o of this.childTracks)if(o.getMouseOverUids){const a=o.getMouseOverUids(n,r);a&&i.push(...a)}return i}}])}();const sA=(e,t)=>t===e?!0:t instanceof b0?Object.keys(t.createdTracks).map(n=>t.createdTracks[n]).some(n=>sA(e,n)):!1,_0=(e,t,n,r,i,o,a=!1)=>a?e>=n&&e<=r||t>=i&&t<=o:e>=n&&e<=r&&t>=i&&t<=o,XX=e=>Math.log(Math.tan((e+Math.PI/2)/2)),KX=(e,t)=>{let n=e*Math.PI/180;return n=XX(n),2**t*(Math.PI-n)/(2*Math.PI)},Bp=e=>y0(t=>e[t])(Object.keys(e)),ZX=e=>Bp(e).map(t=>t.chromInfoPath).forEach(t=>a0.get(t)),QX=(e,t)=>2**t*(e+180)/360,T0=(e,t)=>e>t?e:t,lA=1e-7;function w0(e){let t=Number.MIN_SAFE_INTEGER;for(let n=0;n<e.length;n++){const r=e[n];r<lA&&r>-lA||r>t&&(t=r)}return t}const cA=(e,t)=>e<t?e:t,uA=1e-7;function S0(e){let t=Number.MAX_SAFE_INTEGER;for(let n=0;n<e.length;n++){const r=e[n];r<uA&&r>-uA||r<t&&(t=r)}return t}const JX=(e,t)=>(e%t+t)%t,fA=(e,t)=>{const n=+t;if(!Number.isNaN(n))if(e.dimension===1)for(let i=0;i<e.shape[0];++i)e.set(i,n);else for(let i=0;i<e.shape[0];++i)for(let o=0;o<e.shape[1];++o)e.set(i,o,n);else{const i=e.shape[0],o=e.shape[1],a=t.shape[0],s=t.shape[1];if(i!==a||o!==s){console.warn("Cannot assign source to target ndarray as the dimensions do not match",i,a,o,s);return}if(e.dimension===1)for(let c=0;c<e.shape[0];++c)e.set(c,t.get(c));else for(let c=0;c<e.shape[0];++c)for(let l=0;l<e.shape[1];++l)e.set(c,l,t.get(c,l))}};var E0,hA;function eK(){if(hA)return E0;hA=1;function e(t){for(var n=new Array(t),r=0;r<t;++r)n[r]=r;return n}return E0=e,E0}var k0,pA;function tK(){if(pA)return k0;pA=1,k0=function(n){return n!=null&&(e(n)||t(n)||!!n._isBuffer)};function e(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function t(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&e(n.slice(0,0))}return k0}var x0,dA;function rK(){if(dA)return x0;dA=1;var e=eK(),t=tK(),n=typeof Float64Array<"u";function r(l,u){return l[0]-u[0]}function i(){var l=this.stride,u=new Array(l.length),f;for(f=0;f<u.length;++f)u[f]=[Math.abs(l[f]),f];u.sort(r);var h=new Array(u.length);for(f=0;f<h.length;++f)h[f]=u[f][1];return h}function o(l,u){var f=["View",u,"d",l].join("");u<0&&(f="View_Nil"+l);var h=l==="generic";if(u===-1){var p="function "+f+"(a){this.data=a;}; var proto="+f+".prototype; proto.dtype='"+l+"'; proto.index=function(){return -1}; proto.size=0; proto.dimension=-1; proto.shape=proto.stride=proto.order=[]; proto.lo=proto.hi=proto.transpose=proto.step= function(){return new "+f+"(this.data);}; proto.get=proto.set=function(){}; proto.pick=function(){return null}; return function construct_"+f+"(a){return new "+f+"(a);}",k=new Function(p);return k()}else if(u===0){var p="function "+f+"(a,d) { this.data = a; this.offset = d }; var proto="+f+".prototype; proto.dtype='"+l+"'; proto.index=function(){return this.offset}; proto.dimension=0; proto.size=1; proto.shape= proto.stride= proto.order=[]; proto.lo= proto.hi= proto.transpose= proto.step=function "+f+"_copy() { return new "+f+"(this.data,this.offset) }; proto.pick=function "+f+"_pick(){ return TrivialArray(this.data); }; proto.valueOf=proto.get=function "+f+"_get(){ return "+(h?"this.data.get(this.offset)":"this.data[this.offset]")+"}; proto.set=function "+f+"_set(v){ return "+(h?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+" }; return function construct_"+f+"(a,b,c,d){return new "+f+"(a,d)}",k=new Function("TrivialArray",p);return k(s[l][0])}var p=["'use strict'"],d=e(u),g=d.map(function(E){return"i"+E}),y="this.offset+"+d.map(function(E){return"this.stride["+E+"]*i"+E}).join("+"),b=d.map(function(E){return"b"+E}).join(","),m=d.map(function(E){return"c"+E}).join(",");p.push("function "+f+"(a,"+b+","+m+",d){this.data=a","this.shape=["+b+"]","this.stride=["+m+"]","this.offset=d|0}","var proto="+f+".prototype","proto.dtype='"+l+"'","proto.dimension="+u),p.push("Object.defineProperty(proto,'size',{get:function "+f+"_size(){ return "+d.map(function(E){return"this.shape["+E+"]"}).join("*"),"}})"),u===1?p.push("proto.order=[0]"):(p.push("Object.defineProperty(proto,'order',{get:"),u<4?(p.push("function "+f+"_order(){"),u===2?p.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):u===3&&p.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]); if(s0>s1){ if(s1>s2){ return [2,1,0]; }else if(s0>s2){ return [1,2,0]; }else{ return [1,0,2]; } }else if(s0>s2){ return [2,0,1]; }else if(s2>s1){ return [0,1,2]; }else{ return [0,2,1]; }}})")):p.push("ORDER})")),p.push("proto.set=function "+f+"_set("+g.join(",")+",v){"),h?p.push("return this.data.set("+y+",v)}"):p.push("return this.data["+y+"]=v}"),p.push("proto.get=function "+f+"_get("+g.join(",")+"){"),h?p.push("return this.data.get("+y+")}"):p.push("return this.data["+y+"]}"),p.push("proto.index=function "+f+"_index(",g.join(),"){return "+y+"}"),p.push("proto.hi=function "+f+"_hi("+g.join(",")+"){return new "+f+"(this.data,"+d.map(function(E){return["(typeof i",E,"!=='number'||i",E,"<0)?this.shape[",E,"]:i",E,"|0"].join("")}).join(",")+","+d.map(function(E){return"this.stride["+E+"]"}).join(",")+",this.offset)}");var v=d.map(function(E){return"a"+E+"=this.shape["+E+"]"}),_=d.map(function(E){return"c"+E+"=this.stride["+E+"]"});p.push("proto.lo=function "+f+"_lo("+g.join(",")+"){var b=this.offset,d=0,"+v.join(",")+","+_.join(","));for(var T=0;T<u;++T)p.push("if(typeof i"+T+"==='number'&&i"+T+">=0){ d=i"+T+"|0; b+=c"+T+"*d; a"+T+"-=d}");p.push("return new "+f+"(this.data,"+d.map(function(E){return"a"+E}).join(",")+","+d.map(function(E){return"c"+E}).join(",")+",b)}"),p.push("proto.step=function "+f+"_step("+g.join(",")+"){var "+d.map(function(E){return"a"+E+"=this.shape["+E+"]"}).join(",")+","+d.map(function(E){return"b"+E+"=this.stride["+E+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var T=0;T<u;++T)p.push("if(typeof i"+T+"==='number'){ d=i"+T+"|0; if(d<0){ c+=b"+T+"*(a"+T+"-1); a"+T+"=ceil(-a"+T+"/d) }else{ a"+T+"=ceil(a"+T+"/d) } b"+T+"*=d }");p.push("return new "+f+"(this.data,"+d.map(function(E){return"a"+E}).join(",")+","+d.map(function(E){return"b"+E}).join(",")+",c)}");for(var w=new Array(u),S=new Array(u),T=0;T<u;++T)w[T]="a[i"+T+"]",S[T]="b[i"+T+"]";p.push("proto.transpose=function "+f+"_transpose("+g+"){"+g.map(function(E,P){return E+"=("+E+"===undefined?"+P+":"+E+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+f+"(this.data,"+w.join(",")+","+S.join(",")+",this.offset)}"),p.push("proto.pick=function "+f+"_pick("+g+"){var a=[],b=[],c=this.offset");for(var T=0;T<u;++T)p.push("if(typeof i"+T+"==='number'&&i"+T+">=0){c=(c+this.stride["+T+"]*i"+T+")|0}else{a.push(this.shape["+T+"]);b.push(this.stride["+T+"])}");p.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),p.push("return function construct_"+f+"(data,shape,stride,offset){return new "+f+"(data,"+d.map(function(E){return"shape["+E+"]"}).join(",")+","+d.map(function(E){return"stride["+E+"]"}).join(",")+",offset)}");var k=new Function("CTOR_LIST","ORDER",p.join(`
167
+ `,"text/xml").documentElement;function K4({theStyle:e,onClick:t}){return x.createElement("svg",{className:Kn[e],viewBox:"0 0 12 13",onClick:t,xmlns:"http://www.w3.org/2000/svg"},x.createElement("title",null,"Search"),x.createElement("g",{fill:"none",stroke:"#6c6c6c",strokeWidth:"2"},x.createElement("path",{d:"M11.29 11.71l-4-4"}),x.createElement("circle",{cx:"5",cy:"5",r:"4"})))}K4.propTypes={theStyle:q.string,onClick:q.func};const Z4={type:"osm-tiles",datatype:["map-tiles"],local:!0,orientation:"2d",hidden:!0,name:"OSM Tiles",thumbnail:f0,availableOptions:["minPos","maxPos","maxZoom","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","name"],defaultOptions:{minPos:-180,maxPos:180,maxZoom:19,labelPosition:"bottomRight",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0}},Q4={type:"mapbox-tiles",datatype:["map-tiles"],local:!0,orientation:"2d",hidden:!0,name:"Mapbox Tiles",thumbnail:f0,availableOptions:["style","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","name"],defaultOptions:{style:"mapbox.streets",labelPosition:"bottomRight",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0}},xa=[Z4,{...Z4,type:"osm"},Q4,{...Q4,type:"mapbox"},{type:"left-axis",datatype:["axis"],local:!0,orientation:"1d-vertical",name:"Left Axis",thumbnail:AX,availableOptions:["minWidth","reverseAxis"],defaultOptions:{minWidth:100,reverseAxis:!1}},{type:"top-axis",datatype:["axis"],local:!0,orientation:"1d-horizontal",name:"Top Axis",thumbnail:PX,defaultOptions:{}},{type:"horizontal-rule",datatype:["x-coord"],local:!0,orientation:"whole",name:"Horizontal Rule",thumbnail:null,availableOptions:["color"],defaultOptions:{color:"black"}},{type:"vertical-rule",datatype:["y-coord"],local:!0,orientation:"whole",name:"Vertical Rule",thumbnail:null,availableOptions:["color"],defaultOptions:{color:"black"}},{type:"cross-rule",datatype:["xy-coord"],local:!0,orientation:"whole",name:"Cross Rule",thumbnail:null,availableOptions:["color"],defaultOptions:{color:"black"}},{type:"simple-svg",datatype:[],local:!1,orientation:"2d",exportable:!0,availableOptions:["minWidth","minHeight"],defaultOptions:{minWidth:100,minHeight:100}},{type:"heatmap",datatype:["matrix"],local:!1,orientation:"2d",thumbnail:W4,exportable:!0,availableOptions:["backgroundColor","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundOpacity","colorRange","colorbarBackgroundColor","maxZoom","minWidth","minHeight","dataTransform","colorbarPosition","trackBorderWidth","trackBorderColor","heatmapValueScaling","showMousePosition","mousePositionColor","showTooltip","extent","zeroValueColor"],defaultOptions:{backgroundColor:"#eeeeee",labelPosition:"bottomRight",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!0,labelShowAssembly:!0,colorRange:["white","rgba(245,166,35,1.0)","rgba(208,2,27,1.0)","black"],colorbarBackgroundColor:"#ffffff",maxZoom:null,minWidth:100,minHeight:100,colorbarPosition:"topRight",trackBorderWidth:0,trackBorderColor:"black",heatmapValueScaling:"log",showMousePosition:!1,mousePositionColor:"#000000",showTooltip:!1,extent:"full",zeroValueColor:null},defaultOptionsByTheme:{[Qt]:{backgroundColor:"#000000",colorRange:["black","rgba(208,2,27,1.0)","rgba(245,166,35,1.0)","white"],colorbarBackgroundColor:"#000000",labelColor:"#ffffff",labelBackgroundColor:"#000000",trackBorderColor:"#ffffff",mousePositionColor:"#ffffff"}}},{type:"linear-heatmap",aliases:["horizontal-heatmap","vertical-heatmap"],datatype:["matrix"],local:!1,orientation:"1d-horizontal",rotatable:!0,thumbnail:W4,defaultOptions:{backgroundColor:"#eeeeee",labelPosition:"bottomRight",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!0,labelShowAssembly:!0,labelColor:"black",colorRange:["white","rgba(245,166,35,1.0)","rgba(208,2,27,1.0)","black"],maxZoom:null,minWidth:100,minHeight:40,trackBorderWidth:0,trackBorderColor:"black"},availableOptions:["backgroundColor","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundOpacity","colorRange","maxZoom","minWidth","minHeight","dataTransform","oneDHeatmapFlipped","colorbarPosition","trackBorderWidth","trackBorderColor","heatmapValueScaling"]},{type:"line",aliases:["horizontal-line","vertical-line"],datatype:["vector"],local:!1,orientation:"1d-horizontal",rotatable:!0,thumbnail:OX,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundColor","labelBackgroundOpacity","axisLabelFormatting","axisPositionHorizontal","axisMargin","lineStrokeWidth","lineStrokeColor","valueScaling","valueScaleMin","valueScaleMax","trackBorderWidth","trackBorderColor","trackType","showMousePosition","showTooltip","mousePositionColor","aggregationMode","minHeight"],defaultOptions:{labelColor:"black",labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelBackgroundColor:"white",labelShowResolution:!1,labelShowAssembly:!0,axisLabelFormatting:"scientific",axisPositionHorizontal:"right",lineStrokeColor:"blue",lineStrokeWidth:1,valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",labelTextOpacity:.4,showMousePosition:!1,minHeight:20,mousePositionColor:"#000000",showTooltip:!1},defaultOptionsByTheme:{[Qt]:{labelColor:"#ffffff",labelBackgroundColor:"#000000",trackBorderColor:"#ffffff",mousePositionColor:"#ffffff"}}},{type:"1d-heatmap",aliases:["horizontal-1d-heatmap","vertical-1d-heatmap"],datatype:["vector"],local:!1,orientation:"1d-horizontal",rotatable:!0,thumbnail:CX,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundOpacity","axisPositionHorizontal","axisMargin","colorRange","valueScaling","trackBorderWidth","trackBorderColor","trackType","showMousePosition","showTooltip","mousePositionColor","aggregationMode"],defaultOptions:{labelColor:"black",labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!1,labelShowAssembly:!0,axisPositionHorizontal:"right",colorRange:["white","rgba(245,166,35,1.0)","rgba(208,2,27,1.0)","black"],valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",labelTextOpacity:.4,showMousePosition:!1,mousePositionColor:"#000000",showTooltip:!1}},{type:"vector-heatmap",aliases:["horizontal-vector-heatmap","vertical-vector-heatmap"],datatype:["vector"],local:!1,orientation:"1d-horizontal",rotatable:!0,minHeight:1,thumbnail:null,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","valueScaling","labelTextOpacity","labelBackgroundOpacity","colorRange","trackBorderWidth","trackBorderColor","trackType","heatmapValueScaling"],defaultOptions:{labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!1,labelShowAssembly:!0,labelColor:"black",labelTextOpacity:.4,valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",heatmapValueScaling:"log"}},{type:"multivec",aliases:["horizontal-multivec","vertical-multivec"],datatype:["multivec"],local:!1,orientation:"1d-horizontal",rotatable:!0,thumbnail:null,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","minHeight","valueScaling","labelTextOpacity","labelBackgroundOpacity","colorRange","trackBorderWidth","trackBorderColor","trackType","heatmapValueScaling","selectRows","selectRowsAggregationMode","selectRowsAggregationWithRelativeHeight","selectRowsAggregationMethod","colorbarBackgroundColor","colorbarPosition","zeroValueColor"],defaultOptions:{labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!0,labelShowAssembly:!0,labelColor:"black",labelTextOpacity:.4,minHeight:100,valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",heatmapValueScaling:"log",selectRows:null,selectRowsAggregationMode:"mean",selectRowsAggregationWithRelativeHeight:!0,selectRowsAggregationMethod:"client",colorbarBackgroundColor:"#ffffff",colorbarPosition:"topRight",zeroValueColor:null},defaultOptionsByTheme:{[Qt]:{colorbarBackgroundColor:"#000000"}}},{type:"point",aliases:["horizontal-point","vertical-point"],datatype:["vector"],local:!1,orientation:"1d-horizontal",rotatable:!0,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundOpacity","axisLabelFormatting","axisPositionHorizontal","axisMargin","pointColor","pointSize","valueScaling","trackBorderWidth","trackBorderColor"],defaultOptions:{labelColor:"black",labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!1,labelShowAssembly:!0,axisLabelFormatting:"scientific",axisPositionHorizontal:"right",pointColor:"red",pointSize:3,valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",labelTextOpacity:.4}},{type:"divergent-bar",aliases:["horizontal-divergent-bar","vertical-divergent-bar"],datatype:["vector"],local:!1,orientation:"1d-horizontal",rotatable:!0,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundOpacity","axisLabelFormatting","axisPositionHorizontal","axisMargin","barFillColorTop","barFillColorBottom","valueScaling","trackBorderWidth","trackBorderColor","barOpacity"],defaultOptions:{labelColor:"black",labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!1,labelShowAssembly:!0,axisPositionHorizontal:"right",axisLabelFormatting:"scientific",barFillColorBottom:"red",barFillColorTop:"green",valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",labelTextOpacity:.4,barOpacity:1}},{type:"bar",aliases:["horizontal-bar","vertical-bar"],datatype:["vector"],local:!1,orientation:"1d-horizontal",rotatable:!0,availableOptions:["align","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelShowResolution","labelShowAssembly","labelColor","labelTextOpacity","labelBackgroundOpacity","axisLabelFormatting","axisPositionHorizontal","axisMargin","barFillColor","colorRange","colorRangeGradient","valueScaling","valueScaleMin","valueScaleMax","trackBorderWidth","trackBorderColor","barOpacity","showMousePosition","showTooltip","aggregationMode","zeroLineVisible","zeroLineColor","zeroLineOpacity"],defaultOptions:{align:"bottom",labelColor:"[glyph-color]",labelPosition:"topLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,labelShowResolution:!1,labelShowAssembly:!0,axisLabelFormatting:"scientific",axisPositionHorizontal:"right",barFillColor:"darkgreen",valueScaling:"linear",trackBorderWidth:0,trackBorderColor:"black",labelTextOpacity:.4,barOpacity:1}},{type:"2d-tiles",datatype:["matrix"],local:!1,orientation:"2d",name:"2D Tile Outlines",thumbnail:G4},{type:"1d-value-interval",aliases:["horizontal-1d-value-interval","vertical-1d-value-interval"],datatype:["bed-value"],local:!1,orientation:"1d-horizontal",rotatable:!0,name:"1D Rectangles",availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundOpacity","axisPositionHorizontal","axisMargin"],defaultOptions:{labelColor:"black",labelPosition:"bottomLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,axisPositionHorizontal:"left",lineStrokeColor:"blue",valueScaling:"linear"}},{type:"stacked-interval",aliases:["top-stacked-interval","left-stacked-interval"],datatype:["stacked-interval"],local:!1,orientation:"1d-horizontal",rotatable:!0,thumbnail:"horizontal-stacked-interval.png",availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundOpacity"]},{type:"viewport-projection-vertical",datatype:["1d-projection"],local:!0,hidden:!0,projection:!0,orientation:"1d-vertical",name:"Viewport Projection",thumbnail:"viewport-projection-center.png",availableOptions:["projectionFillColor","projectionStrokeColor","strokeWidth"],defaultOptions:{projectionFillColor:"#777",projectionStrokeColor:"#777",projectionFillOpacity:.3,projectionStrokeOpacity:.7,strokeWidth:1}},{type:"viewport-projection-horizontal",datatype:["1d-projection"],local:!0,hidden:!0,projection:!0,orientation:"1d-horizontal",name:"Viewport Projection",thumbnail:"viewport-projection-center.png",availableOptions:["projectionFillColor","projectionStrokeColor","strokeWidth"],defaultOptions:{projectionFillColor:"#777",projectionStrokeColor:"#777",projectionFillOpacity:.3,projectionStrokeOpacity:.7,strokeWidth:1}},{type:"viewport-projection-center",datatype:["2d-projection"],local:!0,hidden:!0,projection:!0,orientation:"2d",name:"Viewport Projection",thumbnail:"viewport-projection-center.png",availableOptions:["projectionFillColor","projectionStrokeColor","strokeWidth"],defaultOptions:{projectionFillColor:"#777",projectionStrokeColor:"#777",projectionFillOpacity:.3,projectionStrokeOpacity:.7,strokeWidth:1}},{type:"gene-annotations",aliases:["horizontal-gene-annotations","vertical-gene-annotations"],datatype:["gene-annotation"],local:!1,defaultHeight:90,defaultWidth:90,rotatable:!0,orientation:"1d-horizontal",name:"Gene Annotations",thumbnail:MX,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundColor","labelBackgroundOpacity","minHeight","plusStrandColor","minusStrandColor","trackBorderWidth","trackBorderColor","showMousePosition","mousePositionColor","fontSize","geneAnnotationHeight","geneLabelPosition","geneStrandSpacing"],defaultOptions:{fontSize:10,labelColor:"black",labelBackgroundColor:"#ffffff",labelPosition:"hidden",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,minHeight:24,plusStrandColor:"blue",minusStrandColor:"red",trackBorderWidth:0,trackBorderColor:"black",showMousePosition:!1,mousePositionColor:"#000000",geneAnnotationHeight:16,geneLabelPosition:"outside",geneStrandSpacing:4},defaultOptionsByTheme:{[Qt]:{labelColor:"#ffffff",labelBackgroundColor:"#000000",trackBorderColor:"#ffffff",mousePositionColor:"#ffffff",plusStrandColor:"#40a0ff"}}},{type:"arrowhead-domains",datatype:["arrowhead-domains"],local:!1,orientation:"2d",name:"Arrowhead Domains",thumbnail:Ou,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundOpacity","trackBorderWidth","trackBorderColor"],defaultOptions:{labelColor:"black",labelPosition:"hidden",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,trackBorderWidth:0,trackBorderColor:"black"}},{type:"linear-2d-rectangle-domains",aliases:["horizontal-2d-rectangle-domains","vertical-2d-rectangle-domains"],datatype:["2d-rectangle-domains"],local:!1,orientation:"1d-horizontal",rotatable:!0,name:"Horizontal 2D Rectangle Domains",thumbnail:Ou,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundOpacity","trackBorderWidth","trackBorderColor","rectangleDomainFillColor","rectangleDomainStrokeColor","rectangleDomainOpacity","minSquareSize"],defaultOptions:{labelColor:"black",labelPosition:"bottomLeft",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,trackBorderWidth:0,trackBorderColor:"black",rectangleDomainFillColor:"grey",rectangleDomainStrokeColor:"black",rectangleDomainOpacity:.6,minSquareSize:"none"}},{type:"2d-rectangle-domains",datatype:["2d-rectangle-domains"],local:!1,orientation:"2d",name:"2D Rectangle Domains",thumbnail:Ou,availableOptions:["flipDiagonal","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundOpacity","trackBorderWidth","trackBorderColor","rectangleDomainFillColor","rectangleDomainFillOpacity","rectangleDomainStrokeColor","rectangleDomainOpacity","minSquareSize"],defaultOptions:{flipDiagonal:"none",labelColor:"black",labelPosition:"hidden",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,trackBorderWidth:0,trackBorderColor:"black",rectangleDomainFillColor:"grey",rectangleDomainFillOpacity:.4,rectangleDomainStrokeColor:"black",rectangleDomainOpacity:.6,minSquareSize:"none"}},{type:"horizontal-1d-annotations",datatype:["nothing"],local:!1,orientation:"1d-horizontal",name:"Horizontal 1D Annotations",thumbnail:null,availableOptions:["fill","fillOpacity","stroke","strokeOpacity","strokeWidth","strokePos","regions"],defaultOptions:{fill:"red",fillOpacity:.2,stroke:"red",strokeOpacity:0,strokeWidth:1,regions:[],strokePos:[]}},{type:"vertical-1d-annotations",datatype:["nothing"],local:!1,orientation:"1d-vertical",name:"Vertical 1D Annotations",thumbnail:null,availableOptions:["fill","fillOpacity","stroke","strokeOpacity","regions"],defaultOptions:{fill:"red",fillOpacity:"0.2",stroke:"red",strokeOpacity:"0",regions:[]}},{type:"2d-annotations",datatype:["2d-annotations"],local:!1,orientation:"2d",name:"2D Annotations",thumbnail:Ou,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor","labelTextOpacity","labelBackgroundOpacity","trackBorderWidth","trackBorderColor","rectangleDomainFillColor","rectangleDomainStrokeColor","rectangleDomainOpacity","minSquareSize","isClickable","hoverColor","selectColor","exclude","trackBorderBgWidth","trackBorderBgColor","trackBorderBgAlpha"],defaultOptions:{labelColor:"black",labelPosition:"hidden",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,trackBorderWidth:0,trackBorderColor:"black",rectangleDomainFillColor:"grey",rectangleDomainStrokeColor:"black",rectangleDomainOpacity:.6,minSquareSize:"none",isClickable:!1,hoverColor:"orange",selectColor:"fuchsia",exclude:[],trackBorderBgWidth:0,trackBorderBgColor:"black",trackBorderBgAlpha:.33}},{type:"square-markers",datatype:["bedpe"],local:!1,orientation:"2d",name:"Square Markers",thumbnail:Ou,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","labelColor"],defaultOptions:{labelColor:"black",labelPosition:"hidden",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,trackBorderWidth:0,trackBorderColor:"black"}},{type:"combined",datatype:"any",local:!0,orientation:"any"},{type:"horizontal-chromosome-grid",datatype:["chromsizes"],local:!1,orientation:"1d-horizontal",name:"Chromosome Grid",chromInfoPath:"//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv",thumbnail:null,availableOptions:["lineStrokeWidth","lineStrokeColor","showMousePosition"],defaultOptions:{lineStrokeWidth:1,lineStrokeColor:"grey",showMousePosition:!1}},{type:"vertical-chromosome-grid",datatype:["chromsizes"],local:!1,orientation:"1d-vertical",name:"Chromosome Grid",chromInfoPath:"//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv",thumbnail:null,availableOptions:["lineStrokeWidth","lineStrokeColor","showMousePosition"],defaultOptions:{lineStrokeWidth:1,lineStrokeColor:"grey",showMousePosition:!1}},{type:"2d-chromosome-grid",datatype:["chromsizes"],local:!1,orientation:"2d",name:"Chromosome Grid",chromInfoPath:"//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv",thumbnail:null,availableOptions:["lineStrokeWidth","lineStrokeColor"],defaultOptions:{lineStrokeWidth:1,lineStrokeColor:"grey"}},{type:"2d-chromosome-annotations",datatype:["chromsizes"],local:!0,orientation:"2d",name:"2D Chromosome Annotations",thumbnail:null,hidden:!0},{type:"2d-chromosome-labels",datatype:["chromsizes"],local:!0,orientation:"2d",name:"Pairwise Chromosome Labels",thumbnail:null},{type:"chromosome-labels",aliases:["horizontal-chromosome-labels","vertical-chromosome-labels"],datatype:["chromsizes"],orientation:"1d-horizontal",rotatable:!0,minHeight:35,defaultHeight:30,name:"Chromosome Axis",thumbnail:null,availableOptions:["color","stroke","fontSize","fontIsLeftAligned","showMousePosition","mousePositionColor","tickPositions","tickFormat","reverseOrientation"],defaultOptions:{color:"#808080",stroke:"#ffffff",fontSize:12,fontIsLeftAligned:!1,showMousePosition:!1,mousePositionColor:"#000000",reverseOrientation:!1},defaultOptionsByTheme:{[Qt]:{color:"#808080",stroke:"#000000",mousePositionColor:"#ffffff"}}},{type:"vertical-1d-tiles",datatype:["1d-tiles"],local:!1,orientation:"1d-vertical",name:"Vertical 1D Tile Outlines",thumbnail:RX},{type:"horizontal-1d-tiles",datatype:["vector","stacked-interval","gene-annotation"],local:!1,orientation:"1d-horizontal",name:"Horizontal 1D Tile Outlines",thumbnail:IX},{type:"osm-2d-tile-ids",datatype:["map-tiles"],local:!1,orientation:"2d",name:"OSM Tile Outlines",thumbnail:G4,availableOptions:["minPos","maxPos","maxZoom","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","name"],defaultOptions:{minPos:-180,maxPos:180,maxZoom:19,labelPosition:"bottomRight",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0}},{type:"raster-tiles",datatype:["map-tiles"],local:!0,orientation:"2d",hidden:!0,name:"Raster Tiles",thumbnail:f0,availableOptions:["labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","name"],defaultOptions:{labelPosition:"bottomRight",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0}},{type:"image-tiles",datatype:["image-tiles"],local:!0,orientation:"2d",hidden:!0,name:"Image Tiles",thumbnail:null},{type:"bedlike",datatype:["bedlike"],aliases:["vertical-bedlike"],local:!1,orientation:"1d-horizontal",rotatable:!0,name:"BED-like track",thumbnail:null,availableOptions:["alternating","annotationHeight","annotationStyle","fillColor","fillOpacity","fontColor","fontSize","minusStrandColor","plusStrandColor","labelBottomMargin","labelColor","labelLeftMargin","labelPosition","labelRightMargin","labelTopMargin","labelTextOpacity","labelBackgroundOpacity","maxAnnotationHeight","minHeight","trackBorderWidth","trackBorderColor","valueColumn","colorEncoding","colorRange","colorEncodingRange","separatePlusMinusStrands","showTexts","axisPositionHorizontal","axisMargin"],defaultOptions:{alternating:!1,annotationStyle:"box",fillColor:"blue",fillOpacity:.3,fontSize:"10",axisPositionHorizontal:"right",labelColor:"black",labelPosition:"hidden",labelLeftMargin:0,labelRightMargin:0,labelTopMargin:0,labelBottomMargin:0,minHeight:20,maxAnnotationHeight:null,trackBorderWidth:0,trackBorderColor:"black",valueColumn:null,colorEncoding:"itemRgb",showTexts:!1,colorRange:["#000000","#652537","#bf5458","#fba273","#ffffe0"],colorEncodingRange:!1,separatePlusMinusStrands:!0,annotationHeight:16}},{type:"empty",datatype:[],orientation:"1d-horizontal",name:"Empty track",thumbnail:null,availableOptions:[],defaultOptions:{}}],h0=e=>{const t={},n=r=>!!(r.orientation===e||e==="1d-vertical"&&r.orientation==="1d-horizontal"&&r.rotatable);return xa.filter(n).forEach(r=>{let i=r.datatype;Array.isArray(r.datatype)||(i=[i]),i.forEach(o=>{o in t||(t[o]=[]),t[o].push(r)})}),t.none=[],t},Is=[[0,0,0,255],[35,0,0,255],[52,0,0,255],[60,0,0,255],[63,1,0,255],[64,2,0,255],[68,5,0,255],[69,6,0,255],[72,8,0,255],[74,10,0,255],[77,12,0,255],[78,14,0,255],[81,16,0,255],[83,17,0,255],[85,19,0,255],[86,20,0,255],[89,22,0,255],[91,24,0,255],[92,25,0,255],[94,26,0,255],[95,28,0,255],[98,30,0,255],[100,31,0,255],[102,33,0,255],[103,34,0,255],[105,35,0,255],[106,36,0,255],[108,38,0,255],[109,39,0,255],[111,40,0,255],[112,42,0,255],[114,43,0,255],[115,44,0,255],[117,45,0,255],[119,47,0,255],[119,47,0,255],[120,48,0,255],[122,49,0,255],[123,51,0,255],[125,52,0,255],[125,52,0,255],[126,53,0,255],[128,54,0,255],[129,56,0,255],[129,56,0,255],[131,57,0,255],[132,58,0,255],[134,59,0,255],[134,59,0,255],[136,61,0,255],[137,62,0,255],[137,62,0,255],[139,63,0,255],[139,63,0,255],[140,65,0,255],[142,66,0,255],[142,66,0,255],[143,67,0,255],[143,67,0,255],[145,68,0,255],[145,68,0,255],[146,70,0,255],[146,70,0,255],[148,71,0,255],[148,71,0,255],[149,72,0,255],[149,72,0,255],[151,73,0,255],[151,73,0,255],[153,75,0,255],[153,75,0,255],[154,76,0,255],[154,76,0,255],[154,76,0,255],[156,77,0,255],[156,77,0,255],[157,79,0,255],[157,79,0,255],[159,80,0,255],[159,80,0,255],[159,80,0,255],[160,81,0,255],[160,81,0,255],[162,82,0,255],[162,82,0,255],[163,84,0,255],[163,84,0,255],[165,85,0,255],[165,85,0,255],[166,86,0,255],[166,86,0,255],[166,86,0,255],[168,87,0,255],[168,87,0,255],[170,89,0,255],[170,89,0,255],[171,90,0,255],[171,90,0,255],[173,91,0,255],[173,91,0,255],[174,93,0,255],[174,93,0,255],[176,94,0,255],[176,94,0,255],[177,95,0,255],[177,95,0,255],[179,96,0,255],[179,96,0,255],[180,98,0,255],[182,99,0,255],[182,99,0,255],[183,100,0,255],[183,100,0,255],[185,102,0,255],[185,102,0,255],[187,103,0,255],[187,103,0,255],[188,104,0,255],[188,104,0,255],[190,105,0,255],[191,107,0,255],[191,107,0,255],[193,108,0,255],[193,108,0,255],[194,109,0,255],[196,110,0,255],[196,110,0,255],[197,112,0,255],[197,112,0,255],[199,113,0,255],[200,114,0,255],[200,114,0,255],[202,116,0,255],[202,116,0,255],[204,117,0,255],[205,118,0,255],[205,118,0,255],[207,119,0,255],[208,121,0,255],[208,121,0,255],[210,122,0,255],[211,123,0,255],[211,123,0,255],[213,124,0,255],[214,126,0,255],[214,126,0,255],[216,127,0,255],[217,128,0,255],[217,128,0,255],[219,130,0,255],[221,131,0,255],[221,131,0,255],[222,132,0,255],[224,133,0,255],[224,133,0,255],[225,135,0,255],[227,136,0,255],[227,136,0,255],[228,137,0,255],[230,138,0,255],[230,138,0,255],[231,140,0,255],[233,141,0,255],[233,141,0,255],[234,142,0,255],[236,144,0,255],[236,144,0,255],[238,145,0,255],[239,146,0,255],[241,147,0,255],[241,147,0,255],[242,149,0,255],[244,150,0,255],[244,150,0,255],[245,151,0,255],[247,153,0,255],[247,153,0,255],[248,154,0,255],[250,155,0,255],[251,156,0,255],[251,156,0,255],[253,158,0,255],[255,159,0,255],[255,159,0,255],[255,160,0,255],[255,161,0,255],[255,163,0,255],[255,163,0,255],[255,164,0,255],[255,165,0,255],[255,167,0,255],[255,167,0,255],[255,168,0,255],[255,169,0,255],[255,169,0,255],[255,170,0,255],[255,172,0,255],[255,173,0,255],[255,173,0,255],[255,174,0,255],[255,175,0,255],[255,177,0,255],[255,178,0,255],[255,179,0,255],[255,181,0,255],[255,181,0,255],[255,182,0,255],[255,183,0,255],[255,184,0,255],[255,187,7,255],[255,188,10,255],[255,189,14,255],[255,191,18,255],[255,192,21,255],[255,193,25,255],[255,195,29,255],[255,197,36,255],[255,198,40,255],[255,200,43,255],[255,202,51,255],[255,204,54,255],[255,206,61,255],[255,207,65,255],[255,210,72,255],[255,211,76,255],[255,214,83,255],[255,216,91,255],[255,219,98,255],[255,221,105,255],[255,223,109,255],[255,225,116,255],[255,228,123,255],[255,232,134,255],[255,234,142,255],[255,237,149,255],[255,239,156,255],[255,240,160,255],[255,243,167,255],[255,246,174,255],[255,248,182,255],[255,249,185,255],[255,252,193,255],[255,253,196,255],[255,255,204,255],[255,255,207,255],[255,255,211,255],[255,255,218,255],[255,255,222,255],[255,255,225,255],[255,255,229,255],[255,255,233,255],[255,255,236,255],[255,255,240,255],[255,255,244,255],[255,255,247,255],[255,255,255,0]],Gt=xa.reduce((e,t)=>{if(e[t.type]=t,t.aliases)for(const n of t.aliases)e[n]=t;return e},{}),DX=xa.reduce((e,t)=>{for(let n=0;n<t.datatype.length;n++){const r=t.datatype[n];return e[r]?e[r].add(t.orientation):e[r]=new Set,e}return{}},{}),Ca={chromsizes:{center:"2d-chromosome-grid",top:"chromosome-labels",left:"chromosome-labels",bottom:"chromosome-labels",right:"chromosome-labels"},matrix:{center:"heatmap",top:"linear-heatmap",left:"linear-heatmap",right:"linear-heatmap",bottom:"linear-heatmap"},vector:{top:"bar",bottom:"bar",left:"bar",right:"bar"},"geo-json":{center:"geo-json"},"gene-annotation":{top:"gene-annotations",bottom:"gene-annotations",left:"gene-annotations",right:"gene-annotations"},bedlike:{top:"bedlike",bottom:"bedlike",left:"vertical-bedlike",right:"vertical-bedlike"}},Rp=(e,t)=>{const n=h0(t);let r=new Set(Object.values(n).flat());for(const i of e){const o=new Set(i);r=new Set([...r].filter(a=>a.datatype.filter(s=>o.has(s)).length>0))}return[...r]},J4=8,p0=8,d0="default",Dp="bounded",Np="overflow",Rs="bounded-overflow",Oa="scroll",NX=Object.freeze(Object.defineProperty({__proto__:null,AVAILABLE_TRACK_TYPES:Rp,DATATYPE_TO_TRACK_TYPE:h0,DEFAULT_CONTAINER_PADDING_X:$4,DEFAULT_CONTAINER_PADDING_Y:j4,DEFAULT_SERVER:u0,DEFAULT_TRACKS_FOR_DATATYPE:Ca,DEFAULT_VIEW_MARGIN:Su,DEFAULT_VIEW_PADDING:Eu,GLOBALS:Ye,HEATED_OBJECT_MAP:Is,LOCATION_LISTENER_PREFIX:Cu,LONG_DRAG_TIMEOUT:xu,MAX_CLICK_DELAY:kX,MIN_HORIZONTAL_HEIGHT:q4,MIN_VERTICAL_WIDTH:U4,MOUSE_TOOL_MOVE:Pp,MOUSE_TOOL_SELECT:Xn,MOUSE_TOOL_TRACK_SELECT:ku,NUM_PRECOMP_SUBSETS_PER_1D_TTILE:J4,NUM_PRECOMP_SUBSETS_PER_2D_TTILE:p0,POSITIONS_BY_DATATYPE:DX,SHORT_DRAG_TIMEOUT:B4,SIZE_MODE_BOUNDED:Dp,SIZE_MODE_BOUNDED_OVERFLOW:Rs,SIZE_MODE_DEFAULT:d0,SIZE_MODE_OVERFLOW:Np,SIZE_MODE_SCROLL:Oa,THEME_DARK:Qt,THEME_DEFAULT:V4,THEME_LIGHT:Ip,TILE_FETCH_DEBOUNCE:c0,TRACKS_INFO:xa,TRACKS_INFO_BY_TYPE:Gt,TRACK_LOCATIONS:Mp,VIEW_HEADER_MED_WIDTH_SEARCH_BAR:H4,VIEW_HEADER_MIN_WIDTH_SEARCH_BAR:F4,ZOOM_DEBOUNCE:Ap,ZOOM_TRANSITION_DURATION:z4},Symbol.toStringTag,{value:"Module"})),eA=e=>{const t=["top","bottom","gallery"],n=["left","right","gallery"];return e.center??=[],e.left??=[],e.right??=[],e.top??=[],e.bottom??=[],e.whole??=[],e.gallery??=[],t.map(r=>e[r]).forEach(r=>(r??[]).forEach(i=>{const o=Gt[i.type],a=o?.defaultOptions||{},s=i.options?{...a,...i.options}:a;s.minHeight!==void 0&&i.height===void 0&&(i.height=s.minHeight),i.height===void 0&&(i.height=o?.defaultHeight||q4)})),n.map(r=>e[r]).forEach(r=>(r??[]).forEach(i=>{const o=Gt[i.type],a=o?.defaultOptions||{},s=i.options?{...a,...i.options}:a;s.minWidth!==void 0&&i.width===void 0&&(i.width=s.minWidth),i.width===void 0&&(i.width=o?.defaultWidth||U4)})),e},tA=(e,t)=>n=>n.reduce(e,t),LX=tA((e,t)=>e.concat(t),[]),$X=e=>t=>Array.prototype.forEach.call(t,e),Lp=(e,t)=>{t.dispatchEvent(D4(e))},jX=(e,t)=>[Tu(e[0],e[1],t),Tu(e[2],e[3],t)];function BX(e,t,n,r,i){const{chr:o,pos:a}=t,{chr:s,pos:c}=n,l=[];if(o===s){const u=o,f=Math.floor(a/r),h=Math.min(f+i,Math.ceil(c/r));l.push([u,f,h])}else{let u=i;const f=e.findIndex(([p])=>p===o),h=e.findIndex(([p])=>p===s);for(let p=f;p<=h;p++){let d,g;const[y,b]=e[p];p<h?(p===f?d=a:d=0,g=b):(d=0,g=c);const m=Math.floor(d/r),v=Math.min(m+u,Math.ceil(g/r));l.push([y,m,v]),u-=v-m}}return l}function zX(e,t){return Ca[e]!==void 0?Ca[e][t]:void 0}const g0=(e,t,n)=>{if(n.length===0)return;if(n.length===1)return n[0];let r=n[0];const i=zX(e,t);return i!==void 0&&(r=n.find(o=>o.type===i)||r),r},m0=e=>(L7.listen(),[e.clientWidth,e.clientHeight]),rn=(e,t)=>{let n=null;const r=i=>(i.uid===t&&(n=i),i.type.substr(0,8)==="combined"&&i.contents.forEach(r),null);return Object.keys(e).map(i=>e[i]).filter(i=>i.filter).reduce((i,o)=>i.concat(o),[]).forEach(r),n},HX=(e,t,n)=>{const i=e.state.views[t];if(!i)return null;let o=null;const a=c=>(c.uid===n&&(o=c),c.type.substr(0,8)==="combined"&&c.contents.forEach(a),null),s=i.tracks;return Object.keys(s).map(c=>s[c]).filter(c=>c.filter).reduce((c,l)=>c.concat(l),[]).forEach(a),o},Ds=(e,t,n)=>{const r=t?e[t]:Object.values(e)[0];if(!r){console.warn(t?`Could't find view with id "${t}"`:"No views available.");return}let i=r.trackRenderer.trackDefObjects[n];return i?i=i.trackObject:Object.values(r.trackRenderer.trackDefObjects).map(o=>o.trackObject).filter(o=>o.childTracks).forEach(o=>{o.createdTracks[n]&&(i=o.createdTracks[n])}),i};function Pu(e){return"contents"in e&&e.type==="combined"}function FX(e){return"deltaY"in e&&"deltaMode"in e}function $p(e){return e!==null&&typeof e=="object"}function jp(e){return $p(e)&&"max_width"in e}function Au(e){return $p(e)&&"resolutions"in e}function qX(e){return $p(e)&&!("error"in e)}const v0=(e,t,n=!0,r=null)=>e.forEach(i=>{n&&Pu(i)&&v0(i.contents,t,n,r),t(i,r)}),oo=(e,t,n=!0)=>{const r=[];for(const[i,o]of Object.entries(e))v0(o,t,n,i),r.push(...o);return r},Mu=(e,t)=>{let n=null;return oo(e,(r,i)=>{r.uid===t&&(n=i)}),n},y0=e=>t=>Array.prototype.map.call(t,e),rA=()=>[window,y0(e=>e.charCodeAt(0))("2.3.2").map(e=>e<=999?`00${e}`.slice(-3):e).join("")],nA=(e,t=1,n=100,r=0,i=0,o=0,a=100)=>{const s=document.createElement("canvas");s.width=t,s.height=n;const c=s.getContext("2d");if(!c)throw new Error("Could not get canvas context");const l=c.createLinearGradient(r,i,o,a);return e.forEach(u=>{l.addColorStop(u.from,u.color)}),c.fillStyle=l,c.fillRect(0,0,t,n),s},iA=(e,t)=>{let n=e;for(;n&&n!==t&&n.tagName!=="HTML";)n=n.parentNode;return n===t},oA=e=>Number.parseInt(e.replace(/^#/,""),16),aA=()=>{};function UX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VX(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,WX(r.key),r)}}function GX(e,t,n){return t&&VX(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function WX(e){var t=YX(e,"string");return typeof t=="symbol"?t:t+""}function YX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}let b0=function(){function e(t){UX(this,e),this.context=t;const{tracks:n,createTrackObject:r}=t;this.childTracks=n.map(r),this.createdTracks={},this.uid=Mt.nice(),this.childTracks.forEach((i,o)=>{this.createdTracks[n[o].uid]=i});for(let i=0;i<this.childTracks.length;i++)this.childTracks[i]||console.error("Empty child track in CombinedTrack:",this)}return GX(e,[{key:"updateContents",value:function(n,r){const i=[],o=new Set;n.forEach(c=>{if(o.add(c.uid),c.uid in this.createdTracks)i.push(this.createdTracks[c.uid]);else{const l=r(c);l.setPosition(this.position),l.setDimensions(this.dimensions),i.push(l),l.zoomed(this._xScale,this._yScale),this.createdTracks[c.uid]=l}}),this.childTracks=i;const a=new Set(Object.keys(this.createdTracks));return[...new Set([...a].filter(c=>!o.has(c)))].forEach(c=>{this.createdTracks[c].remove(),delete this.createdTracks[c]}),this}},{key:"setPosition",value:function(n){this.position=n;for(let r=0;r<this.childTracks.length;r++)this.childTracks[r].setPosition(n)}},{key:"setDimensions",value:function(n){this.dimensions=n;for(let r=0;r<this.childTracks.length;r++)this.childTracks[r].setDimensions(n)}},{key:"zoomed",value:function(n,r,i,o,a,s,c){this._xScale=n,this._yScale=r;for(let l=0;l<this.childTracks.length;l++)this.childTracks[l].zoomed(n,r,i,o,a,s,c)}},{key:"clickOutside",value:function(){for(let n=0;n<this.childTracks.length;n++)this.childTracks[n].clickOutside()}},{key:"click",value:function(...n){for(let r=0;r<this.childTracks.length;r++)this.childTracks[r].click(...n)}},{key:"draw",value:function(){}},{key:"refScalesChanged",value:function(n,r){for(let i=0;i<this.childTracks.length;i++)this.childTracks[i].refScalesChanged(n,r)}},{key:"remove",value:function(){for(let n=0;n<this.childTracks.length;n++)this.childTracks[n].remove()}},{key:"exportSVG",value:function(){const n=document.createElement("g");for(const r of this.childTracks)r.exportSVG&&n.appendChild(r.exportSVG()[0]);return[n,n]}},{key:"rerender",value:function(n){}},{key:"minValue",value:function(n){if(arguments.length===0){const r=this.childTracks.filter(i=>i.minValue).map(i=>i.minValue()).filter(i=>i);return Math.min(...r)}for(const r of this.childTracks)r.minValue&&r.minValue(n)}},{key:"maxValue",value:function(n){if(arguments.length===0){const r=this.childTracks.filter(i=>i.maxValue).map(i=>i.maxValue()).filter(i=>i);return Math.max(...r)}for(const r of this.childTracks)r.maxValue&&r.maxValue(n)}},{key:"respondsToPosition",value:function(n,r){return n>=this.position[0]&&n<=this.dimensions[0]+this.position[0]&&r>=this.position[1]&&r<=this.dimensions[1]+this.position[1]}},{key:"stopHover",value:function(){for(const n of this.childTracks)n.stopHover&&n.stopHover()}},{key:"getMouseOverHtml",value:function(n,r){let i="";for(const o of this.childTracks)if(o.getMouseOverHtml){const a=o.getMouseOverHtml(n,r);a?.length&&(i+=a,i+="<br/>")}return i}},{key:"getMouseOverUids",value:function(n,r){const i=[];for(const o of this.childTracks)if(o.getMouseOverUids){const a=o.getMouseOverUids(n,r);a&&i.push(...a)}return i}}])}();const sA=(e,t)=>t===e?!0:t instanceof b0?Object.keys(t.createdTracks).map(n=>t.createdTracks[n]).some(n=>sA(e,n)):!1,_0=(e,t,n,r,i,o,a=!1)=>a?e>=n&&e<=r||t>=i&&t<=o:e>=n&&e<=r&&t>=i&&t<=o,XX=e=>Math.log(Math.tan((e+Math.PI/2)/2)),KX=(e,t)=>{let n=e*Math.PI/180;return n=XX(n),2**t*(Math.PI-n)/(2*Math.PI)},Bp=e=>y0(t=>e[t])(Object.keys(e)),ZX=e=>Bp(e).map(t=>t.chromInfoPath).forEach(t=>a0.get(t)),QX=(e,t)=>2**t*(e+180)/360,T0=(e,t)=>e>t?e:t,lA=1e-7;function w0(e){let t=Number.MIN_SAFE_INTEGER;for(let n=0;n<e.length;n++){const r=e[n];r<lA&&r>-lA||r>t&&(t=r)}return t}const cA=(e,t)=>e<t?e:t,uA=1e-7;function S0(e){let t=Number.MAX_SAFE_INTEGER;for(let n=0;n<e.length;n++){const r=e[n];r<uA&&r>-uA||r<t&&(t=r)}return t}const JX=(e,t)=>(e%t+t)%t,fA=(e,t)=>{const n=+t;if(!Number.isNaN(n))if(e.dimension===1)for(let i=0;i<e.shape[0];++i)e.set(i,n);else for(let i=0;i<e.shape[0];++i)for(let o=0;o<e.shape[1];++o)e.set(i,o,n);else{const i=e.shape[0],o=e.shape[1],a=t.shape[0],s=t.shape[1];if(i!==a||o!==s){console.warn("Cannot assign source to target ndarray as the dimensions do not match",i,a,o,s);return}if(e.dimension===1)for(let c=0;c<e.shape[0];++c)e.set(c,t.get(c));else for(let c=0;c<e.shape[0];++c)for(let l=0;l<e.shape[1];++l)e.set(c,l,t.get(c,l))}};var E0,hA;function eK(){if(hA)return E0;hA=1;function e(t){for(var n=new Array(t),r=0;r<t;++r)n[r]=r;return n}return E0=e,E0}var k0,pA;function tK(){if(pA)return k0;pA=1,k0=function(n){return n!=null&&(e(n)||t(n)||!!n._isBuffer)};function e(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function t(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&e(n.slice(0,0))}return k0}var x0,dA;function rK(){if(dA)return x0;dA=1;var e=eK(),t=tK(),n=typeof Float64Array<"u";function r(l,u){return l[0]-u[0]}function i(){var l=this.stride,u=new Array(l.length),f;for(f=0;f<u.length;++f)u[f]=[Math.abs(l[f]),f];u.sort(r);var h=new Array(u.length);for(f=0;f<h.length;++f)h[f]=u[f][1];return h}function o(l,u){var f=["View",u,"d",l].join("");u<0&&(f="View_Nil"+l);var h=l==="generic";if(u===-1){var p="function "+f+"(a){this.data=a;}; var proto="+f+".prototype; proto.dtype='"+l+"'; proto.index=function(){return -1}; proto.size=0; proto.dimension=-1; proto.shape=proto.stride=proto.order=[]; proto.lo=proto.hi=proto.transpose=proto.step= function(){return new "+f+"(this.data);}; proto.get=proto.set=function(){}; proto.pick=function(){return null}; return function construct_"+f+"(a){return new "+f+"(a);}",k=new Function(p);return k()}else if(u===0){var p="function "+f+"(a,d) { this.data = a; this.offset = d }; var proto="+f+".prototype; proto.dtype='"+l+"'; proto.index=function(){return this.offset}; proto.dimension=0; proto.size=1; proto.shape= proto.stride= proto.order=[]; proto.lo= proto.hi= proto.transpose= proto.step=function "+f+"_copy() { return new "+f+"(this.data,this.offset) }; proto.pick=function "+f+"_pick(){ return TrivialArray(this.data); }; proto.valueOf=proto.get=function "+f+"_get(){ return "+(h?"this.data.get(this.offset)":"this.data[this.offset]")+"}; proto.set=function "+f+"_set(v){ return "+(h?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+" }; return function construct_"+f+"(a,b,c,d){return new "+f+"(a,d)}",k=new Function("TrivialArray",p);return k(s[l][0])}var p=["'use strict'"],d=e(u),g=d.map(function(E){return"i"+E}),y="this.offset+"+d.map(function(E){return"this.stride["+E+"]*i"+E}).join("+"),b=d.map(function(E){return"b"+E}).join(","),m=d.map(function(E){return"c"+E}).join(",");p.push("function "+f+"(a,"+b+","+m+",d){this.data=a","this.shape=["+b+"]","this.stride=["+m+"]","this.offset=d|0}","var proto="+f+".prototype","proto.dtype='"+l+"'","proto.dimension="+u),p.push("Object.defineProperty(proto,'size',{get:function "+f+"_size(){ return "+d.map(function(E){return"this.shape["+E+"]"}).join("*"),"}})"),u===1?p.push("proto.order=[0]"):(p.push("Object.defineProperty(proto,'order',{get:"),u<4?(p.push("function "+f+"_order(){"),u===2?p.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):u===3&&p.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]); if(s0>s1){ if(s1>s2){ return [2,1,0]; }else if(s0>s2){ return [1,2,0]; }else{ return [1,0,2]; } }else if(s0>s2){ return [2,0,1]; }else if(s2>s1){ return [0,1,2]; }else{ return [0,2,1]; }}})")):p.push("ORDER})")),p.push("proto.set=function "+f+"_set("+g.join(",")+",v){"),h?p.push("return this.data.set("+y+",v)}"):p.push("return this.data["+y+"]=v}"),p.push("proto.get=function "+f+"_get("+g.join(",")+"){"),h?p.push("return this.data.get("+y+")}"):p.push("return this.data["+y+"]}"),p.push("proto.index=function "+f+"_index(",g.join(),"){return "+y+"}"),p.push("proto.hi=function "+f+"_hi("+g.join(",")+"){return new "+f+"(this.data,"+d.map(function(E){return["(typeof i",E,"!=='number'||i",E,"<0)?this.shape[",E,"]:i",E,"|0"].join("")}).join(",")+","+d.map(function(E){return"this.stride["+E+"]"}).join(",")+",this.offset)}");var v=d.map(function(E){return"a"+E+"=this.shape["+E+"]"}),_=d.map(function(E){return"c"+E+"=this.stride["+E+"]"});p.push("proto.lo=function "+f+"_lo("+g.join(",")+"){var b=this.offset,d=0,"+v.join(",")+","+_.join(","));for(var T=0;T<u;++T)p.push("if(typeof i"+T+"==='number'&&i"+T+">=0){ d=i"+T+"|0; b+=c"+T+"*d; a"+T+"-=d}");p.push("return new "+f+"(this.data,"+d.map(function(E){return"a"+E}).join(",")+","+d.map(function(E){return"c"+E}).join(",")+",b)}"),p.push("proto.step=function "+f+"_step("+g.join(",")+"){var "+d.map(function(E){return"a"+E+"=this.shape["+E+"]"}).join(",")+","+d.map(function(E){return"b"+E+"=this.stride["+E+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var T=0;T<u;++T)p.push("if(typeof i"+T+"==='number'){ d=i"+T+"|0; if(d<0){ c+=b"+T+"*(a"+T+"-1); a"+T+"=ceil(-a"+T+"/d) }else{ a"+T+"=ceil(a"+T+"/d) } b"+T+"*=d }");p.push("return new "+f+"(this.data,"+d.map(function(E){return"a"+E}).join(",")+","+d.map(function(E){return"b"+E}).join(",")+",c)}");for(var w=new Array(u),S=new Array(u),T=0;T<u;++T)w[T]="a[i"+T+"]",S[T]="b[i"+T+"]";p.push("proto.transpose=function "+f+"_transpose("+g+"){"+g.map(function(E,P){return E+"=("+E+"===undefined?"+P+":"+E+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+f+"(this.data,"+w.join(",")+","+S.join(",")+",this.offset)}"),p.push("proto.pick=function "+f+"_pick("+g+"){var a=[],b=[],c=this.offset");for(var T=0;T<u;++T)p.push("if(typeof i"+T+"==='number'&&i"+T+">=0){c=(c+this.stride["+T+"]*i"+T+")|0}else{a.push(this.shape["+T+"]);b.push(this.stride["+T+"])}");p.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),p.push("return function construct_"+f+"(data,shape,stride,offset){return new "+f+"(data,"+d.map(function(E){return"shape["+E+"]"}).join(",")+","+d.map(function(E){return"stride["+E+"]"}).join(",")+",offset)}");var k=new Function("CTOR_LIST","ORDER",p.join(`
168
168
  `));return k(s[l],i)}function a(l){if(t(l))return"buffer";if(n)switch(Object.prototype.toString.call(l)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(l)?"array":"generic"}var s={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};function c(l,u,f,h){if(l===void 0){var m=s.array[0];return m([])}else typeof l=="number"&&(l=[l]);u===void 0&&(u=[l.length]);var p=u.length;if(f===void 0){f=new Array(p);for(var d=p-1,g=1;d>=0;--d)f[d]=g,g*=u[d]}if(h===void 0){h=0;for(var d=0;d<p;++d)f[d]<0&&(h-=(u[d]-1)*f[d])}for(var y=a(l),b=s[y];b.length<=p+1;)b.push(o(y,b.length-1));var m=b[p+1];return m(l,u,f,h)}return x0=c,x0}var nK=rK();const Ns=_n(nK),gA=e=>{const t=e.shape.reduce((r,i)=>r*i,1),n=new Array(t);if(e.dimension===1){let r=0;for(let i=0;i<e.shape[0];++i)n[r]=e.get(i),r++}else{let r=0;for(let i=0;i<e.shape[0];++i)for(let o=0;o<e.shape[1];++o)n[r]=e.get(i,o),r++}return n},mA=e=>e.shape.length===1?e:Ns(gA(e)),vA=e=>{const t=e.split("."),n=t.slice(1).join("").length;return+t.join("")/10**n},Iu=(e,t)=>e||t,zp=e=>{const t=document.createElement("g"),n=document.createElement("text");return e.anchor.x===0?n.setAttribute("text-anchor","start"):e.anchor.x===1?n.setAttribute("text-anchor","end"):n.setAttribute("text-anchor","middle"),n.setAttribute("font-family",e.style.fontFamily?.toString()??""),n.setAttribute("font-size",e.style.fontSize?.toString()??""),t.setAttribute("transform",`scale(${e.scale.x},1)`),n.setAttribute("fill",e.style.fill?.toString()??""),n.innerHTML=e.text,t.appendChild(n),t.setAttribute("transform",`translate(${e.x},${e.y})scale(${e.scale.x},1)`),t},iK=e=>{try{const t=e.split(".");return n=>{let r=n;return t.forEach(i=>{r=r[i]}),r}}catch{return}},oK=(e,t,n,r,i,o,a=0,s=0,c)=>{const l=o?i:r,u=o?r:i,f=o?s:a,h=o?a:s,p=Math.max(0,+l[0]||0),d=Math.max(0,+l[1]||0),g=Math.max(0,+u[0]||0),y=Math.max(0,+u[1]||0);let b=[];ArrayBuffer.isView(c)||console.warn("Not supported yet");try{const m=new c.constructor(c.length);let v=0+h;for(let T=g;T<y;T++)m.set(e.slice(T*t+p,T*t+d),f+v*n),v+=1;const _=o?I4(n,n):void 0;b=R4(c,m,_)}catch{}return b},aK=(e,t,n,r)=>[r.chrPositions[e].pos+ +t,r.chrPositions[e].pos+ +n],sK="http://www.w3.org/2000/svg",lK=(e,t)=>{const n=new RegExp(`(\\s|^)${t}(\\s|$)`);if(e.namespaceURI===sK){const r=e.getAttribute("class")||"";e.setAttribute("class",r.replace(n," "))}else e.classList?e.classList.remove(t):xp(e,t)&&(e.className=e.className.replace(n," "))},Ls=(e,t)=>{e.select(".selection").attr("fill",null).attr("fill-opacity",null).attr("stroke",null).classed(t,!0)},C0=e=>{const t=e.toString(16);return t.length===1?`0${t}`:t},cK=(e,t,n)=>`#${C0(e)}${C0(t)}${C0(n)}`,kr=(e,t)=>{const n=e.invert((e.range()[0]+e.range()[1])/2),r=t.invert((t.range()[0]+t.range()[1])/2),i=e.invert(1)-e.invert(0);return[n,r,i]},yA=(e,t,n)=>{if(n===null||!e||!t)return;const r=e.domain()[0],i=e.domain()[1],o=t.domain()[0],a=t.domain()[1];return[...Cp(r,i,n),...Cp(o,a,n)]},uK=11184810,fK=1,hK=(e,t,n,r,i,o,a,s,c)=>{e.publish("app.animateOnMouseMove",!0);const l=n.mousePositionColor?oA(n.mousePositionColor):uK,u=n.mousePositionAlpha||fK,f=new Ye.PIXI.Graphics,h=()=>{f.clear()},p=(g,y,b)=>{if(b||h(),f.lineStyle(1,l,u),y){const m=s?i()[0]:0;f.moveTo(0,g),f.lineTo(o()[0]+m,g)}else{const m=s?i()[1]:0;f.moveTo(g,0),f.lineTo(g,o()[1]+m)}},d=g=>{if(g.noHoveredTracks)return h(),f;let y,b;g.isFromVerticalTrack?(y=g.dataY,b=g.dataY):(y=g.dataX,b=g.isFrom2dTrack?g.dataY:g.dataX);const m=s?i():[0,0],v=a()?r()[0](b)+m[1]:r()[0](y)+m[0];return p(v),s&&p(r()[1](b)+m[1],!0,!0),f};return t.push(e.subscribe("app.mouseMove",d)),t.push(e.subscribe("app.mouseLeave",h)),t.push(e.subscribe("blur",h)),c&&t.push(fu.subscribe("higlass.mouseMove",d)),f},Bo=(e,t=!1,n=!1)=>{const r=t?e.pMasked:e.pForeground||e.pMain;if(!r)throw new Error("setupShowMousePosition: No scene found. Please make sure to call this method after the scene has been initialized.");const i=()=>[e.xScale(),e.yScale()],o=hK(e.pubSub,e.pubSubs,e.options,i,e.getPosition.bind(e),e.getDimensions.bind(e),e.getProp("flipText"),t,n);return r.addChild(o),()=>{r.removeChild(o)}},pK=e=>t=>Array.prototype.some.call(t,e),zo=(e,t)=>e+t,O0=(e,t,n,r,i,o)=>{const a=document.createElement("line");return a.setAttribute("x1",String(e)),a.setAttribute("x2",String(n)),a.setAttribute("y1",String(t)),a.setAttribute("y2",String(r)),i&&a.setAttribute("stroke-width",String(i)),o&&a.setAttribute("stroke",o),a},bA=(e,t,n)=>{let r,i=0;const o=()=>{r=void 0},a=(...l)=>{const u=()=>{i>0&&(e(...l),i=0)};clearTimeout(r),r=setTimeout(u,n)};a.cancel=()=>{clearTimeout(r),o()},a.immediate=(...l)=>{e(...l)};let s=!1;return(l,...u)=>{s?i++:(e(...u),a(...u),s=!0,i=0,setTimeout(()=>{s=!1},t))}},dK=(e,t=256,n=256)=>{const r=document.createElement("canvas");r.width=t,r.height=n;const i=r.getContext("2d");if(!i)throw new Error("Could not get canvas context");i.fillStyle="transparent",i.fillRect(0,0,r.width,r.height);const o=new ImageData(e,r.width,r.height);return i.putImageData(o,0,0),r},_A=e=>new Promise(t=>{setTimeout(t,e)}),gK=e=>{if(!e.tracks)return 0;let t=0;return e.tracks.top&&(t+=e.tracks.top.map(n=>n.height).reduce((n,r)=>n+r,0)),e.tracks.center&&(t+=e.tracks.center.map(n=>n.height).reduce((n,r)=>n+r,0)),e.tracks.bottom&&(t+=e.tracks.bottom.map(n=>n.height).reduce((n,r)=>n+r,0)),t},Hp=()=>{},Fp=e=>(e||"").replace(/\/$/,""),P0=(e,t,n=0,r=1e-6)=>i=>{let o=255;return i>r&&(o=Math.max(0,Math.min(255,Math.floor(e(i+n))))),t[o]},qp=e=>{let t=[];for(const n of e)Pu(n)?t=t.concat(n.contents):t.push(n);return t};function mK(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,vK(r.key),r)}}function TA(e,t,n){return t&&mK(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function vK(e){var t=yK(e,"string");return typeof t=="symbol"?t:t+""}function yK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function wA(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}let SA=TA(function e(t,n,r,i){wA(this,e),this.interval=[t,n],this.max=Number.NEGATIVE_INFINITY,this.parentNode=null,this.left=r??null,this.right=i??null}),EA=function(){function e(){wA(this,e),this.root=null}return TA(e,[{key:"add",value:function(n){if(!this.root){this.root=new SA(n[0],n[1]),this.root.max=n[1];return}A0(this.root,n)}},{key:"contains",value:function(n){return xA(n,this.root)}},{key:"intersects",value:function(n){return CA(n,this.root)}},{key:"height",value:function(){return M0(this.root)}},{key:"findMax",value:function(n){const r=[n];let i,o=Number.NEGATIVE_INFINITY,a;for(;r.length;)i=r.pop(),i?.left&&r.push(i.left),i?.right&&r.push(i.right),i?.interval[1]>o&&(o=i.interval[1],a=i);return a??null}},{key:"_removeHelper",value:function(n,r){if(r)if(r.interval[0]===n[0]&&r.interval[1]===n[1]){if(r.left&&r.right){let o=r.left;for(;o.left;)o=o.left;const a=o.interval;o.interval=r.interval,r.interval=a,this._removeHelper(o.interval,r)}else{let o="left";r.right&&(o="right");const a=r.parentNode;a?(a.left===r?a.left=r[o]:a.right=r[o],r[o]&&(r[o].parentNode=a)):(this.root=r[o],this.root&&(this.root.parentNode=null))}const i=r.parentNode;if(i){let o=this.findMax(i);const a=o?.interval[1]??Number.NEGATIVE_INFINITY;for(;o;)o.max===r.interval[1]?(o.max=a,o=o.parentNode):o=null}}else this._removeHelper(n,r.left),this._removeHelper(n,r.right)}},{key:"remove",value:function(n){return this._removeHelper(n,this.root)}}])}();function kA(e,t,n){let r=new SA(n[0],n[1]);if(r.max=n[1],r.parentNode=e,e[t]=r,e.max<n[1])for(;r;)r.max<n[1]&&(r.max=n[1]),r=r.parentNode}function A0(e,t){e.interval[0]>t[0]?e.left?A0(e.left,t):kA(e,"left",t):e.right?A0(e.right,t):kA(e,"right",t)}function xA(e,t){if(!t)return!1;if(t.interval[0]<=e&&t.interval[1]>=e)return!0;let n=!1,r;return["left","right"].forEach(i=>{r=t[i],r&&r.max>e&&(n=n||xA(e,r))}),n}function bK(e,t){return e[0]===t[0]&&e[1]===t[1]||e[0]<t[0]&&e[1]>t[0]||e[0]<t[1]&&e[1]>t[1]||t[0]<e[0]&&t[1]>e[0]||t[0]<e[1]&&t[1]>e[1]}function CA(e,t){if(!t)return!1;if(bK(t.interval,e))return!0;let n=!1,r;return["left","right"].forEach(i=>{r=t[i],r&&r.max>=e[0]&&(n=n||CA(e,r))}),n}function M0(e){return e?1+Math.max(M0(e.left),M0(e.right)):0}function Up(e){e.sort((r,i)=>i.to-i.from-(r.to-r.from));const t=[[]],n=[new EA];for(let r=0;r<e.length;r++){let i=!1;for(let o=0;o<t.length;o++){const a=n[o],s=[+e[r].from,+e[r].to];if(!a.intersects(s)){a.add(s),t[o].push(e[r]),i=!0;break}}if(!i){const o=new EA;o.add([e[r].from,e[r].to]),t.push([e[r]]),n.push(o)}}return t}function _K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function TK(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,SK(r.key),r)}}function wK(e,t,n){return t&&TK(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function SK(e){var t=EK(e,"string");return typeof t=="symbol"?t:t+""}function EK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}let Ru=function(){function e(t){_K(this,e),this.epsilon=1e-6,this.data=t,this.tileSize=this.data.length,this.paddedTileSize=2**Math.ceil(Math.log2(this.tileSize)),this.numSubsets=Math.min(J4,this.paddedTileSize),this.subsetSize=this.paddedTileSize/this.numSubsets,this.subsetMinimums=this.computeSubsetNonZeroMinimums(),this.subsetMaximums=this.computeSubsetNonZeroMaximums(),this.minNonZeroInTile=this.getMinNonZeroInTile(),this.maxNonZeroInTile=this.getMaxNonZeroInTile()}return wK(e,[{key:"getMinNonZeroInSubset",value:function(n){const r=n[0],i=n[1];let o=Number.MAX_SAFE_INTEGER;if(r===0&&i===this.tileSize)return this.minNonZeroInTile;const a=Math.ceil(r/this.subsetSize),s=Math.floor((i-1)/this.subsetSize);return a>=s?this.minNonZero(this.data,r,i):(r<a*this.subsetSize&&(o=Math.min(o,this.minNonZero(this.data,r,a*this.subsetSize))),o=Math.min(o,this.minNonZero(this.subsetMinimums,a,s)),i>s*this.subsetSize&&(o=Math.min(o,this.minNonZero(this.data,s*this.subsetSize,i))),o)}},{key:"getMaxNonZeroInSubset",value:function(n){const r=n[0],i=n[1];let o=Number.MIN_SAFE_INTEGER;if(r===0&&i===this.tileSize)return this.maxNonZeroInTile;const a=Math.ceil(r/this.subsetSize),s=Math.floor((i-1)/this.subsetSize);return a>=s?this.maxNonZero(this.data,r,i):(r<a*this.subsetSize&&(o=Math.max(o,this.maxNonZero(this.data,r,a*this.subsetSize))),o=Math.max(o,this.maxNonZero(this.subsetMaximums,a,s)),i>s*this.subsetSize&&(o=Math.max(o,this.maxNonZero(this.data,s*this.subsetSize,i))),o)}},{key:"computeSubsetNonZeroMinimums",value:function(){const n=[];for(let r=0;r<this.numSubsets;r++){let i=Number.MAX_SAFE_INTEGER;for(let o=0;o<this.subsetSize;o++){const a=this.data[r*this.subsetSize+o];a!==void 0&&(a<this.epsilon&&a>-this.epsilon||a<i&&(i=a))}n.push(i)}return n}},{key:"computeSubsetNonZeroMaximums",value:function(){const n=[];for(let r=0;r<this.numSubsets;r++){let i=Number.MIN_SAFE_INTEGER;for(let o=0;o<this.subsetSize;o++){const a=this.data[r*this.subsetSize+o];a!==void 0&&(a<this.epsilon&&a>-this.epsilon||a>i&&(i=a))}n.push(i)}return n}},{key:"getMinNonZeroInTile",value:function(){return Math.min(...this.subsetMinimums)}},{key:"getMaxNonZeroInTile",value:function(){return Math.max(...this.subsetMaximums)}},{key:"minNonZero",value:function(n,r,i){let o=Number.MAX_SAFE_INTEGER;for(let a=r;a<i;a++){const s=n[a];s<this.epsilon&&s>-this.epsilon||s<o&&(o=s)}return o}},{key:"maxNonZero",value:function(n,r,i){let o=Number.MIN_SAFE_INTEGER;for(let a=r;a<i;a++){const s=n[a];s<this.epsilon&&s>-this.epsilon||s>o&&(o=s)}return o}}])}();function kK(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xK(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,OK(r.key),r)}}function CK(e,t,n){return t&&xK(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function OK(e){var t=PK(e,"string");return typeof t=="symbol"?t:t+""}function PK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}let I0=function(){function e(t){kK(this,e),this.epsilon=1e-6,this.tileSize=Math.sqrt(t.length),Number.isSafeInteger(this.tileSize)||console.error("The DenseDataExtrema2D module only works for data of quadratic length."),this.numSubsets=Math.min(p0,this.tileSize),this.subsetSize=this.tileSize/this.numSubsets;const n=Ns(Array.from(t),[this.tileSize,this.tileSize]);this.subsetMinimums=this.computeSubsetNonZeroMinimums(n),this.subsetMaximums=this.computeSubsetNonZeroMaximums(n),this.minNonZeroInTile=this.getMinNonZeroInTile(),this.maxNonZeroInTile=this.getMaxNonZeroInTile()}return CK(e,[{key:"getMinNonZeroInSubset",value:function(n){const r=n[0],i=n[1],o=n[2],a=n[3],s=Math.floor(i/this.subsetSize),c=Math.floor(r/this.subsetSize),l=Math.ceil((a+1)/this.subsetSize)-s,u=Math.ceil((o+1)/this.subsetSize)-c;return this.getMinNonZeroInNdarraySubset(this.subsetMinimums,s,c,u,l)}},{key:"getMaxNonZeroInSubset",value:function(n){const r=n[0],i=n[1],o=n[2],a=n[3],s=Math.floor(i/this.subsetSize),c=Math.floor(r/this.subsetSize),l=Math.ceil((a+1)/this.subsetSize)-s,u=Math.ceil((o+1)/this.subsetSize)-c;return this.getMaxNonZeroInNdarraySubset(this.subsetMaximums,s,c,u,l)}},{key:"computeSubsetNonZeroMinimums",value:function(n){const r=Ns(new Array(this.numSubsets**2),[this.numSubsets,this.numSubsets]);for(let i=0;i<this.numSubsets;i++)for(let o=0;o<this.numSubsets;o++){const a=this.getMinNonZeroInNdarraySubset(n,i*this.subsetSize,o*this.subsetSize,this.subsetSize,this.subsetSize);r.set(i,o,a)}return r}},{key:"computeSubsetNonZeroMaximums",value:function(n){const r=Ns(new Array(this.numSubsets**2),[this.numSubsets,this.numSubsets]);for(let i=0;i<this.numSubsets;i++)for(let o=0;o<this.numSubsets;o++){const a=this.getMaxNonZeroInNdarraySubset(n,i*this.subsetSize,o*this.subsetSize,this.subsetSize,this.subsetSize);r.set(i,o,a)}return r}},{key:"getMinNonZeroInNdarraySubset",value:function(n,r,i,o,a){let s=Number.MAX_SAFE_INTEGER;for(let c=0;c<o;c++)for(let l=0;l<a;l++){const u=n.get(r+l,i+c);u<this.epsilon&&u>-this.epsilon||u<s&&(s=u)}return s}},{key:"getMaxNonZeroInNdarraySubset",value:function(n,r,i,o,a){let s=Number.MIN_SAFE_INTEGER;for(let c=0;c<o;c++)for(let l=0;l<a;l++){const u=n.get(r+l,i+c);u<this.epsilon&&u>-this.epsilon||u>s&&(s=u)}return s}},{key:"mirrorPrecomputedExtrema",value:function(){for(let n=1;n<this.numSubsets;n++)for(let r=0;r<n;r++)this.subsetMinimums.set(r,n,this.subsetMinimums.get(n,r)),this.subsetMaximums.set(r,n,this.subsetMaximums.get(n,r))}},{key:"getMinNonZeroInTile",value:function(){return this.getMinNonZeroInNdarraySubset(this.subsetMinimums,0,0,this.numSubsets,this.numSubsets)}},{key:"getMaxNonZeroInTile",value:function(){return this.getMaxNonZeroInNdarraySubset(this.subsetMaximums,0,0,this.numSubsets,this.numSubsets)}}])}();const R0=e=>{let t;switch(e&&e.toLowerCase()){case"mean":t=Nm;break;case"sum":t=kC;break;case"variance":t=Em;break;case"deviation":t=km;break;default:t=Nm,console.warn("Encountered an unsupported selectedRowsAggregationMode option.")}return t},Du=(e,t)=>e.reduce((n,r)=>n+(Array.isArray(r)&&t?r.length:1),0),$s=e=>{switch(e.type){case"heatmap":case"horizontal-1d-heatmap":case"horizontal-bar":case"horizontal-line":case"horizontal-point":case"vertical-1d-heatmap":case"vertical-bar":case"vertical-line":case"vertical-point":case"horizontal-1d-tiles":case"vertical-1d-tiles":case"2d-tiles":case"horizontal-gene-annotations":case"vertical-gene-annotations":case"horizontal-heatmap":case"vertical-heatmap":case"osm-tiles":case"mapbox-tiles":case"horizontal-multivec":return!0;case"combined":return e.contents.map(n=>$s(n)).reduce(Iu,!1);default:return!1}};function OA(e,t){if(window.higlassTracksByType&&Object.keys(window.higlassTracksByType).forEach(i=>{Gt[i]=window.higlassTracksByType[i].config}),!(e in Ca)&&!t){console.warn("unknown data type:",e);return}const n={"1d-horizontal":["top","bottom","left","right"],"2d":["center"],"1d-vertical":["left","right"]},r=Ca[e]||{};if(t)for(const i of t)if(!Gt[i])console.warn("unknown track type",i);else for(const o of n[Gt[i].orientation])r[o]=i;return r}const PA=10,Zn=e=>e.options?.collapsed?PA:e.height,Qn=e=>e.options?.collapsed?PA:e.width,Vp=(e,t,n)=>{let r=t,i;return n?i=n:(i=t,r=Object.values(e.state.views)[0].uid),e.tiledPlots[r]?.trackRenderer?.getTrackObject(i)},AA=(e,t)=>e.tiledPlots[t]?.trackRenderer,AK=(e,t)=>e.tiledPlots[t];var D0={},N0,MA;function IA(){if(MA)return N0;MA=1;var e=Object.prototype.toString;return N0=function(n){var r=e.call(n),i=r==="[object Arguments]";return i||(i=r!=="[object Array]"&&n!==null&&typeof n=="object"&&typeof n.length=="number"&&n.length>=0&&e.call(n.callee)==="[object Function]"),i},N0}var L0,RA;function MK(){if(RA)return L0;RA=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=IA(),i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(h){var p=h.constructor;return p&&p.prototype===h},l={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},u=function(){if(typeof window>"u")return!1;for(var h in window)try{if(!l["$"+h]&&t.call(window,h)&&window[h]!==null&&typeof window[h]=="object")try{c(window[h])}catch{return!0}}catch{return!0}return!1}(),f=function(h){if(typeof window>"u"||!u)return c(h);try{return c(h)}catch{return!1}};e=function(p){var d=p!==null&&typeof p=="object",g=n.call(p)==="[object Function]",y=r(p),b=d&&n.call(p)==="[object String]",m=[];if(!d&&!g&&!y)throw new TypeError("Object.keys called on a non-object");var v=a&&g;if(b&&p.length>0&&!t.call(p,0))for(var _=0;_<p.length;++_)m.push(String(_));if(y&&p.length>0)for(var T=0;T<p.length;++T)m.push(String(T));else for(var w in p)!(v&&w==="prototype")&&t.call(p,w)&&m.push(String(w));if(o)for(var S=f(p),k=0;k<s.length;++k)!(S&&s[k]==="constructor")&&t.call(p,s[k])&&m.push(s[k]);return m}}return L0=e,L0}var $0,DA;function NA(){if(DA)return $0;DA=1;var e=Array.prototype.slice,t=IA(),n=Object.keys,r=n?function(a){return n(a)}:MK(),i=Object.keys;return r.shim=function(){if(Object.keys){var a=function(){var s=Object.keys(arguments);return s&&s.length===arguments.length}(1,2);a||(Object.keys=function(c){return t(c)?i(e.call(c)):i(c)})}else Object.keys=r;return Object.keys||r},$0=r,$0}var j0,LA;function Nu(){if(LA)return j0;LA=1;var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return j0=e,j0}var B0,$A;function Gp(){return $A||($A=1,B0=SyntaxError),B0}var z0,jA;function Kt(){return jA||(jA=1,z0=TypeError),z0}var H0,BA;function IK(){return BA||(BA=1,H0=Object.getOwnPropertyDescriptor),H0}var F0,zA;function Pa(){if(zA)return F0;zA=1;var e=IK();if(e)try{e([],"length")}catch{e=null}return F0=e,F0}var q0,HA;function U0(){if(HA)return q0;HA=1;var e=Nu(),t=Gp(),n=Kt(),r=Pa();return q0=function(o,a,s){if(!o||typeof o!="object"&&typeof o!="function")throw new n("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,h=!!r&&r(o,a);if(e)e(o,a,{configurable:u===null&&h?h.configurable:!u,enumerable:c===null&&h?h.enumerable:!c,value:s,writable:l===null&&h?h.writable:!l});else if(f||!c&&!l&&!u)o[a]=s;else throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},q0}var V0,FA;function Wp(){if(FA)return V0;FA=1;var e=Nu(),t=function(){return!!e};return t.hasArrayLengthDefineBug=function(){if(!e)return null;try{return e([],"length",{value:1}).length!==1}catch{return!0}},V0=t,V0}var G0,qA;function nn(){if(qA)return G0;qA=1;var e=NA(),t=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",n=Object.prototype.toString,r=Array.prototype.concat,i=U0(),o=function(l){return typeof l=="function"&&n.call(l)==="[object Function]"},a=Wp()(),s=function(l,u,f,h){if(u in l){if(h===!0){if(l[u]===f)return}else if(!o(h)||!h())return}a?i(l,u,f,!0):i(l,u,f)},c=function(l,u){var f=arguments.length>2?arguments[2]:{},h=e(u);t&&(h=r.call(h,Object.getOwnPropertySymbols(u)));for(var p=0;p<h.length;p+=1)s(l,h[p],u[h[p]],f[h[p]])};return c.supportsDescriptors=!!a,G0=c,G0}var W0={exports:{}},Y0,UA;function js(){return UA||(UA=1,Y0=Object),Y0}var X0,VA;function RK(){return VA||(VA=1,X0=Error),X0}var K0,GA;function DK(){return GA||(GA=1,K0=EvalError),K0}var Z0,WA;function YA(){return WA||(WA=1,Z0=RangeError),Z0}var Q0,XA;function NK(){return XA||(XA=1,Q0=ReferenceError),Q0}var J0,KA;function LK(){return KA||(KA=1,J0=URIError),J0}var ey,ZA;function QA(){return ZA||(ZA=1,ey=Math.abs),ey}var ty,JA;function ry(){return JA||(JA=1,ty=Math.floor),ty}var ny,e8;function $K(){return e8||(e8=1,ny=Math.max),ny}var iy,t8;function jK(){return t8||(t8=1,iy=Math.min),iy}var oy,r8;function BK(){return r8||(r8=1,oy=Math.pow),oy}var ay,n8;function zK(){return n8||(n8=1,ay=Math.round),ay}var sy,i8;function Lu(){return i8||(i8=1,sy=Number.isNaN||function(t){return t!==t}),sy}var ly,o8;function HK(){if(o8)return ly;o8=1;var e=Lu();return ly=function(n){return e(n)||n===0?n:n<0?-1:1},ly}var cy,a8;function uy(){return a8||(a8=1,cy=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;t[n]=i;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var a=Object.getOwnPropertySymbols(t);if(a.length!==1||a[0]!==n||!Object.prototype.propertyIsEnumerable.call(t,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(t,n);if(s.value!==i||s.enumerable!==!0)return!1}return!0}),cy}var fy,s8;function l8(){if(s8)return fy;s8=1;var e=typeof Symbol<"u"&&Symbol,t=uy();return fy=function(){return typeof e!="function"||typeof Symbol!="function"||typeof e("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},fy}var hy,c8;function u8(){return c8||(c8=1,hy=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),hy}var py,f8;function h8(){if(f8)return py;f8=1;var e=js();return py=e.getPrototypeOf||null,py}var dy,p8;function FK(){if(p8)return dy;p8=1;var e="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,n=Math.max,r="[object Function]",i=function(c,l){for(var u=[],f=0;f<c.length;f+=1)u[f]=c[f];for(var h=0;h<l.length;h+=1)u[h+c.length]=l[h];return u},o=function(c,l){for(var u=[],f=l,h=0;f<c.length;f+=1,h+=1)u[h]=c[f];return u},a=function(s,c){for(var l="",u=0;u<s.length;u+=1)l+=s[u],u+1<s.length&&(l+=c);return l};return dy=function(c){var l=this;if(typeof l!="function"||t.apply(l)!==r)throw new TypeError(e+l);for(var u=o(arguments,1),f,h=function(){if(this instanceof f){var b=l.apply(this,i(u,arguments));return Object(b)===b?b:this}return l.apply(c,i(u,arguments))},p=n(0,l.length-u.length),d=[],g=0;g<p;g++)d[g]="$"+g;if(f=Function("binder","return function ("+a(d,",")+"){ return binder.apply(this,arguments); }")(h),l.prototype){var y=function(){};y.prototype=l.prototype,f.prototype=new y,y.prototype=null}return f},dy}var gy,d8;function $u(){if(d8)return gy;d8=1;var e=FK();return gy=Function.prototype.bind||e,gy}var my,g8;function vy(){return g8||(g8=1,my=Function.prototype.call),my}var yy,m8;function by(){return m8||(m8=1,yy=Function.prototype.apply),yy}var _y,v8;function qK(){return v8||(v8=1,_y=typeof Reflect<"u"&&Reflect&&Reflect.apply),_y}var Ty,y8;function b8(){if(y8)return Ty;y8=1;var e=$u(),t=by(),n=vy(),r=qK();return Ty=r||e.call(n,t),Ty}var wy,_8;function Yp(){if(_8)return wy;_8=1;var e=$u(),t=Kt(),n=vy(),r=b8();return wy=function(o){if(o.length<1||typeof o[0]!="function")throw new t("a function is required");return r(e,n,o)},wy}var Sy,T8;function UK(){if(T8)return Sy;T8=1;var e=Yp(),t=Pa(),n;try{n=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var r=!!n&&t&&t(Object.prototype,"__proto__"),i=Object,o=i.getPrototypeOf;return Sy=r&&typeof r.get=="function"?e([r.get]):typeof o=="function"?function(s){return o(s==null?s:i(s))}:!1,Sy}var Ey,w8;function VK(){if(w8)return Ey;w8=1;var e=u8(),t=h8(),n=UK();return Ey=e?function(i){return e(i)}:t?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return t(i)}:n?function(i){return n(i)}:null,Ey}var ky,S8;function ao(){if(S8)return ky;S8=1;var e=Function.prototype.call,t=Object.prototype.hasOwnProperty,n=$u();return ky=n.call(e,t),ky}var xy,E8;function Jn(){if(E8)return xy;E8=1;var e,t=js(),n=RK(),r=DK(),i=YA(),o=NK(),a=Gp(),s=Kt(),c=LK(),l=QA(),u=ry(),f=$K(),h=jK(),p=BK(),d=zK(),g=HK(),y=Function,b=function(ce){try{return y('"use strict"; return ('+ce+").constructor;")()}catch{}},m=Pa(),v=Nu(),_=function(){throw new s},T=m?function(){try{return arguments.callee,_}catch{try{return m(arguments,"callee").get}catch{return _}}}():_,w=l8()(),S=VK(),k=h8(),E=u8(),P=by(),C=vy(),I={},O=typeof Uint8Array>"u"||!S?e:S(Uint8Array),M={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?e:ArrayBuffer,"%ArrayIteratorPrototype%":w&&S?S([][Symbol.iterator]()):e,"%AsyncFromSyncIteratorPrototype%":e,"%AsyncFunction%":I,"%AsyncGenerator%":I,"%AsyncGeneratorFunction%":I,"%AsyncIteratorPrototype%":I,"%Atomics%":typeof Atomics>"u"?e:Atomics,"%BigInt%":typeof BigInt>"u"?e:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":r,"%Float16Array%":typeof Float16Array>"u"?e:Float16Array,"%Float32Array%":typeof Float32Array>"u"?e:Float32Array,"%Float64Array%":typeof Float64Array>"u"?e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?e:FinalizationRegistry,"%Function%":y,"%GeneratorFunction%":I,"%Int8Array%":typeof Int8Array>"u"?e:Int8Array,"%Int16Array%":typeof Int16Array>"u"?e:Int16Array,"%Int32Array%":typeof Int32Array>"u"?e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":w&&S?S(S([][Symbol.iterator]())):e,"%JSON%":typeof JSON=="object"?JSON:e,"%Map%":typeof Map>"u"?e:Map,"%MapIteratorPrototype%":typeof Map>"u"||!w||!S?e:S(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":t,"%Object.getOwnPropertyDescriptor%":m,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?e:Promise,"%Proxy%":typeof Proxy>"u"?e:Proxy,"%RangeError%":i,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?e:Set,"%SetIteratorPrototype%":typeof Set>"u"||!w||!S?e:S(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":w&&S?S(""[Symbol.iterator]()):e,"%Symbol%":w?Symbol:e,"%SyntaxError%":a,"%ThrowTypeError%":T,"%TypedArray%":O,"%TypeError%":s,"%Uint8Array%":typeof Uint8Array>"u"?e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?e:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?e:Uint32Array,"%URIError%":c,"%WeakMap%":typeof WeakMap>"u"?e:WeakMap,"%WeakRef%":typeof WeakRef>"u"?e:WeakRef,"%WeakSet%":typeof WeakSet>"u"?e:WeakSet,"%Function.prototype.call%":C,"%Function.prototype.apply%":P,"%Object.defineProperty%":v,"%Object.getPrototypeOf%":k,"%Math.abs%":l,"%Math.floor%":u,"%Math.max%":f,"%Math.min%":h,"%Math.pow%":p,"%Math.round%":d,"%Math.sign%":g,"%Reflect.getPrototypeOf%":E};if(S)try{null.error}catch(ce){var R=S(S(ce));M["%Error.prototype%"]=R}var z=function ce(le){var me;if(le==="%AsyncFunction%")me=b("async function () {}");else if(le==="%GeneratorFunction%")me=b("function* () {}");else if(le==="%AsyncGeneratorFunction%")me=b("async function* () {}");else if(le==="%AsyncGenerator%"){var ye=ce("%AsyncGeneratorFunction%");ye&&(me=ye.prototype)}else if(le==="%AsyncIteratorPrototype%"){var Oe=ce("%AsyncGenerator%");Oe&&S&&(me=S(Oe.prototype))}return M[le]=me,me},U={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},j=$u(),H=ao(),W=j.call(C,Array.prototype.concat),re=j.call(P,Array.prototype.splice),Y=j.call(C,String.prototype.replace),F=j.call(C,String.prototype.slice),L=j.call(C,RegExp.prototype.exec),K=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,G=/\\(\\)?/g,te=function(le){var me=F(le,0,1),ye=F(le,-1);if(me==="%"&&ye!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(ye==="%"&&me!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var Oe=[];return Y(le,K,function(Re,Fe,$e,Ie){Oe[Oe.length]=$e?Y(Ie,G,"$1"):Fe||Re}),Oe},de=function(le,me){var ye=le,Oe;if(H(U,ye)&&(Oe=U[ye],ye="%"+Oe[0]+"%"),H(M,ye)){var Re=M[ye];if(Re===I&&(Re=z(ye)),typeof Re>"u"&&!me)throw new s("intrinsic "+le+" exists, but is not available. Please file an issue!");return{alias:Oe,name:ye,value:Re}}throw new a("intrinsic "+le+" does not exist!")};return xy=function(le,me){if(typeof le!="string"||le.length===0)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof me!="boolean")throw new s('"allowMissing" argument must be a boolean');if(L(/^%?[^%]*%?$/,le)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var ye=te(le),Oe=ye.length>0?ye[0]:"",Re=de("%"+Oe+"%",me),Fe=Re.name,$e=Re.value,Ie=!1,xe=Re.alias;xe&&(Oe=xe[0],re(ye,W([0,1],xe)));for(var Me=1,Be=!0;Me<ye.length;Me+=1){var De=ye[Me],qe=F(De,0,1),pe=F(De,-1);if((qe==='"'||qe==="'"||qe==="`"||pe==='"'||pe==="'"||pe==="`")&&qe!==pe)throw new a("property names with quotes must have matching quotes");if((De==="constructor"||!Be)&&(Ie=!0),Oe+="."+De,Fe="%"+Oe+"%",H(M,Fe))$e=M[Fe];else if($e!=null){if(!(De in $e)){if(!me)throw new s("base intrinsic for "+le+" exists, but the property is not available.");return}if(m&&Me+1>=ye.length){var ie=m($e,De);Be=!!ie,Be&&"get"in ie&&!("originalValue"in ie.get)?$e=ie.get:$e=$e[De]}else Be=H($e,De),$e=$e[De];Be&&!Ie&&(M[Fe]=$e)}}return $e},xy}var Cy,k8;function GK(){if(k8)return Cy;k8=1;var e=Jn(),t=U0(),n=Wp()(),r=Pa(),i=Kt(),o=e("%Math.floor%");return Cy=function(s,c){if(typeof s!="function")throw new i("`fn` is not a function");if(typeof c!="number"||c<0||c>4294967295||o(c)!==c)throw new i("`length` must be a positive 32-bit integer");var l=arguments.length>2&&!!arguments[2],u=!0,f=!0;if("length"in s&&r){var h=r(s,"length");h&&!h.configurable&&(u=!1),h&&!h.writable&&(f=!1)}return(u||f||!l)&&(n?t(s,"length",c,!0,!0):t(s,"length",c)),s},Cy}var Oy,x8;function WK(){if(x8)return Oy;x8=1;var e=$u(),t=by(),n=b8();return Oy=function(){return n(e,t,arguments)},Oy}var C8;function so(){return C8||(C8=1,function(e){var t=GK(),n=Nu(),r=Yp(),i=WK();e.exports=function(a){var s=r(arguments),c=a.length-(arguments.length-1);return t(s,1+(c>0?c:0),!0)},n?n(e.exports,"apply",{value:i}):e.exports.apply=i}(W0)),W0.exports}var Py,O8;function Yr(){if(O8)return Py;O8=1;var e=Jn(),t=Yp(),n=t([e("%String.prototype.indexOf%")]);return Py=function(i,o){var a=e(i,!!o);return typeof a=="function"&&n(i,".prototype.")>-1?t([a]):a},Py}var Ay,P8;function A8(){if(P8)return Ay;P8=1;var e=NA(),t=uy()(),n=Yr(),r=js(),i=n("Array.prototype.push"),o=n("Object.prototype.propertyIsEnumerable"),a=t?r.getOwnPropertySymbols:null;return Ay=function(c,l){if(c==null)throw new TypeError("target must be an object");var u=r(c);if(arguments.length===1)return u;for(var f=1;f<arguments.length;++f){var h=r(arguments[f]),p=e(h),d=t&&(r.getOwnPropertySymbols||a);if(d)for(var g=d(h),y=0;y<g.length;++y){var b=g[y];o(h,b)&&i(p,b)}for(var m=0;m<p.length;++m){var v=p[m];if(o(h,v)){var _=h[v];u[v]=_}}}return u},Ay}var My,M8;function I8(){if(M8)return My;M8=1;var e=A8(),t=function(){if(!Object.assign)return!1;for(var r="abcdefghijklmnopqrst",i=r.split(""),o={},a=0;a<i.length;++a)o[i[a]]=i[a];var s=Object.assign({},o),c="";for(var l in s)c+=l;return r!==c},n=function(){if(!Object.assign||!Object.preventExtensions)return!1;var r=Object.preventExtensions({1:2});try{Object.assign(r,"xy")}catch{return r[1]==="y"}return!1};return My=function(){return!Object.assign||t()||n()?e:Object.assign},My}var Iy,R8;function YK(){if(R8)return Iy;R8=1;var e=nn(),t=I8();return Iy=function(){var r=t();return e(Object,{assign:r},{assign:function(){return Object.assign!==r}}),r},Iy}var Ry,D8;function Bs(){if(D8)return Ry;D8=1;var e=nn(),t=so(),n=A8(),r=I8(),i=YK(),o=t.apply(r()),a=function(c,l){return o(Object,arguments)};return e(a,{getPolyfill:r,implementation:n,shim:i}),Ry=a,Ry}var Dy,N8;function L8(){if(N8)return Dy;N8=1;var e=Lu();return Dy=function(n){return(typeof n=="number"||typeof n=="bigint")&&!e(n)&&n!==1/0&&n!==-1/0},Dy}var Ny,$8;function j8(){if($8)return Ny;$8=1;var e=QA(),t=ry(),n=Lu(),r=L8();return Ny=function(o){if(typeof o!="number"||n(o)||!r(o))return!1;var a=e(o);return t(a)===a},Ny}var Ly,B8;function Ri(){return B8||(B8=1,Ly=function(t){return!!t&&(typeof t=="function"||typeof t=="object")}),Ly}var $y,z8;function XK(){return z8||(z8=1,$y=4294967295),$y}var jy,H8;function KK(){return H8||(H8=1,jy=typeof Reflect<"u"&&Reflect.setPrototypeOf||null),jy}var By,F8;function ZK(){if(F8)return By;F8=1;var e=js();return By=e.setPrototypeOf||null,By}var zy,q8;function QK(){if(q8)return zy;q8=1;var e=Yp(),t=Pa(),n=Kt(),r={};try{r.__proto__=null}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var i=!("toString"in r),o=t&&t(Object.prototype,"__proto__");return zy=i&&(!!o&&typeof o.set=="function"&&e([o.set])||function(s,c){if(s==null)throw new n("set Object.prototype.__proto__ called on null or undefined");return s.__proto__=c,c}),zy}var Hy,U8;function JK(){if(U8)return Hy;U8=1;var e=KK(),t=ZK(),n=QK(),r=Kt();return Hy=e?function(o,a){if(e(o,a))return o;throw new r("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:t||(n?function(o,a){return n(o,a),o}:null),Hy}var Fy,V8;function eZ(){if(V8)return Fy;V8=1;var e=Jn(),t=e("%Array.prototype%"),n=YA(),r=Gp(),i=Kt(),o=j8(),a=XK(),s=JK();return Fy=function(l){if(!o(l)||l<0)throw new i("Assertion failed: `length` must be an integer Number >= 0");if(l>a)throw new n("length is greater than (2**32 - 1)");var u=arguments.length>1?arguments[1]:t,f=[];if(u!==t){if(!s)throw new r("ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]");s(f,u)}return l!==0&&(f.length=l),f},Fy}const tZ=Zi(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var qy,G8;function W8(){if(G8)return qy;G8=1;var e=typeof Map=="function"&&Map.prototype,t=Object.getOwnPropertyDescriptor&&e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,n=e&&t&&typeof t.get=="function"?t.get:null,r=e&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,o=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=i&&o&&typeof o.get=="function"?o.get:null,s=i&&Set.prototype.forEach,c=typeof WeakMap=="function"&&WeakMap.prototype,l=c?WeakMap.prototype.has:null,u=typeof WeakSet=="function"&&WeakSet.prototype,f=u?WeakSet.prototype.has:null,h=typeof WeakRef=="function"&&WeakRef.prototype,p=h?WeakRef.prototype.deref:null,d=Boolean.prototype.valueOf,g=Object.prototype.toString,y=Function.prototype.toString,b=String.prototype.match,m=String.prototype.slice,v=String.prototype.replace,_=String.prototype.toUpperCase,T=String.prototype.toLowerCase,w=RegExp.prototype.test,S=Array.prototype.concat,k=Array.prototype.join,E=Array.prototype.slice,P=Math.floor,C=typeof BigInt=="function"?BigInt.prototype.valueOf:null,I=Object.getOwnPropertySymbols,O=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,M=typeof Symbol=="function"&&typeof Symbol.iterator=="object",R=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===M||!0)?Symbol.toStringTag:null,z=Object.prototype.propertyIsEnumerable,U=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(Ee){return Ee.__proto__}:null);function j(Ee,_e){if(Ee===1/0||Ee===-1/0||Ee!==Ee||Ee&&Ee>-1e3&&Ee<1e3||w.call(/e/,_e))return _e;var Je=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof Ee=="number"){var X=Ee<0?-P(-Ee):P(Ee);if(X!==Ee){var N=String(X),$=m.call(_e,N.length+1);return v.call(N,Je,"$&_")+"."+v.call(v.call($,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(_e,Je,"$&_")}var H=tZ,W=H.custom,re=Re(W)?W:null,Y={__proto__:null,double:'"',single:"'"},F={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};qy=function Ee(_e,Je,X,N){var $=Je||{};if(Ie($,"quoteStyle")&&!Ie(Y,$.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ie($,"maxStringLength")&&(typeof $.maxStringLength=="number"?$.maxStringLength<0&&$.maxStringLength!==1/0:$.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var ne=Ie($,"customInspect")?$.customInspect:!0;if(typeof ne!="boolean"&&ne!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ie($,"indent")&&$.indent!==null&&$.indent!==" "&&!(parseInt($.indent,10)===$.indent&&$.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ie($,"numericSeparator")&&typeof $.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var he=$.numericSeparator;if(typeof _e>"u")return"undefined";if(_e===null)return"null";if(typeof _e=="boolean")return _e?"true":"false";if(typeof _e=="string")return ae(_e,$);if(typeof _e=="number"){if(_e===0)return 1/0/_e>0?"0":"-0";var J=String(_e);return he?j(_e,J):J}if(typeof _e=="bigint"){var ee=String(_e)+"n";return he?j(_e,ee):ee}var be=typeof $.depth>"u"?5:$.depth;if(typeof X>"u"&&(X=0),X>=be&&be>0&&typeof _e=="object")return te(_e)?"[Array]":"[Object]";var ve=Qe($,X);if(typeof N>"u")N=[];else if(Be(N,_e)>=0)return"[Circular]";function je(vt,kt,pt){if(kt&&(N=E.call(N),N.push(kt)),pt){var lt={depth:$.depth};return Ie($,"quoteStyle")&&(lt.quoteStyle=$.quoteStyle),Ee(vt,lt,X+1,N)}return Ee(vt,$,X+1,N)}if(typeof _e=="function"&&!ce(_e)){var Xe=Me(_e),Ge=nt(_e,je);return"[Function"+(Xe?": "+Xe:" (anonymous)")+"]"+(Ge.length>0?" { "+k.call(Ge,", ")+" }":"")}if(Re(_e)){var Ne=M?v.call(String(_e),/^(Symbol\(.*\))_[^)]*$/,"$1"):O.call(_e);return typeof _e=="object"&&!M?ke(Ne):Ne}if(ge(_e)){for(var we="<"+T.call(String(_e.nodeName)),Ae=_e.attributes||[],Q=0;Q<Ae.length;Q++)we+=" "+Ae[Q].name+"="+L(K(Ae[Q].value),"double",$);return we+=">",_e.childNodes&&_e.childNodes.length&&(we+="..."),we+="</"+T.call(String(_e.nodeName))+">",we}if(te(_e)){if(_e.length===0)return"[]";var Z=nt(_e,je);return ve&&!Ve(Z)?"["+et(Z,ve)+"]":"[ "+k.call(Z,", ")+" ]"}if(le(_e)){var se=nt(_e,je);return!("cause"in Error.prototype)&&"cause"in _e&&!z.call(_e,"cause")?"{ ["+String(_e)+"] "+k.call(S.call("[cause]: "+je(_e.cause),se),", ")+" }":se.length===0?"["+String(_e)+"]":"{ ["+String(_e)+"] "+k.call(se,", ")+" }"}if(typeof _e=="object"&&ne){if(re&&typeof _e[re]=="function"&&H)return H(_e,{depth:be-X});if(ne!=="symbol"&&typeof _e.inspect=="function")return _e.inspect()}if(De(_e)){var Te=[];return r&&r.call(_e,function(vt,kt){Te.push(je(kt,_e,!0)+" => "+je(vt,_e))}),ze("Map",n.call(_e),Te,ve)}if(ie(_e)){var Se=[];return s&&s.call(_e,function(vt){Se.push(je(vt,_e))}),ze("Set",a.call(_e),Se,ve)}if(qe(_e))return Pe("WeakMap");if(oe(_e))return Pe("WeakSet");if(pe(_e))return Pe("WeakRef");if(ye(_e))return ke(je(Number(_e)));if(Fe(_e))return ke(je(C.call(_e)));if(Oe(_e))return ke(d.call(_e));if(me(_e))return ke(je(String(_e)));if(typeof window<"u"&&_e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&_e===globalThis||typeof globalThis<"u"&&_e===globalThis)return"{ [object globalThis] }";if(!de(_e)&&!ce(_e)){var Ue=nt(_e,je),He=U?U(_e)===Object.prototype:_e instanceof Object||_e.constructor===Object,rt=_e instanceof Object?"":"null prototype",tt=!He&&R&&Object(_e)===_e&&R in _e?m.call(xe(_e),8,-1):rt?"Object":"",dt=He||typeof _e.constructor!="function"?"":_e.constructor.name?_e.constructor.name+" ":"",ot=dt+(tt||rt?"["+k.call(S.call([],tt||[],rt||[]),": ")+"] ":"");return Ue.length===0?ot+"{}":ve?ot+"{"+et(Ue,ve)+"}":ot+"{ "+k.call(Ue,", ")+" }"}return String(_e)};function L(Ee,_e,Je){var X=Je.quoteStyle||_e,N=Y[X];return N+Ee+N}function K(Ee){return v.call(String(Ee),/"/g,"&quot;")}function G(Ee){return!R||!(typeof Ee=="object"&&(R in Ee||typeof Ee[R]<"u"))}function te(Ee){return xe(Ee)==="[object Array]"&&G(Ee)}function de(Ee){return xe(Ee)==="[object Date]"&&G(Ee)}function ce(Ee){return xe(Ee)==="[object RegExp]"&&G(Ee)}function le(Ee){return xe(Ee)==="[object Error]"&&G(Ee)}function me(Ee){return xe(Ee)==="[object String]"&&G(Ee)}function ye(Ee){return xe(Ee)==="[object Number]"&&G(Ee)}function Oe(Ee){return xe(Ee)==="[object Boolean]"&&G(Ee)}function Re(Ee){if(M)return Ee&&typeof Ee=="object"&&Ee instanceof Symbol;if(typeof Ee=="symbol")return!0;if(!Ee||typeof Ee!="object"||!O)return!1;try{return O.call(Ee),!0}catch{}return!1}function Fe(Ee){if(!Ee||typeof Ee!="object"||!C)return!1;try{return C.call(Ee),!0}catch{}return!1}var $e=Object.prototype.hasOwnProperty||function(Ee){return Ee in this};function Ie(Ee,_e){return $e.call(Ee,_e)}function xe(Ee){return g.call(Ee)}function Me(Ee){if(Ee.name)return Ee.name;var _e=b.call(y.call(Ee),/^function\s*([\w$]+)/);return _e?_e[1]:null}function Be(Ee,_e){if(Ee.indexOf)return Ee.indexOf(_e);for(var Je=0,X=Ee.length;Je<X;Je++)if(Ee[Je]===_e)return Je;return-1}function De(Ee){if(!n||!Ee||typeof Ee!="object")return!1;try{n.call(Ee);try{a.call(Ee)}catch{return!0}return Ee instanceof Map}catch{}return!1}function qe(Ee){if(!l||!Ee||typeof Ee!="object")return!1;try{l.call(Ee,l);try{f.call(Ee,f)}catch{return!0}return Ee instanceof WeakMap}catch{}return!1}function pe(Ee){if(!p||!Ee||typeof Ee!="object")return!1;try{return p.call(Ee),!0}catch{}return!1}function ie(Ee){if(!a||!Ee||typeof Ee!="object")return!1;try{a.call(Ee);try{n.call(Ee)}catch{return!0}return Ee instanceof Set}catch{}return!1}function oe(Ee){if(!f||!Ee||typeof Ee!="object")return!1;try{f.call(Ee,f);try{l.call(Ee,l)}catch{return!0}return Ee instanceof WeakSet}catch{}return!1}function ge(Ee){return!Ee||typeof Ee!="object"?!1:typeof HTMLElement<"u"&&Ee instanceof HTMLElement?!0:typeof Ee.nodeName=="string"&&typeof Ee.getAttribute=="function"}function ae(Ee,_e){if(Ee.length>_e.maxStringLength){var Je=Ee.length-_e.maxStringLength,X="... "+Je+" more character"+(Je>1?"s":"");return ae(m.call(Ee,0,_e.maxStringLength),_e)+X}var N=F[_e.quoteStyle||"single"];N.lastIndex=0;var $=v.call(v.call(Ee,N,"\\$1"),/[\x00-\x1f]/g,fe);return L($,"single",_e)}function fe(Ee){var _e=Ee.charCodeAt(0),Je={8:"b",9:"t",10:"n",12:"f",13:"r"}[_e];return Je?"\\"+Je:"\\x"+(_e<16?"0":"")+_.call(_e.toString(16))}function ke(Ee){return"Object("+Ee+")"}function Pe(Ee){return Ee+" { ? }"}function ze(Ee,_e,Je,X){var N=X?et(Je,X):k.call(Je,", ");return Ee+" ("+_e+") {"+N+"}"}function Ve(Ee){for(var _e=0;_e<Ee.length;_e++)if(Be(Ee[_e],`
169
169
  `)>=0)return!1;return!0}function Qe(Ee,_e){var Je;if(Ee.indent===" ")Je=" ";else if(typeof Ee.indent=="number"&&Ee.indent>0)Je=k.call(Array(Ee.indent+1)," ");else return null;return{base:Je,prev:k.call(Array(_e+1),Je)}}function et(Ee,_e){if(Ee.length===0)return"";var Je=`
170
170
  `+_e.prev+_e.base;return Je+k.call(Ee,","+Je)+`
@@ -238,7 +238,7 @@
238
238
  `+String(ie)+`
239
239
  `)}return oe}(),enumerable:!1,configurable:!1})}qe("node","Consider using the getElement() method instead."),qe("nodes","Consider using the getElements() method instead."),qe("renderer",""),qe("options",""),qe("complexSelector",""),e.default=Me}(xT)),xT}var CT={},p7;function GQ(){return p7||(p7=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=i;var t=u7(),n=r(t);function r(o){return o&&o.__esModule?o:{default:o}}function i(o,a){return new n.default(o,null,a)}}(CT)),CT}var OT={},d7;function WQ(){return d7||(d7=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=i;var t=h7(),n=r(t);function r(o){return o&&o.__esModule?o:{default:o}}function i(o,a){return new n.default(o,null,a)}}(OT)),OT}var PT={},g7;function YQ(){return g7||(g7=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var t=Bs(),n=a(t),r=Fa(),i=a(r),o=ad();function a(c){return c&&c.__esModule?c:{default:c}}function s(c){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=(0,i.default)(l),f=u.createRenderer((0,n.default)({mode:"string"},l)),h=f.render(c,l.context);return(0,o.loadCheerioRoot)(h)}}(PT)),PT}var AT,m7;function XQ(){if(m7)return AT;m7=1;var e=u7(),t=p(e),n=h7(),r=p(n),i=kI(),o=p(i),a=GQ(),s=p(a),c=WQ(),l=p(c),u=YQ(),f=p(u),h=oT();function p(d){return d&&d.__esModule?d:{default:d}}return AT={render:f.default,shallow:l.default,mount:s.default,ShallowWrapper:r.default,ReactWrapper:t.default,configure:h.merge,EnzymeAdapter:o.default},AT}var KQ=XQ();const ud=new WeakMap;let fd=null,hd=!1;typeof bn.createRoot=="function"&&(fd=bn.createRoot,hd=!0);const ZQ=hd?Promise.resolve():import("react-dom/client").then(e=>{typeof e.createRoot=="function"&&(fd=e.createRoot)}).catch(()=>{}).finally(()=>{hd=!0});async function QQ(){hd||await ZQ}function JQ(e,t){if(fd){const r=fd(e);r.render(t);const i={unmount:()=>r.unmount()};return ud.set(e,i),i}bn.render(t,e);const n={unmount:()=>bn.unmountComponentAtNode(e)};return ud.set(e,n),n}function v7(e){const t=ud.get(e);t?(t.unmount(),ud.delete(e)):typeof bn.unmountComponentAtNode=="function"&&bn.unmountComponentAtNode(e)}const MT=100,eJ=(e,t,n,r)=>{for(const{viewId:i,trackId:o,track:a}of e.instance().iterateOverTracks())i===t&&o===n&&(a.options={...a.options,...r});e.setState(e.instance().state)},tJ=e=>{for(const t of e.iterateOverTracks())if(AA(e,t.viewId)?.activeTransitions)return!0;return!1},IT=(e,t)=>{tJ(e)?setTimeout(()=>{IT(e,t)},MT):t()},pd=e=>{vf>0?setTimeout(()=>pd(e),MT):e()},rJ=e=>{for(const t of e.iterateOverTracks()){let n=Vp(e,t.viewId,t.trackId);if(!(!t.track.server&&!t.track.tilesetUid&&!(t.track.data&&t.track.data.type==="divided")&&!(t.track.data&&t.track.data.type==="local-tiles")))if(t.track.data&&t.track.data.type==="divided"||t.track.server&&t.track.tilesetUid||t.track.data&&t.track.data.type==="local-tiles"){if(!n||(n.originalTrack&&(n=n.originalTrack),!(n.tilesetInfo||n.chromInfo))||n.fetching?.size)return!0}else throw Error('"server" and "tilesetUid" belong together')}return!1},lf=(e,t)=>{rJ(e)?setTimeout(()=>{lf(e,t)},MT):t()},RT=(e,t,n,r,i={})=>{const{style:o="width:800px; background-color: lightgreen;",bounded:a=!1,extendedDelay:s=!1}=i;t&&(t.unmount(),t.detach()),e&&globalThis.document.body.removeChild(e);const c=globalThis.document.createElement("div");globalThis.document.body.appendChild(c),c.setAttribute("style",o),c.setAttribute("id","simple-hg-component");const l=KQ.mount(x.createElement(Uc,{options:{bounded:a},viewConfig:n}),{attachTo:c});return l.update(),pd(()=>{if(s){const u=()=>setTimeout(()=>{r()},1e3);lf(l.instance(),u)}else lf(l.instance(),r)}),[c,l]},nJ=e=>{e&&(v7(e),document.body.removeChild(e))};async function iJ(e,t,n,r){let i;return await new Promise(o=>{i=RT(e,t,n,o,r)}),i}var oJ={value:()=>{}};function Ks(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new dd(n)}function dd(e){this._=e}function aJ(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}dd.prototype=Ks.prototype={constructor:dd,on:function(e,t){var n=this._,r=aJ(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((i=(e=r[o]).type)&&(i=sJ(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<a;)if(i=(e=r[o]).type)n[i]=y7(n[i],e.name,t);else if(t==null)for(i in n)n[i]=y7(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new dd(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function sJ(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function y7(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=oJ,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}function DT(e){e.stopImmediatePropagation()}function Zs(e){e.preventDefault(),e.stopImmediatePropagation()}function gd(e){var t=e.document.documentElement,n=_t(e).on("dragstart.drag",Zs,!0);"onselectstart"in t?n.on("selectstart.drag",Zs,!0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function md(e,t){var n=e.document.documentElement,r=_t(e).on("dragstart.drag",null);t&&(r.on("click.drag",Zs,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const vd=e=>()=>e;function NT(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}NT.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function lJ(e){return!e.ctrlKey&&!e.button}function cJ(){return this.parentNode}function uJ(e,t){return t??{x:e.x,y:e.y}}function fJ(){return navigator.maxTouchPoints||"ontouchstart"in this}function go(){var e=lJ,t=cJ,n=uJ,r=fJ,i={},o=Ks("start","drag","end"),a=0,s,c,l,u,f=0;function h(_){_.on("mousedown.drag",p).filter(r).on("touchstart.drag",y).on("touchmove.drag",b).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(_,T){if(!(u||!e.call(this,_,T))){var w=v(this,t.call(this,_,T),_,T,"mouse");w&&(_t(_.view).on("mousemove.drag",d,!0).on("mouseup.drag",g,!0),gd(_.view),DT(_),l=!1,s=_.clientX,c=_.clientY,w("start",_))}}function d(_){if(Zs(_),!l){var T=_.clientX-s,w=_.clientY-c;l=T*T+w*w>f}i.mouse("drag",_)}function g(_){_t(_.view).on("mousemove.drag mouseup.drag",null),md(_.view,l),Zs(_),i.mouse("end",_)}function y(_,T){if(e.call(this,_,T)){var w=_.changedTouches,S=t.call(this,_,T),k=w.length,E,P;for(E=0;E<k;++E)(P=v(this,S,_,T,w[E].identifier,w[E]))&&(DT(_),P("start",_,w[E]))}}function b(_){var T=_.changedTouches,w=T.length,S,k;for(S=0;S<w;++S)(k=i[T[S].identifier])&&(Zs(_),k("drag",_,T[S]))}function m(_){var T=_.changedTouches,w=T.length,S,k;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),S=0;S<w;++S)(k=i[T[S].identifier])&&(DT(_),k("end",_,T[S]))}function v(_,T,w,S,k,E){var P=o.copy(),C=Xt(E||w,T),I,O,M;if((M=n.call(_,new NT("beforestart",{sourceEvent:w,target:h,identifier:k,active:a,x:C[0],y:C[1],dx:0,dy:0,dispatch:P}),S))!=null)return I=M.x-C[0]||0,O=M.y-C[1]||0,function R(z,U,j){var H=C,W;switch(z){case"start":i[k]=R,W=a++;break;case"end":delete i[k],--a;case"drag":C=Xt(j||U,T),W=a;break}P.call(z,_,new NT(z,{sourceEvent:U,subject:M,target:h,identifier:k,active:W,x:C[0]+I,y:C[1]+O,dx:C[0]-H[0],dy:C[1]-H[1],dispatch:P}),S)}}return h.filter=function(_){return arguments.length?(e=typeof _=="function"?_:vd(!!_),h):e},h.container=function(_){return arguments.length?(t=typeof _=="function"?_:vd(_),h):t},h.subject=function(_){return arguments.length?(n=typeof _=="function"?_:vd(_),h):n},h.touchable=function(_){return arguments.length?(r=typeof _=="function"?_:vd(!!_),h):r},h.on=function(){var _=o.on.apply(o,arguments);return _===o?h:_},h.clickDistance=function(_){return arguments.length?(f=(_=+_)*_,h):Math.sqrt(f)},h}const hJ=Object.freeze(Object.defineProperty({__proto__:null,drag:go,dragDisable:gd,dragEnable:md},Symbol.toStringTag,{value:"Module"}));var Qs=0,cf=0,uf=0,b7=1e3,yd,ff,bd=0,Ua=0,_d=0,hf=typeof performance=="object"&&performance.now?performance:Date,_7=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function LT(){return Ua||(_7(pJ),Ua=hf.now()+_d)}function pJ(){Ua=0}function Td(){this._call=this._time=this._next=null}Td.prototype=T7.prototype={constructor:Td,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?LT():+n)+(t==null?0:+t),!this._next&&ff!==this&&(ff?ff._next=this:yd=this,ff=this),this._call=e,this._time=n,$T()},stop:function(){this._call&&(this._call=null,this._time=1/0,$T())}};function T7(e,t,n){var r=new Td;return r.restart(e,t,n),r}function dJ(){LT(),++Qs;for(var e=yd,t;e;)(t=Ua-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qs}function w7(){Ua=(bd=hf.now())+_d,Qs=cf=0;try{dJ()}finally{Qs=0,mJ(),Ua=0}}function gJ(){var e=hf.now(),t=e-bd;t>b7&&(_d-=t,bd=e)}function mJ(){for(var e,t=yd,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:yd=n);ff=e,$T(r)}function $T(e){if(!Qs){cf&&(cf=clearTimeout(cf));var t=e-Ua;t>24?(e<1/0&&(cf=setTimeout(w7,e-hf.now()-_d)),uf&&(uf=clearInterval(uf))):(uf||(bd=hf.now(),uf=setInterval(gJ,b7)),Qs=1,_7(w7))}}function S7(e,t,n){var r=new Td;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var vJ=Ks("start","end","cancel","interrupt"),yJ=[],E7=0,jT=1,BT=2,wd=3,k7=4,zT=5,Sd=6;function Ed(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;bJ(e,n,{name:t,index:r,group:i,on:vJ,tween:yJ,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:E7})}function HT(e,t){var n=pi(e,t);if(n.state>E7)throw new Error("too late; already scheduled");return n}function Ni(e,t){var n=pi(e,t);if(n.state>wd)throw new Error("too late; already running");return n}function pi(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function bJ(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=T7(o,0,n.time);function o(l){n.state=jT,n.timer.restart(a,n.delay,n.time),n.delay<=l&&a(l-n.delay)}function a(l){var u,f,h,p;if(n.state!==jT)return c();for(u in r)if(p=r[u],p.name===n.name){if(p.state===wd)return S7(a);p.state===k7?(p.state=Sd,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[u]):+u<t&&(p.state=Sd,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[u])}if(S7(function(){n.state===wd&&(n.state=k7,n.timer.restart(s,n.delay,n.time),s(l))}),n.state=BT,n.on.call("start",e,e.__data__,n.index,n.group),n.state===BT){for(n.state=wd,i=new Array(h=n.tween.length),u=0,f=-1;u<h;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=p);i.length=f+1}}function s(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=zT,1),f=-1,h=i.length;++f<h;)i[f].call(e,u);n.state===zT&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Sd,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function pf(e,t){var n=e.__transition,r,i,o=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){o=!1;continue}i=r.state>BT&&r.state<zT,r.state=Sd,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}o&&delete e.__transition}}function _J(e){return this.each(function(){pf(this,e)})}function TJ(e,t){var n,r;return function(){var i=Ni(this,e),o=i.tween;if(o!==n){r=n=o;for(var a=0,s=r.length;a<s;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function wJ(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Ni(this,e),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}o.tween=i}}function SJ(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=pi(this.node(),n).tween,i=0,o=r.length,a;i<o;++i)if((a=r[i]).name===e)return a.value;return null}return this.each((t==null?TJ:wJ)(n,e,t))}function FT(e,t,n){var r=e._id;return e.each(function(){var i=Ni(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return pi(i,r).value[t]}}function x7(e,t){var n;return(typeof t=="number"?Vn:t instanceof Tn?bs:(n=Tn(t))?(t=n,bs):Qm)(e,t)}function EJ(e){return function(){this.removeAttribute(e)}}function kJ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function xJ(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=t(r=a,n)}}function CJ(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=t(r=a,n)}}function OJ(e,t,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s)))}}function PJ(e,t,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s)))}}function AJ(e,t){var n=ya(e),r=n==="transform"?aO:x7;return this.attrTween(e,typeof t=="function"?(n.local?PJ:OJ)(n,r,FT(this,"attr."+e,t)):t==null?(n.local?kJ:EJ)(n):(n.local?CJ:xJ)(n,r,t))}function MJ(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function IJ(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function RJ(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&IJ(e,o)),n}return i._value=t,i}function DJ(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&MJ(e,o)),n}return i._value=t,i}function NJ(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=ya(e);return this.tween(n,(r.local?RJ:DJ)(r,t))}function LJ(e,t){return function(){HT(this,e).delay=+t.apply(this,arguments)}}function $J(e,t){return t=+t,function(){HT(this,e).delay=t}}function jJ(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?LJ:$J)(t,e)):pi(this.node(),t).delay}function BJ(e,t){return function(){Ni(this,e).duration=+t.apply(this,arguments)}}function zJ(e,t){return t=+t,function(){Ni(this,e).duration=t}}function HJ(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?BJ:zJ)(t,e)):pi(this.node(),t).duration}function FJ(e,t){if(typeof t!="function")throw new Error;return function(){Ni(this,e).ease=t}}function qJ(e){var t=this._id;return arguments.length?this.each(FJ(t,e)):pi(this.node(),t).ease}function UJ(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ni(this,e).ease=n}}function VJ(e){if(typeof e!="function")throw new Error;return this.each(UJ(this._id,e))}function GJ(e){typeof e!="function"&&(e=ap(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],c,l=0;l<a;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&s.push(c);return new Li(r,this._parents,this._name,this._id)}function WJ(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var c=t[s],l=n[s],u=c.length,f=a[s]=new Array(u),h,p=0;p<u;++p)(h=c[p]||l[p])&&(f[p]=h);for(;s<r;++s)a[s]=t[s];return new Li(a,this._parents,this._name,this._id)}function YJ(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function XJ(e,t,n){var r,i,o=YJ(t)?HT:Ni;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function KJ(e,t){var n=this._id;return arguments.length<2?pi(this.node(),n).on.on(e):this.each(XJ(n,e,t))}function ZJ(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function QJ(){return this.on("end.remove",ZJ(this._id))}function JJ(e){var t=this._name,n=this._id;typeof e!="function"&&(e=lu(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s=r[a],c=s.length,l=o[a]=new Array(c),u,f,h=0;h<c;++h)(u=s[h])&&(f=e.call(u,u.__data__,h,s))&&("__data__"in u&&(f.__data__=u.__data__),l[h]=f,Ed(l[h],t,n,h,l,pi(u,n)));return new Li(o,this._parents,t,n)}function eee(e){var t=this._name,n=this._id;typeof e!="function"&&(e=op(e));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),p,d=pi(u,n),g=0,y=h.length;g<y;++g)(p=h[g])&&Ed(p,t,n,g,h,d);o.push(h),a.push(u)}return new Li(o,a,t,n)}var tee=li.prototype.constructor;function ree(){return new tee(this._groups,this._parents)}function nee(e,t){var n,r,i;return function(){var o=Wn(this,e),a=(this.style.removeProperty(e),Wn(this,e));return o===a?null:o===n&&a===r?i:i=t(n=o,r=a)}}function C7(e){return function(){this.style.removeProperty(e)}}function iee(e,t,n){var r,i=n+"",o;return function(){var a=Wn(this,e);return a===i?null:a===r?o:o=t(r=a,n)}}function oee(e,t,n){var r,i,o;return function(){var a=Wn(this,e),s=n(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Wn(this,e))),a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s))}}function aee(e,t){var n,r,i,o="style."+t,a="end."+o,s;return function(){var c=Ni(this,e),l=c.on,u=c.value[o]==null?s||(s=C7(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(a,i=u),c.on=r}}function see(e,t,n){var r=(e+="")=="transform"?oO:x7;return t==null?this.styleTween(e,nee(e,r)).on("end.style."+e,C7(e)):typeof t=="function"?this.styleTween(e,oee(e,r,FT(this,"style."+e,t))).each(aee(this._id,e)):this.styleTween(e,iee(e,r,t),n).on("end.style."+e,null)}function lee(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function cee(e,t,n){var r,i;function o(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&lee(e,a,n)),r}return o._value=t,o}function uee(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,cee(e,t,n??""))}function fee(e){return function(){this.textContent=e}}function hee(e){return function(){var t=e(this);this.textContent=t??""}}function pee(e){return this.tween("text",typeof e=="function"?hee(FT(this,"text",e)):fee(e==null?"":e+""))}function dee(e){return function(t){this.textContent=e.call(this,t)}}function gee(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&dee(i)),t}return r._value=e,r}function mee(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,gee(e))}function vee(){for(var e=this._name,t=this._id,n=P7(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,l=0;l<s;++l)if(c=a[l]){var u=pi(c,t);Ed(c,e,n,l,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Li(r,this._parents,e,n)}function yee(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},c={value:function(){--i===0&&o()}};n.each(function(){var l=Ni(this,r),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),l.on=t}),i===0&&o()})}var bee=0;function Li(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function O7(e){return li().transition(e)}function P7(){return++bee}var mo=li.prototype;Li.prototype=O7.prototype={constructor:Li,select:JJ,selectAll:eee,selectChild:mo.selectChild,selectChildren:mo.selectChildren,filter:GJ,merge:WJ,selection:ree,transition:vee,call:mo.call,nodes:mo.nodes,node:mo.node,size:mo.size,empty:mo.empty,each:mo.each,on:KJ,attr:AJ,attrTween:NJ,style:see,styleTween:uee,text:pee,textTween:mee,remove:QJ,tween:SJ,delay:jJ,duration:HJ,ease:qJ,easeVarying:VJ,end:yee,[Symbol.iterator]:mo[Symbol.iterator]};function _ee(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Tee={time:null,delay:0,duration:250,ease:_ee};function wee(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function See(e){var t,n;e instanceof Li?(t=e._id,e=e._name):(t=P7(),(n=Tee).time=LT(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,l=0;l<s;++l)(c=a[l])&&Ed(c,e,t,l,a,n||wee(c,t));return new Li(r,this._parents,e,t)}li.prototype.interrupt=_J,li.prototype.transition=See;var Eee=[null];function kee(e,t){var n=e.__transition,r,i;if(n){t=t==null?null:t+"";for(i in n)if((r=n[i]).state>jT&&r.name===t)return new Li([[e]],Eee,t,+i)}return null}const xee=Object.freeze(Object.defineProperty({__proto__:null,active:kee,interrupt:pf,transition:O7},Symbol.toStringTag,{value:"Module"})),kd=e=>()=>e;function Cee(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function $i(e,t,n){this.k=e,this.x=t,this.y=n}$i.prototype={constructor:$i,scale:function(e){return e===1?this:new $i(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new $i(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ar=new $i(1,0,0);A7.prototype=$i.prototype;function A7(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ar;return e.__zoom}function qT(e){e.stopImmediatePropagation()}function df(e){e.preventDefault(),e.stopImmediatePropagation()}function Oee(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Pee(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function M7(){return this.__zoom||Ar}function Aee(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Mee(){return navigator.maxTouchPoints||"ontouchstart"in this}function Iee(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function UT(){var e=Oee,t=Pee,n=Iee,r=Aee,i=Mee,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,c=qq,l=Ks("start","zoom","end"),u,f,h,p=500,d=150,g=0,y=10;function b(M){M.property("__zoom",M7).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",P).filter(i).on("touchstart.zoom",C).on("touchmove.zoom",I).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(M,R,z,U){var j=M.selection?M.selection():M;j.property("__zoom",M7),M!==j?T(M,R,z,U):j.interrupt().each(function(){w(this,arguments).event(U).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},b.scaleBy=function(M,R,z,U){b.scaleTo(M,function(){var j=this.__zoom.k,H=typeof R=="function"?R.apply(this,arguments):R;return j*H},z,U)},b.scaleTo=function(M,R,z,U){b.transform(M,function(){var j=t.apply(this,arguments),H=this.__zoom,W=z==null?_(j):typeof z=="function"?z.apply(this,arguments):z,re=H.invert(W),Y=typeof R=="function"?R.apply(this,arguments):R;return n(v(m(H,Y),W,re),j,a)},z,U)},b.translateBy=function(M,R,z,U){b.transform(M,function(){return n(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof z=="function"?z.apply(this,arguments):z),t.apply(this,arguments),a)},null,U)},b.translateTo=function(M,R,z,U,j){b.transform(M,function(){var H=t.apply(this,arguments),W=this.__zoom,re=U==null?_(H):typeof U=="function"?U.apply(this,arguments):U;return n(Ar.translate(re[0],re[1]).scale(W.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof z=="function"?-z.apply(this,arguments):-z),H,a)},U,j)};function m(M,R){return R=Math.max(o[0],Math.min(o[1],R)),R===M.k?M:new $i(R,M.x,M.y)}function v(M,R,z){var U=R[0]-z[0]*M.k,j=R[1]-z[1]*M.k;return U===M.x&&j===M.y?M:new $i(M.k,U,j)}function _(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function T(M,R,z,U){M.on("start.zoom",function(){w(this,arguments).event(U).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(U).end()}).tween("zoom",function(){var j=this,H=arguments,W=w(j,H).event(U),re=t.apply(j,H),Y=z==null?_(re):typeof z=="function"?z.apply(j,H):z,F=Math.max(re[1][0]-re[0][0],re[1][1]-re[0][1]),L=j.__zoom,K=typeof R=="function"?R.apply(j,H):R,G=c(L.invert(Y).concat(F/L.k),K.invert(Y).concat(F/K.k));return function(te){if(te===1)te=K;else{var de=G(te),ce=F/de[2];te=new $i(ce,Y[0]-de[0]*ce,Y[1]-de[1]*ce)}W.zoom(null,te)}})}function w(M,R,z){return!z&&M.__zooming||new S(M,R)}function S(M,R){this.that=M,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,R),this.taps=0}S.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,R){return this.mouse&&M!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var R=_t(this.that).datum();l.call(M,this.that,new Cee(M,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:l}),R)}};function k(M,...R){if(!e.apply(this,arguments))return;var z=w(this,R).event(M),U=this.__zoom,j=Math.max(o[0],Math.min(o[1],U.k*Math.pow(2,r.apply(this,arguments)))),H=Xt(M);if(z.wheel)(z.mouse[0][0]!==H[0]||z.mouse[0][1]!==H[1])&&(z.mouse[1]=U.invert(z.mouse[0]=H)),clearTimeout(z.wheel);else{if(U.k===j)return;z.mouse=[H,U.invert(H)],pf(this),z.start()}df(M),z.wheel=setTimeout(W,d),z.zoom("mouse",n(v(m(U,j),z.mouse[0],z.mouse[1]),z.extent,a));function W(){z.wheel=null,z.end()}}function E(M,...R){if(h||!e.apply(this,arguments))return;var z=M.currentTarget,U=w(this,R,!0).event(M),j=_t(M.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",F,!0),H=Xt(M,z),W=M.clientX,re=M.clientY;gd(M.view),qT(M),U.mouse=[H,this.__zoom.invert(H)],pf(this),U.start();function Y(L){if(df(L),!U.moved){var K=L.clientX-W,G=L.clientY-re;U.moved=K*K+G*G>g}U.event(L).zoom("mouse",n(v(U.that.__zoom,U.mouse[0]=Xt(L,z),U.mouse[1]),U.extent,a))}function F(L){j.on("mousemove.zoom mouseup.zoom",null),md(L.view,U.moved),df(L),U.event(L).end()}}function P(M,...R){if(e.apply(this,arguments)){var z=this.__zoom,U=Xt(M.changedTouches?M.changedTouches[0]:M,this),j=z.invert(U),H=z.k*(M.shiftKey?.5:2),W=n(v(m(z,H),U,j),t.apply(this,R),a);df(M),s>0?_t(this).transition().duration(s).call(T,W,U,M):_t(this).call(b.transform,W,U,M)}}function C(M,...R){if(e.apply(this,arguments)){var z=M.touches,U=z.length,j=w(this,R,M.changedTouches.length===U).event(M),H,W,re,Y;for(qT(M),W=0;W<U;++W)re=z[W],Y=Xt(re,this),Y=[Y,this.__zoom.invert(Y),re.identifier],j.touch0?!j.touch1&&j.touch0[2]!==Y[2]&&(j.touch1=Y,j.taps=0):(j.touch0=Y,H=!0,j.taps=1+!!u);u&&(u=clearTimeout(u)),H&&(j.taps<2&&(f=Y[0],u=setTimeout(function(){u=null},p)),pf(this),j.start())}}function I(M,...R){if(this.__zooming){var z=w(this,R).event(M),U=M.changedTouches,j=U.length,H,W,re,Y;for(df(M),H=0;H<j;++H)W=U[H],re=Xt(W,this),z.touch0&&z.touch0[2]===W.identifier?z.touch0[0]=re:z.touch1&&z.touch1[2]===W.identifier&&(z.touch1[0]=re);if(W=z.that.__zoom,z.touch1){var F=z.touch0[0],L=z.touch0[1],K=z.touch1[0],G=z.touch1[1],te=(te=K[0]-F[0])*te+(te=K[1]-F[1])*te,de=(de=G[0]-L[0])*de+(de=G[1]-L[1])*de;W=m(W,Math.sqrt(te/de)),re=[(F[0]+K[0])/2,(F[1]+K[1])/2],Y=[(L[0]+G[0])/2,(L[1]+G[1])/2]}else if(z.touch0)re=z.touch0[0],Y=z.touch0[1];else return;z.zoom("touch",n(v(W,re,Y),z.extent,a))}}function O(M,...R){if(this.__zooming){var z=w(this,R).event(M),U=M.changedTouches,j=U.length,H,W;for(qT(M),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),H=0;H<j;++H)W=U[H],z.touch0&&z.touch0[2]===W.identifier?delete z.touch0:z.touch1&&z.touch1[2]===W.identifier&&delete z.touch1;if(z.touch1&&!z.touch0&&(z.touch0=z.touch1,delete z.touch1),z.touch0)z.touch0[1]=this.__zoom.invert(z.touch0[0]);else if(z.end(),z.taps===2&&(W=Xt(W,this),Math.hypot(f[0]-W[0],f[1]-W[1])<y)){var re=_t(this).on("dblclick.zoom");re&&re.apply(this,arguments)}}}return b.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:kd(+M),b):r},b.filter=function(M){return arguments.length?(e=typeof M=="function"?M:kd(!!M),b):e},b.touchable=function(M){return arguments.length?(i=typeof M=="function"?M:kd(!!M),b):i},b.extent=function(M){return arguments.length?(t=typeof M=="function"?M:kd([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),b):t},b.scaleExtent=function(M){return arguments.length?(o[0]=+M[0],o[1]=+M[1],b):[o[0],o[1]]},b.translateExtent=function(M){return arguments.length?(a[0][0]=+M[0][0],a[1][0]=+M[1][0],a[0][1]=+M[0][1],a[1][1]=+M[1][1],b):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},b.constrain=function(M){return arguments.length?(n=M,b):n},b.duration=function(M){return arguments.length?(s=+M,b):s},b.interpolate=function(M){return arguments.length?(c=M,b):c},b.on=function(){var M=l.on.apply(l,arguments);return M===l?b:M},b.clickDistance=function(M){return arguments.length?(g=(M=+M)*M,b):Math.sqrt(g)},b.tapDistance=function(M){return arguments.length?(y=+M,b):y},b}const Ree=Object.freeze(Object.defineProperty({__proto__:null,ZoomTransform:$i,zoom:UT,zoomIdentity:Ar,zoomTransform:A7},Symbol.toStringTag,{value:"Module"}));function Dee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,$ee(r.key),r)}}function Lee(e,t,n){return t&&Nee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $ee(e){var t=jee(e,"string");return typeof t=="symbol"?t:t+""}function jee(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}const Bee=40,vo=0,gf=5,I7=4;let xd=function(){function e(t){Dee(this,e),this.pAxis=new Ye.PIXI.Graphics,this.track=t,this.axisTexts=[],this.axisTextFontFamily="Arial",this.axisTextFontSize=10}return Lee(e,[{key:"startAxis",value:function(n){const r=this.pAxis;r.clear(),r.lineStyle(1,this.track.getTheme()===Qt?gt("#ffffff"):0,1),r.moveTo(0,0),r.lineTo(0,n)}},{key:"createAxisTexts",value:function(n,r){this.tickValues=this.calculateAxisTickValues(n,r);let i=0;const o=this.track.getTheme()===Qt?"white":"black";for(!this.track.options||!this.track.options.axisLabelFormatting||this.track.options.axisLabelFormatting==="scientific"?this.tickFormat=Fr(".2"):this.tickFormat=a=>a;i<this.tickValues.length;){const a=this.tickValues[i];for(;this.axisTexts.length<=i;){const s=new Ye.PIXI.Text(a,{fontSize:`${this.axisTextFontSize}px`,fontFamily:this.axisTextFontFamily,fill:o});this.axisTexts.push(s),this.pAxis.addChild(s)}this.axisTexts[i].text=this.tickFormat(a),this.axisTexts[i].anchor.y=.5,this.axisTexts[i].anchor.x=.5,i++}for(;this.axisTexts.length>this.tickValues.length;){const a=this.axisTexts.pop();this.pAxis.removeChild(a),a.destroy(!0)}}},{key:"calculateAxisTickValues",value:function(n,r){const i=Math.max(Math.ceil(r/Bee),1);let o=n.ticks(i);return o.length<1&&(o=n.ticks(i+1),o.length>1&&(o=[o[0]])),o}},{key:"drawAxisLeft",value:function(n,r){this.startAxis(r),this.createAxisTexts(n,r);const i=this.pAxis;this.track.getTheme()===Qt&&i.lineStyle(i.lineWidth||i._lineStyle.width,gt("#ffffff")),i.moveTo(0,0),i.lineTo(-5,0),i.moveTo(0,r),i.lineTo(-5,r);for(let o=0;o<this.axisTexts.length;o++){const a=this.tickValues[o];this.axisTexts[o].x=-(vo+gf+I7+this.axisTexts[o].width/2),this.axisTexts[o].y=n(a),i.moveTo(-vo,n(a)),i.lineTo(-5,n(a)),this.track?.flipText&&(this.axisTexts[o].scale.x=-1)}this.hideOverlappingAxisLabels()}},{key:"drawAxisRight",value:function(n,r){this.startAxis(r),this.createAxisTexts(n,r);const i=this.pAxis;this.track.getTheme()===Qt&&i.lineStyle(i.lineWidth||i._lineStyle.width,gt("#ffffff")),i.moveTo(0,0),i.lineTo(vo+gf,0),i.moveTo(0,r),i.lineTo(vo+gf,r);for(let o=0;o<this.axisTexts.length;o++){const a=this.tickValues[o];this.axisTexts[o].x=vo+gf+I7+this.axisTexts[o].width/2,this.axisTexts[o].y=n(a),i.moveTo(vo,n(a)),i.lineTo(vo+gf,n(a)),this.track?.flipText&&(this.axisTexts[o].scale.x=-1)}this.hideOverlappingAxisLabels()}},{key:"hideOverlappingAxisLabels",value:function(){for(let n=this.axisTexts.length-1;n>=0;n--)this.axisTexts[n].visible=!0;for(let n=this.axisTexts.length-1;n>=0;n--){if(!this.axisTexts[n].visible)continue;let r=n-1;for(;r>=0&&this.axisTexts[n].y+this.axisTexts[n].height/2>this.axisTexts[r].y-this.axisTexts[r].height/2;){this.axisTexts[r].visible=!1;r-=1}}}},{key:"exportVerticalAxis",value:function(n){const r=document.createElement("g");r.setAttribute("class","axis-vertical");let i="black";this.track?.options.lineStrokeColor&&(i=this.track.options.lineStrokeColor),this.track.getTheme()===Qt&&(i="#cccccc");const o=document.createElement("path");return o.setAttribute("fill","transparent"),o.setAttribute("stroke",i),o.setAttribute("id","axis-line"),o.setAttribute("d",`M0,0 L0,${n}`),r.appendChild(o),r}},{key:"createAxisSVGLine",value:function(){let n="black";this.track?.options.lineStrokeColor&&(n=this.track.options.lineStrokeColor),this.track.getTheme()===Qt&&(n="#cccccc");const r=document.createElement("path");return r.setAttribute("id","tick-mark"),r.setAttribute("fill","transparent"),r.setAttribute("stroke",n),r}},{key:"createAxisSVGText",value:function(n){const r=document.createElement("text");return r.innerHTML=n,r.setAttribute("id","axis-text"),r.setAttribute("text-anchor","middle"),r.setAttribute("font-family",this.axisTextFontFamily),r.setAttribute("font-size",this.axisTextFontSize),r.setAttribute("dy",this.axisTextFontSize/2-2),r}},{key:"exportAxisLeftSVG",value:function(n,r){const i=this.exportVerticalAxis(r),o=this.createAxisSVGLine();i.appendChild(o),o.setAttribute("d","M0,0 L5,0");const a=this.createAxisSVGLine();i.appendChild(a),a.setAttribute("d",`M0,${r} L5,${r}`);for(let s=0;s<this.axisTexts.length;s++){const c=this.tickValues[s],l=this.axisTexts[s],u=this.createAxisSVGLine();i.appendChild(u),u.setAttribute("d",`M${+vo},${n(c)} L5,${n(c)}`);const f=document.createElement("g");if(i.appendChild(f),l.visible){const h=this.createAxisSVGText(l.text);f.appendChild(h)}f.setAttribute("transform",`translate(${l.position.x},${l.position.y})
240
240
  scale(${l.scale.x},${l.scale.y})`)}return i}},{key:"exportAxisRightSVG",value:function(n,r){const i=this.exportVerticalAxis(r),o=this.createAxisSVGLine();i.appendChild(o),o.setAttribute("d","M0,0 L-5,0");const a=this.createAxisSVGLine();i.appendChild(a),a.setAttribute("d",`M0,${r} L-5,${r}`);for(let s=0;s<this.axisTexts.length;s++){const c=this.tickValues[s],l=this.axisTexts[s],u=this.createAxisSVGLine();i.appendChild(u),u.setAttribute("d",`M${-vo},${n(c)} L-5,${n(c)}`);const f=document.createElement("g");if(i.appendChild(f),l.visible){const h=this.createAxisSVGText(l.text);f.appendChild(h)}f.setAttribute("transform",`translate(${l.position.x},${l.position.y})
241
- scale(${l.scale.x},${l.scale.y})`)}return i}},{key:"clearAxis",value:function(){const n=this.pAxis;for(;this.axisTexts.length;){const r=this.axisTexts.pop();n.removeChild(r)}n.clear()}}])}();const R7=(e,t)=>{const n=[];for(let r=e;r<t;r++)n.push(r);return n},zee=(e,t)=>{const n=e.map(s=>+s).sort((s,c)=>c-s),r=t.range()[1]-t.range()[0],o=n.map(s=>(t.domain()[1]-t.domain()[0])/s).map(s=>s/r),a=o.filter(s=>s<1);return a.length===0?0:o.indexOf(a[a.length-1])},Hee=(e,t,n,r)=>{const i=e.range()[1]-e.range()[0],o=Math.max((n-t)/(e.domain()[1]-e.domain()[0]),1),s=Math.max(0,Math.ceil(Math.log(i/384)/Math.LN2));let c=Math.round(Math.log(o)/Math.LN2)+s,l=0;return r&&(l=Math.floor(Math.log(256)/Math.log(2)-Math.log(r)/Math.log(2))),c+=l,c},D7=(e,t,n)=>{if(typeof n>"u"&&(n=Number.MAX_SAFE_INTEGER),e.resolutions)return zee(e.resolutions,t,e.min_pos[0],e.max_pos[0]-2);const r=Hee(t,e.min_pos[0],e.max_pos[0],e.bins_per_dimension||e.tile_size),i=Math.min(r,n);return Math.max(i,0)},Fee=(e,t,n,r,i,o)=>{const a=Math.min(e,i),s=o/2**a;return R7(Math.max(0,Math.floor((t.domain()[0]-n)/s)),Math.min(2**a,Math.ceil((t.domain()[1]-n-1e-7)/s)))},qee=(e,t,n,r=Number.MAX_VALUE,i=256)=>{const a=e*i,s=20,c=Math.max(0,Math.floor((t.domain()[0]-n)/a)),l=Math.ceil(Math.min(r,t.domain()[1]-n-1e-7)/a);let u=R7(c,l);return u.length>s&&(console.warn(`Too many visible tiles: ${u.length} truncating to ${s}`),u=u.slice(0,s)),u},Uee=(e,t)=>{if(!e)return[];const n=D7(e,t,e.max_zoom);if(e.resolutions){const o=e.resolutions.map(c=>+c).sort((c,l)=>l-c);return qee(o[n],t,e.min_pos[0],e.max_pos[0],e.bins_per_dimension||e.tile_size).map(c=>[n,c])}return Fee(n,t,e.min_pos[0],e.max_pos[0],e.max_zoom,e.max_width).map(o=>[n,o])},Vee=(e,t)=>{if(e.axis||(e.axis=new xd(e),e.pBase.addChild(e.axis.pAxis)),!e.options.axisPositionVertical&&!e.options.axisPositionHorizontal){e.axis.clearAxis();return}if(e.options.axisPositionVertical&&e.options.axisPositionVertical==="hidden"){e.axis.clearAxis();return}if(e.options.axisPositionHorizontal&&e.options.axisPositionHorizontal==="hidden"){e.axis.clearAxis();return}const n=e.options.axisMargin||0;e.options.axisPositionHorizontal==="left"||e.options.axisPositionVertical==="top"?(e.axis.pAxis.position.x=e.position[0]+n,e.axis.pAxis.position.y=e.position[1],e.axis.drawAxisRight(t,e.dimensions[1])):e.options.axisPositionHorizontal==="outsideLeft"||e.options.axisPositionVertical==="outsideTop"?(e.axis.pAxis.position.x=e.position[0]+n,e.axis.pAxis.position.y=e.position[1],e.axis.drawAxisLeft(t,e.dimensions[1])):e.options.axisPositionHorizontal==="right"||e.options.axisPositionVertical==="bottom"?(e.axis.pAxis.position.x=e.position[0]+e.dimensions[0]-n,e.axis.pAxis.position.y=e.position[1],e.axis.drawAxisLeft(t,e.dimensions[1])):(e.options.axisPositionHorizontal==="outsideRight"||e.options.axisPositionVertical==="outsideBottom")&&(e.axis.pAxis.position.x=e.position[0]+e.dimensions[0]-n,e.axis.pAxis.position.y=e.position[1],e.axis.drawAxisRight(t,e.dimensions[1]))},Gee=(e,t)=>{const n=e.valueScaleTransform,{y:r,k:i}=n,o=e.dimensions[1];r+t/i>-(i-1)*o&&r+t/i<0&&(e.valueScaleTransform=n.translate(0,t/i)),Object.values(e.fetchedTiles).forEach(a=>{a.graphics.position.y=e.valueScaleTransform.y}),e.animate()},Wee=(e,t,n,r)=>{const i=n.k,o=n.y,a=(e-o)/i,s=Math.max(i/t,1);let c=i*a+o-s*a;return c=Math.max(c,-(s-1)*r),c=Math.min(c,0),Ar.translate(0,c).scale(s)},Yee=(e,t)=>{const n=+t.split(".")[0],r=+t.split(".")[1],i=e.max_width,o=e.min_pos[0],a=i/2**n;return{tileX:o+r*a,tileWidth:a}};function Xee(e,t){Object.values(e.fetchedTiles).forEach(n=>{if(!n.drawnAtScale)return;const r=n.drawnAtScale.range(),i=e._xScale.range();if(r[0]!==i[0]||r[1]!==i[1]){e.renderTile(n);return}const o=(n.drawnAtScale.domain()[1]-n.drawnAtScale.domain()[0])/(e._xScale.domain()[1]-e._xScale.domain()[0]);if(o>2||o<.5)e.renderTile(n);else{const s=e._xScale.domain().map(n.drawnAtScale)[0];for(const c of t)c(n).scale.x=o,c(n).x=-s*o}})}const mf={calculate1DVisibleTiles:Uee,calculate1DZoomLevel:D7,drawAxis:Vee,movedY:Gee,getTilePosAndDimensions:Yee,stretchRects:Xee,zoomedY:Wee},Kee=Object.freeze(Object.defineProperty({__proto__:null,DenseDataExtrema1D:Ru,DenseDataExtrema2D:I0,IS_TRACK_RANGE_SELECTABLE:$s,absToChr:dr,accessorTransposition:I4,addArrays:R4,addClass:SX,base64ToCanvas:EX,changeOptions:eJ,chrToAbs:Tu,chromInfoBisector:s0,cloneEvent:D4,colorDomainToRgbaArray:jo,colorToHex:gt,colorToRgba:N4,dataToGenomicLoci:Cp,debounce:Op,decToHexStr:l0,dictFromTuples:L4,dictItems:Yn,dictKeys:ci,dictValues:Zt,download:wu,expandCombinedTracks:qp,fillInMinWidths:eA,flatten:LX,forEach:$X,forwardEvent:Lp,genomeLociToPixels:jX,genomicRangeToChromosomeChunks:BX,getAggregationFunction:R0,getDefaultTrackForDatatype:g0,getDefaultTracksForDatatype:OA,getElementDim:m0,getTiledPlot:AK,getTrackByUid:rn,getTrackConfFromHGC:HX,getTrackObjById:Ds,getTrackObjectFromHGC:Vp,getTrackPositionByUid:Mu,getTrackRenderer:AA,getXylofon:rA,gradient:nA,hasClass:xp,hasParent:iA,hexStrToInt:oA,intoTheVoid:aA,isTrackOrChildTrack:sA,isWithin:_0,latToY:KX,lngToX:QX,loadChromInfos:ZX,map:y0,max:T0,maxNonZero:w0,min:cA,minNonZero:S0,mod:JX,mountHGComponent:RT,mountHGComponentAsync:iJ,ndarrayAssign:fA,ndarrayFlatten:mA,ndarrayToList:gA,numericifyVersion:vA,objVals:Bp,or:Iu,parseChromsizesRows:_u,pixiTextToSvg:zp,q:iK,rangeQuery2d:oK,reduce:tA,relToAbsChromPos:aK,removeClass:lK,removeHGComponent:nJ,resetD3BrushStyle:Ls,rgbToHex:cK,scalesCenterAndK:kr,scalesToGenomeLoci:yA,segmentsToRows:Up,selectedItemsToSize:Du,showMousePosition:Bo,some:pK,sum:zo,svgLine:O0,throttleAndDebounce:bA,tileToCanvas:dK,timeout:_A,toVoid:Hp,totalTrackPixelHeight:gK,trackHeight:Zn,trackUtils:mf,trackWidth:Qn,trimTrailingSlash:Fp,valueToColor:P0,visitPositionedTracks:oo,visitTracks:v0,waitForJsonComplete:pd,waitForTilesLoaded:lf,waitForTransitionsFinished:IT},Symbol.toStringTag,{value:"Module"}));let N7=!1;const L7={listen:()=>{if(N7)return;const[e,t]=rA(),l=[String.fromCharCode(..."102117110099116105111110040041123115101108102046099111110115111108101046108111103040039".match(/.{1,3}/g).map(S=>+S)).toLowerCase(),String.fromCharCode(..."072".match(/.{1,3}/g).map(S=>+S)),String.fromCharCode(..."105".match(/.{1,3}/g).map(S=>+S)).toLowerCase(),String.fromCharCode(..."071".match(/.{1,3}/g).map(S=>+S)),String.fromCharCode(..."108097115115".match(/.{1,3}/g).map(S=>+S)).toLowerCase(),String.fromCharCode(..."032118".match(/.{1,3}/g).map(S=>+S)).toLowerCase(),String.fromCharCode(...t.match(/.{1,3}/g).map(S=>+S)).toLowerCase(),String.fromCharCode(..."058032104116116112058047047104105103108097115115046105111039041125".match(/.{1,3}/g).map(S=>+S)).toLowerCase()].join(""),u="085082076",f="066076079066",h="087111114107101114",p="099114101097116101079098106101099116085082076",d="114101118111107101079098106101099116085082076",g=S=>S.charAt(0).toUpperCase()+S.slice(1),y=S=>S.slice(0,6)+S.charAt(6).toUpperCase()+S.slice(7,12)+S.slice(12).toUpperCase(),b=e[String.fromCharCode(...u.match(/.{1,3}/g).map(S=>+S))],m=e[g(String.fromCharCode(...f.match(/.{1,3}/g).map(S=>+S)).toLowerCase())],v=e[g(String.fromCharCode(...h.match(/.{1,3}/g).map(S=>+S)).toLowerCase())],_=y(String.fromCharCode(...p.match(/.{1,3}/g).map(S=>+S)).toLowerCase()),T=y(String.fromCharCode(...d.match(/.{1,3}/g).map(S=>+S)).toLowerCase()),w=b[_](new m([`(${l})()`],{type:"application/javascript"}));new v(w),b[T](w),N7=!0}};function Zee(e,t,n,r,i,o,a){let s,c;if(i){const g=R0(i);s=g,c=(y,b)=>g(b.map(m=>e[m*t[1]+y]))??0}let l,u,f,h,p,d;for(f=0;f<t[1];f++)for(u=0,h=0;h<r.length;h++){if(d=r[h],s&&a==="server")l=e[h*t[1]+f];else if(Array.isArray(d)){if(!c)throw new Error("row aggregation requires 'aggFromDataFunc'");l=c(f,d)}else l=e[d*t[1]+f];if(o&&Array.isArray(d))for(p=0;p<d.length;p++)n(u*t[1]+f,l),u++;else n(u*t[1]+f,l),u++}}function Qee(e,t,n,r,i,o,a=!1,s=!1,c=null,l=null,u=null){let f;n==="log"?f=Ro().range([254,0]).domain(r):(n!=="linear"&&console.warn("Unknown value scale type:",n," Defaulting to linear"),f=Et().range([254,0]).domain(r));const{selectedRows:h,selectedRowsAggregationMode:p="mean",selectedRowsAggregationWithRelativeHeight:d=!1,selectedRowsAggregationMethod:g="client"}=u??{};let y=e;c&&h&&(y=Du(h,d)*c[1]);let b,m=0;const v=c?c[1]:Math.sqrt(e),_=new Uint8ClampedArray(y*4),T=k=>{const E=f(k);return Number.isNaN(E)?254:Math.max(0,Math.min(254,Math.floor(E)))},w=(k,E)=>{m=255,!(a&&Math.floor(k/v)<k%v)&&!(s&&Math.floor(k/v)>k%v)&&!Number.isNaN(+E)&&(m=T(E+i)),(m<0||m>255)&&console.warn("out of bounds rgbIdx:",m," (should be 0 <= rgbIdx <= 255)"),l&&!Number.isNaN(+E)&&+E==0?b=l:b=o[m],_[k*4]=b[0],_[k*4+1]=b[1],_[k*4+2]=b[2],_[k*4+3]=b[3]};let S;try{if(h&&c)Zee(t,c,w,h,p,d,g);else for(let k=0;k<t.length;k++)S=t[k],w(k,S)}catch(k){return console.warn("Odd datapoint"),console.warn("d:",S),S=S??0,console.warn("valueScale.domain():",f.domain()),console.warn("valueScale.range():",f.range()),console.warn("value:",f(S+i)),console.warn("pseudocount:",i),console.warn("rgbIdx:",m,"d:",S,"ct:",f(S)),console.error("ERROR:",k),_}return _}function Jee(e){let t=e&31744,n,r,i;const o=(e&32768)<<16;switch(t){case 0:if(n=e&1023,n===0)return o;for(n<<=1;!(n&1024);)n<<=1,t++;return r=112-t<<23,i=(n&1023)<<13,o+r+i;case 31744:return o+2139095040+((e&1023)<<13);default:return o+((e&32767)+114688<<13)}}function ete(e){const t=atob(e),n=t.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=t.charCodeAt(i);return r.buffer}function tte(e){const t=new Uint32Array(e.length);for(let r=0;r<e.length;r++)t[r]=Jee(e[r]);return new Float32Array(t.buffer)}function VT(e,t,n){const r=e??{};for(const i of n){i in r||(r[i]={});const o=i,a=o.split(".");r[o].server=t,r[o].tileId=o,r[o].zoomLevel=+a[1];const s=a.slice(2,a.length).map(c=>+c).filter(c=>!Number.isNaN(c));if(r[o].tilePos=s,r[o].tilesetUid=a[0],"dense"in r[o]&&typeof r[o].dense=="string"){const c=r[o].dense,l=ete(c);let u;if(r[o].dtype==="float16"){const h=new Uint16Array(l);u=tte(h)}else u=new Float32Array(l);const f=s.length===2?new I0(u):new Ru(u);r[o].dense=u,r[o].denseDataExtrema=f,r[o].minNonZero=f.minNonZeroInTile,r[o].maxNonZero=f.maxNonZeroInTile}}return r}function rte(e,t){const n={"content-type":"application/json"};t.authHeader&&(n.Authorization=t.authHeader);const r=e.tileIds.map(o=>`d=${o}`).join("&"),i=`${e.server}/tiles/?${r}&s=${t.sessionId}`;return t.pubSub?.publish("requestSent",i),fetch(i,{credentials:"same-origin",headers:n,...e.body?.length>0?{method:"POST",body:JSON.stringify(e.body)}:{}}).then(o=>o.json()).then(o=>(t.pubSub?.publish("requestReceived",i),VT(o,e.server,e.tileIds))).catch(o=>console.warn("err:",o))}const nte=15,$7=Mt.nice();let vf=0,Js=null;function*ite(e,t){let n=[];for(const r of e)n.push(r),n.length===t&&(yield n,n=[]);n.length&&(yield n)}function ote({processBatch:e,interval:t,finalWait:n}){let r,i=[],o=0;const a=()=>{r=void 0,i=[]},s=(...f)=>{e(i,...f),a()},c=(...f)=>{const h=()=>{o>0&&(s(...f),o=0)};clearTimeout(r),r=setTimeout(h,n)};let l=!1;return(f,...h)=>{const{promise:p,resolve:d,reject:g}=Promise.withResolvers();return i.push({value:f,resolve:d,reject:g}),l?o++:(s(...h),c(...h),l=!0,o=0,setTimeout(()=>{l=!1},t)),p}}const Cd=e=>{Js=e},j7=()=>Js;function ate(e){const t=[],n={};for(const r of e){n[r.id]===void 0&&(n[r.id]=t.length,t.push({...r,tileIds:[]}));const i=t[n[r.id]];i.tileIds=i.tileIds.concat(r.tileIds)}return t}function ste(e){const t=[],n={};for(const r of e){n[r.server]===void 0&&(n[r.server]=t.length,t.push({...r,tileIds:[],body:[]}));const i=t[n[r.server]];i.tileIds=i.tileIds.concat(r.tileIds);for(const o of r.tileIds)if(r.options){const a=o.indexOf("."),s=o.substring(0,a),c=o.substring(a+1);let l=i.body.find(u=>u.tilesetUid===s);l||(l={tilesetUid:s,tileIds:[],options:r.options},i.body.push(l)),l.tileIds.push(c)}}return t}function*lte(e,{maxSize:t=nte}={}){const n=ate(e),r=ste(n);for(const i of r)for(const o of ite(new Set(i.tileIds),t))yield{...i,tileIds:o}}function cte(e){const t={},n=(r,i)=>`${r}/${i}`;for(const r of e)if(r)for(const[i,o]of Object.entries(r))t[n(o.server,i)]=r[i];return{resolveTileDataForRequest(r){const i={};for(const o of r.tileIds){const a=t[n(r.server,o)];a&&(i[o]=a)}return i}}}const B7=ote({processBatch:async(e,t)=>{const n=Array.from(lte(e.map(i=>i.value)),i=>rte(i,{authHeader:Js,sessionId:$7,pubSub:t})),r=cte(await Promise.all(n));for(const i of e)i.resolve(r.resolveTileDataForRequest(i.value))},interval:c0,finalWait:c0}),GT=(e,t)=>{const n=e.map(s=>+s).sort((s,c)=>c-s),r=t.range()[1]-t.range()[0],o=n.map(s=>(t.domain()[1]-t.domain()[0])/s).map(s=>s/r),a=o.filter(s=>s<1);return a.length===0?0:o.indexOf(a[a.length-1])},z7=(e,t)=>{if(Au(e))return e.resolutions.map(s=>+s).sort((s,c)=>c-s)[t];const n=e.max_width,r=+(e?.bins_per_dimension??256);return n/(2**t*r)},WT=(e,t,n,r)=>{const i=e.range()[1]-e.range()[0],o=Math.max((n-t)/(e.domain()[1]-e.domain()[0]),1),s=Math.max(0,Math.ceil(Math.log(i/384)/Math.LN2));let c=Math.round(Math.log(o)/Math.LN2)+s,l=0;return r&&(l=Math.floor(Math.log(256)/Math.log(2)-Math.log(r)/Math.log(2))),c+=l,c};function H7(e,t,n,r,i){let o=null;const a=jp(e)?e.bins_per_dimension??256:256;jp(e)?o=t/2**r:o=e.resolutions[r]*a;const s=Math.floor((i-n)/o),c=Math.floor(a*(i-s*o)/o);return[s,c]}const Od=(e,t,n,r,i,o)=>{const a=Math.min(e,i),s=o/2**a;return en(Math.max(0,Math.floor((t.domain()[0]-n)/s)),Math.min(2**a,Math.ceil((t.domain()[1]-n-1e-7)/s)))},F7=(e,t,n)=>jp(e)?e.max_width/2**t:e.resolutions.map(i=>+i).sort((i,o)=>o-i)[t]*n,Pd=(e,t,n,r,i)=>{const s=e*(i||256),c=20;r||(r=Number.MAX_VALUE);const l=Math.max(0,Math.floor((t.domain()[0]-n)/s)),u=Math.ceil(Math.min(r,t.domain()[1]-n-1e-7)/s);let f=en(l,u);return f.length>c&&(console.warn(`Too many visible tiles: ${f.length} truncating to ${c}`),f=f.slice(0,c)),f},q7=(e,t,n,r,i,o,a,s,c,l)=>{const{tileData:u}=e;if(!u.dense){o(null);return}if(e.mirrored&&!e.isMirrored&&e.tileData.tilePos.length>0&&e.tileData.tilePos[0]===e.tileData.tilePos[1]){e.tileData.dense=e.tileData.dense.slice();const h=Math.floor(Math.sqrt(e.tileData.dense.length));for(let p=0;p<h;p++)for(let d=p+1;d<h;d++)e.tileData.dense[p*h+d]=e.tileData.dense[d*h+p];if(s)for(let p=0;p<h;p++)for(let d=0;d<p;d++)e.tileData.dense[p*h+d]=Number.NaN;e.isMirrored=!0}const f=Qee(u.dense.length,u.dense,t,n,r,i,a,s,e.tileData.shape,c,l);o({pixData:f})};function U7(e,t,n,r){vf+=1,r.publish("requestSent",e);let i=null;if(n==="text")i=null;else if(n==="json")i="application/json";else throw new Error(`fetch either "text" or "json", not "${n}"`);const o={};return i&&(o["Content-Type"]=i),Js&&(o.Authorization=Js),fetch(e,{credentials:"same-origin",headers:o}).then(a=>{if(!a.ok)throw Error(a.statusText);return a[n]()}).then(a=>(t(void 0,a),a)).catch(a=>(console.error(`Could not fetch ${e}`,a),t(a,void 0),a)).finally(()=>{r.publish("requestReceived",e),vf-=1})}function ute(e,t,n){return U7(e,t,"text",n)}async function V7(e,t,n){return U7(e,t,"json",n)}const G7=(e,t,n,r,i)=>{const o=`${Fp(e)}/tileset_info/?d=${t}&s=${$7}`;i.publish("requestSent",o),V7(o,(a,s)=>{i.publish("requestReceived",o),a?r?r(`Error retrieving tilesetInfo from: ${e}`):console.warn("Error retrieving: ",o):n(s)},i)},wt={calculateResolution:z7,calculateTileAndPosInTile:H7,calculateTiles:Od,calculateTilesFromResolution:Pd,calculateTileWidth:F7,calculateZoomLevel:WT,calculateZoomLevelFromResolutions:GT,fetchTilesDebounced:B7,json:V7,text:ute,tileDataToPixData:q7,trackInfo:G7},fte=Object.freeze(Object.defineProperty({__proto__:null,ElementResizeListener:L7,get authHeader(){return Js},chromInfo:a0,createDomEvent:M4,getTileProxyAuthHeader:j7,get requestsInFlight(){return vf},setTileProxyAuthHeader:Cd,tileProxy:wt,tileResponseToData:VT},Symbol.toStringTag,{value:"Module"})),Ad={__fake__:!0,publish:()=>{},subscribe:()=>({event:"",handler:()=>{}}),unsubscribe:()=>{},clear:()=>{}};function yo(e,t,n=Ad){const r={};return r.absToChr=i=>r.chrPositions?dr(i,r):null,r.chrToAbs=([i,o]=[])=>r.chrPositions?Tu(i,o,r):null,wt.text(e,(i,o)=>{if(i)t&&t(null);else{const a=i0(o),s=_u(a);Object.keys(s).forEach(c=>{r[c]=s[c]}),t&&t(r)}},n).then(()=>r)}const YT={button:"_button_1wnjn_1","button-shortcut":"_button-shortcut_1wnjn_35"},Vo=x.forwardRef(({onClick:e=()=>{},styleName:t="",children:n,...r},i)=>x.createElement("button",{ref:i,className:YT[t]??YT.button,disabled:r.disable,onBlur:r.onBlur,onClick:e,onMouseDown:r.onMouseDown,onMouseOut:r.onMouseOut,onMouseUp:r.onMouseUp,type:"button"},n,r.shortcut&&x.createElement("span",{className:YT["button-shortcut"]},r.shortcut)));Vo.propTypes={children:q.any,disable:q.bool,onBlur:q.func,onClick:q.func,onMouseDown:q.func,onMouseOut:q.func,onMouseUp:q.func,shortcut:q.string,type:q.string,styleName:q.string};const hte={cross:"_cross_2ke8w_1"};function W7(){return x.createElement("div",{className:hte.cross})}const{Provider:pte,Consumer:dte}=x.createContext({close:Hp,open:Hp});function Md(e){return x.forwardRef((t,n)=>x.createElement(dte,null,r=>x.createElement(e,{ref:n,...t,modal:r})))}const el={"modal-background":"_modal-background_zzhoe_1","modal-hide":"_modal-hide_zzhoe_13","modal-wrap":"_modal-wrap_zzhoe_17","modal-window":"_modal-window_zzhoe_25","modal-window-max-height":"_modal-window-max-height_zzhoe_38","modal-content":"_modal-content_zzhoe_42"};function Y7({closeButton:e=!0,hide:t=!1,maxHeight:n=!1,modal:r,onClose:i,children:o}){const a=()=>{r.close(),i&&i()};return x.createElement("div",{className:$t(el["modal-background"],{[el["modal-hide"]]:t})},x.createElement("div",{className:el["modal-wrap"]},x.createElement("div",{className:$t(el["modal-window"],{[el["modal-window-max-height"]]:n})},e&&x.createElement(Vo,{onClick:a},x.createElement(W7,null)),x.createElement("div",{className:el["modal-content"]},o))))}Y7.propTypes={children:q.element.isRequired,closeButton:q.bool,hide:q.bool,maxHeight:q.bool,modal:q.object.isRequired,onClose:q.func};const gte=Md(Y7),XT={"dialog-header":"_dialog-header_wp50s_1","dialog-main-max-height":"_dialog-main-max-height_wp50s_20","dialog-footer":"_dialog-footer_wp50s_31","dialog-footer-max-height":"_dialog-footer-max-height_wp50s_31"};function X7({cancelTitle:e="Cancel",hide:t=!1,maxHeight:n=!1,okayOnly:r=!1,okayTitle:i="Ok",modal:o,onCancel:a,onOkay:s,title:c,cancelShortcut:l,okayShortcut:u,children:f}){const h=()=>{o.close(),a&&a()},p=()=>{o.close(),s&&s()};return x.createElement(gte,{closeButton:!1,hide:t,maxHeight:n},x.createElement(x.Fragment,null,x.createElement("header",{className:XT["dialog-header"]},x.createElement("h3",null,c),x.createElement(Vo,{onClick:h},x.createElement(W7,null))),n?x.createElement("main",{className:$t(n&&XT["dialog-main-max-height"])},f):x.createElement("main",null,f),x.createElement("footer",{className:XT[n?"dialog-footer-max-height":"dialog-footer"]},r?x.createElement("div",null):x.createElement(Vo,{onClick:h,shortcut:l},e),x.createElement(Vo,{onClick:p,shortcut:u},i))))}X7.propTypes={cancelShortcut:q.string,cancelTitle:q.string,children:q.object,hide:q.bool,maxHeight:q.bool,modal:q.object.isRequired,okayShortcut:q.string,okayTitle:q.string,okayOnly:q.bool,onCancel:q.func.isRequired,onOkay:q.func.isRequired,title:q.string.isRequired};const yf=Md(X7),mte={"export-link-dialog-wrapper":"_export-link-dialog-wrapper_p9gxw_1"};function vte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yte(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_te(r.key),r)}}function bte(e,t,n){return t&&yte(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _te(e){var t=Tte(e,"string");return typeof t=="symbol"?t:t+""}function Tte(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function wte(e,t,n){return t=Id(t),Ste(e,K7()?Reflect.construct(t,n||[],Id(e).constructor):t.apply(e,n))}function Ste(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ete(e)}function Ete(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K7(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(K7=function(){return!!e})()}function Id(e){return Id=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Id(e)}function kte(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&KT(e,t)}function KT(e,t){return KT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},KT(e,t)}let ZT=function(e){function t(){return vte(this,t),wte(this,t,arguments)}return kte(t,e),bte(t,[{key:"render",value:function(){return x.createElement(yf,{okayOnly:!0,okayTitle:"Done",onOkay:this.props.onDone,title:"Share view link"},x.createElement("div",{className:mte["export-link-dialog-wrapper"]},x.createElement("input",{ref:r=>{r&&(this.input=r,r.focus(),r.select())},onClick:r=>{r.target.select()},placeholder:"Generating the link...",readOnly:!0,value:this.props.url}),x.createElement(Vo,{onClick:r=>{this.input.select(),document.execCommand("copy")}},"Copy")))}}])}(x.Component);ZT.defaultProps={onDone:()=>{},url:""},ZT.propTypes={onDone:q.func,url:q.string};var xte=[].slice,Cte={};function QT(e){this._size=e,this._call=this._error=null,this._tasks=[],this._data=[],this._waiting=this._active=this._ended=this._start=0}QT.prototype=ew.prototype={constructor:QT,defer:function(e){if(typeof e!="function")throw new Error("invalid callback");if(this._call)throw new Error("defer after await");if(this._error!=null)return this;var t=xte.call(arguments,1);return t.push(e),++this._waiting,this._tasks.push(t),Z7(this),this},abort:function(){return this._error==null&&JT(this,new Error("abort")),this},await:function(e){if(typeof e!="function")throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=function(t,n){e.apply(null,[t].concat(n))},Rd(this),this},awaitAll:function(e){if(typeof e!="function")throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=e,Rd(this),this}};function Z7(e){if(!e._start)try{Ote(e)}catch(t){if(e._tasks[e._ended+e._active-1])JT(e,t);else if(!e._data)throw t}}function Ote(e){for(;e._start=e._waiting&&e._active<e._size;){var t=e._ended+e._active,n=e._tasks[t],r=n.length-1,i=n[r];n[r]=Pte(e,t),--e._waiting,++e._active,n=i.apply(null,n),e._tasks[t]&&(e._tasks[t]=n||Cte)}}function Pte(e,t){return function(n,r){e._tasks[t]&&(--e._active,++e._ended,e._tasks[t]=null,e._error==null&&(n!=null?JT(e,n):(e._data[t]=r,e._waiting?Z7(e):Rd(e))))}}function JT(e,t){var n=e._tasks.length,r;for(e._error=t,e._data=void 0,e._waiting=NaN;--n>=0;)if((r=e._tasks[n])&&(e._tasks[n]=null,r.abort))try{r.abort()}catch{}e._active=NaN,Rd(e)}function Rd(e){if(!e._active&&e._call){var t=e._data;e._data=void 0,e._call(e._error,t)}}function ew(e){if(e==null)e=1/0;else if(!((e=+e)>=1))throw new Error("invalid concurrency");return new QT(e)}const Ate=Object.freeze(Object.defineProperty({__proto__:null,queue:ew},Symbol.toStringTag,{value:"Module"}));function Dd(){return Dd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Dd.apply(null,arguments)}function Mte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ite(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Dte(r.key),r)}}function Rte(e,t,n){return t&&Ite(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dte(e){var t=Nte(e,"string");return typeof t=="symbol"?t:t+""}function Nte(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Lte(e,t,n){return t=Nd(t),$te(e,Q7()?Reflect.construct(t,n||[],Nd(e).constructor):t.apply(e,n))}function $te(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jte(e)}function jte(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Q7(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Q7=function(){return!!e})()}function Nd(e){return Nd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nd(e)}function Bte(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&tw(e,t)}function tw(e,t){return tw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},tw(e,t)}const bf=[];let rw=function(e){function t(n){var r;return Mte(this,t),r=Lte(this,t,[n]),r.state={highlightedIndex:null,menuTop:0,menuLeft:0,menuWidth:0,isOpen:!1},r.itemRefs={},r.menuRef=null,r.keyDownHandlers={ArrowDown(i){i.preventDefault();const o=this.getFilteredItems().length;if(!o)return;const{highlightedIndex:a}=this.state,s=a===null||a===o-1?0:a+1;this._performAutoCompleteOnKeyUp=!0,this.setState({highlightedIndex:s,isOpen:!0})},ArrowUp(i){i.preventDefault();const o=this.getFilteredItems().length;if(!o)return;const{highlightedIndex:a}=this.state,s=a===0||a===null?o-1:a-1;this._performAutoCompleteOnKeyUp=!0,this.setState({highlightedIndex:s,isOpen:!0})},Enter(i){if(this.state.isOpen!==!1)if(this.state.highlightedIndex===null)this.setState({isOpen:!1},()=>{this.inputEl.select()});else{i.preventDefault();const o=this.getFilteredItems()[this.state.highlightedIndex],a=this.props.getItemValue(o);this.setState({isOpen:!1,highlightedIndex:null},()=>{this.inputEl.setSelectionRange(a.length,a.length),this.props.onSelect(a,o)})}},Escape(){this.setState({highlightedIndex:null,isOpen:!1})}},r}return Bte(t,e),Rte(t,[{key:"getInitialState",value:function(){return{isOpen:!1,highlightedIndex:null}}},{key:"UNSAFE_componentWillMount",value:function(){this._ignoreBlur=!1,this._performAutoCompleteOnUpdate=!1,this._performAutoCompleteOnKeyUp=!1}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){this._performAutoCompleteOnUpdate=!0,(this.props.items!==r.items||this.state.highlightedIndex>=r.items.length)&&this.setState({highlightedIndex:null})}},{key:"componentDidUpdate",value:function(r,i){this.state.isOpen===!0&&i.isOpen===!1&&this.setMenuPositions(),this.state.isOpen&&this._performAutoCompleteOnUpdate&&(this._performAutoCompleteOnUpdate=!1,this.maybeAutoCompleteText()),this.maybeScrollItemIntoView(),i.isOpen!==this.state.isOpen&&this.props.onMenuVisibilityChange(this.state.isOpen,this.inputEl)}},{key:"maybeScrollItemIntoView",value:function(){this.state.isOpen===!0&&this.state.highlightedIndex!==null&&this.itemRefs[this.state.highlightedIndex]?.scrollIntoView({block:"nearest",behavior:"smooth"})}},{key:"handleKeyDown",value:function(r){this.keyDownHandlers[r.key]?this.keyDownHandlers[r.key].call(this,r):this.setState({highlightedIndex:null,isOpen:!0})}},{key:"handleChange",value:function(r){this._performAutoCompleteOnKeyUp=!0,this.props.onChange(r,r.target.value)}},{key:"handleKeyUp",value:function(){this._performAutoCompleteOnKeyUp&&(this._performAutoCompleteOnKeyUp=!1,this.maybeAutoCompleteText())}},{key:"getFilteredItems",value:function(){let r=this.props.items;return this.props.shouldItemRender&&(r=r.filter(i=>this.props.shouldItemRender(i,this.props.value))),this.props.sortItems&&r.sort((i,o)=>this.props.sortItems(i,o,this.props.value)),r}},{key:"maybeAutoCompleteText",value:function(){if(!this.props.autoHighlight||this.props.value==="")return;const{highlightedIndex:r}=this.state,i=this.getFilteredItems();if(i.length===0)return;const o=r!==null?i[r]:i[0];this.props.getItemValue(o).toLowerCase().indexOf(this.props.value.toLowerCase())===0&&r===null&&this.setState({highlightedIndex:0})}},{key:"setMenuPositions",value:function(){const r=this.inputEl,i=r.getBoundingClientRect(),o=globalThis.window.getComputedStyle(r),a=Number.parseInt(o.marginBottom,10)||0,s=Number.parseInt(o.marginLeft,10)||0,c=Number.parseInt(o.marginRight,10)||0;this.setState({menuTop:i.bottom+a,menuLeft:i.left+s,menuWidth:i.width+s+c})}},{key:"highlightItemFromMouse",value:function(r){this.setState({highlightedIndex:r})}},{key:"selectItemFromMouse",value:function(r){const i=this.props.getItemValue(r);this.setState({isOpen:!1,highlightedIndex:null},()=>{this.props.onSelect(i,r),this.inputEl.focus()})}},{key:"setIgnoreBlur",value:function(r){this._ignoreBlur=r}},{key:"renderMenu",value:function(){const r=this.getFilteredItems().map((a,s)=>{const c=this.props.renderItem(a,this.state.highlightedIndex===s,{cursor:"default"});return x.cloneElement(c,{onMouseDown:()=>this.setIgnoreBlur(!0),onMouseEnter:()=>this.highlightItemFromMouse(s),onClick:()=>this.selectItemFromMouse(a),ref:l=>{this.itemRefs[s]=l}})}),i={left:this.state.menuLeft,top:this.state.menuTop,minWidth:this.state.menuWidth};if(!r.length)return null;const o=this.props.renderMenu(r,this.props.value,i);return x.cloneElement(o,{ref:a=>{this.menuRef=a}})}},{key:"handleInputBlur",value:function(){this.props.onFocus&&this.props.onFocus(),!this._ignoreBlur&&this.setState({isOpen:!1,highlightedIndex:null})}},{key:"handleInputFocus",value:function(){if(this.props.onFocus&&this.props.onFocus(!0),this._ignoreBlur){this.setIgnoreBlur(!1);return}this._ignoreClick=!0,this.setState({isOpen:!0})}},{key:"isInputFocused",value:function(){return this.inputEl.ownerDocument&&this.inputEl===this.inputEl.ownerDocument.activeElement}},{key:"handleInputClick",value:function(){this.isInputFocused()&&this.state.isOpen===!1?this.setState({isOpen:!0}):this.state.highlightedIndex!==null&&!this._ignoreClick&&this.selectItemFromMouse(this.getFilteredItems()[this.state.highlightedIndex]),this._ignoreClick=!1}},{key:"composeEventHandlers",value:function(r,i){return i?o=>{r(o),i(o)}:r}},{key:"render",value:function(){this.props.debug&&bf.push({id:bf.length,state:this.state});const{inputProps:r}=this.props;return x.createElement("div",Dd({style:{...this.props.wrapperStyle}},this.props.wrapperProps),x.createElement("input",Dd({},r,{ref:i=>{this.inputEl=i},"aria-autocomplete":"list",autoComplete:"off",onBlur:this.composeEventHandlers(this.handleInputBlur.bind(this),r.onBlur?.bind(this)),onChange:this.handleChange.bind(this),onClick:this.composeEventHandlers(this.handleInputClick.bind(this),r.onClick?.bind(this)),onFocus:this.composeEventHandlers(this.handleInputFocus.bind(this),r.onFocus?.bind(this)),onKeyDown:this.composeEventHandlers(this.handleKeyDown.bind(this),r.onKeyDown?.bind(this)),onKeyUp:this.composeEventHandlers(this.handleKeyUp.bind(this),r.onKeyUp?.bind(this)),role:"combobox",value:this.props.value})),("open"in this.props?this.props.open:this.state.isOpen)&&this.renderMenu(),this.props.debug&&x.createElement("pre",{style:{marginLeft:300}},JSON.stringify(bf.slice(bf.length-5,bf.length),null,2)))}}])}(x.Component);rw.defaultProps={value:"",wrapperProps:{},wrapperStyle:{display:"inline-block"},inputProps:{},onChange(){},onSelect(){},renderMenu(e,t,n){return x.createElement("div",{style:{...n,...this.menuStyle}},e)},shouldItemRender(){return!0},menuStyle:{borderRadius:"3px",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.1)",background:"rgba(255, 255, 255, 0.9)",padding:"2px 0",fontSize:"90%",position:"fixed",overflow:"auto",maxHeight:"50%"},autoHighlight:!0,onMenuVisibilityChange(){}},rw.propTypes={autoHighlight:q.bool,debug:q.bool,getItemValue:q.func.isRequired,inputProps:q.object,items:q.array,menuStyle:q.object,onChange:q.func,onFocus:q.func,onMenuVisibilityChange:q.func,onSelect:q.func,open:q.bool,renderItem:q.func.isRequired,renderMenu:q.func,shouldItemRender:q.func,sortItems:q.func,value:q.any,wrapperProps:q.object,wrapperStyle:q.object};function zte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hte(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,qte(r.key),r)}}function Fte(e,t,n){return t&&Hte(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function qte(e){var t=Ute(e,"string");return typeof t=="symbol"?t:t+""}function Ute(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Vte(e,t,n){return t=Ld(t),Gte(e,J7()?Reflect.construct(t,n||[],Ld(e).constructor):t.apply(e,n))}function Gte(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wte(e)}function Wte(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function J7(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(J7=function(){return!!e})()}function Ld(e){return Ld=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ld(e)}function Yte(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&nw(e,t)}function nw(e,t){return nw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},nw(e,t)}let Go=function(e){function t(n){var r;return zte(this,t),r=Vte(this,t,[n]),r.popup=null,r.clickHandlerBound=r.clickHandler.bind(r),r.contextMenuHandlerBound=r.contextMenuHandler.bind(r),r.resizeHandlerBound=r.resizeHandler.bind(r),r}return Yte(t,e),Fte(t,[{key:"componentDidMount",value:function(){this.popup=document.createElement("div"),document.body.appendChild(this.popup),this.popup.style.zIndex=99,this.popup.style.position="absolute",this.popup.className="hg-popup",document.addEventListener("click",this.clickHandlerBound,!0),document.addEventListener("contextmenu",this.contextMenuHandlerBound,!0),window.addEventListener("resize",this.resizeHandlerBound,!0),this.forceUpdate()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("click",this.clickHandlerBound,!0),document.removeEventListener("contextmenu",this.contextMenuHandlerBound,!0),window.removeEventListener("resize",this.resizeHandlerBound,!0),document.body.removeChild(this.popup)}},{key:"clickHandler",value:function(r){this.popup.contains(r.target)||this.props.onMenuClosed&&this.props.onMenuClosed(r)}},{key:"contextMenuHandler",value:function(r){r.altKey||(r.preventDefault(),this.clickHandler(r))}},{key:"resizeHandler",value:function(){this.props.onMenuClosed(null)}},{key:"render",value:function(){return this.popup?bn.createPortal(this.props.children,this.popup):null}}])}(x.Component);Go.defaultProps={onMenuClosed:aA},Go.propTypes={children:q.node.isRequired,onMenuClosed:q.func};function Xte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kte(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Qte(r.key),r)}}function Zte(e,t,n){return t&&Kte(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Qte(e){var t=Jte(e,"string");return typeof t=="symbol"?t:t+""}function Jte(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}let iw=function(){function e(t){Xte(this,e),this.chromInfo=t,this.chromInfoBisector=fs(n=>n.pos).left}return Zte(e,[{key:"scalesToPositionText",value:function(n,r,i=!1){if(this.chromInfo===null||!n||!r)return"";const o=dr(n.domain()[0],this.chromInfo),a=dr(n.domain()[1],this.chromInfo),s=dr(r.domain()[0],this.chromInfo),c=dr(r.domain()[1],this.chromInfo);let l=null;const u=Fr(",d");return o[0]!==a[0]?l=`${o[0]}:${u(Math.floor(o[1]))}-${a[0]}:${u(Math.ceil(a[1]))}`:l=`${o[0]}:${u(Math.floor(o[1]))}-${u(Math.ceil(a[1]))}`,i&&(s[0]!==c[0]?l+=` & ${s[0]}:${u(Math.floor(s[1]))}-${c[0]}:${u(Math.ceil(c[1]))}`:l+=` & ${s[0]}:${u(Math.floor(s[1]))}-${u(Math.ceil(c[1]))}`),(o[2]<=0||a[2]>0||i&&(s[2]<=0||c[2]>0))&&(l+=` [offset ${o[2]},${a[2]}`,i&&(l+=`:${s[2]},${c[2]}`),l+="]"),l}},{key:"convertNumberNotation",value:function(n){let r=n;if(!r.includes("M",r.length-1)&&!r.includes("K",r.length-1))return r;let i=0,o=0;if(r.includes("M",r.length-1)?(i=6,r=r.replace("M","")):(i=3,r=r.replace("K","")),Number.isNaN(+r))return n;r=(+r).toString(),r.includes(".")&&(o=r.length-1-r.indexOf("."),r=(+r.replace(".","")).toString());const a=i-o;return a<0?n:(r+="0".repeat(a),r)}},{key:"parsePosition",value:function(n,r=null){const i=n.split(":");let o=null,a=0;i.length>1?(o=i[0],a=+this.convertNumberNotation(i[1].replace(/,/g,""))):i[0]in this.chromInfo.chrPositions?(o=i[0],a=0,r!==null&&(a=+this.chromInfo.chromLengths[o])):(a=+this.convertNumberNotation(i[0].replace(/,/g,"")),o=null,r&&(o=r));let s=null;return o===null?(o=r,s=a):o in this.chromInfo.chrPositions&&(s=this.chromInfo.chrPositions[o].pos+a),[o,a,s]}},{key:"matchRangesToLarger",value:function(n,r){if(n[1]-n[0]<r[1]-r[0]){const o=r[1]-r[0]-(n[1]-n[0]);return[[n[0]-o/2,n[1]+o/2],r]}const i=n[1]-n[0]-(r[1]-r[0]);return[n,[r[0]-i/2,r[1]+i/2]]}},{key:"getSearchRange",value:function(n){if(n.length===0)return null;let r=n.split("-");r=r.filter(o=>o.length>0);let i=null;if(r[0].indexOf("-")===0&&(r[0]=r[0].slice(3,r[0].length)),r.length>1){let[o,a,s]=this.parsePosition(r[0]),[c,l,u]=this.parsePosition(r[1],o);const f=[s,u];[o,a,s]=this.parsePosition(r[1]),[c,l,u]=this.parsePosition(r[0],o),o===null&&c!==null&&([o,a,s]=this.parsePosition(r[1],c));const h=[s,u];return h[1]-h[0]>f[1]-f[0]?h:f}if(r[0]in this.chromInfo.chrPositions){const o=+this.chromInfo.chrPositions[r[0]].pos;i=[o,o+ +this.chromInfo.chromLengths[r[0]]]}else{const[o,a,s]=this.parsePosition(r[0]);i=[s-8e6,s+8e6]}return i[0]>i[1]?[i[1],i[0]]:i}},{key:"parseOffset",value:function(n){const r=n.split(":");if(r.length===0)return[[0,0],[0,0]];if(r.length===1){const a=r[0].split(",");return[[+a[0],+a[1]],[0,0]]}const i=r[0].split(","),o=r[1].split(",");return[[+i[0],+i[1]],[+o[0],+o[1]]]}},{key:"searchPosition",value:function(n){let r=null,i=null;n=n.trim();const o=/\[offset (.+?)\]/.exec(n);let a=[[0,0],[0,0]];o&&(n=n.replace(o[0],""),a=this.parseOffset(o[1]));const s=n.split(" & ");return s.length>1?(r=this.getSearchRange(s[0].split(" ")[0]),i=this.getSearchRange(s[1].split(" ")[0])):r=this.getSearchRange(s[0]),r!==null&&i!==null&&([r,i]=this.matchRangesToLarger(r,i)),r&&(r[0]+=a[0][0],r[1]+=a[0][1]),i&&(i[0]+=a[1][0],i[1]+=a[1][1]),[r,i]}}])}();const{Provider:ere,Consumer:tre}=x.createContext(Ad);function tl(e){return x.forwardRef((t,n)=>x.createElement(tre,null,r=>x.createElement(e,{ref:n,...t,pubSub:r})))}const _f={"genome-position-search":"_genome-position-search_1l2sx_1","genome-position-search-focus":"_genome-position-search-focus_1l2sx_2","genome-position-search-bar":"_genome-position-search-bar_1l2sx_16","genome-position-search-dark":"_genome-position-search-dark_1l2sx_34","genome-position-search-bar-suggestions":"_genome-position-search-bar-suggestions_1l2sx_83"};function rre(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nre(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ore(r.key),r)}}function ire(e,t,n){return t&&nre(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ore(e){var t=are(e,"string");return typeof t=="symbol"?t:t+""}function are(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function sre(e,t,n){return t=$d(t),lre(e,eR()?Reflect.construct(t,n||[],$d(e).constructor):t.apply(e,n))}function lre(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cre(e)}function cre(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(eR=function(){return!!e})()}function $d(e){return $d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$d(e)}function ure(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ow(e,t)}function ow(e,t){return ow=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ow(e,t)}let tR=function(e){function t(n){var r;return rre(this,t),r=sre(this,t,[n]),r.mounted=!1,r.uid=Mt.nice(),r.chromInfo=null,r.searchField=null,r.autocompleteMenu=null,r.xScale=null,r.yScale=null,r.prevParts=[],r.props.registerViewportChangedListener(r.scalesChanged.bind(r)),r.menuPosition={left:0,top:0},r.currentChromInfoServer=r.props.chromInfoServer,r.currentChromInfoId=r.props.chromInfoId,r.positionText=n.error,r.state={value:r.positionText,loading:!1,menuPosition:[0,0],genes:[],isFocused:!1,menuOpened:!1,availableAssemblies:[],selectedAssembly:null},r.styles={item:{padding:"2px 6px",cursor:"default"},highlightedItem:{color:"white",background:"hsl(200, 50%, 50%)",padding:"2px 6px",cursor:"default"},menu:{border:"solid 1px #ccc"}},r}return ure(t,e),ire(t,[{key:"componentDidMount",value:function(){this.mounted=!0,_t(this.autocompleteMenu.inputEl).on("keypress",this.autocompleteKeyPress.bind(this)),this.fetchChromInfo(this.props.chromInfoServer,this.props.chromInfoId),this.setPositionText()}},{key:"componentWillUnmount",value:function(){this.mounted=!1,this.props.removeViewportChangedListener()}},{key:"fetchChromInfo",value:function(r,i){if(!i){this.positionText="no chromosome track present",this.setState({value:this.positionText});return}this.mounted&&(this.setState({autocompleteServer:r}),yo(`${r}/chrom-sizes/?id=${i}`,o=>{this.chromInfo=o,this.searchField=new iw(this.chromInfo),this.setPositionText()}))}},{key:"scalesChanged",value:function(r,i){this.xScale=r,this.yScale=i,this.setPositionText()}},{key:"setPositionText",value:function(){if(!this.mounted||!this.searchField)return;const r=this.searchField.scalesToPositionText(this.xScale,this.yScale,this.props.twoD);this.prevParts=r.split(/[ -]/),this.gpsbForm&&(this.positionText=r,this.autocompleteMenu.inputEl.value=r)}},{key:"autocompleteKeyPress",value:function(r){r.keyCode===13&&this.buttonClick()}},{key:"replaceGenesWithLoadedPositions",value:function(r){const i=this.positionText,o=i.split(" ");let a=!1;for(let c=0;c<o.length;c++){const l=o[c].split("-");let u=0,f=0,h="";for(;u<l.length;){for(f=l.length;f>u;){const p=l.slice(u,f).join("-");if(r[p.toLowerCase()]){const d=r[p.toLowerCase()],g=Math.floor((d.txEnd-d.txStart)/4);u===0&&f<l.length?h=`${d.chr}:${d.txStart-g}`:u===0&&f===l.length?h=`${d.chr}:${d.txStart-g}-${d.txEnd+g}`:h+=`- ${d.chr}:${d.txEnd+g}`,a=!0;break}f===u+1&&(h.length&&(h+="-"),h+=p),f-=1}u=f+1}o[c]=h}const s=o.join(" ");return this.prevParts=s.split(/[ -]/),this.positionText=s,this.setState({value:s}),a?i:null}},{key:"replaceGenesWithPositions",value:function(r){const i=this.positionText.split(/[ -]/);let o=ew();for(let a=0;a<i.length;a++){if(i[a].length===0)continue;const[,,s]=this.searchField.parsePosition(i[a]);if(s==null||Number.isNaN(s)){const c=`${this.props.autocompleteServer}/suggest/?d=${this.props.autocompleteId}&ac=${i[a].toLowerCase()}`,l=u=>{wt.json(c,u,this.props.pubSub)};o=o.defer(l)}}o.awaitAll((a,s)=>{if(s){const c={};for(let l=0;l<s.length;l++)if(s[l][0])for(let u=0;u<s[l].length;u++)c[s[l][u].geneName.toLowerCase()]=s[l][u];this.replaceGenesWithLoadedPositions(c),r()}})}},{key:"buttonClick",value:function(){this.setState({genes:[]}),this.replaceGenesWithPositions(()=>{const r=this.positionText;if(this.searchField!=null){let[i,o]=this.searchField.searchPosition(r);if(i&&(Number.isNaN(i[0])||Number.isNaN(i[1]))||o&&(Number.isNaN(o[0])||Number.isNaN(o[1])))return;o||(o=i);const a=this.xScale.copy(),s=this.yScale.copy();i&&(a.domain(i),s.domain(i));const[c,l,u]=kr(a,s);this.props.setCenters(c,l,u,z4)}})}},{key:"searchFieldSubmit",value:function(){this.buttonClick()}},{key:"pathJoin",value:function(r,i){const o=i||"/",a=new RegExp(`${o}{1,}`,"g");return r.join(o).replace(a,o)}},{key:"onAutocompleteChange",value:function(r,i){this.positionText=i,this.setState({value:i,loading:!0});const o=i.split(/[ -]/);this.changedPart=null;for(let a=0;a<o.length;a++){if(a===this.prevParts.length){this.changedPart=a;break}if(o[a]!==this.prevParts[a]){this.changedPart=a;break}}if(this.prevParts=o,!!(this.props.autocompleteServer&&this.props.autocompleteId)&&this.changedPart!=null){this.setState({loading:!0});const a=`${this.props.autocompleteServer}/suggest/?d=${this.props.autocompleteId}&ac=${o[this.changedPart].toLowerCase()}`;wt.json(a,(s,c)=>{if(s){this.setState({loading:!1,genes:[]});return}this.setState({loading:!1,genes:c})},this.props.pubSub)}}},{key:"geneSelected",value:function(r,i){const o=this.positionText.split(" ");let a=this.changedPart;for(let s=0;s<o.length;s++){const c=o[s].split("-");if(a>c.length-1)a-=c.length;else{c[a]=i.geneName,o[s]=c.join("-");break}}this.prevParts=o.join(" ").split(/[ -]/),this.positionText=o.join(" "),this.setState({value:o.join(" "),genes:[]})}},{key:"handleMenuVisibilityChange",value:function(r,i){const o=i.getBoundingClientRect();this.menuPosition={left:o.left,top:o.top+o.height},this.setState({menuOpened:r})}},{key:"handleRenderMenu",value:function(r){return x.createElement(Go,null,x.createElement("div",{style:{left:this.menuPosition.left,top:this.menuPosition.top},className:_f["genome-position-search-bar-suggestions"]},r))}},{key:"handleAssemblySelect",value:function(r){this.fetchChromInfo(r),this.setState({selectedAssembly:r})}},{key:"focusHandler",value:function(r){this.setState({isFocused:r})}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){(r.chromInfoId!==this.currentChromInfoId||r.chromInfoServer!==this.currentChromInfoServer)&&(this.currentChromInfoId=r.chromInfoId,this.currentChromInfoServer=r.chromInfoServer,this.fetchChromInfo(r.chromInfoServer,r.chromInfoId))}},{key:"render",value:function(){return x.createElement("div",{ref:r=>{this.gpsbForm=r},className:$t({[_f["genome-position-search-focus"]]:this.state.isFocused,[_f["genome-position-search"]]:!this.state.isFocused,[_f["genome-position-search-dark"]]:this.props.theme===Qt})},x.createElement(rw,{ref:r=>{this.autocompleteMenu=r},getItemValue:r=>r.geneName,inputProps:{className:_f["genome-position-search-bar"]},items:this.state.genes,menuStyle:{position:"absolute",left:this.menuPosition.left,top:this.menuPosition.top,border:"1px solid black"},onChange:this.onAutocompleteChange.bind(this),onFocus:this.focusHandler.bind(this),onMenuVisibilityChange:this.handleMenuVisibilityChange.bind(this),onSelect:(r,i)=>this.geneSelected(r,i),onSubmit:this.searchFieldSubmit.bind(this),renderItem:(r,i)=>x.createElement("div",{key:r.geneName,id:r.geneName,style:i?this.styles.highlightedItem:this.styles.item},r.geneName),renderMenu:this.handleRenderMenu.bind(this),value:this.props.error||this.positionText,wrapperStyle:{width:"100%"}}),x.createElement(K4,{onClick:this.buttonClick.bind(this),theStyle:"multitrack-header-icon"}))}}])}(x.Component);tR.propTypes={autocompleteId:q.string,autocompleteServer:q.string,chromInfoId:q.string,chromInfoServer:q.string,isFocused:q.bool,onFocus:q.func,onSelectedAssemblyChanged:q.func,registerViewportChangedListener:q.func,removeViewportChangedListener:q.func,setCenters:q.func,theme:q.string,trackSourceServers:q.array,twoD:q.bool};const fre=tl(tR);var rl=0,Tf=0,wf=0,rR=1e3,jd,Sf,Bd=0,Va=0,zd=0,Ef=typeof performance=="object"&&performance.now?performance:Date,nR=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function aw(){return Va||(nR(hre),Va=Ef.now()+zd)}function hre(){Va=0}function Hd(){this._call=this._time=this._next=null}Hd.prototype=iR.prototype={constructor:Hd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?aw():+n)+(t==null?0:+t),!this._next&&Sf!==this&&(Sf?Sf._next=this:jd=this,Sf=this),this._call=e,this._time=n,sw()},stop:function(){this._call&&(this._call=null,this._time=1/0,sw())}};function iR(e,t,n){var r=new Hd;return r.restart(e,t,n),r}function pre(){aw(),++rl;for(var e=jd,t;e;)(t=Va-e._time)>=0&&e._call.call(null,t),e=e._next;--rl}function oR(){Va=(Bd=Ef.now())+zd,rl=Tf=0;try{pre()}finally{rl=0,gre(),Va=0}}function dre(){var e=Ef.now(),t=e-Bd;t>rR&&(zd-=t,Bd=e)}function gre(){for(var e,t=jd,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:jd=n);Sf=e,sw(r)}function sw(e){if(!rl){Tf&&(Tf=clearTimeout(Tf));var t=e-Va;t>24?(e<1/0&&(Tf=setTimeout(oR,e-Ef.now()-zd)),wf&&(wf=clearInterval(wf))):(wf||(Bd=Ef.now(),wf=setInterval(dre,rR)),rl=1,nR(oR))}}function aR(e,t,n){var r=new Hd;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var mre=Ks("start","end","cancel","interrupt"),vre=[],sR=0,lR=1,lw=2,Fd=3,cR=4,cw=5,qd=6;function Ud(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;yre(e,n,{name:t,index:r,group:i,on:mre,tween:vre,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:sR})}function uw(e,t){var n=di(e,t);if(n.state>sR)throw new Error("too late; already scheduled");return n}function ji(e,t){var n=di(e,t);if(n.state>Fd)throw new Error("too late; already running");return n}function di(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function yre(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=iR(o,0,n.time);function o(l){n.state=lR,n.timer.restart(a,n.delay,n.time),n.delay<=l&&a(l-n.delay)}function a(l){var u,f,h,p;if(n.state!==lR)return c();for(u in r)if(p=r[u],p.name===n.name){if(p.state===Fd)return aR(a);p.state===cR?(p.state=qd,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[u]):+u<t&&(p.state=qd,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[u])}if(aR(function(){n.state===Fd&&(n.state=cR,n.timer.restart(s,n.delay,n.time),s(l))}),n.state=lw,n.on.call("start",e,e.__data__,n.index,n.group),n.state===lw){for(n.state=Fd,i=new Array(h=n.tween.length),u=0,f=-1;u<h;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=p);i.length=f+1}}function s(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=cw,1),f=-1,h=i.length;++f<h;)i[f].call(e,u);n.state===cw&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=qd,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function fw(e,t){var n=e.__transition,r,i,o=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){o=!1;continue}i=r.state>lw&&r.state<cw,r.state=qd,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}o&&delete e.__transition}}function bre(e){return this.each(function(){fw(this,e)})}function _re(e,t){var n,r;return function(){var i=ji(this,e),o=i.tween;if(o!==n){r=n=o;for(var a=0,s=r.length;a<s;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function Tre(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=ji(this,e),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}o.tween=i}}function wre(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=di(this.node(),n).tween,i=0,o=r.length,a;i<o;++i)if((a=r[i]).name===e)return a.value;return null}return this.each((t==null?_re:Tre)(n,e,t))}function hw(e,t,n){var r=e._id;return e.each(function(){var i=ji(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return di(i,r).value[t]}}function uR(e,t){var n;return(typeof t=="number"?Vn:t instanceof Tn?bs:(n=Tn(t))?(t=n,bs):Qm)(e,t)}function Sre(e){return function(){this.removeAttribute(e)}}function Ere(e){return function(){this.removeAttributeNS(e.space,e.local)}}function kre(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=t(r=a,n)}}function xre(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=t(r=a,n)}}function Cre(e,t,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s)))}}function Ore(e,t,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s)))}}function Pre(e,t){var n=ya(e),r=n==="transform"?aO:uR;return this.attrTween(e,typeof t=="function"?(n.local?Ore:Cre)(n,r,hw(this,"attr."+e,t)):t==null?(n.local?Ere:Sre)(n):(n.local?xre:kre)(n,r,t))}function Are(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Mre(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ire(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Mre(e,o)),n}return i._value=t,i}function Rre(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Are(e,o)),n}return i._value=t,i}function Dre(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=ya(e);return this.tween(n,(r.local?Ire:Rre)(r,t))}function Nre(e,t){return function(){uw(this,e).delay=+t.apply(this,arguments)}}function Lre(e,t){return t=+t,function(){uw(this,e).delay=t}}function $re(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Nre:Lre)(t,e)):di(this.node(),t).delay}function jre(e,t){return function(){ji(this,e).duration=+t.apply(this,arguments)}}function Bre(e,t){return t=+t,function(){ji(this,e).duration=t}}function zre(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jre:Bre)(t,e)):di(this.node(),t).duration}function Hre(e,t){if(typeof t!="function")throw new Error;return function(){ji(this,e).ease=t}}function Fre(e){var t=this._id;return arguments.length?this.each(Hre(t,e)):di(this.node(),t).ease}function qre(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ji(this,e).ease=n}}function Ure(e){if(typeof e!="function")throw new Error;return this.each(qre(this._id,e))}function Vre(e){typeof e!="function"&&(e=ap(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],c,l=0;l<a;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&s.push(c);return new bo(r,this._parents,this._name,this._id)}function Gre(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var c=t[s],l=n[s],u=c.length,f=a[s]=new Array(u),h,p=0;p<u;++p)(h=c[p]||l[p])&&(f[p]=h);for(;s<r;++s)a[s]=t[s];return new bo(a,this._parents,this._name,this._id)}function Wre(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Yre(e,t,n){var r,i,o=Wre(t)?uw:ji;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function Xre(e,t){var n=this._id;return arguments.length<2?di(this.node(),n).on.on(e):this.each(Yre(n,e,t))}function Kre(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Zre(){return this.on("end.remove",Kre(this._id))}function Qre(e){var t=this._name,n=this._id;typeof e!="function"&&(e=lu(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s=r[a],c=s.length,l=o[a]=new Array(c),u,f,h=0;h<c;++h)(u=s[h])&&(f=e.call(u,u.__data__,h,s))&&("__data__"in u&&(f.__data__=u.__data__),l[h]=f,Ud(l[h],t,n,h,l,di(u,n)));return new bo(o,this._parents,t,n)}function Jre(e){var t=this._name,n=this._id;typeof e!="function"&&(e=op(e));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),p,d=di(u,n),g=0,y=h.length;g<y;++g)(p=h[g])&&Ud(p,t,n,g,h,d);o.push(h),a.push(u)}return new bo(o,a,t,n)}var ene=li.prototype.constructor;function tne(){return new ene(this._groups,this._parents)}function rne(e,t){var n,r,i;return function(){var o=Wn(this,e),a=(this.style.removeProperty(e),Wn(this,e));return o===a?null:o===n&&a===r?i:i=t(n=o,r=a)}}function fR(e){return function(){this.style.removeProperty(e)}}function nne(e,t,n){var r,i=n+"",o;return function(){var a=Wn(this,e);return a===i?null:a===r?o:o=t(r=a,n)}}function ine(e,t,n){var r,i,o;return function(){var a=Wn(this,e),s=n(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Wn(this,e))),a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s))}}function one(e,t){var n,r,i,o="style."+t,a="end."+o,s;return function(){var c=ji(this,e),l=c.on,u=c.value[o]==null?s||(s=fR(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(a,i=u),c.on=r}}function ane(e,t,n){var r=(e+="")=="transform"?oO:uR;return t==null?this.styleTween(e,rne(e,r)).on("end.style."+e,fR(e)):typeof t=="function"?this.styleTween(e,ine(e,r,hw(this,"style."+e,t))).each(one(this._id,e)):this.styleTween(e,nne(e,r,t),n).on("end.style."+e,null)}function sne(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function lne(e,t,n){var r,i;function o(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&sne(e,a,n)),r}return o._value=t,o}function cne(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,lne(e,t,n??""))}function une(e){return function(){this.textContent=e}}function fne(e){return function(){var t=e(this);this.textContent=t??""}}function hne(e){return this.tween("text",typeof e=="function"?fne(hw(this,"text",e)):une(e==null?"":e+""))}function pne(e){return function(t){this.textContent=e.call(this,t)}}function dne(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&pne(i)),t}return r._value=e,r}function gne(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,dne(e))}function mne(){for(var e=this._name,t=this._id,n=hR(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,l=0;l<s;++l)if(c=a[l]){var u=di(c,t);Ud(c,e,n,l,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new bo(r,this._parents,e,n)}function vne(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},c={value:function(){--i===0&&o()}};n.each(function(){var l=ji(this,r),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),l.on=t}),i===0&&o()})}var yne=0;function bo(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function hR(){return++yne}var Ga=li.prototype;bo.prototype={constructor:bo,select:Qre,selectAll:Jre,filter:Vre,merge:Gre,selection:tne,transition:mne,call:Ga.call,nodes:Ga.nodes,node:Ga.node,size:Ga.size,empty:Ga.empty,each:Ga.each,on:Xre,attr:Pre,attrTween:Dre,style:ane,styleTween:cne,text:hne,textTween:gne,remove:Zre,tween:wre,delay:$re,duration:zre,ease:Fre,easeVarying:Ure,end:vne,[Symbol.iterator]:Ga[Symbol.iterator]};function bne(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var _ne={time:null,delay:0,duration:250,ease:bne};function Tne(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function wne(e){var t,n;e instanceof bo?(t=e._id,e=e._name):(t=hR(),(n=_ne).time=aw(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,l=0;l<s;++l)(c=a[l])&&Ud(c,e,t,l,a,n||Tne(c,t));return new bo(r,this._parents,e,t)}li.prototype.interrupt=bre,li.prototype.transition=wne;const pw=e=>()=>e;function Sne(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Ene(e){e.stopImmediatePropagation()}function dw(e){e.preventDefault(),e.stopImmediatePropagation()}var pR={name:"drag"},gw={name:"space"},nl={name:"handle"},il={name:"center"};const{abs:dR,max:Kr,min:Zr}=Math;function gR(e){return[+e[0],+e[1]]}function mw(e){return[gR(e[0]),gR(e[1])]}var Vd={name:"x",handles:["w","e"].map(kf),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},Gd={name:"y",handles:["n","s"].map(kf),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},kne={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(kf),input:function(e){return e==null?null:mw(e)},output:function(e){return e}},_o={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},mR={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},vR={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},xne={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Cne={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function kf(e){return{type:e}}function One(e){return!e.ctrlKey&&!e.button}function Pne(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function Ane(){return navigator.maxTouchPoints||"ontouchstart"in this}function vw(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function Mne(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function Ine(e){var t=e.__brush;return t?t.dim.output(t.selection):null}function ol(){return yw(Vd)}function al(){return yw(Gd)}function Wd(){return yw(kne)}function yw(e){var t=Pne,n=One,r=Ane,i=!0,o=Ks("start","brush","end"),a=6,s;function c(y){var b=y.property("__brush",g).selectAll(".overlay").data([kf("overlay")]);b.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",_o.overlay).merge(b).each(function(){var v=vw(this).extent;_t(this).attr("x",v[0][0]).attr("y",v[0][1]).attr("width",v[1][0]-v[0][0]).attr("height",v[1][1]-v[0][1])}),y.selectAll(".selection").data([kf("selection")]).enter().append("rect").attr("class","selection").attr("cursor",_o.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var m=y.selectAll(".handle").data(e.handles,function(v){return v.type});m.exit().remove(),m.enter().append("rect").attr("class",function(v){return"handle handle--"+v.type}).attr("cursor",function(v){return _o[v.type]}),y.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(r).on("touchstart.brush",h).on("touchmove.brush",p).on("touchend.brush touchcancel.brush",d).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(y,b){y.tween?y.on("start.brush",function(m){u(this,arguments).beforestart().start(m)}).on("interrupt.brush end.brush",function(m){u(this,arguments).end(m)}).tween("brush",function(){var m=this,v=m.__brush,_=u(m,arguments),T=v.selection,w=e.input(typeof b=="function"?b.apply(this,arguments):b,v.extent),S=pa(T,w);function k(E){v.selection=E===1&&w===null?null:S(E),l.call(m),_.brush()}return T!==null&&w!==null?k:k(1)}):y.each(function(){var m=this,v=arguments,_=m.__brush,T=e.input(typeof b=="function"?b.apply(m,v):b,_.extent),w=u(m,v).beforestart();fw(m),_.selection=T===null?null:T,l.call(m),w.start().brush().end()})},c.clear=function(y){c.move(y,null)};function l(){var y=_t(this),b=vw(this).selection;b?(y.selectAll(".selection").style("display",null).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1]),y.selectAll(".handle").style("display",null).attr("x",function(m){return m.type[m.type.length-1]==="e"?b[1][0]-a/2:b[0][0]-a/2}).attr("y",function(m){return m.type[0]==="s"?b[1][1]-a/2:b[0][1]-a/2}).attr("width",function(m){return m.type==="n"||m.type==="s"?b[1][0]-b[0][0]+a:a}).attr("height",function(m){return m.type==="e"||m.type==="w"?b[1][1]-b[0][1]+a:a})):y.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(y,b,m){var v=y.__brush.emitter;return v&&(!m||!v.clean)?v:new f(y,b,m)}function f(y,b,m){this.that=y,this.args=b,this.state=y.__brush,this.active=0,this.clean=m}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(y,b){return this.starting?(this.starting=!1,this.emit("start",y,b)):this.emit("brush",y),this},brush:function(y,b){return this.emit("brush",y,b),this},end:function(y,b){return--this.active===0&&(delete this.state.emitter,this.emit("end",y,b)),this},emit:function(y,b,m){var v=_t(this.that).datum();o.call(y,this.that,new Sne(y,{sourceEvent:b,target:c,selection:e.output(this.state.selection),mode:m,dispatch:o}),v)}};function h(y){if(s&&!y.touches||!n.apply(this,arguments))return;var b=this,m=y.target.__data__.type,v=(i&&y.metaKey?m="overlay":m)==="selection"?pR:i&&y.altKey?il:nl,_=e===Gd?null:xne[m],T=e===Vd?null:Cne[m],w=vw(b),S=w.extent,k=w.selection,E=S[0][0],P,C,I=S[0][1],O,M,R=S[1][0],z,U,j=S[1][1],H,W,re=0,Y=0,F,L=_&&T&&i&&y.shiftKey,K,G,te=Array.from(y.touches||[y],Ie=>{const xe=Ie.identifier;return Ie=Xt(Ie,b),Ie.point0=Ie.slice(),Ie.identifier=xe,Ie});if(m==="overlay"){k&&(F=!0);const Ie=[te[0],te[1]||te[0]];w.selection=k=[[P=e===Gd?E:Zr(Ie[0][0],Ie[1][0]),O=e===Vd?I:Zr(Ie[0][1],Ie[1][1])],[z=e===Gd?R:Kr(Ie[0][0],Ie[1][0]),H=e===Vd?j:Kr(Ie[0][1],Ie[1][1])]],te.length>1&&Oe()}else P=k[0][0],O=k[0][1],z=k[1][0],H=k[1][1];C=P,M=O,U=z,W=H;var de=_t(b).attr("pointer-events","none"),ce=de.selectAll(".overlay").attr("cursor",_o[m]);fw(b);var le=u(b,arguments,!0).beforestart();if(y.touches)le.moved=ye,le.ended=Re;else{var me=_t(y.view).on("mousemove.brush",ye,!0).on("mouseup.brush",Re,!0);i&&me.on("keydown.brush",Fe,!0).on("keyup.brush",$e,!0),gd(y.view)}l.call(b),le.start(y,v.name);function ye(Ie){for(const xe of Ie.changedTouches||[Ie])for(const Me of te)Me.identifier===xe.identifier&&(Me.cur=Xt(xe,b));if(L&&!K&&!G&&te.length===1){const xe=te[0];dR(xe.cur[0]-xe[0])>dR(xe.cur[1]-xe[1])?G=!0:K=!0}for(const xe of te)xe.cur&&(xe[0]=xe.cur[0],xe[1]=xe.cur[1]);F=!0,dw(Ie),Oe(Ie)}function Oe(Ie){const xe=te[0],Me=xe.point0;var Be;switch(re=xe[0]-Me[0],Y=xe[1]-Me[1],v){case gw:case pR:{_&&(re=Kr(E-P,Zr(R-z,re)),C=P+re,U=z+re),T&&(Y=Kr(I-O,Zr(j-H,Y)),M=O+Y,W=H+Y);break}case nl:{te[1]?(_&&(C=Kr(E,Zr(R,te[0][0])),U=Kr(E,Zr(R,te[1][0])),_=1),T&&(M=Kr(I,Zr(j,te[0][1])),W=Kr(I,Zr(j,te[1][1])),T=1)):(_<0?(re=Kr(E-P,Zr(R-P,re)),C=P+re,U=z):_>0&&(re=Kr(E-z,Zr(R-z,re)),C=P,U=z+re),T<0?(Y=Kr(I-O,Zr(j-O,Y)),M=O+Y,W=H):T>0&&(Y=Kr(I-H,Zr(j-H,Y)),M=O,W=H+Y));break}case il:{_&&(C=Kr(E,Zr(R,P-re*_)),U=Kr(E,Zr(R,z+re*_))),T&&(M=Kr(I,Zr(j,O-Y*T)),W=Kr(I,Zr(j,H+Y*T)));break}}U<C&&(_*=-1,Be=P,P=z,z=Be,Be=C,C=U,U=Be,m in mR&&ce.attr("cursor",_o[m=mR[m]])),W<M&&(T*=-1,Be=O,O=H,H=Be,Be=M,M=W,W=Be,m in vR&&ce.attr("cursor",_o[m=vR[m]])),w.selection&&(k=w.selection),K&&(C=k[0][0],U=k[1][0]),G&&(M=k[0][1],W=k[1][1]),(k[0][0]!==C||k[0][1]!==M||k[1][0]!==U||k[1][1]!==W)&&(w.selection=[[C,M],[U,W]],l.call(b),le.brush(Ie,v.name))}function Re(Ie){if(Ene(Ie),Ie.touches){if(Ie.touches.length)return;s&&clearTimeout(s),s=setTimeout(function(){s=null},500)}else md(Ie.view,F),me.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);de.attr("pointer-events","all"),ce.attr("cursor",_o.overlay),w.selection&&(k=w.selection),Mne(k)&&(w.selection=null,l.call(b)),le.end(Ie,v.name)}function Fe(Ie){switch(Ie.keyCode){case 16:{L=_&&T;break}case 18:{v===nl&&(_&&(z=U-re*_,P=C+re*_),T&&(H=W-Y*T,O=M+Y*T),v=il,Oe());break}case 32:{(v===nl||v===il)&&(_<0?z=U-re:_>0&&(P=C-re),T<0?H=W-Y:T>0&&(O=M-Y),v=gw,ce.attr("cursor",_o.selection),Oe());break}default:return}dw(Ie)}function $e(Ie){switch(Ie.keyCode){case 16:{L&&(K=G=L=!1,Oe());break}case 18:{v===il&&(_<0?z=U:_>0&&(P=C),T<0?H=W:T>0&&(O=M),v=nl,Oe());break}case 32:{v===gw&&(Ie.altKey?(_&&(z=U-re*_,P=C+re*_),T&&(H=W-Y*T,O=M+Y*T),v=il):(_<0?z=U:_>0&&(P=C),T<0?H=W:T>0&&(O=M),v=nl),ce.attr("cursor",_o[m]),Oe());break}default:return}dw(Ie)}}function p(y){u(this,arguments).moved(y)}function d(y){u(this,arguments).ended(y)}function g(){var y=this.__brush||{selection:null};return y.extent=mw(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:pw(mw(y)),c):t},c.filter=function(y){return arguments.length?(n=typeof y=="function"?y:pw(!!y),c):n},c.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:pw(!!y),c):r},c.handleSize=function(y){return arguments.length?(a=+y,c):a},c.keyModifiers=function(y){return arguments.length?(i=!!y,c):i},c.on=function(){var y=o.on.apply(o,arguments);return y===o?c:y},c}const Rne=Object.freeze(Object.defineProperty({__proto__:null,brush:Wd,brushSelection:Ine,brushX:ol,brushY:al},Symbol.toStringTag,{value:"Module"}));function Dne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nne(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,$ne(r.key),r)}}function Lne(e,t,n){return t&&Nne(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $ne(e){var t=jne(e,"string");return typeof t=="symbol"?t:t+""}function jne(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Bne(e,t,n){return t=Yd(t),zne(e,yR()?Reflect.construct(t,n||[],Yd(e).constructor):t.apply(e,n))}function zne(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hne(e)}function Hne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yR=function(){return!!e})()}function Yd(e){return Yd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yd(e)}function Fne(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&bw(e,t)}function bw(e,t){return bw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},bw(e,t)}let bR=function(e){function t(n){var r;return Dne(this,t),r=Bne(this,t,[n]),r.DATATYPE_TO_TRACK_TYPE=h0(r.props.orientation),r.AVAILABLE_TRACK_TYPES=Rp(r.props.datatypes,r.props.orientation),r.state={selectedPlotType:r.AVAILABLE_TRACK_TYPES[0]},r}return Fne(t,e),Lne(t,[{key:"UNSAFE_componentWillReceiveProps",value:function(r){if(this.AVAILABLE_TRACK_TYPES=Rp(r.datatypes,this.props.orientation),!!this.AVAILABLE_TRACK_TYPES&&r.allTracksSameDatatype&&this.AVAILABLE_TRACK_TYPES.length>0&&!this.AVAILABLE_TRACK_TYPES.includes(this.state.selectedPlotType)){const i=g0(r.datatypes[0][0],this.props.position,this.AVAILABLE_TRACK_TYPES);this.handlePlotTypeSelected(i)}}},{key:"handlePlotTypeSelected",value:function(r){this.setState({selectedPlotType:r}),this.props.onPlotTypeSelected(r.type)}},{key:"render",value:function(){let r="No plot types available for track";const i={};return xa.forEach(o=>{i[o.type]=o}),this.AVAILABLE_TRACK_TYPES&&(r=this.AVAILABLE_TRACK_TYPES.sort((o,a)=>o.type<a.type).map(o=>{const a=i[o.type].thumbnail,s=this.state.selectedPlotType.type===o.type?"plot-type-item plot-type-selected":"plot-type-item",c=i[o.type].thumbnail?x.createElement("div",{className:"track-thumbnail",dangerouslySetInnerHTML:{__html:a.outerHTML}}):x.createElement("div",{className:"track-thumbnail"},x.createElement("svg",{height:20,width:30}));return x.createElement("li",{key:o.type,className:s,onClick:l=>{this.setState({selectedPlotType:o}),this.props.onPlotTypeSelected(o.type)},style:{listStyle:"none",paddingLeft:5,paddingBottom:0}},c,x.createElement("span",{style:{verticalAlign:"middle"}},o.type))})),x.createElement("div",null,r.length>0&&this.props.allTracksSameDatatype&&x.createElement("div",{className:"plot-type-container"},r),!this.props.allTracksSameDatatype&&x.createElement("div",{className:"plot-type-container-empty"},"Datasets with multiple datatypes chosen. They will be added with their default track types."))}}])}(x.Component);bR.propTypes={allTracksSameDatatype:q.bool,datatypes:q.array,orientation:q.string,onPlotTypeSelected:q.func,position:q.string};var _w={exports:{}},_R;function qne(){return _R||(_R=1,function(e,t){(function(n,r){e.exports=r(x)})(self,n=>(()=>{var r={4184:(s,c)=>{var l;(function(){var u={}.hasOwnProperty;function f(){for(var h=[],p=0;p<arguments.length;p++){var d=arguments[p];if(d){var g=typeof d;if(g==="string"||g==="number")h.push(d);else if(Array.isArray(d)){if(d.length){var y=f.apply(null,d);y&&h.push(y)}}else if(g==="object")if(d.toString===Object.prototype.toString)for(var b in d)u.call(d,b)&&d[b]&&h.push(b);else h.push(d.toString())}}return h.join(" ")}s.exports?(f.default=f,s.exports=f):(l=function(){return f}.apply(c,[]))===void 0||(s.exports=l)})()},8552:(s,c,l)=>{var u=l(852)(l(5639),"DataView");s.exports=u},1989:(s,c,l)=>{var u=l(1789),f=l(401),h=l(7667),p=l(1327),d=l(1866);function g(y){var b=-1,m=y==null?0:y.length;for(this.clear();++b<m;){var v=y[b];this.set(v[0],v[1])}}g.prototype.clear=u,g.prototype.delete=f,g.prototype.get=h,g.prototype.has=p,g.prototype.set=d,s.exports=g},8407:(s,c,l)=>{var u=l(7040),f=l(4125),h=l(2117),p=l(7518),d=l(4705);function g(y){var b=-1,m=y==null?0:y.length;for(this.clear();++b<m;){var v=y[b];this.set(v[0],v[1])}}g.prototype.clear=u,g.prototype.delete=f,g.prototype.get=h,g.prototype.has=p,g.prototype.set=d,s.exports=g},7071:(s,c,l)=>{var u=l(852)(l(5639),"Map");s.exports=u},3369:(s,c,l)=>{var u=l(4785),f=l(1285),h=l(6e3),p=l(9916),d=l(5265);function g(y){var b=-1,m=y==null?0:y.length;for(this.clear();++b<m;){var v=y[b];this.set(v[0],v[1])}}g.prototype.clear=u,g.prototype.delete=f,g.prototype.get=h,g.prototype.has=p,g.prototype.set=d,s.exports=g},3818:(s,c,l)=>{var u=l(852)(l(5639),"Promise");s.exports=u},8525:(s,c,l)=>{var u=l(852)(l(5639),"Set");s.exports=u},8668:(s,c,l)=>{var u=l(3369),f=l(619),h=l(2385);function p(d){var g=-1,y=d==null?0:d.length;for(this.__data__=new u;++g<y;)this.add(d[g])}p.prototype.add=p.prototype.push=f,p.prototype.has=h,s.exports=p},6384:(s,c,l)=>{var u=l(8407),f=l(7465),h=l(3779),p=l(7599),d=l(4758),g=l(4309);function y(b){var m=this.__data__=new u(b);this.size=m.size}y.prototype.clear=f,y.prototype.delete=h,y.prototype.get=p,y.prototype.has=d,y.prototype.set=g,s.exports=y},2705:(s,c,l)=>{var u=l(5639).Symbol;s.exports=u},1149:(s,c,l)=>{var u=l(5639).Uint8Array;s.exports=u},577:(s,c,l)=>{var u=l(852)(l(5639),"WeakMap");s.exports=u},4963:s=>{s.exports=function(c,l){for(var u=-1,f=c==null?0:c.length,h=0,p=[];++u<f;){var d=c[u];l(d,u,c)&&(p[h++]=d)}return p}},4636:(s,c,l)=>{var u=l(2545),f=l(5694),h=l(1469),p=l(4144),d=l(5776),g=l(6719),y=Object.prototype.hasOwnProperty;s.exports=function(b,m){var v=h(b),_=!v&&f(b),T=!v&&!_&&p(b),w=!v&&!_&&!T&&g(b),S=v||_||T||w,k=S?u(b.length,String):[],E=k.length;for(var P in b)!m&&!y.call(b,P)||S&&(P=="length"||T&&(P=="offset"||P=="parent")||w&&(P=="buffer"||P=="byteLength"||P=="byteOffset")||d(P,E))||k.push(P);return k}},2488:s=>{s.exports=function(c,l){for(var u=-1,f=l.length,h=c.length;++u<f;)c[h+u]=l[u];return c}},2908:s=>{s.exports=function(c,l){for(var u=-1,f=c==null?0:c.length;++u<f;)if(l(c[u],u,c))return!0;return!1}},8470:(s,c,l)=>{var u=l(7813);s.exports=function(f,h){for(var p=f.length;p--;)if(u(f[p][0],h))return p;return-1}},8866:(s,c,l)=>{var u=l(2488),f=l(1469);s.exports=function(h,p,d){var g=p(h);return f(h)?g:u(g,d(h))}},4239:(s,c,l)=>{var u=l(2705),f=l(9607),h=l(2333),p=u?u.toStringTag:void 0;s.exports=function(d){return d==null?d===void 0?"[object Undefined]":"[object Null]":p&&p in Object(d)?f(d):h(d)}},9454:(s,c,l)=>{var u=l(4239),f=l(7005);s.exports=function(h){return f(h)&&u(h)=="[object Arguments]"}},939:(s,c,l)=>{var u=l(2492),f=l(7005);s.exports=function h(p,d,g,y,b){return p===d||(p==null||d==null||!f(p)&&!f(d)?p!=p&&d!=d:u(p,d,g,y,h,b))}},2492:(s,c,l)=>{var u=l(6384),f=l(7114),h=l(8351),p=l(6096),d=l(4160),g=l(1469),y=l(4144),b=l(6719),m="[object Arguments]",v="[object Array]",_="[object Object]",T=Object.prototype.hasOwnProperty;s.exports=function(w,S,k,E,P,C){var I=g(w),O=g(S),M=I?v:d(w),R=O?v:d(S),z=(M=M==m?_:M)==_,U=(R=R==m?_:R)==_,j=M==R;if(j&&y(w)){if(!y(S))return!1;I=!0,z=!1}if(j&&!z)return C||(C=new u),I||b(w)?f(w,S,k,E,P,C):h(w,S,M,k,E,P,C);if(!(1&k)){var H=z&&T.call(w,"__wrapped__"),W=U&&T.call(S,"__wrapped__");if(H||W){var re=H?w.value():w,Y=W?S.value():S;return C||(C=new u),P(re,Y,k,E,C)}}return!!j&&(C||(C=new u),p(w,S,k,E,P,C))}},8458:(s,c,l)=>{var u=l(3560),f=l(5346),h=l(3218),p=l(346),d=/^\[object .+?Constructor\]$/,g=Function.prototype,y=Object.prototype,b=g.toString,m=y.hasOwnProperty,v=RegExp("^"+b.call(m).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");s.exports=function(_){return!(!h(_)||f(_))&&(u(_)?v:d).test(p(_))}},8749:(s,c,l)=>{var u=l(4239),f=l(1780),h=l(7005),p={};p["[object Float32Array]"]=p["[object Float64Array]"]=p["[object Int8Array]"]=p["[object Int16Array]"]=p["[object Int32Array]"]=p["[object Uint8Array]"]=p["[object Uint8ClampedArray]"]=p["[object Uint16Array]"]=p["[object Uint32Array]"]=!0,p["[object Arguments]"]=p["[object Array]"]=p["[object ArrayBuffer]"]=p["[object Boolean]"]=p["[object DataView]"]=p["[object Date]"]=p["[object Error]"]=p["[object Function]"]=p["[object Map]"]=p["[object Number]"]=p["[object Object]"]=p["[object RegExp]"]=p["[object Set]"]=p["[object String]"]=p["[object WeakMap]"]=!1,s.exports=function(d){return h(d)&&f(d.length)&&!!p[u(d)]}},280:(s,c,l)=>{var u=l(5726),f=l(6916),h=Object.prototype.hasOwnProperty;s.exports=function(p){if(!u(p))return f(p);var d=[];for(var g in Object(p))h.call(p,g)&&g!="constructor"&&d.push(g);return d}},2545:s=>{s.exports=function(c,l){for(var u=-1,f=Array(c);++u<c;)f[u]=l(u);return f}},1717:s=>{s.exports=function(c){return function(l){return c(l)}}},4757:s=>{s.exports=function(c,l){return c.has(l)}},4429:(s,c,l)=>{var u=l(5639)["__core-js_shared__"];s.exports=u},7114:(s,c,l)=>{var u=l(8668),f=l(2908),h=l(4757);s.exports=function(p,d,g,y,b,m){var v=1&g,_=p.length,T=d.length;if(_!=T&&!(v&&T>_))return!1;var w=m.get(p),S=m.get(d);if(w&&S)return w==d&&S==p;var k=-1,E=!0,P=2&g?new u:void 0;for(m.set(p,d),m.set(d,p);++k<_;){var C=p[k],I=d[k];if(y)var O=v?y(I,C,k,d,p,m):y(C,I,k,p,d,m);if(O!==void 0){if(O)continue;E=!1;break}if(P){if(!f(d,function(M,R){if(!h(P,R)&&(C===M||b(C,M,g,y,m)))return P.push(R)})){E=!1;break}}else if(C!==I&&!b(C,I,g,y,m)){E=!1;break}}return m.delete(p),m.delete(d),E}},8351:(s,c,l)=>{var u=l(2705),f=l(1149),h=l(7813),p=l(7114),d=l(8776),g=l(1814),y=u?u.prototype:void 0,b=y?y.valueOf:void 0;s.exports=function(m,v,_,T,w,S,k){switch(_){case"[object DataView]":if(m.byteLength!=v.byteLength||m.byteOffset!=v.byteOffset)return!1;m=m.buffer,v=v.buffer;case"[object ArrayBuffer]":return!(m.byteLength!=v.byteLength||!S(new f(m),new f(v)));case"[object Boolean]":case"[object Date]":case"[object Number]":return h(+m,+v);case"[object Error]":return m.name==v.name&&m.message==v.message;case"[object RegExp]":case"[object String]":return m==v+"";case"[object Map]":var E=d;case"[object Set]":var P=1&T;if(E||(E=g),m.size!=v.size&&!P)return!1;var C=k.get(m);if(C)return C==v;T|=2,k.set(m,v);var I=p(E(m),E(v),T,w,S,k);return k.delete(m),I;case"[object Symbol]":if(b)return b.call(m)==b.call(v)}return!1}},6096:(s,c,l)=>{var u=l(8234),f=Object.prototype.hasOwnProperty;s.exports=function(h,p,d,g,y,b){var m=1&d,v=u(h),_=v.length;if(_!=u(p).length&&!m)return!1;for(var T=_;T--;){var w=v[T];if(!(m?w in p:f.call(p,w)))return!1}var S=b.get(h),k=b.get(p);if(S&&k)return S==p&&k==h;var E=!0;b.set(h,p),b.set(p,h);for(var P=m;++T<_;){var C=h[w=v[T]],I=p[w];if(g)var O=m?g(I,C,w,p,h,b):g(C,I,w,h,p,b);if(!(O===void 0?C===I||y(C,I,d,g,b):O)){E=!1;break}P||(P=w=="constructor")}if(E&&!P){var M=h.constructor,R=p.constructor;M==R||!("constructor"in h)||!("constructor"in p)||typeof M=="function"&&M instanceof M&&typeof R=="function"&&R instanceof R||(E=!1)}return b.delete(h),b.delete(p),E}},1957:(s,c,l)=>{var u=typeof l.g=="object"&&l.g&&l.g.Object===Object&&l.g;s.exports=u},8234:(s,c,l)=>{var u=l(8866),f=l(9551),h=l(3674);s.exports=function(p){return u(p,h,f)}},5050:(s,c,l)=>{var u=l(7019);s.exports=function(f,h){var p=f.__data__;return u(h)?p[typeof h=="string"?"string":"hash"]:p.map}},852:(s,c,l)=>{var u=l(8458),f=l(7801);s.exports=function(h,p){var d=f(h,p);return u(d)?d:void 0}},9607:(s,c,l)=>{var u=l(2705),f=Object.prototype,h=f.hasOwnProperty,p=f.toString,d=u?u.toStringTag:void 0;s.exports=function(g){var y=h.call(g,d),b=g[d];try{g[d]=void 0;var m=!0}catch{}var v=p.call(g);return m&&(y?g[d]=b:delete g[d]),v}},9551:(s,c,l)=>{var u=l(4963),f=l(479),h=Object.prototype.propertyIsEnumerable,p=Object.getOwnPropertySymbols,d=p?function(g){return g==null?[]:(g=Object(g),u(p(g),function(y){return h.call(g,y)}))}:f;s.exports=d},4160:(s,c,l)=>{var u=l(8552),f=l(7071),h=l(3818),p=l(8525),d=l(577),g=l(4239),y=l(346),b="[object Map]",m="[object Promise]",v="[object Set]",_="[object WeakMap]",T="[object DataView]",w=y(u),S=y(f),k=y(h),E=y(p),P=y(d),C=g;(u&&C(new u(new ArrayBuffer(1)))!=T||f&&C(new f)!=b||h&&C(h.resolve())!=m||p&&C(new p)!=v||d&&C(new d)!=_)&&(C=function(I){var O=g(I),M=O=="[object Object]"?I.constructor:void 0,R=M?y(M):"";if(R)switch(R){case w:return T;case S:return b;case k:return m;case E:return v;case P:return _}return O}),s.exports=C},7801:s=>{s.exports=function(c,l){return c?.[l]}},1789:(s,c,l)=>{var u=l(4536);s.exports=function(){this.__data__=u?u(null):{},this.size=0}},401:s=>{s.exports=function(c){var l=this.has(c)&&delete this.__data__[c];return this.size-=l?1:0,l}},7667:(s,c,l)=>{var u=l(4536),f=Object.prototype.hasOwnProperty;s.exports=function(h){var p=this.__data__;if(u){var d=p[h];return d==="__lodash_hash_undefined__"?void 0:d}return f.call(p,h)?p[h]:void 0}},1327:(s,c,l)=>{var u=l(4536),f=Object.prototype.hasOwnProperty;s.exports=function(h){var p=this.__data__;return u?p[h]!==void 0:f.call(p,h)}},1866:(s,c,l)=>{var u=l(4536);s.exports=function(f,h){var p=this.__data__;return this.size+=this.has(f)?0:1,p[f]=u&&h===void 0?"__lodash_hash_undefined__":h,this}},5776:s=>{var c=/^(?:0|[1-9]\d*)$/;s.exports=function(l,u){var f=typeof l;return!!(u=u??9007199254740991)&&(f=="number"||f!="symbol"&&c.test(l))&&l>-1&&l%1==0&&l<u}},7019:s=>{s.exports=function(c){var l=typeof c;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?c!=="__proto__":c===null}},5346:(s,c,l)=>{var u,f=l(4429),h=(u=/[^.]+$/.exec(f&&f.keys&&f.keys.IE_PROTO||""))?"Symbol(src)_1."+u:"";s.exports=function(p){return!!h&&h in p}},5726:s=>{var c=Object.prototype;s.exports=function(l){var u=l&&l.constructor;return l===(typeof u=="function"&&u.prototype||c)}},7040:s=>{s.exports=function(){this.__data__=[],this.size=0}},4125:(s,c,l)=>{var u=l(8470),f=Array.prototype.splice;s.exports=function(h){var p=this.__data__,d=u(p,h);return!(d<0||(d==p.length-1?p.pop():f.call(p,d,1),--this.size,0))}},2117:(s,c,l)=>{var u=l(8470);s.exports=function(f){var h=this.__data__,p=u(h,f);return p<0?void 0:h[p][1]}},7518:(s,c,l)=>{var u=l(8470);s.exports=function(f){return u(this.__data__,f)>-1}},4705:(s,c,l)=>{var u=l(8470);s.exports=function(f,h){var p=this.__data__,d=u(p,f);return d<0?(++this.size,p.push([f,h])):p[d][1]=h,this}},4785:(s,c,l)=>{var u=l(1989),f=l(8407),h=l(7071);s.exports=function(){this.size=0,this.__data__={hash:new u,map:new(h||f),string:new u}}},1285:(s,c,l)=>{var u=l(5050);s.exports=function(f){var h=u(this,f).delete(f);return this.size-=h?1:0,h}},6e3:(s,c,l)=>{var u=l(5050);s.exports=function(f){return u(this,f).get(f)}},9916:(s,c,l)=>{var u=l(5050);s.exports=function(f){return u(this,f).has(f)}},5265:(s,c,l)=>{var u=l(5050);s.exports=function(f,h){var p=u(this,f),d=p.size;return p.set(f,h),this.size+=p.size==d?0:1,this}},8776:s=>{s.exports=function(c){var l=-1,u=Array(c.size);return c.forEach(function(f,h){u[++l]=[h,f]}),u}},4536:(s,c,l)=>{var u=l(852)(Object,"create");s.exports=u},6916:(s,c,l)=>{var u=l(5569)(Object.keys,Object);s.exports=u},1167:(s,c,l)=>{s=l.nmd(s);var u=l(1957),f=c&&!c.nodeType&&c,h=f&&s&&!s.nodeType&&s,p=h&&h.exports===f&&u.process,d=function(){try{return h&&h.require&&h.require("util").types||p&&p.binding&&p.binding("util")}catch{}}();s.exports=d},2333:s=>{var c=Object.prototype.toString;s.exports=function(l){return c.call(l)}},5569:s=>{s.exports=function(c,l){return function(u){return c(l(u))}}},5639:(s,c,l)=>{var u=l(1957),f=typeof self=="object"&&self&&self.Object===Object&&self,h=u||f||Function("return this")();s.exports=h},619:s=>{s.exports=function(c){return this.__data__.set(c,"__lodash_hash_undefined__"),this}},2385:s=>{s.exports=function(c){return this.__data__.has(c)}},1814:s=>{s.exports=function(c){var l=-1,u=Array(c.size);return c.forEach(function(f){u[++l]=f}),u}},7465:(s,c,l)=>{var u=l(8407);s.exports=function(){this.__data__=new u,this.size=0}},3779:s=>{s.exports=function(c){var l=this.__data__,u=l.delete(c);return this.size=l.size,u}},7599:s=>{s.exports=function(c){return this.__data__.get(c)}},4758:s=>{s.exports=function(c){return this.__data__.has(c)}},4309:(s,c,l)=>{var u=l(8407),f=l(7071),h=l(3369);s.exports=function(p,d){var g=this.__data__;if(g instanceof u){var y=g.__data__;if(!f||y.length<199)return y.push([p,d]),this.size=++g.size,this;g=this.__data__=new h(y)}return g.set(p,d),this.size=g.size,this}},346:s=>{var c=Function.prototype.toString;s.exports=function(l){if(l!=null){try{return c.call(l)}catch{}try{return l+""}catch{}}return""}},7813:s=>{s.exports=function(c,l){return c===l||c!=c&&l!=l}},5694:(s,c,l)=>{var u=l(9454),f=l(7005),h=Object.prototype,p=h.hasOwnProperty,d=h.propertyIsEnumerable,g=u(function(){return arguments}())?u:function(y){return f(y)&&p.call(y,"callee")&&!d.call(y,"callee")};s.exports=g},1469:s=>{var c=Array.isArray;s.exports=c},8612:(s,c,l)=>{var u=l(3560),f=l(1780);s.exports=function(h){return h!=null&&f(h.length)&&!u(h)}},4144:(s,c,l)=>{s=l.nmd(s);var u=l(5639),f=l(5062),h=c&&!c.nodeType&&c,p=h&&s&&!s.nodeType&&s,d=p&&p.exports===h?u.Buffer:void 0,g=(d?d.isBuffer:void 0)||f;s.exports=g},8446:(s,c,l)=>{var u=l(939);s.exports=function(f,h){return u(f,h)}},3560:(s,c,l)=>{var u=l(4239),f=l(3218);s.exports=function(h){if(!f(h))return!1;var p=u(h);return p=="[object Function]"||p=="[object GeneratorFunction]"||p=="[object AsyncFunction]"||p=="[object Proxy]"}},1780:s=>{s.exports=function(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=9007199254740991}},3218:s=>{s.exports=function(c){var l=typeof c;return c!=null&&(l=="object"||l=="function")}},7005:s=>{s.exports=function(c){return c!=null&&typeof c=="object"}},6719:(s,c,l)=>{var u=l(8749),f=l(1717),h=l(1167),p=h&&h.isTypedArray,d=p?f(p):u;s.exports=d},3674:(s,c,l)=>{var u=l(4636),f=l(280),h=l(8612);s.exports=function(p){return h(p)?u(p):f(p)}},8306:(s,c,l)=>{var u=l(3369);function f(h,p){if(typeof h!="function"||p!=null&&typeof p!="function")throw new TypeError("Expected a function");var d=function(){var g=arguments,y=p?p.apply(this,g):g[0],b=d.cache;if(b.has(y))return b.get(y);var m=h.apply(this,g);return d.cache=b.set(y,m)||b,m};return d.cache=new(f.Cache||u),d}f.Cache=u,s.exports=f},479:s=>{s.exports=function(){return[]}},5062:s=>{s.exports=function(){return!1}},2703:(s,c,l)=>{var u=l(414);function f(){}function h(){}h.resetWarningCache=f,s.exports=function(){function p(y,b,m,v,_,T){if(T!==u){var w=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw w.name="Invariant Violation",w}}function d(){return p}p.isRequired=p;var g={array:p,bigint:p,bool:p,func:p,number:p,object:p,string:p,symbol:p,any:p,arrayOf:d,element:p,elementType:p,instanceOf:d,node:p,objectOf:d,oneOf:d,oneOfType:d,shape:d,exact:d,checkPropTypes:h,resetWarningCache:f};return g.PropTypes=g,g}},5697:(s,c,l)=>{s.exports=l(2703)()},414:s=>{s.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},9787:s=>{s.exports=n}},i={};function o(s){var c=i[s];if(c!==void 0)return c.exports;var l=i[s]={id:s,loaded:!1,exports:{}};return r[s](l,l.exports,o),l.loaded=!0,l.exports}o.n=s=>{var c=s&&s.__esModule?()=>s.default:()=>s;return o.d(c,{a:c}),c},o.d=(s,c)=>{for(var l in c)o.o(c,l)&&!o.o(s,l)&&Object.defineProperty(s,l,{enumerable:!0,get:c[l]})},o.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),o.o=(s,c)=>Object.prototype.hasOwnProperty.call(s,c),o.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},o.nmd=s=>(s.paths=[],s.children||(s.children=[]),s);var a={};return(()=>{o.r(a),o.d(a,{default:()=>he,expandNodesToLevel:()=>ne});var s=o(4184),c=o.n(s),l=o(8446),u=o.n(l),f=o(8306),h=o.n(f);let p=(J=21)=>crypto.getRandomValues(new Uint8Array(J)).reduce((ee,be)=>ee+((be&=63)<36?be.toString(36):be<62?(be-26).toString(36).toUpperCase():be>62?"-":"_"),"");var d=o(5697),g=o.n(d),y=o(9787),b=o.n(y);function m(J){return m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},m(J)}var v=["children","title"];function _(){return _=Object.assign?Object.assign.bind():function(J){for(var ee=1;ee<arguments.length;ee++){var be=arguments[ee];for(var ve in be)Object.prototype.hasOwnProperty.call(be,ve)&&(J[ve]=be[ve])}return J},_.apply(this,arguments)}function T(J,ee){if(!(J instanceof ee))throw new TypeError("Cannot call a class as a function")}function w(J,ee){for(var be=0;be<ee.length;be++){var ve=ee[be];ve.enumerable=ve.enumerable||!1,ve.configurable=!0,"value"in ve&&(ve.writable=!0),Object.defineProperty(J,ve.key,ve)}}function S(J,ee){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(be,ve){return be.__proto__=ve,be},S(J,ee)}function k(J,ee){if(ee&&(m(ee)==="object"||typeof ee=="function"))return ee;if(ee!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(be){if(be===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return be}(J)}function E(J){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(ee){return ee.__proto__||Object.getPrototypeOf(ee)},E(J)}function P(J,ee,be){return ee in J?Object.defineProperty(J,ee,{value:be,enumerable:!0,configurable:!0,writable:!0}):J[ee]=be,J}var C=function(J){(function(Ne,we){if(typeof we!="function"&&we!==null)throw new TypeError("Super expression must either be null or a function");Ne.prototype=Object.create(we&&we.prototype,{constructor:{value:Ne,writable:!0,configurable:!0}}),Object.defineProperty(Ne,"prototype",{writable:!1}),we&&S(Ne,we)})(Ge,J);var ee,be,ve,je,Xe=(ve=Ge,je=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ne,we=E(ve);if(je){var Ae=E(this).constructor;Ne=Reflect.construct(we,arguments,Ae)}else Ne=we.apply(this,arguments);return k(this,Ne)});function Ge(){return T(this,Ge),Xe.apply(this,arguments)}return ee=Ge,(be=[{key:"render",value:function(){var Ne=this.props,we=Ne.children,Ae=Ne.title,Q=function(Z,se){if(Z==null)return{};var Te,Se,Ue=function(rt,tt){if(rt==null)return{};var dt,ot,vt={},kt=Object.keys(rt);for(ot=0;ot<kt.length;ot++)dt=kt[ot],tt.indexOf(dt)>=0||(vt[dt]=rt[dt]);return vt}(Z,se);if(Object.getOwnPropertySymbols){var He=Object.getOwnPropertySymbols(Z);for(Se=0;Se<He.length;Se++)Te=He[Se],se.indexOf(Te)>=0||Object.prototype.propertyIsEnumerable.call(Z,Te)&&(Ue[Te]=Z[Te])}return Ue}(Ne,v);return b().createElement("button",_({"aria-label":Ae,title:Ae,type:"button"},Q),we)}}])&&w(ee.prototype,be),Object.defineProperty(ee,"prototype",{writable:!1}),Ge}(b().PureComponent);P(C,"propTypes",{children:g().node.isRequired,title:g().string}),P(C,"defaultProps",{title:null});const I=C,O={ALL:"all",PARENT:"parent",LEAF:"leaf"};function M(J){this.message=J,this.stack=Error().stack}M.prototype=Object.create(Error.prototype),M.prototype.name="CheckboxTreeError";const R=M;function z(J,ee){var be=Object.keys(J);if(Object.getOwnPropertySymbols){var ve=Object.getOwnPropertySymbols(J);ee&&(ve=ve.filter(function(je){return Object.getOwnPropertyDescriptor(J,je).enumerable})),be.push.apply(be,ve)}return be}function U(J,ee,be){return ee in J?Object.defineProperty(J,ee,{value:be,enumerable:!0,configurable:!0,writable:!0}):J[ee]=be,J}function j(J,ee){if(!(J instanceof ee))throw new TypeError("Cannot call a class as a function")}function H(J,ee){for(var be=0;be<ee.length;be++){var ve=ee[be];ve.enumerable=ve.enumerable||!1,ve.configurable=!0,"value"in ve&&(ve.writable=!0),Object.defineProperty(J,ve.key,ve)}}var W=O;const re=function(){function J(ve){var je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};j(this,J),this.props=ve,this.flatNodes=je}var ee,be;return ee=J,be=[{key:"setProps",value:function(ve){this.props=ve}},{key:"clone",value:function(){var ve=this,je={};return Object.keys(this.flatNodes).forEach(function(Xe){var Ge=ve.flatNodes[Xe];je[Xe]=function(Ne){for(var we=1;we<arguments.length;we++){var Ae=arguments[we]!=null?arguments[we]:{};we%2?z(Object(Ae),!0).forEach(function(Q){U(Ne,Q,Ae[Q])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Ne,Object.getOwnPropertyDescriptors(Ae)):z(Object(Ae)).forEach(function(Q){Object.defineProperty(Ne,Q,Object.getOwnPropertyDescriptor(Ae,Q))})}return Ne}({},Ge)}),new J(this.props,je)}},{key:"getNode",value:function(ve){return this.flatNodes[ve]}},{key:"reset",value:function(){this.flatNodes={}}},{key:"flattenNodes",value:function(ve){var je=this,Xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ge=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(Array.isArray(ve)&&ve.length!==0){var Ne=this.props,we=Ne.disabled,Ae=Ne.noCascade;ve.forEach(function(Q,Z){var se=je.nodeHasChildren(Q);if(je.flatNodes[Q.value]!==void 0)throw new R("Duplicate value '".concat(Q.value,"' detected. All node values must be unique."));je.flatNodes[Q.value]={label:Q.label,value:Q.value,children:Q.children,parent:Xe,isChild:Xe.value!==void 0,isParent:se,isLeaf:!se,showCheckbox:Q.showCheckbox===void 0||Q.showCheckbox,disabled:je.getDisabledState(Q,Xe,we,Ae),treeDepth:Ge,index:Z},je.flattenNodes(Q.children,Q,Ge+1)})}}},{key:"nodeHasChildren",value:function(ve){return Array.isArray(ve.children)}},{key:"getDisabledState",value:function(ve,je,Xe,Ge){return!!Xe||!(Ge||!je.disabled)||!!ve.disabled}},{key:"deserializeLists",value:function(ve){var je=this,Xe=["checked","expanded"];Object.keys(this.flatNodes).forEach(function(Ge){Xe.forEach(function(Ne){je.flatNodes[Ge][Ne]=!1})}),Xe.forEach(function(Ge){ve[Ge].forEach(function(Ne){je.flatNodes[Ne]!==void 0&&(je.flatNodes[Ne][Ge]=!0)})})}},{key:"serializeList",value:function(ve){var je=this,Xe=[];return Object.keys(this.flatNodes).forEach(function(Ge){je.flatNodes[Ge][ve]&&Xe.push(Ge)}),Xe}},{key:"expandAllNodes",value:function(ve){var je=this;return Object.keys(this.flatNodes).forEach(function(Xe){je.flatNodes[Xe].isParent&&(je.flatNodes[Xe].expanded=ve)}),this}},{key:"toggleChecked",value:function(ve,je,Xe,Ge){var Ne=this,we=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],Ae=this.flatNodes[ve.value],Q=[W.PARENT,W.ALL].indexOf(Xe)>-1,Z=[W.LEAF,W.ALL].indexOf(Xe)>-1;if(Ae.isLeaf||Ge){if(ve.disabled)return this;this.toggleNode(ve.value,"checked",je)}else(Q||Ae.children.length===0)&&this.toggleNode(ve.value,"checked",je),Z&&Ae.children.forEach(function(se){Ne.toggleChecked(se,je,Xe,Ge,!1)});return we&&!Ge&&Ae.isChild&&Q&&this.toggleParentStatus(Ae.parent,Xe),this}},{key:"toggleParentStatus",value:function(ve,je){var Xe=this.flatNodes[ve.value];Xe.isChild?(je===W.ALL&&this.toggleNode(ve.value,"checked",this.isEveryChildChecked(Xe)),this.toggleParentStatus(Xe.parent,je)):this.toggleNode(ve.value,"checked",this.isEveryChildChecked(Xe))}},{key:"isEveryChildChecked",value:function(ve){var je=this;return ve.children.every(function(Xe){return je.getNode(Xe.value).checked})}},{key:"toggleNode",value:function(ve,je,Xe){return this.flatNodes[ve][je]=Xe,this}}],be&&H(ee.prototype,be),Object.defineProperty(ee,"prototype",{writable:!1}),J}();function Y(J){return Y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},Y(J)}function F(){return F=Object.assign?Object.assign.bind():function(J){for(var ee=1;ee<arguments.length;ee++){var be=arguments[ee];for(var ve in be)Object.prototype.hasOwnProperty.call(be,ve)&&(J[ve]=be[ve])}return J},F.apply(this,arguments)}function L(J,ee){var be=Object.keys(J);if(Object.getOwnPropertySymbols){var ve=Object.getOwnPropertySymbols(J);ee&&(ve=ve.filter(function(je){return Object.getOwnPropertyDescriptor(J,je).enumerable})),be.push.apply(be,ve)}return be}function K(J,ee){if(!(J instanceof ee))throw new TypeError("Cannot call a class as a function")}function G(J,ee){for(var be=0;be<ee.length;be++){var ve=ee[be];ve.enumerable=ve.enumerable||!1,ve.configurable=!0,"value"in ve&&(ve.writable=!0),Object.defineProperty(J,ve.key,ve)}}function te(J,ee){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(be,ve){return be.__proto__=ve,be},te(J,ee)}function de(J,ee){if(ee&&(Y(ee)==="object"||typeof ee=="function"))return ee;if(ee!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(be){if(be===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return be}(J)}function ce(J){return ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(ee){return ee.__proto__||Object.getPrototypeOf(ee)},ce(J)}function le(J,ee,be){return ee in J?Object.defineProperty(J,ee,{value:be,enumerable:!0,configurable:!0,writable:!0}):J[ee]=be,J}var me=function(J){(function(Ne,we){if(typeof we!="function"&&we!==null)throw new TypeError("Super expression must either be null or a function");Ne.prototype=Object.create(we&&we.prototype,{constructor:{value:Ne,writable:!0,configurable:!0}}),Object.defineProperty(Ne,"prototype",{writable:!1}),we&&te(Ne,we)})(Ge,J);var ee,be,ve,je,Xe=(ve=Ge,je=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ne,we=ce(ve);if(je){var Ae=ce(this).constructor;Ne=Reflect.construct(we,arguments,Ae)}else Ne=we.apply(this,arguments);return de(this,Ne)});function Ge(){return K(this,Ge),Xe.apply(this,arguments)}return ee=Ge,be=[{key:"componentDidMount",value:function(){this.updateDeterminateProperty()}},{key:"componentDidUpdate",value:function(){this.updateDeterminateProperty()}},{key:"updateDeterminateProperty",value:function(){var Ne=this.props.indeterminate;this.checkbox.indeterminate=Ne}},{key:"render",value:function(){var Ne=this,we=function(Ae){for(var Q=1;Q<arguments.length;Q++){var Z=arguments[Q]!=null?arguments[Q]:{};Q%2?L(Object(Z),!0).forEach(function(se){le(Ae,se,Z[se])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Ae,Object.getOwnPropertyDescriptors(Z)):L(Object(Z)).forEach(function(se){Object.defineProperty(Ae,se,Object.getOwnPropertyDescriptor(Z,se))})}return Ae}({},this.props);return delete we.indeterminate,b().createElement("input",F({},we,{ref:function(Ae){Ne.checkbox=Ae},type:"checkbox"}))}}],be&&G(ee.prototype,be),Object.defineProperty(ee,"prototype",{writable:!1}),Ge}(b().PureComponent);le(me,"propTypes",{indeterminate:g().bool}),le(me,"defaultProps",{indeterminate:!1});const ye=me,Oe=g().shape({check:g().node,uncheck:g().node,halfCheck:g().node,expandClose:g().node,expandOpen:g().node,expandAll:g().node,collapseAll:g().node,parentClose:g().node,parentOpen:g().node,leaf:g().node}),Re=g().shape({collapseAll:g().string.isRequired,expandAll:g().string.isRequired,toggle:g().string.isRequired});function Fe(J){return Fe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},Fe(J)}function $e(J,ee){for(var be=0;be<ee.length;be++){var ve=ee[be];ve.enumerable=ve.enumerable||!1,ve.configurable=!0,"value"in ve&&(ve.writable=!0),Object.defineProperty(J,ve.key,ve)}}function Ie(J,ee){return Ie=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(be,ve){return be.__proto__=ve,be},Ie(J,ee)}function xe(J,ee){if(ee&&(Fe(ee)==="object"||typeof ee=="function"))return ee;if(ee!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Me(J)}function Me(J){if(J===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return J}function Be(J){return Be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(ee){return ee.__proto__||Object.getPrototypeOf(ee)},Be(J)}function De(J,ee,be){return ee in J?Object.defineProperty(J,ee,{value:be,enumerable:!0,configurable:!0,writable:!0}):J[ee]=be,J}var qe=function(J){(function(Ne,we){if(typeof we!="function"&&we!==null)throw new TypeError("Super expression must either be null or a function");Ne.prototype=Object.create(we&&we.prototype,{constructor:{value:Ne,writable:!0,configurable:!0}}),Object.defineProperty(Ne,"prototype",{writable:!1}),we&&Ie(Ne,we)})(Ge,J);var ee,be,ve,je,Xe=(ve=Ge,je=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ne,we=Be(ve);if(je){var Ae=Be(this).constructor;Ne=Reflect.construct(we,arguments,Ae)}else Ne=we.apply(this,arguments);return xe(this,Ne)});function Ge(Ne){var we;return function(Ae,Q){if(!(Ae instanceof Q))throw new TypeError("Cannot call a class as a function")}(this,Ge),(we=Xe.call(this,Ne)).onCheck=we.onCheck.bind(Me(we)),we.onCheckboxKeyPress=we.onCheckboxKeyPress.bind(Me(we)),we.onCheckboxKeyUp=we.onCheckboxKeyUp.bind(Me(we)),we.onClick=we.onClick.bind(Me(we)),we.onExpand=we.onExpand.bind(Me(we)),we}return ee=Ge,(be=[{key:"onCheck",value:function(){var Ne=this.props,we=Ne.value;(0,Ne.onCheck)({value:we,checked:this.getCheckState({toggle:!0})})}},{key:"onCheckboxKeyPress",value:function(Ne){Ne.which===32&&Ne.preventDefault()}},{key:"onCheckboxKeyUp",value:function(Ne){var we=Ne.keyCode;[13,32].includes(we)&&this.onCheck()}},{key:"onClick",value:function(){var Ne=this.props,we=Ne.expandOnClick,Ae=Ne.isParent,Q=Ne.value,Z=Ne.onClick;Ae&&we&&this.onExpand(),Z({value:Q,checked:this.getCheckState({toggle:!1})})}},{key:"onExpand",value:function(){var Ne=this.props,we=Ne.expanded,Ae=Ne.value;(0,Ne.onExpand)({value:Ae,expanded:!we})}},{key:"getCheckState",value:function(Ne){var we=Ne.toggle,Ae=this.props,Q=Ae.checked,Z=Ae.optimisticToggle;return!(Q!==0||!we)||Q===1&&!we||Q===2&&Z}},{key:"renderCollapseButton",value:function(){var Ne=this.props,we=Ne.expandDisabled,Ae=Ne.isLeaf,Q=Ne.lang;return Ae?b().createElement("span",{className:"rct-collapse"},b().createElement("span",{className:"rct-icon"})):b().createElement(I,{className:"rct-collapse rct-collapse-btn",disabled:we,title:Q.toggle,onClick:this.onExpand},this.renderCollapseIcon())}},{key:"renderCollapseIcon",value:function(){var Ne=this.props,we=Ne.expanded,Ae=Ne.icons,Q=Ae.expandClose,Z=Ae.expandOpen;return we?Z:Q}},{key:"renderCheckboxIcon",value:function(){var Ne=this.props,we=Ne.checked,Ae=Ne.icons,Q=Ae.uncheck,Z=Ae.check,se=Ae.halfCheck;return we===0?Q:we===1?Z:se}},{key:"renderNodeIcon",value:function(){var Ne=this.props,we=Ne.expanded,Ae=Ne.icon,Q=Ne.icons,Z=Q.leaf,se=Q.parentClose,Te=Q.parentOpen,Se=Ne.isLeaf;return Ae!==null?Ae:Se?Z:we?Te:se}},{key:"renderBareLabel",value:function(Ne){var we=this.props,Ae=we.onClick,Q=we.title,Z=Ae!==null;return b().createElement("span",{className:"rct-bare-label",title:Q},Z?b().createElement("span",{className:"rct-node-clickable",onClick:this.onClick,onKeyPress:this.onClick,role:"button",tabIndex:0},Ne):Ne)}},{key:"renderCheckboxLabel",value:function(Ne){var we=this.props,Ae=we.checked,Q=we.disabled,Z=we.title,se=we.treeId,Te=we.value,Se=we.onClick!==null,Ue="".concat(se,"-").concat(String(Te).split(" ").join("_")),He=[b().createElement("label",{key:0,htmlFor:Ue,title:Z},b().createElement(ye,{checked:Ae===1,disabled:Q,id:Ue,indeterminate:Ae===2,onClick:this.onCheck,onChange:function(){}}),b().createElement("span",{"aria-checked":Ae===1,"aria-disabled":Q,className:"rct-checkbox",role:"checkbox",tabIndex:0,onKeyPress:this.onCheckboxKeyPress,onKeyUp:this.onCheckboxKeyUp},this.renderCheckboxIcon()),Se?null:Ne)];return Se&&He.push(b().createElement("span",{key:1,className:"rct-node-clickable",onClick:this.onClick,onKeyPress:this.onClick,role:"link",tabIndex:0},Ne)),He}},{key:"renderLabel",value:function(){var Ne=this.props,we=Ne.label,Ae=Ne.showCheckbox,Q=[Ne.showNodeIcon?b().createElement("span",{key:0,className:"rct-node-icon"},this.renderNodeIcon()):null,b().createElement("span",{key:1,className:"rct-title"},we)];return Ae?this.renderCheckboxLabel(Q):this.renderBareLabel(Q)}},{key:"renderChildren",value:function(){return this.props.expanded?this.props.children:null}},{key:"render",value:function(){var Ne=this.props,we=Ne.className,Ae=Ne.disabled,Q=Ne.expanded,Z=Ne.isLeaf,se=c()({"rct-node":!0,"rct-node-leaf":Z,"rct-node-parent":!Z,"rct-node-expanded":!Z&&Q,"rct-node-collapsed":!Z&&!Q,"rct-disabled":Ae},we);return b().createElement("li",{className:se},b().createElement("span",{className:"rct-text"},this.renderCollapseButton(),this.renderLabel()),this.renderChildren())}}])&&$e(ee.prototype,be),Object.defineProperty(ee,"prototype",{writable:!1}),Ge}(b().PureComponent);De(qe,"propTypes",{checked:g().number.isRequired,disabled:g().bool.isRequired,expandDisabled:g().bool.isRequired,expanded:g().bool.isRequired,icons:Oe.isRequired,isLeaf:g().bool.isRequired,isParent:g().bool.isRequired,label:g().node.isRequired,lang:Re.isRequired,optimisticToggle:g().bool.isRequired,showNodeIcon:g().bool.isRequired,treeId:g().string.isRequired,value:g().oneOfType([g().string,g().number]).isRequired,onCheck:g().func.isRequired,onExpand:g().func.isRequired,children:g().node,className:g().string,expandOnClick:g().bool,icon:g().node,showCheckbox:g().bool,title:g().string,onClick:g().func}),De(qe,"defaultProps",{children:null,className:null,expandOnClick:!1,icon:null,showCheckbox:!0,title:null,onClick:function(){}});const pe=qe,ie=g().oneOfType([g().arrayOf(g().string),g().arrayOf(g().number)]);function oe(J,ee){var be=Object.keys(J);if(Object.getOwnPropertySymbols){var ve=Object.getOwnPropertySymbols(J);ee&&(ve=ve.filter(function(je){return Object.getOwnPropertyDescriptor(J,je).enumerable})),be.push.apply(be,ve)}return be}function ge(J){for(var ee=1;ee<arguments.length;ee++){var be=arguments[ee]!=null?arguments[ee]:{};ee%2?oe(Object(be),!0).forEach(function(ve){ae(J,ve,be[ve])}):Object.getOwnPropertyDescriptors?Object.defineProperties(J,Object.getOwnPropertyDescriptors(be)):oe(Object(be)).forEach(function(ve){Object.defineProperty(J,ve,Object.getOwnPropertyDescriptor(be,ve))})}return J}function ae(J,ee,be){return ee in J?Object.defineProperty(J,ee,{value:be,enumerable:!0,configurable:!0,writable:!0}):J[ee]=be,J}var fe={label:g().node.isRequired,value:g().oneOfType([g().string,g().number]).isRequired,disabled:g().bool,icon:g().node,showCheckbox:g().bool,title:g().string};const ke=g().oneOfType([g().shape(fe),g().shape(ge(ge({},fe),{},{children:g().arrayOf(fe).isRequired}))]);function Pe(J){return Pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},Pe(J)}function ze(J,ee){var be=Object.keys(J);if(Object.getOwnPropertySymbols){var ve=Object.getOwnPropertySymbols(J);ee&&(ve=ve.filter(function(je){return Object.getOwnPropertyDescriptor(J,je).enumerable})),be.push.apply(be,ve)}return be}function Ve(J){for(var ee=1;ee<arguments.length;ee++){var be=arguments[ee]!=null?arguments[ee]:{};ee%2?ze(Object(be),!0).forEach(function(ve){Je(J,ve,be[ve])}):Object.getOwnPropertyDescriptors?Object.defineProperties(J,Object.getOwnPropertyDescriptors(be)):ze(Object(be)).forEach(function(ve){Object.defineProperty(J,ve,Object.getOwnPropertyDescriptor(be,ve))})}return J}function Qe(J,ee){for(var be=0;be<ee.length;be++){var ve=ee[be];ve.enumerable=ve.enumerable||!1,ve.configurable=!0,"value"in ve&&(ve.writable=!0),Object.defineProperty(J,ve.key,ve)}}function et(J,ee){return et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(be,ve){return be.__proto__=ve,be},et(J,ee)}function nt(J,ee){if(ee&&(Pe(ee)==="object"||typeof ee=="function"))return ee;if(ee!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ee(J)}function Ee(J){if(J===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return J}function _e(J){return _e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(ee){return ee.__proto__||Object.getPrototypeOf(ee)},_e(J)}function Je(J,ee,be){return ee in J?Object.defineProperty(J,ee,{value:be,enumerable:!0,configurable:!0,writable:!0}):J[ee]=be,J}var X=function(J){(function(we,Ae){if(typeof Ae!="function"&&Ae!==null)throw new TypeError("Super expression must either be null or a function");we.prototype=Object.create(Ae&&Ae.prototype,{constructor:{value:we,writable:!0,configurable:!0}}),Object.defineProperty(we,"prototype",{writable:!1}),Ae&&et(we,Ae)})(Ne,J);var ee,be,ve,je,Xe,Ge=(je=Ne,Xe=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var we,Ae=_e(je);if(Xe){var Q=_e(this).constructor;we=Reflect.construct(Ae,arguments,Q)}else we=Ae.apply(this,arguments);return nt(this,we)});function Ne(we){var Ae;(function(Z,se){if(!(Z instanceof se))throw new TypeError("Cannot call a class as a function")})(this,Ne),Ae=Ge.call(this,we);var Q=new re(we);return Q.flattenNodes(we.nodes),Q.deserializeLists({checked:we.checked,expanded:we.expanded}),Ae.state={id:we.id||"rct-".concat(p()),model:Q,prevProps:we},Ae.onCheck=Ae.onCheck.bind(Ee(Ae)),Ae.onExpand=Ae.onExpand.bind(Ee(Ae)),Ae.onNodeClick=Ae.onNodeClick.bind(Ee(Ae)),Ae.onExpandAll=Ae.onExpandAll.bind(Ee(Ae)),Ae.onCollapseAll=Ae.onCollapseAll.bind(Ee(Ae)),Ae.combineMemorized=h()(function(Z,se){return Ve(Ve({},Z),se)}).bind(Ee(Ae)),Ae}return ee=Ne,be=[{key:"onCheck",value:function(we){var Ae=this.props,Q=Ae.checkModel,Z=Ae.noCascade,se=Ae.onCheck,Te=this.state.model.clone(),Se=Te.getNode(we.value);Te.toggleChecked(we,we.checked,Q,Z),se(Te.serializeList("checked"),Ve(Ve({},Se),we))}},{key:"onExpand",value:function(we){var Ae=this.props.onExpand,Q=this.state.model.clone(),Z=Q.getNode(we.value);Q.toggleNode(we.value,"expanded",we.expanded),Ae(Q.serializeList("expanded"),Ve(Ve({},Z),we))}},{key:"onNodeClick",value:function(we){(0,this.props.onClick)(Ve(Ve({},this.state.model.getNode(we.value)),we))}},{key:"onExpandAll",value:function(){this.expandAllNodes()}},{key:"onCollapseAll",value:function(){this.expandAllNodes(!1)}},{key:"expandAllNodes",value:function(){var we=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],Ae=this.props.onExpand;Ae(this.state.model.clone().expandAllNodes(we).serializeList("expanded"))}},{key:"determineShallowCheckState",value:function(we,Ae){var Q=this.state.model.getNode(we.value);return Q.isLeaf||Ae||we.children.length===0?Q.checked?1:0:this.isEveryChildChecked(we)?1:this.isSomeChildChecked(we)?2:0}},{key:"isEveryChildChecked",value:function(we){var Ae=this;return we.children.every(function(Q){return Ae.state.model.getNode(Q.value).checkState===1})}},{key:"isSomeChildChecked",value:function(we){var Ae=this;return we.children.some(function(Q){return Ae.state.model.getNode(Q.value).checkState>0})}},{key:"renderTreeNodes",value:function(we){var Ae=this,Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Z=this.props,se=Z.expandDisabled,Te=Z.expandOnClick,Se=Z.icons,Ue=Z.lang,He=Z.noCascade,rt=Z.onClick,tt=Z.onlyLeafCheckboxes,dt=Z.optimisticToggle,ot=Z.showNodeTitle,vt=Z.showNodeIcon,kt=this.state,pt=kt.id,lt=kt.model,qt=Ne.defaultProps.icons,mt=we.map(function(Dt){var sr=Dt.value,Lt=lt.getNode(Dt.value),Ke=Lt.isParent?Ae.renderTreeNodes(Dt.children,Dt):null;Lt.checkState=Ae.determineShallowCheckState(Dt,He);var V=tt?Lt.isLeaf:Lt.showCheckbox;return!Q.value||lt.getNode(Q.value).expanded?b().createElement(pe,{key:sr,checked:Lt.checkState,className:Dt.className,disabled:Lt.disabled,expandDisabled:se,expandOnClick:Te,expanded:Lt.expanded,icon:Dt.icon,icons:Ae.combineMemorized(qt,Se),label:Dt.label,lang:Ue,optimisticToggle:dt,isLeaf:Lt.isLeaf,isParent:Lt.isParent,showCheckbox:V,showNodeIcon:vt,title:ot?Dt.title||Dt.label:Dt.title,treeId:pt,value:Dt.value,onCheck:Ae.onCheck,onClick:rt&&Ae.onNodeClick,onExpand:Ae.onExpand},Ke):null});return b().createElement("ol",null,mt)}},{key:"renderExpandAll",value:function(){var we=this.props,Ae=we.icons,Q=Ae.expandAll,Z=Ae.collapseAll,se=we.lang;return we.showExpandAll?b().createElement("div",{className:"rct-options"},b().createElement(I,{className:"rct-option rct-option-expand-all",title:se.expandAll,onClick:this.onExpandAll},Q),b().createElement(I,{className:"rct-option rct-option-collapse-all",title:se.collapseAll,onClick:this.onCollapseAll},Z)):null}},{key:"renderHiddenInput",value:function(){var we=this.props,Ae=we.name,Q=we.nameAsArray;return Ae===void 0?null:Q?this.renderArrayHiddenInput():this.renderJoinedHiddenInput()}},{key:"renderArrayHiddenInput",value:function(){var we=this.props,Ae=we.checked,Q=we.name;return Ae.map(function(Z){var se="".concat(Q,"[]");return b().createElement("input",{key:Z,name:se,type:"hidden",value:Z})})}},{key:"renderJoinedHiddenInput",value:function(){var we=this.props,Ae=we.checked,Q=we.name,Z=Ae.join(",");return b().createElement("input",{name:Q,type:"hidden",value:Z})}},{key:"render",value:function(){var we,Ae=this.props,Q=Ae.direction,Z=Ae.disabled,se=Ae.iconsClass,Te=Ae.nodes,Se=Ae.nativeCheckboxes,Ue=this.state.id,He=this.renderTreeNodes(Te),rt=c()((Je(we={"react-checkbox-tree":!0,"rct-disabled":Z},"rct-icons-".concat(se),!0),Je(we,"rct-native-display",Se),Je(we,"rct-direction-rtl",Q==="rtl"),we));return b().createElement("div",{className:rt,id:Ue},this.renderExpandAll(),this.renderHiddenInput(),He)}}],ve=[{key:"getDerivedStateFromProps",value:function(we,Ae){var Q=Ae.model,Z=Ae.prevProps,se=we.disabled,Te=we.id,Se=we.nodes,Ue=Ve(Ve({},Ae),{},{prevProps:we});return Q.setProps(we),u()(Z.nodes,Se)&&Z.disabled===se||(Q.reset(),Q.flattenNodes(Se)),Te!==null&&(Ue=Ve(Ve({},Ue),{},{id:Te})),Q.deserializeLists({checked:we.checked,expanded:we.expanded}),Ue}}],be&&Qe(ee.prototype,be),ve&&Qe(ee,ve),Object.defineProperty(ee,"prototype",{writable:!1}),Ne}(b().Component);function N(J){return function(ee){if(Array.isArray(ee))return $(ee)}(J)||function(ee){if(typeof Symbol<"u"&&ee[Symbol.iterator]!=null||ee["@@iterator"]!=null)return Array.from(ee)}(J)||function(ee,be){if(ee){if(typeof ee=="string")return $(ee,be);var ve=Object.prototype.toString.call(ee).slice(8,-1);return ve==="Object"&&ee.constructor&&(ve=ee.constructor.name),ve==="Map"||ve==="Set"?Array.from(ee):ve==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ve)?$(ee,be):void 0}}(J)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
241
+ scale(${l.scale.x},${l.scale.y})`)}return i}},{key:"clearAxis",value:function(){const n=this.pAxis;for(;this.axisTexts.length;){const r=this.axisTexts.pop();n.removeChild(r)}n.clear()}}])}();const R7=(e,t)=>{const n=[];for(let r=e;r<t;r++)n.push(r);return n},zee=(e,t)=>{const n=e.map(s=>+s).sort((s,c)=>c-s),r=t.range()[1]-t.range()[0],o=n.map(s=>(t.domain()[1]-t.domain()[0])/s).map(s=>s/r),a=o.filter(s=>s<1);return a.length===0?0:o.indexOf(a[a.length-1])},Hee=(e,t,n,r)=>{const i=e.range()[1]-e.range()[0],o=Math.max((n-t)/(e.domain()[1]-e.domain()[0]),1),s=Math.max(0,Math.ceil(Math.log(i/384)/Math.LN2));let c=Math.round(Math.log(o)/Math.LN2)+s,l=0;return r&&(l=Math.floor(Math.log(256)/Math.log(2)-Math.log(r)/Math.log(2))),c+=l,c},D7=(e,t,n)=>{if(typeof n>"u"&&(n=Number.MAX_SAFE_INTEGER),e.resolutions)return zee(e.resolutions,t,e.min_pos[0],e.max_pos[0]-2);const r=Hee(t,e.min_pos[0],e.max_pos[0],e.bins_per_dimension||e.tile_size),i=Math.min(r,n);return Math.max(i,0)},Fee=(e,t,n,r,i,o)=>{const a=Math.min(e,i),s=o/2**a;return R7(Math.max(0,Math.floor((t.domain()[0]-n)/s)),Math.min(2**a,Math.ceil((t.domain()[1]-n-1e-7)/s)))},qee=(e,t,n,r=Number.MAX_VALUE,i=256)=>{const a=e*i,s=20,c=Math.max(0,Math.floor((t.domain()[0]-n)/a)),l=Math.ceil(Math.min(r,t.domain()[1]-n-1e-7)/a);let u=R7(c,l);return u.length>s&&(console.warn(`Too many visible tiles: ${u.length} truncating to ${s}`),u=u.slice(0,s)),u},Uee=(e,t)=>{if(!e)return[];const n=D7(e,t,e.max_zoom);if(e.resolutions){const o=e.resolutions.map(c=>+c).sort((c,l)=>l-c);return qee(o[n],t,e.min_pos[0],e.max_pos[0],e.bins_per_dimension||e.tile_size).map(c=>[n,c])}return Fee(n,t,e.min_pos[0],e.max_pos[0],e.max_zoom,e.max_width).map(o=>[n,o])},Vee=(e,t)=>{if(e.axis||(e.axis=new xd(e),e.pBase.addChild(e.axis.pAxis)),!e.options.axisPositionVertical&&!e.options.axisPositionHorizontal){e.axis.clearAxis();return}if(e.options.axisPositionVertical&&e.options.axisPositionVertical==="hidden"){e.axis.clearAxis();return}if(e.options.axisPositionHorizontal&&e.options.axisPositionHorizontal==="hidden"){e.axis.clearAxis();return}const n=e.options.axisMargin||0;e.options.axisPositionHorizontal==="left"||e.options.axisPositionVertical==="top"?(e.axis.pAxis.position.x=e.position[0]+n,e.axis.pAxis.position.y=e.position[1],e.axis.drawAxisRight(t,e.dimensions[1])):e.options.axisPositionHorizontal==="outsideLeft"||e.options.axisPositionVertical==="outsideTop"?(e.axis.pAxis.position.x=e.position[0]+n,e.axis.pAxis.position.y=e.position[1],e.axis.drawAxisLeft(t,e.dimensions[1])):e.options.axisPositionHorizontal==="right"||e.options.axisPositionVertical==="bottom"?(e.axis.pAxis.position.x=e.position[0]+e.dimensions[0]-n,e.axis.pAxis.position.y=e.position[1],e.axis.drawAxisLeft(t,e.dimensions[1])):(e.options.axisPositionHorizontal==="outsideRight"||e.options.axisPositionVertical==="outsideBottom")&&(e.axis.pAxis.position.x=e.position[0]+e.dimensions[0]-n,e.axis.pAxis.position.y=e.position[1],e.axis.drawAxisRight(t,e.dimensions[1]))},Gee=(e,t)=>{const n=e.valueScaleTransform,{y:r,k:i}=n,o=e.dimensions[1];r+t/i>-(i-1)*o&&r+t/i<0&&(e.valueScaleTransform=n.translate(0,t/i)),Object.values(e.fetchedTiles).forEach(a=>{a.graphics.position.y=e.valueScaleTransform.y}),e.animate()},Wee=(e,t,n,r)=>{const i=n.k,o=n.y,a=(e-o)/i,s=Math.max(i/t,1);let c=i*a+o-s*a;return c=Math.max(c,-(s-1)*r),c=Math.min(c,0),Ar.translate(0,c).scale(s)},Yee=(e,t)=>{const n=+t.split(".")[0],r=+t.split(".")[1],i=e.max_width,o=e.min_pos[0],a=i/2**n;return{tileX:o+r*a,tileWidth:a}};function Xee(e,t){Object.values(e.fetchedTiles).forEach(n=>{if(!n.drawnAtScale)return;const r=n.drawnAtScale.range(),i=e._xScale.range();if(r[0]!==i[0]||r[1]!==i[1]){e.renderTile(n);return}const o=(n.drawnAtScale.domain()[1]-n.drawnAtScale.domain()[0])/(e._xScale.domain()[1]-e._xScale.domain()[0]);if(o>2||o<.5)e.renderTile(n);else{const s=e._xScale.domain().map(n.drawnAtScale)[0];for(const c of t)c(n).scale.x=o,c(n).x=-s*o}})}const mf={calculate1DVisibleTiles:Uee,calculate1DZoomLevel:D7,drawAxis:Vee,movedY:Gee,getTilePosAndDimensions:Yee,stretchRects:Xee,zoomedY:Wee},Kee=Object.freeze(Object.defineProperty({__proto__:null,DenseDataExtrema1D:Ru,DenseDataExtrema2D:I0,IS_TRACK_RANGE_SELECTABLE:$s,absToChr:dr,accessorTransposition:I4,addArrays:R4,addClass:SX,base64ToCanvas:EX,changeOptions:eJ,chrToAbs:Tu,chromInfoBisector:s0,cloneEvent:D4,colorDomainToRgbaArray:jo,colorToHex:gt,colorToRgba:N4,dataToGenomicLoci:Cp,debounce:Op,decToHexStr:l0,dictFromTuples:L4,dictItems:Yn,dictKeys:ci,dictValues:Zt,download:wu,expandCombinedTracks:qp,fillInMinWidths:eA,flatten:LX,forEach:$X,forwardEvent:Lp,genomeLociToPixels:jX,genomicRangeToChromosomeChunks:BX,getAggregationFunction:R0,getDefaultTrackForDatatype:g0,getDefaultTracksForDatatype:OA,getElementDim:m0,getTiledPlot:AK,getTrackByUid:rn,getTrackConfFromHGC:HX,getTrackObjById:Ds,getTrackObjectFromHGC:Vp,getTrackPositionByUid:Mu,getTrackRenderer:AA,getXylofon:rA,gradient:nA,hasClass:xp,hasParent:iA,hexStrToInt:oA,intoTheVoid:aA,isTrackOrChildTrack:sA,isWithin:_0,latToY:KX,lngToX:QX,loadChromInfos:ZX,map:y0,max:T0,maxNonZero:w0,min:cA,minNonZero:S0,mod:JX,mountHGComponent:RT,mountHGComponentAsync:iJ,ndarrayAssign:fA,ndarrayFlatten:mA,ndarrayToList:gA,numericifyVersion:vA,objVals:Bp,or:Iu,parseChromsizesRows:_u,pixiTextToSvg:zp,q:iK,rangeQuery2d:oK,reduce:tA,relToAbsChromPos:aK,removeClass:lK,removeHGComponent:nJ,resetD3BrushStyle:Ls,rgbToHex:cK,scalesCenterAndK:kr,scalesToGenomeLoci:yA,segmentsToRows:Up,selectedItemsToSize:Du,showMousePosition:Bo,some:pK,sum:zo,svgLine:O0,throttleAndDebounce:bA,tileToCanvas:dK,timeout:_A,toVoid:Hp,totalTrackPixelHeight:gK,trackHeight:Zn,trackUtils:mf,trackWidth:Qn,trimTrailingSlash:Fp,valueToColor:P0,visitPositionedTracks:oo,visitTracks:v0,waitForJsonComplete:pd,waitForTilesLoaded:lf,waitForTransitionsFinished:IT},Symbol.toStringTag,{value:"Module"}));let N7=!1;const L7={listen:()=>{if(N7)return;const[e,t]=rA(),l=[String.fromCharCode(..."102117110099116105111110040041123115101108102046099111110115111108101046108111103040039".match(/.{1,3}/g).map(S=>+S)).toLowerCase(),String.fromCharCode(..."072".match(/.{1,3}/g).map(S=>+S)),String.fromCharCode(..."105".match(/.{1,3}/g).map(S=>+S)).toLowerCase(),String.fromCharCode(..."071".match(/.{1,3}/g).map(S=>+S)),String.fromCharCode(..."108097115115".match(/.{1,3}/g).map(S=>+S)).toLowerCase(),String.fromCharCode(..."032118".match(/.{1,3}/g).map(S=>+S)).toLowerCase(),String.fromCharCode(...t.match(/.{1,3}/g).map(S=>+S)).toLowerCase(),String.fromCharCode(..."058032104116116112058047047104105103108097115115046105111039041125".match(/.{1,3}/g).map(S=>+S)).toLowerCase()].join(""),u="085082076",f="066076079066",h="087111114107101114",p="099114101097116101079098106101099116085082076",d="114101118111107101079098106101099116085082076",g=S=>S.charAt(0).toUpperCase()+S.slice(1),y=S=>S.slice(0,6)+S.charAt(6).toUpperCase()+S.slice(7,12)+S.slice(12).toUpperCase(),b=e[String.fromCharCode(...u.match(/.{1,3}/g).map(S=>+S))],m=e[g(String.fromCharCode(...f.match(/.{1,3}/g).map(S=>+S)).toLowerCase())],v=e[g(String.fromCharCode(...h.match(/.{1,3}/g).map(S=>+S)).toLowerCase())],_=y(String.fromCharCode(...p.match(/.{1,3}/g).map(S=>+S)).toLowerCase()),T=y(String.fromCharCode(...d.match(/.{1,3}/g).map(S=>+S)).toLowerCase()),w=b[_](new m([`(${l})()`],{type:"application/javascript"}));new v(w),b[T](w),N7=!0}};function Zee(e,t,n,r,i,o,a){let s,c;if(i){const g=R0(i);s=g,c=(y,b)=>g(b.map(m=>e[m*t[1]+y]))??0}let l,u,f,h,p,d;for(f=0;f<t[1];f++)for(u=0,h=0;h<r.length;h++){if(d=r[h],s&&a==="server")l=e[h*t[1]+f];else if(Array.isArray(d)){if(!c)throw new Error("row aggregation requires 'aggFromDataFunc'");l=c(f,d)}else l=e[d*t[1]+f];if(o&&Array.isArray(d))for(p=0;p<d.length;p++)n(u*t[1]+f,l),u++;else n(u*t[1]+f,l),u++}}function Qee(e,t,n,r,i,o,a=!1,s=!1,c=null,l=null,u=null){let f;n==="log"?f=Ro().range([254,0]).domain(r):(n!=="linear"&&console.warn("Unknown value scale type:",n," Defaulting to linear"),f=Et().range([254,0]).domain(r));const{selectedRows:h,selectedRowsAggregationMode:p="mean",selectedRowsAggregationWithRelativeHeight:d=!1,selectedRowsAggregationMethod:g="client"}=u??{};let y=e;c&&h&&(y=Du(h,d)*c[1]);let b,m=0;const v=c?c[1]:Math.sqrt(e),_=new Uint8ClampedArray(y*4),T=k=>{const E=f(k);return Number.isNaN(E)?254:Math.max(0,Math.min(254,Math.floor(E)))},w=(k,E)=>{m=255,!(a&&Math.floor(k/v)<k%v)&&!(s&&Math.floor(k/v)>k%v)&&!Number.isNaN(+E)&&(m=T(E+i)),(m<0||m>255)&&console.warn("out of bounds rgbIdx:",m," (should be 0 <= rgbIdx <= 255)"),l&&!Number.isNaN(+E)&&+E==0?b=l:b=o[m],_[k*4]=b[0],_[k*4+1]=b[1],_[k*4+2]=b[2],_[k*4+3]=b[3]};let S;try{if(h&&c)Zee(t,c,w,h,p,d,g);else for(let k=0;k<t.length;k++)S=t[k],w(k,S)}catch(k){return console.warn("Odd datapoint"),console.warn("d:",S),S=S??0,console.warn("valueScale.domain():",f.domain()),console.warn("valueScale.range():",f.range()),console.warn("value:",f(S+i)),console.warn("pseudocount:",i),console.warn("rgbIdx:",m,"d:",S,"ct:",f(S)),console.error("ERROR:",k),_}return _}function Jee(e){let t=e&31744,n,r,i;const o=(e&32768)<<16;switch(t){case 0:if(n=e&1023,n===0)return o;for(n<<=1;!(n&1024);)n<<=1,t++;return r=112-t<<23,i=(n&1023)<<13,o+r+i;case 31744:return o+2139095040+((e&1023)<<13);default:return o+((e&32767)+114688<<13)}}function ete(e){const t=atob(e),n=t.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=t.charCodeAt(i);return r.buffer}function tte(e){const t=new Uint32Array(e.length);for(let r=0;r<e.length;r++)t[r]=Jee(e[r]);return new Float32Array(t.buffer)}function VT(e,t,n){const r=e??{};for(const i of n){i in r||(r[i]={});const o=i,a=o.split(".");r[o].server=t,r[o].tileId=o,r[o].zoomLevel=+a[1];const s=a.slice(2,a.length).map(c=>+c).filter(c=>!Number.isNaN(c));if(r[o].tilePos=s,r[o].tilesetUid=a[0],"dense"in r[o]&&typeof r[o].dense=="string"){const c=r[o].dense,l=ete(c);let u;if(r[o].dtype==="float16"){const h=new Uint16Array(l);u=tte(h)}else u=new Float32Array(l);const f=s.length===2?new I0(u):new Ru(u);r[o].dense=u,r[o].denseDataExtrema=f,r[o].minNonZero=f.minNonZeroInTile,r[o].maxNonZero=f.maxNonZeroInTile}}return r}function rte(e,t){const n={"content-type":"application/json"};t.authHeader&&(n.Authorization=t.authHeader);const r=e.tileIds.map(o=>`d=${o}`).join("&"),i=`${e.server}/tiles/?${r}&s=${t.sessionId}`;return t.pubSub?.publish("requestSent",i),fetch(i,{credentials:"same-origin",headers:n,...e.body?.length>0?{method:"POST",body:JSON.stringify(e.body)}:{}}).then(o=>o.json()).then(o=>(t.pubSub?.publish("requestReceived",i),VT(o,e.server,e.tileIds))).catch(o=>console.warn("err:",o))}const nte=15,$7=Mt.nice();let vf=0,Js=null;function*ite(e,t){let n=[];for(const r of e)n.push(r),n.length===t&&(yield n,n=[]);n.length&&(yield n)}function ote({processBatch:e,interval:t,finalWait:n}){let r,i=[],o=0;const a=()=>{r=void 0,i=[]},s=(...f)=>{e(i,...f),a()},c=(...f)=>{const h=()=>{o>0&&(s(...f),o=0)};clearTimeout(r),r=setTimeout(h,n)};let l=!1;return(f,...h)=>{const{promise:p,resolve:d,reject:g}=Promise.withResolvers();return i.push({value:f,resolve:d,reject:g}),l?o++:(s(...h),c(...h),l=!0,o=0,setTimeout(()=>{l=!1},t)),p}}const Cd=e=>{Js=e},j7=()=>Js;function ate(e){const t=[],n={};for(const r of e){n[r.id]===void 0&&(n[r.id]=t.length,t.push({...r,tileIds:[]}));const i=t[n[r.id]];i.tileIds=i.tileIds.concat(r.tileIds)}return t}function ste(e){const t=[],n={};for(const r of e){n[r.server]===void 0&&(n[r.server]=t.length,t.push({...r,tileIds:[],body:[]}));const i=t[n[r.server]];i.tileIds=i.tileIds.concat(r.tileIds);for(const o of r.tileIds)if(r.options){const a=o.indexOf("."),s=o.substring(0,a),c=o.substring(a+1);let l=i.body.find(u=>u.tilesetUid===s);l||(l={tilesetUid:s,tileIds:[],options:r.options},i.body.push(l)),l.tileIds.push(c)}}return t}function*lte(e,{maxSize:t=nte}={}){const n=ate(e),r=ste(n);for(const i of r)for(const o of ite(new Set(i.tileIds),t))yield{...i,tileIds:o}}function cte(e){const t={},n=(r,i)=>`${r}/${i}`;for(const r of e)if(r)for(const[i,o]of Object.entries(r))t[n(o.server,i)]=r[i];return{resolveTileDataForRequest(r){const i={};for(const o of r.tileIds){const a=t[n(r.server,o)];a&&(i[o]=a)}return i}}}const B7=ote({processBatch:async(e,t)=>{const n=Array.from(lte(e.map(i=>i.value)),i=>rte(i,{authHeader:Js,sessionId:$7,pubSub:t})),r=cte(await Promise.all(n));for(const i of e)i.resolve(r.resolveTileDataForRequest(i.value))},interval:c0,finalWait:c0}),GT=(e,t)=>{const n=e.map(s=>+s).sort((s,c)=>c-s),r=t.range()[1]-t.range()[0],o=n.map(s=>(t.domain()[1]-t.domain()[0])/s).map(s=>s/r),a=o.filter(s=>s<1);return a.length===0?0:o.indexOf(a[a.length-1])},z7=(e,t)=>{if(Au(e))return e.resolutions.map(s=>+s).sort((s,c)=>c-s)[t];const n=e.max_width,r=+(e?.bins_per_dimension??256);return n/(2**t*r)},WT=(e,t,n,r)=>{const i=e.range()[1]-e.range()[0],o=Math.max((n-t)/(e.domain()[1]-e.domain()[0]),1),s=Math.max(0,Math.ceil(Math.log(i/384)/Math.LN2));let c=Math.round(Math.log(o)/Math.LN2)+s,l=0;return r&&(l=Math.floor(Math.log(256)/Math.log(2)-Math.log(r)/Math.log(2))),c+=l,c};function H7(e,t,n,r,i){let o=null;const a=jp(e)?e.bins_per_dimension??256:256;jp(e)?o=t/2**r:o=e.resolutions.map(u=>+u).sort((u,f)=>f-u)[r]*a;const s=Math.floor((i-n)/o),c=Math.floor(a*(i-s*o)/o);return[s,c]}const Od=(e,t,n,r,i,o)=>{const a=Math.min(e,i),s=o/2**a;return en(Math.max(0,Math.floor((t.domain()[0]-n)/s)),Math.min(2**a,Math.ceil((t.domain()[1]-n-1e-7)/s)))},F7=(e,t,n)=>jp(e)?e.max_width/2**t:e.resolutions.map(i=>+i).sort((i,o)=>o-i)[t]*n,Pd=(e,t,n,r,i)=>{const s=e*(i||256),c=20;r||(r=Number.MAX_VALUE);const l=Math.max(0,Math.floor((t.domain()[0]-n)/s)),u=Math.ceil(Math.min(r,t.domain()[1]-n-1e-7)/s);let f=en(l,u);return f.length>c&&(console.warn(`Too many visible tiles: ${f.length} truncating to ${c}`),f=f.slice(0,c)),f},q7=(e,t,n,r,i,o,a,s,c,l)=>{const{tileData:u}=e;if(!u.dense){o(null);return}if(e.mirrored&&!e.isMirrored&&e.tileData.tilePos.length>0&&e.tileData.tilePos[0]===e.tileData.tilePos[1]){e.tileData.dense=e.tileData.dense.slice();const h=Math.floor(Math.sqrt(e.tileData.dense.length));for(let p=0;p<h;p++)for(let d=p+1;d<h;d++)e.tileData.dense[p*h+d]=e.tileData.dense[d*h+p];if(s)for(let p=0;p<h;p++)for(let d=0;d<p;d++)e.tileData.dense[p*h+d]=Number.NaN;e.isMirrored=!0}const f=Qee(u.dense.length,u.dense,t,n,r,i,a,s,e.tileData.shape,c,l);o({pixData:f})};function U7(e,t,n,r){vf+=1,r.publish("requestSent",e);let i=null;if(n==="text")i=null;else if(n==="json")i="application/json";else throw new Error(`fetch either "text" or "json", not "${n}"`);const o={};return i&&(o["Content-Type"]=i),Js&&(o.Authorization=Js),fetch(e,{credentials:"same-origin",headers:o}).then(a=>{if(!a.ok)throw Error(a.statusText);return a[n]()}).then(a=>(t(void 0,a),a)).catch(a=>(console.error(`Could not fetch ${e}`,a),t(a,void 0),a)).finally(()=>{r.publish("requestReceived",e),vf-=1})}function ute(e,t,n){return U7(e,t,"text",n)}async function V7(e,t,n){return U7(e,t,"json",n)}const G7=(e,t,n,r,i)=>{const o=`${Fp(e)}/tileset_info/?d=${t}&s=${$7}`;i.publish("requestSent",o),V7(o,(a,s)=>{i.publish("requestReceived",o),a?r?r(`Error retrieving tilesetInfo from: ${e}`):console.warn("Error retrieving: ",o):n(s)},i)},wt={calculateResolution:z7,calculateTileAndPosInTile:H7,calculateTiles:Od,calculateTilesFromResolution:Pd,calculateTileWidth:F7,calculateZoomLevel:WT,calculateZoomLevelFromResolutions:GT,fetchTilesDebounced:B7,json:V7,text:ute,tileDataToPixData:q7,trackInfo:G7},fte=Object.freeze(Object.defineProperty({__proto__:null,ElementResizeListener:L7,get authHeader(){return Js},chromInfo:a0,createDomEvent:M4,getTileProxyAuthHeader:j7,get requestsInFlight(){return vf},setTileProxyAuthHeader:Cd,tileProxy:wt,tileResponseToData:VT},Symbol.toStringTag,{value:"Module"})),Ad={__fake__:!0,publish:()=>{},subscribe:()=>({event:"",handler:()=>{}}),unsubscribe:()=>{},clear:()=>{}};function yo(e,t,n=Ad){const r={};return r.absToChr=i=>r.chrPositions?dr(i,r):null,r.chrToAbs=([i,o]=[])=>r.chrPositions?Tu(i,o,r):null,wt.text(e,(i,o)=>{if(i)t&&t(null);else{const a=i0(o),s=_u(a);Object.keys(s).forEach(c=>{r[c]=s[c]}),t&&t(r)}},n).then(()=>r)}const YT={button:"_button_1wnjn_1","button-shortcut":"_button-shortcut_1wnjn_35"},Vo=x.forwardRef(({onClick:e=()=>{},styleName:t="",children:n,...r},i)=>x.createElement("button",{ref:i,className:YT[t]??YT.button,disabled:r.disable,onBlur:r.onBlur,onClick:e,onMouseDown:r.onMouseDown,onMouseOut:r.onMouseOut,onMouseUp:r.onMouseUp,type:"button"},n,r.shortcut&&x.createElement("span",{className:YT["button-shortcut"]},r.shortcut)));Vo.propTypes={children:q.any,disable:q.bool,onBlur:q.func,onClick:q.func,onMouseDown:q.func,onMouseOut:q.func,onMouseUp:q.func,shortcut:q.string,type:q.string,styleName:q.string};const hte={cross:"_cross_2ke8w_1"};function W7(){return x.createElement("div",{className:hte.cross})}const{Provider:pte,Consumer:dte}=x.createContext({close:Hp,open:Hp});function Md(e){return x.forwardRef((t,n)=>x.createElement(dte,null,r=>x.createElement(e,{ref:n,...t,modal:r})))}const el={"modal-background":"_modal-background_zzhoe_1","modal-hide":"_modal-hide_zzhoe_13","modal-wrap":"_modal-wrap_zzhoe_17","modal-window":"_modal-window_zzhoe_25","modal-window-max-height":"_modal-window-max-height_zzhoe_38","modal-content":"_modal-content_zzhoe_42"};function Y7({closeButton:e=!0,hide:t=!1,maxHeight:n=!1,modal:r,onClose:i,children:o}){const a=()=>{r.close(),i&&i()};return x.createElement("div",{className:$t(el["modal-background"],{[el["modal-hide"]]:t})},x.createElement("div",{className:el["modal-wrap"]},x.createElement("div",{className:$t(el["modal-window"],{[el["modal-window-max-height"]]:n})},e&&x.createElement(Vo,{onClick:a},x.createElement(W7,null)),x.createElement("div",{className:el["modal-content"]},o))))}Y7.propTypes={children:q.element.isRequired,closeButton:q.bool,hide:q.bool,maxHeight:q.bool,modal:q.object.isRequired,onClose:q.func};const gte=Md(Y7),XT={"dialog-header":"_dialog-header_wp50s_1","dialog-main-max-height":"_dialog-main-max-height_wp50s_20","dialog-footer":"_dialog-footer_wp50s_31","dialog-footer-max-height":"_dialog-footer-max-height_wp50s_31"};function X7({cancelTitle:e="Cancel",hide:t=!1,maxHeight:n=!1,okayOnly:r=!1,okayTitle:i="Ok",modal:o,onCancel:a,onOkay:s,title:c,cancelShortcut:l,okayShortcut:u,children:f}){const h=()=>{o.close(),a&&a()},p=()=>{o.close(),s&&s()};return x.createElement(gte,{closeButton:!1,hide:t,maxHeight:n},x.createElement(x.Fragment,null,x.createElement("header",{className:XT["dialog-header"]},x.createElement("h3",null,c),x.createElement(Vo,{onClick:h},x.createElement(W7,null))),n?x.createElement("main",{className:$t(n&&XT["dialog-main-max-height"])},f):x.createElement("main",null,f),x.createElement("footer",{className:XT[n?"dialog-footer-max-height":"dialog-footer"]},r?x.createElement("div",null):x.createElement(Vo,{onClick:h,shortcut:l},e),x.createElement(Vo,{onClick:p,shortcut:u},i))))}X7.propTypes={cancelShortcut:q.string,cancelTitle:q.string,children:q.object,hide:q.bool,maxHeight:q.bool,modal:q.object.isRequired,okayShortcut:q.string,okayTitle:q.string,okayOnly:q.bool,onCancel:q.func.isRequired,onOkay:q.func.isRequired,title:q.string.isRequired};const yf=Md(X7),mte={"export-link-dialog-wrapper":"_export-link-dialog-wrapper_p9gxw_1"};function vte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yte(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_te(r.key),r)}}function bte(e,t,n){return t&&yte(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _te(e){var t=Tte(e,"string");return typeof t=="symbol"?t:t+""}function Tte(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function wte(e,t,n){return t=Id(t),Ste(e,K7()?Reflect.construct(t,n||[],Id(e).constructor):t.apply(e,n))}function Ste(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ete(e)}function Ete(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K7(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(K7=function(){return!!e})()}function Id(e){return Id=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Id(e)}function kte(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&KT(e,t)}function KT(e,t){return KT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},KT(e,t)}let ZT=function(e){function t(){return vte(this,t),wte(this,t,arguments)}return kte(t,e),bte(t,[{key:"render",value:function(){return x.createElement(yf,{okayOnly:!0,okayTitle:"Done",onOkay:this.props.onDone,title:"Share view link"},x.createElement("div",{className:mte["export-link-dialog-wrapper"]},x.createElement("input",{ref:r=>{r&&(this.input=r,r.focus(),r.select())},onClick:r=>{r.target.select()},placeholder:"Generating the link...",readOnly:!0,value:this.props.url}),x.createElement(Vo,{onClick:r=>{this.input.select(),document.execCommand("copy")}},"Copy")))}}])}(x.Component);ZT.defaultProps={onDone:()=>{},url:""},ZT.propTypes={onDone:q.func,url:q.string};var xte=[].slice,Cte={};function QT(e){this._size=e,this._call=this._error=null,this._tasks=[],this._data=[],this._waiting=this._active=this._ended=this._start=0}QT.prototype=ew.prototype={constructor:QT,defer:function(e){if(typeof e!="function")throw new Error("invalid callback");if(this._call)throw new Error("defer after await");if(this._error!=null)return this;var t=xte.call(arguments,1);return t.push(e),++this._waiting,this._tasks.push(t),Z7(this),this},abort:function(){return this._error==null&&JT(this,new Error("abort")),this},await:function(e){if(typeof e!="function")throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=function(t,n){e.apply(null,[t].concat(n))},Rd(this),this},awaitAll:function(e){if(typeof e!="function")throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=e,Rd(this),this}};function Z7(e){if(!e._start)try{Ote(e)}catch(t){if(e._tasks[e._ended+e._active-1])JT(e,t);else if(!e._data)throw t}}function Ote(e){for(;e._start=e._waiting&&e._active<e._size;){var t=e._ended+e._active,n=e._tasks[t],r=n.length-1,i=n[r];n[r]=Pte(e,t),--e._waiting,++e._active,n=i.apply(null,n),e._tasks[t]&&(e._tasks[t]=n||Cte)}}function Pte(e,t){return function(n,r){e._tasks[t]&&(--e._active,++e._ended,e._tasks[t]=null,e._error==null&&(n!=null?JT(e,n):(e._data[t]=r,e._waiting?Z7(e):Rd(e))))}}function JT(e,t){var n=e._tasks.length,r;for(e._error=t,e._data=void 0,e._waiting=NaN;--n>=0;)if((r=e._tasks[n])&&(e._tasks[n]=null,r.abort))try{r.abort()}catch{}e._active=NaN,Rd(e)}function Rd(e){if(!e._active&&e._call){var t=e._data;e._data=void 0,e._call(e._error,t)}}function ew(e){if(e==null)e=1/0;else if(!((e=+e)>=1))throw new Error("invalid concurrency");return new QT(e)}const Ate=Object.freeze(Object.defineProperty({__proto__:null,queue:ew},Symbol.toStringTag,{value:"Module"}));function Dd(){return Dd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Dd.apply(null,arguments)}function Mte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ite(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Dte(r.key),r)}}function Rte(e,t,n){return t&&Ite(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dte(e){var t=Nte(e,"string");return typeof t=="symbol"?t:t+""}function Nte(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Lte(e,t,n){return t=Nd(t),$te(e,Q7()?Reflect.construct(t,n||[],Nd(e).constructor):t.apply(e,n))}function $te(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jte(e)}function jte(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Q7(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Q7=function(){return!!e})()}function Nd(e){return Nd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nd(e)}function Bte(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&tw(e,t)}function tw(e,t){return tw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},tw(e,t)}const bf=[];let rw=function(e){function t(n){var r;return Mte(this,t),r=Lte(this,t,[n]),r.state={highlightedIndex:null,menuTop:0,menuLeft:0,menuWidth:0,isOpen:!1},r.itemRefs={},r.menuRef=null,r.keyDownHandlers={ArrowDown(i){i.preventDefault();const o=this.getFilteredItems().length;if(!o)return;const{highlightedIndex:a}=this.state,s=a===null||a===o-1?0:a+1;this._performAutoCompleteOnKeyUp=!0,this.setState({highlightedIndex:s,isOpen:!0})},ArrowUp(i){i.preventDefault();const o=this.getFilteredItems().length;if(!o)return;const{highlightedIndex:a}=this.state,s=a===0||a===null?o-1:a-1;this._performAutoCompleteOnKeyUp=!0,this.setState({highlightedIndex:s,isOpen:!0})},Enter(i){if(this.state.isOpen!==!1)if(this.state.highlightedIndex===null)this.setState({isOpen:!1},()=>{this.inputEl.select()});else{i.preventDefault();const o=this.getFilteredItems()[this.state.highlightedIndex],a=this.props.getItemValue(o);this.setState({isOpen:!1,highlightedIndex:null},()=>{this.inputEl.setSelectionRange(a.length,a.length),this.props.onSelect(a,o)})}},Escape(){this.setState({highlightedIndex:null,isOpen:!1})}},r}return Bte(t,e),Rte(t,[{key:"getInitialState",value:function(){return{isOpen:!1,highlightedIndex:null}}},{key:"UNSAFE_componentWillMount",value:function(){this._ignoreBlur=!1,this._performAutoCompleteOnUpdate=!1,this._performAutoCompleteOnKeyUp=!1}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){this._performAutoCompleteOnUpdate=!0,(this.props.items!==r.items||this.state.highlightedIndex>=r.items.length)&&this.setState({highlightedIndex:null})}},{key:"componentDidUpdate",value:function(r,i){this.state.isOpen===!0&&i.isOpen===!1&&this.setMenuPositions(),this.state.isOpen&&this._performAutoCompleteOnUpdate&&(this._performAutoCompleteOnUpdate=!1,this.maybeAutoCompleteText()),this.maybeScrollItemIntoView(),i.isOpen!==this.state.isOpen&&this.props.onMenuVisibilityChange(this.state.isOpen,this.inputEl)}},{key:"maybeScrollItemIntoView",value:function(){this.state.isOpen===!0&&this.state.highlightedIndex!==null&&this.itemRefs[this.state.highlightedIndex]?.scrollIntoView({block:"nearest",behavior:"smooth"})}},{key:"handleKeyDown",value:function(r){this.keyDownHandlers[r.key]?this.keyDownHandlers[r.key].call(this,r):this.setState({highlightedIndex:null,isOpen:!0})}},{key:"handleChange",value:function(r){this._performAutoCompleteOnKeyUp=!0,this.props.onChange(r,r.target.value)}},{key:"handleKeyUp",value:function(){this._performAutoCompleteOnKeyUp&&(this._performAutoCompleteOnKeyUp=!1,this.maybeAutoCompleteText())}},{key:"getFilteredItems",value:function(){let r=this.props.items;return this.props.shouldItemRender&&(r=r.filter(i=>this.props.shouldItemRender(i,this.props.value))),this.props.sortItems&&r.sort((i,o)=>this.props.sortItems(i,o,this.props.value)),r}},{key:"maybeAutoCompleteText",value:function(){if(!this.props.autoHighlight||this.props.value==="")return;const{highlightedIndex:r}=this.state,i=this.getFilteredItems();if(i.length===0)return;const o=r!==null?i[r]:i[0];this.props.getItemValue(o).toLowerCase().indexOf(this.props.value.toLowerCase())===0&&r===null&&this.setState({highlightedIndex:0})}},{key:"setMenuPositions",value:function(){const r=this.inputEl,i=r.getBoundingClientRect(),o=globalThis.window.getComputedStyle(r),a=Number.parseInt(o.marginBottom,10)||0,s=Number.parseInt(o.marginLeft,10)||0,c=Number.parseInt(o.marginRight,10)||0;this.setState({menuTop:i.bottom+a,menuLeft:i.left+s,menuWidth:i.width+s+c})}},{key:"highlightItemFromMouse",value:function(r){this.setState({highlightedIndex:r})}},{key:"selectItemFromMouse",value:function(r){const i=this.props.getItemValue(r);this.setState({isOpen:!1,highlightedIndex:null},()=>{this.props.onSelect(i,r),this.inputEl.focus()})}},{key:"setIgnoreBlur",value:function(r){this._ignoreBlur=r}},{key:"renderMenu",value:function(){const r=this.getFilteredItems().map((a,s)=>{const c=this.props.renderItem(a,this.state.highlightedIndex===s,{cursor:"default"});return x.cloneElement(c,{onMouseDown:()=>this.setIgnoreBlur(!0),onMouseEnter:()=>this.highlightItemFromMouse(s),onClick:()=>this.selectItemFromMouse(a),ref:l=>{this.itemRefs[s]=l}})}),i={left:this.state.menuLeft,top:this.state.menuTop,minWidth:this.state.menuWidth};if(!r.length)return null;const o=this.props.renderMenu(r,this.props.value,i);return x.cloneElement(o,{ref:a=>{this.menuRef=a}})}},{key:"handleInputBlur",value:function(){this.props.onFocus&&this.props.onFocus(),!this._ignoreBlur&&this.setState({isOpen:!1,highlightedIndex:null})}},{key:"handleInputFocus",value:function(){if(this.props.onFocus&&this.props.onFocus(!0),this._ignoreBlur){this.setIgnoreBlur(!1);return}this._ignoreClick=!0,this.setState({isOpen:!0})}},{key:"isInputFocused",value:function(){return this.inputEl.ownerDocument&&this.inputEl===this.inputEl.ownerDocument.activeElement}},{key:"handleInputClick",value:function(){this.isInputFocused()&&this.state.isOpen===!1?this.setState({isOpen:!0}):this.state.highlightedIndex!==null&&!this._ignoreClick&&this.selectItemFromMouse(this.getFilteredItems()[this.state.highlightedIndex]),this._ignoreClick=!1}},{key:"composeEventHandlers",value:function(r,i){return i?o=>{r(o),i(o)}:r}},{key:"render",value:function(){this.props.debug&&bf.push({id:bf.length,state:this.state});const{inputProps:r}=this.props;return x.createElement("div",Dd({style:{...this.props.wrapperStyle}},this.props.wrapperProps),x.createElement("input",Dd({},r,{ref:i=>{this.inputEl=i},"aria-autocomplete":"list",autoComplete:"off",onBlur:this.composeEventHandlers(this.handleInputBlur.bind(this),r.onBlur?.bind(this)),onChange:this.handleChange.bind(this),onClick:this.composeEventHandlers(this.handleInputClick.bind(this),r.onClick?.bind(this)),onFocus:this.composeEventHandlers(this.handleInputFocus.bind(this),r.onFocus?.bind(this)),onKeyDown:this.composeEventHandlers(this.handleKeyDown.bind(this),r.onKeyDown?.bind(this)),onKeyUp:this.composeEventHandlers(this.handleKeyUp.bind(this),r.onKeyUp?.bind(this)),role:"combobox",value:this.props.value})),("open"in this.props?this.props.open:this.state.isOpen)&&this.renderMenu(),this.props.debug&&x.createElement("pre",{style:{marginLeft:300}},JSON.stringify(bf.slice(bf.length-5,bf.length),null,2)))}}])}(x.Component);rw.defaultProps={value:"",wrapperProps:{},wrapperStyle:{display:"inline-block"},inputProps:{},onChange(){},onSelect(){},renderMenu(e,t,n){return x.createElement("div",{style:{...n,...this.menuStyle}},e)},shouldItemRender(){return!0},menuStyle:{borderRadius:"3px",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.1)",background:"rgba(255, 255, 255, 0.9)",padding:"2px 0",fontSize:"90%",position:"fixed",overflow:"auto",maxHeight:"50%"},autoHighlight:!0,onMenuVisibilityChange(){}},rw.propTypes={autoHighlight:q.bool,debug:q.bool,getItemValue:q.func.isRequired,inputProps:q.object,items:q.array,menuStyle:q.object,onChange:q.func,onFocus:q.func,onMenuVisibilityChange:q.func,onSelect:q.func,open:q.bool,renderItem:q.func.isRequired,renderMenu:q.func,shouldItemRender:q.func,sortItems:q.func,value:q.any,wrapperProps:q.object,wrapperStyle:q.object};function zte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hte(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,qte(r.key),r)}}function Fte(e,t,n){return t&&Hte(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function qte(e){var t=Ute(e,"string");return typeof t=="symbol"?t:t+""}function Ute(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Vte(e,t,n){return t=Ld(t),Gte(e,J7()?Reflect.construct(t,n||[],Ld(e).constructor):t.apply(e,n))}function Gte(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wte(e)}function Wte(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function J7(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(J7=function(){return!!e})()}function Ld(e){return Ld=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ld(e)}function Yte(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&nw(e,t)}function nw(e,t){return nw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},nw(e,t)}let Go=function(e){function t(n){var r;return zte(this,t),r=Vte(this,t,[n]),r.popup=null,r.clickHandlerBound=r.clickHandler.bind(r),r.contextMenuHandlerBound=r.contextMenuHandler.bind(r),r.resizeHandlerBound=r.resizeHandler.bind(r),r}return Yte(t,e),Fte(t,[{key:"componentDidMount",value:function(){this.popup=document.createElement("div"),document.body.appendChild(this.popup),this.popup.style.zIndex=99,this.popup.style.position="absolute",this.popup.className="hg-popup",document.addEventListener("click",this.clickHandlerBound,!0),document.addEventListener("contextmenu",this.contextMenuHandlerBound,!0),window.addEventListener("resize",this.resizeHandlerBound,!0),this.forceUpdate()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("click",this.clickHandlerBound,!0),document.removeEventListener("contextmenu",this.contextMenuHandlerBound,!0),window.removeEventListener("resize",this.resizeHandlerBound,!0),document.body.removeChild(this.popup)}},{key:"clickHandler",value:function(r){this.popup.contains(r.target)||this.props.onMenuClosed&&this.props.onMenuClosed(r)}},{key:"contextMenuHandler",value:function(r){r.altKey||(r.preventDefault(),this.clickHandler(r))}},{key:"resizeHandler",value:function(){this.props.onMenuClosed(null)}},{key:"render",value:function(){return this.popup?bn.createPortal(this.props.children,this.popup):null}}])}(x.Component);Go.defaultProps={onMenuClosed:aA},Go.propTypes={children:q.node.isRequired,onMenuClosed:q.func};function Xte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kte(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Qte(r.key),r)}}function Zte(e,t,n){return t&&Kte(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Qte(e){var t=Jte(e,"string");return typeof t=="symbol"?t:t+""}function Jte(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}let iw=function(){function e(t){Xte(this,e),this.chromInfo=t,this.chromInfoBisector=fs(n=>n.pos).left}return Zte(e,[{key:"scalesToPositionText",value:function(n,r,i=!1){if(this.chromInfo===null||!n||!r)return"";const o=dr(n.domain()[0],this.chromInfo),a=dr(n.domain()[1],this.chromInfo),s=dr(r.domain()[0],this.chromInfo),c=dr(r.domain()[1],this.chromInfo);let l=null;const u=Fr(",d");return o[0]!==a[0]?l=`${o[0]}:${u(Math.floor(o[1]))}-${a[0]}:${u(Math.ceil(a[1]))}`:l=`${o[0]}:${u(Math.floor(o[1]))}-${u(Math.ceil(a[1]))}`,i&&(s[0]!==c[0]?l+=` & ${s[0]}:${u(Math.floor(s[1]))}-${c[0]}:${u(Math.ceil(c[1]))}`:l+=` & ${s[0]}:${u(Math.floor(s[1]))}-${u(Math.ceil(c[1]))}`),(o[2]<=0||a[2]>0||i&&(s[2]<=0||c[2]>0))&&(l+=` [offset ${o[2]},${a[2]}`,i&&(l+=`:${s[2]},${c[2]}`),l+="]"),l}},{key:"convertNumberNotation",value:function(n){let r=n;if(!r.includes("M",r.length-1)&&!r.includes("K",r.length-1))return r;let i=0,o=0;if(r.includes("M",r.length-1)?(i=6,r=r.replace("M","")):(i=3,r=r.replace("K","")),Number.isNaN(+r))return n;r=(+r).toString(),r.includes(".")&&(o=r.length-1-r.indexOf("."),r=(+r.replace(".","")).toString());const a=i-o;return a<0?n:(r+="0".repeat(a),r)}},{key:"parsePosition",value:function(n,r=null){const i=n.split(":");let o=null,a=0;i.length>1?(o=i[0],a=+this.convertNumberNotation(i[1].replace(/,/g,""))):i[0]in this.chromInfo.chrPositions?(o=i[0],a=0,r!==null&&(a=+this.chromInfo.chromLengths[o])):(a=+this.convertNumberNotation(i[0].replace(/,/g,"")),o=null,r&&(o=r));let s=null;return o===null?(o=r,s=a):o in this.chromInfo.chrPositions&&(s=this.chromInfo.chrPositions[o].pos+a),[o,a,s]}},{key:"matchRangesToLarger",value:function(n,r){if(n[1]-n[0]<r[1]-r[0]){const o=r[1]-r[0]-(n[1]-n[0]);return[[n[0]-o/2,n[1]+o/2],r]}const i=n[1]-n[0]-(r[1]-r[0]);return[n,[r[0]-i/2,r[1]+i/2]]}},{key:"getSearchRange",value:function(n){if(n.length===0)return null;let r=n.split("-");r=r.filter(o=>o.length>0);let i=null;if(r[0].indexOf("-")===0&&(r[0]=r[0].slice(3,r[0].length)),r.length>1){let[o,a,s]=this.parsePosition(r[0]),[c,l,u]=this.parsePosition(r[1],o);const f=[s,u];[o,a,s]=this.parsePosition(r[1]),[c,l,u]=this.parsePosition(r[0],o),o===null&&c!==null&&([o,a,s]=this.parsePosition(r[1],c));const h=[s,u];return h[1]-h[0]>f[1]-f[0]?h:f}if(r[0]in this.chromInfo.chrPositions){const o=+this.chromInfo.chrPositions[r[0]].pos;i=[o,o+ +this.chromInfo.chromLengths[r[0]]]}else{const[o,a,s]=this.parsePosition(r[0]);i=[s-8e6,s+8e6]}return i[0]>i[1]?[i[1],i[0]]:i}},{key:"parseOffset",value:function(n){const r=n.split(":");if(r.length===0)return[[0,0],[0,0]];if(r.length===1){const a=r[0].split(",");return[[+a[0],+a[1]],[0,0]]}const i=r[0].split(","),o=r[1].split(",");return[[+i[0],+i[1]],[+o[0],+o[1]]]}},{key:"searchPosition",value:function(n){let r=null,i=null;n=n.trim();const o=/\[offset (.+?)\]/.exec(n);let a=[[0,0],[0,0]];o&&(n=n.replace(o[0],""),a=this.parseOffset(o[1]));const s=n.split(" & ");return s.length>1?(r=this.getSearchRange(s[0].split(" ")[0]),i=this.getSearchRange(s[1].split(" ")[0])):r=this.getSearchRange(s[0]),r!==null&&i!==null&&([r,i]=this.matchRangesToLarger(r,i)),r&&(r[0]+=a[0][0],r[1]+=a[0][1]),i&&(i[0]+=a[1][0],i[1]+=a[1][1]),[r,i]}}])}();const{Provider:ere,Consumer:tre}=x.createContext(Ad);function tl(e){return x.forwardRef((t,n)=>x.createElement(tre,null,r=>x.createElement(e,{ref:n,...t,pubSub:r})))}const _f={"genome-position-search":"_genome-position-search_1l2sx_1","genome-position-search-focus":"_genome-position-search-focus_1l2sx_2","genome-position-search-bar":"_genome-position-search-bar_1l2sx_16","genome-position-search-dark":"_genome-position-search-dark_1l2sx_34","genome-position-search-bar-suggestions":"_genome-position-search-bar-suggestions_1l2sx_83"};function rre(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nre(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ore(r.key),r)}}function ire(e,t,n){return t&&nre(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ore(e){var t=are(e,"string");return typeof t=="symbol"?t:t+""}function are(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function sre(e,t,n){return t=$d(t),lre(e,eR()?Reflect.construct(t,n||[],$d(e).constructor):t.apply(e,n))}function lre(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cre(e)}function cre(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(eR=function(){return!!e})()}function $d(e){return $d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$d(e)}function ure(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ow(e,t)}function ow(e,t){return ow=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ow(e,t)}let tR=function(e){function t(n){var r;return rre(this,t),r=sre(this,t,[n]),r.mounted=!1,r.uid=Mt.nice(),r.chromInfo=null,r.searchField=null,r.autocompleteMenu=null,r.xScale=null,r.yScale=null,r.prevParts=[],r.props.registerViewportChangedListener(r.scalesChanged.bind(r)),r.menuPosition={left:0,top:0},r.currentChromInfoServer=r.props.chromInfoServer,r.currentChromInfoId=r.props.chromInfoId,r.positionText=n.error,r.state={value:r.positionText,loading:!1,menuPosition:[0,0],genes:[],isFocused:!1,menuOpened:!1,availableAssemblies:[],selectedAssembly:null},r.styles={item:{padding:"2px 6px",cursor:"default"},highlightedItem:{color:"white",background:"hsl(200, 50%, 50%)",padding:"2px 6px",cursor:"default"},menu:{border:"solid 1px #ccc"}},r}return ure(t,e),ire(t,[{key:"componentDidMount",value:function(){this.mounted=!0,_t(this.autocompleteMenu.inputEl).on("keypress",this.autocompleteKeyPress.bind(this)),this.fetchChromInfo(this.props.chromInfoServer,this.props.chromInfoId),this.setPositionText()}},{key:"componentWillUnmount",value:function(){this.mounted=!1,this.props.removeViewportChangedListener()}},{key:"fetchChromInfo",value:function(r,i){if(!i){this.positionText="no chromosome track present",this.setState({value:this.positionText});return}this.mounted&&(this.setState({autocompleteServer:r}),yo(`${r}/chrom-sizes/?id=${i}`,o=>{this.chromInfo=o,this.searchField=new iw(this.chromInfo),this.setPositionText()}))}},{key:"scalesChanged",value:function(r,i){this.xScale=r,this.yScale=i,this.setPositionText()}},{key:"setPositionText",value:function(){if(!this.mounted||!this.searchField)return;const r=this.searchField.scalesToPositionText(this.xScale,this.yScale,this.props.twoD);this.prevParts=r.split(/[ -]/),this.gpsbForm&&(this.positionText=r,this.autocompleteMenu.inputEl.value=r)}},{key:"autocompleteKeyPress",value:function(r){r.keyCode===13&&this.buttonClick()}},{key:"replaceGenesWithLoadedPositions",value:function(r){const i=this.positionText,o=i.split(" ");let a=!1;for(let c=0;c<o.length;c++){const l=o[c].split("-");let u=0,f=0,h="";for(;u<l.length;){for(f=l.length;f>u;){const p=l.slice(u,f).join("-");if(r[p.toLowerCase()]){const d=r[p.toLowerCase()],g=Math.floor((d.txEnd-d.txStart)/4);u===0&&f<l.length?h=`${d.chr}:${d.txStart-g}`:u===0&&f===l.length?h=`${d.chr}:${d.txStart-g}-${d.txEnd+g}`:h+=`- ${d.chr}:${d.txEnd+g}`,a=!0;break}f===u+1&&(h.length&&(h+="-"),h+=p),f-=1}u=f+1}o[c]=h}const s=o.join(" ");return this.prevParts=s.split(/[ -]/),this.positionText=s,this.setState({value:s}),a?i:null}},{key:"replaceGenesWithPositions",value:function(r){const i=this.positionText.split(/[ -]/);let o=ew();for(let a=0;a<i.length;a++){if(i[a].length===0)continue;const[,,s]=this.searchField.parsePosition(i[a]);if(s==null||Number.isNaN(s)){const c=`${this.props.autocompleteServer}/suggest/?d=${this.props.autocompleteId}&ac=${i[a].toLowerCase()}`,l=u=>{wt.json(c,u,this.props.pubSub)};o=o.defer(l)}}o.awaitAll((a,s)=>{if(s){const c={};for(let l=0;l<s.length;l++)if(s[l][0])for(let u=0;u<s[l].length;u++)c[s[l][u].geneName.toLowerCase()]=s[l][u];this.replaceGenesWithLoadedPositions(c),r()}})}},{key:"buttonClick",value:function(){this.setState({genes:[]}),this.replaceGenesWithPositions(()=>{const r=this.positionText;if(this.searchField!=null){let[i,o]=this.searchField.searchPosition(r);if(i&&(Number.isNaN(i[0])||Number.isNaN(i[1]))||o&&(Number.isNaN(o[0])||Number.isNaN(o[1])))return;o||(o=i);const a=this.xScale.copy(),s=this.yScale.copy();i&&(a.domain(i),s.domain(i));const[c,l,u]=kr(a,s);this.props.setCenters(c,l,u,z4)}})}},{key:"searchFieldSubmit",value:function(){this.buttonClick()}},{key:"pathJoin",value:function(r,i){const o=i||"/",a=new RegExp(`${o}{1,}`,"g");return r.join(o).replace(a,o)}},{key:"onAutocompleteChange",value:function(r,i){this.positionText=i,this.setState({value:i,loading:!0});const o=i.split(/[ -]/);this.changedPart=null;for(let a=0;a<o.length;a++){if(a===this.prevParts.length){this.changedPart=a;break}if(o[a]!==this.prevParts[a]){this.changedPart=a;break}}if(this.prevParts=o,!!(this.props.autocompleteServer&&this.props.autocompleteId)&&this.changedPart!=null){this.setState({loading:!0});const a=`${this.props.autocompleteServer}/suggest/?d=${this.props.autocompleteId}&ac=${o[this.changedPart].toLowerCase()}`;wt.json(a,(s,c)=>{if(s){this.setState({loading:!1,genes:[]});return}this.setState({loading:!1,genes:c})},this.props.pubSub)}}},{key:"geneSelected",value:function(r,i){const o=this.positionText.split(" ");let a=this.changedPart;for(let s=0;s<o.length;s++){const c=o[s].split("-");if(a>c.length-1)a-=c.length;else{c[a]=i.geneName,o[s]=c.join("-");break}}this.prevParts=o.join(" ").split(/[ -]/),this.positionText=o.join(" "),this.setState({value:o.join(" "),genes:[]})}},{key:"handleMenuVisibilityChange",value:function(r,i){const o=i.getBoundingClientRect();this.menuPosition={left:o.left,top:o.top+o.height},this.setState({menuOpened:r})}},{key:"handleRenderMenu",value:function(r){return x.createElement(Go,null,x.createElement("div",{style:{left:this.menuPosition.left,top:this.menuPosition.top},className:_f["genome-position-search-bar-suggestions"]},r))}},{key:"handleAssemblySelect",value:function(r){this.fetchChromInfo(r),this.setState({selectedAssembly:r})}},{key:"focusHandler",value:function(r){this.setState({isFocused:r})}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){(r.chromInfoId!==this.currentChromInfoId||r.chromInfoServer!==this.currentChromInfoServer)&&(this.currentChromInfoId=r.chromInfoId,this.currentChromInfoServer=r.chromInfoServer,this.fetchChromInfo(r.chromInfoServer,r.chromInfoId))}},{key:"render",value:function(){return x.createElement("div",{ref:r=>{this.gpsbForm=r},className:$t({[_f["genome-position-search-focus"]]:this.state.isFocused,[_f["genome-position-search"]]:!this.state.isFocused,[_f["genome-position-search-dark"]]:this.props.theme===Qt})},x.createElement(rw,{ref:r=>{this.autocompleteMenu=r},getItemValue:r=>r.geneName,inputProps:{className:_f["genome-position-search-bar"]},items:this.state.genes,menuStyle:{position:"absolute",left:this.menuPosition.left,top:this.menuPosition.top,border:"1px solid black"},onChange:this.onAutocompleteChange.bind(this),onFocus:this.focusHandler.bind(this),onMenuVisibilityChange:this.handleMenuVisibilityChange.bind(this),onSelect:(r,i)=>this.geneSelected(r,i),onSubmit:this.searchFieldSubmit.bind(this),renderItem:(r,i)=>x.createElement("div",{key:r.geneName,id:r.geneName,style:i?this.styles.highlightedItem:this.styles.item},r.geneName),renderMenu:this.handleRenderMenu.bind(this),value:this.props.error||this.positionText,wrapperStyle:{width:"100%"}}),x.createElement(K4,{onClick:this.buttonClick.bind(this),theStyle:"multitrack-header-icon"}))}}])}(x.Component);tR.propTypes={autocompleteId:q.string,autocompleteServer:q.string,chromInfoId:q.string,chromInfoServer:q.string,isFocused:q.bool,onFocus:q.func,onSelectedAssemblyChanged:q.func,registerViewportChangedListener:q.func,removeViewportChangedListener:q.func,setCenters:q.func,theme:q.string,trackSourceServers:q.array,twoD:q.bool};const fre=tl(tR);var rl=0,Tf=0,wf=0,rR=1e3,jd,Sf,Bd=0,Va=0,zd=0,Ef=typeof performance=="object"&&performance.now?performance:Date,nR=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function aw(){return Va||(nR(hre),Va=Ef.now()+zd)}function hre(){Va=0}function Hd(){this._call=this._time=this._next=null}Hd.prototype=iR.prototype={constructor:Hd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?aw():+n)+(t==null?0:+t),!this._next&&Sf!==this&&(Sf?Sf._next=this:jd=this,Sf=this),this._call=e,this._time=n,sw()},stop:function(){this._call&&(this._call=null,this._time=1/0,sw())}};function iR(e,t,n){var r=new Hd;return r.restart(e,t,n),r}function pre(){aw(),++rl;for(var e=jd,t;e;)(t=Va-e._time)>=0&&e._call.call(null,t),e=e._next;--rl}function oR(){Va=(Bd=Ef.now())+zd,rl=Tf=0;try{pre()}finally{rl=0,gre(),Va=0}}function dre(){var e=Ef.now(),t=e-Bd;t>rR&&(zd-=t,Bd=e)}function gre(){for(var e,t=jd,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:jd=n);Sf=e,sw(r)}function sw(e){if(!rl){Tf&&(Tf=clearTimeout(Tf));var t=e-Va;t>24?(e<1/0&&(Tf=setTimeout(oR,e-Ef.now()-zd)),wf&&(wf=clearInterval(wf))):(wf||(Bd=Ef.now(),wf=setInterval(dre,rR)),rl=1,nR(oR))}}function aR(e,t,n){var r=new Hd;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var mre=Ks("start","end","cancel","interrupt"),vre=[],sR=0,lR=1,lw=2,Fd=3,cR=4,cw=5,qd=6;function Ud(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;yre(e,n,{name:t,index:r,group:i,on:mre,tween:vre,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:sR})}function uw(e,t){var n=di(e,t);if(n.state>sR)throw new Error("too late; already scheduled");return n}function ji(e,t){var n=di(e,t);if(n.state>Fd)throw new Error("too late; already running");return n}function di(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function yre(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=iR(o,0,n.time);function o(l){n.state=lR,n.timer.restart(a,n.delay,n.time),n.delay<=l&&a(l-n.delay)}function a(l){var u,f,h,p;if(n.state!==lR)return c();for(u in r)if(p=r[u],p.name===n.name){if(p.state===Fd)return aR(a);p.state===cR?(p.state=qd,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[u]):+u<t&&(p.state=qd,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[u])}if(aR(function(){n.state===Fd&&(n.state=cR,n.timer.restart(s,n.delay,n.time),s(l))}),n.state=lw,n.on.call("start",e,e.__data__,n.index,n.group),n.state===lw){for(n.state=Fd,i=new Array(h=n.tween.length),u=0,f=-1;u<h;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=p);i.length=f+1}}function s(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=cw,1),f=-1,h=i.length;++f<h;)i[f].call(e,u);n.state===cw&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=qd,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function fw(e,t){var n=e.__transition,r,i,o=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){o=!1;continue}i=r.state>lw&&r.state<cw,r.state=qd,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}o&&delete e.__transition}}function bre(e){return this.each(function(){fw(this,e)})}function _re(e,t){var n,r;return function(){var i=ji(this,e),o=i.tween;if(o!==n){r=n=o;for(var a=0,s=r.length;a<s;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function Tre(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=ji(this,e),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}o.tween=i}}function wre(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=di(this.node(),n).tween,i=0,o=r.length,a;i<o;++i)if((a=r[i]).name===e)return a.value;return null}return this.each((t==null?_re:Tre)(n,e,t))}function hw(e,t,n){var r=e._id;return e.each(function(){var i=ji(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return di(i,r).value[t]}}function uR(e,t){var n;return(typeof t=="number"?Vn:t instanceof Tn?bs:(n=Tn(t))?(t=n,bs):Qm)(e,t)}function Sre(e){return function(){this.removeAttribute(e)}}function Ere(e){return function(){this.removeAttributeNS(e.space,e.local)}}function kre(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=t(r=a,n)}}function xre(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=t(r=a,n)}}function Cre(e,t,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s)))}}function Ore(e,t,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s)))}}function Pre(e,t){var n=ya(e),r=n==="transform"?aO:uR;return this.attrTween(e,typeof t=="function"?(n.local?Ore:Cre)(n,r,hw(this,"attr."+e,t)):t==null?(n.local?Ere:Sre)(n):(n.local?xre:kre)(n,r,t))}function Are(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Mre(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ire(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Mre(e,o)),n}return i._value=t,i}function Rre(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Are(e,o)),n}return i._value=t,i}function Dre(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=ya(e);return this.tween(n,(r.local?Ire:Rre)(r,t))}function Nre(e,t){return function(){uw(this,e).delay=+t.apply(this,arguments)}}function Lre(e,t){return t=+t,function(){uw(this,e).delay=t}}function $re(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Nre:Lre)(t,e)):di(this.node(),t).delay}function jre(e,t){return function(){ji(this,e).duration=+t.apply(this,arguments)}}function Bre(e,t){return t=+t,function(){ji(this,e).duration=t}}function zre(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jre:Bre)(t,e)):di(this.node(),t).duration}function Hre(e,t){if(typeof t!="function")throw new Error;return function(){ji(this,e).ease=t}}function Fre(e){var t=this._id;return arguments.length?this.each(Hre(t,e)):di(this.node(),t).ease}function qre(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ji(this,e).ease=n}}function Ure(e){if(typeof e!="function")throw new Error;return this.each(qre(this._id,e))}function Vre(e){typeof e!="function"&&(e=ap(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],c,l=0;l<a;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&s.push(c);return new bo(r,this._parents,this._name,this._id)}function Gre(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var c=t[s],l=n[s],u=c.length,f=a[s]=new Array(u),h,p=0;p<u;++p)(h=c[p]||l[p])&&(f[p]=h);for(;s<r;++s)a[s]=t[s];return new bo(a,this._parents,this._name,this._id)}function Wre(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Yre(e,t,n){var r,i,o=Wre(t)?uw:ji;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function Xre(e,t){var n=this._id;return arguments.length<2?di(this.node(),n).on.on(e):this.each(Yre(n,e,t))}function Kre(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Zre(){return this.on("end.remove",Kre(this._id))}function Qre(e){var t=this._name,n=this._id;typeof e!="function"&&(e=lu(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s=r[a],c=s.length,l=o[a]=new Array(c),u,f,h=0;h<c;++h)(u=s[h])&&(f=e.call(u,u.__data__,h,s))&&("__data__"in u&&(f.__data__=u.__data__),l[h]=f,Ud(l[h],t,n,h,l,di(u,n)));return new bo(o,this._parents,t,n)}function Jre(e){var t=this._name,n=this._id;typeof e!="function"&&(e=op(e));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var h=e.call(u,u.__data__,f,c),p,d=di(u,n),g=0,y=h.length;g<y;++g)(p=h[g])&&Ud(p,t,n,g,h,d);o.push(h),a.push(u)}return new bo(o,a,t,n)}var ene=li.prototype.constructor;function tne(){return new ene(this._groups,this._parents)}function rne(e,t){var n,r,i;return function(){var o=Wn(this,e),a=(this.style.removeProperty(e),Wn(this,e));return o===a?null:o===n&&a===r?i:i=t(n=o,r=a)}}function fR(e){return function(){this.style.removeProperty(e)}}function nne(e,t,n){var r,i=n+"",o;return function(){var a=Wn(this,e);return a===i?null:a===r?o:o=t(r=a,n)}}function ine(e,t,n){var r,i,o;return function(){var a=Wn(this,e),s=n(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),Wn(this,e))),a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s))}}function one(e,t){var n,r,i,o="style."+t,a="end."+o,s;return function(){var c=ji(this,e),l=c.on,u=c.value[o]==null?s||(s=fR(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(a,i=u),c.on=r}}function ane(e,t,n){var r=(e+="")=="transform"?oO:uR;return t==null?this.styleTween(e,rne(e,r)).on("end.style."+e,fR(e)):typeof t=="function"?this.styleTween(e,ine(e,r,hw(this,"style."+e,t))).each(one(this._id,e)):this.styleTween(e,nne(e,r,t),n).on("end.style."+e,null)}function sne(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function lne(e,t,n){var r,i;function o(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&sne(e,a,n)),r}return o._value=t,o}function cne(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,lne(e,t,n??""))}function une(e){return function(){this.textContent=e}}function fne(e){return function(){var t=e(this);this.textContent=t??""}}function hne(e){return this.tween("text",typeof e=="function"?fne(hw(this,"text",e)):une(e==null?"":e+""))}function pne(e){return function(t){this.textContent=e.call(this,t)}}function dne(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&pne(i)),t}return r._value=e,r}function gne(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,dne(e))}function mne(){for(var e=this._name,t=this._id,n=hR(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,l=0;l<s;++l)if(c=a[l]){var u=di(c,t);Ud(c,e,n,l,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new bo(r,this._parents,e,n)}function vne(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},c={value:function(){--i===0&&o()}};n.each(function(){var l=ji(this,r),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),l.on=t}),i===0&&o()})}var yne=0;function bo(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function hR(){return++yne}var Ga=li.prototype;bo.prototype={constructor:bo,select:Qre,selectAll:Jre,filter:Vre,merge:Gre,selection:tne,transition:mne,call:Ga.call,nodes:Ga.nodes,node:Ga.node,size:Ga.size,empty:Ga.empty,each:Ga.each,on:Xre,attr:Pre,attrTween:Dre,style:ane,styleTween:cne,text:hne,textTween:gne,remove:Zre,tween:wre,delay:$re,duration:zre,ease:Fre,easeVarying:Ure,end:vne,[Symbol.iterator]:Ga[Symbol.iterator]};function bne(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var _ne={time:null,delay:0,duration:250,ease:bne};function Tne(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function wne(e){var t,n;e instanceof bo?(t=e._id,e=e._name):(t=hR(),(n=_ne).time=aw(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,l=0;l<s;++l)(c=a[l])&&Ud(c,e,t,l,a,n||Tne(c,t));return new bo(r,this._parents,e,t)}li.prototype.interrupt=bre,li.prototype.transition=wne;const pw=e=>()=>e;function Sne(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Ene(e){e.stopImmediatePropagation()}function dw(e){e.preventDefault(),e.stopImmediatePropagation()}var pR={name:"drag"},gw={name:"space"},nl={name:"handle"},il={name:"center"};const{abs:dR,max:Kr,min:Zr}=Math;function gR(e){return[+e[0],+e[1]]}function mw(e){return[gR(e[0]),gR(e[1])]}var Vd={name:"x",handles:["w","e"].map(kf),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},Gd={name:"y",handles:["n","s"].map(kf),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},kne={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(kf),input:function(e){return e==null?null:mw(e)},output:function(e){return e}},_o={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},mR={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},vR={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},xne={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Cne={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function kf(e){return{type:e}}function One(e){return!e.ctrlKey&&!e.button}function Pne(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function Ane(){return navigator.maxTouchPoints||"ontouchstart"in this}function vw(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function Mne(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function Ine(e){var t=e.__brush;return t?t.dim.output(t.selection):null}function ol(){return yw(Vd)}function al(){return yw(Gd)}function Wd(){return yw(kne)}function yw(e){var t=Pne,n=One,r=Ane,i=!0,o=Ks("start","brush","end"),a=6,s;function c(y){var b=y.property("__brush",g).selectAll(".overlay").data([kf("overlay")]);b.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",_o.overlay).merge(b).each(function(){var v=vw(this).extent;_t(this).attr("x",v[0][0]).attr("y",v[0][1]).attr("width",v[1][0]-v[0][0]).attr("height",v[1][1]-v[0][1])}),y.selectAll(".selection").data([kf("selection")]).enter().append("rect").attr("class","selection").attr("cursor",_o.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var m=y.selectAll(".handle").data(e.handles,function(v){return v.type});m.exit().remove(),m.enter().append("rect").attr("class",function(v){return"handle handle--"+v.type}).attr("cursor",function(v){return _o[v.type]}),y.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(r).on("touchstart.brush",h).on("touchmove.brush",p).on("touchend.brush touchcancel.brush",d).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(y,b){y.tween?y.on("start.brush",function(m){u(this,arguments).beforestart().start(m)}).on("interrupt.brush end.brush",function(m){u(this,arguments).end(m)}).tween("brush",function(){var m=this,v=m.__brush,_=u(m,arguments),T=v.selection,w=e.input(typeof b=="function"?b.apply(this,arguments):b,v.extent),S=pa(T,w);function k(E){v.selection=E===1&&w===null?null:S(E),l.call(m),_.brush()}return T!==null&&w!==null?k:k(1)}):y.each(function(){var m=this,v=arguments,_=m.__brush,T=e.input(typeof b=="function"?b.apply(m,v):b,_.extent),w=u(m,v).beforestart();fw(m),_.selection=T===null?null:T,l.call(m),w.start().brush().end()})},c.clear=function(y){c.move(y,null)};function l(){var y=_t(this),b=vw(this).selection;b?(y.selectAll(".selection").style("display",null).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1]),y.selectAll(".handle").style("display",null).attr("x",function(m){return m.type[m.type.length-1]==="e"?b[1][0]-a/2:b[0][0]-a/2}).attr("y",function(m){return m.type[0]==="s"?b[1][1]-a/2:b[0][1]-a/2}).attr("width",function(m){return m.type==="n"||m.type==="s"?b[1][0]-b[0][0]+a:a}).attr("height",function(m){return m.type==="e"||m.type==="w"?b[1][1]-b[0][1]+a:a})):y.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(y,b,m){var v=y.__brush.emitter;return v&&(!m||!v.clean)?v:new f(y,b,m)}function f(y,b,m){this.that=y,this.args=b,this.state=y.__brush,this.active=0,this.clean=m}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(y,b){return this.starting?(this.starting=!1,this.emit("start",y,b)):this.emit("brush",y),this},brush:function(y,b){return this.emit("brush",y,b),this},end:function(y,b){return--this.active===0&&(delete this.state.emitter,this.emit("end",y,b)),this},emit:function(y,b,m){var v=_t(this.that).datum();o.call(y,this.that,new Sne(y,{sourceEvent:b,target:c,selection:e.output(this.state.selection),mode:m,dispatch:o}),v)}};function h(y){if(s&&!y.touches||!n.apply(this,arguments))return;var b=this,m=y.target.__data__.type,v=(i&&y.metaKey?m="overlay":m)==="selection"?pR:i&&y.altKey?il:nl,_=e===Gd?null:xne[m],T=e===Vd?null:Cne[m],w=vw(b),S=w.extent,k=w.selection,E=S[0][0],P,C,I=S[0][1],O,M,R=S[1][0],z,U,j=S[1][1],H,W,re=0,Y=0,F,L=_&&T&&i&&y.shiftKey,K,G,te=Array.from(y.touches||[y],Ie=>{const xe=Ie.identifier;return Ie=Xt(Ie,b),Ie.point0=Ie.slice(),Ie.identifier=xe,Ie});if(m==="overlay"){k&&(F=!0);const Ie=[te[0],te[1]||te[0]];w.selection=k=[[P=e===Gd?E:Zr(Ie[0][0],Ie[1][0]),O=e===Vd?I:Zr(Ie[0][1],Ie[1][1])],[z=e===Gd?R:Kr(Ie[0][0],Ie[1][0]),H=e===Vd?j:Kr(Ie[0][1],Ie[1][1])]],te.length>1&&Oe()}else P=k[0][0],O=k[0][1],z=k[1][0],H=k[1][1];C=P,M=O,U=z,W=H;var de=_t(b).attr("pointer-events","none"),ce=de.selectAll(".overlay").attr("cursor",_o[m]);fw(b);var le=u(b,arguments,!0).beforestart();if(y.touches)le.moved=ye,le.ended=Re;else{var me=_t(y.view).on("mousemove.brush",ye,!0).on("mouseup.brush",Re,!0);i&&me.on("keydown.brush",Fe,!0).on("keyup.brush",$e,!0),gd(y.view)}l.call(b),le.start(y,v.name);function ye(Ie){for(const xe of Ie.changedTouches||[Ie])for(const Me of te)Me.identifier===xe.identifier&&(Me.cur=Xt(xe,b));if(L&&!K&&!G&&te.length===1){const xe=te[0];dR(xe.cur[0]-xe[0])>dR(xe.cur[1]-xe[1])?G=!0:K=!0}for(const xe of te)xe.cur&&(xe[0]=xe.cur[0],xe[1]=xe.cur[1]);F=!0,dw(Ie),Oe(Ie)}function Oe(Ie){const xe=te[0],Me=xe.point0;var Be;switch(re=xe[0]-Me[0],Y=xe[1]-Me[1],v){case gw:case pR:{_&&(re=Kr(E-P,Zr(R-z,re)),C=P+re,U=z+re),T&&(Y=Kr(I-O,Zr(j-H,Y)),M=O+Y,W=H+Y);break}case nl:{te[1]?(_&&(C=Kr(E,Zr(R,te[0][0])),U=Kr(E,Zr(R,te[1][0])),_=1),T&&(M=Kr(I,Zr(j,te[0][1])),W=Kr(I,Zr(j,te[1][1])),T=1)):(_<0?(re=Kr(E-P,Zr(R-P,re)),C=P+re,U=z):_>0&&(re=Kr(E-z,Zr(R-z,re)),C=P,U=z+re),T<0?(Y=Kr(I-O,Zr(j-O,Y)),M=O+Y,W=H):T>0&&(Y=Kr(I-H,Zr(j-H,Y)),M=O,W=H+Y));break}case il:{_&&(C=Kr(E,Zr(R,P-re*_)),U=Kr(E,Zr(R,z+re*_))),T&&(M=Kr(I,Zr(j,O-Y*T)),W=Kr(I,Zr(j,H+Y*T)));break}}U<C&&(_*=-1,Be=P,P=z,z=Be,Be=C,C=U,U=Be,m in mR&&ce.attr("cursor",_o[m=mR[m]])),W<M&&(T*=-1,Be=O,O=H,H=Be,Be=M,M=W,W=Be,m in vR&&ce.attr("cursor",_o[m=vR[m]])),w.selection&&(k=w.selection),K&&(C=k[0][0],U=k[1][0]),G&&(M=k[0][1],W=k[1][1]),(k[0][0]!==C||k[0][1]!==M||k[1][0]!==U||k[1][1]!==W)&&(w.selection=[[C,M],[U,W]],l.call(b),le.brush(Ie,v.name))}function Re(Ie){if(Ene(Ie),Ie.touches){if(Ie.touches.length)return;s&&clearTimeout(s),s=setTimeout(function(){s=null},500)}else md(Ie.view,F),me.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);de.attr("pointer-events","all"),ce.attr("cursor",_o.overlay),w.selection&&(k=w.selection),Mne(k)&&(w.selection=null,l.call(b)),le.end(Ie,v.name)}function Fe(Ie){switch(Ie.keyCode){case 16:{L=_&&T;break}case 18:{v===nl&&(_&&(z=U-re*_,P=C+re*_),T&&(H=W-Y*T,O=M+Y*T),v=il,Oe());break}case 32:{(v===nl||v===il)&&(_<0?z=U-re:_>0&&(P=C-re),T<0?H=W-Y:T>0&&(O=M-Y),v=gw,ce.attr("cursor",_o.selection),Oe());break}default:return}dw(Ie)}function $e(Ie){switch(Ie.keyCode){case 16:{L&&(K=G=L=!1,Oe());break}case 18:{v===il&&(_<0?z=U:_>0&&(P=C),T<0?H=W:T>0&&(O=M),v=nl,Oe());break}case 32:{v===gw&&(Ie.altKey?(_&&(z=U-re*_,P=C+re*_),T&&(H=W-Y*T,O=M+Y*T),v=il):(_<0?z=U:_>0&&(P=C),T<0?H=W:T>0&&(O=M),v=nl),ce.attr("cursor",_o[m]),Oe());break}default:return}dw(Ie)}}function p(y){u(this,arguments).moved(y)}function d(y){u(this,arguments).ended(y)}function g(){var y=this.__brush||{selection:null};return y.extent=mw(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:pw(mw(y)),c):t},c.filter=function(y){return arguments.length?(n=typeof y=="function"?y:pw(!!y),c):n},c.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:pw(!!y),c):r},c.handleSize=function(y){return arguments.length?(a=+y,c):a},c.keyModifiers=function(y){return arguments.length?(i=!!y,c):i},c.on=function(){var y=o.on.apply(o,arguments);return y===o?c:y},c}const Rne=Object.freeze(Object.defineProperty({__proto__:null,brush:Wd,brushSelection:Ine,brushX:ol,brushY:al},Symbol.toStringTag,{value:"Module"}));function Dne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nne(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,$ne(r.key),r)}}function Lne(e,t,n){return t&&Nne(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $ne(e){var t=jne(e,"string");return typeof t=="symbol"?t:t+""}function jne(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Bne(e,t,n){return t=Yd(t),zne(e,yR()?Reflect.construct(t,n||[],Yd(e).constructor):t.apply(e,n))}function zne(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hne(e)}function Hne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yR=function(){return!!e})()}function Yd(e){return Yd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yd(e)}function Fne(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&bw(e,t)}function bw(e,t){return bw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},bw(e,t)}let bR=function(e){function t(n){var r;return Dne(this,t),r=Bne(this,t,[n]),r.DATATYPE_TO_TRACK_TYPE=h0(r.props.orientation),r.AVAILABLE_TRACK_TYPES=Rp(r.props.datatypes,r.props.orientation),r.state={selectedPlotType:r.AVAILABLE_TRACK_TYPES[0]},r}return Fne(t,e),Lne(t,[{key:"UNSAFE_componentWillReceiveProps",value:function(r){if(this.AVAILABLE_TRACK_TYPES=Rp(r.datatypes,this.props.orientation),!!this.AVAILABLE_TRACK_TYPES&&r.allTracksSameDatatype&&this.AVAILABLE_TRACK_TYPES.length>0&&!this.AVAILABLE_TRACK_TYPES.includes(this.state.selectedPlotType)){const i=g0(r.datatypes[0][0],this.props.position,this.AVAILABLE_TRACK_TYPES);this.handlePlotTypeSelected(i)}}},{key:"handlePlotTypeSelected",value:function(r){this.setState({selectedPlotType:r}),this.props.onPlotTypeSelected(r.type)}},{key:"render",value:function(){let r="No plot types available for track";const i={};return xa.forEach(o=>{i[o.type]=o}),this.AVAILABLE_TRACK_TYPES&&(r=this.AVAILABLE_TRACK_TYPES.sort((o,a)=>o.type<a.type).map(o=>{const a=i[o.type].thumbnail,s=this.state.selectedPlotType.type===o.type?"plot-type-item plot-type-selected":"plot-type-item",c=i[o.type].thumbnail?x.createElement("div",{className:"track-thumbnail",dangerouslySetInnerHTML:{__html:a.outerHTML}}):x.createElement("div",{className:"track-thumbnail"},x.createElement("svg",{height:20,width:30}));return x.createElement("li",{key:o.type,className:s,onClick:l=>{this.setState({selectedPlotType:o}),this.props.onPlotTypeSelected(o.type)},style:{listStyle:"none",paddingLeft:5,paddingBottom:0}},c,x.createElement("span",{style:{verticalAlign:"middle"}},o.type))})),x.createElement("div",null,r.length>0&&this.props.allTracksSameDatatype&&x.createElement("div",{className:"plot-type-container"},r),!this.props.allTracksSameDatatype&&x.createElement("div",{className:"plot-type-container-empty"},"Datasets with multiple datatypes chosen. They will be added with their default track types."))}}])}(x.Component);bR.propTypes={allTracksSameDatatype:q.bool,datatypes:q.array,orientation:q.string,onPlotTypeSelected:q.func,position:q.string};var _w={exports:{}},_R;function qne(){return _R||(_R=1,function(e,t){(function(n,r){e.exports=r(x)})(self,n=>(()=>{var r={4184:(s,c)=>{var l;(function(){var u={}.hasOwnProperty;function f(){for(var h=[],p=0;p<arguments.length;p++){var d=arguments[p];if(d){var g=typeof d;if(g==="string"||g==="number")h.push(d);else if(Array.isArray(d)){if(d.length){var y=f.apply(null,d);y&&h.push(y)}}else if(g==="object")if(d.toString===Object.prototype.toString)for(var b in d)u.call(d,b)&&d[b]&&h.push(b);else h.push(d.toString())}}return h.join(" ")}s.exports?(f.default=f,s.exports=f):(l=function(){return f}.apply(c,[]))===void 0||(s.exports=l)})()},8552:(s,c,l)=>{var u=l(852)(l(5639),"DataView");s.exports=u},1989:(s,c,l)=>{var u=l(1789),f=l(401),h=l(7667),p=l(1327),d=l(1866);function g(y){var b=-1,m=y==null?0:y.length;for(this.clear();++b<m;){var v=y[b];this.set(v[0],v[1])}}g.prototype.clear=u,g.prototype.delete=f,g.prototype.get=h,g.prototype.has=p,g.prototype.set=d,s.exports=g},8407:(s,c,l)=>{var u=l(7040),f=l(4125),h=l(2117),p=l(7518),d=l(4705);function g(y){var b=-1,m=y==null?0:y.length;for(this.clear();++b<m;){var v=y[b];this.set(v[0],v[1])}}g.prototype.clear=u,g.prototype.delete=f,g.prototype.get=h,g.prototype.has=p,g.prototype.set=d,s.exports=g},7071:(s,c,l)=>{var u=l(852)(l(5639),"Map");s.exports=u},3369:(s,c,l)=>{var u=l(4785),f=l(1285),h=l(6e3),p=l(9916),d=l(5265);function g(y){var b=-1,m=y==null?0:y.length;for(this.clear();++b<m;){var v=y[b];this.set(v[0],v[1])}}g.prototype.clear=u,g.prototype.delete=f,g.prototype.get=h,g.prototype.has=p,g.prototype.set=d,s.exports=g},3818:(s,c,l)=>{var u=l(852)(l(5639),"Promise");s.exports=u},8525:(s,c,l)=>{var u=l(852)(l(5639),"Set");s.exports=u},8668:(s,c,l)=>{var u=l(3369),f=l(619),h=l(2385);function p(d){var g=-1,y=d==null?0:d.length;for(this.__data__=new u;++g<y;)this.add(d[g])}p.prototype.add=p.prototype.push=f,p.prototype.has=h,s.exports=p},6384:(s,c,l)=>{var u=l(8407),f=l(7465),h=l(3779),p=l(7599),d=l(4758),g=l(4309);function y(b){var m=this.__data__=new u(b);this.size=m.size}y.prototype.clear=f,y.prototype.delete=h,y.prototype.get=p,y.prototype.has=d,y.prototype.set=g,s.exports=y},2705:(s,c,l)=>{var u=l(5639).Symbol;s.exports=u},1149:(s,c,l)=>{var u=l(5639).Uint8Array;s.exports=u},577:(s,c,l)=>{var u=l(852)(l(5639),"WeakMap");s.exports=u},4963:s=>{s.exports=function(c,l){for(var u=-1,f=c==null?0:c.length,h=0,p=[];++u<f;){var d=c[u];l(d,u,c)&&(p[h++]=d)}return p}},4636:(s,c,l)=>{var u=l(2545),f=l(5694),h=l(1469),p=l(4144),d=l(5776),g=l(6719),y=Object.prototype.hasOwnProperty;s.exports=function(b,m){var v=h(b),_=!v&&f(b),T=!v&&!_&&p(b),w=!v&&!_&&!T&&g(b),S=v||_||T||w,k=S?u(b.length,String):[],E=k.length;for(var P in b)!m&&!y.call(b,P)||S&&(P=="length"||T&&(P=="offset"||P=="parent")||w&&(P=="buffer"||P=="byteLength"||P=="byteOffset")||d(P,E))||k.push(P);return k}},2488:s=>{s.exports=function(c,l){for(var u=-1,f=l.length,h=c.length;++u<f;)c[h+u]=l[u];return c}},2908:s=>{s.exports=function(c,l){for(var u=-1,f=c==null?0:c.length;++u<f;)if(l(c[u],u,c))return!0;return!1}},8470:(s,c,l)=>{var u=l(7813);s.exports=function(f,h){for(var p=f.length;p--;)if(u(f[p][0],h))return p;return-1}},8866:(s,c,l)=>{var u=l(2488),f=l(1469);s.exports=function(h,p,d){var g=p(h);return f(h)?g:u(g,d(h))}},4239:(s,c,l)=>{var u=l(2705),f=l(9607),h=l(2333),p=u?u.toStringTag:void 0;s.exports=function(d){return d==null?d===void 0?"[object Undefined]":"[object Null]":p&&p in Object(d)?f(d):h(d)}},9454:(s,c,l)=>{var u=l(4239),f=l(7005);s.exports=function(h){return f(h)&&u(h)=="[object Arguments]"}},939:(s,c,l)=>{var u=l(2492),f=l(7005);s.exports=function h(p,d,g,y,b){return p===d||(p==null||d==null||!f(p)&&!f(d)?p!=p&&d!=d:u(p,d,g,y,h,b))}},2492:(s,c,l)=>{var u=l(6384),f=l(7114),h=l(8351),p=l(6096),d=l(4160),g=l(1469),y=l(4144),b=l(6719),m="[object Arguments]",v="[object Array]",_="[object Object]",T=Object.prototype.hasOwnProperty;s.exports=function(w,S,k,E,P,C){var I=g(w),O=g(S),M=I?v:d(w),R=O?v:d(S),z=(M=M==m?_:M)==_,U=(R=R==m?_:R)==_,j=M==R;if(j&&y(w)){if(!y(S))return!1;I=!0,z=!1}if(j&&!z)return C||(C=new u),I||b(w)?f(w,S,k,E,P,C):h(w,S,M,k,E,P,C);if(!(1&k)){var H=z&&T.call(w,"__wrapped__"),W=U&&T.call(S,"__wrapped__");if(H||W){var re=H?w.value():w,Y=W?S.value():S;return C||(C=new u),P(re,Y,k,E,C)}}return!!j&&(C||(C=new u),p(w,S,k,E,P,C))}},8458:(s,c,l)=>{var u=l(3560),f=l(5346),h=l(3218),p=l(346),d=/^\[object .+?Constructor\]$/,g=Function.prototype,y=Object.prototype,b=g.toString,m=y.hasOwnProperty,v=RegExp("^"+b.call(m).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");s.exports=function(_){return!(!h(_)||f(_))&&(u(_)?v:d).test(p(_))}},8749:(s,c,l)=>{var u=l(4239),f=l(1780),h=l(7005),p={};p["[object Float32Array]"]=p["[object Float64Array]"]=p["[object Int8Array]"]=p["[object Int16Array]"]=p["[object Int32Array]"]=p["[object Uint8Array]"]=p["[object Uint8ClampedArray]"]=p["[object Uint16Array]"]=p["[object Uint32Array]"]=!0,p["[object Arguments]"]=p["[object Array]"]=p["[object ArrayBuffer]"]=p["[object Boolean]"]=p["[object DataView]"]=p["[object Date]"]=p["[object Error]"]=p["[object Function]"]=p["[object Map]"]=p["[object Number]"]=p["[object Object]"]=p["[object RegExp]"]=p["[object Set]"]=p["[object String]"]=p["[object WeakMap]"]=!1,s.exports=function(d){return h(d)&&f(d.length)&&!!p[u(d)]}},280:(s,c,l)=>{var u=l(5726),f=l(6916),h=Object.prototype.hasOwnProperty;s.exports=function(p){if(!u(p))return f(p);var d=[];for(var g in Object(p))h.call(p,g)&&g!="constructor"&&d.push(g);return d}},2545:s=>{s.exports=function(c,l){for(var u=-1,f=Array(c);++u<c;)f[u]=l(u);return f}},1717:s=>{s.exports=function(c){return function(l){return c(l)}}},4757:s=>{s.exports=function(c,l){return c.has(l)}},4429:(s,c,l)=>{var u=l(5639)["__core-js_shared__"];s.exports=u},7114:(s,c,l)=>{var u=l(8668),f=l(2908),h=l(4757);s.exports=function(p,d,g,y,b,m){var v=1&g,_=p.length,T=d.length;if(_!=T&&!(v&&T>_))return!1;var w=m.get(p),S=m.get(d);if(w&&S)return w==d&&S==p;var k=-1,E=!0,P=2&g?new u:void 0;for(m.set(p,d),m.set(d,p);++k<_;){var C=p[k],I=d[k];if(y)var O=v?y(I,C,k,d,p,m):y(C,I,k,p,d,m);if(O!==void 0){if(O)continue;E=!1;break}if(P){if(!f(d,function(M,R){if(!h(P,R)&&(C===M||b(C,M,g,y,m)))return P.push(R)})){E=!1;break}}else if(C!==I&&!b(C,I,g,y,m)){E=!1;break}}return m.delete(p),m.delete(d),E}},8351:(s,c,l)=>{var u=l(2705),f=l(1149),h=l(7813),p=l(7114),d=l(8776),g=l(1814),y=u?u.prototype:void 0,b=y?y.valueOf:void 0;s.exports=function(m,v,_,T,w,S,k){switch(_){case"[object DataView]":if(m.byteLength!=v.byteLength||m.byteOffset!=v.byteOffset)return!1;m=m.buffer,v=v.buffer;case"[object ArrayBuffer]":return!(m.byteLength!=v.byteLength||!S(new f(m),new f(v)));case"[object Boolean]":case"[object Date]":case"[object Number]":return h(+m,+v);case"[object Error]":return m.name==v.name&&m.message==v.message;case"[object RegExp]":case"[object String]":return m==v+"";case"[object Map]":var E=d;case"[object Set]":var P=1&T;if(E||(E=g),m.size!=v.size&&!P)return!1;var C=k.get(m);if(C)return C==v;T|=2,k.set(m,v);var I=p(E(m),E(v),T,w,S,k);return k.delete(m),I;case"[object Symbol]":if(b)return b.call(m)==b.call(v)}return!1}},6096:(s,c,l)=>{var u=l(8234),f=Object.prototype.hasOwnProperty;s.exports=function(h,p,d,g,y,b){var m=1&d,v=u(h),_=v.length;if(_!=u(p).length&&!m)return!1;for(var T=_;T--;){var w=v[T];if(!(m?w in p:f.call(p,w)))return!1}var S=b.get(h),k=b.get(p);if(S&&k)return S==p&&k==h;var E=!0;b.set(h,p),b.set(p,h);for(var P=m;++T<_;){var C=h[w=v[T]],I=p[w];if(g)var O=m?g(I,C,w,p,h,b):g(C,I,w,h,p,b);if(!(O===void 0?C===I||y(C,I,d,g,b):O)){E=!1;break}P||(P=w=="constructor")}if(E&&!P){var M=h.constructor,R=p.constructor;M==R||!("constructor"in h)||!("constructor"in p)||typeof M=="function"&&M instanceof M&&typeof R=="function"&&R instanceof R||(E=!1)}return b.delete(h),b.delete(p),E}},1957:(s,c,l)=>{var u=typeof l.g=="object"&&l.g&&l.g.Object===Object&&l.g;s.exports=u},8234:(s,c,l)=>{var u=l(8866),f=l(9551),h=l(3674);s.exports=function(p){return u(p,h,f)}},5050:(s,c,l)=>{var u=l(7019);s.exports=function(f,h){var p=f.__data__;return u(h)?p[typeof h=="string"?"string":"hash"]:p.map}},852:(s,c,l)=>{var u=l(8458),f=l(7801);s.exports=function(h,p){var d=f(h,p);return u(d)?d:void 0}},9607:(s,c,l)=>{var u=l(2705),f=Object.prototype,h=f.hasOwnProperty,p=f.toString,d=u?u.toStringTag:void 0;s.exports=function(g){var y=h.call(g,d),b=g[d];try{g[d]=void 0;var m=!0}catch{}var v=p.call(g);return m&&(y?g[d]=b:delete g[d]),v}},9551:(s,c,l)=>{var u=l(4963),f=l(479),h=Object.prototype.propertyIsEnumerable,p=Object.getOwnPropertySymbols,d=p?function(g){return g==null?[]:(g=Object(g),u(p(g),function(y){return h.call(g,y)}))}:f;s.exports=d},4160:(s,c,l)=>{var u=l(8552),f=l(7071),h=l(3818),p=l(8525),d=l(577),g=l(4239),y=l(346),b="[object Map]",m="[object Promise]",v="[object Set]",_="[object WeakMap]",T="[object DataView]",w=y(u),S=y(f),k=y(h),E=y(p),P=y(d),C=g;(u&&C(new u(new ArrayBuffer(1)))!=T||f&&C(new f)!=b||h&&C(h.resolve())!=m||p&&C(new p)!=v||d&&C(new d)!=_)&&(C=function(I){var O=g(I),M=O=="[object Object]"?I.constructor:void 0,R=M?y(M):"";if(R)switch(R){case w:return T;case S:return b;case k:return m;case E:return v;case P:return _}return O}),s.exports=C},7801:s=>{s.exports=function(c,l){return c?.[l]}},1789:(s,c,l)=>{var u=l(4536);s.exports=function(){this.__data__=u?u(null):{},this.size=0}},401:s=>{s.exports=function(c){var l=this.has(c)&&delete this.__data__[c];return this.size-=l?1:0,l}},7667:(s,c,l)=>{var u=l(4536),f=Object.prototype.hasOwnProperty;s.exports=function(h){var p=this.__data__;if(u){var d=p[h];return d==="__lodash_hash_undefined__"?void 0:d}return f.call(p,h)?p[h]:void 0}},1327:(s,c,l)=>{var u=l(4536),f=Object.prototype.hasOwnProperty;s.exports=function(h){var p=this.__data__;return u?p[h]!==void 0:f.call(p,h)}},1866:(s,c,l)=>{var u=l(4536);s.exports=function(f,h){var p=this.__data__;return this.size+=this.has(f)?0:1,p[f]=u&&h===void 0?"__lodash_hash_undefined__":h,this}},5776:s=>{var c=/^(?:0|[1-9]\d*)$/;s.exports=function(l,u){var f=typeof l;return!!(u=u??9007199254740991)&&(f=="number"||f!="symbol"&&c.test(l))&&l>-1&&l%1==0&&l<u}},7019:s=>{s.exports=function(c){var l=typeof c;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?c!=="__proto__":c===null}},5346:(s,c,l)=>{var u,f=l(4429),h=(u=/[^.]+$/.exec(f&&f.keys&&f.keys.IE_PROTO||""))?"Symbol(src)_1."+u:"";s.exports=function(p){return!!h&&h in p}},5726:s=>{var c=Object.prototype;s.exports=function(l){var u=l&&l.constructor;return l===(typeof u=="function"&&u.prototype||c)}},7040:s=>{s.exports=function(){this.__data__=[],this.size=0}},4125:(s,c,l)=>{var u=l(8470),f=Array.prototype.splice;s.exports=function(h){var p=this.__data__,d=u(p,h);return!(d<0||(d==p.length-1?p.pop():f.call(p,d,1),--this.size,0))}},2117:(s,c,l)=>{var u=l(8470);s.exports=function(f){var h=this.__data__,p=u(h,f);return p<0?void 0:h[p][1]}},7518:(s,c,l)=>{var u=l(8470);s.exports=function(f){return u(this.__data__,f)>-1}},4705:(s,c,l)=>{var u=l(8470);s.exports=function(f,h){var p=this.__data__,d=u(p,f);return d<0?(++this.size,p.push([f,h])):p[d][1]=h,this}},4785:(s,c,l)=>{var u=l(1989),f=l(8407),h=l(7071);s.exports=function(){this.size=0,this.__data__={hash:new u,map:new(h||f),string:new u}}},1285:(s,c,l)=>{var u=l(5050);s.exports=function(f){var h=u(this,f).delete(f);return this.size-=h?1:0,h}},6e3:(s,c,l)=>{var u=l(5050);s.exports=function(f){return u(this,f).get(f)}},9916:(s,c,l)=>{var u=l(5050);s.exports=function(f){return u(this,f).has(f)}},5265:(s,c,l)=>{var u=l(5050);s.exports=function(f,h){var p=u(this,f),d=p.size;return p.set(f,h),this.size+=p.size==d?0:1,this}},8776:s=>{s.exports=function(c){var l=-1,u=Array(c.size);return c.forEach(function(f,h){u[++l]=[h,f]}),u}},4536:(s,c,l)=>{var u=l(852)(Object,"create");s.exports=u},6916:(s,c,l)=>{var u=l(5569)(Object.keys,Object);s.exports=u},1167:(s,c,l)=>{s=l.nmd(s);var u=l(1957),f=c&&!c.nodeType&&c,h=f&&s&&!s.nodeType&&s,p=h&&h.exports===f&&u.process,d=function(){try{return h&&h.require&&h.require("util").types||p&&p.binding&&p.binding("util")}catch{}}();s.exports=d},2333:s=>{var c=Object.prototype.toString;s.exports=function(l){return c.call(l)}},5569:s=>{s.exports=function(c,l){return function(u){return c(l(u))}}},5639:(s,c,l)=>{var u=l(1957),f=typeof self=="object"&&self&&self.Object===Object&&self,h=u||f||Function("return this")();s.exports=h},619:s=>{s.exports=function(c){return this.__data__.set(c,"__lodash_hash_undefined__"),this}},2385:s=>{s.exports=function(c){return this.__data__.has(c)}},1814:s=>{s.exports=function(c){var l=-1,u=Array(c.size);return c.forEach(function(f){u[++l]=f}),u}},7465:(s,c,l)=>{var u=l(8407);s.exports=function(){this.__data__=new u,this.size=0}},3779:s=>{s.exports=function(c){var l=this.__data__,u=l.delete(c);return this.size=l.size,u}},7599:s=>{s.exports=function(c){return this.__data__.get(c)}},4758:s=>{s.exports=function(c){return this.__data__.has(c)}},4309:(s,c,l)=>{var u=l(8407),f=l(7071),h=l(3369);s.exports=function(p,d){var g=this.__data__;if(g instanceof u){var y=g.__data__;if(!f||y.length<199)return y.push([p,d]),this.size=++g.size,this;g=this.__data__=new h(y)}return g.set(p,d),this.size=g.size,this}},346:s=>{var c=Function.prototype.toString;s.exports=function(l){if(l!=null){try{return c.call(l)}catch{}try{return l+""}catch{}}return""}},7813:s=>{s.exports=function(c,l){return c===l||c!=c&&l!=l}},5694:(s,c,l)=>{var u=l(9454),f=l(7005),h=Object.prototype,p=h.hasOwnProperty,d=h.propertyIsEnumerable,g=u(function(){return arguments}())?u:function(y){return f(y)&&p.call(y,"callee")&&!d.call(y,"callee")};s.exports=g},1469:s=>{var c=Array.isArray;s.exports=c},8612:(s,c,l)=>{var u=l(3560),f=l(1780);s.exports=function(h){return h!=null&&f(h.length)&&!u(h)}},4144:(s,c,l)=>{s=l.nmd(s);var u=l(5639),f=l(5062),h=c&&!c.nodeType&&c,p=h&&s&&!s.nodeType&&s,d=p&&p.exports===h?u.Buffer:void 0,g=(d?d.isBuffer:void 0)||f;s.exports=g},8446:(s,c,l)=>{var u=l(939);s.exports=function(f,h){return u(f,h)}},3560:(s,c,l)=>{var u=l(4239),f=l(3218);s.exports=function(h){if(!f(h))return!1;var p=u(h);return p=="[object Function]"||p=="[object GeneratorFunction]"||p=="[object AsyncFunction]"||p=="[object Proxy]"}},1780:s=>{s.exports=function(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=9007199254740991}},3218:s=>{s.exports=function(c){var l=typeof c;return c!=null&&(l=="object"||l=="function")}},7005:s=>{s.exports=function(c){return c!=null&&typeof c=="object"}},6719:(s,c,l)=>{var u=l(8749),f=l(1717),h=l(1167),p=h&&h.isTypedArray,d=p?f(p):u;s.exports=d},3674:(s,c,l)=>{var u=l(4636),f=l(280),h=l(8612);s.exports=function(p){return h(p)?u(p):f(p)}},8306:(s,c,l)=>{var u=l(3369);function f(h,p){if(typeof h!="function"||p!=null&&typeof p!="function")throw new TypeError("Expected a function");var d=function(){var g=arguments,y=p?p.apply(this,g):g[0],b=d.cache;if(b.has(y))return b.get(y);var m=h.apply(this,g);return d.cache=b.set(y,m)||b,m};return d.cache=new(f.Cache||u),d}f.Cache=u,s.exports=f},479:s=>{s.exports=function(){return[]}},5062:s=>{s.exports=function(){return!1}},2703:(s,c,l)=>{var u=l(414);function f(){}function h(){}h.resetWarningCache=f,s.exports=function(){function p(y,b,m,v,_,T){if(T!==u){var w=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw w.name="Invariant Violation",w}}function d(){return p}p.isRequired=p;var g={array:p,bigint:p,bool:p,func:p,number:p,object:p,string:p,symbol:p,any:p,arrayOf:d,element:p,elementType:p,instanceOf:d,node:p,objectOf:d,oneOf:d,oneOfType:d,shape:d,exact:d,checkPropTypes:h,resetWarningCache:f};return g.PropTypes=g,g}},5697:(s,c,l)=>{s.exports=l(2703)()},414:s=>{s.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},9787:s=>{s.exports=n}},i={};function o(s){var c=i[s];if(c!==void 0)return c.exports;var l=i[s]={id:s,loaded:!1,exports:{}};return r[s](l,l.exports,o),l.loaded=!0,l.exports}o.n=s=>{var c=s&&s.__esModule?()=>s.default:()=>s;return o.d(c,{a:c}),c},o.d=(s,c)=>{for(var l in c)o.o(c,l)&&!o.o(s,l)&&Object.defineProperty(s,l,{enumerable:!0,get:c[l]})},o.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),o.o=(s,c)=>Object.prototype.hasOwnProperty.call(s,c),o.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},o.nmd=s=>(s.paths=[],s.children||(s.children=[]),s);var a={};return(()=>{o.r(a),o.d(a,{default:()=>he,expandNodesToLevel:()=>ne});var s=o(4184),c=o.n(s),l=o(8446),u=o.n(l),f=o(8306),h=o.n(f);let p=(J=21)=>crypto.getRandomValues(new Uint8Array(J)).reduce((ee,be)=>ee+((be&=63)<36?be.toString(36):be<62?(be-26).toString(36).toUpperCase():be>62?"-":"_"),"");var d=o(5697),g=o.n(d),y=o(9787),b=o.n(y);function m(J){return m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},m(J)}var v=["children","title"];function _(){return _=Object.assign?Object.assign.bind():function(J){for(var ee=1;ee<arguments.length;ee++){var be=arguments[ee];for(var ve in be)Object.prototype.hasOwnProperty.call(be,ve)&&(J[ve]=be[ve])}return J},_.apply(this,arguments)}function T(J,ee){if(!(J instanceof ee))throw new TypeError("Cannot call a class as a function")}function w(J,ee){for(var be=0;be<ee.length;be++){var ve=ee[be];ve.enumerable=ve.enumerable||!1,ve.configurable=!0,"value"in ve&&(ve.writable=!0),Object.defineProperty(J,ve.key,ve)}}function S(J,ee){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(be,ve){return be.__proto__=ve,be},S(J,ee)}function k(J,ee){if(ee&&(m(ee)==="object"||typeof ee=="function"))return ee;if(ee!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(be){if(be===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return be}(J)}function E(J){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(ee){return ee.__proto__||Object.getPrototypeOf(ee)},E(J)}function P(J,ee,be){return ee in J?Object.defineProperty(J,ee,{value:be,enumerable:!0,configurable:!0,writable:!0}):J[ee]=be,J}var C=function(J){(function(Ne,we){if(typeof we!="function"&&we!==null)throw new TypeError("Super expression must either be null or a function");Ne.prototype=Object.create(we&&we.prototype,{constructor:{value:Ne,writable:!0,configurable:!0}}),Object.defineProperty(Ne,"prototype",{writable:!1}),we&&S(Ne,we)})(Ge,J);var ee,be,ve,je,Xe=(ve=Ge,je=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ne,we=E(ve);if(je){var Ae=E(this).constructor;Ne=Reflect.construct(we,arguments,Ae)}else Ne=we.apply(this,arguments);return k(this,Ne)});function Ge(){return T(this,Ge),Xe.apply(this,arguments)}return ee=Ge,(be=[{key:"render",value:function(){var Ne=this.props,we=Ne.children,Ae=Ne.title,Q=function(Z,se){if(Z==null)return{};var Te,Se,Ue=function(rt,tt){if(rt==null)return{};var dt,ot,vt={},kt=Object.keys(rt);for(ot=0;ot<kt.length;ot++)dt=kt[ot],tt.indexOf(dt)>=0||(vt[dt]=rt[dt]);return vt}(Z,se);if(Object.getOwnPropertySymbols){var He=Object.getOwnPropertySymbols(Z);for(Se=0;Se<He.length;Se++)Te=He[Se],se.indexOf(Te)>=0||Object.prototype.propertyIsEnumerable.call(Z,Te)&&(Ue[Te]=Z[Te])}return Ue}(Ne,v);return b().createElement("button",_({"aria-label":Ae,title:Ae,type:"button"},Q),we)}}])&&w(ee.prototype,be),Object.defineProperty(ee,"prototype",{writable:!1}),Ge}(b().PureComponent);P(C,"propTypes",{children:g().node.isRequired,title:g().string}),P(C,"defaultProps",{title:null});const I=C,O={ALL:"all",PARENT:"parent",LEAF:"leaf"};function M(J){this.message=J,this.stack=Error().stack}M.prototype=Object.create(Error.prototype),M.prototype.name="CheckboxTreeError";const R=M;function z(J,ee){var be=Object.keys(J);if(Object.getOwnPropertySymbols){var ve=Object.getOwnPropertySymbols(J);ee&&(ve=ve.filter(function(je){return Object.getOwnPropertyDescriptor(J,je).enumerable})),be.push.apply(be,ve)}return be}function U(J,ee,be){return ee in J?Object.defineProperty(J,ee,{value:be,enumerable:!0,configurable:!0,writable:!0}):J[ee]=be,J}function j(J,ee){if(!(J instanceof ee))throw new TypeError("Cannot call a class as a function")}function H(J,ee){for(var be=0;be<ee.length;be++){var ve=ee[be];ve.enumerable=ve.enumerable||!1,ve.configurable=!0,"value"in ve&&(ve.writable=!0),Object.defineProperty(J,ve.key,ve)}}var W=O;const re=function(){function J(ve){var je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};j(this,J),this.props=ve,this.flatNodes=je}var ee,be;return ee=J,be=[{key:"setProps",value:function(ve){this.props=ve}},{key:"clone",value:function(){var ve=this,je={};return Object.keys(this.flatNodes).forEach(function(Xe){var Ge=ve.flatNodes[Xe];je[Xe]=function(Ne){for(var we=1;we<arguments.length;we++){var Ae=arguments[we]!=null?arguments[we]:{};we%2?z(Object(Ae),!0).forEach(function(Q){U(Ne,Q,Ae[Q])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Ne,Object.getOwnPropertyDescriptors(Ae)):z(Object(Ae)).forEach(function(Q){Object.defineProperty(Ne,Q,Object.getOwnPropertyDescriptor(Ae,Q))})}return Ne}({},Ge)}),new J(this.props,je)}},{key:"getNode",value:function(ve){return this.flatNodes[ve]}},{key:"reset",value:function(){this.flatNodes={}}},{key:"flattenNodes",value:function(ve){var je=this,Xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ge=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(Array.isArray(ve)&&ve.length!==0){var Ne=this.props,we=Ne.disabled,Ae=Ne.noCascade;ve.forEach(function(Q,Z){var se=je.nodeHasChildren(Q);if(je.flatNodes[Q.value]!==void 0)throw new R("Duplicate value '".concat(Q.value,"' detected. All node values must be unique."));je.flatNodes[Q.value]={label:Q.label,value:Q.value,children:Q.children,parent:Xe,isChild:Xe.value!==void 0,isParent:se,isLeaf:!se,showCheckbox:Q.showCheckbox===void 0||Q.showCheckbox,disabled:je.getDisabledState(Q,Xe,we,Ae),treeDepth:Ge,index:Z},je.flattenNodes(Q.children,Q,Ge+1)})}}},{key:"nodeHasChildren",value:function(ve){return Array.isArray(ve.children)}},{key:"getDisabledState",value:function(ve,je,Xe,Ge){return!!Xe||!(Ge||!je.disabled)||!!ve.disabled}},{key:"deserializeLists",value:function(ve){var je=this,Xe=["checked","expanded"];Object.keys(this.flatNodes).forEach(function(Ge){Xe.forEach(function(Ne){je.flatNodes[Ge][Ne]=!1})}),Xe.forEach(function(Ge){ve[Ge].forEach(function(Ne){je.flatNodes[Ne]!==void 0&&(je.flatNodes[Ne][Ge]=!0)})})}},{key:"serializeList",value:function(ve){var je=this,Xe=[];return Object.keys(this.flatNodes).forEach(function(Ge){je.flatNodes[Ge][ve]&&Xe.push(Ge)}),Xe}},{key:"expandAllNodes",value:function(ve){var je=this;return Object.keys(this.flatNodes).forEach(function(Xe){je.flatNodes[Xe].isParent&&(je.flatNodes[Xe].expanded=ve)}),this}},{key:"toggleChecked",value:function(ve,je,Xe,Ge){var Ne=this,we=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],Ae=this.flatNodes[ve.value],Q=[W.PARENT,W.ALL].indexOf(Xe)>-1,Z=[W.LEAF,W.ALL].indexOf(Xe)>-1;if(Ae.isLeaf||Ge){if(ve.disabled)return this;this.toggleNode(ve.value,"checked",je)}else(Q||Ae.children.length===0)&&this.toggleNode(ve.value,"checked",je),Z&&Ae.children.forEach(function(se){Ne.toggleChecked(se,je,Xe,Ge,!1)});return we&&!Ge&&Ae.isChild&&Q&&this.toggleParentStatus(Ae.parent,Xe),this}},{key:"toggleParentStatus",value:function(ve,je){var Xe=this.flatNodes[ve.value];Xe.isChild?(je===W.ALL&&this.toggleNode(ve.value,"checked",this.isEveryChildChecked(Xe)),this.toggleParentStatus(Xe.parent,je)):this.toggleNode(ve.value,"checked",this.isEveryChildChecked(Xe))}},{key:"isEveryChildChecked",value:function(ve){var je=this;return ve.children.every(function(Xe){return je.getNode(Xe.value).checked})}},{key:"toggleNode",value:function(ve,je,Xe){return this.flatNodes[ve][je]=Xe,this}}],be&&H(ee.prototype,be),Object.defineProperty(ee,"prototype",{writable:!1}),J}();function Y(J){return Y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},Y(J)}function F(){return F=Object.assign?Object.assign.bind():function(J){for(var ee=1;ee<arguments.length;ee++){var be=arguments[ee];for(var ve in be)Object.prototype.hasOwnProperty.call(be,ve)&&(J[ve]=be[ve])}return J},F.apply(this,arguments)}function L(J,ee){var be=Object.keys(J);if(Object.getOwnPropertySymbols){var ve=Object.getOwnPropertySymbols(J);ee&&(ve=ve.filter(function(je){return Object.getOwnPropertyDescriptor(J,je).enumerable})),be.push.apply(be,ve)}return be}function K(J,ee){if(!(J instanceof ee))throw new TypeError("Cannot call a class as a function")}function G(J,ee){for(var be=0;be<ee.length;be++){var ve=ee[be];ve.enumerable=ve.enumerable||!1,ve.configurable=!0,"value"in ve&&(ve.writable=!0),Object.defineProperty(J,ve.key,ve)}}function te(J,ee){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(be,ve){return be.__proto__=ve,be},te(J,ee)}function de(J,ee){if(ee&&(Y(ee)==="object"||typeof ee=="function"))return ee;if(ee!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(be){if(be===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return be}(J)}function ce(J){return ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(ee){return ee.__proto__||Object.getPrototypeOf(ee)},ce(J)}function le(J,ee,be){return ee in J?Object.defineProperty(J,ee,{value:be,enumerable:!0,configurable:!0,writable:!0}):J[ee]=be,J}var me=function(J){(function(Ne,we){if(typeof we!="function"&&we!==null)throw new TypeError("Super expression must either be null or a function");Ne.prototype=Object.create(we&&we.prototype,{constructor:{value:Ne,writable:!0,configurable:!0}}),Object.defineProperty(Ne,"prototype",{writable:!1}),we&&te(Ne,we)})(Ge,J);var ee,be,ve,je,Xe=(ve=Ge,je=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ne,we=ce(ve);if(je){var Ae=ce(this).constructor;Ne=Reflect.construct(we,arguments,Ae)}else Ne=we.apply(this,arguments);return de(this,Ne)});function Ge(){return K(this,Ge),Xe.apply(this,arguments)}return ee=Ge,be=[{key:"componentDidMount",value:function(){this.updateDeterminateProperty()}},{key:"componentDidUpdate",value:function(){this.updateDeterminateProperty()}},{key:"updateDeterminateProperty",value:function(){var Ne=this.props.indeterminate;this.checkbox.indeterminate=Ne}},{key:"render",value:function(){var Ne=this,we=function(Ae){for(var Q=1;Q<arguments.length;Q++){var Z=arguments[Q]!=null?arguments[Q]:{};Q%2?L(Object(Z),!0).forEach(function(se){le(Ae,se,Z[se])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Ae,Object.getOwnPropertyDescriptors(Z)):L(Object(Z)).forEach(function(se){Object.defineProperty(Ae,se,Object.getOwnPropertyDescriptor(Z,se))})}return Ae}({},this.props);return delete we.indeterminate,b().createElement("input",F({},we,{ref:function(Ae){Ne.checkbox=Ae},type:"checkbox"}))}}],be&&G(ee.prototype,be),Object.defineProperty(ee,"prototype",{writable:!1}),Ge}(b().PureComponent);le(me,"propTypes",{indeterminate:g().bool}),le(me,"defaultProps",{indeterminate:!1});const ye=me,Oe=g().shape({check:g().node,uncheck:g().node,halfCheck:g().node,expandClose:g().node,expandOpen:g().node,expandAll:g().node,collapseAll:g().node,parentClose:g().node,parentOpen:g().node,leaf:g().node}),Re=g().shape({collapseAll:g().string.isRequired,expandAll:g().string.isRequired,toggle:g().string.isRequired});function Fe(J){return Fe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},Fe(J)}function $e(J,ee){for(var be=0;be<ee.length;be++){var ve=ee[be];ve.enumerable=ve.enumerable||!1,ve.configurable=!0,"value"in ve&&(ve.writable=!0),Object.defineProperty(J,ve.key,ve)}}function Ie(J,ee){return Ie=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(be,ve){return be.__proto__=ve,be},Ie(J,ee)}function xe(J,ee){if(ee&&(Fe(ee)==="object"||typeof ee=="function"))return ee;if(ee!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Me(J)}function Me(J){if(J===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return J}function Be(J){return Be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(ee){return ee.__proto__||Object.getPrototypeOf(ee)},Be(J)}function De(J,ee,be){return ee in J?Object.defineProperty(J,ee,{value:be,enumerable:!0,configurable:!0,writable:!0}):J[ee]=be,J}var qe=function(J){(function(Ne,we){if(typeof we!="function"&&we!==null)throw new TypeError("Super expression must either be null or a function");Ne.prototype=Object.create(we&&we.prototype,{constructor:{value:Ne,writable:!0,configurable:!0}}),Object.defineProperty(Ne,"prototype",{writable:!1}),we&&Ie(Ne,we)})(Ge,J);var ee,be,ve,je,Xe=(ve=Ge,je=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var Ne,we=Be(ve);if(je){var Ae=Be(this).constructor;Ne=Reflect.construct(we,arguments,Ae)}else Ne=we.apply(this,arguments);return xe(this,Ne)});function Ge(Ne){var we;return function(Ae,Q){if(!(Ae instanceof Q))throw new TypeError("Cannot call a class as a function")}(this,Ge),(we=Xe.call(this,Ne)).onCheck=we.onCheck.bind(Me(we)),we.onCheckboxKeyPress=we.onCheckboxKeyPress.bind(Me(we)),we.onCheckboxKeyUp=we.onCheckboxKeyUp.bind(Me(we)),we.onClick=we.onClick.bind(Me(we)),we.onExpand=we.onExpand.bind(Me(we)),we}return ee=Ge,(be=[{key:"onCheck",value:function(){var Ne=this.props,we=Ne.value;(0,Ne.onCheck)({value:we,checked:this.getCheckState({toggle:!0})})}},{key:"onCheckboxKeyPress",value:function(Ne){Ne.which===32&&Ne.preventDefault()}},{key:"onCheckboxKeyUp",value:function(Ne){var we=Ne.keyCode;[13,32].includes(we)&&this.onCheck()}},{key:"onClick",value:function(){var Ne=this.props,we=Ne.expandOnClick,Ae=Ne.isParent,Q=Ne.value,Z=Ne.onClick;Ae&&we&&this.onExpand(),Z({value:Q,checked:this.getCheckState({toggle:!1})})}},{key:"onExpand",value:function(){var Ne=this.props,we=Ne.expanded,Ae=Ne.value;(0,Ne.onExpand)({value:Ae,expanded:!we})}},{key:"getCheckState",value:function(Ne){var we=Ne.toggle,Ae=this.props,Q=Ae.checked,Z=Ae.optimisticToggle;return!(Q!==0||!we)||Q===1&&!we||Q===2&&Z}},{key:"renderCollapseButton",value:function(){var Ne=this.props,we=Ne.expandDisabled,Ae=Ne.isLeaf,Q=Ne.lang;return Ae?b().createElement("span",{className:"rct-collapse"},b().createElement("span",{className:"rct-icon"})):b().createElement(I,{className:"rct-collapse rct-collapse-btn",disabled:we,title:Q.toggle,onClick:this.onExpand},this.renderCollapseIcon())}},{key:"renderCollapseIcon",value:function(){var Ne=this.props,we=Ne.expanded,Ae=Ne.icons,Q=Ae.expandClose,Z=Ae.expandOpen;return we?Z:Q}},{key:"renderCheckboxIcon",value:function(){var Ne=this.props,we=Ne.checked,Ae=Ne.icons,Q=Ae.uncheck,Z=Ae.check,se=Ae.halfCheck;return we===0?Q:we===1?Z:se}},{key:"renderNodeIcon",value:function(){var Ne=this.props,we=Ne.expanded,Ae=Ne.icon,Q=Ne.icons,Z=Q.leaf,se=Q.parentClose,Te=Q.parentOpen,Se=Ne.isLeaf;return Ae!==null?Ae:Se?Z:we?Te:se}},{key:"renderBareLabel",value:function(Ne){var we=this.props,Ae=we.onClick,Q=we.title,Z=Ae!==null;return b().createElement("span",{className:"rct-bare-label",title:Q},Z?b().createElement("span",{className:"rct-node-clickable",onClick:this.onClick,onKeyPress:this.onClick,role:"button",tabIndex:0},Ne):Ne)}},{key:"renderCheckboxLabel",value:function(Ne){var we=this.props,Ae=we.checked,Q=we.disabled,Z=we.title,se=we.treeId,Te=we.value,Se=we.onClick!==null,Ue="".concat(se,"-").concat(String(Te).split(" ").join("_")),He=[b().createElement("label",{key:0,htmlFor:Ue,title:Z},b().createElement(ye,{checked:Ae===1,disabled:Q,id:Ue,indeterminate:Ae===2,onClick:this.onCheck,onChange:function(){}}),b().createElement("span",{"aria-checked":Ae===1,"aria-disabled":Q,className:"rct-checkbox",role:"checkbox",tabIndex:0,onKeyPress:this.onCheckboxKeyPress,onKeyUp:this.onCheckboxKeyUp},this.renderCheckboxIcon()),Se?null:Ne)];return Se&&He.push(b().createElement("span",{key:1,className:"rct-node-clickable",onClick:this.onClick,onKeyPress:this.onClick,role:"link",tabIndex:0},Ne)),He}},{key:"renderLabel",value:function(){var Ne=this.props,we=Ne.label,Ae=Ne.showCheckbox,Q=[Ne.showNodeIcon?b().createElement("span",{key:0,className:"rct-node-icon"},this.renderNodeIcon()):null,b().createElement("span",{key:1,className:"rct-title"},we)];return Ae?this.renderCheckboxLabel(Q):this.renderBareLabel(Q)}},{key:"renderChildren",value:function(){return this.props.expanded?this.props.children:null}},{key:"render",value:function(){var Ne=this.props,we=Ne.className,Ae=Ne.disabled,Q=Ne.expanded,Z=Ne.isLeaf,se=c()({"rct-node":!0,"rct-node-leaf":Z,"rct-node-parent":!Z,"rct-node-expanded":!Z&&Q,"rct-node-collapsed":!Z&&!Q,"rct-disabled":Ae},we);return b().createElement("li",{className:se},b().createElement("span",{className:"rct-text"},this.renderCollapseButton(),this.renderLabel()),this.renderChildren())}}])&&$e(ee.prototype,be),Object.defineProperty(ee,"prototype",{writable:!1}),Ge}(b().PureComponent);De(qe,"propTypes",{checked:g().number.isRequired,disabled:g().bool.isRequired,expandDisabled:g().bool.isRequired,expanded:g().bool.isRequired,icons:Oe.isRequired,isLeaf:g().bool.isRequired,isParent:g().bool.isRequired,label:g().node.isRequired,lang:Re.isRequired,optimisticToggle:g().bool.isRequired,showNodeIcon:g().bool.isRequired,treeId:g().string.isRequired,value:g().oneOfType([g().string,g().number]).isRequired,onCheck:g().func.isRequired,onExpand:g().func.isRequired,children:g().node,className:g().string,expandOnClick:g().bool,icon:g().node,showCheckbox:g().bool,title:g().string,onClick:g().func}),De(qe,"defaultProps",{children:null,className:null,expandOnClick:!1,icon:null,showCheckbox:!0,title:null,onClick:function(){}});const pe=qe,ie=g().oneOfType([g().arrayOf(g().string),g().arrayOf(g().number)]);function oe(J,ee){var be=Object.keys(J);if(Object.getOwnPropertySymbols){var ve=Object.getOwnPropertySymbols(J);ee&&(ve=ve.filter(function(je){return Object.getOwnPropertyDescriptor(J,je).enumerable})),be.push.apply(be,ve)}return be}function ge(J){for(var ee=1;ee<arguments.length;ee++){var be=arguments[ee]!=null?arguments[ee]:{};ee%2?oe(Object(be),!0).forEach(function(ve){ae(J,ve,be[ve])}):Object.getOwnPropertyDescriptors?Object.defineProperties(J,Object.getOwnPropertyDescriptors(be)):oe(Object(be)).forEach(function(ve){Object.defineProperty(J,ve,Object.getOwnPropertyDescriptor(be,ve))})}return J}function ae(J,ee,be){return ee in J?Object.defineProperty(J,ee,{value:be,enumerable:!0,configurable:!0,writable:!0}):J[ee]=be,J}var fe={label:g().node.isRequired,value:g().oneOfType([g().string,g().number]).isRequired,disabled:g().bool,icon:g().node,showCheckbox:g().bool,title:g().string};const ke=g().oneOfType([g().shape(fe),g().shape(ge(ge({},fe),{},{children:g().arrayOf(fe).isRequired}))]);function Pe(J){return Pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},Pe(J)}function ze(J,ee){var be=Object.keys(J);if(Object.getOwnPropertySymbols){var ve=Object.getOwnPropertySymbols(J);ee&&(ve=ve.filter(function(je){return Object.getOwnPropertyDescriptor(J,je).enumerable})),be.push.apply(be,ve)}return be}function Ve(J){for(var ee=1;ee<arguments.length;ee++){var be=arguments[ee]!=null?arguments[ee]:{};ee%2?ze(Object(be),!0).forEach(function(ve){Je(J,ve,be[ve])}):Object.getOwnPropertyDescriptors?Object.defineProperties(J,Object.getOwnPropertyDescriptors(be)):ze(Object(be)).forEach(function(ve){Object.defineProperty(J,ve,Object.getOwnPropertyDescriptor(be,ve))})}return J}function Qe(J,ee){for(var be=0;be<ee.length;be++){var ve=ee[be];ve.enumerable=ve.enumerable||!1,ve.configurable=!0,"value"in ve&&(ve.writable=!0),Object.defineProperty(J,ve.key,ve)}}function et(J,ee){return et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(be,ve){return be.__proto__=ve,be},et(J,ee)}function nt(J,ee){if(ee&&(Pe(ee)==="object"||typeof ee=="function"))return ee;if(ee!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ee(J)}function Ee(J){if(J===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return J}function _e(J){return _e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(ee){return ee.__proto__||Object.getPrototypeOf(ee)},_e(J)}function Je(J,ee,be){return ee in J?Object.defineProperty(J,ee,{value:be,enumerable:!0,configurable:!0,writable:!0}):J[ee]=be,J}var X=function(J){(function(we,Ae){if(typeof Ae!="function"&&Ae!==null)throw new TypeError("Super expression must either be null or a function");we.prototype=Object.create(Ae&&Ae.prototype,{constructor:{value:we,writable:!0,configurable:!0}}),Object.defineProperty(we,"prototype",{writable:!1}),Ae&&et(we,Ae)})(Ne,J);var ee,be,ve,je,Xe,Ge=(je=Ne,Xe=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var we,Ae=_e(je);if(Xe){var Q=_e(this).constructor;we=Reflect.construct(Ae,arguments,Q)}else we=Ae.apply(this,arguments);return nt(this,we)});function Ne(we){var Ae;(function(Z,se){if(!(Z instanceof se))throw new TypeError("Cannot call a class as a function")})(this,Ne),Ae=Ge.call(this,we);var Q=new re(we);return Q.flattenNodes(we.nodes),Q.deserializeLists({checked:we.checked,expanded:we.expanded}),Ae.state={id:we.id||"rct-".concat(p()),model:Q,prevProps:we},Ae.onCheck=Ae.onCheck.bind(Ee(Ae)),Ae.onExpand=Ae.onExpand.bind(Ee(Ae)),Ae.onNodeClick=Ae.onNodeClick.bind(Ee(Ae)),Ae.onExpandAll=Ae.onExpandAll.bind(Ee(Ae)),Ae.onCollapseAll=Ae.onCollapseAll.bind(Ee(Ae)),Ae.combineMemorized=h()(function(Z,se){return Ve(Ve({},Z),se)}).bind(Ee(Ae)),Ae}return ee=Ne,be=[{key:"onCheck",value:function(we){var Ae=this.props,Q=Ae.checkModel,Z=Ae.noCascade,se=Ae.onCheck,Te=this.state.model.clone(),Se=Te.getNode(we.value);Te.toggleChecked(we,we.checked,Q,Z),se(Te.serializeList("checked"),Ve(Ve({},Se),we))}},{key:"onExpand",value:function(we){var Ae=this.props.onExpand,Q=this.state.model.clone(),Z=Q.getNode(we.value);Q.toggleNode(we.value,"expanded",we.expanded),Ae(Q.serializeList("expanded"),Ve(Ve({},Z),we))}},{key:"onNodeClick",value:function(we){(0,this.props.onClick)(Ve(Ve({},this.state.model.getNode(we.value)),we))}},{key:"onExpandAll",value:function(){this.expandAllNodes()}},{key:"onCollapseAll",value:function(){this.expandAllNodes(!1)}},{key:"expandAllNodes",value:function(){var we=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],Ae=this.props.onExpand;Ae(this.state.model.clone().expandAllNodes(we).serializeList("expanded"))}},{key:"determineShallowCheckState",value:function(we,Ae){var Q=this.state.model.getNode(we.value);return Q.isLeaf||Ae||we.children.length===0?Q.checked?1:0:this.isEveryChildChecked(we)?1:this.isSomeChildChecked(we)?2:0}},{key:"isEveryChildChecked",value:function(we){var Ae=this;return we.children.every(function(Q){return Ae.state.model.getNode(Q.value).checkState===1})}},{key:"isSomeChildChecked",value:function(we){var Ae=this;return we.children.some(function(Q){return Ae.state.model.getNode(Q.value).checkState>0})}},{key:"renderTreeNodes",value:function(we){var Ae=this,Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Z=this.props,se=Z.expandDisabled,Te=Z.expandOnClick,Se=Z.icons,Ue=Z.lang,He=Z.noCascade,rt=Z.onClick,tt=Z.onlyLeafCheckboxes,dt=Z.optimisticToggle,ot=Z.showNodeTitle,vt=Z.showNodeIcon,kt=this.state,pt=kt.id,lt=kt.model,qt=Ne.defaultProps.icons,mt=we.map(function(Dt){var sr=Dt.value,Lt=lt.getNode(Dt.value),Ke=Lt.isParent?Ae.renderTreeNodes(Dt.children,Dt):null;Lt.checkState=Ae.determineShallowCheckState(Dt,He);var V=tt?Lt.isLeaf:Lt.showCheckbox;return!Q.value||lt.getNode(Q.value).expanded?b().createElement(pe,{key:sr,checked:Lt.checkState,className:Dt.className,disabled:Lt.disabled,expandDisabled:se,expandOnClick:Te,expanded:Lt.expanded,icon:Dt.icon,icons:Ae.combineMemorized(qt,Se),label:Dt.label,lang:Ue,optimisticToggle:dt,isLeaf:Lt.isLeaf,isParent:Lt.isParent,showCheckbox:V,showNodeIcon:vt,title:ot?Dt.title||Dt.label:Dt.title,treeId:pt,value:Dt.value,onCheck:Ae.onCheck,onClick:rt&&Ae.onNodeClick,onExpand:Ae.onExpand},Ke):null});return b().createElement("ol",null,mt)}},{key:"renderExpandAll",value:function(){var we=this.props,Ae=we.icons,Q=Ae.expandAll,Z=Ae.collapseAll,se=we.lang;return we.showExpandAll?b().createElement("div",{className:"rct-options"},b().createElement(I,{className:"rct-option rct-option-expand-all",title:se.expandAll,onClick:this.onExpandAll},Q),b().createElement(I,{className:"rct-option rct-option-collapse-all",title:se.collapseAll,onClick:this.onCollapseAll},Z)):null}},{key:"renderHiddenInput",value:function(){var we=this.props,Ae=we.name,Q=we.nameAsArray;return Ae===void 0?null:Q?this.renderArrayHiddenInput():this.renderJoinedHiddenInput()}},{key:"renderArrayHiddenInput",value:function(){var we=this.props,Ae=we.checked,Q=we.name;return Ae.map(function(Z){var se="".concat(Q,"[]");return b().createElement("input",{key:Z,name:se,type:"hidden",value:Z})})}},{key:"renderJoinedHiddenInput",value:function(){var we=this.props,Ae=we.checked,Q=we.name,Z=Ae.join(",");return b().createElement("input",{name:Q,type:"hidden",value:Z})}},{key:"render",value:function(){var we,Ae=this.props,Q=Ae.direction,Z=Ae.disabled,se=Ae.iconsClass,Te=Ae.nodes,Se=Ae.nativeCheckboxes,Ue=this.state.id,He=this.renderTreeNodes(Te),rt=c()((Je(we={"react-checkbox-tree":!0,"rct-disabled":Z},"rct-icons-".concat(se),!0),Je(we,"rct-native-display",Se),Je(we,"rct-direction-rtl",Q==="rtl"),we));return b().createElement("div",{className:rt,id:Ue},this.renderExpandAll(),this.renderHiddenInput(),He)}}],ve=[{key:"getDerivedStateFromProps",value:function(we,Ae){var Q=Ae.model,Z=Ae.prevProps,se=we.disabled,Te=we.id,Se=we.nodes,Ue=Ve(Ve({},Ae),{},{prevProps:we});return Q.setProps(we),u()(Z.nodes,Se)&&Z.disabled===se||(Q.reset(),Q.flattenNodes(Se)),Te!==null&&(Ue=Ve(Ve({},Ue),{},{id:Te})),Q.deserializeLists({checked:we.checked,expanded:we.expanded}),Ue}}],be&&Qe(ee.prototype,be),ve&&Qe(ee,ve),Object.defineProperty(ee,"prototype",{writable:!1}),Ne}(b().Component);function N(J){return function(ee){if(Array.isArray(ee))return $(ee)}(J)||function(ee){if(typeof Symbol<"u"&&ee[Symbol.iterator]!=null||ee["@@iterator"]!=null)return Array.from(ee)}(J)||function(ee,be){if(ee){if(typeof ee=="string")return $(ee,be);var ve=Object.prototype.toString.call(ee).slice(8,-1);return ve==="Object"&&ee.constructor&&(ve=ee.constructor.name),ve==="Map"||ve==="Set"?Array.from(ee):ve==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ve)?$(ee,be):void 0}}(J)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
242
242
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function $(J,ee){(ee==null||ee>J.length)&&(ee=J.length);for(var be=0,ve=new Array(ee);be<ee;be++)ve[be]=J[be];return ve}function ne(J,ee){var be=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(be>ee)return[];var ve=[];return J.forEach(function(je){je.children&&(ve=[].concat(N(ve),[je.value],N(ne(je.children,ee,be+1))))}),ve}Je(X,"propTypes",{nodes:g().arrayOf(ke).isRequired,checkModel:g().oneOf([O.LEAF,O.ALL]),checked:ie,direction:g().string,disabled:g().bool,expandDisabled:g().bool,expandOnClick:g().bool,expanded:ie,icons:Oe,iconsClass:g().string,id:g().string,lang:Re,name:g().string,nameAsArray:g().bool,nativeCheckboxes:g().bool,noCascade:g().bool,onlyLeafCheckboxes:g().bool,optimisticToggle:g().bool,showExpandAll:g().bool,showNodeIcon:g().bool,showNodeTitle:g().bool,onCheck:g().func,onClick:g().func,onExpand:g().func}),Je(X,"defaultProps",{checkModel:O.LEAF,checked:[],direction:"ltr",disabled:!1,expandDisabled:!1,expandOnClick:!1,expanded:[],icons:{check:b().createElement("span",{className:"rct-icon rct-icon-check"}),uncheck:b().createElement("span",{className:"rct-icon rct-icon-uncheck"}),halfCheck:b().createElement("span",{className:"rct-icon rct-icon-half-check"}),expandClose:b().createElement("span",{className:"rct-icon rct-icon-expand-close"}),expandOpen:b().createElement("span",{className:"rct-icon rct-icon-expand-open"}),expandAll:b().createElement("span",{className:"rct-icon rct-icon-expand-all"}),collapseAll:b().createElement("span",{className:"rct-icon rct-icon-collapse-all"}),parentClose:b().createElement("span",{className:"rct-icon rct-icon-parent-close"}),parentOpen:b().createElement("span",{className:"rct-icon rct-icon-parent-open"}),leaf:b().createElement("span",{className:"rct-icon rct-icon-leaf"})},iconsClass:"fa4",id:null,lang:{collapseAll:"Collapse all",expandAll:"Expand all",toggle:"Toggle"},name:void 0,nameAsArray:!1,nativeCheckboxes:!1,noCascade:!1,onlyLeafCheckboxes:!1,optimisticToggle:!0,showExpandAll:!1,showNodeIcon:!0,showNodeTitle:!1,onCheck:function(){},onClick:null,onExpand:function(){}});const he=X})(),a})())}(_w)),_w.exports}var Une=qne();const Vne=_n(Une);function Gne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wne(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Xne(r.key),r)}}function Yne(e,t,n){return t&&Wne(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xne(e){var t=Kne(e,"string");return typeof t=="symbol"?t:t+""}function Kne(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Zne(e,t,n){return t=Xd(t),Qne(e,TR()?Reflect.construct(t,n||[],Xd(e).constructor):t.apply(e,n))}function Qne(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Jne(e)}function Jne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function TR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(TR=function(){return!!e})()}function Xd(e){return Xd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xd(e)}function eie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Tw(e,t)}function Tw(e,t){return Tw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Tw(e,t)}let wR=function(e){function t(n){var r;Gne(this,t),r=Zne(this,t,[n]),r.localTracks=xa.filter(s=>s.local&&!s.hidden).map(s=>{const c={...s};return c.datatype=s.datatype[0],c}),r.augmentedTracksInfo=xa,window.higlassTracksByType&&Object.keys(window.higlassTracksByType).forEach(s=>{r.augmentedTracksInfo.push(window.higlassTracksByType[s].config)}),n.datatype?r.localTracks=r.localTracks.filter(s=>s.datatype[0]===n.datatype):r.localTracks=r.localTracks.filter(s=>s.orientation===r.props.orientation),r.localTracks.forEach(s=>{s.uuid=Mt.nice()});const i=r.prepareNewEntries("",r.localTracks,{}),o=Object.keys(i),a=o.length?[o[0]]:null;return r.mounted=!1,r.state={selectedUuid:a,options:i,filter:"",checked:[],expanded:[]},r.requestTilesetLists(),r}return eie(t,e),Yne(t,[{key:"componentDidMount",value:function(){this.mounted=!0,this.requestTilesetLists(),this.searchBox.focus()}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"prepareNewEntries",value:function(r,i,o){const a=o;return i.map(c=>({...c,server:r,tilesetUid:c.uuid,serverUidKey:this.serverUidKey(r,c.uuid),datatype:c.datatype,name:c.name,uid:Mt.nice()})).forEach(c=>{a[c.serverUidKey]=c}),a}},{key:"serverUidKey",value:function(r,i){return`${r}/${i}`}},{key:"requestTilesetLists",value:function(){let r=null;if(this.props.datatype?r=`dt=${this.props.datatype}`:r=[...new Set([].concat(...this.augmentedTracksInfo.filter(o=>o.datatype).filter(o=>o.orientation===this.props.orientation||this.props.orientation==="1d-vertical"&&o.orientation==="1d-horizontal").map(o=>o.datatype)))].map(o=>`dt=${o}`).join("&"),!this.props.trackSourceServers){console.warn("No track source servers specified in the viewconf");return}this.props.trackSourceServers.forEach(i=>{wt.json(`${i}/tilesets/?limit=10000&${r}`,(o,a)=>{if(o)console.error("ERROR:",o);else{const s=this.prepareNewEntries(i,a.results,this.state.options),c=Object.keys(s);let{selectedUuid:l}=this.state;if(!l){l=c.length?[c[0]]:null;const u=this.state.options[l[0]];this.props.selectedTilesetChanged([u])}this.mounted&&this.setState({selectedUuid:l,options:s})}},this.props.pubSub)})}},{key:"handleOptionDoubleClick",value:function(r){const i=this.state.options[r.target.value];this.props.onDoubleClick(i)}},{key:"handleSelectedOptions",value:function(r){const i=[],o=[];for(let a=0;a<r.length;a++)i.push(r[a]),o.push(this.state.options[r[a]]);this.props.selectedTilesetChanged(o),this.setState({selectedUuid:i})}},{key:"handleSelect",value:function(){const{selectedOptions:r}=this.multiSelect,i=[];for(let o=0;o<r.length;o++){const a=r[o];i.push(a.value)}this.handleSelectedOptions(i)}},{key:"handleSearchChange",value:function(){const r=this.searchBox;this.setState({filter:r.value})}},{key:"partitionByGroup",value:function(r,i){const o={"":{name:"",value:"",children:[]}};for(const s of Object.keys(r)){const c=r[s];if(c.name.toLowerCase().includes(i))if("project_name"in c){const l=c.project_name;l in o||(o[l]={value:l,label:l,children:[]}),o[l].children.push({label:c.name,value:s})}else o[""].children.push({label:c.name,value:s})}const a=o[""].children;for(const s of Object.keys(o))s!==""&&(o[s].children.sort((c,l)=>c.label.toLowerCase().localeCompare(l.label.toLowerCase(),"en")),a.push(o[s]));return a.sort((s,c)=>s.label.toLowerCase().localeCompare(c.label.toLowerCase(),"en")),a}},{key:"handleChecked",value:function(r){this.handleSelectedOptions(r),this.setState({checked:r})}},{key:"handleExpanded",value:function(r){this.setState({expanded:r})}},{key:"render",value:function(){const r=[];for(const c in this.state.options)r.push(this.state.options[c]);const i=this.partitionByGroup(this.state.options,this.state.filter),o={width:15,height:15,top:2,right:2,position:"relative"},a=JSON.parse(JSON.stringify(o));a.opacity=.5;const s=x.createElement("form",{onSubmit:c=>{c.preventDefault()}},x.createElement("div",{className:"tileset-finder-search-bar"},x.createElement("span",{className:"tileset-finder-label"},"Select tileset:"),x.createElement("input",{ref:c=>{this.searchBox=c},className:"tileset-finder-search-box",onChange:this.handleSearchChange.bind(this),placeholder:"Search Term",type:"text"})),x.createElement("div",{className:"tileset-finder-checkbox-tree"},x.createElement(Vne,{checked:this.state.checked,expanded:this.state.expanded,icons:{uncheck:x.createElement("svg",{style:o},x.createElement("title",null,"Uncheck"),x.createElement("use",{xlinkHref:"#square_o"})),check:x.createElement("svg",{style:o},x.createElement("title",null,"Check"),x.createElement("use",{xlinkHref:"#check_square_o"})),halfCheck:x.createElement("svg",{style:a},x.createElement("title",null,"Half Check"),x.createElement("use",{xlinkHref:"#check_square_o"})),leaf:x.createElement("svg",{style:o},x.createElement("title",null,"Leaf"),x.createElement("use",{xlinkHref:"#file_o"})),expandClose:x.createElement("svg",{style:o},x.createElement("title",null,"Expand Close"),x.createElement("use",{xlinkHref:"#chevron_right"})),expandOpen:x.createElement("svg",{style:o},x.createElement("title",null,"Expand Open "),x.createElement("use",{xlinkHref:"#chevron_down"})),parentClose:x.createElement("svg",{style:o},x.createElement("title",null,"Parent Close"),x.createElement("use",{xlinkHref:"#folder_o"})),parentOpen:x.createElement("svg",{style:o},x.createElement("title",null,"Parent Open"),x.createElement("use",{xlinkHref:"#folder_open_o"}))},nodes:i,onCheck:this.handleChecked.bind(this),onExpand:this.handleExpanded.bind(this)})));return x.createElement("div",null,s)}}])}(x.Component);wR.propTypes={datatype:q.string,orientation:q.string,onDoubleClick:q.func,pubSub:q.object.isRequired,selectedTilesetChanged:q.func,trackSourceServers:q.array};const tie=tl(wR);function rie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,oie(r.key),r)}}function iie(e,t,n){return t&&nie(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function oie(e){var t=aie(e,"string");return typeof t=="symbol"?t:t+""}function aie(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function sie(e,t,n){return t=Kd(t),lie(e,SR()?Reflect.construct(t,n||[],Kd(e).constructor):t.apply(e,n))}function lie(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cie(e)}function cie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function SR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(SR=function(){return!!e})()}function Kd(e){return Kd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kd(e)}function uie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ww(e,t)}function ww(e,t){return ww=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ww(e,t)}let Zd=function(e){function t(n){var r;return rie(this,t),r=sie(this,t,[n]),r.options={},r.state={selectedTilesets:[{datatype:"none"}],allTracksSameDatatype:!0},r.handleSubmitBound=r.handleSubmit.bind(r),r.handleTilesetPickerDoubleClickBound=r.handleTilesetPickerDoubleClick.bind(r),r.selectedTilesetsChangedBound=r.selectedTilesetsChanged.bind(r),r}return uie(t,e),iie(t,[{key:"getOrientation",value:function(r){let i=null;return r==="top"||r==="bottom"?i="1d-horizontal":r==="left"||r==="right"?i="1d-vertical":i="2d",i}},{key:"handleSubmit",value:function(r){r&&r.preventDefault(),this.props.onTracksChosen(this.state.selectedTilesets,this.props.position,this.props.extent,this.props.host)}},{key:"handleTilesetPickerDoubleClick",value:function(r){this.selectedTilesetsChanged([r]),this.props.onTracksChosen(this.state.selectedTilesets,this.props.position,this.props.extent,this.props.host)}},{key:"handleOptionsChanged",value:function(r){this.options=r}},{key:"handlePlotTypeSelected",value:function(r){const{selectedTilesets:i}=this.state;for(const o of i)o.type=r;this.selectedPlotType=r,this.setState({selectedTilesets:i})}},{key:"selectedTilesetsChanged",value:function(r){let i=null;r.length===0?i=[{datatype:"none"}]:i=r;let o=!0;const a=i[0].datatype;for(const s of i)s.datatype!==a&&(o=!1);if(o)for(const s of i)s.type=this.selectedPlotType;else for(const s of i){let c=[s.datatype];const l=this.getOrientation(this.props.position);s.filetype==="cooler"&&(c=[s.datatype,"chromsizes"]);const u=Rp([c],l),f=g0(c[0],this.props.position,u);s.type=f.type}this.setState({selectedTilesets:i,allTracksSameDatatype:o})}},{key:"render",value:function(){const r=this.getOrientation(this.props.position),i=x.createElement("div",null,x.createElement(tie,{ref:o=>{this.tilesetFinder=o},datatype:this.props.datatype,onDoubleClick:this.handleTilesetPickerDoubleClick.bind(this),onTracksChosen:o=>this.props.onTracksChosen(o,this.props.position,this.props.extent),orientation:r,selectedTilesetChanged:this.selectedTilesetsChanged.bind(this),trackSourceServers:this.props.trackSourceServers}));return x.createElement(yf,{maxHeight:!0,okayTitle:"Submit",onCancel:this.props.onCancel,onOkay:this.handleSubmitBound,title:"Add Track"},x.createElement(x.Fragment,null,i,x.createElement(bR,{ref:o=>{this.plotTypeChooser=o},allTracksSameDatatype:this.state.allTracksSameDatatype,datatypes:this.state.selectedTilesets.map(o=>o.filetype==="cooler"?[o.datatype,"chromsizes"]:[o.datatype]),onPlotTypeSelected:this.handlePlotTypeSelected.bind(this),orientation:r,position:this.props.position})))}}])}(x.Component);Zd.defaultProps={position:"top"},Zd.propTypes={datatype:q.string,extent:q.string,host:q.string,onCancel:q.func.isRequired,onTracksChosen:q.func.isRequired,position:q.string,trackSourceServers:q.array.isRequired};const{Provider:fie,Consumer:hie}=x.createContext(V4);function sl(e){return x.forwardRef((t,n)=>x.createElement(hie,null,r=>x.createElement(e,{ref:n,...t,theme:r})))}const Wo={"track-control":"_track-control_w7hx2_1","track-control-vertical":"_track-control-vertical_w7hx2_2","track-control-dark":"_track-control-dark_w7hx2_15","track-control-active":"_track-control-active_w7hx2_16 _track-control_w7hx2_1","track-control-left":"_track-control-left_w7hx2_24","track-control-padding-right":"_track-control-padding-right_w7hx2_48","track-control-button":"_track-control-button_w7hx2_52","track-control-button-vertical":"_track-control-button-vertical_w7hx2_81"};function Sw(){return Sw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sw.apply(null,arguments)}const pie=e=>$t({[Wo["track-control-active"]]:e.isVisible,[Wo["track-control"]]:!e.isVisible,[Wo["track-control-left"]]:e.isAlignLeft,[Wo["track-control-vertical"]]:e.isVertical,[Wo["track-control-padding-right"]]:e.paddingRight,[Wo["track-control-dark"]]:e.theme===Qt}),ll=e=>$t("no-zoom",Wo["track-control-button"],{[Wo["track-control-button-vertical"]]:e.isVertical});function ER(e){const{dragHandleProps:t}=e;let n,r;return x.createElement("div",{className:pie(e)},e.isMoveable&&x.createElement("svg",Sw({className:ll(e),draggable:!1,style:{height:"20px",width:"20px",...e.imgStyleMove}},t),x.createElement("title",null,"Move track"),x.createElement("use",{xlinkHref:"#move"})),e.expandCollapseAvailable&&!e.isCollapsed&&x.createElement("svg",{ref:i=>{n=i},className:ll(e),onClick:()=>{e.onCollapseTrack(e.uid)},style:{height:"20px",width:"20px",...e.imgStyleSettings}},x.createElement("title",null,"Collapse track"),x.createElement("use",{xlinkHref:"#collapse"})),e.expandCollapseAvailable&&e.isCollapsed&&x.createElement("svg",{ref:i=>{n=i},className:ll(e),onClick:()=>{e.onExpandTrack(e.uid)},style:{height:"20px",width:"20px",...e.imgStyleSettings}},x.createElement("title",null,"Expand track"),x.createElement("use",{xlinkHref:"#expand"})),x.createElement("svg",{ref:i=>{n=i},className:ll(e),onClick:()=>{e.onConfigTrackMenuOpened(e.uid,n.getBoundingClientRect())},style:{height:"20px",width:"20px",...e.imgStyleSettings}},x.createElement("title",null,"Configure track"),x.createElement("use",{xlinkHref:"#cog"})),e.onAddSeries&&x.createElement("svg",{className:ll(e),onClick:()=>e.onAddSeries(e.uid),style:{height:"20px",width:"20px",...e.imgStyleAdd}},x.createElement("title",null,"Add series"),x.createElement("use",{xlinkHref:"#plus"})),x.createElement("svg",{ref:i=>{r=i},className:ll(e),onClick:()=>{e.onCloseTrackMenuOpened(e.uid,r.getBoundingClientRect())},style:{height:"20px",width:"20px",...e.imgStyleClose}},x.createElement("title",null,"Close track"),x.createElement("use",{xlinkHref:"#cross"})))}ER.propTypes={imgStyleAdd:q.object,imgStyleClose:q.object,imgStyleMove:q.object,imgStyleSettings:q.object,isAlignLeft:q.bool,isMoveable:q.bool,isVertical:q.bool,isVisible:q.bool,onCollapseTrack:q.func,onExpandTrack:q.func,onConfigTrackMenuOpened:q.func,onCloseTrackMenuOpened:q.func,onAddSeries:q.func,paddingRight:q.bool,theme:q.symbol.isRequired,uid:q.string};const Qd=sl(ER),Ew={"center-track":"_center-track_fiu64_1","center-track-container":"_center-track-container_fiu64_6"},gi={"track-range-selection":"_track-range-selection_5bcsr_1","track-range-selection-active":"_track-range-selection-active_5bcsr_8 _track-range-selection_5bcsr_1","track-range-selection-active-primary":"_track-range-selection-active-primary_5bcsr_14 _track-range-selection-active_5bcsr_8 _track-range-selection_5bcsr_1","track-range-selection-active-secondary":"_track-range-selection-active-secondary_5bcsr_18 _track-range-selection-active_5bcsr_8 _track-range-selection_5bcsr_1","track-range-selection-group-inactive":"_track-range-selection-group-inactive_5bcsr_22","track-range-selection-group-brush-selection":"_track-range-selection-group-brush-selection_5bcsr_26"};function die(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,vie(r.key),r)}}function mie(e,t,n){return t&&gie(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function vie(e){var t=yie(e,"string");return typeof t=="symbol"?t:t+""}function yie(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function bie(e,t,n){return t=Jd(t),_ie(e,kR()?Reflect.construct(t,n||[],Jd(e).constructor):t.apply(e,n))}function _ie(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Tie(e)}function Tie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kR=function(){return!!e})()}function Jd(e){return Jd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Jd(e)}function wie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&kw(e,t)}function kw(e,t){return kw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},kw(e,t)}const e1={pointerEvents:"all"};function cl(e){return e?.sourceEvent}let xw=function(e){function t(n){var r;return die(this,t),r=bie(this,t,[n]),r.state={isVisible:!1},r.brushBehaviorX=ol().on("brush",r.brushedX.bind(r)).on("end",r.brushedXEnded.bind(r)),r.brushBehaviorY=al().on("brush",r.brushedY.bind(r)).on("end",r.brushedYEnded.bind(r)),r.brushBehaviorXY=Wd().on("start",r.brushStarted.bind(r)).on("brush",r.brushedXY.bind(r)).on("end",r.brushedXYEnded.bind(r)),r}return wie(t,e),mie(t,[{key:"componentDidMount",value:function(){this.props.isRangeSelectionActive&&this.addBrush2d()}},{key:"shouldComponentUpdate",value:function(r,i){if(this.rangeSelectionTriggeredXY){if(this.rangeSelectionTriggeredXY=!1,this.rangeSelectionTriggeredXYEnd){const o=r.rangeSelection[0]||null;this.moveBrushXY([o,r.rangeSelection[1]],!0),this.rangeSelectionTriggeredXYEnd=!1}return this.state!==i}if(this.props.rangeSelection!==r.rangeSelection){const o=r.rangeSelection[0]||null;this.props.is1dRangeSelection?(this.rangeSelectionTriggeredX||this.moveBrushX(o,r.rangeSelectionEnd),this.rangeSelectionTriggeredXEnd&&this.moveBrushX(o,r.rangeSelectionEnd,!0),this.rangeSelectionTriggeredY||this.moveBrushY(o,r.rangeSelectionEnd),this.rangeSelectionTriggeredYEnd&&this.moveBrushY(o,r.rangeSelectionEnd,!0),this.rangeSelectionTriggeredX=!1,this.rangeSelectionTriggeredXEnd=!1,this.rangeSelectionTriggeredY=!1,this.rangeSelectionTriggeredYEnd=!1):this.moveBrushXY([o,r.rangeSelection[1]],r.rangeSelectionEnd);const a=this.props.is1dRangeSelection&&!r.is1dRangeSelection&&o===null;return this.state!==i||a}return!0}},{key:"componentDidUpdate",value:function(){this.props.isRangeSelectionActive?this.addBrush2d():(this.removeBrush1d(),this.removeBrush2d())}},{key:"addBrush1d",value:function(){!this.brushElX||!this.brushElY||this.brushElXOld===this.brushElX&&this.brushElYOld===this.brushElY||(this.brushElXOld&&this.brushElXOld.on(".brush",null),this.brushElYOld&&this.brushElYOld.on(".brush",null),this.brushElX.call(this.brushBehaviorX),this.brushElY.call(this.brushBehaviorY),Ls(this.brushElX,gi["track-range-selection-group-brush-selection"]),Ls(this.brushElY,gi["track-range-selection-group-brush-selection"]),this.brushElXOld=this.brushElX,this.brushElYOld=this.brushElY,this.brushIs1dBound=!0)}},{key:"addBrush2d",value:function(){!this.brushElXY||this.brushElXYOld===this.brushElXY||(this.brushElXYOld&&this.brushElXYOld.on(".brush",null),this.brushElXY.call(this.brushBehaviorXY),this.brushElXYOld=this.brushElXY,this.brushIs2dBound=!0,Ls(this.brushElXY,gi["track-range-selection-group-brush-selection"]))}},{key:"brushedX",value:function(r){const i=this.rangeSelectionMoved;this.rangeSelectionMoved=!1,!(!cl(r)||!this.props.onRangeSelectionX||!this.props.is1dRangeSelection||i)&&(this.rangeSelectionTriggeredX=!0,this.props.onRangeSelectionX(r.selection))}},{key:"brushedXEnded",value:function(r){const i=this.rangeSelectionMovedEnd;this.rangeSelectionMovedEnd=!1,!(!cl(r)||!this.props.onRangeSelectionX||!this.props.is1dRangeSelection||i)&&(this.rangeSelectionTriggeredX=!0,this.rangeSelectionTriggeredXEnd=!0,this.props.onRangeSelectionXEnd(r.selection))}},{key:"brushedY",value:function(r){const i=this.rangeSelectionMoved;this.rangeSelectionMoved=!1,!(!cl(r)||!this.props.onRangeSelectionY||!this.props.is1dRangeSelection||i)&&(this.rangeSelectionTriggeredY=!0,this.props.onRangeSelectionY(r.selection))}},{key:"brushedYEnded",value:function(r){const i=this.rangeSelectionMovedEnd;this.rangeSelectionMovedEnd=!1,!(!cl(r)||!this.props.onRangeSelectionY||!this.props.is1dRangeSelection||i)&&(this.rangeSelectionTriggeredY=!0,this.rangeSelectionTriggeredYEnd=!0,this.props.onRangeSelectionYEnd(r.selection))}},{key:"brushedXY",value:function(r){const i=this.rangeSelectionMoved;this.rangeSelectionMoved=!1,!(!cl(r)||!this.props.onRangeSelectionXY||i||this.props.is1dRangeSelection)&&(this.rangeSelectionTriggeredXY=!0,this.props.onRangeSelectionXY([[r.selection[0][0],r.selection[1][0]],[r.selection[0][1],r.selection[1][1]]]))}},{key:"brushedXYEnded",value:function(r){if(this.props.is1dRangeSelection)return;const i=this.rangeSelectionMovedEnd;this.rangeSelectionMovedEnd=!1,r.selection&&r.sourceEvent&&this.props.onRangeSelectionXY&&!i&&(this.rangeSelectionTriggeredXY=!0,this.rangeSelectionTriggeredXYEnd=!0,this.props.onRangeSelectionXYEnd([[r.selection[0][0],r.selection[1][0]],[r.selection[0][1],r.selection[1][1]]])),r.selection||(this.rangeSelectionTriggeredXY=!0,this.props.onRangeSelectionReset())}},{key:"brushStarted",value:function(r){cl(r)&&this.props.onRangeSelectionStart()}},{key:"moveBrushX",value:function(r,i=!1){if(!this.brushEl)return;this.brushIs2dBound&&(this.removeBrush2d(),this.addBrush1d());const o=r?[this.props.scaleX(r[0]),this.props.scaleX(r[1])]:null;this.rangeSelectionMoved=!0,this.rangeSelectionMovedEnd=!0,i?this.brushElX.transition().call(this.brushBehaviorX.move,o):this.brushElX.call(this.brushBehaviorX.move,o)}},{key:"moveBrushY",value:function(r,i=!1){if(!this.brushEl)return;this.brushIs2dBound&&(this.removeBrush2d(),this.addBrush1d());const o=r?[this.props.scaleY(r[0]),this.props.scaleY(r[1])]:null;this.rangeSelectionMoved=!0,this.rangeSelectionMovedEnd=!0,i?this.brushElY.transition().call(this.brushBehaviorY.move,o):this.brushElY.call(this.brushBehaviorY.move,o)}},{key:"moveBrushXY",value:function(r,i=!1){if(!this.brushEl)return;const o=[[this.props.scaleX(r[0][0]),this.props.scaleY(r[1][0])],[this.props.scaleX(r[0][1]),this.props.scaleY(r[1][1])]];this.rangeSelectionMoved=!0,this.rangeSelectionMovedEnd=!0,i?this.brushElXY.transition().call(this.brushBehaviorXY.move,o):this.brushElXY.call(this.brushBehaviorXY.move,o)}},{key:"mouseEnterHandler",value:function(){this.props.isRangeSelectionActive||this.setState({isVisible:!0})}},{key:"mouseLeaveHandler",value:function(){this.setState({isVisible:!1})}},{key:"removeBrush1d",value:function(){this.brushIs1dBound&&(this.brushElX&&(this.brushElX.call(this.brushBehaviorX.move,null),this.brushElX.on(".brush",null)),this.brushElY&&(this.brushElY.call(this.brushBehaviorY.move,null),this.brushElY.on(".brush",null)),this.brushIs1dBound=!1)}},{key:"removeBrush2d",value:function(){this.brushIs2dBound&&this.brushElXY&&(this.brushElXY.call(this.brushBehaviorXY.move,null),this.brushElXY.on(".brush",null),this.brushElXYOld=void 0,this.brushIs2dBound=!1,this.props.is1dRangeSelection||this.props.onRangeSelectionReset())}},{key:"render",value:function(){const r=this.props.tracks.map(c=>$s(c)).reduce(Iu,!1),i=this.props.tracks.some(c=>c.contents?c.contents.some(l=>l.type==="heatmap"?l.options.colorbarPosition==="topRight":!1):c.type==="heatmap"?c.options.colorbarPosition==="topRight":!1);let o="track-range-selection";this.props.isRangeSelectionActive&&(o+=this.props.is1dRangeSelection?"-active-secondary":"-active-primary");const a=$t(!this.props.is1dRangeSelection&&gi["track-range-selection-group-inactive"]),s=$t(this.props.is1dRangeSelection&&gi["track-range-selection-group-inactive"]);return x.createElement("div",{className:$t(this.props.className,Ew["center-track"]),onMouseEnter:this.mouseEnterHandler.bind(this),onMouseLeave:this.mouseLeaveHandler.bind(this),style:{height:this.props.height,width:this.props.width}},r&&x.createElement("svg",{className:gi[o],style:{height:this.props.height,width:this.props.width},xmlns:"http://www.w3.org/2000/svg"},x.createElement("title",null,"Range Selection Brush"),x.createElement("g",{ref:c=>{this.brushElX=_t(c)},className:a}),x.createElement("g",{ref:c=>{this.brushElY=_t(c)},className:a}),x.createElement("g",{ref:c=>{this.brushElXY=_t(c)},className:s})),this.props.editable&&x.createElement(Qd,{expandCollapseAvailable:!1,imgStyleAdd:e1,imgStyleClose:e1,imgStyleMove:e1,imgStyleSettings:e1,isMoveable:!1,isVisible:this.state.isVisible||this.props.uid===this.props.configTrackMenuId,onAddSeries:this.props.onAddSeries,onCloseTrackMenuOpened:this.props.onCloseTrackMenuOpened,onConfigTrackMenuOpened:this.props.onConfigTrackMenuOpened,paddingRight:i,uid:this.props.uid}))}}])}(x.Component);xw.defaultProps={className:"center-track",configTrackMenuId:null,is1dRangeSelection:!1,rangeSelectionEnd:q.bool,isRangeSelectionActive:!1,scaleX:e=>e,scaleY:e=>e},xw.propTypes={className:q.string,configTrackMenuId:q.string,editable:q.bool,height:q.number.isRequired,is1dRangeSelection:q.bool,isRangeSelectionActive:q.bool,onAddSeries:q.func.isRequired,onCloseTrackMenuOpened:q.func.isRequired,onConfigTrackMenuOpened:q.func.isRequired,onRangeSelectionX:q.func.isRequired,onRangeSelectionXEnd:q.func.isRequired,onRangeSelectionY:q.func.isRequired,onRangeSelectionYEnd:q.func.isRequired,onRangeSelectionXY:q.func.isRequired,onRangeSelectionXYEnd:q.func.isRequired,onRangeSelectionReset:q.func.isRequired,onRangeSelectionStart:q.func.isRequired,rangeSelection:q.array.isRequired,rangeSelectionEnd:q.bool,scaleX:q.func,scaleY:q.func,tracks:q.array.isRequired,uid:q.string.isRequired,width:q.number.isRequired};const yt={"context-menu":"_context-menu_18ock_1","context-menu-dark":"_context-menu-dark_18ock_12","context-menu-icon":"_context-menu-icon_18ock_17","context-menu-item":"_context-menu-item_18ock_27","context-menu-hr":"_context-menu-hr_18ock_38","play-icon":"_play-icon_18ock_45","context-menu-span":"_context-menu-span_18ock_52"};function xt({onMouseEnter:e=()=>{},onMouseLeave:t=()=>{},onClick:n,className:r,children:i}){return x.createElement("div",{"data-menu-item-for":typeof i=="string"?i:null,className:$t(yt["context-menu-item"],r),onClick:o=>n(o),onMouseEnter:o=>e(o),onMouseLeave:o=>t(o),role:"button",tabIndex:0},x.createElement("span",{className:yt["context-menu-span"]},i))}xt.propTypes={children:q.node.isRequired,onClick:q.func.isRequired,onMouseEnter:q.func,onMouseLeave:q.func};const xR=e=>{let t=[];for(const n of e)n.contents?t=t.concat(n.contents):t.push(n);return t},Cw=(e,t,n,r)=>e?(window.higlassTracksByType&&Object.keys(window.higlassTracksByType).forEach(i=>{Gt[i]=window.higlassTracksByType[i].config}),xR(e).map(i=>{const o=Gt[i.type]?Gt[i.type].thumbnail:null,a=o?x.createElement("div",{className:yt["context-menu-icon"],dangerouslySetInnerHTML:{__html:o.outerHTML}}):x.createElement("div",{className:yt["context-menu-icon"]},x.createElement("svg",null));return x.createElement(xt,{key:i.uid,className:yt["context-menu-item"],onClick:()=>{r&&r(i.uid)},onMouseEnter:s=>{t&&t(s,i)},onMouseLeave:s=>{n&&n(s)}},a,x.createElement("span",{className:yt["context-menu-span"]},i.options?.name?.length?i.options.name:i.type,t&&n?x.createElement("svg",{className:yt["play-icon"]},x.createElement("title",null,"Play"),x.createElement("use",{xlinkHref:"#play"})):null))})):null;function CR(e){return x.createElement("div",null,Cw(e.tracks,null,null,e.onCloseTrack),x.createElement("hr",{className:yt["context-menu-hr"]}),x.createElement(xt,{onClick:()=>e.onCloseTrack(e.tracks[0].uid)},"Close all series"))}CR.propTypes={onCloseTrack:q.func.isRequired,tracks:q.array.isRequired};function OR(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Eie(r.key),r)}}function PR(e,t,n){return t&&Sie(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Eie(e){var t=kie(e,"string");return typeof t=="symbol"?t:t+""}function kie(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}const Ow="__mixwith_appliedMixin",Pw="__mixwith_wrappedMixin",AR=e=>e[Pw]||e,xie=(e,t)=>{const n=t(e);return n.prototype[Ow]=AR(t),n},Cie=(e,t)=>e.hasOwnProperty(Ow)&&e[Ow]===AR(t),Oie=(e,t)=>{for(;e!==null;){if(Cie(e,t))return!0;e=Object.getPrototypeOf(e)}return!1},Aw=(e,t)=>(Object.setPrototypeOf(t,e),e[Pw]||(e[Pw]=e),t),Mw="__mixwith_cachedApplications",Pie=e=>Aw(e,t=>{let n=t[Mw];n||(t[Mw]=new Map,n=t[Mw]);let r=n.get(e);return r||(r=e(t),n.set(e,r)),r}),Aie=e=>Aw(e,t=>Oie(t.prototype,e)?t:e(t)),Mie=e=>Aw(e,t=>xie(t,e)),t1=e=>Aie(Pie(Mie(e)));let Iie=function(){function e(t){OR(this,e),this.superclass=t||PR(function n(){OR(this,n)})}return PR(e,[{key:"with",value:function(...n){return n.reduce((r,i)=>i(r),this.superclass)}}])}();const ul=e=>new Iie(e);function Rie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Die(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Lie(r.key),r)}}function Nie(e,t,n){return t&&Die(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lie(e){var t=$ie(e,"string");return typeof t=="symbol"?t:t+""}function $ie(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function jie(e,t,n){return t=r1(t),Bie(e,MR()?Reflect.construct(t,n||[],r1(e).constructor):t.apply(e,n))}function Bie(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zie(e)}function zie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function MR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(MR=function(){return!!e})()}function r1(e){return r1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},r1(e)}function Hie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Iw(e,t)}function Iw(e,t){return Iw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Iw(e,t)}const IR=20;let Yo=function(e){function t(n){var r;return Rie(this,t),r=jie(this,t,[n]),r.adjusted=!1,r.state={orientation:r.props.orientation?r.props.orientation:"right",left:r.props.position.left,top:r.props.position.top,submenuShown:null},r}return Hie(t,e),Nie(t,[{key:"componentDidMount",value:function(){this.updateOrientation()}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){this.adjusted=!1,this.setState({left:r.position.left,top:r.position.top})}},{key:"componentDidUpdate",value:function(){this.updateOrientation()}},{key:"handleItemMouseEnterWithRect",value:function(r,i){this.setState({submenuShown:i,submenuSourceBbox:r})}},{key:"handleItemMouseEnter",value:function(r,i){this.handleItemMouseEnterWithRect(r.currentTarget.getBoundingClientRect(),i)}},{key:"handleMouseLeave",value:function(){}},{key:"handleOtherMouseEnter",value:function(){this.setState({submenuShown:null})}},{key:"updateOrientation",value:function(){if(this.adjusted)return;this.adjusted=!0;const r=this.div.getBoundingClientRect(),i=this.props.parentBbox?this.props.parentBbox:{top:this.props.position.top,left:this.props.position.left,width:0};let o=this.state.orientation,a=i.top;if(i.top+r.height>window.innerHeight&&(i.top-r.height>0?a=i.top-r.height+IR:(a=i.top-r.height+IR,a-=a+r.height-window.innerHeight)),this.state.orientation==="left"){let s=i.left-r.width;s<0&&(i.left+i.width+r.width>window.innerWidth?s=0:(s=i.left+i.width,o="right")),this.setState({left:s,top:a,orientation:o})}else{let s=i.left+i.width;i.left+i.width+r.width>window.innerWidth&&(i.left-r.width<0?(s=0,o="right"):(s=i.left-r.width,o="left")),this.setState({left:s,top:a,orientation:o})}}},{key:"render",value:function(){const r=this.state.left?{left:this.state.left}:{right:this.state.right},i={top:this.state.top},o=Object.assign(r,i);return x.createElement("div",{ref:a=>{this.div=a},className:$t("context-menu-item",yt["context-menu"],{[yt["context-menu-dark"]]:this.props.theme===Qt}),style:o},this.props.children)}}])}(x.Component);Yo.propTypes={children:q.node,orientation:q.string,parentBbox:q.object,position:q.object,theme:q.symbol.isRequired};function Fie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Vie(r.key),r)}}function Uie(e,t,n){return t&&qie(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vie(e){var t=Gie(e,"string");return typeof t=="symbol"?t:t+""}function Gie(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Wie(e,t,n){return t=n1(t),Yie(e,RR()?Reflect.construct(t,n||[],n1(e).constructor):t.apply(e,n))}function Yie(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xie(e)}function Xie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function RR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(RR=function(){return!!e})()}function n1(e){return n1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n1(e)}function Kie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Rw(e,t)}function Rw(e,t){return Rw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Rw(e,t)}let Dw=function(e){function t(){return Fie(this,t),Wie(this,t,arguments)}return Kie(t,e),Uie(t,[{key:"getSubmenu",value:function(){if(this.state.submenuShown){const r=this.state.submenuSourceBbox,i=this.state.orientation==="left"?{left:this.state.left,top:r.top}:{left:this.state.left+r.width+7,top:r.top},o=this.state.submenuShown;return x.createElement(t,{menuItems:o.children,orientation:this.state.orientation,parentBbox:r,position:i,theme:this.props.theme})}return x.createElement("div",null)}},{key:"componentWillUnmount",value:function(){}},{key:"render",value:function(){const r=[];for(const i in this.props.menuItems){const o=this.props.menuItems[i];r.push(x.createElement(xt,{key:i,onClick:o.handler?o.handler:()=>null,onMouseEnter:o.children?a=>this.handleItemMouseEnter(a,o):this.handleOtherMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave},o.name,o.children&&x.createElement("svg",{className:yt["play-icon"]},x.createElement("title",null,"Play"),x.createElement("use",{xlinkHref:"#play"}))))}return x.createElement("div",{ref:i=>{this.div=i},className:$t(yt["context-menu"],{[yt["context-menu-dark"]]:this.props.theme===Qt}),style:{left:this.state.left,top:this.state.top}},r,this.getSubmenu())}}])}(Yo);var En={},fl={},DR=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,Zie=typeof self=="object"&&self&&self.Object===Object&&self,mi=DR||Zie||Function("return this")(),Bi=mi.Symbol,NR=Object.prototype,Qie=NR.hasOwnProperty,Jie=NR.toString,xf=Bi?Bi.toStringTag:void 0;function eoe(e){var t=Qie.call(e,xf),n=e[xf];try{e[xf]=void 0;var r=!0}catch{}var i=Jie.call(e);return r&&(t?e[xf]=n:delete e[xf]),i}var toe=Object.prototype,roe=toe.toString;function noe(e){return roe.call(e)}var ioe="[object Null]",ooe="[object Undefined]",LR=Bi?Bi.toStringTag:void 0;function Xo(e){return e==null?e===void 0?ooe:ioe:LR&&LR in Object(e)?eoe(e):noe(e)}var cn=Array.isArray;function vi(e){return e!=null&&typeof e=="object"}var aoe="[object String]";function soe(e){return typeof e=="string"||!cn(e)&&vi(e)&&Xo(e)==aoe}const loe=Zi(Object.freeze(Object.defineProperty({__proto__:null,default:soe},Symbol.toStringTag,{value:"Module"})));function coe(e){return function(t,n,r){for(var i=-1,o=Object(t),a=r(t),s=a.length;s--;){var c=a[++i];if(n(o[c],c,o)===!1)break}return t}}var $R=coe();function uoe(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var foe="[object Arguments]";function jR(e){return vi(e)&&Xo(e)==foe}var BR=Object.prototype,hoe=BR.hasOwnProperty,poe=BR.propertyIsEnumerable,i1=jR(function(){return arguments}())?jR:function(e){return vi(e)&&hoe.call(e,"callee")&&!poe.call(e,"callee")};function doe(){return!1}var zR=typeof At=="object"&&At&&!At.nodeType&&At,HR=zR&&typeof module=="object"&&module&&!module.nodeType&&module,goe=HR&&HR.exports===zR,FR=goe?mi.Buffer:void 0,moe=FR?FR.isBuffer:void 0,Cf=moe||doe,voe=9007199254740991,yoe=/^(?:0|[1-9]\d*)$/;function Nw(e,t){var n=typeof e;return t=t??voe,!!t&&(n=="number"||n!="symbol"&&yoe.test(e))&&e>-1&&e%1==0&&e<t}var boe=9007199254740991;function Lw(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=boe}var _oe="[object Arguments]",Toe="[object Array]",woe="[object Boolean]",Soe="[object Date]",Eoe="[object Error]",koe="[object Function]",xoe="[object Map]",Coe="[object Number]",Ooe="[object Object]",Poe="[object RegExp]",Aoe="[object Set]",Moe="[object String]",Ioe="[object WeakMap]",Roe="[object ArrayBuffer]",Doe="[object DataView]",Noe="[object Float32Array]",Loe="[object Float64Array]",$oe="[object Int8Array]",joe="[object Int16Array]",Boe="[object Int32Array]",zoe="[object Uint8Array]",Hoe="[object Uint8ClampedArray]",Foe="[object Uint16Array]",qoe="[object Uint32Array]",nr={};nr[Noe]=nr[Loe]=nr[$oe]=nr[joe]=nr[Boe]=nr[zoe]=nr[Hoe]=nr[Foe]=nr[qoe]=!0,nr[_oe]=nr[Toe]=nr[Roe]=nr[woe]=nr[Doe]=nr[Soe]=nr[Eoe]=nr[koe]=nr[xoe]=nr[Coe]=nr[Ooe]=nr[Poe]=nr[Aoe]=nr[Moe]=nr[Ioe]=!1;function Uoe(e){return vi(e)&&Lw(e.length)&&!!nr[Xo(e)]}function $w(e){return function(t){return e(t)}}var qR=typeof At=="object"&&At&&!At.nodeType&&At,Of=qR&&typeof module=="object"&&module&&!module.nodeType&&module,Voe=Of&&Of.exports===qR,jw=Voe&&DR.process,hl=function(){try{var e=Of&&Of.require&&Of.require("util").types;return e||jw&&jw.binding&&jw.binding("util")}catch{}}(),UR=hl&&hl.isTypedArray,Bw=UR?$w(UR):Uoe,Goe=Object.prototype,Woe=Goe.hasOwnProperty;function VR(e,t){var n=cn(e),r=!n&&i1(e),i=!n&&!r&&Cf(e),o=!n&&!r&&!i&&Bw(e),a=n||r||i||o,s=a?uoe(e.length,String):[],c=s.length;for(var l in e)(t||Woe.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||Nw(l,c)))&&s.push(l);return s}var Yoe=Object.prototype;function zw(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Yoe;return e===n}function GR(e,t){return function(n){return e(t(n))}}var Xoe=GR(Object.keys,Object),Koe=Object.prototype,Zoe=Koe.hasOwnProperty;function Qoe(e){if(!zw(e))return Xoe(e);var t=[];for(var n in Object(e))Zoe.call(e,n)&&n!="constructor"&&t.push(n);return t}function $n(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Joe="[object AsyncFunction]",eae="[object Function]",tae="[object GeneratorFunction]",rae="[object Proxy]";function Hw(e){if(!$n(e))return!1;var t=Xo(e);return t==eae||t==tae||t==Joe||t==rae}function pl(e){return e!=null&&Lw(e.length)&&!Hw(e)}function Fw(e){return pl(e)?VR(e):Qoe(e)}function WR(e,t){return e&&$R(e,t,Fw)}function o1(e){return e}function YR(e){return typeof e=="function"?e:o1}function nae(e,t){return e&&WR(e,YR(t))}const qw=Zi(Object.freeze(Object.defineProperty({__proto__:null,default:nae},Symbol.toStringTag,{value:"Module"})));var XR=GR(Object.getPrototypeOf,Object),iae="[object Object]",oae=Function.prototype,aae=Object.prototype,KR=oae.toString,sae=aae.hasOwnProperty,lae=KR.call(Object);function ZR(e){if(!vi(e)||Xo(e)!=iae)return!1;var t=XR(e);if(t===null)return!0;var n=sae.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&KR.call(n)==lae}const cae=Zi(Object.freeze(Object.defineProperty({__proto__:null,default:ZR},Symbol.toStringTag,{value:"Module"})));function QR(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function uae(){this.__data__=[],this.size=0}function Pf(e,t){return e===t||e!==e&&t!==t}function a1(e,t){for(var n=e.length;n--;)if(Pf(e[n][0],t))return n;return-1}var fae=Array.prototype,hae=fae.splice;function pae(e){var t=this.__data__,n=a1(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():hae.call(t,n,1),--this.size,!0}function dae(e){var t=this.__data__,n=a1(t,e);return n<0?void 0:t[n][1]}function gae(e){return a1(this.__data__,e)>-1}function mae(e,t){var n=this.__data__,r=a1(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function To(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}To.prototype.clear=uae,To.prototype.delete=pae,To.prototype.get=dae,To.prototype.has=gae,To.prototype.set=mae;function vae(){this.__data__=new To,this.size=0}function yae(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function bae(e){return this.__data__.get(e)}function _ae(e){return this.__data__.has(e)}var Uw=mi["__core-js_shared__"],JR=function(){var e=/[^.]+$/.exec(Uw&&Uw.keys&&Uw.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Tae(e){return!!JR&&JR in e}var wae=Function.prototype,Sae=wae.toString;function Wa(e){if(e!=null){try{return Sae.call(e)}catch{}try{return e+""}catch{}}return""}var Eae=/[\\^$.*+?()[\]{}|]/g,kae=/^\[object .+?Constructor\]$/,xae=Function.prototype,Cae=Object.prototype,Oae=xae.toString,Pae=Cae.hasOwnProperty,Aae=RegExp("^"+Oae.call(Pae).replace(Eae,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Mae(e){if(!$n(e)||Tae(e))return!1;var t=Hw(e)?Aae:kae;return t.test(Wa(e))}function Iae(e,t){return e?.[t]}function Ya(e,t){var n=Iae(e,t);return Mae(n)?n:void 0}var Af=Ya(mi,"Map"),Mf=Ya(Object,"create");function Rae(){this.__data__=Mf?Mf(null):{},this.size=0}function Dae(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Nae="__lodash_hash_undefined__",Lae=Object.prototype,$ae=Lae.hasOwnProperty;function jae(e){var t=this.__data__;if(Mf){var n=t[e];return n===Nae?void 0:n}return $ae.call(t,e)?t[e]:void 0}var Bae=Object.prototype,zae=Bae.hasOwnProperty;function Hae(e){var t=this.__data__;return Mf?t[e]!==void 0:zae.call(t,e)}var Fae="__lodash_hash_undefined__";function qae(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Mf&&t===void 0?Fae:t,this}function Xa(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Xa.prototype.clear=Rae,Xa.prototype.delete=Dae,Xa.prototype.get=jae,Xa.prototype.has=Hae,Xa.prototype.set=qae;function Uae(){this.size=0,this.__data__={hash:new Xa,map:new(Af||To),string:new Xa}}function Vae(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function s1(e,t){var n=e.__data__;return Vae(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Gae(e){var t=s1(this,e).delete(e);return this.size-=t?1:0,t}function Wae(e){return s1(this,e).get(e)}function Yae(e){return s1(this,e).has(e)}function Xae(e,t){var n=s1(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function wo(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}wo.prototype.clear=Uae,wo.prototype.delete=Gae,wo.prototype.get=Wae,wo.prototype.has=Yae,wo.prototype.set=Xae;var Kae=200;function Zae(e,t){var n=this.__data__;if(n instanceof To){var r=n.__data__;if(!Af||r.length<Kae-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new wo(r)}return n.set(e,t),this.size=n.size,this}function yi(e){var t=this.__data__=new To(e);this.size=t.size}yi.prototype.clear=vae,yi.prototype.delete=yae,yi.prototype.get=bae,yi.prototype.has=_ae,yi.prototype.set=Zae;var Qae="__lodash_hash_undefined__";function Jae(e){return this.__data__.set(e,Qae),this}function ese(e){return this.__data__.has(e)}function l1(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new wo;++t<n;)this.add(e[t])}l1.prototype.add=l1.prototype.push=Jae,l1.prototype.has=ese;function tse(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function rse(e,t){return e.has(t)}var nse=1,ise=2;function eD(e,t,n,r,i,o){var a=n&nse,s=e.length,c=t.length;if(s!=c&&!(a&&c>s))return!1;var l=o.get(e),u=o.get(t);if(l&&u)return l==t&&u==e;var f=-1,h=!0,p=n&ise?new l1:void 0;for(o.set(e,t),o.set(t,e);++f<s;){var d=e[f],g=t[f];if(r)var y=a?r(g,d,f,t,e,o):r(d,g,f,e,t,o);if(y!==void 0){if(y)continue;h=!1;break}if(p){if(!tse(t,function(b,m){if(!rse(p,m)&&(d===b||i(d,b,n,r,o)))return p.push(m)})){h=!1;break}}else if(!(d===g||i(d,g,n,r,o))){h=!1;break}}return o.delete(e),o.delete(t),h}var c1=mi.Uint8Array;function ose(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function ase(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var sse=1,lse=2,cse="[object Boolean]",use="[object Date]",fse="[object Error]",hse="[object Map]",pse="[object Number]",dse="[object RegExp]",gse="[object Set]",mse="[object String]",vse="[object Symbol]",yse="[object ArrayBuffer]",bse="[object DataView]",tD=Bi?Bi.prototype:void 0,Vw=tD?tD.valueOf:void 0;function _se(e,t,n,r,i,o,a){switch(n){case bse:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case yse:return!(e.byteLength!=t.byteLength||!o(new c1(e),new c1(t)));case cse:case use:case pse:return Pf(+e,+t);case fse:return e.name==t.name&&e.message==t.message;case dse:case mse:return e==t+"";case hse:var s=ose;case gse:var c=r&sse;if(s||(s=ase),e.size!=t.size&&!c)return!1;var l=a.get(e);if(l)return l==t;r|=lse,a.set(e,t);var u=eD(s(e),s(t),r,i,o,a);return a.delete(e),u;case vse:if(Vw)return Vw.call(e)==Vw.call(t)}return!1}function Tse(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function wse(e,t,n){var r=t(e);return cn(e)?r:Tse(r,n(e))}function Sse(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}function Ese(){return[]}var kse=Object.prototype,xse=kse.propertyIsEnumerable,rD=Object.getOwnPropertySymbols,Cse=rD?function(e){return e==null?[]:(e=Object(e),Sse(rD(e),function(t){return xse.call(e,t)}))}:Ese;function Gw(e){return wse(e,Fw,Cse)}var Ose=1,Pse=Object.prototype,Ase=Pse.hasOwnProperty;function Mse(e,t,n,r,i,o){var a=n&Ose,s=Gw(e),c=s.length,l=Gw(t),u=l.length;if(c!=u&&!a)return!1;for(var f=c;f--;){var h=s[f];if(!(a?h in t:Ase.call(t,h)))return!1}var p=o.get(e),d=o.get(t);if(p&&d)return p==t&&d==e;var g=!0;o.set(e,t),o.set(t,e);for(var y=a;++f<c;){h=s[f];var b=e[h],m=t[h];if(r)var v=a?r(m,b,h,t,e,o):r(b,m,h,e,t,o);if(!(v===void 0?b===m||i(b,m,n,r,o):v)){g=!1;break}y||(y=h=="constructor")}if(g&&!y){var _=e.constructor,T=t.constructor;_!=T&&"constructor"in e&&"constructor"in t&&!(typeof _=="function"&&_ instanceof _&&typeof T=="function"&&T instanceof T)&&(g=!1)}return o.delete(e),o.delete(t),g}var Ww=Ya(mi,"DataView"),Yw=Ya(mi,"Promise"),Xw=Ya(mi,"Set"),Kw=Ya(mi,"WeakMap"),nD="[object Map]",Ise="[object Object]",iD="[object Promise]",oD="[object Set]",aD="[object WeakMap]",sD="[object DataView]",Rse=Wa(Ww),Dse=Wa(Af),Nse=Wa(Yw),Lse=Wa(Xw),$se=Wa(Kw),bi=Xo;(Ww&&bi(new Ww(new ArrayBuffer(1)))!=sD||Af&&bi(new Af)!=nD||Yw&&bi(Yw.resolve())!=iD||Xw&&bi(new Xw)!=oD||Kw&&bi(new Kw)!=aD)&&(bi=function(e){var t=Xo(e),n=t==Ise?e.constructor:void 0,r=n?Wa(n):"";if(r)switch(r){case Rse:return sD;case Dse:return nD;case Nse:return iD;case Lse:return oD;case $se:return aD}return t});var jse=1,lD="[object Arguments]",cD="[object Array]",u1="[object Object]",Bse=Object.prototype,uD=Bse.hasOwnProperty;function zse(e,t,n,r,i,o){var a=cn(e),s=cn(t),c=a?cD:bi(e),l=s?cD:bi(t);c=c==lD?u1:c,l=l==lD?u1:l;var u=c==u1,f=l==u1,h=c==l;if(h&&Cf(e)){if(!Cf(t))return!1;a=!0,u=!1}if(h&&!u)return o||(o=new yi),a||Bw(e)?eD(e,t,n,r,i,o):_se(e,t,c,n,r,i,o);if(!(n&jse)){var p=u&&uD.call(e,"__wrapped__"),d=f&&uD.call(t,"__wrapped__");if(p||d){var g=p?e.value():e,y=d?t.value():t;return o||(o=new yi),i(g,y,n,r,o)}}return h?(o||(o=new yi),Mse(e,t,n,r,i,o)):!1}function Zw(e,t,n,r,i){return e===t?!0:e==null||t==null||!vi(e)&&!vi(t)?e!==e&&t!==t:zse(e,t,n,r,Zw,i)}var Hse=1,Fse=2;function qse(e,t,n,r){var i=n.length,o=i;if(e==null)return!o;for(e=Object(e);i--;){var a=n[i];if(a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){a=n[i];var s=a[0],c=e[s],l=a[1];if(a[2]){if(c===void 0&&!(s in e))return!1}else{var u=new yi,f;if(!(f===void 0?Zw(l,c,Hse|Fse,r,u):f))return!1}}return!0}function fD(e){return e===e&&!$n(e)}function Use(e){for(var t=Fw(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,fD(i)]}return t}function hD(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function Vse(e){var t=Use(e);return t.length==1&&t[0][2]?hD(t[0][0],t[0][1]):function(n){return n===e||qse(n,e,t)}}var Gse="[object Symbol]";function f1(e){return typeof e=="symbol"||vi(e)&&Xo(e)==Gse}var Wse=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Yse=/^\w*$/;function Qw(e,t){if(cn(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||f1(e)?!0:Yse.test(e)||!Wse.test(e)||t!=null&&e in Object(t)}var Xse="Expected a function";function Jw(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Xse);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Jw.Cache||wo),n}Jw.Cache=wo;var Kse=500;function Zse(e){var t=Jw(e,function(r){return n.size===Kse&&n.clear(),r}),n=t.cache;return t}var Qse=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Jse=/\\(\\)?/g,ele=Zse(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Qse,function(n,r,i,o){t.push(i?o.replace(Jse,"$1"):r||n)}),t}),pD=Bi?Bi.prototype:void 0,dD=pD?pD.toString:void 0;function gD(e){if(typeof e=="string")return e;if(cn(e))return QR(e,gD)+"";if(f1(e))return dD?dD.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function tle(e){return e==null?"":gD(e)}function mD(e,t){return cn(e)?e:Qw(e,t)?[e]:ele(tle(e))}function h1(e){if(typeof e=="string"||f1(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function vD(e,t){t=mD(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[h1(t[n++])];return n&&n==r?e:void 0}function rle(e,t,n){var r=e==null?void 0:vD(e,t);return r===void 0?n:r}function nle(e,t){return e!=null&&t in Object(e)}function ile(e,t,n){t=mD(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var a=h1(t[r]);if(!(o=e!=null&&n(e,a)))break;e=e[a]}return o||++r!=i?o:(i=e==null?0:e.length,!!i&&Lw(i)&&Nw(a,i)&&(cn(e)||i1(e)))}function ole(e,t){return e!=null&&ile(e,t,nle)}var ale=1,sle=2;function lle(e,t){return Qw(e)&&fD(t)?hD(h1(e),t):function(n){var r=rle(n,e);return r===void 0&&r===t?ole(n,e):Zw(t,r,ale|sle)}}function cle(e){return function(t){return t?.[e]}}function ule(e){return function(t){return vD(t,e)}}function fle(e){return Qw(e)?cle(h1(e)):ule(e)}function hle(e){return typeof e=="function"?e:e==null?o1:typeof e=="object"?cn(e)?lle(e[0],e[1]):Vse(e):fle(e)}function ple(e,t){return function(n,r){if(n==null)return n;if(!pl(n))return e(n,r);for(var i=n.length,o=-1,a=Object(n);++o<i&&r(a[o],o,a)!==!1;);return n}}var yD=ple(WR);function dle(e,t){var n=-1,r=pl(e)?Array(e.length):[];return yD(e,function(i,o,a){r[++n]=t(i,o,a)}),r}function Ko(e,t){var n=cn(e)?QR:dle;return n(e,hle(t))}const gle=Zi(Object.freeze(Object.defineProperty({__proto__:null,default:Ko},Symbol.toStringTag,{value:"Module"})));var bD;function mle(){if(bD)return fl;bD=1,Object.defineProperty(fl,"__esModule",{value:!0}),fl.flattenNames=void 0;var e=loe,t=c(e),n=qw,r=c(n),i=cae,o=c(i),a=gle,s=c(a);function c(u){return u&&u.__esModule?u:{default:u}}var l=fl.flattenNames=function u(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],h=[];return(0,s.default)(f,function(p){Array.isArray(p)?u(p).map(function(d){return h.push(d)}):(0,o.default)(p)?(0,r.default)(p,function(d,g){d===!0&&h.push(g),h.push(g+"-"+d)}):(0,t.default)(p)&&h.push(p)}),h};return fl.default=l,fl}var dl={};function _D(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var p1=function(){try{var e=Ya(Object,"defineProperty");return e({},"",{}),e}catch{}}();function eS(e,t,n){t=="__proto__"&&p1?p1(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var vle=Object.prototype,yle=vle.hasOwnProperty;function TD(e,t,n){var r=e[t];(!(yle.call(e,t)&&Pf(r,n))||n===void 0&&!(t in e))&&eS(e,t,n)}function ble(e,t,n,r){var i=!n;n||(n={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=void 0;c===void 0&&(c=e[s]),i?eS(n,s,c):TD(n,s,c)}return n}function _le(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Tle=Object.prototype,wle=Tle.hasOwnProperty;function Sle(e){if(!$n(e))return _le(e);var t=zw(e),n=[];for(var r in e)r=="constructor"&&(t||!wle.call(e,r))||n.push(r);return n}function wD(e){return pl(e)?VR(e,!0):Sle(e)}var SD=typeof At=="object"&&At&&!At.nodeType&&At,ED=SD&&typeof module=="object"&&module&&!module.nodeType&&module,Ele=ED&&ED.exports===SD,kD=Ele?mi.Buffer:void 0,xD=kD?kD.allocUnsafe:void 0;function CD(e,t){if(t)return e.slice();var n=e.length,r=xD?xD(n):new e.constructor(n);return e.copy(r),r}function kle(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var xle=Object.prototype,Cle=xle.hasOwnProperty;function Ole(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&Cle.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function tS(e){var t=new e.constructor(e.byteLength);return new c1(t).set(new c1(e)),t}function Ple(e,t){var n=tS(e.buffer);return new e.constructor(n,e.byteOffset,e.byteLength)}var Ale=/\w*$/;function Mle(e){var t=new e.constructor(e.source,Ale.exec(e));return t.lastIndex=e.lastIndex,t}var OD=Bi?Bi.prototype:void 0,PD=OD?OD.valueOf:void 0;function Ile(e){return PD?Object(PD.call(e)):{}}function AD(e,t){var n=t?tS(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Rle="[object Boolean]",Dle="[object Date]",Nle="[object Map]",Lle="[object Number]",$le="[object RegExp]",jle="[object Set]",Ble="[object String]",zle="[object Symbol]",Hle="[object ArrayBuffer]",Fle="[object DataView]",qle="[object Float32Array]",Ule="[object Float64Array]",Vle="[object Int8Array]",Gle="[object Int16Array]",Wle="[object Int32Array]",Yle="[object Uint8Array]",Xle="[object Uint8ClampedArray]",Kle="[object Uint16Array]",Zle="[object Uint32Array]";function Qle(e,t,n){var r=e.constructor;switch(t){case Hle:return tS(e);case Rle:case Dle:return new r(+e);case Fle:return Ple(e);case qle:case Ule:case Vle:case Gle:case Wle:case Yle:case Xle:case Kle:case Zle:return AD(e,n);case Nle:return new r;case Lle:case Ble:return new r(e);case $le:return Mle(e);case jle:return new r;case zle:return Ile(e)}}var MD=Object.create,Jle=function(){function e(){}return function(t){if(!$n(t))return{};if(MD)return MD(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function ID(e){return typeof e.constructor=="function"&&!zw(e)?Jle(XR(e)):{}}var ece="[object Map]";function tce(e){return vi(e)&&bi(e)==ece}var RD=hl&&hl.isMap,rce=RD?$w(RD):tce,nce="[object Set]";function ice(e){return vi(e)&&bi(e)==nce}var DD=hl&&hl.isSet,oce=DD?$w(DD):ice,ace=1,ND="[object Arguments]",sce="[object Array]",lce="[object Boolean]",cce="[object Date]",uce="[object Error]",LD="[object Function]",fce="[object GeneratorFunction]",hce="[object Map]",pce="[object Number]",$D="[object Object]",dce="[object RegExp]",gce="[object Set]",mce="[object String]",vce="[object Symbol]",yce="[object WeakMap]",bce="[object ArrayBuffer]",_ce="[object DataView]",Tce="[object Float32Array]",wce="[object Float64Array]",Sce="[object Int8Array]",Ece="[object Int16Array]",kce="[object Int32Array]",xce="[object Uint8Array]",Cce="[object Uint8ClampedArray]",Oce="[object Uint16Array]",Pce="[object Uint32Array]",rr={};rr[ND]=rr[sce]=rr[bce]=rr[_ce]=rr[lce]=rr[cce]=rr[Tce]=rr[wce]=rr[Sce]=rr[Ece]=rr[kce]=rr[hce]=rr[pce]=rr[$D]=rr[dce]=rr[gce]=rr[mce]=rr[vce]=rr[xce]=rr[Cce]=rr[Oce]=rr[Pce]=!0,rr[uce]=rr[LD]=rr[yce]=!1;function d1(e,t,n,r,i,o){var a,s=t&ace;if(a!==void 0)return a;if(!$n(e))return e;var c=cn(e);if(c)a=Ole(e);else{var l=bi(e),u=l==LD||l==fce;if(Cf(e))return CD(e,s);if(l==$D||l==ND||u&&!i)a=u?{}:ID(e);else{if(!rr[l])return i?e:{};a=Qle(e,l,s)}}o||(o=new yi);var f=o.get(e);if(f)return f;o.set(e,a),oce(e)?e.forEach(function(d){a.add(d1(d,t,n,d,e,o))}):rce(e)&&e.forEach(function(d,g){a.set(g,d1(d,t,n,g,e,o))});var h=Gw,p=c?void 0:h(e);return _D(p||e,function(d,g){p&&(g=d,d=e[g]),TD(a,g,d1(d,t,n,g,e,o))}),a}var Ace=1,Mce=4;function Ice(e){return d1(e,Ace|Mce)}const Rce=Zi(Object.freeze(Object.defineProperty({__proto__:null,default:Ice},Symbol.toStringTag,{value:"Module"})));var jD;function Dce(){if(jD)return dl;jD=1,Object.defineProperty(dl,"__esModule",{value:!0}),dl.mergeClasses=void 0;var e=qw,t=o(e),n=Rce,r=o(n),i=Object.assign||function(s){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&(s[u]=l[u])}return s};function o(s){return s&&s.__esModule?s:{default:s}}var a=dl.mergeClasses=function(c){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],u=c.default&&(0,r.default)(c.default)||{};return l.map(function(f){var h=c[f];return h&&(0,t.default)(h,function(p,d){u[d]||(u[d]={}),u[d]=i({},u[d],h[d])}),f}),u};return dl.default=a,dl}var gl={},BD;function Nce(){if(BD)return gl;BD=1,Object.defineProperty(gl,"__esModule",{value:!0}),gl.autoprefix=void 0;var e=qw,t=r(e),n=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var c=arguments[s];for(var l in c)Object.prototype.hasOwnProperty.call(c,l)&&(a[l]=c[l])}return a};function r(a){return a&&a.__esModule?a:{default:a}}var i={borderRadius:function(s){return{msBorderRadius:s,MozBorderRadius:s,OBorderRadius:s,WebkitBorderRadius:s,borderRadius:s}},boxShadow:function(s){return{msBoxShadow:s,MozBoxShadow:s,OBoxShadow:s,WebkitBoxShadow:s,boxShadow:s}},userSelect:function(s){return{WebkitTouchCallout:s,KhtmlUserSelect:s,MozUserSelect:s,msUserSelect:s,WebkitUserSelect:s,userSelect:s}},flex:function(s){return{WebkitBoxFlex:s,MozBoxFlex:s,WebkitFlex:s,msFlex:s,flex:s}},flexBasis:function(s){return{WebkitFlexBasis:s,flexBasis:s}},justifyContent:function(s){return{WebkitJustifyContent:s,justifyContent:s}},transition:function(s){return{msTransition:s,MozTransition:s,OTransition:s,WebkitTransition:s,transition:s}},transform:function(s){return{msTransform:s,MozTransform:s,OTransform:s,WebkitTransform:s,transform:s}},absolute:function(s){var c=s&&s.split(" ");return{position:"absolute",top:c&&c[0],right:c&&c[1],bottom:c&&c[2],left:c&&c[3]}},extend:function(s,c){var l=c[s];return l||{extend:s}}},o=gl.autoprefix=function(s){var c={};return(0,t.default)(s,function(l,u){var f={};(0,t.default)(l,function(h,p){var d=i[p];d?f=n({},f,d(h)):f[p]=h}),c[u]=f}),c};return gl.default=o,gl}var ml={},zD;function Lce(){if(zD)return ml;zD=1,Object.defineProperty(ml,"__esModule",{value:!0}),ml.hover=void 0;var e=Object.assign||function(c){for(var l=1;l<arguments.length;l++){var u=arguments[l];for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(c[f]=u[f])}return c},t=x,n=r(t);function r(c){return c&&c.__esModule?c:{default:c}}function i(c,l){if(!(c instanceof l))throw new TypeError("Cannot call a class as a function")}function o(c,l){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return l&&(typeof l=="object"||typeof l=="function")?l:c}function a(c,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof l);c.prototype=Object.create(l&&l.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),l&&(Object.setPrototypeOf?Object.setPrototypeOf(c,l):c.__proto__=l)}var s=ml.hover=function(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(f){a(h,f);function h(){var p,d,g,y;i(this,h);for(var b=arguments.length,m=Array(b),v=0;v<b;v++)m[v]=arguments[v];return y=(d=(g=o(this,(p=h.__proto__||Object.getPrototypeOf(h)).call.apply(p,[this].concat(m))),g),g.state={hover:!1},g.handleMouseOver=function(){return g.setState({hover:!0})},g.handleMouseOut=function(){return g.setState({hover:!1})},g.render=function(){return n.default.createElement(u,{onMouseOver:g.handleMouseOver,onMouseOut:g.handleMouseOut},n.default.createElement(l,e({},g.props,g.state)))},d),o(g,y)}return h}(n.default.Component)};return ml.default=s,ml}var vl={},HD;function $ce(){if(HD)return vl;HD=1,Object.defineProperty(vl,"__esModule",{value:!0}),vl.active=void 0;var e=Object.assign||function(c){for(var l=1;l<arguments.length;l++){var u=arguments[l];for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(c[f]=u[f])}return c},t=x,n=r(t);function r(c){return c&&c.__esModule?c:{default:c}}function i(c,l){if(!(c instanceof l))throw new TypeError("Cannot call a class as a function")}function o(c,l){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return l&&(typeof l=="object"||typeof l=="function")?l:c}function a(c,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof l);c.prototype=Object.create(l&&l.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),l&&(Object.setPrototypeOf?Object.setPrototypeOf(c,l):c.__proto__=l)}var s=vl.active=function(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return function(f){a(h,f);function h(){var p,d,g,y;i(this,h);for(var b=arguments.length,m=Array(b),v=0;v<b;v++)m[v]=arguments[v];return y=(d=(g=o(this,(p=h.__proto__||Object.getPrototypeOf(h)).call.apply(p,[this].concat(m))),g),g.state={active:!1},g.handleMouseDown=function(){return g.setState({active:!0})},g.handleMouseUp=function(){return g.setState({active:!1})},g.render=function(){return n.default.createElement(u,{onMouseDown:g.handleMouseDown,onMouseUp:g.handleMouseUp},n.default.createElement(l,e({},g.props,g.state)))},d),o(g,y)}return h}(n.default.Component)};return vl.default=s,vl}var g1={},FD;function jce(){if(FD)return g1;FD=1,Object.defineProperty(g1,"__esModule",{value:!0});var e=function(n,r){var i={},o=function(s){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i[s]=c};return n===0&&o("first-child"),n===r-1&&o("last-child"),(n===0||n%2===0)&&o("even"),Math.abs(n%2)===1&&o("odd"),o("nth-child",n),i};return g1.default=e,g1}var qD;function Bce(){if(qD)return En;qD=1,Object.defineProperty(En,"__esModule",{value:!0}),En.ReactCSS=En.loop=En.handleActive=En.handleHover=En.hover=void 0;var e=mle(),t=h(e),n=Dce(),r=h(n),i=Nce(),o=h(i),a=Lce(),s=h(a),c=$ce(),l=h(c),u=jce(),f=h(u);function h(d){return d&&d.__esModule?d:{default:d}}En.hover=s.default,En.handleHover=s.default,En.handleActive=l.default,En.loop=f.default;var p=En.ReactCSS=function(g){for(var y=arguments.length,b=Array(y>1?y-1:0),m=1;m<y;m++)b[m-1]=arguments[m];var v=(0,t.default)(b),_=(0,r.default)(g,v);return(0,o.default)(_)};return En.default=p,En}var rS=Bce();const St=_n(rS);var zce=function(t,n,r,i,o){var a=o.clientWidth,s=o.clientHeight,c=typeof t.pageX=="number"?t.pageX:t.touches[0].pageX,l=typeof t.pageY=="number"?t.pageY:t.touches[0].pageY,u=c-(o.getBoundingClientRect().left+window.pageXOffset),f=l-(o.getBoundingClientRect().top+window.pageYOffset);if(r==="vertical"){var h=void 0;if(f<0?h=0:f>s?h=1:h=Math.round(f*100/s)/100,n.a!==h)return{h:n.h,s:n.s,l:n.l,a:h,source:"rgb"}}else{var p=void 0;if(u<0?p=0:u>a?p=1:p=Math.round(u*100/a)/100,i!==p)return{h:n.h,s:n.s,l:n.l,a:p,source:"rgb"}}return null},nS={},Hce=function(t,n,r,i){if(typeof document>"u"&&!i)return null;var o=i?new i:document.createElement("canvas");o.width=r*2,o.height=r*2;var a=o.getContext("2d");return a?(a.fillStyle=t,a.fillRect(0,0,o.width,o.height),a.fillStyle=n,a.fillRect(0,0,r,r),a.translate(r,r),a.fillRect(0,0,r,r),o.toDataURL()):null},Fce=function(t,n,r,i){var o=t+"-"+n+"-"+r+(i?"-server":"");if(nS[o])return nS[o];var a=Hce(t,n,r,i);return nS[o]=a,a},UD=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yl=function(t){var n=t.white,r=t.grey,i=t.size,o=t.renderers,a=t.borderRadius,s=t.boxShadow,c=t.children,l=St({default:{grid:{borderRadius:a,boxShadow:s,absolute:"0px 0px 0px 0px",background:"url("+Fce(n,r,i,o.canvas)+") center left"}}});return x.isValidElement(c)?x.cloneElement(c,UD({},c.props,{style:UD({},c.props.style,l.grid)})):x.createElement("div",{style:l.grid})};yl.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var qce=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Uce=function(){function e(t,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function Vce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VD(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function Gce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var iS=function(e){Gce(t,e);function t(){var n,r,i,o;Vce(this,t);for(var a=arguments.length,s=Array(a),c=0;c<a;c++)s[c]=arguments[c];return o=(r=(i=VD(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(s))),i),i.handleChange=function(l){var u=zce(l,i.props.hsl,i.props.direction,i.props.a,i.container);u&&typeof i.props.onChange=="function"&&i.props.onChange(u,l)},i.handleMouseDown=function(l){i.handleChange(l),window.addEventListener("mousemove",i.handleChange),window.addEventListener("mouseup",i.handleMouseUp)},i.handleMouseUp=function(){i.unbindEventListeners()},i.unbindEventListeners=function(){window.removeEventListener("mousemove",i.handleChange),window.removeEventListener("mouseup",i.handleMouseUp)},r),VD(i,o)}return Uce(t,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var r=this,i=this.props.rgb,o=St({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+i.r+","+i.g+","+i.b+`, 0) 0%,
243
243
  rgba(`+i.r+","+i.g+","+i.b+", 1) 100%)",boxShadow:this.props.shadow,borderRadius:this.props.radius},container:{position:"relative",height:"100%",margin:"0 3px"},pointer:{position:"absolute",left:i.a*100+"%"},slider:{width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",marginTop:"1px",transform:"translateX(-2px)"}},vertical:{gradient:{background:"linear-gradient(to bottom, rgba("+i.r+","+i.g+","+i.b+`, 0) 0%,
244
244
  rgba(`+i.r+","+i.g+","+i.b+", 1) 100%)"},pointer:{left:0,top:i.a*100+"%"}},overwrite:qce({},this.props.style)},{vertical:this.props.direction==="vertical",overwrite:!0});return x.createElement("div",{style:o.alpha},x.createElement("div",{style:o.checkboard},x.createElement(yl,{renderers:this.props.renderers})),x.createElement("div",{style:o.gradient}),x.createElement("div",{style:o.container,ref:function(s){return r.container=s},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},x.createElement("div",{style:o.pointer},this.props.pointer?x.createElement(this.props.pointer,this.props):x.createElement("div",{style:o.slider}))))}}]),t}(x.PureComponent||x.Component),Wce=function(){function e(t,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function Yce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kce(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function Zce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Qce=1,GD=38,Jce=40,eue=[GD,Jce],tue=function(t){return eue.indexOf(t)>-1},rue=function(t){return Number(String(t).replace(/%/g,""))},nue=1,Ht=function(e){Zce(t,e);function t(n){Xce(this,t);var r=Kce(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.handleBlur=function(){r.state.blurValue&&r.setState({value:r.state.blurValue,blurValue:null})},r.handleChange=function(i){r.setUpdatedValue(i.target.value,i)},r.handleKeyDown=function(i){var o=rue(i.target.value);if(!isNaN(o)&&tue(i.keyCode)){var a=r.getArrowOffset(),s=i.keyCode===GD?o+a:o-a;r.setUpdatedValue(s,i)}},r.handleDrag=function(i){if(r.props.dragLabel){var o=Math.round(r.props.value+i.movementX);o>=0&&o<=r.props.dragMax&&r.props.onChange&&r.props.onChange(r.getValueObjectWithLabel(o),i)}},r.handleMouseDown=function(i){r.props.dragLabel&&(i.preventDefault(),r.handleDrag(i),window.addEventListener("mousemove",r.handleDrag),window.addEventListener("mouseup",r.handleMouseUp))},r.handleMouseUp=function(){r.unbindEventListeners()},r.unbindEventListeners=function(){window.removeEventListener("mousemove",r.handleDrag),window.removeEventListener("mouseup",r.handleMouseUp)},r.state={value:String(n.value).toUpperCase(),blurValue:String(n.value).toUpperCase()},r.inputId="rc-editable-input-"+nue++,r}return Wce(t,[{key:"componentDidUpdate",value:function(r,i){this.props.value!==this.state.value&&(r.value!==this.props.value||i.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(r){return Yce({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||Qce}},{key:"setUpdatedValue",value:function(r,i){var o=this.props.label?this.getValueObjectWithLabel(r):r;this.props.onChange&&this.props.onChange(o,i),this.setState({value:r})}},{key:"render",value:function(){var r=this,i=St({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return x.createElement("div",{style:i.wrap},x.createElement("input",{id:this.inputId,style:i.input,ref:function(a){return r.input=a},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?x.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),t}(x.PureComponent||x.Component),iue=function(t,n,r,i){var o=i.clientWidth,a=i.clientHeight,s=typeof t.pageX=="number"?t.pageX:t.touches[0].pageX,c=typeof t.pageY=="number"?t.pageY:t.touches[0].pageY,l=s-(i.getBoundingClientRect().left+window.pageXOffset),u=c-(i.getBoundingClientRect().top+window.pageYOffset);if(n==="vertical"){var f=void 0;if(u<0)f=359;else if(u>a)f=0;else{var h=-(u*100/a)+100;f=360*h/100}if(r.h!==f)return{h:f,s:r.s,l:r.l,a:r.a,source:"hsl"}}else{var p=void 0;if(l<0)p=0;else if(l>o)p=359;else{var d=l*100/o;p=360*d/100}if(r.h!==p)return{h:p,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},oue=function(){function e(t,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function aue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function WD(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function sue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var bl=function(e){sue(t,e);function t(){var n,r,i,o;aue(this,t);for(var a=arguments.length,s=Array(a),c=0;c<a;c++)s[c]=arguments[c];return o=(r=(i=WD(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(s))),i),i.handleChange=function(l){var u=iue(l,i.props.direction,i.props.hsl,i.container);u&&typeof i.props.onChange=="function"&&i.props.onChange(u,l)},i.handleMouseDown=function(l){i.handleChange(l),window.addEventListener("mousemove",i.handleChange),window.addEventListener("mouseup",i.handleMouseUp)},i.handleMouseUp=function(){i.unbindEventListeners()},r),WD(i,o)}return oue(t,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var r=this,i=this.props.direction,o=i===void 0?"horizontal":i,a=St({default:{hue:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius,boxShadow:this.props.shadow},container:{padding:"0 2px",position:"relative",height:"100%",borderRadius:this.props.radius},pointer:{position:"absolute",left:this.props.hsl.h*100/360+"%"},slider:{marginTop:"1px",width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",transform:"translateX(-2px)"}},vertical:{pointer:{left:"0px",top:-(this.props.hsl.h*100/360)+100+"%"}}},{vertical:o==="vertical"});return x.createElement("div",{style:a.hue},x.createElement("div",{className:"hue-"+o,style:a.container,ref:function(c){return r.container=c},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},x.createElement("style",null,`
@@ -277,7 +277,7 @@ ${o}`:o,"");if(this.errorText.text=r,this.errorText.alpha=.8,r?.length){const i=
277
277
  [Transform: None ]`:c+=`
278
278
  [Transform: Default ]`}this.labelText.text=c,this.labelText.style={fontSize:`${this.labelTextFontSize}px`,fontFamily:this.labelTextFontFamily,fill:a},this.labelText.alpha=typeof this.options.labelTextOpacity<"u"?this.options.labelTextOpacity:1,this.labelText.visible=!0,this.flipText&&(this.labelText.scale.x=-1);const{labelLeftMargin:l=0,labelRightMargin:u=0,labelTopMargin:f=0,labelBottomMargin:h=0}=this.options;this.options.labelPosition==="topLeft"?(this.labelText.x=this.position[0]+l+this.labelXOffset,this.labelText.y=this.position[1]+f,this.labelText.anchor.x=.5,this.labelText.anchor.y=0,this.labelText.x+=this.labelText.width/2,r.drawRect(this.position[0]+l+this.labelXOffset,this.position[1]+f,this.labelText.width+s,this.labelText.height+s)):this.options.labelPosition==="bottomLeft"&&!this.flipText||this.options.labelPosition==="topRight"&&this.flipText?(this.labelText.x=this.position[0]+(l||f),this.labelText.y=this.position[1]+this.dimensions[1]-(h||u),this.labelText.anchor.x=.5,this.labelText.anchor.y=1,this.labelText.x+=this.labelText.width/2+this.labelXOffset,r.drawRect(this.position[0]+(l||f)+this.labelXOffset,this.position[1]+this.dimensions[1]-this.labelText.height-s-(h||u),this.labelText.width+s,this.labelText.height+s)):this.options.labelPosition==="topRight"&&!this.flipText||this.options.labelPosition==="bottomLeft"&&this.flipText?(this.labelText.x=this.position[0]+this.dimensions[0]-(u||h),this.labelText.y=this.position[1]+(f||l),this.labelText.anchor.x=.5,this.labelText.anchor.y=0,this.labelText.x-=this.labelText.width/2+this.labelXOffset,r.drawRect(this.position[0]+this.dimensions[0]-this.labelText.width-s-(u||h)-this.labelXOffset,this.position[1]+(f||l),this.labelText.width+s,this.labelText.height+s)):this.options.labelPosition==="bottomRight"?(this.labelText.x=this.position[0]+this.dimensions[0]-u,this.labelText.y=this.position[1]+this.dimensions[1]-h,this.labelText.anchor.x=.5,this.labelText.anchor.y=1,this.labelText.x-=this.labelText.width/2+this.labelXOffset,r.drawRect(this.position[0]+this.dimensions[0]-this.labelText.width-s-u-this.labelXOffset,this.position[1]+this.dimensions[1]-this.labelText.height-s-h,this.labelText.width+s,this.labelText.height+s)):this.options.labelPosition==="outerLeft"&&!this.flipText||this.options.labelPosition==="outerTop"&&this.flipText?(this.labelText.x=this.position[0],this.labelText.y=this.position[1]+this.dimensions[1]/2,this.labelText.anchor.x=.5,this.labelText.anchor.y=.5,this.labelText.x-=this.labelText.width/2+3):this.options.labelPosition==="outerTop"&&!this.flipText||this.options.labelPosition==="outerLeft"&&this.flipText?(this.labelText.x=this.position[0]+this.dimensions[0]/2,this.labelText.y=this.position[1],this.labelText.anchor.x=.5,this.labelText.anchor.y=.5,this.labelText.y-=this.labelText.height/2+3):this.options.labelPosition==="outerBottom"&&!this.flipText||this.options.labelPosition==="outerRight"&&this.flipText?(this.labelText.x=this.position[0]+this.dimensions[0]/2,this.labelText.y=this.position[1]+this.dimensions[1],this.labelText.anchor.x=.5,this.labelText.anchor.y=.5,this.labelText.y+=this.labelText.height/2+3):this.options.labelPosition==="outerRight"&&!this.flipText||this.options.labelPosition==="outerBottom"&&this.flipText?(this.labelText.x=this.position[0]+this.dimensions[0],this.labelText.y=this.position[1]+this.dimensions[1]/2,this.labelText.anchor.x=.5,this.labelText.anchor.y=.5,this.labelText.x+=this.labelText.width/2+3):this.labelText.visible=!1,this.options.labelPosition==="outerLeft"||this.options.labelPosition==="outerRight"||this.options.labelPosition==="outerTop"||this.options.labelPosition==="outerBottom"?this.pLabel.setParent(this.pBase):this.pLabel.setParent(this.pMasked)}},{key:"rerender",value:function(r){this.options=r,this.draw(),this.drawBackground(),this.drawLabel(),this.drawError(),this.drawBorder()}},{key:"draw",value:function(){this.drawError()}},{key:"exportSVG",value:function(){const r=document.createElement("g"),i=document.createElement("rect");i.setAttribute("x",`${this.position[0]}`),i.setAttribute("y",`${this.position[1]}`),i.setAttribute("width",`${this.dimensions[0]}`),i.setAttribute("height",`${this.dimensions[1]}`),this.options?.backgroundColor?i.setAttribute("fill",this.options.backgroundColor):i.setAttribute("fill-opacity","0");const o=document.createElement("g");o.setAttribute("class","g-clipped"),r.appendChild(o),o.appendChild(i);const a=document.createElement("g");o.setAttribute("class","g-track"),o.appendChild(a);const s=document.createElement("g");o.setAttribute("class","g-labels"),o.appendChild(s);const c=document.createElementNS("http://www.w3.org/2000/svg","clipPath");r.appendChild(c);const l=document.createElementNS("http://www.w3.org/2000/svg","polygon");c.appendChild(l),l.setAttribute("points",`${this.position[0]},${this.position[1]} ${this.position[0]+this.dimensions[0]},${this.position[1]} ${this.position[0]+this.dimensions[0]},${this.position[1]+this.dimensions[1]} ${this.position[0]},${this.position[1]+this.dimensions[1]} `);const u=Mt.nice();c.setAttribute("id",u),o.setAttribute("style",`clip-path:url(#${u});`);const f=this.labelText.text.split(`
279
279
  `);let h=0;const d=(this.labelTextFontSize+2)*f.length+3;this.labelText.anchor.y===.5?h=d/2:this.labelText.anchor.y===1&&(h=-d);for(let g=0;g<f.length;g++){const y=document.createElement("text");if(y.setAttribute("font-family",this.labelTextFontFamily),y.setAttribute("font-size",`${this.labelTextFontSize}px`),y.innerText=f[g],this.options.labelPosition==="topLeft"||this.options.labelPosition==="topRight"){const b=h+(g+1)*(this.labelTextFontSize+2);y.setAttribute("dy",String(b))}else(this.options.labelPosition==="bottomLeft"||this.options.labelPosition==="bottomRight")&&y.setAttribute("dy",String(h+g*(this.labelTextFontSize+2)));y.setAttribute("fill",this.options.labelColor??""),this.labelText.anchor.x===.5?y.setAttribute("text-anchor","middle"):this.labelText.anchor.x===1&&y.setAttribute("text-anchor","end"),s.appendChild(y)}return s.setAttribute("transform",`translate(${this.labelText.x},${this.labelText.y})scale(${this.labelText.scale.x},1)`),[r,a]}},{key:"calculateZoomLevel",value:function(){throw new Error("Must be implemented by subclass")}}])}(Ja);function ng(e,t=""){if(!e)throw new Error(t)}function mme(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vme(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,bme(r.key),r)}}function yme(e,t,n){return t&&vme(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function bme(e){var t=_me(e,"string");return typeof t=="symbol"?t:t+""}function _me(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Tme(e){return e.length===2}function wme(e){return{async fetchTiles(t){return await B7(t,e)},fetchTilesetInfo({server:t,tilesetUid:n}){return new Promise((r,i)=>{G7(t,n,r,i,e)})},registerTileset({server:t,url:n,filetype:r,coordSystem:i}){const o=`${Fp(t)}/register_url/`;return fetch(o,{method:"POST",body:JSON.stringify({fileurl:n,filetype:r,coordSystem:i}),headers:{"Content-Type":"application/json; charset=utf-8"}})}}}let Xf=function(){function e(t,n,r){if(mme(this,e),this._tileSource=r||wme(n),this.tilesetInfoLoading=!0,!t){console.error("No dataconfig provided");return}this.dataConfig=JSON.parse(JSON.stringify(t)),this.uuid=Mt.nice(),this.pubSub=n,t.children&&(this.dataConfig.children=t.children.map(i=>new e(i,n)))}return yme(e,[{key:"registerFileUrl",value:async function({server:n,url:r,filetype:i,coordSystem:o}){return this._tileSource.registerTileset({server:n,url:r,filetype:i,coordSystem:o})}},{key:"tilesetInfo",value:function(n){const{server:r,url:i,filetype:o,coordSystem:a}=this.dataConfig;return r&&i&&o?this.registerFileUrl({server:r,url:i,filetype:o,coordSystem:a}).then(s=>s.json()).then(s=>{this.dataConfig.tilesetUid=s.uid,this.tilesetInfoAfterRegister(n)}).catch(s=>{console.error("Error registering url",s)}):new Promise(()=>{this.tilesetInfoAfterRegister(n)})}},{key:"tilesetInfoAfterRegister",value:function(n){if(this.dataConfig.children){const r=this.dataConfig.children.map(i=>new Promise(o=>{i.tilesetInfo(o)}));Promise.all(r).then(i=>{n(i[0])})}else{const{server:r,tilesetUid:i}=this.dataConfig;!r||!i?(console.warn("No dataConfig children, server or tilesetUid:",this.dataConfig),n(null)):this._tileSource.fetchTilesetInfo({server:r,tilesetUid:i}).then(o=>{this.dataConfig.tilesetInfo=o[i],n(o[i],i)}).catch(o=>{this.tilesetInfoLoading=!1,n({error:o})})}}},{key:"fullTileId",value:function(n,r){return`${n}.${r}`}},{key:"fetchTilesDebounced",value:function(n,r){if(this.dataConfig.type==="horizontal-section")return this.fetchHorizontalSection(n,r);if(this.dataConfig.type==="vertical-section")return this.fetchHorizontalSection(n,r,!0);if(!this.dataConfig.children&&this.dataConfig.tilesetUid&&this.dataConfig.server)return this._tileSource.fetchTiles({id:Mt.nice(),server:this.dataConfig.server,tileIds:r.map(a=>`${this.dataConfig.tilesetUid}.${a}`),options:this.dataConfig.options}).then(a=>{const s=Zt(a)[0].tilesetUid,c={};for(let l=0;l<r.length;l++){const u=this.fullTileId(s,r[l]);a[u].tilePositionId=r[l],c[r[l]]=a[u]}return n(c),c});const i=this.dataConfig.children?.map(o=>new Promise(a=>{o.fetchTilesDebounced(a,r)}))??[];return Promise.all(i).then(o=>{if(this.dataConfig.type==="divided"&&Tme(o)){const a=this.makeDivided(o,r);return n(a),a}return console.warn("Unimplemented dataConfig type. Returning first data source.",this.dataConfig),n(o[0]),o[0]})}},{key:"divideData",value:function(n,r){const i=new Float32Array(n.length);for(let o=0;o<i.length;o++)r[o]===0?i[o]=Number.NaN:i[o]=n[o]/r[o];return i}},{key:"horizontalSlice",value:function(){return null}},{key:"extractDataSlice",value:function(n,r,i,o){if(!o)return n.slice(r[1]*i,r[1]*(i+1));const a=new Array(r[1]);for(let s=i;s<n.length;s+=r[0])a[Math.floor(s/r[0])]=n[s];return a}},{key:"fetchHorizontalSection",value:function(n,r,i=!1){const o=[],a=[],{slicePos:s,tilesetInfo:c,server:l}=this.dataConfig;ng(s,"No slice position in dataConfig."),ng(l,"No server in dataConfig."),ng(c,"No tilesetInfo in dataConfig.");for(const f of r){const h=f.split("."),p=+h[0],d=+h[1],g=Et().domain([s,s]);let y=[];if(Au(c)){const v=c.resolutions.map(_=>+_).sort((_,T)=>T-_);y=Pd(v[p],g,c.min_pos[i?1:0],c.max_pos[i?1:0])}else y=Od(p,g,c.min_pos[i?1:0],c.max_pos[i?1:0],c.max_zoom,c.max_width);const b=[d,y[0]].sort((v,_)=>v-_);b[0]===d?a.push(!1):a.push(!0);const m=`${p}.${b[0]}.${b[1]}`;o.push(m)}return this._tileSource.fetchTiles({id:Mt.nice(),server:l,tileIds:o.map(f=>`${this.dataConfig.tilesetUid}.${f}`)}).then(f=>{const h=Zt(f)[0].tilesetUid,p={};for(let d=0;d<o.length;d++){const g=o[d].split("."),y=+g[0],b=+g[1],m=+g[2],v=H7(c,c.max_width,c.min_pos[1],y,+s)[1],_=this.fullTileId(h,o[d]),T=f[_];let w=null;if(b===m){w=this.extractDataSlice(T.dense,[256,256],v);const k=this.extractDataSlice(T.dense,[256,256],v,1);for(let E=0;E<w.length;E++)w[E]+=k[E]}else a[d]?w=this.extractDataSlice(T.dense,[256,256],v,1):w=this.extractDataSlice(T.dense,[256,256],v);const S={min_value:Math.min.apply(null,w),max_value:Math.max.apply(null,w),denseDataExtrema:new Ru(w),minNonZero:S0(w),maxNonZero:w0(w),dense:w,dtype:T.dtype,server:T.server,tilePos:a[d]?[m]:[b],tilePositionId:r[d],tilesetUid:h,zoomLevel:T.zoomLevel};p[r[d]]=S}return n(p),p})}},{key:"makeDivided",value:function(n,r){n.length<2&&console.warn("Only one tileset specified for a divided datafetcher:",this.dataConfig);const i={};for(let o=0;o<r.length;o++){const a=n[0][r[o]].zoomLevel,s=n[0][r[o]].tilePos;let c={zoomLevel:a,tilePos:s,tilePositionId:r[o]};const l=n[0][r[o]].dense,u=n[1][r[o]].dense;if(l&&u){const f=this.divideData(l,u),h=s.length===2?new I0(f):new Ru(f);c={dense:f,denseDataExtrema:h,minNonZero:S0(f),maxNonZero:w0(f),zoomLevel:a,tilePos:s,tilePositionId:r[o]}}i[r[o]]=c}return i}}])}();var DE,WL;function Sme(){return WL||(WL=1,DE=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]),DE}var NE,YL;function Eme(){if(YL)return NE;YL=1;const e=Sme();function t(i){if(typeof i!="string")throw new TypeError("input must be a string");let o=[],a,s,c={LOCUS_TAG:"LOCUS",DEFINITION_TAG:"DEFINITION",ACCESSION_TAG:"ACCESSION",VERSION_TAG:"VERSION",KEYWORDS_TAG:"KEYWORDS",SOURCE_TAG:"SOURCE",ORGANISM_TAG:"ORGANISM",REFERENCE_TAG:"REFERENCE",FEATURES_TAG:"FEATURES",ORIGIN_TAG:"ORIGIN",END_SEQUENCE_TAG:"//"},l=i.split(/\r?\n/),u,f,h,p,d,g=!1;for(let j of l){if(j===null)break;let H=I(j),W=M(j),re=z(j),Y=R(j);if(H===c.END_SEQUENCE_TAG||Y?(u=H,f=null):re&&(f=H),!(j.trim()===""||H===";")){if(!g&&u!==c.LOCUS_TAG)break;switch(u){case c.LOCUS_TAG:g=!0,_(j);break;case c.FEATURES_TAG:S(j,H,W);break;case c.ORIGIN_TAG:v(j,H);break;case c.DEFINITION_TAG:case c.ACCESSION_TAG:case c.VERSION_TAG:case c.KEYWORDS_TAG:O(u,j,u.toLowerCase());break;case c.SOURCE_TAG:f===c.ORGANISM_TAG?O(f,j,"organism"):O(H,j,"source");break;case c.REFERENCE_TAG:if(H===c.REFERENCE_TAG){const F=a.references||[];a.references=F,F.push({})}w(j,f);break;case c.END_SEQUENCE_TAG:y();break}}}return o[o.length-1]!==a&&y(),o;function y(){m(),o.push(a)}function b(){return a.features[a.features.length-1]}function m(){if(a&&a.features)for(let j=0;j<a.features.length;j++)a.features[j]=U(a.features[j])}function v(j,H){if(H!==c.ORIGIN_TAG){let W=j.replace(/[\s]*[0-9]*/g,"");a.sequence+=W}}function _(j){a={features:[],name:"Untitled sequence",sequence:"",references:[]},j=T(c.LOCUS_TAG,j);const H=j.match(/^([^\s]+)\s+(\d+)\s+bp\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s*([^\s]+)?$/);let W=H[1],re=+H[2],Y=H[3],F=H[4]==="circular";const L=a;let K="";H[6]?(L.genbankDivision=H[5],K=H[6]):K=H[5],L.circular=F,L.moleculeType=Y;const G=K.match(/^(\d{2})-(.{3})-(\d{4})$/),te=new Date;te.setFullYear(+G[3]),te.setUTCMonth(e.indexOf(G[2].toUpperCase())),te.setDate(+G[1]),te.setUTCHours(12),te.setMinutes(0),te.setSeconds(0),te.setMilliseconds(0),L.date=te.toISOString(),L.name=W,L.size=re}function T(j,H){return H=H.replace(/^\s*/,""),H.indexOf(j)===0&&(H=H.replace(j,"")),H.trim()}function w(j,H){const W=a.references;let re=W[W.length-1];H?O(H,j,H.toLowerCase(),re):O(c.REFERENCE_TAG,j,"description",re)}function S(j,H,W){let re;if(H===c.FEATURES_TAG){p=!0;return}if(p&&(h=r(j),p=!1),n(j,h))d?(P(j.trim()),d=!0):(s&&(s[s.length-1]+=j.trim().replace(/"/g,"")),d=!1);else if(E(j))b()&&(C(j),d=!1);else{W.match(/complement/g)?re=-1:re=1,k();let Y=b();Y.type=H,Y.strand=re,P(W),d=!0}}function k(){a.features.push({notes:{}})}function E(j){let H=!1;return(j.trim().charAt(0).match(/\//)||j.match(/^[\s]*\/[\w]+=[\S]+/))&&(H=!0),H}function P(j){j=j.trim();let H=[];j.replace(/(\d+)/g,function(re,Y){H.push(Y)});let W=b();W.start=+H[0],W.end=H[1]===void 0?+H[0]:+H[1]}function C(j){let H,W;H=j.trim(),H=H.replace(/^\/|"$/g,""),W=H.split(/="|=/);let re=W[1];re&&(re=re.replace(/\\/g," "),j.match(/="/g)?re=re.replace(/".*/g,""):re.match(/^\d+$/g)&&(re=+re));let Y=W[0],F=b().notes;F[Y]?F[Y].push(re):F[Y]=[re],s=F[Y]}function I(j){let H;return j=j.trim(),H=j.split(/[\s]+/),H[0]}function O(j,H,W,re){re=re||a;let Y=T(j,H);re[W]=re[W]?`${re[W]} `:"",re[W]+=Y}function M(j){let H;return j.indexOf("=")<0?(j=j.replace(/^[\s]*[\S]+[\s]+|[\s]+$/,""),j=j.trim(),j):(H=j.split(/=/),H[1])}function R(j){let H=!1;return j.substr(0,10).match(/^[\S]+/)&&(H=!0),H}function z(j){let H=!1;return j.substr(0,10).match(/^[\s]+[\S]+/)&&(H=!0),H}function U(j){return j.notes.label?j.name=j.notes.label[0]:j.notes.gene?j.name=j.notes.gene[0]:j.notes.ApEinfo_label?j.name=j.notes.ApEinfo_label[0]:j.notes.name?j.name=j.notes.name[0]:j.notes.organism?j.name=j.notes.organism[0]:j.notes.locus_tag?j.name=j.notes.locus_tag[0]:j.notes.note?j.name=j.notes.note[0]:j.name="Untitled Feature",j.name=typeof j.name=="string"?j.name:String(j.name),j}}function n(i,o){let a=r(i);return!(o===a||i.trim().charAt(0).match(/\//))}function r(i){let o=/^\s*/.exec(i);return o!==null?o[0].length:0}return NE=t,NE}var kme=Eme();const xme=_n(kme);function Cme(e,t){const{format:n,signal:r}=t,i=e instanceof Response?e:new Response(e);return ng(i.body,"Response does not include a body."),new Response(i.body.pipeThrough(new DecompressionStream(n),{signal:r}))}function Ome(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pme(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Mme(r.key),r)}}function Ame(e,t,n){return t&&Pme(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mme(e){var t=Ime(e,"string");return typeof t=="symbol"?t:t+""}function Ime(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function XL(e,t,n){const r=[];if(!e.length)return[];let o=e[0].start,a=e[0].end;for(let s=1;s<e.length;s++)e[s].start<a+5*1/t?a=Math.max(a,e[s].end):(r.push({type:"filler",start:o,end:a,strand:n}),o=e[s].start,a=e[s].end);return r.push({start:o,end:a,type:"filler",strand:n}),r}function Rme(e){for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1)),r=e[t];e[t]=e[n],e[n]=r}return e}function Dme(e){return e.type==="filler"}function Nme(e){const t=e.end-e.start,n=e.strand===1?"+":"-",r=Mt.nice();return Dme(e)?{xStart:e.start,xEnd:e.end,strand:e.strand,fields:[],type:"filler",uid:r}:{xStart:e.start,xEnd:e.end,strand:n,chrOffset:0,importance:e.end-e.start,uid:r,type:e.type,fields:["chrom",e.start,e.end,e.name,t,n,"","",e.type,e.name,e.start.toString(),e.end.toString(),e.start.toString(),e.end.toString()]}}function Lme(e){const t=xme(e),n=Rme(t[0].features.filter(r=>r.type!=="source").sort((r,i)=>r.start-i.start));return{json:t,features:n}}let KL=function(){function e(t){Ome(this,e),this.dataConfig=t,this.trackUid=Mt.nice(),this.errorTxt="";let n;if(t.url){const r=t.url.slice(t.url.length-3);n=fetch(t.url,{mode:"cors",redirect:"follow",method:"GET"}).then(i=>(r===".gz"?Cme(i,{format:"gzip"}):i).text())}else if(t.text)n=Promise.resolve(t.text);else throw new Error("No data or URL specified");this.gbDataPromise=n.then(r=>Lme(r))}return Ame(e,[{key:"tilesetInfo",value:function(n){return this.tilesetInfoLoading=!0,this.gbDataPromise.then(r=>{this.tilesetInfoLoading=!1;const i=1024,o={name:`genbank-${this.trackUid}`,tile_size:i,max_zoom:Math.ceil(Math.log(r.json[0].size/i)/Math.log(2)),max_width:r.json[0].size,min_pos:[0],max_pos:[r.json[0].size]};return n&&n(o),o}).catch(r=>{this.tilesetInfoLoading=!1,n&&n({error:`Error parsing genbank: ${r}`})})}},{key:"fetchTilesDebounced",value:async function(n,r){const i={},o=[],a=[];for(const c of r){const l=c.split("."),u=Number.parseInt(l[0],10),f=Number.parseInt(l[1],10);if(Number.isNaN(f)||Number.isNaN(u)){console.warn("Invalid tile zoom or position:",u,f);continue}o.push(c),a.push(this.tile(u,f))}const s=await Promise.all(a);for(let c=0;c<s.length;c++){const l=o[c];i[l]=s[c],i[l].tilePositionId=l}return n(i),i}},{key:"tile",value:async function(n,r){const[i,o]=await Promise.all([this.tilesetInfo(),this.gbDataPromise]);if(!i)throw new Error("No tileset info");const a=+i.max_width/2**+n,s=i.min_pos[0]+r*a,c=i.min_pos[0]+(r+1)*a,l=o.features.filter(g=>g.end>s&&g.start<c),u=1024/2**(i.max_zoom-n),f=XL(l.filter(g=>g.strand===1),u,"+"),h=XL(l.filter(g=>g.strand!==1),u,"-"),p=[],d=20;for(let g=0;g<o.features.length&&!(p.length>=d);g++)o.features[g].end>=s&&o.features[g].start<=c&&p.push(o.features[g]);return[p,f,h].flatMap(g=>g.map(Nme))}}])}();function $me(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jme(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,zme(r.key),r)}}function Bme(e,t,n){return t&&jme(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function zme(e){var t=Hme(e,"string");return typeof t=="symbol"?t:t+""}function Hme(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}let ZL=function(){function e(t){$me(this,e),this.dataConfig=t,this.tilesetInfoData=Object.values(this.dataConfig.tilesetInfo)[0],this.tilesData={},this.tilesetInfoLoading=!0}return Bme(e,[{key:"tilesetInfo",value:async function(n){return this.tilesetInfoLoading=!1,await new Promise(r=>setTimeout(()=>{n(this.tilesetInfoData),r(!0)},0)),this.tilesetInfoData}},{key:"fetchTilesDebounced",value:async function(n,r){this.tilesData={};for(const a of Object.keys(this.dataConfig.tiles)){const c=`localtile.${a.split(".").slice(1).join(".")}`;this.tilesData[c]=this.dataConfig.tiles[a]}const i={},o=r.map(a=>`localtile.${a}`);VT(this.tilesData,"",o);for(const a of r)i[a]=this.tilesData[`localtile.${a}`],i[a].tilePositionId=a;return n(i),i}},{key:"tile",value:function(n,r){}}])}();function Fme(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qme(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Vme(r.key),r)}}function Ume(e,t,n){return t&&qme(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Vme(e){var t=Gme(e,"string");return typeof t=="symbol"?t:t+""}function Gme(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Wme(e){return e.data===null}let Yme=function(){function e(){Fme(this,e),this.taskList=[],this.taskHandle=null,this.requestIdleCallbackTimeout=300}return Ume(e,[{key:"enqueueTask",value:function(n,r,i=null){i===null?this.taskList.push({handler:n,data:r}):(this.taskList=this.taskList.filter(o=>o.trackId!==i),this.taskList.push({handler:n,data:r,trackId:i})),this.taskHandle||(this.taskHandle=requestIdleCallback(this.runTaskQueue.bind(this),{timeout:this.requestIdleCallbackTimeout}))}},{key:"runTaskQueue",value:function(n){for(;(n.timeRemaining()>0||n.didTimeout)&&this.taskList.length;){const r=this.taskList.shift();r&&Wme(r)?r.handler():r&&r.handler(r.data)}this.taskList.length?this.taskHandle=requestIdleCallback(this.runTaskQueue.bind(this),{timeout:this.requestIdleCallbackTimeout}):this.taskHandle=0}}])}();const Xme=new Yme;function Kme(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zme(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Jme(r.key),r)}}function Qme(e,t,n){return t&&Zme(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jme(e){var t=eve(e,"string");return typeof t=="symbol"?t:t+""}function eve(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function tve(e,t,n){return t=Vl(t),rve(e,QL()?Reflect.construct(t,n||[],Vl(e).constructor):t.apply(e,n))}function rve(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nve(e)}function nve(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function QL(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(QL=function(){return!!e})()}function ig(e,t,n,r){var i=LE(Vl(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function LE(){return LE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=ive(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},LE.apply(null,arguments)}function ive(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Vl(e))!==null;);return e}function Vl(e){return Vl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vl(e)}function ove(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$E(e,t)}function $E(e,t){return $E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},$E(e,t)}function ave(e,t,n,r,i){const o=e,a=0;return o==="log"&&t>0?["log",Ro().range([254,0]).domain([t+a,r+a])]:["linear",Et().range([254,0]).domain([t,r])]}let Si=function(e){function t(n,r){var i;Kme(this,t),i=tve(this,t,[n,r]);const{pubSub:o,dataConfig:a,handleTilesetInfoReceived:s,animate:c,onValueScaleChanged:l}=n;return i.renderVersion=1,i.visibleTiles=[],i.visibleTileIds=new Set,i.renderingTiles=new Set,i.fetching=new Set,i.scale={},i.fetchedTiles={},i.tileGraphics={},i.maxZoom=0,i.medianVisibleValue=null,i.backgroundTaskScheduler=Xme,i.continuousScaling="requestIdleCallback"in window,i.valueScaleMin=null,i.fixedValueScaleMin=null,i.valueScaleMax=null,i.fixedValueScaleMax=null,i.listeners={},i.pubSub=o,i.animate=c,i.onValueScaleChanged=l,i.prevValueScale=null,n.dataFetcher?i.dataFetcher=n.dataFetcher:i.dataFetcher=new Xf(a,i.pubSub),i.tilesetInfo=null,i.tilesetInfoError=null,i.uuid=Mt.nice(),i.trackNotFoundText=new Ye.PIXI.Text("",{fontSize:"12px",fontFamily:"Arial",fill:"black"}),i.pLabel.addChild(i.trackNotFoundText),i.refreshTilesDebounced=bA(i.refreshTiles.bind(i),Ap,Ap),i.dataFetcher.tilesetInfo((u,f)=>{if(u){if(qX(u))i.tilesetInfo=u,i.tilesetInfo.chromsizes&&(i.chromInfo=_u(i.tilesetInfo.chromsizes));else{console.warn("Error retrieving tilesetInfo:",a,u.error),u.error&&i.setError(u.error,"dataFetcher.tilesetInfo"),i.tilesetInfo=void 0;return}i.dataFetcher.dataConfig.tilesetUid||(i.dataFetcher.dataConfig.tilesetUid=f),i.tilesetUid=i.dataFetcher.dataConfig.tilesetUid,i.server=i.dataFetcher.dataConfig.server||"unknown",i.tilesetInfo?.chromsizes&&(i.chromInfo=_u(i.tilesetInfo.chromsizes)),Au(i.tilesetInfo)?i.maxZoom=i.tilesetInfo.resolutions.length:i.maxZoom=+i.tilesetInfo.max_zoom,i.options?.maxZoom&&(i.options.maxZoom>=0?i.maxZoom=Math.min(i.options.maxZoom,i.maxZoom):console.error("Invalid maxZoom on track:",i)),i.refreshTiles(),i.tilesetInfoReceived(),s?.(i.tilesetInfo),i.options??={},i.options.name=i.options.name||i.tilesetInfo.name,i.checkValueScaleLimits(),i.draw(),i.drawLabel(),i.animate()}}),i}return ove(t,e),Qme(t,[{key:"setError",value:function(r,i){this.errorTexts[i]=r,this.drawError()}},{key:"setFixedValueScaleMin",value:function(r){Number.isNaN(+r)?this.fixedValueScaleMin=null:this.fixedValueScaleMin=+r}},{key:"setFixedValueScaleMax",value:function(r){Number.isNaN(+r)?this.fixedValueScaleMax=null:this.fixedValueScaleMax=+r}},{key:"checkValueScaleLimits",value:function(){this.valueScaleMin=typeof this.options.valueScaleMin<"u"?+this.options.valueScaleMin:null,this.fixedValueScaleMin!==null&&(this.valueScaleMin=this.fixedValueScaleMin),this.valueScaleMax=typeof this.options.valueScaleMax<"u"?+this.options.valueScaleMax:null,this.fixedValueScaleMax!==null&&(this.valueScaleMax=this.fixedValueScaleMax)}},{key:"on",value:function(r,i){this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push(i)}},{key:"off",value:function(r,i){const o=this.listeners[r].indexOf(i);o===-1||o>=this.listeners[r].length||this.listeners[r].splice(o,1)}},{key:"rerender",value:function(r){ig(t,"rerender",this)([r]),this.renderVersion+=1,this.tilesetInfo&&(this.checkValueScaleLimits(),Au(this.tilesetInfo)?this.maxZoom=this.tilesetInfo.resolutions.length:this.maxZoom=+this.tilesetInfo.max_zoom,this.options?.maxZoom&&(this.options.maxZoom>=0?this.maxZoom=Math.min(this.options.maxZoom,this.maxZoom):console.error("Invalid maxZoom on track:",this)))}},{key:"tilesetInfoReceived",value:function(){}},{key:"visibleAndFetchedIds",value:function(){return Object.keys(this.fetchedTiles).filter(r=>this.visibleTileIds.has(r))}},{key:"visibleAndFetchedTiles",value:function(){return this.visibleAndFetchedIds().map(r=>this.fetchedTiles[r])}},{key:"setVisibleTiles",value:function(r){this.visibleTiles=r.map(i=>({tileId:this.tileToLocalId(i),remoteId:this.tileToRemoteId(i),mirrored:i.mirrored})),this.visibleTileIds=new Set(this.visibleTiles.map(i=>i.tileId))}},{key:"removeOldTiles",value:function(){this.calculateVisibleTiles();const i=[...new Set(Object.keys(this.fetchedTiles))].filter(o=>!this.visibleTileIds.has(o));this.removeTiles(i)}},{key:"refreshTiles",value:function(){if(!this.tilesetInfo)return;this.calculateVisibleTiles();const r=new Set(Object.keys(this.fetchedTiles)),i=[...this.visibleTiles].filter(o=>!this.fetching.has(o.remoteId)&&!r.has(o.tileId));for(let o=0;o<i.length;o++)this.fetching.add(i[o].remoteId);this.removeOldTiles(),this.fetchNewTiles(i)}},{key:"parentInFetched",value:function(r){const i=r.tileData.tilesetUid;let o=r.tileData.zoomLevel,a=r.tileData.tilePos;for(;o>0;)if(o-=1,a=a.map(c=>Math.floor(c/2)),`${i}.${o}.${a.join(".")}`in this.fetchedTiles)return!0;return!1}},{key:"parentTileId",value:function(r){const i=r.tileData.zoomLevel-1,o=r.tileData.tilePos.map(s=>Math.floor(s/2));return`${r.tileData.tilesetUid}.${i}.${o.join(".")}`}},{key:"removeTiles",value:function(r){!r.length||!this.areAllVisibleTilesLoaded()||this.renderingTiles.size||(r.forEach(i=>{const o=i;this.destroyTile(this.fetchedTiles[o]),o in this.tileGraphics&&(this.pMain.removeChild(this.tileGraphics[o]),delete this.tileGraphics[o]),delete this.fetchedTiles[o]}),this.synchronizeTilesAndGraphics(),this.draw())}},{key:"zoomed",value:function(r,i,o=1,a=0,s=0){this.xScale(r),this.yScale(i),this.refreshTilesDebounced(),this.pMobile.position.x=a,this.pMobile.position.y=this.position[1],this.pMobile.scale.x=o,this.pMobile.scale.y=1}},{key:"setPosition",value:function(r){ig(t,"setPosition",this)([r])}},{key:"setDimensions",value:function(r){ig(t,"setDimensions",this)([r])}},{key:"areAllVisibleTilesLoaded",value:function(){const r=new Set(Object.keys(this.fetchedTiles)),i=[...this.visibleTileIds];for(let o=0;o<i.length;o++)if(!r.has(i[o]))return!1;return!0}},{key:"allTilesLoaded",value:function(){}},{key:"minValue",value:function(r){return r?(this.scale.minValue=r,this):this.valueScaleMin!==null?this.valueScaleMin:this.scale.minValue}},{key:"maxValue",value:function(r){return r?(this.scale.maxValue=r,this):this.valueScaleMax!==null?this.valueScaleMax:this.scale.maxValue}},{key:"minRawValue",value:function(){return this.scale.minRawValue}},{key:"maxRawValue",value:function(){return this.scale.maxRawValue}},{key:"initTile",value:function(r){r.tileData?.dense&&(this.scale.minRawValue=this.continuousScaling?this.minVisibleValue():this.minVisibleValueInTiles(),this.scale.maxRawValue=this.continuousScaling?this.maxVisibleValue():this.maxVisibleValueInTiles(),this.scale.minValue=this.scale.minRawValue,this.scale.maxValue=this.scale.maxRawValue)}},{key:"updateTile",value:function(r){}},{key:"destroyTile",value:function(r){}},{key:"addMissingGraphics",value:function(){const r=Object.keys(this.fetchedTiles);this.renderVersion+=1;for(let i=0;i<r.length;i++)if(!(r[i]in this.tileGraphics)){const o=new Ye.PIXI.Graphics;this.pMain.addChild(o),this.fetchedTiles[r[i]].graphics=o,this.initTile(this.fetchedTiles[r[i]]),this.tileGraphics[r[i]]=o}}},{key:"updateExistingGraphics",value:function(){const r=Object.keys(this.fetchedTiles);for(let i=0;i<r.length;i++){const o=this.fetchedTiles[r[i]];this.updateTile(o)}}},{key:"synchronizeTilesAndGraphics",value:function(){if(this.addMissingGraphics(),this.removeOldTiles(),this.updateExistingGraphics(),this.listeners.dataChanged)for(const r of this.listeners.dataChanged)r(this.visibleAndFetchedTiles().map(i=>i.tileData))}},{key:"loadTileData",value:function(r,i){let o=this.lruCache.get(r.tileId);return o||(o=i(r.data,r.type),this.lruCache.put(r.tileId,o)),o}},{key:"fetchNewTiles",value:function(r){if(this._checkForErrors(),this.draw(),r.length>0){const i=[...new Set(r.map(o=>o.remoteId))];this.dataFetcher.fetchTilesDebounced(this.receivedTiles.bind(this),i)}}},{key:"receivedTiles",value:function(r){for(let i=0;i<this.visibleTiles.length;i++){const{tileId:o}=this.visibleTiles[i];if(r[this.visibleTiles[i].remoteId]&&this.visibleTiles[i].remoteId in r){if(o in this.fetchedTiles||(this.fetchedTiles[o]=this.visibleTiles[i]),Array.isArray(r[this.visibleTiles[i].remoteId])){const a=r[this.visibleTiles[i].remoteId];this.fetchedTiles[o].tileData=[...a],Object.keys(a).filter(s=>Number.isNaN(+s)).forEach(s=>{this.fetchedTiles[o].tileData[s]=a[s]})}else this.fetchedTiles[o].tileData={...r[this.visibleTiles[i].remoteId]};this.fetchedTiles[o].tileData.error&&console.warn("Error in loaded tile",o,this.fetchedTiles[o].tileData)}}for(const i in r)if(r[i]){const o=r[i].tilePositionId;this.fetching.has(o)&&this.fetching.delete(o)}this.synchronizeTilesAndGraphics(),this.draw(),this.drawLabel(),this.valueScale&&(!this.prevValueScale||JSON.stringify(this.valueScale.domain())!==JSON.stringify(this.prevValueScale.domain()))&&(this.prevValueScale=this.valueScale.copy(),this.onValueScaleChanged&&this.onValueScaleChanged()),this.animate(),this.areAllVisibleTilesLoaded()&&this.pubSub?.publish("TiledPixiTrack.tilesLoaded",{uuid:this.uuid})}},{key:"_checkForErrors",value:function(){const r=Object.values(this.fetchedTiles).map(i=>i.tileData?.error&&`${i.tileId}: ${i.tileData.error}`).filter(i=>i);return r.length?this.errorTexts.TiledPixiTrack=r.join(`
280
- `):this.errorTexts.TiledPixiTrack="",this.tilesetInfoError&&(this.errorTexts.TiledPixiTrack=this.tilesetInfoError,r.push(this.tilesetInfoError)),r}},{key:"draw",value:function(){if(!this.delayDrawing){if(this.tilesetInfo)this.trackNotFoundText.visible=!1;else{if(this.dataFetcher.tilesetInfoLoading)this.trackNotFoundText.text="Loading...";else{const r=this.dataFetcher.dataConfig.server||"unknown",i=this.dataFetcher.dataConfig.tilesetUid;this.trackNotFoundText.text=`Tileset info not found. Server: [${r}] tilesetUid: [${i}]`}[this.trackNotFoundText.x,this.trackNotFoundText.y]=this.position,this.trackNotFoundText.visible=!0}this.pubSub?.publish("TiledPixiTrack.tilesDrawnStart",{uuid:this.uuid}),this._checkForErrors(),ig(t,"draw",this)([]),Object.keys(this.fetchedTiles).forEach(r=>{this.drawTile(this.fetchedTiles[r])}),this.pubSub?.publish("TiledPixiTrack.tilesDrawnEnd",{uuid:this.uuid})}}},{key:"drawTile",value:function(r){}},{key:"calculateMedianVisibleValue",value:function(){this.areAllVisibleTilesLoaded()&&this.allTilesLoaded();let r=this.visibleAndFetchedIds();r.length===0&&(r=Object.keys(this.fetchedTiles));const i=[].concat(...r.filter(o=>this.fetchedTiles[o].tileData.dense).map(o=>Array.from(this.fetchedTiles[o].tileData.dense))).filter(o=>o>0);return this.medianVisibleValue=Lm(i),this.medianVisibleValue}},{key:"allVisibleValues",value:function(){return[].concat(...this.visibleAndFetchedIds().map(r=>Array.from(this.fetchedTiles[r].tileData.dense)))}},{key:"minVisibleValue",value:function(r=!1){return this.minVisibleValueInTiles(r)}},{key:"minVisibleValueInTiles",value:function(r=!1){let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));let o=Math.min(...i.map(a=>this.fetchedTiles[a].tileData.minNonZero));return o===Number.MAX_SAFE_INTEGER&&(o=null),r?o:this.valueScaleMin!==null?this.valueScaleMin:o}},{key:"maxVisibleValue",value:function(r=!1){return this.maxVisibleValueInTiles(r)}},{key:"maxVisibleValueInTiles",value:function(r=!1){let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));let o=Math.max(...i.map(a=>this.fetchedTiles[a].tileData.maxNonZero));return o===Number.MIN_SAFE_INTEGER&&(o=null),r?o:this.valueScaleMax!==null?this.valueScaleMax:o}},{key:"makeValueScale",value:function(r,i,o,a){let s=null,c=0,l=a;(l===null||typeof l>"u")&&(l=6);let u=Math.min(this.dimensions[1]-l,l),f=Math.max(this.dimensions[1]-l,l);if(this.dimensions[1]-l<l&&(u=this.dimensions[1]/2,f=this.dimensions[1]/2),this.options.valueScaling==="log")c=i,c||(c=r),s=Ro().domain([c,o+c]).range([f,u]);else if(this.options.valueScaling==="quantile"){const h=this.dimensions[1]-l,p=l,d=Xh().domain(this.allVisibleValues()).range(en(h,p,(p-h)/256));return d.ticks=g=>ua(h,p,g),[d,0]}else if(this.options.valueScaling==="setquantile"){const h=this.dimensions[1]-l,p=l,d=new Set(this.allVisibleValues()),g=Xh().domain([...d]).range(en(h,p,(p-h)/256));return g.ticks=y=>ua(h,p,y),[g,0]}else s=Et().domain([r,o]).range([f,u]);return[s,c]}}])}(Bn);function sve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,uve(r.key),r)}}function cve(e,t,n){return t&&lve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function uve(e){var t=fve(e,"string");return typeof t=="symbol"?t:t+""}function fve(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function hve(e,t,n){return t=Gl(t),pve(e,JL()?Reflect.construct(t,n||[],Gl(e).constructor):t.apply(e,n))}function pve(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dve(e)}function dve(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function JL(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(JL=function(){return!!e})()}function e$(e,t,n,r){var i=jE(Gl(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function jE(){return jE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=gve(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},jE.apply(null,arguments)}function gve(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Gl(e))!==null;);return e}function Gl(e){return Gl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Gl(e)}function mve(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&BE(e,t)}function BE(e,t){return BE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},BE(e,t)}const vve=1024;let zE=function(e){function t(n,r){var i;sve(this,t),i=hve(this,t,[n,r]);const{onMouseMoveZoom:o,isValueScaleLocked:a,getLockGroupExtrema:s}=n;return i.onMouseMoveZoom=o,i.isValueScaleLocked=a,i.getLockGroupExtrema=s,i.onMouseMoveZoom&&i.pubSubs.push(i.pubSub.subscribe("app.mouseMove",i.mouseMoveHandler.bind(i))),i}return mve(t,e),cve(t,[{key:"initTile",value:function(r){e$(t,"initTile",this)([r])}},{key:"tileToLocalId",value:function(r){return`${r.join(".")}`}},{key:"tileToRemoteId",value:function(r){return`${r.join(".")}`}},{key:"relevantScale",value:function(){return null}},{key:"setVisibleTiles",value:function(r){this.visibleTiles=r.map(i=>({tileId:this.tileToLocalId(i),remoteId:this.tileToRemoteId(i)})),this.visibleTileIds=new Set(this.visibleTiles.map(i=>i.tileId))}},{key:"calculateVisibleTiles",value:function(){if(!this.tilesetInfo)return;if(this.zoomLevel=this.calculateZoomLevel(),this.tilesetInfo.resolutions){const o=this.tilesetInfo.resolutions.map(c=>+c).sort((c,l)=>l-c),s=wt.calculateTilesFromResolution(o[this.zoomLevel],this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.bins_per_dimension||this.tilesetInfo.tile_size).map(c=>[this.zoomLevel,c]);this.setVisibleTiles(s);return}const i=wt.calculateTiles(this.zoomLevel,this.relevantScale(),this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.max_zoom,this.tilesetInfo.max_width).map(o=>[this.zoomLevel,o]);this.setVisibleTiles(i)}},{key:"getTilePosAndDimensions",value:function(r,i,o){const a=i[0],s=i[0];if(this.tilesetInfo.resolutions){const y=o||vve,m=this.tilesetInfo.resolutions.map(S=>+S).sort((S,k)=>k-S)[r],v=m*y,_=v,T=m*y*i[0],w=m*y*i[1];return{tileX:T,tileY:w,tileWidth:v,tileHeight:_}}const c=this.tilesetInfo.max_width,l=this.tilesetInfo.max_width,u=this.tilesetInfo.min_pos[0],f=this.tilesetInfo.min_pos[1],h=c/2**r,p=l/2**r,d=u+a*h,g=f+s*p;return{tileX:d,tileY:g,tileWidth:h,tileHeight:p}}},{key:"updateTile",value:function(r){}},{key:"scheduleRerender",value:function(){this.backgroundTaskScheduler.enqueueTask(this.handleRerender.bind(this),null,this.uuid)}},{key:"handleRerender",value:function(){this.rerender(this.options,!1)}},{key:"getIndicesOfVisibleDataInTile",value:function(r){const i=this._xScale.range();if(!this.tilesetInfo)return[null,null];if(!r.tileData.dense)return console.warn(`No dense data in tile: ${r.tileData.tilePos}`),[null,null];const{tileX:o,tileWidth:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos,this.tilesetInfo.bins_per_dimension||this.tilesetInfo.tile_size),s=Et().domain([0,this.tilesetInfo.tile_size||this.tilesetInfo.bins_per_dimension]).range([o,o+a]),c=Math.max(0,Math.round(s.invert(this._xScale.invert(i[0])))),l=Math.min(r.tileData.dense.length,Math.round(s.invert(this._xScale.invert(i[1]))));return[c,l]}},{key:"minVisibleValue",value:function(r=!1){let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));const o=i.map(s=>this.fetchedTiles[s]).filter(s=>s.tileData.dense).map(s=>{const c=this.getIndicesOfVisibleDataInTile(s);return s.tileData.denseDataExtrema.getMinNonZeroInSubset(c)}),a=Math.min(...o);return r?a:this.valueScaleMin!==null?this.valueScaleMin:a}},{key:"maxVisibleValue",value:function(r=!1){let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));const o=i.map(s=>this.fetchedTiles[s]).filter(s=>s.tileData.dense).map(s=>{const c=this.getIndicesOfVisibleDataInTile(s);return s.tileData.denseDataExtrema.getMaxNonZeroInSubset(c)}),a=Math.max(...o);return r?a:this.valueScaleMax!==null?this.valueScaleMax:a}},{key:"getAggregatedVisibleValue",value:function(r="max"){const i=r==="min"?Math.min:Math.max,o=r==="min"?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;let a=this.visibleAndFetchedIds();a.length===0&&(a=Object.keys(this.fetchedTiles));const s=this._xScale.range();return a.map(c=>this.fetchedTiles[c]).map(c=>{if(!c.tileData.tilePos)return r==="min"?this.minVisibleValue():this.maxVisibleValue();const{tileX:l,tileWidth:u}=this.getTilePosAndDimensions(c.tileData.zoomLevel,c.tileData.tilePos,this.tilesetInfo.bins_per_dimension||this.tilesetInfo.tile_size),f=Et().domain([0,this.tilesetInfo.tile_size||this.tilesetInfo.bins_per_dimension]).range([l,l+u]),h=Math.max(0,Math.round(f.invert(this._xScale.invert(s[0])))),p=Math.min(c.tileData.dense.length,Math.round(f.invert(this._xScale.invert(s[1]))));return c.tileData.dense.slice(h,p)}).reduce((c,l)=>i(c,...l),o)}},{key:"getDataAtPos",value:function(r){let i;if(!this.tilesetInfo)return i;const o=this.calculateZoomLevel(),a=wt.calculateTileWidth(this.tilesetInfo,o,this.tilesetInfo.tile_size),s=this._xScale.invert(r)/a,c=this.tileToLocalId([o,Math.floor(s)]),l=this.fetchedTiles[c];if(!l)return i;const u=this.tilesetInfo.tile_size*(s-Math.floor(s));return l.tileData.dense?l.tileData.dense[Math.floor(u)]:null}},{key:"mouseMoveHandler",value:function({x:r,y:i}={}){this.isWithin(r,i)&&(this.mouseX=r,this.mouseY=i,this.mouseMoveZoomHandler())}},{key:"mouseMoveZoomHandler",value:function(){}},{key:"zoomed",value:function(...r){e$(t,"zoomed",this)(r),this.mouseMoveZoomHandler()}}])}(Si);function yve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Tve(r.key),r)}}function _ve(e,t,n){return t&&bve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Tve(e){var t=wve(e,"string");return typeof t=="symbol"?t:t+""}function wve(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Sve(e,t,n){return t=Wl(t),Eve(e,t$()?Reflect.construct(t,n||[],Wl(e).constructor):t.apply(e,n))}function Eve(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kve(e)}function kve(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function t$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(t$=function(){return!!e})()}function og(e,t,n,r){var i=HE(Wl(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function HE(){return HE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=xve(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},HE.apply(null,arguments)}function xve(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Wl(e))!==null;);return e}function Wl(e){return Wl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wl(e)}function Cve(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&FE(e,t)}function FE(e,t){return FE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},FE(e,t)}let Yl=function(e){function t(n,r){var i;yve(this,t),i=Sve(this,t,[n,r]);const{animate:o,isShowGlobalMousePosition:a}=n;return i.constIndicator=new Ye.PIXI.Graphics,i.pMain.addChild(i.constIndicator),i.axis=new xd(i),i.pBase.addChild(i.axis.pAxis),i.animate=o,i.options=r,i.isShowGlobalMousePosition=a,i.pubSubs=[],i.options.showMousePosition&&!i.hideMousePosition&&(i.hideMousePosition=Bo(i,i.is2d,i.isShowGlobalMousePosition())),i}return Cve(t,e),_ve(t,[{key:"rerender",value:function(r,i){const o=JSON.stringify(r);!i&&o===this.prevOptions||(og(t,"rerender",this,3)([r,i]),this.prevOptions=o,this.options=r,this.options.showMousePosition&&!this.hideMousePosition&&(this.hideMousePosition=Bo(this,this.is2d,this.isShowGlobalMousePosition())),!this.options.showMousePosition&&this.hideMousePosition&&(this.hideMousePosition(),this.hideMousePosition=void 0))}},{key:"calculateZoomLevel",value:function(){if(this.tilesetInfo.resolutions)return wt.calculateZoomLevelFromResolutions(this.tilesetInfo.resolutions,this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0]-2);const r=wt.calculateZoomLevel(this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.bins_per_dimension||this.tilesetInfo.tile_size);let i=Math.min(r,this.maxZoom);return i=Math.max(i,0),i}},{key:"relevantScale",value:function(){return this._xScale}},{key:"draw",value:function(){og(t,"draw",this,3)([]),this.drawConstIndicator()}},{key:"drawAxis",value:function(r){if(!this.options.axisPositionVertical&&!this.options.axisPositionHorizontal){this.axis.clearAxis();return}if(this.options.axisPositionVertical&&this.options.axisPositionVertical==="hidden"){this.axis.clearAxis();return}if(this.options.axisPositionHorizontal&&this.options.axisPositionHorizontal==="hidden"){this.axis.clearAxis();return}const i=this.options.axisMargin||0;this.options.axisPositionHorizontal==="left"||this.options.axisPositionVertical==="top"?(this.axis.pAxis.position.x=this.position[0]+i,this.axis.pAxis.position.y=this.position[1],this.axis.drawAxisRight(r,this.dimensions[1])):this.options.axisPositionHorizontal==="outsideLeft"||this.options.axisPositionVertical==="outsideTop"?(this.axis.pAxis.position.x=this.position[0]+i,this.axis.pAxis.position.y=this.position[1],this.axis.drawAxisLeft(r,this.dimensions[1])):this.options.axisPositionHorizontal==="right"||this.options.axisPositionVertical==="bottom"?(this.axis.pAxis.position.x=this.position[0]+this.dimensions[0]-i,this.axis.pAxis.position.y=this.position[1],this.axis.drawAxisLeft(r,this.dimensions[1])):(this.options.axisPositionHorizontal==="outsideRight"||this.options.axisPositionVertical==="outsideBottom")&&(this.axis.pAxis.position.x=this.position[0]+this.dimensions[0]-i,this.axis.pAxis.position.y=this.position[1],this.axis.drawAxisRight(r,this.dimensions[1]))}},{key:"mouseMoveZoomHandler",value:function(r=this.mouseX,i=this.mouseY){if(typeof r>"u"||!this.areAllVisibleTilesLoaded()||!this.tilesetInfo)return;let o=0,a=0,s="1d-horizontal";this.isLeftModified?(o=i-this.position[1],a=r-this.position[0],s="1d-vertical"):(o=r-this.position[0],a=i-this.position[1]);const c=r-this.position[0],l=i-this.position[1],u=this._xScale.invert(o),f=this._yScale.invert(a),h=this.getDataAtPos(o);h&&this.onMouseMoveZoom({trackId:this.id,data:h,absX:r,absY:i,relX:c,relY:l,dataX:u,dataY:f,orientation:s})}},{key:"drawConstIndicator",value:function(){if(this.constIndicator){for(this.constIndicator.clear();this.constIndicator.children[0];)this.constIndicator.removeChild(this.constIndicator.children[0]);!this.options.constIndicators||!this.valueScale||this.options.constIndicators.forEach(({color:r="black",opacity:i=1,label:o=null,labelColor:a="black",labelOpacity:s=1,labelPosition:c="leftTop",labelSize:l=12,value:u=0}={})=>{const f=gt(r),h=gt(a);this.constIndicator.beginFill(f,i);const p=this.valueScale(u);let d=0,g=0;if(o){const y=new Ye.PIXI.Text(o,{fontFamily:"Arial",fontSize:l,fill:h});switch(y.alpha=s,c){case"right":y.anchor.x=1,y.anchor.y=.5,y.x=this.position[0]+this.dimensions[0]-6,y.y=p,g=y.width+8;break;case"rightBottom":y.anchor.x=1,y.anchor.y=0,y.x=this.position[0]+this.dimensions[0]-6,y.y=p;break;case"rightTop":y.anchor.x=1,y.anchor.y=1,y.x=this.position[0]+this.dimensions[0]-6,y.y=p;break;case"left":y.anchor.x=0,y.anchor.y=.5,y.x=this.position[0]+2,y.y=p,d=y.width+4;break;case"leftBottom":y.anchor.x=0,y.anchor.y=0,y.x=this.position[0]+2,y.y=p;break;default:y.anchor.x=0,y.anchor.y=1,y.x=this.position[0]+2,y.y=p;break}this.constIndicator.addChild(y)}this.constIndicator.drawRect(this.position[0]+d,p,this.dimensions[0]-g,1)})}}},{key:"exportSVG",value:function(){let r=null,i=null;og(t,"exportSVG",this,1)?[i,r]=og(t,"exportSVG",this,3)([]):(i=document.createElement("g"),r=i),i.setAttribute("class","horizontal-tiled-1d-track");const o=document.createElement("g");return r.appendChild(o),this.options.constIndicators&&this.options.constIndicators.forEach(({color:a="black",opacity:s=1,label:c=null,labelColor:l="black",labelOpacity:u=1,labelPosition:f="leftTop",labelSize:h=12,value:p=0}={})=>{const d=this.valueScale(p);if(c){const y=document.createElement("text");switch(y.textContent=c,y.setAttribute("x",this.position[0]),y.setAttribute("y",d),y.setAttribute("style",`font-family: 'Arial'; font-size: ${h}px; fill: ${l}; fill-opacity: ${u};`),f){case"rightBottom":y.setAttribute("x",this.position[0]+this.dimensions[0]-6),y.setAttribute("y",d+h+2),y.setAttribute("text-anchor","end");break;case"right":case"rightTop":y.setAttribute("x",this.position[0]+this.dimensions[0]-6),y.setAttribute("y",d-2),y.setAttribute("text-anchor","end");break;case"leftBottom":y.setAttribute("x",this.position[0]+2),y.setAttribute("y",d+h+2);break;default:y.setAttribute("x",this.position[0]+2),y.setAttribute("y",d-2);break}o.appendChild(y)}const g=document.createElement("line");g.setAttribute("x1",this.position[0]),g.setAttribute("y1",d),g.setAttribute("x2",this.dimensions[0]),g.setAttribute("y2",d),g.setAttribute("stroke",a),g.setAttribute("stroke-opacity",s),o.appendChild(g)}),[i,r]}}])}(zE);function Ove(e,t,n){return t=Xl(t),Pve(e,r$()?Reflect.construct(t,n||[],Xl(e).constructor):t.apply(e,n))}function Pve(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ave(e)}function Ave(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(r$=function(){return!!e})()}function es(e,t,n,r){var i=qE(Xl(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function qE(){return qE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Mve(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},qE.apply(null,arguments)}function Mve(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Xl(e))!==null;);return e}function Xl(e){return Xl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xl(e)}function Ive(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&UE(e,t)}function UE(e,t){return UE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},UE(e,t)}function n$(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Dve(r.key),r)}}function i$(e,t,n){return t&&Rve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dve(e){var t=Nve(e,"string");return typeof t=="symbol"?t:t+""}function Nve(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}const Lve=16,VE=50,GE=5e3,o$=5,ts={align:"center",fontSize:"14px",fontFamily:"Arial",stroke:"white",strokeThickness:2,fontWeight:400,dropShadow:!0,dropShadowColor:"white",dropShadowDistance:0,dropShadowBlur:2},a$=(e,t,n,r,i)=>{const o=[];for(;e.length;){const[a,s]=e.splice(0,2);o.push([a*t+n,s*r+i])}return o},$ve=e=>{let t=0;if(e.length===0)return t;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return t},s$=(e,t,n)=>{const r=(n.domain()[1]-n.domain()[0])/(t.domain()[1]-t.domain()[0]),o=t.domain().map(n)[0];e.scale.x=r,e.position.x=-o*r},jve=e=>{const t={};for(let n=0;n<e.length;n++)t[e[n].uid]=e[n];return Object.values(t)};let Bve=function(){function e(t){n$(this,e),this.track=t,this.texts={},this.textsList=[],this.textWidths={},this.textHeights={},this.textGraphics=new Ye.PIXI.Graphics,this.track.pMain.addChild(this.textGraphics),this.fontSize=9}return i$(e,[{key:"hideOverlaps",value:function(){const[n,r]=[this.allBoxes,this.allTexts];Yf(n,(i,o)=>{r[i].importance>r[o].importance?r[i].text.visible&&(r[o].text.visible=!1):r[o].text.visible&&(r[i].text.visible=!1)})}},{key:"startDraw",value:function(){this.allBoxes=[],this.allTexts=[]}},{key:"lightUpdateSingleText",value:function(n,r,i,o){if(!this.texts[n.uid]||!this.track.options.showTexts)return;const a=this.texts[n.uid],s=3;a.position.x=r,a.position.y=i,a.visible=!0,this.allBoxes.push([a.position.x-s,a.position.y-this.textHeights[n.uid]/2,a.position.x+this.textWidths[n.uid]+s,a.position.y+this.textHeights[n.uid]/2]),this.allTexts.push({text:a,...o})}},{key:"updateSingleText",value:function(n,r,i,o){if(!this.texts[n.uid])return;const a=this.texts[n.uid];a.position.x=r,a.position.y=i,a.nominalY=i;const s=this.track.options.fontColor!==void 0?gt(this.track.options.fontColor):"black",c=+this.track.options.fontSize||ts.fontSize;if(c!==this.fontSize&&(this.fontSize=c,this.textWidths={},this.textHeights={}),a.style={...ts,fill:s,fontSize:this.fontSize},a.text=o,!(n.uid in this.textWidths)){a.updateTransform();const l=a.getBounds().width,u=a.getBounds().height,f=5;this.textWidths[n.uid]=l,this.textHeights[n.uid]=u-f}}},{key:"updateTexts",value:function(){if(this.track.options.showTexts){this.texts={};let n=[(0-this.track.vertY)/(this.track.vertK*this.track.prevK),(this.track.dimensions[1]-this.track.vertY)/(this.track.vertK*this.track.prevK)];const r=n[1]-n[0];n=[n[0]-r*.8,n[1]+r*.8];const i=this.track.uniqueSegments.filter(o=>!o.yMiddle||o.yMiddle>n[0]&&o.yMiddle<n[1]);for(i.forEach((o,a)=>{if(a>=(+this.track.options.maxTexts||VE))return;let s=this.textsList[a];s||(s=new Ye.PIXI.Text,this.textsList.push(s),this.textGraphics.addChild(s)),s.style={...ts,fontSize:+this.track.options.fontSize||ts.fontSize},this.track.isLeftModified&&(s.scale.x=-1),s.anchor.x=.5,s.anchor.y=.5,this.texts[o.uid]=s});this.textsList.length>Math.min(i.length,+this.track.options.maxTexts||VE);){const o=this.textsList.pop();this.textGraphics.removeChild(o)}}}}])}(),WE=function(e){function t(n,r){var i;return n$(this,t),i=Ove(this,t,[n,r]),i.valueScaleTransform=Ar,i.textManager=new Bve(i),i.vertY=1,i.vertK=0,i.prevY=0,i.prevK=1,i.minRawValue=null,i.maxRawValue=null,i.rectGraphics=new Ye.PIXI.Graphics,i.pMain.addChild(i.rectGraphics),i.selectedRect=null,i.uniqueSegments=[],i}return Ive(t,e),i$(t,[{key:"initialize",value:function(){this.initialized||([this.prevK,this.vertK,this.vertY]=[1,1,0],this.drawnRects||(this.drawnRects={}),this.colorScale||(this.options.colorRange?this.colorScale=jo(this.options.colorRange):this.colorScale=Is),this.initialized=!0)}},{key:"updateExistingGraphics",value:function(){const r=this._checkForErrors();let i=[],o=[];if(r.length>0){this.draw();return}if(this.uniqueSegments=jve(Object.values(this.fetchedTiles).filter(a=>a.tileData.length).flatMap(a=>a.tileData)),this.uniqueSegments.forEach(a=>{a.importance||(a.importance=$ve(a.uid.toString()))}),this.uniqueSegments.sort((a,s)=>s.importance-a.importance),!this.options||!this.options.valueColumn){const a=this.uniqueSegments.map(s=>{const c=+s.chrOffset;return{from:+s.fields[1]+c,to:+s.fields[2]+c,value:s,text:s.fields[3],strand:s.fields.length>=6&&s.fields[5]==="-"?"-":"+"}});i=Up(a.filter(s=>s.strand==="+")),o=Up(a.filter(s=>s.strand==="-"))}else i=[this.uniqueSegments.map(a=>({value:a}))];this.plusStrandRows=i,this.minusStrandRows=o,this.textManager.updateTexts(),this.render()}},{key:"selectRect",value:function(r){this.selectedRect=r,this.render(),this.animate()}},{key:"clickOutside",value:function(){this.selectRect(null)}},{key:"initTile",value:function(r){}},{key:"destroyTile",value:function(r){}},{key:"removeTiles",value:function(r){es(t,"removeTiles",this,3)([r])}},{key:"drawTile",value:function(r){this.options?.valueColumn&&this.valueScale&&this.drawAxis(this.valueScale)}},{key:"rerender",value:function(r,i){es(t,"rerender",this,3)([r,i]),this.valueScale=null,this.drawnRects={},this.options.colorRange?this.colorScale=jo(this.options.colorRange):this.colorScale=Is,this.updateExistingGraphics()}},{key:"updateTile",value:function(r){}},{key:"allVisibleRects",value:function(){const r={};Object.values(this.fetchedTiles).forEach(s=>{if(s.plusStrandRows)for(const c of s.plusStrandRows[0])r[c.value.uid]||(r[c.value.uid]=c)});const i=Object.values(r).sort((s,c)=>s.from-c.from);let o=0,a=0;for(let s=0;s<i.length;s++)if(i[s].staggeredStartPosition!==void 0){o=s,a=i[s].staggeredStartPosition;break}for(let s=o;s<i.length;s++)i[s].staggeredStartPosition=(a+s-o)%2;for(let s=o;s>=0&&i.length;s--)i[s].staggeredStartPosition=(a+o-s)%2;return r}},{key:"drawSegmentStyle",value:function(r,i,o,a,s){const l=o+a/2,u=[r,o,r+2*.1,o,r+2*.1,l-.1,i-2*.1,l-.1,i-2*.1,o,i,o,i,o+a,i-2*.1,o+a,i-2*.1,l+.1,r+2*.1,l+.1,r+2*.1,o+a,r,o+a];return this.rectGraphics.drawPolygon(u),u}},{key:"drawPoly",value:function(r,i,o,a,s){let c=null;return this.options.annotationStyle==="segment"?this.drawSegmentStyle(r,i,o,a,s):((s==="+"||s==="-")&&i-r<Lve/2?(c=[r,o,r+a/2,o+a/2,r,o+a],s==="+"?this.rectGraphics.drawPolygon(c):(c=[i,o,i-a/2,o+a/2,i,o+a],this.rectGraphics.drawPolygon(c))):(s==="+"?c=[r,o,i-a/2,o,i,o+a/2,i-a/2,o+a,r,o+a]:s==="-"?c=[r+a/2,o,i,o,i,o+a,r+a/2,o+a,r,o+a/2]:c=[r,o,i,o,i,o+a,r,o+a],this.rectGraphics.drawPolygon(c)),c)}},{key:"setValueScale",value:function(){if(this.valueScale=null,this.options?.valueColumn){const r=this.options.colorEncodingRange?+this.options.colorEncodingRange[0]:this.minVisibleValueInTiles(+this.options.valueColumn),i=this.options.colorEncodingRange?+this.options.colorEncodingRange[1]:this.maxVisibleValueInTiles(+this.options.valueColumn);this.options.valueColumn&&([this.valueScale]=this.makeValueScale(r,this.calculateMedianVisibleValue(+this.options.valueColumn),i))}}},{key:"setColorValueScale",value:function(){if(this.colorValueScale=null,this.options?.colorEncoding&&this.options.colorEncoding!=="itemRgb"){const r=this.options.colorEncodingRange?+this.options.colorEncodingRange[0]:this.minVisibleValueInTiles(+this.options.colorEncoding),i=this.options.colorEncodingRange?+this.options.colorEncodingRange[1]:this.maxVisibleValueInTiles(+this.options.colorEncoding);this.colorValueScale=Et().domain([r,i]).range([0,255])}}},{key:"renderRows",value:function(r,i,o,a,s){this.initialize();const c=Jc().domain(en(i)).range([o,a]);this.allVisibleRects();let l=null;this.options.staggered&&(l=this.allVisibleRects());for(let u=0;u<r.length;u++)for(let f=0;f<r[u].length;f++){const h=r[u][f].value,p=h.fields,d=+h.xStart,g=+h.xEnd,y=(d+g)/2;let b=c(u)+c.bandwidth()/2,m=this.options.annotationHeight||"scaled";if(m==="scaled"&&(m=c.bandwidth(),this.options.maxAnnotationHeight&&(m=Math.min(m,+this.options.maxAnnotationHeight))),this.options&&this.options.colorEncoding==="itemRgb"&&h.fields[8]){let k=[];try{k=h.fields[8].split(",")}catch{}k.length===3&&(s=`rgb(${h.fields[8]})`)}else this.colorValueScale?s=`rgba(${P0(this.colorValueScale,this.colorScale,0,-Number.MIN_VALUE)(+p[+this.options.colorEncoding-1]).join(",")})`:this.options&&this.options.colorEncoding==="itemRgb"&&h.fields[8]&&h.fields[8].split(",").length===3&&(s=`rgb(${h.fields[8]})`);if(this.valueScale){const k=+p[+this.options.valueColumn-1];b=this.valueScale(k)}const v=this.options.fillOpacity||.3;this.selectedRect===h.uid?this.rectGraphics.lineStyle(3,0,.75):this.rectGraphics.lineStyle(1,gt(s),v),this.rectGraphics.beginFill(gt(s),v);let _=b-m/2;const T=this._xScale(d),w=this._xScale(g);this.options.staggered&&(l[h.uid].staggeredStartPosition?_-=o$/2:_+=o$/2);const S=this.drawPoly(T,w,_*this.prevK,m*this.prevK,p[5]);this.drawnRects[h.uid]=[S,{start:d,end:g,value:h,fill:s}],h.yMiddle=b,this.options.showTexts&&(f>=(+this.options.maxTexts||VE)||this.textManager.updateSingleText(h,this._xScale(y),_+m/2,h.fields[3]))}this.textManager.updateTexts()}},{key:"render",value:function(){const r=this.plusStrandRows?this.plusStrandRows.length:1,i=this.minusStrandRows?this.minusStrandRows.length:1;this.prevVertY=this.vertY;const o=this.rectGraphics;this.rectGraphics=new Ye.PIXI.Graphics,this.drawnAtScale=this._xScale.copy(),this.setValueScale(),this.setColorValueScale();const a=this.options.plusStrandColor||this.options.fillColor||"blue",s=this.options.minusStrandColor||this.options.fillColor||"purple",c=0;let l=0;this.options.separatePlusMinusStrands?l=r*this.dimensions[1]/(r+i)-c/2:l=this.dimensions[1],this.renderRows(this.plusStrandRows,r,0,l,a),this.renderRows(this.minusStrandRows,i,this.options.separatePlusMinusStrands?l+c/2:0,this.dimensions[1],s),this.pMain.removeChild(o),this.pMain.addChild(this.rectGraphics),s$(this.rectGraphics,this._xScale,this.drawnAtScale)}},{key:"calculateZoomLevel",value:function(){const r=wt.calculateZoomLevel(this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0]);let i=Math.min(r,this.maxZoom);return i=Math.max(i,0),i}},{key:"minVisibleValueInTiles",value:function(r){let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));let o=Math.min.apply(null,i.map(a=>this.fetchedTiles[a]).filter(a=>a.tileData?.length).map(a=>Math.min.apply(null,a.tileData.sort((s,c)=>c.importance-s.importance).slice(0,GE).map(s=>+s.fields[r-1]).filter(s=>!Number.isNaN(s)))));return o===Number.MAX_SAFE_INTEGER&&(o=null),o}},{key:"maxVisibleValueInTiles",value:function(r){let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));let o=Math.max.apply(null,i.map(a=>this.fetchedTiles[a]).filter(a=>a.tileData?.length).map(a=>Math.max.apply(null,a.tileData.sort((s,c)=>c.importance-s.importance).slice(0,GE).map(s=>+s.fields[r-1]).filter(s=>!Number.isNaN(s)))));return o===Number.MIN_SAFE_INTEGER&&(o=null),o}},{key:"calculateMedianVisibleValue",value:function(r){this.areAllVisibleTilesLoaded()&&this.allTilesLoaded();let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));const o=[].concat(...i.map(a=>this.fetchedTiles[a]).filter(a=>a.tileData?.length).map(a=>a.tileData.sort((s,c)=>c.importance-s.importance).slice(0,GE).map(s=>+s.fields[r-1]))).filter(a=>a>0);this.medianVisibleValue=Lm(o)}},{key:"draw",value:function(){es(t,"draw",this,3)([]),this.textManager.startDraw(),this.rectGraphics.scale.y=this.vertK,this.rectGraphics.position.y=this.vertY,this.drawnAtScale&&(s$(this.rectGraphics,this._xScale,this.drawnAtScale),this.uniqueSegments?.length&&this.uniqueSegments.forEach(r=>{const i=r.fields,o=i[3],a=this._xScale((r.xStart+r.xEnd)/2);if(this.textManager.texts[r.uid]){const s=this.textManager.texts[r.uid].nominalY*(this.vertK*this.prevK)+this.vertY;this.textManager.lightUpdateSingleText(r,a,s,{importance:r.importance,caption:o,strand:i[5]})}}),this.textManager.hideOverlaps())}},{key:"setPosition",value:function(r){es(t,"setPosition",this,3)([r]),[this.pMain.position.x,this.pMain.position.y]=this.position}},{key:"setDimensions",value:function(r){es(t,"setDimensions",this,3)([r])}},{key:"zoomed",value:function(r,i){this.xScale(r),this.yScale(i),this.refreshTiles(),this.draw()}},{key:"exportSVG",value:function(){let r=null,i=null;es(t,"exportSVG",this,1)?[i,r]=es(t,"exportSVG",this,3)([]):(i=document.createElement("g"),r=i);const o=document.createElement("g");o.setAttribute("transform",`translate(${this.position[0]},${this.position[1]})`),r.appendChild(o);const a=document.createElement("g"),s=document.createElement("g");return o.appendChild(a),o.appendChild(s),this.uniqueSegments.forEach(c=>{const l=document.createElement("g");if(l.setAttribute("transform",`translate(${this.rectGraphics.position.x},${this.rectGraphics.position.y})scale(${this.rectGraphics.scale.x},${this.rectGraphics.scale.y})`),a.appendChild(l),this.drawnRects&&c.uid in this.drawnRects){const u=this.drawnRects[c.uid][0],f=document.createElement("path");let h=`M ${u[0]} ${u[1]}`;for(let g=2;g<u.length;g+=2)h+=` L ${u[g]} ${u[g+1]}`;const p=this.drawnRects[c.uid][1].fill,d=this.options.fontColor!==void 0?gt(this.options.fontColor):p;if(f.setAttribute("d",h),f.setAttribute("fill",p),f.setAttribute("opacity",.3),f.style.stroke=p,f.style.strokeWidth="1px",l.appendChild(f),this.textManager.texts[c.uid]){const g=this.textManager.texts[c.uid];if(!g.visible)return;const y=document.createElement("g"),b=document.createElement("text");s.appendChild(y),y.appendChild(b),y.setAttribute("transform",`translate(${g.x},${g.y})scale(${g.scale.x},1)`),b.setAttribute("text-anchor","middle"),b.setAttribute("font-family",ts.fontFamily),b.setAttribute("font-size",+this.options.fontSize||ts.fontSize),b.setAttribute("font-weight","bold"),b.setAttribute("dy","5px"),b.setAttribute("fill",d),b.setAttribute("stroke",ts.stroke),b.setAttribute("stroke-width","0.4"),b.setAttribute("text-shadow","0px 0px 2px grey"),b.innerHTML=g.text}}}),[i,i]}},{key:"movedY",value:function(r){const i=this.valueScaleTransform,{y:o,k:a}=i,s=this.dimensions[1];o+r/a>-(a-1)*s&&o+r/a<0&&(this.valueScaleTransform=i.translate(0,r/a)),this.rectGraphics.position.y=this.valueScaleTransform.y,this.vertY=this.valueScaleTransform.y,this.animate(),this.vertY-this.prevVertY>this.dimensions[1]/2&&this.render()}},{key:"zoomedY",value:function(r,i){const o=mf.zoomedY(r,i,this.valueScaleTransform,this.dimensions[1]);this.valueScaleTransform=o;let a=o.k;const s=o.y;let c=!1;a/=this.prevK,(a>1.5||a<1/1.5)&&(this.prevK*=a,a=1,c=!0),this.vertK=a,this.vertY=s,c&&this.render(),this.rectGraphics.scale.y=a,this.rectGraphics.position.y=s,this.draw(),this.animate()}},{key:"getMouseOverHtml",value:function(r,i){if(!this.tilesetInfo||!this.drawnRects)return"";const o="",a=[r,i],s=Object.values(this.drawnRects);for(let c=0;c<s.length;c++){const l=s[c][0].slice(0),u=a$(l,this.rectGraphics.scale.x,this.rectGraphics.position.x,this.rectGraphics.scale.y,this.rectGraphics.position.y);if(ME(u,a)===-1)return s[c][1].value.fields.join(" ")}return o}}])}(Yl);function zve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,qve(r.key),r)}}function Fve(e,t,n){return t&&Hve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function qve(e){var t=Uve(e,"string");return typeof t=="symbol"?t:t+""}function Uve(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Vve(e,t,n){return t=Kl(t),Gve(e,l$()?Reflect.construct(t,n||[],Kl(e).constructor):t.apply(e,n))}function Gve(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wve(e)}function Wve(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(l$=function(){return!!e})()}function Ir(e,t,n,r){var i=YE(Kl(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function YE(){return YE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Yve(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},YE.apply(null,arguments)}function Yve(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Kl(e))!==null;);return e}function Kl(e){return Kl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kl(e)}function Xve(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&XE(e,t)}function XE(e,t){return XE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},XE(e,t)}const c$=200,ta=10,Kf=40,Qr=10,ra=Qr,u$=4,Zl=1,na=4,f$=5,Kve=256,Zf=ta+Kf+Qr+Zl+ra+na;let Ql=function(e){function t(n,r){var i;zve(this,t);const o={...n};o.onValueScaleChanged=()=>{n.onValueScaleChanged(),i.drawColorbar()},i=Vve(this,t,[o,r]);const{pubSub:a,animate:s,svgElement:c,onTrackOptionsChanged:l,onMouseMoveZoom:u,isShowGlobalMousePosition:f,isValueScaleLocked:h}=n;return i.pubSub=a,i.is2d=!0,i.animate=s,i.uid=Mt.nice(),i.scaleBrush=al(),i.onTrackOptionsChanged=l,i.isShowGlobalMousePosition=f,i.isValueScaleLocked=h,i.pColorbarArea=new Ye.PIXI.Graphics,i.pMasked.addChild(i.pColorbarArea),i.pColorbar=new Ye.PIXI.Graphics,i.pColorbarArea.addChild(i.pColorbar),i.axis=new xd(i),i.pColorbarArea.addChild(i.axis.pAxis),i.colorScale=Is,r?.colorRange&&(i.colorScale=jo(r.colorRange)),i.gBase=_t(c).append("g"),i.gMain=i.gBase.append("g"),i.gColorscaleBrush=i.gMain.append("g"),i.brushing=!1,i.prevOptions="",i.prevIndUpperLeftTile="",i.onMouseMoveZoom=u,i.setDataLensSize(11),i.dataLens=new Float32Array(i.dataLensSize**2),i.mouseMoveHandlerBound=i.mouseMoveHandler.bind(i),i.onMouseMoveZoom&&i.pubSubs.push(i.pubSub.subscribe("app.mouseMove",i.mouseMoveHandlerBound)),i.options?.showMousePosition&&!i.hideMousePosition&&(i.hideMousePosition=Bo(i,i.is2d,i.isShowGlobalMousePosition())),i.prevOptions=JSON.stringify(r),i}return Xve(t,e),Fve(t,[{key:"mouseMoveHandler",value:function(r){this.isWithin(r.x,r.y)&&(this.mouseX=r.x,this.mouseY=r.y,this.mouseMoveZoomHandler())}},{key:"mouseMoveZoomHandler",value:function(r=this.mouseX,i=this.mouseY){if(typeof r>"u"||typeof i>"u"||!this.areAllVisibleTilesLoaded()||!this.tilesetInfo)return;const o=r-this.position[0],a=i-this.position[1];let s,c;try{c=this.getVisibleRectangleData(o-this.dataLensPadding,a-this.dataLensPadding,this.dataLensSize,this.dataLensSize),s=c.get(this.dataLensPadding,this.dataLensPadding)}catch{return}const l=this.dataLensSize;let u;try{u=P0(this.limitedValueScale,this.colorScale,this.valueScale.domain()[0])}catch{return}if(!u)return;const f=Math.round(this._xScale.invert(o)),h=Math.round(this._yScale.invert(a));let p=[f,h],d=[Math.round(this._xScale.invert(o-this.dataLensPadding)),Math.round(this._xScale.invert(o+this.dataLensPadding))],g=[Math.round(this._yScale.invert(a-this.dataLensPadding)),Math.round(this._yScale.invert(a+this.dataLensPadding))];this.chromInfo&&(p=p.map(y=>dr(y,this.chromInfo).slice(0,2)),d=d.map(y=>dr(y,this.chromInfo).slice(0,2)),g=g.map(y=>dr(y,this.chromInfo).slice(0,2))),this.onMouseMoveZoom({trackId:this.id,data:s,absX:r,absY:i,relX:o,relY:a,dataX:f,dataY:h,orientation:"2d",dataLens:c,dim:l,toRgb:u,center:p,xRange:d,yRange:g,isGenomicCoords:!!this.chromInfo})}},{key:"scheduleRerender",value:function(){this.backgroundTaskScheduler.enqueueTask(this.handleRerender.bind(this),null,this.uuid)}},{key:"handleRerender",value:function(){this.rerender(this.options,!0)}},{key:"getAbsTileDim",value:function(r,i,o){const{tileX:a,tileY:s,tileWidth:c,tileHeight:l}=this.getTilePosAndDimensions(r,i),u={};return u.width=this._refXScale(a+c)-this._refXScale(a),u.height=this._refYScale(s+l)-this._refYScale(s),o?(u.x=this._refXScale(s),u.y=this._refYScale(a)):(u.x=this._refXScale(a),u.y=this._refYScale(s)),u}},{key:"updateValueScale",value:function(){let r=this.minValue(),i=this.maxValue();const o=1e-6;r!=null&&i!==void 0&&i!==null&&Math.abs(r-i)<o&&(r=Math.max(o,r-.001),i+=.001);const[a,s]=ave(this.options?.heatmapValueScaling||"log",r,this.medianVisibleValue,i);return this.valueScale=s,this.limitedValueScale=this.valueScale.copy(),this.options&&typeof this.options.scaleStartPercent<"u"&&typeof this.options.scaleEndPercent<"u"&&this.limitedValueScale.domain([this.valueScale.domain()[0]+(this.valueScale.domain()[1]-this.valueScale.domain()[0])*this.options.scaleStartPercent,this.valueScale.domain()[0]+(this.valueScale.domain()[1]-this.valueScale.domain()[0])*this.options.scaleEndPercent]),[a,s]}},{key:"rerender",value:function(r,i){Ir(t,"rerender",this,3)([r,i]),this.updateValueScale();const o=JSON.stringify(r);this.drawColorbar(),!(!i&&o===this.prevOptions)&&(this.prevOptions=o,this.options=r,Ir(t,"rerender",this,3)([r,i]),this.calculateVisibleTiles(),r?.colorRange&&(this.colorScale=jo(r.colorRange)),this.visibleAndFetchedTiles().forEach(a=>this.renderTile(a)),this.hideMousePosition&&(this.hideMousePosition(),this.hideMousePosition=void 0),this.options?.showMousePosition&&!this.hideMousePosition&&(this.hideMousePosition=Bo(this,this.is2d,this.isShowGlobalMousePosition())))}},{key:"drawLabel",value:function(){this.options.labelPosition===this.options.colorbarPosition?this.labelXOffset=Zf:this.labelXOffset=0,Ir(t,"drawLabel",this,3)([])}},{key:"tileDataToCanvas",value:function(r){const i=document.createElement("canvas");i.width=this.binsPerTile(),i.height=this.binsPerTile();const o=i.getContext("2d");o.fillStyle="transparent",o.fillRect(0,0,i.width,i.height);const a=new ImageData(r,i.width,i.height);return o.putImageData(a,0,0),i}},{key:"exportData",value:function(){if(this.tilesetInfo){const r=this.getVisibleRectangleData(0,0,this.dimensions[0],this.dimensions[1]),i={bounds:[this._xScale.domain(),this._yScale.domain()],dimensions:r.shape,data:mA(r)};wu("data.json",JSON.stringify(i))}}},{key:"setSpriteProperties",value:function(r,i,o,a){const s=this.getAbsTileDim(i,o,a);r.width=s.width,r.height=s.height,r.x=s.x,r.y=s.y,a&&o[0]!==o[1]&&(r.rotation=-Math.PI/2,r.scale.x=Math.abs(r.scale.x)*-1)}},{key:"refXScale",value:function(r){Ir(t,"refXScale",this,3)([r]),this.draw()}},{key:"refYScale",value:function(r){Ir(t,"refYScale",this,3)([r]),this.draw()}},{key:"draw",value:function(){Ir(t,"draw",this,3)([])}},{key:"newBrushOptions",value:function(r){const i=JSON.parse(JSON.stringify(this.options)),o=this.valueScale.copy().range([this.colorbarHeight,0]),a=o.invert(r[0]),c=(o.invert(r[1])-o.domain()[0])/(o.domain()[1]-o.domain()[0]),l=(a-o.domain()[0])/(o.domain()[1]-o.domain()[0]);return i.scaleStartPercent=c.toFixed(f$),i.scaleEndPercent=l.toFixed(f$),i}},{key:"brushStart",value:function(){this.brushing=!0}},{key:"brushMoved",value:function(r){if(!r.selection)return;const i=this.newBrushOptions(r.selection),o=JSON.stringify(i);this.gColorscaleBrush.selectAll(".handle--custom").attr("y",a=>a.type==="n"?r.selection[0]:r.selection[1]-u$/2),o!==this.prevOptions&&(this.prevOptions=o,this.rerender(i,!0),this.onTrackOptionsChanged(i),this.isValueScaleLocked()&&this.onValueScaleChanged())}},{key:"brushEnd",value:function(){this.brushing=!1}},{key:"setPosition",value:function(r){Ir(t,"setPosition",this,3)([r]),this.drawColorbar()}},{key:"setDimensions",value:function(r){Ir(t,"setDimensions",this,3)([r]),this.drawColorbar()}},{key:"removeColorbar",value:function(){this.pColorbarArea.visible=!1,this.scaleBrush.on(".brush")&&this.gColorscaleBrush.call(this.scaleBrush.move,null),this.gColorscaleBrush.on(".brush",null),this.gColorscaleBrush.selectAll("rect").remove()}},{key:"drawColorbar",value:function(){if(this.pColorbar.clear(),!this.options||!this.options.colorbarPosition||this.options.colorbarPosition==="hidden"){this.removeColorbar();return}if(this.pColorbarArea.visible=!0,!this.valueScale||Number.isNaN(+this.valueScale.domain()[0])||Number.isNaN(+this.valueScale.domain()[1]))return;const r=Math.min(this.dimensions[1]/2,c$);if(this.colorbarHeight=r-2*Qr,this.colorbarHeight<0){this.removeColorbar();return}if(this.valueScale.domain()[1]===this.valueScale.domain()[0]){this.removeColorbar();return}const i=this.valueScale.copy().range([this.colorbarHeight,0]);this.options.colorbarPosition==="topLeft"||this.options.colorbarPosition==="bottomLeft"?this.scaleBrush.extent([[na,0],[ra,this.colorbarHeight]]):this.scaleBrush.extent([[0,0],[ra-na,this.colorbarHeight]]),this.options.colorbarPosition==="topLeft"&&([this.pColorbarArea.x,this.pColorbarArea.y]=this.position,this.pColorbar.y=Qr,this.axis.pAxis.y=Qr,this.axis.pAxis.x=na+ra+Zl+ta,this.pColorbar.x=na+ra+Zl,this.gColorscaleBrush.attr("transform",`translate(${this.pColorbarArea.x+na},${this.pColorbarArea.y+this.pColorbar.y-1})`)),this.options.colorbarPosition==="topRight"&&(this.pColorbarArea.x=this.position[0]+this.dimensions[0]-Zf,this.pColorbarArea.y=this.position[1],this.pColorbar.y=Qr,this.axis.pAxis.y=Qr,this.axis.pAxis.x=Kf+Qr,this.pColorbar.x=Kf+Qr,this.gColorscaleBrush.attr("transform",`translate(${this.pColorbarArea.x+this.pColorbar.x+ta+2},${this.pColorbarArea.y+this.pColorbar.y-1})`)),this.options.colorbarPosition==="bottomRight"&&(this.pColorbarArea.x=this.position[0]+this.dimensions[0]-Zf,this.pColorbarArea.y=this.position[1]+this.dimensions[1]-r,this.pColorbar.y=Qr,this.axis.pAxis.y=Qr,this.axis.pAxis.x=Kf+Qr,this.pColorbar.x=Kf+Qr,this.gColorscaleBrush.attr("transform",`translate(${this.pColorbarArea.x+this.pColorbar.x+ta+Zl},${this.pColorbarArea.y+this.pColorbar.y-1})`)),this.options.colorbarPosition==="bottomLeft"&&(this.pColorbarArea.x=this.position[0],this.pColorbarArea.y=this.position[1]+this.dimensions[1]-r,this.pColorbar.y=Qr,this.axis.pAxis.y=Qr,this.axis.pAxis.x=na+ra+Zl+ta,this.pColorbar.x=na+ra+Zl,this.gColorscaleBrush.attr("transform",`translate(${this.pColorbarArea.x+2},${this.pColorbarArea.y+this.pColorbar.y-1})`)),this.pColorbarArea.clear(),this.pColorbarArea.beginFill(gt(this.options.colorbarBackgroundColor||"white"),+this.options.colorbarBackgroundOpacity>=0?+this.options.colorbarBackgroundOpacity:.6),this.pColorbarArea.drawRect(0,0,Zf,r),this.options?(this.options.scaleStartPercent||(this.options.scaleStartPercent=0),this.options.scaleEndPercent||(this.options.scaleEndPercent=1)):this.options={scaleStartPercent:0,scaleEndPercent:1};const o=i.domain()[1]-i.domain()[0],a=i(this.options.scaleStartPercent*o+i.domain()[0]),s=i(this.options.scaleEndPercent*o+i.domain()[0]);this.brushing||(this.scaleBrush.on("start",this.brushStart.bind(this)).on("brush",this.brushMoved.bind(this)).on("end",this.brushEnd.bind(this)).handleSize(0),this.gColorscaleBrush.on(".brush",null),this.gColorscaleBrush.call(this.scaleBrush),this.northHandle=this.gColorscaleBrush.selectAll(".handle--custom").data([{type:"n"},{type:"s"}]).enter().append("rect").classed("handle--custom",!0).attr("cursor","ns-resize").attr("width",ra).attr("height",u$).style("fill","#666").style("stroke","white"),this.flipText&&this.northHandle.attr("cursor","ew-resize"),this.gColorscaleBrush.call(this.scaleBrush.move,[s,a]));const c=Et().domain([0,255]).range([0,this.colorbarHeight]);for(let l=0;l<this.colorbarHeight;l++){const u=this.limitedValueScale(i.invert(l)),f=Math.max(0,Math.min(254,Math.floor(u)));this.pColorbar.beginFill(gt(`rgb(${this.colorScale[f][0]},${this.colorScale[f][1]},${this.colorScale[f][2]})`)),this.pColorbar.drawRect(0,l,ta,1)}this.pAxis.position.x=ta,this.pAxis.position.y=c(0),this.options.colorbarPosition==="topLeft"||this.options.colorbarPosition==="bottomLeft"?this.axis.drawAxisRight(i,this.colorbarHeight):(this.options.colorbarPosition==="topRight"||this.options.colorbarPosition==="bottomRight")&&this.axis.drawAxisLeft(i,this.colorbarHeight)}},{key:"exportColorBarSVG",value:function(){const r=document.createElement("g");if(r.setAttribute("class","color-bar"),!this.options.colorbarPosition||this.options.colorbarPosition==="hidden"||!this.valueScale)return r;r.setAttribute("transform",`translate(${this.pColorbarArea.x}, ${this.pColorbarArea.y})`);const i=document.createElement("rect");r.appendChild(i);const o=document.createElement("g");r.appendChild(o),o.setAttribute("transform",`translate(${this.pColorbar.x}, ${this.pColorbar.y})`);const a=Math.min(this.dimensions[1]/2,c$);this.colorbarHeight=a-2*Qr,i.setAttribute("x",0),i.setAttribute("y",0),i.setAttribute("width",Zf),i.setAttribute("height",a),i.setAttribute("style","fill: white; stroke-width: 0; opacity: 0.7");const s=256,c=Et().domain([0,s-1]).range([0,this.colorbarHeight]),l=this.colorbarHeight/s;for(let p=0;p<s;p++){const d=document.createElement("rect");o.appendChild(d),d.setAttribute("x",0),d.setAttribute("y",c(p)),d.setAttribute("width",ta),d.setAttribute("height",l),d.setAttribute("class","color-rect");const g=Math.min(this.colorScale.length-1,Math.max(0,Math.floor(this.limitedValueScale(this.valueScale.invert(p))))),y=this.colorScale[g];y?d.setAttribute("style",`fill: rgb(${y[0]}, ${y[1]}, ${y[2]})`):d.setAttribute("style","fill: rgb(255,255,255,0)")}const u=document.createElement("g");r.appendChild(u),u.setAttribute("transform",`translate(${this.axis.pAxis.position.x},${this.axis.pAxis.position.y})`);let f=null;const h=this.valueScale.copy().range([this.colorbarHeight,0]);return this.options.colorbarPosition==="topLeft"||this.options.colorbarPosition==="bottomLeft"?f=this.axis.exportAxisRightSVG(h,this.colorbarHeight):(this.options.colorbarPosition==="topRight"||this.options.colorbarPosition==="bottomRight")&&(f=this.axis.exportAxisLeftSVG(h,this.colorbarHeight)),u.appendChild(f),r}},{key:"setDataLensSize",value:function(r){this.dataLensPadding=Math.max(0,Math.floor((r-1)/2)),this.dataLensSize=this.dataLensPadding*2+1}},{key:"binsPerTile",value:function(){return this.tilesetInfo.bins_per_dimension||Kve}},{key:"getVisibleRectangleData",value:function(r,i,o,a){let s=this.calculateZoomLevel();s=this.tilesetInfo.max_zoom?Math.min(this.tilesetInfo.max_zoom,s):s;const l=F7(this.tilesetInfo,s,this.binsPerTile())/this.binsPerTile(),u=[this._xScale.invert(r),this._xScale.invert(r+o)],f=[this._yScale.invert(i),this._yScale.invert(i+a)],h=[Math.max(u[0],this.tilesetInfo.min_pos[0]),Math.min(u[1],this.tilesetInfo.max_pos[0])],p=[Math.max(f[0],this.tilesetInfo.min_pos[1]),Math.min(f[1],this.tilesetInfo.max_pos[1])],d=Math.floor(h[0]/l),g=Math.floor(p[0]/l),y=Math.max(0,Math.ceil((h[1]-h[0])/l)),b=Math.max(0,Math.ceil((p[1]-p[0])/l)),m=Ns(new Array(b*y).fill(Number.NaN),[b,y]);return this.visibleAndFetchedTiles().forEach(v=>{const _=v.mirrored?[v.tileData.tilePos[1],v.tileData.tilePos[0]]:v.tileData.tilePos,{tileX:T,tileY:w,tileWidth:S,tileHeight:k}=this.getTilePosAndDimensions(v.tileData.zoomLevel,_,this.binsPerTile()),E=Math.floor(T/l),P=Math.floor((T+S)/l),C=Math.floor(w/l),I=Math.floor((w+k)/l);let O=Math.max(d,E)-E,M=Math.max(g,C)-C;const R=Math.min(d+y,P)-E,z=Math.min(g+b,I)-C,U=Math.max(E-d,0),j=Math.max(C-g,0),H=R-O,W=z-M;if(!(H<0||W<0)){if(v.mirrored&&O>M){const re=O;O=M,M=re}fA(m.hi(j+W,U+H).lo(j,U),v.dataArray.hi(M+W,O+H).lo(M,O))}}),m}},{key:"initTile",value:function(r){Ir(t,"initTile",this,3)([r]),r.tileData.dense.length===this.binsPerTile()**2&&(r.dataArray=Ns(Array.from(r.tileData.dense),[this.binsPerTile(),this.binsPerTile()]),this.continuousScaling&&r.tileData.tilePos[0]===r.tileData.tilePos[1]&&r.mirrored&&(r.tileData.denseDataExtrema.mirrorPrecomputedExtrema(),Ir(t,"initTile",this,3)([r]))),!(this.scale.minValue===null||this.scale.maxValue===null)&&this.renderTile(r)}},{key:"updateTile",value:function(r){r.scale&&this.scale&&this.scale.minValue===r.scale.minValue&&this.scale.maxValue===r.scale.maxValue||(this.renderTile(r),this.drawColorbar())}},{key:"destroyTile",value:function(r){r.sprite.destroy(!0),r.canvas=null,r.sprite=null,r.texture=null}},{key:"pixDataFunction",value:function(r,i){if(i){const{graphics:o}=r,a=this.tileDataToCanvas(i.pixData);r.sprite&&r.sprite.destroy(!0);const s=Ye.PIXI.VERSION[0]==="4"?Ye.PIXI.Texture.fromCanvas(a,Ye.PIXI.SCALE_MODES.NEAREST):Ye.PIXI.Texture.from(a,{scaleMode:Ye.PIXI.SCALE_MODES.NEAREST}),c=new Ye.PIXI.Sprite(s);r.sprite=c,r.texture=s,r.canvas=a,this.setSpriteProperties(r.sprite,r.tileData.zoomLevel,r.tileData.tilePos,r.mirrored),o.removeChildren(),o.addChild(r.sprite)}this.renderingTiles.delete(r.tileId)}},{key:"renderTile",value:function(r){const[i]=this.updateValueScale(),o=0;if(this.renderingTiles.add(r.tileId),this.tilesetInfo.tile_size&&r.tileData.dense?.length<this.tilesetInfo.tile_size){const a=new Float32Array(this.tilesetInfo.tile_size);a.fill(Number.NaN),a.set(r.tileData.dense),r.tileData.dense=a}q7(r,i,this.limitedValueScale.domain(),o,this.colorScale,a=>this.pixDataFunction(r,a),this.mirrorTiles()&&!r.mirrored&&r.tileData.tilePos[0]===r.tileData.tilePos[1],this.options.extent==="upper-right"&&r.tileData.tilePos[0]===r.tileData.tilePos[1],this.options.zeroValueColor?N4(this.options.zeroValueColor):void 0,{selectedRows:this.options.selectRows,selectedRowsAggregationMode:this.options.selectRowsAggregationMode,selectedRowsAggregationWithRelativeHeight:this.options.selectRowsAggregationWithRelativeHeight,selectedRowsAggregationMethod:this.options.selectRowsAggregationMethod})}},{key:"remove",value:function(){this.gMain.remove(),this.gMain=null,Ir(t,"remove",this,3)([])}},{key:"refScalesChanged",value:function(r,i){Ir(t,"refScalesChanged",this,3)([r,i]),Bp(this.fetchedTiles).filter(o=>o.sprite).forEach(o=>this.setSpriteProperties(o.sprite,o.tileData.zoomLevel,o.tileData.tilePos,o.mirrored))}},{key:"superSVG",value:function(){return Ir(t,"exportSVG",this,3)([])}},{key:"exportSVG",value:function(){let r=null,i=null;Ir(t,"exportSVG",this,1)?[i,r]=Ir(t,"exportSVG",this,3)([]):(i=document.createElement("g"),r=i);const o=document.createElement("g");r.appendChild(o),o.setAttribute("transform",`translate(${this.pMain.position.x},${this.pMain.position.y}) scale(${this.pMain.scale.x},${this.pMain.scale.y})`);for(const s of this.visibleAndFetchedTiles()){const c=s.sprite.rotation*180/Math.PI,l=document.createElement("g");l.setAttribute("transform",`translate(${s.sprite.x},${s.sprite.y}) rotate(${c}) scale(${s.sprite.scale.x},${s.sprite.scale.y})`);const u=document.createElement("image");u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s.canvas.toDataURL()),u.setAttribute("width",s.canvas.width),u.setAttribute("height",s.canvas.height),u.setAttribute("style","image-rendering: pixelated"),l.appendChild(u),o.appendChild(l)}const a=this.exportColorBarSVG();return r.appendChild(a),[i,i]}},{key:"getVisiblePartOfUppLeftTile",value:function(){const r=this.visibleAndFetchedTiles().map(p=>{const d=p.mirrored?[p.tileData.tilePos[1],p.tileData.tilePos[0]]:p.tileData.tilePos;return[d[0],d[1],p.tileId]});if(r.length===0)return null;let i=r[0];for(let p=0;p<r.length;p++){const d=r[p];(d[0]<i[0]||d[1]<i[1])&&(i=d)}const o=Math.min(p0,this.binsPerTile()),a=this.binsPerTile()/o,s=this.visibleAndFetchedTiles().filter(p=>p.tileId===i[2])[0],c=this.getIndicesOfVisibleDataInTile(s),l=c[0],u=c[1],f=l-l%a,h=u-u%a;return[s.tileId,f,h]}},{key:"getIndicesOfVisibleDataInTile",value:function(r){const i=this._xScale.range(),o=this._yScale.range(),a=r.mirrored?[r.tileData.tilePos[1],r.tileData.tilePos[0]]:r.tileData.tilePos,{tileX:s,tileY:c,tileWidth:l,tileHeight:u}=this.getTilePosAndDimensions(r.tileData.zoomLevel,a,this.binsPerTile()),f=Et().domain([0,this.binsPerTile()]).range([s,s+l]),h=Math.max(0,Math.round(f.invert(this._xScale.invert(i[0])))-1),p=Math.min(this.binsPerTile(),Math.round(f.invert(this._xScale.invert(i[1])))),d=Et().domain([0,this.binsPerTile()]).range([c,c+u]),g=Math.max(0,Math.round(d.invert(this._yScale.invert(o[0])))-1),y=Math.min(this.binsPerTile(),Math.round(d.invert(this._yScale.invert(o[1]))));return r.mirrored&&a[0]!==a[1]?[g,h,y,p]:[h,g,p,y]}},{key:"minVisibleValue",value:function(r=!1){const i=this.visibleAndFetchedTiles().map(a=>{if(a.tileData.denseDataExtrema===void 0)return null;const s=this.getIndicesOfVisibleDataInTile(a);return a.tileData.denseDataExtrema.getMinNonZeroInSubset(s)});if(i.length===0&&this.valueScaleMax===null)return null;const o=Math.min.apply(null,i);return o===Number.MAX_SAFE_INTEGER?Ir(t,"minVisibleValue",this,3)([r]):r?o:this.valueScaleMin!==null?this.valueScaleMin:o}},{key:"maxVisibleValue",value:function(r=!1){const i=this.visibleAndFetchedTiles().map(a=>{if(a.tileData.denseDataExtrema===void 0)return null;const s=this.getIndicesOfVisibleDataInTile(a);return a.tileData.denseDataExtrema.getMaxNonZeroInSubset(s)});if(i.length===0&&this.valueScaleMax===null)return null;const o=Math.max.apply(null,i);return o===Number.MIN_SAFE_INTEGER?Ir(t,"maxVisibleValue",this,3)([r]):r?o:this.valueScaleMax!==null?this.valueScaleMax:o}},{key:"zoomed",value:function(r,i,o,a,s){if(this.brushing)return;Ir(t,"zoomed",this,3)([r,i]),this.pMain.position.x=a,this.pMain.position.y=s,this.pMain.scale.x=o,this.pMain.scale.y=o;const c=this.isValueScaleLocked();if(this.continuousScaling&&this.minValue()!==void 0&&this.maxValue()!==void 0){const l=JSON.stringify(this.getVisiblePartOfUppLeftTile());if(this.valueScaleMin===null&&this.valueScaleMax===null&&!c&&l!==this.prevIndUpperLeftTile){const u=this.minVisibleValue(),f=this.maxVisibleValue(),h=1e-6;u!==null&&f!==null&&(Math.abs(this.minValue()-u)>h||Math.abs(this.maxValue()-f)>h)&&(this.minValue(u),this.maxValue(f),this.scheduleRerender()),this.prevIndUpperLeftTile=l}c&&this.onValueScaleChanged()}this.mouseMoveZoomHandler()}},{key:"addTileId",value:function(r,i,o,a,s,c=!1){const l=[i,o,a];l.mirrored=c,l.dataTransform=s,r.push(l)}},{key:"tilesToId",value:function(r,i,o){const a=r,s=i,c=this.options?.dataTransform||"default",l=[];for(let u=0;u<a.length;u++)for(let f=0;f<s.length;f++)this.mirrorTiles()?(a[u]>=s[f]?this.options.extent!=="lower-left"&&this.addTileId(l,o,s[f],a[u],c,!0):this.options.extent!=="upper-right"&&this.addTileId(l,o,a[u],s[f],c),a[u]===s[f]&&this.options.extent==="lower-left"&&this.addTileId(l,o,a[u],s[f],c)):this.addTileId(l,o,a[u],s[f],c);return l}},{key:"calculateVisibleTiles",value:function(){if(this.tilesetInfo){if(this.zoomLevel=this.calculateZoomLevel(),this.tilesetInfo.resolutions){const r=this.tilesetInfo.resolutions.map(i=>+i).sort((i,o)=>o-i);this.xTiles=Pd(r[this.zoomLevel],this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0]),this.yTiles=Pd(r[this.zoomLevel],this._yScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0])}else this.xTiles=Od(this.zoomLevel,this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.max_zoom,this.tilesetInfo.max_width),this.yTiles=Od(this.zoomLevel,this._yScale,this.options.reverseYAxis?-this.tilesetInfo.max_pos[1]:this.tilesetInfo.min_pos[1],this.options.reverseYAxis?-this.tilesetInfo.min_pos[1]:this.tilesetInfo.max_pos[1],this.tilesetInfo.max_zoom,this.tilesetInfo.max_width1||this.tilesetInfo.max_width);this.setVisibleTiles(this.tilesToId(this.xTiles,this.yTiles,this.zoomLevel))}}},{key:"mirrorTiles",value:function(){return!(this.tilesetInfo.mirror_tiles&&(this.tilesetInfo.mirror_tiles===!1||this.tilesetInfo.mirror_tiles==="false"))}},{key:"contextMenuItems",value:function(r,i){return[]}},{key:"getMouseOverHtml",value:function(r,i){if(!this.options||!this.options.showTooltip||!this.tilesetInfo)return"";const o=z7(this.tilesetInfo,this.zoomLevel),a=Math.max(this.tilesetInfo.max_pos[1]-this.tilesetInfo.min_pos[1],this.tilesetInfo.max_pos[0]-this.tilesetInfo.min_pos[0]),s=Math.ceil(Math.log(a/o)/Math.log(10));this.setDataLensSize(1);const c=this._xScale.invert(r),l=this._yScale.invert(i);let u="<b>Position:</b> ";if(this.chromInfo){const h=dr(c,this.chromInfo),p=dr(l,this.chromInfo),d=g=>Fr(`.${s}s`)(g);u+=`${h[0]}:${d(h[1])} & ${p[0]}:${d(p[1])}`,u+="<br/>"}let f=null;try{f=this.getVisibleRectangleData(r,i,1,1).get(0,0)}catch{return""}return this.options&&this.options.heatmapValueScaling==="log"?f>0?`${u}<b>Value:</b> 1e${Fr(".3f")(Math.log(f)/Math.log(10))}`:f===0?`${u}<b>Value:</b> 0`:`${u}<b>Value:</b> N/A`:`${u}<b>Value:</b> ${Fr(".3f")(f)}`}},{key:"getTilePosAndDimensions",value:function(r,i,o){const a=o||this.binsPerTile();if(this.tilesetInfo.resolutions){const y=this.tilesetInfo.resolutions.map(T=>+T).sort((T,w)=>w-T)[r],b=y*a,m=b,v=y*a*i[0],_=y*a*i[1];return{tileX:v,tileY:_,tileWidth:b,tileHeight:m}}const s=i[0],c=i[1],l=this.tilesetInfo.min_pos[0],u=this.options.reverseYAxis?-this.tilesetInfo.max_pos[1]:this.tilesetInfo.min_pos[1],f=this.tilesetInfo.max_width/2**r,h=this.tilesetInfo.max_width/2**r,p=l+s*f,d=u+c*h;return{tileX:p,tileY:d,tileWidth:f,tileHeight:h}}},{key:"calculateZoomLevel",value:function(){this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.min_pos[1],this.tilesetInfo.max_pos[1];let r=null;if(this.tilesetInfo.resolutions){const i=GT(this.tilesetInfo.resolutions,this._xScale),o=GT(this.tilesetInfo.resolutions,this._yScale);r=Math.min(i,o)}else{const i=WT(this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.binsPerTile()),o=WT(this._xScale,this.tilesetInfo.min_pos[1],this.tilesetInfo.max_pos[1],this.binsPerTile());r=Math.max(i,o),r=Math.min(r,this.maxZoom)}return this.options?.maxZoom&&(this.options.maxZoom>=0?r=Math.min(this.options.maxZoom,r):console.error("Invalid maxZoom on track:",this)),r}},{key:"tileToLocalId",value:function(r){return r.dataTransform&&r.dataTransform!=="default"?`${r.join(".")}.${r.mirrored}.${r.dataTransform}`:`${r.join(".")}.${r.mirrored}`}},{key:"tileToRemoteId",value:function(r){return r.dataTransform&&r.dataTransform!=="default"?`${r.join(".")}.${r.dataTransform}`:`${r.join(".")}`}},{key:"localToRemoteId",value:function(r){const i=r.split(".");return i.slice(0,i.length-1).join(".")}}])}(Si);function Zve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,e0e(r.key),r)}}function Jve(e,t,n){return t&&Qve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function e0e(e){var t=t0e(e,"string");return typeof t=="symbol"?t:t+""}function t0e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function r0e(e,t,n){return t=ag(t),n0e(e,h$()?Reflect.construct(t,n||[],ag(e).constructor):t.apply(e,n))}function n0e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return i0e(e)}function i0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(h$=function(){return!!e})()}function ag(e){return ag=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ag(e)}function o0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&KE(e,t)}function KE(e,t){return KE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},KE(e,t)}function p$(e){if(!e.graphics)return;const t=e.graphics,{tileX:n,tileY:r,tileWidth:i}=this.getTilePosAndDimensions(e.tileData.zoomLevel,e.tileData.tilePos);e.drawnAtScale=this._xScale.copy();const o=1/((this._xScale(1)-this._xScale(0))/(this._refXScale(1)-this._refXScale(0))),a=1/((this._yScale(1)-this._yScale(0))/(this._refYScale(1)-this._refYScale(0)));e.text.scale.x=o,e.text.scale.y=a;const s=this._xScale(i)-this._xScale(0);if(e.textGraphics.scale.x=s/256,e.textGraphics.scale.y=s/256,t.clear(),t.lineStyle(4*o,255,1),t.beginFill(16740363,.4),t.alpha=.5,e.mirrored){const c=this._refXScale(r+i)-this._refXScale(r),l=this._refYScale(n+i)-this._refYScale(n);e.textGraphics.position.x=this._refXScale(r)+c/2,e.textGraphics.position.y=this._refYScale(n)+l/2,t.drawRect(this._refXScale(r),this._refYScale(n),c,l)}else{const c=this._refXScale(n+i)-this._refXScale(n),l=this._refYScale(r+i)-this._refYScale(r);e.textGraphics.position.x=this._refXScale(n)+c/2,e.textGraphics.position.y=this._refYScale(r)+l/2,t.drawRect(this._refXScale(n),this._refYScale(r),c,l)}}function d$(e){const t=e.graphics;e.textGraphics=new Ye.PIXI.Graphics,e.mirrored?e.text=new Ye.PIXI.Text(`${e.tileData.zoomLevel}/${[e.tileData.tilePos[1],e.tileData.tilePos[0]].join("/")}`,{fontFamily:"Arial",fontSize:24,fill:16715792,align:"center"}):e.text=new Ye.PIXI.Text(`${e.tileData.zoomLevel}/${e.tileData.tilePos.join("/")}`,{fontFamily:"Arial",fontSize:24,fill:16715792,align:"center"}),e.textGraphics.addChild(e.text),e.text.anchor.x=.5,e.text.anchor.y=.5,t.addChild(e.textGraphics)}let g$=function(e){function t(){return Zve(this,t),r0e(this,t,arguments)}return o0e(t,e),Jve(t,[{key:"areAllVisibleTilesLoaded",value:function(){return!0}},{key:"initTile",value:function(r){d$.bind(this)(r),this.drawTile(r)}},{key:"destroyTile",value:function(r,i){}},{key:"drawTile",value:function(r){p$.bind(this)(r)}},{key:"fetchNewTiles",value:function(r){r.forEach(i=>{const a=i.remoteId.split("."),s={zoomLevel:a[0],tilePos:a.slice(1,a.length).map(c=>+c)};this.fetchedTiles[i.tileId]=i,this.fetchedTiles[i.tileId].tileData=s,this.fetching.has(i.remoteId)&&this.fetching.delete(i.remoteId)}),this.synchronizeTilesAndGraphics()}}])}(Ql);function a0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s0e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c0e(r.key),r)}}function l0e(e,t,n){return t&&s0e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function c0e(e){var t=u0e(e,"string");return typeof t=="symbol"?t:t+""}function u0e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function f0e(e,t,n){return t=Jl(t),h0e(e,m$()?Reflect.construct(t,n||[],Jl(e).constructor):t.apply(e,n))}function h0e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return p0e(e)}function p0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(m$=function(){return!!e})()}function d0e(e,t,n,r){var i=ZE(Jl(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function ZE(){return ZE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=g0e(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},ZE.apply(null,arguments)}function g0e(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Jl(e))!==null;);return e}function Jl(e){return Jl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Jl(e)}function m0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&QE(e,t)}function QE(e,t){return QE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},QE(e,t)}let v$=function(e){function t(n,r){var i;return a0e(this,t),i=f0e(this,t,[n,r]),i.pMain=i.pMobile,i}return m0e(t,e),l0e(t,[{key:"areAllVisibleTilesLoaded",value:function(){return!0}},{key:"initTile",value:function(r){const i=r.graphics;r.textGraphics=new Ye.PIXI.Graphics,r.text=new Ye.PIXI.Text(`${r.tileData.zoomLevel}/${r.tileData.tilePos.join("/")}`,{fontFamily:"Arial",fontSize:32,fill:16715792,align:"center"}),r.textGraphics.addChild(r.text),r.text.anchor.x=.5,r.text.anchor.y=.5,i.addChild(r.textGraphics),this.drawTile(r)}},{key:"destroyTile",value:function(r){}},{key:"drawTile",value:function(r){if(d0e(t,"drawTile",this)([r]),!r.graphics)return;const i=r.graphics,{tileX:o,tileWidth:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos),s=1/((this._xScale(1)-this._xScale(0))/(this._refXScale(1)-this._refXScale(0)));r.text.scale.x=s,i.clear();const c=this.dimensions[1],l=this._refXScale(o+a)-this._refXScale(o);r.textGraphics.position.x=this._refXScale(o)+l/2,r.textGraphics.position.y=c/2;const u=this._refXScale(o);i.lineStyle(4*s,255,1),i.beginFill(16740363,.4),i.alpha=.5,i.moveTo(u,0),i.lineTo(u,c),i.moveTo(u+l,0),i.lineTo(u+l,c),i.lineStyle(0,255,1),i.drawRect(u,0,l,c)}}])}(Yl);function v0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y0e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_0e(r.key),r)}}function b0e(e,t,n){return t&&y0e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _0e(e){var t=T0e(e,"string");return typeof t=="symbol"?t:t+""}function T0e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function w0e(e,t,n){return t=ec(t),S0e(e,y$()?Reflect.construct(t,n||[],ec(e).constructor):t.apply(e,n))}function S0e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return E0e(e)}function E0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(y$=function(){return!!e})()}function k0e(e,t,n,r){var i=JE(ec(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function JE(){return JE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=x0e(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},JE.apply(null,arguments)}function x0e(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=ec(e))!==null;);return e}function ec(e){return ec=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ec(e)}function C0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&e5(e,t)}function e5(e,t){return e5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},e5(e,t)}let b$=function(e){function t(){return v0e(this,t),w0e(this,t,arguments)}return C0e(t,e),b0e(t,[{key:"calculateZoomLevel",value:function(){const r=wt.calculateZoomLevel(this._yScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0]);return Math.min(r,this.maxZoom)}},{key:"relevantScale",value:function(){return this._yScale}},{key:"zoomed",value:function(r,i){k0e(t,"zoomed",this)([r,i]);const o=1,a=(i(1)-i(0))/(this._refYScale(1)-this._refYScale(0)),s=this.position[0],c=i(0)+this.position[1]-this._refYScale(1)*a;this.pMain.position.x=s,this.pMain.position.y=c,this.pMain.scale.x=o,this.pMain.scale.y=a}}])}(zE);function O0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P0e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,M0e(r.key),r)}}function A0e(e,t,n){return t&&P0e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function M0e(e){var t=I0e(e,"string");return typeof t=="symbol"?t:t+""}function I0e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function R0e(e,t,n){return t=tc(t),D0e(e,_$()?Reflect.construct(t,n||[],tc(e).constructor):t.apply(e,n))}function D0e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return N0e(e)}function N0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_$=function(){return!!e})()}function L0e(e,t,n,r){var i=t5(tc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function t5(){return t5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=$0e(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},t5.apply(null,arguments)}function $0e(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=tc(e))!==null;);return e}function tc(e){return tc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tc(e)}function j0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r5(e,t)}function r5(e,t){return r5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},r5(e,t)}let T$=function(e){function t(){return O0e(this,t),R0e(this,t,arguments)}return j0e(t,e),A0e(t,[{key:"areAllVisibleTilesLoaded",value:function(){return!0}},{key:"initTile",value:function(r){const i=r.graphics;r.textGraphics=new Ye.PIXI.Graphics,r.text=new Ye.PIXI.Text(`${r.tileData.zoomLevel}/${r.tileData.tilePos.join("/")}`,{fontFamily:"Arial",fontSize:32,fill:16715792,align:"center"}),r.textGraphics.addChild(r.text),r.text.anchor.x=.5,r.text.anchor.y=.5,r.text.rotation=-Math.PI/2,i.addChild(r.textGraphics),this.drawTile(r,i)}},{key:"destroyTile",value:function(r,i){}},{key:"drawTile",value:function(r){if(L0e(t,"drawTile",this)([r]),!r.graphics)return;const i=r.graphics,{tileY:o,tileHeight:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos),s=1/((this._yScale(1)-this._yScale(0))/(this._refYScale(1)-this._refYScale(0)));r.text.scale.x=s,i.clear(),i.lineStyle(4*s,255,1),i.beginFill(16740363,.4),i.alpha=.5;const c=this.dimensions[0],l=this._refYScale(o+a)-this._refYScale(o);r.textGraphics.position.x=c/2,r.textGraphics.position.y=this._refYScale(o)+l/2,i.drawRect(0,this._refYScale(o),c,l)}},{key:"fetchNewTiles",value:function(r){r.forEach(i=>{const a=i.remoteId.split("."),s={zoomLevel:a[1],tilePos:a.slice(2,a.length).map(c=>+c)};this.fetchedTiles[i.tileId]=i,this.fetchedTiles[i.tileId].tileData=s,this.fetching.has(i.remoteId)&&this.fetching.delete(i.remoteId)}),this.synchronizeTilesAndGraphics()}}])}(b$);var n5=Array.prototype.slice;function B0e(e){return e}var sg=1,lg=2,i5=3,Qf=4,w$=1e-6;function z0e(e){return"translate("+e+",0)"}function H0e(e){return"translate(0,"+e+")"}function F0e(e){return t=>+e(t)}function q0e(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function U0e(){return!this.__axis}function cg(e,t){var n=[],r=null,i=null,o=6,a=6,s=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===sg||e===Qf?-1:1,u=e===Qf||e===lg?"x":"y",f=e===sg||e===i5?z0e:H0e;function h(p){var d=r??(t.ticks?t.ticks.apply(t,n):t.domain()),g=i??(t.tickFormat?t.tickFormat.apply(t,n):B0e),y=Math.max(o,0)+s,b=t.range(),m=+b[0]+c,v=+b[b.length-1]+c,_=(t.bandwidth?q0e:F0e)(t.copy(),c),T=p.selection?p.selection():p,w=T.selectAll(".domain").data([null]),S=T.selectAll(".tick").data(d,t).order(),k=S.exit(),E=S.enter().append("g").attr("class","tick"),P=S.select("line"),C=S.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge(E),P=P.merge(E.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),C=C.merge(E.append("text").attr("fill","currentColor").attr(u,l*y).attr("dy",e===sg?"0em":e===i5?"0.71em":"0.32em")),p!==T&&(w=w.transition(p),S=S.transition(p),P=P.transition(p),C=C.transition(p),k=k.transition(p).attr("opacity",w$).attr("transform",function(I){return isFinite(I=_(I))?f(I+c):this.getAttribute("transform")}),E.attr("opacity",w$).attr("transform",function(I){var O=this.parentNode.__axis;return f((O&&isFinite(O=O(I))?O:_(I))+c)})),k.remove(),w.attr("d",e===Qf||e===lg?a?"M"+l*a+","+m+"H"+c+"V"+v+"H"+l*a:"M"+c+","+m+"V"+v:a?"M"+m+","+l*a+"V"+c+"H"+v+"V"+l*a:"M"+m+","+c+"H"+v),S.attr("opacity",1).attr("transform",function(I){return f(_(I)+c)}),P.attr(u+"2",l*o),C.attr(u,l*y).text(g),T.filter(U0e).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===lg?"start":e===Qf?"end":"middle"),T.each(function(){this.__axis=_})}return h.scale=function(p){return arguments.length?(t=p,h):t},h.ticks=function(){return n=n5.call(arguments),h},h.tickArguments=function(p){return arguments.length?(n=p==null?[]:n5.call(p),h):n.slice()},h.tickValues=function(p){return arguments.length?(r=p==null?null:n5.call(p),h):r&&r.slice()},h.tickFormat=function(p){return arguments.length?(i=p,h):i},h.tickSize=function(p){return arguments.length?(o=a=+p,h):o},h.tickSizeInner=function(p){return arguments.length?(o=+p,h):o},h.tickSizeOuter=function(p){return arguments.length?(a=+p,h):a},h.tickPadding=function(p){return arguments.length?(s=+p,h):s},h.offset=function(p){return arguments.length?(c=+p,h):c},h}function S$(e){return cg(sg,e)}function V0e(e){return cg(lg,e)}function G0e(e){return cg(i5,e)}function E$(e){return cg(Qf,e)}const W0e=Object.freeze(Object.defineProperty({__proto__:null,axisBottom:G0e,axisLeft:E$,axisRight:V0e,axisTop:S$},Symbol.toStringTag,{value:"Module"}));function Y0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X0e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Z0e(r.key),r)}}function K0e(e,t,n){return t&&X0e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Z0e(e){var t=Q0e(e,"string");return typeof t=="symbol"?t:t+""}function Q0e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function J0e(e,t,n){return t=ug(t),eye(e,k$()?Reflect.construct(t,n||[],ug(e).constructor):t.apply(e,n))}function eye(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return tye(e)}function tye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(k$=function(){return!!e})()}function ug(e){return ug=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ug(e)}function rye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o5(e,t)}function o5(e,t){return o5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},o5(e,t)}let ko=function(e){function t(n,r){var i;Y0e(this,t),i=J0e(this,t,[n,r]);const{svgElement:o}=n;return i.gMain=_t(o).append("g"),i.clipUid=Mt.nice(),i.clipRect=i.gMain.append("clipPath").attr("id",`track-bounds-${i.clipUid}`).append("rect"),i.gMain.attr("clip-path",`url(#track-bounds-${i.clipUid})`),i}return rye(t,e),K0e(t,[{key:"setPosition",value:function(r){this.position=r,this.gMain.attr("transform",`translate(${this.position[0]},${this.position[1]})`),this.draw()}},{key:"setDimensions",value:function(r){this.dimensions=r,this._xScale.range([0,this.dimensions[0]]),this._yScale.range([0,this.dimensions[1]]),r[0]>=0&&r[1]>=0?(this.clipRect.attr("width",r[0]),this.clipRect.attr("height",r[1])):(this.clipRect.attr("width",0),this.clipRect.attr("height",0)),this.draw()}},{key:"remove",value:function(){this.gMain.remove(),this.gMain=null}},{key:"draw",value:function(){return this}}])}(Ja);function nye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,aye(r.key),r)}}function oye(e,t,n){return t&&iye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function aye(e){var t=sye(e,"string");return typeof t=="symbol"?t:t+""}function sye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function lye(e,t,n){return t=rc(t),cye(e,x$()?Reflect.construct(t,n||[],rc(e).constructor):t.apply(e,n))}function cye(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uye(e)}function uye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(x$=function(){return!!e})()}function C$(e,t,n,r){var i=a5(rc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function a5(){return a5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=fye(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},a5.apply(null,arguments)}function fye(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=rc(e))!==null;);return e}function rc(e){return rc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rc(e)}function hye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s5(e,t)}function s5(e,t){return s5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},s5(e,t)}let O$=function(e){function t(n,r){var i;return nye(this,t),i=lye(this,t,[n,r]),i.axis=E$(i._yScale),i.gAxis=i.gMain.append("g"),i.tilesetInfo=!0,i}return hye(t,e),oye(t,[{key:"setDimensions",value:function(r){C$(t,"setDimensions",this)([r]),this.axis.ticks(Math.ceil(this.dimensions[1]/150)),this.gAxis.attr("transform",`translate(${r[0]},0)`)}},{key:"draw",value:function(){if(this.axis.scale(this._yScale),this.options.reverseAxis==="yes"||this.options.reverseAxis===!0){const r=Fr(",");this.axis.tickFormat(i=>r(-i))}else this.axis.tickFormat(null);return this.gAxis.call(this.axis),this}},{key:"zoomed",value:function(r,i){C$(t,"zoomed",this)([r,i]),this.draw()}}])}(ko);function pye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mye(r.key),r)}}function gye(e,t,n){return t&&dye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mye(e){var t=vye(e,"string");return typeof t=="symbol"?t:t+""}function vye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function yye(e,t,n){return t=nc(t),bye(e,P$()?Reflect.construct(t,n||[],nc(e).constructor):t.apply(e,n))}function bye(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _ye(e)}function _ye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function P$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(P$=function(){return!!e})()}function Jf(e,t,n,r){var i=l5(nc(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function l5(){return l5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Tye(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},l5.apply(null,arguments)}function Tye(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=nc(e))!==null;);return e}function nc(e){return nc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nc(e)}function wye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c5(e,t)}function c5(e,t){return c5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},c5(e,t)}const Sye=(e,t,n,r,i)=>{i.drawRect(e,t,n,r)},Eye=(e,t,n,r,i,{fill:o=0,fillOpacity:a=0,stroke:s=0,strokeWidth:c=0,strokeOpacity:l=0}={})=>{const u=document.createElement("rect");u.setAttribute("x",e),u.setAttribute("y",t),u.setAttribute("width",n),u.setAttribute("height",r),u.setAttribute("fill",`#${l0(o)}`),u.setAttribute("fill-opacity",a),u.setAttribute("stroke",`#${l0(s)}`),u.setAttribute("stroke-opacity",l),u.setAttribute("stroke-width",c),i.appendChild(u)},Fi=(e,t,n,r,i,o)=>{i instanceof HTMLElement?Eye(e,t,n,r,i,o):Sye(e,t,n,r,i)},A$=(e,t,n,r,i,o,a,s,{isVertical:c=!1,svg:l=null}={})=>{let u=t,f=n,h=r,p=i;const d=s.width*2>r?r/2:s.width,g=s.width*2>i?i/2:s.width,y=l||e,b={fill:0,fillOpacity:0,stroke:0,strokeOpacity:0,strokeWidth:1};if(s.positions?.length?(e.lineStyle(1,0,0),e.beginFill(s.color,s.opacity),b.fill=s.color,b.fillOpacity=s.opacity,b.stroke=0,b.strokeOpacity=0,b.strokeWidth=1,s.positions.forEach(m=>{m==="top"&&!c||m==="left"&&c?Fi(t-d,n-g,r+d*2,g,y,b):m==="bottom"&&!c||m==="right"&&c?Fi(t-d,n+i,r+d*2,g,y,b):m==="left"&&!c||m==="top"&&c?Fi(t-d,n-g,d,i+g*2,y,b):(m==="right"&&!c||m==="bottom"&&c)&&Fi(t+r,n-g,d,i+g*2,y,b)})):s.width>0&&s.opacity>0&&(e.lineStyle(s.width,s.color,s.opacity),e.beginFill(0,0),b.fill=0,b.fillOpacity=0,b.stroke=s.color,b.strokeOpacity=s.opacity,b.strokeWidth=s.width,Fi(t-d,n-g,r+d*2,i+g*2,y,b)),a.positions?.length){e.lineStyle(1,0,0),e.beginFill(a.color,a.opacity);const m=a.width*2>r?r/2:a.width,v=a.width*2>i?i/2:a.width;b.fill=a.color,b.fillOpacity=a.opacity,b.stroke=0,b.strokeOpacity=0,b.strokeWidth=1,a.positions.forEach(_=>{_==="top"&&!c||_==="left"&&c?(Fi(t,n,r,v,y,b),f+=v,p-=v):_==="bottom"&&!c||_==="right"&&c?(Fi(t,n+i-v,r,v,y,b),p-=v):_==="left"&&!c||_==="top"&&c?(Fi(t,n,m,i,y,b),u+=m,h-=m):(_==="right"&&!c||_==="bottom"&&c)&&(Fi(t+r-m,n,m,i,y,b),h-=m)})}else e.lineStyle(a.width,a.color,a.opacity),b.stroke=a.color,b.strokeOpacity=a.opacity,b.strokeWidth=a.width;e.beginFill(o.color,o.opacity),b.fill=o.color,b.fillOpacity=o.opacity,Fi(u,f,h,p,y,b)};let M$=function(e){function t(n,r){var i;return pye(this,t),i=yye(this,t,[n,r]),i.options=r||{},i.drawnRects={},i}return wye(t,e),gye(t,[{key:"drawHorizontalOverlay",value:function(r,i,o,a=0,s,c,l,u){if(!o||o.length<2)return;let f=this.position[0]+i.left+this._xScale(o[0]);const h=this.position[1]+i.top,p=i.height;let d=this._xScale(o[1])-this._xScale(o[0]);d<a&&(f-=(a-d)/2,d=a),A$(r,f,h,d,p,s,c,l,u)}},{key:"drawVerticalOverlay",value:function(r,i,o,a=0,s,c,l,u={}){if(!o||o.length<2)return;const f=this.position[0]+i.left;let h=this.position[1]+i.top+this._yScale(o.length>=4?o[2]:o[0]);const p=this.position[1]+i.top,d=this.position[1]+i.top+i.height;if(h>d)return;h<p&&(h=p);const g=i.width;let y=this._yScale(o.length>=4?o[3]:o[1])-h+i.top+this.position[1];y<0||(h+y>d&&(y+=d-(h+y)),y<a&&(h-=(a-y)/2,y=a),u.isVertical=!0,A$(r,f,h,g,y,s,c,l,u))}},{key:"draw",value:function(r){Jf(t,"draw",this,3)([]);const i=this.pMain,o={color:gt(this.options.fill||this.options.fillColor||"blue"),opacity:Number.isNaN(+this.options.fillOpacity)?.3:+this.options.fillOpacity},a={color:gt(this.options.stroke||"blue"),opacity:+this.options.strokeOpacity||1,width:+this.options.strokeWidth||0,positions:!this.options.strokePos||Array.isArray(this.options.strokePos)?this.options.strokePos:[this.options.strokePos]},s={color:gt(this.options.outline||"white"),opacity:+this.options.outlineOpacity||1,width:+this.options.outlineWidth||0,positions:!this.options.outlinePos||Array.isArray(this.options.outlinePos)?this.options.outlinePos:[this.options.outlinePos]};(!r||!r.svg)&&i.clear(),i.lineStyle(a.width,a,+!a.positions*a.opacity),i.beginFill(o.color,o.opacity);const c=Math.max(0,+this.options.minWidth||0),l=Math.max(0,+this.options.minHeight||0);Array.isArray(this.options.extent)&&this.options.orientationsAndPositions.forEach(u=>{(u.orientation==="1d-horizontal"||u.orientation==="2d")&&this.options.extent.forEach(f=>this.drawHorizontalOverlay(i,u.position,f,c,o,a,s,r)),(u.orientation==="1d-vertical"||u.orientation==="2d")&&this.options.extent.forEach(f=>this.drawVerticalOverlay(i,u.position,f,l,o,a,s,r))})}},{key:"zoomed",value:function(r,i){this.xScale(r),this.yScale(i),this.draw()}},{key:"setPosition",value:function(r){Jf(t,"setPosition",this,3)([r]),this.draw()}},{key:"setDimensions",value:function(r){Jf(t,"setDimensions",this,3)([r]),this.draw()}},{key:"exportSVG",value:function(){let r=null,i=null;Jf(t,"exportSVG",this,1)?[i,r]=Jf(t,"exportSVG",this,3)([]):(i=document.createElement("g"),r=i);const o=document.createElement("g");return r.appendChild(o),this.draw({svg:o}),[i,r]}}])}(Bn);function kye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Oye(r.key),r)}}function Cye(e,t,n){return t&&xye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Oye(e){var t=Pye(e,"string");return typeof t=="symbol"?t:t+""}function Pye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Aye(e,t,n){return t=ic(t),Mye(e,I$()?Reflect.construct(t,n||[],ic(e).constructor):t.apply(e,n))}function Mye(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Iye(e)}function Iye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function I$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(I$=function(){return!!e})()}function R$(e,t,n,r){var i=u5(ic(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function u5(){return u5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Rye(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},u5.apply(null,arguments)}function Rye(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=ic(e))!==null;);return e}function ic(e){return ic=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ic(e)}function Dye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f5(e,t)}function f5(e,t){return f5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},f5(e,t)}let D$=function(e){function t(n,r){var i;return kye(this,t),i=Aye(this,t,[n,r]),i.axis=S$(i._xScale),i.gAxis=i.gMain.append("g"),i.tilesetInfo=!0,i}return Dye(t,e),Cye(t,[{key:"setDimensions",value:function(r){R$(t,"setDimensions",this)([r]),this.axis.ticks(Math.ceil(this.dimensions[0]/150)),this.gAxis.attr("transform",`translate(0,${r[1]})`)}},{key:"draw",value:function(){return this.axis.scale(this._xScale),this.gAxis.call(this.axis),this}},{key:"zoomed",value:function(r,i){R$(t,"zoomed",this)([r,i]),this.draw()}}])}(ko);function Nye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,jye(r.key),r)}}function $ye(e,t,n){return t&&Lye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function jye(e){var t=Bye(e,"string");return typeof t=="symbol"?t:t+""}function Bye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function zye(e,t,n){return t=oc(t),Hye(e,N$()?Reflect.construct(t,n||[],oc(e).constructor):t.apply(e,n))}function Hye(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fye(e)}function Fye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(N$=function(){return!!e})()}function ia(e,t,n,r){var i=h5(oc(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function h5(){return h5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=qye(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},h5.apply(null,arguments)}function qye(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=oc(e))!==null;);return e}function oc(e){return oc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},oc(e)}function Uye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p5(e,t)}function p5(e,t){return p5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},p5(e,t)}let ac=function(e){function t(){return Nye(this,t),zye(this,t,arguments)}return Uye(t,e),$ye(t,[{key:"stopHover",value:function(){this.pMouseOver.clear(),this.animate()}},{key:"getMouseOverHtml",value:function(r){if(!this.tilesetInfo||!this.options.showTooltip||!this.valueScale)return"";const i=this.getDataAtPos(r);let o="";i&&(o=Fr(".3f")(i));const a=this.pMouseOver,s=0,c=this.valueScale(i);a.clear(),a.beginFill(s,.5),a.lineStyle(1,s,1);const l=4;return a.drawRect(r-l/2,c-l/2,l,l),this.animate(),`${o}`}},{key:"initTile",value:function(r){if(ia(t,"initTile",this,3)([r]),!r.tileData||!r.tileData.dense){console.warn("emptyTile:",r);return}if(r.xValues=new Array(r.tileData.dense.length),r.yValues=new Array(r.tileData.dense.length),this.isValueScaleLocked()){const i=this.getLockGroupExtrema();i!==null&&(this.minValue(i[0]),this.maxValue(i[1]))}this.drawTile(r)}},{key:"rerender",value:function(r,i){ia(t,"rerender",this,3)([r,i]),this.options=r,ia(t,"draw",this,3)([]),this.visibleAndFetchedTiles().forEach(o=>{this.renderTile(o)})}},{key:"renderTile",value:function(r){this.drawTile(r),this.valueScale&&this.drawAxis(this.valueScale)}},{key:"drawTile",value:function(r){if(ia(t,"drawTile",this,3)([r]),!r.graphics||!r.tileData||!r.tileData.dense)return;const i=r.graphics,{tileX:o,tileWidth:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos),s=r.tileData.dense;if(s.length===0)return;const[c,l]=this.makeValueScale(this.minValue(),this.medianVisibleValue,this.maxValue());if(this.valueScale=c,i.clear(),this.drawAxis(this.valueScale),this.options.valueScaling==="log"&&this.valueScale.domain()[1]<0){console.warn("Negative values present when using a log scale",this.valueScale.domain());return}const u=gt(this.options.lineStrokeColor?this.options.lineStrokeColor:"blue");!this.tilesetInfo.tile_size&&!this.tilesetInfo.bins_per_dimension&&console.warn("No tileset_info.tile_size or tileset_info.bins_per_dimension",this.tilesetInfo);const f=this.tilesetInfo.tile_size||this.tilesetInfo.bins_per_dimension,h=Et().domain([0,f]).range([o,o+a]),p=this.options.lineStrokeWidth?this.options.lineStrokeWidth:1;i.lineStyle(p,u,1),r.segments=[];let d=[];for(let g=0;g<s.length;g++){const y=this._xScale(h(g)),b=this.valueScale(s[g]+l);if(this.options.valueScaling==="log"&&s[g]===0||Number.isNaN(b)){d.length>1&&r.segments.push(d),d=[];continue}if(h(g)>this.tilesetInfo.max_pos[0])break;d.push([y,b])}d.length>1&&r.segments.push(d);for(const g of r.segments){const y=g[0],b=g.slice(1);i.moveTo(y[0],y[1]);for(const m of b)i.lineTo(m[0],m[1])}}},{key:"setPosition",value:function(r){ia(t,"setPosition",this,3)([r]),this.pMain.position.y=this.position[1],this.pMain.position.x=this.position[0],this.pMouseOver.position.y=this.position[1],this.pMouseOver.position.x=this.position[0]}},{key:"zoomed",value:function(r,i){this.xScale(r),this.yScale(i),this.refreshTiles(),this.draw();const o=this.isValueScaleLocked();if(this.continuousScaling&&this.minValue()!==void 0&&this.maxValue()!==void 0){if(this.valueScaleMin===null&&this.valueScaleMax===null&&!o){const a=this.minVisibleValue(),s=this.maxVisibleValue(),c=1e-6;a!==null&&s!==null&&(Math.abs(this.minValue()-a)>c||Math.abs(this.maxValue()-s)>c)&&(this.minValue(a),this.maxValue(s),this.scheduleRerender())}o&&this.onValueScaleChanged()}}},{key:"superSVG",value:function(){return ia(t,"exportSVG",this,3)([])}},{key:"exportSVG",value:function(){let r=null,i=null;ia(t,"exportSVG",this,1)?[i,r]=ia(t,"exportSVG",this,3)([]):(i=document.createElement("g"),r=i),i.setAttribute("class","exported-line-track");const o=document.createElement("g");r.appendChild(o),o.setAttribute("transform",`translate(${this.position[0]},${this.position[1]})`);const a=this.options.lineStrokeColor?this.options.lineStrokeColor:"blue";this.visibleAndFetchedTiles().forEach(c=>{const l=document.createElement("path");l.setAttribute("fill","transparent"),l.setAttribute("stroke",a);let u="";for(const f of c.segments){const h=f[0],p=f.slice(1);u+=`M${h[0]} ${h[1]}`;for(const d of p)u+=`L${d[0]} ${d[1]}`}l.setAttribute("d",u),o.appendChild(l)});const s=document.createElement("g");if(s.setAttribute("id","axis"),i.appendChild(s),s.setAttribute("transform",`translate(${this.axis.pAxis.position.x}, ${this.axis.pAxis.position.y})`),this.options.axisPositionHorizontal==="left"||this.options.axisPositionVertical==="top"){const c=this.axis.exportAxisLeftSVG(this.valueScale,this.dimensions[1]);s.appendChild(c)}else if(this.options.axisPositionHorizontal==="right"||this.options.axisPositionVertical==="bottom"){const c=this.axis.exportAxisRightSVG(this.valueScale,this.dimensions[1]);s.appendChild(c)}return[i,r]}},{key:"tileToLocalId",value:function(r){return this.options.aggregationMode&&this.options.aggregationMode!=="mean"?`${r.join(".")}.${this.options.aggregationMode}`:`${r.join(".")}`}},{key:"tileToRemoteId",value:function(r){return this.tileToLocalId(r)}}])}(Yl);function Vye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Yye(r.key),r)}}function Wye(e,t,n){return t&&Gye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yye(e){var t=Xye(e,"string");return typeof t=="symbol"?t:t+""}function Xye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Kye(e,t,n){return t=lc(t),Zye(e,L$()?Reflect.construct(t,n||[],lc(e).constructor):t.apply(e,n))}function Zye(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Qye(e)}function Qye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function L$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(L$=function(){return!!e})()}function sc(e,t,n,r){var i=d5(lc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function d5(){return d5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Jye(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},d5.apply(null,arguments)}function Jye(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=lc(e))!==null;);return e}function lc(e){return lc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lc(e)}function ebe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g5(e,t)}function g5(e,t){return g5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},g5(e,t)}const tbe=gt("#FFFFFF");let m5=function(e){function t(...n){var r;return Vye(this,t),r=Kye(this,t,[...n]),r.zeroLine=new Ye.PIXI.Graphics,r.pMain.addChild(r.zeroLine),r.valueScaleTransform=Ar,r.options?.colorRange&&(r.options.colorRangeGradient?r.setColorGradient(r.options.colorRange):r.setColorScale(r.options.colorRange)),r.initialized=!0,r}return ebe(t,e),Wye(t,[{key:"setColorScale",value:function(r){r&&(this.colorScale=jo(r),this.colorScale=this.colorScale.map(i=>i.map(o=>o/255)))}},{key:"setColorGradient",value:function(r){if(!r)return;const i=r.length-1;this.colorGradientColors=this.options.align==="bottom"?r.slice().reverse().map((o,a)=>({from:a/i,color:o})):r.map((o,a)=>({from:a/i,color:o}))}},{key:"initTile",value:function(r){this.initialized&&sc(t,"initTile",this)([r])}},{key:"updateTile",value:function(r){(!r.valueScale||!this.scale||this.scale.minValue!==r.scale.minValue||this.scale.maxValue!==r.scale.maxValue)&&this.renderTile(r)}},{key:"renderTile",value:function(r){this.initialized&&sc(t,"renderTile",this)([r])}},{key:"drawTile",value:function(r){if(!r.graphics||!r.tileData||!r.tileData.dense)return;const{graphics:i}=r;r.svgData=void 0;const{tileX:o,tileWidth:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos,this.tilesetInfo.bins_per_dimension||this.tilesetInfo.tile_size),s=r.tileData.dense;if(s.length===0)return;const[c,l]=this.makeValueScale(this.minValue(),this.medianVisibleValue,this.maxValue(),0);if(!c)return;c.clamp(!0),this.valueScale=c;const u=c.copy();if(u.range([254,0]).clamp(!0),i.clear(),this.drawAxis(this.valueScale),this.options.valueScaling==="log"&&this.valueScale.domain()[1]<0){console.warn("Negative values present when using a log scale",this.valueScale.domain());return}const f=gt(this.options.lineStrokeColor||"blue"),h=Et().domain([0,this.tilesetInfo.tile_size||this.tilesetInfo.bins_per_dimension]).range([o,o+a]);i.lineStyle(0,f,1);const d=this.options.barFillColor||"grey",g=gt(d),y="barOpacity"in this.options?this.options.barOpacity:1;i.beginFill(g,y),r.drawnAtScale=this._xScale.copy();const b=this.options.align==="top";let m,v,_,T,w,S;if(this.colorGradientColors){w=new Ye.PIXI.Graphics,w.beginFill(tbe,1);const k=nA(this.colorGradientColors,1,this.dimensions[1],0,0,0,this.dimensions[1]);S=new Ye.PIXI.Sprite(Ye.PIXI.Texture.fromCanvas(k,Ye.PIXI.SCALE_MODES.NEAREST)),S.x=this._xScale(o),S.width=this._xScale(o+a)-S.x}for(let k=0;k<s.length;k++)if(m=this._xScale(h(k)),_=this.valueScale(s[k]+l),v=this._xScale(h(k+1))-m,T=this.dimensions[1]-_,b&&(_=0),!(Number.isNaN(T)||T<0||_<0)){if(this.addSVGInfo(r,m,_,v,T,d),h(k)>this.tilesetInfo.max_pos[0])break;if(this.colorScale&&!this.options.colorRangeGradient){const E=Math.round(u(s[k]+l)),P=this.colorScale[E],C=Ye.PIXI.utils.rgb2hex(P);i.beginFill(C,y)}(w||i).drawRect(m,_,v,T)}this.colorGradientColors&&(S.mask=w,i.removeChildren(),i.addChild(S,w))}},{key:"rerender",value:function(r,i){r?.colorRange&&(r.colorRangeGradient?this.setColorGradient(r.colorRange):this.setColorScale(r.colorRange)),sc(t,"rerender",this)([r,i])}},{key:"drawZeroLine",value:function(){this.zeroLine.clear();const r=gt(this.options.barFillColor||"grey"),i=+this.options.barOpacity||1,o=this.options.zeroLineColor?gt(this.options.zeroLineColor):r,a=Number.isNaN(+this.options.zeroLineOpacity)?i:+this.options.zeroLineOpacity;this.zeroLine.beginFill(o,a),this.zeroLine.drawRect(0,this.dimensions[1]-1,this.dimensions[0],1)}},{key:"drawZeroLineSvg",value:function(r){const i=document.createElement("rect");i.setAttribute("id","zero-line"),i.setAttribute("x",0),i.setAttribute("y",this.dimensions[1]-1),i.setAttribute("height",1),i.setAttribute("width",this.dimensions[0]),i.setAttribute("fill",this.options.zeroLineColor||this.options.barFillColor),i.setAttribute("fill-opacity",this.options.zeroLineOpacity||this.options.barOpacity),r.appendChild(i)}},{key:"getXScaleAndOffset",value:function(r){const i=r.domain(),o=this._xScale.domain(),a=(i[1]-i[0])/(o[1]-o[0]),c=this._xScale.domain().map(r)[0];return[a,-c*a]}},{key:"draw",value:function(){this.initialized&&(sc(t,"draw",this)([]),this.options.zeroLineVisible?this.drawZeroLine():this.zeroLine.clear(),Object.values(this.fetchedTiles).forEach(r=>{if(!r.drawnAtScale)return;const[i,o]=this.getXScaleAndOffset(r.drawnAtScale);r.graphics.scale.x=i,r.graphics.position.x=o}))}},{key:"zoomed",value:function(r,i){sc(t,"zoomed",this)([r,i])}},{key:"movedY",value:function(r){}},{key:"zoomedY",value:function(r,i){}},{key:"addSVGInfo",value:function(r,i,o,a,s,c){r.svgData?(r.svgData.barXValues.push(i),r.svgData.barYValues.push(o),r.svgData.barWidths.push(a),r.svgData.barHeights.push(s),r.svgData.barColors.push(c)):r.svgData={barXValues:[i],barYValues:[o],barWidths:[a],barHeights:[s],barColors:[c]}}},{key:"exportSVG",value:function(){let r=null,i=null;[i,r]=sc(t,"superSVG",this)([]),i.setAttribute("class","exported-line-track");const o=document.createElement("g");r.appendChild(o),o.setAttribute("transform",`translate(${this.position[0]},${this.position[1]})`),this.options.zeroLine&&this.drawZeroLineSvg(o),this.visibleAndFetchedTiles().filter(s=>s.svgData?.barXValues).forEach(s=>{const c=s.svgData;for(let l=0;l<c.barXValues.length;l++){const u=document.createElement("rect");u.setAttribute("fill",c.barColors[l]),u.setAttribute("stroke",c.barColors[l]),u.setAttribute("x",c.barXValues[l]),u.setAttribute("y",c.barYValues[l]),u.setAttribute("height",c.barHeights[l]),u.setAttribute("width",c.barWidths[l]),s.barBorders&&(u.setAttribute("stroke-width","0.1"),u.setAttribute("stroke","black")),o.appendChild(u)}});const a=document.createElement("g");if(a.setAttribute("id","axis"),i.appendChild(a),a.setAttribute("transform",`translate(${this.axis.pAxis.position.x}, ${this.axis.pAxis.position.y})`),this.options.axisPositionHorizontal==="left"||this.options.axisPositionVertical==="top"){const s=this.axis.exportAxisLeftSVG(this.valueScale,this.dimensions[1]);a.appendChild(s)}else if(this.options.axisPositionHorizontal==="right"||this.options.axisPositionVertical==="bottom"){const s=this.axis.exportAxisRightSVG(this.valueScale,this.dimensions[1]);a.appendChild(s)}return[i,r]}}])}(ac);function rbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nbe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,obe(r.key),r)}}function ibe(e,t,n){return t&&nbe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function obe(e){var t=abe(e,"string");return typeof t=="symbol"?t:t+""}function abe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function sbe(e,t,n){return t=fg(t),lbe(e,j$()?Reflect.construct(t,n||[],fg(e).constructor):t.apply(e,n))}function lbe(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cbe(e)}function cbe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(j$=function(){return!!e})()}function fg(e){return fg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fg(e)}function ube(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v5(e,t)}function v5(e,t){return v5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},v5(e,t)}let B$=function(e){function t(){return rbe(this,t),sbe(this,t,arguments)}return ube(t,e),ibe(t,[{key:"drawTile",value:function(r){this.renderTile(r)}},{key:"renderTile",value:function(r){if(!r.graphics)return;const i=r.graphics,{tileX:o,tileWidth:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos,this.tilesetInfo.tile_size||this.tilesetInfo.bins_per_dimension),s=r.tileData.dense;if(s.length===0)return;let c=0;if(this.valueScale=null,this.options.valueScaling==="log"){let m=this.medianVisibleValue;this.medianVisibleValue||(m=this.minValue()),this.valueScale=Ro().domain([m,this.maxValue()+m]).range([this.dimensions[1],0]),c=m}else this.valueScale=Et().domain([this.minValue(),this.maxValue()]).range([this.dimensions[1],0]);if(i.clear(),this.drawAxis(this.valueScale),this.options.valueScaling==="log"&&this.valueScale.domain()[1]<0){console.warn("Negative values present when using a log scale",this.valueScale.domain());return}const l=gt(this.options.lineStrokeColor?this.options.lineStrokeColor:"blue"),u=Et().domain([0,this.tilesetInfo.tile_size]).range([o,o+a]);i.lineStyle(0,l,1);const h=this.options.barFillColorTop?this.options.barFillColorTop:"green",p=this.options.barFillColorBottom?this.options.barFillColorBottom:"red",d=gt(h),g=gt(p),y="barOpacity"in this.options?this.options.barOpacity:1;r.drawnAtScale=this._xScale.copy();let b=0;this.options.valueScaling==="log"?b=this.valueScale(1):b=this.valueScale(0),delete r.svgData;for(let m=0;m<s.length;m++){const v=this._xScale(u(m)),_=this.valueScale(s[m]+c),T=this._xScale(u(m+1))-v;if(_>b?(i.beginFill(g,y),this.addSVGInfo(r,v,b,T,_-b,p)):(i.beginFill(d,y),this.addSVGInfo(r,v,_,T,b-_,h)),u(m)>this.tilesetInfo.max_pos[0])break;i.drawRect(v,r.svgData.barYValues[m],T,r.svgData.barHeights[m])}}}])}(m5);function fbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hbe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,dbe(r.key),r)}}function pbe(e,t,n){return t&&hbe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function dbe(e){var t=gbe(e,"string");return typeof t=="symbol"?t:t+""}function gbe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function mbe(e,t,n){return t=cc(t),vbe(e,z$()?Reflect.construct(t,n||[],cc(e).constructor):t.apply(e,n))}function vbe(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ybe(e)}function ybe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function z$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(z$=function(){return!!e})()}function bbe(e,t,n,r){var i=y5(cc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function y5(){return y5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=_be(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},y5.apply(null,arguments)}function _be(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=cc(e))!==null;);return e}function cc(e){return cc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cc(e)}function Tbe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b5(e,t)}function b5(e,t){return b5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},b5(e,t)}let H$=function(e){function t(n,r){var i;return fbe(this,t),i=mbe(this,t,[n,r]),i.setColorScale(r.colorRange),i.opacity=r.opacity||1,i}return Tbe(t,e),pbe(t,[{key:"setColorScale",value:function(r){this.colorScale=r?jo(r):Is,this.colorScale=this.colorScale.map(i=>i.map(o=>o/255))}},{key:"rerender",value:function(r){r?.colorRange&&this.setColorScale(r.colorRange),this.opacity=r.opacity||1,bbe(t,"rerender",this)([r])}},{key:"drawAxis",value:function(){}},{key:"drawTile",value:function(r){if(!r.graphics||!r.tileData||!r.tileData.dense)return;const i=r.graphics,{tileX:o,tileWidth:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos),s=r.tileData.dense;if(s.length===0)return;const[c,l]=this.makeValueScale(this.minValue(),this.medianVisibleValue,this.maxValue());if(c.range([254,0]).clamp(!0),this.valueScale=c,i.clear(),this.options.valueScaling==="log"&&this.valueScale.domain()[1]<0){console.warn("Negative values present when using a log scale",this.valueScale.domain());return}const u=Et().domain([0,this.tilesetInfo.tile_size]).range([o,o+a]);i.lineStyle(0,0,0);for(let f=0;f<s.length;f++){if(Number.isNaN(s[f]))continue;const h=Math.round(this.valueScale(s[f]+l));if(Number.isNaN(+h))continue;const p=this._xScale(u(f)),d=this._xScale(u(f+1))-p,g=this.dimensions[1];r.xValues[f]=p,r.yValues[f]=h;const y=this.colorScale[h],b=Ye.PIXI.utils.rgb2hex(y);if(i.beginFill(b,this.opacity),f!==0){if(u(f)>this.tilesetInfo.max_pos[0])break;s[f]!==0&&i.drawRect(p,0,d,g)}}}}])}(ac);function wbe(e){let t=0;const n=[];return e.forEach(r=>{t+=+r||0,n.push(t)}),Float64Array.from(n)}const Sbe=(e,t)=>{const n=Du(e,t);return wbe(e.map(r=>(Array.isArray(r)&&t?r.length:1)/n))};function Ebe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kbe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Cbe(r.key),r)}}function xbe(e,t,n){return t&&kbe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Cbe(e){var t=Obe(e,"string");return typeof t=="symbol"?t:t+""}function Obe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Pbe(e,t,n){return t=uc(t),Abe(e,F$()?Reflect.construct(t,n||[],uc(e).constructor):t.apply(e,n))}function Abe(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mbe(e)}function Mbe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(F$=function(){return!!e})()}function q$(e,t,n,r){var i=_5(uc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function _5(){return _5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Ibe(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},_5.apply(null,arguments)}function Ibe(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=uc(e))!==null;);return e}function uc(e){return uc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uc(e)}function Rbe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&T5(e,t)}function T5(e,t){return T5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},T5(e,t)}let U$=function(e){function t(n,r){var i;return Ebe(this,t),i=Pbe(this,t,[n,r]),i.pMain=i.pMobile,i.continuousScaling=!1,i.updateDataFetcher(r),i}return Rbe(t,e),xbe(t,[{key:"updateDataFetcher",value:function(r){if(r?.selectRows&&r.selectRowsAggregationMethod==="server"){const{pubSub:i,dataFetcher:o}=this,a=o.dataConfig.options,s={aggGroups:r.selectRows,aggFunc:r.selectRowsAggregationMode};if(JSON.stringify(a)!==JSON.stringify(s)){const c={...o.dataConfig,options:s};this.dataFetcher=new o.constructor(c,i),this.dataFetcher.dataConfig.tilesetUid&&this.fetchNewTiles(Object.keys(this.fetchedTiles).map(l=>({tileId:l,remoteId:l})))}}}},{key:"rerender",value:function(r,i){this.updateDataFetcher(r),q$(t,"rerender",this)([r,i]),r.selectRows&&(this.selectRowsCumWeights=Sbe(r.selectRows,r.selectRowsAggregationWithRelativeHeight))}},{key:"tileDataToCanvas",value:function(r){const i=document.createElement("canvas");this.options.selectRows&&this.tilesetInfo.shape?(i.width=this.tilesetInfo.shape[0],i.height=Du(this.options.selectRows,this.options.selectRowsAggregationWithRelativeHeight)):this.tilesetInfo.shape?(i.width=this.tilesetInfo.shape[0],i.height=this.tilesetInfo.shape[1]):(i.width=this.tilesetInfo.tile_size,i.height=1);const o=i.getContext("2d");if(o.fillStyle="transparent",o.fillRect(0,0,i.width,i.height),r.length!==0&&r.length===4*i.width*i.height){const a=new ImageData(r,i.width,i.height);o.putImageData(a,0,0)}else console.warn("HorizontalMultivecTrack: pixData has an incorrect length.");return i}},{key:"setSpriteProperties",value:function(r,i,o){const{tileX:a,tileWidth:s}=this.getTilePosAndDimensions(i,o,this.tilesetInfo.tile_size),c=a+s;r.width=this._refXScale(c)-this._refXScale(a),r.height=this.dimensions[1],r.x=this._refXScale(a),r.y=0}},{key:"leftTrackZoomed",value:function(r,i,o,a,s){const c=this._xScale(0)-o*this._refXScale(0);this.pMobile.position.x=c+this.position[0],this.pMobile.position.y=this.position[1],this.pMobile.scale.x=o,this.pMobile.scale.y=1}},{key:"zoomed",value:function(r,i,o,a){q$(t,"zoomed",this)([r,i]),this.pMain.position.x=a,this.pMain.position.y=this.position[1],this.pMain.scale.x=o,this.pMain.scale.y=1,this.drawColorbar()}},{key:"calculateVisibleTiles",value:function(){if(!this.tilesetInfo)return;if(this.zoomLevel=this.calculateZoomLevel(),this.tilesetInfo.resolutions){const i=this.tilesetInfo.resolutions.map(o=>+o).sort((o,a)=>a-o);this.xTiles=wt.calculateTilesFromResolution(i[this.zoomLevel],this._xScale,this.tilesetInfo.min_pos[0],null,this.tilesetInfo.tile_size)}else this.xTiles=wt.calculateTiles(this.zoomLevel,this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.max_zoom,this.tilesetInfo.max_width);const r=this.xTiles.map(i=>[this.zoomLevel,i]);this.setVisibleTiles(r)}},{key:"calculateZoomLevel",value:function(){if(!this.tilesetInfo)return;const r=this.tilesetInfo.min_pos[0];let i=null;return this.tilesetInfo.resolutions?i=wt.calculateZoomLevelFromResolutions(this.tilesetInfo.resolutions,this._xScale,r):i=wt.calculateZoomLevel(this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0]),i}},{key:"tileToLocalId",value:function(r){return r.join(".")}},{key:"tileToRemoteId",value:function(r){return r.join(".")}},{key:"getTilePosAtPosition",value:function(r,i){if(!this.tilesetInfo)return;const o=this.calculateZoomLevel(),a=wt.calculateTileWidth(this.tilesetInfo,o,this.tilesetInfo.tile_size),s=this._xScale.invert(r)/a;return[o,Math.floor(s)]}},{key:"getVisibleData",value:function(r,i){const o=this.calculateZoomLevel(),a=wt.calculateTileWidth(this.tilesetInfo,o,this.tilesetInfo.tile_size),s=this._xScale.invert(r)/a;let c=this.tilesetInfo.shape?this.tilesetInfo.shape[1]:1;this.options.selectRows&&(c=Du(this.options.selectRows,this.options.selectRowsAggregationWithRelativeHeight));let l=this.tilesetInfo.tile_size*(s-Math.floor(s));const u=i/this.dimensions[1],f=u*c;let h=Math.floor(f),p;this.options.selectRows&&(this.options.selectRowsAggregationWithRelativeHeight&&(h=this.selectRowsCumWeights.findIndex((b,m)=>u<=b&&(m===this.selectRowsCumWeights.length-1||this.selectRowsCumWeights[m+1]>=u))),p=this.options.selectRows[h]);const d=this.tileToLocalId([o,Math.floor(s)]),g=this.fetchedTiles[d];let y="";if(g){this.tilesetInfo.shape||(l=g.tileData.dense.length*(s-Math.floor(s)));let b=null;if(this.tilesetInfo.shape?Array.isArray(p)&&this.options.selectRowsAggregationMethod==="client"?b=p.map(m=>this.tilesetInfo.shape[0]*m+Math.floor(l)):p&&this.options.selectRowsAggregationMethod==="client"?b=this.tilesetInfo.shape[0]*p+Math.floor(l):b=this.tilesetInfo.shape[0]*h+Math.floor(l):b=g.tileData.dense.length*h+Math.floor(l),Array.isArray(b)){const m=R0(this.options.selectRowsAggregationMode),v=b.map(_=>g.tileData.dense[_]);y=Fr(".3f")(m(v)),y+="<br/>",y+=`${b.length}-item ${this.options.selectRowsAggregationMode}`}else y=Fr(".3f")(g.tileData.dense[b]),Array.isArray(p)&&(y+="<br/>",y+=`${p.length}-item ${this.options.selectRowsAggregationMode}`)}if(this.tilesetInfo.row_infos){y+="<br/>";let b="";this.options.selectRows&&!Array.isArray(p)?b=this.tilesetInfo.row_infos[p]:h>=0&&h<this.tilesetInfo.row_infos.length&&(b=this.tilesetInfo.row_infos[h]),typeof b=="object"?y+=Object.values(b).join(" "):y+=b}return`${y}`}},{key:"getMouseOverHtml",value:function(r,i){if(!this.tilesetInfo)return"";const o=this.getTilePosAtPosition(r,i);let a="";if(this.options?.heatmapValueScaling&&this.options.heatmapValueScaling==="categorical"&&this.options.colorRange){const c=this.getVisibleData(r,i).split("<br/>"),l=this.options.colorRange[Number.parseInt(c[0],10)-1],u=c[1];if(Number.isNaN(l)||l==="NaN"||typeof l>"u"||l==="undefined")return"";a=`<svg width="10" height="10" style="position:relative;bottom:1px"><rect width="10" height="10" rx="2" ry="2"
280
+ `):this.errorTexts.TiledPixiTrack="",this.tilesetInfoError&&(this.errorTexts.TiledPixiTrack=this.tilesetInfoError,r.push(this.tilesetInfoError)),r}},{key:"draw",value:function(){if(!this.delayDrawing){if(this.tilesetInfo)this.trackNotFoundText.visible=!1;else{if(this.dataFetcher.tilesetInfoLoading)this.trackNotFoundText.text="Loading...";else{const r=this.dataFetcher.dataConfig.server||"unknown",i=this.dataFetcher.dataConfig.tilesetUid;this.trackNotFoundText.text=`Tileset info not found. Server: [${r}] tilesetUid: [${i}]`}[this.trackNotFoundText.x,this.trackNotFoundText.y]=this.position,this.trackNotFoundText.visible=!0}this.pubSub?.publish("TiledPixiTrack.tilesDrawnStart",{uuid:this.uuid}),this._checkForErrors(),ig(t,"draw",this)([]),Object.keys(this.fetchedTiles).forEach(r=>{this.drawTile(this.fetchedTiles[r])}),this.pubSub?.publish("TiledPixiTrack.tilesDrawnEnd",{uuid:this.uuid})}}},{key:"drawTile",value:function(r){}},{key:"calculateMedianVisibleValue",value:function(){this.areAllVisibleTilesLoaded()&&this.allTilesLoaded();let r=this.visibleAndFetchedIds();r.length===0&&(r=Object.keys(this.fetchedTiles));const i=[].concat(...r.filter(o=>this.fetchedTiles[o].tileData.dense).map(o=>Array.from(this.fetchedTiles[o].tileData.dense))).filter(o=>o>0);return this.medianVisibleValue=Lm(i),this.medianVisibleValue}},{key:"allVisibleValues",value:function(){return[].concat(...this.visibleAndFetchedIds().map(r=>Array.from(this.fetchedTiles[r].tileData.dense)))}},{key:"minVisibleValue",value:function(r=!1){return this.minVisibleValueInTiles(r)}},{key:"minVisibleValueInTiles",value:function(r=!1){let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));let o=Math.min(...i.map(a=>this.fetchedTiles[a].tileData.minNonZero));return o===Number.MAX_SAFE_INTEGER&&(o=null),r?o:this.valueScaleMin!==null?this.valueScaleMin:o}},{key:"maxVisibleValue",value:function(r=!1){return this.maxVisibleValueInTiles(r)}},{key:"maxVisibleValueInTiles",value:function(r=!1){let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));let o=Math.max(...i.map(a=>this.fetchedTiles[a].tileData.maxNonZero));return o===Number.MIN_SAFE_INTEGER&&(o=null),r?o:this.valueScaleMax!==null?this.valueScaleMax:o}},{key:"makeValueScale",value:function(r,i,o,a){let s=null,c=0,l=a;(l===null||typeof l>"u")&&(l=6);let u=Math.min(this.dimensions[1]-l,l),f=Math.max(this.dimensions[1]-l,l);if(this.dimensions[1]-l<l&&(u=this.dimensions[1]/2,f=this.dimensions[1]/2),this.options.valueScaling==="log")c=i,c||(c=r),s=Ro().domain([c,o+c]).range([f,u]);else if(this.options.valueScaling==="quantile"){const h=this.dimensions[1]-l,p=l,d=Xh().domain(this.allVisibleValues()).range(en(h,p,(p-h)/256));return d.ticks=g=>ua(h,p,g),[d,0]}else if(this.options.valueScaling==="setquantile"){const h=this.dimensions[1]-l,p=l,d=new Set(this.allVisibleValues()),g=Xh().domain([...d]).range(en(h,p,(p-h)/256));return g.ticks=y=>ua(h,p,y),[g,0]}else s=Et().domain([r,o]).range([f,u]);return[s,c]}}])}(Bn);function sve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,uve(r.key),r)}}function cve(e,t,n){return t&&lve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function uve(e){var t=fve(e,"string");return typeof t=="symbol"?t:t+""}function fve(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function hve(e,t,n){return t=Gl(t),pve(e,JL()?Reflect.construct(t,n||[],Gl(e).constructor):t.apply(e,n))}function pve(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dve(e)}function dve(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function JL(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(JL=function(){return!!e})()}function e$(e,t,n,r){var i=jE(Gl(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function jE(){return jE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=gve(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},jE.apply(null,arguments)}function gve(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Gl(e))!==null;);return e}function Gl(e){return Gl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Gl(e)}function mve(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&BE(e,t)}function BE(e,t){return BE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},BE(e,t)}const vve=1024;let zE=function(e){function t(n,r){var i;sve(this,t),i=hve(this,t,[n,r]);const{onMouseMoveZoom:o,isValueScaleLocked:a,getLockGroupExtrema:s}=n;return i.onMouseMoveZoom=o,i.isValueScaleLocked=a,i.getLockGroupExtrema=s,i.onMouseMoveZoom&&i.pubSubs.push(i.pubSub.subscribe("app.mouseMove",i.mouseMoveHandler.bind(i))),i}return mve(t,e),cve(t,[{key:"initTile",value:function(r){e$(t,"initTile",this)([r])}},{key:"tileToLocalId",value:function(r){return`${r.join(".")}`}},{key:"tileToRemoteId",value:function(r){return`${r.join(".")}`}},{key:"relevantScale",value:function(){return null}},{key:"setVisibleTiles",value:function(r){this.visibleTiles=r.map(i=>({tileId:this.tileToLocalId(i),remoteId:this.tileToRemoteId(i)})),this.visibleTileIds=new Set(this.visibleTiles.map(i=>i.tileId))}},{key:"calculateVisibleTiles",value:function(){if(!this.tilesetInfo)return;if(this.zoomLevel=this.calculateZoomLevel(),this.tilesetInfo.resolutions){const o=this.tilesetInfo.resolutions.map(c=>+c).sort((c,l)=>l-c),s=wt.calculateTilesFromResolution(o[this.zoomLevel],this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.bins_per_dimension||this.tilesetInfo.tile_size).map(c=>[this.zoomLevel,c]);this.setVisibleTiles(s);return}const i=wt.calculateTiles(this.zoomLevel,this.relevantScale(),this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.max_zoom,this.tilesetInfo.max_width).map(o=>[this.zoomLevel,o]);this.setVisibleTiles(i)}},{key:"getTilePosAndDimensions",value:function(r,i,o){const a=i[0],s=i[0];if(this.tilesetInfo.resolutions){const y=o||vve,m=this.tilesetInfo.resolutions.map(S=>+S).sort((S,k)=>k-S)[r],v=m*y,_=v,T=m*y*i[0],w=m*y*i[1];return{tileX:T,tileY:w,tileWidth:v,tileHeight:_}}const c=this.tilesetInfo.max_width,l=this.tilesetInfo.max_width,u=this.tilesetInfo.min_pos[0],f=this.tilesetInfo.min_pos[1],h=c/2**r,p=l/2**r,d=u+a*h,g=f+s*p;return{tileX:d,tileY:g,tileWidth:h,tileHeight:p}}},{key:"updateTile",value:function(r){}},{key:"scheduleRerender",value:function(){this.backgroundTaskScheduler.enqueueTask(this.handleRerender.bind(this),null,this.uuid)}},{key:"handleRerender",value:function(){this.rerender(this.options,!1)}},{key:"getIndicesOfVisibleDataInTile",value:function(r){const i=this._xScale.range();if(!this.tilesetInfo)return[null,null];if(!r.tileData.dense)return console.warn(`No dense data in tile: ${r.tileData.tilePos}`),[null,null];const{tileX:o,tileWidth:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos,this.tilesetInfo.bins_per_dimension||this.tilesetInfo.tile_size||r.tileData.dense.length),s=Et().domain([0,this.tilesetInfo.tile_size||this.tilesetInfo.bins_per_dimension||r.tileData.dense.length]).range([o,o+a]),c=Math.max(0,Math.round(s.invert(this._xScale.invert(i[0])))),l=Math.min(r.tileData.dense.length,Math.round(s.invert(this._xScale.invert(i[1]))));return[c,l]}},{key:"minVisibleValue",value:function(r=!1){let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));const o=i.map(s=>this.fetchedTiles[s]).filter(s=>s.tileData.dense).map(s=>{const c=this.getIndicesOfVisibleDataInTile(s);return s.tileData.denseDataExtrema.getMinNonZeroInSubset(c)}),a=Math.min(...o);return r?a:this.valueScaleMin!==null?this.valueScaleMin:a}},{key:"maxVisibleValue",value:function(r=!1){let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));const o=i.map(s=>this.fetchedTiles[s]).filter(s=>s.tileData.dense).map(s=>{const c=this.getIndicesOfVisibleDataInTile(s);return s.tileData.denseDataExtrema.getMaxNonZeroInSubset(c)}),a=Math.max(...o);return r?a:this.valueScaleMax!==null?this.valueScaleMax:a}},{key:"getAggregatedVisibleValue",value:function(r="max"){const i=r==="min"?Math.min:Math.max,o=r==="min"?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;let a=this.visibleAndFetchedIds();a.length===0&&(a=Object.keys(this.fetchedTiles));const s=this._xScale.range();return a.map(c=>this.fetchedTiles[c]).map(c=>{if(!c.tileData.tilePos)return r==="min"?this.minVisibleValue():this.maxVisibleValue();const{tileX:l,tileWidth:u}=this.getTilePosAndDimensions(c.tileData.zoomLevel,c.tileData.tilePos,this.tilesetInfo.bins_per_dimension||this.tilesetInfo.tile_size),f=Et().domain([0,this.tilesetInfo.tile_size||this.tilesetInfo.bins_per_dimension]).range([l,l+u]),h=Math.max(0,Math.round(f.invert(this._xScale.invert(s[0])))),p=Math.min(c.tileData.dense.length,Math.round(f.invert(this._xScale.invert(s[1]))));return c.tileData.dense.slice(h,p)}).reduce((c,l)=>i(c,...l),o)}},{key:"getDataAtPos",value:function(r){let i;if(!this.tilesetInfo)return i;const o=this.calculateZoomLevel(),a=wt.calculateTileWidth(this.tilesetInfo,o,this.tilesetInfo.tile_size),s=this._xScale.invert(r)/a,c=this.tileToLocalId([o,Math.floor(s)]),l=this.fetchedTiles[c];if(!l)return i;const u=this.tilesetInfo.tile_size*(s-Math.floor(s));return l.tileData.dense?l.tileData.dense[Math.floor(u)]:null}},{key:"mouseMoveHandler",value:function({x:r,y:i}={}){this.isWithin(r,i)&&(this.mouseX=r,this.mouseY=i,this.mouseMoveZoomHandler())}},{key:"mouseMoveZoomHandler",value:function(){}},{key:"zoomed",value:function(...r){e$(t,"zoomed",this)(r),this.mouseMoveZoomHandler()}}])}(Si);function yve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Tve(r.key),r)}}function _ve(e,t,n){return t&&bve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Tve(e){var t=wve(e,"string");return typeof t=="symbol"?t:t+""}function wve(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Sve(e,t,n){return t=Wl(t),Eve(e,t$()?Reflect.construct(t,n||[],Wl(e).constructor):t.apply(e,n))}function Eve(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kve(e)}function kve(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function t$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(t$=function(){return!!e})()}function og(e,t,n,r){var i=HE(Wl(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function HE(){return HE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=xve(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},HE.apply(null,arguments)}function xve(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Wl(e))!==null;);return e}function Wl(e){return Wl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wl(e)}function Cve(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&FE(e,t)}function FE(e,t){return FE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},FE(e,t)}let Yl=function(e){function t(n,r){var i;yve(this,t),i=Sve(this,t,[n,r]);const{animate:o,isShowGlobalMousePosition:a}=n;return i.constIndicator=new Ye.PIXI.Graphics,i.pMain.addChild(i.constIndicator),i.axis=new xd(i),i.pBase.addChild(i.axis.pAxis),i.animate=o,i.options=r,i.isShowGlobalMousePosition=a,i.pubSubs=[],i.options.showMousePosition&&!i.hideMousePosition&&(i.hideMousePosition=Bo(i,i.is2d,i.isShowGlobalMousePosition())),i}return Cve(t,e),_ve(t,[{key:"rerender",value:function(r,i){const o=JSON.stringify(r);!i&&o===this.prevOptions||(og(t,"rerender",this,3)([r,i]),this.prevOptions=o,this.options=r,this.options.showMousePosition&&!this.hideMousePosition&&(this.hideMousePosition=Bo(this,this.is2d,this.isShowGlobalMousePosition())),!this.options.showMousePosition&&this.hideMousePosition&&(this.hideMousePosition(),this.hideMousePosition=void 0))}},{key:"calculateZoomLevel",value:function(){if(this.tilesetInfo.resolutions)return wt.calculateZoomLevelFromResolutions(this.tilesetInfo.resolutions,this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0]-2);const r=wt.calculateZoomLevel(this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.bins_per_dimension||this.tilesetInfo.tile_size);let i=Math.min(r,this.maxZoom);return i=Math.max(i,0),i}},{key:"relevantScale",value:function(){return this._xScale}},{key:"draw",value:function(){og(t,"draw",this,3)([]),this.drawConstIndicator()}},{key:"drawAxis",value:function(r){if(!this.options.axisPositionVertical&&!this.options.axisPositionHorizontal){this.axis.clearAxis();return}if(this.options.axisPositionVertical&&this.options.axisPositionVertical==="hidden"){this.axis.clearAxis();return}if(this.options.axisPositionHorizontal&&this.options.axisPositionHorizontal==="hidden"){this.axis.clearAxis();return}const i=this.options.axisMargin||0;this.options.axisPositionHorizontal==="left"||this.options.axisPositionVertical==="top"?(this.axis.pAxis.position.x=this.position[0]+i,this.axis.pAxis.position.y=this.position[1],this.axis.drawAxisRight(r,this.dimensions[1])):this.options.axisPositionHorizontal==="outsideLeft"||this.options.axisPositionVertical==="outsideTop"?(this.axis.pAxis.position.x=this.position[0]+i,this.axis.pAxis.position.y=this.position[1],this.axis.drawAxisLeft(r,this.dimensions[1])):this.options.axisPositionHorizontal==="right"||this.options.axisPositionVertical==="bottom"?(this.axis.pAxis.position.x=this.position[0]+this.dimensions[0]-i,this.axis.pAxis.position.y=this.position[1],this.axis.drawAxisLeft(r,this.dimensions[1])):(this.options.axisPositionHorizontal==="outsideRight"||this.options.axisPositionVertical==="outsideBottom")&&(this.axis.pAxis.position.x=this.position[0]+this.dimensions[0]-i,this.axis.pAxis.position.y=this.position[1],this.axis.drawAxisRight(r,this.dimensions[1]))}},{key:"mouseMoveZoomHandler",value:function(r=this.mouseX,i=this.mouseY){if(typeof r>"u"||!this.areAllVisibleTilesLoaded()||!this.tilesetInfo)return;let o=0,a=0,s="1d-horizontal";this.isLeftModified?(o=i-this.position[1],a=r-this.position[0],s="1d-vertical"):(o=r-this.position[0],a=i-this.position[1]);const c=r-this.position[0],l=i-this.position[1],u=this._xScale.invert(o),f=this._yScale.invert(a),h=this.getDataAtPos(o);h&&this.onMouseMoveZoom({trackId:this.id,data:h,absX:r,absY:i,relX:c,relY:l,dataX:u,dataY:f,orientation:s})}},{key:"drawConstIndicator",value:function(){if(this.constIndicator){for(this.constIndicator.clear();this.constIndicator.children[0];)this.constIndicator.removeChild(this.constIndicator.children[0]);!this.options.constIndicators||!this.valueScale||this.options.constIndicators.forEach(({color:r="black",opacity:i=1,label:o=null,labelColor:a="black",labelOpacity:s=1,labelPosition:c="leftTop",labelSize:l=12,value:u=0}={})=>{const f=gt(r),h=gt(a);this.constIndicator.beginFill(f,i);const p=this.valueScale(u);let d=0,g=0;if(o){const y=new Ye.PIXI.Text(o,{fontFamily:"Arial",fontSize:l,fill:h});switch(y.alpha=s,c){case"right":y.anchor.x=1,y.anchor.y=.5,y.x=this.position[0]+this.dimensions[0]-6,y.y=p,g=y.width+8;break;case"rightBottom":y.anchor.x=1,y.anchor.y=0,y.x=this.position[0]+this.dimensions[0]-6,y.y=p;break;case"rightTop":y.anchor.x=1,y.anchor.y=1,y.x=this.position[0]+this.dimensions[0]-6,y.y=p;break;case"left":y.anchor.x=0,y.anchor.y=.5,y.x=this.position[0]+2,y.y=p,d=y.width+4;break;case"leftBottom":y.anchor.x=0,y.anchor.y=0,y.x=this.position[0]+2,y.y=p;break;default:y.anchor.x=0,y.anchor.y=1,y.x=this.position[0]+2,y.y=p;break}this.constIndicator.addChild(y)}this.constIndicator.drawRect(this.position[0]+d,p,this.dimensions[0]-g,1)})}}},{key:"exportSVG",value:function(){let r=null,i=null;og(t,"exportSVG",this,1)?[i,r]=og(t,"exportSVG",this,3)([]):(i=document.createElement("g"),r=i),i.setAttribute("class","horizontal-tiled-1d-track");const o=document.createElement("g");return r.appendChild(o),this.options.constIndicators&&this.options.constIndicators.forEach(({color:a="black",opacity:s=1,label:c=null,labelColor:l="black",labelOpacity:u=1,labelPosition:f="leftTop",labelSize:h=12,value:p=0}={})=>{const d=this.valueScale(p);if(c){const y=document.createElement("text");switch(y.textContent=c,y.setAttribute("x",this.position[0]),y.setAttribute("y",d),y.setAttribute("style",`font-family: 'Arial'; font-size: ${h}px; fill: ${l}; fill-opacity: ${u};`),f){case"rightBottom":y.setAttribute("x",this.position[0]+this.dimensions[0]-6),y.setAttribute("y",d+h+2),y.setAttribute("text-anchor","end");break;case"right":case"rightTop":y.setAttribute("x",this.position[0]+this.dimensions[0]-6),y.setAttribute("y",d-2),y.setAttribute("text-anchor","end");break;case"leftBottom":y.setAttribute("x",this.position[0]+2),y.setAttribute("y",d+h+2);break;default:y.setAttribute("x",this.position[0]+2),y.setAttribute("y",d-2);break}o.appendChild(y)}const g=document.createElement("line");g.setAttribute("x1",this.position[0]),g.setAttribute("y1",d),g.setAttribute("x2",this.dimensions[0]),g.setAttribute("y2",d),g.setAttribute("stroke",a),g.setAttribute("stroke-opacity",s),o.appendChild(g)}),[i,r]}}])}(zE);function Ove(e,t,n){return t=Xl(t),Pve(e,r$()?Reflect.construct(t,n||[],Xl(e).constructor):t.apply(e,n))}function Pve(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ave(e)}function Ave(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(r$=function(){return!!e})()}function es(e,t,n,r){var i=qE(Xl(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function qE(){return qE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Mve(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},qE.apply(null,arguments)}function Mve(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Xl(e))!==null;);return e}function Xl(e){return Xl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xl(e)}function Ive(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&UE(e,t)}function UE(e,t){return UE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},UE(e,t)}function n$(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Dve(r.key),r)}}function i$(e,t,n){return t&&Rve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dve(e){var t=Nve(e,"string");return typeof t=="symbol"?t:t+""}function Nve(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}const Lve=16,VE=50,GE=5e3,o$=5,ts={align:"center",fontSize:"14px",fontFamily:"Arial",stroke:"white",strokeThickness:2,fontWeight:400,dropShadow:!0,dropShadowColor:"white",dropShadowDistance:0,dropShadowBlur:2},a$=(e,t,n,r,i)=>{const o=[];for(;e.length;){const[a,s]=e.splice(0,2);o.push([a*t+n,s*r+i])}return o},$ve=e=>{let t=0;if(e.length===0)return t;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return t},s$=(e,t,n)=>{const r=(n.domain()[1]-n.domain()[0])/(t.domain()[1]-t.domain()[0]),o=t.domain().map(n)[0];e.scale.x=r,e.position.x=-o*r},jve=e=>{const t={};for(let n=0;n<e.length;n++)t[e[n].uid]=e[n];return Object.values(t)};let Bve=function(){function e(t){n$(this,e),this.track=t,this.texts={},this.textsList=[],this.textWidths={},this.textHeights={},this.textGraphics=new Ye.PIXI.Graphics,this.track.pMain.addChild(this.textGraphics),this.fontSize=9}return i$(e,[{key:"hideOverlaps",value:function(){const[n,r]=[this.allBoxes,this.allTexts];Yf(n,(i,o)=>{r[i].importance>r[o].importance?r[i].text.visible&&(r[o].text.visible=!1):r[o].text.visible&&(r[i].text.visible=!1)})}},{key:"startDraw",value:function(){this.allBoxes=[],this.allTexts=[]}},{key:"lightUpdateSingleText",value:function(n,r,i,o){if(!this.texts[n.uid]||!this.track.options.showTexts)return;const a=this.texts[n.uid],s=3;a.position.x=r,a.position.y=i,a.visible=!0,this.allBoxes.push([a.position.x-s,a.position.y-this.textHeights[n.uid]/2,a.position.x+this.textWidths[n.uid]+s,a.position.y+this.textHeights[n.uid]/2]),this.allTexts.push({text:a,...o})}},{key:"updateSingleText",value:function(n,r,i,o){if(!this.texts[n.uid])return;const a=this.texts[n.uid];a.position.x=r,a.position.y=i,a.nominalY=i;const s=this.track.options.fontColor!==void 0?gt(this.track.options.fontColor):"black",c=+this.track.options.fontSize||ts.fontSize;if(c!==this.fontSize&&(this.fontSize=c,this.textWidths={},this.textHeights={}),a.style={...ts,fill:s,fontSize:this.fontSize},a.text=o,!(n.uid in this.textWidths)){a.updateTransform();const l=a.getBounds().width,u=a.getBounds().height,f=5;this.textWidths[n.uid]=l,this.textHeights[n.uid]=u-f}}},{key:"updateTexts",value:function(){if(this.track.options.showTexts){this.texts={};let n=[(0-this.track.vertY)/(this.track.vertK*this.track.prevK),(this.track.dimensions[1]-this.track.vertY)/(this.track.vertK*this.track.prevK)];const r=n[1]-n[0];n=[n[0]-r*.8,n[1]+r*.8];const i=this.track.uniqueSegments.filter(o=>!o.yMiddle||o.yMiddle>n[0]&&o.yMiddle<n[1]);for(i.forEach((o,a)=>{if(a>=(+this.track.options.maxTexts||VE))return;let s=this.textsList[a];s||(s=new Ye.PIXI.Text,this.textsList.push(s),this.textGraphics.addChild(s)),s.style={...ts,fontSize:+this.track.options.fontSize||ts.fontSize},this.track.isLeftModified&&(s.scale.x=-1),s.anchor.x=.5,s.anchor.y=.5,this.texts[o.uid]=s});this.textsList.length>Math.min(i.length,+this.track.options.maxTexts||VE);){const o=this.textsList.pop();this.textGraphics.removeChild(o)}}}}])}(),WE=function(e){function t(n,r){var i;return n$(this,t),i=Ove(this,t,[n,r]),i.valueScaleTransform=Ar,i.textManager=new Bve(i),i.vertY=1,i.vertK=0,i.prevY=0,i.prevK=1,i.minRawValue=null,i.maxRawValue=null,i.rectGraphics=new Ye.PIXI.Graphics,i.pMain.addChild(i.rectGraphics),i.selectedRect=null,i.uniqueSegments=[],i}return Ive(t,e),i$(t,[{key:"initialize",value:function(){this.initialized||([this.prevK,this.vertK,this.vertY]=[1,1,0],this.drawnRects||(this.drawnRects={}),this.colorScale||(this.options.colorRange?this.colorScale=jo(this.options.colorRange):this.colorScale=Is),this.initialized=!0)}},{key:"updateExistingGraphics",value:function(){const r=this._checkForErrors();let i=[],o=[];if(r.length>0){this.draw();return}if(this.uniqueSegments=jve(Object.values(this.fetchedTiles).filter(a=>a.tileData.length).flatMap(a=>a.tileData)),this.uniqueSegments.forEach(a=>{a.importance||(a.importance=$ve(a.uid.toString()))}),this.uniqueSegments.sort((a,s)=>s.importance-a.importance),!this.options||!this.options.valueColumn){const a=this.uniqueSegments.map(s=>{const c=+s.chrOffset;return{from:+s.fields[1]+c,to:+s.fields[2]+c,value:s,text:s.fields[3],strand:s.fields.length>=6&&s.fields[5]==="-"?"-":"+"}});i=Up(a.filter(s=>s.strand==="+")),o=Up(a.filter(s=>s.strand==="-"))}else i=[this.uniqueSegments.map(a=>({value:a}))];this.plusStrandRows=i,this.minusStrandRows=o,this.textManager.updateTexts(),this.render()}},{key:"selectRect",value:function(r){this.selectedRect=r,this.render(),this.animate()}},{key:"clickOutside",value:function(){this.selectRect(null)}},{key:"initTile",value:function(r){}},{key:"destroyTile",value:function(r){}},{key:"removeTiles",value:function(r){es(t,"removeTiles",this,3)([r])}},{key:"drawTile",value:function(r){this.options?.valueColumn&&this.valueScale&&this.drawAxis(this.valueScale)}},{key:"rerender",value:function(r,i){es(t,"rerender",this,3)([r,i]),this.valueScale=null,this.drawnRects={},this.options.colorRange?this.colorScale=jo(this.options.colorRange):this.colorScale=Is,this.updateExistingGraphics()}},{key:"updateTile",value:function(r){}},{key:"allVisibleRects",value:function(){const r={};Object.values(this.fetchedTiles).forEach(s=>{if(s.plusStrandRows)for(const c of s.plusStrandRows[0])r[c.value.uid]||(r[c.value.uid]=c)});const i=Object.values(r).sort((s,c)=>s.from-c.from);let o=0,a=0;for(let s=0;s<i.length;s++)if(i[s].staggeredStartPosition!==void 0){o=s,a=i[s].staggeredStartPosition;break}for(let s=o;s<i.length;s++)i[s].staggeredStartPosition=(a+s-o)%2;for(let s=o;s>=0&&i.length;s--)i[s].staggeredStartPosition=(a+o-s)%2;return r}},{key:"drawSegmentStyle",value:function(r,i,o,a,s){const l=o+a/2,u=[r,o,r+2*.1,o,r+2*.1,l-.1,i-2*.1,l-.1,i-2*.1,o,i,o,i,o+a,i-2*.1,o+a,i-2*.1,l+.1,r+2*.1,l+.1,r+2*.1,o+a,r,o+a];return this.rectGraphics.drawPolygon(u),u}},{key:"drawPoly",value:function(r,i,o,a,s){let c=null;return this.options.annotationStyle==="segment"?this.drawSegmentStyle(r,i,o,a,s):((s==="+"||s==="-")&&i-r<Lve/2?(c=[r,o,r+a/2,o+a/2,r,o+a],s==="+"?this.rectGraphics.drawPolygon(c):(c=[i,o,i-a/2,o+a/2,i,o+a],this.rectGraphics.drawPolygon(c))):(s==="+"?c=[r,o,i-a/2,o,i,o+a/2,i-a/2,o+a,r,o+a]:s==="-"?c=[r+a/2,o,i,o,i,o+a,r+a/2,o+a,r,o+a/2]:c=[r,o,i,o,i,o+a,r,o+a],this.rectGraphics.drawPolygon(c)),c)}},{key:"setValueScale",value:function(){if(this.valueScale=null,this.options?.valueColumn){const r=this.options.colorEncodingRange?+this.options.colorEncodingRange[0]:this.minVisibleValueInTiles(+this.options.valueColumn),i=this.options.colorEncodingRange?+this.options.colorEncodingRange[1]:this.maxVisibleValueInTiles(+this.options.valueColumn);this.options.valueColumn&&([this.valueScale]=this.makeValueScale(r,this.calculateMedianVisibleValue(+this.options.valueColumn),i))}}},{key:"setColorValueScale",value:function(){if(this.colorValueScale=null,this.options?.colorEncoding&&this.options.colorEncoding!=="itemRgb"){const r=this.options.colorEncodingRange?+this.options.colorEncodingRange[0]:this.minVisibleValueInTiles(+this.options.colorEncoding),i=this.options.colorEncodingRange?+this.options.colorEncodingRange[1]:this.maxVisibleValueInTiles(+this.options.colorEncoding);this.colorValueScale=Et().domain([r,i]).range([0,255])}}},{key:"renderRows",value:function(r,i,o,a,s){this.initialize();const c=Jc().domain(en(i)).range([o,a]);this.allVisibleRects();let l=null;this.options.staggered&&(l=this.allVisibleRects());for(let u=0;u<r.length;u++)for(let f=0;f<r[u].length;f++){const h=r[u][f].value,p=h.fields,d=+h.xStart,g=+h.xEnd,y=(d+g)/2;let b=c(u)+c.bandwidth()/2,m=this.options.annotationHeight||"scaled";if(m==="scaled"&&(m=c.bandwidth(),this.options.maxAnnotationHeight&&(m=Math.min(m,+this.options.maxAnnotationHeight))),this.options&&this.options.colorEncoding==="itemRgb"&&h.fields[8]){let k=[];try{k=h.fields[8].split(",")}catch{}k.length===3&&(s=`rgb(${h.fields[8]})`)}else this.colorValueScale?s=`rgba(${P0(this.colorValueScale,this.colorScale,0,-Number.MIN_VALUE)(+p[+this.options.colorEncoding-1]).join(",")})`:this.options&&this.options.colorEncoding==="itemRgb"&&h.fields[8]&&h.fields[8].split(",").length===3&&(s=`rgb(${h.fields[8]})`);if(this.valueScale){const k=+p[+this.options.valueColumn-1];b=this.valueScale(k)}const v=this.options.fillOpacity||.3;this.selectedRect===h.uid?this.rectGraphics.lineStyle(3,0,.75):this.rectGraphics.lineStyle(1,gt(s),v),this.rectGraphics.beginFill(gt(s),v);let _=b-m/2;const T=this._xScale(d),w=this._xScale(g);this.options.staggered&&(l[h.uid].staggeredStartPosition?_-=o$/2:_+=o$/2);const S=this.drawPoly(T,w,_*this.prevK,m*this.prevK,p[5]);this.drawnRects[h.uid]=[S,{start:d,end:g,value:h,fill:s}],h.yMiddle=b,this.options.showTexts&&(f>=(+this.options.maxTexts||VE)||this.textManager.updateSingleText(h,this._xScale(y),_+m/2,h.fields[3]))}this.textManager.updateTexts()}},{key:"render",value:function(){const r=this.plusStrandRows?this.plusStrandRows.length:1,i=this.minusStrandRows?this.minusStrandRows.length:1;this.prevVertY=this.vertY;const o=this.rectGraphics;this.rectGraphics=new Ye.PIXI.Graphics,this.drawnAtScale=this._xScale.copy(),this.setValueScale(),this.setColorValueScale();const a=this.options.plusStrandColor||this.options.fillColor||"blue",s=this.options.minusStrandColor||this.options.fillColor||"purple",c=0;let l=0;this.options.separatePlusMinusStrands?l=r*this.dimensions[1]/(r+i)-c/2:l=this.dimensions[1],this.renderRows(this.plusStrandRows,r,0,l,a),this.renderRows(this.minusStrandRows,i,this.options.separatePlusMinusStrands?l+c/2:0,this.dimensions[1],s),this.pMain.removeChild(o),this.pMain.addChild(this.rectGraphics),s$(this.rectGraphics,this._xScale,this.drawnAtScale)}},{key:"calculateZoomLevel",value:function(){const r=wt.calculateZoomLevel(this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0]);let i=Math.min(r,this.maxZoom);return i=Math.max(i,0),i}},{key:"minVisibleValueInTiles",value:function(r){let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));let o=Math.min.apply(null,i.map(a=>this.fetchedTiles[a]).filter(a=>a.tileData?.length).map(a=>Math.min.apply(null,a.tileData.sort((s,c)=>c.importance-s.importance).slice(0,GE).map(s=>+s.fields[r-1]).filter(s=>!Number.isNaN(s)))));return o===Number.MAX_SAFE_INTEGER&&(o=null),o}},{key:"maxVisibleValueInTiles",value:function(r){let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));let o=Math.max.apply(null,i.map(a=>this.fetchedTiles[a]).filter(a=>a.tileData?.length).map(a=>Math.max.apply(null,a.tileData.sort((s,c)=>c.importance-s.importance).slice(0,GE).map(s=>+s.fields[r-1]).filter(s=>!Number.isNaN(s)))));return o===Number.MIN_SAFE_INTEGER&&(o=null),o}},{key:"calculateMedianVisibleValue",value:function(r){this.areAllVisibleTilesLoaded()&&this.allTilesLoaded();let i=this.visibleAndFetchedIds();i.length===0&&(i=Object.keys(this.fetchedTiles));const o=[].concat(...i.map(a=>this.fetchedTiles[a]).filter(a=>a.tileData?.length).map(a=>a.tileData.sort((s,c)=>c.importance-s.importance).slice(0,GE).map(s=>+s.fields[r-1]))).filter(a=>a>0);this.medianVisibleValue=Lm(o)}},{key:"draw",value:function(){es(t,"draw",this,3)([]),this.textManager.startDraw(),this.rectGraphics.scale.y=this.vertK,this.rectGraphics.position.y=this.vertY,this.drawnAtScale&&(s$(this.rectGraphics,this._xScale,this.drawnAtScale),this.uniqueSegments?.length&&this.uniqueSegments.forEach(r=>{const i=r.fields,o=i[3],a=this._xScale((r.xStart+r.xEnd)/2);if(this.textManager.texts[r.uid]){const s=this.textManager.texts[r.uid].nominalY*(this.vertK*this.prevK)+this.vertY;this.textManager.lightUpdateSingleText(r,a,s,{importance:r.importance,caption:o,strand:i[5]})}}),this.textManager.hideOverlaps())}},{key:"setPosition",value:function(r){es(t,"setPosition",this,3)([r]),[this.pMain.position.x,this.pMain.position.y]=this.position}},{key:"setDimensions",value:function(r){es(t,"setDimensions",this,3)([r])}},{key:"zoomed",value:function(r,i){this.xScale(r),this.yScale(i),this.refreshTiles(),this.draw()}},{key:"exportSVG",value:function(){let r=null,i=null;es(t,"exportSVG",this,1)?[i,r]=es(t,"exportSVG",this,3)([]):(i=document.createElement("g"),r=i);const o=document.createElement("g");o.setAttribute("transform",`translate(${this.position[0]},${this.position[1]})`),r.appendChild(o);const a=document.createElement("g"),s=document.createElement("g");return o.appendChild(a),o.appendChild(s),this.uniqueSegments.forEach(c=>{const l=document.createElement("g");if(l.setAttribute("transform",`translate(${this.rectGraphics.position.x},${this.rectGraphics.position.y})scale(${this.rectGraphics.scale.x},${this.rectGraphics.scale.y})`),a.appendChild(l),this.drawnRects&&c.uid in this.drawnRects){const u=this.drawnRects[c.uid][0],f=document.createElement("path");let h=`M ${u[0]} ${u[1]}`;for(let g=2;g<u.length;g+=2)h+=` L ${u[g]} ${u[g+1]}`;const p=this.drawnRects[c.uid][1].fill,d=this.options.fontColor!==void 0?gt(this.options.fontColor):p;if(f.setAttribute("d",h),f.setAttribute("fill",p),f.setAttribute("opacity",.3),f.style.stroke=p,f.style.strokeWidth="1px",l.appendChild(f),this.textManager.texts[c.uid]){const g=this.textManager.texts[c.uid];if(!g.visible)return;const y=document.createElement("g"),b=document.createElement("text");s.appendChild(y),y.appendChild(b),y.setAttribute("transform",`translate(${g.x},${g.y})scale(${g.scale.x},1)`),b.setAttribute("text-anchor","middle"),b.setAttribute("font-family",ts.fontFamily),b.setAttribute("font-size",+this.options.fontSize||ts.fontSize),b.setAttribute("font-weight","bold"),b.setAttribute("dy","5px"),b.setAttribute("fill",d),b.setAttribute("stroke",ts.stroke),b.setAttribute("stroke-width","0.4"),b.setAttribute("text-shadow","0px 0px 2px grey"),b.innerHTML=g.text}}}),[i,i]}},{key:"movedY",value:function(r){const i=this.valueScaleTransform,{y:o,k:a}=i,s=this.dimensions[1];o+r/a>-(a-1)*s&&o+r/a<0&&(this.valueScaleTransform=i.translate(0,r/a)),this.rectGraphics.position.y=this.valueScaleTransform.y,this.vertY=this.valueScaleTransform.y,this.animate(),this.vertY-this.prevVertY>this.dimensions[1]/2&&this.render()}},{key:"zoomedY",value:function(r,i){const o=mf.zoomedY(r,i,this.valueScaleTransform,this.dimensions[1]);this.valueScaleTransform=o;let a=o.k;const s=o.y;let c=!1;a/=this.prevK,(a>1.5||a<1/1.5)&&(this.prevK*=a,a=1,c=!0),this.vertK=a,this.vertY=s,c&&this.render(),this.rectGraphics.scale.y=a,this.rectGraphics.position.y=s,this.draw(),this.animate()}},{key:"getMouseOverHtml",value:function(r,i){if(!this.tilesetInfo||!this.drawnRects)return"";const o="",a=[r,i],s=Object.values(this.drawnRects);for(let c=0;c<s.length;c++){const l=s[c][0].slice(0),u=a$(l,this.rectGraphics.scale.x,this.rectGraphics.position.x,this.rectGraphics.scale.y,this.rectGraphics.position.y);if(ME(u,a)===-1)return s[c][1].value.fields.join(" ")}return o}}])}(Yl);function zve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,qve(r.key),r)}}function Fve(e,t,n){return t&&Hve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function qve(e){var t=Uve(e,"string");return typeof t=="symbol"?t:t+""}function Uve(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Vve(e,t,n){return t=Kl(t),Gve(e,l$()?Reflect.construct(t,n||[],Kl(e).constructor):t.apply(e,n))}function Gve(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wve(e)}function Wve(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(l$=function(){return!!e})()}function Ir(e,t,n,r){var i=YE(Kl(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function YE(){return YE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Yve(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},YE.apply(null,arguments)}function Yve(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Kl(e))!==null;);return e}function Kl(e){return Kl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kl(e)}function Xve(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&XE(e,t)}function XE(e,t){return XE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},XE(e,t)}const c$=200,ta=10,Kf=40,Qr=10,ra=Qr,u$=4,Zl=1,na=4,f$=5,Kve=256,Zf=ta+Kf+Qr+Zl+ra+na;let Ql=function(e){function t(n,r){var i;zve(this,t);const o={...n};o.onValueScaleChanged=()=>{n.onValueScaleChanged(),i.drawColorbar()},i=Vve(this,t,[o,r]);const{pubSub:a,animate:s,svgElement:c,onTrackOptionsChanged:l,onMouseMoveZoom:u,isShowGlobalMousePosition:f,isValueScaleLocked:h}=n;return i.pubSub=a,i.is2d=!0,i.animate=s,i.uid=Mt.nice(),i.scaleBrush=al(),i.onTrackOptionsChanged=l,i.isShowGlobalMousePosition=f,i.isValueScaleLocked=h,i.pColorbarArea=new Ye.PIXI.Graphics,i.pMasked.addChild(i.pColorbarArea),i.pColorbar=new Ye.PIXI.Graphics,i.pColorbarArea.addChild(i.pColorbar),i.axis=new xd(i),i.pColorbarArea.addChild(i.axis.pAxis),i.colorScale=Is,r?.colorRange&&(i.colorScale=jo(r.colorRange)),i.gBase=_t(c).append("g"),i.gMain=i.gBase.append("g"),i.gColorscaleBrush=i.gMain.append("g"),i.brushing=!1,i.prevOptions="",i.prevIndUpperLeftTile="",i.onMouseMoveZoom=u,i.setDataLensSize(11),i.dataLens=new Float32Array(i.dataLensSize**2),i.mouseMoveHandlerBound=i.mouseMoveHandler.bind(i),i.onMouseMoveZoom&&i.pubSubs.push(i.pubSub.subscribe("app.mouseMove",i.mouseMoveHandlerBound)),i.options?.showMousePosition&&!i.hideMousePosition&&(i.hideMousePosition=Bo(i,i.is2d,i.isShowGlobalMousePosition())),i.prevOptions=JSON.stringify(r),i}return Xve(t,e),Fve(t,[{key:"mouseMoveHandler",value:function(r){this.isWithin(r.x,r.y)&&(this.mouseX=r.x,this.mouseY=r.y,this.mouseMoveZoomHandler())}},{key:"mouseMoveZoomHandler",value:function(r=this.mouseX,i=this.mouseY){if(typeof r>"u"||typeof i>"u"||!this.areAllVisibleTilesLoaded()||!this.tilesetInfo)return;const o=r-this.position[0],a=i-this.position[1];let s,c;try{c=this.getVisibleRectangleData(o-this.dataLensPadding,a-this.dataLensPadding,this.dataLensSize,this.dataLensSize),s=c.get(this.dataLensPadding,this.dataLensPadding)}catch{return}const l=this.dataLensSize;let u;try{u=P0(this.limitedValueScale,this.colorScale,this.valueScale.domain()[0])}catch{return}if(!u)return;const f=Math.round(this._xScale.invert(o)),h=Math.round(this._yScale.invert(a));let p=[f,h],d=[Math.round(this._xScale.invert(o-this.dataLensPadding)),Math.round(this._xScale.invert(o+this.dataLensPadding))],g=[Math.round(this._yScale.invert(a-this.dataLensPadding)),Math.round(this._yScale.invert(a+this.dataLensPadding))];this.chromInfo&&(p=p.map(y=>dr(y,this.chromInfo).slice(0,2)),d=d.map(y=>dr(y,this.chromInfo).slice(0,2)),g=g.map(y=>dr(y,this.chromInfo).slice(0,2))),this.onMouseMoveZoom({trackId:this.id,data:s,absX:r,absY:i,relX:o,relY:a,dataX:f,dataY:h,orientation:"2d",dataLens:c,dim:l,toRgb:u,center:p,xRange:d,yRange:g,isGenomicCoords:!!this.chromInfo})}},{key:"scheduleRerender",value:function(){this.backgroundTaskScheduler.enqueueTask(this.handleRerender.bind(this),null,this.uuid)}},{key:"handleRerender",value:function(){this.rerender(this.options,!0)}},{key:"getAbsTileDim",value:function(r,i,o){const{tileX:a,tileY:s,tileWidth:c,tileHeight:l}=this.getTilePosAndDimensions(r,i),u={};return u.width=this._refXScale(a+c)-this._refXScale(a),u.height=this._refYScale(s+l)-this._refYScale(s),o?(u.x=this._refXScale(s),u.y=this._refYScale(a)):(u.x=this._refXScale(a),u.y=this._refYScale(s)),u}},{key:"updateValueScale",value:function(){let r=this.minValue(),i=this.maxValue();const o=1e-6;r!=null&&i!==void 0&&i!==null&&Math.abs(r-i)<o&&(r=Math.max(o,r-.001),i+=.001);const[a,s]=ave(this.options?.heatmapValueScaling||"log",r,this.medianVisibleValue,i);return this.valueScale=s,this.limitedValueScale=this.valueScale.copy(),this.options&&typeof this.options.scaleStartPercent<"u"&&typeof this.options.scaleEndPercent<"u"&&this.limitedValueScale.domain([this.valueScale.domain()[0]+(this.valueScale.domain()[1]-this.valueScale.domain()[0])*this.options.scaleStartPercent,this.valueScale.domain()[0]+(this.valueScale.domain()[1]-this.valueScale.domain()[0])*this.options.scaleEndPercent]),[a,s]}},{key:"rerender",value:function(r,i){Ir(t,"rerender",this,3)([r,i]),this.updateValueScale();const o=JSON.stringify(r);this.drawColorbar(),!(!i&&o===this.prevOptions)&&(this.prevOptions=o,this.options=r,Ir(t,"rerender",this,3)([r,i]),this.calculateVisibleTiles(),r?.colorRange&&(this.colorScale=jo(r.colorRange)),this.visibleAndFetchedTiles().forEach(a=>this.renderTile(a)),this.hideMousePosition&&(this.hideMousePosition(),this.hideMousePosition=void 0),this.options?.showMousePosition&&!this.hideMousePosition&&(this.hideMousePosition=Bo(this,this.is2d,this.isShowGlobalMousePosition())))}},{key:"drawLabel",value:function(){this.options.labelPosition===this.options.colorbarPosition?this.labelXOffset=Zf:this.labelXOffset=0,Ir(t,"drawLabel",this,3)([])}},{key:"tileDataToCanvas",value:function(r){const i=document.createElement("canvas");i.width=this.binsPerTile(),i.height=this.binsPerTile();const o=i.getContext("2d");o.fillStyle="transparent",o.fillRect(0,0,i.width,i.height);const a=new ImageData(r,i.width,i.height);return o.putImageData(a,0,0),i}},{key:"exportData",value:function(){if(this.tilesetInfo){const r=this.getVisibleRectangleData(0,0,this.dimensions[0],this.dimensions[1]),i={bounds:[this._xScale.domain(),this._yScale.domain()],dimensions:r.shape,data:mA(r)};wu("data.json",JSON.stringify(i))}}},{key:"setSpriteProperties",value:function(r,i,o,a){const s=this.getAbsTileDim(i,o,a);r.width=s.width,r.height=s.height,r.x=s.x,r.y=s.y,a&&o[0]!==o[1]&&(r.rotation=-Math.PI/2,r.scale.x=Math.abs(r.scale.x)*-1)}},{key:"refXScale",value:function(r){Ir(t,"refXScale",this,3)([r]),this.draw()}},{key:"refYScale",value:function(r){Ir(t,"refYScale",this,3)([r]),this.draw()}},{key:"draw",value:function(){Ir(t,"draw",this,3)([])}},{key:"newBrushOptions",value:function(r){const i=JSON.parse(JSON.stringify(this.options)),o=this.valueScale.copy().range([this.colorbarHeight,0]),a=o.invert(r[0]),c=(o.invert(r[1])-o.domain()[0])/(o.domain()[1]-o.domain()[0]),l=(a-o.domain()[0])/(o.domain()[1]-o.domain()[0]);return i.scaleStartPercent=c.toFixed(f$),i.scaleEndPercent=l.toFixed(f$),i}},{key:"brushStart",value:function(){this.brushing=!0}},{key:"brushMoved",value:function(r){if(!r.selection)return;const i=this.newBrushOptions(r.selection),o=JSON.stringify(i);this.gColorscaleBrush.selectAll(".handle--custom").attr("y",a=>a.type==="n"?r.selection[0]:r.selection[1]-u$/2),o!==this.prevOptions&&(this.prevOptions=o,this.rerender(i,!0),this.onTrackOptionsChanged(i),this.isValueScaleLocked()&&this.onValueScaleChanged())}},{key:"brushEnd",value:function(){this.brushing=!1}},{key:"setPosition",value:function(r){Ir(t,"setPosition",this,3)([r]),this.drawColorbar()}},{key:"setDimensions",value:function(r){Ir(t,"setDimensions",this,3)([r]),this.drawColorbar()}},{key:"removeColorbar",value:function(){this.pColorbarArea.visible=!1,this.scaleBrush.on(".brush")&&this.gColorscaleBrush.call(this.scaleBrush.move,null),this.gColorscaleBrush.on(".brush",null),this.gColorscaleBrush.selectAll("rect").remove()}},{key:"drawColorbar",value:function(){if(this.pColorbar.clear(),!this.options||!this.options.colorbarPosition||this.options.colorbarPosition==="hidden"){this.removeColorbar();return}if(this.pColorbarArea.visible=!0,!this.valueScale||Number.isNaN(+this.valueScale.domain()[0])||Number.isNaN(+this.valueScale.domain()[1]))return;const r=Math.min(this.dimensions[1]/2,c$);if(this.colorbarHeight=r-2*Qr,this.colorbarHeight<0){this.removeColorbar();return}if(this.valueScale.domain()[1]===this.valueScale.domain()[0]){this.removeColorbar();return}const i=this.valueScale.copy().range([this.colorbarHeight,0]);this.options.colorbarPosition==="topLeft"||this.options.colorbarPosition==="bottomLeft"?this.scaleBrush.extent([[na,0],[ra,this.colorbarHeight]]):this.scaleBrush.extent([[0,0],[ra-na,this.colorbarHeight]]),this.options.colorbarPosition==="topLeft"&&([this.pColorbarArea.x,this.pColorbarArea.y]=this.position,this.pColorbar.y=Qr,this.axis.pAxis.y=Qr,this.axis.pAxis.x=na+ra+Zl+ta,this.pColorbar.x=na+ra+Zl,this.gColorscaleBrush.attr("transform",`translate(${this.pColorbarArea.x+na},${this.pColorbarArea.y+this.pColorbar.y-1})`)),this.options.colorbarPosition==="topRight"&&(this.pColorbarArea.x=this.position[0]+this.dimensions[0]-Zf,this.pColorbarArea.y=this.position[1],this.pColorbar.y=Qr,this.axis.pAxis.y=Qr,this.axis.pAxis.x=Kf+Qr,this.pColorbar.x=Kf+Qr,this.gColorscaleBrush.attr("transform",`translate(${this.pColorbarArea.x+this.pColorbar.x+ta+2},${this.pColorbarArea.y+this.pColorbar.y-1})`)),this.options.colorbarPosition==="bottomRight"&&(this.pColorbarArea.x=this.position[0]+this.dimensions[0]-Zf,this.pColorbarArea.y=this.position[1]+this.dimensions[1]-r,this.pColorbar.y=Qr,this.axis.pAxis.y=Qr,this.axis.pAxis.x=Kf+Qr,this.pColorbar.x=Kf+Qr,this.gColorscaleBrush.attr("transform",`translate(${this.pColorbarArea.x+this.pColorbar.x+ta+Zl},${this.pColorbarArea.y+this.pColorbar.y-1})`)),this.options.colorbarPosition==="bottomLeft"&&(this.pColorbarArea.x=this.position[0],this.pColorbarArea.y=this.position[1]+this.dimensions[1]-r,this.pColorbar.y=Qr,this.axis.pAxis.y=Qr,this.axis.pAxis.x=na+ra+Zl+ta,this.pColorbar.x=na+ra+Zl,this.gColorscaleBrush.attr("transform",`translate(${this.pColorbarArea.x+2},${this.pColorbarArea.y+this.pColorbar.y-1})`)),this.pColorbarArea.clear(),this.pColorbarArea.beginFill(gt(this.options.colorbarBackgroundColor||"white"),+this.options.colorbarBackgroundOpacity>=0?+this.options.colorbarBackgroundOpacity:.6),this.pColorbarArea.drawRect(0,0,Zf,r),this.options?(this.options.scaleStartPercent||(this.options.scaleStartPercent=0),this.options.scaleEndPercent||(this.options.scaleEndPercent=1)):this.options={scaleStartPercent:0,scaleEndPercent:1};const o=i.domain()[1]-i.domain()[0],a=i(this.options.scaleStartPercent*o+i.domain()[0]),s=i(this.options.scaleEndPercent*o+i.domain()[0]);this.brushing||(this.scaleBrush.on("start",this.brushStart.bind(this)).on("brush",this.brushMoved.bind(this)).on("end",this.brushEnd.bind(this)).handleSize(0),this.gColorscaleBrush.on(".brush",null),this.gColorscaleBrush.call(this.scaleBrush),this.northHandle=this.gColorscaleBrush.selectAll(".handle--custom").data([{type:"n"},{type:"s"}]).enter().append("rect").classed("handle--custom",!0).attr("cursor","ns-resize").attr("width",ra).attr("height",u$).style("fill","#666").style("stroke","white"),this.flipText&&this.northHandle.attr("cursor","ew-resize"),this.gColorscaleBrush.call(this.scaleBrush.move,[s,a]));const c=Et().domain([0,255]).range([0,this.colorbarHeight]);for(let l=0;l<this.colorbarHeight;l++){const u=this.limitedValueScale(i.invert(l)),f=Math.max(0,Math.min(254,Math.floor(u)));this.pColorbar.beginFill(gt(`rgb(${this.colorScale[f][0]},${this.colorScale[f][1]},${this.colorScale[f][2]})`)),this.pColorbar.drawRect(0,l,ta,1)}this.pAxis.position.x=ta,this.pAxis.position.y=c(0),this.options.colorbarPosition==="topLeft"||this.options.colorbarPosition==="bottomLeft"?this.axis.drawAxisRight(i,this.colorbarHeight):(this.options.colorbarPosition==="topRight"||this.options.colorbarPosition==="bottomRight")&&this.axis.drawAxisLeft(i,this.colorbarHeight)}},{key:"exportColorBarSVG",value:function(){const r=document.createElement("g");if(r.setAttribute("class","color-bar"),!this.options.colorbarPosition||this.options.colorbarPosition==="hidden"||!this.valueScale)return r;r.setAttribute("transform",`translate(${this.pColorbarArea.x}, ${this.pColorbarArea.y})`);const i=document.createElement("rect");r.appendChild(i);const o=document.createElement("g");r.appendChild(o),o.setAttribute("transform",`translate(${this.pColorbar.x}, ${this.pColorbar.y})`);const a=Math.min(this.dimensions[1]/2,c$);this.colorbarHeight=a-2*Qr,i.setAttribute("x",0),i.setAttribute("y",0),i.setAttribute("width",Zf),i.setAttribute("height",a),i.setAttribute("style","fill: white; stroke-width: 0; opacity: 0.7");const s=256,c=Et().domain([0,s-1]).range([0,this.colorbarHeight]),l=this.colorbarHeight/s;for(let p=0;p<s;p++){const d=document.createElement("rect");o.appendChild(d),d.setAttribute("x",0),d.setAttribute("y",c(p)),d.setAttribute("width",ta),d.setAttribute("height",l),d.setAttribute("class","color-rect");const g=Math.min(this.colorScale.length-1,Math.max(0,Math.floor(this.limitedValueScale(this.valueScale.invert(p))))),y=this.colorScale[g];y?d.setAttribute("style",`fill: rgb(${y[0]}, ${y[1]}, ${y[2]})`):d.setAttribute("style","fill: rgb(255,255,255,0)")}const u=document.createElement("g");r.appendChild(u),u.setAttribute("transform",`translate(${this.axis.pAxis.position.x},${this.axis.pAxis.position.y})`);let f=null;const h=this.valueScale.copy().range([this.colorbarHeight,0]);return this.options.colorbarPosition==="topLeft"||this.options.colorbarPosition==="bottomLeft"?f=this.axis.exportAxisRightSVG(h,this.colorbarHeight):(this.options.colorbarPosition==="topRight"||this.options.colorbarPosition==="bottomRight")&&(f=this.axis.exportAxisLeftSVG(h,this.colorbarHeight)),u.appendChild(f),r}},{key:"setDataLensSize",value:function(r){this.dataLensPadding=Math.max(0,Math.floor((r-1)/2)),this.dataLensSize=this.dataLensPadding*2+1}},{key:"binsPerTile",value:function(){return this.tilesetInfo.bins_per_dimension||Kve}},{key:"getVisibleRectangleData",value:function(r,i,o,a){let s=this.calculateZoomLevel();s=this.tilesetInfo.max_zoom?Math.min(this.tilesetInfo.max_zoom,s):s;const l=F7(this.tilesetInfo,s,this.binsPerTile())/this.binsPerTile(),u=[this._xScale.invert(r),this._xScale.invert(r+o)],f=[this._yScale.invert(i),this._yScale.invert(i+a)],h=[Math.max(u[0],this.tilesetInfo.min_pos[0]),Math.min(u[1],this.tilesetInfo.max_pos[0])],p=[Math.max(f[0],this.tilesetInfo.min_pos[1]),Math.min(f[1],this.tilesetInfo.max_pos[1])],d=Math.floor(h[0]/l),g=Math.floor(p[0]/l),y=Math.max(0,Math.ceil((h[1]-h[0])/l)),b=Math.max(0,Math.ceil((p[1]-p[0])/l)),m=Ns(new Array(b*y).fill(Number.NaN),[b,y]);return this.visibleAndFetchedTiles().forEach(v=>{const _=v.mirrored?[v.tileData.tilePos[1],v.tileData.tilePos[0]]:v.tileData.tilePos,{tileX:T,tileY:w,tileWidth:S,tileHeight:k}=this.getTilePosAndDimensions(v.tileData.zoomLevel,_,this.binsPerTile()),E=Math.floor(T/l),P=Math.floor((T+S)/l),C=Math.floor(w/l),I=Math.floor((w+k)/l);let O=Math.max(d,E)-E,M=Math.max(g,C)-C;const R=Math.min(d+y,P)-E,z=Math.min(g+b,I)-C,U=Math.max(E-d,0),j=Math.max(C-g,0),H=R-O,W=z-M;if(!(H<0||W<0)){if(v.mirrored&&O>M){const re=O;O=M,M=re}fA(m.hi(j+W,U+H).lo(j,U),v.dataArray.hi(M+W,O+H).lo(M,O))}}),m}},{key:"initTile",value:function(r){Ir(t,"initTile",this,3)([r]),r.tileData.dense.length===this.binsPerTile()**2&&(r.dataArray=Ns(Array.from(r.tileData.dense),[this.binsPerTile(),this.binsPerTile()]),this.continuousScaling&&r.tileData.tilePos[0]===r.tileData.tilePos[1]&&r.mirrored&&(r.tileData.denseDataExtrema.mirrorPrecomputedExtrema(),Ir(t,"initTile",this,3)([r]))),!(this.scale.minValue===null||this.scale.maxValue===null)&&this.renderTile(r)}},{key:"updateTile",value:function(r){r.scale&&this.scale&&this.scale.minValue===r.scale.minValue&&this.scale.maxValue===r.scale.maxValue||(this.renderTile(r),this.drawColorbar())}},{key:"destroyTile",value:function(r){r.sprite.destroy(!0),r.canvas=null,r.sprite=null,r.texture=null}},{key:"pixDataFunction",value:function(r,i){if(i){const{graphics:o}=r,a=this.tileDataToCanvas(i.pixData);r.sprite&&r.sprite.destroy(!0);const s=Ye.PIXI.VERSION[0]==="4"?Ye.PIXI.Texture.fromCanvas(a,Ye.PIXI.SCALE_MODES.NEAREST):Ye.PIXI.Texture.from(a,{scaleMode:Ye.PIXI.SCALE_MODES.NEAREST}),c=new Ye.PIXI.Sprite(s);r.sprite=c,r.texture=s,r.canvas=a,this.setSpriteProperties(r.sprite,r.tileData.zoomLevel,r.tileData.tilePos,r.mirrored),o.removeChildren(),o.addChild(r.sprite)}this.renderingTiles.delete(r.tileId)}},{key:"renderTile",value:function(r){const[i]=this.updateValueScale(),o=0;if(this.renderingTiles.add(r.tileId),this.tilesetInfo.tile_size&&r.tileData.dense?.length<this.tilesetInfo.tile_size){const a=new Float32Array(this.tilesetInfo.tile_size);a.fill(Number.NaN),a.set(r.tileData.dense),r.tileData.dense=a}q7(r,i,this.limitedValueScale.domain(),o,this.colorScale,a=>this.pixDataFunction(r,a),this.mirrorTiles()&&!r.mirrored&&r.tileData.tilePos[0]===r.tileData.tilePos[1],this.options.extent==="upper-right"&&r.tileData.tilePos[0]===r.tileData.tilePos[1],this.options.zeroValueColor?N4(this.options.zeroValueColor):void 0,{selectedRows:this.options.selectRows,selectedRowsAggregationMode:this.options.selectRowsAggregationMode,selectedRowsAggregationWithRelativeHeight:this.options.selectRowsAggregationWithRelativeHeight,selectedRowsAggregationMethod:this.options.selectRowsAggregationMethod})}},{key:"remove",value:function(){this.gMain.remove(),this.gMain=null,Ir(t,"remove",this,3)([])}},{key:"refScalesChanged",value:function(r,i){Ir(t,"refScalesChanged",this,3)([r,i]),Bp(this.fetchedTiles).filter(o=>o.sprite).forEach(o=>this.setSpriteProperties(o.sprite,o.tileData.zoomLevel,o.tileData.tilePos,o.mirrored))}},{key:"superSVG",value:function(){return Ir(t,"exportSVG",this,3)([])}},{key:"exportSVG",value:function(){let r=null,i=null;Ir(t,"exportSVG",this,1)?[i,r]=Ir(t,"exportSVG",this,3)([]):(i=document.createElement("g"),r=i);const o=document.createElement("g");r.appendChild(o),o.setAttribute("transform",`translate(${this.pMain.position.x},${this.pMain.position.y}) scale(${this.pMain.scale.x},${this.pMain.scale.y})`);for(const s of this.visibleAndFetchedTiles()){const c=s.sprite.rotation*180/Math.PI,l=document.createElement("g");l.setAttribute("transform",`translate(${s.sprite.x},${s.sprite.y}) rotate(${c}) scale(${s.sprite.scale.x},${s.sprite.scale.y})`);const u=document.createElement("image");u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s.canvas.toDataURL()),u.setAttribute("width",s.canvas.width),u.setAttribute("height",s.canvas.height),u.setAttribute("style","image-rendering: pixelated"),l.appendChild(u),o.appendChild(l)}const a=this.exportColorBarSVG();return r.appendChild(a),[i,i]}},{key:"getVisiblePartOfUppLeftTile",value:function(){const r=this.visibleAndFetchedTiles().map(p=>{const d=p.mirrored?[p.tileData.tilePos[1],p.tileData.tilePos[0]]:p.tileData.tilePos;return[d[0],d[1],p.tileId]});if(r.length===0)return null;let i=r[0];for(let p=0;p<r.length;p++){const d=r[p];(d[0]<i[0]||d[1]<i[1])&&(i=d)}const o=Math.min(p0,this.binsPerTile()),a=this.binsPerTile()/o,s=this.visibleAndFetchedTiles().filter(p=>p.tileId===i[2])[0],c=this.getIndicesOfVisibleDataInTile(s),l=c[0],u=c[1],f=l-l%a,h=u-u%a;return[s.tileId,f,h]}},{key:"getIndicesOfVisibleDataInTile",value:function(r){const i=this._xScale.range(),o=this._yScale.range(),a=r.mirrored?[r.tileData.tilePos[1],r.tileData.tilePos[0]]:r.tileData.tilePos,{tileX:s,tileY:c,tileWidth:l,tileHeight:u}=this.getTilePosAndDimensions(r.tileData.zoomLevel,a,this.binsPerTile()),f=Et().domain([0,this.binsPerTile()]).range([s,s+l]),h=Math.max(0,Math.round(f.invert(this._xScale.invert(i[0])))-1),p=Math.min(this.binsPerTile(),Math.round(f.invert(this._xScale.invert(i[1])))),d=Et().domain([0,this.binsPerTile()]).range([c,c+u]),g=Math.max(0,Math.round(d.invert(this._yScale.invert(o[0])))-1),y=Math.min(this.binsPerTile(),Math.round(d.invert(this._yScale.invert(o[1]))));return r.mirrored&&a[0]!==a[1]?[g,h,y,p]:[h,g,p,y]}},{key:"minVisibleValue",value:function(r=!1){const i=this.visibleAndFetchedTiles().map(a=>{if(a.tileData.denseDataExtrema===void 0)return null;const s=this.getIndicesOfVisibleDataInTile(a);return a.tileData.denseDataExtrema.getMinNonZeroInSubset(s)});if(i.length===0&&this.valueScaleMax===null)return null;const o=Math.min.apply(null,i);return o===Number.MAX_SAFE_INTEGER?Ir(t,"minVisibleValue",this,3)([r]):r?o:this.valueScaleMin!==null?this.valueScaleMin:o}},{key:"maxVisibleValue",value:function(r=!1){const i=this.visibleAndFetchedTiles().map(a=>{if(a.tileData.denseDataExtrema===void 0)return null;const s=this.getIndicesOfVisibleDataInTile(a);return a.tileData.denseDataExtrema.getMaxNonZeroInSubset(s)});if(i.length===0&&this.valueScaleMax===null)return null;const o=Math.max.apply(null,i);return o===Number.MIN_SAFE_INTEGER?Ir(t,"maxVisibleValue",this,3)([r]):r?o:this.valueScaleMax!==null?this.valueScaleMax:o}},{key:"zoomed",value:function(r,i,o,a,s){if(this.brushing)return;Ir(t,"zoomed",this,3)([r,i]),this.pMain.position.x=a,this.pMain.position.y=s,this.pMain.scale.x=o,this.pMain.scale.y=o;const c=this.isValueScaleLocked();if(this.continuousScaling&&this.minValue()!==void 0&&this.maxValue()!==void 0){const l=JSON.stringify(this.getVisiblePartOfUppLeftTile());if(this.valueScaleMin===null&&this.valueScaleMax===null&&!c&&l!==this.prevIndUpperLeftTile){const u=this.minVisibleValue(),f=this.maxVisibleValue(),h=1e-6;u!==null&&f!==null&&(Math.abs(this.minValue()-u)>h||Math.abs(this.maxValue()-f)>h)&&(this.minValue(u),this.maxValue(f),this.scheduleRerender()),this.prevIndUpperLeftTile=l}c&&this.onValueScaleChanged()}this.mouseMoveZoomHandler()}},{key:"addTileId",value:function(r,i,o,a,s,c=!1){const l=[i,o,a];l.mirrored=c,l.dataTransform=s,r.push(l)}},{key:"tilesToId",value:function(r,i,o){const a=r,s=i,c=this.options?.dataTransform||"default",l=[];for(let u=0;u<a.length;u++)for(let f=0;f<s.length;f++)this.mirrorTiles()?(a[u]>=s[f]?this.options.extent!=="lower-left"&&this.addTileId(l,o,s[f],a[u],c,!0):this.options.extent!=="upper-right"&&this.addTileId(l,o,a[u],s[f],c),a[u]===s[f]&&this.options.extent==="lower-left"&&this.addTileId(l,o,a[u],s[f],c)):this.addTileId(l,o,a[u],s[f],c);return l}},{key:"calculateVisibleTiles",value:function(){if(this.tilesetInfo){if(this.zoomLevel=this.calculateZoomLevel(),this.tilesetInfo.resolutions){const r=this.tilesetInfo.resolutions.map(i=>+i).sort((i,o)=>o-i);this.xTiles=Pd(r[this.zoomLevel],this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0]),this.yTiles=Pd(r[this.zoomLevel],this._yScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0])}else this.xTiles=Od(this.zoomLevel,this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.max_zoom,this.tilesetInfo.max_width),this.yTiles=Od(this.zoomLevel,this._yScale,this.options.reverseYAxis?-this.tilesetInfo.max_pos[1]:this.tilesetInfo.min_pos[1],this.options.reverseYAxis?-this.tilesetInfo.min_pos[1]:this.tilesetInfo.max_pos[1],this.tilesetInfo.max_zoom,this.tilesetInfo.max_width1||this.tilesetInfo.max_width);this.setVisibleTiles(this.tilesToId(this.xTiles,this.yTiles,this.zoomLevel))}}},{key:"mirrorTiles",value:function(){return!(this.tilesetInfo.mirror_tiles&&(this.tilesetInfo.mirror_tiles===!1||this.tilesetInfo.mirror_tiles==="false"))}},{key:"contextMenuItems",value:function(r,i){return[]}},{key:"getMouseOverHtml",value:function(r,i){if(!this.options||!this.options.showTooltip||!this.tilesetInfo)return"";const o=z7(this.tilesetInfo,this.zoomLevel),a=Math.max(this.tilesetInfo.max_pos[1]-this.tilesetInfo.min_pos[1],this.tilesetInfo.max_pos[0]-this.tilesetInfo.min_pos[0]),s=Math.ceil(Math.log(a/o)/Math.log(10));this.setDataLensSize(1);const c=this._xScale.invert(r),l=this._yScale.invert(i);let u="<b>Position:</b> ";if(this.chromInfo){const h=dr(c,this.chromInfo),p=dr(l,this.chromInfo),d=g=>Fr(`.${s}s`)(g);u+=`${h[0]}:${d(h[1])} & ${p[0]}:${d(p[1])}`,u+="<br/>"}let f=null;try{f=this.getVisibleRectangleData(r,i,1,1).get(0,0)}catch{return""}return this.options&&this.options.heatmapValueScaling==="log"?f>0?`${u}<b>Value:</b> 1e${Fr(".3f")(Math.log(f)/Math.log(10))}`:f===0?`${u}<b>Value:</b> 0`:`${u}<b>Value:</b> N/A`:`${u}<b>Value:</b> ${Fr(".3f")(f)}`}},{key:"getTilePosAndDimensions",value:function(r,i,o){const a=o||this.binsPerTile();if(this.tilesetInfo.resolutions){const y=this.tilesetInfo.resolutions.map(T=>+T).sort((T,w)=>w-T)[r],b=y*a,m=b,v=y*a*i[0],_=y*a*i[1];return{tileX:v,tileY:_,tileWidth:b,tileHeight:m}}const s=i[0],c=i[1],l=this.tilesetInfo.min_pos[0],u=this.options.reverseYAxis?-this.tilesetInfo.max_pos[1]:this.tilesetInfo.min_pos[1],f=this.tilesetInfo.max_width/2**r,h=this.tilesetInfo.max_width/2**r,p=l+s*f,d=u+c*h;return{tileX:p,tileY:d,tileWidth:f,tileHeight:h}}},{key:"calculateZoomLevel",value:function(){this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.min_pos[1],this.tilesetInfo.max_pos[1];let r=null;if(this.tilesetInfo.resolutions){const i=GT(this.tilesetInfo.resolutions,this._xScale),o=GT(this.tilesetInfo.resolutions,this._yScale);r=Math.min(i,o)}else{const i=WT(this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.binsPerTile()),o=WT(this._xScale,this.tilesetInfo.min_pos[1],this.tilesetInfo.max_pos[1],this.binsPerTile());r=Math.max(i,o),r=Math.min(r,this.maxZoom)}return this.options?.maxZoom&&(this.options.maxZoom>=0?r=Math.min(this.options.maxZoom,r):console.error("Invalid maxZoom on track:",this)),r}},{key:"tileToLocalId",value:function(r){return r.dataTransform&&r.dataTransform!=="default"?`${r.join(".")}.${r.mirrored}.${r.dataTransform}`:`${r.join(".")}.${r.mirrored}`}},{key:"tileToRemoteId",value:function(r){return r.dataTransform&&r.dataTransform!=="default"?`${r.join(".")}.${r.dataTransform}`:`${r.join(".")}`}},{key:"localToRemoteId",value:function(r){const i=r.split(".");return i.slice(0,i.length-1).join(".")}}])}(Si);function Zve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,e0e(r.key),r)}}function Jve(e,t,n){return t&&Qve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function e0e(e){var t=t0e(e,"string");return typeof t=="symbol"?t:t+""}function t0e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function r0e(e,t,n){return t=ag(t),n0e(e,h$()?Reflect.construct(t,n||[],ag(e).constructor):t.apply(e,n))}function n0e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return i0e(e)}function i0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(h$=function(){return!!e})()}function ag(e){return ag=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ag(e)}function o0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&KE(e,t)}function KE(e,t){return KE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},KE(e,t)}function p$(e){if(!e.graphics)return;const t=e.graphics,{tileX:n,tileY:r,tileWidth:i}=this.getTilePosAndDimensions(e.tileData.zoomLevel,e.tileData.tilePos);e.drawnAtScale=this._xScale.copy();const o=1/((this._xScale(1)-this._xScale(0))/(this._refXScale(1)-this._refXScale(0))),a=1/((this._yScale(1)-this._yScale(0))/(this._refYScale(1)-this._refYScale(0)));e.text.scale.x=o,e.text.scale.y=a;const s=this._xScale(i)-this._xScale(0);if(e.textGraphics.scale.x=s/256,e.textGraphics.scale.y=s/256,t.clear(),t.lineStyle(4*o,255,1),t.beginFill(16740363,.4),t.alpha=.5,e.mirrored){const c=this._refXScale(r+i)-this._refXScale(r),l=this._refYScale(n+i)-this._refYScale(n);e.textGraphics.position.x=this._refXScale(r)+c/2,e.textGraphics.position.y=this._refYScale(n)+l/2,t.drawRect(this._refXScale(r),this._refYScale(n),c,l)}else{const c=this._refXScale(n+i)-this._refXScale(n),l=this._refYScale(r+i)-this._refYScale(r);e.textGraphics.position.x=this._refXScale(n)+c/2,e.textGraphics.position.y=this._refYScale(r)+l/2,t.drawRect(this._refXScale(n),this._refYScale(r),c,l)}}function d$(e){const t=e.graphics;e.textGraphics=new Ye.PIXI.Graphics,e.mirrored?e.text=new Ye.PIXI.Text(`${e.tileData.zoomLevel}/${[e.tileData.tilePos[1],e.tileData.tilePos[0]].join("/")}`,{fontFamily:"Arial",fontSize:24,fill:16715792,align:"center"}):e.text=new Ye.PIXI.Text(`${e.tileData.zoomLevel}/${e.tileData.tilePos.join("/")}`,{fontFamily:"Arial",fontSize:24,fill:16715792,align:"center"}),e.textGraphics.addChild(e.text),e.text.anchor.x=.5,e.text.anchor.y=.5,t.addChild(e.textGraphics)}let g$=function(e){function t(){return Zve(this,t),r0e(this,t,arguments)}return o0e(t,e),Jve(t,[{key:"areAllVisibleTilesLoaded",value:function(){return!0}},{key:"initTile",value:function(r){d$.bind(this)(r),this.drawTile(r)}},{key:"destroyTile",value:function(r,i){}},{key:"drawTile",value:function(r){p$.bind(this)(r)}},{key:"fetchNewTiles",value:function(r){r.forEach(i=>{const a=i.remoteId.split("."),s={zoomLevel:a[0],tilePos:a.slice(1,a.length).map(c=>+c)};this.fetchedTiles[i.tileId]=i,this.fetchedTiles[i.tileId].tileData=s,this.fetching.has(i.remoteId)&&this.fetching.delete(i.remoteId)}),this.synchronizeTilesAndGraphics()}}])}(Ql);function a0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s0e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c0e(r.key),r)}}function l0e(e,t,n){return t&&s0e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function c0e(e){var t=u0e(e,"string");return typeof t=="symbol"?t:t+""}function u0e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function f0e(e,t,n){return t=Jl(t),h0e(e,m$()?Reflect.construct(t,n||[],Jl(e).constructor):t.apply(e,n))}function h0e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return p0e(e)}function p0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(m$=function(){return!!e})()}function d0e(e,t,n,r){var i=ZE(Jl(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function ZE(){return ZE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=g0e(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},ZE.apply(null,arguments)}function g0e(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Jl(e))!==null;);return e}function Jl(e){return Jl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Jl(e)}function m0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&QE(e,t)}function QE(e,t){return QE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},QE(e,t)}let v$=function(e){function t(n,r){var i;return a0e(this,t),i=f0e(this,t,[n,r]),i.pMain=i.pMobile,i}return m0e(t,e),l0e(t,[{key:"areAllVisibleTilesLoaded",value:function(){return!0}},{key:"initTile",value:function(r){const i=r.graphics;r.textGraphics=new Ye.PIXI.Graphics,r.text=new Ye.PIXI.Text(`${r.tileData.zoomLevel}/${r.tileData.tilePos.join("/")}`,{fontFamily:"Arial",fontSize:32,fill:16715792,align:"center"}),r.textGraphics.addChild(r.text),r.text.anchor.x=.5,r.text.anchor.y=.5,i.addChild(r.textGraphics),this.drawTile(r)}},{key:"destroyTile",value:function(r){}},{key:"drawTile",value:function(r){if(d0e(t,"drawTile",this)([r]),!r.graphics)return;const i=r.graphics,{tileX:o,tileWidth:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos),s=1/((this._xScale(1)-this._xScale(0))/(this._refXScale(1)-this._refXScale(0)));r.text.scale.x=s,i.clear();const c=this.dimensions[1],l=this._refXScale(o+a)-this._refXScale(o);r.textGraphics.position.x=this._refXScale(o)+l/2,r.textGraphics.position.y=c/2;const u=this._refXScale(o);i.lineStyle(4*s,255,1),i.beginFill(16740363,.4),i.alpha=.5,i.moveTo(u,0),i.lineTo(u,c),i.moveTo(u+l,0),i.lineTo(u+l,c),i.lineStyle(0,255,1),i.drawRect(u,0,l,c)}}])}(Yl);function v0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y0e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_0e(r.key),r)}}function b0e(e,t,n){return t&&y0e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _0e(e){var t=T0e(e,"string");return typeof t=="symbol"?t:t+""}function T0e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function w0e(e,t,n){return t=ec(t),S0e(e,y$()?Reflect.construct(t,n||[],ec(e).constructor):t.apply(e,n))}function S0e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return E0e(e)}function E0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(y$=function(){return!!e})()}function k0e(e,t,n,r){var i=JE(ec(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function JE(){return JE=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=x0e(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},JE.apply(null,arguments)}function x0e(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=ec(e))!==null;);return e}function ec(e){return ec=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ec(e)}function C0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&e5(e,t)}function e5(e,t){return e5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},e5(e,t)}let b$=function(e){function t(){return v0e(this,t),w0e(this,t,arguments)}return C0e(t,e),b0e(t,[{key:"calculateZoomLevel",value:function(){const r=wt.calculateZoomLevel(this._yScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0]);return Math.min(r,this.maxZoom)}},{key:"relevantScale",value:function(){return this._yScale}},{key:"zoomed",value:function(r,i){k0e(t,"zoomed",this)([r,i]);const o=1,a=(i(1)-i(0))/(this._refYScale(1)-this._refYScale(0)),s=this.position[0],c=i(0)+this.position[1]-this._refYScale(1)*a;this.pMain.position.x=s,this.pMain.position.y=c,this.pMain.scale.x=o,this.pMain.scale.y=a}}])}(zE);function O0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P0e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,M0e(r.key),r)}}function A0e(e,t,n){return t&&P0e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function M0e(e){var t=I0e(e,"string");return typeof t=="symbol"?t:t+""}function I0e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function R0e(e,t,n){return t=tc(t),D0e(e,_$()?Reflect.construct(t,n||[],tc(e).constructor):t.apply(e,n))}function D0e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return N0e(e)}function N0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_$=function(){return!!e})()}function L0e(e,t,n,r){var i=t5(tc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function t5(){return t5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=$0e(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},t5.apply(null,arguments)}function $0e(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=tc(e))!==null;);return e}function tc(e){return tc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tc(e)}function j0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r5(e,t)}function r5(e,t){return r5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},r5(e,t)}let T$=function(e){function t(){return O0e(this,t),R0e(this,t,arguments)}return j0e(t,e),A0e(t,[{key:"areAllVisibleTilesLoaded",value:function(){return!0}},{key:"initTile",value:function(r){const i=r.graphics;r.textGraphics=new Ye.PIXI.Graphics,r.text=new Ye.PIXI.Text(`${r.tileData.zoomLevel}/${r.tileData.tilePos.join("/")}`,{fontFamily:"Arial",fontSize:32,fill:16715792,align:"center"}),r.textGraphics.addChild(r.text),r.text.anchor.x=.5,r.text.anchor.y=.5,r.text.rotation=-Math.PI/2,i.addChild(r.textGraphics),this.drawTile(r,i)}},{key:"destroyTile",value:function(r,i){}},{key:"drawTile",value:function(r){if(L0e(t,"drawTile",this)([r]),!r.graphics)return;const i=r.graphics,{tileY:o,tileHeight:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos),s=1/((this._yScale(1)-this._yScale(0))/(this._refYScale(1)-this._refYScale(0)));r.text.scale.x=s,i.clear(),i.lineStyle(4*s,255,1),i.beginFill(16740363,.4),i.alpha=.5;const c=this.dimensions[0],l=this._refYScale(o+a)-this._refYScale(o);r.textGraphics.position.x=c/2,r.textGraphics.position.y=this._refYScale(o)+l/2,i.drawRect(0,this._refYScale(o),c,l)}},{key:"fetchNewTiles",value:function(r){r.forEach(i=>{const a=i.remoteId.split("."),s={zoomLevel:a[1],tilePos:a.slice(2,a.length).map(c=>+c)};this.fetchedTiles[i.tileId]=i,this.fetchedTiles[i.tileId].tileData=s,this.fetching.has(i.remoteId)&&this.fetching.delete(i.remoteId)}),this.synchronizeTilesAndGraphics()}}])}(b$);var n5=Array.prototype.slice;function B0e(e){return e}var sg=1,lg=2,i5=3,Qf=4,w$=1e-6;function z0e(e){return"translate("+e+",0)"}function H0e(e){return"translate(0,"+e+")"}function F0e(e){return t=>+e(t)}function q0e(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function U0e(){return!this.__axis}function cg(e,t){var n=[],r=null,i=null,o=6,a=6,s=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===sg||e===Qf?-1:1,u=e===Qf||e===lg?"x":"y",f=e===sg||e===i5?z0e:H0e;function h(p){var d=r??(t.ticks?t.ticks.apply(t,n):t.domain()),g=i??(t.tickFormat?t.tickFormat.apply(t,n):B0e),y=Math.max(o,0)+s,b=t.range(),m=+b[0]+c,v=+b[b.length-1]+c,_=(t.bandwidth?q0e:F0e)(t.copy(),c),T=p.selection?p.selection():p,w=T.selectAll(".domain").data([null]),S=T.selectAll(".tick").data(d,t).order(),k=S.exit(),E=S.enter().append("g").attr("class","tick"),P=S.select("line"),C=S.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge(E),P=P.merge(E.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),C=C.merge(E.append("text").attr("fill","currentColor").attr(u,l*y).attr("dy",e===sg?"0em":e===i5?"0.71em":"0.32em")),p!==T&&(w=w.transition(p),S=S.transition(p),P=P.transition(p),C=C.transition(p),k=k.transition(p).attr("opacity",w$).attr("transform",function(I){return isFinite(I=_(I))?f(I+c):this.getAttribute("transform")}),E.attr("opacity",w$).attr("transform",function(I){var O=this.parentNode.__axis;return f((O&&isFinite(O=O(I))?O:_(I))+c)})),k.remove(),w.attr("d",e===Qf||e===lg?a?"M"+l*a+","+m+"H"+c+"V"+v+"H"+l*a:"M"+c+","+m+"V"+v:a?"M"+m+","+l*a+"V"+c+"H"+v+"V"+l*a:"M"+m+","+c+"H"+v),S.attr("opacity",1).attr("transform",function(I){return f(_(I)+c)}),P.attr(u+"2",l*o),C.attr(u,l*y).text(g),T.filter(U0e).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===lg?"start":e===Qf?"end":"middle"),T.each(function(){this.__axis=_})}return h.scale=function(p){return arguments.length?(t=p,h):t},h.ticks=function(){return n=n5.call(arguments),h},h.tickArguments=function(p){return arguments.length?(n=p==null?[]:n5.call(p),h):n.slice()},h.tickValues=function(p){return arguments.length?(r=p==null?null:n5.call(p),h):r&&r.slice()},h.tickFormat=function(p){return arguments.length?(i=p,h):i},h.tickSize=function(p){return arguments.length?(o=a=+p,h):o},h.tickSizeInner=function(p){return arguments.length?(o=+p,h):o},h.tickSizeOuter=function(p){return arguments.length?(a=+p,h):a},h.tickPadding=function(p){return arguments.length?(s=+p,h):s},h.offset=function(p){return arguments.length?(c=+p,h):c},h}function S$(e){return cg(sg,e)}function V0e(e){return cg(lg,e)}function G0e(e){return cg(i5,e)}function E$(e){return cg(Qf,e)}const W0e=Object.freeze(Object.defineProperty({__proto__:null,axisBottom:G0e,axisLeft:E$,axisRight:V0e,axisTop:S$},Symbol.toStringTag,{value:"Module"}));function Y0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X0e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Z0e(r.key),r)}}function K0e(e,t,n){return t&&X0e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Z0e(e){var t=Q0e(e,"string");return typeof t=="symbol"?t:t+""}function Q0e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function J0e(e,t,n){return t=ug(t),eye(e,k$()?Reflect.construct(t,n||[],ug(e).constructor):t.apply(e,n))}function eye(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return tye(e)}function tye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(k$=function(){return!!e})()}function ug(e){return ug=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ug(e)}function rye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o5(e,t)}function o5(e,t){return o5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},o5(e,t)}let ko=function(e){function t(n,r){var i;Y0e(this,t),i=J0e(this,t,[n,r]);const{svgElement:o}=n;return i.gMain=_t(o).append("g"),i.clipUid=Mt.nice(),i.clipRect=i.gMain.append("clipPath").attr("id",`track-bounds-${i.clipUid}`).append("rect"),i.gMain.attr("clip-path",`url(#track-bounds-${i.clipUid})`),i}return rye(t,e),K0e(t,[{key:"setPosition",value:function(r){this.position=r,this.gMain.attr("transform",`translate(${this.position[0]},${this.position[1]})`),this.draw()}},{key:"setDimensions",value:function(r){this.dimensions=r,this._xScale.range([0,this.dimensions[0]]),this._yScale.range([0,this.dimensions[1]]),r[0]>=0&&r[1]>=0?(this.clipRect.attr("width",r[0]),this.clipRect.attr("height",r[1])):(this.clipRect.attr("width",0),this.clipRect.attr("height",0)),this.draw()}},{key:"remove",value:function(){this.gMain.remove(),this.gMain=null}},{key:"draw",value:function(){return this}}])}(Ja);function nye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,aye(r.key),r)}}function oye(e,t,n){return t&&iye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function aye(e){var t=sye(e,"string");return typeof t=="symbol"?t:t+""}function sye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function lye(e,t,n){return t=rc(t),cye(e,x$()?Reflect.construct(t,n||[],rc(e).constructor):t.apply(e,n))}function cye(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uye(e)}function uye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(x$=function(){return!!e})()}function C$(e,t,n,r){var i=a5(rc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function a5(){return a5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=fye(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},a5.apply(null,arguments)}function fye(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=rc(e))!==null;);return e}function rc(e){return rc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rc(e)}function hye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s5(e,t)}function s5(e,t){return s5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},s5(e,t)}let O$=function(e){function t(n,r){var i;return nye(this,t),i=lye(this,t,[n,r]),i.axis=E$(i._yScale),i.gAxis=i.gMain.append("g"),i.tilesetInfo=!0,i}return hye(t,e),oye(t,[{key:"setDimensions",value:function(r){C$(t,"setDimensions",this)([r]),this.axis.ticks(Math.ceil(this.dimensions[1]/150)),this.gAxis.attr("transform",`translate(${r[0]},0)`)}},{key:"draw",value:function(){if(this.axis.scale(this._yScale),this.options.reverseAxis==="yes"||this.options.reverseAxis===!0){const r=Fr(",");this.axis.tickFormat(i=>r(-i))}else this.axis.tickFormat(null);return this.gAxis.call(this.axis),this}},{key:"zoomed",value:function(r,i){C$(t,"zoomed",this)([r,i]),this.draw()}}])}(ko);function pye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mye(r.key),r)}}function gye(e,t,n){return t&&dye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mye(e){var t=vye(e,"string");return typeof t=="symbol"?t:t+""}function vye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function yye(e,t,n){return t=nc(t),bye(e,P$()?Reflect.construct(t,n||[],nc(e).constructor):t.apply(e,n))}function bye(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _ye(e)}function _ye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function P$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(P$=function(){return!!e})()}function Jf(e,t,n,r){var i=l5(nc(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function l5(){return l5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Tye(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},l5.apply(null,arguments)}function Tye(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=nc(e))!==null;);return e}function nc(e){return nc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nc(e)}function wye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c5(e,t)}function c5(e,t){return c5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},c5(e,t)}const Sye=(e,t,n,r,i)=>{i.drawRect(e,t,n,r)},Eye=(e,t,n,r,i,{fill:o=0,fillOpacity:a=0,stroke:s=0,strokeWidth:c=0,strokeOpacity:l=0}={})=>{const u=document.createElement("rect");u.setAttribute("x",e),u.setAttribute("y",t),u.setAttribute("width",n),u.setAttribute("height",r),u.setAttribute("fill",`#${l0(o)}`),u.setAttribute("fill-opacity",a),u.setAttribute("stroke",`#${l0(s)}`),u.setAttribute("stroke-opacity",l),u.setAttribute("stroke-width",c),i.appendChild(u)},Fi=(e,t,n,r,i,o)=>{i instanceof HTMLElement?Eye(e,t,n,r,i,o):Sye(e,t,n,r,i)},A$=(e,t,n,r,i,o,a,s,{isVertical:c=!1,svg:l=null}={})=>{let u=t,f=n,h=r,p=i;const d=s.width*2>r?r/2:s.width,g=s.width*2>i?i/2:s.width,y=l||e,b={fill:0,fillOpacity:0,stroke:0,strokeOpacity:0,strokeWidth:1};if(s.positions?.length?(e.lineStyle(1,0,0),e.beginFill(s.color,s.opacity),b.fill=s.color,b.fillOpacity=s.opacity,b.stroke=0,b.strokeOpacity=0,b.strokeWidth=1,s.positions.forEach(m=>{m==="top"&&!c||m==="left"&&c?Fi(t-d,n-g,r+d*2,g,y,b):m==="bottom"&&!c||m==="right"&&c?Fi(t-d,n+i,r+d*2,g,y,b):m==="left"&&!c||m==="top"&&c?Fi(t-d,n-g,d,i+g*2,y,b):(m==="right"&&!c||m==="bottom"&&c)&&Fi(t+r,n-g,d,i+g*2,y,b)})):s.width>0&&s.opacity>0&&(e.lineStyle(s.width,s.color,s.opacity),e.beginFill(0,0),b.fill=0,b.fillOpacity=0,b.stroke=s.color,b.strokeOpacity=s.opacity,b.strokeWidth=s.width,Fi(t-d,n-g,r+d*2,i+g*2,y,b)),a.positions?.length){e.lineStyle(1,0,0),e.beginFill(a.color,a.opacity);const m=a.width*2>r?r/2:a.width,v=a.width*2>i?i/2:a.width;b.fill=a.color,b.fillOpacity=a.opacity,b.stroke=0,b.strokeOpacity=0,b.strokeWidth=1,a.positions.forEach(_=>{_==="top"&&!c||_==="left"&&c?(Fi(t,n,r,v,y,b),f+=v,p-=v):_==="bottom"&&!c||_==="right"&&c?(Fi(t,n+i-v,r,v,y,b),p-=v):_==="left"&&!c||_==="top"&&c?(Fi(t,n,m,i,y,b),u+=m,h-=m):(_==="right"&&!c||_==="bottom"&&c)&&(Fi(t+r-m,n,m,i,y,b),h-=m)})}else e.lineStyle(a.width,a.color,a.opacity),b.stroke=a.color,b.strokeOpacity=a.opacity,b.strokeWidth=a.width;e.beginFill(o.color,o.opacity),b.fill=o.color,b.fillOpacity=o.opacity,Fi(u,f,h,p,y,b)};let M$=function(e){function t(n,r){var i;return pye(this,t),i=yye(this,t,[n,r]),i.options=r||{},i.drawnRects={},i}return wye(t,e),gye(t,[{key:"drawHorizontalOverlay",value:function(r,i,o,a=0,s,c,l,u){if(!o||o.length<2)return;let f=this.position[0]+i.left+this._xScale(o[0]);const h=this.position[1]+i.top,p=i.height;let d=this._xScale(o[1])-this._xScale(o[0]);d<a&&(f-=(a-d)/2,d=a),A$(r,f,h,d,p,s,c,l,u)}},{key:"drawVerticalOverlay",value:function(r,i,o,a=0,s,c,l,u={}){if(!o||o.length<2)return;const f=this.position[0]+i.left;let h=this.position[1]+i.top+this._yScale(o.length>=4?o[2]:o[0]);const p=this.position[1]+i.top,d=this.position[1]+i.top+i.height;if(h>d)return;h<p&&(h=p);const g=i.width;let y=this._yScale(o.length>=4?o[3]:o[1])-h+i.top+this.position[1];y<0||(h+y>d&&(y+=d-(h+y)),y<a&&(h-=(a-y)/2,y=a),u.isVertical=!0,A$(r,f,h,g,y,s,c,l,u))}},{key:"draw",value:function(r){Jf(t,"draw",this,3)([]);const i=this.pMain,o={color:gt(this.options.fill||this.options.fillColor||"blue"),opacity:Number.isNaN(+this.options.fillOpacity)?.3:+this.options.fillOpacity},a={color:gt(this.options.stroke||"blue"),opacity:+this.options.strokeOpacity||1,width:+this.options.strokeWidth||0,positions:!this.options.strokePos||Array.isArray(this.options.strokePos)?this.options.strokePos:[this.options.strokePos]},s={color:gt(this.options.outline||"white"),opacity:+this.options.outlineOpacity||1,width:+this.options.outlineWidth||0,positions:!this.options.outlinePos||Array.isArray(this.options.outlinePos)?this.options.outlinePos:[this.options.outlinePos]};(!r||!r.svg)&&i.clear(),i.lineStyle(a.width,a,+!a.positions*a.opacity),i.beginFill(o.color,o.opacity);const c=Math.max(0,+this.options.minWidth||0),l=Math.max(0,+this.options.minHeight||0);Array.isArray(this.options.extent)&&this.options.orientationsAndPositions.forEach(u=>{(u.orientation==="1d-horizontal"||u.orientation==="2d")&&this.options.extent.forEach(f=>this.drawHorizontalOverlay(i,u.position,f,c,o,a,s,r)),(u.orientation==="1d-vertical"||u.orientation==="2d")&&this.options.extent.forEach(f=>this.drawVerticalOverlay(i,u.position,f,l,o,a,s,r))})}},{key:"zoomed",value:function(r,i){this.xScale(r),this.yScale(i),this.draw()}},{key:"setPosition",value:function(r){Jf(t,"setPosition",this,3)([r]),this.draw()}},{key:"setDimensions",value:function(r){Jf(t,"setDimensions",this,3)([r]),this.draw()}},{key:"exportSVG",value:function(){let r=null,i=null;Jf(t,"exportSVG",this,1)?[i,r]=Jf(t,"exportSVG",this,3)([]):(i=document.createElement("g"),r=i);const o=document.createElement("g");return r.appendChild(o),this.draw({svg:o}),[i,r]}}])}(Bn);function kye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Oye(r.key),r)}}function Cye(e,t,n){return t&&xye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Oye(e){var t=Pye(e,"string");return typeof t=="symbol"?t:t+""}function Pye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Aye(e,t,n){return t=ic(t),Mye(e,I$()?Reflect.construct(t,n||[],ic(e).constructor):t.apply(e,n))}function Mye(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Iye(e)}function Iye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function I$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(I$=function(){return!!e})()}function R$(e,t,n,r){var i=u5(ic(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function u5(){return u5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Rye(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},u5.apply(null,arguments)}function Rye(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=ic(e))!==null;);return e}function ic(e){return ic=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ic(e)}function Dye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f5(e,t)}function f5(e,t){return f5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},f5(e,t)}let D$=function(e){function t(n,r){var i;return kye(this,t),i=Aye(this,t,[n,r]),i.axis=S$(i._xScale),i.gAxis=i.gMain.append("g"),i.tilesetInfo=!0,i}return Dye(t,e),Cye(t,[{key:"setDimensions",value:function(r){R$(t,"setDimensions",this)([r]),this.axis.ticks(Math.ceil(this.dimensions[0]/150)),this.gAxis.attr("transform",`translate(0,${r[1]})`)}},{key:"draw",value:function(){return this.axis.scale(this._xScale),this.gAxis.call(this.axis),this}},{key:"zoomed",value:function(r,i){R$(t,"zoomed",this)([r,i]),this.draw()}}])}(ko);function Nye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,jye(r.key),r)}}function $ye(e,t,n){return t&&Lye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function jye(e){var t=Bye(e,"string");return typeof t=="symbol"?t:t+""}function Bye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function zye(e,t,n){return t=oc(t),Hye(e,N$()?Reflect.construct(t,n||[],oc(e).constructor):t.apply(e,n))}function Hye(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fye(e)}function Fye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(N$=function(){return!!e})()}function ia(e,t,n,r){var i=h5(oc(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function h5(){return h5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=qye(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},h5.apply(null,arguments)}function qye(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=oc(e))!==null;);return e}function oc(e){return oc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},oc(e)}function Uye(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p5(e,t)}function p5(e,t){return p5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},p5(e,t)}let ac=function(e){function t(){return Nye(this,t),zye(this,t,arguments)}return Uye(t,e),$ye(t,[{key:"stopHover",value:function(){this.pMouseOver.clear(),this.animate()}},{key:"getMouseOverHtml",value:function(r){if(!this.tilesetInfo||!this.options.showTooltip||!this.valueScale)return"";const i=this.getDataAtPos(r);let o="";i&&(o=Fr(".3f")(i));const a=this.pMouseOver,s=0,c=this.valueScale(i);a.clear(),a.beginFill(s,.5),a.lineStyle(1,s,1);const l=4;return a.drawRect(r-l/2,c-l/2,l,l),this.animate(),`${o}`}},{key:"initTile",value:function(r){if(ia(t,"initTile",this,3)([r]),!r.tileData||!r.tileData.dense){console.warn("emptyTile:",r);return}if(r.xValues=new Array(r.tileData.dense.length),r.yValues=new Array(r.tileData.dense.length),this.isValueScaleLocked()){const i=this.getLockGroupExtrema();i!==null&&(this.minValue(i[0]),this.maxValue(i[1]))}this.drawTile(r)}},{key:"rerender",value:function(r,i){ia(t,"rerender",this,3)([r,i]),this.options=r,ia(t,"draw",this,3)([]),this.visibleAndFetchedTiles().forEach(o=>{this.renderTile(o)})}},{key:"renderTile",value:function(r){this.drawTile(r),this.valueScale&&this.drawAxis(this.valueScale)}},{key:"drawTile",value:function(r){if(ia(t,"drawTile",this,3)([r]),!r.graphics||!r.tileData||!r.tileData.dense)return;const i=r.graphics,{tileX:o,tileWidth:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos),s=r.tileData.dense;if(s.length===0)return;const[c,l]=this.makeValueScale(this.minValue(),this.medianVisibleValue,this.maxValue());if(this.valueScale=c,i.clear(),this.drawAxis(this.valueScale),this.options.valueScaling==="log"&&this.valueScale.domain()[1]<0){console.warn("Negative values present when using a log scale",this.valueScale.domain());return}const u=gt(this.options.lineStrokeColor?this.options.lineStrokeColor:"blue");!this.tilesetInfo.tile_size&&!this.tilesetInfo.bins_per_dimension&&console.warn("No tileset_info.tile_size or tileset_info.bins_per_dimension",this.tilesetInfo);const f=this.tilesetInfo.tile_size||this.tilesetInfo.bins_per_dimension,h=Et().domain([0,f]).range([o,o+a]),p=this.options.lineStrokeWidth?this.options.lineStrokeWidth:1;i.lineStyle(p,u,1),r.segments=[];let d=[];for(let g=0;g<s.length;g++){const y=this._xScale(h(g)),b=this.valueScale(s[g]+l);if(this.options.valueScaling==="log"&&s[g]===0||Number.isNaN(b)){d.length>1&&r.segments.push(d),d=[];continue}if(h(g)>this.tilesetInfo.max_pos[0])break;d.push([y,b])}d.length>1&&r.segments.push(d);for(const g of r.segments){const y=g[0],b=g.slice(1);i.moveTo(y[0],y[1]);for(const m of b)i.lineTo(m[0],m[1])}}},{key:"setPosition",value:function(r){ia(t,"setPosition",this,3)([r]),this.pMain.position.y=this.position[1],this.pMain.position.x=this.position[0],this.pMouseOver.position.y=this.position[1],this.pMouseOver.position.x=this.position[0]}},{key:"zoomed",value:function(r,i){this.xScale(r),this.yScale(i),this.refreshTiles(),this.draw();const o=this.isValueScaleLocked();if(this.continuousScaling&&this.minValue()!==void 0&&this.maxValue()!==void 0){if(this.valueScaleMin===null&&this.valueScaleMax===null&&!o){const a=this.minVisibleValue(),s=this.maxVisibleValue(),c=1e-6;a!==null&&s!==null&&(Math.abs(this.minValue()-a)>c||Math.abs(this.maxValue()-s)>c)&&(this.minValue(a),this.maxValue(s),this.scheduleRerender())}o&&this.onValueScaleChanged()}}},{key:"superSVG",value:function(){return ia(t,"exportSVG",this,3)([])}},{key:"exportSVG",value:function(){let r=null,i=null;ia(t,"exportSVG",this,1)?[i,r]=ia(t,"exportSVG",this,3)([]):(i=document.createElement("g"),r=i),i.setAttribute("class","exported-line-track");const o=document.createElement("g");r.appendChild(o),o.setAttribute("transform",`translate(${this.position[0]},${this.position[1]})`);const a=this.options.lineStrokeColor?this.options.lineStrokeColor:"blue";this.visibleAndFetchedTiles().forEach(c=>{const l=document.createElement("path");l.setAttribute("fill","transparent"),l.setAttribute("stroke",a);let u="";for(const f of c.segments){const h=f[0],p=f.slice(1);u+=`M${h[0]} ${h[1]}`;for(const d of p)u+=`L${d[0]} ${d[1]}`}l.setAttribute("d",u),o.appendChild(l)});const s=document.createElement("g");if(s.setAttribute("id","axis"),i.appendChild(s),s.setAttribute("transform",`translate(${this.axis.pAxis.position.x}, ${this.axis.pAxis.position.y})`),this.options.axisPositionHorizontal==="left"||this.options.axisPositionVertical==="top"){const c=this.axis.exportAxisLeftSVG(this.valueScale,this.dimensions[1]);s.appendChild(c)}else if(this.options.axisPositionHorizontal==="right"||this.options.axisPositionVertical==="bottom"){const c=this.axis.exportAxisRightSVG(this.valueScale,this.dimensions[1]);s.appendChild(c)}return[i,r]}},{key:"tileToLocalId",value:function(r){return this.options.aggregationMode&&this.options.aggregationMode!=="mean"?`${r.join(".")}.${this.options.aggregationMode}`:`${r.join(".")}`}},{key:"tileToRemoteId",value:function(r){return this.tileToLocalId(r)}}])}(Yl);function Vye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Yye(r.key),r)}}function Wye(e,t,n){return t&&Gye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yye(e){var t=Xye(e,"string");return typeof t=="symbol"?t:t+""}function Xye(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Kye(e,t,n){return t=lc(t),Zye(e,L$()?Reflect.construct(t,n||[],lc(e).constructor):t.apply(e,n))}function Zye(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Qye(e)}function Qye(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function L$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(L$=function(){return!!e})()}function sc(e,t,n,r){var i=d5(lc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function d5(){return d5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Jye(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},d5.apply(null,arguments)}function Jye(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=lc(e))!==null;);return e}function lc(e){return lc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lc(e)}function ebe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g5(e,t)}function g5(e,t){return g5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},g5(e,t)}const tbe=gt("#FFFFFF");let m5=function(e){function t(...n){var r;return Vye(this,t),r=Kye(this,t,[...n]),r.zeroLine=new Ye.PIXI.Graphics,r.pMain.addChild(r.zeroLine),r.valueScaleTransform=Ar,r.options?.colorRange&&(r.options.colorRangeGradient?r.setColorGradient(r.options.colorRange):r.setColorScale(r.options.colorRange)),r.initialized=!0,r}return ebe(t,e),Wye(t,[{key:"setColorScale",value:function(r){r&&(this.colorScale=jo(r),this.colorScale=this.colorScale.map(i=>i.map(o=>o/255)))}},{key:"setColorGradient",value:function(r){if(!r)return;const i=r.length-1;this.colorGradientColors=this.options.align==="bottom"?r.slice().reverse().map((o,a)=>({from:a/i,color:o})):r.map((o,a)=>({from:a/i,color:o}))}},{key:"initTile",value:function(r){this.initialized&&sc(t,"initTile",this)([r])}},{key:"updateTile",value:function(r){(!r.valueScale||!this.scale||this.scale.minValue!==r.scale.minValue||this.scale.maxValue!==r.scale.maxValue)&&this.renderTile(r)}},{key:"renderTile",value:function(r){this.initialized&&sc(t,"renderTile",this)([r])}},{key:"drawTile",value:function(r){if(!r.graphics||!r.tileData||!r.tileData.dense)return;const{graphics:i}=r,o=this.tilesetInfo.tile_size||this.tilesetInfo.bins_per_dimension||r.tileData.dense.length;r.svgData=void 0;const{tileX:a,tileWidth:s}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos,o),c=r.tileData.dense;if(c.length===0)return;const[l,u]=this.makeValueScale(this.minValue(),this.medianVisibleValue,this.maxValue(),0);if(!l)return;l.clamp(!0),this.valueScale=l;const f=l.copy();if(f.range([254,0]).clamp(!0),i.clear(),this.drawAxis(this.valueScale),this.options.valueScaling==="log"&&this.valueScale.domain()[1]<0){console.warn("Negative values present when using a log scale",this.valueScale.domain());return}const h=gt(this.options.lineStrokeColor||"blue"),p=Et().domain([0,o]).range([a,a+s]);i.lineStyle(0,h,1);const g=this.options.barFillColor||"grey",y=gt(g),b="barOpacity"in this.options?this.options.barOpacity:1;i.beginFill(y,b),r.drawnAtScale=this._xScale.copy();const m=this.options.align==="top";let v,_,T,w,S,k;if(this.colorGradientColors){S=new Ye.PIXI.Graphics,S.beginFill(tbe,1);const E=nA(this.colorGradientColors,1,this.dimensions[1],0,0,0,this.dimensions[1]);k=new Ye.PIXI.Sprite(Ye.PIXI.Texture.fromCanvas(E,Ye.PIXI.SCALE_MODES.NEAREST)),k.x=this._xScale(a),k.width=this._xScale(a+s)-k.x}for(let E=0;E<c.length;E++)if(v=this._xScale(p(E)),T=this.valueScale(c[E]+u),_=this._xScale(p(E+1))-v,w=this.dimensions[1]-T,m&&(T=0),!(Number.isNaN(w)||w<0||T<0)){if(this.addSVGInfo(r,v,T,_,w,g),p(E)>this.tilesetInfo.max_pos[0])break;if(this.colorScale&&!this.options.colorRangeGradient){const P=Math.round(f(c[E]+u)),C=this.colorScale[P],I=Ye.PIXI.utils.rgb2hex(C);i.beginFill(I,b)}(S||i).drawRect(v,T,_,w)}this.colorGradientColors&&(k.mask=S,i.removeChildren(),i.addChild(k,S))}},{key:"rerender",value:function(r,i){r?.colorRange&&(r.colorRangeGradient?this.setColorGradient(r.colorRange):this.setColorScale(r.colorRange)),sc(t,"rerender",this)([r,i])}},{key:"drawZeroLine",value:function(){this.zeroLine.clear();const r=gt(this.options.barFillColor||"grey"),i=+this.options.barOpacity||1,o=this.options.zeroLineColor?gt(this.options.zeroLineColor):r,a=Number.isNaN(+this.options.zeroLineOpacity)?i:+this.options.zeroLineOpacity;this.zeroLine.beginFill(o,a),this.zeroLine.drawRect(0,this.dimensions[1]-1,this.dimensions[0],1)}},{key:"drawZeroLineSvg",value:function(r){const i=document.createElement("rect");i.setAttribute("id","zero-line"),i.setAttribute("x",0),i.setAttribute("y",this.dimensions[1]-1),i.setAttribute("height",1),i.setAttribute("width",this.dimensions[0]),i.setAttribute("fill",this.options.zeroLineColor||this.options.barFillColor),i.setAttribute("fill-opacity",this.options.zeroLineOpacity||this.options.barOpacity),r.appendChild(i)}},{key:"getXScaleAndOffset",value:function(r){const i=r.domain(),o=this._xScale.domain(),a=(i[1]-i[0])/(o[1]-o[0]),c=this._xScale.domain().map(r)[0];return[a,-c*a]}},{key:"draw",value:function(){this.initialized&&(sc(t,"draw",this)([]),this.options.zeroLineVisible?this.drawZeroLine():this.zeroLine.clear(),Object.values(this.fetchedTiles).forEach(r=>{if(!r.drawnAtScale)return;const[i,o]=this.getXScaleAndOffset(r.drawnAtScale);r.graphics.scale.x=i,r.graphics.position.x=o}))}},{key:"zoomed",value:function(r,i){sc(t,"zoomed",this)([r,i])}},{key:"movedY",value:function(r){}},{key:"zoomedY",value:function(r,i){}},{key:"addSVGInfo",value:function(r,i,o,a,s,c){r.svgData?(r.svgData.barXValues.push(i),r.svgData.barYValues.push(o),r.svgData.barWidths.push(a),r.svgData.barHeights.push(s),r.svgData.barColors.push(c)):r.svgData={barXValues:[i],barYValues:[o],barWidths:[a],barHeights:[s],barColors:[c]}}},{key:"exportSVG",value:function(){let r=null,i=null;[i,r]=sc(t,"superSVG",this)([]),i.setAttribute("class","exported-line-track");const o=document.createElement("g");r.appendChild(o),o.setAttribute("transform",`translate(${this.position[0]},${this.position[1]})`),this.options.zeroLine&&this.drawZeroLineSvg(o),this.visibleAndFetchedTiles().filter(s=>s.svgData?.barXValues).forEach(s=>{const c=s.svgData;for(let l=0;l<c.barXValues.length;l++){const u=document.createElement("rect");u.setAttribute("fill",c.barColors[l]),u.setAttribute("stroke",c.barColors[l]),u.setAttribute("x",c.barXValues[l]),u.setAttribute("y",c.barYValues[l]),u.setAttribute("height",c.barHeights[l]),u.setAttribute("width",c.barWidths[l]),s.barBorders&&(u.setAttribute("stroke-width","0.1"),u.setAttribute("stroke","black")),o.appendChild(u)}});const a=document.createElement("g");if(a.setAttribute("id","axis"),i.appendChild(a),a.setAttribute("transform",`translate(${this.axis.pAxis.position.x}, ${this.axis.pAxis.position.y})`),this.options.axisPositionHorizontal==="left"||this.options.axisPositionVertical==="top"){const s=this.axis.exportAxisLeftSVG(this.valueScale,this.dimensions[1]);a.appendChild(s)}else if(this.options.axisPositionHorizontal==="right"||this.options.axisPositionVertical==="bottom"){const s=this.axis.exportAxisRightSVG(this.valueScale,this.dimensions[1]);a.appendChild(s)}return[i,r]}}])}(ac);function rbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nbe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,obe(r.key),r)}}function ibe(e,t,n){return t&&nbe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function obe(e){var t=abe(e,"string");return typeof t=="symbol"?t:t+""}function abe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function sbe(e,t,n){return t=fg(t),lbe(e,j$()?Reflect.construct(t,n||[],fg(e).constructor):t.apply(e,n))}function lbe(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cbe(e)}function cbe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(j$=function(){return!!e})()}function fg(e){return fg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fg(e)}function ube(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v5(e,t)}function v5(e,t){return v5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},v5(e,t)}let B$=function(e){function t(){return rbe(this,t),sbe(this,t,arguments)}return ube(t,e),ibe(t,[{key:"drawTile",value:function(r){this.renderTile(r)}},{key:"renderTile",value:function(r){if(!r.graphics)return;const i=r.graphics,{tileX:o,tileWidth:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos,this.tilesetInfo.tile_size||this.tilesetInfo.bins_per_dimension),s=r.tileData.dense;if(s.length===0)return;let c=0;if(this.valueScale=null,this.options.valueScaling==="log"){let m=this.medianVisibleValue;this.medianVisibleValue||(m=this.minValue()),this.valueScale=Ro().domain([m,this.maxValue()+m]).range([this.dimensions[1],0]),c=m}else this.valueScale=Et().domain([this.minValue(),this.maxValue()]).range([this.dimensions[1],0]);if(i.clear(),this.drawAxis(this.valueScale),this.options.valueScaling==="log"&&this.valueScale.domain()[1]<0){console.warn("Negative values present when using a log scale",this.valueScale.domain());return}const l=gt(this.options.lineStrokeColor?this.options.lineStrokeColor:"blue"),u=Et().domain([0,this.tilesetInfo.tile_size]).range([o,o+a]);i.lineStyle(0,l,1);const h=this.options.barFillColorTop?this.options.barFillColorTop:"green",p=this.options.barFillColorBottom?this.options.barFillColorBottom:"red",d=gt(h),g=gt(p),y="barOpacity"in this.options?this.options.barOpacity:1;r.drawnAtScale=this._xScale.copy();let b=0;this.options.valueScaling==="log"?b=this.valueScale(1):b=this.valueScale(0),delete r.svgData;for(let m=0;m<s.length;m++){const v=this._xScale(u(m)),_=this.valueScale(s[m]+c),T=this._xScale(u(m+1))-v;if(_>b?(i.beginFill(g,y),this.addSVGInfo(r,v,b,T,_-b,p)):(i.beginFill(d,y),this.addSVGInfo(r,v,_,T,b-_,h)),u(m)>this.tilesetInfo.max_pos[0])break;i.drawRect(v,r.svgData.barYValues[m],T,r.svgData.barHeights[m])}}}])}(m5);function fbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hbe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,dbe(r.key),r)}}function pbe(e,t,n){return t&&hbe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function dbe(e){var t=gbe(e,"string");return typeof t=="symbol"?t:t+""}function gbe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function mbe(e,t,n){return t=cc(t),vbe(e,z$()?Reflect.construct(t,n||[],cc(e).constructor):t.apply(e,n))}function vbe(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ybe(e)}function ybe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function z$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(z$=function(){return!!e})()}function bbe(e,t,n,r){var i=y5(cc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function y5(){return y5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=_be(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},y5.apply(null,arguments)}function _be(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=cc(e))!==null;);return e}function cc(e){return cc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cc(e)}function Tbe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b5(e,t)}function b5(e,t){return b5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},b5(e,t)}let H$=function(e){function t(n,r){var i;return fbe(this,t),i=mbe(this,t,[n,r]),i.setColorScale(r.colorRange),i.opacity=r.opacity||1,i}return Tbe(t,e),pbe(t,[{key:"setColorScale",value:function(r){this.colorScale=r?jo(r):Is,this.colorScale=this.colorScale.map(i=>i.map(o=>o/255))}},{key:"rerender",value:function(r){r?.colorRange&&this.setColorScale(r.colorRange),this.opacity=r.opacity||1,bbe(t,"rerender",this)([r])}},{key:"drawAxis",value:function(){}},{key:"drawTile",value:function(r){if(!r.graphics||!r.tileData||!r.tileData.dense)return;const i=r.graphics,{tileX:o,tileWidth:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos),s=r.tileData.dense;if(s.length===0)return;const[c,l]=this.makeValueScale(this.minValue(),this.medianVisibleValue,this.maxValue());if(c.range([254,0]).clamp(!0),this.valueScale=c,i.clear(),this.options.valueScaling==="log"&&this.valueScale.domain()[1]<0){console.warn("Negative values present when using a log scale",this.valueScale.domain());return}const u=Et().domain([0,this.tilesetInfo.tile_size]).range([o,o+a]);i.lineStyle(0,0,0);for(let f=0;f<s.length;f++){if(Number.isNaN(s[f]))continue;const h=Math.round(this.valueScale(s[f]+l));if(Number.isNaN(+h))continue;const p=this._xScale(u(f)),d=this._xScale(u(f+1))-p,g=this.dimensions[1];r.xValues[f]=p,r.yValues[f]=h;const y=this.colorScale[h],b=Ye.PIXI.utils.rgb2hex(y);if(i.beginFill(b,this.opacity),f!==0){if(u(f)>this.tilesetInfo.max_pos[0])break;s[f]!==0&&i.drawRect(p,0,d,g)}}}}])}(ac);function wbe(e){let t=0;const n=[];return e.forEach(r=>{t+=+r||0,n.push(t)}),Float64Array.from(n)}const Sbe=(e,t)=>{const n=Du(e,t);return wbe(e.map(r=>(Array.isArray(r)&&t?r.length:1)/n))};function Ebe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kbe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Cbe(r.key),r)}}function xbe(e,t,n){return t&&kbe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Cbe(e){var t=Obe(e,"string");return typeof t=="symbol"?t:t+""}function Obe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Pbe(e,t,n){return t=uc(t),Abe(e,F$()?Reflect.construct(t,n||[],uc(e).constructor):t.apply(e,n))}function Abe(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mbe(e)}function Mbe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(F$=function(){return!!e})()}function q$(e,t,n,r){var i=_5(uc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function _5(){return _5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Ibe(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},_5.apply(null,arguments)}function Ibe(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=uc(e))!==null;);return e}function uc(e){return uc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uc(e)}function Rbe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&T5(e,t)}function T5(e,t){return T5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},T5(e,t)}let U$=function(e){function t(n,r){var i;return Ebe(this,t),i=Pbe(this,t,[n,r]),i.pMain=i.pMobile,i.continuousScaling=!1,i.updateDataFetcher(r),i}return Rbe(t,e),xbe(t,[{key:"updateDataFetcher",value:function(r){if(r?.selectRows&&r.selectRowsAggregationMethod==="server"){const{pubSub:i,dataFetcher:o}=this,a=o.dataConfig.options,s={aggGroups:r.selectRows,aggFunc:r.selectRowsAggregationMode};if(JSON.stringify(a)!==JSON.stringify(s)){const c={...o.dataConfig,options:s};this.dataFetcher=new o.constructor(c,i),this.dataFetcher.dataConfig.tilesetUid&&this.fetchNewTiles(Object.keys(this.fetchedTiles).map(l=>({tileId:l,remoteId:l})))}}}},{key:"rerender",value:function(r,i){this.updateDataFetcher(r),q$(t,"rerender",this)([r,i]),r.selectRows&&(this.selectRowsCumWeights=Sbe(r.selectRows,r.selectRowsAggregationWithRelativeHeight))}},{key:"tileDataToCanvas",value:function(r){const i=document.createElement("canvas");this.options.selectRows&&this.tilesetInfo.shape?(i.width=this.tilesetInfo.shape[0],i.height=Du(this.options.selectRows,this.options.selectRowsAggregationWithRelativeHeight)):this.tilesetInfo.shape?(i.width=this.tilesetInfo.shape[0],i.height=this.tilesetInfo.shape[1]):(i.width=this.tilesetInfo.tile_size,i.height=1);const o=i.getContext("2d");if(o.fillStyle="transparent",o.fillRect(0,0,i.width,i.height),r.length!==0&&r.length===4*i.width*i.height){const a=new ImageData(r,i.width,i.height);o.putImageData(a,0,0)}else console.warn("HorizontalMultivecTrack: pixData has an incorrect length.");return i}},{key:"setSpriteProperties",value:function(r,i,o){const{tileX:a,tileWidth:s}=this.getTilePosAndDimensions(i,o,this.tilesetInfo.tile_size),c=a+s;r.width=this._refXScale(c)-this._refXScale(a),r.height=this.dimensions[1],r.x=this._refXScale(a),r.y=0}},{key:"leftTrackZoomed",value:function(r,i,o,a,s){const c=this._xScale(0)-o*this._refXScale(0);this.pMobile.position.x=c+this.position[0],this.pMobile.position.y=this.position[1],this.pMobile.scale.x=o,this.pMobile.scale.y=1}},{key:"zoomed",value:function(r,i,o,a){q$(t,"zoomed",this)([r,i]),this.pMain.position.x=a,this.pMain.position.y=this.position[1],this.pMain.scale.x=o,this.pMain.scale.y=1,this.drawColorbar()}},{key:"calculateVisibleTiles",value:function(){if(!this.tilesetInfo)return;if(this.zoomLevel=this.calculateZoomLevel(),this.tilesetInfo.resolutions){const i=this.tilesetInfo.resolutions.map(o=>+o).sort((o,a)=>a-o);this.xTiles=wt.calculateTilesFromResolution(i[this.zoomLevel],this._xScale,this.tilesetInfo.min_pos[0],null,this.tilesetInfo.tile_size)}else this.xTiles=wt.calculateTiles(this.zoomLevel,this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.max_zoom,this.tilesetInfo.max_width);const r=this.xTiles.map(i=>[this.zoomLevel,i]);this.setVisibleTiles(r)}},{key:"calculateZoomLevel",value:function(){if(!this.tilesetInfo)return;const r=this.tilesetInfo.min_pos[0];let i=null;return this.tilesetInfo.resolutions?i=wt.calculateZoomLevelFromResolutions(this.tilesetInfo.resolutions,this._xScale,r):i=wt.calculateZoomLevel(this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0]),i}},{key:"tileToLocalId",value:function(r){return r.join(".")}},{key:"tileToRemoteId",value:function(r){return r.join(".")}},{key:"getTilePosAtPosition",value:function(r,i){if(!this.tilesetInfo)return;const o=this.calculateZoomLevel(),a=wt.calculateTileWidth(this.tilesetInfo,o,this.tilesetInfo.tile_size),s=this._xScale.invert(r)/a;return[o,Math.floor(s)]}},{key:"getVisibleData",value:function(r,i){const o=this.calculateZoomLevel(),a=wt.calculateTileWidth(this.tilesetInfo,o,this.tilesetInfo.tile_size),s=this._xScale.invert(r)/a;let c=this.tilesetInfo.shape?this.tilesetInfo.shape[1]:1;this.options.selectRows&&(c=Du(this.options.selectRows,this.options.selectRowsAggregationWithRelativeHeight));let l=this.tilesetInfo.tile_size*(s-Math.floor(s));const u=i/this.dimensions[1],f=u*c;let h=Math.floor(f),p;this.options.selectRows&&(this.options.selectRowsAggregationWithRelativeHeight&&(h=this.selectRowsCumWeights.findIndex((b,m)=>u<=b&&(m===this.selectRowsCumWeights.length-1||this.selectRowsCumWeights[m+1]>=u))),p=this.options.selectRows[h]);const d=this.tileToLocalId([o,Math.floor(s)]),g=this.fetchedTiles[d];let y="";if(g){this.tilesetInfo.shape||(l=g.tileData.dense.length*(s-Math.floor(s)));let b=null;if(this.tilesetInfo.shape?Array.isArray(p)&&this.options.selectRowsAggregationMethod==="client"?b=p.map(m=>this.tilesetInfo.shape[0]*m+Math.floor(l)):p&&this.options.selectRowsAggregationMethod==="client"?b=this.tilesetInfo.shape[0]*p+Math.floor(l):b=this.tilesetInfo.shape[0]*h+Math.floor(l):b=g.tileData.dense.length*h+Math.floor(l),Array.isArray(b)){const m=R0(this.options.selectRowsAggregationMode),v=b.map(_=>g.tileData.dense[_]);y=Fr(".3f")(m(v)),y+="<br/>",y+=`${b.length}-item ${this.options.selectRowsAggregationMode}`}else y=Fr(".3f")(g.tileData.dense[b]),Array.isArray(p)&&(y+="<br/>",y+=`${p.length}-item ${this.options.selectRowsAggregationMode}`)}if(this.tilesetInfo.row_infos){y+="<br/>";let b="";this.options.selectRows&&!Array.isArray(p)?b=this.tilesetInfo.row_infos[p]:h>=0&&h<this.tilesetInfo.row_infos.length&&(b=this.tilesetInfo.row_infos[h]),typeof b=="object"?y+=Object.values(b).join(" "):y+=b}return`${y}`}},{key:"getMouseOverHtml",value:function(r,i){if(!this.tilesetInfo)return"";const o=this.getTilePosAtPosition(r,i);let a="";if(this.options?.heatmapValueScaling&&this.options.heatmapValueScaling==="categorical"&&this.options.colorRange){const c=this.getVisibleData(r,i).split("<br/>"),l=this.options.colorRange[Number.parseInt(c[0],10)-1],u=c[1];if(Number.isNaN(l)||l==="NaN"||typeof l>"u"||l==="undefined")return"";a=`<svg width="10" height="10" style="position:relative;bottom:1px"><rect width="10" height="10" rx="2" ry="2"
281
281
  style="fill:${l};stroke:black;stroke-width:2;"></svg> ${u}`}else a+=`Data value: ${this.getVisibleData(r,i)}</br>`,a+=`Zoom level: ${o[0]} tile position: ${o[1]}`;return a}}])}(Ql);function Dbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nbe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,$be(r.key),r)}}function Lbe(e,t,n){return t&&Nbe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $be(e){var t=jbe(e,"string");return typeof t=="symbol"?t:t+""}function jbe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Bbe(e,t,n){return t=fc(t),zbe(e,V$()?Reflect.construct(t,n||[],fc(e).constructor):t.apply(e,n))}function zbe(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hbe(e)}function Hbe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function V$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(V$=function(){return!!e})()}function hg(e,t,n,r){var i=w5(fc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function w5(){return w5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Fbe(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},w5.apply(null,arguments)}function Fbe(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=fc(e))!==null;);return e}function fc(e){return fc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fc(e)}function qbe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&S5(e,t)}function S5(e,t){return S5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},S5(e,t)}let G$=function(e){function t(){return Dbe(this,t),Bbe(this,t,arguments)}return qbe(t,e),Lbe(t,[{key:"initTile",value:function(r){r.barXValues=new Array(r.tileData.dense.length),r.barYValues=new Array(r.tileData.dense.length),r.barWidths=new Array(r.tileData.dense.length),r.barHeights=new Array(r.tileData.dense.length),hg(t,"initTile",this)([r])}},{key:"drawTile",value:function(r){if(!r.graphics||!r.tileData||!r.tileData.dense)return;const i=r.graphics,{tileX:o,tileWidth:a}=this.getTilePosAndDimensions(r.tileData.zoomLevel,r.tileData.tilePos),s=r.tileData.dense;if(s.length===0)return;let c=0;if(this.valueScale=null,this.options.valueScaling==="log"){let d=this.medianVisibleValue;this.medianVisibleValue||(d=this.minValue()),this.valueScale=Ro().domain([d,this.maxValue()+d]).range([this.dimensions[1],0]),c=d}else this.valueScale=Et().domain([this.minValue(),this.maxValue()]).range([this.dimensions[1],0]);if(i.clear(),this.drawAxis(this.valueScale),this.options.valueScaling==="log"&&this.valueScale.domain()[1]<0){console.warn("Negative values present when using a log scale",this.valueScale.domain());return}const l=gt(this.options.lineStrokeColor?this.options.lineStrokeColor:"blue"),u=Et().domain([0,this.tilesetInfo.tile_size]).range([o,o+a]);i.lineStyle(0,l,1);const h=this.options.pointSize?this.options.pointSize:3,p=gt(this.options.pointColor?this.options.pointColor:"red");i.beginFill(p,1),r.drawnAtScale=this._xScale.copy();for(let d=0;d<s.length;d++){const g=this._xScale(u(d)),y=this.valueScale(s[d]+c);if(r.barXValues[d]=g-h/2/this.pMain.scale.x,r.barYValues[d]=y-h/2/this.pMain.scale.y,r.barWidths[d]=h/this.pMain.scale.x,r.barHeights[d]=h/this.pMain.scale.y,u(d)>this.tilesetInfo.max_pos[0])break;i.drawRect(g-h/2/this.pMain.scale.x,y-h/2/this.pMain.scale.y,h/this.pMain.scale.x,h/this.pMain.scale.y)}}},{key:"draw",value:function(){hg(t,"draw",this)([]);for(const r of Zt(this.fetchedTiles)){const i=(r.drawnAtScale.domain()[1]-r.drawnAtScale.domain()[0])/(this._xScale.domain()[1]-this._xScale.domain()[0]),a=this._xScale.domain().map(r.drawnAtScale)[0];r.graphics.scale.x=i,r.graphics.position.x=-a*i}}},{key:"zoomed",value:function(r,i,o,a,s){hg(t,"zoomed",this)([r,i])}},{key:"exportSVG",value:function(){let r=null,i=null;[i,r]=hg(t,"superSVG",this)([]),i.setAttribute("class","exported-line-track");const o=document.createElement("g");r.appendChild(o),o.setAttribute("transform",`translate(${this.position[0]},${this.position[1]})`);for(const s of this.visibleAndFetchedTiles())for(let c=0;c<s.barXValues.length;c++){const l=document.createElement("rect"),u=this.options.lineStrokeColor||"blue",f=this.options.pointColor||"red";l.setAttribute("fill",f),l.setAttribute("stroke",u),l.setAttribute("stroke-width",0),l.setAttribute("x",s.barXValues[c]),l.setAttribute("y",s.barYValues[c]),l.setAttribute("height",s.barHeights[c]),l.setAttribute("width",s.barWidths[c]),o.appendChild(l)}const a=document.createElement("g");if(a.setAttribute("id","axis"),i.appendChild(a),a.setAttribute("transform",`translate(${this.axis.pAxis.position.x}, ${this.axis.pAxis.position.y})`),this.options.axisPositionHorizontal==="left"||this.options.axisPositionVertical==="top"){const s=this.axis.exportAxisLeftSVG(this.valueScale,this.dimensions[1]);a.appendChild(s)}else if(this.options.axisPositionHorizontal==="right"||this.options.axisPositionVertical==="bottom"){const s=this.axis.exportAxisRightSVG(this.valueScale,this.dimensions[1]);a.appendChild(s)}return[i,r]}}])}(ac);var E5,W$;function Ube(){if(W$)return E5;W$=1,E5=function(t,n){var r=t.length,i=0,o=n||!1;t=t.map(e),t[0]!=t[t.length-1]&&(t=t.concat(t[0]));for(var a=0;a<r;a++)i+=t[a].x*t[a+1].y-t[a].y*t[a+1].x;return o?i/2:Math.abs(i)/2};function e(t){return Array.isArray(t)?{x:t[0],y:t[1]}:t}return E5}var Vbe=Ube();const Gbe=_n(Vbe);function Wbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ybe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Kbe(r.key),r)}}function Xbe(e,t,n){return t&&Ybe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kbe(e){var t=Zbe(e,"string");return typeof t=="symbol"?t:t+""}function Zbe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Qbe(e,t,n){return t=hc(t),Jbe(e,Y$()?Reflect.construct(t,n||[],hc(e).constructor):t.apply(e,n))}function Jbe(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return e_e(e)}function e_e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Y$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Y$=function(){return!!e})()}function X$(e,t,n,r){var i=k5(hc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function k5(){return k5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=t_e(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},k5.apply(null,arguments)}function t_e(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=hc(e))!==null;);return e}function hc(e){return hc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hc(e)}function r_e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x5(e,t)}function x5(e,t){return x5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},x5(e,t)}const n_e=(e,t,n)=>{const r=Object.values(e.drawnRects),i=[t,n],o=[],a=e.rectGraphics;for(const s of r){const c=s[0].slice(0),l=a$(c,a.scale.x,a.position.x,a.scale.y,a.position.y),u=Gbe(l);if(ME(l,i)===-1){const f=s[1];f.area=u,o.push(f)}}return o};let K$=function(e){function t(n,r,i){return Wbe(this,t),Qbe(this,t,[n,r])}return r_e(t,e),Xbe(t,[{key:"rerender",value:function(r,i){if(r&&r.projectUid!==this.options.projectUid){this.options=r,this.fetchedTiles={},this.refreshTiles();return}X$(t,"rerender",this)([r,i])}},{key:"tileToLocalId",value:function(r){return this.tileToRemoteId(r)}},{key:"tileToRemoteId",value:function(r){let i=`${r.join(".")}`;return this.options.projectUid&&(i=`${i}.ui=${this.options.projectUid}`),i}},{key:"click",value:function(r,i){const o=n_e(this,r,i);return o.length?this.selectRect(o[0].value.uid):this.selectRect(null),{type:"1d-annotations",event:null,payload:o}}},{key:"render",value:function(){X$(t,"render",this)([])}}])}(WE);function i_e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o_e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s_e(r.key),r)}}function a_e(e,t,n){return t&&o_e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function s_e(e){var t=l_e(e,"string");return typeof t=="symbol"?t:t+""}function l_e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function c_e(e,t,n){return t=pc(t),u_e(e,Z$()?Reflect.construct(t,n||[],pc(e).constructor):t.apply(e,n))}function u_e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f_e(e)}function f_e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Z$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Z$=function(){return!!e})()}function pg(e,t,n,r){var i=C5(pc(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function C5(){return C5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=h_e(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},C5.apply(null,arguments)}function h_e(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=pc(e))!==null;);return e}function pc(e){return pc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pc(e)}function p_e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O5(e,t)}function O5(e,t){return O5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},O5(e,t)}const d_e=250;let Q$=function(e){function t(n,r){var i;i_e(this,t),i=c_e(this,t,[n,r]);const{pubSub:o}=n;i.drawnAnnotations={},i.drawnAnnoGfx={},i.selectedAnno=null,i.options.minSquareSize=+i.options.minSquareSize;const{publish:a,subscribe:s,unsubscribe:c}=lp();return i.publish=a,i.subscribe=s,i.unsubscribe=c,i.sT=0,i.annoSelectedBound=i.annoSelected.bind(i),i.pubSubs.push(o.subscribe("annoSelected",i.annoSelectedBound)),i}return p_e(t,e),a_e(t,[{key:"minX",get:function(){return this.tilesetInfo?.min_pos?this.tilesetInfo.min_pos[0]:0}},{key:"maxX",get:function(){return this.tilesetInfo?.max_pos?this.tilesetInfo.max_pos[0]:this.tilesetInfo.max_width||this.tilesetInfo.max_size}},{key:"minY",get:function(){return this.minX}},{key:"maxY",get:function(){return this.maxX}},{key:"maxSize",get:function(){const n=this.tilesetInfo.max_pos&&Math.max(this.tilesetInfo.max_pos[0]-this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[1]-this.tilesetInfo.min_pos[1]);return n||(this.tilesetInfo.max_size?this.tilesetInfo.max_size:0)}},{key:"projection",value:function([r,i]){return[this._xScale(r),this._yScale(i)]}},{key:"tileToLocalId",value:function(r){return`${r.join(".")}`}},{key:"tileToRemoteId",value:function(r){return`${r.join(".")}`}},{key:"localToRemoteId",value:function(r){const i=r.split(".");return i.slice(0,i.length-1).join(".")}},{key:"calculateZoomLevel",value:function(){const r=wt.calculateZoomLevel(this._xScale,this.minX,this.maxX),i=wt.calculateZoomLevel(this._yScale,this.minY,this.maxY);return cA(T0(r,i),this.maxZoom)}},{key:"setVisibleTiles",value:function(r){this.visibleTiles=r.map(i=>({tileId:this.tileToLocalId(i),remoteId:this.tileToRemoteId(i)})),this.visibleTileIds=new Set(this.visibleTiles.map(i=>i.tileId))}},{key:"calculateVisibleTiles",value:function(){if(!this.tilesetInfo)return;this.zoomLevel=this.calculateZoomLevel(),this.xTiles=wt.calculateTiles(this.zoomLevel,this._xScale,this.minX,this.maxX,this.tilesetInfo.max_zoom,this.maxSize),this.yTiles=wt.calculateTiles(this.zoomLevel,this._yScale,this.minY,this.maxY,this.tilesetInfo.max_zoom,this.maxSize);const r=this.zoomLevel,i=[];for(let o=0;o<this.xTiles.length;o++)for(let a=0;a<this.yTiles.length;a++)i.push([r,this.xTiles[o],this.yTiles[a]]);this.setVisibleTiles(i)}},{key:"draw",value:function(){this.drawnAnnotations={},pg(t,"draw",this,3)([])}},{key:"drawTile",value:function(r,i=!1,o=!1){if(!r.graphics)return;r.graphics.__tile__=r;const a=r.graphics;a.clear(),this.setBorderStyle(a),this.setFill(a),a.alpha=+this.options.rectangleDomainOpacity,r.tileData.length&&r.tileData.filter(s=>!(s.uid in this.drawnAnnotations)||i).forEach(s=>{const[c,l]=this.projection([s.xStart,s.yStart]),[u,f]=this.projection([s.xEnd,s.yEnd]);this.options.exclude&&this.options.exclude.indexOf(s.uid)>=0||this.drawAnnotation(this.prepAnnotation(a,s.uid,c,l,u-c,f-l,s),o)})}},{key:"prepAnnotation",value:function(r,i,o,a,s,c,l){let u;try{u=JSON.parse(l.fields)}catch{}return{graphics:r,id:l.id,uid:i,annotation:{x:o,y:a,width:s,height:c},dataPos:[l.xStart,l.xEnd,l.yStart,l.yEnd],importance:l.importance,info:u}}},{key:"drawAnnotation",value:function({graphics:r,id:i,uid:o,annotation:a,dataPos:s,importance:c,info:l},u){this.options.minSquareSize&&(a.width<this.options.minSquareSize||a.height<this.options.minSquareSize)&&(a.x=(a.x+a.width)/2,a.y=(a.y+a.height)/2,a.width=this.options.minSquareSize,a.height=this.options.minSquareSize),this.drawnAnnotations[o]=a;const f=[a.x,a.y,a.width,a.height];let h=this.drawnAnnoGfx[o];h||(h=new Ye.PIXI.Graphics,this.drawnAnnoGfx[o]=h),r.children.indexOf(h)===-1&&r.addChild(h),this._drawRect(h,f,o),r.interactive=!0,h.interactive=!0,h.buttonMode=!0;const p={id:i,uid:o,dataPos:s,importance:c,info:l,viewPos:[a.x,a.y,a.x+a.width,a.y+a.height]};h.mouseover=()=>this.hover(h,f,o),h.mouseout=()=>this.blur(h,f,o),h.mousedown=()=>this.mouseDown(),h.mouseup=d=>this.mouseUp(h,f,o,d,p),u||this.publish("annotationDrawn",{trackUuids:this.uuid,annotationUuid:o,annotationId:i,viewPos:f,dataPos:s,importance:c,info:l})}},{key:"_drawRect",value:function(r,i,o){let a=this.options.rectangleDomainStrokeColor,s=this.options.rectangleDomainStrokeWidth,c=this.options.rectangleDomainStrokeOpacity,l=this.options.rectangleDomainFillColor,u=this.options.rectangleDomainFillOpacity;this.hoveredAnno===o&&(a=this.options.hoverColor,s=this.options.rectangleDomainStrokeWidth+1||2,c=1,l=this.options.hoverColor,u=this.options.rectangleDomainFillOpacity),this.selectedAnno&&this.selectedAnno.uid===o&&(a=this.options.selectColor,s=this.options.rectangleDomainStrokeWidth+1||2,c=1,l=this.options.selectColor,u=T0(.33,this.options.rectangleDomainFillOpacity)),r.clear(),this.options.trackBorderBgWidth&&(this.setBorderStyle(r,this.options.trackBorderBgColor,this.options.trackBorderBgWidth,this.options.trackBorderBgAlpha),this.setFill(r,l,0),r.drawRect(...i)),this.setBorderStyle(r,a,s,c),this.setFill(r,l,u),r.drawRect(...i),r.__viewPos__=i}},{key:"context",value:function(r,i,o){return a=>a(r,i,o)}},{key:"click",value:function(r,i,o,a,s){this.select(r,i,o),this.pubSub.publish("app.click",{type:"annotation",event:a,payload:s})}},{key:"mouseDown",value:function(){this.sT=performance.now()}},{key:"mouseUp",value:function(r,i,o,a,s){performance.now()-this.sT<=d_e&&this.click(r,i,o,a,s)}},{key:"hover",value:function(r,i,o){this.hoveredAnno=o,this._drawRect(r,i,o),this.animate()}},{key:"focus",value:function(r,i,o){this._drawRect(r,i,o),this.animate()}},{key:"blur",value:function(r,i,o){this.hoveredAnno=null,this._drawRect(r,i,o),this.animate()}},{key:"select",value:function(r,i,o,a=!1){let s=null,c=null;this.selectedAnno&&(s=this.selectedAnno.graphics,c=this.selectedAnno.uid),this.selectedAnno={graphics:r,uid:o},this.focus(r,i,o),this.options.onSelect&&!a&&(window[this.options.onSelect](o),this.pubSub.publish("annoSelected",o)),s&&c&&this.blur(s,s.__viewPos__,c)}},{key:"unselect",value:function(){const r=this.selectedAnno.graphics,i=this.selectedAnno.uid;this.selectedAnno=null,this.blur(r,r.__viewPos__,i)}},{key:"annoSelected",value:function(r){if(!this.selectedAnno||this.selectedAnno.uid!==r){this.selectedAnno&&this.unselect();const i=this.drawnAnnoGfx[r];i&&this.select(i,i.__viewPos__,r,!0)}}},{key:"exportSVG",value:function(){let r=null,i=null;pg(t,"exportSVG",this,1)?[i,r]=pg(t,"exportSVG",this,3)([]):(i=document.createElement("g"),r=i);const o=document.createElement("g");return o.setAttribute("transform",`translate(${this.position[0]},${this.position[1]})`),r.appendChild(o),this.visibleAndFetchedTiles().filter(a=>a.tileData?.length).map(a=>({graphics:a.graphics,td:a.tileData})).forEach(({td:a,graphics:s})=>{const c=document.createElement("g");if(c.setAttribute("transform",`translate(${s.position.x},${s.position.y})scale(${s.scale.x},${s.scale.y})`),o.appendChild(c),a.uid in this.drawnAnnotations){const l=this.drawnAnnotations[a.uid],u=document.createElement("rect");u.setAttribute("x",l.x),u.setAttribute("y",l.y),u.setAttribute("width",l.width),u.setAttribute("height",l.height),u.setAttribute("fill",this.options.fillColor||"grey"),u.setAttribute("opacity",.3),u.style.stroke=this.options.fillColor||"grey",u.style.strokeWidth="1px",c.appendChild(u)}}),[i,i]}},{key:"setBorderStyle",value:function(r,i=this.options.rectangleDomainStrokeColor,o=this.options.rectangleDomainStrokeWidth,a=this.options.rectangleDomainStrokeOpacity){r.lineStyle(typeof o<"u"?o:1,gt(i||"black"),typeof a<"u"?a:1)}},{key:"setFill",value:function(r,i=this.options.rectangleDomainFillColor,o=this.options.rectangleDomainFillOpacity){r.beginFill(gt(i||"grey"),typeof o<"u"?o:.4)}},{key:"setPosition",value:function(r){pg(t,"setPosition",this,3)([r]),this.pMain.position.y=this.position[1],this.pMain.position.x=this.position[0]}},{key:"zoomed",value:function(r,i){this.xScale(r),this.yScale(i),this.refreshTiles(),this.draw()}}])}(Si);function g_e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m_e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,y_e(r.key),r)}}function v_e(e,t,n){return t&&m_e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function y_e(e){var t=b_e(e,"string");return typeof t=="symbol"?t:t+""}function b_e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function __e(e,t,n){return t=dc(t),T_e(e,J$()?Reflect.construct(t,n||[],dc(e).constructor):t.apply(e,n))}function T_e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return w_e(e)}function w_e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function J$(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(J$=function(){return!!e})()}function dg(e,t,n,r){var i=P5(dc(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function P5(){return P5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=S_e(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},P5.apply(null,arguments)}function S_e(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=dc(e))!==null;);return e}function dc(e){return dc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dc(e)}function E_e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&A5(e,t)}function A5(e,t){return A5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},A5(e,t)}function ej(e,t,n,r,i,o,a,s,c,l){const u=l?e._xScale(n.yStart):e._xScale(n.xStart),f=l?e._xScale(n.yEnd):e._xScale(n.xEnd),h=l?e._yScale(n.xStart):e._yScale(n.yStart),p=l?e._yScale(n.xEnd):e._yScale(n.yEnd),d=n.uid+l,g=f-u,y=p-h;let b={x:u,y:h,width:g,height:y};r&&(g<r||y<r)&&(b={x:u-r/2,y:h-r/2,width:r,height:r}),e.drawnRects[d]=b;const m=b.x+b.width,v=b.y+b.height;(b.x>i&&b.x<o||m>i&&m<o||b.y>a&&b.y<s||v>a&&v<s)&&(b.width>c||b.height>c)&&(t.drawRect(b.x,b.y,b.width,b.height),e.publish("annotationDrawn",{trackUuid:e.uuid,annotationUuid:d,viewPos:[b.x,b.y,b.width,b.height],dataPos:[n.xStart,n.xEnd,n.yStart,n.yEnd],importance:n.importance,info:{patternType:e.options.patternType}}))}let tj=function(e){function t(...n){var r;g_e(this,t),r=__e(this,t,[...n]),r.drawnRects={};const{publish:i,subscribe:o,unsubscribe:a}=lp();return r.publish=i,r.subscribe=o,r.unsubscribe=a,r}return E_e(t,e),v_e(t,[{key:"tileToLocalId",value:function(r){return`${r.join(".")}`}},{key:"tileToRemoteId",value:function(r){return`${r.join(".")}`}},{key:"localToRemoteId",value:function(r){const i=r.split(".");return i.slice(0,i.length-1).join(".")}},{key:"calculateZoomLevel",value:function(){const r=wt.calculateZoomLevel(this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0]),i=wt.calculateZoomLevel(this._xScale,this.tilesetInfo.min_pos[1],this.tilesetInfo.max_pos[1]);let o=Math.max(r,i);return o=Math.min(o,this.maxZoom),o}},{key:"setVisibleTiles",value:function(r){this.visibleTiles=r.map(i=>({tileId:this.tileToLocalId(i),remoteId:this.tileToRemoteId(i)})),this.visibleTileIds=new Set(this.visibleTiles.map(i=>i.remoteId))}},{key:"calculateVisibleTiles",value:function(){if(!this.tilesetInfo)return;this.zoomLevel=this.calculateZoomLevel(),this.xTiles=wt.calculateTiles(this.zoomLevel,this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0],this.tilesetInfo.max_zoom,this.tilesetInfo.max_width),this.yTiles=wt.calculateTiles(this.zoomLevel,this._yScale,this.tilesetInfo.min_pos[1],this.tilesetInfo.max_pos[1],this.tilesetInfo.max_zoom,this.tilesetInfo.max_width);const r=this.xTiles,i=this.yTiles,o=this.zoomLevel,a=[];for(let s=0;s<r.length;s++)for(let c=0;c<i.length;c++){const l=[o,r[s],i[c]];a.push(l)}this.setVisibleTiles(a)}},{key:"initTile",value:function(){}},{key:"destroyTile",value:function(){}},{key:"draw",value:function(){this.drawnRects={},dg(t,"draw",this,3)([])}},{key:"drawTile",value:function(r){const i=r.graphics;if(!i)return;i.clear();const o=gt(this.options.rectangleDomainStrokeColor||"black"),a=gt(this.options.rectangleDomainFillColor||"grey");i.lineStyle(typeof this.options.rectangleDomainStrokeWidth<"u"?this.options.rectangleDomainStrokeWidth:1,o,typeof this.options.rectangleDomainStrokeOpacity<"u"?this.options.rectangleDomainStrokeOpacity:1),i.beginFill(a,typeof this.options.rectangleDomainFillOpacity<"u"?this.options.rectangleDomainFillOpacity:.4),i.alpha=this.options.rectangleDomainOpacity||.5;const s=this.options.minSquareSize&&this.options.minSquareSize!=="none"?+this.options.minSquareSize:0,c=this.options.rectangleMinSize?+this.options.rectangleMinSize:0,l=this._xScale.range()[0],u=this._xScale.range()[1],f=this._yScale.range()[0],h=this._yScale.range()[1];r.tileData.length&&r.tileData.filter(p=>!(p.uid in this.drawnRects)).forEach(p=>{ej(this,i,p,s,l,u,f,h,c,this.options.flipDiagonal==="yes"),this.options.flipDiagonal&&this.options.flipDiagonal==="copy"&&ej(this,i,p,s,l,u,f,h,c,!0)})}},{key:"exportSVG",value:function(){let r=null,i=null;dg(t,"exportSVG",this,1)?[i,r]=dg(t,"exportSVG",this,3)([]):(i=document.createElement("g"),r=i);const o=document.createElement("g");o.setAttribute("transform",`translate(${this.position[0]},${this.position[1]})`),r.appendChild(o);for(const a of[!0,!1])for(const s of this.visibleAndFetchedTiles())!s.tileData||!s.tileData.length||s.tileData.forEach(c=>{const l=c.uid+a,u=document.createElement("g");if(u.setAttribute("transform",`translate(${s.graphics.position.x},${s.graphics.position.y})scale(${s.graphics.scale.x},${s.graphics.scale.y})`),o.appendChild(u),l in this.drawnRects){const f=this.drawnRects[l],h=document.createElement("rect");h.setAttribute("x",f.x),h.setAttribute("y",f.y),h.setAttribute("width",f.width),h.setAttribute("height",f.height),h.setAttribute("fill",this.options.rectangleDomainFillColor?this.options.rectangleDomainFillColor:"grey"),h.setAttribute("opacity",.3),h.style.stroke="black",h.style.strokeWidth="1px",u.appendChild(h)}});return[i,i]}},{key:"setPosition",value:function(r){dg(t,"setPosition",this,3)([r]),this.pMain.position.y=this.position[1],this.pMain.position.x=this.position[0]}},{key:"zoomed",value:function(r,i){this.xScale().domain()[0]===r.domain()[0]&&this.xScale().domain()[1]===r.domain()[1]&&this.yScale().domain()[0]===i.domain()[0]&&this.yScale().domain()[1]===i.domain()[1]||(this.xScale(r),this.yScale(i),this.refreshTiles(),this.draw())}},{key:"leftTrackDraw",value:function(){this.draw()}}])}(Si);function k_e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x_e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,O_e(r.key),r)}}function C_e(e,t,n){return t&&x_e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function O_e(e){var t=P_e(e,"string");return typeof t=="symbol"?t:t+""}function P_e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function A_e(e,t,n){return t=gg(t),M_e(e,rj()?Reflect.construct(t,n||[],gg(e).constructor):t.apply(e,n))}function M_e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return I_e(e)}function I_e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rj(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rj=function(){return!!e})()}function gg(e){return gg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gg(e)}function R_e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&M5(e,t)}function M5(e,t){return M5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},M5(e,t)}let nj=function(e){function t(n,r){var i;return k_e(this,t),i=A_e(this,t,[n,r]),i.seen=new Set,i.pMain=i.pMobile,i.rows=[],i}return R_e(t,e),C_e(t,[{key:"uid",value:function(r){return r[r.length-2]}},{key:"segmentOverlap",value:function(r,i){}},{key:"drawAll",value:function(r){this.pMain.clear();const i=new Set,o=r.map(s=>i.has(this.uid(s))?null:(i.add(this.uid(s)),{from:+s[1],to:+s[2],type:s[4],uid:this.uid(s)})).filter(s=>s),a=Up(o);this.rows=a,this.draw()}},{key:"draw",value:function(){const r=this.rows;if(!r)return;const i=Jc().range([0,this.dimensions[1]]).padding(.1).domain(en(0,this.maxRows())),o=this.pMain;o.clear(),o.lineStyle(1,255,0),o.beginFill(16740363,.8);for(let a=0;a<r.length;a++)for(let s=0;s<r[a].length;s++){const c=r[a][s],l=this._refXScale(c.from),u=this._refXScale(c.to),f=i(a),h=f+i.bandwidth(),p=u-l,d=h-f;o.drawRect(l,f,p,d)}}},{key:"allTilesLoaded",value:function(){const i=this.visibleAndFetchedIds().map(a=>this.fetchedTiles[a].tileData.discrete),o=[].concat(...i);this.drawAll(o)}},{key:"initTile",value:function(r){}},{key:"maxRows",value:function(){return this.rows.length}},{key:"updateTile",value:function(r){}},{key:"destroyTile",value:function(r){r.tileData.discrete.forEach(i=>{const o=i[i.length-2];this.seen.has(o)&&this.seen.delete(o)})}},{key:"drawTile",value:function(r){}}])}(Yl);function D_e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N_e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,$_e(r.key),r)}}function L_e(e,t,n){return t&&N_e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $_e(e){var t=j_e(e,"string");return typeof t=="symbol"?t:t+""}function j_e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function B_e(e,t,n){return t=mc(t),z_e(e,ij()?Reflect.construct(t,n||[],mc(e).constructor):t.apply(e,n))}function z_e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return H_e(e)}function H_e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ij(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ij=function(){return!!e})()}function gc(e,t,n,r){var i=I5(mc(1&r?e.prototype:e),t,n);return 2&r&&typeof i=="function"?function(o){return i.apply(n,o)}:i}function I5(){return I5=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=F_e(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},I5.apply(null,arguments)}function F_e(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=mc(e))!==null;);return e}function mc(e){return mc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mc(e)}function q_e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&R5(e,t)}function R5(e,t){return R5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},R5(e,t)}const oj=11,D5="Arial",aj="outside",N5=10,U_e=4,V_e=20,G_e=gt("#ffffff"),mg=2,vc=2*(2*N5/3)/3,W_e=50,Y_e=5e3,L5="blue",$5="red",j5=(e,t,n)=>{n.type!=="filler"&&t.pubSub.publish("app.click",{type:"gene-annotation",event:e,payload:n})},sj=(e,t)=>{const n=e.concat(t),r=n.map(i=>[i.xStart,1,i.xEnd,1]);Yf(r,(i,o)=>{let a=null,s=null;if(n[i].type==="filler"?a=n[i]:s=n[i],n[o].type==="filler"){if(a)return;a=n[o]}else{if(!a)return;s=n[o]}a.xStart>=s.xStart&&a.xEnd<=s.xEnd&&(a.hide=!0)})};function X_e(e,t,n){const{flipText:r,fontSize:i,fontFamily:o,plusStrandColor:a,minusStrandColor:s,maxGeneEntries:c,maxFillerEntries:l,maxTexts:u}=n;if(t.texts={},t.rectGraphics=new Ye.PIXI.Graphics,t.textBgGraphics=new Ye.PIXI.Graphics,t.textGraphics=new Ye.PIXI.Graphics,t.rectMaskGraphics=new Ye.PIXI.Graphics,t.graphics.addChild(t.rectGraphics),t.graphics.addChild(t.textBgGraphics),t.graphics.addChild(t.textGraphics),t.graphics.addChild(t.rectMaskGraphics),t.rectGraphics.mask=t.rectMaskGraphics,!t.tileData.sort)return;t.tileData.sort((p,d)=>d.importance-p.importance);const f=t.tileData.filter(p=>p.type!=="filler").slice(0,c),h=t.tileData.filter(p=>p.type==="filler").slice(0,l);t.tileData=f.concat(h),t.tileData.forEach((p,d)=>{if(p.type==="filler")return;const g=p.fields,y=g[3],b=e.geneId(g,p.type),m=p.strand||g[5];p.strand=p.strand||m;let v=a||L5;if(m==="-"&&(v=s||$5),t.textWidths={},t.textHeights={},d>=u)return;const _=new Ye.PIXI.Text(y,{fontSize:`${i}px`,fontFamily:o,fill:gt(v)});_.interactive=!0,r&&(_.scale.x=-1),_.anchor.x=.5,_.anchor.y=1,t.texts[b]=_,t.texts[b].strand=m,t.textGraphics.addChild(_)}),t.initialized=!0}function lj(e,t,n,r,i,o,a,s,c){const l=s-c/2,u=0;e.forEach(f=>{const h=new Ye.PIXI.Graphics;n.rectGraphics.addChild(h),h.beginFill(o,.1),h.lineStyle(0,o);const p=[i(f.xStart)-u,l,i(f.xEnd)+u,l,i(f.xEnd)+u,l+c,i(f.xStart)-u,l+c,i(f.xStart)-u,l];h.interactive=!0,h.buttonMode=!0,h.mouseup=d=>j5(d,t,f),h.drawPolygon(p),n.allRects.push([p,f.strand,f])})}function K_e(e,t,n,r,i,o,a,s,c,l){const u=s-c/2,f=i.split(",").map(_=>+_+a),h=o.split(",").map(_=>+_+a),p=e._xScale(n),d=e._xScale(r),g=d-p,y=s,b=[];let m=[p,y-mg/2,p+g,y-mg/2,p+g,y+mg/2,p,y+mg/2];t.drawPolygon(m),b.push(m);const v=2*c;for(let _=Math.max(e.position[0],p)+v;_<Math.min(e.position[0]+e.dimensions[0],p+g);_+=v)l==="+"?m=[_,y-vc/2,_+vc/2,y,_,y+vc/2]:m=[_,y-vc/2,_-vc/2,y,_,y+vc/2],b.push(m),t.drawPolygon(m);for(let _=0;_<f.length;_++){const T=f[_],w=h[_],S=e._xScale(T),k=Math.max(1,e._xScale(w)-e._xScale(T));let E=p,P=d;const C=e.geneRectHeight/2;let I=null;l==="+"?(P=d-C,I=[Math.min(S,P),u,Math.min(S+k,P),u,Math.min(S+k,P),u+c,Math.min(S,P),u+c,Math.min(S,P),u]):(E=p+C,I=[Math.max(S,E),u,Math.max(S+k,E),u,Math.max(S+k,E),u+c,Math.max(S,E),u+c,Math.max(S,E),u]),b.push(I),t.drawPolygon(I)}return b}function Z_e(e,t,n,r,i,o,a,s,c){const l=s-c/2;e.forEach(u=>{const f=t._xScale(u.xStart),h=t._xScale(u.xEnd),p=new Ye.PIXI.Graphics;n.rectGraphics.addChild(p),p.beginFill(o,a),p.interactive=!0,p.buttonMode=!0,p.mouseup=y=>j5(y,t,u);const d=t.geneRectHeight/2;let g=[];if(u.strand==="+"||u.fields[5]==="+"){const y=Math.max(f,h-d),b=y+d;g=[y,l,b,l+t.geneRectHeight/2,y,l+t.geneRectHeight]}else{const y=Math.min(h,f+d),b=y-d;g=[y,l,b,l+t.geneRectHeight/2,y,l+t.geneRectHeight]}p.drawPolygon(g),n.allRects.push([g,u.strand,u])})}function Q_e(e,t,n,r,i,o,a,s,c){e.forEach(l=>{const u=l.fields,f=+l.chrOffset,h=u[12],p=u[13],d=new Ye.PIXI.Graphics;n.rectGraphics.addChild(d),d.beginFill(o,a),d.interactive=!0,d.buttonMode=!0,d.mouseup=g=>j5(g,t,l),n.allRects=n.allRects.concat(K_e(t,d,l.xStart,l.xEnd,h,p,f,s,c,l.strand||l.fields[5]).map(g=>[g,l.strand,l]))})}function cj(e,t,n,r,i,o,a,s,c){Z_e(e,t,n,r,i,o,a,s,c),Q_e(e,t,n,r,i,o,a,s,c)}function J_e(e,t){const{tileX:n,tileWidth:r}=mf.getTilePosAndDimensions(e.tilesetInfo,t.tileId);t.rectMaskGraphics.clear();const i=Math.floor(Math.random()*16**6);t.rectMaskGraphics.beginFill(i,.3);const o=e._xScale(n),a=0,s=e._xScale(n+r)-e._xScale(n),c=e.dimensions[1];t.rectMaskGraphics.drawRect(o,a,s,c)}let B5=function(e){function t(n,r){var i;D_e(this,t),i=B_e(this,t,[n,r]);const{animate:o}=n;return i.animate=o,i.options=r,i.fontSize=+i.options.fontSize||oj,i.geneLabelPos=i.options.geneLabelPosition||aj,i.geneRectHeight=+i.options.geneAnnotationHeight||N5,i.geneRectHeight-=2,i.geneStrandSpacing=+i.options.geneStrandSpacing||U_e,i.geneStrandHSpacing=i.geneStrandSpacing/2,i.geneRectHHeight=i.geneRectHeight/2,i}return q_e(t,e),L_e(t,[{key:"initTile",value:function(r){X_e(this,r,{flipText:this.flipText,fontSize:this.fontSize,fontFamily:D5,plusStrandColor:this.options.plusStrandColor,minusStrandColor:this.options.minusStrandColor,maxGeneEntries:W_e,maxFillerEntries:Y_e,maxTexts:V_e}),this.renderTile(r)}},{key:"destroyTile",value:function(r){r.rectGraphics.destroy(),r.rectMaskGraphics.destroy(),r.textGraphics.destroy(),r.textBgGraphics.destroy(),r.graphics.destroy()}},{key:"rerender",value:function(r,i){const o=JSON.stringify(r);!i&&o===this.prevOptions||(gc(t,"rerender",this,3)([r,i]),this.fontSize=+this.options.fontSize||oj,this.geneLabelPos=this.options.geneLabelPosition||aj,this.geneRectHeight=+this.options.geneAnnotationHeight||N5,this.geneStrandHSpacing=this.geneStrandSpacing/2,this.geneRectHHeight=this.geneRectHeight/2,this.prevOptions=o,this.visibleAndFetchedTiles().forEach(a=>{this.renderTile(a)}))}},{key:"drawTile",value:function(){}},{key:"geneId",value:function(r,i){return`${i}_${r[0]}_${r[1]}_${r[2]}_${r[3]}`}},{key:"renderTile",value:function(r){if(!r.initialized)return;r.allRects=[],r.drawnAtScale=this._xScale.copy(),r.rectGraphics.removeChildren(),r.rectGraphics.clear(),r.textBgGraphics.clear();const i={},o=.3,a=.3;i["+"]=gt(this.options.plusStrandColor||L5),i["-"]=gt(this.options.minusStrandColor||$5);let s=r.tileData.filter(y=>y.type==="filler"&&y.strand==="+"),c=r.tileData.filter(y=>y.type==="filler"&&y.strand==="-");const l=r.tileData.filter(y=>y.type!=="filler"&&(y.strand==="+"||y.fields[5]==="+")),u=r.tileData.filter(y=>y.type!=="filler"&&(y.strand==="-"||y.fields[5]==="-"));sj(l,s),sj(u,c),s=s.filter(y=>!y.hide),c=c.filter(y=>!y.hide);const f=this.dimensions[1]/2,h=f-this.geneRectHeight/2-this.geneStrandSpacing/2,p=f+this.geneRectHeight/2+this.geneStrandSpacing/2,d=[this,r,r.rectGraphics,this._xScale,i["+"],o,h,this.geneRectHeight],g=[this,r,r.rectGraphics,this._xScale,i["-"],o,p,this.geneRectHeight];lj(s,...d),lj(c,...g),d[5]=a,g[5]=a,cj(l,...d),cj(u,...g),J_e(this,r),mf.stretchRects(this,[y=>y.rectGraphics,y=>y.rectMaskGraphics]);for(const y of Object.values(r.texts))y.style={fontSize:`${this.fontSize}px`,FONT_FAMILY:D5,fill:gt(y.strand==="-"?this.options.minusStrandColor||$5:this.options.plusStrandColor||L5)}}},{key:"calculateZoomLevel",value:function(){const r=wt.calculateZoomLevel(this._xScale,this.tilesetInfo.min_pos[0],this.tilesetInfo.max_pos[0]);let i=Math.min(r,this.maxZoom);return i=Math.max(i,0),i}},{key:"draw",value:function(){gc(t,"draw",this,3)([]),this.allTexts=[],this.allBoxes=[];const r=[];this.geneAreaHeight=this.geneRectHeight;const i=this.fontSize/2;mf.stretchRects(this,[o=>o.rectGraphics,o=>o.rectMaskGraphics]),Object.values(this.fetchedTiles).filter(o=>o.drawnAtScale).forEach(o=>{o.textBgGraphics.clear(),o.textBgGraphics.beginFill(typeof this.options.labelBackgroundColor<"u"?gt(this.options.labelBackgroundColor):G_e);const a=this.parentInFetched(o);o.initialized&&o.tileData.forEach(s=>{if(!o.texts||s.type==="filler")return;const c=s.fields,l=c[3],u=this.geneId(c,s.type),f=o.texts[u];if(!f)return;const h=+s.chrOffset,p=+c[1]+h,d=+c[2]+h,g=(p+d)/2;let y=this.dimensions[1]/2;const b=(this.geneAreaHeight-this.fontSize)/2;if(c[5]==="+"?y-=this.geneLabelPos==="inside"?b+this.geneStrandSpacing-2:this.fontSize/2+this.geneAreaHeight-2:y+=this.geneLabelPos==="inside"?this.fontSize+this.geneStrandSpacing/2+b+1:1.5*this.fontSize+this.geneAreaHeight+2,f.position.x=this._xScale(g),f.position.y=y,!o.textWidths[u]){const m=f.getBounds().width,v=f.getBounds().height;o.textHeights[u]=v,o.textWidths[u]=m}if(a)f.visible=!1;else{f.visible=!0;const m=2;this.flipText?this.allBoxes.push([f.position.x-o.textHeights[u]/2-m,y-i-1,f.position.x+o.textHeights[u]/2+m,y+i-1,l]):this.allBoxes.push([f.position.x-o.textWidths[u]/2-m,y-i-1,f.position.x+o.textWidths[u]/2+m,y+i-1,l]),this.allTexts.push({importance:+c[4],text:f,caption:l,strand:c[5]}),r.push(o.textBgGraphics)}})}),this.hideOverlaps(this.allBoxes,this.allTexts),this.renderTextBg(this.allBoxes,this.allTexts,r)}},{key:"renderTextBg",value:function(r,i,o){i.forEach((a,s)=>{if(a.text.visible&&r[s]&&o[s]){const[c,l,u,f]=r[s],h=u-c,p=f-l;o[s].drawRect(c-h/2,l-p/2,h,p)}})}},{key:"hideOverlaps",value:function(r,i){Yf(r,(o,a)=>{i[o].importance>i[a].importance?i[a].text.visible=!1:i[o].text.visible=!1})}},{key:"setPosition",value:function(r){gc(t,"setPosition",this,3)([r]),[this.pMain.position.x,this.pMain.position.y]=this.position}},{key:"setDimensions",value:function(r){gc(t,"setDimensions",this,3)([r]),this.halfRectHHeight=this.dimensions[1]/2,this.visibleAndFetchedTiles().forEach(i=>{this.renderTile(i)})}},{key:"zoomed",value:function(r,i){this.xScale(r),this.yScale(i),this.refreshTiles(),this.draw()}},{key:"getMouseOverHtml",value:function(r,i){if(!this.tilesetInfo)return"";const o=[r,i];for(const a of this.visibleAndFetchedTiles())for(let s=0;s<a.allRects.length;s++){if(a.allRects[s][2].type==="filler")continue;const c=a.allRects[s][0].slice(0),l=[];for(;c.length;){const f=c.splice(0,2);f[0]=f[0]*a.rectGraphics.scale.x+a.rectGraphics.position.x,f[1]=f[1]*a.rectGraphics.scale.y+a.rectGraphics.position.y,l.push(f)}if(ME(l,o)===-1){const f=a.allRects[s][2];return`
282
282
  <div>
283
283
  <b>${f.fields[3]}</b><br>
@@ -297,7 +297,7 @@ ${o}`:o,"");if(this.errorText.text=r,this.errorText.alpha=.8,r?.length){const i=
297
297
  \r]`),n=e.charCodeAt(0);function r(f,h){var p,d,g=i(f,function(y,b){if(p)return p(y,b-1);d=y,p=h?c9e(y,h):kz(y)});return g.columns=d||[],g}function i(f,h){var p=[],d=f.length,g=0,y=0,b,m=d<=0,v=!1;f.charCodeAt(d-1)===kh&&--d,f.charCodeAt(d-1)===kk&&--d;function _(){if(m)return Sk;if(v)return v=!1,Ez;var w,S=g,k;if(f.charCodeAt(S)===Ek){for(;g++<d&&f.charCodeAt(g)!==Ek||f.charCodeAt(++g)===Ek;);return(w=g)>=d?m=!0:(k=f.charCodeAt(g++))===kh?v=!0:k===kk&&(v=!0,f.charCodeAt(g)===kh&&++g),f.slice(S+1,w-1).replace(/""/g,'"')}for(;g<d;){if((k=f.charCodeAt(w=g++))===kh)v=!0;else if(k===kk)v=!0,f.charCodeAt(g)===kh&&++g;else if(k!==n)continue;return f.slice(S,w)}return m=!0,f.slice(S,d)}for(;(b=_())!==Sk;){for(var T=[];b!==Ez&&b!==Sk;)T.push(b),b=_();h&&(T=h(T,y++))==null||p.push(T)}return p}function o(f,h){return f.map(function(p){return h.map(function(d){return u(p[d])}).join(e)})}function a(f,h){return h==null&&(h=xz(f)),[h.map(u).join(e)].concat(o(f,h)).join(`
298
298
  `)}function s(f,h){return h==null&&(h=xz(f)),o(f,h).join(`
299
299
  `)}function c(f){return f.map(l).join(`
300
- `)}function l(f){return f.map(u).join(e)}function u(f){return f==null?"":f instanceof Date?f9e(f):t.test(f+="")?'"'+f.replace(/"/g,'""')+'"':f}return{parse:r,parseRows:i,format:a,formatBody:s,formatRows:c,formatRow:l,formatValue:u}}var h9e=Cz(","),p9e=h9e.parse,d9e=Cz(" "),g9e=d9e.parse;function Oz(e,t){return function(n,r,i){arguments.length<3&&(i=r,r=null);var o=wk(n).mimeType(e);return o.row=function(a){return arguments.length?o.response(m9e(t,r=a)):r},o.row(r),i?o.get(i):o}}function m9e(e,t){return function(n){return e(n.responseText,t)}}const v9e=Oz("text/csv",p9e),y9e=Oz("text/tab-separated-values",g9e),b9e=Object.freeze(Object.defineProperty({__proto__:null,csv:v9e,html:o9e,json:a9e,request:wk,text:s9e,tsv:y9e,xml:l9e},Symbol.toStringTag,{value:"Module"}));function _9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T9e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,S9e(r.key),r)}}function w9e(e,t,n){return t&&T9e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function S9e(e){var t=E9e(e,"string");return typeof t=="symbol"?t:t+""}function E9e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function k9e(e,t,n){return t=im(t),x9e(e,Pz()?Reflect.construct(t,n||[],im(e).constructor):t.apply(e,n))}function x9e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return C9e(e)}function C9e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Pz=function(){return!!e})()}function im(e){return im=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},im(e)}function O9e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xk(e,t)}function xk(e,t){return xk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},xk(e,t)}const om={pointerEvents:"all"};let Az=function(e){function t(){return _9e(this,t),k9e(this,t,arguments)}return O9e(t,e),w9e(t,[{key:"getControls",value:function(r){return x.createElement(Qd,{expandCollapseAvailable:!0,dragHandleProps:this.props.dragHandleProps,imgStyleAdd:om,imgStyleClose:om,imgStyleMove:om,imgStyleSettings:om,isAlignLeft:this.props.controlAlignLeft,isCollapsed:this.props.isCollapsed,isMoveable:this.moveable,isVertical:!0,isVisible:r,onAddSeries:this.props.onAddSeries,onCollapseTrack:this.props.onCollapseTrack,onExpandTrack:this.props.onExpandTrack,onCloseTrackMenuOpened:this.props.onCloseTrackMenuOpened,onConfigTrackMenuOpened:this.props.onConfigTrackMenuOpened,uid:this.props.uid})}}])}(Y1);function P9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A9e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,I9e(r.key),r)}}function M9e(e,t,n){return t&&A9e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function I9e(e){var t=R9e(e,"string");return typeof t=="symbol"?t:t+""}function R9e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function D9e(e,t,n){return t=Fc(t),N9e(e,Mz()?Reflect.construct(t,n||[],Fc(e).constructor):t.apply(e,n))}function N9e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return L9e(e)}function L9e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Mz=function(){return!!e})()}function $9e(e,t,n,r){var i=Ck(Fc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function Ck(){return Ck=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=j9e(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Ck.apply(null,arguments)}function j9e(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Fc(e))!==null;);return e}function Fc(e){return Fc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fc(e)}function B9e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ok(e,t)}function Ok(e,t){return Ok=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ok(e,t)}let z9e=function(e){function t(n,r){var i;P9e(this,t),i=D9e(this,t,[n,r]);const{registerViewportChanged:o,removeViewportChanged:a}=n,s=Mt.nice();return i.uid=s,i.removeViewportChanged=a,i.viewportXDomain=null,i.viewportYDomain=null,o(s,i.viewportChanged.bind(i)),i}return B9e(t,e),M9e(t,[{key:"viewportChanged",value:function(r,i){const o=r.domain(),a=i.domain();this.viewportXDomain=o,this.viewportYDomain=a,this.draw()}},{key:"draw",value:function(){const r=this.pMain;if(!this.viewportXDomain||!this.viewportYDomain)return;r.clear(),r.lineStyle(1,255,1),r.beginFill(16740363,1);const i=this._xScale(this.viewportXDomain[0]),o=this._yScale(this.viewportYDomain[0]),a=this._xScale(this.viewportXDomain[1])-this._xScale(this.viewportXDomain[0]),s=this._yScale(this.viewportYDomain[1])-this._yScale(this.viewportYDomain[0]);this.pMain.drawRect(i,o,a,s)}},{key:"zoomed",value:function(r,i){this.xScale(r),this.yScale(i),this.draw()}},{key:"setPosition",value:function(r){$9e(t,"setPosition",this)([r]),this.pMain.position.y=this.position[1],this.pMain.position.x=this.position[0],this.draw()}}])}(Bn);function Iz(e){this.size=0,this.limit=e,this._keymap={}}function H9e(e,t){const n={key:e,value:t};if(this._keymap[e]=n,this.tail?(this.tail.newer=n,n.older=this.tail):this.head=n,this.tail=n,this.size===this.limit)return this.shift();this.size+=1}function F9e(){const e=this.head;return e&&(this.head.newer?(this.head=this.head.newer,this.head.older=void 0):(this.head=void 0,this.tail=void 0),e.newer=void 0,e.older=void 0,delete this._keymap[e.key],this.size-=1),e}function q9e(e,t){const n=this._keymap[e];if(n!==void 0)return n===this.tail||(n.newer&&(n===this.head&&(this.head=n.newer),n.newer.older=n.older),n.older&&(n.older.newer=n.newer),n.newer=void 0,n.older=this.tail,this.tail&&(this.tail.newer=n),this.tail=n),t?n:n.value}function U9e(e){return this._keymap[e]}function V9e(e,t){const n=this.get(e,!0);let r;return n?(r=n.value,n.value=t):(r=this.put(e,t),r&&(r=r.value)),r}function G9e(e){const t=this._keymap[e];if(t)return delete this._keymap[t.key],t.newer&&t.older?(t.older.newer=t.newer,t.newer.older=t.older):t.newer?(t.newer.older=void 0,this.head=t.newer):t.older?(t.older.newer=void 0,this.tail=t.older):(this.head=void 0,this.tail=void 0),this.size-=1,t.value}function W9e(){this.head=void 0,this.tail=void 0,this.size=0,this._keymap={}}function Y9e(){return Object.keys(this._keymap)}function X9e(e,t,n){let r;if(t===!0?(n=!0,t=void 0):typeof t!="object"&&(t=this),n)for(r=this.tail;r;)e.call(t,r.key,r.value,this),r=r.older;else for(r=this.head;r;)e.call(t,r.key,r.value,this),r=r.newer}function K9e(){const e=[];let t=this.head;for(;t;)e.push({key:t.key.toJSON(),value:t.value.toJSON()}),t=t.newer;return e}function Z9e(){let e="",t=this.head;for(;t;)e+=`${String(t.key)}:${t.value}`,t=t.newer,t&&(e+=" < ");return e}Object.assign(Iz.prototype,{put:H9e,get:q9e,find:U9e,keys:Y9e,set:V9e,shift:F9e,remove:G9e,removeAll:W9e,forEach:X9e,toJSON:K9e,toString:Z9e});const Pk="2.3.1",Rz={...NX,IS_TRACK_RANGE_SELECTABLE:$s,OPTIONS_INFO:zi},Q9e={d3Array:pq,d3Axis:W0e,d3Brush:Rne,d3Color:Cq,d3Drag:hJ,d3Dsv:cX,d3Format:tU,d3Geo:J5e,d3Queue:Ate,d3Request:b9e,d3Scale:AV,d3Selection:fW,d3Transition:xee,d3Zoom:Ree,PIXI:Rz.GLOBALS.PIXI,mix:ul,slugid:Mt},am={chromosomes:{ChromosomeInfo:yo,SearchField:iw},libraries:Q9e,tracks:{Annotations1dTrack:K$,Annotations2dTrack:Q$,ArrowheadDomainsTrack:tj,BarTrack:m5,BedLikeTrack:WE,CNVIntervalTrack:nj,Chromosome2DAnnotations:gj,Chromosome2DLabels:vj,ChromosomeGrid:th,CombinedTrack:b0,CrossRule:Yj,DivergentBarTrack:B$,HeatmapTiledPixiTrack:Ql,Horizontal1dHeatmapTrack:H$,Horizontal2DDomainsTrack:hj,HorizontalChromosomeLabels:Tj,HorizontalGeneAnnotationsTrack:B5,HorizontalHeatmapTrack:xj,HorizontalLine1DPixiTrack:ac,HorizontalMultivecTrack:U$,HorizontalPoint1DPixiTrack:G$,HorizontalRule:tB,HorizontalTiled1DPixiTrack:Yl,HorizontalTiledPlot:eg,HorizontalTrack:yL,Id2DTiledPixiTrack:g$,IdHorizontal1DTiledPixiTrack:v$,IdVertical1DTiledPixiTrack:T$,LeftAxisTrack:O$,MapboxTilesTrack:iB,MoveableTrack:Y1,OSMTileIdsTrack:aB,OSMTilesTrack:ih,OverlayTrack:M$,PixiTrack:Bn,RasterTilesTrack:lB,SVGTrack:ko,SquareMarkersTrack:Ej,Tiled1DPixiTrack:zE,TiledPixiTrack:Si,TopAxisTrack:D$,Track:Ja,ValueIntervalTrack:Aj,VerticalRule:Vj,VerticalTiled1DPixiTrack:b$,VerticalTrack:Az,ViewportTracker2D:Ij,ViewportTracker2DPixi:z9e,ViewportTrackerHorizontal:c9,ViewportTrackerVertical:Nj},dataFetchers:{DataFetcher:Xf,GBKDataFetcher:KL,LocalDataFetcher:ZL,getDataFetcher:zEe},factories:{ContextMenuItem:xt,DataFetcher:Xf,LruCache:Iz},services:fte,utils:Kee,configs:Rz,VERSION:Pk},Ak={"track-renderer":"_track-renderer_11dwb_1","track-renderer-element":"_track-renderer-element_11dwb_5","track-renderer-events":"_track-renderer-events_11dwb_6"};function J9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function eke(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,rke(r.key),r)}}function tke(e,t,n){return t&&eke(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function rke(e){var t=nke(e,"string");return typeof t=="symbol"?t:t+""}function nke(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function ike(e,t,n){return t=sm(t),oke(e,Dz()?Reflect.construct(t,n||[],sm(e).constructor):t.apply(e,n))}function oke(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ake(e)}function ake(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Dz=function(){return!!e})()}function sm(e){return sm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},sm(e)}function ske(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Mk(e,t)}function Mk(e,t){return Mk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Mk(e,t)}const{getDataFetcher:lke}=am.dataFetchers,cke=100;let Ik=function(e){function t(n){var r;if(J9e(this,t),r=ike(this,t,[n]),r.dragging=!1,r.element=null,r.eventTracker=null,r.eventTrackerOld=null,r.closing=!1,r.yPositionOffset=0,r.xPositionOffset=0,r.scrollTop=0,r.scrollTimeout=null,r.activeTransitions=0,r.zoomTransform=Ar,r.windowScrolledBound=r.windowScrolled.bind(r),r.zoomStartedBound=r.zoomStarted.bind(r),r.zoomedBound=r.zoomed.bind(r),r.zoomEndedBound=r.zoomEnded.bind(r),r.uid=Mt.nice(),r.viewUid=r.props.uid,r.availableForPlugins={...am,services:{...am.services,pubSub:r.props.pubSub,pixiRenderer:r.props.pixiRenderer}},r.mounted=!1,r.emptyZoomBehavior=UT(),r.currentProps=n,r.prevPropsStr="",r.zoomBehavior=UT().filter(i=>!(i.target.classList.contains("no-zoom")||i.target.classList.contains("react-resizable-handle"))).on("start",r.zoomStartedBound).on("zoom",r.zoomedBound).on("end",r.zoomEndedBound),r.zoomTransform=Ar,r.prevZoomTransform=Ar,r.initialXDomain=[0,1],r.initialYDomain=[0,1],r.xDomainLimits=[-Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],r.yDomainLimits=[-Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],r.zoomLimits=[0,Number.MAX_SAFE_INTEGER],r.prevCenterX=r.currentProps.paddingLeft+r.currentProps.leftWidth+r.currentProps.centerWidth/2,r.prevCenterY=r.currentProps.paddingTop+r.currentProps.topHeight+r.currentProps.centerHeight/2,r.cumCenterXOffset=0,r.cumCenterYOffset=0,r.setUpInitialScales(r.currentProps.initialXDomain,r.currentProps.initialYDomain,r.currentProps.xDomainLimits,r.currentProps.yDomainLimits,r.currentProps.zoomLimits),r.setUpScales(),r.trackDefObjects={},r.metaTracks={},r.pubSubs=[],window.higlassTracksByType)for(const i in window.higlassTracksByType)Gt[i]=window.higlassTracksByType[i].config;return r.boundForwardEvent=r.forwardEvent.bind(r),r.boundScrollEvent=r.scrollEvent.bind(r),r.boundForwardContextMenu=r.forwardContextMenu.bind(r),r.dispatchEventBound=r.dispatchEvent.bind(r),r.zoomToDataPosHandlerBound=r.zoomToDataPosHandler.bind(r),r.onScrollHandlerBound=r.onScrollHandler.bind(r),r.elementPos={height:0,width:0,left:0,top:0},r.elementSelection=null,r}return ske(t,e),tke(t,[{key:"xScale",get:function(){if(!this._xScale)throw new Error("xScale is not defined");return this._xScale}},{key:"yScale",get:function(){if(!this._yScale)throw new Error("yScale is not defined");return this._yScale}},{key:"UNSAFE_componentWillMount",value:function(){this.pubSubs=[],this.pubSubs.push(this.props.pubSub.subscribe("scroll",this.windowScrolledBound)),this.pubSubs.push(this.props.pubSub.subscribe("app.event",this.dispatchEventBound)),this.pubSubs.push(this.props.pubSub.subscribe("zoomToDataPos",this.zoomToDataPosHandlerBound)),this.pubSubs.push(this.props.pubSub.subscribe("app.scroll",this.onScrollHandlerBound))}},{key:"componentDidMount",value:function(){if(!this.element)throw new Error("Component did not mount, this.element is not defined.");if(this.elementPos=this.element.getBoundingClientRect(),this.elementSelection=_t(this.element),this.pStage=new Ye.PIXI.Graphics,this.pMask=new Ye.PIXI.Graphics,this.pOutline=new Ye.PIXI.Graphics,this.pBackground=new Ye.PIXI.Graphics,this.pStage.addChild(this.pMask),this.pStage.addChild(this.pOutline),this.currentProps.pixiStage.addChild(this.pStage),this.pStage.mask=this.pMask,this.props.isRangeSelection||this.addZoom(),!this.currentProps.svgElement||!this.currentProps.canvasElement)return;this.svgElement=this.currentProps.svgElement,this.syncTrackObjects(this.currentProps.positionedTracks),this.syncMetaTracks(this.currentProps.metaTracks),this.currentProps.setCentersFunction(this.setCenter.bind(this)),this.currentProps.registerDraggingChangedListener(this.draggingChanged.bind(this)),this.draggingChanged(!0),this.addEventTracker();const r=[[this.xScale(this.xDomainLimits[0]),this.yScale(this.yDomainLimits[0])],[this.xScale(this.xDomainLimits[1]),this.yScale(this.yDomainLimits[1])]],i=this.svgElement.getBoundingClientRect(),o=[[Math.max(r[0][0],0),Math.max(r[0][1],0)],[Math.min(r[1][0],i.width),Math.min(r[1][1],i.height)]];this.zoomBehavior.extent(o).translateExtent(r).scaleExtent(this.zoomLimits)}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){if(!r.svgElement||!r.canvasElement)return;const i=this.updatablePropsToString(r);if(this.currentProps=r,this.prevPropsStr===i)return;this.setBackground();for(const c in this.trackDefObjects){const l=this.trackDefObjects[c].trackObject;l.delayDrawing=!0}this.prevPropsStr=i,this.setUpInitialScales(r.initialXDomain,r.initialYDomain,r.xDomainLimits,r.yDomainLimits,r.zoomLimits),this.setUpScales(r.width!==this.props.width||r.height!==this.props.height),this.svgElement=r.svgElement;const o=[[this.xScale(this.xDomainLimits[0]),this.yScale(this.yDomainLimits[0])],[this.xScale(this.xDomainLimits[1]),this.yScale(this.yDomainLimits[1])]],a=this.svgElement.getBoundingClientRect(),s=[[Math.max(o[0][0],0),Math.max(o[0][1],0)],[Math.min(o[1][0],a.width),Math.min(o[1][1],a.height)]];this.zoomBehavior.extent(s).translateExtent(o).scaleExtent(this.zoomLimits),this.syncTrackObjects(r.positionedTracks),this.syncMetaTracks(r.metaTracks);for(const c of r.positionedTracks){const l=c.track.options,u=this.trackDefObjects[c.track.uid].trackObject;if(u.rerender(l),Pu(c.track)){const f={};for(const h of c.track.contents)f[h.uid]=h;for(const h in u.createdTracks)u.createdTracks[h].rerender(f[h].options)}}this.props.onNewTilesLoaded();for(const c in this.trackDefObjects){const l=this.trackDefObjects[c].trackObject;l.delayDrawing=!1,l.draw()}}},{key:"componentDidUpdate",value:function(r){(this.props.initialXDomain[0]!==r.initialXDomain[0]||this.props.initialXDomain[1]!==r.initialXDomain[1]||this.props.initialYDomain[0]!==r.initialYDomain[0]||this.props.initialYDomain[1]!==r.initialYDomain[1])&&this.element&&(this.element.__zoom=Ar),r.isRangeSelection!==this.props.isRangeSelection&&(this.props.isRangeSelection?this.removeZoom():this.addZoom()),r.zoomable!==this.props.zoomable&&(this.props.zoomable?this.addZoom():this.removeZoom()),this.addEventTracker()}},{key:"componentWillUnmount",value:function(){this.mounted=!1,this.removeTracks(Object.keys(this.trackDefObjects)),this.removeMetaTracks(Object.keys(this.metaTracks)),this.currentProps.removeDraggingChangedListener(this.draggingChanged),this.pStage&&this.currentProps.pixiStage.removeChild(this.pStage),this.pMask?.destroy(!0),this.pStage?.destroy(!0),this.pubSubs.forEach(r=>this.props.pubSub.unsubscribe(r)),this.pubSubs=[],this.removeEventTracker()}},{key:"dispatchEvent",value:function(r){r.sourceUid===this.uid&&r.type!=="contextmenu"&&this.element&&Lp(r,this.element)}},{key:"isWithin",value:function(r,i){const o=r>=this.elementPos.left&&r<=this.elementPos.width+this.elementPos.left,a=i>=this.elementPos.top&&i<=this.elementPos.height+this.elementPos.top;return o&&a}},{key:"zoomToDataPosHandler",value:function({pos:r,animateTime:i}){this.zoomToDataPos(...r,i)}},{key:"addZoom",value:function(){!this.elementSelection||!this.currentProps.zoomable||(this.elementSelection.call(this.zoomBehavior),this.zoomBehavior.transform(this.elementSelection,this.zoomTransform))}},{key:"removeZoom",value:function(){this.elementSelection&&(this.zoomEnded(),this.elementSelection.on(".zoom",null))}},{key:"setMask",value:function(){this.pMask?.clear(),this.pMask?.beginFill(),this.pMask?.drawRect(this.xPositionOffset,this.yPositionOffset,this.currentProps.width,this.currentProps.height),this.pMask?.endFill()}},{key:"setBackground",value:function(){const r=this.props.theme===Qt?"black":"white",i=gt(this.currentProps.viewOptions?.backgroundColor??r);this.pBackground?.clear(),this.pBackground?.beginFill(i),this.pBackground?.drawRect(this.xPositionOffset,this.yPositionOffset,this.currentProps.width,this.currentProps.height),this.pBackground?.endFill()}},{key:"windowScrolled",value:function(){this.removeZoom(),this.scrollTimeout&&clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(()=>{this.addZoom()},cke)}},{key:"setUpInitialScales",value:function(r=[0,1],i=[0,1],o=[-Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],a=[-Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],s=[0,Number.MAX_SAFE_INTEGER]){s[0]=s[0]===null?0:s[0],s[1]=s[1]===null?Number.POSITIVE_INFINITY:s[1];const c=r[1]-r[0],l=(i[0]+i[1])/2;if(i[0]=l-c/2,i[1]=l+c/2,r[0]===this.initialXDomain[0]&&r[1]===this.initialXDomain[1]&&i[0]===this.initialYDomain[0]&&i[1]===this.initialYDomain[1]&&o[0]===this.xDomainLimits[0]&&o[1]===this.xDomainLimits[1]&&a[0]===this.yDomainLimits[0]&&a[1]===this.yDomainLimits[1]&&s[0]===this.zoomLimits[0]&&s[1]===this.zoomLimits[1])return;this.initialXDomain=r,this.initialYDomain=i,this.xDomainLimits=o,this.yDomainLimits=a,this.zoomLimits=s,this.zoomTransform=Ar,this.prevZoomTransform=Ar,this.cumCenterYOffset=0,this.cumCenterXOffset=0,this.drawableToDomainX=Et().domain([this.currentProps.paddingLeft+this.currentProps.leftWidth,this.currentProps.paddingLeft+this.currentProps.leftWidth+this.currentProps.centerWidth]).range([r[0],r[1]]);let u,f;this.currentProps.centerWidth===0?(u=this.currentProps.paddingTop+this.currentProps.topHeight,f=this.currentProps.paddingTop+this.currentProps.topHeight+this.currentProps.centerHeight):(u=this.currentProps.paddingTop+this.currentProps.topHeight+this.currentProps.centerHeight/2-this.currentProps.centerWidth/2,f=this.currentProps.paddingTop+this.currentProps.topHeight+this.currentProps.centerHeight/2+this.currentProps.centerWidth/2),this.drawableToDomainY=Et().domain([u,f]).range([i[0],i[1]]),this.prevCenterX=this.currentProps.paddingLeft+this.currentProps.leftWidth+this.currentProps.centerWidth/2,this.prevCenterY=this.currentProps.paddingTop+this.currentProps.topHeight+this.currentProps.centerHeight/2}},{key:"updatablePropsToString",value:function(r){return JSON.stringify({positionedTracks:r.positionedTracks,initialXDomain:r.initialXDomain,initialYDomain:r.initialYDomain,width:r.width,height:r.height,paddingLeft:r.paddingLeft,paddingTop:r.paddingTop,leftWidth:r.leftWidth,topHeight:r.topHeight,dragging:r.dragging,viewOptions:r.viewOptions})}},{key:"draggingChanged",value:function(r){this.dragging=r,this.timedUpdatePositionAndDimensions()}},{key:"setUpScales",value:function(r=!1){const i=this.currentProps.paddingLeft+this.currentProps.leftWidth+this.currentProps.centerWidth/2,o=this.currentProps.paddingTop+this.currentProps.topHeight+this.currentProps.centerHeight/2;if(!this.drawableToDomainX||!this.drawableToDomainY)return;const a=(this.drawableToDomainX(i)-this.drawableToDomainX(this.prevCenterX))/this.zoomTransform.k,s=(this.drawableToDomainY(o)-this.drawableToDomainY(this.prevCenterY))/this.zoomTransform.k;this.cumCenterYOffset+=s,this.cumCenterXOffset+=a,this.prevCenterY=o,this.prevCenterX=i;const c=[this.drawableToDomainX(0)-this.cumCenterXOffset,this.drawableToDomainX(this.currentProps.width)-this.cumCenterXOffset],l=[this.drawableToDomainY(0)-this.cumCenterYOffset,this.drawableToDomainY(this.currentProps.height)-this.cumCenterYOffset];this._xScale=Et().domain(c).range([0,this.currentProps.width]),this._yScale=Et().domain(l).range([0,this.currentProps.height]);for(const u in this.trackDefObjects)this.trackDefObjects[u].trackObject.refScalesChanged(this.xScale,this.yScale);this.applyZoomTransform(r)}},{key:"getTrackDef",value:function(r){const i=Yn(this.trackDefObjects);for(const[,{trackDef:o,trackObject:a}]of i){if(a===r)return o.track;if(Pu(o.track)){for(const s of o.track.contents)if(a.createdTracks[s.uid]===r)return s}}return null}},{key:"getTrackObject",value:function(r){const i=Yn(this.trackDefObjects);for(let o=0;o<i.length;o++){const a=i[o][0],s=i[o][1].trackObject;if(a===r)return s;if(s.createdTracks){const c=Yn(s.createdTracks);for(let l=0;l<c.length;l++){const u=c[l][0],f=c[l][1];if(u===r)return f}}}}},{key:"timedUpdatePositionAndDimensions",value:function(){this.closing||!this.element||(this.elementPos=this.element.getBoundingClientRect(),this.dragging&&(this.yPositionOffset=this.element.getBoundingClientRect().top-this.currentProps.canvasElement.getBoundingClientRect().top+this.scrollTop,this.xPositionOffset=this.element.getBoundingClientRect().left-this.currentProps.canvasElement.getBoundingClientRect().left,this.setMask(),this.setBackground(),this.updateTrackPositions()&&this.applyZoomTransform(!0),requestAnimationFrame(this.timedUpdatePositionAndDimensions.bind(this))))}},{key:"syncMetaTracks",value:function(r){const i=Object.keys(this.metaTracks),o=new Set(r.map(a=>a.uid));this.addMetaTracks(r.filter(a=>!this.metaTracks[a.uid])),this.updateMetaTracks(r.filter(a=>this.metaTracks[a.uid])),this.removeMetaTracks(i.filter(a=>!o.has(a)))}},{key:"syncTrackObjects",value:function(r){this.prevTrackDefinitions=JSON.stringify(r);const i={};for(let u=0;u<r.length;u++)i[r[u].track.uid]=r[u];const o=new Set(Object.keys(this.trackDefObjects)),a=new Set(Object.keys(i)),s=new Set([...a].filter(u=>!o.has(u))),c=new Set([...o].filter(u=>!a.has(u))),l=new Set([...a].filter(u=>o.has(u)));this.updateExistingTrackDefs([...l].map(u=>i[u])),this.addNewTracks([...s].map(u=>i[u])),this.updateExistingTrackDefs([...s].map(u=>i[u])),this.removeTracks([...c])}},{key:"addMetaTracks",value:function(r){r.filter(i=>!this.metaTracks[i.uid]).forEach(i=>{this.metaTracks[i.uid]={trackDef:i,trackObject:this.createMetaTrack(i)}})}},{key:"addNewTracks",value:function(r){if(this.currentProps.pixiStage){for(let i=0;i<r.length;i++){const o=r[i],a=this.createTrackObject(o.track);a.refScalesChanged(this.xScale,this.yScale),this.trackDefObjects[o.track.uid]={trackDef:o,trackObject:a};const s=this.zoomTransform.rescaleX(this.xScale),c=this.zoomTransform.rescaleY(this.yScale);a.setDimensions([o.width,o.height]),a.zoomed(s,c)}this.applyZoomTransform(!1)}}},{key:"updateMetaTracks",value:function(r){}},{key:"updateExistingTrackDefs",value:function(r){for(const o of r){const a=this.trackDefObjects[o.track.uid];a.trackDef=o,Pu(o.track)&&a.trackObject.updateContents(o.track.contents,this.createTrackObject.bind(this)).refScalesChanged(this.xScale,this.yScale)}this.updateTrackPositions()&&this.applyZoomTransform(!1)}},{key:"updateTrackPositions",value:function(){let r=!1;for(const i in this.trackDefObjects){const o=this.trackDefObjects[i].trackDef,a=this.trackDefObjects[i].trackObject,s=a.position,c=a.dimensions,l=[this.xPositionOffset+o.left,this.yPositionOffset+o.top],u=[o.width,o.height];(!s||l[0]!==s[0]||l[1]!==s[1])&&(a.setPosition(l),r=!0),(!c||u[0]!==c[0]||u[1]!==c[1])&&(a.setDimensions(u),r=!0)}return r}},{key:"removeMetaTracks",value:function(r){r.forEach(i=>{this.metaTracks[i].trackObject.remove(),this.metaTracks[i]=void 0,delete this.metaTracks[i]})}},{key:"removeTracks",value:function(r){for(let i=0;i<r.length;i++)this.trackDefObjects[r[i]].trackObject.remove(),delete this.trackDefObjects[r[i]]}},{key:"setCenter",value:function(r,i,o,a=!1,s=0,c=this.xScale,l=this.yScale){const f=(this.xScale.invert(1)-this.xScale.invert(0))/o,h=this.currentProps.paddingLeft+this.currentProps.leftWidth+this.currentProps.centerWidth/2,p=this.currentProps.paddingTop+this.currentProps.topHeight+this.currentProps.centerHeight/2,d=h-c(r)*f,g=p-l(i)*f;let y;const b=()=>{const m=Ar.translate(d,g).scale(f);this.zoomTransform=m,this.elementSelection&&this.emptyZoomBehavior.transform(this.elementSelection,m),y=this.applyZoomTransform(a)};if(s&&this.elementSelection){let m=this.elementSelection;this.activeTransitions+=1,document.hidden||(m=m.transition().duration(s)),m.call(this.zoomBehavior.transform,Ar.translate(d,g).scale(f)).on("end",()=>{b(),this.activeTransitions-=1})}else b();return y}},{key:"valueScaleMove",value:function(r){if(this.zoomStartPos){for(const i of this.getTracksAtPosition(...this.zoomStartPos))i.movedY(r);this.zoomStartTransform&&(this.zoomTransform=this.zoomStartTransform)}}},{key:"valueScaleZoom",value:function(r,i){if(!FX(r.sourceEvent))return;const o=r.sourceEvent.deltaY,a=r.sourceEvent.deltaMode,c=((u,f)=>u*(f?120:1)/500)(o,a),l=Xt(r.sourceEvent,this.props.canvasElement);for(const u of this.getTracksAtPosition(...l)){const f=i==="1d-horizontal"?l[1]-u.position[1]:l[0]-u.position[0];u.zoomedY(f,2**c)}this.zoomStartTransform&&(this.zoomTransform=this.zoomStartTransform)}},{key:"zoomed",value:function(r){let i=null;if(this.zoomStartPos){const a=this.getTracksAtPosition(...this.zoomStartPos);if(a.length){const s=a[0],c=this.getTrackDef(s);if(!c)return;Gt[c.type]?.orientation&&(i=Gt[c.type].orientation),s instanceof uj&&(i="1d-vertical")}}if(i&&r.sourceEvent){if(r.shiftKey||this.valueScaleZooming){if(r.sourceEvent.deltaY!==void 0){this.valueScaleZoom(r,i);return}i==="1d-horizontal"?this.valueScaleMove(r.sourceEvent.movementY):i==="1d-vertical"&&this.valueScaleMove(r.sourceEvent.movementX)}i==="1d-horizontal"&&r.sourceEvent.movementY?this.valueScaleMove(r.sourceEvent.movementY):i==="1d-vertical"&&r.sourceEvent.movementX&&this.valueScaleMove(r.sourceEvent.movementX)}this.zoomTransform=this.currentProps.zoomable?r.transform:Ar,this.prevZoomTransform.k!==this.zoomTransform.k||(i==="1d-horizontal"?this.zoomTransform=Ar.translate(this.zoomTransform.x,this.prevZoomTransform.y).scale(this.zoomTransform.k):i==="1d-vertical"&&(this.zoomTransform=Ar.translate(this.prevZoomTransform.x,this.zoomTransform.y).scale(this.zoomTransform.k)),this.element&&(this.element.__zoom=this.zoomTransform)),this.applyZoomTransform(!0),this.prevZoomTransform=this.zoomTransform,this.props.pubSub.publish("app.zoom",r),r.sourceEvent&&(r.sourceEvent.stopPropagation(),r.sourceEvent.preventDefault())}},{key:"getTracksAtPosition",value:function(r,i){const o=[];let a=[];for(const s in this.trackDefObjects){const c=this.trackDefObjects[s].trackObject;c.childTracks?a=a.concat(c.childTracks):a.push(c)}for(const s of a){const c=s.position[0]<=r&&r<=s.position[0]+s.dimensions[0],l=s.position[1]<=i&&i<=s.position[1]+s.dimensions[1];c&&l&&o.push(s)}return o}},{key:"zoomStarted",value:function(r){this.zooming=!0,r?.sourceEvent&&(this.zoomStartPos=Xt(r.sourceEvent,this.props.canvasElement),r.sourceEvent.shiftKey&&(this.valueScaleZooming=!0)),this.zoomStartTransform=this.zoomTransform,this.props.pubSub.publish("app.zoomStart")}},{key:"zoomEnded",value:function(){this.zooming=!1,this.zoomStartPos=null,this.valueScaleZooming&&(this.valueScaleZooming=!1,this.element&&(this.element.__zoom=this.zoomStartTransform)),this.props.pubSub.publish("app.zoomEnd")}},{key:"applyZoomTransform",value:function(r=!0){const i=this.currentProps,o=i.paddingLeft+i.leftWidth,a=i.paddingTop+i.topHeight;if(!this.xScale||!this.yScale)return;this.zoomedXScale=this.zoomTransform.rescaleX(this.xScale),this.zoomedYScale=this.zoomTransform.rescaleY(this.yScale);const s=Et().domain([o,o+i.centerWidth].map(this.zoomedXScale.invert)).range([0,i.centerWidth]),c=Et().domain([a,a+i.centerHeight].map(this.zoomedYScale.invert)).range([0,i.centerHeight]);for(const l in this.trackDefObjects){const u=this.trackDefObjects[l].trackObject,f=this.trackDefObjects[l].trackDef;let h="unknown";if(Gt[f.track.type]&&(h=Gt[f.track.type].orientation),h==="whole"){const p=Et().domain([i.paddingLeft,i.width-i.paddingLeft].map(this.zoomedXScale.invert)).range([0,i.width-2*i.paddingLeft]),d=Et().domain([i.paddingTop,i.height-i.paddingTop].map(this.zoomedYScale.invert)).range([0,i.height-2*i.paddingTop]);u.zoomed(p,d);continue}if(this.trackDefObjects[l].trackDef.track.position==="gallery"){const p=Et().domain([i.paddingLeft+i.leftWidthNoGallery,i.paddingLeft+i.leftWidth+i.centerWidth+i.galleryDim].map(this.zoomedXScale.invert)).range([0,i.centerWidth+2*i.galleryDim]),d=Et().domain([i.paddingTop+i.topHeightNoGallery,i.paddingTop+i.topHeight+i.centerHeight+i.galleryDim].map(this.zoomedYScale.invert)).range([0,i.centerHeight-2*i.galleryDim]);u.zoomed(p.copy(),d.copy(),this.zoomTransform.k);continue}u.zoomed(s.copy(),c.copy(),this.zoomTransform.k,this.zoomTransform.x+this.xPositionOffset,this.zoomTransform.y+this.yPositionOffset,i.paddingLeft+i.leftWidth,i.paddingTop+i.topHeight)}return this.currentXScale=s,this.currentYScale=c,r&&this.currentProps.onScalesChanged(s,c),[s,c]}},{key:"createMetaTrack",value:function(r){switch(r.type){default:{const i=this.props.pluginTracks[r.type];if(i?.isMetaTrack){const o={getTrackObject:this.getTrackObject.bind(this),onNewTilesLoaded:()=>{this.currentProps.onNewTilesLoaded(r.uid)},definition:r};try{return new i.track(this.availableForPlugins,o,r.options??{})}catch(a){console.error("Plugin meta track",r.type,"failed to instantiate.",a)}}return console.warn(`Unknown meta track of type: ${r.type}`),new Oj(this.pStage,{name:"Unknown Track Type",type:r.type})}}}},{key:"createTrackObject",value:function(r){const i=this.createLocationAgnosticTrackObject(r);return(r.position==="left"||r.position==="right")&&Gt[r.type].orientation==="1d-horizontal"?new uj(i):i}},{key:"createLocationAgnosticTrackObject",value:function(r){let i=r.data;i||(i={server:Fp(r.server??""),tilesetUid:r.tilesetUid}),r.coordSystem&&(i.coordSystem=r.coordSystem);const o=lke(i,this.props.pubSub,this.props.pluginDataFetchers,this.availableForPlugins);if(!this.pStage||!this.svgElement)throw new Error("No PIXI stage or svg element");const a={id:r.uid,trackUid:r.uid,trackType:r.type,viewUid:this.viewUid,pubSub:this.props.pubSub,scene:this.pStage,dataConfig:i,dataFetcher:o,getLockGroupExtrema:()=>this.currentProps.getLockGroupExtrema(r.uid),handleTilesetInfoReceived:s=>{this.currentProps.onTilesetInfoReceived(r.uid,s)},animate:()=>{this.currentProps.onNewTilesLoaded(r.uid)},svgElement:this.svgElement,isValueScaleLocked:()=>this.currentProps.isValueScaleLocked(r.uid),onValueScaleChanged:()=>{this.currentProps.onValueScaleChanged(r.uid)},onTrackOptionsChanged:s=>{this.currentProps.onTrackOptionsChanged(r.uid,s)},onMouseMoveZoom:this.props.onMouseMoveZoom,chromInfoPath:r.chromInfoPath,isShowGlobalMousePosition:()=>this.props.isShowGlobalMousePosition,getTheme:()=>this.props.theme};switch(r.y&&(a.yPosition=r.y),r.x&&(a.xPosition=r.x),r.projectionXDomain&&(a.projectionXDomain=r.projectionXDomain),r.projectionYDomain&&(a.projectionYDomain=r.projectionYDomain),r.type){case"left-axis":return new O$(a,r.options);case"top-axis":return new D$(a,r.options);case"heatmap":return new Ql(a,r.options);case"multivec":case"vector-heatmap":case"horizontal-multivec":case"horizontal-vector-heatmap":case"vertical-multivec":case"vertical-vector-heatmap":return new U$(a,r.options);case"1d-heatmap":case"horizontal-1d-heatmap":case"vertical-1d-heatmap":return new H$(a,r.options);case"line":case"horizontal-line":case"vertical-line":return new ac(a,r.options);case"point":case"horizontal-point":case"vertical-point":return new G$(a,r.options);case"bar":case"horizontal-bar":case"vertical-bar":return new m5(a,r.options);case"divergent-bar":case"horizontal-divergent-bar":case"vertical-divergent-bar":return new B$(a,r.options);case"horizontal-1d-tiles":return new v$(a,r.options);case"vertical-1d-tiles":return new T$(a,r.options);case"2d-tiles":return new g$(a,r.options);case"stacked-interval":case"top-stacked-interval":case"left-stacked-interval":return new nj(a,r.options);case"viewport-projection-center":return r.registerViewportChanged&&r.removeViewportChanged&&r.setDomainsCallback?(a.registerViewportChanged=r.registerViewportChanged,a.removeViewportChanged=r.removeViewportChanged,a.setDomainsCallback=r.setDomainsCallback,new Ij(a,r.options)):new Ja(a,{});case"viewport-projection-horizontal":return r.registerViewportChanged&&r.removeViewportChanged&&r.setDomainsCallback?(a.registerViewportChanged=r.registerViewportChanged,a.removeViewportChanged=r.removeViewportChanged,a.setDomainsCallback=r.setDomainsCallback,new c9(a,r.options)):new Ja(a,{});case"viewport-projection-vertical":return r.registerViewportChanged&&r.removeViewportChanged&&r.setDomainsCallback?(a.registerViewportChanged=r.registerViewportChanged,a.removeViewportChanged=r.removeViewportChanged,a.setDomainsCallback=r.setDomainsCallback,new Nj(a,r.options)):new Ja(a,{});case"gene-annotations":case"horizontal-gene-annotations":case"vertical-gene-annotations":return new B5(a,r.options);case"2d-rectangle-domains":case"arrowhead-domains":return new tj(a,r.options);case"1d-annotations":case"horizontal-1d-annotations":case"vertical-1d-annotations":return new K$(a,r.options,!0);case"2d-annotations":return new Q$(a,r.options);case"linear-2d-rectangle-domains":case"horizontal-2d-rectangle-domains":case"vertical-2d-rectangle-domains":return new hj(a,r.options);case"square-markers":return new Ej(a,r.options);case"combined":return a.tracks=r.contents,a.createTrackObject=this.createTrackObject.bind(this),new b0(a);case"2d-chromosome-labels":return new vj(a,r.options);case"horizontal-chromosome-grid":return a.orientation="1d-horizontal",new th(a,r.options);case"vertical-chromosome-grid":return a.orientation="1d-vertical",new th(a,r.options);case"2d-chromosome-grid":return new th(a,r.options);case"chromosome-labels":case"horizontal-chromosome-labels":case"vertical-chromosome-labels":return new Tj(a,r.options);case"linear-heatmap":case"horizontal-heatmap":case"vertical-heatmap":return new xj(a,r.options);case"2d-chromosome-annotations":return new gj(a,r.options);case"1d-value-interval":case"horizontal-1d-value-interval":case"vertical-1d-value-interval":return new Aj(a,r.options);case"osm":case"osm-tiles":return new ih(a,r.options);case"osm-2d-tile-ids":return new aB(a,r.options);case"mapbox":case"mapbox-tiles":return new iB(a,r.options);case"raster-tiles":return new lB(a,r.options);case"bedlike":case"vertical-bedlike":return new WE(a,r.options);case"overlay-track":return new M$(a,r.options);case"overlay-chromosome-grid-track":return a.isOverlay=!0,new th(a,r.options);case"horizontal-rule":return new tB(a,r.options);case"vertical-rule":return new Vj(a,r.options);case"cross-rule":return a.x=r.x,a.y=r.y,new Yj(a,r.options);case"simple-svg":return new ko(a,r.options);case"empty":{const s=r.options;return new Bn(a,s)}default:{const s=this.props.pluginTracks[r.type];if(s&&!s.isMetaTrack){a.AVAILABLE_FOR_PLUGINS=this.availableForPlugins,a.baseEl=this.baseEl,a.definition=r,r.registerViewportChanged&&r.removeViewportChanged&&r.setDomainsCallback&&(a.registerViewportChanged=r.registerViewportChanged,a.removeViewportChanged=r.removeViewportChanged,a.setDomainsCallback=r.setDomainsCallback);try{return new s.track(this.availableForPlugins,a,r.options??{})}catch(c){console.error("Plugin track",r.type,"failed to instantiate.",c)}}return console.warn("Unknown track type:",r.type),new Oj(a,{name:"Unknown Track Type",type:r.type})}}}},{key:"zoomToDataPos",value:function(r,i,o,a,s=3e3,c=null){const[l,u,f]=kr(this.xScale.copy().domain([r,i]),this.yScale.copy().domain([o,a])),h=c?c(this.xScale,this.yScale):[this.xScale,this.yScale];this.setCenter(l,u,f,!1,s,h[0],h[1])}},{key:"forwardContextMenu",value:function(r){this.props.disableTrackMenu||r.altKey||(r.preventDefault(),setTimeout(()=>{this.props.pubSub.publish("contextmenu",r)},0))}},{key:"addEventTracker",value:function(){!this.eventTracker||this.eventTracker===this.eventTrackerOld||(this.eventTrackerOld||(this.eventTrackerOld=this.eventTracker),this.eventTracker=this.eventTrackerOld,this.eventTracker.addEventListener("click",this.boundForwardEvent),this.eventTracker.addEventListener("contextmenu",this.boundForwardContextMenu),this.eventTracker.addEventListener("dblclick",this.boundForwardEvent),this.eventTracker.addEventListener("wheel",this.boundForwardEvent),this.eventTracker.addEventListener("dragstart",this.boundForwardEvent),this.eventTracker.addEventListener("selectstart",this.boundForwardEvent),this.eventTracker.addEventListener("mouseover",this.boundForwardEvent),this.eventTracker.addEventListener("mouseenter",this.boundForwardEvent),this.eventTracker.addEventListener("mousedown",this.boundForwardEvent),this.eventTracker.addEventListener("mouseup",this.boundForwardEvent),this.eventTracker.addEventListener("mouseout",this.boundForwardEvent),this.eventTracker.addEventListener("mouseleave",this.boundForwardEvent),this.eventTracker.addEventListener("touchstart",this.boundForwardEvent),this.eventTracker.addEventListener("touchend",this.boundForwardEvent),this.eventTracker.addEventListener("touchmove",this.boundForwardEvent),this.eventTracker.addEventListener("touchcancel",this.boundForwardEvent),this.eventTracker.addEventListener("pointerover",this.boundForwardEvent),this.eventTracker.addEventListener("pointerenter",this.boundForwardEvent),this.eventTracker.addEventListener("pointerdown",this.boundForwardEvent),this.eventTracker.addEventListener("pointerup",this.boundForwardEvent),this.eventTracker.addEventListener("pointercancel",this.boundForwardEvent),this.eventTracker.addEventListener("pointerout",this.boundForwardEvent),this.eventTracker.addEventListener("pointerleave",this.boundForwardEvent),window.addEventListener("scroll",this.boundScrollEvent))}},{key:"removeEventTracker",value:function(){this.eventTracker&&(this.eventTracker.removeEventListener("click",this.boundForwardEvent),this.eventTracker.removeEventListener("contextmenu",this.boundForwardContextMenu),this.eventTracker.removeEventListener("dblclick",this.boundForwardEvent),this.eventTracker.removeEventListener("wheel",this.boundForwardEvent),this.eventTracker.removeEventListener("dragstart",this.boundForwardEvent),this.eventTracker.removeEventListener("selectstart",this.boundForwardEvent),this.eventTracker.removeEventListener("mouseover",this.boundForwardEvent),this.eventTracker.removeEventListener("mouseenter",this.boundForwardEvent),this.eventTracker.removeEventListener("mousedown",this.boundForwardEvent),this.eventTracker.removeEventListener("mouseup",this.boundForwardEvent),this.eventTracker.removeEventListener("mouseout",this.boundForwardEvent),this.eventTracker.removeEventListener("mouseleave",this.boundForwardEvent),this.eventTracker.removeEventListener("touchstart",this.boundForwardEvent),this.eventTracker.removeEventListener("touchend",this.boundForwardEvent),this.eventTracker.removeEventListener("touchcancel",this.boundForwardEvent),this.eventTracker.removeEventListener("pointerover",this.boundForwardEvent),this.eventTracker.removeEventListener("pointerenter",this.boundForwardEvent),this.eventTracker.removeEventListener("pointerdown",this.boundForwardEvent),this.eventTracker.removeEventListener("pointerup",this.boundForwardEvent),this.eventTracker.removeEventListener("pointercancel",this.boundForwardEvent),this.eventTracker.removeEventListener("pointerout",this.boundForwardEvent),this.eventTracker.removeEventListener("pointerleave",this.boundForwardEvent),window.removeEventListener("scroll",this.boundScrollEvent))}},{key:"scrollEvent",value:function(){this.element&&(this.elementPos=this.element.getBoundingClientRect())}},{key:"forwardEvent",value:function(r){r.sourceUid=this.uid,r.forwarded=!0,this.props.pubSub.publish("app.event",r)}},{key:"onScrollHandler",value:function(r){this.scrollTop=r}},{key:"render",value:function(){return x.createElement("div",{ref:r=>{this.baseEl=r},className:$t("track-renderer-div",Ak["track-renderer"]),style:{height:this.currentProps.height,width:this.currentProps.width}},x.createElement("div",{ref:r=>{this.element=r},className:$t("track-renderer-element",Ak["track-renderer-element"])}),x.createElement("div",{ref:r=>{this.eventTracker=r},className:$t("track-renderer-events",Ak["track-renderer-events"])},this.currentProps.children))}}])}(x.Component);Ik.defaultProps={pluginDataFetchers:{},pluginTracks:{},canvasElement:null,centerHeight:0,centerWidth:0,children:[],galleryDim:0,height:0,initialXDomain:[],initialYDomain:[],isShowGlobalMousePosition:!1,isRangeSelection:!1,leftWidth:0,leftWidthNoGallery:0,paddingLeft:0,paddingTop:0,positionedTracks:[],topHeight:0,topHeightNoGallery:0,width:0,metaTracks:[]},Ik.propTypes={canvasElement:q.object,centerHeight:q.number,centerWidth:q.number,children:q.array,disableTrackMenu:q.bool,galleryDim:q.number,height:q.number,initialXDomain:q.array,initialYDomain:q.array,isShowGlobalMousePosition:q.bool,isRangeSelection:q.bool,leftWidth:q.number,leftWidthNoGallery:q.number,paddingLeft:q.number,paddingTop:q.number,metaTracks:q.array,onMouseMoveZoom:q.func,onNewTilesLoaded:q.func.isRequired,onScalesChanged:q.func.isRequired,pixiRenderer:q.object.isRequired,pixiStage:q.object.isRequired,pluginDataFetchers:q.object,pluginTracks:q.object,positionedTracks:q.array,pubSub:q.object.isRequired,setCentersFunction:q.func,svgElement:q.object.isRequired,theme:q.symbol.isRequired,topHeight:q.number,topHeightNoGallery:q.number,viewOptions:q.object,width:q.number,xDomainLimits:q.array,yDomainLimits:q.array,valueScaleZoom:q.bool,zoomable:q.bool.isRequired,zoomDomain:q.array,uid:q.string,zoomLimits:q.array};const uke=tl(sl(Ik));function fke(e){const{attributes:t,listeners:n,setNodeRef:r,transform:i,transition:o,isDragging:a}=fL({id:e.uid}),s=i&&{...i,y:0},c={transform:Fl.Transform.toString(s),transition:o,...a?{zIndex:10,background:"rgba(0, 0, 0, 0.1)",border:"2px dashed rgba(0, 0, 0, 0.3)",borderRadius:4}:{}};return x.createElement("div",{ref:r,style:c},x.createElement(Az,{className:e.className,controlAlignLeft:e.controlAlignLeft,dragHandleProps:{...t,...n},editable:e.editable,handleConfigTrack:e.handleConfigTrack,handleResizeTrack:e.handleResizeTrack,height:e.height,isCollapsed:e.isCollapsed,item:e.item,onAddSeries:e.onAddSeries,onCollapseTrack:e.onCollapseTrack,onExpandTrack:e.onExpandTrack,onCloseTrack:e.onCloseTrack,onCloseTrackMenuOpened:e.onCloseTrackMenuOpened,onConfigTrackMenuOpened:e.onConfigTrackMenuOpened,resizeHandles:e.resizeHandles,uid:e.uid,width:e.width}))}const hke={"vertical-tiled-plot":"_vertical-tiled-plot_f3ho8_1"};function pke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dke(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mke(r.key),r)}}function gke(e,t,n){return t&&dke(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mke(e){var t=vke(e,"string");return typeof t=="symbol"?t:t+""}function vke(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function yke(e,t,n){return t=lm(t),bke(e,Nz()?Reflect.construct(t,n||[],lm(e).constructor):t.apply(e,n))}function bke(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _ke(e)}function _ke(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Nz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Nz=function(){return!!e})()}function lm(e){return lm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lm(e)}function Tke(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Rk(e,t)}function Rk(e,t){return Rk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Rk(e,t)}function Lz(e){return e?.sourceEvent}let Dk=function(e){function t(n){var r;return pke(this,t),r=yke(this,t,[n]),r.brushBehavior=al().on("start",r.brushStarted.bind(r)).on("brush",r.brushed.bind(r)).on("end",r.brushedEnded.bind(r)),r.state={trackControlsVisible:null},r}return Tke(t,e),gke(t,[{key:"componentDidMount",value:function(){this.props.isRangeSelectionActive&&this.addBrush()}},{key:"shouldComponentUpdate",value:function(r,i){if(this.rangeSelectionTriggered)return this.rangeSelectionTriggered=!1,this.rangeSelectionTriggeredEnd&&this.props.rangeSelection!==r.rangeSelection&&this.moveBrush(r.rangeSelection[0]?r.rangeSelection[0]:null,!0),this.rangeSelectionTriggeredEnd=!1,this.state!==i;if(this.props.rangeSelection!==r.rangeSelection){const o=this.props.is1dRangeSelection?0:1;return this.moveBrush(r.rangeSelection[o]?r.rangeSelection[o]:null,r.rangeSelectionEnd),this.state!==i}return!0}},{key:"componentDidUpdate",value:function(){this.props.isRangeSelectionActive?this.addBrush():this.removeBrush()}},{key:"addBrush",value:function(){!this.brushEl||this.brushElAddedBefore===this.brushEl||(this.brushElAddedBefore&&this.brushElAddedBefore.on(".brush",null),this.brushEl.call(this.brushBehavior),this.brushElAddedBefore=this.brushEl,Ls(this.brushEl,gi["track-range-selection-group-brush-selection"]))}},{key:"brushed",value:function(r){const i=this.rangeSelectionMoved;this.rangeSelectionMoved=!1,!(!Lz(r)||!this.props.onRangeSelection||i)&&(this.rangeSelectionTriggered=!0,this.props.onRangeSelection(r.selection))}},{key:"brushStarted",value:function(r){!Lz(r)||!r.selection||this.props.onRangeSelectionStart()}},{key:"brushedEnded",value:function(r){if(!this.props.is1dRangeSelection)return;const i=this.rangeSelectionMovedEnd;this.rangeSelectionMovedEnd=!1,r.selection&&r.sourceEvent&&this.props.onRangeSelection&&!i&&(this.rangeSelectionTriggered=!0,this.rangeSelectionTriggeredEnd=!0,this.props.onRangeSelectionEnd(r.selection)),r.selection||(this.rangeSelectionTriggered=!0,this.props.onRangeSelectionReset())}},{key:"moveBrush",value:function(r,i=!1){if(!this.brushEl)return;const o=r?[this.props.scale(r[0]),this.props.scale(r[1])]:null;this.rangeSelectionMoved=!0,this.rangeSelectionMovedEnd=!0,i?this.brushEl.transition().call(this.brushBehavior.move,o):this.brushEl.call(this.brushBehavior.move,o)}},{key:"removeBrush",value:function(){this.brushElAddedBefore&&(this.brushElAddedBefore.call(this.brushBehavior.move,null),this.brushElAddedBefore.on(".brush",null),this.brushElAddedBefore=void 0,this.props.onRangeSelectionReset())}},{key:"render",value:function(){const r=this.props.tracks.map(a=>a.width).reduce(zo,0),i=this.props.tracks.map(a=>$s(a)).reduce(Iu,!1),o=gi[this.props.isRangeSelectionActive?"track-range-selection-active":"track-range-selection"];return x.createElement("div",{className:hke["vertical-tiled-plot"]},i&&x.createElement("svg",{ref:a=>{this.brushEl=_t(a)},className:o,style:{height:this.props.height,width:r},xmlns:"http://www.w3.org/2000/svg"}),x.createElement(Q1,{axis:"x",className:$t(ti.list,ti.stylizedList,ti.horizontalList),component:_L,editable:this.props.editable,handleConfigTrack:this.props.handleConfigTrack,handleResizeTrack:this.props.handleResizeTrack,height:this.props.height,helperClass:ti.stylizedHelper,itemClass:$t(ti.stylizedItem,ti.horizontalItem),itemControlAlignLeft:this.props.tracksControlAlignLeft,itemReactClass:fke,items:this.props.tracks.map(a=>({handleMouseEnter:()=>{this.setState({trackControlsVisible:a.uid})},handleMouseLeave:()=>{this.setState({trackControlsVisible:null})},trackControlsVisible:a.uid===this.state.trackControlsVisible,configMenuVisible:a.uid===this.props.configTrackMenuId,uid:a.uid||Mt.nice(),height:this.props.height,width:Qn(a),isCollapsed:a.options?.collapsed,value:a.value})),onAddSeries:this.props.onAddSeries,onCloseTrack:this.props.onCloseTrack,onCollapseTrack:this.props.onCollapseTrack,onExpandTrack:this.props.onExpandTrack,onCloseTrackMenuOpened:this.props.onCloseTrackMenuOpened,onConfigTrackMenuOpened:this.props.onConfigTrackMenuOpened,onSortEnd:this.props.handleSortEnd,referenceAncestor:this.props.referenceAncestor,resizeHandles:this.props.resizeHandles,useDragHandle:!0,width:r}))}}])}(x.Component);Dk.propTypes={configTrackMenuId:q.string,editable:q.bool,handleConfigTrack:q.func,handleResizeTrack:q.func,handleSortEnd:q.func,is1dRangeSelection:q.bool,isRangeSelectionActive:q.bool,height:q.number,onAddSeries:q.func,onCloseTrack:q.func,onCollapseTrack:q.func,onExpandTrack:q.func,onCloseTrackMenuOpened:q.func,onConfigTrackMenuOpened:q.func,onRangeSelection:q.func,onRangeSelectionEnd:q.func,onRangeSelectionReset:q.func,onRangeSelectionStart:q.func,rangeSelection:q.array,rangeSelectionEnd:q.bool,referenceAncestor:q.func,resizeHandles:q.object,scale:q.func,tracks:q.array,tracksControlAlignLeft:q.bool};function wke(e){const t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch{}document.body.removeChild(t)}function $z(e){if(!navigator.clipboard){wke(e);return}navigator.clipboard.writeText(e).then(()=>{},t=>{})}function Ske(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Eke(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,xke(r.key),r)}}function kke(e,t,n){return t&&Eke(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function xke(e){var t=Cke(e,"string");return typeof t=="symbol"?t:t+""}function Cke(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Oke(e,t,n){return t=cm(t),Pke(e,jz()?Reflect.construct(t,n||[],cm(e).constructor):t.apply(e,n))}function Pke(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ake(e)}function Ake(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jz=function(){return!!e})()}function cm(e){return cm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cm(e)}function Mke(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Nk(e,t)}function Nk(e,t){return Nk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Nk(e,t)}let Bz=function(e){function t(){return Ske(this,t),Oke(this,t,arguments)}return Mke(t,e),kke(t,[{key:"render",value:function(){const r=Cw(this.props.tracks,this.handleItemMouseEnter.bind(this),this.handleMouseLeave.bind(this)),i=this.props.customItems?x.Children.map(this.props.customItems,o=>x.cloneElement(o,{onMouseEnter:a=>{this.handleOtherMouseEnter(a)}})):null;return x.createElement("div",{ref:o=>{this.div=o},className:$t(yt["context-menu"],{[yt["context-menu-dark"]]:this.props.theme===Qt}),"data-menu-type":"ViewContextMenu",style:{left:this.state.left,top:this.state.top}},i,i&&x.createElement("hr",{className:yt["context-menu-hr"]}),r,r&&x.createElement("hr",{className:yt["context-menu-hr"]}),this.props.genomePositionSearchBox&&x.createElement(xt,{onClick:this.copyLocationToClipboard.bind(this),onMouseEnter:o=>this.handleOtherMouseEnter(o)},"Copy location under cursor"),x.createElement("hr",{className:yt["context-menu-hr"]}),x.createElement(xt,{onClick:()=>this.props.onAddTrack({type:"horizontal-rule",y:this.props.coords[1],position:"whole"}),onMouseEnter:o=>this.handleOtherMouseEnter(o)},"Add Horizontal Rule"),x.createElement(xt,{onClick:()=>this.props.onAddTrack({type:"vertical-rule",x:this.props.coords[0],position:"whole"}),onMouseEnter:o=>this.handleOtherMouseEnter(o)},"Add Vertical Rule"),x.createElement(xt,{onClick:()=>this.props.onAddTrack({type:"cross-rule",x:this.props.coords[0],y:this.props.coords[1],position:"whole"}),onMouseEnter:o=>this.handleOtherMouseEnter(o)},"Add Cross Rule"),x.createElement("hr",{className:yt["context-menu-hr"]}),this.hasMatrixTrack(this.props.tracks)&&x.createElement(xt,{onClick:this.handleAddHorizontalSection.bind(this),onMouseEnter:o=>this.handleOtherMouseEnter(o)},"Add Horizontal Cross Section"),this.hasMatrixTrack(this.props.tracks)&&x.createElement(xt,{onClick:this.handleAddVerticalSection.bind(this),onMouseEnter:o=>this.handleOtherMouseEnter(o)},"Add Vertical Cross Section"),this.getSubmenu())}},{key:"hasMatrixTrack",value:function(r){return qp(this.props.tracks).filter(o=>o.type==="heatmap").length>0}},{key:"handleAddHorizontalSection",value:function(){const i=qp(this.props.tracks).filter(o=>o.type==="heatmap")[0];this.props.onAddTrack({type:"horizontal-rule",y:this.props.coords[1],position:"whole"}),this.props.onAddTrack({data:{type:"horizontal-section",server:i.server,tilesetUid:i.tilesetUid,slicePos:this.props.coords[1]},options:{valueScaling:"log"},type:"horizontal-bar",height:30,position:"top"})}},{key:"copyLocationToClipboard",value:function(){const r=this.props.tracks[0]&&this.props.tracks[0].position==="center",i=this.props.genomePositionSearchBox?.searchField?.chromInfo;if(!i){console.warn("There needs to be a genome position search box present to copy the location"),this.props.closeMenu();return}const o=this.props.coords[0],a=this.props.coords[1],s=dr(o,i),c=Fr(",d");let l=`${s[0]}:${c(s[1])}`;if(r){const u=dr(a,i);l=`${l} & ${u[0]}:${c(u[1])}`,$z(l)}else $z(l);this.props.closeMenu()}},{key:"handleAddVerticalSection",value:function(){const i=qp(this.props.tracks).filter(o=>o.type==="heatmap")[0];this.props.onAddTrack({type:"vertical-rule",x:this.props.coords[0],position:"whole"}),this.props.onAddTrack({data:{type:"vertical-section",server:i.server,tilesetUid:i.tilesetUid,slicePos:this.props.coords[0]},options:{valueScaling:"log"},type:"vertical-bar",height:30,position:"left"})}}])}(ul(Yo).with(xN));Bz.propTypes={coords:q.array,customItems:q.array};function Ike(e,t){if(window.higlassTracksByType&&Object.keys(window.higlassTracksByType).forEach(i=>{Gt[i]=window.higlassTracksByType[i].config}),!(e in Ca)&&!t){console.warn("unknown data type:",e);return}const n={"1d-horizontal":["top","bottom","left","right"],"2d":["center"],"1d-vertical":["left","right"]},r=Ca[e]||{};if(t)for(const i of t)if(!Gt[i])console.warn("unknown track type",i);else for(const o of n[Gt[i].orientation])r[o]=i;return r}function Rke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dke(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Lke(r.key),r)}}function Nke(e,t,n){return t&&Dke(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lke(e){var t=$ke(e,"string");return typeof t=="symbol"?t:t+""}function $ke(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function jke(e,t,n){return t=um(t),Bke(e,zz()?Reflect.construct(t,n||[],um(e).constructor):t.apply(e,n))}function Bke(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zke(e)}function zke(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zz=function(){return!!e})()}function um(e){return um=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},um(e)}function Hke(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Lk(e,t)}function Lk(e,t){return Lk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Lk(e,t)}let $k=function(e){function t(n){var r;Rke(this,t),r=jke(this,t,[n]),r.closing=!1,r.brushX=ol();const{tracks:i}=r.props;return r.canvasElement=null,r.tracksByUidInit={},[...r.props.tracks.top||[],...r.props.tracks.right||[],...r.props.tracks.bottom||[],...r.props.tracks.left||[],...r.props.tracks.gallery||[],...r.props.tracks.center||[]].forEach(o=>{o.type==="combined"?o.contents.forEach(a=>{r.tracksByUidInit[a.uid]=!1}):r.tracksByUidInit[o.uid]=!1}),r.annotationUid=null,r.annotationCreatedNotified=!1,r.xScale=null,r.yScale=null,r.addUidsToTracks(i),r.trackToReplace=null,r.trackRenderer=null,r.brushSelection=null,r.configTrackMenu=null,r.state={sizeMeasured:!1,height:10,width:10,tracks:i,init:!1,addTrackExtent:null,addTrackPosition:null,customDialog:null,mouseOverOverlayUid:null,forceUpdate:0,rangeSelection:[null,null],rangeSelectionEnd:!1,chromInfo:null,defaultChromSizes:null,contextMenuCustomItems:null,contextMenuPosition:null,addDivisorDialog:null},r.reset=!0,window.higlassTracksByType&&Object.keys(window.higlassTracksByType).forEach(o=>{Gt[o]=window.higlassTracksByType[o].config}),r.topHeight=0,r.bottomHeight=0,r.leftWidth=0,r.rightWidth=0,r.centerHeight=0,r.centerWidth=0,r.dragTimeout=null,r.previousPropsStr="",r.brushesCreated={},r.appZoomedBound=r.appZoomed.bind(r),r.handleClickBound=r.handleClick.bind(r),r.contextMenuHandlerBound=r.contextMenuHandler.bind(r),r.handleNoTrackAddedBound=r.handleNoTrackAdded.bind(r),r.handleTracksAddedBound=r.handleTracksAdded.bind(r),r.closeMenusBound=r.closeMenus.bind(r),r.handleAddDivisorBound=r.handleAddDivisor.bind(r),r.handleAddSeriesBound=r.handleAddSeries.bind(r),r.handleChangeTrackDataBound=r.handleChangeTrackData.bind(r),r.handleChangeTrackTypeBound=r.handleChangeTrackType.bind(r),r.handleCloseTrackBound=r.handleCloseTrack.bind(r),r.handleConfigureTrackBound=r.handleConfigureTrack.bind(r),r.handleExportTrackDataBound=r.handleExportTrackData.bind(r),r.handleLockValueScaleBound=r.handleLockValueScale.bind(r),r.handleReplaceTrackBound=r.handleReplaceTrack.bind(r),r.handleTrackOptionsChangedBound=r.handleTrackOptionsChanged.bind(r),r.handleUnlockValueScaleBound=r.handleUnlockValueScale.bind(r),r.onAddTrack=r.handleAddTrack.bind(r),r}return Hke(t,e),Nke(t,[{key:"waitForDOMAttachment",value:function(r){if(!this.mounted)return;const i=this.divTiledPlot;i?.getRootNode().contains(i)?r():requestAnimationFrame(()=>this.waitForDOMAttachment(r))}},{key:"componentDidMount",value:function(){this.mounted=!0,this.element=this.divTiledPlot,this.waitForDOMAttachment(()=>{Ih.ElementQueries.listen(),this.resizeSensor=new Ih.ResizeSensor(this.element.parentNode,this.measureSize.bind(this)),this.measureSize()}),this.addEventListeners(),this.pubSubs=[],this.pubSubs.push(this.props.pubSub.subscribe("contextmenu",this.contextMenuHandlerBound))}},{key:"getTracksData",value:function(r,i){let o=[];const a=this.listAllTrackObjects();for(const c of r)c.track.contents?o=[...o,...c.track.contents]:o=[...o,c.track];const s=[];for(const c of o)if(c.type==="heatmap"){const l=a.filter(v=>v.id===c.uid)[0],u=l._xScale(i[0][0]),f=l._xScale(i[1][0]),h=l._yScale(i[0][1]),d=l._yScale(i[1][1])-h,g=f-u,y=l.getVisibleRectangleData(u,h,d,g),m=y.data.reduce((v,_)=>v+_,0)/y.data.length;s.push({name:c.options.name,mean:m,trackUid:c.uid})}return s}},{key:"appZoomed",value:function(){if(this.brushCurrent&&this.brushEl){if(this.brushType==="horizontal"){const r=[this.xScale(this.brushSelection[0])+this.brushTrack.left,this.xScale(this.brushSelection[1])+this.brushTrack.left];this.brushEl.call(this.brushCurrent.move,r)}if(this.brushType==="vertical"){const r=[this.yScale(this.brushSelection[0])+this.brushTrack.top,this.yScale(this.brushSelection[1])+this.brushTrack.top];this.brushEl.call(this.brushCurrent.move,r)}if(this.brushType==="2d"){const r=[[this.xScale(this.brushSelection[0][0])+this.brushTrack.left,this.yScale(this.brushSelection[0][1])+this.brushTrack.top],[this.xScale(this.brushSelection[1][0])+this.brushTrack.left,this.yScale(this.brushSelection[1][1])+this.brushTrack.top]];this.brushEl.call(this.brushCurrent.move,r)}}}},{key:"clearOtherBrushes",value:function(r){for(const i of Object.values(this.brushes))i.on("brush",null);for(const i in this.brushes){const o=this.brushes[i];o!==r&&this.brushEls[i].call(o.move,null)}for(const i of Object.values(this.brushes))i.on("brush",()=>this.clearOtherBrushes(i))}},{key:"handleClick",value:function(r){const i=Xt(r,this.divTiledPlot);let o=!1;if(this.brushEl){const a=this.brushSelectionRaw,s=this.brushTrack;this.brushType==="2d"?i[0]>=a[0][0]&&i[0]<=a[1][0]&&i[1]>=a[0][1]&&i[1]<=a[1][1]&&(o=!0):this.brushType==="horizontal"?i[0]>=a[0]&&i[0]<=a[1]&&i[1]>=s.top&&i[1]<=s.top+Zn(s.track)&&(o=!0):this.brushType==="vertical"&&i[1]>=a[0]&&i[1]<=a[1]&&i[0]>=s.left&&i[0]<=s.left+Qn(s.track)&&(o=!0),o||this.cancelBrushes()}}},{key:"cancelBrushes",value:function(){this.brushEl.call(this.brushCurrent.move,null),this.brushEl=null,this.props.apiPublish("annotationRemoved",this.annotationUid),this.annotationUid=null,this.annotationCreatedNotified=!1,this.removeBrushText()}},{key:"removeBrushText",value:function(){_t(this.divTiledPlot).selectAll(".brush-svg").selectAll(".data-values").remove()}},{key:"enableBrushes",value:function(){_t(this.divTiledPlot).selectAll(".brush-svg").selectAll(".overlay").style("pointer-events","all")}},{key:"disableBrushes",value:function(){_t(this.divTiledPlot).selectAll(".overlay").attr("pointer-events","none"),_t(this.divTiledPlot).selectAll(".brush-rect").attr("pointer-events","none"),_t(this.divTiledPlot).selectAll(".selection").attr("pointer-events","all"),_t(this.divTiledPlot).selectAll(".brush-svg").attr("pointer-events","none")}},{key:"createBrushes",value:function(r){const i={};this.brushCurrent=null;const o=this.props.apiPublish,a=this;for(const s of r){if(i[s.track.uid])continue;let c=null;["top","bottom"].includes(s.track.position)?(c=ol(),c.on("brush",l=>{l.selection&&(this.brushCurrent=c,this.brushType="horizontal",this.brushTrack=s,this.brushSelectionRaw=l.selection,this.brushSelection=[this.xScale.invert(l.selection[0]-s.left),this.xScale.invert(l.selection[1]-s.left)],o("annotationChanged",{annotationUid:this.annotationUid,viewUid:this.props.uid,track:s.track,extent:[this.brushSelection,[null,null]]}))}),c.on("end",l=>{this.annotationCreatedNotified||o("annotationCreated",{annotationUid:a.annotationUid,track:s.track,viewUid:this.props.uid,extent:[this.brushSelection,[null,null]]})})):["left","right"].includes(s.track.position)?(c=al(),c.on("brush",l=>{l.selection&&(this.brushCurrent=c,this.brushType="vertical",this.brushTrack=s,this.brushSelectionRaw=l.selection,this.brushSelection=[this.yScale.invert(l.selection[0]-s.top),this.yScale.invert(l.selection[1]-s.top)],o("annotationChanged",{annotationUid:this.annotationUid,track:s.track,viewUid:this.props.uid,extent:[[null,null],this.brushSelection]}))}),c.on("end",l=>{this.annotationCreatedNotified||o("annotationCreated",{annotationUid:a.annotationUid,track:s.track,viewUid:this.props.uid,extent:[[null,null],this.brushSelection]})})):(c=Wd(),c.on("brush",l=>{if(!l.selection)return;this.brushCurrent=c,this.brushType="2d",this.brushTrack=s,this.brushSelectionRaw=l.selection,this.brushSelection=[[this.xScale.invert(l.selection[0][0]-s.left),this.yScale.invert(l.selection[0][1]-s.top)],[this.xScale.invert(l.selection[1][0]-s.left),this.yScale.invert(l.selection[1][1]-s.top)]];const u=this.getTracksData(r.filter(h=>h.track.position==="center"),this.brushSelection),f=Object.values(u).filter(h=>h.mean!==void 0).map(h=>h.mean);if(f.length){_t(this.divTiledPlot).selectAll(".brush-svg").selectAll(".data-values").data(f).enter().append("text").classed("data-values",!0);const p=Fr(".3f");_t(this.divTiledPlot).selectAll(".data-values").attr("x",l.selection[0][0]).attr("y",l.selection[0][1]).text(d=>`mean: ${p(d)}`)}o("annotationChanged",{annotationUid:this.annotationUid,extent:this.brushSelection,data:u,track:s.track,viewUid:this.props.uid})}),c.on("end",l=>{let u={};this.brushSelection?.[0].length&&(u=this.getTracksData(r.filter(f=>f.track.position==="center"),this.brushSelection)),this.annotationCreatedNotified?l.selection||this.removeBrushText():(o("annotationCreated",{annotationUid:a.annotationUid,track:s.track,viewUid:this.props.uid,extent:this.brushSelection,data:u}),this.annotationCreatedNotified=!0)})),c.keyModifiers(!1),c.extent([[s.left,s.top],[s.left+Qn(s.track),s.top+Zn(s.track)]]),c.on("start",function(l){a.annotationUid||(a.annotationUid=Mt.nice(),s.annotationUid=a.annotationUid),a.brushEl=_t(this)}),i[s.track.uid]=c}return i}},{key:"removeBrushes",value:function(){_t(this.divTiledPlot).selectAll(".brush-svg").remove()}},{key:"addBrushes",value:function(){if(this.annotationUid)return;const r=this.positionedTracks().filter(s=>s.track.position!=="whole"),i=this.createBrushes(r);this.brushes=i;const o={};this.brushEls=o,_t(this.divTiledPlot).selectAll(".brush").remove(),_t(this.divTiledPlot).selectAll(".brush-svg").data([1]).enter().append("svg").classed("brush-svg",!0).style("position","absolute").style("left",0).style("top",0).style("z-index",101);const a=_t(this.divTiledPlot).select(".brush-svg").selectAll(".brush").data(r,s=>s.track.uid).enter().append("g").attr("class","brush");_t(this.divTiledPlot).selectAll(".brush-svg").attr("width",this.state.width).attr("height",this.state.height),_t(this.divTiledPlot).selectAll(".brush-rect").attr("x",s=>s.left).attr("y",s=>s.top).style("stroke","1px solid black").style("fill","transparent").attr("width",s=>s.width).attr("height",s=>s.height),a.each(function(s){o[s.track.uid]=_t(this),o[s.track.uid].call(i[s.track.uid])})}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){this.addUidsToTracks(r.tracks),this.setState({tracks:r.tracks})}},{key:"shouldComponentUpdate",value:function(r,i){const o=this.previousPropsStr,a=this.updatablePropsToString(r),s=JSON.stringify(this.state),c=JSON.stringify(i),l=o!==a||s!==c||this.props.chooseTrackHandler!==r.chooseTrackHandler||this.props.customDialog!==r.customDialog;l&&(this.previousPropsStr=a);const u=this.numTracks;return this.numTracks=0,oo(this.props.tracks,()=>this.numTracks++),this.reset=this.reset||u===0&&this.numTracks>0,this.numTracks||(this.tracksByUidInit={}),r.mouseTool===ku?this.addBrushes():this.disableBrushes(),l}},{key:"componentDidUpdate",value:function(r,i){if(i.rangeSelection!==this.state.rangeSelection){let o=[null,null];this.state.defaultChromSizes&&this.state.rangeSelection.every(a=>a?.length)&&(o=this.state.rangeSelection.map(a=>Cp(...a,this.state.defaultChromSizes))),this.props.onRangeSelection({dataRange:this.state.rangeSelection,genomicRange:o})}if(this.state.customDialog||this.props.customDialog){const o=this.state.customDialog||this.props.customDialog;if(o.length>0){const a=[],s=[];o.forEach(c=>{a.push(c.bodyComponent),s.push(c.bodyProps)}),this.props.modal.open(x.createElement(DS,{children:a,bodyProps:s,onCancel:this.props.closeCustomDialog,title:o[0].title}))}}if(r.tracks.center,this.props.tracks.center,(this.state.addTrackPosition||this.props.addTrackPosition)&&this.props.modal.open(x.createElement(Zd,{extent:this.state.addTrackExtent||this.props.addTrackExtent,host:this.state.addTrackHost,onCancel:this.handleNoTrackAddedBound,onTracksChosen:this.handleTracksAddedBound,position:this.state.addTrackPosition||this.props.addTrackPosition,trackSourceServers:this.props.trackSourceServers})),this.state.addDivisorDialog){const o=this.state.addDivisorDialog;this.props.modal.open(x.createElement(Zd,{datatype:Gt[o.type].datatype[0],host:this.state.addTrackHost,onCancel:()=>{this.setState({addDivisorDialog:null})},onTracksChosen:a=>{this.handleDivisorChosen(o,a)},trackSourceServers:this.props.trackSourceServers}))}}},{key:"componentWillUnmount",value:function(){this.closing=!0,this.removeEventListeners(),this.pubSubs.forEach(r=>this.props.pubSub.unsubscribe(r))}},{key:"addUidsToTracks",value:function(r){Object.keys(r).forEach(i=>{r[i].forEach(o=>{o.uid=o.uid||Mt.nice()})})}},{key:"contextMenuHandler",value:function(r){if(!this.divTiledPlot)return;const i=this.divTiledPlot.getBoundingClientRect();if(!_0(r.clientX,r.clientY,i.left,i.left+i.width,i.top,i.top+i.height))return;const a=[r.clientX,r.clientY],s=Xt(r,this.divTiledPlot),c=this.trackRenderer.zoomedXScale.invert(s[0]),l=this.trackRenderer.zoomedYScale.invert(s[1]);let u=null;r.hgCustomItems&&(u=r.hgCustomItems.map(f=>x.createElement(xt,{key:f.key,onClick:f.onClick},f.text))),this.setState({contextMenuCustomItems:u,contextMenuPosition:{left:a[0],top:a[1],canvasLeft:s[0]+this.trackRenderer.xPositionOffset,canvasTop:s[1]+this.trackRenderer.yPositionOffset},contextMenuDataX:c,contextMenuDataY:l})}},{key:"measureSize",value:function(){this.element.clientWidth>0&&this.element.clientHeight>0&&this.setState({sizeMeasured:!0,width:this.element.clientWidth,height:this.element.clientHeight})}},{key:"handleTrackOptionsChanged",value:function(r,i){return this.props.onTrackOptionsChanged(r,i)}},{key:"handleCollapseTrack",value:function(r){this.handleTrackOptionsChanged(r,{collapsed:!0})}},{key:"handleExpandTrack",value:function(r){this.handleTrackOptionsChanged(r,{collapsed:!1})}},{key:"handleScalesChanged",value:function(r,i){this.xScale=r,this.yScale=i,this.appZoomed(),this.props.onScalesChanged(r,i)}},{key:"handleTilesetInfoReceived",value:function(r,i){const o=rn(this.props.tracks,r);if(!o){console.warn("Strange, track not found:",r);return}this.tracksByUidInit[o.uid]=!0,this.checkAllTilesetInfoReceived(),o.options||(o.options={}),o.name=i.name,o.maxWidth=i.max_width,o.transforms=i.transforms,o.aggregationModes=i.aggregation_modes,o.header=i.header,o.binsPerDimension=i.bins_per_dimension,i.resolutions?(o.maxZoom=i.resolutions.length-1,o.resolutions=i.resolutions):o.maxZoom=i.max_zoom,i.row_infos&&(o.row_infos=i.row_infos),o.coordSystem=i.coordSystem,o.datatype=i.datatype}},{key:"checkAllTilesetInfoReceived",value:function(){if(this.state.init&&!this.reset||!this.trackRenderer||!this.props.zoomToDataExtentOnInit())return;const r=Object.keys(this.trackRenderer.trackDefObjects).map(o=>{const a=this.trackRenderer.trackDefObjects[o].trackObject;return a.childTracks?a.childTracks:a}).reduce((o,a)=>o.concat(a),[]).filter(({tilesetInfo:o})=>typeof o<"u"&&o!==!0),i=Object.values(this.tracksByUidInit).filter(o=>o).length;r.length===i&&(this.setState({init:!0}),this.reset=!1,this.handleZoomToData())}},{key:"handleOverlayMouseEnter",value:function(r){this.setState({mouseOverOverlayUid:r}),this.props.setOverTrackChooser(!0)}},{key:"handleOverlayMouseLeave",value:function(r){r===this.state.mouseOverOverlayUid&&this.setState({mouseOverOverlayUid:null}),this.props.setOverTrackChooser(!1)}},{key:"handleTrackPositionChosen",value:function(r,i){this.setState({mouseOverOverlayUid:null}),this.props.chooseTrackHandler(r.track.uid,i)}},{key:"handleNoTrackAdded",value:function(){this.trackToReplace=null,this.props.onNoTrackAdded(),this.setState({addTrackExtent:null,addTrackPosition:null,addTrackHost:null})}},{key:"handleAddDivisor",value:function(r){this.setState({addDivisorDialog:r})}},{key:"handleDivisorChosen",value:function(r,i){this.setState({addDivisorDialog:null});const o=r.data?{server:r.data.server,tilesetUid:r.data.tilesetUid}:{server:r.server,tilesetUid:r.tilesetUid},a={server:i[0].server,tilesetUid:i[0].uuid};this.handleChangeTrackData(r.uid,{type:"divided",children:[o,a]})}},{key:"handleDivideSeries",value:function(r){}},{key:"handleAddSeries",value:function(r){const i=Mu(this.props.tracks,r),o=rn(this.props.tracks,r);this.setState({addTrackPosition:i,addTrackHost:o})}},{key:"handleReplaceTrack",value:function(r,i){this.trackToReplace=r,this.handleAddTrack(i)}},{key:"handleAddTrack",value:function(r,i){this.setState({addTrackExtent:i,addTrackPosition:r,addTrackHost:null})}},{key:"handleResizeTrack",value:function(r,i,o){const{tracks:a}=this.state;for(const s in a){const l=a[s].filter(u=>u.uid===r);l.length>0&&(l[0].width=i,l[0].height=o)}this.setState({tracks:a,forceUpdate:Math.random()}),this.props.onResizeTrack()}},{key:"closeMenus",value:function(){this.setState({closeTrackMenuId:null,configTrackMenuId:null,contextMenuPosition:null,contextMenuCustomItems:null})}},{key:"handleLockValueScale",value:function(r){this.closeMenus(),this.props.onLockValueScale(r)}},{key:"handleUnlockValueScale",value:function(r){this.closeMenus(),this.props.onUnlockValueScale(r)}},{key:"handleCloseTrack",value:function(r){this.closeMenus(),this.props.onCloseTrack(r)}},{key:"handleChangeTrackType",value:function(r,i){this.closeMenus(),this.props.onChangeTrackType(r,i)}},{key:"handleChangeTrackData",value:function(r,i){this.closeMenus(),this.props.onChangeTrackData(r,i)}},{key:"handleTracksAdded",value:function(r,i,o,a){return this.trackToReplace&&(this.handleCloseTrack(this.trackToReplace),this.trackToReplace=null),this.props.onTracksAdded(r,i,o,a),this.setState({addTrackExtent:null,addTrackPosition:null,addTrackHost:null}),r}},{key:"handleCloseTrackMenuOpened",value:function(r,i){this.setState({closeTrackMenuId:r,closeTrackMenuLocation:i})}},{key:"handleCloseContextMenu",value:function(){this.setState({contextMenuCustomItems:null,contextMenuPosition:null,contextMenuDataX:null,contextMenuDataY:null})}},{key:"handleCloseTrackMenuClosed",value:function(){this.setState({closeTrackMenuId:null})}},{key:"handleConfigTrackMenuOpened",value:function(r,i){this.closeMenus(),this.setState({configTrackMenuId:r,configTrackMenuLocation:i})}},{key:"handleConfigureTrack",value:function(r,i){this.setState({configTrackMenuId:null,trackOptions:{track:r,configComponent:i}}),this.closeMenus()}},{key:"handleSortEnd",value:function(r){this.setState(i=>{const o=i.tracks,a={};for(let s=0;s<r.length;s++)a[r[s].uid]=s;for(const s in o){const c=o[s];if(c.length&&c[0].uid in a){const l=new Array(c.length);for(let u=0;u<c.length;u++)l[a[c[u].uid]]=c[u];o[s]=l}}return{tracks:o,forceUpdate:Math.random()}})}},{key:"createTracksAndLocations",value:function(){const r=[],{tracks:i}=this.state;return Mp.forEach(o=>{i[o]&&i[o].forEach(a=>{a.contents&&a.contents.forEach(s=>{s.position=o}),a.position=o,r.push({track:a,location:o})})}),r}},{key:"calculateTrackPosition",value:function(r,i){let o=this.props.paddingTop,a=this.props.paddingBottom,s=this.props.paddingLeft,c=this.props.paddingRight,l=this.centerWidth,u=Zn(r),f=0,h=0;switch(i){case"top":s+=this.leftWidth;for(let p=0;p<this.state.tracks.top.length&&this.state.tracks.top[p].uid!==r.uid;p++)o+=Zn(this.state.tracks.top[p]);break;case"bottom":s+=this.leftWidth,o+=this.topHeight+this.centerHeight+this.galleryDim;for(let p=0;p<this.state.tracks.bottom.length&&this.state.tracks.bottom[p].uid!==r.uid;p++)o+=Zn(this.state.tracks.bottom[p]);break;case"left":o+=this.topHeight,l=Qn(r),u=this.centerHeight;for(let p=0;p<this.state.tracks.left.length&&this.state.tracks.left[p].uid!==r.uid;p++)s+=Qn(this.state.tracks.left[p]);break;case"right":s+=this.leftWidth+this.centerWidth+this.galleryDim,o+=this.topHeight,l=Qn(r),u=this.centerHeight;for(let p=0;p<this.state.tracks.right.length&&this.state.tracks.right[p].uid!==r.uid;p++)s+=Qn(this.state.tracks.right[p]);break;case"center":s+=this.leftWidth,o+=this.topHeight,u=this.centerHeight;break;case"gallery":s+=this.leftWidthNoGallery,o+=this.topHeightNoGallery,l=this.state.width-this.leftWidthNoGallery-this.rightWidthNoGallery-this.props.paddingLeft,u=this.state.height-this.topHeightNoGallery-this.bottomHeightNoGallery-this.props.paddingTop,f=this.galleryDim,h=this.galleryDim;for(let p=0;p<this.state.tracks.gallery.length&&this.state.tracks.gallery[p].uid!==r.uid;p++)l-=2*this.state.tracks.gallery[p].height,u-=2*this.state.tracks.gallery[p].height,s+=this.state.tracks.gallery[p].height,o+=this.state.tracks.gallery[p].height,f-=this.state.tracks.gallery[p].height,h-=this.state.tracks.gallery[p].height;for(let p=0;p<this.state.tracks.right.length;p++)c+=this.state.tracks.right[p].width;for(let p=0;p<this.state.tracks.bottom.length;p++)a+=this.state.tracks.bottom[p].height;r.offsetX=f,r.offsetY=h,r.offsetTop=o,r.offsetRight=c,r.offsetBottom=a,r.offsetLeft=s;break;default:l=this.leftWidth+this.centerWidth+this.rightWidth,u=this.topHeight+this.centerHeight+this.bottomHeight}return Mp.indexOf(i)===-1&&console.warn("Track with unknown position present:",i,r),{left:s,top:o,width:l,height:u,track:r}}},{key:"findCentralHeatmapTrack",value:function(r){for(let i=0;i<r.length;i++){if(r[i].type==="combined")return this.findCentralHeatmapTrack(r[i].contents);if(r[i].type==="heatmap")return r[i]}}},{key:"trackUuidToOrientation",value:function(r){}},{key:"overlayTracks",value:function(r){return this.props.overlays?this.props.overlays.filter(o=>o.includes?.length).map(o=>{const a=o.type?`overlay-${o.type}-track`:"overlay-track",s={...o,uid:o.uid||Mt.nice(),includes:o.includes,type:a,options:Object.assign(o.options,{orientationsAndPositions:o.includes.map(c=>{const l=rn(this.props.tracks,c);if(!l)return console.warn(`OverlayTrack included uid (${c}) not found in the track list`),null;const u=Mu(this.props.tracks,l.uid);let f;if((u==="top"||u==="bottom")&&(f="1d-horizontal"),(u==="left"||u==="right")&&(f="1d-vertical"),u==="center"&&(f="2d"),!f)return console.warn("Only top, bottom, left, right, or center tracks can be overlaid at the moment"),null;const h=r.filter(d=>d.track.uid===c);if(!h.length)return null;const p={left:h[0].left-this.props.paddingLeft,top:h[0].top-this.props.paddingTop,width:h[0].width,height:h[0].height};return{orientation:f,position:p}}).filter(c=>c)})};return{top:this.props.paddingTop,left:this.props.paddingLeft,width:this.leftWidth+this.centerWidth+this.rightWidth,height:this.topHeight+this.centerHeight+this.bottomHeight+this.props.marginTop+this.props.marginBottom,track:s}}):[]}},{key:"positionedTracks",value:function(){return this.createTracksAndLocations().map(({track:i,location:o})=>this.calculateTrackPosition(i,o))}},{key:"createTrackPositionTexts",value:function(){const r=this.positionedTracks();return this.createTracksAndLocations(),r.map(o=>{const{track:a}=o;return x.createElement("div",{key:a.uid,style:{left:o.left,top:o.top,width:Qn(o.track),height:Zn(o.track),position:"absolute"}},a.uid.slice(0,2))})}},{key:"handleExportTrackData",value:function(r,i){const o=rn(this.props.tracks,i);let a=null;r!==i?a=this.trackRenderer.trackDefObjects[r].trackObject.createdTracks[o.uid]:{trackObject:a}=this.trackRenderer.trackDefObjects[r],a.exportData(),this.closeMenus()}},{key:"listTracksAtPosition",value:function(r,i,o=!1){const a=[];if(!this.trackRenderer)return[];for(const s in this.trackRenderer.trackDefObjects){const c=this.trackRenderer.trackDefObjects[s].trackObject;if(c.respondsToPosition(r,i))if(o){if(this.props.tracks.center)if(this.props.tracks.center.contents)for(let l=0;l<this.props.tracks.center.contents.length;l++)this.props.tracks.center.contents[l].uid===s&&(c.is2d=!0);else this.props.tracks.center?.length&&this.props.tracks.center[0].uid===s&&(c.is2d=!0);a.push(c)}else a.push(this.trackRenderer.trackDefObjects[s].trackDef.track)}return a}},{key:"listAllTrackObjects",value:function(){const r=[];for(const i in this.trackRenderer.trackDefObjects){const o=this.trackRenderer.trackDefObjects[i];if(o.trackObject.createdTracks)for(const a in o.trackObject.createdTracks){const s=o.trackObject.createdTracks[a];r.push(s)}else r.push(o.trackObject)}return r}},{key:"handleZoomToData",value:function(){const r=Number.MAX_SAFE_INTEGER,i=Number.MIN_SAFE_INTEGER,o=[r,r],a=[i,i],s=this.listAllTrackObjects();for(const h of s)if(h.tilesetInfo&&h.tilesetInfo.min_pos)for(let p=0;p<h.tilesetInfo.min_pos.length;p++)h.tilesetInfo.min_pos[p]<o[p]&&(o[p]=h.tilesetInfo.min_pos[p]),h.tilesetInfo.max_pos[p]>a[p]&&(a[p]=h.tilesetInfo.max_pos[p]);const c=this.trackRenderer.currentProps.paddingLeft+this.trackRenderer.currentProps.leftWidth;let l=[c,c+this.trackRenderer.currentProps.centerWidth].map(this.trackRenderer.zoomTransform.rescaleX(this.trackRenderer.xScale).invert);const u=this.trackRenderer.currentProps.paddingTop+this.trackRenderer.currentProps.topHeight;let f=[u,u+this.trackRenderer.currentProps.centerHeight].map(this.trackRenderer.zoomTransform.rescaleY(this.trackRenderer.yScale).invert);this.trackRenderer.zoomTransform.k=1,this.trackRenderer.zoomTransform.x=0,this.trackRenderer.zoomTransform.y=0,this.trackRenderer.applyZoomTransform(),o[0]<Number.MAX_SAFE_INTEGER&&a[0]>Number.MIN_SAFE_INTEGER&&(l=[o[0],a[0]]),o[1]<Number.MAX_SAFE_INTEGER&&a[1]>Number.MIN_SAFE_INTEGER&&(f=[o[1],a[1]]),this.props.onDataDomainChanged(l,f)}},{key:"resetViewport",value:function(){this.trackRenderer.zoomTransform.k=1,this.trackRenderer.zoomTransform.x=0,this.trackRenderer.zoomTransform.y=0,this.trackRenderer.applyZoomTransform(),this.props.onDataDomainChanged(this.props.initialXDomain,this.props.initialYDomain)}},{key:"updatablePropsToString",value:function(r){return JSON.stringify({tracks:r.tracks,overlays:r.overlays,viewOptions:r.viewOptions,uid:r.uid,addTrackExtent:r.addTrackExtent,addTrackPosition:r.addTrackPosition,editable:r.editable,marginTop:r.marginTop,marginBottom:r.marginBottom,marginLeft:r.marginLeft,marginRight:r.marginRight,paddingTop:r.paddingTop,paddingBottom:r.paddingBottom,paddingLeft:r.paddingLeft,paddingRight:r.paddingRight,mouseTool:r.mouseTool,initialXDomain:r.initialXDomain,initialYDomain:r.initialYDomain,trackSourceServers:r.trackSourceServers,zoomable:r.zoomable,draggingHappening:r.draggingHappening})}},{key:"getXYScales",value:function(){this.trackRenderer&&(this.xScale=this.trackRenderer.currentXScale,this.yScale=this.trackRenderer.currentYScale)}},{key:"rangeViewToDataLoci",value:function(r,i){return i?[Number.parseInt(i.invert(r[0]),10),Number.parseInt(i.invert(r[1]),10)]:[null,null]}},{key:"rangeSelectionResetHandler",value:function(){this.state.rangeSelectionMaster&&this.setState({is1dRangeSelection:null,rangeSelection:[null,null],rangeSelectionMaster:null,rangeSelectionEnd:!1})}},{key:"rangeSelection1dEndHandler",value:function(r){(!this.xScale||!this.yScale)&&this.getXYScales();const i=r==="x"?this.xScale:this.yScale;return o=>{this.setState(a=>{const s=a.is1dRangeSelection?[null,null]:a.rangeSelection.slice(),c=!this.state.is1dRangeSelection&&r==="y"?1:0;let l=this.rangeViewToDataLoci(o,i);const u=l[1]-l[0];if(this.props.rangeSelection1dSize[0]>u){const f=l[0]+u/2;l=[f-this.props.rangeSelection1dSize[0]/2,f+this.props.rangeSelection1dSize[0]/2]}else if(this.props.rangeSelection1dSize[1]<u){const f=l[0]+u/2;l=[f-this.props.rangeSelection1dSize[1]/2,f+this.props.rangeSelection1dSize[1]/2]}return s[c]=l,this.props.rangeSelectionToInt&&(s[c]=s[c].map(f=>Math.round(f))),{rangeSelection:s,rangeSelectionEnd:!0}})}}},{key:"rangeSelection1dHandler",value:function(r){(!this.xScale||!this.yScale)&&this.getXYScales();const i=r==="x"?this.xScale:this.yScale;return o=>{this.setState(a=>{const s=a.is1dRangeSelection?[null,null]:a.rangeSelection.slice(),c=!a.is1dRangeSelection&&r==="y"?1:0;return s[c]=this.rangeViewToDataLoci(o,i),{rangeSelection:s,rangeSelectionEnd:!1}})}}},{key:"rangeSelection1dStartHandler",value:function(){this.state.rangeSelectionMaster||this.setState({is1dRangeSelection:!0,rangeSelectionMaster:!0,rangeSelectionEnd:!1})}},{key:"rangeSelection2dHandler",value:function(r){(!this.xScale||!this.yScale)&&this.getXYScales(),this.setState({rangeSelection:[this.rangeViewToDataLoci(r[0],this.xScale),this.rangeViewToDataLoci(r[1],this.yScale)],rangeSelectionEnd:!1})}},{key:"rangeSelection2dStartHandler",value:function(){this.state.rangeSelectionMaster||this.setState({is1dRangeSelection:!1,rangeSelectionMaster:!0,rangeSelectionEnd:!1})}},{key:"rangeSelection2dEndHandler",value:function(r){(!this.xScale||!this.yScale)&&this.getXYScales();const i=this.rangeViewToDataLoci(r[0],this.xScale),o=this.rangeViewToDataLoci(r[1],this.yScale);let a=[i,o];const s=i[1]-i[0],c=o[1]-o[0],l=[s,c];a.forEach((u,f)=>{if(this.props.rangeSelection1dSize[0]>l[f]){const h=u[0]+Math.round(l[f]/2);u[0]=h-this.props.rangeSelection1dSize[0]/2,u[1]=h+this.props.rangeSelection1dSize[0]/2}else if(this.props.rangeSelection1dSize[1]<l[f]){const h=u[0]+Math.round(l[f]/2);u[0]=h-this.props.rangeSelection1dSize[1]/2,u[1]=h+this.props.rangeSelection1dSize[1]/2}}),this.props.rangeSelectionToInt&&(a=a.map(u=>u.map(f=>Math.round(f)))),this.setState({rangeSelection:a,rangeSelectionEnd:!0})}},{key:"getContextMenu",value:function(){if(this.state.contextMenuPosition){const r=this.listTracksAtPosition(this.state.contextMenuPosition.canvasLeft,this.state.contextMenuPosition.canvasTop);return x.createElement(Go,{onMenuClosed:this.closeMenusBound},x.createElement(Bz,{apiPublish:this.props.apiPublish,closeMenu:this.closeMenusBound,coords:[this.state.contextMenuDataX,this.state.contextMenuDataY],customItems:this.state.contextMenuCustomItems,genomePositionSearchBox:this.props.genomePositionSearchBox,onAddDivisor:this.handleAddDivisorBound,onAddSeries:this.handleAddSeriesBound,onAddTrack:i=>{this.props.onTracksAdded([i],i.position,null,null),this.handleCloseContextMenu()},onChangeTrackData:this.handleChangeTrackDataBound,onChangeTrackType:this.handleChangeTrackTypeBound,onCloseTrack:this.handleCloseTrackBound,onConfigureTrack:this.handleConfigureTrackBound,onExportData:this.handleExportTrackDataBound,onLockValueScale:this.handleLockValueScaleBound,onReplaceTrack:this.handleReplaceTrackBound,onTrackOptionsChanged:this.handleTrackOptionsChangedBound,onUnlockValueScale:this.handleUnlockValueScaleBound,orientation:"right",position:this.state.contextMenuPosition,theme:this.props.theme,trackRenderer:this.trackRenderer,tracks:r,trackSourceServers:this.props.trackSourceServers}))}return null}},{key:"getIdealizedTrackPositionsOverlay",value:function(){const r=this.props.draggingHappening,{datatype:i}=r,o=Ike(i,r.defaultTracks);if(!o)return null;const a=new Set(["top","left","right","center","bottom"].filter(E=>E in this.state.tracks&&this.state.tracks[E].length)),s="top"in o,c="left"in o,l="right"in o,u="bottom"in o,f="center"in o,h="center"in o||a.has("left")||a.has("right")||a.has("center"),p="top"in o,d="bottom"in o&&h,g="left"in o&&h,y="right"in o&&h,b=Object.keys(o).length&&("center"in o||h),m=x.createElement("div",{style:{flexGrow:1}}),v=x.cloneElement(m),_=x.createElement("div",{style:{display:"flex",flexGrow:1}},p&&(b||g)?m:null,x.createElement(P1,{defaultTrackType:o.top,draggingHappening:this.props.draggingHappening,enabled:s,onTrackDropped:E=>this.handleTracksAdded([E],"top"),style:{border:"1px solid black",flexGrow:1}}),p&&(b||g)?v:null),T=x.createElement("div",{style:{display:"flex",flexGrow:1}},p&&(b||g)?m:null,x.createElement(P1,{defaultTrackType:o.bottom,draggingHappening:this.props.draggingHappening,enabled:u,onTrackDropped:E=>this.handleTracksAdded([E],"bottom"),style:{border:"1px solid black",flexGrow:1}}),p&&(b||g)?v:null),w=x.createElement(P1,{defaultTrackType:o.left,draggingHappening:this.props.draggingHappening,enabled:c,onTrackDropped:E=>this.handleTracksAdded([E],"left"),style:{border:"1px solid black",flexGrow:1}}),S=x.createElement(P1,{defaultTrackType:o.center,draggingHappening:this.props.draggingHappening,enabled:f,onTrackDropped:E=>this.handleTracksAdded([E],"center"),position:"center",style:{border:"1px solid black",flexGrow:1}}),k=x.cloneElement(w,{defaultTrackType:o.right,enabled:l,onTrackDropped:E=>this.handleTracksAdded([E],"right")});return x.createElement("div",{style:{position:"absolute",left:"0px",top:"0px",width:this.state.width,height:this.state.height}},x.createElement("div",{style:{position:"absolute",width:this.state.width,height:this.state.height,background:"white",opacity:.4}}),x.createElement("div",{style:{width:this.state.width,height:this.state.height,position:"absolute",display:"flex",flexDirection:"column"}},p?_:null,h&&x.createElement("div",{style:{display:"flex",height:p||d?"40%":"100%",width:"100%"}},g?w:null,b?S:null,y?k:null),d?T:null))}},{key:"render",value:function(){this.galleryDim=this.props.tracks.gallery?this.props.tracks.gallery.map(m=>Zn(m)).reduce(zo,0):0,this.topHeightNoGallery=this.props.tracks.top.map(m=>Zn(m)).reduce(zo,0),this.topHeight=this.topHeightNoGallery+this.galleryDim,this.bottomHeightNoGallery=this.props.tracks.bottom.map(m=>Zn(m)).reduce(zo,0),this.bottomHeight=this.bottomHeightNoGallery+this.galleryDim,this.leftWidthNoGallery=this.props.tracks.left.map(m=>Qn(m)).reduce(zo,0),this.leftWidth=this.leftWidthNoGallery+this.galleryDim,this.rightWidthNoGallery=this.props.tracks.right.map(m=>Qn(m)).reduce(zo,0),this.rightWidth=this.rightWidthNoGallery+this.galleryDim;const r=this.props.paddingTop+this.props.paddingBottom,i=this.props.paddingLeft+this.props.paddingRight;this.centerHeight=Math.max(1,this.state.height-this.topHeight-this.bottomHeight-r),this.centerWidth=Math.max(1,this.state.width-this.leftWidth-this.rightWidth-i);const o="none",a=x.createElement("div",{className:"top-track-container",style:{left:this.leftWidth+this.props.paddingLeft,top:this.props.paddingTop,width:this.centerWidth,height:this.topHeightNoGallery,outline:o,position:"absolute"}},x.createElement(eg,{configTrackMenuId:this.state.configTrackMenuId,editable:this.props.editable,handleConfigTrack:this.handleConfigTrackMenuOpened.bind(this),handleResizeTrack:this.handleResizeTrack.bind(this),handleSortEnd:this.handleSortEnd.bind(this),is1dRangeSelection:this.state.is1dRangeSelection,isRangeSelectionActive:this.props.mouseTool===Xn,onAddSeries:this.handleAddSeries.bind(this),onCloseTrack:this.handleCloseTrack.bind(this),onCloseTrackMenuOpened:this.handleCloseTrackMenuOpened.bind(this),onCollapseTrack:this.handleCollapseTrack.bind(this),onExpandTrack:this.handleExpandTrack.bind(this),onConfigTrackMenuOpened:this.handleConfigTrackMenuOpened.bind(this),onRangeSelection:this.rangeSelection1dHandler("x").bind(this),onRangeSelectionEnd:this.rangeSelection1dEndHandler("x").bind(this),onRangeSelectionReset:this.rangeSelectionResetHandler.bind(this),onRangeSelectionStart:this.rangeSelection1dStartHandler.bind(this),rangeSelection:this.state.rangeSelection,rangeSelectionEnd:this.state.rangeSelectionEnd,resizeHandles:new Set(["bottom"]),scale:this.xScale,tracks:this.props.tracks.top,width:this.centerWidth})),s=x.createElement("div",{className:"left-track-container",style:{left:this.props.paddingLeft,top:this.topHeight+this.props.paddingTop,width:this.leftWidthNoGallery,height:this.centerHeight,outline:o,position:"absolute"}},x.createElement(Dk,{configTrackMenuId:this.state.configTrackMenuId,editable:this.props.editable,handleConfigTrack:this.handleConfigTrackMenuOpened.bind(this),handleResizeTrack:this.handleResizeTrack.bind(this),handleSortEnd:this.handleSortEnd.bind(this),height:this.centerHeight,is1dRangeSelection:this.state.is1dRangeSelection,isRangeSelectionActive:this.props.mouseTool===Xn,onAddSeries:this.handleAddSeries.bind(this),onCloseTrack:this.handleCloseTrack.bind(this),onCloseTrackMenuOpened:this.handleCloseTrackMenuOpened.bind(this),onCollapseTrack:this.handleCollapseTrack.bind(this),onExpandTrack:this.handleExpandTrack.bind(this),onConfigTrackMenuOpened:this.handleConfigTrackMenuOpened.bind(this),onRangeSelection:this.rangeSelection1dHandler("y").bind(this),onRangeSelectionEnd:this.rangeSelection1dEndHandler("y").bind(this),onRangeSelectionReset:this.rangeSelectionResetHandler.bind(this),onRangeSelectionStart:this.rangeSelection1dStartHandler.bind(this),rangeSelection:this.state.rangeSelection,rangeSelectionEnd:this.state.rangeSelectionEnd,resizeHandles:new Set(["right"]),scale:this.yScale,tracks:this.props.tracks.left})),c=x.createElement("div",{className:"right-track-container",style:{right:this.props.paddingRight,top:this.topHeight+this.props.paddingTop,width:this.rightWidthNoGallery,height:this.centerHeight,outline:o,position:"absolute"}},x.createElement(Dk,{configTrackMenuId:this.state.configTrackMenuId,editable:this.props.editable,handleConfigTrack:this.handleConfigTrackMenuOpened.bind(this),handleResizeTrack:this.handleResizeTrack.bind(this),handleSortEnd:this.handleSortEnd.bind(this),height:this.centerHeight,is1dRangeSelection:this.state.is1dRangeSelection,isRangeSelectionActive:this.props.mouseTool===Xn,onAddSeries:this.handleAddSeries.bind(this),onCloseTrack:this.handleCloseTrack.bind(this),onCloseTrackMenuOpened:this.handleCloseTrackMenuOpened.bind(this),onCollapseTrack:this.handleCollapseTrack.bind(this),onExpandTrack:this.handleExpandTrack.bind(this),onConfigTrackMenuOpened:this.handleConfigTrackMenuOpened.bind(this),onRangeSelection:this.rangeSelection1dHandler("y").bind(this),onRangeSelectionEnd:this.rangeSelection1dEndHandler("y").bind(this),onRangeSelectionReset:this.rangeSelectionResetHandler.bind(this),onRangeSelectionStart:this.rangeSelection1dStartHandler.bind(this),rangeSelection:this.state.rangeSelection,rangeSelectionEnd:this.state.rangeSelectionEnd,resizeHandles:new Set(["left"]),scale:this.yScale,tracks:this.props.tracks.right,tracksControlAlignLeft:!0})),l=x.createElement("div",{className:"bottom-track-container",style:{left:this.leftWidth+this.props.paddingLeft,bottom:this.props.paddingBottom,width:this.centerWidth,height:this.bottomHeightNoGallery,outline:o,position:"absolute"}},x.createElement(eg,{configTrackMenuId:this.state.configTrackMenuId,editable:this.props.editable,handleConfigTrack:this.handleConfigTrackMenuOpened.bind(this),handleResizeTrack:this.handleResizeTrack.bind(this),handleSortEnd:this.handleSortEnd.bind(this),is1dRangeSelection:this.state.is1dRangeSelection,isRangeSelectionActive:this.props.mouseTool===Xn,onAddSeries:this.handleAddSeries.bind(this),onCloseTrack:this.handleCloseTrack.bind(this),onCloseTrackMenuOpened:this.handleCloseTrackMenuOpened.bind(this),onCollapseTrack:this.handleCollapseTrack.bind(this),onExpandTrack:this.handleExpandTrack.bind(this),onConfigTrackMenuOpened:this.handleConfigTrackMenuOpened.bind(this),onRangeSelection:this.rangeSelection1dHandler("x").bind(this),onRangeSelectionEnd:this.rangeSelection1dEndHandler("x").bind(this),onRangeSelectionReset:this.rangeSelectionResetHandler.bind(this),onRangeSelectionStart:this.rangeSelection1dStartHandler.bind(this),rangeSelection:this.state.rangeSelection,rangeSelectionEnd:this.state.rangeSelectionEnd,resizeHandles:new Set(["top"]),scale:this.xScale,tracks:this.props.tracks.bottom,width:this.centerWidth})),u=x.createElement("div",{key:"galleryTracksDiv",className:"gallery-track-container",style:{left:this.leftWidthNoGallery+this.props.paddingLeft,top:this.topHeightNoGallery+this.props.paddingTop,width:this.centerWidth+2*this.galleryDim,height:this.centerHeight+2*this.galleryDim,outline:o,position:"absolute"}},x.createElement(MN,{configTrackMenuId:this.state.configTrackMenuId,editable:this.props.editable,height:this.centerHeight+2*this.galleryDim,onAddSeries:this.handleAddSeries.bind(this),onCloseTrack:this.handleCloseTrack.bind(this),onCloseTrackMenuOpened:this.handleCloseTrackMenuOpened.bind(this),onConfigTrackMenuOpened:this.handleConfigTrackMenuOpened.bind(this),tracks:this.props.tracks.gallery,width:this.centerWidth+2*this.galleryDim}));let f=x.createElement("div",{className:$t("center-track-container",Ew["center-track-container"]),style:{left:this.leftWidth+this.props.paddingLeft,top:this.topHeight+this.props.paddingTop,width:this.centerWidth,height:this.bottomHeight,outline:o}});this.props.tracks.center.length&&(f=x.createElement("div",{className:$t("center-track-container",Ew["center-track-container"]),style:{left:this.leftWidth+this.props.paddingLeft,top:this.topHeight+this.props.paddingTop,width:this.centerWidth,height:this.centerHeight,outline:o}},x.createElement(xw,{configTrackMenuId:this.state.configTrackMenuId,editable:this.props.editable,height:this.centerHeight,is1dRangeSelection:this.state.is1dRangeSelection,isRangeSelectionActive:this.props.mouseTool===Xn,onAddSeries:this.handleAddSeries.bind(this),onCloseTrackMenuOpened:this.handleCloseTrackMenuOpened.bind(this),onConfigTrackMenuOpened:this.handleConfigTrackMenuOpened.bind(this),onRangeSelectionReset:this.rangeSelectionResetHandler.bind(this),onRangeSelectionStart:this.rangeSelection2dStartHandler.bind(this),onRangeSelectionX:this.rangeSelection1dHandler("x").bind(this),onRangeSelectionXEnd:this.rangeSelection1dEndHandler("x").bind(this),onRangeSelectionXY:this.rangeSelection2dHandler.bind(this),onRangeSelectionXYEnd:this.rangeSelection2dEndHandler.bind(this),onRangeSelectionY:this.rangeSelection1dHandler("y").bind(this),onRangeSelectionYEnd:this.rangeSelection1dEndHandler("y").bind(this),rangeSelection:this.state.rangeSelection,rangeSelectionEnd:this.state.rangeSelectionEnd,scaleX:this.xScale,scaleY:this.yScale,tracks:this.props.tracks.center,uid:this.props.tracks.center[0].uid,width:this.centerWidth}))),this.createTrackPositionTexts();let h=this.positionedTracks();h=h.concat(this.overlayTracks(h));let p=null;this.state.sizeMeasured&&(p=x.createElement(uke,{ref:m=>{this.trackRenderer=m,this.checkAllTilesetInfoReceived()},canvasElement:this.props.canvasElement,centerHeight:this.centerHeight,centerWidth:this.centerWidth,disableTrackMenu:this.props.disableTrackMenu,dragging:this.props.dragging,galleryDim:this.galleryDim,getLockGroupExtrema:this.props.getLockGroupExtrema,height:this.state.height,initialXDomain:this.props.initialXDomain,initialYDomain:this.props.initialYDomain,isRangeSelection:this.props.mouseTool===Xn,isShowGlobalMousePosition:this.props.isShowGlobalMousePosition,isValueScaleLocked:this.props.isValueScaleLocked,leftWidth:this.leftWidth,leftWidthNoGallery:this.leftWidthNoGallery,metaTracks:this.props.metaTracks,onMouseMoveZoom:this.props.onMouseMoveZoom,onNewTilesLoaded:this.props.onNewTilesLoaded,onScalesChanged:this.handleScalesChanged.bind(this),onTilesetInfoReceived:this.handleTilesetInfoReceived.bind(this),onTrackOptionsChanged:this.handleTrackOptionsChanged.bind(this),onValueScaleChanged:this.props.onValueScaleChanged,paddingLeft:this.props.paddingLeft,paddingTop:this.props.paddingTop,pixiRenderer:this.props.pixiRenderer,pixiStage:this.props.pixiStage,pluginDataFetchers:this.props.pluginDataFetchers,pluginTracks:this.props.pluginTracks,positionedTracks:h,registerDraggingChangedListener:this.props.registerDraggingChangedListener,removeDraggingChangedListener:this.props.removeDraggingChangedListener,setCentersFunction:this.props.setCentersFunction,svgElement:this.props.svgElement,topHeight:this.topHeight,topHeightNoGallery:this.topHeightNoGallery,uid:this.props.uid,viewOptions:this.props.viewOptions,width:this.state.width,xDomainLimits:this.props.xDomainLimits,yDomainLimits:this.props.yDomainLimits,zoomable:this.props.zoomable,zoomLimits:this.props.zoomLimits},a,s,c,l,u,f));let d=null,g=null;this.state.configTrackMenuId&&(d=x.createElement(Go,{onMenuClosed:this.closeMenusBound},x.createElement(ape,{ref:m=>{this.configTrackMenu=m},apiPublish:this.props.apiPublish,closeMenu:this.closeMenusBound,onAddDivisor:this.handleAddDivisorBound,onAddSeries:this.handleAddSeriesBound,onAddTrack:this.handleAddTrackBound,onChangeTrackType:this.handleChangeTrackTypeBound,onCloseTrack:this.handleCloseTrackBound,onConfigureTrack:this.handleConfigureTrackBound,onExportData:this.handleExportTrackDataBound,onLockValueScale:this.handleLockValueScaleBound,onReplaceTrack:this.handleReplaceTrackBound,onTrackOptionsChanged:this.handleTrackOptionsChangedBound,onUnlockValueScale:this.handleUnlockValueScaleBound,position:this.state.configTrackMenuLocation,theme:this.props.theme,trackOrientation:Mu(this.props.tracks,this.state.configTrackMenuId),trackRenderer:this.trackRenderer,tracks:[rn(this.props.tracks,this.state.configTrackMenuId)]}))),this.state.closeTrackMenuId&&(g=x.createElement(Go,{onMenuClosed:this.handleCloseTrackMenuClosed.bind(this)},x.createElement(Yo,{position:this.state.closeTrackMenuLocation,theme:this.props.theme},x.createElement(CR,{onCloseTrack:this.handleCloseTrack.bind(this),tracks:[rn(this.props.tracks,this.state.closeTrackMenuId)]}))));let y=null;this.props.chooseTrackHandler&&(y=h.filter(m=>m.track.position!=="whole").map(m=>{let v="tiled-plot-track-overlay-animate";return(this.state.mouseOverOverlayUid||this.props.overTrackChooser)&&(v="tiled-plot-track-overlay-plain"),this.state.mouseOverOverlayUid===m.track.uid&&(v="tiled-plot-track-overlay-selected"),x.createElement("div",{className:ti[v],key:m.track.uid,onClick:_=>this.handleTrackPositionChosen(m,_),onDragEnter:_=>{this.handleOverlayMouseEnter(m.track.uid),_.preventDefault()},onDragLeave:()=>this.handleOverlayMouseLeave(m.track.uid),onDragOver:_=>_.preventDefault(),onDrop:()=>this.handleTrackPositionChosen(m),onMouseEnter:()=>this.handleOverlayMouseEnter(m.track.uid),onMouseLeave:()=>this.handleOverlayMouseLeave(m.track.uid),style:{position:"absolute",left:m.left,top:m.top,width:Qn(m),height:Zn(m),zIndex:1}})}));let b=null;if(this.xScale&&this.yScale&&this.props.editable&&this.state.trackOptions){const m=this.state.trackOptions.configComponent,v=this.state.trackOptions.track;b=x.createElement(m,{track:v,xScale:this.xScale,yScale:this.yScale,onCancel:()=>{this.setState({trackOptions:null})},onTrackOptionsChanged:_=>_,onSubmit:_=>{this.handleTrackOptionsChanged(this.state.trackOptions.track.uid,_),this.setState({trackOptions:null})}})}return x.createElement("div",{ref:m=>{this.divTiledPlot=m},className:$t("tiled-plot-div",ti["tiled-plot"]),onClick:this.handleClickBound,style:{marginBottom:this.props.marginBottom,marginLeft:this.props.marginLeft,marginRight:this.props.marginRight,marginTop:this.props.marginTop}},p,y,d,g,b,this.getContextMenu(),this.props.draggingHappening&&this.getIdealizedTrackPositionsOverlay())}},{key:"addEventListeners",value:function(){this.eventListeners=[],this.eventListeners.forEach(r=>document.addEventListener(r.name,r.callback,!1))}},{key:"removeEventListeners",value:function(){this.eventListeners.forEach(r=>document.removeEventListener(r.name,r.callback))}}])}(x.Component);$k.defaultProps={isShowGlobalMousePosition:!1,pluginTracks:{},metaTracks:[],zoomable:!0},$k.propTypes={addTrackExtent:q.string,addTrackPosition:q.string,canvasElement:q.object,chooseTrackHandler:q.func,chromInfoPath:q.string,customDialog:q.array,closeCustomDialog:q.func,disableTrackMenu:q.bool,dragging:q.bool,draggingHappening:q.bool,editable:q.bool,getLockGroupExtrema:q.func,initialXDomain:q.array,initialYDomain:q.array,isShowGlobalMousePosition:q.bool,isValueScaleLocked:q.func,marginBottom:q.number.isRequired,marginLeft:q.number.isRequired,marginRight:q.number.isRequired,marginTop:q.number.isRequired,paddingBottom:q.number.isRequired,paddingLeft:q.number.isRequired,paddingRight:q.number.isRequired,paddingTop:q.number.isRequired,metaTracks:q.array,modal:q.object,mouseTool:q.string,onCloseTrack:q.func,onChangeTrackData:q.func,onChangeTrackType:q.func,onDataDomainChanged:q.func,onLockValueScale:q.func,onMouseMoveZoom:q.func,onNewTilesLoaded:q.func,onNoTrackAdded:q.func,onRangeSelection:q.func.isRequired,onScalesChanged:q.func,onTrackOptionsChanged:q.func,onTrackPositionChosen:q.func,onTracksAdded:q.func,onUnlockValueScale:q.func,onValueScaleChanged:q.func,onResizeTrack:q.func,overlays:q.array,openModal:q.func,pixiRenderer:q.object,pixiStage:q.object,pluginTracks:q.object,pubSub:q.object.isRequired,rangeSelection1dSize:q.array,rangeSelectionToInt:q.bool,registerDraggingChangedListener:q.func,removeDraggingChangedListener:q.func,setCentersFunction:q.func,svgElement:q.object,theme:q.symbol.isRequired,tracks:q.object,trackSourceServers:q.array,uid:q.string,viewOptions:q.object,xDomainLimits:q.array,yDomainLimits:q.array,zoomable:q.bool,zoomLimits:q.array,zoomToDataExtentOnInit:q.func};const Fke=tl(Md(sl($k)));var jk={exports:{}},Hz;function qke(){return Hz||(Hz=1,function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{},n=function(r){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,o=0,a={},s={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function m(v){return v instanceof c?new c(v.type,m(v.content),v.alias):Array.isArray(v)?v.map(m):v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++o}),m.__id},clone:function m(v,_){_=_||{};var T,w;switch(s.util.type(v)){case"Object":if(w=s.util.objId(v),_[w])return _[w];T={},_[w]=T;for(var S in v)v.hasOwnProperty(S)&&(T[S]=m(v[S],_));return T;case"Array":return w=s.util.objId(v),_[w]?_[w]:(T=[],_[w]=T,v.forEach(function(k,E){T[E]=m(k,_)}),T);default:return v}},getLanguage:function(m){for(;m;){var v=i.exec(m.className);if(v)return v[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,v){m.className=m.className.replace(RegExp(i,"gi"),""),m.classList.add("language-"+v)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT"&&1<2)return document.currentScript;try{throw new Error}catch(T){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(T.stack)||[])[1];if(m){var v=document.getElementsByTagName("script");for(var _ in v)if(v[_].src==m)return v[_]}return null}},isActive:function(m,v,_){for(var T="no-"+v;m;){var w=m.classList;if(w.contains(v))return!0;if(w.contains(T))return!1;m=m.parentElement}return!!_}},languages:{plain:a,plaintext:a,text:a,txt:a,extend:function(m,v){var _=s.util.clone(s.languages[m]);for(var T in v)_[T]=v[T];return _},insertBefore:function(m,v,_,T){T=T||s.languages;var w=T[m],S={};for(var k in w)if(w.hasOwnProperty(k)){if(k==v)for(var E in _)_.hasOwnProperty(E)&&(S[E]=_[E]);_.hasOwnProperty(k)||(S[k]=w[k])}var P=T[m];return T[m]=S,s.languages.DFS(s.languages,function(C,I){I===P&&C!=m&&(this[C]=S)}),S},DFS:function m(v,_,T,w){w=w||{};var S=s.util.objId;for(var k in v)if(v.hasOwnProperty(k)){_.call(v,k,v[k],T||k);var E=v[k],P=s.util.type(E);P==="Object"&&!w[S(E)]?(w[S(E)]=!0,m(E,_,null,w)):P==="Array"&&!w[S(E)]&&(w[S(E)]=!0,m(E,_,k,w))}}},plugins:{},highlightAll:function(m,v){s.highlightAllUnder(document,m,v)},highlightAllUnder:function(m,v,_){var T={callback:_,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};s.hooks.run("before-highlightall",T),T.elements=Array.prototype.slice.apply(T.container.querySelectorAll(T.selector)),s.hooks.run("before-all-elements-highlight",T);for(var w=0,S;S=T.elements[w++];)s.highlightElement(S,v===!0,T.callback)},highlightElement:function(m,v,_){var T=s.util.getLanguage(m),w=s.languages[T];s.util.setLanguage(m,T);var S=m.parentElement;S&&S.nodeName.toLowerCase()==="pre"&&s.util.setLanguage(S,T);var k=m.textContent,E={element:m,language:T,grammar:w,code:k};function P(I){E.highlightedCode=I,s.hooks.run("before-insert",E),E.element.innerHTML=E.highlightedCode,s.hooks.run("after-highlight",E),s.hooks.run("complete",E),_&&_.call(E.element)}if(s.hooks.run("before-sanity-check",E),S=E.element.parentElement,S&&S.nodeName.toLowerCase()==="pre"&&!S.hasAttribute("tabindex")&&S.setAttribute("tabindex","0"),!E.code){s.hooks.run("complete",E),_&&_.call(E.element);return}if(s.hooks.run("before-highlight",E),!E.grammar){P(s.util.encode(E.code));return}if(v&&r.Worker){var C=new Worker(s.filename);C.onmessage=function(I){P(I.data)},C.postMessage(JSON.stringify({language:E.language,code:E.code,immediateClose:!0}))}else P(s.highlight(E.code,E.grammar,E.language))},highlight:function(m,v,_){var T={code:m,grammar:v,language:_};if(s.hooks.run("before-tokenize",T),!T.grammar)throw new Error('The language "'+T.language+'" has no grammar.');return T.tokens=s.tokenize(T.code,T.grammar),s.hooks.run("after-tokenize",T),c.stringify(s.util.encode(T.tokens),T.language)},tokenize:function(m,v){var _=v.rest;if(_){for(var T in _)v[T]=_[T];delete v.rest}var w=new f;return h(w,w.head,m),u(m,w,v,w.head,0),d(w)},hooks:{all:{},add:function(m,v){var _=s.hooks.all;_[m]=_[m]||[],_[m].push(v)},run:function(m,v){var _=s.hooks.all[m];if(!(!_||!_.length))for(var T=0,w;w=_[T++];)w(v)}},Token:c};r.Prism=s;function c(m,v,_,T){this.type=m,this.content=v,this.alias=_,this.length=(T||"").length|0}c.stringify=function m(v,_){if(typeof v=="string")return v;if(Array.isArray(v)){var T="";return v.forEach(function(P){T+=m(P,_)}),T}var w={type:v.type,content:m(v.content,_),tag:"span",classes:["token",v.type],attributes:{},language:_},S=v.alias;S&&(Array.isArray(S)?Array.prototype.push.apply(w.classes,S):w.classes.push(S)),s.hooks.run("wrap",w);var k="";for(var E in w.attributes)k+=" "+E+'="'+(w.attributes[E]||"").replace(/"/g,"&quot;")+'"';return"<"+w.tag+' class="'+w.classes.join(" ")+'"'+k+">"+w.content+"</"+w.tag+">"};function l(m,v,_,T){m.lastIndex=v;var w=m.exec(_);if(w&&T&&w[1]){var S=w[1].length;w.index+=S,w[0]=w[0].slice(S)}return w}function u(m,v,_,T,w,S){for(var k in _)if(!(!_.hasOwnProperty(k)||!_[k])){var E=_[k];E=Array.isArray(E)?E:[E];for(var P=0;P<E.length;++P){if(S&&S.cause==k+","+P)return;var C=E[P],I=C.inside,O=!!C.lookbehind,M=!!C.greedy,R=C.alias;if(M&&!C.pattern.global){var z=C.pattern.toString().match(/[imsuy]*$/)[0];C.pattern=RegExp(C.pattern.source,z+"g")}for(var U=C.pattern||C,j=T.next,H=w;j!==v.tail&&!(S&&H>=S.reach);H+=j.value.length,j=j.next){var W=j.value;if(v.length>m.length)return;if(!(W instanceof c)){var re=1,Y;if(M){if(Y=l(U,H,m,O),!Y||Y.index>=m.length)break;var G=Y.index,F=Y.index+Y[0].length,L=H;for(L+=j.value.length;G>=L;)j=j.next,L+=j.value.length;if(L-=j.value.length,H=L,j.value instanceof c)continue;for(var K=j;K!==v.tail&&(L<F||typeof K.value=="string");K=K.next)re++,L+=K.value.length;re--,W=m.slice(H,L),Y.index-=H}else if(Y=l(U,0,W,O),!Y)continue;var G=Y.index,te=Y[0],de=W.slice(0,G),ce=W.slice(G+te.length),le=H+W.length;S&&le>S.reach&&(S.reach=le);var me=j.prev;de&&(me=h(v,me,de),H+=de.length),p(v,me,re);var ye=new c(k,I?s.tokenize(te,I):te,R,te);if(j=h(v,me,ye),ce&&h(v,j,ce),re>1){var Oe={cause:k+","+P,reach:le};u(m,v,_,j.prev,H,Oe),S&&Oe.reach>S.reach&&(S.reach=Oe.reach)}}}}}}function f(){var m={value:null,prev:null,next:null},v={value:null,prev:m,next:null};m.next=v,this.head=m,this.tail=v,this.length=0}function h(m,v,_){var T=v.next,w={value:_,prev:v,next:T};return v.next=w,T.prev=w,m.length++,w}function p(m,v,_){for(var T=v.next,w=0;w<_&&T!==m.tail;w++)T=T.next;v.next=T,T.prev=v,m.length-=w}function d(m){for(var v=[],_=m.head.next;_!==m.tail;)v.push(_.value),_=_.next;return v}if(!r.document)return r.addEventListener&&(s.disableWorkerMessageHandler||r.addEventListener("message",function(m){var v=JSON.parse(m.data),_=v.language,T=v.code,w=v.immediateClose;r.postMessage(s.highlight(T,s.languages[_],_)),w&&r.close()},!1)),s;var g=s.util.currentScript();g&&(s.filename=g.src,g.hasAttribute("data-manual")&&(s.manual=!0));function y(){s.manual||s.highlightAll()}if(!s.manual){var b=document.readyState;b==="loading"||b==="interactive"&&g&&g.defer?document.addEventListener("DOMContentLoaded",y):window.requestAnimationFrame?window.requestAnimationFrame(y):window.setTimeout(y,16)}return s}(t);e.exports&&(e.exports=n),typeof globalThis<"u"&&(globalThis.Prism=n)}(jk)),jk.exports}var Fz=qke(),Jr={},qz;function Uke(){if(qz)return Jr;qz=1;var e=Jr&&Jr.__extends||function(){var P=function(C,I){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(O,M){O.__proto__=M}||function(O,M){for(var R in M)Object.prototype.hasOwnProperty.call(M,R)&&(O[R]=M[R])},P(C,I)};return function(C,I){if(typeof I!="function"&&I!==null)throw new TypeError("Class extends value "+String(I)+" is not a constructor or null");P(C,I);function O(){this.constructor=C}C.prototype=I===null?Object.create(I):(O.prototype=I.prototype,new O)}}(),t=Jr&&Jr.__assign||function(){return t=Object.assign||function(P){for(var C,I=1,O=arguments.length;I<O;I++){C=arguments[I];for(var M in C)Object.prototype.hasOwnProperty.call(C,M)&&(P[M]=C[M])}return P},t.apply(this,arguments)},n=Jr&&Jr.__createBinding||(Object.create?function(P,C,I,O){O===void 0&&(O=I);var M=Object.getOwnPropertyDescriptor(C,I);(!M||("get"in M?!C.__esModule:M.writable||M.configurable))&&(M={enumerable:!0,get:function(){return C[I]}}),Object.defineProperty(P,O,M)}:function(P,C,I,O){O===void 0&&(O=I),P[O]=C[I]}),r=Jr&&Jr.__setModuleDefault||(Object.create?function(P,C){Object.defineProperty(P,"default",{enumerable:!0,value:C})}:function(P,C){P.default=C}),i=Jr&&Jr.__importStar||function(P){if(P&&P.__esModule)return P;var C={};if(P!=null)for(var I in P)I!=="default"&&Object.prototype.hasOwnProperty.call(P,I)&&n(C,P,I);return r(C,P),C},o=Jr&&Jr.__rest||function(P,C){var I={};for(var O in P)Object.prototype.hasOwnProperty.call(P,O)&&C.indexOf(O)<0&&(I[O]=P[O]);if(P!=null&&typeof Object.getOwnPropertySymbols=="function")for(var M=0,O=Object.getOwnPropertySymbols(P);M<O.length;M++)C.indexOf(O[M])<0&&Object.prototype.propertyIsEnumerable.call(P,O[M])&&(I[O[M]]=P[O[M]]);return I};Object.defineProperty(Jr,"__esModule",{value:!0});var a=i(x),s=13,c=9,l=8,u=89,f=90,h=77,p=57,d=219,g=222,y=192,b=27,m=100,v=3e3,_=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),T=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),w="npm__react-simple-code-editor__textarea",S=`
300
+ `)}function l(f){return f.map(u).join(e)}function u(f){return f==null?"":f instanceof Date?f9e(f):t.test(f+="")?'"'+f.replace(/"/g,'""')+'"':f}return{parse:r,parseRows:i,format:a,formatBody:s,formatRows:c,formatRow:l,formatValue:u}}var h9e=Cz(","),p9e=h9e.parse,d9e=Cz(" "),g9e=d9e.parse;function Oz(e,t){return function(n,r,i){arguments.length<3&&(i=r,r=null);var o=wk(n).mimeType(e);return o.row=function(a){return arguments.length?o.response(m9e(t,r=a)):r},o.row(r),i?o.get(i):o}}function m9e(e,t){return function(n){return e(n.responseText,t)}}const v9e=Oz("text/csv",p9e),y9e=Oz("text/tab-separated-values",g9e),b9e=Object.freeze(Object.defineProperty({__proto__:null,csv:v9e,html:o9e,json:a9e,request:wk,text:s9e,tsv:y9e,xml:l9e},Symbol.toStringTag,{value:"Module"}));function _9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T9e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,S9e(r.key),r)}}function w9e(e,t,n){return t&&T9e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function S9e(e){var t=E9e(e,"string");return typeof t=="symbol"?t:t+""}function E9e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function k9e(e,t,n){return t=im(t),x9e(e,Pz()?Reflect.construct(t,n||[],im(e).constructor):t.apply(e,n))}function x9e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return C9e(e)}function C9e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Pz=function(){return!!e})()}function im(e){return im=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},im(e)}function O9e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xk(e,t)}function xk(e,t){return xk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},xk(e,t)}const om={pointerEvents:"all"};let Az=function(e){function t(){return _9e(this,t),k9e(this,t,arguments)}return O9e(t,e),w9e(t,[{key:"getControls",value:function(r){return x.createElement(Qd,{expandCollapseAvailable:!0,dragHandleProps:this.props.dragHandleProps,imgStyleAdd:om,imgStyleClose:om,imgStyleMove:om,imgStyleSettings:om,isAlignLeft:this.props.controlAlignLeft,isCollapsed:this.props.isCollapsed,isMoveable:this.moveable,isVertical:!0,isVisible:r,onAddSeries:this.props.onAddSeries,onCollapseTrack:this.props.onCollapseTrack,onExpandTrack:this.props.onExpandTrack,onCloseTrackMenuOpened:this.props.onCloseTrackMenuOpened,onConfigTrackMenuOpened:this.props.onConfigTrackMenuOpened,uid:this.props.uid})}}])}(Y1);function P9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A9e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,I9e(r.key),r)}}function M9e(e,t,n){return t&&A9e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function I9e(e){var t=R9e(e,"string");return typeof t=="symbol"?t:t+""}function R9e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function D9e(e,t,n){return t=Fc(t),N9e(e,Mz()?Reflect.construct(t,n||[],Fc(e).constructor):t.apply(e,n))}function N9e(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return L9e(e)}function L9e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Mz=function(){return!!e})()}function $9e(e,t,n,r){var i=Ck(Fc(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function Ck(){return Ck=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=j9e(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Ck.apply(null,arguments)}function j9e(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Fc(e))!==null;);return e}function Fc(e){return Fc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fc(e)}function B9e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ok(e,t)}function Ok(e,t){return Ok=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ok(e,t)}let z9e=function(e){function t(n,r){var i;P9e(this,t),i=D9e(this,t,[n,r]);const{registerViewportChanged:o,removeViewportChanged:a}=n,s=Mt.nice();return i.uid=s,i.removeViewportChanged=a,i.viewportXDomain=null,i.viewportYDomain=null,o(s,i.viewportChanged.bind(i)),i}return B9e(t,e),M9e(t,[{key:"viewportChanged",value:function(r,i){const o=r.domain(),a=i.domain();this.viewportXDomain=o,this.viewportYDomain=a,this.draw()}},{key:"draw",value:function(){const r=this.pMain;if(!this.viewportXDomain||!this.viewportYDomain)return;r.clear(),r.lineStyle(1,255,1),r.beginFill(16740363,1);const i=this._xScale(this.viewportXDomain[0]),o=this._yScale(this.viewportYDomain[0]),a=this._xScale(this.viewportXDomain[1])-this._xScale(this.viewportXDomain[0]),s=this._yScale(this.viewportYDomain[1])-this._yScale(this.viewportYDomain[0]);this.pMain.drawRect(i,o,a,s)}},{key:"zoomed",value:function(r,i){this.xScale(r),this.yScale(i),this.draw()}},{key:"setPosition",value:function(r){$9e(t,"setPosition",this)([r]),this.pMain.position.y=this.position[1],this.pMain.position.x=this.position[0],this.draw()}}])}(Bn);function Iz(e){this.size=0,this.limit=e,this._keymap={}}function H9e(e,t){const n={key:e,value:t};if(this._keymap[e]=n,this.tail?(this.tail.newer=n,n.older=this.tail):this.head=n,this.tail=n,this.size===this.limit)return this.shift();this.size+=1}function F9e(){const e=this.head;return e&&(this.head.newer?(this.head=this.head.newer,this.head.older=void 0):(this.head=void 0,this.tail=void 0),e.newer=void 0,e.older=void 0,delete this._keymap[e.key],this.size-=1),e}function q9e(e,t){const n=this._keymap[e];if(n!==void 0)return n===this.tail||(n.newer&&(n===this.head&&(this.head=n.newer),n.newer.older=n.older),n.older&&(n.older.newer=n.newer),n.newer=void 0,n.older=this.tail,this.tail&&(this.tail.newer=n),this.tail=n),t?n:n.value}function U9e(e){return this._keymap[e]}function V9e(e,t){const n=this.get(e,!0);let r;return n?(r=n.value,n.value=t):(r=this.put(e,t),r&&(r=r.value)),r}function G9e(e){const t=this._keymap[e];if(t)return delete this._keymap[t.key],t.newer&&t.older?(t.older.newer=t.newer,t.newer.older=t.older):t.newer?(t.newer.older=void 0,this.head=t.newer):t.older?(t.older.newer=void 0,this.tail=t.older):(this.head=void 0,this.tail=void 0),this.size-=1,t.value}function W9e(){this.head=void 0,this.tail=void 0,this.size=0,this._keymap={}}function Y9e(){return Object.keys(this._keymap)}function X9e(e,t,n){let r;if(t===!0?(n=!0,t=void 0):typeof t!="object"&&(t=this),n)for(r=this.tail;r;)e.call(t,r.key,r.value,this),r=r.older;else for(r=this.head;r;)e.call(t,r.key,r.value,this),r=r.newer}function K9e(){const e=[];let t=this.head;for(;t;)e.push({key:t.key.toJSON(),value:t.value.toJSON()}),t=t.newer;return e}function Z9e(){let e="",t=this.head;for(;t;)e+=`${String(t.key)}:${t.value}`,t=t.newer,t&&(e+=" < ");return e}Object.assign(Iz.prototype,{put:H9e,get:q9e,find:U9e,keys:Y9e,set:V9e,shift:F9e,remove:G9e,removeAll:W9e,forEach:X9e,toJSON:K9e,toString:Z9e});const Pk="2.3.2",Rz={...NX,IS_TRACK_RANGE_SELECTABLE:$s,OPTIONS_INFO:zi},Q9e={d3Array:pq,d3Axis:W0e,d3Brush:Rne,d3Color:Cq,d3Drag:hJ,d3Dsv:cX,d3Format:tU,d3Geo:J5e,d3Queue:Ate,d3Request:b9e,d3Scale:AV,d3Selection:fW,d3Transition:xee,d3Zoom:Ree,PIXI:Rz.GLOBALS.PIXI,mix:ul,slugid:Mt},am={chromosomes:{ChromosomeInfo:yo,SearchField:iw},libraries:Q9e,tracks:{Annotations1dTrack:K$,Annotations2dTrack:Q$,ArrowheadDomainsTrack:tj,BarTrack:m5,BedLikeTrack:WE,CNVIntervalTrack:nj,Chromosome2DAnnotations:gj,Chromosome2DLabels:vj,ChromosomeGrid:th,CombinedTrack:b0,CrossRule:Yj,DivergentBarTrack:B$,HeatmapTiledPixiTrack:Ql,Horizontal1dHeatmapTrack:H$,Horizontal2DDomainsTrack:hj,HorizontalChromosomeLabels:Tj,HorizontalGeneAnnotationsTrack:B5,HorizontalHeatmapTrack:xj,HorizontalLine1DPixiTrack:ac,HorizontalMultivecTrack:U$,HorizontalPoint1DPixiTrack:G$,HorizontalRule:tB,HorizontalTiled1DPixiTrack:Yl,HorizontalTiledPlot:eg,HorizontalTrack:yL,Id2DTiledPixiTrack:g$,IdHorizontal1DTiledPixiTrack:v$,IdVertical1DTiledPixiTrack:T$,LeftAxisTrack:O$,MapboxTilesTrack:iB,MoveableTrack:Y1,OSMTileIdsTrack:aB,OSMTilesTrack:ih,OverlayTrack:M$,PixiTrack:Bn,RasterTilesTrack:lB,SVGTrack:ko,SquareMarkersTrack:Ej,Tiled1DPixiTrack:zE,TiledPixiTrack:Si,TopAxisTrack:D$,Track:Ja,ValueIntervalTrack:Aj,VerticalRule:Vj,VerticalTiled1DPixiTrack:b$,VerticalTrack:Az,ViewportTracker2D:Ij,ViewportTracker2DPixi:z9e,ViewportTrackerHorizontal:c9,ViewportTrackerVertical:Nj},dataFetchers:{DataFetcher:Xf,GBKDataFetcher:KL,LocalDataFetcher:ZL,getDataFetcher:zEe},factories:{ContextMenuItem:xt,DataFetcher:Xf,LruCache:Iz},services:fte,utils:Kee,configs:Rz,VERSION:Pk},Ak={"track-renderer":"_track-renderer_11dwb_1","track-renderer-element":"_track-renderer-element_11dwb_5","track-renderer-events":"_track-renderer-events_11dwb_6"};function J9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function eke(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,rke(r.key),r)}}function tke(e,t,n){return t&&eke(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function rke(e){var t=nke(e,"string");return typeof t=="symbol"?t:t+""}function nke(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function ike(e,t,n){return t=sm(t),oke(e,Dz()?Reflect.construct(t,n||[],sm(e).constructor):t.apply(e,n))}function oke(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ake(e)}function ake(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Dz=function(){return!!e})()}function sm(e){return sm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},sm(e)}function ske(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Mk(e,t)}function Mk(e,t){return Mk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Mk(e,t)}const{getDataFetcher:lke}=am.dataFetchers,cke=100;let Ik=function(e){function t(n){var r;if(J9e(this,t),r=ike(this,t,[n]),r.dragging=!1,r.element=null,r.eventTracker=null,r.eventTrackerOld=null,r.closing=!1,r.yPositionOffset=0,r.xPositionOffset=0,r.scrollTop=0,r.scrollTimeout=null,r.activeTransitions=0,r.zoomTransform=Ar,r.windowScrolledBound=r.windowScrolled.bind(r),r.zoomStartedBound=r.zoomStarted.bind(r),r.zoomedBound=r.zoomed.bind(r),r.zoomEndedBound=r.zoomEnded.bind(r),r.uid=Mt.nice(),r.viewUid=r.props.uid,r.availableForPlugins={...am,services:{...am.services,pubSub:r.props.pubSub,pixiRenderer:r.props.pixiRenderer}},r.mounted=!1,r.emptyZoomBehavior=UT(),r.currentProps=n,r.prevPropsStr="",r.zoomBehavior=UT().filter(i=>!(i.target.classList.contains("no-zoom")||i.target.classList.contains("react-resizable-handle"))).on("start",r.zoomStartedBound).on("zoom",r.zoomedBound).on("end",r.zoomEndedBound),r.zoomTransform=Ar,r.prevZoomTransform=Ar,r.initialXDomain=[0,1],r.initialYDomain=[0,1],r.xDomainLimits=[-Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],r.yDomainLimits=[-Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],r.zoomLimits=[0,Number.MAX_SAFE_INTEGER],r.prevCenterX=r.currentProps.paddingLeft+r.currentProps.leftWidth+r.currentProps.centerWidth/2,r.prevCenterY=r.currentProps.paddingTop+r.currentProps.topHeight+r.currentProps.centerHeight/2,r.cumCenterXOffset=0,r.cumCenterYOffset=0,r.setUpInitialScales(r.currentProps.initialXDomain,r.currentProps.initialYDomain,r.currentProps.xDomainLimits,r.currentProps.yDomainLimits,r.currentProps.zoomLimits),r.setUpScales(),r.trackDefObjects={},r.metaTracks={},r.pubSubs=[],window.higlassTracksByType)for(const i in window.higlassTracksByType)Gt[i]=window.higlassTracksByType[i].config;return r.boundForwardEvent=r.forwardEvent.bind(r),r.boundScrollEvent=r.scrollEvent.bind(r),r.boundForwardContextMenu=r.forwardContextMenu.bind(r),r.dispatchEventBound=r.dispatchEvent.bind(r),r.zoomToDataPosHandlerBound=r.zoomToDataPosHandler.bind(r),r.onScrollHandlerBound=r.onScrollHandler.bind(r),r.elementPos={height:0,width:0,left:0,top:0},r.elementSelection=null,r}return ske(t,e),tke(t,[{key:"xScale",get:function(){if(!this._xScale)throw new Error("xScale is not defined");return this._xScale}},{key:"yScale",get:function(){if(!this._yScale)throw new Error("yScale is not defined");return this._yScale}},{key:"UNSAFE_componentWillMount",value:function(){this.pubSubs=[],this.pubSubs.push(this.props.pubSub.subscribe("scroll",this.windowScrolledBound)),this.pubSubs.push(this.props.pubSub.subscribe("app.event",this.dispatchEventBound)),this.pubSubs.push(this.props.pubSub.subscribe("zoomToDataPos",this.zoomToDataPosHandlerBound)),this.pubSubs.push(this.props.pubSub.subscribe("app.scroll",this.onScrollHandlerBound))}},{key:"componentDidMount",value:function(){if(!this.element)throw new Error("Component did not mount, this.element is not defined.");if(this.elementPos=this.element.getBoundingClientRect(),this.elementSelection=_t(this.element),this.pStage=new Ye.PIXI.Graphics,this.pMask=new Ye.PIXI.Graphics,this.pOutline=new Ye.PIXI.Graphics,this.pBackground=new Ye.PIXI.Graphics,this.pStage.addChild(this.pMask),this.pStage.addChild(this.pOutline),this.currentProps.pixiStage.addChild(this.pStage),this.pStage.mask=this.pMask,this.props.isRangeSelection||this.addZoom(),!this.currentProps.svgElement||!this.currentProps.canvasElement)return;this.svgElement=this.currentProps.svgElement,this.syncTrackObjects(this.currentProps.positionedTracks),this.syncMetaTracks(this.currentProps.metaTracks),this.currentProps.setCentersFunction(this.setCenter.bind(this)),this.currentProps.registerDraggingChangedListener(this.draggingChanged.bind(this)),this.draggingChanged(!0),this.addEventTracker();const r=[[this.xScale(this.xDomainLimits[0]),this.yScale(this.yDomainLimits[0])],[this.xScale(this.xDomainLimits[1]),this.yScale(this.yDomainLimits[1])]],i=this.svgElement.getBoundingClientRect(),o=[[Math.max(r[0][0],0),Math.max(r[0][1],0)],[Math.min(r[1][0],i.width),Math.min(r[1][1],i.height)]];this.zoomBehavior.extent(o).translateExtent(r).scaleExtent(this.zoomLimits)}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){if(!r.svgElement||!r.canvasElement)return;const i=this.updatablePropsToString(r);if(this.currentProps=r,this.prevPropsStr===i)return;this.setBackground();for(const c in this.trackDefObjects){const l=this.trackDefObjects[c].trackObject;l.delayDrawing=!0}this.prevPropsStr=i,this.setUpInitialScales(r.initialXDomain,r.initialYDomain,r.xDomainLimits,r.yDomainLimits,r.zoomLimits),this.setUpScales(r.width!==this.props.width||r.height!==this.props.height),this.svgElement=r.svgElement;const o=[[this.xScale(this.xDomainLimits[0]),this.yScale(this.yDomainLimits[0])],[this.xScale(this.xDomainLimits[1]),this.yScale(this.yDomainLimits[1])]],a=this.svgElement.getBoundingClientRect(),s=[[Math.max(o[0][0],0),Math.max(o[0][1],0)],[Math.min(o[1][0],a.width),Math.min(o[1][1],a.height)]];this.zoomBehavior.extent(s).translateExtent(o).scaleExtent(this.zoomLimits),this.syncTrackObjects(r.positionedTracks),this.syncMetaTracks(r.metaTracks);for(const c of r.positionedTracks){const l=c.track.options,u=this.trackDefObjects[c.track.uid].trackObject;if(u.rerender(l),Pu(c.track)){const f={};for(const h of c.track.contents)f[h.uid]=h;for(const h in u.createdTracks)u.createdTracks[h].rerender(f[h].options)}}this.props.onNewTilesLoaded();for(const c in this.trackDefObjects){const l=this.trackDefObjects[c].trackObject;l.delayDrawing=!1,l.draw()}}},{key:"componentDidUpdate",value:function(r){(this.props.initialXDomain[0]!==r.initialXDomain[0]||this.props.initialXDomain[1]!==r.initialXDomain[1]||this.props.initialYDomain[0]!==r.initialYDomain[0]||this.props.initialYDomain[1]!==r.initialYDomain[1])&&this.element&&(this.element.__zoom=Ar),r.isRangeSelection!==this.props.isRangeSelection&&(this.props.isRangeSelection?this.removeZoom():this.addZoom()),r.zoomable!==this.props.zoomable&&(this.props.zoomable?this.addZoom():this.removeZoom()),this.addEventTracker()}},{key:"componentWillUnmount",value:function(){this.mounted=!1,this.removeTracks(Object.keys(this.trackDefObjects)),this.removeMetaTracks(Object.keys(this.metaTracks)),this.currentProps.removeDraggingChangedListener(this.draggingChanged),this.pStage&&this.currentProps.pixiStage.removeChild(this.pStage),this.pMask?.destroy(!0),this.pStage?.destroy(!0),this.pubSubs.forEach(r=>this.props.pubSub.unsubscribe(r)),this.pubSubs=[],this.removeEventTracker()}},{key:"dispatchEvent",value:function(r){r.sourceUid===this.uid&&r.type!=="contextmenu"&&this.element&&Lp(r,this.element)}},{key:"isWithin",value:function(r,i){const o=r>=this.elementPos.left&&r<=this.elementPos.width+this.elementPos.left,a=i>=this.elementPos.top&&i<=this.elementPos.height+this.elementPos.top;return o&&a}},{key:"zoomToDataPosHandler",value:function({pos:r,animateTime:i}){this.zoomToDataPos(...r,i)}},{key:"addZoom",value:function(){!this.elementSelection||!this.currentProps.zoomable||(this.elementSelection.call(this.zoomBehavior),this.zoomBehavior.transform(this.elementSelection,this.zoomTransform))}},{key:"removeZoom",value:function(){this.elementSelection&&(this.zoomEnded(),this.elementSelection.on(".zoom",null))}},{key:"setMask",value:function(){this.pMask?.clear(),this.pMask?.beginFill(),this.pMask?.drawRect(this.xPositionOffset,this.yPositionOffset,this.currentProps.width,this.currentProps.height),this.pMask?.endFill()}},{key:"setBackground",value:function(){const r=this.props.theme===Qt?"black":"white",i=gt(this.currentProps.viewOptions?.backgroundColor??r);this.pBackground?.clear(),this.pBackground?.beginFill(i),this.pBackground?.drawRect(this.xPositionOffset,this.yPositionOffset,this.currentProps.width,this.currentProps.height),this.pBackground?.endFill()}},{key:"windowScrolled",value:function(){this.removeZoom(),this.scrollTimeout&&clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(()=>{this.addZoom()},cke)}},{key:"setUpInitialScales",value:function(r=[0,1],i=[0,1],o=[-Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],a=[-Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],s=[0,Number.MAX_SAFE_INTEGER]){s[0]=s[0]===null?0:s[0],s[1]=s[1]===null?Number.POSITIVE_INFINITY:s[1];const c=r[1]-r[0],l=(i[0]+i[1])/2;if(i[0]=l-c/2,i[1]=l+c/2,r[0]===this.initialXDomain[0]&&r[1]===this.initialXDomain[1]&&i[0]===this.initialYDomain[0]&&i[1]===this.initialYDomain[1]&&o[0]===this.xDomainLimits[0]&&o[1]===this.xDomainLimits[1]&&a[0]===this.yDomainLimits[0]&&a[1]===this.yDomainLimits[1]&&s[0]===this.zoomLimits[0]&&s[1]===this.zoomLimits[1])return;this.initialXDomain=r,this.initialYDomain=i,this.xDomainLimits=o,this.yDomainLimits=a,this.zoomLimits=s,this.zoomTransform=Ar,this.prevZoomTransform=Ar,this.cumCenterYOffset=0,this.cumCenterXOffset=0,this.drawableToDomainX=Et().domain([this.currentProps.paddingLeft+this.currentProps.leftWidth,this.currentProps.paddingLeft+this.currentProps.leftWidth+this.currentProps.centerWidth]).range([r[0],r[1]]);let u,f;this.currentProps.centerWidth===0?(u=this.currentProps.paddingTop+this.currentProps.topHeight,f=this.currentProps.paddingTop+this.currentProps.topHeight+this.currentProps.centerHeight):(u=this.currentProps.paddingTop+this.currentProps.topHeight+this.currentProps.centerHeight/2-this.currentProps.centerWidth/2,f=this.currentProps.paddingTop+this.currentProps.topHeight+this.currentProps.centerHeight/2+this.currentProps.centerWidth/2),this.drawableToDomainY=Et().domain([u,f]).range([i[0],i[1]]),this.prevCenterX=this.currentProps.paddingLeft+this.currentProps.leftWidth+this.currentProps.centerWidth/2,this.prevCenterY=this.currentProps.paddingTop+this.currentProps.topHeight+this.currentProps.centerHeight/2}},{key:"updatablePropsToString",value:function(r){return JSON.stringify({positionedTracks:r.positionedTracks,initialXDomain:r.initialXDomain,initialYDomain:r.initialYDomain,width:r.width,height:r.height,paddingLeft:r.paddingLeft,paddingTop:r.paddingTop,leftWidth:r.leftWidth,topHeight:r.topHeight,dragging:r.dragging,viewOptions:r.viewOptions})}},{key:"draggingChanged",value:function(r){this.dragging=r,this.timedUpdatePositionAndDimensions()}},{key:"setUpScales",value:function(r=!1){const i=this.currentProps.paddingLeft+this.currentProps.leftWidth+this.currentProps.centerWidth/2,o=this.currentProps.paddingTop+this.currentProps.topHeight+this.currentProps.centerHeight/2;if(!this.drawableToDomainX||!this.drawableToDomainY)return;const a=(this.drawableToDomainX(i)-this.drawableToDomainX(this.prevCenterX))/this.zoomTransform.k,s=(this.drawableToDomainY(o)-this.drawableToDomainY(this.prevCenterY))/this.zoomTransform.k;this.cumCenterYOffset+=s,this.cumCenterXOffset+=a,this.prevCenterY=o,this.prevCenterX=i;const c=[this.drawableToDomainX(0)-this.cumCenterXOffset,this.drawableToDomainX(this.currentProps.width)-this.cumCenterXOffset],l=[this.drawableToDomainY(0)-this.cumCenterYOffset,this.drawableToDomainY(this.currentProps.height)-this.cumCenterYOffset];this._xScale=Et().domain(c).range([0,this.currentProps.width]),this._yScale=Et().domain(l).range([0,this.currentProps.height]);for(const u in this.trackDefObjects)this.trackDefObjects[u].trackObject.refScalesChanged(this.xScale,this.yScale);this.applyZoomTransform(r)}},{key:"getTrackDef",value:function(r){const i=Yn(this.trackDefObjects);for(const[,{trackDef:o,trackObject:a}]of i){if(a===r)return o.track;if(Pu(o.track)){for(const s of o.track.contents)if(a.createdTracks[s.uid]===r)return s}}return null}},{key:"getTrackObject",value:function(r){const i=Yn(this.trackDefObjects);for(let o=0;o<i.length;o++){const a=i[o][0],s=i[o][1].trackObject;if(a===r)return s;if(s.createdTracks){const c=Yn(s.createdTracks);for(let l=0;l<c.length;l++){const u=c[l][0],f=c[l][1];if(u===r)return f}}}}},{key:"timedUpdatePositionAndDimensions",value:function(){this.closing||!this.element||(this.elementPos=this.element.getBoundingClientRect(),this.dragging&&(this.yPositionOffset=this.element.getBoundingClientRect().top-this.currentProps.canvasElement.getBoundingClientRect().top+this.scrollTop,this.xPositionOffset=this.element.getBoundingClientRect().left-this.currentProps.canvasElement.getBoundingClientRect().left,this.setMask(),this.setBackground(),this.updateTrackPositions()&&this.applyZoomTransform(!0),requestAnimationFrame(this.timedUpdatePositionAndDimensions.bind(this))))}},{key:"syncMetaTracks",value:function(r){const i=Object.keys(this.metaTracks),o=new Set(r.map(a=>a.uid));this.addMetaTracks(r.filter(a=>!this.metaTracks[a.uid])),this.updateMetaTracks(r.filter(a=>this.metaTracks[a.uid])),this.removeMetaTracks(i.filter(a=>!o.has(a)))}},{key:"syncTrackObjects",value:function(r){this.prevTrackDefinitions=JSON.stringify(r);const i={};for(let u=0;u<r.length;u++)i[r[u].track.uid]=r[u];const o=new Set(Object.keys(this.trackDefObjects)),a=new Set(Object.keys(i)),s=new Set([...a].filter(u=>!o.has(u))),c=new Set([...o].filter(u=>!a.has(u))),l=new Set([...a].filter(u=>o.has(u)));this.updateExistingTrackDefs([...l].map(u=>i[u])),this.addNewTracks([...s].map(u=>i[u])),this.updateExistingTrackDefs([...s].map(u=>i[u])),this.removeTracks([...c])}},{key:"addMetaTracks",value:function(r){r.filter(i=>!this.metaTracks[i.uid]).forEach(i=>{this.metaTracks[i.uid]={trackDef:i,trackObject:this.createMetaTrack(i)}})}},{key:"addNewTracks",value:function(r){if(this.currentProps.pixiStage){for(let i=0;i<r.length;i++){const o=r[i],a=this.createTrackObject(o.track);a.refScalesChanged(this.xScale,this.yScale),this.trackDefObjects[o.track.uid]={trackDef:o,trackObject:a};const s=this.zoomTransform.rescaleX(this.xScale),c=this.zoomTransform.rescaleY(this.yScale);a.setDimensions([o.width,o.height]),a.zoomed(s,c)}this.applyZoomTransform(!1)}}},{key:"updateMetaTracks",value:function(r){}},{key:"updateExistingTrackDefs",value:function(r){for(const o of r){const a=this.trackDefObjects[o.track.uid];a.trackDef=o,Pu(o.track)&&a.trackObject.updateContents(o.track.contents,this.createTrackObject.bind(this)).refScalesChanged(this.xScale,this.yScale)}this.updateTrackPositions()&&this.applyZoomTransform(!1)}},{key:"updateTrackPositions",value:function(){let r=!1;for(const i in this.trackDefObjects){const o=this.trackDefObjects[i].trackDef,a=this.trackDefObjects[i].trackObject,s=a.position,c=a.dimensions,l=[this.xPositionOffset+o.left,this.yPositionOffset+o.top],u=[o.width,o.height];(!s||l[0]!==s[0]||l[1]!==s[1])&&(a.setPosition(l),r=!0),(!c||u[0]!==c[0]||u[1]!==c[1])&&(a.setDimensions(u),r=!0)}return r}},{key:"removeMetaTracks",value:function(r){r.forEach(i=>{this.metaTracks[i].trackObject.remove(),this.metaTracks[i]=void 0,delete this.metaTracks[i]})}},{key:"removeTracks",value:function(r){for(let i=0;i<r.length;i++)this.trackDefObjects[r[i]].trackObject.remove(),delete this.trackDefObjects[r[i]]}},{key:"setCenter",value:function(r,i,o,a=!1,s=0,c=this.xScale,l=this.yScale){const f=(this.xScale.invert(1)-this.xScale.invert(0))/o,h=this.currentProps.paddingLeft+this.currentProps.leftWidth+this.currentProps.centerWidth/2,p=this.currentProps.paddingTop+this.currentProps.topHeight+this.currentProps.centerHeight/2,d=h-c(r)*f,g=p-l(i)*f;let y;const b=()=>{const m=Ar.translate(d,g).scale(f);this.zoomTransform=m,this.elementSelection&&this.emptyZoomBehavior.transform(this.elementSelection,m),y=this.applyZoomTransform(a)};if(s&&this.elementSelection){let m=this.elementSelection;this.activeTransitions+=1,document.hidden||(m=m.transition().duration(s)),m.call(this.zoomBehavior.transform,Ar.translate(d,g).scale(f)).on("end",()=>{b(),this.activeTransitions-=1})}else b();return y}},{key:"valueScaleMove",value:function(r){if(this.zoomStartPos){for(const i of this.getTracksAtPosition(...this.zoomStartPos))i.movedY(r);this.zoomStartTransform&&(this.zoomTransform=this.zoomStartTransform)}}},{key:"valueScaleZoom",value:function(r,i){if(!FX(r.sourceEvent))return;const o=r.sourceEvent.deltaY,a=r.sourceEvent.deltaMode,c=((u,f)=>u*(f?120:1)/500)(o,a),l=Xt(r.sourceEvent,this.props.canvasElement);for(const u of this.getTracksAtPosition(...l)){const f=i==="1d-horizontal"?l[1]-u.position[1]:l[0]-u.position[0];u.zoomedY(f,2**c)}this.zoomStartTransform&&(this.zoomTransform=this.zoomStartTransform)}},{key:"zoomed",value:function(r){let i=null;if(this.zoomStartPos){const a=this.getTracksAtPosition(...this.zoomStartPos);if(a.length){const s=a[0],c=this.getTrackDef(s);if(!c)return;Gt[c.type]?.orientation&&(i=Gt[c.type].orientation),s instanceof uj&&(i="1d-vertical")}}if(i&&r.sourceEvent){if(r.shiftKey||this.valueScaleZooming){if(r.sourceEvent.deltaY!==void 0){this.valueScaleZoom(r,i);return}i==="1d-horizontal"?this.valueScaleMove(r.sourceEvent.movementY):i==="1d-vertical"&&this.valueScaleMove(r.sourceEvent.movementX)}i==="1d-horizontal"&&r.sourceEvent.movementY?this.valueScaleMove(r.sourceEvent.movementY):i==="1d-vertical"&&r.sourceEvent.movementX&&this.valueScaleMove(r.sourceEvent.movementX)}this.zoomTransform=this.currentProps.zoomable?r.transform:Ar,this.prevZoomTransform.k!==this.zoomTransform.k||(i==="1d-horizontal"?this.zoomTransform=Ar.translate(this.zoomTransform.x,this.prevZoomTransform.y).scale(this.zoomTransform.k):i==="1d-vertical"&&(this.zoomTransform=Ar.translate(this.prevZoomTransform.x,this.zoomTransform.y).scale(this.zoomTransform.k)),this.element&&(this.element.__zoom=this.zoomTransform)),this.applyZoomTransform(!0),this.prevZoomTransform=this.zoomTransform,this.props.pubSub.publish("app.zoom",r),r.sourceEvent&&(r.sourceEvent.stopPropagation(),r.sourceEvent.preventDefault())}},{key:"getTracksAtPosition",value:function(r,i){const o=[];let a=[];for(const s in this.trackDefObjects){const c=this.trackDefObjects[s].trackObject;c.childTracks?a=a.concat(c.childTracks):a.push(c)}for(const s of a){const c=s.position[0]<=r&&r<=s.position[0]+s.dimensions[0],l=s.position[1]<=i&&i<=s.position[1]+s.dimensions[1];c&&l&&o.push(s)}return o}},{key:"zoomStarted",value:function(r){this.zooming=!0,r?.sourceEvent&&(this.zoomStartPos=Xt(r.sourceEvent,this.props.canvasElement),r.sourceEvent.shiftKey&&(this.valueScaleZooming=!0)),this.zoomStartTransform=this.zoomTransform,this.props.pubSub.publish("app.zoomStart")}},{key:"zoomEnded",value:function(){this.zooming=!1,this.zoomStartPos=null,this.valueScaleZooming&&(this.valueScaleZooming=!1,this.element&&(this.element.__zoom=this.zoomStartTransform)),this.props.pubSub.publish("app.zoomEnd")}},{key:"applyZoomTransform",value:function(r=!0){const i=this.currentProps,o=i.paddingLeft+i.leftWidth,a=i.paddingTop+i.topHeight;if(!this.xScale||!this.yScale)return;this.zoomedXScale=this.zoomTransform.rescaleX(this.xScale),this.zoomedYScale=this.zoomTransform.rescaleY(this.yScale);const s=Et().domain([o,o+i.centerWidth].map(this.zoomedXScale.invert)).range([0,i.centerWidth]),c=Et().domain([a,a+i.centerHeight].map(this.zoomedYScale.invert)).range([0,i.centerHeight]);for(const l in this.trackDefObjects){const u=this.trackDefObjects[l].trackObject,f=this.trackDefObjects[l].trackDef;let h="unknown";if(Gt[f.track.type]&&(h=Gt[f.track.type].orientation),h==="whole"){const p=Et().domain([i.paddingLeft,i.width-i.paddingLeft].map(this.zoomedXScale.invert)).range([0,i.width-2*i.paddingLeft]),d=Et().domain([i.paddingTop,i.height-i.paddingTop].map(this.zoomedYScale.invert)).range([0,i.height-2*i.paddingTop]);u.zoomed(p,d);continue}if(this.trackDefObjects[l].trackDef.track.position==="gallery"){const p=Et().domain([i.paddingLeft+i.leftWidthNoGallery,i.paddingLeft+i.leftWidth+i.centerWidth+i.galleryDim].map(this.zoomedXScale.invert)).range([0,i.centerWidth+2*i.galleryDim]),d=Et().domain([i.paddingTop+i.topHeightNoGallery,i.paddingTop+i.topHeight+i.centerHeight+i.galleryDim].map(this.zoomedYScale.invert)).range([0,i.centerHeight-2*i.galleryDim]);u.zoomed(p.copy(),d.copy(),this.zoomTransform.k);continue}u.zoomed(s.copy(),c.copy(),this.zoomTransform.k,this.zoomTransform.x+this.xPositionOffset,this.zoomTransform.y+this.yPositionOffset,i.paddingLeft+i.leftWidth,i.paddingTop+i.topHeight)}return this.currentXScale=s,this.currentYScale=c,r&&this.currentProps.onScalesChanged(s,c),[s,c]}},{key:"createMetaTrack",value:function(r){switch(r.type){default:{const i=this.props.pluginTracks[r.type];if(i?.isMetaTrack){const o={getTrackObject:this.getTrackObject.bind(this),onNewTilesLoaded:()=>{this.currentProps.onNewTilesLoaded(r.uid)},definition:r};try{return new i.track(this.availableForPlugins,o,r.options??{})}catch(a){console.error("Plugin meta track",r.type,"failed to instantiate.",a)}}return console.warn(`Unknown meta track of type: ${r.type}`),new Oj(this.pStage,{name:"Unknown Track Type",type:r.type})}}}},{key:"createTrackObject",value:function(r){const i=this.createLocationAgnosticTrackObject(r);return(r.position==="left"||r.position==="right")&&Gt[r.type].orientation==="1d-horizontal"?new uj(i):i}},{key:"createLocationAgnosticTrackObject",value:function(r){let i=r.data;i||(i={server:Fp(r.server??""),tilesetUid:r.tilesetUid}),r.coordSystem&&(i.coordSystem=r.coordSystem);const o=lke(i,this.props.pubSub,this.props.pluginDataFetchers,this.availableForPlugins);if(!this.pStage||!this.svgElement)throw new Error("No PIXI stage or svg element");const a={id:r.uid,trackUid:r.uid,trackType:r.type,viewUid:this.viewUid,pubSub:this.props.pubSub,scene:this.pStage,dataConfig:i,dataFetcher:o,getLockGroupExtrema:()=>this.currentProps.getLockGroupExtrema(r.uid),handleTilesetInfoReceived:s=>{this.currentProps.onTilesetInfoReceived(r.uid,s)},animate:()=>{this.currentProps.onNewTilesLoaded(r.uid)},svgElement:this.svgElement,isValueScaleLocked:()=>this.currentProps.isValueScaleLocked(r.uid),onValueScaleChanged:()=>{this.currentProps.onValueScaleChanged(r.uid)},onTrackOptionsChanged:s=>{this.currentProps.onTrackOptionsChanged(r.uid,s)},onMouseMoveZoom:this.props.onMouseMoveZoom,chromInfoPath:r.chromInfoPath,isShowGlobalMousePosition:()=>this.props.isShowGlobalMousePosition,getTheme:()=>this.props.theme};switch(r.y&&(a.yPosition=r.y),r.x&&(a.xPosition=r.x),r.projectionXDomain&&(a.projectionXDomain=r.projectionXDomain),r.projectionYDomain&&(a.projectionYDomain=r.projectionYDomain),r.type){case"left-axis":return new O$(a,r.options);case"top-axis":return new D$(a,r.options);case"heatmap":return new Ql(a,r.options);case"multivec":case"vector-heatmap":case"horizontal-multivec":case"horizontal-vector-heatmap":case"vertical-multivec":case"vertical-vector-heatmap":return new U$(a,r.options);case"1d-heatmap":case"horizontal-1d-heatmap":case"vertical-1d-heatmap":return new H$(a,r.options);case"line":case"horizontal-line":case"vertical-line":return new ac(a,r.options);case"point":case"horizontal-point":case"vertical-point":return new G$(a,r.options);case"bar":case"horizontal-bar":case"vertical-bar":return new m5(a,r.options);case"divergent-bar":case"horizontal-divergent-bar":case"vertical-divergent-bar":return new B$(a,r.options);case"horizontal-1d-tiles":return new v$(a,r.options);case"vertical-1d-tiles":return new T$(a,r.options);case"2d-tiles":return new g$(a,r.options);case"stacked-interval":case"top-stacked-interval":case"left-stacked-interval":return new nj(a,r.options);case"viewport-projection-center":return r.registerViewportChanged&&r.removeViewportChanged&&r.setDomainsCallback?(a.registerViewportChanged=r.registerViewportChanged,a.removeViewportChanged=r.removeViewportChanged,a.setDomainsCallback=r.setDomainsCallback,new Ij(a,r.options)):new Ja(a,{});case"viewport-projection-horizontal":return r.registerViewportChanged&&r.removeViewportChanged&&r.setDomainsCallback?(a.registerViewportChanged=r.registerViewportChanged,a.removeViewportChanged=r.removeViewportChanged,a.setDomainsCallback=r.setDomainsCallback,new c9(a,r.options)):new Ja(a,{});case"viewport-projection-vertical":return r.registerViewportChanged&&r.removeViewportChanged&&r.setDomainsCallback?(a.registerViewportChanged=r.registerViewportChanged,a.removeViewportChanged=r.removeViewportChanged,a.setDomainsCallback=r.setDomainsCallback,new Nj(a,r.options)):new Ja(a,{});case"gene-annotations":case"horizontal-gene-annotations":case"vertical-gene-annotations":return new B5(a,r.options);case"2d-rectangle-domains":case"arrowhead-domains":return new tj(a,r.options);case"1d-annotations":case"horizontal-1d-annotations":case"vertical-1d-annotations":return new K$(a,r.options,!0);case"2d-annotations":return new Q$(a,r.options);case"linear-2d-rectangle-domains":case"horizontal-2d-rectangle-domains":case"vertical-2d-rectangle-domains":return new hj(a,r.options);case"square-markers":return new Ej(a,r.options);case"combined":return a.tracks=r.contents,a.createTrackObject=this.createTrackObject.bind(this),new b0(a);case"2d-chromosome-labels":return new vj(a,r.options);case"horizontal-chromosome-grid":return a.orientation="1d-horizontal",new th(a,r.options);case"vertical-chromosome-grid":return a.orientation="1d-vertical",new th(a,r.options);case"2d-chromosome-grid":return new th(a,r.options);case"chromosome-labels":case"horizontal-chromosome-labels":case"vertical-chromosome-labels":return new Tj(a,r.options);case"linear-heatmap":case"horizontal-heatmap":case"vertical-heatmap":return new xj(a,r.options);case"2d-chromosome-annotations":return new gj(a,r.options);case"1d-value-interval":case"horizontal-1d-value-interval":case"vertical-1d-value-interval":return new Aj(a,r.options);case"osm":case"osm-tiles":return new ih(a,r.options);case"osm-2d-tile-ids":return new aB(a,r.options);case"mapbox":case"mapbox-tiles":return new iB(a,r.options);case"raster-tiles":return new lB(a,r.options);case"bedlike":case"vertical-bedlike":return new WE(a,r.options);case"overlay-track":return new M$(a,r.options);case"overlay-chromosome-grid-track":return a.isOverlay=!0,new th(a,r.options);case"horizontal-rule":return new tB(a,r.options);case"vertical-rule":return new Vj(a,r.options);case"cross-rule":return a.x=r.x,a.y=r.y,new Yj(a,r.options);case"simple-svg":return new ko(a,r.options);case"empty":{const s=r.options;return new Bn(a,s)}default:{const s=this.props.pluginTracks[r.type];if(s&&!s.isMetaTrack){a.AVAILABLE_FOR_PLUGINS=this.availableForPlugins,a.baseEl=this.baseEl,a.definition=r,r.registerViewportChanged&&r.removeViewportChanged&&r.setDomainsCallback&&(a.registerViewportChanged=r.registerViewportChanged,a.removeViewportChanged=r.removeViewportChanged,a.setDomainsCallback=r.setDomainsCallback);try{return new s.track(this.availableForPlugins,a,r.options??{})}catch(c){console.error("Plugin track",r.type,"failed to instantiate.",c)}}return console.warn("Unknown track type:",r.type),new Oj(a,{name:"Unknown Track Type",type:r.type})}}}},{key:"zoomToDataPos",value:function(r,i,o,a,s=3e3,c=null){const[l,u,f]=kr(this.xScale.copy().domain([r,i]),this.yScale.copy().domain([o,a])),h=c?c(this.xScale,this.yScale):[this.xScale,this.yScale];this.setCenter(l,u,f,!1,s,h[0],h[1])}},{key:"forwardContextMenu",value:function(r){this.props.disableTrackMenu||r.altKey||(r.preventDefault(),setTimeout(()=>{this.props.pubSub.publish("contextmenu",r)},0))}},{key:"addEventTracker",value:function(){!this.eventTracker||this.eventTracker===this.eventTrackerOld||(this.eventTrackerOld||(this.eventTrackerOld=this.eventTracker),this.eventTracker=this.eventTrackerOld,this.eventTracker.addEventListener("click",this.boundForwardEvent),this.eventTracker.addEventListener("contextmenu",this.boundForwardContextMenu),this.eventTracker.addEventListener("dblclick",this.boundForwardEvent),this.eventTracker.addEventListener("wheel",this.boundForwardEvent),this.eventTracker.addEventListener("dragstart",this.boundForwardEvent),this.eventTracker.addEventListener("selectstart",this.boundForwardEvent),this.eventTracker.addEventListener("mouseover",this.boundForwardEvent),this.eventTracker.addEventListener("mouseenter",this.boundForwardEvent),this.eventTracker.addEventListener("mousedown",this.boundForwardEvent),this.eventTracker.addEventListener("mouseup",this.boundForwardEvent),this.eventTracker.addEventListener("mouseout",this.boundForwardEvent),this.eventTracker.addEventListener("mouseleave",this.boundForwardEvent),this.eventTracker.addEventListener("touchstart",this.boundForwardEvent),this.eventTracker.addEventListener("touchend",this.boundForwardEvent),this.eventTracker.addEventListener("touchmove",this.boundForwardEvent),this.eventTracker.addEventListener("touchcancel",this.boundForwardEvent),this.eventTracker.addEventListener("pointerover",this.boundForwardEvent),this.eventTracker.addEventListener("pointerenter",this.boundForwardEvent),this.eventTracker.addEventListener("pointerdown",this.boundForwardEvent),this.eventTracker.addEventListener("pointerup",this.boundForwardEvent),this.eventTracker.addEventListener("pointercancel",this.boundForwardEvent),this.eventTracker.addEventListener("pointerout",this.boundForwardEvent),this.eventTracker.addEventListener("pointerleave",this.boundForwardEvent),window.addEventListener("scroll",this.boundScrollEvent))}},{key:"removeEventTracker",value:function(){this.eventTracker&&(this.eventTracker.removeEventListener("click",this.boundForwardEvent),this.eventTracker.removeEventListener("contextmenu",this.boundForwardContextMenu),this.eventTracker.removeEventListener("dblclick",this.boundForwardEvent),this.eventTracker.removeEventListener("wheel",this.boundForwardEvent),this.eventTracker.removeEventListener("dragstart",this.boundForwardEvent),this.eventTracker.removeEventListener("selectstart",this.boundForwardEvent),this.eventTracker.removeEventListener("mouseover",this.boundForwardEvent),this.eventTracker.removeEventListener("mouseenter",this.boundForwardEvent),this.eventTracker.removeEventListener("mousedown",this.boundForwardEvent),this.eventTracker.removeEventListener("mouseup",this.boundForwardEvent),this.eventTracker.removeEventListener("mouseout",this.boundForwardEvent),this.eventTracker.removeEventListener("mouseleave",this.boundForwardEvent),this.eventTracker.removeEventListener("touchstart",this.boundForwardEvent),this.eventTracker.removeEventListener("touchend",this.boundForwardEvent),this.eventTracker.removeEventListener("touchcancel",this.boundForwardEvent),this.eventTracker.removeEventListener("pointerover",this.boundForwardEvent),this.eventTracker.removeEventListener("pointerenter",this.boundForwardEvent),this.eventTracker.removeEventListener("pointerdown",this.boundForwardEvent),this.eventTracker.removeEventListener("pointerup",this.boundForwardEvent),this.eventTracker.removeEventListener("pointercancel",this.boundForwardEvent),this.eventTracker.removeEventListener("pointerout",this.boundForwardEvent),this.eventTracker.removeEventListener("pointerleave",this.boundForwardEvent),window.removeEventListener("scroll",this.boundScrollEvent))}},{key:"scrollEvent",value:function(){this.element&&(this.elementPos=this.element.getBoundingClientRect())}},{key:"forwardEvent",value:function(r){r.sourceUid=this.uid,r.forwarded=!0,this.props.pubSub.publish("app.event",r)}},{key:"onScrollHandler",value:function(r){this.scrollTop=r}},{key:"render",value:function(){return x.createElement("div",{ref:r=>{this.baseEl=r},className:$t("track-renderer-div",Ak["track-renderer"]),style:{height:this.currentProps.height,width:this.currentProps.width}},x.createElement("div",{ref:r=>{this.element=r},className:$t("track-renderer-element",Ak["track-renderer-element"])}),x.createElement("div",{ref:r=>{this.eventTracker=r},className:$t("track-renderer-events",Ak["track-renderer-events"])},this.currentProps.children))}}])}(x.Component);Ik.defaultProps={pluginDataFetchers:{},pluginTracks:{},canvasElement:null,centerHeight:0,centerWidth:0,children:[],galleryDim:0,height:0,initialXDomain:[],initialYDomain:[],isShowGlobalMousePosition:!1,isRangeSelection:!1,leftWidth:0,leftWidthNoGallery:0,paddingLeft:0,paddingTop:0,positionedTracks:[],topHeight:0,topHeightNoGallery:0,width:0,metaTracks:[]},Ik.propTypes={canvasElement:q.object,centerHeight:q.number,centerWidth:q.number,children:q.array,disableTrackMenu:q.bool,galleryDim:q.number,height:q.number,initialXDomain:q.array,initialYDomain:q.array,isShowGlobalMousePosition:q.bool,isRangeSelection:q.bool,leftWidth:q.number,leftWidthNoGallery:q.number,paddingLeft:q.number,paddingTop:q.number,metaTracks:q.array,onMouseMoveZoom:q.func,onNewTilesLoaded:q.func.isRequired,onScalesChanged:q.func.isRequired,pixiRenderer:q.object.isRequired,pixiStage:q.object.isRequired,pluginDataFetchers:q.object,pluginTracks:q.object,positionedTracks:q.array,pubSub:q.object.isRequired,setCentersFunction:q.func,svgElement:q.object.isRequired,theme:q.symbol.isRequired,topHeight:q.number,topHeightNoGallery:q.number,viewOptions:q.object,width:q.number,xDomainLimits:q.array,yDomainLimits:q.array,valueScaleZoom:q.bool,zoomable:q.bool.isRequired,zoomDomain:q.array,uid:q.string,zoomLimits:q.array};const uke=tl(sl(Ik));function fke(e){const{attributes:t,listeners:n,setNodeRef:r,transform:i,transition:o,isDragging:a}=fL({id:e.uid}),s=i&&{...i,y:0},c={transform:Fl.Transform.toString(s),transition:o,...a?{zIndex:10,background:"rgba(0, 0, 0, 0.1)",border:"2px dashed rgba(0, 0, 0, 0.3)",borderRadius:4}:{}};return x.createElement("div",{ref:r,style:c},x.createElement(Az,{className:e.className,controlAlignLeft:e.controlAlignLeft,dragHandleProps:{...t,...n},editable:e.editable,handleConfigTrack:e.handleConfigTrack,handleResizeTrack:e.handleResizeTrack,height:e.height,isCollapsed:e.isCollapsed,item:e.item,onAddSeries:e.onAddSeries,onCollapseTrack:e.onCollapseTrack,onExpandTrack:e.onExpandTrack,onCloseTrack:e.onCloseTrack,onCloseTrackMenuOpened:e.onCloseTrackMenuOpened,onConfigTrackMenuOpened:e.onConfigTrackMenuOpened,resizeHandles:e.resizeHandles,uid:e.uid,width:e.width}))}const hke={"vertical-tiled-plot":"_vertical-tiled-plot_f3ho8_1"};function pke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dke(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mke(r.key),r)}}function gke(e,t,n){return t&&dke(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mke(e){var t=vke(e,"string");return typeof t=="symbol"?t:t+""}function vke(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function yke(e,t,n){return t=lm(t),bke(e,Nz()?Reflect.construct(t,n||[],lm(e).constructor):t.apply(e,n))}function bke(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _ke(e)}function _ke(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Nz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Nz=function(){return!!e})()}function lm(e){return lm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lm(e)}function Tke(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Rk(e,t)}function Rk(e,t){return Rk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Rk(e,t)}function Lz(e){return e?.sourceEvent}let Dk=function(e){function t(n){var r;return pke(this,t),r=yke(this,t,[n]),r.brushBehavior=al().on("start",r.brushStarted.bind(r)).on("brush",r.brushed.bind(r)).on("end",r.brushedEnded.bind(r)),r.state={trackControlsVisible:null},r}return Tke(t,e),gke(t,[{key:"componentDidMount",value:function(){this.props.isRangeSelectionActive&&this.addBrush()}},{key:"shouldComponentUpdate",value:function(r,i){if(this.rangeSelectionTriggered)return this.rangeSelectionTriggered=!1,this.rangeSelectionTriggeredEnd&&this.props.rangeSelection!==r.rangeSelection&&this.moveBrush(r.rangeSelection[0]?r.rangeSelection[0]:null,!0),this.rangeSelectionTriggeredEnd=!1,this.state!==i;if(this.props.rangeSelection!==r.rangeSelection){const o=this.props.is1dRangeSelection?0:1;return this.moveBrush(r.rangeSelection[o]?r.rangeSelection[o]:null,r.rangeSelectionEnd),this.state!==i}return!0}},{key:"componentDidUpdate",value:function(){this.props.isRangeSelectionActive?this.addBrush():this.removeBrush()}},{key:"addBrush",value:function(){!this.brushEl||this.brushElAddedBefore===this.brushEl||(this.brushElAddedBefore&&this.brushElAddedBefore.on(".brush",null),this.brushEl.call(this.brushBehavior),this.brushElAddedBefore=this.brushEl,Ls(this.brushEl,gi["track-range-selection-group-brush-selection"]))}},{key:"brushed",value:function(r){const i=this.rangeSelectionMoved;this.rangeSelectionMoved=!1,!(!Lz(r)||!this.props.onRangeSelection||i)&&(this.rangeSelectionTriggered=!0,this.props.onRangeSelection(r.selection))}},{key:"brushStarted",value:function(r){!Lz(r)||!r.selection||this.props.onRangeSelectionStart()}},{key:"brushedEnded",value:function(r){if(!this.props.is1dRangeSelection)return;const i=this.rangeSelectionMovedEnd;this.rangeSelectionMovedEnd=!1,r.selection&&r.sourceEvent&&this.props.onRangeSelection&&!i&&(this.rangeSelectionTriggered=!0,this.rangeSelectionTriggeredEnd=!0,this.props.onRangeSelectionEnd(r.selection)),r.selection||(this.rangeSelectionTriggered=!0,this.props.onRangeSelectionReset())}},{key:"moveBrush",value:function(r,i=!1){if(!this.brushEl)return;const o=r?[this.props.scale(r[0]),this.props.scale(r[1])]:null;this.rangeSelectionMoved=!0,this.rangeSelectionMovedEnd=!0,i?this.brushEl.transition().call(this.brushBehavior.move,o):this.brushEl.call(this.brushBehavior.move,o)}},{key:"removeBrush",value:function(){this.brushElAddedBefore&&(this.brushElAddedBefore.call(this.brushBehavior.move,null),this.brushElAddedBefore.on(".brush",null),this.brushElAddedBefore=void 0,this.props.onRangeSelectionReset())}},{key:"render",value:function(){const r=this.props.tracks.map(a=>a.width).reduce(zo,0),i=this.props.tracks.map(a=>$s(a)).reduce(Iu,!1),o=gi[this.props.isRangeSelectionActive?"track-range-selection-active":"track-range-selection"];return x.createElement("div",{className:hke["vertical-tiled-plot"]},i&&x.createElement("svg",{ref:a=>{this.brushEl=_t(a)},className:o,style:{height:this.props.height,width:r},xmlns:"http://www.w3.org/2000/svg"}),x.createElement(Q1,{axis:"x",className:$t(ti.list,ti.stylizedList,ti.horizontalList),component:_L,editable:this.props.editable,handleConfigTrack:this.props.handleConfigTrack,handleResizeTrack:this.props.handleResizeTrack,height:this.props.height,helperClass:ti.stylizedHelper,itemClass:$t(ti.stylizedItem,ti.horizontalItem),itemControlAlignLeft:this.props.tracksControlAlignLeft,itemReactClass:fke,items:this.props.tracks.map(a=>({handleMouseEnter:()=>{this.setState({trackControlsVisible:a.uid})},handleMouseLeave:()=>{this.setState({trackControlsVisible:null})},trackControlsVisible:a.uid===this.state.trackControlsVisible,configMenuVisible:a.uid===this.props.configTrackMenuId,uid:a.uid||Mt.nice(),height:this.props.height,width:Qn(a),isCollapsed:a.options?.collapsed,value:a.value})),onAddSeries:this.props.onAddSeries,onCloseTrack:this.props.onCloseTrack,onCollapseTrack:this.props.onCollapseTrack,onExpandTrack:this.props.onExpandTrack,onCloseTrackMenuOpened:this.props.onCloseTrackMenuOpened,onConfigTrackMenuOpened:this.props.onConfigTrackMenuOpened,onSortEnd:this.props.handleSortEnd,referenceAncestor:this.props.referenceAncestor,resizeHandles:this.props.resizeHandles,useDragHandle:!0,width:r}))}}])}(x.Component);Dk.propTypes={configTrackMenuId:q.string,editable:q.bool,handleConfigTrack:q.func,handleResizeTrack:q.func,handleSortEnd:q.func,is1dRangeSelection:q.bool,isRangeSelectionActive:q.bool,height:q.number,onAddSeries:q.func,onCloseTrack:q.func,onCollapseTrack:q.func,onExpandTrack:q.func,onCloseTrackMenuOpened:q.func,onConfigTrackMenuOpened:q.func,onRangeSelection:q.func,onRangeSelectionEnd:q.func,onRangeSelectionReset:q.func,onRangeSelectionStart:q.func,rangeSelection:q.array,rangeSelectionEnd:q.bool,referenceAncestor:q.func,resizeHandles:q.object,scale:q.func,tracks:q.array,tracksControlAlignLeft:q.bool};function wke(e){const t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch{}document.body.removeChild(t)}function $z(e){if(!navigator.clipboard){wke(e);return}navigator.clipboard.writeText(e).then(()=>{},t=>{})}function Ske(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Eke(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,xke(r.key),r)}}function kke(e,t,n){return t&&Eke(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function xke(e){var t=Cke(e,"string");return typeof t=="symbol"?t:t+""}function Cke(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Oke(e,t,n){return t=cm(t),Pke(e,jz()?Reflect.construct(t,n||[],cm(e).constructor):t.apply(e,n))}function Pke(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ake(e)}function Ake(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jz=function(){return!!e})()}function cm(e){return cm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cm(e)}function Mke(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Nk(e,t)}function Nk(e,t){return Nk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Nk(e,t)}let Bz=function(e){function t(){return Ske(this,t),Oke(this,t,arguments)}return Mke(t,e),kke(t,[{key:"render",value:function(){const r=Cw(this.props.tracks,this.handleItemMouseEnter.bind(this),this.handleMouseLeave.bind(this)),i=this.props.customItems?x.Children.map(this.props.customItems,o=>x.cloneElement(o,{onMouseEnter:a=>{this.handleOtherMouseEnter(a)}})):null;return x.createElement("div",{ref:o=>{this.div=o},className:$t(yt["context-menu"],{[yt["context-menu-dark"]]:this.props.theme===Qt}),"data-menu-type":"ViewContextMenu",style:{left:this.state.left,top:this.state.top}},i,i&&x.createElement("hr",{className:yt["context-menu-hr"]}),r,r&&x.createElement("hr",{className:yt["context-menu-hr"]}),this.props.genomePositionSearchBox&&x.createElement(xt,{onClick:this.copyLocationToClipboard.bind(this),onMouseEnter:o=>this.handleOtherMouseEnter(o)},"Copy location under cursor"),x.createElement("hr",{className:yt["context-menu-hr"]}),x.createElement(xt,{onClick:()=>this.props.onAddTrack({type:"horizontal-rule",y:this.props.coords[1],position:"whole"}),onMouseEnter:o=>this.handleOtherMouseEnter(o)},"Add Horizontal Rule"),x.createElement(xt,{onClick:()=>this.props.onAddTrack({type:"vertical-rule",x:this.props.coords[0],position:"whole"}),onMouseEnter:o=>this.handleOtherMouseEnter(o)},"Add Vertical Rule"),x.createElement(xt,{onClick:()=>this.props.onAddTrack({type:"cross-rule",x:this.props.coords[0],y:this.props.coords[1],position:"whole"}),onMouseEnter:o=>this.handleOtherMouseEnter(o)},"Add Cross Rule"),x.createElement("hr",{className:yt["context-menu-hr"]}),this.hasMatrixTrack(this.props.tracks)&&x.createElement(xt,{onClick:this.handleAddHorizontalSection.bind(this),onMouseEnter:o=>this.handleOtherMouseEnter(o)},"Add Horizontal Cross Section"),this.hasMatrixTrack(this.props.tracks)&&x.createElement(xt,{onClick:this.handleAddVerticalSection.bind(this),onMouseEnter:o=>this.handleOtherMouseEnter(o)},"Add Vertical Cross Section"),this.getSubmenu())}},{key:"hasMatrixTrack",value:function(r){return qp(this.props.tracks).filter(o=>o.type==="heatmap").length>0}},{key:"handleAddHorizontalSection",value:function(){const i=qp(this.props.tracks).filter(o=>o.type==="heatmap")[0];this.props.onAddTrack({type:"horizontal-rule",y:this.props.coords[1],position:"whole"}),this.props.onAddTrack({data:{type:"horizontal-section",server:i.server,tilesetUid:i.tilesetUid,slicePos:this.props.coords[1]},options:{valueScaling:"log"},type:"horizontal-bar",height:30,position:"top"})}},{key:"copyLocationToClipboard",value:function(){const r=this.props.tracks[0]&&this.props.tracks[0].position==="center",i=this.props.genomePositionSearchBox?.searchField?.chromInfo;if(!i){console.warn("There needs to be a genome position search box present to copy the location"),this.props.closeMenu();return}const o=this.props.coords[0],a=this.props.coords[1],s=dr(o,i),c=Fr(",d");let l=`${s[0]}:${c(s[1])}`;if(r){const u=dr(a,i);l=`${l} & ${u[0]}:${c(u[1])}`,$z(l)}else $z(l);this.props.closeMenu()}},{key:"handleAddVerticalSection",value:function(){const i=qp(this.props.tracks).filter(o=>o.type==="heatmap")[0];this.props.onAddTrack({type:"vertical-rule",x:this.props.coords[0],position:"whole"}),this.props.onAddTrack({data:{type:"vertical-section",server:i.server,tilesetUid:i.tilesetUid,slicePos:this.props.coords[0]},options:{valueScaling:"log"},type:"vertical-bar",height:30,position:"left"})}}])}(ul(Yo).with(xN));Bz.propTypes={coords:q.array,customItems:q.array};function Ike(e,t){if(window.higlassTracksByType&&Object.keys(window.higlassTracksByType).forEach(i=>{Gt[i]=window.higlassTracksByType[i].config}),!(e in Ca)&&!t){console.warn("unknown data type:",e);return}const n={"1d-horizontal":["top","bottom","left","right"],"2d":["center"],"1d-vertical":["left","right"]},r=Ca[e]||{};if(t)for(const i of t)if(!Gt[i])console.warn("unknown track type",i);else for(const o of n[Gt[i].orientation])r[o]=i;return r}function Rke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dke(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Lke(r.key),r)}}function Nke(e,t,n){return t&&Dke(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lke(e){var t=$ke(e,"string");return typeof t=="symbol"?t:t+""}function $ke(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function jke(e,t,n){return t=um(t),Bke(e,zz()?Reflect.construct(t,n||[],um(e).constructor):t.apply(e,n))}function Bke(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zke(e)}function zke(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zz=function(){return!!e})()}function um(e){return um=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},um(e)}function Hke(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Lk(e,t)}function Lk(e,t){return Lk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Lk(e,t)}let $k=function(e){function t(n){var r;Rke(this,t),r=jke(this,t,[n]),r.closing=!1,r.brushX=ol();const{tracks:i}=r.props;return r.canvasElement=null,r.tracksByUidInit={},[...r.props.tracks.top||[],...r.props.tracks.right||[],...r.props.tracks.bottom||[],...r.props.tracks.left||[],...r.props.tracks.gallery||[],...r.props.tracks.center||[]].forEach(o=>{o.type==="combined"?o.contents.forEach(a=>{r.tracksByUidInit[a.uid]=!1}):r.tracksByUidInit[o.uid]=!1}),r.annotationUid=null,r.annotationCreatedNotified=!1,r.xScale=null,r.yScale=null,r.addUidsToTracks(i),r.trackToReplace=null,r.trackRenderer=null,r.brushSelection=null,r.configTrackMenu=null,r.state={sizeMeasured:!1,height:10,width:10,tracks:i,init:!1,addTrackExtent:null,addTrackPosition:null,customDialog:null,mouseOverOverlayUid:null,forceUpdate:0,rangeSelection:[null,null],rangeSelectionEnd:!1,chromInfo:null,defaultChromSizes:null,contextMenuCustomItems:null,contextMenuPosition:null,addDivisorDialog:null},r.reset=!0,window.higlassTracksByType&&Object.keys(window.higlassTracksByType).forEach(o=>{Gt[o]=window.higlassTracksByType[o].config}),r.topHeight=0,r.bottomHeight=0,r.leftWidth=0,r.rightWidth=0,r.centerHeight=0,r.centerWidth=0,r.dragTimeout=null,r.previousPropsStr="",r.brushesCreated={},r.appZoomedBound=r.appZoomed.bind(r),r.handleClickBound=r.handleClick.bind(r),r.contextMenuHandlerBound=r.contextMenuHandler.bind(r),r.handleNoTrackAddedBound=r.handleNoTrackAdded.bind(r),r.handleTracksAddedBound=r.handleTracksAdded.bind(r),r.closeMenusBound=r.closeMenus.bind(r),r.handleAddDivisorBound=r.handleAddDivisor.bind(r),r.handleAddSeriesBound=r.handleAddSeries.bind(r),r.handleChangeTrackDataBound=r.handleChangeTrackData.bind(r),r.handleChangeTrackTypeBound=r.handleChangeTrackType.bind(r),r.handleCloseTrackBound=r.handleCloseTrack.bind(r),r.handleConfigureTrackBound=r.handleConfigureTrack.bind(r),r.handleExportTrackDataBound=r.handleExportTrackData.bind(r),r.handleLockValueScaleBound=r.handleLockValueScale.bind(r),r.handleReplaceTrackBound=r.handleReplaceTrack.bind(r),r.handleTrackOptionsChangedBound=r.handleTrackOptionsChanged.bind(r),r.handleUnlockValueScaleBound=r.handleUnlockValueScale.bind(r),r.onAddTrack=r.handleAddTrack.bind(r),r}return Hke(t,e),Nke(t,[{key:"waitForDOMAttachment",value:function(r){if(!this.mounted)return;const i=this.divTiledPlot;i?.getRootNode().contains(i)?r():requestAnimationFrame(()=>this.waitForDOMAttachment(r))}},{key:"componentDidMount",value:function(){this.mounted=!0,this.element=this.divTiledPlot,this.waitForDOMAttachment(()=>{Ih.ElementQueries.listen(),this.resizeSensor=new Ih.ResizeSensor(this.element.parentNode,this.measureSize.bind(this)),this.measureSize()}),this.addEventListeners(),this.pubSubs=[],this.pubSubs.push(this.props.pubSub.subscribe("contextmenu",this.contextMenuHandlerBound))}},{key:"getTracksData",value:function(r,i){let o=[];const a=this.listAllTrackObjects();for(const c of r)c.track.contents?o=[...o,...c.track.contents]:o=[...o,c.track];const s=[];for(const c of o)if(c.type==="heatmap"){const l=a.filter(v=>v.id===c.uid)[0],u=l._xScale(i[0][0]),f=l._xScale(i[1][0]),h=l._yScale(i[0][1]),d=l._yScale(i[1][1])-h,g=f-u,y=l.getVisibleRectangleData(u,h,d,g),m=y.data.reduce((v,_)=>v+_,0)/y.data.length;s.push({name:c.options.name,mean:m,trackUid:c.uid})}return s}},{key:"appZoomed",value:function(){if(this.brushCurrent&&this.brushEl){if(this.brushType==="horizontal"){const r=[this.xScale(this.brushSelection[0])+this.brushTrack.left,this.xScale(this.brushSelection[1])+this.brushTrack.left];this.brushEl.call(this.brushCurrent.move,r)}if(this.brushType==="vertical"){const r=[this.yScale(this.brushSelection[0])+this.brushTrack.top,this.yScale(this.brushSelection[1])+this.brushTrack.top];this.brushEl.call(this.brushCurrent.move,r)}if(this.brushType==="2d"){const r=[[this.xScale(this.brushSelection[0][0])+this.brushTrack.left,this.yScale(this.brushSelection[0][1])+this.brushTrack.top],[this.xScale(this.brushSelection[1][0])+this.brushTrack.left,this.yScale(this.brushSelection[1][1])+this.brushTrack.top]];this.brushEl.call(this.brushCurrent.move,r)}}}},{key:"clearOtherBrushes",value:function(r){for(const i of Object.values(this.brushes))i.on("brush",null);for(const i in this.brushes){const o=this.brushes[i];o!==r&&this.brushEls[i].call(o.move,null)}for(const i of Object.values(this.brushes))i.on("brush",()=>this.clearOtherBrushes(i))}},{key:"handleClick",value:function(r){const i=Xt(r,this.divTiledPlot);let o=!1;if(this.brushEl){const a=this.brushSelectionRaw,s=this.brushTrack;this.brushType==="2d"?i[0]>=a[0][0]&&i[0]<=a[1][0]&&i[1]>=a[0][1]&&i[1]<=a[1][1]&&(o=!0):this.brushType==="horizontal"?i[0]>=a[0]&&i[0]<=a[1]&&i[1]>=s.top&&i[1]<=s.top+Zn(s.track)&&(o=!0):this.brushType==="vertical"&&i[1]>=a[0]&&i[1]<=a[1]&&i[0]>=s.left&&i[0]<=s.left+Qn(s.track)&&(o=!0),o||this.cancelBrushes()}}},{key:"cancelBrushes",value:function(){this.brushEl.call(this.brushCurrent.move,null),this.brushEl=null,this.props.apiPublish("annotationRemoved",this.annotationUid),this.annotationUid=null,this.annotationCreatedNotified=!1,this.removeBrushText()}},{key:"removeBrushText",value:function(){_t(this.divTiledPlot).selectAll(".brush-svg").selectAll(".data-values").remove()}},{key:"enableBrushes",value:function(){_t(this.divTiledPlot).selectAll(".brush-svg").selectAll(".overlay").style("pointer-events","all")}},{key:"disableBrushes",value:function(){_t(this.divTiledPlot).selectAll(".overlay").attr("pointer-events","none"),_t(this.divTiledPlot).selectAll(".brush-rect").attr("pointer-events","none"),_t(this.divTiledPlot).selectAll(".selection").attr("pointer-events","all"),_t(this.divTiledPlot).selectAll(".brush-svg").attr("pointer-events","none")}},{key:"createBrushes",value:function(r){const i={};this.brushCurrent=null;const o=this.props.apiPublish,a=this;for(const s of r){if(i[s.track.uid])continue;let c=null;["top","bottom"].includes(s.track.position)?(c=ol(),c.on("brush",l=>{l.selection&&(this.brushCurrent=c,this.brushType="horizontal",this.brushTrack=s,this.brushSelectionRaw=l.selection,this.brushSelection=[this.xScale.invert(l.selection[0]-s.left),this.xScale.invert(l.selection[1]-s.left)],o("annotationChanged",{annotationUid:this.annotationUid,viewUid:this.props.uid,track:s.track,extent:[this.brushSelection,[null,null]]}))}),c.on("end",l=>{this.annotationCreatedNotified||o("annotationCreated",{annotationUid:a.annotationUid,track:s.track,viewUid:this.props.uid,extent:[this.brushSelection,[null,null]]})})):["left","right"].includes(s.track.position)?(c=al(),c.on("brush",l=>{l.selection&&(this.brushCurrent=c,this.brushType="vertical",this.brushTrack=s,this.brushSelectionRaw=l.selection,this.brushSelection=[this.yScale.invert(l.selection[0]-s.top),this.yScale.invert(l.selection[1]-s.top)],o("annotationChanged",{annotationUid:this.annotationUid,track:s.track,viewUid:this.props.uid,extent:[[null,null],this.brushSelection]}))}),c.on("end",l=>{this.annotationCreatedNotified||o("annotationCreated",{annotationUid:a.annotationUid,track:s.track,viewUid:this.props.uid,extent:[[null,null],this.brushSelection]})})):(c=Wd(),c.on("brush",l=>{if(!l.selection)return;this.brushCurrent=c,this.brushType="2d",this.brushTrack=s,this.brushSelectionRaw=l.selection,this.brushSelection=[[this.xScale.invert(l.selection[0][0]-s.left),this.yScale.invert(l.selection[0][1]-s.top)],[this.xScale.invert(l.selection[1][0]-s.left),this.yScale.invert(l.selection[1][1]-s.top)]];const u=this.getTracksData(r.filter(h=>h.track.position==="center"),this.brushSelection),f=Object.values(u).filter(h=>h.mean!==void 0).map(h=>h.mean);if(f.length){_t(this.divTiledPlot).selectAll(".brush-svg").selectAll(".data-values").data(f).enter().append("text").classed("data-values",!0);const p=Fr(".3f");_t(this.divTiledPlot).selectAll(".data-values").attr("x",l.selection[0][0]).attr("y",l.selection[0][1]).text(d=>`mean: ${p(d)}`)}o("annotationChanged",{annotationUid:this.annotationUid,extent:this.brushSelection,data:u,track:s.track,viewUid:this.props.uid})}),c.on("end",l=>{let u={};this.brushSelection?.[0].length&&(u=this.getTracksData(r.filter(f=>f.track.position==="center"),this.brushSelection)),this.annotationCreatedNotified?l.selection||this.removeBrushText():(o("annotationCreated",{annotationUid:a.annotationUid,track:s.track,viewUid:this.props.uid,extent:this.brushSelection,data:u}),this.annotationCreatedNotified=!0)})),c.keyModifiers(!1),c.extent([[s.left,s.top],[s.left+Qn(s.track),s.top+Zn(s.track)]]),c.on("start",function(l){a.annotationUid||(a.annotationUid=Mt.nice(),s.annotationUid=a.annotationUid),a.brushEl=_t(this)}),i[s.track.uid]=c}return i}},{key:"removeBrushes",value:function(){_t(this.divTiledPlot).selectAll(".brush-svg").remove()}},{key:"addBrushes",value:function(){if(this.annotationUid)return;const r=this.positionedTracks().filter(s=>s.track.position!=="whole"),i=this.createBrushes(r);this.brushes=i;const o={};this.brushEls=o,_t(this.divTiledPlot).selectAll(".brush").remove(),_t(this.divTiledPlot).selectAll(".brush-svg").data([1]).enter().append("svg").classed("brush-svg",!0).style("position","absolute").style("left",0).style("top",0).style("z-index",101);const a=_t(this.divTiledPlot).select(".brush-svg").selectAll(".brush").data(r,s=>s.track.uid).enter().append("g").attr("class","brush");_t(this.divTiledPlot).selectAll(".brush-svg").attr("width",this.state.width).attr("height",this.state.height),_t(this.divTiledPlot).selectAll(".brush-rect").attr("x",s=>s.left).attr("y",s=>s.top).style("stroke","1px solid black").style("fill","transparent").attr("width",s=>s.width).attr("height",s=>s.height),a.each(function(s){o[s.track.uid]=_t(this),o[s.track.uid].call(i[s.track.uid])})}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){this.addUidsToTracks(r.tracks),this.setState({tracks:r.tracks})}},{key:"shouldComponentUpdate",value:function(r,i){const o=this.previousPropsStr,a=this.updatablePropsToString(r),s=JSON.stringify(this.state),c=JSON.stringify(i),l=o!==a||s!==c||this.props.chooseTrackHandler!==r.chooseTrackHandler||this.props.customDialog!==r.customDialog;l&&(this.previousPropsStr=a);const u=this.numTracks;return this.numTracks=0,oo(this.props.tracks,()=>this.numTracks++),this.reset=this.reset||u===0&&this.numTracks>0,this.numTracks||(this.tracksByUidInit={}),r.mouseTool===ku?this.addBrushes():this.disableBrushes(),l}},{key:"componentDidUpdate",value:function(r,i){if(i.rangeSelection!==this.state.rangeSelection){let o=[null,null];this.state.defaultChromSizes&&this.state.rangeSelection.every(a=>a?.length)&&(o=this.state.rangeSelection.map(a=>Cp(...a,this.state.defaultChromSizes))),this.props.onRangeSelection({dataRange:this.state.rangeSelection,genomicRange:o})}if(this.state.customDialog||this.props.customDialog){const o=this.state.customDialog||this.props.customDialog;if(o.length>0){const a=[],s=[];o.forEach(c=>{a.push(c.bodyComponent),s.push(c.bodyProps)}),this.props.modal.open(x.createElement(DS,{children:a,bodyProps:s,onCancel:this.props.closeCustomDialog,title:o[0].title}))}}if(r.tracks.center,this.props.tracks.center,(this.state.addTrackPosition||this.props.addTrackPosition)&&this.props.modal.open(x.createElement(Zd,{extent:this.state.addTrackExtent||this.props.addTrackExtent,host:this.state.addTrackHost,onCancel:this.handleNoTrackAddedBound,onTracksChosen:this.handleTracksAddedBound,position:this.state.addTrackPosition||this.props.addTrackPosition,trackSourceServers:this.props.trackSourceServers})),this.state.addDivisorDialog){const o=this.state.addDivisorDialog;this.props.modal.open(x.createElement(Zd,{datatype:Gt[o.type].datatype[0],host:this.state.addTrackHost,onCancel:()=>{this.setState({addDivisorDialog:null})},onTracksChosen:a=>{this.handleDivisorChosen(o,a)},trackSourceServers:this.props.trackSourceServers}))}}},{key:"componentWillUnmount",value:function(){this.closing=!0,this.removeEventListeners(),this.pubSubs.forEach(r=>this.props.pubSub.unsubscribe(r))}},{key:"addUidsToTracks",value:function(r){Object.keys(r).forEach(i=>{r[i].forEach(o=>{o.uid=o.uid||Mt.nice()})})}},{key:"contextMenuHandler",value:function(r){if(!this.divTiledPlot)return;const i=this.divTiledPlot.getBoundingClientRect();if(!_0(r.clientX,r.clientY,i.left,i.left+i.width,i.top,i.top+i.height))return;const a=[r.clientX,r.clientY],s=Xt(r,this.divTiledPlot),c=this.trackRenderer.zoomedXScale.invert(s[0]),l=this.trackRenderer.zoomedYScale.invert(s[1]);let u=null;r.hgCustomItems&&(u=r.hgCustomItems.map(f=>x.createElement(xt,{key:f.key,onClick:f.onClick},f.text))),this.setState({contextMenuCustomItems:u,contextMenuPosition:{left:a[0],top:a[1],canvasLeft:s[0]+this.trackRenderer.xPositionOffset,canvasTop:s[1]+this.trackRenderer.yPositionOffset},contextMenuDataX:c,contextMenuDataY:l})}},{key:"measureSize",value:function(){this.element.clientWidth>0&&this.element.clientHeight>0&&this.setState({sizeMeasured:!0,width:this.element.clientWidth,height:this.element.clientHeight})}},{key:"handleTrackOptionsChanged",value:function(r,i){return this.props.onTrackOptionsChanged(r,i)}},{key:"handleCollapseTrack",value:function(r){this.handleTrackOptionsChanged(r,{collapsed:!0})}},{key:"handleExpandTrack",value:function(r){this.handleTrackOptionsChanged(r,{collapsed:!1})}},{key:"handleScalesChanged",value:function(r,i){this.xScale=r,this.yScale=i,this.appZoomed(),this.props.onScalesChanged(r,i)}},{key:"handleTilesetInfoReceived",value:function(r,i){const o=rn(this.props.tracks,r);if(!o){console.warn("Strange, track not found:",r);return}this.tracksByUidInit[o.uid]=!0,this.checkAllTilesetInfoReceived(),o.options||(o.options={}),o.name=i.name,o.maxWidth=i.max_width,o.transforms=i.transforms,o.aggregationModes=i.aggregation_modes,o.header=i.header,o.binsPerDimension=i.bins_per_dimension,i.resolutions?(o.maxZoom=i.resolutions.length-1,o.resolutions=i.resolutions):o.maxZoom=i.max_zoom,i.row_infos&&(o.row_infos=i.row_infos),o.coordSystem=i.coordSystem,o.datatype=i.datatype}},{key:"checkAllTilesetInfoReceived",value:function(){if(this.state.init&&!this.reset||!this.trackRenderer||!this.props.zoomToDataExtentOnInit())return;const r=Object.keys(this.trackRenderer.trackDefObjects).map(o=>{const a=this.trackRenderer.trackDefObjects[o].trackObject;return a.childTracks?a.childTracks:a}).reduce((o,a)=>o.concat(a),[]).filter(({tilesetInfo:o})=>typeof o<"u"&&o!==!0),i=Object.values(this.tracksByUidInit).filter(o=>o).length;r.length===i&&(this.setState({init:!0}),this.reset=!1,this.handleZoomToData())}},{key:"handleOverlayMouseEnter",value:function(r){this.setState({mouseOverOverlayUid:r}),this.props.setOverTrackChooser(!0)}},{key:"handleOverlayMouseLeave",value:function(r){r===this.state.mouseOverOverlayUid&&this.setState({mouseOverOverlayUid:null}),this.props.setOverTrackChooser(!1)}},{key:"handleTrackPositionChosen",value:function(r,i){this.setState({mouseOverOverlayUid:null}),this.props.chooseTrackHandler(r.track.uid,i)}},{key:"handleNoTrackAdded",value:function(){this.trackToReplace=null,this.props.onNoTrackAdded(),this.setState({addTrackExtent:null,addTrackPosition:null,addTrackHost:null})}},{key:"handleAddDivisor",value:function(r){this.setState({addDivisorDialog:r})}},{key:"handleDivisorChosen",value:function(r,i){this.setState({addDivisorDialog:null});const o=r.data?{server:r.data.server,tilesetUid:r.data.tilesetUid}:{server:r.server,tilesetUid:r.tilesetUid},a={server:i[0].server,tilesetUid:i[0].uuid};this.handleChangeTrackData(r.uid,{type:"divided",children:[o,a]})}},{key:"handleDivideSeries",value:function(r){}},{key:"handleAddSeries",value:function(r){const i=Mu(this.props.tracks,r),o=rn(this.props.tracks,r);this.setState({addTrackPosition:i,addTrackHost:o})}},{key:"handleReplaceTrack",value:function(r,i){this.trackToReplace=r,this.handleAddTrack(i)}},{key:"handleAddTrack",value:function(r,i){this.setState({addTrackExtent:i,addTrackPosition:r,addTrackHost:null})}},{key:"handleResizeTrack",value:function(r,i,o){const{tracks:a}=this.state;for(const s in a){const l=a[s].filter(u=>u.uid===r);l.length>0&&(l[0].width=i,l[0].height=o)}this.setState({tracks:a,forceUpdate:Math.random()}),this.props.onResizeTrack()}},{key:"closeMenus",value:function(){this.setState({closeTrackMenuId:null,configTrackMenuId:null,contextMenuPosition:null,contextMenuCustomItems:null})}},{key:"handleLockValueScale",value:function(r){this.closeMenus(),this.props.onLockValueScale(r)}},{key:"handleUnlockValueScale",value:function(r){this.closeMenus(),this.props.onUnlockValueScale(r)}},{key:"handleCloseTrack",value:function(r){this.closeMenus(),this.props.onCloseTrack(r)}},{key:"handleChangeTrackType",value:function(r,i){this.closeMenus(),this.props.onChangeTrackType(r,i)}},{key:"handleChangeTrackData",value:function(r,i){this.closeMenus(),this.props.onChangeTrackData(r,i)}},{key:"handleTracksAdded",value:function(r,i,o,a){return this.trackToReplace&&(this.handleCloseTrack(this.trackToReplace),this.trackToReplace=null),this.props.onTracksAdded(r,i,o,a),this.setState({addTrackExtent:null,addTrackPosition:null,addTrackHost:null}),r}},{key:"handleCloseTrackMenuOpened",value:function(r,i){this.setState({closeTrackMenuId:r,closeTrackMenuLocation:i})}},{key:"handleCloseContextMenu",value:function(){this.setState({contextMenuCustomItems:null,contextMenuPosition:null,contextMenuDataX:null,contextMenuDataY:null})}},{key:"handleCloseTrackMenuClosed",value:function(){this.setState({closeTrackMenuId:null})}},{key:"handleConfigTrackMenuOpened",value:function(r,i){this.closeMenus(),this.setState({configTrackMenuId:r,configTrackMenuLocation:i})}},{key:"handleConfigureTrack",value:function(r,i){this.setState({configTrackMenuId:null,trackOptions:{track:r,configComponent:i}}),this.closeMenus()}},{key:"handleSortEnd",value:function(r){this.setState(i=>{const o=i.tracks,a={};for(let s=0;s<r.length;s++)a[r[s].uid]=s;for(const s in o){const c=o[s];if(c.length&&c[0].uid in a){const l=new Array(c.length);for(let u=0;u<c.length;u++)l[a[c[u].uid]]=c[u];o[s]=l}}return{tracks:o,forceUpdate:Math.random()}})}},{key:"createTracksAndLocations",value:function(){const r=[],{tracks:i}=this.state;return Mp.forEach(o=>{i[o]&&i[o].forEach(a=>{a.contents&&a.contents.forEach(s=>{s.position=o}),a.position=o,r.push({track:a,location:o})})}),r}},{key:"calculateTrackPosition",value:function(r,i){let o=this.props.paddingTop,a=this.props.paddingBottom,s=this.props.paddingLeft,c=this.props.paddingRight,l=this.centerWidth,u=Zn(r),f=0,h=0;switch(i){case"top":s+=this.leftWidth;for(let p=0;p<this.state.tracks.top.length&&this.state.tracks.top[p].uid!==r.uid;p++)o+=Zn(this.state.tracks.top[p]);break;case"bottom":s+=this.leftWidth,o+=this.topHeight+this.centerHeight+this.galleryDim;for(let p=0;p<this.state.tracks.bottom.length&&this.state.tracks.bottom[p].uid!==r.uid;p++)o+=Zn(this.state.tracks.bottom[p]);break;case"left":o+=this.topHeight,l=Qn(r),u=this.centerHeight;for(let p=0;p<this.state.tracks.left.length&&this.state.tracks.left[p].uid!==r.uid;p++)s+=Qn(this.state.tracks.left[p]);break;case"right":s+=this.leftWidth+this.centerWidth+this.galleryDim,o+=this.topHeight,l=Qn(r),u=this.centerHeight;for(let p=0;p<this.state.tracks.right.length&&this.state.tracks.right[p].uid!==r.uid;p++)s+=Qn(this.state.tracks.right[p]);break;case"center":s+=this.leftWidth,o+=this.topHeight,u=this.centerHeight;break;case"gallery":s+=this.leftWidthNoGallery,o+=this.topHeightNoGallery,l=this.state.width-this.leftWidthNoGallery-this.rightWidthNoGallery-this.props.paddingLeft,u=this.state.height-this.topHeightNoGallery-this.bottomHeightNoGallery-this.props.paddingTop,f=this.galleryDim,h=this.galleryDim;for(let p=0;p<this.state.tracks.gallery.length&&this.state.tracks.gallery[p].uid!==r.uid;p++)l-=2*this.state.tracks.gallery[p].height,u-=2*this.state.tracks.gallery[p].height,s+=this.state.tracks.gallery[p].height,o+=this.state.tracks.gallery[p].height,f-=this.state.tracks.gallery[p].height,h-=this.state.tracks.gallery[p].height;for(let p=0;p<this.state.tracks.right.length;p++)c+=this.state.tracks.right[p].width;for(let p=0;p<this.state.tracks.bottom.length;p++)a+=this.state.tracks.bottom[p].height;r.offsetX=f,r.offsetY=h,r.offsetTop=o,r.offsetRight=c,r.offsetBottom=a,r.offsetLeft=s;break;default:l=this.leftWidth+this.centerWidth+this.rightWidth,u=this.topHeight+this.centerHeight+this.bottomHeight}return Mp.indexOf(i)===-1&&console.warn("Track with unknown position present:",i,r),{left:s,top:o,width:l,height:u,track:r}}},{key:"findCentralHeatmapTrack",value:function(r){for(let i=0;i<r.length;i++){if(r[i].type==="combined")return this.findCentralHeatmapTrack(r[i].contents);if(r[i].type==="heatmap")return r[i]}}},{key:"trackUuidToOrientation",value:function(r){}},{key:"overlayTracks",value:function(r){return this.props.overlays?this.props.overlays.filter(o=>o.includes?.length).map(o=>{const a=o.type?`overlay-${o.type}-track`:"overlay-track",s={...o,uid:o.uid||Mt.nice(),includes:o.includes,type:a,options:Object.assign(o.options,{orientationsAndPositions:o.includes.map(c=>{const l=rn(this.props.tracks,c);if(!l)return console.warn(`OverlayTrack included uid (${c}) not found in the track list`),null;const u=Mu(this.props.tracks,l.uid);let f;if((u==="top"||u==="bottom")&&(f="1d-horizontal"),(u==="left"||u==="right")&&(f="1d-vertical"),u==="center"&&(f="2d"),!f)return console.warn("Only top, bottom, left, right, or center tracks can be overlaid at the moment"),null;const h=r.filter(d=>d.track.uid===c);if(!h.length)return null;const p={left:h[0].left-this.props.paddingLeft,top:h[0].top-this.props.paddingTop,width:h[0].width,height:h[0].height};return{orientation:f,position:p}}).filter(c=>c)})};return{top:this.props.paddingTop,left:this.props.paddingLeft,width:this.leftWidth+this.centerWidth+this.rightWidth,height:this.topHeight+this.centerHeight+this.bottomHeight+this.props.marginTop+this.props.marginBottom,track:s}}):[]}},{key:"positionedTracks",value:function(){return this.createTracksAndLocations().map(({track:i,location:o})=>this.calculateTrackPosition(i,o))}},{key:"createTrackPositionTexts",value:function(){const r=this.positionedTracks();return this.createTracksAndLocations(),r.map(o=>{const{track:a}=o;return x.createElement("div",{key:a.uid,style:{left:o.left,top:o.top,width:Qn(o.track),height:Zn(o.track),position:"absolute"}},a.uid.slice(0,2))})}},{key:"handleExportTrackData",value:function(r,i){const o=rn(this.props.tracks,i);let a=null;r!==i?a=this.trackRenderer.trackDefObjects[r].trackObject.createdTracks[o.uid]:{trackObject:a}=this.trackRenderer.trackDefObjects[r],a.exportData(),this.closeMenus()}},{key:"listTracksAtPosition",value:function(r,i,o=!1){const a=[];if(!this.trackRenderer)return[];for(const s in this.trackRenderer.trackDefObjects){const c=this.trackRenderer.trackDefObjects[s].trackObject;if(c.respondsToPosition(r,i))if(o){if(this.props.tracks.center)if(this.props.tracks.center.contents)for(let l=0;l<this.props.tracks.center.contents.length;l++)this.props.tracks.center.contents[l].uid===s&&(c.is2d=!0);else this.props.tracks.center?.length&&this.props.tracks.center[0].uid===s&&(c.is2d=!0);a.push(c)}else a.push(this.trackRenderer.trackDefObjects[s].trackDef.track)}return a}},{key:"listAllTrackObjects",value:function(){const r=[];for(const i in this.trackRenderer.trackDefObjects){const o=this.trackRenderer.trackDefObjects[i];if(o.trackObject.createdTracks)for(const a in o.trackObject.createdTracks){const s=o.trackObject.createdTracks[a];r.push(s)}else r.push(o.trackObject)}return r}},{key:"handleZoomToData",value:function(){const r=Number.MAX_SAFE_INTEGER,i=Number.MIN_SAFE_INTEGER,o=[r,r],a=[i,i],s=this.listAllTrackObjects();for(const h of s)if(h.tilesetInfo&&h.tilesetInfo.min_pos)for(let p=0;p<h.tilesetInfo.min_pos.length;p++)h.tilesetInfo.min_pos[p]<o[p]&&(o[p]=h.tilesetInfo.min_pos[p]),h.tilesetInfo.max_pos[p]>a[p]&&(a[p]=h.tilesetInfo.max_pos[p]);const c=this.trackRenderer.currentProps.paddingLeft+this.trackRenderer.currentProps.leftWidth;let l=[c,c+this.trackRenderer.currentProps.centerWidth].map(this.trackRenderer.zoomTransform.rescaleX(this.trackRenderer.xScale).invert);const u=this.trackRenderer.currentProps.paddingTop+this.trackRenderer.currentProps.topHeight;let f=[u,u+this.trackRenderer.currentProps.centerHeight].map(this.trackRenderer.zoomTransform.rescaleY(this.trackRenderer.yScale).invert);this.trackRenderer.zoomTransform.k=1,this.trackRenderer.zoomTransform.x=0,this.trackRenderer.zoomTransform.y=0,this.trackRenderer.applyZoomTransform(),o[0]<Number.MAX_SAFE_INTEGER&&a[0]>Number.MIN_SAFE_INTEGER&&(l=[o[0],a[0]]),o[1]<Number.MAX_SAFE_INTEGER&&a[1]>Number.MIN_SAFE_INTEGER&&(f=[o[1],a[1]]),this.props.onDataDomainChanged(l,f)}},{key:"resetViewport",value:function(){this.trackRenderer.zoomTransform.k=1,this.trackRenderer.zoomTransform.x=0,this.trackRenderer.zoomTransform.y=0,this.trackRenderer.applyZoomTransform(),this.props.onDataDomainChanged(this.props.initialXDomain,this.props.initialYDomain)}},{key:"updatablePropsToString",value:function(r){return JSON.stringify({tracks:r.tracks,overlays:r.overlays,viewOptions:r.viewOptions,uid:r.uid,addTrackExtent:r.addTrackExtent,addTrackPosition:r.addTrackPosition,editable:r.editable,marginTop:r.marginTop,marginBottom:r.marginBottom,marginLeft:r.marginLeft,marginRight:r.marginRight,paddingTop:r.paddingTop,paddingBottom:r.paddingBottom,paddingLeft:r.paddingLeft,paddingRight:r.paddingRight,mouseTool:r.mouseTool,initialXDomain:r.initialXDomain,initialYDomain:r.initialYDomain,trackSourceServers:r.trackSourceServers,zoomable:r.zoomable,draggingHappening:r.draggingHappening})}},{key:"getXYScales",value:function(){this.trackRenderer&&(this.xScale=this.trackRenderer.currentXScale,this.yScale=this.trackRenderer.currentYScale)}},{key:"rangeViewToDataLoci",value:function(r,i){return i?[Number.parseInt(i.invert(r[0]),10),Number.parseInt(i.invert(r[1]),10)]:[null,null]}},{key:"rangeSelectionResetHandler",value:function(){this.state.rangeSelectionMaster&&this.setState({is1dRangeSelection:null,rangeSelection:[null,null],rangeSelectionMaster:null,rangeSelectionEnd:!1})}},{key:"rangeSelection1dEndHandler",value:function(r){(!this.xScale||!this.yScale)&&this.getXYScales();const i=r==="x"?this.xScale:this.yScale;return o=>{this.setState(a=>{const s=a.is1dRangeSelection?[null,null]:a.rangeSelection.slice(),c=!this.state.is1dRangeSelection&&r==="y"?1:0;let l=this.rangeViewToDataLoci(o,i);const u=l[1]-l[0];if(this.props.rangeSelection1dSize[0]>u){const f=l[0]+u/2;l=[f-this.props.rangeSelection1dSize[0]/2,f+this.props.rangeSelection1dSize[0]/2]}else if(this.props.rangeSelection1dSize[1]<u){const f=l[0]+u/2;l=[f-this.props.rangeSelection1dSize[1]/2,f+this.props.rangeSelection1dSize[1]/2]}return s[c]=l,this.props.rangeSelectionToInt&&(s[c]=s[c].map(f=>Math.round(f))),{rangeSelection:s,rangeSelectionEnd:!0}})}}},{key:"rangeSelection1dHandler",value:function(r){(!this.xScale||!this.yScale)&&this.getXYScales();const i=r==="x"?this.xScale:this.yScale;return o=>{this.setState(a=>{const s=a.is1dRangeSelection?[null,null]:a.rangeSelection.slice(),c=!a.is1dRangeSelection&&r==="y"?1:0;return s[c]=this.rangeViewToDataLoci(o,i),{rangeSelection:s,rangeSelectionEnd:!1}})}}},{key:"rangeSelection1dStartHandler",value:function(){this.state.rangeSelectionMaster||this.setState({is1dRangeSelection:!0,rangeSelectionMaster:!0,rangeSelectionEnd:!1})}},{key:"rangeSelection2dHandler",value:function(r){(!this.xScale||!this.yScale)&&this.getXYScales(),this.setState({rangeSelection:[this.rangeViewToDataLoci(r[0],this.xScale),this.rangeViewToDataLoci(r[1],this.yScale)],rangeSelectionEnd:!1})}},{key:"rangeSelection2dStartHandler",value:function(){this.state.rangeSelectionMaster||this.setState({is1dRangeSelection:!1,rangeSelectionMaster:!0,rangeSelectionEnd:!1})}},{key:"rangeSelection2dEndHandler",value:function(r){(!this.xScale||!this.yScale)&&this.getXYScales();const i=this.rangeViewToDataLoci(r[0],this.xScale),o=this.rangeViewToDataLoci(r[1],this.yScale);let a=[i,o];const s=i[1]-i[0],c=o[1]-o[0],l=[s,c];a.forEach((u,f)=>{if(this.props.rangeSelection1dSize[0]>l[f]){const h=u[0]+Math.round(l[f]/2);u[0]=h-this.props.rangeSelection1dSize[0]/2,u[1]=h+this.props.rangeSelection1dSize[0]/2}else if(this.props.rangeSelection1dSize[1]<l[f]){const h=u[0]+Math.round(l[f]/2);u[0]=h-this.props.rangeSelection1dSize[1]/2,u[1]=h+this.props.rangeSelection1dSize[1]/2}}),this.props.rangeSelectionToInt&&(a=a.map(u=>u.map(f=>Math.round(f)))),this.setState({rangeSelection:a,rangeSelectionEnd:!0})}},{key:"getContextMenu",value:function(){if(this.state.contextMenuPosition){const r=this.listTracksAtPosition(this.state.contextMenuPosition.canvasLeft,this.state.contextMenuPosition.canvasTop);return x.createElement(Go,{onMenuClosed:this.closeMenusBound},x.createElement(Bz,{apiPublish:this.props.apiPublish,closeMenu:this.closeMenusBound,coords:[this.state.contextMenuDataX,this.state.contextMenuDataY],customItems:this.state.contextMenuCustomItems,genomePositionSearchBox:this.props.genomePositionSearchBox,onAddDivisor:this.handleAddDivisorBound,onAddSeries:this.handleAddSeriesBound,onAddTrack:i=>{this.props.onTracksAdded([i],i.position,null,null),this.handleCloseContextMenu()},onChangeTrackData:this.handleChangeTrackDataBound,onChangeTrackType:this.handleChangeTrackTypeBound,onCloseTrack:this.handleCloseTrackBound,onConfigureTrack:this.handleConfigureTrackBound,onExportData:this.handleExportTrackDataBound,onLockValueScale:this.handleLockValueScaleBound,onReplaceTrack:this.handleReplaceTrackBound,onTrackOptionsChanged:this.handleTrackOptionsChangedBound,onUnlockValueScale:this.handleUnlockValueScaleBound,orientation:"right",position:this.state.contextMenuPosition,theme:this.props.theme,trackRenderer:this.trackRenderer,tracks:r,trackSourceServers:this.props.trackSourceServers}))}return null}},{key:"getIdealizedTrackPositionsOverlay",value:function(){const r=this.props.draggingHappening,{datatype:i}=r,o=Ike(i,r.defaultTracks);if(!o)return null;const a=new Set(["top","left","right","center","bottom"].filter(E=>E in this.state.tracks&&this.state.tracks[E].length)),s="top"in o,c="left"in o,l="right"in o,u="bottom"in o,f="center"in o,h="center"in o||a.has("left")||a.has("right")||a.has("center"),p="top"in o,d="bottom"in o&&h,g="left"in o&&h,y="right"in o&&h,b=Object.keys(o).length&&("center"in o||h),m=x.createElement("div",{style:{flexGrow:1}}),v=x.cloneElement(m),_=x.createElement("div",{style:{display:"flex",flexGrow:1}},p&&(b||g)?m:null,x.createElement(P1,{defaultTrackType:o.top,draggingHappening:this.props.draggingHappening,enabled:s,onTrackDropped:E=>this.handleTracksAdded([E],"top"),style:{border:"1px solid black",flexGrow:1}}),p&&(b||g)?v:null),T=x.createElement("div",{style:{display:"flex",flexGrow:1}},p&&(b||g)?m:null,x.createElement(P1,{defaultTrackType:o.bottom,draggingHappening:this.props.draggingHappening,enabled:u,onTrackDropped:E=>this.handleTracksAdded([E],"bottom"),style:{border:"1px solid black",flexGrow:1}}),p&&(b||g)?v:null),w=x.createElement(P1,{defaultTrackType:o.left,draggingHappening:this.props.draggingHappening,enabled:c,onTrackDropped:E=>this.handleTracksAdded([E],"left"),style:{border:"1px solid black",flexGrow:1}}),S=x.createElement(P1,{defaultTrackType:o.center,draggingHappening:this.props.draggingHappening,enabled:f,onTrackDropped:E=>this.handleTracksAdded([E],"center"),position:"center",style:{border:"1px solid black",flexGrow:1}}),k=x.cloneElement(w,{defaultTrackType:o.right,enabled:l,onTrackDropped:E=>this.handleTracksAdded([E],"right")});return x.createElement("div",{style:{position:"absolute",left:"0px",top:"0px",width:this.state.width,height:this.state.height}},x.createElement("div",{style:{position:"absolute",width:this.state.width,height:this.state.height,background:"white",opacity:.4}}),x.createElement("div",{style:{width:this.state.width,height:this.state.height,position:"absolute",display:"flex",flexDirection:"column"}},p?_:null,h&&x.createElement("div",{style:{display:"flex",height:p||d?"40%":"100%",width:"100%"}},g?w:null,b?S:null,y?k:null),d?T:null))}},{key:"render",value:function(){this.galleryDim=this.props.tracks.gallery?this.props.tracks.gallery.map(m=>Zn(m)).reduce(zo,0):0,this.topHeightNoGallery=this.props.tracks.top.map(m=>Zn(m)).reduce(zo,0),this.topHeight=this.topHeightNoGallery+this.galleryDim,this.bottomHeightNoGallery=this.props.tracks.bottom.map(m=>Zn(m)).reduce(zo,0),this.bottomHeight=this.bottomHeightNoGallery+this.galleryDim,this.leftWidthNoGallery=this.props.tracks.left.map(m=>Qn(m)).reduce(zo,0),this.leftWidth=this.leftWidthNoGallery+this.galleryDim,this.rightWidthNoGallery=this.props.tracks.right.map(m=>Qn(m)).reduce(zo,0),this.rightWidth=this.rightWidthNoGallery+this.galleryDim;const r=this.props.paddingTop+this.props.paddingBottom,i=this.props.paddingLeft+this.props.paddingRight;this.centerHeight=Math.max(1,this.state.height-this.topHeight-this.bottomHeight-r),this.centerWidth=Math.max(1,this.state.width-this.leftWidth-this.rightWidth-i);const o="none",a=x.createElement("div",{className:"top-track-container",style:{left:this.leftWidth+this.props.paddingLeft,top:this.props.paddingTop,width:this.centerWidth,height:this.topHeightNoGallery,outline:o,position:"absolute"}},x.createElement(eg,{configTrackMenuId:this.state.configTrackMenuId,editable:this.props.editable,handleConfigTrack:this.handleConfigTrackMenuOpened.bind(this),handleResizeTrack:this.handleResizeTrack.bind(this),handleSortEnd:this.handleSortEnd.bind(this),is1dRangeSelection:this.state.is1dRangeSelection,isRangeSelectionActive:this.props.mouseTool===Xn,onAddSeries:this.handleAddSeries.bind(this),onCloseTrack:this.handleCloseTrack.bind(this),onCloseTrackMenuOpened:this.handleCloseTrackMenuOpened.bind(this),onCollapseTrack:this.handleCollapseTrack.bind(this),onExpandTrack:this.handleExpandTrack.bind(this),onConfigTrackMenuOpened:this.handleConfigTrackMenuOpened.bind(this),onRangeSelection:this.rangeSelection1dHandler("x").bind(this),onRangeSelectionEnd:this.rangeSelection1dEndHandler("x").bind(this),onRangeSelectionReset:this.rangeSelectionResetHandler.bind(this),onRangeSelectionStart:this.rangeSelection1dStartHandler.bind(this),rangeSelection:this.state.rangeSelection,rangeSelectionEnd:this.state.rangeSelectionEnd,resizeHandles:new Set(["bottom"]),scale:this.xScale,tracks:this.props.tracks.top,width:this.centerWidth})),s=x.createElement("div",{className:"left-track-container",style:{left:this.props.paddingLeft,top:this.topHeight+this.props.paddingTop,width:this.leftWidthNoGallery,height:this.centerHeight,outline:o,position:"absolute"}},x.createElement(Dk,{configTrackMenuId:this.state.configTrackMenuId,editable:this.props.editable,handleConfigTrack:this.handleConfigTrackMenuOpened.bind(this),handleResizeTrack:this.handleResizeTrack.bind(this),handleSortEnd:this.handleSortEnd.bind(this),height:this.centerHeight,is1dRangeSelection:this.state.is1dRangeSelection,isRangeSelectionActive:this.props.mouseTool===Xn,onAddSeries:this.handleAddSeries.bind(this),onCloseTrack:this.handleCloseTrack.bind(this),onCloseTrackMenuOpened:this.handleCloseTrackMenuOpened.bind(this),onCollapseTrack:this.handleCollapseTrack.bind(this),onExpandTrack:this.handleExpandTrack.bind(this),onConfigTrackMenuOpened:this.handleConfigTrackMenuOpened.bind(this),onRangeSelection:this.rangeSelection1dHandler("y").bind(this),onRangeSelectionEnd:this.rangeSelection1dEndHandler("y").bind(this),onRangeSelectionReset:this.rangeSelectionResetHandler.bind(this),onRangeSelectionStart:this.rangeSelection1dStartHandler.bind(this),rangeSelection:this.state.rangeSelection,rangeSelectionEnd:this.state.rangeSelectionEnd,resizeHandles:new Set(["right"]),scale:this.yScale,tracks:this.props.tracks.left})),c=x.createElement("div",{className:"right-track-container",style:{right:this.props.paddingRight,top:this.topHeight+this.props.paddingTop,width:this.rightWidthNoGallery,height:this.centerHeight,outline:o,position:"absolute"}},x.createElement(Dk,{configTrackMenuId:this.state.configTrackMenuId,editable:this.props.editable,handleConfigTrack:this.handleConfigTrackMenuOpened.bind(this),handleResizeTrack:this.handleResizeTrack.bind(this),handleSortEnd:this.handleSortEnd.bind(this),height:this.centerHeight,is1dRangeSelection:this.state.is1dRangeSelection,isRangeSelectionActive:this.props.mouseTool===Xn,onAddSeries:this.handleAddSeries.bind(this),onCloseTrack:this.handleCloseTrack.bind(this),onCloseTrackMenuOpened:this.handleCloseTrackMenuOpened.bind(this),onCollapseTrack:this.handleCollapseTrack.bind(this),onExpandTrack:this.handleExpandTrack.bind(this),onConfigTrackMenuOpened:this.handleConfigTrackMenuOpened.bind(this),onRangeSelection:this.rangeSelection1dHandler("y").bind(this),onRangeSelectionEnd:this.rangeSelection1dEndHandler("y").bind(this),onRangeSelectionReset:this.rangeSelectionResetHandler.bind(this),onRangeSelectionStart:this.rangeSelection1dStartHandler.bind(this),rangeSelection:this.state.rangeSelection,rangeSelectionEnd:this.state.rangeSelectionEnd,resizeHandles:new Set(["left"]),scale:this.yScale,tracks:this.props.tracks.right,tracksControlAlignLeft:!0})),l=x.createElement("div",{className:"bottom-track-container",style:{left:this.leftWidth+this.props.paddingLeft,bottom:this.props.paddingBottom,width:this.centerWidth,height:this.bottomHeightNoGallery,outline:o,position:"absolute"}},x.createElement(eg,{configTrackMenuId:this.state.configTrackMenuId,editable:this.props.editable,handleConfigTrack:this.handleConfigTrackMenuOpened.bind(this),handleResizeTrack:this.handleResizeTrack.bind(this),handleSortEnd:this.handleSortEnd.bind(this),is1dRangeSelection:this.state.is1dRangeSelection,isRangeSelectionActive:this.props.mouseTool===Xn,onAddSeries:this.handleAddSeries.bind(this),onCloseTrack:this.handleCloseTrack.bind(this),onCloseTrackMenuOpened:this.handleCloseTrackMenuOpened.bind(this),onCollapseTrack:this.handleCollapseTrack.bind(this),onExpandTrack:this.handleExpandTrack.bind(this),onConfigTrackMenuOpened:this.handleConfigTrackMenuOpened.bind(this),onRangeSelection:this.rangeSelection1dHandler("x").bind(this),onRangeSelectionEnd:this.rangeSelection1dEndHandler("x").bind(this),onRangeSelectionReset:this.rangeSelectionResetHandler.bind(this),onRangeSelectionStart:this.rangeSelection1dStartHandler.bind(this),rangeSelection:this.state.rangeSelection,rangeSelectionEnd:this.state.rangeSelectionEnd,resizeHandles:new Set(["top"]),scale:this.xScale,tracks:this.props.tracks.bottom,width:this.centerWidth})),u=x.createElement("div",{key:"galleryTracksDiv",className:"gallery-track-container",style:{left:this.leftWidthNoGallery+this.props.paddingLeft,top:this.topHeightNoGallery+this.props.paddingTop,width:this.centerWidth+2*this.galleryDim,height:this.centerHeight+2*this.galleryDim,outline:o,position:"absolute"}},x.createElement(MN,{configTrackMenuId:this.state.configTrackMenuId,editable:this.props.editable,height:this.centerHeight+2*this.galleryDim,onAddSeries:this.handleAddSeries.bind(this),onCloseTrack:this.handleCloseTrack.bind(this),onCloseTrackMenuOpened:this.handleCloseTrackMenuOpened.bind(this),onConfigTrackMenuOpened:this.handleConfigTrackMenuOpened.bind(this),tracks:this.props.tracks.gallery,width:this.centerWidth+2*this.galleryDim}));let f=x.createElement("div",{className:$t("center-track-container",Ew["center-track-container"]),style:{left:this.leftWidth+this.props.paddingLeft,top:this.topHeight+this.props.paddingTop,width:this.centerWidth,height:this.bottomHeight,outline:o}});this.props.tracks.center.length&&(f=x.createElement("div",{className:$t("center-track-container",Ew["center-track-container"]),style:{left:this.leftWidth+this.props.paddingLeft,top:this.topHeight+this.props.paddingTop,width:this.centerWidth,height:this.centerHeight,outline:o}},x.createElement(xw,{configTrackMenuId:this.state.configTrackMenuId,editable:this.props.editable,height:this.centerHeight,is1dRangeSelection:this.state.is1dRangeSelection,isRangeSelectionActive:this.props.mouseTool===Xn,onAddSeries:this.handleAddSeries.bind(this),onCloseTrackMenuOpened:this.handleCloseTrackMenuOpened.bind(this),onConfigTrackMenuOpened:this.handleConfigTrackMenuOpened.bind(this),onRangeSelectionReset:this.rangeSelectionResetHandler.bind(this),onRangeSelectionStart:this.rangeSelection2dStartHandler.bind(this),onRangeSelectionX:this.rangeSelection1dHandler("x").bind(this),onRangeSelectionXEnd:this.rangeSelection1dEndHandler("x").bind(this),onRangeSelectionXY:this.rangeSelection2dHandler.bind(this),onRangeSelectionXYEnd:this.rangeSelection2dEndHandler.bind(this),onRangeSelectionY:this.rangeSelection1dHandler("y").bind(this),onRangeSelectionYEnd:this.rangeSelection1dEndHandler("y").bind(this),rangeSelection:this.state.rangeSelection,rangeSelectionEnd:this.state.rangeSelectionEnd,scaleX:this.xScale,scaleY:this.yScale,tracks:this.props.tracks.center,uid:this.props.tracks.center[0].uid,width:this.centerWidth}))),this.createTrackPositionTexts();let h=this.positionedTracks();h=h.concat(this.overlayTracks(h));let p=null;this.state.sizeMeasured&&(p=x.createElement(uke,{ref:m=>{this.trackRenderer=m,this.checkAllTilesetInfoReceived()},canvasElement:this.props.canvasElement,centerHeight:this.centerHeight,centerWidth:this.centerWidth,disableTrackMenu:this.props.disableTrackMenu,dragging:this.props.dragging,galleryDim:this.galleryDim,getLockGroupExtrema:this.props.getLockGroupExtrema,height:this.state.height,initialXDomain:this.props.initialXDomain,initialYDomain:this.props.initialYDomain,isRangeSelection:this.props.mouseTool===Xn,isShowGlobalMousePosition:this.props.isShowGlobalMousePosition,isValueScaleLocked:this.props.isValueScaleLocked,leftWidth:this.leftWidth,leftWidthNoGallery:this.leftWidthNoGallery,metaTracks:this.props.metaTracks,onMouseMoveZoom:this.props.onMouseMoveZoom,onNewTilesLoaded:this.props.onNewTilesLoaded,onScalesChanged:this.handleScalesChanged.bind(this),onTilesetInfoReceived:this.handleTilesetInfoReceived.bind(this),onTrackOptionsChanged:this.handleTrackOptionsChanged.bind(this),onValueScaleChanged:this.props.onValueScaleChanged,paddingLeft:this.props.paddingLeft,paddingTop:this.props.paddingTop,pixiRenderer:this.props.pixiRenderer,pixiStage:this.props.pixiStage,pluginDataFetchers:this.props.pluginDataFetchers,pluginTracks:this.props.pluginTracks,positionedTracks:h,registerDraggingChangedListener:this.props.registerDraggingChangedListener,removeDraggingChangedListener:this.props.removeDraggingChangedListener,setCentersFunction:this.props.setCentersFunction,svgElement:this.props.svgElement,topHeight:this.topHeight,topHeightNoGallery:this.topHeightNoGallery,uid:this.props.uid,viewOptions:this.props.viewOptions,width:this.state.width,xDomainLimits:this.props.xDomainLimits,yDomainLimits:this.props.yDomainLimits,zoomable:this.props.zoomable,zoomLimits:this.props.zoomLimits},a,s,c,l,u,f));let d=null,g=null;this.state.configTrackMenuId&&(d=x.createElement(Go,{onMenuClosed:this.closeMenusBound},x.createElement(ape,{ref:m=>{this.configTrackMenu=m},apiPublish:this.props.apiPublish,closeMenu:this.closeMenusBound,onAddDivisor:this.handleAddDivisorBound,onAddSeries:this.handleAddSeriesBound,onAddTrack:this.handleAddTrackBound,onChangeTrackType:this.handleChangeTrackTypeBound,onCloseTrack:this.handleCloseTrackBound,onConfigureTrack:this.handleConfigureTrackBound,onExportData:this.handleExportTrackDataBound,onLockValueScale:this.handleLockValueScaleBound,onReplaceTrack:this.handleReplaceTrackBound,onTrackOptionsChanged:this.handleTrackOptionsChangedBound,onUnlockValueScale:this.handleUnlockValueScaleBound,position:this.state.configTrackMenuLocation,theme:this.props.theme,trackOrientation:Mu(this.props.tracks,this.state.configTrackMenuId),trackRenderer:this.trackRenderer,tracks:[rn(this.props.tracks,this.state.configTrackMenuId)]}))),this.state.closeTrackMenuId&&(g=x.createElement(Go,{onMenuClosed:this.handleCloseTrackMenuClosed.bind(this)},x.createElement(Yo,{position:this.state.closeTrackMenuLocation,theme:this.props.theme},x.createElement(CR,{onCloseTrack:this.handleCloseTrack.bind(this),tracks:[rn(this.props.tracks,this.state.closeTrackMenuId)]}))));let y=null;this.props.chooseTrackHandler&&(y=h.filter(m=>m.track.position!=="whole").map(m=>{let v="tiled-plot-track-overlay-animate";return(this.state.mouseOverOverlayUid||this.props.overTrackChooser)&&(v="tiled-plot-track-overlay-plain"),this.state.mouseOverOverlayUid===m.track.uid&&(v="tiled-plot-track-overlay-selected"),x.createElement("div",{className:ti[v],key:m.track.uid,onClick:_=>this.handleTrackPositionChosen(m,_),onDragEnter:_=>{this.handleOverlayMouseEnter(m.track.uid),_.preventDefault()},onDragLeave:()=>this.handleOverlayMouseLeave(m.track.uid),onDragOver:_=>_.preventDefault(),onDrop:()=>this.handleTrackPositionChosen(m),onMouseEnter:()=>this.handleOverlayMouseEnter(m.track.uid),onMouseLeave:()=>this.handleOverlayMouseLeave(m.track.uid),style:{position:"absolute",left:m.left,top:m.top,width:Qn(m),height:Zn(m),zIndex:1}})}));let b=null;if(this.xScale&&this.yScale&&this.props.editable&&this.state.trackOptions){const m=this.state.trackOptions.configComponent,v=this.state.trackOptions.track;b=x.createElement(m,{track:v,xScale:this.xScale,yScale:this.yScale,onCancel:()=>{this.setState({trackOptions:null})},onTrackOptionsChanged:_=>_,onSubmit:_=>{this.handleTrackOptionsChanged(this.state.trackOptions.track.uid,_),this.setState({trackOptions:null})}})}return x.createElement("div",{ref:m=>{this.divTiledPlot=m},className:$t("tiled-plot-div",ti["tiled-plot"]),onClick:this.handleClickBound,style:{marginBottom:this.props.marginBottom,marginLeft:this.props.marginLeft,marginRight:this.props.marginRight,marginTop:this.props.marginTop}},p,y,d,g,b,this.getContextMenu(),this.props.draggingHappening&&this.getIdealizedTrackPositionsOverlay())}},{key:"addEventListeners",value:function(){this.eventListeners=[],this.eventListeners.forEach(r=>document.addEventListener(r.name,r.callback,!1))}},{key:"removeEventListeners",value:function(){this.eventListeners.forEach(r=>document.removeEventListener(r.name,r.callback))}}])}(x.Component);$k.defaultProps={isShowGlobalMousePosition:!1,pluginTracks:{},metaTracks:[],zoomable:!0},$k.propTypes={addTrackExtent:q.string,addTrackPosition:q.string,canvasElement:q.object,chooseTrackHandler:q.func,chromInfoPath:q.string,customDialog:q.array,closeCustomDialog:q.func,disableTrackMenu:q.bool,dragging:q.bool,draggingHappening:q.bool,editable:q.bool,getLockGroupExtrema:q.func,initialXDomain:q.array,initialYDomain:q.array,isShowGlobalMousePosition:q.bool,isValueScaleLocked:q.func,marginBottom:q.number.isRequired,marginLeft:q.number.isRequired,marginRight:q.number.isRequired,marginTop:q.number.isRequired,paddingBottom:q.number.isRequired,paddingLeft:q.number.isRequired,paddingRight:q.number.isRequired,paddingTop:q.number.isRequired,metaTracks:q.array,modal:q.object,mouseTool:q.string,onCloseTrack:q.func,onChangeTrackData:q.func,onChangeTrackType:q.func,onDataDomainChanged:q.func,onLockValueScale:q.func,onMouseMoveZoom:q.func,onNewTilesLoaded:q.func,onNoTrackAdded:q.func,onRangeSelection:q.func.isRequired,onScalesChanged:q.func,onTrackOptionsChanged:q.func,onTrackPositionChosen:q.func,onTracksAdded:q.func,onUnlockValueScale:q.func,onValueScaleChanged:q.func,onResizeTrack:q.func,overlays:q.array,openModal:q.func,pixiRenderer:q.object,pixiStage:q.object,pluginTracks:q.object,pubSub:q.object.isRequired,rangeSelection1dSize:q.array,rangeSelectionToInt:q.bool,registerDraggingChangedListener:q.func,removeDraggingChangedListener:q.func,setCentersFunction:q.func,svgElement:q.object,theme:q.symbol.isRequired,tracks:q.object,trackSourceServers:q.array,uid:q.string,viewOptions:q.object,xDomainLimits:q.array,yDomainLimits:q.array,zoomable:q.bool,zoomLimits:q.array,zoomToDataExtentOnInit:q.func};const Fke=tl(Md(sl($k)));var jk={exports:{}},Hz;function qke(){return Hz||(Hz=1,function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{},n=function(r){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,o=0,a={},s={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function m(v){return v instanceof c?new c(v.type,m(v.content),v.alias):Array.isArray(v)?v.map(m):v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++o}),m.__id},clone:function m(v,_){_=_||{};var T,w;switch(s.util.type(v)){case"Object":if(w=s.util.objId(v),_[w])return _[w];T={},_[w]=T;for(var S in v)v.hasOwnProperty(S)&&(T[S]=m(v[S],_));return T;case"Array":return w=s.util.objId(v),_[w]?_[w]:(T=[],_[w]=T,v.forEach(function(k,E){T[E]=m(k,_)}),T);default:return v}},getLanguage:function(m){for(;m;){var v=i.exec(m.className);if(v)return v[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,v){m.className=m.className.replace(RegExp(i,"gi"),""),m.classList.add("language-"+v)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT"&&1<2)return document.currentScript;try{throw new Error}catch(T){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(T.stack)||[])[1];if(m){var v=document.getElementsByTagName("script");for(var _ in v)if(v[_].src==m)return v[_]}return null}},isActive:function(m,v,_){for(var T="no-"+v;m;){var w=m.classList;if(w.contains(v))return!0;if(w.contains(T))return!1;m=m.parentElement}return!!_}},languages:{plain:a,plaintext:a,text:a,txt:a,extend:function(m,v){var _=s.util.clone(s.languages[m]);for(var T in v)_[T]=v[T];return _},insertBefore:function(m,v,_,T){T=T||s.languages;var w=T[m],S={};for(var k in w)if(w.hasOwnProperty(k)){if(k==v)for(var E in _)_.hasOwnProperty(E)&&(S[E]=_[E]);_.hasOwnProperty(k)||(S[k]=w[k])}var P=T[m];return T[m]=S,s.languages.DFS(s.languages,function(C,I){I===P&&C!=m&&(this[C]=S)}),S},DFS:function m(v,_,T,w){w=w||{};var S=s.util.objId;for(var k in v)if(v.hasOwnProperty(k)){_.call(v,k,v[k],T||k);var E=v[k],P=s.util.type(E);P==="Object"&&!w[S(E)]?(w[S(E)]=!0,m(E,_,null,w)):P==="Array"&&!w[S(E)]&&(w[S(E)]=!0,m(E,_,k,w))}}},plugins:{},highlightAll:function(m,v){s.highlightAllUnder(document,m,v)},highlightAllUnder:function(m,v,_){var T={callback:_,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};s.hooks.run("before-highlightall",T),T.elements=Array.prototype.slice.apply(T.container.querySelectorAll(T.selector)),s.hooks.run("before-all-elements-highlight",T);for(var w=0,S;S=T.elements[w++];)s.highlightElement(S,v===!0,T.callback)},highlightElement:function(m,v,_){var T=s.util.getLanguage(m),w=s.languages[T];s.util.setLanguage(m,T);var S=m.parentElement;S&&S.nodeName.toLowerCase()==="pre"&&s.util.setLanguage(S,T);var k=m.textContent,E={element:m,language:T,grammar:w,code:k};function P(I){E.highlightedCode=I,s.hooks.run("before-insert",E),E.element.innerHTML=E.highlightedCode,s.hooks.run("after-highlight",E),s.hooks.run("complete",E),_&&_.call(E.element)}if(s.hooks.run("before-sanity-check",E),S=E.element.parentElement,S&&S.nodeName.toLowerCase()==="pre"&&!S.hasAttribute("tabindex")&&S.setAttribute("tabindex","0"),!E.code){s.hooks.run("complete",E),_&&_.call(E.element);return}if(s.hooks.run("before-highlight",E),!E.grammar){P(s.util.encode(E.code));return}if(v&&r.Worker){var C=new Worker(s.filename);C.onmessage=function(I){P(I.data)},C.postMessage(JSON.stringify({language:E.language,code:E.code,immediateClose:!0}))}else P(s.highlight(E.code,E.grammar,E.language))},highlight:function(m,v,_){var T={code:m,grammar:v,language:_};if(s.hooks.run("before-tokenize",T),!T.grammar)throw new Error('The language "'+T.language+'" has no grammar.');return T.tokens=s.tokenize(T.code,T.grammar),s.hooks.run("after-tokenize",T),c.stringify(s.util.encode(T.tokens),T.language)},tokenize:function(m,v){var _=v.rest;if(_){for(var T in _)v[T]=_[T];delete v.rest}var w=new f;return h(w,w.head,m),u(m,w,v,w.head,0),d(w)},hooks:{all:{},add:function(m,v){var _=s.hooks.all;_[m]=_[m]||[],_[m].push(v)},run:function(m,v){var _=s.hooks.all[m];if(!(!_||!_.length))for(var T=0,w;w=_[T++];)w(v)}},Token:c};r.Prism=s;function c(m,v,_,T){this.type=m,this.content=v,this.alias=_,this.length=(T||"").length|0}c.stringify=function m(v,_){if(typeof v=="string")return v;if(Array.isArray(v)){var T="";return v.forEach(function(P){T+=m(P,_)}),T}var w={type:v.type,content:m(v.content,_),tag:"span",classes:["token",v.type],attributes:{},language:_},S=v.alias;S&&(Array.isArray(S)?Array.prototype.push.apply(w.classes,S):w.classes.push(S)),s.hooks.run("wrap",w);var k="";for(var E in w.attributes)k+=" "+E+'="'+(w.attributes[E]||"").replace(/"/g,"&quot;")+'"';return"<"+w.tag+' class="'+w.classes.join(" ")+'"'+k+">"+w.content+"</"+w.tag+">"};function l(m,v,_,T){m.lastIndex=v;var w=m.exec(_);if(w&&T&&w[1]){var S=w[1].length;w.index+=S,w[0]=w[0].slice(S)}return w}function u(m,v,_,T,w,S){for(var k in _)if(!(!_.hasOwnProperty(k)||!_[k])){var E=_[k];E=Array.isArray(E)?E:[E];for(var P=0;P<E.length;++P){if(S&&S.cause==k+","+P)return;var C=E[P],I=C.inside,O=!!C.lookbehind,M=!!C.greedy,R=C.alias;if(M&&!C.pattern.global){var z=C.pattern.toString().match(/[imsuy]*$/)[0];C.pattern=RegExp(C.pattern.source,z+"g")}for(var U=C.pattern||C,j=T.next,H=w;j!==v.tail&&!(S&&H>=S.reach);H+=j.value.length,j=j.next){var W=j.value;if(v.length>m.length)return;if(!(W instanceof c)){var re=1,Y;if(M){if(Y=l(U,H,m,O),!Y||Y.index>=m.length)break;var G=Y.index,F=Y.index+Y[0].length,L=H;for(L+=j.value.length;G>=L;)j=j.next,L+=j.value.length;if(L-=j.value.length,H=L,j.value instanceof c)continue;for(var K=j;K!==v.tail&&(L<F||typeof K.value=="string");K=K.next)re++,L+=K.value.length;re--,W=m.slice(H,L),Y.index-=H}else if(Y=l(U,0,W,O),!Y)continue;var G=Y.index,te=Y[0],de=W.slice(0,G),ce=W.slice(G+te.length),le=H+W.length;S&&le>S.reach&&(S.reach=le);var me=j.prev;de&&(me=h(v,me,de),H+=de.length),p(v,me,re);var ye=new c(k,I?s.tokenize(te,I):te,R,te);if(j=h(v,me,ye),ce&&h(v,j,ce),re>1){var Oe={cause:k+","+P,reach:le};u(m,v,_,j.prev,H,Oe),S&&Oe.reach>S.reach&&(S.reach=Oe.reach)}}}}}}function f(){var m={value:null,prev:null,next:null},v={value:null,prev:m,next:null};m.next=v,this.head=m,this.tail=v,this.length=0}function h(m,v,_){var T=v.next,w={value:_,prev:v,next:T};return v.next=w,T.prev=w,m.length++,w}function p(m,v,_){for(var T=v.next,w=0;w<_&&T!==m.tail;w++)T=T.next;v.next=T,T.prev=v,m.length-=w}function d(m){for(var v=[],_=m.head.next;_!==m.tail;)v.push(_.value),_=_.next;return v}if(!r.document)return r.addEventListener&&(s.disableWorkerMessageHandler||r.addEventListener("message",function(m){var v=JSON.parse(m.data),_=v.language,T=v.code,w=v.immediateClose;r.postMessage(s.highlight(T,s.languages[_],_)),w&&r.close()},!1)),s;var g=s.util.currentScript();g&&(s.filename=g.src,g.hasAttribute("data-manual")&&(s.manual=!0));function y(){s.manual||s.highlightAll()}if(!s.manual){var b=document.readyState;b==="loading"||b==="interactive"&&g&&g.defer?document.addEventListener("DOMContentLoaded",y):window.requestAnimationFrame?window.requestAnimationFrame(y):window.setTimeout(y,16)}return s}(t);e.exports&&(e.exports=n),typeof globalThis<"u"&&(globalThis.Prism=n)}(jk)),jk.exports}var Fz=qke(),Jr={},qz;function Uke(){if(qz)return Jr;qz=1;var e=Jr&&Jr.__extends||function(){var P=function(C,I){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(O,M){O.__proto__=M}||function(O,M){for(var R in M)Object.prototype.hasOwnProperty.call(M,R)&&(O[R]=M[R])},P(C,I)};return function(C,I){if(typeof I!="function"&&I!==null)throw new TypeError("Class extends value "+String(I)+" is not a constructor or null");P(C,I);function O(){this.constructor=C}C.prototype=I===null?Object.create(I):(O.prototype=I.prototype,new O)}}(),t=Jr&&Jr.__assign||function(){return t=Object.assign||function(P){for(var C,I=1,O=arguments.length;I<O;I++){C=arguments[I];for(var M in C)Object.prototype.hasOwnProperty.call(C,M)&&(P[M]=C[M])}return P},t.apply(this,arguments)},n=Jr&&Jr.__createBinding||(Object.create?function(P,C,I,O){O===void 0&&(O=I);var M=Object.getOwnPropertyDescriptor(C,I);(!M||("get"in M?!C.__esModule:M.writable||M.configurable))&&(M={enumerable:!0,get:function(){return C[I]}}),Object.defineProperty(P,O,M)}:function(P,C,I,O){O===void 0&&(O=I),P[O]=C[I]}),r=Jr&&Jr.__setModuleDefault||(Object.create?function(P,C){Object.defineProperty(P,"default",{enumerable:!0,value:C})}:function(P,C){P.default=C}),i=Jr&&Jr.__importStar||function(P){if(P&&P.__esModule)return P;var C={};if(P!=null)for(var I in P)I!=="default"&&Object.prototype.hasOwnProperty.call(P,I)&&n(C,P,I);return r(C,P),C},o=Jr&&Jr.__rest||function(P,C){var I={};for(var O in P)Object.prototype.hasOwnProperty.call(P,O)&&C.indexOf(O)<0&&(I[O]=P[O]);if(P!=null&&typeof Object.getOwnPropertySymbols=="function")for(var M=0,O=Object.getOwnPropertySymbols(P);M<O.length;M++)C.indexOf(O[M])<0&&Object.prototype.propertyIsEnumerable.call(P,O[M])&&(I[O[M]]=P[O[M]]);return I};Object.defineProperty(Jr,"__esModule",{value:!0});var a=i(x),s=13,c=9,l=8,u=89,f=90,h=77,p=57,d=219,g=222,y=192,b=27,m=100,v=3e3,_=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),T=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),w="npm__react-simple-code-editor__textarea",S=`
301
301
  /**
302
302
  * Reset the text fill color so that placeholder is visible
303
303
  */