From ff67d4bb0e15339697e97c918df1f1cc4385dce6 Mon Sep 17 00:00:00 2001 From: Muriithi Frederick Muriuki Date: Fri, 31 May 2019 16:26:07 +0300 Subject: Migrate to newer HTMLGen * Migrate to HTMLGen that supports both Python2 and Python3. --- .../marker_regression/display_mapping_results.py | 111 ++++++++++++++------- 1 file changed, 75 insertions(+), 36 deletions(-) diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 993fc2d9..6a3eeccc 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -34,7 +34,8 @@ import httplib from flask import Flask, g -from htmlgen import HTMLgen2 as HT +from htmlgen import (Element,Paragraph,LineBreak,Image,Link,Form, + Input) from base import webqtlConfig from base.GeneralObject import GeneralObject @@ -48,6 +49,41 @@ from base.webqtlConfig import TMPDIR, GENERATED_TEXT_DIR, GENERATED_IMAGE_DIR import utility.logger logger = utility.logger.getLogger(__name__ ) +def set_attributes(element, attributes): + for attr_name, attr_value in attributes.items(): + if attr_value is not None: + if attr_value.endswith("_"): + element.set_attribute(attr_name[:-1], attr_value) + else: + element.set_attribute(attr_name, attr_value) + + return element + +def make_map(**kwargs): + return set_attributes(Element("map"), kwargs) + +def make_map_area(**kwargs): + return set_attributes(Element("area"), kwargs) + +def make_image(url, alt=None, width=None, height=None, border=None): + img = Image(url=url, alternate_text=alt) + if width: + img.width = width + + if height: + img.height = height + + if border: + img.border = border + + return img + +def make_input(type_, name, value, class_=None, onClick=None): + return set_attributes(Input(type_=type_), kwargs) + +def make_link(url, content=(), **kwargs): + return set_attributes(Link(url, *content), kwargs) + ######################################### # Inteval Mapping Plot Page ######################################### @@ -79,7 +115,7 @@ class DisplayMappingResults(object): DRAW_DETAIL_MB = 4 DRAW_UTR_LABELS_MB = 4 - qmarkImg = HT.Image('/images/qmarkBoxBlue.gif', width=10, height=13, border=0, alt='Glossary') + qmarkImg = make_image('/images/qmarkBoxBlue.gif', width=10, height=13, border=0, alt='Glossary') # Note that "qmark.gif" is a similar, smaller, rounded-edges question mark. It doesn't look # like the ones on the image, though, which is why we don't use it here. @@ -445,7 +481,7 @@ class DisplayMappingResults(object): self.filename= webqtlUtil.genRandStr("Itvl_") intCanvas.save(os.path.join(webqtlConfig.GENERATED_IMAGE_DIR, self.filename), format='png') - intImg=HT.Image('/image/'+self.filename+'.png', border=0, usemap='#WebQTLImageMap') + intImg=make_image('/image/'+self.filename+'.png', border=0, usemap='#WebQTLImageMap') #Scales plot differently for high resolution if self.draw2X: @@ -458,11 +494,13 @@ class DisplayMappingResults(object): ################################################################ #this form is used for opening Locus page or trait page, only available for genetic mapping if showLocusForm: - showLocusForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', - name=showLocusForm, submit=HT.Input(type='hidden')) + showLocusForm = Form(url= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE)) + showLocusForm.multipart = True # enctype='multipart/form-data' + showLocusForm.set_attribute("name", showLocusForm) + showLocusForm.append(make_input(type='hidden', name="submit")) hddn = {'FormID':'showDatabase', 'ProbeSetID':'_','database':fd.RISet+"Geno",'CellID':'_', 'RISet':fd.RISet, 'incparentsf1':'ON'} for key in hddn.keys(): - showLocusForm.append(HT.Input(name=key, value=hddn[key], type='hidden')) + showLocusForm.append(make_input(name=key, value=hddn[key], type='hidden')) showLocusForm.append(intImg) else: showLocusForm = intImg @@ -473,10 +511,11 @@ class DisplayMappingResults(object): ################################################################ # footnote goes here ################################################################ - btminfo = HT.Paragraph(Id="smallsize") #Small('More information about this graph is available here.') + btminfo = Paragraph() + btminfo.set_attribute("id", "smallsize") #Small('More information about this graph is available here.') if self.traitList and self.traitList[0].dataset and self.traitList[0].dataset.type == 'Geno': - btminfo.append(HT.BR(), 'Mapping using genotype data as a trait will result in infinity LRS at one locus. In order to display the result properly, all LRSs higher than 100 are capped at 100.') + btminfo.append(LineBreak(), 'Mapping using genotype data as a trait will result in infinity LRS at one locus. In order to display the result properly, all LRSs higher than 100 are capped at 100.') def plotIntMapping(self, canvas, offset= (80, 120, 20, 100), zoom = 1, startMb = None, endMb = None, showLocusForm = ""): #calculating margins @@ -529,7 +568,7 @@ class DisplayMappingResults(object): drawAreaHeight -= 60 #Image map - gifmap = HT.Map(name = "WebQTLImageMap") + gifmap = make_map(name = "WebQTLImageMap") newoffset = (xLeftOffset, xRightOffset, yTopOffset, yBottomOffset) # Draw the alternating-color background first and get plotXScale @@ -835,7 +874,7 @@ class DisplayMappingResults(object): if thisTrait.db: COORDS = "%d,%d,%d,%d" %(rectWidth+2+rightShift,yPaddingTop+kstep*15,rectWidth+2+rightShift+nameWidth,yPaddingTop+10+kstep*15,) HREF= "javascript:showDatabase3('%s','%s','%s','');" % (showLocusForm, thisTrait.db.name, thisTrait.name) - Areas = HT.Area(shape='rect',coords=COORDS,href=HREF) + Areas = make_map_area(shape='rect',coords=COORDS,href=HREF) gifmap.areas.append(Areas) def drawLegendPanel(self, canvas, offset= (40, 120, 80, 10), zoom = 1): @@ -1152,7 +1191,7 @@ class DisplayMappingResults(object): COORDS = "%d, %d, %d, %d" %(geneStartPix, geneYLocation, geneEndPix, (geneYLocation + self.EACH_GENE_HEIGHT)) # NL: 06-02-2011 Rob required to display NCBI info in a new window - gifmap.areas.append(HT.Area(shape='rect',coords=COORDS,href=HREF, title=TITLE,target="_blank")) + gifmap.areas.append(make_map_area(shape='rect',coords=COORDS,href=HREF, title=TITLE,target="_blank")) ## BEGIN HaplotypeAnalyst def drawHaplotypeBand(self, canvas, gifmap, plotXScale, offset= (40, 120, 80, 10), zoom = 1, startMb = None, endMb = None): @@ -1308,7 +1347,7 @@ class DisplayMappingResults(object): COORDS = "%d, %d, %d, %d" %(geneStartPix, geneYLocation+ind*self.EACH_GENE_HEIGHT, geneEndPix+1, (geneYLocation + ind*self.EACH_GENE_HEIGHT)) TITLE = "Strain: %s, marker (%s) \n Position %2.3f Mb." % (samplelist[k], _chr[j].name, float(txStart)) HREF = '' - gifmap.areas.append(HT.Area(shape='rect',coords=COORDS,href=HREF, title=TITLE)) + gifmap.areas.append(make_map_area(shape='rect',coords=COORDS,href=HREF, title=TITLE)) # if there are no more markers in a chromosome, the plotRight value calculated above will be before the plotWidth # resulting in some empty space on the right side of the plot area. This draws an "unknown" bar from plotRight to the edge. @@ -1405,7 +1444,7 @@ class DisplayMappingResults(object): WEBQTL_HREF = "javascript:rangeView('%s', %f, %f)" % (self.selectedChr - 1, max(0, (calBase-webqtlZoomWidth))/1000000.0, (calBase+webqtlZoomWidth)/1000000.0) WEBQTL_TITLE = "Click to view this section of the genome in WebQTL" - gifmap.areas.append(HT.Area(shape='rect',coords=WEBQTL_COORDS,href=WEBQTL_HREF, title=WEBQTL_TITLE)) + gifmap.areas.append(make_map_area(shape='rect',coords=WEBQTL_COORDS,href=WEBQTL_HREF, title=WEBQTL_TITLE)) canvas.drawRect(xBrowse1, paddingTop, xBrowse2, (paddingTop + self.BAND_HEIGHT), edgeColor=self.CLICKABLE_WEBQTL_REGION_COLOR, fillColor=self.CLICKABLE_WEBQTL_REGION_COLOR) canvas.drawLine(xBrowse1, paddingTop, xBrowse1, (paddingTop + self.BAND_HEIGHT), color=self.CLICKABLE_WEBQTL_REGION_OUTLINE_COLOR) @@ -1416,7 +1455,7 @@ class DisplayMappingResults(object): else: PHENOGEN_HREF = "https://phenogen.ucdenver.edu/PhenoGen/gene.jsp?speciesCB=Mm&auto=Y&geneTxt=chr%s:%d-%d&genomeVer=mm10" % (self.selectedChr, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases) PHENOGEN_TITLE = "Click to view this section of the genome in PhenoGen" - gifmap.areas.append(HT.Area(shape='rect',coords=PHENOGEN_COORDS,href=PHENOGEN_HREF, title=PHENOGEN_TITLE)) + gifmap.areas.append(make_map_area(shape='rect',coords=PHENOGEN_COORDS,href=PHENOGEN_HREF, title=PHENOGEN_TITLE)) canvas.drawRect(xBrowse1, phenogenPaddingTop, xBrowse2, (phenogenPaddingTop+self.BAND_HEIGHT), edgeColor=self.CLICKABLE_PHENOGEN_REGION_COLOR, fillColor=self.CLICKABLE_PHENOGEN_REGION_COLOR) canvas.drawLine(xBrowse1, phenogenPaddingTop, xBrowse1, (phenogenPaddingTop+self.BAND_HEIGHT), color=self.CLICKABLE_PHENOGEN_REGION_OUTLINE_COLOR) @@ -1426,7 +1465,7 @@ class DisplayMappingResults(object): else: UCSC_HREF = "http://genome.ucsc.edu/cgi-bin/hgTracks?db=%s&position=chr%s:%d-%d" % (self._ucscDb, self.selectedChr, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases) UCSC_TITLE = "Click to view this section of the genome in the UCSC Genome Browser" - gifmap.areas.append(HT.Area(shape='rect',coords=UCSC_COORDS,href=UCSC_HREF, title=UCSC_TITLE)) + gifmap.areas.append(make_map_area(shape='rect',coords=UCSC_COORDS,href=UCSC_HREF, title=UCSC_TITLE)) canvas.drawRect(xBrowse1, ucscPaddingTop, xBrowse2, (ucscPaddingTop+self.BAND_HEIGHT), edgeColor=self.CLICKABLE_UCSC_REGION_COLOR, fillColor=self.CLICKABLE_UCSC_REGION_COLOR) canvas.drawLine(xBrowse1, ucscPaddingTop, xBrowse1, (ucscPaddingTop+self.BAND_HEIGHT), color=self.CLICKABLE_UCSC_REGION_OUTLINE_COLOR) @@ -1436,7 +1475,7 @@ class DisplayMappingResults(object): else: ENSEMBL_HREF = "http://www.ensembl.org/Rattus_norvegicus/contigview?chr=%s&start=%d&end=%d" % (self.selectedChr, max(0, calBase-flankingWidthInBases), calBase+flankingWidthInBases) ENSEMBL_TITLE = "Click to view this section of the genome in the Ensembl Genome Browser" - gifmap.areas.append(HT.Area(shape='rect',coords=ENSEMBL_COORDS,href=ENSEMBL_HREF, title=ENSEMBL_TITLE)) + gifmap.areas.append(make_map_area(shape='rect',coords=ENSEMBL_COORDS,href=ENSEMBL_HREF, title=ENSEMBL_TITLE)) canvas.drawRect(xBrowse1, ensemblPaddingTop, xBrowse2, (ensemblPaddingTop+self.BAND_HEIGHT), edgeColor=self.CLICKABLE_ENSEMBL_REGION_COLOR, fillColor=self.CLICKABLE_ENSEMBL_REGION_COLOR) canvas.drawLine(xBrowse1, ensemblPaddingTop, xBrowse1, (ensemblPaddingTop+self.BAND_HEIGHT), color=self.CLICKABLE_ENSEMBL_REGION_OUTLINE_COLOR) # end for @@ -1618,7 +1657,7 @@ class DisplayMappingResults(object): xLeftOffset+offsetA,yZero+40+Zorder*(LRectWidth+3)+LRectWidth) HREF="/show_trait?trait_id=%s&dataset=%s" % (Lname, self.dataset.group.name+"Geno") #HREF="javascript:showDatabase3('%s','%s','%s','');" % (showLocusForm,fd.RISet+"Geno", Lname) - Areas=HT.Area(shape='rect', coords=COORDS, href=HREF, target="_blank", title="Locus : " + Lname) + Areas=make_map_area(shape='rect', coords=COORDS, href=HREF, target="_blank", title="Locus : " + Lname) gifmap.areas.append(Areas) ##piddle bug if j == 0: @@ -1745,8 +1784,8 @@ class DisplayMappingResults(object): else: sugg_title = "Suggestive LOD = %0.2f" % (self.suggestive/4.61) sig_title = "Significant LOD = %0.2f" % (self.significant/4.61) - Areas1 = HT.Area(shape='rect',coords=sugg_coords,title=sugg_title) - Areas2 = HT.Area(shape='rect',coords=sig_coords,title=sig_title) + Areas1 = make_map_area(shape='rect',coords=sugg_coords,title=sugg_title) + Areas2 = make_map_area(shape='rect',coords=sig_coords,title=sig_title) gifmap.areas.append(Areas1) gifmap.areas.append(Areas2) @@ -2033,7 +2072,7 @@ class DisplayMappingResults(object): #add by NL 09-03-2010 HREF = "javascript:chrView(%d,%s);" % (i,self.ChrLengthMbList) #HREF = "javascript:changeView(%d,%s);" % (i,self.ChrLengthMbList) - Areas = HT.Area(shape='rect',coords=COORDS,href=HREF) + Areas = make_map_area(shape='rect',coords=COORDS,href=HREF) gifmap.areas.append(Areas) startPosX += (self.ChrLengthDistList[i]+self.GraphInterval)*plotXScale @@ -2118,7 +2157,7 @@ class DisplayMappingResults(object): tableIterationsCnt = tableIterationsCnt + 1 this_row = [] #container for the cells of each row - selectCheck = HT.Input(type="checkbox", name="searchResult", value=theGO["GeneSymbol"], Class="checkbox trait_checkbox") #checkbox for each row + selectCheck = make_input(type="checkbox", name="searchResult", value=theGO["GeneSymbol"], class_="checkbox trait_checkbox") #checkbox for each row geneLength = (theGO["TxEnd"] - theGO["TxStart"])*1000.0 tenPercentLength = geneLength*0.0001 @@ -2129,9 +2168,9 @@ class DisplayMappingResults(object): geneIdString = 'http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids=%s' % theGO["GeneID"] if theGO["snpCount"]: - snpString = HT.Href(url="http://genenetwork.org/webqtl/main.py?FormID=snpBrowser&chr=%s&start=%s&end=%s&geneName=%s&s1=%d&s2=%d" % (theGO["Chromosome"], + snpString = make_link(url="http://genenetwork.org/webqtl/main.py?FormID=snpBrowser&chr=%s&start=%s&end=%s&geneName=%s&s1=%d&s2=%d" % (theGO["Chromosome"], theGO["TxStart"], theGO["TxEnd"], theGO["GeneSymbol"], self.diffCol[0], self.diffCol[1]), - text=theGO["snpCount"], target="_blank", Class="normalsize") + content=(theGO["snpCount"],), target="_blank", class_="normalsize") else: snpString = 0 @@ -2176,27 +2215,27 @@ class DisplayMappingResults(object): this_row = [selectCheck.__str__(), str(tableIterationsCnt), - HT.Href(geneIdString, theGO["GeneSymbol"], target="_blank").__str__(), - HT.Href(mouseStartString, "%0.6f" % txStart, target="_blank").__str__(), - HT.Href("javascript:rangeView('%s', %f, %f)" % (str(chr_as_int), txStart-tenPercentLength, txEnd+tenPercentLength), "%0.3f" % geneLength).__str__(), + make_link(geneIdString, content=(theGO["GeneSymbol"],), target="_blank").__str__(), + make_link(mouseStartString, content=("%0.6f" % txStart,), target="_blank").__str__(), + make_link("javascript:rangeView('%s', %f, %f)" % (str(chr_as_int), txStart-tenPercentLength, txEnd+tenPercentLength), content=("%0.3f" % geneLength,)).__str__(), snpString, snpDensityStr, avgExpr, humanChr, - HT.Href(humanStartString, humanStartDisplay, target="_blank").__str__(), + make_link(humanStartString, content=(humanStartDisplay,), target="_blank").__str__(), literatureCorrelationString, geneDescription] else: this_row = [selectCheck.__str__(), str(tableIterationsCnt), - HT.Href(geneIdString, theGO["GeneSymbol"], target="_blank").__str__(), - HT.Href(mouseStartString, "%0.6f" % txStart, target="_blank").__str__(), - HT.Href("javascript:rangeView('%s', %f, %f)" % (str(chr_as_int), txStart-tenPercentLength, txEnd+tenPercentLength), "%0.3f" % geneLength).__str__(), + make_link(geneIdString, content=(theGO["GeneSymbol"],), target="_blank").__str__(), + make_link(mouseStartString, content=("%0.6f" % txStart,), target="_blank").__str__(), + make_link("javascript:rangeView('%s', %f, %f)" % (str(chr_as_int), txStart-tenPercentLength, txEnd+tenPercentLength), content=("%0.3f" % geneLength,)).__str__(), snpString, snpDensityStr, avgExpr, humanChr, - HT.Href(humanStartString, humanStartDisplay, target="_blank").__str__(), + make_link(humanStartString, content=(humanStartDisplay,), target="_blank").__str__(), geneDescription] gene_table_body.append(this_row) @@ -2204,12 +2243,12 @@ class DisplayMappingResults(object): elif self.dataset.group.species == 'rat': for gIndex, theGO in enumerate(geneCol): this_row = [] #container for the cells of each row - selectCheck = HT.Input(type="checkbox", name="searchResult", Class="checkbox", onClick="highlight(this)").__str__() #checkbox for each row + selectCheck = make_input(type_="checkbox", name="searchResult", class_="checkbox", onClick="highlight(this)").__str__() #checkbox for each row - webqtlSearch = HT.Href(os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE)+"?cmd=sch&gene=%s&alias=1&species=rat" % theGO["GeneSymbol"], ">>", target="_blank").__str__() + webqtlSearch = make_link(os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE)+"?cmd=sch&gene=%s&alias=1&species=rat" % theGO["GeneSymbol"], content=(">>",), target="_blank").__str__() if theGO["GeneID"] != "": - geneSymbolNCBI = HT.Href("http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids=%s" % theGO["GeneID"], theGO["GeneSymbol"], Class="normalsize", target="_blank").__str__() + geneSymbolNCBI = make_link("http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids=%s" % theGO["GeneID"], content=(theGO["GeneSymbol"],), class_="normalsize", target="_blank").__str__() else: geneSymbolNCBI = theGO["GeneSymbol"] @@ -2249,7 +2288,7 @@ class DisplayMappingResults(object): str(gIndex+1), webqtlSearch.__str__() + geneSymbolNCBI, theGO["TxStart"], - HT.Href(geneLengthURL, "%0.3f" % (geneLength*1000.0)).__str__(), + make_link(geneLengthURL, content=("%0.3f" % (geneLength*1000.0),)).__str__(), avgExprVal, mouseChr, mouseTxStart, @@ -2278,4 +2317,4 @@ class DisplayMappingResults(object): lCorr = lCorr[0] break except: raise #lCorr = None - return lCorr \ No newline at end of file + return lCorr -- cgit v1.2.3 From f271a933abf5e20cc137f2ac730012ac10eb6172 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 28 Jun 2019 15:59:15 -0500 Subject: Added regression lines to correlation scatterplots Fixed bug when doing correlations of non-phenotype traits against phenotype datasets Changed color of manhattan plot points (subject to change) --- wqflask/wqflask/correlation/corr_scatter_plot.py | 56 ++++++++++++++ wqflask/wqflask/correlation/show_corr_results.py | 5 +- .../marker_regression/display_mapping_results.py | 4 +- .../static/new/javascript/draw_corr_scatterplot.js | 85 ++++++++++++++++++---- 4 files changed, 133 insertions(+), 17 deletions(-) diff --git a/wqflask/wqflask/correlation/corr_scatter_plot.py b/wqflask/wqflask/correlation/corr_scatter_plot.py index 925e8783..4090b70e 100644 --- a/wqflask/wqflask/correlation/corr_scatter_plot.py +++ b/wqflask/wqflask/correlation/corr_scatter_plot.py @@ -1,5 +1,7 @@ from __future__ import absolute_import, print_function, division +import math + from flask import g from base.trait import GeneralTrait @@ -39,6 +41,14 @@ class CorrScatterPlot(object): y = np.array(vals_2) slope, intercept, r_value, p_value, std_err = stats.linregress(x, y) + x_buffer = (max(vals_1) - min(vals_1))*0.1 + y_buffer = (max(vals_2) - min(vals_2))*0.1 + + x_range = [min(vals_1) - x_buffer, max(vals_1) + x_buffer] + y_range = [min(vals_2) - y_buffer, max(vals_2) + y_buffer] + + intercept_coords = get_intercept_coords(slope, intercept, x_range, y_range) + rx = stats.rankdata(x) ry = stats.rankdata(y) self.rdata = [] @@ -46,6 +56,13 @@ class CorrScatterPlot(object): self.rdata.append(ry.tolist()) srslope, srintercept, srr_value, srp_value, srstd_err = stats.linregress(rx, ry) + x_buffer = (max(rx) - min(rx))*0.1 + y_buffer = (max(ry) - min(ry))*0.1 + + sr_range = [min(rx) - x_buffer, max(rx) + x_buffer] + + sr_intercept_coords = get_intercept_coords(srslope, srintercept, sr_range, sr_range) + #vals_3 = [] #for sample in self.trait_3.data: # vals_3.append(self.trait_3.data[sample].value) @@ -68,6 +85,11 @@ class CorrScatterPlot(object): num_overlap = num_overlap, vals_1 = vals_1, vals_2 = vals_2, + x_range = x_range, + y_range = y_range, + sr_range = sr_range, + intercept_coords = intercept_coords, + sr_intercept_coords = sr_intercept_coords, slope = slope, intercept = intercept, @@ -83,3 +105,37 @@ class CorrScatterPlot(object): #vals_3 = vals_3 ) self.jsdata = self.js_data + + +def get_intercept_coords(slope, intercept, x_range, y_range): + intercept_coords = [] + + y1 = slope*x_range[0] + intercept + if slope > 0: + if (y1 < y_range[0]): + x1 = (y_range[0] - intercept)/slope + else: + x1 = x_range[0] + intercept_coords.append([x1, y1]) + + x2 = (y_range[1] - intercept)/slope + if (x2 > x_range[1]): + y2 = slope*x_range[1] + intercept + else: + y2 = y_range[1] + else: + if (y1 > y_range[1]): + x1 = (y_range[0] - intercept)/slope + else: + x1 = x_range[0] + intercept_coords.append([x1, y1]) + + x2 = (y_range[0] - intercept)/slope + if (x2 > x_range[1]): + y2 = slope*x_range[1] + intercept + else: + y2 = y_range[0] + + intercept_coords.append([x2, y2]) + + return intercept_coords \ No newline at end of file diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 6e9abcd6..75cf5f7f 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -179,8 +179,9 @@ class CorrelationResults(object): #ZS: Convert min/max chromosome to an int for the location range option range_chr_as_int = None for order_id, chr_info in self.dataset.species.chromosomes.chromosomes.iteritems(): - if chr_info.name == self.location_chr: - range_chr_as_int = order_id + if 'loc_chr' in start_vars: + if chr_info.name == self.location_chr: + range_chr_as_int = order_id for _trait_counter, trait in enumerate(self.correlation_data.keys()[:self.return_number]): trait_object = GeneralTrait(dataset=self.target_dataset, name=trait, get_qtl_info=True, get_sample_info=False) diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 91fdae8f..3bcd613f 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -1865,9 +1865,9 @@ class DisplayMappingResults(object): if self.manhattan_plot == True: if self.selectedChr == -1 and (previous_chr_as_int % 2 == 1): - point_color = pid.grey + point_color = pid.red else: - point_color = pid.black + point_color = pid.blue final_x_pos = Xc-canvas.stringWidth("5",font=symbolFont)/2+1 if final_x_pos > (xLeftOffset + plotWidth): diff --git a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js index a74c99d3..a29e751e 100644 --- a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js +++ b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js @@ -11,6 +11,7 @@ var layout = { b: 50 }, xaxis: { + range: [js_data.x_range[0], js_data.x_range[1]], title: js_data.trait_1, zeroline: false, visible: true, @@ -18,6 +19,7 @@ var layout = { linewidth: 1, }, yaxis: { + range: [js_data.y_range[0], js_data.y_range[1]], title: js_data.trait_2, zeroline: false, visible: true, @@ -27,6 +29,34 @@ var layout = { hovermode: "closest" } +var sr_layout = { + height: 700, + width: 800, + margin: { + l: 60, + r: 30, + t: 80, + b: 50 + }, + xaxis: { + range: [js_data.sr_range[0], js_data.sr_range[1]], + title: js_data.trait_1, + zeroline: false, + visible: true, + linecolor: 'black', + linewidth: 1, + }, + yaxis: { + range: [js_data.sr_range[0], js_data.sr_range[1]], + title: js_data.trait_2, + zeroline: false, + visible: true, + linecolor: 'black', + linewidth: 1, + }, + hovermode: "closest" +} + cofactor1_dict = {} ranked_cofactor1_dict = {} //cofactor1_values = [] @@ -48,14 +78,23 @@ function drawg() { sample_names.push(js_data.indIDs[j]) } - var trace = { + var trace1 = { x: x_values, y: y_values, mode: 'markers', text: sample_names } - Plotly.newPlot('scatterplot2', [trace], layout) + var trace2 = { + x: [js_data.intercept_coords[0][0], js_data.intercept_coords[1][0]], + y: [js_data.intercept_coords[0][1], js_data.intercept_coords[1][1]], + mode: 'lines', + line: { + color: 'rgb(250, 60, 73)' + } + } + + Plotly.newPlot('scatterplot2', [trace2, trace1], layout) } @@ -69,14 +108,14 @@ function srdrawg() { sample_names.push(js_data.indIDs[j]) } - var trace = { + var trace1 = { x: x_values, y: y_values, mode: 'markers', text: sample_names } - Plotly.newPlot('srscatterplot2', [trace], layout) + Plotly.newPlot('srscatterplot2', [trace1], sr_layout) } function getdata() { @@ -256,32 +295,41 @@ function getdata() { point_text.push(this_text) } - console.log("symbol list:", symbol_list) - if (symbol_list.length > 0) { - var trace = { + var trace1 = { x: x_values, y: y_values, mode: 'markers', text: point_text, marker: { + color: 'rgb(66, 66, 245)', symbol: symbol_list, size: sizes } } } else { - var trace = { + var trace1 = { x: x_values, y: y_values, mode: 'markers', text: point_text, marker: { + color: 'rgb(66, 66, 245)', size: sizes } } } - return [trace]; + var trace2 = { + x: [js_data.intercept_coords[0][0], js_data.intercept_coords[1][0]], + y: [js_data.intercept_coords[0][1], js_data.intercept_coords[1][1]], + mode: 'lines', + line: { + color: 'rgb(250, 60, 73)' + } + } + + return [trace2, trace1]; } function map1to2 (min1, max1, min2, max2, v1) { @@ -465,18 +513,28 @@ function srgetdata() { point_text.push(this_text) } - var trace = { + var trace1 = { x: x_values, y: y_values, mode: 'markers', text: point_text, marker: { + color: 'rgb(66, 66, 245)', symbol: symbol_list, size: sizes } } - return [trace]; + var trace2 = { + x: [js_data.sr_intercept_coords[0][0], js_data.sr_intercept_coords[1][0]], + y: [js_data.sr_intercept_coords[0][1], js_data.sr_intercept_coords[1][1]], + mode: 'lines', + line: { + color: 'rgb(250, 60, 73)' + } + } + + return [trace2, trace1]; } function chartupdatewh() { @@ -490,7 +548,8 @@ function chartupdatewh() { Plotly.newPlot('scatterplot2', getdata(), layout) Plotly.relayout('scatterplot2', width_height_update) - Plotly.newPlot('srscatterplot2', srgetdata(), layout) + + Plotly.newPlot('srscatterplot2', srgetdata(), sr_layout) Plotly.relayout('srscatterplot2', width_height_update) } @@ -567,7 +626,7 @@ function chartupdatedata() { Plotly.newPlot('scatterplot2', getdata(), layout) Plotly.relayout('scatterplot2', pearson_title_update) - Plotly.newPlot('srscatterplot2', srgetdata(), layout) + Plotly.newPlot('srscatterplot2', srgetdata(), sr_layout) Plotly.relayout('srscatterplot2', spearman_title_update) if ($('#cofactor1_type option:selected').val() == "color"){ -- cgit v1.2.3 From 13d36103288668d50eb73ce7a0b438a7880c33a4 Mon Sep 17 00:00:00 2001 From: zsloan Date: Sun, 30 Jun 2019 17:12:18 -0500 Subject: Made external links on trait page open new tab/window --- wqflask/wqflask/templates/show_trait_details.html | 42 +++++++++++------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html index 43efa314..e6c68591 100644 --- a/wqflask/wqflask/templates/show_trait_details.html +++ b/wqflask/wqflask/templates/show_trait_details.html @@ -18,7 +18,7 @@ Journal - {{ this_trait.journal }} ({{ this_trait.year }}) + {{ this_trait.journal }} ({{ this_trait.year }}) {% else %} @@ -47,7 +47,7 @@ Database - + {{ dataset.fullname }} @@ -56,7 +56,7 @@ Target Score - + BLAT Specificity : {{ "%0.3f" | format(this_trait.probe_set_specificity|float) }} @@ -72,106 +72,106 @@ Resource Links {% if pubmed_link %} - + PubMed {% endif %} {% if ncbi_gene_link %} - + Gene    {% endif %} {% if omim_link %} - + OMIM    {% endif %} {% if genemania_link %} - + GeneMANIA    {% endif %} {% if unigene_link %} - + UniGene    {% endif %} {% if genbank_link %} - + GenBank    {% endif %} {% if homologene_link %} - + HomoloGene    {% endif %} {% if this_trait.symbol %} - + Genotation    - + GTEx Portal    {% if genebridge_link %} - + GeneBridge {% endif %} {% endif %}
{% if ucsc_blat_link %} - + UCSC    {% endif %} {% if biogps_link %} - + BioGPS    {% endif %} {% if string_link %} - + STRING    {% endif %} {% if panther_link %} - + PANTHER    {% endif %} {% if gemma_link %} - + Gemma    {% endif %} {% if aba_link %} - + ABA    {% endif %} {% if ebi_gwas_link %} - + EBI GWAS    {% endif %} {% if wiki_pi_link %} - + Wiki-Pi    -- cgit v1.2.3 From 94e8faa9866ef21165b5686f33905c2815b4b933 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 1 Jul 2019 12:33:07 -0500 Subject: a --- wqflask/wqflask/correlation/show_corr_results.py | 2 ++ wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 75cf5f7f..b7b349d5 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -117,6 +117,8 @@ class CorrelationResults(object): self.location_chr = get_string(start_vars,'loc_chr') self.min_location_mb = get_int(start_vars,'min_loc_mb') self.max_location_mb = get_int(start_vars,'max_loc_mb') + else: + self.location_chr = self.min_location_mb = self.max_location_mb = None self.get_formatted_corr_type() self.return_number = int(start_vars['corr_return_results']) diff --git a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js index a29e751e..4b212f8b 100644 --- a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js +++ b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js @@ -26,7 +26,8 @@ var layout = { linecolor: 'black', linewidth: 1, }, - hovermode: "closest" + hovermode: "closest", + showlegend: false } var sr_layout = { @@ -54,7 +55,8 @@ var sr_layout = { linecolor: 'black', linewidth: 1, }, - hovermode: "closest" + hovermode: "closest", + showlegend: false } cofactor1_dict = {} -- cgit v1.2.3 From c05650476b4e925c2bf6e7369ab8d321ce83ad48 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 3 Jul 2019 22:10:03 -0500 Subject: Fixed bug for creating one of the third party links on the trait page Changed text in several pages (submit trait, mapping error) Changed header menu structure some --- wqflask/base/webqtlConfig.py | 2 +- wqflask/wqflask/show_trait/show_trait.py | 7 ++++++- wqflask/wqflask/templates/base.html | 29 +++++++++++++------------- wqflask/wqflask/templates/gsearch_gene.html | 9 ++++---- wqflask/wqflask/templates/gsearch_pheno.html | 5 ++--- wqflask/wqflask/templates/index_page_orig.html | 1 - wqflask/wqflask/templates/mapping_error.html | 6 ++++++ wqflask/wqflask/templates/submit_trait.html | 19 ++++++++--------- 8 files changed, 42 insertions(+), 36 deletions(-) diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py index a08acb0a..b9e6abd8 100644 --- a/wqflask/base/webqtlConfig.py +++ b/wqflask/base/webqtlConfig.py @@ -53,7 +53,7 @@ ABA_URL = "http://mouse.brain-map.org/search/show?search_type=gene&search_term=% EBIGWAS_URL = "https://www.ebi.ac.uk/gwas/search?query=%s" WIKI_PI_URL = "http://severus.dbmi.pitt.edu/wiki-pi/index.php/search?q=%s" ENSEMBLETRANSCRIPT_URL="http://useast.ensembl.org/Mus_musculus/Transcript/Idhistory?t=%s" -DBSNP = 'http://www.ncbi.nlm.nih.gov/SNP/snp_ref.cgi?type=rs&rs=%s' +DBSNP = 'http://ensembl.org/Mus_musculus/Variation/Population?v=%s' # Temporary storage (note that this TMPDIR can be set as an # environment variable - use utility.tools.TEMPDIR when you diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 5178ece8..5c349bf3 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -291,7 +291,12 @@ class ShowTrait(object): FROM GeneList_rn33 WHERE geneSymbol = '{}'""".format(self.this_trait.symbol) - kgId, chr, transcript_start, transcript_end = g.db.execute(query).fetchall()[0] if len(g.db.execute(query).fetchall()) > 0 else None + results = g.db.execute(query).fetchone() + if results: + kgId, chr, transcript_start, transcript_end = results + else: + kgId = chr = transcript_start = transcript_end = None + if chr and transcript_start and transcript_end and kgId: transcript_start = int(transcript_start*1000000) # Convert to bases from megabases transcript_end = int(transcript_end*1000000) diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 3fd9faf5..b1977b7f 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -44,10 +44,19 @@ Intro
  • - Search + +
  • - Submit Trait + Submit Data
  • Collections @@ -61,18 +70,6 @@
  • SNP Browser
  • -
  • - - -
  • {% if g.user_session.logged_in %} Sign out @@ -80,11 +77,13 @@ Sign in {% endif %}
  • +
  • - Use GeneNetwork 1 + Use GN1
  • diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 70390830..9b584ea5 100644 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -9,7 +9,7 @@
    -

    GN searched 754 datasets and 39765944 traits across 10 species, and found {{ trait_count }} results that match your query. +

    GN searched 754 datasets and 39,765,944 traits across 10 species, and found {{ trait_count }} results that match your query. You can filter these results by adding key words in the fields below and you can also sort results on most columns.

    To study a record, click on its Record ID below.
    Check records below and click Add button to add to selection.

    @@ -21,14 +21,13 @@ -
    -
    -
    + - +

    +
    diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index 42bf1b64..609c1852 100644 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -21,14 +21,13 @@ -
    -
    - +
    +
    diff --git a/wqflask/wqflask/templates/index_page_orig.html b/wqflask/wqflask/templates/index_page_orig.html index 30e3f2f6..251a816f 100755 --- a/wqflask/wqflask/templates/index_page_orig.html +++ b/wqflask/wqflask/templates/index_page_orig.html @@ -181,7 +181,6 @@

    Affiliates

    diff --git a/wqflask/wqflask/templates/mapping_error.html b/wqflask/wqflask/templates/mapping_error.html index b73a2c31..884d4df8 100644 --- a/wqflask/wqflask/templates/mapping_error.html +++ b/wqflask/wqflask/templates/mapping_error.html @@ -5,7 +5,13 @@ {{ header("An error occurred during mapping") }}
    +

    There is likely an issue with the genotype file associated with this group/RISet. Please contact Zach Sloan (zachary.a.sloan@gmail.com) or Arthur Centeno (acenteno@gmail.com) about the data set in question.

    +

    +
    +

    +

    Try mapping using interval mapping instead; some genotype files with many columns of NAs have issues with GEMMA or R/qtl.

    +

    diff --git a/wqflask/wqflask/templates/submit_trait.html b/wqflask/wqflask/templates/submit_trait.html index c9f716bf..0dd38fe5 100644 --- a/wqflask/wqflask/templates/submit_trait.html +++ b/wqflask/wqflask/templates/submit_trait.html @@ -8,7 +8,7 @@ {{ flash_me() }}
    -
    +

    Introduction

    @@ -33,7 +33,7 @@

    Trait Submission Form


    -

    1. Choose cross or RI set:

    +

    1. Choose Species and Group:


    @@ -52,7 +52,6 @@
    -

    2. Enter Trait Data:

    @@ -66,9 +65,9 @@

    From a File: You can enter data by entering a file name here. The file should contain a series of numbers representing trait values. - The values can be on one line separated by spaces or tabs, or they can be on separate lines. Include one value for each progeny individual - or recombinant inbred line. Represent missing values with a non-numeric character such as "x". If you have chosen a recombinant inbred set, - when you submit your data will be displayed in a form where you can confirm and/or edit them. If you enter a file name here, any data that + The values can be on one line separated by spaces or tabs, or they can be on separate lines. Include one value for each progeny individual + or recombinant inbred line. Represent missing values with a non-numeric character such as "x". If you have chosen a recombinant inbred set, + when you submit your data will be displayed in a form where you can confirm and/or edit them. If you enter a file name here, any data that you paste into the next section will be ignored.

    @@ -77,10 +76,10 @@

    Paste or Type Multiple Values: You can enter data by pasting a series of numbers representing trait values into this area. - The values can be on one line separated by spaces or tabs, or they can be on separate lines. Include one value for each progeny individual - or recombinant inbredline. Represent missing values with a non-numeric character such as "x". If you have chosen a recombinant inbred set, - when you submit your data will be displayed in a form where you can confirm and/or edit them. If you enter a file name in the previous section, - any data that you paste here will be ignored. Check sample data for the correct format. + The values can be on one line separated by spaces or tabs, or they can be on separate lines. Include one value for each individual + or line. Use an "x" for missing values. If you have chosen a set of inbred strains, then your data will be displayed in a form in + which you can confirm and/or edit. If you enter a file name in the previous section, + any data that you paste here will be ignored. Check sample data for the correct format.

    -- cgit v1.2.3 From 633973e33de6a989d3fc7710002b5659a8857bb8 Mon Sep 17 00:00:00 2001 From: zsloan Date: Sat, 6 Jul 2019 12:06:18 -0500 Subject: Fixed issue where spaces were inserted into descriptions for mRNA expression data in the regular search Created default collection name when the user submits a collection without naming it --- wqflask/wqflask/collect.py | 2 ++ wqflask/wqflask/search_results.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index 74013239..7e3337a0 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -214,6 +214,8 @@ def collections_new(): if "create_new" in params: logger.debug("in create_new") collection_name = params['new_collection'] + if collection_name.strip() == "": + collection_name = datetime.datetime.utcnow().strftime('Collection_%b_%d_%H:%M') return create_new(collection_name) elif "add_to_existing" in params: logger.debug("in add to existing") diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 12a69bc3..278bf930 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -112,7 +112,7 @@ views.py). trait_dict['hmac'] = user_manager.data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) if this_trait.dataset.type == "ProbeSet": trait_dict['symbol'] = this_trait.symbol - trait_dict['description'] = insert_newlines(this_trait.description_display) + trait_dict['description'] = this_trait.description_display trait_dict['location'] = this_trait.location_repr trait_dict['mean'] = "N/A" trait_dict['additive'] = "N/A" -- cgit v1.2.3 From 477a259b752537b615e286e4cae48234b9cd782b Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 15 Jul 2019 14:12:45 -0500 Subject: Fixed issue where qnorm values were wrong Fixed issue where traits couldn't be highlighted or added to a collection from global search results Fixed issue where third party links threw an error for some traits on the trait page Fixed issue where clicking a row's link unhighlighted it --- wqflask/wqflask/show_trait/show_trait.py | 9 ++++-- wqflask/wqflask/templates/gsearch_gene.html | 35 +++++++++++++++++++++++ wqflask/wqflask/templates/gsearch_pheno.html | 35 +++++++++++++++++++++++ wqflask/wqflask/templates/search_result_page.html | 4 +-- wqflask/wqflask/templates/show_trait.html | 2 +- 5 files changed, 80 insertions(+), 5 deletions(-) diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 5c349bf3..1dd80962 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -278,7 +278,12 @@ class ShowTrait(object): FROM GeneList WHERE geneSymbol = '{}'""".format(self.this_trait.symbol) - chr, transcript_start, transcript_end = g.db.execute(query).fetchall()[0] if len(g.db.execute(query).fetchall()) > 0 else None + results = g.db.execute(query).fetchone() + if results: + chr, transcript_start, transcript_end = results + else: + chr = transcript_start = transcript_end = None + if chr and transcript_start and transcript_end and self.this_trait.refseq_transcriptid: transcript_start = int(transcript_start*1000000) transcript_end = int(transcript_end*1000000) @@ -292,7 +297,7 @@ class ShowTrait(object): WHERE geneSymbol = '{}'""".format(self.this_trait.symbol) results = g.db.execute(query).fetchone() - if results: + if results: kgId, chr, transcript_start, transcript_end = results else: kgId = chr = transcript_start = transcript_end = None diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 9b584ea5..0ee98972 100644 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -78,8 +78,43 @@ } }); + function change_buttons() { + buttons = ["#add", "#remove"]; + num_checked = $('.trait_checkbox:checked').length; + if (num_checked === 0) { + for (_i = 0, _len = buttons.length; _i < _len; _i++) { + button = buttons[_i]; + $(button).prop("disabled", true); + } + } else { + for (_j = 0, _len2 = buttons.length; _j < _len2; _j++) { + button = buttons[_j]; + $(button).prop("disabled", false); + } + } + //}); + if ($(this).is(":checked")) { + if (!$(this).closest('tr').hasClass('selected')) { + $(this).closest('tr').addClass('selected') + } + } + else { + if ($(this).closest('tr').hasClass('selected')) { + $(this).closest('tr').removeClass('selected') + } + } + } + console.time("Creating table"); $('#trait_table').DataTable( { + 'drawCallback': function( settings ) { + $('#trait_table tr').click(function(event) { + if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') { + $(':checkbox', this).trigger('click'); + } + }); + $('.trait_checkbox:checkbox').on("change", change_buttons); + }, 'createdRow': function ( row, data, index ) { $('td', row).eq(0).attr("style", "text-align: center; padding: 4px 10px 2px 10px;"); $('td', row).eq(1).attr("align", "right"); diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index 609c1852..4e142846 100644 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -78,8 +78,43 @@ } }); + function change_buttons() { + buttons = ["#add", "#remove"]; + num_checked = $('.trait_checkbox:checked').length; + if (num_checked === 0) { + for (_i = 0, _len = buttons.length; _i < _len; _i++) { + button = buttons[_i]; + $(button).prop("disabled", true); + } + } else { + for (_j = 0, _len2 = buttons.length; _j < _len2; _j++) { + button = buttons[_j]; + $(button).prop("disabled", false); + } + } + //}); + if ($(this).is(":checked")) { + if (!$(this).closest('tr').hasClass('selected')) { + $(this).closest('tr').addClass('selected') + } + } + else { + if ($(this).closest('tr').hasClass('selected')) { + $(this).closest('tr').removeClass('selected') + } + } + } + console.time("Creating table"); $('#trait_table').DataTable( { + 'drawCallback': function( settings ) { + $('#trait_table tr').click(function(event) { + if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') { + $(':checkbox', this).trigger('click'); + } + }); + $('.trait_checkbox:checkbox').on("change", change_buttons); + }, "createdRow": function ( row, data, index ) { $('td', row).eq(0).attr("style", "text-align: center; padding: 4px 10px 2px 10px;"); $('td', row).eq(1).attr("align", "right"); diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index d1bfbd23..b1442b7f 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -205,7 +205,7 @@ $('#trait_table').DataTable( { 'drawCallback': function( settings ) { $('#trait_table tr').click(function(event) { - if (event.target.type !== 'checkbox') { + if (event.target.type !== 'checkbox' && event.target.tagName.toLowerCase() !== 'a') { $(':checkbox', this).trigger('click'); } }); @@ -398,7 +398,7 @@ postfixButtons: [ 'colvisRestore' ] } ], - 'sDom': "Btir", + 'sDom': "Bitir", 'autoWidth': false, 'deferRender': true, 'paging': false, diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index d5473bca..ea7c5123 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -296,7 +296,7 @@ if (data.value == null) { return '' } else { - return '' + return '' } } }{% if sample_groups[0].se_exists() %}, -- cgit v1.2.3 From 375c87faac2e1eeee064263aafb1e20480643eb7 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 17 Jul 2019 10:53:50 -0500 Subject: Error page should now correctly appear when doing LOCO mapping with GEMMA (if there's no appropriate genotype file) --- wqflask/wqflask/marker_regression/gemma_mapping.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wqflask/wqflask/marker_regression/gemma_mapping.py b/wqflask/wqflask/marker_regression/gemma_mapping.py index 4e3c203d..895d4ac6 100644 --- a/wqflask/wqflask/marker_regression/gemma_mapping.py +++ b/wqflask/wqflask/marker_regression/gemma_mapping.py @@ -221,7 +221,11 @@ def parse_loco_output(this_dataset, gwa_output_filename): marker_obs = [] previous_chr = 0 + no_results = False for this_file in output_filelist: + if not os.path.isfile(this_file): + no_results = True + break with open(this_file) as output_file: for line in output_file: if line.startswith("chr\t"): -- cgit v1.2.3 From 6dab4e5935b87ad818129e3b4bfab4cfa465addf Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 17 Jul 2019 14:09:00 -0500 Subject: Hopefully fixed the issue with weird characters in search result descriptions --- wqflask/wqflask/gsearch.py | 6 +++--- wqflask/wqflask/search_results.py | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 8df8c9a3..dbb77826 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -75,7 +75,7 @@ class GSearch(object): this_trait['group'] = line[1] this_trait['tissue'] = line[2] this_trait['symbol'] = line[6] - this_trait['description'] = line[7] + this_trait['description'] = line[7].decode('utf-8', 'replace') this_trait['location_repr'] = 'N/A' if (line[8] != "NULL" and line[8] != "") and (line[9] != 0): this_trait['location_repr'] = 'Chr%s: %.6f' % (line[8], float(line[9])) @@ -152,9 +152,9 @@ class GSearch(object): this_trait['species'] = line[0] this_trait['group'] = line[1] if line[9] != None and line[6] != None: - this_trait['description'] = unicode(line[6], "utf-8", "ignore") + this_trait['description'] = line[6].decode('utf-8', 'replace') elif line[5] != None: - this_trait['description'] = unicode(line[5], "utf-8", "ignore") + this_trait['description'] = line[5].decode('utf-8', 'replace') else: this_trait['description'] = "N/A" this_trait['authors'] = line[7] diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 278bf930..2ce76c37 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -112,7 +112,7 @@ views.py). trait_dict['hmac'] = user_manager.data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) if this_trait.dataset.type == "ProbeSet": trait_dict['symbol'] = this_trait.symbol - trait_dict['description'] = this_trait.description_display + trait_dict['description'] = this_trait.description_display.decode('utf-8', 'replace') trait_dict['location'] = this_trait.location_repr trait_dict['mean'] = "N/A" trait_dict['additive'] = "N/A" @@ -125,7 +125,7 @@ views.py). elif this_trait.dataset.type == "Geno": trait_dict['location'] = this_trait.location_repr elif this_trait.dataset.type == "Publish": - trait_dict['description'] = this_trait.description_display + trait_dict['description'] = this_trait.description_display.decode('utf-8', 'replace') trait_dict['authors'] = this_trait.authors trait_dict['pubmed_id'] = "N/A" if this_trait.pubmed_id: @@ -179,7 +179,6 @@ views.py). if self.search_term_exists: combined_where_clause = "(" + combined_where_clause + ")" final_query = the_search.compile_final_query(combined_from_clause, combined_where_clause) - # logger.debug("final_query",final_query) results = the_search.execute(final_query) self.results.extend(results) else: -- cgit v1.2.3 From 4ef78a90b4b232300a7806afdc5503fcf6fc7c4b Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 18 Jul 2019 17:58:33 -0500 Subject: Made change that should fix encoding issue, fingers crossed --- wqflask/base/trait.py | 6 ++++-- wqflask/wqflask/database.py | 2 +- wqflask/wqflask/search_results.py | 2 +- wqflask/wqflask/views.py | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 6fecf725..0527449b 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -396,8 +396,10 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False): #XZ: assign SQL query result to trait attributes. for i, field in enumerate(dataset.display_fields): holder = trait_info[i] - if isinstance(trait_info[i], basestring): - holder = unicode(trait_info[i], "utf-8", "ignore") + # if isinstance(trait_info[i], basestring): + # logger.debug("HOLDER:", holder) + # logger.debug("HOLDER2:", holder.decode(encoding='latin1')) + # holder = unicode(trait_info[i], "utf-8", "ignore") setattr(trait, field, holder) if dataset.type == 'Publish': diff --git a/wqflask/wqflask/database.py b/wqflask/wqflask/database.py index 96c2c301..adeed6ad 100644 --- a/wqflask/wqflask/database.py +++ b/wqflask/wqflask/database.py @@ -9,7 +9,7 @@ import utility.logger logger = utility.logger.getLogger(__name__ ) -engine = create_engine(SQL_URI, convert_unicode=True) +engine = create_engine(SQL_URI, encoding="latin1") db_session = scoped_session(sessionmaker(autocommit=False, autoflush=False, diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 2ce76c37..444e1f40 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -125,7 +125,7 @@ views.py). elif this_trait.dataset.type == "Geno": trait_dict['location'] = this_trait.location_repr elif this_trait.dataset.type == "Publish": - trait_dict['description'] = this_trait.description_display.decode('utf-8', 'replace') + trait_dict['description'] = this_trait.description_display trait_dict['authors'] = this_trait.authors trait_dict['pubmed_id'] = "N/A" if this_trait.pubmed_id: diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 109e30cc..2ff6d4d7 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -80,7 +80,7 @@ def connect_db(): db = getattr(g, '_database', None) if db is None: logger.debug("Get new database connector") - g.db = g._database = sqlalchemy.create_engine(SQL_URI) + g.db = g._database = sqlalchemy.create_engine(SQL_URI, encoding="latin1") logger.debug(g.db) @app.teardown_appcontext -- cgit v1.2.3 From 60ae84f8bf2f68846ddeb41bba073b11747bc5e7 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 19 Jul 2019 10:49:29 -0500 Subject: Fixed issue where chr in lower case didn't work for LRS term search --- wqflask/wqflask/do_search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index c7dbc972..c4c303fe 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -448,8 +448,8 @@ class LrsSearch(DoSearch): def get_from_clause(self): #If the user typed, for example "Chr4", the "Chr" substring needs to be removed so that all search elements can be converted to floats - if len(self.search_term) > 2 and "Chr" in self.search_term[2]: - chr_num = self.search_term[2].replace("Chr", "") + if len(self.search_term) > 2 and "chr" in self.search_term[2].lower(): + chr_num = self.search_term[2].lower().replace("chr", "") self.search_term[2] = chr_num self.search_term = [float(value) for value in self.search_term] -- cgit v1.2.3 From 5f5adb62bf13ace887c03522b0b8e83181cd6503 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 23 Jul 2019 11:24:56 -0500 Subject: Added change to automatically update datasets list using rest api instead of json file Removed option to edit certain html pages, like news, policies, etc --- etc/default_settings.py | 1 + wqflask/base/data_set.py | 4 +- wqflask/utility/tools.py | 4 ++ .../marker_regression/display_mapping_results.py | 1 - wqflask/wqflask/marker_regression/run_mapping.py | 17 +++++++- .../new/javascript/dataset_menu_structure.json | 51 ++++++++++++---------- wqflask/wqflask/templates/docs.html | 4 +- 7 files changed, 53 insertions(+), 29 deletions(-) diff --git a/etc/default_settings.py b/etc/default_settings.py index a1fe81e5..a16ac3ad 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -91,4 +91,5 @@ JS_GN_PATH = os.environ['HOME']+"/genenetwork/javascript" # ---- GN2 Executables (overwrite for testing only) # PLINK_COMMAND = str.strip(os.popen("which plink2").read()) # GEMMA_COMMAND = str.strip(os.popen("which gemma").read()) +REAPER_COMMAND = HOME + "/gn2-zach/rust-qtlreaper/target/release/qtlreaper" # GEMMA_WRAPPER_COMMAND = str.strip(os.popen("which gemma-wrapper").read()) diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index d766e284..41de8492 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -46,6 +46,8 @@ from utility import chunks from utility import gen_geno_ob from utility.tools import locate, locate_ignore_error, flat_files +from wqflask.api import gen_menu + from maintenance import get_group_samplelists from MySQLdb import escape_string as escape @@ -92,7 +94,7 @@ Publish or ProbeSet. E.g. """ self.datasets = {} if USE_GN_SERVER: - data = menu_main() + data = gen_menu.gen_dropdown_json() else: file_name = "wqflask/static/new/javascript/dataset_menu_structure.json" with open(file_name, 'r') as fh: diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index 8b2260f5..31ab2046 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -107,6 +107,9 @@ def js_path(module=None): return try_guix raise "No JS path found for "+module+" (if not in Guix check JS_GN_PATH)" +def reaper_command(guess=None): + return get_setting("REAPER_COMMAND",guess) + def gemma_command(guess=None): return assert_bin(get_setting("GEMMA_COMMAND",guess)) @@ -274,6 +277,7 @@ SMTP_CONNECT = get_setting('SMTP_CONNECT') SMTP_USERNAME = get_setting('SMTP_USERNAME') SMTP_PASSWORD = get_setting('SMTP_PASSWORD') +REAPER_COMMAND = app_set("REAPER_COMMAND",reaper_command()) GEMMA_COMMAND = app_set("GEMMA_COMMAND",gemma_command()) assert(GEMMA_COMMAND is not None) PLINK_COMMAND = app_set("PLINK_COMMAND",plink_command()) diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 3bcd613f..d9601405 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -1790,7 +1790,6 @@ class DisplayMappingResults(object): m = 0 thisLRSColor = self.colorCollection[0] if qtlresult['chr'] != previous_chr and self.selectedChr == -1: - if self.manhattan_plot != True: canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth)) diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 2bde2b53..6e9fe85c 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -36,7 +36,7 @@ from utility import helper_functions from utility import Plot, Bunch from utility import temp_data from utility.benchmark import Bench -from wqflask.marker_regression import gemma_mapping, rqtl_mapping, qtlreaper_mapping, plink_mapping +from wqflask.marker_regression import gemma_mapping, rqtl_mapping, qtlreaper_mapping, plink_mapping, rust_reaper_mapping from utility.tools import locate, locate_ignore_error, GEMMA_COMMAND, PLINK_COMMAND, TEMPDIR from utility.external import shell @@ -242,7 +242,8 @@ class RunMapping(object): self.control_marker = start_vars['control_marker'] self.do_control = start_vars['do_control'] logger.info("Running qtlreaper") - results, self.json_data, self.perm_output, self.suggestive, self.significant, self.bootstrap_results = qtlreaper_mapping.gen_reaper_results(self.this_trait, + + results, self.perm_output, self.suggestive, self.significant, self.bootstrap_results = rust_reaper_mapping.run_reaper(self.this_trait, self.dataset, self.samples, self.vals, @@ -253,6 +254,18 @@ class RunMapping(object): self.do_control, self.control_marker, self.manhattan_plot) + + # results, self.json_data, self.perm_output, self.suggestive, self.significant, self.bootstrap_results = qtlreaper_mapping.gen_reaper_results(self.this_trait, + # self.dataset, + # self.samples, + # self.vals, + # self.json_data, + # self.num_perm, + # self.bootCheck, + # self.num_bootstrap, + # self.do_control, + # self.control_marker, + # self.manhattan_plot) elif self.mapping_method == "plink": self.score_type = "-log(p)" self.manhattan_plot = True diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 0d73213d..6531f5a0 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -1440,7 +1440,7 @@ [ "None", "HSBPublish", - "HSB Phenotypes" + "HSB Published Phenotypes" ] ], "Posterior Inferior Parietal Cortex mRNA": [ @@ -1721,7 +1721,7 @@ [ "None", "B6D2Publish", - "B6D2 Phenotypes" + "UTHSC-Glaucoma-Aged-Retina Phenotypes" ] ] }, @@ -2247,6 +2247,11 @@ "Eye_M2_0908_R_ND", "Eye M430v2 WT Gpnmb (Sep08) RMA" ], + [ + "382", + "Eye_M2_0908_WTWT", + "Eye M430v2 WT WT (Sep08) RMA" + ], [ "279", "Eye_M2_0908_R_WT", @@ -2257,11 +2262,6 @@ "Eye_M2_0908_R_MT", "Eye M430v2 Mutant Tyrp1 (Sep08) RMA" ], - [ - "382", - "Eye_M2_0908_WTWT", - "Eye M430v2 WT WT (Sep08) RMA" - ], [ "400", "DBA2J-ONH-1212", @@ -2500,6 +2500,11 @@ "245", "UT_ILM_BXD_hipp_RSE_0909", "UTHSC Hippocampus Illumina v6.1 RSE (Sep09) RankInv" + ], + [ + "711", + "UTHSC_BXD_AgeHipp0515", + "UTHSC BXD Aged Hippocampus Affy MoGene1.0 ST (May15) RMA Gene Level" ] ], "Hypothalamus mRNA": [ @@ -3028,16 +3033,6 @@ ] ], "Striatum mRNA": [ - [ - "376", - "DevStriatum_ILM6.2P3RInv_1111", - "BIDMC/UTHSC Dev Striatum P3 ILMv6.2 (Nov11) RankInv" - ], - [ - "377", - "DevStriatum_ILM6.2P14RInv_1111", - "BIDMC/UTHSC Dev Striatum P14 ILMv6.2 (Nov11) RankInv" - ], [ "399", "Striatum_Exon_1212", @@ -3048,6 +3043,16 @@ "Striatum_Exon_0209", "HQF Striatum Affy Mouse Exon 1.0ST Exon Level (Dec09) RMA" ], + [ + "376", + "DevStriatum_ILM6.2P3RInv_1111", + "BIDMC/UTHSC Dev Striatum P3 ILMv6.2 (Nov11) RankInv" + ], + [ + "377", + "DevStriatum_ILM6.2P14RInv_1111", + "BIDMC/UTHSC Dev Striatum P14 ILMv6.2 (Nov11) RankInv" + ], [ "285", "UTHSC_Striatum_RankInv_1210", @@ -3554,6 +3559,11 @@ ] ], "Hippocampus mRNA": [ + [ + "211", + "Illum_LXS_Hipp_RSS_1008", + "Hippocampus Illumina RSS (Oct08) RankInv beta" + ], [ "213", "Illum_LXS_Hipp_NOS_1008", @@ -3574,11 +3584,6 @@ "Illum_LXS_Hipp_NOE_1008", "Hippocampus Illumina NOE (Oct08) RankInv beta" ], - [ - "211", - "Illum_LXS_Hipp_RSS_1008", - "Hippocampus Illumina RSS (Oct08) RankInv beta" - ], [ "143", "Illum_LXS_Hipp_loess0807", @@ -3835,7 +3840,7 @@ [ "None", "HSNIH-RGSMCPublish", - "HSNIH-RGSMC Phenotypes" + "HSNIH Published Phenotypes" ] ] }, diff --git a/wqflask/wqflask/templates/docs.html b/wqflask/wqflask/templates/docs.html index c485f757..1a241ce7 100644 --- a/wqflask/wqflask/templates/docs.html +++ b/wqflask/wqflask/templates/docs.html @@ -6,9 +6,9 @@

    {{title}}

    - + - +
    {{content|safe}}
    -- cgit v1.2.3 From 1bc7672b4e00010b186f75eacc26bdef1dfab56b Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 26 Jul 2019 11:13:23 -0500 Subject: Scatterplots should have consistent decimal places for axes now --- .../wqflask/static/new/javascript/draw_corr_scatterplot.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js index 4b212f8b..7cc89304 100644 --- a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js +++ b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js @@ -1,6 +1,18 @@ var chart; var srchart; +x_val_range = js_data.x_range[1] - js_data.x_range[0] +y_val_range = js_data.y_range[1] - js_data.y_range[0] + + +if (x_val_range < 4 || y_val_range < 4){ + tick_digits = '.1f' +} else if (x_val_range < 0.4 || y_val_range < 0.4) { + tick_digits = '.2f' +} else { + tick_digits = 'f' +} + var layout = { height: 700, width: 800, @@ -17,6 +29,7 @@ var layout = { visible: true, linecolor: 'black', linewidth: 1, + tickformat: tick_digits }, yaxis: { range: [js_data.y_range[0], js_data.y_range[1]], @@ -25,6 +38,7 @@ var layout = { visible: true, linecolor: 'black', linewidth: 1, + tickformat: tick_digits }, hovermode: "closest", showlegend: false -- cgit v1.2.3 From c277a136f595004ff504ed393dab209e06517960 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 26 Jul 2019 12:44:02 -0500 Subject: Fixed the intercept line and added information to top of figure --- wqflask/wqflask/correlation/corr_scatter_plot.py | 36 +++--------- .../static/new/javascript/draw_corr_scatterplot.js | 65 ++++++++++++++++++++-- 2 files changed, 66 insertions(+), 35 deletions(-) diff --git a/wqflask/wqflask/correlation/corr_scatter_plot.py b/wqflask/wqflask/correlation/corr_scatter_plot.py index 4090b70e..07aa947e 100644 --- a/wqflask/wqflask/correlation/corr_scatter_plot.py +++ b/wqflask/wqflask/correlation/corr_scatter_plot.py @@ -37,9 +37,7 @@ class CorrScatterPlot(object): vals_2.append(samples_2[sample].value) self.data.append(vals_2) - x = np.array(vals_1) - y = np.array(vals_2) - slope, intercept, r_value, p_value, std_err = stats.linregress(x, y) + slope, intercept, r_value, p_value, std_err = stats.linregress(vals_1, vals_2) x_buffer = (max(vals_1) - min(vals_1))*0.1 y_buffer = (max(vals_2) - min(vals_2))*0.1 @@ -49,8 +47,8 @@ class CorrScatterPlot(object): intercept_coords = get_intercept_coords(slope, intercept, x_range, y_range) - rx = stats.rankdata(x) - ry = stats.rankdata(y) + rx = stats.rankdata(vals_1) + ry = stats.rankdata(vals_2) self.rdata = [] self.rdata.append(rx.tolist()) self.rdata.append(ry.tolist()) @@ -111,31 +109,11 @@ def get_intercept_coords(slope, intercept, x_range, y_range): intercept_coords = [] y1 = slope*x_range[0] + intercept - if slope > 0: - if (y1 < y_range[0]): - x1 = (y_range[0] - intercept)/slope - else: - x1 = x_range[0] - intercept_coords.append([x1, y1]) - - x2 = (y_range[1] - intercept)/slope - if (x2 > x_range[1]): - y2 = slope*x_range[1] + intercept - else: - y2 = y_range[1] - else: - if (y1 > y_range[1]): - x1 = (y_range[0] - intercept)/slope - else: - x1 = x_range[0] - intercept_coords.append([x1, y1]) - - x2 = (y_range[0] - intercept)/slope - if (x2 > x_range[1]): - y2 = slope*x_range[1] + intercept - else: - y2 = y_range[0] + y2 = slope*x_range[1] + intercept + x1 = (y1-intercept)/slope + x2 = (y2-intercept)/slope + intercept_coords.append([x1, y1]) intercept_coords.append([x2, y2]) return intercept_coords \ No newline at end of file diff --git a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js index 7cc89304..23f41c66 100644 --- a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js +++ b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js @@ -4,10 +4,9 @@ var srchart; x_val_range = js_data.x_range[1] - js_data.x_range[0] y_val_range = js_data.y_range[1] - js_data.y_range[0] - -if (x_val_range < 4 || y_val_range < 4){ +if (x_val_range < 9 || y_val_range < 9){ tick_digits = '.1f' -} else if (x_val_range < 0.4 || y_val_range < 0.4) { +} else if (x_val_range < 2 || y_val_range < 2) { tick_digits = '.2f' } else { tick_digits = 'f' @@ -19,7 +18,7 @@ var layout = { margin: { l: 60, r: 30, - t: 80, + t: 90, b: 50 }, xaxis: { @@ -29,6 +28,7 @@ var layout = { visible: true, linecolor: 'black', linewidth: 1, + ticklen: 4, tickformat: tick_digits }, yaxis: { @@ -38,10 +38,37 @@ var layout = { visible: true, linecolor: 'black', linewidth: 1, + ticklen: 4, tickformat: tick_digits }, hovermode: "closest", - showlegend: false + showlegend: false, + annotations:[{ + xref: 'paper', + yref: 'paper', + x: 1, + xanchor: 'right', + y: 1.05, + yanchor: 'top', + text: 'r = ' + js_data.r_value.toFixed(3) + ' P = ' + js_data.p_value.toExponential(), + showarrow: false, + font: { + size: 14 + }, + }, { + xref: 'paper', + yref: 'paper', + x: 0, + xanchor: 'left', + y: 1.05, + yanchor: 'top', + text: 'N=' + js_data.num_overlap, + showarrow: false, + font: { + size: 14 + }, + } + ] } var sr_layout = { @@ -70,7 +97,33 @@ var sr_layout = { linewidth: 1, }, hovermode: "closest", - showlegend: false + showlegend: false, + annotations:[{ + xref: 'paper', + yref: 'paper', + x: 1, + xanchor: 'right', + y: 1.05, + yanchor: 'top', + text: 'r = ' + js_data.srr_value.toFixed(3) + ' P = ' + js_data.srp_value.toExponential(), + showarrow: false, + font: { + size: 14 + }, + }, { + xref: 'paper', + yref: 'paper', + x: 0, + xanchor: 'left', + y: 1.05, + yanchor: 'top', + text: 'N=' + js_data.num_overlap, + showarrow: false, + font: { + size: 14 + }, + } +] } cofactor1_dict = {} -- cgit v1.2.3 From 4773b58bd9fdf6b25bddd2dd75570d56e7d1325c Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 29 Jul 2019 13:43:23 -0500 Subject: Added Christian's RUST qtlreaper as an option --- .../marker_regression/display_mapping_results.py | 3 + .../wqflask/marker_regression/qtlreaper_mapping.py | 116 ++++++++++++++++++++- wqflask/wqflask/marker_regression/run_mapping.py | 49 +++++---- .../templates/show_trait_mapping_tools.html | 17 ++- wqflask/wqflask/views.py | 3 +- 5 files changed, 160 insertions(+), 28 deletions(-) diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index d9601405..e6924f40 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -233,6 +233,9 @@ class DisplayMappingResults(object): if self.use_loco == "True": self.gwa_filename = start_vars['gwa_filename'] + if 'reaper_version' in start_vars.keys() and self.mapping_method == "reaper": + self.reaper_version = start_vars['reaper_version'] + self.selectedChr = int(start_vars['selected_chr']) self.strainlist = start_vars['samples'] diff --git a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py index d58c59c8..b74a1c4d 100644 --- a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py +++ b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py @@ -1,7 +1,121 @@ +import os, math, string, random, json + +from base import webqtlConfig +from base.trait import GeneralTrait +from base.data_set import create_dataset +from utility.tools import flat_files, REAPER_COMMAND, TEMPDIR + import utility.logger logger = utility.logger.getLogger(__name__ ) -def gen_reaper_results(this_trait, dataset, samples_before, trait_vals, json_data, num_perm, bootCheck, num_bootstrap, do_control, control_marker, manhattan_plot): +def run_reaper(this_trait, this_dataset, samples, vals, json_data, num_perm, boot_check, num_bootstrap, do_control, control_marker, manhattan_plot): + """Generates p-values for each marker using qtlreaper""" + + if this_dataset.group.genofile != None: + genofile_name = this_dataset.group.genofile[:-5] + else: + genofile_name = this_dataset.group.name + + trait_filename = str(this_trait.name) + "_" + str(this_dataset.name) + "_pheno" + gen_pheno_txt_file(this_dataset, genofile_name, samples, vals, trait_filename) + + output_filename = this_dataset.group.name + "_GWA_" + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6)) + bootstrap_filename = None + permu_filename = None + + opt_list = [] + if boot_check and num_bootstrap > 0: + bootstrap_filename = this_dataset.group.name + "_BOOTSTRAP_" + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6)) + + opt_list.append("-b") + opt_list.append("--n_bootstrap " + str(num_bootstrap)) + opt_list.append("--bootstrap_output " + webqtlConfig.GENERATED_IMAGE_DIR + bootstrap_filename + ".txt") + if num_perm > 0: + permu_filename = this_dataset.group.name + "_PERM_" + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6)) + opt_list.append("-n " + str(num_perm)) + opt_list.append("--permu_output " + webqtlConfig.GENERATED_IMAGE_DIR + permu_filename + ".txt") + if control_marker != "" and do_control == "true": + opt_list.append("-c " + control_marker) + + reaper_command = REAPER_COMMAND + ' --geno {0}/{1}.geno --traits {2}/gn2/{3}.txt {4} -o {5}{6}.txt'.format(flat_files('genotype'), + genofile_name, + TEMPDIR, + trait_filename, + " ".join(opt_list), + webqtlConfig.GENERATED_IMAGE_DIR, + output_filename) + + logger.debug("reaper_command:" + reaper_command) + os.system(reaper_command) + + marker_obs, permu_vals, bootstrap_vals = parse_reaper_output(output_filename, permu_filename, bootstrap_filename) + + suggestive = 0 + significant = 0 + if len(permu_vals) > 0: + suggestive = permu_vals[int(num_perm*0.37-1)] + significant = permu_vals[int(num_perm*0.95-1)] + + return marker_obs, permu_vals, suggestive, significant, bootstrap_vals + +def gen_pheno_txt_file(this_dataset, genofile_name, samples, vals, trait_filename): + """Generates phenotype file for GEMMA""" + + with open("{}/gn2/{}.txt".format(TEMPDIR, trait_filename), "w") as outfile: + outfile.write("Trait\t") + + filtered_sample_list = [] + filtered_vals_list = [] + for i, sample in enumerate(samples): + if vals[i] != "x": + filtered_sample_list.append(sample) + filtered_vals_list.append(vals[i]) + + samples_string = "\t".join(filtered_sample_list) + outfile.write(samples_string + "\n") + outfile.write("T1\t") + values_string = "\t".join(filtered_vals_list) + outfile.write(values_string) + +def parse_reaper_output(gwa_filename, permu_filename, bootstrap_filename): + included_markers = [] + p_values = [] + marker_obs = [] + + with open("{}{}.txt".format(webqtlConfig.GENERATED_IMAGE_DIR, gwa_filename)) as output_file: + for line in output_file: + if line.startswith("ID\t"): + continue + else: + marker = {} + marker['name'] = line.split("\t")[1] + try: + marker['chr'] = int(line.split("\t")[2]) + except: + marker['chr'] = line.split("\t")[2] + marker['cM'] = float(line.split("\t")[3]) + marker['Mb'] = float(line.split("\t")[4]) + marker['p_value'] = float(line.split("\t")[7]) + marker['lrs_value'] = float(line.split("\t")[5]) + marker['lod_score'] = marker['lrs_value'] / 4.61 + marker['additive'] = float(line.split("\t")[6]) + marker_obs.append(marker) + + permu_vals = [] + if permu_filename: + with open("{}{}.txt".format(webqtlConfig.GENERATED_IMAGE_DIR, permu_filename)) as permu_file: + for line in permu_file: + permu_vals.append(float(line)) + + bootstrap_vals = [] + if bootstrap_filename: + with open("{}{}.txt".format(webqtlConfig.GENERATED_IMAGE_DIR, bootstrap_filename)) as bootstrap_file: + for line in bootstrap_file: + bootstrap_vals.append(int(line)) + + return marker_obs, permu_vals, bootstrap_vals + +def run_original_reaper(this_trait, dataset, samples_before, trait_vals, json_data, num_perm, bootCheck, num_bootstrap, do_control, control_marker, manhattan_plot): genotype = dataset.group.read_genotype_file(use_reaper=True) if manhattan_plot != True: diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 6e9fe85c..648d646c 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -239,33 +239,36 @@ class RunMapping(object): self.bootCheck = False self.num_bootstrap = 0 + self.reaper_version = start_vars['reaper_version'] + self.control_marker = start_vars['control_marker'] self.do_control = start_vars['do_control'] logger.info("Running qtlreaper") - results, self.perm_output, self.suggestive, self.significant, self.bootstrap_results = rust_reaper_mapping.run_reaper(self.this_trait, - self.dataset, - self.samples, - self.vals, - self.json_data, - self.num_perm, - self.bootCheck, - self.num_bootstrap, - self.do_control, - self.control_marker, - self.manhattan_plot) - - # results, self.json_data, self.perm_output, self.suggestive, self.significant, self.bootstrap_results = qtlreaper_mapping.gen_reaper_results(self.this_trait, - # self.dataset, - # self.samples, - # self.vals, - # self.json_data, - # self.num_perm, - # self.bootCheck, - # self.num_bootstrap, - # self.do_control, - # self.control_marker, - # self.manhattan_plot) + if self.reaper_version == "new": + results, self.perm_output, self.suggestive, self.significant, self.bootstrap_results = qtlreaper_mapping.run_reaper(self.this_trait, + self.dataset, + self.samples, + self.vals, + self.json_data, + self.num_perm, + self.bootCheck, + self.num_bootstrap, + self.do_control, + self.control_marker, + self.manhattan_plot) + else: + results, self.json_data, self.perm_output, self.suggestive, self.significant, self.bootstrap_results = qtlreaper_mapping.run_original_reaper(self.this_trait, + self.dataset, + self.samples, + self.vals, + self.json_data, + self.num_perm, + self.bootCheck, + self.num_bootstrap, + self.do_control, + self.control_marker, + self.manhattan_plot) elif self.mapping_method == "plink": self.score_type = "-log(p)" self.manhattan_plot = True diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html index b5c37b8b..22707f41 100644 --- a/wqflask/wqflask/templates/show_trait_mapping_tools.html +++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html @@ -115,6 +115,15 @@ {% if dataset.group.mapping_id == "1" %}
    +
    + +
    + +
    +
    @@ -347,9 +356,11 @@
    GEMMA
    GEMMA is software implementing the Genome-wide Efficient Mixed Model Association algorithm for a standard linear mixed model for genome-wide association studies (GWAS).
    {% if dataset.group.mapping_id == "1" %} -
    Interval Mapping
    -
    Interval mapping is a process in which the statistical significance of a hypothetical QTL is evaluated at regular points across a chromosome, even in the absence of explicit genotype data at those points.
    -
    R/qtl
    +
    Interval Mapping
    +
    Interval mapping is a process in which the statistical significance of a hypothetical QTL is evaluated at regular points across a chromosome, even in the absence of explicit genotype data at those points.

    + The default option is a version of qtlrearper rewritten in RUST that should fix some of the issues the original had. You can still use the original with the Version option.
    + Please let us know if you encounter any issues while using the new version.
    +
    R/qtl
    R/qtl is an extensible, interactive environment for mapping quantitative trait loci (QTL) in experimental crosses.
    {% endif %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 2ff6d4d7..fe858d52 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -628,7 +628,8 @@ def mapping_results_page(): 'haplotypeAnalystCheck', 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno', - 'temp_trait' + 'temp_trait', + 'reaper_version' ) start_vars = {} for key, value in initial_start_vars.iteritems(): -- cgit v1.2.3 From c75343ef5b36844a574c24864e483ab1fc8bc01e Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 29 Jul 2019 13:47:13 -0500 Subject: Forgot to remove an unused import --- wqflask/wqflask/marker_regression/run_mapping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 648d646c..676df391 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -36,7 +36,7 @@ from utility import helper_functions from utility import Plot, Bunch from utility import temp_data from utility.benchmark import Bench -from wqflask.marker_regression import gemma_mapping, rqtl_mapping, qtlreaper_mapping, plink_mapping, rust_reaper_mapping +from wqflask.marker_regression import gemma_mapping, rqtl_mapping, qtlreaper_mapping, plink_mapping from utility.tools import locate, locate_ignore_error, GEMMA_COMMAND, PLINK_COMMAND, TEMPDIR from utility.external import shell -- cgit v1.2.3 From 4fc8d44631bcccbe80089e40d9706eb6b5b7aa0a Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 29 Jul 2019 14:25:34 -0500 Subject: Fixed minor issue with previous commit --- wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js | 2 +- wqflask/wqflask/templates/show_trait_mapping_tools.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js index 95d3a537..8001dfc9 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -156,7 +156,7 @@ 'score_type', 'suggestive', 'significant', 'num_perm', 'permCheck', 'perm_output', 'num_bootstrap', 'bootCheck', 'bootstrap_results', 'LRSCheck', 'covariates', 'maf', 'use_loco', 'manhattan_plot', 'control_marker', 'control_marker_db', 'do_control', 'genofile', 'pair_scan', 'startMb', 'endMb', 'graphWidth', 'lrsMax', 'additiveCheck', 'showSNP', 'showGenes', 'viewLegend', 'haplotypeAnalystCheck', - 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno', 'temp_trait', 'group', 'species'] + 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno', 'temp_trait', 'group', 'species', 'reaper_version'] $("#rqtl_geno_compute").on("click", (function(_this) { return function() { diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html index 22707f41..369bbe43 100644 --- a/wqflask/wqflask/templates/show_trait_mapping_tools.html +++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html @@ -118,7 +118,7 @@
    - -- cgit v1.2.3 From 968ad52a42d0f3684b4b0c836e901c5c603eee2d Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 30 Jul 2019 11:08:36 -0500 Subject: Fixed correlation matrix width, colors, and padding --- wqflask/wqflask/templates/correlation_matrix.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html index bcdc499f..ed077471 100644 --- a/wqflask/wqflask/templates/correlation_matrix.html +++ b/wqflask/wqflask/templates/correlation_matrix.html @@ -13,24 +13,24 @@ {% if lowest_overlap < 8 %}
    Caution: This matrix of correlations contains some cells with small sample sizes of fewer than 8.
    {% endif %} -
    +
    - - + + - + {% for trait in traits %} - {% endfor %} {% for trait in traits %} - {% for result in corr_results[loop.index-1] %} {% if result[0].name == trait.name %} - + {% else %} - + {% endif %} {% endfor %} -- cgit v1.2.3 From 8cf60da3d6acd18c84381bb51fde9968dc3d75e5 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 31 Jul 2019 14:50:07 -0500 Subject: Fixed header to not have a fixed width, and added min-widths to many pages to avoid them ever looking strange when the window's width is lowered Significnatly improved correlation matrix output Fixed issue where zooming into Mb ranges with GEMMA mapping output often showed no results; this fix is not ideal and is just a way to work around the results currently not being sorted correctly. Later I should fix the sorting --- .../marker_regression/display_mapping_results.py | 3 +- .../static/new/javascript/create_corr_matrix.js | 14 ++- .../static/new/javascript/draw_corr_scatterplot.js | 59 ++++++------ .../packages/bootstrap/css/non-responsive.css | 4 +- wqflask/wqflask/templates/base.html | 14 +-- wqflask/wqflask/templates/collections/list.html | 7 +- wqflask/wqflask/templates/collections/view.html | 2 +- wqflask/wqflask/templates/correlation_matrix.html | 100 +++++++++++++++------ wqflask/wqflask/templates/index_page_orig.html | 2 +- wqflask/wqflask/templates/mapping_results.html | 2 +- wqflask/wqflask/templates/search_result_page.html | 2 +- wqflask/wqflask/templates/show_trait.html | 2 +- 12 files changed, 130 insertions(+), 81 deletions(-) diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index e6924f40..6498f039 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -1873,7 +1873,8 @@ class DisplayMappingResults(object): final_x_pos = Xc-canvas.stringWidth("5",font=symbolFont)/2+1 if final_x_pos > (xLeftOffset + plotWidth): - break + continue + #break ZS: This is temporary until issue with sorting for GEMMA is fixed elif final_x_pos < xLeftOffset: continue else: diff --git a/wqflask/wqflask/static/new/javascript/create_corr_matrix.js b/wqflask/wqflask/static/new/javascript/create_corr_matrix.js index fe89a672..c0c39fbc 100644 --- a/wqflask/wqflask/static/new/javascript/create_corr_matrix.js +++ b/wqflask/wqflask/static/new/javascript/create_corr_matrix.js @@ -1,5 +1,5 @@ -var neg_color_scale = chroma.scale(['#FF0000', '#FFFFFF']).domain([-1, -0.4]); -var pos_color_scale = chroma.scale(['#FFFFFF', '#00FFFF']).domain([0.4, 1]) +var neg_color_scale = chroma.scale(['#91bfdb', '#ffffff']).domain([-1, -0.4]); +var pos_color_scale = chroma.scale(['#ffffff', '#fc8d59']).domain([0.4, 1]) $('.corr_cell').each( function () { corr_value = parseFloat($(this).find('span.corr_value').text()) if (corr_value >= 0.5){ @@ -14,6 +14,11 @@ $('.corr_cell').each( function () { }); $('#short_labels').click( function (){ + if ($('.short_check').css("display") == "none"){ + $('.short_check').css("display", "inline-block") + } else { + $('.short_check').css("display", "none") + } $('.shortName').each( function() { if ($(this).css("display") == "none"){ $(this).css("display", "block"); @@ -25,6 +30,11 @@ $('#short_labels').click( function (){ }); $('#long_labels').click( function (){ + if ($('.long_check').css("display") == "none"){ + $('.long_check').css("display", "inline-block") + } else { + $('.long_check').css("display", "none") + } $('.verboseName').each( function() { if ($(this).css("display") == "none"){ $(this).css("display", "block"); diff --git a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js index 23f41c66..8fdbad35 100644 --- a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js +++ b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js @@ -4,19 +4,33 @@ var srchart; x_val_range = js_data.x_range[1] - js_data.x_range[0] y_val_range = js_data.y_range[1] - js_data.y_range[0] -if (x_val_range < 9 || y_val_range < 9){ - tick_digits = '.1f' -} else if (x_val_range < 2 || y_val_range < 2) { - tick_digits = '.2f' +if (x_val_range >= 2 && x_val_range < 9){ + x_tick_digits = '.1f' +} else if (x_val_range >= 0.8 && x_val_range < 2) { + x_tick_digits = '.2f' +} else if (x_val_range < 0.8) { + x_tick_digits = '.3f' } else { - tick_digits = 'f' + x_tick_digits = 'f' } +if (y_val_range >= 2 && y_val_range < 8){ + y_tick_digits = '.1f' +} else if (y_val_range >= 0.8 && y_val_range < 2) { + y_tick_digits = '.2f' +} else if (y_val_range < 0.8) { + y_tick_digits = '.3f' +} else { + y_tick_digits = 'f' +} + +console.log("y_digits:", y_tick_digits) + var layout = { height: 700, width: 800, margin: { - l: 60, + l: 70, r: 30, t: 90, b: 50 @@ -29,7 +43,7 @@ var layout = { linecolor: 'black', linewidth: 1, ticklen: 4, - tickformat: tick_digits + tickformat: x_tick_digits }, yaxis: { range: [js_data.y_range[0], js_data.y_range[1]], @@ -39,7 +53,8 @@ var layout = { linecolor: 'black', linewidth: 1, ticklen: 4, - tickformat: tick_digits + tickformat: y_tick_digits, + automargin: true }, hovermode: "closest", showlegend: false, @@ -50,19 +65,7 @@ var layout = { xanchor: 'right', y: 1.05, yanchor: 'top', - text: 'r = ' + js_data.r_value.toFixed(3) + ' P = ' + js_data.p_value.toExponential(), - showarrow: false, - font: { - size: 14 - }, - }, { - xref: 'paper', - yref: 'paper', - x: 0, - xanchor: 'left', - y: 1.05, - yanchor: 'top', - text: 'N=' + js_data.num_overlap, + text: 'r = ' + js_data.r_value.toFixed(3) + ', p = ' + js_data.p_value.toExponential(3) + ', n = ' + js_data.num_overlap, showarrow: false, font: { size: 14 @@ -105,19 +108,7 @@ var sr_layout = { xanchor: 'right', y: 1.05, yanchor: 'top', - text: 'r = ' + js_data.srr_value.toFixed(3) + ' P = ' + js_data.srp_value.toExponential(), - showarrow: false, - font: { - size: 14 - }, - }, { - xref: 'paper', - yref: 'paper', - x: 0, - xanchor: 'left', - y: 1.05, - yanchor: 'top', - text: 'N=' + js_data.num_overlap, + text: 'r = ' + js_data.srr_value.toFixed(3) + ', P = ' + js_data.srp_value.toExponential(3) + ', n = ' + js_data.num_overlap, showarrow: false, font: { size: 14 diff --git a/wqflask/wqflask/static/packages/bootstrap/css/non-responsive.css b/wqflask/wqflask/static/packages/bootstrap/css/non-responsive.css index d352390f..36affd72 100644 --- a/wqflask/wqflask/static/packages/bootstrap/css/non-responsive.css +++ b/wqflask/wqflask/static/packages/bootstrap/css/non-responsive.css @@ -6,7 +6,7 @@ /* Account for fixed navbar */ body { - min-width: 1200px; + //min-width: 1200px; padding-top: 70px; padding-bottom: 30px; } @@ -28,7 +28,7 @@ body { /* Reset the container */ .container { - width: 1400px; + width: 100%; max-width: none !important; } diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index b1977b7f..80bbd7f5 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -21,10 +21,10 @@ - + - "; + header = ""; } else { - header = ""; + header = ""; } _ref = js_data.sample_group_types; for (key in _ref) { @@ -990,12 +990,13 @@ var hist_trace = { root.histogram_data = [hist_trace]; root.histogram_layout = { bargap: 0.05, - title: js_data.trait_id, + title: "Trait " + js_data.trait_id + ": " + js_data.short_description + "", xaxis: { autorange: true, - title: "Value", + title: "Value", titlefont: { - size: 16 + family: "arial", + size: 20 }, ticklen: 4, tickfont: { @@ -1004,23 +1005,25 @@ root.histogram_layout = { }, yaxis: { autorange: true, - title: "Count", + title: "Count", titlefont: { - size: 16 + family: "arial", + size: 20 }, showline: true, ticklen: 4, tickfont: { size: 16 - } + }, + automargin: true }, width: 500, height: 600, margin: { - l: 50, + l: 70, r: 30, t: 100, - b: 60 + b: 50 } }; @@ -1036,25 +1039,34 @@ $('.histogram_samples_group').change(function() { }); root.box_layout = { - title: js_data.trait_id, xaxis: { showline: true, + titlefont: { + family: "arial", + size: 20 + }, tickfont: { size: 16 }, }, yaxis: { - title: js_data.unit_type, + title: "" + js_data.unit_type +"", autorange: true, showline: true, + titlefont: { + family: "arial", + size: 20 + }, ticklen: 4, tickfont: { size: 16 }, - tickformat: tick_digits + tickformat: tick_digits, + zeroline: false, + automargin: true }, margin: { - l: 50, + l: 90, r: 30, t: 30, b: 80 @@ -1122,7 +1134,7 @@ if (full_sample_lists.length > 1) { { type: 'box', y: get_sample_vals(full_sample_lists[0]), - name: sample_group_list[0], + name: "Trait " + js_data.trait_id + "", boxpoints: 'Outliers', jitter: 0.5, whiskerwidth: 0.2, @@ -1150,28 +1162,36 @@ $('.box_plot_tab').click(function() { // Violin Plot root.violin_layout = { - title: js_data.trait_id, xaxis: { showline: true, + titlefont: { + family: "arial", + size: 20 + }, tickfont: { size: 16 } }, yaxis: { - title: js_data.unit_type, + title: ""+js_data.unit_type+"", autorange: true, showline: true, + titlefont: { + family: "arial", + size: 20 + }, ticklen: 4, tickfont: { size: 16 }, tickformat: tick_digits, - zeroline: false + zeroline: false, + automargin: true }, margin: { - l: 50, + l: 90, r: 30, - t: 80, + t: 30, b: 80 } }; @@ -1239,14 +1259,11 @@ if (full_sample_lists.length > 1) { box: { visible: true }, - line: { - color: 'green', - }, meanline: { visible: true }, - name: sample_group_list[0], - x0: sample_group_list[0] + name: "Trait " + js_data.trait_id + "", + x0: "Trait " + js_data.trait_id + "" } ] } diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js index 8001dfc9..8db9522c 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -156,7 +156,7 @@ 'score_type', 'suggestive', 'significant', 'num_perm', 'permCheck', 'perm_output', 'num_bootstrap', 'bootCheck', 'bootstrap_results', 'LRSCheck', 'covariates', 'maf', 'use_loco', 'manhattan_plot', 'control_marker', 'control_marker_db', 'do_control', 'genofile', 'pair_scan', 'startMb', 'endMb', 'graphWidth', 'lrsMax', 'additiveCheck', 'showSNP', 'showGenes', 'viewLegend', 'haplotypeAnalystCheck', - 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno', 'temp_trait', 'group', 'species', 'reaper_version'] + 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno', 'temp_trait', 'group', 'species', 'reaper_version', 'primary_samples'] $("#rqtl_geno_compute").on("click", (function(_this) { return function() { diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 80bbd7f5..2366bdec 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -94,7 +94,7 @@
    - diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html index 7e67ece2..34a15c6a 100644 --- a/wqflask/wqflask/templates/correlation_matrix.html +++ b/wqflask/wqflask/templates/correlation_matrix.html @@ -10,7 +10,7 @@

    Correlation Matrix

    -
    Lower left cells list Pearson product-moment correlations; upper right cells list Spearman rank order correlations. Each cell also contains the n of cases. Values ranging from 0.4 to 1.0 range from dark blue to white, while values ranging from -0.4 to -1.0 range from orange to white. Select any cell to generate a scatter plot. Select trait labels for more information.
    +
    Lower left cells list Pearson product-moment correlations; upper right cells list Spearman rank order correlations. Each cell also contains the n of cases. Values ranging from 0.4 to 1.0 range from orange to white, while values ranging from -0.4 to -1.0 range from dark blue to white. Select any cell to generate a scatter plot. Select trait labels for more information.

    {% if lowest_overlap < 8 %}
    Caution: This matrix of correlations contains some cells with small sample sizes of fewer than 8.
    diff --git a/wqflask/wqflask/templates/index_page_orig.html b/wqflask/wqflask/templates/index_page_orig.html index 286f6c1f..ed91a886 100755 --- a/wqflask/wqflask/templates/index_page_orig.html +++ b/wqflask/wqflask/templates/index_page_orig.html @@ -28,7 +28,7 @@ - +
    @@ -241,7 +241,7 @@

    GeneNetwork v2:

    GeneNetwork v1:

      diff --git a/wqflask/wqflask/templates/loading.html b/wqflask/wqflask/templates/loading.html index 25560249..3eb061e5 100644 --- a/wqflask/wqflask/templates/loading.html +++ b/wqflask/wqflask/templates/loading.html @@ -7,10 +7,24 @@
      -
      +
      + {% if start_vars.tool_used == "Mapping" %} +

      Computing the Map

      +
      + n = {{ start_vars.num_vals }} +
      + Method = {{ start_vars.method }} +
      + {% if start_vars.transform != "" %} + transform = {{ start_vars.transform }} +
      + {% endif %} + MAF = {{ start_vars.maf }} + {% else %}

      Loading {{ start_vars.tool_used }} Results...

      + {% endif %}
      -
      +
      @@ -22,5 +36,5 @@ \ No newline at end of file diff --git a/wqflask/wqflask/templates/new_security/login_user.html b/wqflask/wqflask/templates/new_security/login_user.html index 27b20ebf..c9aaf028 100644 --- a/wqflask/wqflask/templates/new_security/login_user.html +++ b/wqflask/wqflask/templates/new_security/login_user.html @@ -2,53 +2,11 @@ {% block title %}Register{% endblock %} {% block content %} -
      +
      {{ flash_me() }} - - - -
      - -

      Don't have an account?

      - - {% if es_server: %} - Create a new account - {% else: %} -
      -

      You cannot create an account at this moment.
      - Please try again later.

      -
      - {% endif %} - -
      -

      Login with external services

      - - {% if external_login: %} -
      - {% if external_login["github"]: %} - Login with Github - {% else %} -

      Github login is not available right now

      - {% endif %} - - {% if external_login["orcid"]: %} - Login with ORCID - {% else %} -

      ORCID login is not available right now

      - {% endif %} -
      - {% else: %} -
      -

      Sorry, you cannot login with Github or ORCID at this time.

      -
      - {% endif %} -
      - -

      Already have an account? Sign in here.

      +

      Already have an account? Sign in here.

      {% if es_server: %} @@ -69,7 +27,6 @@
      -
      @@ -87,6 +44,42 @@
    +
    + +

    Don't have an account?

    + + {% if es_server: %} + Create a new account + {% else: %} +
    +

    You cannot create an account at this moment.
    + Please try again later.

    +
    + {% endif %} + +
    +

    Login with external services

    + + {% if external_login: %} +
    + {% if external_login["github"]: %} + Login with Github + {% else %} +

    Github login is not available right now

    + {% endif %} + + {% if external_login["orcid"]: %} + Login with ORCID + {% else %} +

    ORCID login is not available right now

    + {% endif %} +
    + {% else: %} +
    +

    Sorry, you cannot login with Github or ORCID at this time.

    +
    + {% endif %} + {% else: %}
    diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index f5978196..2dded69f 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -13,7 +13,7 @@
    -

    We searched {{ dataset.fullname }} +

    Search Results: We searched {{ dataset.fullname }} to find all records {% for word in search_terms %} {% if word.key|lower == "rif" %} @@ -249,6 +249,7 @@ 'columns': [ { 'data': null, + 'width': "30px", 'orderDataType': "dom-checkbox", 'orderSequence': [ "desc", "asc"], 'render': function(data, type, row, meta) { @@ -258,12 +259,14 @@ { 'title': "Index", 'type': "natural", + 'width': "30px", 'data': "index" }, { 'title': "Record", 'type': "natural", 'data': null, + 'width': "60px", 'orderDataType': "dom-inner-text", 'render': function(data, type, row, meta) { return '' + data.name + '' @@ -277,7 +280,6 @@ { 'title': "Description", 'type': "natural", - 'width': "300px", 'data': null, 'render': function(data, type, row, meta) { try { @@ -290,12 +292,13 @@ { 'title': "Location", 'type': "natural", - 'width': "140px", + 'width': "120px", 'data': "location" }, { 'title': "Mean", 'type': "natural", + 'width': "40px", 'data': "mean", 'orderSequence': [ "desc", "asc"] }, @@ -308,7 +311,7 @@ { 'title': "Max LRS Location", 'type': "natural", - 'width': "140px", + 'width': "120px", 'data': "lrs_location" }, { diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index fe858d52..7b585b03 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -560,6 +560,7 @@ def loading_page(): logger.info(request.url) initial_start_vars = request.form start_vars_container = {} + num_vals = 0 #ZS: So it can be displayed on loading page if 'wanted_inputs' in initial_start_vars: wanted = initial_start_vars['wanted_inputs'].split(",") start_vars = {} @@ -567,6 +568,15 @@ def loading_page(): if key in wanted or key.startswith(('value:')): start_vars[key] = value + if 'primary_samples' in start_vars: + samples = start_vars['primary_samples'].split(",") + for sample in samples: + value = start_vars.get('value:' + sample) + if value != "x": + num_vals += 1 + + start_vars['num_vals'] = num_vals + start_vars_container['start_vars'] = start_vars else: start_vars_container['start_vars'] = initial_start_vars -- cgit v1.2.3 From d49507350119c79c1ffb09b054d08b7545703a18 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 1 Aug 2019 15:04:06 -0500 Subject: Replaced loading bar with a gif that should work in Safari --- wqflask/wqflask/templates/loading.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/templates/loading.html b/wqflask/wqflask/templates/loading.html index 3eb061e5..4c30664b 100644 --- a/wqflask/wqflask/templates/loading.html +++ b/wqflask/wqflask/templates/loading.html @@ -6,8 +6,8 @@ {% endfor %}

    -
    -
    +
    +
    {% if start_vars.tool_used == "Mapping" %}

    Computing the Map


    @@ -23,10 +23,17 @@ {% else %}

    Loading {{ start_vars.tool_used }} Results...

    {% endif %} +

    +
    + +
    -- cgit v1.2.3 From eb2fb5c936ff8e2351ef3c1f9cf4968790528bdb Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 1 Aug 2019 15:16:39 -0500 Subject: Added wikidata aliases Fixed year to not be a hyperlink when no pubmed id Fixed first column width so it doesn't go onto two lines for trait details --- wqflask/base/trait.py | 16 +++++++++++----- wqflask/wqflask/templates/show_trait_details.html | 12 +++++++++--- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 39dd075e..a0679041 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -122,17 +122,23 @@ class GeneralTrait(object): def alias_fmt(self): '''Return a text formatted alias''' + alias = 'Not available' + if self.alias: + alias = string.replace(self.alias, ";", " ") + alias = string.join(string.split(alias), ", ") + + return alias + + @property + def wikidata_alias_fmt(self): + '''Return a text formatted alias''' + alias = 'Not available' if self.symbol: response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol) alias_list = json.loads(response.content) alias = "; ".join(alias_list) - if alias == 'Not available': - if self.alias: - alias = string.replace(self.alias, ";", " ") - alias = string.join(string.split(alias), ", ") - return alias diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html index e6c68591..7714a1ab 100644 --- a/wqflask/wqflask/templates/show_trait_details.html +++ b/wqflask/wqflask/templates/show_trait_details.html @@ -1,6 +1,6 @@
    Spearman Rank Correlation (rho)Spearman Rank Correlation (rho)
    P e a r s o n     rP e a r s o n     r + Trait{{ loop.index }}
    + Trait {{ loop.index }}: {{ trait.dataset.name }}::{{ trait.name }} n
    {{ result[2] }}
    n
    {{ result[2] }}
    {{ '%0.3f' % result[1] }}
    {{ result[2] }}
    {{ '%0.3f' % result[1] }}
    {{ result[2] }}
    Trait: " + js_data.trait_id + " - " + js_data.trait_symbol + "
    Statistic
    Trait " + js_data.trait_id + " - " + js_data.trait_symbol + "
    Statistic
    Trait: " + js_data.trait_id + "
    Statistic
    Trait " + js_data.trait_id + "
    Statistic
    - + {% if this_trait.dataset.type == 'Publish' %} @@ -18,7 +18,7 @@ - + {% else %} @@ -35,8 +35,14 @@ {% endif %} - + + {% if this_trait.alias_fmt != "Not Available" %} + + + + + {% endif %} {% endif %} {% if this_trait.dataset.type != 'Publish' %} -- cgit v1.2.3 From 1fd5271ebd12cff537e8ce68d9f8d706e531eb51 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 1 Aug 2019 17:13:07 -0500 Subject: Updated aliases to get all species aliases and remove duplicates --- wqflask/base/trait.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index a0679041..58169b5c 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -135,9 +135,20 @@ class GeneralTrait(object): alias = 'Not available' if self.symbol: - response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol) - alias_list = json.loads(response.content) - alias = "; ".join(alias_list) + human_response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol.upper()) + mouse_response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol.capitalize()) + other_response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol.lower()) + alias_list = json.loads(human_response.content) + json.loads(mouse_response.content) + json.loads(other_response.content) + + filtered_aliases = [] + seen = set() + for item in alias_list: + if item in seen: + continue + else: + filtered_aliases.append(item) + seen.add(item) + alias = "; ".join(filtered_aliases) return alias -- cgit v1.2.3 From 3b626057ffebddf2829fbddb50445cf4934b0580 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 2 Aug 2019 10:47:18 -0500 Subject: Added the gif for the loading screen --- wqflask/wqflask/static/gif/89.gif | Bin 0 -> 27183 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 wqflask/wqflask/static/gif/89.gif diff --git a/wqflask/wqflask/static/gif/89.gif b/wqflask/wqflask/static/gif/89.gif new file mode 100644 index 00000000..e9b3279d Binary files /dev/null and b/wqflask/wqflask/static/gif/89.gif differ -- cgit v1.2.3 From 8f9dcc4b53e4149d5ac7c698bb0b3bb88e36cf64 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 2 Aug 2019 10:50:05 -0500 Subject: Fixed issue where resizing correlation page could make buttons get pushed down --- wqflask/wqflask/templates/correlation_page.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index 32f5e774..fea60dfa 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -4,7 +4,7 @@ {% endblock %} {% block content %} -
    +
    {% if selectedChr == -1 %} -
    +

    Mapping Statistics


    @@ -307,20 +320,14 @@ + - {% if mapping_method != "gemma" and mapping_method != "plink" %} - {% endif %} - {% if mapping_method != "gemma" and mapping_method != "plink" %} - - - - - {% endif %} + {% endblock %} diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 2dded69f..8dfa37a8 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -15,6 +15,9 @@

    Search Results: We searched {{ dataset.fullname }} to find all records + {% if go_term is not none %} + with Gene Ontology ID GO:{{ go_term }}. + {% else %} {% for word in search_terms %} {% if word.key|lower == "rif" %} with GeneRIF containing {{ word.search_term[0] }}{% if loop.last %}.{% else %} and {% endif %} @@ -40,9 +43,13 @@ {% if word.search_term[0] == "*" %} in the dataset.{% else %}{% if loop.first %}that match:
    {% endif %}"{{ word.search_term[0] }}"{% if loop.last %}{% else %} and {% endif %}{% endif %} {% endif %} {% endfor %} + {% endif %}
    {{ results|count }} records are shown below.

    + {% if go_term is not none %} +

    The associated genes include:

    {% for word in search_terms %}{{ word.search_term[0] }}{% endfor %}

    + {% endif %} diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html index 7714a1ab..bb0b62fe 100644 --- a/wqflask/wqflask/templates/show_trait_details.html +++ b/wqflask/wqflask/templates/show_trait_details.html @@ -1,40 +1,40 @@
    Species and GroupSpecies and Group {{ this_trait.dataset.group.species }}, {{ this_trait.dataset.group.name }}
    Journal{{ this_trait.journal }} ({{ this_trait.year }}){{ this_trait.journal }} ({% if this_trait.pubmed_id %}{{ this_trait.year }}{% else %}{{ this_trait.year }}{% endif %})
    Aliases{{ this_trait.alias_fmt|replace(",",";") }}Wikidata: {{ this_trait.wikidata_alias_fmt|replace(",",";") }}
    GeneNetwork: {{ this_trait.alias_fmt|replace(",",";") }}
    - + {% if this_trait.dataset.type == 'Publish' %} - + - + - + - + {% else %} - + {% endif %} {% if this_trait.dataset.type == 'ProbeSet' %} {% if this_trait.symbol != None %} - + {% endif %} - + {% if this_trait.alias_fmt != "Not Available" %} @@ -46,12 +46,12 @@ {% endif %} {% if this_trait.dataset.type != 'Publish' %} - + {% endif %} - + {% if this_trait.probe_set_specificity %} - + - + - {% for header in target_dataset.header_fields %} - {% if header == 'Year' %} + {% for header in header_fields %} - {% elif header == 'Max LRS' %} - - {% elif header == 'Max LRS Location' %} - - {% elif header == 'Location' %} - - {% elif header == 'Mean' %} - - {% elif header == 'Additive Effect' %} - - {% elif header == 'Index' %} - - {% elif header == 'N' %} - - {% else %} - - {% endif %} {% endfor %} - {% if target_dataset.type == "ProbeSet" %} - {% if corr_method == 'pearson' %} - - - - - - - {% else %} - - - - - - - {% endif %} - {% elif target_dataset.type == "Publish" %} - {% if corr_method == 'pearson' %} - - - - {% else %} - - - - {% endif %} - {% elif target_dataset.type == "Geno" %} - {% if corr_method == 'pearson' %} - - - - {% else %} - - - - {% endif %} - {% endif %} @@ -190,9 +135,6 @@ - - - @@ -208,6 +150,9 @@ {% endif %} + + + {% elif target_dataset.type == "Publish" %} @@ -398,15 +343,15 @@ { "type": "natural", "width": "15%" }, { "type": "natural" }, { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" }, { "orderDataType": "dom-innertext", 'orderSequence': [ "desc", "asc"] }, { "type": "natural" }, { "type": "scientific" }, { "type": "numeric-html", 'orderSequence': [ "desc", "asc"] }, { "type": "numeric-html", 'orderSequence': [ "desc", "asc"] }, - { "type": "scientific" } + { "type": "scientific" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" } ], "createdRow": function ( row, data, index ) { $('td', row).eq(4).attr('title', $('td', row).eq(4).text()); @@ -416,14 +361,11 @@ } }, "order": [[12, "asc" ]], - "sDom": "BRZtir", + "sDom": "tir", "iDisplayLength": -1, "autoWidth": false, "deferRender": true, "bSortClasses": false, - "scrollY": "800px", - "scrollCollapse": false, - "scroller": true, "paging": false, "orderClasses": true } diff --git a/wqflask/wqflask/templates/index_page_orig.html b/wqflask/wqflask/templates/index_page_orig.html index 5706c870..48ed0ec5 100755 --- a/wqflask/wqflask/templates/index_page_orig.html +++ b/wqflask/wqflask/templates/index_page_orig.html @@ -36,7 +36,7 @@
    - +
    @@ -48,7 +48,7 @@
    - +
    @@ -58,7 +58,7 @@
    - +
    @@ -67,7 +67,7 @@
    - +
    -- cgit v1.2.3 From d9ceb094bd6887d81faf37dc93388d3df200e9b7 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 29 Aug 2019 16:03:35 -0500 Subject: Fixed remaining issue where columns didn't show up right and the mean/r filter didn't work right for non-ProbeSet target datasets --- wqflask/wqflask/correlation/show_corr_results.py | 17 ++++++++++-- wqflask/wqflask/templates/correlation_page.html | 35 +++++++++++------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 1fa47920..0db8fa38 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -150,6 +150,13 @@ class CorrelationResults(object): self.header_fields = get_header_fields(self.target_dataset.type, self.corr_method) + if self.target_dataset.type == "ProbeSet": + self.filter_cols = [7, 6] + elif self.target_dataset.type == "Publish": + self.filter_cols = [6, 0] + else: + self.filter_cols = [4, 0] + self.correlation_results = [] self.correlation_data = {} @@ -583,7 +590,10 @@ def get_header_fields(data_type, corr_method): 'Year', 'Sample r', 'N', - 'Sample p(r)'] + 'Sample p(r)', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'] else: header_fields = ['Index', 'Record', @@ -592,7 +602,10 @@ def get_header_fields(data_type, corr_method): 'Year', 'Sample rho', 'N', - 'Sample p(rho)'] + 'Sample p(rho)', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'] else: if corr_method == "pearson": header_fields = ['Index', diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index fffdfd75..cbd2ab46 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -161,12 +161,12 @@ {{ trait.pubmed_text }} -
    - - + + + {% elif target_dataset.type == "Geno" %} @@ -233,38 +233,37 @@ //$.fn.dataTableExt.afnFiltering.push( $.fn.dataTable.ext.search.push( function( settings, data, dataIndex ) { - var r_column = 10; + var r_column = {{ filter_cols[0] }}; var r_greater = parseFloat($('input[name=r_greater_select]').val()) var r_less = parseFloat($('input[name=r_less_select]').val()); var r_and_or = $('#r_and_or').val(); - var mean_column = 6; + var mean_column = {{ filter_cols[1] }}; var mean_greater = parseFloat($('input[name=mean_greater_select]').val()); var mean_less = parseFloat($('input[name=mean_less_select]').val()); var mean_and_or = $('#mean_and_or').val(); - if (r_and_or == "and" && mean_and_or == "and"){ - if ( (data[r_column] >= r_greater && data[r_column] <= r_less) && (data[mean_column] > mean_greater && data[mean_column] < mean_less) ){ + if ( (data[r_column] >= r_greater && data[r_column] <= r_less) && {% if filter_cols[1] != 0 %}(data[mean_column] > mean_greater && data[mean_column] < mean_less){% else %} true{% endif %} ){ return true } else { return false } } else if (r_and_or == "and" && mean_and_or == "or"){ - if ( (data[r_column] >= r_greater && data[r_column] <= r_less) && (data[mean_column] >= mean_greater || data[mean_column] <= mean_less) ){ + if ( (data[r_column] >= r_greater && data[r_column] <= r_less) && {% if filter_cols[1] != 0 %}(data[mean_column] >= mean_greater || data[mean_column] <= mean_less){% else %} true{% endif %} ){ return true } else { return false } } else if (r_and_or == "or" && mean_and_or == "and") { - if ( (data[r_column] >= r_greater || data[r_column] <= r_less) && (data[mean_column] >= mean_greater && data[mean_column] <= mean_less) ){ + if ( (data[r_column] >= r_greater || data[r_column] <= r_less) && {% if filter_cols[1] != 0 %}(data[mean_column] >= mean_greater && data[mean_column] <= mean_less){% else %} true{% endif %} ){ return true } else { return false } } else { - if ( (data[r_column] >= r_greater || data[r_column] <= r_less) && (data[mean_column] >= mean_greater || data[mean_column] <= mean_less) ){ + if ( (data[r_column] >= r_greater || data[r_column] <= r_less) && {% if filter_cols[1] != 0 %}(data[mean_column] >= mean_greater || data[mean_column] <= mean_less){% else %} true{% endif %} ){ return true } else { return false @@ -360,7 +359,7 @@ $('td', row).eq(4).text($('td', row).eq(4).text() + '...') } }, - "order": [[12, "asc" ]], + "order": [[9, "asc" ]], "sDom": "tir", "iDisplayLength": -1, "autoWidth": false, @@ -395,11 +394,11 @@ { "type": "natural", "width": "12%" }, { "type": "natural" }, { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" }, { "orderDataType": "dom-innertext", 'orderSequence': [ "desc", "asc"] }, + { "type": "scientific" }, { "type": "natural" }, - { "type": "scientific" } + { "type": "natural" }, + { "type": "natural" } ], "createdRow": function ( row, data, index ) { $('td', row).eq(3).attr('title', $('td', row).eq(3).text()); @@ -413,12 +412,10 @@ $('td', row).eq(4).text($('td', row).eq(4).text() + '...') } }, - "order": [[11, "asc" ]], - "sDom": "Btir", + "order": [[8, "asc" ]], + "sDom": "tir", "autoWidth": false, - "bDeferRender": true, - "scrollY": "800px", - "scrollCollapse": false + "bDeferRender": true } {% elif target_dataset.type == "Geno" %} table_conf = { -- cgit v1.2.3 From c540d661c9603f33b46edf2f6c8fd6b95bab8b38 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 29 Aug 2019 17:09:46 -0500 Subject: Fixed issue where LOD to LRS conversions weren't showing up correctly in the table Fixed issue where non-LOCO GEMMA wasn't working correctly --- .../wqflask/marker_regression/display_mapping_results.py | 10 +++++----- wqflask/wqflask/marker_regression/gemma_mapping.py | 2 +- wqflask/wqflask/marker_regression/run_mapping.py | 16 ++++++++-------- wqflask/wqflask/templates/mapping_results.html | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 1d5843d4..911219f4 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -229,10 +229,10 @@ class DisplayMappingResults(object): self.covariates = start_vars['covariates'] if 'maf' in start_vars.keys(): self.maf = start_vars['maf'] + if 'output_files' in start_vars.keys(): + self.output_files = start_vars['output_files'] if 'use_loco' in start_vars.keys() and self.mapping_method == "gemma": self.use_loco = start_vars['use_loco'] - if self.use_loco == "True": - self.output_files = start_vars['output_files'] if 'reaper_version' in start_vars.keys() and self.mapping_method == "reaper": self.reaper_version = start_vars['reaper_version'] @@ -1702,7 +1702,7 @@ class DisplayMappingResults(object): #ZS: Needed to pass to genome browser js_data = json.loads(self.js_data) if self.LRS_LOD == "LRS": - js_data['max_score'] = LRS_LOD_Max/4.16 + js_data['max_score'] = LRS_LOD_Max/4.61 else: js_data['max_score'] = LRS_LOD_Max self.js_data = json.dumps(js_data) @@ -2068,9 +2068,9 @@ class DisplayMappingResults(object): ######################################### myCanvas = pid.PILCanvas(size=(400,300)) if 'lod_score' in self.qtlresults[0] and self.LRS_LOD == "LRS": - perm_output = [value*4.16 for value in self.perm_output] + perm_output = [value*4.61 for value in self.perm_output] elif 'lod_score' not in self.qtlresults[0] and self.LRS_LOD == "LOD": - perm_output = [value/4.16 for value in self.perm_output] + perm_output = [value/4.61 for value in self.perm_output] else: perm_output = self.perm_output diff --git a/wqflask/wqflask/marker_regression/gemma_mapping.py b/wqflask/wqflask/marker_regression/gemma_mapping.py index 8d59a392..5b34e837 100644 --- a/wqflask/wqflask/marker_regression/gemma_mapping.py +++ b/wqflask/wqflask/marker_regression/gemma_mapping.py @@ -109,7 +109,7 @@ def run_gemma(this_trait, this_dataset, samples, vals, covariates, use_loco, maf return marker_obs, gwa_output_filename else: marker_obs = parse_loco_output(this_dataset, gwa_output_filename) - return marker_obs + return marker_obs, gwa_output_filename def gen_pheno_txt_file(this_dataset, genofile_name, vals, trait_filename): """Generates phenotype file for GEMMA""" diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index af5d0206..56d901fc 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -181,18 +181,18 @@ class RunMapping(object): self.dataset.group.get_markers() if self.mapping_method == "gemma": self.first_run = True - self.output_files= None + self.output_files = None + if 'output_files' in start_vars: + self.output_files = start_vars['output_files'] if 'first_run' in start_vars: #ZS: check if first run so existing result files can be used if it isn't (for example zooming on a chromosome, etc) self.first_run = False - if 'output_files' in start_vars: - self.output_files = start_vars['output_files'] self.score_type = "-log(p)" self.manhattan_plot = True with Bench("Running GEMMA"): if self.use_loco == "True": marker_obs, self.output_files = gemma_mapping.run_gemma(self.this_trait, self.dataset, self.samples, self.vals, self.covariates, self.use_loco, self.maf, self.first_run, self.output_files) else: - marker_obs = gemma_mapping.run_gemma(self.this_trait, self.dataset, self.samples, self.vals, self.covariates, self.use_loco, self.maf, self.first_run) + marker_obs, self.output_files = gemma_mapping.run_gemma(self.this_trait, self.dataset, self.samples, self.vals, self.covariates, self.use_loco, self.maf, self.first_run, self.output_files) results = marker_obs elif self.mapping_method == "rqtl_plink": results = self.run_rqtl_plink() @@ -397,7 +397,7 @@ class RunMapping(object): if self.mapping_method != "gemma": if self.score_type == "LRS": - significant_for_browser = self.significant / 4.16 + significant_for_browser = self.significant / 4.61 else: significant_for_browser = self.significant @@ -521,15 +521,15 @@ def trim_markers_for_figure(markers): else: filtered_markers.append(marker) else: - if marker[score_type] < 4.16: + if marker[score_type] < 4.61: if low_counter % 20 == 0: filtered_markers.append(marker) low_counter += 1 - elif 4.16 <= marker[score_type] < (2*4.16): + elif 4.61 <= marker[score_type] < (2*4.61): if med_counter % 10 == 0: filtered_markers.append(marker) med_counter += 1 - elif (2*4.16) <= marker[score_type] <= (3*4.16): + elif (2*4.61) <= marker[score_type] <= (3*4.61): if high_counter % 2 == 0: filtered_markers.append(marker) high_counter += 1 diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index 189f8abc..373bae1e 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -250,11 +250,11 @@ {% if 'lod_score' in marker %} {% else %} - + {% endif %} {% else %} {% if 'lod_score' in marker %} - + {% else %} {% endif %} -- cgit v1.2.3 From 4bd1db34b109bff3b9abdcc161472885e9ae700d Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Fri, 6 Sep 2019 03:29:12 -0500 Subject: Fix name of javascript-twitter-post-fetcher --- wqflask/utility/tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index 31ab2046..ec9f01bd 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -289,11 +289,14 @@ assert_dir(TEMPDIR) JS_GUIX_PATH = get_setting("JS_GUIX_PATH") assert_dir(JS_GUIX_PATH) assert_dir(JS_GUIX_PATH+'/cytoscape-panzoom') + CSS_PATH = "UNKNOWN" # assert_dir(JS_PATH) -JS_TWITTER_POST_FETCHER_PATH = get_setting("JS_TWITTER_POST_FETCHER_PATH",js_path("Twitter-Post-Fetcher")) + +JS_TWITTER_POST_FETCHER_PATH = get_setting("JS_TWITTER_POST_FETCHER_PATH",js_path("javascript-twitter-post-fetcher")) assert_dir(JS_TWITTER_POST_FETCHER_PATH) assert_file(JS_TWITTER_POST_FETCHER_PATH+"/js/twitterFetcher_min.js") + JS_CYTOSCAPE_PATH = get_setting("JS_CYTOSCAPE_PATH",js_path("cytoscape")) assert_dir(JS_CYTOSCAPE_PATH) assert_file(JS_CYTOSCAPE_PATH+'/cytoscape.min.js') -- cgit v1.2.3 From cc12fe06593f4957fb2b5b641ebe7e5cf43453b1 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 9 Sep 2019 16:22:15 -0500 Subject: Add option to hide columns in correlation results Increased width of permutation histogram Increased a couple table widths that had crowded header text on certain browers (maybe just Safari) --- wqflask/utility/tools.py | 5 ++-- .../marker_regression/display_mapping_results.py | 2 +- wqflask/wqflask/templates/correlation_page.html | 28 ++++++++++++---------- wqflask/wqflask/templates/mapping_results.html | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index 31ab2046..a2eb0817 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -105,7 +105,7 @@ def js_path(module=None): try_guix = get_setting("JS_GUIX_PATH")+"/"+module if valid_path(try_guix): return try_guix - raise "No JS path found for "+module+" (if not in Guix check JS_GN_PATH)" + raise Exception("No JS path found for "+module+" (if not in Guix check JS_GN_PATH)") def reaper_command(guess=None): return get_setting("REAPER_COMMAND",guess) @@ -291,7 +291,8 @@ assert_dir(JS_GUIX_PATH) assert_dir(JS_GUIX_PATH+'/cytoscape-panzoom') CSS_PATH = "UNKNOWN" # assert_dir(JS_PATH) -JS_TWITTER_POST_FETCHER_PATH = get_setting("JS_TWITTER_POST_FETCHER_PATH",js_path("Twitter-Post-Fetcher")) +#JS_TWITTER_POST_FETCHER_PATH = get_setting("JS_TWITTER_POST_FETCHER_PATH",js_path("Twitter-Post-Fetcher")) +JS_TWITTER_POST_FETCHER_PATH = get_setting("JS_TWITTER_POST_FETCHER_PATH",js_path("javascript-twitter-post-fetcher")) assert_dir(JS_TWITTER_POST_FETCHER_PATH) assert_file(JS_TWITTER_POST_FETCHER_PATH+"/js/twitterFetcher_min.js") JS_CYTOSCAPE_PATH = get_setting("JS_CYTOSCAPE_PATH",js_path("cytoscape")) diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index 911219f4..2834f1c3 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -2066,7 +2066,7 @@ class DisplayMappingResults(object): ######################################### # Permutation Graph ######################################### - myCanvas = pid.PILCanvas(size=(400,300)) + myCanvas = pid.PILCanvas(size=(500,300)) if 'lod_score' in self.qtlresults[0] and self.LRS_LOD == "LRS": perm_output = [value*4.61 for value in self.perm_output] elif 'lod_score' not in self.qtlresults[0] and self.LRS_LOD == "LOD": diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index cbd2ab46..9e986eda 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -2,6 +2,7 @@ {% block css %} + {% endblock %} {% block content %}
    @@ -188,10 +189,9 @@ - - - - + + + - - - + + + + - - - - + + + + @@ -441,6 +447,66 @@ $('#marker_regression_form').attr('action', '/export_perm_data'); return $('#marker_regression_form').submit(); } + + modebar_options = { + modeBarButtonsToAdd:[{ + name: 'Export as SVG', + icon: Plotly.Icons.disk, + click: function(gd) { + Plotly.downloadImage(gd, {format: 'svg'}) + } + }], + modeBarButtonsToRemove:['toImage', 'sendDataToCloud', 'hoverClosest', 'hoverCompare', 'hoverClosestCartesian', 'hoverCompareCartesian', 'lasso2d', 'toggleSpikelines'], + displaylogo: false + //modeBarButtons:['toImage2', 'zoom2d', 'pan2d', 'select2d', 'zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d'], + } + + perm_data = js_data.perm_results + var hist_trace = { + x: perm_data, + type: 'histogram' + }; + histogram_data = [hist_trace]; + histogram_layout = { + bargap: 0.05, + title: "Histogram of Permutation Test", + xaxis: { + autorange: true, + title: "LRS", + titlefont: { + family: "arial", + size: 20 + }, + ticklen: 4, + tickfont: { + size: 16 + } + }, + yaxis: { + autorange: true, + title: "Frequency", + titlefont: { + family: "arial", + size: 20 + }, + showline: true, + ticklen: 4, + tickfont: { + size: 16 + }, + automargin: true + }, + width: 500, + height: 300, + margin: { + l: 70, + r: 30, + t: 100, + b: 50 + } + }; + + Plotly.newPlot('perm_histogram', histogram_data, histogram_layout, modebar_options); {% endif %} export_mapping_results = function() { -- cgit v1.2.3 From bf3f98fb51e20d3ced96c7004c60d8b19b2aad55 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 24 Sep 2019 10:59:15 -0500 Subject: Fixed issue that caused logging in to stop working with new GUIX build Removed some unused JS libraries --- bin/genenetwork2 | 2 +- etc/default_settings.py | 2 +- wqflask/wqflask/heatmap/heatmap.py | 83 +- .../wqflask/marker_regression/qtlreaper_mapping.py | 4 +- wqflask/wqflask/marker_regression/run_mapping.py | 5 + .../new/javascript/dataset_menu_structure.json | 142 +- .../new/javascript/get_traits_from_collection.js | 74 +- .../wqflask/static/new/javascript/network_graph.js | 17 +- wqflask/wqflask/static/new/packages/nvd3/nv.d3.css | 641 - wqflask/wqflask/static/new/packages/nvd3/nv.d3.js | 13363 ------------------- .../wqflask/static/new/packages/nvd3/nv.d3.min.css | 1 - .../wqflask/static/new/packages/nvd3/nv.d3.min.js | 8 - .../static/packages/DT_bootstrap/DT_bootstrap.css | 179 - .../static/packages/DT_bootstrap/DT_bootstrap.js | 159 - .../wqflask/static/packages/DT_bootstrap/images | 1 - wqflask/wqflask/templates/index_page_orig.html | 2 + wqflask/wqflask/templates/show_trait.html | 2 - wqflask/wqflask/user_manager.py | 5 +- 18 files changed, 203 insertions(+), 14487 deletions(-) delete mode 100644 wqflask/wqflask/static/new/packages/nvd3/nv.d3.css delete mode 100644 wqflask/wqflask/static/new/packages/nvd3/nv.d3.js delete mode 100644 wqflask/wqflask/static/new/packages/nvd3/nv.d3.min.css delete mode 100644 wqflask/wqflask/static/new/packages/nvd3/nv.d3.min.js delete mode 100644 wqflask/wqflask/static/packages/DT_bootstrap/DT_bootstrap.css delete mode 100644 wqflask/wqflask/static/packages/DT_bootstrap/DT_bootstrap.js delete mode 120000 wqflask/wqflask/static/packages/DT_bootstrap/images diff --git a/bin/genenetwork2 b/bin/genenetwork2 index 7c875274..1c538e86 100755 --- a/bin/genenetwork2 +++ b/bin/genenetwork2 @@ -25,7 +25,7 @@ # webserver) run from the base-dir with settings file and add that # script with a -c switch, e.g. # -# env GN2_PROFILE=/usr/local/guix-profiles/gn-latest-20181119 TMPDIR=/export/local/home/zas1024/gn2-zach/tmp WEBSERVER_MODE=DEBUG LOG_LEVEL=DEBUG SERVER_PORT=5002 GENENETWORK_FILES=/export/local/home/zas1024/gn2-zach/genotype_files SQL_URI=mysql://webqtlout:webqtlout@lily.uthsc.edu/db_webqtl ./bin/genenetwork2 ./etc/default_settings.py -c ./maintenance/gen_select_dataset.py +# env GN2_PROFILE=/usr/local/guix-profiles/gn-latest-20190905 TMPDIR=/export/local/home/zas1024/gn2-zach/tmp WEBSERVER_MODE=DEBUG LOG_LEVEL=DEBUG SERVER_PORT=5002 GENENETWORK_FILES=/export/local/home/zas1024/gn2-zach/genotype_files SQL_URI=mysql://webqtlout:webqtlout@lily.uthsc.edu/db_webqtl ./bin/genenetwork2 ./etc/default_settings.py -c ./maintenance/gen_select_dataset.py # # To run any script in the environment # diff --git a/etc/default_settings.py b/etc/default_settings.py index a16ac3ad..75f84dc4 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -91,5 +91,5 @@ JS_GN_PATH = os.environ['HOME']+"/genenetwork/javascript" # ---- GN2 Executables (overwrite for testing only) # PLINK_COMMAND = str.strip(os.popen("which plink2").read()) # GEMMA_COMMAND = str.strip(os.popen("which gemma").read()) -REAPER_COMMAND = HOME + "/gn2-zach/rust-qtlreaper/target/release/qtlreaper" +REAPER_COMMAND = os.environ['GN2_PROFILE'] + "/bin/qtlreaper" # GEMMA_WRAPPER_COMMAND = str.strip(os.popen("which gemma-wrapper").read()) diff --git a/wqflask/wqflask/heatmap/heatmap.py b/wqflask/wqflask/heatmap/heatmap.py index 37454dfb..e82aa0ef 100644 --- a/wqflask/wqflask/heatmap/heatmap.py +++ b/wqflask/wqflask/heatmap/heatmap.py @@ -10,6 +10,7 @@ import datetime import time import pp import math +import random import collections import resource @@ -23,9 +24,11 @@ import reaper from base.trait import GeneralTrait from base import data_set from base import species +from base import webqtlConfig from utility import helper_functions from utility import Plot, Bunch from utility import temp_data +from utility.tools import flat_files, REAPER_COMMAND, TEMPDIR from MySQLdb import escape_string as escape @@ -119,10 +122,15 @@ class Heatmap(object): for trait_db in self.trait_list: self.dataset.group.get_markers() this_trait = trait_db[0] - #this_db = trait_db[1] - genotype = self.dataset.group.read_genotype_file(use_reaper=True) + + genotype = self.dataset.group.read_genotype_file(use_reaper=False) samples, values, variances, sample_aliases = this_trait.export_informative() + if self.dataset.group.genofile != None: + genofile_name = self.dataset.group.genofile[:-5] + else: + genofile_name = self.dataset.group.name + trimmed_samples = [] trimmed_values = [] for i in range(0, len(samples)): @@ -130,14 +138,73 @@ class Heatmap(object): trimmed_samples.append(str(samples[i])) trimmed_values.append(values[i]) - reaper_results = genotype.regression(strains = trimmed_samples, - trait = trimmed_values) + trait_filename = str(this_trait.name) + "_" + str(self.dataset.name) + "_pheno" + gen_pheno_txt_file(trimmed_samples, trimmed_values, trait_filename) + + output_filename = self.dataset.group.name + "_GWA_" + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6)) + + reaper_command = REAPER_COMMAND + ' --geno {0}/{1}.geno --traits {2}/gn2/{3}.txt -n 1000 -o {4}{5}.txt'.format(flat_files('genotype'), + genofile_name, + TEMPDIR, + trait_filename, + webqtlConfig.GENERATED_IMAGE_DIR, + output_filename) + + os.system(reaper_command) + + reaper_results = parse_reaper_output(output_filename) - lrs_values = [float(qtl.lrs) for qtl in reaper_results] + lrs_values = [float(qtl['lrs_value']) for qtl in reaper_results] self.trait_results[this_trait.name] = [] for qtl in reaper_results: - if qtl.additive > 0: - self.trait_results[this_trait.name].append(-float(qtl.lrs)) + if qtl['additive'] > 0: + self.trait_results[this_trait.name].append(-float(qtl['lrs_value'])) else: - self.trait_results[this_trait.name].append(float(qtl.lrs)) + self.trait_results[this_trait.name].append(float(qtl['lrs_value'])) + +def gen_pheno_txt_file(samples, vals, filename): + """Generates phenotype file for GEMMA""" + + with open("{0}/gn2/{1}.txt".format(TEMPDIR, filename), "w") as outfile: + outfile.write("Trait\t") + + filtered_sample_list = [] + filtered_vals_list = [] + for i, sample in enumerate(samples): + if vals[i] != "x": + filtered_sample_list.append(sample) + filtered_vals_list.append(str(vals[i])) + + samples_string = "\t".join(filtered_sample_list) + outfile.write(samples_string + "\n") + outfile.write("T1\t") + values_string = "\t".join(filtered_vals_list) + outfile.write(values_string) + +def parse_reaper_output(gwa_filename): + included_markers = [] + p_values = [] + marker_obs = [] + + with open("{}{}.txt".format(webqtlConfig.GENERATED_IMAGE_DIR, gwa_filename)) as output_file: + for line in output_file: + if line.startswith("ID\t"): + continue + else: + marker = {} + marker['name'] = line.split("\t")[1] + try: + marker['chr'] = int(line.split("\t")[2]) + except: + marker['chr'] = line.split("\t")[2] + marker['cM'] = float(line.split("\t")[3]) + marker['Mb'] = float(line.split("\t")[4]) + if float(line.split("\t")[7]) != 1: + marker['p_value'] = float(line.split("\t")[7]) + marker['lrs_value'] = float(line.split("\t")[5]) + marker['lod_score'] = marker['lrs_value'] / 4.61 + marker['additive'] = float(line.split("\t")[6]) + marker_obs.append(marker) + + return marker_obs \ No newline at end of file diff --git a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py index bbc8b513..50e6bd7e 100644 --- a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py +++ b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py @@ -18,7 +18,7 @@ def run_reaper(this_trait, this_dataset, samples, vals, json_data, num_perm, boo genofile_name = this_dataset.group.name trait_filename = str(this_trait.name) + "_" + str(this_dataset.name) + "_pheno" - gen_pheno_txt_file(this_dataset, genofile_name, samples, vals, trait_filename) + gen_pheno_txt_file(samples, vals, trait_filename) output_filename = this_dataset.group.name + "_GWA_" + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6)) bootstrap_filename = None @@ -61,7 +61,7 @@ def run_reaper(this_trait, this_dataset, samples, vals, json_data, num_perm, boo return marker_obs, permu_vals, suggestive, significant, bootstrap_vals, [output_filename, permu_filename, bootstrap_filename] -def gen_pheno_txt_file(this_dataset, genofile_name, samples, vals, trait_filename): +def gen_pheno_txt_file(samples, vals, trait_filename): """Generates phenotype file for GEMMA""" with open("{}/gn2/{}.txt".format(TEMPDIR, trait_filename), "w") as outfile: diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 56d901fc..7c526f33 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -54,6 +54,11 @@ class RunMapping(object): self.temp_uuid = temp_uuid #needed to pass temp_uuid to gn1 mapping code (marker_regression_gn1.py) + #ZS: Needed to zoom in or remap temp traits like PCA traits + if "temp_trait" in start_vars: + self.temp_trait = "True" + self.group = self.dataset.group.name + self.json_data = {} self.json_data['lodnames'] = ['lod.hk'] diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 6531f5a0..492d4313 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -116,15 +116,15 @@ "B30_K_1206_M", "Barley1 Leaf MAS 5.0 SCRI (Dec06)" ], - [ - "126", - "B30_K_1206_Rn", - "Barley1 Leaf gcRMAn SCRI (Dec06)" - ], [ "125", "B30_K_1206_R", "Barley1 Leaf gcRMA SCRI (Dec06)" + ], + [ + "126", + "B30_K_1206_Rn", + "Barley1 Leaf gcRMAn SCRI (Dec06)" ] ], "Phenotypes": [ @@ -1622,15 +1622,15 @@ "NCI_Agil_Mam_Tum_RMA_0409", "NCI Mammary LMT miRNA v2 (Apr09) RMA" ], - [ - "37", - "MA_M_0704_R", - "NCI Mammary mRNA M430 (July04) RMA" - ], [ "36", "MA_M_0704_M", "NCI Mammary mRNA M430 (July04) MAS5" + ], + [ + "37", + "MA_M_0704_R", + "NCI Mammary mRNA M430 (July04) RMA" ] ] }, @@ -1697,15 +1697,15 @@ ] ], "Liver mRNA": [ - [ - "39", - "LVF2_M_0704_R", - "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) RMA" - ], [ "38", "LVF2_M_0704_M", "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) MAS5" + ], + [ + "39", + "LVF2_M_0704_R", + "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) RMA" ] ], "Phenotypes": [ @@ -1727,6 +1727,11 @@ }, "B6D2F2": { "Brain mRNA": [ + [ + "78", + "BRF2_M_0805_P", + "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) PDNN" + ], [ "77", "BRF2_M_0805_R", @@ -1737,25 +1742,20 @@ "BRF2_M_0805_M", "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) MAS5" ], - [ - "78", - "BRF2_M_0805_P", - "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) PDNN" - ], [ "33", "BRF2_M_0304_P", "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) PDNN" ], - [ - "32", - "BRF2_M_0304_R", - "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) RMA" - ], [ "31", "BRF2_M_0304_M", "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) MAS5" + ], + [ + "32", + "BRF2_M_0304_R", + "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) RMA" ] ], "Genotypes": [ @@ -1833,6 +1833,11 @@ ] ], "Striatum mRNA": [ + [ + "83", + "SA_M2_0905_M", + "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) MAS5" + ], [ "85", "SA_M2_0905_P", @@ -1842,11 +1847,6 @@ "84", "SA_M2_0905_R", "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) RMA" - ], - [ - "83", - "SA_M2_0905_M", - "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) MAS5" ] ] }, @@ -2121,16 +2121,16 @@ "IBR_M_0606_R", "INIA Brain mRNA M430 (Jun06) RMA" ], - [ - "102", - "IBR_M_0106_R", - "INIA Brain mRNA M430 (Jan06) RMA" - ], [ "101", "IBR_M_0106_P", "INIA Brain mRNA M430 (Jan06) PDNN" ], + [ + "102", + "IBR_M_0106_R", + "INIA Brain mRNA M430 (Jan06) RMA" + ], [ "95", "BR_U_1105_P", @@ -2550,16 +2550,16 @@ ] ], "Kidney mRNA": [ - [ - "239", - "MA_M2F_0706_R", - "Mouse kidney M430v2 Female (Aug06) RMA" - ], [ "240", "MA_M2M_0706_R", "Mouse kidney M430v2 Male (Aug06) RMA" ], + [ + "239", + "MA_M2F_0706_R", + "Mouse kidney M430v2 Female (Aug06) RMA" + ], [ "118", "MA_M2_0806_R", @@ -2570,28 +2570,28 @@ "MA_M2_0806_P", "Mouse Kidney M430v2 Sex Balanced (Aug06) PDNN" ], - [ - "116", - "MA_M2_0706_P", - "Mouse Kidney M430v2 (Jul06) PDNN" - ], [ "115", "MA_M2_0706_R", "Mouse Kidney M430v2 (Jul06) RMA" + ], + [ + "116", + "MA_M2_0706_P", + "Mouse Kidney M430v2 (Jul06) PDNN" ] ], "Liver Metabolome": [ - [ - "836", - "UTHSC-ETHZ-EPFL_LivPMetExtAHFD0817", - "UTHSC/ETHZ/EPFL BXD Liver Polar Metabolites Extraction, HFD Cohorts (Jul 2017) log2" - ], [ "835", "UTHSC-ETHZ-EPFL_LivPMetExtACD0817", "UTHSC/ETHZ/EPFL BXD Liver Polar Metabolites Extraction, Chow Diet Cohorts (Jul 2017) log2" ], + [ + "836", + "UTHSC-ETHZ-EPFL_LivPMetExtAHFD0817", + "UTHSC/ETHZ/EPFL BXD Liver Polar Metabolites Extraction, HFD Cohorts (Jul 2017) log2" + ], [ "473", "EPFL-LISP_LivPMetCDHFD1213", @@ -2844,16 +2844,16 @@ ] ], "Neocortex mRNA": [ - [ - "375", - "DevNeocortex_ILM6.2P14RInv_1111", - "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov11) RankInv" - ], [ "374", "DevNeocortex_ILM6.2P3RInv_1111", "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov11) RankInv" ], + [ + "375", + "DevNeocortex_ILM6.2P14RInv_1111", + "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov11) RankInv" + ], [ "284", "HQFNeoc_1210v2_RankInv", @@ -3109,6 +3109,11 @@ ] ], "Ventral Tegmental Area mRNA": [ + [ + "228", + "VCUSal_0609_R", + "VCU BXD VTA Sal M430 2.0 (Jun09) RMA" + ], [ "230", "VCUEtvsSal_0609_R", @@ -3118,11 +3123,6 @@ "229", "VCUEtOH_0609_R", "VCU BXD VTA EtOH M430 2.0 (Jun09) RMA" - ], - [ - "228", - "VCUSal_0609_R", - "VCU BXD VTA Sal M430 2.0 (Jun09) RMA" ] ] }, @@ -3264,7 +3264,7 @@ [ "808", "UCSD_CFW_HIP_RNA-Seq_0117", - "UCSD CFW Hippocampus (Jan17) RNA-Seq" + "UCSD CFW Hippocampus RNA-Seq (Jan17) FPKM Quantile" ] ], "Phenotypes": [ @@ -3462,15 +3462,15 @@ ] ], "Hippocampus mRNA": [ - [ - "100", - "HC_M2CB_1205_R", - "Hippocampus Consortium M430v2 CXB (Dec05) RMA" - ], [ "99", "HC_M2CB_1205_P", "Hippocampus Consortium M430v2 CXB (Dec05) PDNN" + ], + [ + "100", + "HC_M2CB_1205_R", + "Hippocampus Consortium M430v2 CXB (Dec05) RMA" ] ], "Liver mRNA": [ @@ -3674,15 +3674,15 @@ ] ], "Hippocampus mRNA": [ - [ - "273", - "UMUTAffyExon_0209_RMA_MDP", - "UMUTAffy Hippocampus Exon (Feb09) RMA MDP" - ], [ "272", "HC_M2_0606_MDP", "Hippocampus Consortium M430v2 (Jun06) RMA MDP" + ], + [ + "273", + "UMUTAffyExon_0209_RMA_MDP", + "UMUTAffy Hippocampus Exon (Feb09) RMA MDP" ] ], "Liver mRNA": [ diff --git a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js index d89264c6..a34394a1 100644 --- a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js +++ b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js @@ -42,23 +42,27 @@ $('#trait_table').dataTable( { } ); $('#collection_table').dataTable( { - "createdRow": function ( row, data, index ) { - if ($('td', row).eq(1).text().length > 40) { - $('td', row).eq(1).text($('td', row).eq(1).text().substring(0, 40)); - $('td', row).eq(1).text($('td', row).eq(1).text() + '...') - } - if ($('td', row).eq(3).text().length > 50) { - $('td', row).eq(3).text($('td', row).eq(3).text().substring(0, 50)); - $('td', row).eq(3).text($('td', row).eq(3).text() + '...') - } - }, - "order": [[0, "asc" ]], - "sDom": "ZRtr", - "iDisplayLength": -1, - "autoWidth": true, - "bSortClasses": false, - "paging": false, - "orderClasses": true + "createdRow": function ( row, data, index ) { + if ($('td', row).eq(2).text().length > 40) { + $('td', row).eq(2).text($('td', row).eq(2).text().substring(0, 40)); + $('td', row).eq(2).text($('td', row).eq(2).text() + '...') + } + if ($('td', row).eq(4).text().length > 50) { + $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 50)); + $('td', row).eq(4).text($('td', row).eq(4).text() + '...') + } + }, + "columnDefs": [ { + "targets": 0, + "orderable": false + } ], + "order": [[1, "asc" ]], + "sDom": "ZRtr", + "iDisplayLength": -1, + "autoWidth": true, + "bSortClasses": false, + "paging": false, + "orderClasses": true } ); collection_click = function() { @@ -364,37 +368,29 @@ color_by_trait = function(trait_sample_data, textStatus, jqXHR) { process_traits = function(trait_data, textStatus, jqXHR) { var the_html, trait, _i, _len; console.log('in process_traits with trait_data:', trait_data); - the_html = ""; - if ($('.corr_compute').length){ - the_html += " "; - } - if ($('#scatterplot2').length){ - the_html += " Please click the row of the trait you wish to select as a cofactor."; - } - the_html += "
    Species and GroupSpecies and Group {{ this_trait.dataset.group.species }}, {{ this_trait.dataset.group.name }}
    PhenotypePhenotype
    {{ this_trait.description_fmt }}
    AuthorsAuthors
    {{ this_trait.authors }}
    TitleTitle
    {{ this_trait.title }}
    JournalJournal {{ this_trait.journal }} ({% if this_trait.pubmed_id %}{{ this_trait.year }}{% else %}{{ this_trait.year }}{% endif %})
    TissueTissue {{ this_trait.dataset.tissue }}
    Gene SymbolGene Symbol {{ this_trait.symbol }}
    AliasesAliases Wikidata: {{ this_trait.wikidata_alias_fmt|replace(",",";") }}
    LocationLocation {{ this_trait.location_fmt }}
    DatabaseDatabase {{ dataset.fullname }} @@ -60,7 +60,7 @@
    Target ScoreTarget Score BLAT Specificity @@ -75,7 +75,7 @@ {% endif %} {% if this_trait.pubmed_id or this_trait.geneid or this_trait.omim or this_trait.symbol %}
    Resource LinksResource Links {% if pubmed_link %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 7b585b03..aa64a910 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -639,7 +639,8 @@ def mapping_results_page(): 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno', 'temp_trait', - 'reaper_version' + 'reaper_version', + 'num_vals' ) start_vars = {} for key, value in initial_start_vars.iteritems(): @@ -670,8 +671,8 @@ def mapping_results_page(): if template_vars.no_results: rendered_template = render_template("mapping_error.html") else: - if template_vars.mapping_method != "gemma" and template_vars.mapping_method != "plink": - template_vars.js_data = json.dumps(template_vars.js_data, + #if template_vars.mapping_method != "gemma" and template_vars.mapping_method != "plink": + template_vars.js_data = json.dumps(template_vars.js_data, default=json_default_handler, indent=" ") @@ -808,6 +809,17 @@ def get_temp_data(): temp_uuid = request.args['key'] return flask.jsonify(temp_data.TempData(temp_uuid).get_all()) +@app.route("/browser_input", methods=('GET',)) +def browser_inputs(): + """ Returns JSON from tmp directory for the purescript genome browser""" + + filename = request.args['filename'] + + with open("{}/gn2/".format(TEMPDIR) + filename + ".json", "r") as the_file: + file_contents = json.load(the_file) + + return flask.jsonify(file_contents) + ########################################################################## def json_default_handler(obj): -- cgit v1.2.3 From eb710ee13c5c1d138a75c5689ae7158b8a8f40cb Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 7 Aug 2019 14:55:30 -0500 Subject: Fixed issue with non-LOCO GEMMA mapping --- wqflask/wqflask/marker_regression/gemma_mapping.py | 35 +++---------- wqflask/wqflask/views.py | 60 +++++++++++----------- 2 files changed, 37 insertions(+), 58 deletions(-) diff --git a/wqflask/wqflask/marker_regression/gemma_mapping.py b/wqflask/wqflask/marker_regression/gemma_mapping.py index 895d4ac6..1d9bbb43 100644 --- a/wqflask/wqflask/marker_regression/gemma_mapping.py +++ b/wqflask/wqflask/marker_regression/gemma_mapping.py @@ -73,14 +73,6 @@ def run_gemma(this_trait, this_dataset, samples, vals, covariates, use_loco, maf gwa_output_filename) else: - # generate_k_command = GEMMA_COMMAND + ' ' + GEMMAOPTS + ' -g %s/%s_geno.txt -p %s/gn2/%s.txt -a %s/%s_snps.txt -gk -outdir %s/gn2/ -o %s' % (flat_files('genotype/bimbam'), - # genofile_name, - # TEMPDIR, - # trait_filename, - # flat_files('genotype/bimbam'), - # genofile_name, - # TEMPDIR, - # k_output_filename) generate_k_command = GEMMA_WRAPPER_COMMAND + ' --json -- ' + GEMMAOPTS + ' -g %s/%s_geno.txt -p %s/gn2/%s.txt -a %s/%s_snps.txt -gk > %s/gn2/%s.json' % (flat_files('genotype/bimbam'), genofile_name, TEMPDIR, @@ -93,31 +85,18 @@ def run_gemma(this_trait, this_dataset, samples, vals, covariates, use_loco, maf logger.debug("k_command:" + generate_k_command) os.system(generate_k_command) - # gemma_command = GEMMA_COMMAND + ' ' + GEMMAOPTS + ' -g %s/%s_geno.txt -p %s/gn2/%s.txt -a %s/%s_snps.txt -k %s/gn2/%s.cXX.txt -lmm 2 -maf %s' % (flat_files('genotype/bimbam'), - # genofile_name, - # TEMPDIR, - # trait_filename, - # flat_files('genotype/bimbam'), - # genofile_name, - # TEMPDIR, - # k_output_filename, - # maf) - - gemma_command = GEMMA_WRAPPER_COMMAND + ' --json --input %s/gn2/%s.json -- ' % (TEMPDIR, k_output_filename) + GEMMAOPTS + ' -lmm 2 -g %s/%s_geno.txt -p %s/gn2/%s.txt' % (flat_files('genotype/bimbam'), + gemma_command = GEMMA_WRAPPER_COMMAND + ' --json --input %s/gn2/%s.json -- ' % (TEMPDIR, k_output_filename) + GEMMAOPTS + ' -a %s/%s_snps.txt -lmm 2 -g %s/%s_geno.txt -p %s/gn2/%s.txt' % (flat_files('genotype/bimbam'), + genofile_name, + flat_files('genotype/bimbam'), genofile_name, TEMPDIR, trait_filename) if covariates != "": - gemma_command += ' -c %s/%s_covariates.txt' % (flat_files('mapping'), this_dataset.group.name) - # gemma_command += ' -c %s/%s_covariates.txt -outdir %s -o %s_output' % (flat_files('mapping'), - # this_dataset.group.name, - # webqtlConfig.GENERATED_IMAGE_DIR, - # genofile_name) - # else: - # gemma_command += ' -outdir %s -o %s_output' % (webqtlConfig.GENERATED_IMAGE_DIR, - # genofile_name) + gemma_command += ' -c %s/%s_covariates.txt > %s/gn2/%s.json' % (flat_files('mapping'), this_dataset.group.name, TEMPDIR, gwa_output_filename) + else: + gemma_command += ' > %s/gn2/%s.json' % (TEMPDIR, gwa_output_filename) logger.debug("gemma_command:" + gemma_command) @@ -127,7 +106,7 @@ def run_gemma(this_trait, this_dataset, samples, vals, covariates, use_loco, maf marker_obs = parse_loco_output(this_dataset, gwa_output_filename) return marker_obs, gwa_output_filename else: - marker_obs = parse_gemma_output(genofile_name) + marker_obs = parse_loco_output(this_dataset, gwa_output_filename) return marker_obs def gen_pheno_txt_file(this_dataset, genofile_name, vals, trait_filename): diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index aa64a910..fbcaefc1 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -671,36 +671,36 @@ def mapping_results_page(): if template_vars.no_results: rendered_template = render_template("mapping_error.html") else: - #if template_vars.mapping_method != "gemma" and template_vars.mapping_method != "plink": - template_vars.js_data = json.dumps(template_vars.js_data, - default=json_default_handler, - indent=" ") - - result = template_vars.__dict__ - - if result['pair_scan']: - with Bench("Rendering template"): - img_path = result['pair_scan_filename'] - logger.info("img_path:", img_path) - initial_start_vars = request.form - logger.info("initial_start_vars:", initial_start_vars) - imgfile = open(TEMPDIR + img_path, 'rb') - imgdata = imgfile.read() - imgB64 = imgdata.encode("base64") - bytesarray = array.array('B', imgB64) - result['pair_scan_array'] = bytesarray - rendered_template = render_template("pair_scan_results.html", **result) - else: - gn1_template_vars = display_mapping_results.DisplayMappingResults(result).__dict__ - #pickled_result = pickle.dumps(result, pickle.HIGHEST_PROTOCOL) - #logger.info("pickled result length:", len(pickled_result)) - #Redis.set(key, pickled_result) - #Redis.expire(key, 1*60) - - with Bench("Rendering template"): - if (gn1_template_vars['mapping_method'] == "gemma") or (gn1_template_vars['mapping_method'] == "plink"): - gn1_template_vars.pop('qtlresults', None) - rendered_template = render_template("mapping_results.html", **gn1_template_vars) + #if template_vars.mapping_method != "gemma" and template_vars.mapping_method != "plink": + template_vars.js_data = json.dumps(template_vars.js_data, + default=json_default_handler, + indent=" ") + + result = template_vars.__dict__ + + if result['pair_scan']: + with Bench("Rendering template"): + img_path = result['pair_scan_filename'] + logger.info("img_path:", img_path) + initial_start_vars = request.form + logger.info("initial_start_vars:", initial_start_vars) + imgfile = open(TEMPDIR + img_path, 'rb') + imgdata = imgfile.read() + imgB64 = imgdata.encode("base64") + bytesarray = array.array('B', imgB64) + result['pair_scan_array'] = bytesarray + rendered_template = render_template("pair_scan_results.html", **result) + else: + gn1_template_vars = display_mapping_results.DisplayMappingResults(result).__dict__ + #pickled_result = pickle.dumps(result, pickle.HIGHEST_PROTOCOL) + #logger.info("pickled result length:", len(pickled_result)) + #Redis.set(key, pickled_result) + #Redis.expire(key, 1*60) + + with Bench("Rendering template"): + if (gn1_template_vars['mapping_method'] == "gemma") or (gn1_template_vars['mapping_method'] == "plink"): + gn1_template_vars.pop('qtlresults', None) + rendered_template = render_template("mapping_results.html", **gn1_template_vars) return rendered_template -- cgit v1.2.3 From 183997c17e7572d69227aacde15408e8577073e1 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 7 Aug 2019 14:57:48 -0500 Subject: Added Christian's genome browser, but still need to clean things up a bunch since now it has to create two separate marker lists --- .../static/new/javascript/init_genome_browser.js | 73 +++ .../css/purescript_genetics_browser_v01.css | 1 + .../js/purescript-genetics-browser_v01.js | 659 +++++++++++++++++++++ 3 files changed, 733 insertions(+) create mode 100644 wqflask/wqflask/static/new/javascript/init_genome_browser.js create mode 100644 wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript_genetics_browser_v01.css create mode 100644 wqflask/wqflask/static/packages/purescript_genome_browser/js/purescript-genetics-browser_v01.js diff --git a/wqflask/wqflask/static/new/javascript/init_genome_browser.js b/wqflask/wqflask/static/new/javascript/init_genome_browser.js new file mode 100644 index 00000000..64a300bc --- /dev/null +++ b/wqflask/wqflask/static/new/javascript/init_genome_browser.js @@ -0,0 +1,73 @@ +console.log("THE FILES:", js_data.browser_files) + +snps_filename = "/browser_input?filename=" + js_data.browser_files[0] +annot_filename = "/browser_input?filename=" + js_data.browser_files[1] + +localUrls = +{ + snps: snps_filename, + annotations: null +}; + +var vscaleWidth = 90.0; +var legendWidth = 140.0; +var score = { min: 0.0, max: 30.0, sig: 4 }; +var gwasPadding = { top: 35.0, + bottom: 35.0, + left: vscaleWidth, + right: legendWidth }; +var gwasHeight = 420.0; +var genePadding = { top: 10.0, + bottom: 35.0, + left: vscaleWidth, + right: legendWidth }; +var geneHeight = 140.0; + + +var config = +{ trackHeight: 400.0, + padding: gwasPadding, + score: score, + urls: localUrls, + tracks: { + gwas: { + trackHeight: gwasHeight, + padding: gwasPadding, + snps: { + radius: 3.75, + lineWidth: 1.0, + color: { outline: "#FFFFFF", + fill: "#00008B" }, + pixelOffset: {x: 0.0, y: 0.0} + }, + annotations: { + radius: 5.5, + outline: "#000000", + snpColor: "#0074D9", + geneColor: "#FF4136" + }, + score: score, + legend: { + fontSize: 14, + hPad: 0.2, + vPad: 0.2 + }, + vscale: { + color: "#000000", + hPad: 0.125, + numSteps: 3, + fonts: { labelSize: 18, scaleSize: 16 } + }, + } + }, + chrs: { + chrBG1: "#FFFFFF", + chrBG2: "#DDDDDD", + chrLabels: { fontSize: 16 }, + }, + initialChrs: { left: "1", right: "19" } +}; + +GenomeBrowser.main(config)(); + +document.getElementById("controls").style.visibility = "visible"; \ No newline at end of file diff --git a/wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript_genetics_browser_v01.css b/wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript_genetics_browser_v01.css new file mode 100644 index 00000000..135292ac --- /dev/null +++ b/wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript_genetics_browser_v01.css @@ -0,0 +1 @@ +body,html{max-width:100%;overflow-x:hidden}#browser{position:absolute;margin:0}#info-line{border:1px solid #aaa;padding:2px;position:absolute;right:0;top:1px;min-width:14%;font-size:9pt}#controls{visibility:hidden;position:absolute;top:4px;left:100px;z-index:1000}#controls>button{border:1px solid #aaa;border-radius:2px;padding-left:6px;padding-right:6px;height:23px;min-width:20px}button#scrollRight,button#zoomIn{margin-left:-2px;margin-right:4px}#infoBox{position:absolute;display:inline-block;z-index:10000;visibility:hidden;padding:5px;border:2px solid grey;border-radius:5%;background-color:#fff;min-height:100px;min-width:10px;max-width:80%;margin-top:9.7em;font-family:sans-serif}#infoBox>div{float:left;margin:1em 1.2em}#infoBox>div>p{margin:.1em} \ No newline at end of file diff --git a/wqflask/wqflask/static/packages/purescript_genome_browser/js/purescript-genetics-browser_v01.js b/wqflask/wqflask/static/packages/purescript_genome_browser/js/purescript-genetics-browser_v01.js new file mode 100644 index 00000000..acd590a5 --- /dev/null +++ b/wqflask/wqflask/static/packages/purescript_genome_browser/js/purescript-genetics-browser_v01.js @@ -0,0 +1,659 @@ +parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c="0"&&r[u]<="9"?"\\&":"";return"\\"+n.charCodeAt(0).toString(10)+c})+'"'},exports.showArrayImpl=function(r){return function(t){for(var n=[],e=0,u=t.length;er?-1:1,e=new Array(t*(r-n)+1),u=n,o=0;u!==r;)e[o++]=u,u+=t;return e[o]=u,e}};var n=function(n){return function(r){return n<1?[]:new Array(n).fill(r)}},r=function(n){return function(r){for(var t=[],e=0,u=0;u=t.length?r:n(t[e])}}}},exports.findIndexImpl=function(n){return function(r){return function(t){return function(e){for(var u=0,o=e.length;u=0;u--)if(t(e[u]))return n(u);return r}}}},exports._insertAt=function(n){return function(r){return function(t){return function(e){return function(u){if(t<0||t>u.length)return r;var o=u.slice();return o.splice(t,0,e),n(o)}}}}},exports._deleteAt=function(n){return function(r){return function(t){return function(e){if(t<0||t>=e.length)return r;var u=e.slice();return u.splice(t,1),n(u)}}}},exports._updateAt=function(n){return function(r){return function(t){return function(e){return function(u){if(t<0||t>=u.length)return r;var o=u.slice();return o[t]=e,n(o)}}}}},exports.reverse=function(n){return n.slice().reverse()},exports.concat=function(n){if(n.length<=1e4)return Array.prototype.concat.apply([],n);for(var r=[],t=0,e=n.length;t=0;o--)u=r(t[o])(u);return u}}},exports.foldlArray=function(r){return function(n){return function(t){for(var u=n,o=t.length,e=0;eu?-1:1}}}; +},{}],"5Eun":[function(require,module,exports) { +"use strict";var n=require("../Data.Eq/index.js"),e=require("../Data.Semigroup/index.js"),r=require("../Data.Show/index.js"),t=function(){function n(){}return n.value=new n,n}(),i=function(){function n(){}return n.value=new n,n}(),o=function(){function n(){}return n.value=new n,n}(),u=new r.Show(function(n){if(n instanceof t)return"LT";if(n instanceof i)return"GT";if(n instanceof o)return"EQ";throw new Error("Failed pattern match at Data.Ordering (line 26, column 1 - line 29, column 17): "+[n.constructor.name])}),a=new e.Semigroup(function(n){return function(e){if(n instanceof t)return t.value;if(n instanceof i)return i.value;if(n instanceof o)return e;throw new Error("Failed pattern match at Data.Ordering (line 21, column 1 - line 24, column 18): "+[n.constructor.name,e.constructor.name])}}),c=function(n){if(n instanceof i)return t.value;if(n instanceof o)return o.value;if(n instanceof t)return i.value;throw new Error("Failed pattern match at Data.Ordering (line 33, column 1 - line 33, column 31): "+[n.constructor.name])},f=new n.Eq(function(n){return function(e){return n instanceof t&&e instanceof t||(n instanceof i&&e instanceof i||n instanceof o&&e instanceof o)}});module.exports={LT:t,GT:i,EQ:o,invert:c,eqOrdering:f,semigroupOrdering:a,showOrdering:u}; +},{"../Data.Eq/index.js":"Pq4F","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7"}],"+BUG":[function(require,module,exports) { +"use strict";exports.intSub=function(n){return function(t){return n-t|0}},exports.numSub=function(n){return function(t){return n-t}}; +},{}],"Vm8y":[function(require,module,exports) { +"use strict";exports.intAdd=function(n){return function(t){return n+t|0}},exports.intMul=function(n){return function(t){return n*t|0}},exports.numAdd=function(n){return function(t){return n+t}},exports.numMul=function(n){return function(t){return n*t}}; +},{}],"11NF":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),r=require("../Data.Symbol/index.js"),e=require("../Data.Unit/index.js"),u=require("../Record.Unsafe/index.js"),t=require("../Type.Data.Row/index.js"),o=require("../Type.Data.RowList/index.js"),i=function(n,r,e,u){this.addRecord=n,this.mulRecord=r,this.oneRecord=e,this.zeroRecord=u},c=function(n,r,e,u){this.add=n,this.mul=r,this.one=e,this.zero=u},f=function(n){return n.zeroRecord},a=function(n){return n.zero},d=new c(function(n){return function(n){return e.unit}},function(n){return function(n){return e.unit}},e.unit,e.unit),l=new i(function(n){return function(n){return function(n){return{}}}},function(n){return function(n){return function(n){return{}}}},function(n){return function(n){return{}}},function(n){return function(n){return{}}}),s=new c(n.numAdd,n.numMul,1,0),R=new c(n.intAdd,n.intMul,1,0),m=function(n){return n.oneRecord},y=function(n){return n.one},x=function(n){return n.mulRecord},v=function(n){return n.mul},P=function(n){return n.addRecord},S=function(n){return function(n){return new c(P(n)(o.RLProxy.value),x(n)(o.RLProxy.value),m(n)(o.RLProxy.value)(t.RProxy.value),f(n)(o.RLProxy.value)(t.RProxy.value))}},g=function(n){return n.add},w=function(n){return new c(function(r){return function(e){return function(u){return g(n)(r(u))(e(u))}}},function(r){return function(e){return function(u){return v(n)(r(u))(e(u))}}},function(r){return y(n)},function(r){return a(n)})},L=function(n){return function(e){return function(e){return function(c){return new i(function(t){return function(t){return function(i){var f=P(e)(o.RLProxy.value)(t)(i),a=r.reflectSymbol(n)(r.SProxy.value),d=u.unsafeSet(a),l=u.unsafeGet(a);return d(g(c)(l(t))(l(i)))(f)}}},function(t){return function(t){return function(i){var f=x(e)(o.RLProxy.value)(t)(i),a=r.reflectSymbol(n)(r.SProxy.value),d=u.unsafeSet(a),l=u.unsafeGet(a);return d(v(c)(l(t))(l(i)))(f)}}},function(i){return function(i){var f=m(e)(o.RLProxy.value)(t.RProxy.value),a=r.reflectSymbol(n)(r.SProxy.value);return u.unsafeSet(a)(y(c))(f)}},function(i){return function(i){var d=f(e)(o.RLProxy.value)(t.RProxy.value),l=r.reflectSymbol(n)(r.SProxy.value);return u.unsafeSet(l)(a(c))(d)}})}}}};module.exports={Semiring:c,add:g,zero:a,mul:v,one:y,SemiringRecord:i,addRecord:P,mulRecord:x,oneRecord:m,zeroRecord:f,semiringInt:R,semiringNumber:s,semiringFn:w,semiringUnit:d,semiringRecord:S,semiringRecordNil:l,semiringRecordCons:L}; +},{"./foreign.js":"Vm8y","../Data.Symbol/index.js":"4oJQ","../Data.Unit/index.js":"NhVk","../Record.Unsafe/index.js":"KG04","../Type.Data.Row/index.js":"ukdD","../Type.Data.RowList/index.js":"XaXP"}],"E2qH":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),r=require("../Data.Semiring/index.js"),e=require("../Data.Symbol/index.js"),i=require("../Data.Unit/index.js"),u=require("../Record.Unsafe/index.js"),t=require("../Type.Data.RowList/index.js"),o=function(n,r){this.SemiringRecord0=n,this.subRecord=r},c=function(n,r){this.Semiring0=n,this.sub=r},f=function(n){return n.subRecord},s=function(n){return n.sub},g=new c(function(){return r.semiringUnit},function(n){return function(n){return i.unit}}),m=new o(function(){return r.semiringRecordNil},function(n){return function(n){return function(n){return{}}}}),d=function(n){return function(i){return function(c){return function(g){return new o(function(){return r.semiringRecordCons(n)(i)(c.SemiringRecord0())(g.Semiring0())},function(r){return function(r){return function(i){var o=f(c)(t.RLProxy.value)(r)(i),m=e.reflectSymbol(n)(e.SProxy.value),d=u.unsafeSet(m),R=u.unsafeGet(m);return d(s(g)(R(r))(R(i)))(o)}}})}}}},R=function(n){return function(e){return new c(function(){return r.semiringRecord(n)(e.SemiringRecord0())},f(e)(t.RLProxy.value))}},a=new c(function(){return r.semiringNumber},n.numSub),S=new c(function(){return r.semiringInt},n.intSub),b=function(n){return new c(function(){return r.semiringFn(n.Semiring0())},function(r){return function(e){return function(i){return s(n)(r(i))(e(i))}}})},l=function(n){return function(e){return s(n)(r.zero(n.Semiring0()))(e)}};module.exports={Ring:c,sub:s,negate:l,RingRecord:o,subRecord:f,ringInt:S,ringNumber:a,ringUnit:g,ringFn:b,ringRecord:R,ringRecordNil:m,ringRecordCons:d}; +},{"./foreign.js":"+BUG","../Data.Semiring/index.js":"11NF","../Data.Symbol/index.js":"4oJQ","../Data.Unit/index.js":"NhVk","../Record.Unsafe/index.js":"KG04","../Type.Data.RowList/index.js":"XaXP"}],"r4Vb":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),r=require("../Data.Eq/index.js"),e=require("../Data.Ordering/index.js"),t=require("../Data.Ring/index.js"),u=require("../Data.Semiring/index.js"),o=require("../Data.Symbol/index.js"),i=require("../Record.Unsafe/index.js"),c=require("../Type.Data.RowList/index.js"),a=function(n,r){this.EqRecord0=n,this.compareRecord=r},f=function(n,r){this.Eq10=n,this.compare1=r},l=function(n,r){this.Eq0=n,this.compare=r},s=new l(function(){return r.eqVoid},function(n){return function(n){return e.EQ.value}}),d=new l(function(){return r.eqUnit},function(n){return function(n){return e.EQ.value}}),m=new l(function(){return r.eqString},n.ordStringImpl(e.LT.value)(e.EQ.value)(e.GT.value)),T=new a(function(){return r.eqRowNil},function(n){return function(n){return function(n){return e.EQ.value}}}),v=new l(function(){return e.eqOrdering},function(n){return function(r){if(n instanceof e.LT&&r instanceof e.LT)return e.EQ.value;if(n instanceof e.EQ&&r instanceof e.EQ)return e.EQ.value;if(n instanceof e.GT&&r instanceof e.GT)return e.EQ.value;if(n instanceof e.LT)return e.LT.value;if(n instanceof e.EQ&&r instanceof e.LT)return e.GT.value;if(n instanceof e.EQ&&r instanceof e.GT)return e.LT.value;if(n instanceof e.GT)return e.GT.value;throw new Error("Failed pattern match at Data.Ord (line 112, column 1 - line 119, column 21): "+[n.constructor.name,r.constructor.name])}}),E=new l(function(){return r.eqNumber},n.ordNumberImpl(e.LT.value)(e.EQ.value)(e.GT.value)),q=new l(function(){return r.eqInt},n.ordIntImpl(e.LT.value)(e.EQ.value)(e.GT.value)),w=new l(function(){return r.eqChar},n.ordCharImpl(e.LT.value)(e.EQ.value)(e.GT.value)),p=new l(function(){return r.eqBoolean},n.ordBooleanImpl(e.LT.value)(e.EQ.value)(e.GT.value)),h=function(n){return n.compareRecord},g=function(n){return function(e){return new l(function(){return r.eqRec(n)(e.EqRecord0())},h(e)(c.RLProxy.value))}},L=function(n){return n.compare1},Q=function(n){return n.compare},G=function(n){return function(r){return function(e){return function(t){return Q(n)(r(e))(r(t))}}}},R=function(n){return function(r){return function(t){return Q(n)(r)(t)instanceof e.GT}}},O=function(n){return function(r){return function(t){return!(Q(n)(r)(t)instanceof e.LT)}}},x=function(n){return function(r){return function(e){return O(n)(e)(u.zero(r.Semiring0()))?u.one(r.Semiring0()):t.negate(r)(u.one(r.Semiring0()))}}},y=function(n){return function(r){return function(t){return Q(n)(r)(t)instanceof e.LT}}},S=function(n){return function(r){return function(t){return!(Q(n)(r)(t)instanceof e.GT)}}},D=function(n){return function(r){return function(t){var u=Q(n)(r)(t);if(u instanceof e.LT)return t;if(u instanceof e.EQ)return r;if(u instanceof e.GT)return r;throw new Error("Failed pattern match at Data.Ord (line 167, column 3 - line 170, column 12): "+[u.constructor.name])}}},I=function(n){return function(r){return function(t){var u=Q(n)(r)(t);if(u instanceof e.LT)return r;if(u instanceof e.EQ)return r;if(u instanceof e.GT)return t;throw new Error("Failed pattern match at Data.Ord (line 158, column 3 - line 161, column 12): "+[u.constructor.name])}}},j=function(t){return new l(function(){return r.eqArray(t.Eq0())},(u=function(n){return function(r){var u=Q(t)(n)(r);if(u instanceof e.EQ)return 0;if(u instanceof e.LT)return 1;if(u instanceof e.GT)return-1;throw new Error("Failed pattern match at Data.Ord (line 65, column 7 - line 68, column 17): "+[u.constructor.name])}},function(r){return function(e){return Q(q)(0)(n.ordArrayImpl(u)(r)(e))}}));var u},b=new f(function(){return r.eq1Array},function(n){return Q(j(n))}),A=function(n){return function(t){return function(u){return function(f){return new a(function(){return r.eqRowCons(n.EqRecord0())(t)(u)(f.Eq0())},function(t){return function(t){return function(a){var l=o.reflectSymbol(u)(o.SProxy.value),s=Q(f)(i.unsafeGet(l)(t))(i.unsafeGet(l)(a));return r.notEq(e.eqOrdering)(s)(e.EQ.value)?s:h(n)(c.RLProxy.value)(t)(a)}}})}}}},C=function(n){return function(r){return function(e){return function(t){return I(n)(e)(D(n)(r)(t))}}}},N=function(n){return function(r){return function(e){return function(t){return!y(n)(t)(r)&&!R(n)(t)(e)}}}},F=function(n){return function(r){return function(e){return O(n)(e)(u.zero(r.Semiring0()))?e:t.negate(r)(e)}}};module.exports={Ord:l,compare:Q,Ord1:f,compare1:L,lessThan:y,lessThanOrEq:S,greaterThan:R,greaterThanOrEq:O,comparing:G,min:I,max:D,clamp:C,between:N,abs:F,signum:x,OrdRecord:a,compareRecord:h,ordBoolean:p,ordInt:q,ordNumber:E,ordString:m,ordChar:w,ordUnit:d,ordVoid:s,ordArray:j,ordOrdering:v,ord1Array:b,ordRecordNil:T,ordRecordCons:A,ordRecord:g}; +},{"./foreign.js":"m7Aq","../Data.Eq/index.js":"Pq4F","../Data.Ordering/index.js":"5Eun","../Data.Ring/index.js":"E2qH","../Data.Semiring/index.js":"11NF","../Data.Symbol/index.js":"4oJQ","../Record.Unsafe/index.js":"KG04","../Type.Data.RowList/index.js":"XaXP"}],"kcUU":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),t=require("../Data.Ord/index.js"),r=require("../Data.Ordering/index.js"),e=require("../Data.Unit/index.js"),o=function(n,t,r){this.Ord0=n,this.bottom=t,this.top=r},u=function(n){return n.top},d=new o(function(){return t.ordUnit},e.unit,e.unit),i=new o(function(){return t.ordOrdering},r.LT.value,r.GT.value),b=new o(function(){return t.ordNumber},n.bottomNumber,n.topNumber),a=new o(function(){return t.ordInt},n.bottomInt,n.topInt),m=new o(function(){return t.ordChar},n.bottomChar,n.topChar),c=new o(function(){return t.ordBoolean},!1,!0),f=function(n){return n.bottom};module.exports={Bounded:o,bottom:f,top:u,boundedBoolean:c,boundedInt:a,boundedChar:m,boundedOrdering:i,boundedUnit:d,boundedNumber:b}; +},{"./foreign.js":"0C+G","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Unit/index.js":"NhVk"}],"AXkC":[function(require,module,exports) { +"use strict";var n=require("../Data.Functor/index.js"),r=function(n){this.imap=n},t=new r(function(n){return function(r){return function(r){return n(r)}}}),i=new r(function(n){return function(r){return function(t){return function(i){return n(t(r(i)))}}}}),u=new r(function(n){return function(r){return function(r){return n(r)}}}),e=new r(function(n){return function(r){return function(r){return n(r)}}}),o=new r(function(n){return function(r){return function(r){return n(r)}}}),a=new r(function(n){return function(r){return function(r){return n(r)}}}),c=function(r){return function(t){return function(i){return n.map(r)(t)}}},f=new r(c(n.functorArray)),v=new r(c(n.functorFn)),w=function(n){return n.imap};module.exports={imap:w,Invariant:r,imapF:c,invariantFn:v,invariantArray:f,invariantAdditive:a,invariantConj:o,invariantDisj:e,invariantDual:u,invariantEndo:i,invariantMultiplicative:t}; +},{"../Data.Functor/index.js":"+0AE"}],"8EBw":[function(require,module,exports) { +"use strict";exports.intDegree=function(t){return Math.min(Math.abs(t),2147483647)},exports.intDiv=function(t){return function(n){return 0===n?0:n>0?Math.floor(t/n):-Math.floor(t/-n)}},exports.intMod=function(t){return function(n){if(0===n)return 0;var r=Math.abs(n);return(t%r+r)%r}},exports.numDiv=function(t){return function(n){return t/n}}; +},{}],"60TQ":[function(require,module,exports) { +"use strict";var n=require("../Data.Ring/index.js"),t=function(n){this.RingRecord0=n},i=function(n){this.Ring0=n},r=new i(function(){return n.ringUnit}),e=new t(function(){return n.ringRecordNil}),u=function(i){return function(r){return function(e){return function(u){return new t(function(){return n.ringRecordCons(i)(r)(e.RingRecord0())(u.Ring0())})}}}},o=function(t){return function(r){return new i(function(){return n.ringRecord(t)(r.RingRecord0())})}},c=new i(function(){return n.ringNumber}),R=new i(function(){return n.ringInt}),g=function(t){return new i(function(){return n.ringFn(t.Ring0())})};module.exports={CommutativeRing:i,CommutativeRingRecord:t,commutativeRingInt:R,commutativeRingNumber:c,commutativeRingUnit:r,commutativeRingFn:g,commutativeRingRecord:o,commutativeRingRecordNil:e,commutativeRingRecordCons:u}; +},{"../Data.Ring/index.js":"E2qH"}],"2IRB":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),i=require("../Data.CommutativeRing/index.js"),e=require("../Data.Eq/index.js"),t=require("../Data.Semiring/index.js"),r=function(n,i,e,t){this.CommutativeRing0=n,this.degree=i,this.div=e,this.mod=t},u=function(n){return n.mod},o=function(n){return function(i){return function(r){return function(o){var m,g=n,c=i,f=r,a=!1;function d(n,i,r,m){if(e.eq(n)(m)(t.zero(i.CommutativeRing0().Ring0().Semiring0())))return a=!0,r;g=n,c=i,f=m,o=u(i)(r)(m)}for(;!a;)m=d(g,c,f,o);return m}}}},m=new r(function(){return i.commutativeRingNumber},function(n){return 1},n.numDiv,function(n){return function(n){return 0}}),g=new r(function(){return i.commutativeRingInt},n.intDegree,n.intDiv,n.intMod),c=function(n){return n.div},f=function(n){return function(i){return function(r){return function(u){return e.eq(n)(r)(t.zero(i.CommutativeRing0().Ring0().Semiring0()))||e.eq(n)(u)(t.zero(i.CommutativeRing0().Ring0().Semiring0()))?t.zero(i.CommutativeRing0().Ring0().Semiring0()):c(i)(t.mul(i.CommutativeRing0().Ring0().Semiring0())(r)(u))(o(n)(i)(r)(u))}}}},a=function(n){return n.degree};module.exports={EuclideanRing:r,degree:a,div:c,mod:u,gcd:o,lcm:f,euclideanRingInt:g,euclideanRingNumber:m}; +},{"./foreign.js":"8EBw","../Data.CommutativeRing/index.js":"60TQ","../Data.Eq/index.js":"Pq4F","../Data.Semiring/index.js":"11NF"}],"TiEB":[function(require,module,exports) { +"use strict";var n=require("../Data.Boolean/index.js"),r=require("../Data.EuclideanRing/index.js"),e=require("../Data.Ordering/index.js"),i=require("../Data.Semigroup/index.js"),o=require("../Data.Symbol/index.js"),t=require("../Data.Unit/index.js"),u=require("../Record.Unsafe/index.js"),c=require("../Type.Data.RowList/index.js"),d=function(n,r){this.SemigroupRecord0=n,this.memptyRecord=r},m=function(n,r){this.Semigroup0=n,this.mempty=r},a=new m(function(){return i.semigroupUnit},t.unit),f=new m(function(){return i.semigroupString},""),p=new d(function(){return i.semigroupRecordNil},function(n){return{}}),s=new m(function(){return e.semigroupOrdering},e.EQ.value),g=new m(function(){return i.semigroupArray},[]),l=function(n){return n.memptyRecord},R=function(n){return function(r){return new m(function(){return i.semigroupRecord(n)(r.SemigroupRecord0())},l(r)(c.RLProxy.value))}},S=function(n){return n.mempty},w=function(n){return new m(function(){return i.semigroupFn(n.Semigroup0())},function(r){return S(n)})},y=function(n){return function(r){return function(e){return function(t){return new d(function(){return i.semigroupRecordCons(n)(e)(t.SemigroupRecord0())(r.Semigroup0())},function(e){var i=l(t)(c.RLProxy.value),d=o.reflectSymbol(n)(o.SProxy.value);return u.unsafeSet(d)(S(r))(i)})}}}},x=function(e){return function(o){return function t(u){if(u<=0)return S(e);if(1===u)return o;if(0===r.mod(r.euclideanRingInt)(u)(2)){var c=t(r.div(r.euclideanRingInt)(u)(2));return i.append(e.Semigroup0())(c)(c)}if(n.otherwise)return c=t(r.div(r.euclideanRingInt)(u)(2)),i.append(e.Semigroup0())(c)(i.append(e.Semigroup0())(c)(o));throw new Error("Failed pattern match at Data.Monoid (line 65, column 3 - line 65, column 17): "+[u.constructor.name])}}},h=function(n){return function(r){return function(e){if(r)return e;if(!r)return S(n);throw new Error("Failed pattern match at Data.Monoid (line 73, column 1 - line 73, column 49): "+[r.constructor.name,e.constructor.name])}}};module.exports={Monoid:m,mempty:S,power:x,guard:h,MonoidRecord:d,memptyRecord:l,monoidUnit:a,monoidOrdering:s,monoidFn:w,monoidString:f,monoidArray:g,monoidRecord:R,monoidRecordNil:p,monoidRecordCons:y}; +},{"../Data.Boolean/index.js":"ObQr","../Data.EuclideanRing/index.js":"2IRB","../Data.Ordering/index.js":"5Eun","../Data.Semigroup/index.js":"EsAJ","../Data.Symbol/index.js":"4oJQ","../Data.Unit/index.js":"NhVk","../Record.Unsafe/index.js":"KG04","../Type.Data.RowList/index.js":"XaXP"}],"5mN7":[function(require,module,exports) { +"use strict";var n=require("../Control.Alt/index.js"),e=require("../Control.Alternative/index.js"),t=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),u=require("../Control.Bind/index.js"),o=require("../Control.Category/index.js"),i=require("../Control.Extend/index.js"),a=require("../Control.Monad/index.js"),c=require("../Control.MonadZero/index.js"),f=require("../Control.Plus/index.js"),l=require("../Data.Bounded/index.js"),s=require("../Data.Eq/index.js"),d=require("../Data.Function/index.js"),m=require("../Data.Functor/index.js"),w=require("../Data.Functor.Invariant/index.js"),y=require("../Data.Monoid/index.js"),p=require("../Data.Ord/index.js"),v=require("../Data.Ordering/index.js"),M=require("../Data.Semigroup/index.js"),b=require("../Data.Show/index.js"),q=require("../Data.Unit/index.js"),x=function(){function n(){}return n.value=new n,n}(),h=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),j=function(n){return new b.Show(function(e){if(e instanceof h)return"(Just "+b.show(n)(e.value0)+")";if(e instanceof x)return"Nothing";throw new Error("Failed pattern match at Data.Maybe (line 205, column 1 - line 207, column 28): "+[e.constructor.name])})},D=function(n){return new M.Semigroup(function(e){return function(t){if(e instanceof x)return t;if(t instanceof x)return e;if(e instanceof h&&t instanceof h)return new h(M.append(n)(e.value0)(t.value0));throw new Error("Failed pattern match at Data.Maybe (line 174, column 1 - line 177, column 43): "+[e.constructor.name,t.constructor.name])}})},F=function(e){return function(r){return n.alt(e.Plus1().Alt0())(m.map(e.Plus1().Alt0().Functor0())(h.create)(r))(t.pure(e.Applicative0())(x.value))}},E=function(n){return new y.Monoid(function(){return D(n)},x.value)},A=function(n){return function(e){return function(t){if(t instanceof x)return n(q.unit);if(t instanceof h)return e(t.value0);throw new Error("Failed pattern match at Data.Maybe (line 230, column 1 - line 230, column 62): "+[n.constructor.name,e.constructor.name,t.constructor.name])}}},C=function(n){return function(e){return function(t){if(t instanceof x)return n;if(t instanceof h)return e(t.value0);throw new Error("Failed pattern match at Data.Maybe (line 217, column 1 - line 217, column 51): "+[n.constructor.name,e.constructor.name,t.constructor.name])}}},g=C(!0)(d.const(!1)),O=C(!1)(d.const(!0)),B=new m.Functor(function(n){return function(e){return e instanceof h?new h(n(e.value0)):x.value}}),J=new w.Invariant(w.imapF(B)),P=function(n){return A(n)(o.identity(o.categoryFn))},S=function(n){return C(n)(o.identity(o.categoryFn))},N=function(n){return function(n){if(n instanceof h)return n.value0;throw new Error("Failed pattern match at Data.Maybe (line 268, column 1 - line 268, column 46): "+[n.constructor.name])}},Z=new i.Extend(function(){return B},function(n){return function(e){return e instanceof x?x.value:new h(n(e))}}),I=function(n){return new s.Eq(function(e){return function(t){return e instanceof x&&t instanceof x||e instanceof h&&t instanceof h&&s.eq(n)(e.value0)(t.value0)}})},T=function(n){return new p.Ord(function(){return I(n.Eq0())},function(e){return function(t){if(e instanceof x&&t instanceof x)return v.EQ.value;if(e instanceof x)return v.LT.value;if(t instanceof x)return v.GT.value;if(e instanceof h&&t instanceof h)return p.compare(n)(e.value0)(t.value0);throw new Error("Failed pattern match at Data.Maybe (line 194, column 1 - line 194, column 51): "+[e.constructor.name,t.constructor.name])}})},G=new s.Eq1(function(n){return s.eq(I(n))}),L=new p.Ord1(function(){return G},function(n){return p.compare(T(n))}),Q=function(n){return new l.Bounded(function(){return T(n.Ord0())},x.value,new h(l.top(n)))},U=new r.Apply(function(){return B},function(n){return function(e){if(n instanceof h)return m.map(B)(n.value0)(e);if(n instanceof x)return x.value;throw new Error("Failed pattern match at Data.Maybe (line 67, column 1 - line 69, column 30): "+[n.constructor.name,e.constructor.name])}}),k=new u.Bind(function(){return U},function(n){return function(e){if(n instanceof h)return e(n.value0);if(n instanceof x)return x.value;throw new Error("Failed pattern match at Data.Maybe (line 125, column 1 - line 127, column 28): "+[n.constructor.name,e.constructor.name])}}),z=new t.Applicative(function(){return U},h.create),H=new a.Monad(function(){return z},function(){return k}),K=new n.Alt(function(){return B},function(n){return function(e){return n instanceof x?e:n}}),R=new f.Plus(function(){return K},x.value),V=new e.Alternative(function(){return z},function(){return R}),W=new c.MonadZero(function(){return V},function(){return H});module.exports={Nothing:x,Just:h,maybe:C,"maybe'":A,fromMaybe:S,"fromMaybe'":P,isJust:O,isNothing:g,fromJust:N,optional:F,functorMaybe:B,applyMaybe:U,applicativeMaybe:z,altMaybe:K,plusMaybe:R,alternativeMaybe:V,bindMaybe:k,monadMaybe:H,monadZeroMaybe:W,extendMaybe:Z,invariantMaybe:J,semigroupMaybe:D,monoidMaybe:E,eqMaybe:I,eq1Maybe:G,ordMaybe:T,ord1Maybe:L,boundedMaybe:Q,showMaybe:j}; +},{"../Control.Alt/index.js":"lN+m","../Control.Alternative/index.js":"aHia","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Control.Extend/index.js":"JIoJ","../Control.Monad/index.js":"U/Ix","../Control.MonadZero/index.js":"lD5R","../Control.Plus/index.js":"oMBg","../Data.Bounded/index.js":"kcUU","../Data.Eq/index.js":"Pq4F","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Functor.Invariant/index.js":"AXkC","../Data.Monoid/index.js":"TiEB","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7","../Data.Unit/index.js":"NhVk"}],"U/G5":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),e=require("../Control.Bind/index.js"),t=require("../Control.Monad/index.js"),o=require("../Data.Eq/index.js"),u=require("../Data.Functor/index.js"),i=require("../Data.HeytingAlgebra/index.js"),c=require("../Data.Monoid/index.js"),f=require("../Data.Ord/index.js"),j=require("../Data.Semigroup/index.js"),d=require("../Data.Semiring/index.js"),a=require("../Data.Show/index.js"),s=function(n){return n},C=function(n){return new a.Show(function(r){return"(Conj "+a.show(n)(r)+")"})},p=function(n){return new d.Semiring(function(r){return function(e){return i.conj(n)(r)(e)}},function(r){return function(e){return i.disj(n)(r)(e)}},i.ff(n),i.tt(n))},q=function(n){return new j.Semigroup(function(r){return function(e){return i.conj(n)(r)(e)}})},w=function(n){return n},x=function(n){return new c.Monoid(function(){return q(n)},i.tt(n))},l=new u.Functor(function(n){return function(r){return n(r)}}),m=function(n){return n},g=new o.Eq1(function(n){return o.eq(m(n))}),D=new f.Ord1(function(){return g},function(n){return f.compare(w(n))}),S=function(n){return n},A=new r.Apply(function(){return l},function(n){return function(r){return n(r)}}),h=new e.Bind(function(){return A},function(n){return function(r){return r(n)}}),v=new n.Applicative(function(){return A},s),y=new t.Monad(function(){return v},function(){return h});module.exports={Conj:s,eqConj:m,eq1Conj:g,ordConj:w,ord1Conj:D,boundedConj:S,showConj:C,functorConj:l,applyConj:A,applicativeConj:v,bindConj:h,monadConj:y,semigroupConj:q,monoidConj:x,semiringConj:p}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Monad/index.js":"U/Ix","../Data.Eq/index.js":"Pq4F","../Data.Functor/index.js":"+0AE","../Data.HeytingAlgebra/index.js":"paZe","../Data.Monoid/index.js":"TiEB","../Data.Ord/index.js":"r4Vb","../Data.Semigroup/index.js":"EsAJ","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7"}],"9bR7":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),e=require("../Control.Bind/index.js"),i=require("../Control.Monad/index.js"),t=require("../Data.Eq/index.js"),u=require("../Data.Functor/index.js"),o=require("../Data.HeytingAlgebra/index.js"),c=require("../Data.Monoid/index.js"),s=require("../Data.Ord/index.js"),f=require("../Data.Semigroup/index.js"),j=require("../Data.Semiring/index.js"),d=require("../Data.Show/index.js"),a=function(n){return n},D=function(n){return new d.Show(function(r){return"(Disj "+d.show(n)(r)+")"})},p=function(n){return new j.Semiring(function(r){return function(e){return o.disj(n)(r)(e)}},function(r){return function(e){return o.conj(n)(r)(e)}},o.tt(n),o.ff(n))},q=function(n){return new f.Semigroup(function(r){return function(e){return o.disj(n)(r)(e)}})},w=function(n){return n},x=function(n){return new c.Monoid(function(){return q(n)},o.ff(n))},l=new u.Functor(function(n){return function(r){return n(r)}}),m=function(n){return n},g=new t.Eq1(function(n){return t.eq(m(n))}),S=new s.Ord1(function(){return g},function(n){return s.compare(w(n))}),A=function(n){return n},h=new r.Apply(function(){return l},function(n){return function(r){return n(r)}}),v=new e.Bind(function(){return h},function(n){return function(r){return r(n)}}),y=new n.Applicative(function(){return h},a),C=new i.Monad(function(){return y},function(){return v});module.exports={Disj:a,eqDisj:m,eq1Disj:g,ordDisj:w,ord1Disj:S,boundedDisj:A,showDisj:D,functorDisj:l,applyDisj:h,applicativeDisj:y,bindDisj:v,monadDisj:C,semigroupDisj:q,monoidDisj:x,semiringDisj:p}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Monad/index.js":"U/Ix","../Data.Eq/index.js":"Pq4F","../Data.Functor/index.js":"+0AE","../Data.HeytingAlgebra/index.js":"paZe","../Data.Monoid/index.js":"TiEB","../Data.Ord/index.js":"r4Vb","../Data.Semigroup/index.js":"EsAJ","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7"}],"ULyl":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),u=require("../Control.Bind/index.js"),e=require("../Control.Monad/index.js"),t=require("../Data.Eq/index.js"),i=require("../Data.Functor/index.js"),o=require("../Data.Monoid/index.js"),a=require("../Data.Ord/index.js"),c=require("../Data.Semigroup/index.js"),d=require("../Data.Show/index.js"),f=function(n){return n},l=function(n){return new d.Show(function(r){return"(Dual "+d.show(n)(r)+")"})},p=function(n){return new c.Semigroup(function(r){return function(u){return c.append(n)(u)(r)}})},D=function(n){return n},s=function(n){return new o.Monoid(function(){return p(n.Semigroup0())},o.mempty(n))},q=new i.Functor(function(n){return function(r){return n(r)}}),w=function(n){return n},x=new t.Eq1(function(n){return t.eq(w(n))}),j=new a.Ord1(function(){return x},function(n){return a.compare(D(n))}),m=function(n){return n},S=new r.Apply(function(){return q},function(n){return function(r){return n(r)}}),g=new u.Bind(function(){return S},function(n){return function(r){return r(n)}}),h=new n.Applicative(function(){return S},f),v=new e.Monad(function(){return h},function(){return g});module.exports={Dual:f,eqDual:w,eq1Dual:x,ordDual:D,ord1Dual:j,boundedDual:m,showDual:l,functorDual:q,applyDual:S,applicativeDual:h,bindDual:g,monadDual:v,semigroupDual:p,monoidDual:s}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Monad/index.js":"U/Ix","../Data.Eq/index.js":"Pq4F","../Data.Functor/index.js":"+0AE","../Data.Monoid/index.js":"TiEB","../Data.Ord/index.js":"r4Vb","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7"}],"2o47":[function(require,module,exports) { +"use strict";var n=require("../Control.Category/index.js"),o=require("../Control.Semigroupoid/index.js"),r=require("../Data.Monoid/index.js"),e=require("../Data.Semigroup/index.js"),u=require("../Data.Show/index.js"),i=function(n){return n},t=function(n){return new u.Show(function(o){return"(Endo "+u.show(n)(o)+")"})},d=function(n){return new e.Semigroup(function(r){return function(e){return o.compose(n)(r)(e)}})},c=function(n){return n},s=function(o){return new r.Monoid(function(){return d(o.Semigroupoid0())},n.identity(o))},f=function(n){return n},a=function(n){return n};module.exports={Endo:i,eqEndo:f,ordEndo:c,boundedEndo:a,showEndo:t,semigroupEndo:d,monoidEndo:s}; +},{"../Control.Category/index.js":"IAi2","../Control.Semigroupoid/index.js":"/riR","../Data.Monoid/index.js":"TiEB","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7"}],"fHyj":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),e=require("../Control.Apply/index.js"),i=require("../Control.Bind/index.js"),r=require("../Control.Monad/index.js"),t=require("../Data.Eq/index.js"),u=require("../Data.Functor/index.js"),d=require("../Data.Monoid/index.js"),o=require("../Data.Ord/index.js"),c=require("../Data.Semigroup/index.js"),f=require("../Data.Semiring/index.js"),a=require("../Data.Show/index.js"),v=function(n){return n},A=function(n){return new a.Show(function(e){return"(Additive "+a.show(n)(e)+")"})},p=function(n){return new c.Semigroup(function(e){return function(i){return f.add(n)(e)(i)}})},s=function(n){return n},q=function(n){return new d.Monoid(function(){return p(n)},f.zero(n))},w=new u.Functor(function(n){return function(e){return n(e)}}),x=function(n){return n},j=new t.Eq1(function(n){return t.eq(x(n))}),l=new o.Ord1(function(){return j},function(n){return o.compare(s(n))}),m=function(n){return n},D=new e.Apply(function(){return w},function(n){return function(e){return n(e)}}),S=new i.Bind(function(){return D},function(n){return function(e){return e(n)}}),g=new n.Applicative(function(){return D},v),h=new r.Monad(function(){return g},function(){return S});module.exports={Additive:v,eqAdditive:x,eq1Additive:j,ordAdditive:s,ord1Additive:l,boundedAdditive:m,showAdditive:A,functorAdditive:w,applyAdditive:D,applicativeAdditive:g,bindAdditive:S,monadAdditive:h,semigroupAdditive:p,monoidAdditive:q}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Monad/index.js":"U/Ix","../Data.Eq/index.js":"Pq4F","../Data.Functor/index.js":"+0AE","../Data.Monoid/index.js":"TiEB","../Data.Ord/index.js":"r4Vb","../Data.Semigroup/index.js":"EsAJ","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7"}],"y5cd":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),i=require("../Control.Apply/index.js"),t=require("../Control.Bind/index.js"),e=require("../Control.Monad/index.js"),r=require("../Data.Eq/index.js"),u=require("../Data.Functor/index.js"),o=require("../Data.Monoid/index.js"),c=require("../Data.Ord/index.js"),l=require("../Data.Semigroup/index.js"),a=require("../Data.Semiring/index.js"),p=require("../Data.Show/index.js"),d=function(n){return n},f=function(n){return new p.Show(function(i){return"(Multiplicative "+p.show(n)(i)+")"})},v=function(n){return new l.Semigroup(function(i){return function(t){return a.mul(n)(i)(t)}})},M=function(n){return n},s=function(n){return new o.Monoid(function(){return v(n)},a.one(n))},q=new u.Functor(function(n){return function(i){return n(i)}}),w=function(n){return n},x=new r.Eq1(function(n){return r.eq(w(n))}),j=new c.Ord1(function(){return x},function(n){return c.compare(M(n))}),m=function(n){return n},D=new i.Apply(function(){return q},function(n){return function(i){return n(i)}}),S=new t.Bind(function(){return D},function(n){return function(i){return i(n)}}),g=new n.Applicative(function(){return D},d),h=new e.Monad(function(){return g},function(){return S});module.exports={Multiplicative:d,eqMultiplicative:w,eq1Multiplicative:x,ordMultiplicative:M,ord1Multiplicative:j,boundedMultiplicative:m,showMultiplicative:f,functorMultiplicative:q,applyMultiplicative:D,applicativeMultiplicative:g,bindMultiplicative:S,monadMultiplicative:h,semigroupMultiplicative:v,monoidMultiplicative:s}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Monad/index.js":"U/Ix","../Data.Eq/index.js":"Pq4F","../Data.Functor/index.js":"+0AE","../Data.Monoid/index.js":"TiEB","../Data.Ord/index.js":"r4Vb","../Data.Semigroup/index.js":"EsAJ","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7"}],"aRYH":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),t=require("../Control.Bind/index.js"),e=require("../Control.Monad/index.js"),i=require("../Data.Eq/index.js"),u=require("../Data.Functor/index.js"),o=require("../Data.Ord/index.js"),c=require("../Data.Semigroup/index.js"),s=require("../Data.Show/index.js"),f=function(n){return n},d=function(n){return new s.Show(function(r){return"(First "+s.show(n)(r)+")"})},a=new c.Semigroup(function(n){return function(r){return n}}),p=function(n){return n},F=new u.Functor(function(n){return function(r){return n(r)}}),q=function(n){return n},w=new i.Eq1(function(n){return i.eq(q(n))}),l=new o.Ord1(function(){return w},function(n){return o.compare(p(n))}),x=function(n){return n},j=new r.Apply(function(){return F},function(n){return function(r){return n(r)}}),m=new t.Bind(function(){return j},function(n){return function(r){return r(n)}}),D=new n.Applicative(function(){return j},f),h=new e.Monad(function(){return D},function(){return m});module.exports={First:f,eqFirst:q,eq1First:w,ordFirst:p,ord1First:l,boundedFirst:x,showFirst:d,functorFirst:F,applyFirst:j,applicativeFirst:D,bindFirst:m,monadFirst:h,semigroupFirst:a}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Monad/index.js":"U/Ix","../Data.Eq/index.js":"Pq4F","../Data.Functor/index.js":"+0AE","../Data.Ord/index.js":"r4Vb","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7"}],"mI/Z":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),t=require("../Control.Bind/index.js"),e=require("../Control.Monad/index.js"),u=require("../Data.Eq/index.js"),i=require("../Data.Functor/index.js"),o=require("../Data.Ord/index.js"),a=require("../Data.Semigroup/index.js"),c=require("../Data.Show/index.js"),s=function(n){return n},f=function(n){return new c.Show(function(r){return"(Last "+c.show(n)(r)+")"})},d=new a.Semigroup(function(n){return function(n){return n}}),p=function(n){return n},q=new i.Functor(function(n){return function(r){return n(r)}}),L=function(n){return n},w=new u.Eq1(function(n){return u.eq(L(n))}),l=new o.Ord1(function(){return w},function(n){return o.compare(p(n))}),x=function(n){return n},j=new r.Apply(function(){return q},function(n){return function(r){return n(r)}}),m=new t.Bind(function(){return j},function(n){return function(r){return r(n)}}),D=new n.Applicative(function(){return j},s),h=new e.Monad(function(){return D},function(){return m});module.exports={Last:s,eqLast:L,eq1Last:w,ordLast:p,ord1Last:l,boundedLast:x,showLast:f,functorLast:q,applyLast:j,applicativeLast:D,bindLast:m,monadLast:h,semigroupLast:d}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Monad/index.js":"U/Ix","../Data.Eq/index.js":"Pq4F","../Data.Functor/index.js":"+0AE","../Data.Ord/index.js":"r4Vb","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7"}],"lz8k":[function(require,module,exports) { +"use strict";var n=require("../Control.Semigroupoid/index.js"),r=require("../Data.Function/index.js"),t=require("../Data.Functor/index.js"),u=require("../Data.Monoid.Additive/index.js"),e=require("../Data.Monoid.Conj/index.js"),i=require("../Data.Monoid.Disj/index.js"),o=require("../Data.Monoid.Dual/index.js"),c=require("../Data.Monoid.Endo/index.js"),f=require("../Data.Monoid.Multiplicative/index.js"),a=require("../Data.Semigroup.First/index.js"),p=require("../Data.Semigroup.Last/index.js"),d=function(n,r){this.unwrap=n,this.wrap=r},s=function(n){return n.wrap},m=function(n){return n.unwrap},v=function(u){return function(e){return function(i){return function(o){return function(c){return function(c){var f=n.compose(n.semigroupoidFn)(t.map(e)(m(o))),a=r.on(c)(t.map(u)(s(i)));return function(n){return f(a(n))}}}}}}},w=function(n){return function(r){return function(u){return function(e){return function(i){return function(i){var o=t.map(r)(m(e)),c=t.map(n)(s(u));return function(n){return o(i(c(n)))}}}}}}},j=function(t){return function(u){return function(e){return function(e){var i=n.compose(n.semigroupoidFn)(m(u)),o=r.on(e)(s(t));return function(n){return i(o(n))}}}}},D=function(n){return function(r){return function(t){return function(t){var u=m(r),e=s(n);return function(n){return u(t(e(n)))}}}}},l=function(n){return function(r){return m(n)}},F=function(n){return function(r){return function(u){return function(u){var e=t.map(n)(s(r)),i=m(r);return function(n){return e(u(i(n)))}}}}},x=function(u){return function(e){return function(i){return function(o){return function(c){return function(c){var f=n.compose(n.semigroupoidFn)(t.map(e)(s(o))),a=r.on(c)(t.map(u)(m(i)));return function(n){return f(a(n))}}}}}}},q=function(n){return function(r){return function(u){return function(e){return function(i){return function(i){var o=t.map(r)(s(e)),c=t.map(n)(m(u));return function(n){return o(i(c(n)))}}}}}}},y=function(t){return function(u){return function(e){return function(e){var i=n.compose(n.semigroupoidFn)(s(u)),o=r.on(e)(m(t));return function(n){return i(o(n))}}}}},M=function(n){return function(r){return function(t){return function(t){var u=s(r),e=m(n);return function(n){return u(t(e(n)))}}}}},g=function(n){return l(n)},C=new d(function(n){return n},f.Multiplicative),A=new d(function(n){return n},p.Last),E=new d(function(n){return n},a.First),L=new d(function(n){return n},c.Endo),S=new d(function(n){return n},o.Dual),h=new d(function(n){return n},i.Disj),N=new d(function(n){return n},e.Conj),b=new d(function(n){return n},u.Additive),k=function(n){return function(r){return function(u){return function(u){var e=s(r),i=t.map(n)(m(r));return function(n){return e(u(i(n)))}}}}},z=function(n){return function(r){return function(u){return function(e){return function(i){return function(i){var o=t.map(r)(m(e)),c=t.map(n)(s(u));return function(n){return o(i(c(n)))}}}}}}},B=function(n){return function(r){return function(u){return function(e){return function(e){return t.map(n)(m(r))(e(s(u)))}}}}};module.exports={unwrap:m,wrap:s,Newtype:d,un:l,op:g,ala:B,alaF:z,over:M,overF:q,under:D,underF:w,over2:y,overF2:x,under2:j,underF2:v,traverse:F,collect:k,newtypeAdditive:b,newtypeMultiplicative:C,newtypeConj:N,newtypeDisj:h,newtypeDual:S,newtypeEndo:L,newtypeFirst:E,newtypeLast:A}; +},{"../Control.Semigroupoid/index.js":"/riR","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Monoid.Additive/index.js":"fHyj","../Data.Monoid.Conj/index.js":"U/G5","../Data.Monoid.Disj/index.js":"9bR7","../Data.Monoid.Dual/index.js":"ULyl","../Data.Monoid.Endo/index.js":"2o47","../Data.Monoid.Multiplicative/index.js":"y5cd","../Data.Semigroup.First/index.js":"aRYH","../Data.Semigroup.Last/index.js":"mI/Z"}],"eVDl":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),t=require("../Control.Alt/index.js"),r=require("../Control.Applicative/index.js"),u=require("../Control.Apply/index.js"),e=require("../Control.Bind/index.js"),o=require("../Control.Category/index.js"),i=require("../Control.Plus/index.js"),c=require("../Data.Eq/index.js"),f=require("../Data.Function/index.js"),a=require("../Data.Functor/index.js"),l=require("../Data.HeytingAlgebra/index.js"),d=require("../Data.Maybe/index.js"),s=require("../Data.Monoid/index.js"),p=require("../Data.Monoid.Conj/index.js"),m=require("../Data.Monoid.Disj/index.js"),y=require("../Data.Monoid.Dual/index.js"),g=require("../Data.Monoid.Endo/index.js"),w=require("../Data.Newtype/index.js"),D=require("../Data.Ord/index.js"),j=require("../Data.Ordering/index.js"),q=require("../Data.Semigroup/index.js"),h=require("../Data.Semiring/index.js"),v=require("../Data.Unit/index.js"),F=function(n,t,r){this.foldMap=n,this.foldl=t,this.foldr=r},x=function(n){return n.foldr},b=function(n){return function(t){var r=x(n)(function(n){return function(r){return r.elem instanceof d.Just?r:r.pos===t?{elem:new d.Just(n),pos:r.pos}:{pos:r.pos+1|0,elem:r.elem}}})({elem:d.Nothing.value,pos:0});return function(n){return r(n).elem}}},M=function(n){return x(n)(function(n){return function(n){return!1}})(!0)},E=function(n){return function(r){return x(n)(t.alt(r.Alt0()))(i.empty(r))}},A=function(n){return function(r){return function(u){return x(n)((e=t.alt(r.Alt0()),function(n){return e(u(n))}))(i.empty(r));var e}}},J=function(n){return function(t){return function(e){return x(t)((o=u.applySecond(n.Apply0()),function(n){return o(e(n))}))(r.pure(n)(v.unit));var o}}},N=function(n){return function(t){return f.flip(J(n)(t))}},C=function(n){return function(t){return J(n)(t)(o.identity(o.categoryFn))}},S=function(n){return n.foldl},B=function(n){return function(t){var r=S(n)(function(n){return function(r){return n.elem instanceof d.Just?n:n.pos===t?{elem:new d.Just(r),pos:n.pos}:{pos:n.pos+1|0,elem:n.elem}}})({elem:d.Nothing.value,pos:0});return function(n){return r(n).elem}}},O=function(n){return function(t){return function(r){return function(u){return S(n)(function(n){return function(u){return n.init?{init:!1,acc:u}:{init:!1,acc:q.append(t.Semigroup0())(n.acc)(q.append(t.Semigroup0())(r)(u))}}})({init:!0,acc:s.mempty(t)})(u).acc}}}},L=function(n){return function(t){return S(n)(function(n){return function(r){return h.add(t)(h.one(t))(n)}})(h.zero(t))}},_=function(n){return function(t){return S(n)(function(n){return function(r){if(n instanceof d.Nothing)return new d.Just(r);if(n instanceof d.Just)return new d.Just(c.eq(j.eqOrdering)(t(n.value0)(r))(j.GT.value)?n.value0:r);throw new Error("Failed pattern match at Data.Foldable (line 389, column 3 - line 389, column 27): "+[n.constructor.name,r.constructor.name])}})(d.Nothing.value)}},z=function(n){return function(t){return _(t)(D.compare(n))}},T=function(n){return function(t){return S(n)(function(n){return function(r){if(n instanceof d.Nothing)return new d.Just(r);if(n instanceof d.Just)return new d.Just(c.eq(j.eqOrdering)(t(n.value0)(r))(j.LT.value)?n.value0:r);throw new Error("Failed pattern match at Data.Foldable (line 402, column 3 - line 402, column 27): "+[n.constructor.name,r.constructor.name])}})(d.Nothing.value)}},G=function(n){return function(t){return T(t)(D.compare(n))}},H=function(n){return function(t){return S(n)(h.mul(t))(h.one(t))}},P=function(n){return function(t){return S(n)(h.add(t))(h.zero(t))}},R=new F(function(n){return function(n){return function(t){return n(t)}}},function(n){return function(t){return function(r){return n(t)(r)}}},function(n){return function(t){return function(r){return n(r)(t)}}}),U=new F(function(n){return function(t){return function(r){if(r instanceof d.Nothing)return s.mempty(n);if(r instanceof d.Just)return t(r.value0);throw new Error("Failed pattern match at Data.Foldable (line 129, column 1 - line 135, column 27): "+[t.constructor.name,r.constructor.name])}}},function(n){return function(t){return function(r){if(r instanceof d.Nothing)return t;if(r instanceof d.Just)return n(t)(r.value0);throw new Error("Failed pattern match at Data.Foldable (line 129, column 1 - line 135, column 27): "+[n.constructor.name,t.constructor.name,r.constructor.name])}}},function(n){return function(t){return function(r){if(r instanceof d.Nothing)return t;if(r instanceof d.Just)return n(r.value0)(t);throw new Error("Failed pattern match at Data.Foldable (line 129, column 1 - line 135, column 27): "+[n.constructor.name,t.constructor.name,r.constructor.name])}}}),k=new F(function(n){return function(n){return function(t){return n(t)}}},function(n){return function(t){return function(r){return n(t)(r)}}},function(n){return function(t){return function(r){return n(r)(t)}}}),I=new F(function(n){return function(n){return function(t){return n(t)}}},function(n){return function(t){return function(r){return n(t)(r)}}},function(n){return function(t){return function(r){return n(r)(t)}}}),K=new F(function(n){return function(n){return function(t){return n(t)}}},function(n){return function(t){return function(r){return n(t)(r)}}},function(n){return function(t){return function(r){return n(r)(t)}}}),Q=new F(function(n){return function(n){return function(t){return n(t)}}},function(n){return function(t){return function(r){return n(t)(r)}}},function(n){return function(t){return function(r){return n(r)(t)}}}),V=function(n){return function(t){return function(r){return x(n)(function(n){return function(u){return q.append(t.Semigroup0())(r(n))(u)}})(s.mempty(t))}}},W=new F(function(n){return V(W)(n)},n.foldlArray,n.foldrArray),X=function(n){return function(t){return function(r){return S(n)(function(n){return function(u){return q.append(t.Semigroup0())(n)(r(u))}})(s.mempty(t))}}},Y=function(n){return n.foldMap},Z=new F(function(n){return function(t){return function(r){return Y(U)(n)(t)(r)}}},function(n){return function(t){return function(r){return S(U)(n)(t)(r)}}},function(n){return function(t){return function(r){return x(U)(n)(t)(r)}}}),$=new F(function(n){return function(t){return function(r){return Y(U)(n)(t)(r)}}},function(n){return function(t){return function(r){return S(U)(n)(t)(r)}}},function(n){return function(t){return function(r){return x(U)(n)(t)(r)}}}),nn=function(n){return function(t){return function(r){return function(u){return w.unwrap(w.newtypeEndo)(w.unwrap(w.newtypeDual)(Y(n)(y.monoidDual(g.monoidEndo(o.categoryFn)))((e=f.flip(t),function(n){return y.Dual(g.Endo(e(n)))}))(u)))(r);var e}}}},tn=function(n){return function(t){return function(r){return function(u){return w.unwrap(w.newtypeEndo)(Y(n)(g.monoidEndo(o.categoryFn))(function(n){return g.Endo(t(n))})(u))(r)}}}},rn=function(n){return function(t){return function(r){return function(u){return function(e){return w.unwrap(w.newtypeEndo)(Y(n)(g.monoidEndo(o.categoryFn))(function(n){return function(e){return q.append(t)(r)(q.append(t)(u(n))(e))}})(e))(r)}}}}},un=function(n){return function(t){return function(r){return rn(n)(t)(r)(o.identity(o.categoryFn))}}},en=function(n){return function(t){return function(u){return function(o){return S(n)(function(n){return function(r){return e.bind(t.Bind1())(n)(f.flip(u)(r))}})(r.pure(t.Applicative0())(o))}}}},on=function(n){return function(t){return Y(n)(t)(o.identity(o.categoryFn))}},cn=function(n){return function(t){return S(n)(function(n){return function(r){return n instanceof d.Nothing?t(r):n}})(d.Nothing.value)}},fn=function(n){return function(t){return S(n)(function(n){return function(r){return n instanceof d.Nothing&&t(r)?new d.Just(r):n}})(d.Nothing.value)}},an=function(n){return function(t){return w.alaF(a.functorFn)(a.functorFn)(w.newtypeDisj)(w.newtypeDisj)(m.Disj)(Y(n)(m.monoidDisj(t)))}},ln=function(n){return function(t){var r=an(n)(l.heytingAlgebraBoolean),u=c.eq(t);return function(n){return r(u(n))}}},dn=function(n){return function(t){return function(r){var u=l.not(l.heytingAlgebraBoolean),e=ln(n)(t)(r);return function(n){return u(e(n))}}}},sn=function(n){return function(t){return an(n)(t)(o.identity(o.categoryFn))}},pn=function(n){return function(t){return w.alaF(a.functorFn)(a.functorFn)(w.newtypeConj)(w.newtypeConj)(p.Conj)(Y(n)(p.monoidConj(t)))}},mn=function(n){return function(t){return pn(n)(t)(o.identity(o.categoryFn))}};module.exports={Foldable:F,foldr:x,foldl:S,foldMap:Y,foldrDefault:tn,foldlDefault:nn,foldMapDefaultL:X,foldMapDefaultR:V,fold:on,foldM:en,traverse_:J,for_:N,sequence_:C,oneOf:E,oneOfMap:A,intercalate:O,surroundMap:rn,surround:un,and:mn,or:sn,all:pn,any:an,sum:P,product:H,elem:ln,notElem:dn,indexl:B,indexr:b,find:fn,findMap:cn,maximum:z,maximumBy:_,minimum:G,minimumBy:T,null:M,length:L,foldableArray:W,foldableMaybe:U,foldableFirst:Z,foldableLast:$,foldableAdditive:Q,foldableDual:k,foldableDisj:I,foldableConj:K,foldableMultiplicative:R}; +},{"./foreign.js":"kY6E","../Control.Alt/index.js":"lN+m","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Control.Plus/index.js":"oMBg","../Data.Eq/index.js":"Pq4F","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.HeytingAlgebra/index.js":"paZe","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Monoid.Conj/index.js":"U/G5","../Data.Monoid.Disj/index.js":"9bR7","../Data.Monoid.Dual/index.js":"ULyl","../Data.Monoid.Endo/index.js":"2o47","../Data.Newtype/index.js":"lz8k","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Semigroup/index.js":"EsAJ","../Data.Semiring/index.js":"11NF","../Data.Unit/index.js":"NhVk"}],"wjQo":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),t=require("../Control.Category/index.js"),u=require("../Data.Foldable/index.js"),e=require("../Data.Function/index.js"),i=require("../Data.Monoid/index.js"),o=require("../Data.Monoid.Conj/index.js"),f=require("../Data.Monoid.Disj/index.js"),c=require("../Data.Monoid.Dual/index.js"),a=require("../Data.Monoid.Endo/index.js"),d=require("../Data.Newtype/index.js"),l=require("../Data.Semigroup/index.js"),p=require("../Data.Unit/index.js"),b=function(n,r,t){this.bifoldMap=n,this.bifoldl=r,this.bifoldr=t},y=function(n){return n.bifoldr},s=function(t){return function(u){return function(e){return function(i){return y(t)((f=r.applySecond(u.Apply0()),function(n){return f(e(n))}))((o=r.applySecond(u.Apply0()),function(n){return o(i(n))}))(n.pure(u)(p.unit));var o,f}}}},D=function(n){return function(r){return function(t){return function(u){return function(e){return s(n)(r)(u)(e)(t)}}}}},j=function(n){return function(r){return s(n)(r)(t.identity(t.categoryFn))(t.identity(t.categoryFn))}},g=function(n){return n.bifoldl},w=function(n){return new b(function(r){return function(t){return function(t){return function(e){return u.foldMap(n)(r)(t)(e)}}}},function(r){return function(r){return function(t){return function(e){return u.foldl(n)(r)(t)(e)}}}},function(r){return function(r){return function(t){return function(e){return u.foldr(n)(r)(t)(e)}}}})},m=function(n){return new b(function(r){return function(t){return function(e){return function(e){return u.foldMap(n)(r)(t)(e)}}}},function(r){return function(t){return function(t){return function(e){return u.foldl(n)(r)(t)(e)}}}},function(r){return function(t){return function(t){return function(e){return u.foldr(n)(r)(t)(e)}}}})},q=function(n){return function(r){return function(t){return function(u){return y(n)((o=l.append(r.Semigroup0()),function(n){return o(t(n))}))((e=l.append(r.Semigroup0()),function(n){return e(u(n))}))(i.mempty(r));var e,o}}}},x=function(n){return function(r){return function(t){return function(u){return g(n)(function(n){return function(u){return l.append(r.Semigroup0())(n)(t(u))}})(function(n){return function(t){return l.append(r.Semigroup0())(n)(u(t))}})(i.mempty(r))}}}},M=function(n){return n.bifoldMap},v=function(n){return new b(function(r){return function(t){return function(u){return function(e){return M(n)(r)(u)(t)(e)}}}},function(r){return function(t){return function(u){return function(e){return g(n)(t)(r)(u)(e)}}}},function(r){return function(t){return function(u){return function(e){return y(n)(t)(r)(u)(e)}}}})},C=function(n){return new b(function(r){return function(t){return function(u){return function(e){return M(n)(r)(t)(u)(e)}}}},function(r){return function(t){return function(u){return function(e){return g(n)(r)(t)(u)(e)}}}},function(r){return function(t){return function(u){return function(e){return y(n)(r)(t)(u)(e)}}}})},E=function(n){return function(r){return function(u){return function(i){return function(o){return d.unwrap(d.newtypeEndo)(d.unwrap(d.newtypeDual)(M(n)(c.monoidDual(a.monoidEndo(t.categoryFn)))((l=e.flip(r),function(n){return c.Dual(a.Endo(l(n)))}))((f=e.flip(u),function(n){return c.Dual(a.Endo(f(n)))}))(o)))(i);var f,l}}}}},F=function(n){return function(r){return function(u){return function(e){return function(i){return d.unwrap(d.newtypeEndo)(M(n)(a.monoidEndo(t.categoryFn))(function(n){return a.Endo(r(n))})(function(n){return a.Endo(u(n))})(i))(e)}}}}},S=function n(r){return function(t){return new b(function(n){return function(u){return function(e){return function(i){return l.append(n.Semigroup0())(M(r)(n)(u)(e)(i.value0))(M(t)(n)(u)(e)(i.value1))}}}},function(u){return function(e){return function(i){return function(o){return E(n(r)(t))(u)(e)(i)(o)}}}},function(u){return function(e){return function(i){return function(o){return F(n(r)(t))(u)(e)(i)(o)}}}})}},A=function(n){return function(r){return M(n)(r)(t.identity(t.categoryFn))(t.identity(t.categoryFn))}},h=function(n){return function(r){return function(t){return function(u){var e=d.unwrap(d.newtypeDisj),i=M(n)(f.monoidDisj(r.HeytingAlgebra0()))(function(n){return f.Disj(t(n))})(function(n){return f.Disj(u(n))});return function(n){return e(i(n))}}}}},_=function(n){return function(r){return function(t){return function(u){var e=d.unwrap(d.newtypeConj),i=M(n)(o.monoidConj(r.HeytingAlgebra0()))(function(n){return o.Conj(t(n))})(function(n){return o.Conj(u(n))});return function(n){return e(i(n))}}}}};module.exports={bifoldMap:M,bifoldl:g,bifoldr:y,Bifoldable:b,bifoldrDefault:F,bifoldlDefault:E,bifoldMapDefaultR:q,bifoldMapDefaultL:x,bifold:A,bitraverse_:s,bifor_:D,bisequence_:j,biany:h,biall:_,bifoldableClown:m,bifoldableJoker:w,bifoldableFlip:v,bifoldableProduct:S,bifoldableWrap:C}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Category/index.js":"IAi2","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Monoid/index.js":"TiEB","../Data.Monoid.Conj/index.js":"U/G5","../Data.Monoid.Disj/index.js":"9bR7","../Data.Monoid.Dual/index.js":"ULyl","../Data.Monoid.Endo/index.js":"2o47","../Data.Newtype/index.js":"lz8k","../Data.Semigroup/index.js":"EsAJ","../Data.Unit/index.js":"NhVk"}],"Sd0N":[function(require,module,exports) { +"use strict";var i=function(i,t){this.Biapply0=i,this.bipure=t},t=function(i){return i.bipure};module.exports={bipure:t,Biapplicative:i}; +},{}],"X0ga":[function(require,module,exports) { +"use strict";var n=require("../Control.Category/index.js"),t=require("../Data.Bifunctor/index.js"),i=require("../Data.Function/index.js"),r=function(n,t){this.Bifunctor0=n,this.biapply=t},u=function(n){return n.biapply},e=function(r){return function(e){return function(o){return u(r)(n.identity(n.categoryFn)(t.bimap(r.Bifunctor0())(i.const(n.identity(n.categoryFn)))(i.const(n.identity(n.categoryFn))))(e))(o)}}},o=function(r){return function(e){return function(o){return u(r)(n.identity(n.categoryFn)(t.bimap(r.Bifunctor0())(i.const)(i.const))(e))(o)}}},c=function(i){return function(r){return function(e){return function(o){return function(c){return u(i)(n.identity(n.categoryFn)(t.bimap(i.Bifunctor0())(r)(e))(o))(c)}}}}},f=function(i){return function(r){return function(e){return function(o){return function(c){return function(f){return u(i)(u(i)(n.identity(n.categoryFn)(t.bimap(i.Bifunctor0())(r)(e))(o))(c))(f)}}}}}};module.exports={biapply:u,Biapply:r,biapplyFirst:e,biapplySecond:o,bilift2:c,bilift3:f}; +},{"../Control.Category/index.js":"IAi2","../Data.Bifunctor/index.js":"e2Wc","../Data.Function/index.js":"ImXJ"}],"Wuz6":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),e=require("../Control.Biapplicative/index.js"),t=require("../Control.Biapply/index.js"),u=require("../Data.Bifunctor/index.js"),i=require("../Data.Functor/index.js"),o=require("../Data.Newtype/index.js"),c=require("../Data.Show/index.js"),p=function(n){return n},l=function(n){return new c.Show(function(r){return"(Clown "+c.show(n)(r)+")"})},f=function(n){return n},w=new o.Newtype(function(n){return n},p),a=new i.Functor(function(n){return function(n){return n}}),C=function(n){return n},s=function(n){return new u.Bifunctor(function(r){return function(e){return function(e){return i.map(n)(r)(e)}}})},d=function(n){return new t.Biapply(function(){return s(n.Functor0())},function(e){return function(t){return r.apply(n)(e)(t)}})},q=function(r){return new e.Biapplicative(function(){return d(r.Apply0())},function(e){return function(t){return n.pure(r)(e)}})};module.exports={Clown:p,newtypeClown:w,eqClown:C,ordClown:f,showClown:l,functorClown:a,bifunctorClown:s,biapplyClown:d,biapplicativeClown:q}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Biapplicative/index.js":"Sd0N","../Control.Biapply/index.js":"X0ga","../Data.Bifunctor/index.js":"e2Wc","../Data.Functor/index.js":"+0AE","../Data.Newtype/index.js":"lz8k","../Data.Show/index.js":"mFY7"}],"EM73":[function(require,module,exports) { +"use strict";var n=require("../Control.Biapplicative/index.js"),r=require("../Control.Biapply/index.js"),i=require("../Data.Bifunctor/index.js"),t=require("../Data.Functor/index.js"),e=require("../Data.Newtype/index.js"),u=require("../Data.Show/index.js"),o=function(n){return n},p=function(n){return new u.Show(function(r){return"(Flip "+u.show(n)(r)+")"})},c=function(n){return n},f=new e.Newtype(function(n){return n},o),a=function(n){return new t.Functor(function(r){return function(t){return i.lmap(n)(r)(t)}})},l=function(n){return n},w=function(n){return new i.Bifunctor(function(r){return function(t){return function(e){return i.bimap(n)(t)(r)(e)}}})},F=function(n){return new r.Biapply(function(){return w(n.Bifunctor0())},function(i){return function(t){return r.biapply(n)(i)(t)}})},s=function(r){return new n.Biapplicative(function(){return F(r.Biapply0())},function(i){return function(t){return n.bipure(r)(t)(i)}})};module.exports={Flip:o,newtypeFlip:f,eqFlip:l,ordFlip:c,showFlip:p,functorFlip:a,bifunctorFlip:w,biapplyFlip:F,biapplicativeFlip:s}; +},{"../Control.Biapplicative/index.js":"Sd0N","../Control.Biapply/index.js":"X0ga","../Data.Bifunctor/index.js":"e2Wc","../Data.Functor/index.js":"+0AE","../Data.Newtype/index.js":"lz8k","../Data.Show/index.js":"mFY7"}],"O/Oh":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),e=require("../Control.Biapplicative/index.js"),t=require("../Control.Biapply/index.js"),u=require("../Data.Bifunctor/index.js"),i=require("../Data.Functor/index.js"),o=require("../Data.Newtype/index.js"),c=require("../Data.Show/index.js"),p=function(n){return n},f=function(n){return new c.Show(function(r){return"(Joker "+c.show(n)(r)+")"})},a=function(n){return n},l=new o.Newtype(function(n){return n},p),s=function(n){return new i.Functor(function(r){return function(e){return i.map(n)(r)(e)}})},w=function(n){return n},d=function(n){return new u.Bifunctor(function(r){return function(r){return function(e){return i.map(n)(r)(e)}}})},k=function(n){return new t.Biapply(function(){return d(n.Functor0())},function(e){return function(t){return r.apply(n)(e)(t)}})},J=function(r){return new e.Biapplicative(function(){return k(r.Apply0())},function(e){return function(e){return n.pure(r)(e)}})};module.exports={Joker:p,newtypeJoker:l,eqJoker:w,ordJoker:a,showJoker:f,functorJoker:s,bifunctorJoker:d,biapplyJoker:k,biapplicativeJoker:J}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Biapplicative/index.js":"Sd0N","../Control.Biapply/index.js":"X0ga","../Data.Bifunctor/index.js":"e2Wc","../Data.Functor/index.js":"+0AE","../Data.Newtype/index.js":"lz8k","../Data.Show/index.js":"mFY7"}],"U+97":[function(require,module,exports) { +"use strict";var n=require("../Control.Biapplicative/index.js"),u=require("../Control.Biapply/index.js"),r=require("../Data.Bifunctor/index.js"),e=require("../Data.Eq/index.js"),t=require("../Data.Ord/index.js"),i=require("../Data.Ordering/index.js"),o=require("../Data.Show/index.js"),c=function(){function n(n,u){this.value0=n,this.value1=u}return n.create=function(u){return function(r){return new n(u,r)}},n}(),a=function(n){return function(u){return new o.Show(function(r){return"(Product "+o.show(n)(r.value0)+" "+o.show(u)(r.value1)+")"})}},f=function(n){return function(u){return new e.Eq(function(r){return function(t){return e.eq(n)(r.value0)(t.value0)&&e.eq(u)(r.value1)(t.value1)}})}},l=function(n){return function(u){return new t.Ord(function(){return f(n.Eq0())(u.Eq0())},function(r){return function(e){var o=t.compare(n)(r.value0)(e.value0);return o instanceof i.LT?i.LT.value:o instanceof i.GT?i.GT.value:t.compare(u)(r.value1)(e.value1)}})}},p=function(n){return function(u){return new r.Bifunctor(function(e){return function(t){return function(i){return new c(r.bimap(n)(e)(t)(i.value0),r.bimap(u)(e)(t)(i.value1))}}})}},v=function(n){return function(r){return new u.Biapply(function(){return p(n.Bifunctor0())(r.Bifunctor0())},function(e){return function(t){return new c(u.biapply(n)(e.value0)(t.value0),u.biapply(r)(e.value1)(t.value1))}})}},d=function(u){return function(r){return new n.Biapplicative(function(){return v(u.Biapply0())(r.Biapply0())},function(e){return function(t){return new c(n.bipure(u)(e)(t),n.bipure(r)(e)(t))}})}};module.exports={Product:c,eqProduct:f,ordProduct:l,showProduct:a,bifunctorProduct:p,biapplyProduct:v,biapplicativeProduct:d}; +},{"../Control.Biapplicative/index.js":"Sd0N","../Control.Biapply/index.js":"X0ga","../Data.Bifunctor/index.js":"e2Wc","../Data.Eq/index.js":"Pq4F","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Show/index.js":"mFY7"}],"U78Q":[function(require,module,exports) { +"use strict";var n=require("../Control.Biapplicative/index.js"),r=require("../Control.Biapply/index.js"),t=require("../Data.Bifunctor/index.js"),e=require("../Data.Functor/index.js"),u=require("../Data.Newtype/index.js"),i=require("../Data.Show/index.js"),o=function(n){return n},p=function(n){return new i.Show(function(r){return"(Wrap "+i.show(n)(r)+")"})},a=function(n){return n},c=new u.Newtype(function(n){return n},o),f=function(n){return new e.Functor(function(r){return function(e){return t.rmap(n)(r)(e)}})},w=function(n){return n},l=function(n){return new t.Bifunctor(function(r){return function(e){return function(u){return t.bimap(n)(r)(e)(u)}}})},s=function(n){return new r.Biapply(function(){return l(n.Bifunctor0())},function(t){return function(e){return r.biapply(n)(t)(e)}})},W=function(r){return new n.Biapplicative(function(){return s(r.Biapply0())},function(t){return function(e){return n.bipure(r)(t)(e)}})};module.exports={Wrap:o,newtypeWrap:c,eqWrap:w,ordWrap:a,showWrap:p,functorWrap:f,bifunctorWrap:l,biapplyWrap:s,biapplicativeWrap:W}; +},{"../Control.Biapplicative/index.js":"Sd0N","../Control.Biapply/index.js":"X0ga","../Data.Bifunctor/index.js":"e2Wc","../Data.Functor/index.js":"+0AE","../Data.Newtype/index.js":"lz8k","../Data.Show/index.js":"mFY7"}],"oRQn":[function(require,module,exports) { +"use strict";exports.traverseArrayImpl=function(){function n(n){return[n]}function r(n){return function(r){return[n,r]}}function t(n){return function(r){return function(t){return[n,r,t]}}}function u(n){return function(r){return n.concat(r)}}return function(e){return function(c){return function(o){return function(f){return function(i){return function a(s,l){switch(l-s){case 0:return o([]);case 1:return c(n)(f(i[s]));case 2:return e(c(r)(f(i[s])))(f(i[s+1]));case 3:return e(e(c(t)(f(i[s])))(f(i[s+1])))(f(i[s+2]));default:var h=s+2*Math.floor((l-s)/4);return e(c(u)(a(s,h)))(a(h,l))}}(0,i.length)}}}}}}(); +},{}],"W/l6":[function(require,module,exports) { +"use strict";var e=require("../Control.Alt/index.js"),n=require("../Control.Alternative/index.js"),r=require("../Control.MonadZero/index.js"),t=require("../Control.Plus/index.js"),i=require("../Data.Maybe/index.js"),o=require("../Data.Monoid/index.js"),u=require("../Data.Newtype/index.js"),a=require("../Data.Semigroup/index.js"),s=require("../Data.Show/index.js"),d=function(e){return e},c=function(e){return new s.Show(function(n){return"First ("+s.show(i.showMaybe(e))(n)+")"})},F=new a.Semigroup(function(e){return function(n){return e instanceof i.Just?e:n}}),y=function(e){return i.ordMaybe(e)},f=i.ord1Maybe,l=new u.Newtype(function(e){return e},d),p=new o.Monoid(function(){return F},i.Nothing.value),b=i.monadMaybe,M=i.invariantMaybe,w=i.functorMaybe,q=i.extendMaybe,x=function(e){return i.eqMaybe(e)},m=i.eq1Maybe,j=function(e){return i.boundedMaybe(e)},v=i.bindMaybe,h=i.applyMaybe,D=i.applicativeMaybe,g=new e.Alt(function(){return w},a.append(F)),A=new t.Plus(function(){return g},o.mempty(p)),C=new n.Alternative(function(){return D},function(){return A}),S=new r.MonadZero(function(){return C},function(){return b});module.exports={First:d,newtypeFirst:l,eqFirst:x,eq1First:m,ordFirst:y,ord1First:f,boundedFirst:j,functorFirst:w,invariantFirst:M,applyFirst:h,applicativeFirst:D,bindFirst:v,monadFirst:b,extendFirst:q,showFirst:c,semigroupFirst:F,monoidFirst:p,altFirst:g,plusFirst:A,alternativeFirst:C,monadZeroFirst:S}; +},{"../Control.Alt/index.js":"lN+m","../Control.Alternative/index.js":"aHia","../Control.MonadZero/index.js":"lD5R","../Control.Plus/index.js":"oMBg","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Newtype/index.js":"lz8k","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7"}],"aQky":[function(require,module,exports) { +"use strict";var e=require("../Control.Alt/index.js"),n=require("../Control.Alternative/index.js"),t=require("../Control.MonadZero/index.js"),r=require("../Control.Plus/index.js"),a=require("../Data.Maybe/index.js"),o=require("../Data.Monoid/index.js"),i=require("../Data.Newtype/index.js"),u=require("../Data.Semigroup/index.js"),s=require("../Data.Show/index.js"),d=function(e){return e},c=function(e){return new s.Show(function(n){return"(Last "+s.show(a.showMaybe(e))(n)+")"})},l=new u.Semigroup(function(e){return function(n){if(n instanceof a.Just)return n;if(n instanceof a.Nothing)return e;throw new Error("Failed pattern match at Data.Maybe.Last (line 52, column 1 - line 54, column 36): "+[e.constructor.name,n.constructor.name])}}),L=function(e){return a.ordMaybe(e)},f=a.ord1Maybe,y=new i.Newtype(function(e){return e},d),p=new o.Monoid(function(){return l},a.Nothing.value),b=a.monadMaybe,M=a.invariantMaybe,w=a.functorMaybe,m=a.extendMaybe,q=function(e){return a.eqMaybe(e)},x=a.eq1Maybe,h=function(e){return a.boundedMaybe(e)},j=a.bindMaybe,v=a.applyMaybe,D=a.applicativeMaybe,g=new e.Alt(function(){return w},u.append(l)),A=new r.Plus(function(){return g},o.mempty(p)),C=new n.Alternative(function(){return D},function(){return A}),N=new t.MonadZero(function(){return C},function(){return b});module.exports={Last:d,newtypeLast:y,eqLast:q,eq1Last:x,ordLast:L,ord1Last:f,boundedLast:h,functorLast:w,invariantLast:M,applyLast:v,applicativeLast:D,bindLast:j,monadLast:b,extendLast:m,showLast:c,semigroupLast:l,monoidLast:p,altLast:g,plusLast:A,alternativeLast:C,monadZeroLast:N}; +},{"../Control.Alt/index.js":"lN+m","../Control.Alternative/index.js":"aHia","../Control.MonadZero/index.js":"lD5R","../Control.Plus/index.js":"oMBg","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Newtype/index.js":"lz8k","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7"}],"LbSr":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),t=require("../Control.Apply/index.js"),u=require("../Data.Functor/index.js"),e=function(n){return n},r=function(n){return n},c=function(n){return n},a=function(n){return n},i=new u.Functor(function(n){return function(t){return function(u){var e=c(t)(u);return{accum:e.accum,value:n(e.value)}}}}),o=new u.Functor(function(n){return function(t){return function(u){var e=a(t)(u);return{accum:e.accum,value:n(e.value)}}}}),f=new t.Apply(function(){return i},function(n){return function(t){return function(u){var e=c(t)(u),r=c(n)(e.accum);return{accum:r.accum,value:r.value(e.value)}}}}),l=new t.Apply(function(){return o},function(n){return function(t){return function(u){var e=a(n)(u),r=a(t)(e.accum);return{accum:r.accum,value:e.value(r.value)}}}}),v=new n.Applicative(function(){return f},function(n){return function(t){return{accum:t,value:n}}}),p=new n.Applicative(function(){return l},function(n){return function(t){return{accum:t,value:n}}});module.exports={StateL:r,stateL:a,StateR:e,stateR:c,functorStateL:o,applyStateL:l,applicativeStateL:p,functorStateR:i,applyStateR:f,applicativeStateR:v}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Data.Functor/index.js":"+0AE"}],"n7EE":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),r=require("../Control.Applicative/index.js"),t=require("../Control.Apply/index.js"),u=require("../Control.Category/index.js"),e=require("../Data.Foldable/index.js"),i=require("../Data.Functor/index.js"),o=require("../Data.Maybe/index.js"),c=require("../Data.Maybe.First/index.js"),a=require("../Data.Maybe.Last/index.js"),f=require("../Data.Monoid.Additive/index.js"),l=require("../Data.Monoid.Conj/index.js"),p=require("../Data.Monoid.Disj/index.js"),s=require("../Data.Monoid.Dual/index.js"),d=require("../Data.Monoid.Multiplicative/index.js"),v=require("../Data.Traversable.Accum.Internal/index.js"),m=function(n,r,t,u){this.Foldable1=n,this.Functor0=r,this.sequence=t,this.traverse=u},y=function(n){return n.traverse},A=new m(function(){return e.foldableMultiplicative},function(){return d.functorMultiplicative},function(n){return function(r){return i.map(n.Apply0().Functor0())(d.Multiplicative)(r)}},function(n){return function(r){return function(t){return i.map(n.Apply0().Functor0())(d.Multiplicative)(r(t))}}}),F=new m(function(){return e.foldableMaybe},function(){return o.functorMaybe},function(n){return function(t){if(t instanceof o.Nothing)return r.pure(n)(o.Nothing.value);if(t instanceof o.Just)return i.map(n.Apply0().Functor0())(o.Just.create)(t.value0);throw new Error("Failed pattern match at Data.Traversable (line 86, column 1 - line 90, column 33): "+[t.constructor.name])}},function(n){return function(t){return function(u){if(u instanceof o.Nothing)return r.pure(n)(o.Nothing.value);if(u instanceof o.Just)return i.map(n.Apply0().Functor0())(o.Just.create)(t(u.value0));throw new Error("Failed pattern match at Data.Traversable (line 86, column 1 - line 90, column 33): "+[t.constructor.name,u.constructor.name])}}}),b=new m(function(){return e.foldableDual},function(){return s.functorDual},function(n){return function(r){return i.map(n.Apply0().Functor0())(s.Dual)(r)}},function(n){return function(r){return function(t){return i.map(n.Apply0().Functor0())(s.Dual)(r(t))}}}),j=new m(function(){return e.foldableDisj},function(){return p.functorDisj},function(n){return function(r){return i.map(n.Apply0().Functor0())(p.Disj)(r)}},function(n){return function(r){return function(t){return i.map(n.Apply0().Functor0())(p.Disj)(r(t))}}}),D=new m(function(){return e.foldableConj},function(){return l.functorConj},function(n){return function(r){return i.map(n.Apply0().Functor0())(l.Conj)(r)}},function(n){return function(r){return function(t){return i.map(n.Apply0().Functor0())(l.Conj)(r(t))}}}),q=new m(function(){return e.foldableAdditive},function(){return f.functorAdditive},function(n){return function(r){return i.map(n.Apply0().Functor0())(f.Additive)(r)}},function(n){return function(r){return function(t){return i.map(n.Apply0().Functor0())(f.Additive)(r(t))}}}),M=function(n){return function(r){return y(n)(r)(u.identity(u.categoryFn))}},x=new m(function(){return e.foldableArray},function(){return i.functorArray},function(n){return M(x)(n)},function(u){return n.traverseArrayImpl(t.apply(u.Apply0()))(i.map(u.Apply0().Functor0()))(r.pure(u))}),w=function(n){return n.sequence},h=new m(function(){return e.foldableFirst},function(){return c.functorFirst},function(n){return function(r){return i.map(n.Apply0().Functor0())(c.First)(w(F)(n)(r))}},function(n){return function(r){return function(t){return i.map(n.Apply0().Functor0())(c.First)(y(F)(n)(r)(t))}}}),C=new m(function(){return e.foldableLast},function(){return a.functorLast},function(n){return function(r){return i.map(n.Apply0().Functor0())(a.Last)(w(F)(n)(r))}},function(n){return function(r){return function(t){return i.map(n.Apply0().Functor0())(a.Last)(y(F)(n)(r)(t))}}}),L=function(n){return function(r){return function(t){return function(u){return w(n)(r)(i.map(n.Functor0())(t)(u))}}}},g=function(n){return function(r){return function(t){return function(u){return v.stateR(y(n)(v.applicativeStateR)(function(n){return function(t){return r(t)(n)}})(u))(t)}}}},J=function(n){return function(r){return function(t){return function(u){return g(n)(function(n){return function(t){var u=r(t)(n);return{accum:u,value:u}}})(t)(u).value}}}},N=function(n){return function(r){return function(t){return function(u){return v.stateL(y(n)(v.applicativeStateL)(function(n){return function(t){return r(t)(n)}})(u))(t)}}}},T=function(n){return function(r){return function(t){return function(u){return N(n)(function(n){return function(t){var u=r(n)(t);return{accum:u,value:u}}})(t)(u).value}}}},R=function(n){return function(r){return function(t){return function(u){return y(r)(n)(u)(t)}}}};module.exports={Traversable:m,traverse:y,sequence:w,traverseDefault:L,sequenceDefault:M,for:R,scanl:T,scanr:J,mapAccumL:N,mapAccumR:g,traversableArray:x,traversableMaybe:F,traversableFirst:h,traversableLast:C,traversableAdditive:q,traversableDual:b,traversableConj:D,traversableDisj:j,traversableMultiplicative:A}; +},{"./foreign.js":"oRQn","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Category/index.js":"IAi2","../Data.Foldable/index.js":"eVDl","../Data.Functor/index.js":"+0AE","../Data.Maybe/index.js":"5mN7","../Data.Maybe.First/index.js":"W/l6","../Data.Maybe.Last/index.js":"aQky","../Data.Monoid.Additive/index.js":"fHyj","../Data.Monoid.Conj/index.js":"U/G5","../Data.Monoid.Disj/index.js":"9bR7","../Data.Monoid.Dual/index.js":"ULyl","../Data.Monoid.Multiplicative/index.js":"y5cd","../Data.Traversable.Accum.Internal/index.js":"LbSr"}],"8nb9":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),t=require("../Control.Category/index.js"),u=require("../Data.Bifoldable/index.js"),e=require("../Data.Bifunctor/index.js"),i=require("../Data.Bifunctor.Clown/index.js"),o=require("../Data.Bifunctor.Flip/index.js"),c=require("../Data.Bifunctor.Joker/index.js"),f=require("../Data.Bifunctor.Product/index.js"),a=require("../Data.Bifunctor.Wrap/index.js"),l=require("../Data.Functor/index.js"),p=require("../Data.Traversable/index.js"),b=function(n,r,t,u){this.Bifoldable1=n,this.Bifunctor0=r,this.bisequence=t,this.bitraverse=u},s=function(n){return n.bitraverse},d=function(r){return function(t){return function(u){return function(e){return s(r)(t)(e)(n.pure(t))(u)}}}},F=function(r){return function(t){return function(u){return s(r)(t)(u)(n.pure(t))}}},v=function(r){return function(t){return function(u){return function(e){return s(r)(t)(n.pure(t))(e)(u)}}}},y=function(r){return function(t){return s(r)(t)(n.pure(t))}},B=function(n){return new b(function(){return u.bifoldableJoker(n.Foldable1())},function(){return c.bifunctorJoker(n.Functor0())},function(r){return function(t){return l.map(r.Apply0().Functor0())(c.Joker)(p.sequence(n)(r)(t))}},function(r){return function(t){return function(t){return function(u){return l.map(r.Apply0().Functor0())(c.Joker)(p.traverse(n)(r)(t)(u))}}}})},q=function(n){return new b(function(){return u.bifoldableClown(n.Foldable1())},function(){return i.bifunctorClown(n.Functor0())},function(r){return function(t){return l.map(r.Apply0().Functor0())(i.Clown)(p.sequence(n)(r)(t))}},function(r){return function(t){return function(u){return function(u){return l.map(r.Apply0().Functor0())(i.Clown)(p.traverse(n)(r)(t)(u))}}}})},A=function(n){return function(r){return s(n)(r)(t.identity(t.categoryFn))(t.identity(t.categoryFn))}},x=function(n){return n.bisequence},j=function(n){return new b(function(){return u.bifoldableFlip(n.Bifoldable1())},function(){return o.bifunctorFlip(n.Bifunctor0())},function(r){return function(t){return l.map(r.Apply0().Functor0())(o.Flip)(x(n)(r)(t))}},function(r){return function(t){return function(u){return function(e){return l.map(r.Apply0().Functor0())(o.Flip)(s(n)(r)(u)(t)(e))}}}})},m=function(n){return function(t){return new b(function(){return u.bifoldableProduct(n.Bifoldable1())(t.Bifoldable1())},function(){return f.bifunctorProduct(n.Bifunctor0())(t.Bifunctor0())},function(u){return function(e){return r.apply(u.Apply0())(l.map(u.Apply0().Functor0())(f.Product.create)(x(n)(u)(e.value0)))(x(t)(u)(e.value1))}},function(u){return function(e){return function(i){return function(o){return r.apply(u.Apply0())(l.map(u.Apply0().Functor0())(f.Product.create)(s(n)(u)(e)(i)(o.value0)))(s(t)(u)(e)(i)(o.value1))}}}})}},w=function(n){return new b(function(){return u.bifoldableWrap(n.Bifoldable1())},function(){return a.bifunctorWrap(n.Bifunctor0())},function(r){return function(t){return l.map(r.Apply0().Functor0())(a.Wrap)(x(n)(r)(t))}},function(r){return function(t){return function(u){return function(e){return l.map(r.Apply0().Functor0())(a.Wrap)(s(n)(r)(t)(u)(e))}}}})},D=function(n){return function(r){return function(t){return function(u){return function(i){return x(n)(r)(e.bimap(n.Bifunctor0())(t)(u)(i))}}}}},C=function(n){return function(r){return function(t){return function(u){return function(e){return s(n)(r)(u)(e)(t)}}}}};module.exports={Bitraversable:b,bitraverse:s,bisequence:x,bitraverseDefault:D,bisequenceDefault:A,ltraverse:F,rtraverse:y,bifor:C,lfor:d,rfor:v,bitraversableClown:q,bitraversableJoker:B,bitraversableFlip:j,bitraversableProduct:m,bitraversableWrap:w}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Category/index.js":"IAi2","../Data.Bifoldable/index.js":"wjQo","../Data.Bifunctor/index.js":"e2Wc","../Data.Bifunctor.Clown/index.js":"Wuz6","../Data.Bifunctor.Flip/index.js":"EM73","../Data.Bifunctor.Joker/index.js":"O/Oh","../Data.Bifunctor.Product/index.js":"U+97","../Data.Bifunctor.Wrap/index.js":"U78Q","../Data.Functor/index.js":"+0AE","../Data.Traversable/index.js":"n7EE"}],"ZgoH":[function(require,module,exports) { +"use strict";exports.mapWithIndexArray=function(r){return function(t){for(var n=t.length,e=Array(n),u=0;u=0&&r=0&&n0?n(r.pop()):t}}}},exports.pushAll=function(n){return function(t){return function(){return t.push.apply(t,n)}}},exports.shiftImpl=function(n){return function(t){return function(r){return function(){return r.length>0?n(r.shift()):t}}}},exports.unshiftAll=function(n){return function(t){return function(){return t.unshift.apply(t,n)}}},exports.splice=function(n){return function(t){return function(r){return function(u){return function(){return u.splice.apply(u,[n,t].concat(r))}}}}},exports.copyImpl=function(n){return function(){return n.slice()}},exports.sortByImpl=function(n){return function(t){return function(){return t.sort(function(t,r){return n(t)(r)})}}},exports.toAssocArray=function(n){return function(){for(var t=n.length,r=new Array(t),u=0;u=r?1:-1;return o(n)(function(n){return function(r){var i=r+n|0;return new u.Tuple(r,r===t?e.Nothing.value:new e.Just(i))}}(i))(r)}}};module.exports={Unfoldable1:i,unfoldr1:o,replicate1:f,replicate1A:l,singleton:c,range:s,unfoldable1Array:a}; +},{"./foreign.js":"rpkt","../Data.Boolean/index.js":"ObQr","../Data.Maybe/index.js":"5mN7","../Data.Semigroup.Traversable/index.js":"qkfi","../Data.Tuple/index.js":"II/O"}],"77+Z":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),e=require("../Data.Function/index.js"),r=require("../Data.Functor/index.js"),u=require("../Data.Maybe/index.js"),t=require("../Data.Traversable/index.js"),i=require("../Data.Tuple/index.js"),o=require("../Data.Unfoldable1/index.js"),a=require("../Data.Unit/index.js"),f=function(n,e){this.Unfoldable10=n,this.unfoldr=e},l=function(n){return n.unfoldr},c=new f(function(){return o.unfoldable1Array},n.unfoldrArrayImpl(u.isNothing)(u.fromJust())(i.fst)(i.snd)),s=function(n){return function(e){return function(r){return l(n)(function(n){return n<=0?u.Nothing.value:new u.Just(new i.Tuple(r,n-1|0))})(e)}}},d=function(n){return function(e){return function(r){return function(u){return function(i){return t.sequence(r)(n)(s(e)(u)(i))}}}}},b=function(n){return l(n)(e.const(u.Nothing.value))(a.unit)},p=function(n){return l(n)(function(n){return r.map(u.functorMaybe)(e.flip(i.Tuple.create)(u.Nothing.value))(n)})};module.exports={Unfoldable:f,unfoldr:l,replicate:s,replicateA:d,none:b,fromMaybe:p,unfoldableArray:c}; +},{"./foreign.js":"v/61","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Maybe/index.js":"5mN7","../Data.Traversable/index.js":"n7EE","../Data.Tuple/index.js":"II/O","../Data.Unfoldable1/index.js":"S0Nl","../Data.Unit/index.js":"NhVk"}],"4t4C":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),r=require("../Control.Alt/index.js"),t=require("../Control.Applicative/index.js"),e=require("../Control.Apply/index.js"),u=require("../Control.Bind/index.js"),i=require("../Control.Category/index.js"),o=require("../Control.Lazy/index.js"),a=require("../Control.Monad.Rec.Class/index.js"),c=require("../Control.Monad.ST.Internal/index.js"),f=require("../Data.Array.ST/index.js"),l=require("../Data.Array.ST.Iterator/index.js"),s=require("../Data.Boolean/index.js"),p=require("../Data.Eq/index.js"),d=require("../Data.Foldable/index.js"),h=require("../Data.Function/index.js"),m=require("../Data.Functor/index.js"),v=require("../Data.HeytingAlgebra/index.js"),y=require("../Data.Maybe/index.js"),g=require("../Data.Ord/index.js"),A=require("../Data.Ordering/index.js"),q=require("../Data.Semigroup/index.js"),x=require("../Data.Traversable/index.js"),w=require("../Data.Tuple/index.js"),b=require("../Data.Unfoldable/index.js"),F=function(r){return function(t){return function(e){return function(u){return x.sequence(x.traversableArray)(r)(n.zipWith(t)(e)(u))}}}},T=n.zipWith(w.Tuple.create),j=function(n){return function(r){return function(t){return f.withArray(function(t){return d.traverse_(c.applicativeST)(n)(function(n){return f.poke(n.value0)(n.value1)(t)})(r)})(t)()}}},D=n._updateAt(y.Just.create)(y.Nothing.value),J=function(r){return n.unsafeIndexImpl},I=n["uncons'"](h.const(y.Nothing.value))(function(n){return function(r){return new y.Just({head:n,tail:r})}}),N=function(r){return function(t){var e=n.length(t);return b.unfoldr(r)(function(n){if(n=n.length(o))return t.pure(r.Monad0().Applicative0())(new a.Done(i));if(s.otherwise)return u.bind(r.Monad0().Bind1())(e(i)(J()(o)(c)))(function(n){return t.pure(r.Monad0().Applicative0())(new a.Loop({a:n,b:c+1|0}))});throw new Error("Failed pattern match at Data.Array (line 1101, column 3 - line 1105, column 42): "+[i.constructor.name,c.constructor.name])}})(i)(0)}}}},cn=function r(e){return function(i){return function(o){return n["uncons'"](function(n){return t.pure(e.Applicative0())(o)})(function(n){return function(t){return u.bind(e.Bind1())(i(o)(n))(function(n){return r(e)(i)(n)(t)})}})}}},fn=n.findLastIndexImpl(y.Just.create)(y.Nothing.value),ln=function(n){return function(r){return function(t){var e=y.maybe(0)(function(n){return n+1|0})(fn(function(t){return p.eq(A.eqOrdering)(n(r)(t))(A.GT.value)})(t));return y.fromJust()(P(e)(r)(t))}}},sn=function(n){return ln(g.compare(n))},pn=n.findIndexImpl(y.Just.create)(y.Nothing.value),dn=function(r){return function(t){return function(e){return n.filter(function(n){return y.isJust(pn(r(n))(e))})(t)}}},hn=function(n){return dn(p.eq(n))},mn=function(n){return function(r){return fn(function(t){return p.eq(n)(t)(r)})}},vn=function(n){return function(r){return pn(function(t){return p.eq(n)(t)(r)})}},yn=function(n){return function(r){return X(n)(r).rest}},gn=function(r){return function(t){return n.take(n.length(t)-r|0)(t)}},An=n._deleteAt(y.Just.create)(y.Nothing.value),qn=function(n){return function(r){return function(t){return 0===t.length?[]:y.maybe(t)(function(n){return y.fromJust()(An(n)(t))})(pn(n(r))(t))}}},xn=function(n){return function(r){return function(t){return q.append(q.semigroupArray)(r)(d.foldl(d.foldableArray)(h.flip(qn(n)))(k(n)(t))(r))}}},wn=function(n){return xn(p.eq(n))},bn=function(n){return qn(p.eq(n))},Fn=function(n){return d.foldr(d.foldableArray)(bn(n))},Tn=h.flip(u.bind(u.bindArray)),jn=function(n){return Tn((r=y.maybe([])(W),function(t){return r(n(t))}));var r},Dn=function(n){return function(r){var t=m.map(n.Apply0().Functor0())(jn(function(n){return n.value1?new y.Just(n.value0):y.Nothing.value})),e=x.traverse(x.traversableArray)(n)(function(t){return m.map(n.Apply0().Functor0())(w.Tuple.create(t))(r(t))});return function(n){return t(e(n))}}},Jn=jn(i.identity(i.categoryFn)),In=function(n){return function(r){return function(t){return y.maybe(y.Nothing.value)(function(e){var u=r(e);if(u instanceof y.Nothing)return An(n)(t);if(u instanceof y.Just)return D(n)(u.value0)(t);throw new Error("Failed pattern match at Data.Array (line 544, column 10 - line 546, column 32): "+[u.constructor.name])})(U(t)(n))}}};module.exports={fromFoldable:on,toUnfoldable:N,singleton:W,some:R,many:G,null:C,insert:sn,insertBy:ln,head:$,last:H,tail:E,init:Q,uncons:I,unsnoc:K,index:U,elemIndex:vn,elemLastIndex:mn,findIndex:pn,findLastIndex:fn,insertAt:P,deleteAt:An,updateAt:D,updateAtIndices:j,modifyAt:V,modifyAtIndices:_,alterAt:In,concatMap:Tn,filterA:Dn,mapMaybe:jn,catMaybes:Jn,mapWithIndex:O,sort:M,sortBy:S,sortWith:B,takeEnd:z,takeWhile:Y,dropEnd:gn,dropWhile:yn,span:X,group:en,"group'":un,groupBy:tn,nub:rn,nubEq:L,nubBy:nn,nubByEq:k,union:wn,unionBy:xn,delete:bn,deleteBy:qn,difference:Fn,intersect:hn,intersectBy:dn,zipWithA:F,zip:T,unzip:Z,foldM:cn,foldRecM:an,unsafeIndex:J,range:n.range,replicate:n.replicate,length:n.length,cons:n.cons,snoc:n.snoc,reverse:n.reverse,concat:n.concat,filter:n.filter,partition:n.partition,slice:n.slice,take:n.take,drop:n.drop,zipWith:n.zipWith}; +},{"./foreign.js":"TZDL","../Control.Alt/index.js":"lN+m","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Control.Lazy/index.js":"y9cE","../Control.Monad.Rec.Class/index.js":"UVIy","../Control.Monad.ST.Internal/index.js":"Sedc","../Data.Array.ST/index.js":"s8si","../Data.Array.ST.Iterator/index.js":"Wi7L","../Data.Boolean/index.js":"ObQr","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.HeytingAlgebra/index.js":"paZe","../Data.Maybe/index.js":"5mN7","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Semigroup/index.js":"EsAJ","../Data.Traversable/index.js":"n7EE","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z"}],"9xaU":[function(require,module,exports) { +var define; +var t,r=function(t){"use strict";var e=1e7,n=7,o=9007199254740992,i=f(o),a=Math.log(o);function u(t,r){return void 0===t?u[0]:void 0!==r?10==+r?H(t):R(t,r):H(t)}function s(t,r){this.value=t,this.sign=r,this.isSmall=!1}function p(t){this.value=t,this.sign=t<0,this.isSmall=!0}function l(t){return-o0?Math.floor(t):Math.ceil(t)}function g(t,r){var n,o,i=t.length,a=r.length,u=new Array(i),s=0,p=e;for(o=0;o=p?1:0,u[o]=n-s*p;for(;o0&&u.push(s),u}function m(t,r){return t.length>=r.length?g(t,r):g(r,t)}function d(t,r){var n,o,i=t.length,a=new Array(i),u=e;for(o=0;o0;)a[o++]=r%u,r=Math.floor(r/u);return a}function w(t,r){var n,o,i=t.length,a=r.length,u=new Array(i),s=0,p=e;for(n=0;n0;)a[o++]=s%u,s=Math.floor(s/u);return a}function q(t,r){for(var e=[];r-- >0;)e.push(0);return e.concat(t)}function E(t,r,n){return new s(t=0;--n)i=(a=i*p+t[n])-(o=c(a/r))*r,s[n]=0|o;return[s,0|i]}function O(t,r){var n,o,i=H(r),a=t.value,l=i.value;if(0===l)throw new Error("Cannot divide by zero");if(t.isSmall)return i.isSmall?[new p(c(a/l)),new p(a%l)]:[u[0],t];if(i.isSmall){if(1===l)return[t,u[0]];if(-1==l)return[t.negate(),u[0]];var g=Math.abs(l);if(g=0;o--){for(n=v-1,d[o+f]!==g&&(n=Math.floor((d[o+f]*v+d[o+f-1])/g)),i=0,a=0,s=w.length,u=0;up&&(i=(i+1)*y),n=Math.ceil(i/a);do{if(P(u=S(r,n),f)<=0)break;n--}while(n);l.push(n),f=w(f,u)}return l.reverse(),[h(l),h(f)]}(a,l))[0];var b=t.sign!==i.sign,M=n[1],q=t.sign;return"number"==typeof o?(b&&(o=-o),o=new p(o)):o=new s(o,b),"number"==typeof M?(q&&(M=-M),M=new p(M)):M=new s(M,q),[o,M]}function P(t,r){if(t.length!==r.length)return t.length>r.length?1:-1;for(var e=t.length-1;e>=0;e--)if(t[e]!==r[e])return t[e]>r[e]?1:-1;return 0}function x(t){var r=t.abs();return!r.isUnit()&&(!!(r.equals(2)||r.equals(3)||r.equals(5))||!(r.isEven()||r.isDivisibleBy(3)||r.isDivisibleBy(5))&&(!!r.lesser(25)||void 0))}s.prototype=Object.create(u.prototype),p.prototype=Object.create(u.prototype),s.prototype.add=function(t){var r=H(t);if(this.sign!==r.sign)return this.subtract(r.negate());var e=this.value,n=r.value;return r.isSmall?new s(d(e,Math.abs(n)),this.sign):new s(m(e,n),this.sign)},s.prototype.plus=s.prototype.add,p.prototype.add=function(t){var r=H(t),e=this.value;if(e<0!==r.sign)return this.subtract(r.negate());var n=r.value;if(r.isSmall){if(l(e+n))return new p(e+n);n=f(Math.abs(n))}return new s(d(n,Math.abs(e)),e<0)},p.prototype.plus=p.prototype.add,s.prototype.subtract=function(t){var r=H(t);if(this.sign!==r.sign)return this.add(r.negate());var e=this.value,n=r.value;return r.isSmall?b(e,Math.abs(n),this.sign):function(t,r,e){var n;return P(t,r)>=0?n=w(t,r):(n=w(r,t),e=!e),"number"==typeof(n=h(n))?(e&&(n=-n),new p(n)):new s(n,e)}(e,n,this.sign)},s.prototype.minus=s.prototype.subtract,p.prototype.subtract=function(t){var r=H(t),e=this.value;if(e<0!==r.sign)return this.add(r.negate());var n=r.value;return r.isSmall?new p(e-n):b(n,Math.abs(e),e>=0)},p.prototype.minus=p.prototype.subtract,s.prototype.negate=function(){return new s(this.value,!this.sign)},p.prototype.negate=function(){var t=this.sign,r=new p(-this.value);return r.sign=!t,r},s.prototype.abs=function(){return new s(this.value,!1)},p.prototype.abs=function(){return new p(Math.abs(this.value))},s.prototype.multiply=function(t){var r,n,o,i=H(t),a=this.value,p=i.value,l=this.sign!==i.sign;if(i.isSmall){if(0===p)return u[0];if(1===p)return this;if(-1===p)return this.negate();if((r=Math.abs(p))0?function t(r,e){var n=Math.max(r.length,e.length);if(n<=30)return M(r,e);n=Math.ceil(n/2);var o=r.slice(n),i=r.slice(0,n),a=e.slice(n),u=e.slice(0,n),s=t(i,u),p=t(o,a),l=t(m(i,o),m(u,a)),f=m(m(s,q(w(w(l,s),p),n)),q(p,2*n));return v(f),f}(a,p):M(a,p),l)},s.prototype.times=s.prototype.multiply,p.prototype._multiplyBySmall=function(t){return l(t.value*this.value)?new p(t.value*this.value):E(Math.abs(t.value),f(Math.abs(this.value)),this.sign!==t.sign)},s.prototype._multiplyBySmall=function(t){return 0===t.value?u[0]:1===t.value?this:-1===t.value?this.negate():E(Math.abs(t.value),this.value,this.sign!==t.sign)},p.prototype.multiply=function(t){return H(t)._multiplyBySmall(this)},p.prototype.times=p.prototype.multiply,s.prototype.square=function(){return new s(N(this.value),!1)},p.prototype.square=function(){var t=this.value*this.value;return l(t)?new p(t):new s(N(f(Math.abs(this.value))),!1)},s.prototype.divmod=function(t){var r=O(this,t);return{quotient:r[0],remainder:r[1]}},p.prototype.divmod=s.prototype.divmod,s.prototype.divide=function(t){return O(this,t)[0]},p.prototype.over=p.prototype.divide=s.prototype.over=s.prototype.divide,s.prototype.mod=function(t){return O(this,t)[1]},p.prototype.remainder=p.prototype.mod=s.prototype.remainder=s.prototype.mod,s.prototype.pow=function(t){var r,e,n,o=H(t),i=this.value,a=o.value;if(0===a)return u[1];if(0===i)return u[0];if(1===i)return u[1];if(-1===i)return o.isEven()?u[1]:u[-1];if(o.sign)return u[0];if(!o.isSmall)throw new Error("The exponent "+o.toString()+" is too large.");if(this.isSmall&&l(r=Math.pow(i,a)))return new p(c(r));for(e=this,n=u[1];!0&a&&(n=n.times(e),--a),0!==a;)a/=2,e=e.square();return n},p.prototype.pow=s.prototype.pow,s.prototype.modPow=function(t,r){if(t=H(t),(r=H(r)).isZero())throw new Error("Cannot take modPow with modulus 0");for(var e=u[1],n=this.mod(r);t.isPositive();){if(n.isZero())return u[0];t.isOdd()&&(e=e.multiply(n).mod(r)),t=t.divide(2),n=n.square().mod(r)}return e},p.prototype.modPow=s.prototype.modPow,s.prototype.compareAbs=function(t){var r=H(t),e=this.value,n=r.value;return r.isSmall?1:P(e,n)},p.prototype.compareAbs=function(t){var r=H(t),e=Math.abs(this.value),n=r.value;return r.isSmall?e===(n=Math.abs(n))?0:e>n?1:-1:-1},s.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var r=H(t),e=this.value,n=r.value;return this.sign!==r.sign?r.sign?1:-1:r.isSmall?this.sign?-1:1:P(e,n)*(this.sign?-1:1)},s.prototype.compareTo=s.prototype.compare,p.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var r=H(t),e=this.value,n=r.value;return r.isSmall?e==n?0:e>n?1:-1:e<0!==r.sign?e<0?-1:1:e<0?1:-1},p.prototype.compareTo=p.prototype.compare,s.prototype.equals=function(t){return 0===this.compare(t)},p.prototype.eq=p.prototype.equals=s.prototype.eq=s.prototype.equals,s.prototype.notEquals=function(t){return 0!==this.compare(t)},p.prototype.neq=p.prototype.notEquals=s.prototype.neq=s.prototype.notEquals,s.prototype.greater=function(t){return this.compare(t)>0},p.prototype.gt=p.prototype.greater=s.prototype.gt=s.prototype.greater,s.prototype.lesser=function(t){return this.compare(t)<0},p.prototype.lt=p.prototype.lesser=s.prototype.lt=s.prototype.lesser,s.prototype.greaterOrEquals=function(t){return this.compare(t)>=0},p.prototype.geq=p.prototype.greaterOrEquals=s.prototype.geq=s.prototype.greaterOrEquals,s.prototype.lesserOrEquals=function(t){return this.compare(t)<=0},p.prototype.leq=p.prototype.lesserOrEquals=s.prototype.leq=s.prototype.lesserOrEquals,s.prototype.isEven=function(){return 0==(1&this.value[0])},p.prototype.isEven=function(){return 0==(1&this.value)},s.prototype.isOdd=function(){return 1==(1&this.value[0])},p.prototype.isOdd=function(){return 1==(1&this.value)},s.prototype.isPositive=function(){return!this.sign},p.prototype.isPositive=function(){return this.value>0},s.prototype.isNegative=function(){return this.sign},p.prototype.isNegative=function(){return this.value<0},s.prototype.isUnit=function(){return!1},p.prototype.isUnit=function(){return 1===Math.abs(this.value)},s.prototype.isZero=function(){return!1},p.prototype.isZero=function(){return 0===this.value},s.prototype.isDivisibleBy=function(t){var r=H(t),e=r.value;return 0!==e&&(1===e||(2===e?this.isEven():this.mod(r).equals(u[0])))},p.prototype.isDivisibleBy=s.prototype.isDivisibleBy,s.prototype.isPrime=function(){var t=x(this);if(void 0!==t)return t;for(var e,n,o,i,a=this.abs(),s=a.prev(),p=[2,3,5,7,11,13,17,19],l=s;l.isEven();)l=l.divide(2);for(o=0;o-o?new p(t-1):new s(i,!0)};for(var Z=[1];2*Z[Z.length-1]<=e;)Z.push(2*Z[Z.length-1]);var I=Z.length,B=Z[I-1];function C(t){return("number"==typeof t||"string"==typeof t)&&+Math.abs(t)<=e||t instanceof s&&t.value.length<=1}function J(t,e,n){e=H(e);for(var o=t.isNegative(),i=e.isNegative(),a=o?t.not():t,u=i?e.not():e,s=0,p=0,l=null,f=null,h=[];!a.isZero()||!u.isZero();)s=(l=O(a,B))[1].toJSNumber(),o&&(s=B-1-s),p=(f=O(u,B))[1].toJSNumber(),i&&(p=B-1-p),a=l[0],u=f[0],h.push(n(s,p));for(var v=0!==n(o?1:0,i?1:0)?r(-1):r(0),y=h.length-1;y>=0;y-=1)v=v.multiply(B).add(r(h[y]));return v}s.prototype.shiftLeft=function(t){if(!C(t))throw new Error(String(t)+" is too large for shifting.");if((t=+t)<0)return this.shiftRight(-t);for(var r=this;t>=I;)r=r.multiply(B),t-=I-1;return r.multiply(Z[t])},p.prototype.shiftLeft=s.prototype.shiftLeft,s.prototype.shiftRight=function(t){var r;if(!C(t))throw new Error(String(t)+" is too large for shifting.");if((t=+t)<0)return this.shiftLeft(-t);for(var e=this;t>=I;){if(e.isZero())return e;e=(r=O(e,B))[1].isNegative()?r[0].prev():r[0],t-=I-1}return(r=O(e,Z[t]))[1].isNegative()?r[0].prev():r[0]},p.prototype.shiftRight=s.prototype.shiftRight,s.prototype.not=function(){return this.negate().prev()},p.prototype.not=s.prototype.not,s.prototype.and=function(t){return J(this,t,function(t,r){return t&r})},p.prototype.and=s.prototype.and,s.prototype.or=function(t){return J(this,t,function(t,r){return t|r})},p.prototype.or=s.prototype.or,s.prototype.xor=function(t){return J(this,t,function(t,r){return t^r})},p.prototype.xor=s.prototype.xor;var z=1<<30,j=(e&-e)*(e&-e)|z;function L(t){var r=t.value,n="number"==typeof r?r|z:r[0]+r[1]*e|j;return n&-n}function D(t,r){return t=H(t),r=H(r),t.greater(r)?t:r}function U(t,r){return t=H(t),r=H(r),t.lesser(r)?t:r}function k(t,r){if(t=H(t).abs(),r=H(r).abs(),t.equals(r))return t;if(t.isZero())return r;if(r.isZero())return t;for(var e,n,o=u[1];t.isEven()&&r.isEven();)e=Math.min(L(t),L(r)),t=t.divide(e),r=r.divide(e),o=o.multiply(e);for(;t.isEven();)t=t.divide(L(t));do{for(;r.isEven();)r=r.divide(L(r));t.greater(r)&&(n=r,r=t,t=n),r=r.subtract(t)}while(!r.isZero());return o.isUnit()?t:t.multiply(o)}var R=function(t,r){for(var e=t.length,n=Math.abs(r),o=0;o=n){if("1"===l&&1===n)continue;throw new Error(l+" is not a valid digit in base "+r+".")}if(l.charCodeAt(0)-87>=n)throw new Error(l+" is not a valid digit in base "+r+".")}}if(2<=r&&r<=36&&e<=a/Math.log(r)){var i=parseInt(t,r);if(isNaN(i))throw new Error(l+" is not a valid digit in base "+r+".");return new p(parseInt(t,r))}r=H(r);var u=[],s="-"===t[0];for(o=s?1:0;o"!==t[o]);u.push(H(t.slice(h+1,o)))}}return T(u,r,s)};function T(t,r,e){var n,o=u[0],i=u[1];for(n=t.length-1;n>=0;n--)o=o.add(t[n].times(i)),i=i.times(r);return e?o.negate():o}function _(t){return t<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t):"<"+t+">"}function $(t,e){if((e=r(e)).isZero()){if(t.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(e.equals(-1)){if(t.isZero())return{value:[0],isNegative:!1};if(t.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-t)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var n=Array.apply(null,Array(+t-1)).map(Array.prototype.valueOf,[0,1]);return n.unshift([1]),{value:[].concat.apply([],n),isNegative:!1}}var o=!1;if(t.isNegative()&&e.isPositive()&&(o=!0,t=t.abs()),e.equals(1))return t.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+t)).map(Number.prototype.valueOf,1),isNegative:o};for(var i,a=[],u=t;u.isNegative()||u.compareAbs(e)>=0;){i=u.divmod(e),u=i.quotient;var s=i.remainder;s.isNegative()&&(s=e.minus(s).abs(),u=u.next()),a.push(s.toJSNumber())}return a.push(u.toJSNumber()),{value:a.reverse(),isNegative:o}}function F(t,r){var e=$(t,r);return(e.isNegative?"-":"")+e.value.map(_).join("")}function G(t){if(l(+t)){var r=+t;if(r===c(r))return new p(r);throw"Invalid integer: "+t}var e="-"===t[0];e&&(t=t.slice(1));var o=t.split(/e/i);if(o.length>2)throw new Error("Invalid integer: "+o.join("e"));if(2===o.length){var i=o[1];if("+"===i[0]&&(i=i.slice(1)),(i=+i)!==c(i)||!l(i))throw new Error("Invalid integer: "+i+" is not a valid exponent.");var a=o[0],u=a.indexOf(".");if(u>=0&&(i-=a.length-u-1,a=a.slice(0,u)+a.slice(u+1)),i<0)throw new Error("Cannot include negative exponent part for integers");t=a+=new Array(i+1).join("0")}if(!/^([0-9][0-9]*)$/.test(t))throw new Error("Invalid integer: "+t);for(var f=[],h=t.length,y=n,g=h-y;h>0;)f.push(+t.slice(g,h)),(g-=y)<0&&(g=0),h-=y;return v(f),new s(f,e)}function H(t){return"number"==typeof t?function(t){if(l(t)){if(t!==c(t))throw new Error(t+" is not an integer.");return new p(t)}return G(t.toString())}(t):"string"==typeof t?G(t):t}s.prototype.toArray=function(t){return $(this,t)},p.prototype.toArray=function(t){return $(this,t)},s.prototype.toString=function(t){if(void 0===t&&(t=10),10!==t)return F(this,t);for(var r,e=this.value,n=e.length,o=String(e[--n]);--n>=0;)r=String(e[n]),o+="0000000".slice(r.length)+r;return(this.sign?"-":"")+o},p.prototype.toString=function(t){return void 0===t&&(t=10),10!=t?F(this,t):String(this.value)},s.prototype.toJSON=p.prototype.toJSON=function(){return this.toString()},s.prototype.valueOf=function(){return parseInt(this.toString(),10)},s.prototype.toJSNumber=s.prototype.valueOf,p.prototype.valueOf=function(){return this.value},p.prototype.toJSNumber=p.prototype.valueOf;for(var K=0;K<1e3;K++)u[K]=new p(K),K>0&&(u[-K]=new p(-K));return u.one=u[1],u.zero=u[0],u.minusOne=u[-1],u.max=D,u.min=U,u.gcd=k,u.lcm=function(t,r){return t=H(t).abs(),r=H(r).abs(),t.divide(k(t,r)).multiply(r)},u.isInstance=function(t){return t instanceof s||t instanceof p},u.randBetween=function(t,r){var n=U(t=H(t),r=H(r)),o=D(t,r).subtract(n).add(1);if(o.isSmall)return n.add(Math.floor(Math.random()*o));for(var i=[],a=!0,u=o.value.length-1;u>=0;u--){var l=a?o.value[u]:e,f=c(Math.random()*l);i.unshift(f),f0?Math.floor(n):Math.ceil(n)}exports["fromBase'"]=function(r){return function(t){return function(u){return function(e){try{var o=n(e,u);return r(o)}catch(i){return t}}}}},exports["fromNumber'"]=function(t){return function(u){return function(e){try{var o=n(r(e));return t(o)}catch(i){return u}}}},exports.fromInt=function(r){return n(r)},exports.toBase=function(n){return function(r){return r.toString(n)}},exports.toNumber=function(n){return n.toJSNumber()},exports.biAdd=function(n){return function(r){return n.add(r)}},exports.biMul=function(n){return function(r){return n.multiply(r)}},exports.biSub=function(n){return function(r){return n.minus(r)}},exports.biMod=function(n){return function(r){return n.mod(r)}},exports.biDiv=function(n){return function(r){return n.divide(r)}},exports.biEquals=function(n){return function(r){return n.equals(r)}},exports.biCompare=function(n){return function(r){return n.compare(r)}},exports.abs=function(n){return n.abs()},exports.even=function(n){return n.isEven()},exports.odd=function(n){return n.isOdd()},exports.prime=function(n){return n.isPrime()},exports.pow=function(n){return function(r){return n.pow(r)}},exports.not=function(n){return n.not()},exports.or=function(n){return function(r){return n.or(r)}},exports.xor=function(n){return function(r){return n.xor(r)}},exports.and=function(n){return function(r){return n.and(r)}},exports.shl=function(n){return function(r){return n.shiftLeft(r)}},exports.shr=function(n){return function(r){return n.shiftRight(r)}},exports.digitsInBase=function(n){return function(r){return r.toArray(n)}}; +},{"big-integer":"9xaU"}],"2lBd":[function(require,module,exports) { +"use strict";exports.fromNumberImpl=function(r){return function(n){return function(t){return(0|t)===t?r(t):n}}},exports.toNumber=function(r){return r},exports.fromStringAsImpl=function(r){return function(n){return function(t){var u;u=t<11?"[0-"+(t-1).toString()+"]":11===t?"[0-9a]":"[0-9a-"+String.fromCharCode(86+t)+"]";var o=new RegExp("^[\\+\\-]?"+u+"+$","i");return function(u){if(o.test(u)){var e=parseInt(u,t);return(0|e)===e?r(e):n}return n}}}},exports.toStringAs=function(r){return function(n){return n.toString(r)}},exports.quot=function(r){return function(n){return r/n|0}},exports.rem=function(r){return function(n){return r%n}},exports.pow=function(r){return function(n){return 0|Math.pow(r,n)}}; +},{}],"xYq2":[function(require,module,exports) { +"use strict";var n=require("../Data.Ring/index.js"),i=require("../Data.Semiring/index.js"),r=function(n,i){this.Ring0=n,this.recip=i},e=function(n){return n.recip},t=function(n){return function(r){return function(t){return i.mul(n.Ring0().Semiring0())(r)(e(n)(t))}}},u=function(n){return function(r){return function(t){return i.mul(n.Ring0().Semiring0())(e(n)(t))(r)}}},c=new r(function(){return n.ringNumber},function(n){return 1/n});module.exports={DivisionRing:r,recip:e,leftDiv:u,rightDiv:t,divisionringNumber:c}; +},{"../Data.Ring/index.js":"E2qH","../Data.Semiring/index.js":"11NF"}],"pJ2E":[function(require,module,exports) { +"use strict";exports.nan=NaN,exports.isNaN=isNaN,exports.infinity=1/0,exports.isFinite=isFinite,exports.readInt=function(t){return function(e){return parseInt(e,t)}},exports.readFloat=parseFloat; +},{}],"aQlK":[function(require,module,exports) { +"use strict";var i=require("./foreign.js");module.exports={nan:i.nan,isNaN:i.isNaN,infinity:i.infinity,isFinite:i.isFinite,readInt:i.readInt,readFloat:i.readFloat}; +},{"./foreign.js":"pJ2E"}],"9/+z":[function(require,module,exports) { +"use strict";exports.abs=Math.abs,exports.acos=Math.acos,exports.asin=Math.asin,exports.atan=Math.atan,exports.atan2=function(t){return function(r){return Math.atan2(t,r)}},exports.ceil=Math.ceil,exports.cos=Math.cos,exports.exp=Math.exp,exports.floor=Math.floor,exports.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)},exports.log=Math.log,exports.max=function(t){return function(r){return Math.max(t,r)}},exports.min=function(t){return function(r){return Math.min(t,r)}},exports.pow=function(t){return function(r){return Math.pow(t,r)}},exports.remainder=function(t){return function(r){return t%r}},exports.round=Math.round,exports.sin=Math.sin,exports.sqrt=Math.sqrt,exports.tan=Math.tan,exports.e=Math.E,exports.ln2=Math.LN2,exports.ln10=Math.LN10,exports.log2e=Math.LOG2E,exports.log10e=Math.LOG10E,exports.pi=Math.PI,exports.tau=2*Math.PI,exports.sqrt1_2=Math.SQRT1_2,exports.sqrt2=Math.SQRT2; +},{}],"Rpaz":[function(require,module,exports) { +"use strict";var a=require("./foreign.js");module.exports={abs:a.abs,acos:a.acos,asin:a.asin,atan:a.atan,atan2:a.atan2,ceil:a.ceil,cos:a.cos,exp:a.exp,floor:a.floor,log:a.log,max:a.max,min:a.min,pow:a.pow,round:a.round,sin:a.sin,sqrt:a.sqrt,tan:a.tan,trunc:a.trunc,remainder:a.remainder,e:a.e,ln2:a.ln2,ln10:a.ln10,log2e:a.log2e,log10e:a.log10e,pi:a.pi,tau:a.tau,sqrt1_2:a.sqrt1_2,sqrt2:a.sqrt2}; +},{"./foreign.js":"9/+z"}],"xNJb":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),e=require("../Control.Category/index.js"),t=require("../Data.Boolean/index.js"),r=require("../Data.Bounded/index.js"),i=require("../Data.CommutativeRing/index.js"),u=require("../Data.DivisionRing/index.js"),o=require("../Data.Eq/index.js"),a=require("../Data.EuclideanRing/index.js"),c=require("../Data.Maybe/index.js"),f=require("../Data.Ord/index.js"),l=require("../Data.Ordering/index.js"),d=require("../Data.Ring/index.js"),s=require("../Data.Semiring/index.js"),m=require("../Data.Show/index.js"),v=require("../Global/index.js"),w=require("../Math/index.js"),g=function(n){return n},q=function(){function n(){}return n.value=new n,n}(),h=function(){function n(){}return n.value=new n,n}(),D=new m.Show(function(n){if(n instanceof q)return"Even";if(n instanceof h)return"Odd";throw new Error("Failed pattern match at Data.Int (line 112, column 1 - line 114, column 19): "+[n.constructor.name])}),b=function(n){if(n>=2&&n<=36)return new c.Just(n);if(t.otherwise)return c.Nothing.value;throw new Error("Failed pattern match at Data.Int (line 193, column 1 - line 193, column 28): "+[n.constructor.name])},x=function(n){return 0!=(1&n)},y=8,j=16,p=n.fromStringAsImpl(c.Just.create)(c.Nothing.value),E=p(10),I=n.fromNumberImpl(c.Just.create)(c.Nothing.value),R=function(e){if(e===v.infinity)return 0;if(e===-v.infinity)return 0;if(e>=n.toNumber(r.top(r.boundedInt)))return r.top(r.boundedInt);if(e<=n.toNumber(r.bottom(r.boundedInt)))return r.bottom(r.boundedInt);if(t.otherwise)return c.fromMaybe(0)(I(e));throw new Error("Failed pattern match at Data.Int (line 66, column 1 - line 66, column 29): "+[e.constructor.name])},N=function(n){return R(w.round(n))},P=function(n){return R(w.floor(n))},S=function(n){return 0==(1&n)},F=function(n){return S(n)?q.value:h.value},O=new o.Eq(function(n){return function(e){return n instanceof q&&e instanceof q||n instanceof h&&e instanceof h}}),A=new f.Ord(function(){return O},function(n){return function(e){if(n instanceof q&&e instanceof q)return l.EQ.value;if(n instanceof q)return l.LT.value;if(e instanceof q)return l.GT.value;if(n instanceof h&&e instanceof h)return l.EQ.value;throw new Error("Failed pattern match at Data.Int (line 110, column 1 - line 110, column 40): "+[n.constructor.name,e.constructor.name])}}),C=new s.Semiring(function(n){return function(e){return o.eq(O)(n)(e)?q.value:h.value}},function(n){return function(e){return n instanceof h&&e instanceof h?h.value:q.value}},h.value,q.value),B=new d.Ring(function(){return C},s.add(C)),J=new u.DivisionRing(function(){return B},e.identity(e.categoryFn)),M=10,G=new i.CommutativeRing(function(){return B}),Q=new a.EuclideanRing(function(){return G},function(n){if(n instanceof q)return 0;if(n instanceof h)return 1;throw new Error("Failed pattern match at Data.Int (line 132, column 1 - line 136, column 17): "+[n.constructor.name])},function(n){return function(e){return n}},function(n){return function(n){return q.value}}),T=function(n){return R(w.ceil(n))},L=new r.Bounded(function(){return A},q.value,h.value),k=2,z=36;module.exports={fromNumber:I,ceil:T,floor:P,round:N,fromString:E,radix:b,binary:k,octal:y,decimal:M,hexadecimal:j,base36:z,fromStringAs:p,Even:q,Odd:h,parity:F,even:S,odd:x,eqParity:O,ordParity:A,showParity:D,boundedParity:L,semiringParity:C,ringParity:B,commutativeRingParity:G,euclideanRingParity:Q,divisionRingParity:J,toNumber:n.toNumber,toStringAs:n.toStringAs,quot:n.quot,rem:n.rem,pow:n.pow}; +},{"./foreign.js":"2lBd","../Control.Category/index.js":"IAi2","../Data.Boolean/index.js":"ObQr","../Data.Bounded/index.js":"kcUU","../Data.CommutativeRing/index.js":"60TQ","../Data.DivisionRing/index.js":"xYq2","../Data.Eq/index.js":"Pq4F","../Data.EuclideanRing/index.js":"2IRB","../Data.Maybe/index.js":"5mN7","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Ring/index.js":"E2qH","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7","../Global/index.js":"aQlK","../Math/index.js":"Rpaz"}],"g11n":[function(require,module,exports) { +"use strict";exports.fromCharArray=function(n){return n.join("")},exports.toCharArray=function(n){return n.split("")},exports.singleton=function(n){return n},exports._charAt=function(n){return function(t){return function(r){return function(u){return r>=0&&re.length)return t;var o=e.indexOf(r,u);return-1===o?t:n(o)}}}}},exports._lastIndexOf=function(n){return function(t){return function(r){return function(u){var e=u.lastIndexOf(r);return-1===e?t:n(e)}}}},exports["_lastIndexOf'"]=function(n){return function(t){return function(r){return function(u){return function(e){if(u<0||u>e.length)return t;var o=e.lastIndexOf(r,u);return-1===o?t:n(o)}}}}},exports.take=function(n){return function(t){return t.substr(0,n)}},exports.drop=function(n){return function(t){return t.substring(n)}},exports._slice=function(n){return function(t){return function(r){return r.slice(n,t)}}},exports.splitAt=function(n){return function(t){return{before:t.substring(0,n),after:t.substring(n)}}}; +},{}],"iZpG":[function(require,module,exports) { +"use strict";exports.charAt=function(r){return function(t){if(r>=0&&r=a||c<0||c>a||f>c?e.Nothing.value:new e.Just(t._slice(r)(u)(i))}}},f=t["_lastIndexOf'"](e.Just.create)(e.Nothing.value),l=t._lastIndexOf(e.Just.create)(e.Nothing.value),s=function(n){return function(r){var u=l(n)(r);return u instanceof e.Just&&u.value0===(t.length(r)-t.length(n)|0)?e.Just.create(t.take(u.value0)(r)):e.Nothing.value}},h=t["_indexOf'"](e.Just.create)(e.Nothing.value),g=t._indexOf(e.Just.create)(e.Nothing.value),d=function(n){return function(r){var u=g(n)(r);return u instanceof e.Just&&0===u.value0?e.Just.create(t.drop(t.length(n))(r)):e.Nothing.value}},v=function(n){return function(e){return t.drop(t.countPrefix(n)(e))(e)}},x=function(n){return function(e){return t.take(t.length(e)-n|0)(e)}},p=function(t){var n=g(t);return function(t){return e.isJust(n(t))}},J=t._charAt(e.Just.create)(e.Nothing.value);module.exports={stripPrefix:d,stripSuffix:s,contains:p,charAt:J,toChar:i,uncons:u,indexOf:g,"indexOf'":h,lastIndexOf:l,"lastIndexOf'":f,takeRight:o,takeWhile:a,dropRight:x,dropWhile:v,slice:c,singleton:t.singleton,fromCharArray:t.fromCharArray,toCharArray:t.toCharArray,length:t.length,countPrefix:t.countPrefix,take:t.take,drop:t.drop,splitAt:t.splitAt}; +},{"./foreign.js":"g11n","../Data.Boolean/index.js":"ObQr","../Data.Maybe/index.js":"5mN7","../Data.String.Unsafe/index.js":"5UWM"}],"B+B2":[function(require,module,exports) { +"use strict";exports._localeCompare=function(r){return function(n){return function(t){return function(e){return function(o){var u=e.localeCompare(o);return u<0?r:u>0?t:n}}}}},exports.replace=function(r){return function(n){return function(t){return t.replace(r,n)}}},exports.replaceAll=function(r){return function(n){return function(t){return t.replace(new RegExp(r.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}}},exports.split=function(r){return function(n){return n.split(r)}},exports.toLower=function(r){return r.toLowerCase()},exports.toUpper=function(r){return r.toUpperCase()},exports.trim=function(r){return r.trim()},exports.joinWith=function(r){return function(n){return n.join(r)}}; +},{}],"OSrc":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),r=require("../Data.Ordering/index.js"),l=function(e){return""===e},o=e._localeCompare(r.LT.value)(r.EQ.value)(r.GT.value);module.exports={null:l,localeCompare:o,replace:e.replace,replaceAll:e.replaceAll,split:e.split,toLower:e.toLower,toUpper:e.toUpper,trim:e.trim,joinWith:e.joinWith}; +},{"./foreign.js":"B+B2","../Data.Ordering/index.js":"5Eun"}],"Ph6A":[function(require,module,exports) { +"use strict";var n=require("../Control.Bind/index.js"),r=require("../Data.Eq/index.js"),t=require("../Data.Foldable/index.js"),e=require("../Data.Maybe/index.js"),i=require("../Data.Monoid/index.js"),o=require("../Data.Ord/index.js"),u=require("../Data.Semigroup/index.js"),c=require("../Data.Show/index.js"),a=require("../Data.String.CodeUnits/index.js"),f=require("../Data.String.Common/index.js"),p=require("../Data.Symbol/index.js"),m=function(n){return n},s=function(n){return n},l=function(n){this.nes=n},d=function(n){return f.toUpper(n)},S=function(n){return n},g=function(n){return f.toLower(n)},y=new c.Show(function(n){return"(NonEmptyString.unsafeFromString "+c.show(c.showString)(n)+")"}),E=new c.Show(function(n){return"(NonEmptyReplacement "+c.show(y)(n)+")"}),x=u.semigroupString,N=x,q=function(n){return function(r){return function(t){return f.replaceAll(n)(r)(t)}}},w=function(n){return function(r){return function(t){return f.replace(n)(r)(t)}}},j=function(n){return function(r){return n+r}},h=o.ordString,b=h,D=function(n){return new l(function(r){return p.reflectSymbol(n)(r)})},F=function(n){return n.nes},v=function(n){return new l(function(n){return""})},R=function(n){return function(r){return f.localeCompare(n)(r)}},C=function(n){return function(r){return n(r)}},M=function(n){return function(r){var e=t.intercalate(n.Foldable0())(i.monoidString)(r);return function(n){return m(e(n))}}},U=function(n){return function(r){var e=t.intercalate(n)(i.monoidString)(r);return function(n){return e(n)}}},W=function(n){return function(r){var t=U(n.Foldable0())(r);return function(n){return m(t(n))}}},k=function(n){return""===n?e.Nothing.value:new e.Just(n)},A=function(r){return n.composeKleisliFlipped(e.bindMaybe)(k)(C(a.stripPrefix(r)))},B=function(r){return n.composeKleisliFlipped(e.bindMaybe)(k)(C(a.stripSuffix(r)))},J=function(n){return k(f.trim(n))},K=function(n){var r=e.fromJust(n);return function(n){return r(k(n))}},L=r.eqString,P=L,O=function(n){return C(a.contains(n))},z=function(n){return function(r){return n+r}};module.exports={nes:F,NonEmptyString:m,MakeNonEmpty:l,NonEmptyReplacement:s,fromString:k,unsafeFromString:K,toString:S,appendString:z,prependString:j,stripPrefix:A,stripSuffix:B,contains:O,localeCompare:R,replace:w,replaceAll:q,toLower:g,toUpper:d,trim:J,joinWith:U,join1With:W,joinWith1:M,liftS:C,eqNonEmptyString:L,ordNonEmptyString:h,semigroupNonEmptyString:x,showNonEmptyString:y,makeNonEmptyBad:v,nonEmptyNonEmpty:D,eqNonEmptyReplacement:P,ordNonEmptyReplacement:b,semigroupNonEmptyReplacement:N,showNonEmptyReplacement:E}; +},{"../Control.Bind/index.js":"7VcT","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Ord/index.js":"r4Vb","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7","../Data.String.CodeUnits/index.js":"6c6X","../Data.String.Common/index.js":"OSrc","../Data.Symbol/index.js":"4oJQ"}],"Zx+T":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),e=require("../Data.CommutativeRing/index.js"),r=require("../Data.Eq/index.js"),i=require("../Data.EuclideanRing/index.js"),t=require("../Data.Int/index.js"),o=require("../Data.Maybe/index.js"),u=require("../Data.Ord/index.js"),a=require("../Data.Ordering/index.js"),s=require("../Data.Ring/index.js"),d=require("../Data.Semiring/index.js"),m=require("../Data.Show/index.js"),g=require("../Data.String.NonEmpty.Internal/index.js"),f=n.toBase(10),b=function(e){return function(r){return o.fromJust()(g.fromString(n.toBase(e)(r)))}},c=b(10),q=new m.Show(function(n){return'fromString "'+f(n)+'"'}),B=new d.Semiring(n.biAdd,n.biMul,n.fromInt(1),n.fromInt(0)),l=new s.Ring(function(){return B},n.biSub),v=n.biMod,I=n.biDiv,x=n["fromNumber'"](o.Just.create)(o.Nothing.value),D=n["fromBase'"](o.Just.create)(o.Nothing.value),j=D(10),w=new r.Eq(n.biEquals),S=new u.Ord(function(){return w},function(e){return function(r){var i=n.biCompare(e)(r);return 1===i?a.GT.value:0===i?a.EQ.value:a.LT.value}}),h=new e.CommutativeRing(function(){return l}),N=new i.EuclideanRing(function(){return h},function(e){return t.floor(n.toNumber(n.abs(e)))},function(e){return function(r){return n.biDiv(s.sub(l)(e)(i.mod(N)(e)(r)))(r)}},function(e){return function(r){var i=n.abs(r);return n.biMod(d.add(B)(n.biMod(e)(i))(i))(i)}});module.exports={fromString:j,fromBase:D,fromNumber:x,toString:f,toNonEmptyString:c,"toBase'":b,quot:I,rem:v,eqBigInt:w,ordBigInt:S,showBigInt:q,semiringBigInt:B,ringBigInt:l,commutativeRingBigInt:h,euclideanRingBigInt:N,fromInt:n.fromInt,toBase:n.toBase,digitsInBase:n.digitsInBase,abs:n.abs,even:n.even,odd:n.odd,prime:n.prime,pow:n.pow,not:n.not,or:n.or,xor:n.xor,and:n.and,shl:n.shl,shr:n.shr,toNumber:n.toNumber}; +},{"./foreign.js":"S0gh","../Data.CommutativeRing/index.js":"60TQ","../Data.Eq/index.js":"Pq4F","../Data.EuclideanRing/index.js":"2IRB","../Data.Int/index.js":"xNJb","../Data.Maybe/index.js":"5mN7","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Ring/index.js":"E2qH","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7","../Data.String.NonEmpty.Internal/index.js":"Ph6A"}],"HkJx":[function(require,module,exports) { +"use strict";var r=require("../Control.MonadZero/index.js"),o=function(r){this.MonadZero0=r},n=new o(function(){return r.monadZeroArray});module.exports={MonadPlus:o,monadPlusArray:n}; +},{"../Control.MonadZero/index.js":"lD5R"}],"qF8i":[function(require,module,exports) { +"use strict";var n=require("../Control.Alt/index.js"),e=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),t=require("../Control.Category/index.js"),u=require("../Control.Plus/index.js"),o=require("../Data.Eq/index.js"),i=require("../Data.Foldable/index.js"),a=require("../Data.FoldableWithIndex/index.js"),l=require("../Data.Functor/index.js"),c=require("../Data.FunctorWithIndex/index.js"),f=require("../Data.Maybe/index.js"),d=require("../Data.Ord/index.js"),p=require("../Data.Ordering/index.js"),v=require("../Data.Semigroup/index.js"),s=require("../Data.Semigroup.Foldable/index.js"),x=require("../Data.Show/index.js"),q=require("../Data.Traversable/index.js"),m=require("../Data.TraversableWithIndex/index.js"),y=require("../Data.Tuple/index.js"),h=require("../Data.Unfoldable/index.js"),b=require("../Data.Unfoldable1/index.js"),w=function(){function n(n,e){this.value0=n,this.value1=e}return n.create=function(e){return function(r){return new n(e,r)}},n}(),j=function(n){return new b.Unfoldable1(function(e){return function(r){return y.uncurry(w.create)(l.map(y.functorTuple)(h.unfoldr(n)(l.map(f.functorMaybe)(e)))(e(r)))}})},E=function(n){return n.value1},F=function(n){return function(e){return new w(e,u.empty(n))}},N=function(n){return function(e){return new x.Show(function(r){return"(NonEmpty "+x.show(n)(r.value0)+" "+x.show(e)(r.value1)+")"})}},D=function(r){return function(t){return n.alt(r.Plus1().Alt0())(e.pure(r.Applicative0())(t.value0))(t.value1)}},I=function(n){return n.value0},W=function(n){return new l.Functor(function(e){return function(r){return new w(e(r.value0),l.map(n)(e)(r.value1))}})},g=function(n){return new c.FunctorWithIndex(function(){return W(n.Functor0())},function(e){return function(r){return new w(e(f.Nothing.value)(r.value0),c.mapWithIndex(n)(function(n){return e(f.Just.create(n))})(r.value1))}})},A=function(n){return function(e){return n(e.value0)(e.value1)}},T=function(n){return function(e){return function(r){return i.foldl(n)(e)(r.value0)(r.value1)}}},C=function(n){return new i.Foldable(function(e){return function(r){return function(t){return v.append(e.Semigroup0())(r(t.value0))(i.foldMap(n)(e)(r)(t.value1))}}},function(e){return function(r){return function(t){return i.foldl(n)(e)(e(r)(t.value0))(t.value1)}}},function(e){return function(r){return function(t){return e(t.value0)(i.foldr(n)(e)(r)(t.value1))}}})},S=function(n){return new a.FoldableWithIndex(function(){return C(n.Foldable0())},function(e){return function(r){return function(t){return v.append(e.Semigroup0())(r(f.Nothing.value)(t.value0))(a.foldMapWithIndex(n)(e)(function(n){return r(f.Just.create(n))})(t.value1))}}},function(e){return function(r){return function(t){return a.foldlWithIndex(n)(function(n){return e(f.Just.create(n))})(e(f.Nothing.value)(r)(t.value0))(t.value1)}}},function(e){return function(r){return function(t){return e(f.Nothing.value)(t.value0)(a.foldrWithIndex(n)(function(n){return e(f.Just.create(n))})(r)(t.value1))}}})},J=function(n){return new q.Traversable(function(){return C(n.Foldable1())},function(){return W(n.Functor0())},function(e){return function(t){return r.apply(e.Apply0())(l.map(e.Apply0().Functor0())(w.create)(t.value0))(q.sequence(n)(e)(t.value1))}},function(e){return function(t){return function(u){return r.apply(e.Apply0())(l.map(e.Apply0().Functor0())(w.create)(t(u.value0)))(q.traverse(n)(e)(t)(u.value1))}}})},M=function(n){return new m.TraversableWithIndex(function(){return S(n.FoldableWithIndex1())},function(){return g(n.FunctorWithIndex0())},function(){return J(n.Traversable2())},function(e){return function(t){return function(u){return r.apply(e.Apply0())(l.map(e.Apply0().Functor0())(w.create)(t(f.Nothing.value)(u.value0)))(m.traverseWithIndex(n)(e)(function(n){return t(f.Just.create(n))})(u.value1))}}})},O=function n(e){return new s.Foldable1(function(){return C(e)},function(r){return s.foldMap1(n(e))(r)(t.identity(t.categoryFn))},function(n){return function(r){return function(t){return i.foldl(e)(function(e){return function(t){return v.append(n)(e)(r(t))}})(r(t.value0))(t.value1)}}})},U=function(n){return function(e){return new o.Eq(function(r){return function(t){return o.eq(e)(r.value0)(t.value0)&&o.eq1(n)(e)(r.value1)(t.value1)}})}},G=function(n){return function(e){return new d.Ord(function(){return U(n.Eq10())(e.Eq0())},function(r){return function(t){var u=d.compare(e)(r.value0)(t.value0);return u instanceof p.LT?p.LT.value:u instanceof p.GT?p.GT.value:d.compare1(n)(e)(r.value1)(t.value1)}})}},L=function(n){return new o.Eq1(function(e){return o.eq(U(n)(e))})},P=function(n){return new d.Ord1(function(){return L(n.Eq10())},function(e){return d.compare(G(n)(e))})};module.exports={NonEmpty:w,singleton:F,foldl1:T,fromNonEmpty:A,oneOf:D,head:I,tail:E,showNonEmpty:N,eqNonEmpty:U,eq1NonEmpty:L,ordNonEmpty:G,ord1NonEmpty:P,functorNonEmpty:W,functorWithIndex:g,foldableNonEmpty:C,foldableWithIndexNonEmpty:S,traversableNonEmpty:J,traversableWithIndexNonEmpty:M,foldable1NonEmpty:O,unfoldable1NonEmpty:j}; +},{"../Control.Alt/index.js":"lN+m","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Category/index.js":"IAi2","../Control.Plus/index.js":"oMBg","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.FoldableWithIndex/index.js":"9Efi","../Data.Functor/index.js":"+0AE","../Data.FunctorWithIndex/index.js":"OHRN","../Data.Maybe/index.js":"5mN7","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Semigroup/index.js":"EsAJ","../Data.Semigroup.Foldable/index.js":"ht+A","../Data.Show/index.js":"mFY7","../Data.Traversable/index.js":"n7EE","../Data.TraversableWithIndex/index.js":"V4EF","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z","../Data.Unfoldable1/index.js":"S0Nl"}],"Xxuc":[function(require,module,exports) { +"use strict";var n=require("../Control.Alt/index.js"),e=require("../Control.Alternative/index.js"),t=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),u=require("../Control.Bind/index.js"),i=require("../Control.Category/index.js"),o=require("../Control.Comonad/index.js"),a=require("../Control.Extend/index.js"),l=require("../Control.Monad/index.js"),c=require("../Control.MonadPlus/index.js"),f=require("../Control.MonadZero/index.js"),v=require("../Control.Plus/index.js"),s=require("../Data.Eq/index.js"),d=require("../Data.Foldable/index.js"),p=require("../Data.FoldableWithIndex/index.js"),m=require("../Data.Function/index.js"),w=require("../Data.Functor/index.js"),y=require("../Data.FunctorWithIndex/index.js"),x=require("../Data.Maybe/index.js"),E=require("../Data.Monoid/index.js"),L=require("../Data.Newtype/index.js"),h=require("../Data.NonEmpty/index.js"),N=require("../Data.Ord/index.js"),b=require("../Data.Ordering/index.js"),q=require("../Data.Semigroup/index.js"),j=require("../Data.Semigroup.Traversable/index.js"),I=require("../Data.Semiring/index.js"),D=require("../Data.Show/index.js"),W=require("../Data.Traversable/index.js"),F=require("../Data.TraversableWithIndex/index.js"),T=require("../Data.Tuple/index.js"),g=require("../Data.Unfoldable/index.js"),C=require("../Data.Unfoldable1/index.js"),A=function(){function n(){}return n.value=new n,n}(),M=function(){function n(n,e){this.value0=n,this.value1=e}return n.create=function(e){return function(t){return new n(e,t)}},n}(),S=function(n){return n},P=function(n){return new M(n.value0,n.value1)},O=new L.Newtype(function(n){return n},S),U=function(n){return function(e){return new h.NonEmpty(n,new M(e.value0,e.value1))}},B=function(n){var e;return e=A.value,function(t){var r,u=e,i=!1;function o(e,r){return r instanceof M&&r.value1 instanceof M&&r.value1.value1 instanceof M?(u=new M(r,e),void(t=r.value1.value1.value1)):(i=!0,(a=e,function(e){for(var t,r,u,i=a,o=!1;!o;)u=e,t=(r=i)instanceof M&&r.value0 instanceof M&&r.value0.value1 instanceof M&&r.value0.value1.value1 instanceof M?(i=r.value1,void(e=new M(n(r.value0.value0),new M(n(r.value0.value1.value0),new M(n(r.value0.value1.value1.value0),u))))):(o=!0,u);return t})((o=r)instanceof M&&o.value1 instanceof M&&o.value1.value1 instanceof A?new M(n(o.value0),new M(n(o.value1.value0),A.value)):o instanceof M&&o.value1 instanceof A?new M(n(o.value0),A.value):A.value));var o,a}for(;!i;)r=o(u,t);return r}},Z=new w.Functor(B),J=h.functorNonEmpty(Z),Q=new d.Foldable(function(n){return function(e){return d.foldl(Q)(function(t){var r=q.append(n.Semigroup0())(t);return function(n){return r(e(n))}})(E.mempty(n))}},function(n){return function(e){return function(t){var r,u=e,i=!1;function o(e,r){if(r instanceof A)return i=!0,e;if(r instanceof M)return u=n(e)(r.value0),void(t=r.value1);throw new Error("Failed pattern match at Data.List.Types (line 109, column 12 - line 111, column 30): "+[r.constructor.name])}for(;!i;)r=o(u,t);return r}}},function(n){return function(e){var t=d.foldl(Q)(m.flip(M.create))(A.value),r=d.foldl(Q)(m.flip(n))(e);return function(n){return r(t(n))}}}),G=h.foldableNonEmpty(Q),k=new p.FoldableWithIndex(function(){return Q},function(n){return function(e){return p.foldlWithIndex(k)(function(t){return function(r){var u=q.append(n.Semigroup0())(r),i=e(t);return function(n){return u(i(n))}}})(E.mempty(n))}},function(n){return function(e){var t=d.foldl(Q)(function(e){return function(t){return new T.Tuple(e.value0+1|0,n(e.value0)(e.value1)(t))}})(new T.Tuple(0,e));return function(n){return T.snd(t(n))}}},function(n){return function(e){return function(t){var r=d.foldl(Q)(function(n){return function(e){return new T.Tuple(n.value0+1|0,new M(e,n.value1))}})(new T.Tuple(0,A.value))(t);return T.snd(d.foldl(Q)(function(e){return function(t){return new T.Tuple(e.value0-1|0,n(e.value0-1|0)(t)(e.value1))}})(new T.Tuple(r.value0,e))(r.value1))}}}),z=new p.FoldableWithIndex(function(){return G},function(n){return function(e){return function(t){return p.foldMapWithIndex(h.foldableWithIndexNonEmpty(k))(n)((r=x.maybe(0)(I.add(I.semiringInt)(1)),function(n){return e(r(n))}))(t);var r}}},function(n){return function(e){return function(t){return p.foldlWithIndex(h.foldableWithIndexNonEmpty(k))((r=x.maybe(0)(I.add(I.semiringInt)(1)),function(e){return n(r(e))}))(e)(t);var r}}},function(n){return function(e){return function(t){return p.foldrWithIndex(h.foldableWithIndexNonEmpty(k))((r=x.maybe(0)(I.add(I.semiringInt)(1)),function(e){return n(r(e))}))(e)(t);var r}}}),H=new y.FunctorWithIndex(function(){return Z},function(n){return p.foldrWithIndex(k)(function(e){return function(t){return function(r){return new M(n(e)(t),r)}}})(A.value)}),K=new y.FunctorWithIndex(function(){return J},function(n){return function(e){return S(y.mapWithIndex(h.functorWithIndex(H))((t=x.maybe(0)(I.add(I.semiringInt)(1)),function(e){return n(t(e))}))(e));var t}}),R=new q.Semigroup(function(n){return function(e){return d.foldr(Q)(M.create)(e)(n)}}),V=new E.Monoid(function(){return R},A.value),X=new q.Semigroup(function(n){return function(e){return new h.NonEmpty(n.value0,q.append(R)(n.value1)(P(e)))}}),Y=function(n){return new D.Show(function(e){return e instanceof A?"Nil":"("+d.intercalate(Q)(E.monoidString)(" : ")(w.map(Z)(D.show(n))(e))+" : Nil)"})},$=function(n){return new D.Show(function(e){return"(NonEmptyList "+D.show(h.showNonEmpty(n)(Y(n)))(e)+")"})},_=new W.Traversable(function(){return Q},function(){return Z},function(n){return W.traverse(_)(n)(i.identity(i.categoryFn))},function(n){return function(e){var u=w.map(n.Apply0().Functor0())(d.foldl(Q)(m.flip(M.create))(A.value)),i=d.foldl(Q)(function(t){var u=r.lift2(n.Apply0())(m.flip(M.create))(t);return function(n){return u(e(n))}})(t.pure(n)(A.value));return function(n){return u(i(n))}}}),nn=h.traversableNonEmpty(_),en=new F.TraversableWithIndex(function(){return k},function(){return H},function(){return _},function(n){return function(e){var u=d.foldl(Q)(m.flip(M.create))(A.value),i=w.map(n.Apply0().Functor0())(u),o=p.foldlWithIndex(k)(function(t){return function(u){var i=r.lift2(n.Apply0())(m.flip(M.create))(u),o=e(t);return function(n){return i(o(n))}}})(t.pure(n)(A.value));return function(n){return i(o(n))}}}),tn=new F.TraversableWithIndex(function(){return z},function(){return K},function(){return nn},function(n){return function(e){return function(t){return w.map(n.Apply0().Functor0())(S)(F.traverseWithIndex(h.traversableWithIndexNonEmpty(en))(n)((r=x.maybe(0)(I.add(I.semiringInt)(1)),function(n){return e(r(n))}))(t));var r}}}),rn=new C.Unfoldable1(function(n){return function(e){var t;return(t=e,function(e){var r,u=t,i=!1;function o(t,r){var o=n(t);if(o.value1 instanceof x.Just)return u=o.value1.value0,void(e=new M(o.value0,r));if(o.value1 instanceof x.Nothing)return i=!0,d.foldl(Q)(m.flip(M.create))(A.value)(new M(o.value0,r));throw new Error("Failed pattern match at Data.List.Types (line 133, column 22 - line 135, column 61): "+[o.constructor.name])}for(;!i;)r=o(u,e);return r})(A.value)}}),un=new g.Unfoldable(function(){return rn},function(n){return function(e){var t;return(t=e,function(e){var r,u=t,i=!1;function o(t,r){var o=n(t);if(o instanceof x.Nothing)return i=!0,d.foldl(Q)(m.flip(M.create))(A.value)(r);if(o instanceof x.Just)return u=o.value0.value1,void(e=new M(o.value0.value0,r));throw new Error("Failed pattern match at Data.List.Types (line 140, column 22 - line 142, column 52): "+[o.constructor.name])}for(;!i;)r=o(u,e);return r})(A.value)}}),on=h.unfoldable1NonEmpty(un),an=h.foldable1NonEmpty(Q),ln=new a.Extend(function(){return J},function(n){return function(e){return new h.NonEmpty(n(e),d.foldr(Q)(function(e){return function(t){return{val:new M(n(new h.NonEmpty(e,t.acc)),t.val),acc:new M(e,t.acc)}}})({val:A.value,acc:A.value})(e.value1).val)}}),cn=new a.Extend(function(){return Z},function(n){return function(e){if(e instanceof A)return A.value;if(e instanceof M){return new M(n(e),d.foldr(Q)(function(e){return function(t){var r=new M(e,t.acc);return{val:new M(n(r),t.val),acc:r}}})({val:A.value,acc:A.value})(e.value1).val)}throw new Error("Failed pattern match at Data.List.Types (line 180, column 1 - line 187, column 42): "+[n.constructor.name,e.constructor.name])}}),fn=new s.Eq1(function(n){return function(e){return function(t){var r;return(r=e,function(e){return function(t){for(var u,i,o,a,l=r,c=e,f=!1;!f;)i=l,o=c,u=(a=t)?i instanceof A&&o instanceof A?(f=!0,a):i instanceof M&&o instanceof M?(l=i.value1,c=o.value1,void(t=a&&s.eq(n)(o.value0)(i.value0))):(f=!0,!1):(f=!0,!1);return u}})(t)(!0)}}}),vn=function(n){return new s.Eq(s.eq1(fn)(n))},sn=function(n){return h.eqNonEmpty(fn)(n)},dn=new N.Ord1(function(){return fn},function(n){return function(e){return function(t){var r;return(r=e,function(e){var t,u=r,i=!1;function o(t,r){if(t instanceof A&&r instanceof A)return i=!0,b.EQ.value;if(t instanceof A)return i=!0,b.LT.value;if(r instanceof A)return i=!0,b.GT.value;if(t instanceof M&&r instanceof M){var o=N.compare(n)(t.value0)(r.value0);return o instanceof b.EQ?(u=t.value1,void(e=r.value1)):(i=!0,o)}throw new Error("Failed pattern match at Data.List.Types (line 61, column 5 - line 61, column 20): "+[t.constructor.name,r.constructor.name])}for(;!i;)t=o(u,e);return t})(t)}}}),pn=function(n){return new N.Ord(function(){return vn(n.Eq0())},N.compare1(dn)(n))},mn=function(n){return h.ordNonEmpty(dn)(n)},wn=new o.Comonad(function(){return ln},function(n){return n.value0}),yn=new r.Apply(function(){return Z},function(n){return function(e){if(n instanceof A)return A.value;if(n instanceof M)return q.append(R)(w.map(Z)(n.value0)(e))(r.apply(yn)(n.value1)(e));throw new Error("Failed pattern match at Data.List.Types (line 155, column 1 - line 157, column 48): "+[n.constructor.name,e.constructor.name])}}),xn=new r.Apply(function(){return J},function(n){return function(e){return new h.NonEmpty(n.value0(e.value0),q.append(R)(r.apply(yn)(n.value1)(new M(e.value0,A.value)))(r.apply(yn)(new M(n.value0,n.value1))(e.value1)))}}),En=new u.Bind(function(){return yn},function(n){return function(e){if(n instanceof A)return A.value;if(n instanceof M)return q.append(R)(e(n.value0))(u.bind(En)(n.value1)(e));throw new Error("Failed pattern match at Data.List.Types (line 162, column 1 - line 164, column 37): "+[n.constructor.name,e.constructor.name])}}),Ln=new u.Bind(function(){return xn},function(n){return function(e){var t=e(n.value0);return new h.NonEmpty(t.value0,q.append(R)(t.value1)(u.bind(En)(n.value1)(function(n){return P(e(n))})))}}),hn=new t.Applicative(function(){return yn},function(n){return new M(n,A.value)}),Nn=new l.Monad(function(){return hn},function(){return En}),bn=new n.Alt(function(){return J},q.append(X)),qn=new n.Alt(function(){return Z},q.append(R)),jn=new v.Plus(function(){return qn},A.value),In=new e.Alternative(function(){return hn},function(){return jn}),Dn=new f.MonadZero(function(){return In},function(){return Nn}),Wn=new c.MonadPlus(function(){return Dn}),Fn=new t.Applicative(function(){return xn},function(){var n=h.singleton(jn);return function(e){return S(n(e))}}()),Tn=new l.Monad(function(){return Fn},function(){return Ln}),gn=new j.Traversable1(function(){return an},function(){return nn},function(n){return j.traverse1(gn)(n)(i.identity(i.categoryFn))},function(n){return function(e){return function(u){return w.mapFlipped(n.Functor0())(d.foldl(Q)(function(t){var u=r.lift2(n)(m.flip(U))(t);return function(n){return u(e(n))}})(w.map(n.Functor0())(t.pure(Fn))(e(u.value0)))(u.value1))(function(n){return d.foldl(Q)(m.flip(U))(t.pure(Fn)(n.value0))(n.value1)})}}});module.exports={Nil:A,Cons:M,NonEmptyList:S,toList:P,nelCons:U,showList:Y,eqList:vn,eq1List:fn,ordList:pn,ord1List:dn,semigroupList:R,monoidList:V,functorList:Z,functorWithIndexList:H,foldableList:Q,foldableWithIndexList:k,unfoldable1List:rn,unfoldableList:un,traversableList:_,traversableWithIndexList:en,applyList:yn,applicativeList:hn,bindList:En,monadList:Nn,altList:qn,plusList:jn,alternativeList:In,monadZeroList:Dn,monadPlusList:Wn,extendList:cn,newtypeNonEmptyList:O,eqNonEmptyList:sn,ordNonEmptyList:mn,showNonEmptyList:$,functorNonEmptyList:J,applyNonEmptyList:xn,applicativeNonEmptyList:Fn,bindNonEmptyList:Ln,monadNonEmptyList:Tn,altNonEmptyList:bn,extendNonEmptyList:ln,comonadNonEmptyList:wn,semigroupNonEmptyList:X,foldableNonEmptyList:G,traversableNonEmptyList:nn,foldable1NonEmptyList:an,unfoldable1NonEmptyList:on,functorWithIndexNonEmptyList:K,foldableWithIndexNonEmptyList:z,traversableWithIndexNonEmptyList:tn,traversable1NonEmptyList:gn}; +},{"../Control.Alt/index.js":"lN+m","../Control.Alternative/index.js":"aHia","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Control.Comonad/index.js":"U0zO","../Control.Extend/index.js":"JIoJ","../Control.Monad/index.js":"U/Ix","../Control.MonadPlus/index.js":"HkJx","../Control.MonadZero/index.js":"lD5R","../Control.Plus/index.js":"oMBg","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.FoldableWithIndex/index.js":"9Efi","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.FunctorWithIndex/index.js":"OHRN","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Newtype/index.js":"lz8k","../Data.NonEmpty/index.js":"qF8i","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Semigroup/index.js":"EsAJ","../Data.Semigroup.Traversable/index.js":"qkfi","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7","../Data.Traversable/index.js":"n7EE","../Data.TraversableWithIndex/index.js":"V4EF","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z","../Data.Unfoldable1/index.js":"S0Nl"}],"ezw6":[function(require,module,exports) { +"use strict";var n=require("../Control.Alt/index.js"),e=require("../Control.Applicative/index.js"),t=require("../Control.Apply/index.js"),r=require("../Control.Bind/index.js"),u=require("../Control.Category/index.js"),o=require("../Control.Lazy/index.js"),i=require("../Control.Monad.Rec.Class/index.js"),a=require("../Data.Bifunctor/index.js"),c=require("../Data.Boolean/index.js"),l=require("../Data.Eq/index.js"),f=require("../Data.Foldable/index.js"),s=require("../Data.Function/index.js"),v=require("../Data.Functor/index.js"),m=require("../Data.FunctorWithIndex/index.js"),d=require("../Data.HeytingAlgebra/index.js"),w=require("../Data.List.Types/index.js"),p=require("../Data.Maybe/index.js"),C=require("../Data.Newtype/index.js"),h=require("../Data.NonEmpty/index.js"),N=require("../Data.Ord/index.js"),q=require("../Data.Ordering/index.js"),y=require("../Data.Semigroup/index.js"),D=require("../Data.Show/index.js"),L=require("../Data.Traversable/index.js"),b=require("../Data.Tuple/index.js"),x=require("../Data.Unfoldable/index.js"),F=require("../Data.Unit/index.js"),g=function(n){return n},E=function n(e){return function(t){return function(r){return 0===e&&r instanceof w.Cons?new p.Just(new w.Cons(t,r.value1)):r instanceof w.Cons?v.map(p.functorMaybe)(function(n){return new w.Cons(r.value0,n)})(n(e-1|0)(t)(r.value1)):p.Nothing.value}}},j=f.foldr(w.foldableList)(function(n){return function(e){return new b.Tuple(new w.Cons(n.value0,e.value0),new w.Cons(n.value1,e.value1))}})(new b.Tuple(w.Nil.value,w.Nil.value)),A=function(n){if(n instanceof w.Nil)return p.Nothing.value;if(n instanceof w.Cons)return new p.Just({head:n.value0,tail:n.value1});throw new Error("Failed pattern match at Data.List (line 259, column 1 - line 259, column 66): "+[n.constructor.name])},M=function(n){return x.unfoldr(n)(function(n){return v.map(p.functorMaybe)(function(n){return new b.Tuple(n.head,n.tail)})(A(n))})},J=function(n){if(n instanceof w.Nil)return p.Nothing.value;if(n instanceof w.Cons)return new p.Just(n.value1);throw new Error("Failed pattern match at Data.List (line 245, column 1 - line 245, column 43): "+[n.constructor.name])},B=function(n){return function(e){return function(t){return i.tailRecM2(i.monadRecMaybe)(function(e){return function(t){return e instanceof w.Cons&&t instanceof w.Cons&&l.eq(n)(e.value0)(t.value0)?p.Just.create(new i.Loop({a:e.value1,b:t.value1})):e instanceof w.Nil?p.Just.create(new i.Done(t)):p.Nothing.value}})(e)(t)}}},P=function n(e){return function(t){if(t instanceof w.Cons&&e(t.value0)){var r=n(e)(t.value1);return{init:new w.Cons(t.value0,r.init),rest:r.rest}}return{init:w.Nil.value,rest:t}}},T=function(n){return function(e){return f.foldr(w.foldableList)(w.Cons.create)(new w.Cons(e,w.Nil.value))(n)}},I=function(n){return new w.Cons(n,w.Nil.value)},W=function(n){var e=function e(t){return t instanceof w.Cons&&t.value1 instanceof w.Cons?new w.Cons(function e(t){return function(r){if(t instanceof w.Cons&&r instanceof w.Cons){if(l.eq(q.eqOrdering)(n(t.value0)(r.value0))(q.GT.value))return new w.Cons(r.value0,e(t)(r.value1));if(c.otherwise)return new w.Cons(t.value0,e(t.value1)(r))}if(t instanceof w.Nil)return r;if(r instanceof w.Nil)return t;throw new Error("Failed pattern match at Data.List (line 473, column 3 - line 473, column 38): "+[t.constructor.name,r.constructor.name])}}(t.value0)(t.value1.value0),e(t.value1.value1)):t},t=function(e){if(e instanceof w.Cons&&e.value1 instanceof w.Cons){if(l.eq(q.eqOrdering)(n(e.value0)(e.value1.value0))(q.GT.value))return r(e.value1.value0)(I(e.value0))(e.value1.value1);if(c.otherwise)return u(e.value1.value0)(function(n){return new w.Cons(e.value0,n)})(e.value1.value1)}return I(e)},r=function(e){return function(r){return function(u){var o,i,a,c,f=e,s=r,v=!1;for(;!v;)i=f,a=s,o=(c=u)instanceof w.Cons&&l.eq(q.eqOrdering)(n(i)(c.value0))(q.GT.value)?(f=c.value0,s=new w.Cons(i,a),void(u=c.value1)):(v=!0,new w.Cons(new w.Cons(i,a),t(c)));return o}}},u=function(e){return function(r){return function(u){var o,i=e,a=r,c=!1;function f(e,r,o){return o instanceof w.Cons&&l.notEq(q.eqOrdering)(n(e)(o.value0))(q.GT.value)?(i=o.value0,a=function(n){return r(new w.Cons(e,n))},void(u=o.value1)):(c=!0,new w.Cons(r(I(e)),t(o)))}for(;!c;)o=f(i,a,u);return o}}};return function(n){return function(n){var t,r=!1;function u(t){if(t instanceof w.Cons&&t.value1 instanceof w.Nil)return r=!0,t.value0;n=e(t)}for(;!r;)t=u(n);return t}(t(n))}},O=function(n){return function(e){return W(N.compare(n))(e)}},R=function n(e){if(e instanceof w.Nil)return I(w.Nil.value);if(e instanceof w.Cons)return new w.Cons(e,n(e.value1));throw new Error("Failed pattern match at Data.List (line 626, column 1 - line 626, column 43): "+[e.constructor.name])},z=function(n){return new D.Show(function(e){return"(Pattern "+D.show(w.showList(n))(e)+")"})},G=function(){var n;return n=w.Nil.value,function(e){var t,r=n,u=!1;function o(n,t){if(t instanceof w.Nil)return u=!0,n;if(t instanceof w.Cons)return r=new w.Cons(t.value0,n),void(e=t.value1);throw new Error("Failed pattern match at Data.List (line 368, column 3 - line 368, column 19): "+[n.constructor.name,t.constructor.name])}for(;!u;)t=o(r,e);return t}}(),S=function(){var n;return n=w.Nil.value,function(e){return function(t){var r,u=n,o=e,i=!1;function a(n,e,r){if(e<1)return i=!0,G(n);if(r instanceof w.Nil)return i=!0,G(n);if(r instanceof w.Cons)return u=new w.Cons(r.value0,n),o=e-1|0,void(t=r.value1);throw new Error("Failed pattern match at Data.List (line 520, column 3 - line 520, column 35): "+[n.constructor.name,e.constructor.name,r.constructor.name])}for(;!i;)r=a(u,o,t);return r}}}(),k=function(n){var e;return e=w.Nil.value,function(t){for(var r,u,o,i=e,a=!1;!a;)u=i,r=(o=t)instanceof w.Cons&&n(o.value0)?(i=new w.Cons(o.value0,u),void(t=o.value1)):(a=!0,G(u));return r}},U=function(n){var e;return v.map(p.functorMaybe)(function(n){return{init:G(n.revInit),last:n.last}})((e=n,function(n){var t,r=e,u=!1;function o(e,t){if(e instanceof w.Nil)return u=!0,p.Nothing.value;if(e instanceof w.Cons&&e.value1 instanceof w.Nil)return u=!0,new p.Just({revInit:t,last:e.value0});if(e instanceof w.Cons)return r=e.value1,void(n=new w.Cons(e.value0,t));throw new Error("Failed pattern match at Data.List (line 270, column 3 - line 270, column 23): "+[e.constructor.name,t.constructor.name])}for(;!u;)t=o(r,n);return t})(w.Nil.value))},H=function(n){return function(e){return function(t){var r;return G((r=e,function(e){return function(t){var u,o=r,i=e,a=!1;function c(e,r,u){if(e instanceof w.Nil)return a=!0,u;if(r instanceof w.Nil)return a=!0,u;if(e instanceof w.Cons&&r instanceof w.Cons)return o=e.value1,i=r.value1,void(t=new w.Cons(n(e.value0)(r.value0),u));throw new Error("Failed pattern match at Data.List (line 718, column 3 - line 718, column 21): "+[e.constructor.name,r.constructor.name,u.constructor.name])}for(;!a;)u=c(o,i,t);return u}})(t)(w.Nil.value))}}},K=H(b.Tuple.create),Q=function(n){return function(e){return function(t){return function(r){return L.sequence(w.traversableList)(n)(H(e)(t)(r))}}}},V=function(n){return function(e){if(n===e)return I(n);if(c.otherwise){return(t=e,function(n){return function(e){return function(r){var u,o=t,i=n,a=e,l=!1;function f(n,e,t,u){if(n===e)return l=!0,new w.Cons(n,u);if(c.otherwise)return o=n+t|0,i=e,a=t,void(r=new w.Cons(n,u));throw new Error("Failed pattern match at Data.List (line 148, column 3 - line 149, column 65): "+[n.constructor.name,e.constructor.name,t.constructor.name,u.constructor.name])}for(;!l;)u=f(o,i,a,r);return u}}})(n)(n>e?1:-1)(w.Nil.value)}var t;throw new Error("Failed pattern match at Data.List (line 144, column 1 - line 144, column 32): "+[n.constructor.name,e.constructor.name])}},X=function(n){return function(e){return f.foldr(w.foldableList)(function(e){return function(t){return n(e)?{no:t.no,yes:new w.Cons(e,t.yes)}:{no:new w.Cons(e,t.no),yes:t.yes}}})({no:w.Nil.value,yes:w.Nil.value})(e)}},Y=function(n){return n instanceof w.Nil},Z=new C.Newtype(function(n){return n},g),$=m.mapWithIndex(w.functorWithIndexList),_=function(n){var e;return e=w.Nil.value,function(t){var r,u=e,o=!1;function i(e,r){if(r instanceof w.Nil)return o=!0,G(e);if(r instanceof w.Cons){var i=n(r.value0);if(i instanceof p.Nothing)return u=e,void(t=r.value1);if(i instanceof p.Just)return u=new w.Cons(i.value0,e),void(t=r.value1);throw new Error("Failed pattern match at Data.List (line 419, column 5 - line 421, column 32): "+[i.constructor.name])}throw new Error("Failed pattern match at Data.List (line 417, column 3 - line 417, column 27): "+[e.constructor.name,r.constructor.name])}for(;!o;)r=i(u,t);return r}},nn=function(t){return function(u){return function(o){return i.tailRecM(t)(function(c){return r.bind(t.Monad0().Bind1())(n.alt(u.Plus1().Alt0())(v.map(u.Plus1().Alt0().Functor0())(i.Loop.create)(o))(e.pure(u.Applicative0())(new i.Done(F.unit))))(function(n){return e.pure(u.Applicative0())(a.bimap(i.bifunctorStep)(function(n){return new w.Cons(n,c)})(function(n){return G(c)})(n))})})(w.Nil.value)}}},en=function(n){return function(e){return function(r){return t.apply(e.Applicative0().Apply0())(v.map(e.Plus1().Alt0().Functor0())(w.Cons.create)(r))(nn(n)(e)(r))}}},tn=function(n){return function(e){return function(r){return t.apply(n.Applicative0().Apply0())(v.map(n.Plus1().Alt0().Functor0())(w.Cons.create)(r))(o.defer(e)(function(t){return rn(n)(e)(r)}))}}},rn=function(t){return function(r){return function(u){return n.alt(t.Plus1().Alt0())(tn(t)(r)(u))(e.pure(t.Applicative0())(w.Nil.value))}}},un=f.foldl(w.foldableList)(function(n){return function(e){return n+1|0}})(0),on=function(n){var e,t,r=!1;for(;!r;)e=(t=n)instanceof w.Cons&&t.value1 instanceof w.Nil?(r=!0,new p.Just(t.value0)):t instanceof w.Cons?void(n=t.value1):(r=!0,p.Nothing.value);return e},an=function n(e){return function(t){return function(r){if(r instanceof w.Nil)return I(t);if(r instanceof w.Cons)return e(t)(r.value0)instanceof q.GT?new w.Cons(r.value0,n(e)(t)(r.value1)):new w.Cons(t,r);throw new Error("Failed pattern match at Data.List (line 216, column 1 - line 216, column 68): "+[e.constructor.name,t.constructor.name,r.constructor.name])}}},cn=function n(e){return function(t){return function(r){return 0===e?new p.Just(new w.Cons(t,r)):r instanceof w.Cons?v.map(p.functorMaybe)(function(n){return new w.Cons(r.value0,n)})(n(e-1|0)(t)(r.value1)):p.Nothing.value}}},ln=function(n){return an(N.compare(n))},fn=function(n){return v.map(p.functorMaybe)(function(n){return n.init})(U(n))},sn=function(n){return function(e){var t,r=n,u=!1;function o(n,t){if(n instanceof w.Nil)return u=!0,p.Nothing.value;if(n instanceof w.Cons&&0===t)return u=!0,new p.Just(n.value0);if(n instanceof w.Cons)return r=n.value1,void(e=t-1|0);throw new Error("Failed pattern match at Data.List (line 281, column 1 - line 281, column 44): "+[n.constructor.name,t.constructor.name])}for(;!u;)t=o(r,e);return t}},vn=function(n){if(n instanceof w.Nil)return p.Nothing.value;if(n instanceof w.Cons)return new p.Just(n.value0);throw new Error("Failed pattern match at Data.List (line 230, column 1 - line 230, column 22): "+[n.constructor.name])},mn=function n(e){if(e instanceof w.Nil)return w.Nil.value;if(e instanceof w.Cons&&e.value0 instanceof w.Nil)return n(e.value1);if(e instanceof w.Cons&&e.value0 instanceof w.Cons)return new w.Cons(new w.Cons(e.value0.value0,_(vn)(e.value1)),n(new w.Cons(e.value0.value1,_(J)(e.value1))));throw new Error("Failed pattern match at Data.List (line 752, column 1 - line 752, column 54): "+[e.constructor.name])},dn=function n(e){return function(t){if(t instanceof w.Nil)return w.Nil.value;if(t instanceof w.Cons){var r=P(e(t.value0))(t.value1);return new w.Cons(new h.NonEmpty(t.value0,r.init),n(e)(r.rest))}throw new Error("Failed pattern match at Data.List (line 605, column 1 - line 605, column 80): "+[e.constructor.name,t.constructor.name])}},wn=function(n){return dn(l.eq(n))},pn=function(n){var e=wn(n.Eq0()),t=O(n);return function(n){return e(t(n))}},Cn=function(n){return f.foldr(n)(w.Cons.create)(w.Nil.value)},hn=function n(t){return function(u){return function(o){return function(i){if(i instanceof w.Nil)return e.pure(t.Applicative0())(o);if(i instanceof w.Cons)return r.bind(t.Bind1())(u(o)(i.value0))(function(e){return n(t)(u)(e)(i.value1)});throw new Error("Failed pattern match at Data.List (line 763, column 1 - line 763, column 72): "+[u.constructor.name,o.constructor.name,i.constructor.name])}}}},Nn=function(n){var e;return e=0,function(t){var r,u=e,o=!1;function i(e,r){if(r instanceof w.Cons){if(n(r.value0))return o=!0,new p.Just(e);if(c.otherwise)return u=e+1|0,void(t=r.value1)}if(r instanceof w.Nil)return o=!0,p.Nothing.value;throw new Error("Failed pattern match at Data.List (line 301, column 3 - line 301, column 35): "+[e.constructor.name,r.constructor.name])}for(;!o;)r=i(u,t);return r}},qn=function(n){return function(e){return v.map(p.functorMaybe)(function(n){return(un(e)-1|0)-n|0})(Nn(n)(G(e)))}},yn=function n(t){return function(u){return function(o){if(o instanceof w.Nil)return e.pure(t.Applicative0())(w.Nil.value);if(o instanceof w.Cons)return r.bind(t.Bind1())(u(o.value0))(function(i){return r.bind(t.Bind1())(n(t)(u)(o.value1))(function(n){return e.pure(t.Applicative0())(i?new w.Cons(o.value0,n):n)})});throw new Error("Failed pattern match at Data.List (line 403, column 1 - line 403, column 75): "+[u.constructor.name,o.constructor.name])}}},Dn=function(n){var e;return e=w.Nil.value,function(t){var r,u=e,o=!1;function i(e,r){if(r instanceof w.Nil)return o=!0,G(e);if(r instanceof w.Cons){if(n(r.value0))return u=new w.Cons(r.value0,e),void(t=r.value1);if(c.otherwise)return u=e,void(t=r.value1)}throw new Error("Failed pattern match at Data.List (line 390, column 3 - line 390, column 27): "+[e.constructor.name,r.constructor.name])}for(;!o;)r=i(u,t);return r}},Ln=function(n){return function(e){return function(t){return e instanceof w.Nil?w.Nil.value:t instanceof w.Nil?w.Nil.value:Dn(function(e){return f.any(w.foldableList)(d.heytingAlgebraBoolean)(n(e))(t)})(e)}}},bn=function(n){return Ln(l.eq(n))},xn=function n(e){return function(t){if(t instanceof w.Nil)return w.Nil.value;if(t instanceof w.Cons)return new w.Cons(t.value0,n(e)(Dn(function(n){return!e(t.value0)(n)})(t.value1)));throw new Error("Failed pattern match at Data.List (line 644, column 1 - line 644, column 59): "+[e.constructor.name,t.constructor.name])}},Fn=function(n){return xn(l.eq(n))},gn=function(n){return new l.Eq(function(e){return function(t){return l.eq(w.eqList(n))(e)(t)}})},En=function(n){return new N.Ord(function(){return gn(n.Eq0())},function(e){return function(t){return N.compare(w.ordList(n))(e)(t)}})},jn=function(n){return function(e){return qn(function(t){return l.eq(n)(t)(e)})}},An=function(n){return function(e){return Nn(function(t){return l.eq(n)(t)(e)})}},Mn=function(n){return function(e){var t,r=!1;function u(t){if(!(t instanceof w.Cons&&n(t.value0)))return r=!0,t;e=t.value1}for(;!r;)t=u(e);return t}},Jn=function(n){return function(e){return S(un(e)-n|0)(e)}},Bn=function(n){return function(e){var t,r=n,u=!1;function o(n,t){if(n<1)return u=!0,t;if(t instanceof w.Nil)return u=!0,w.Nil.value;if(t instanceof w.Cons)return r=n-1|0,void(e=t.value1);throw new Error("Failed pattern match at Data.List (line 543, column 1 - line 543, column 42): "+[n.constructor.name,t.constructor.name])}for(;!u;)t=o(r,e);return t}},Pn=function(n){return function(e){return function(t){return S(e-n|0)(Bn(n)(t))}}},Tn=function(n){return function(e){return Bn(un(e)-n|0)(e)}},In=function n(e){return function(t){return function(r){if(r instanceof w.Nil)return w.Nil.value;if(r instanceof w.Cons&&e(t)(r.value0))return r.value1;if(r instanceof w.Cons)return new w.Cons(r.value0,n(e)(t)(r.value1));throw new Error("Failed pattern match at Data.List (line 671, column 1 - line 671, column 67): "+[e.constructor.name,t.constructor.name,r.constructor.name])}}},Wn=function(n){return function(e){return function(t){return y.append(w.semigroupList)(e)(f.foldl(w.foldableList)(s.flip(In(n)))(xn(n)(t))(e))}}},On=function(n){return Wn(l.eq(n))},Rn=function n(e){return function(t){return 0===e&&t instanceof w.Cons?new p.Just(t.value1):t instanceof w.Cons?v.map(p.functorMaybe)(function(n){return new w.Cons(t.value0,n)})(n(e-1|0)(t.value1)):p.Nothing.value}},zn=function(n){return In(l.eq(n))},Gn=function(n){return f.foldl(w.foldableList)(s.flip(zn(n)))},Sn=s.flip(r.bind(w.bindList)),kn=function(n){return r.bind(w.bindList)(n)(u.identity(u.categoryFn))},Un=_(u.identity(u.categoryFn)),Hn=function n(e){return function(t){return function(r){return 0===e&&r instanceof w.Cons?p.Just.create(function(){var n=t(r.value0);if(n instanceof p.Nothing)return r.value1;if(n instanceof p.Just)return new w.Cons(n.value0,r.value1);throw new Error("Failed pattern match at Data.List (line 352, column 3 - line 354, column 23): "+[n.constructor.name])}()):r instanceof w.Cons?v.map(p.functorMaybe)(function(n){return new w.Cons(r.value0,n)})(n(e-1|0)(t)(r.value1)):p.Nothing.value}}},Kn=function(n){return function(e){return Hn(n)(function(n){return p.Just.create(e(n))})}};module.exports={toUnfoldable:M,fromFoldable:Cn,singleton:I,range:V,some:tn,someRec:en,many:rn,manyRec:nn,null:Y,length:un,snoc:T,insert:ln,insertBy:an,head:vn,last:on,tail:J,init:fn,uncons:A,unsnoc:U,index:sn,elemIndex:An,elemLastIndex:jn,findIndex:Nn,findLastIndex:qn,insertAt:cn,deleteAt:Rn,updateAt:E,modifyAt:Kn,alterAt:Hn,reverse:G,concat:kn,concatMap:Sn,filter:Dn,filterM:yn,mapMaybe:_,catMaybes:Un,mapWithIndex:$,sort:O,sortBy:W,Pattern:g,stripPrefix:B,slice:Pn,take:S,takeEnd:Tn,takeWhile:k,drop:Bn,dropEnd:Jn,dropWhile:Mn,span:P,group:wn,"group'":pn,groupBy:dn,partition:X,nub:Fn,nubBy:xn,union:On,unionBy:Wn,delete:zn,deleteBy:In,difference:Gn,intersect:bn,intersectBy:Ln,zipWith:H,zipWithA:Q,zip:K,unzip:j,transpose:mn,foldM:hn,eqPattern:gn,ordPattern:En,newtypePattern:Z,showPattern:z}; +},{"../Control.Alt/index.js":"lN+m","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Control.Lazy/index.js":"y9cE","../Control.Monad.Rec.Class/index.js":"UVIy","../Data.Bifunctor/index.js":"e2Wc","../Data.Boolean/index.js":"ObQr","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.FunctorWithIndex/index.js":"OHRN","../Data.HeytingAlgebra/index.js":"paZe","../Data.List.Types/index.js":"Xxuc","../Data.Maybe/index.js":"5mN7","../Data.Newtype/index.js":"lz8k","../Data.NonEmpty/index.js":"qF8i","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7","../Data.Traversable/index.js":"n7EE","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z","../Data.Unit/index.js":"NhVk"}],"9xeJ":[function(require,module,exports) { +"use strict";exports.defer=function(r){var n=null;return function(){return void 0===r?n:(n=r(),r=void 0,n)}},exports.force=function(r){return r()}; +},{}],"aRUE":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),r=require("../Control.Applicative/index.js"),e=require("../Control.Apply/index.js"),t=require("../Control.Bind/index.js"),u=require("../Control.Comonad/index.js"),i=require("../Control.Extend/index.js"),o=require("../Control.Lazy/index.js"),f=require("../Control.Monad/index.js"),c=require("../Data.BooleanAlgebra/index.js"),a=require("../Data.Bounded/index.js"),d=require("../Data.CommutativeRing/index.js"),l=require("../Data.Eq/index.js"),s=require("../Data.EuclideanRing/index.js"),p=require("../Data.Foldable/index.js"),y=require("../Data.FoldableWithIndex/index.js"),x=require("../Data.Function/index.js"),m=require("../Data.Functor/index.js"),q=require("../Data.Functor.Invariant/index.js"),g=require("../Data.FunctorWithIndex/index.js"),w=require("../Data.HeytingAlgebra/index.js"),z=require("../Data.Monoid/index.js"),j=require("../Data.Ord/index.js"),L=require("../Data.Ring/index.js"),b=require("../Data.Semigroup/index.js"),D=require("../Data.Semigroup.Foldable/index.js"),v=require("../Data.Semigroup.Traversable/index.js"),F=require("../Data.Semiring/index.js"),h=require("../Data.Show/index.js"),A=require("../Data.Traversable/index.js"),C=require("../Data.TraversableWithIndex/index.js"),I=require("../Data.Unit/index.js"),R=function(r){return new h.Show(function(e){return"(defer \\_ -> "+h.show(r)(n.force(e))+")"})},S=function(r){return new F.Semiring(function(e){return function(t){return n.defer(function(u){return F.add(r)(n.force(e))(n.force(t))})}},function(e){return function(t){return n.defer(function(u){return F.mul(r)(n.force(e))(n.force(t))})}},n.defer(function(n){return F.one(r)}),n.defer(function(n){return F.zero(r)}))},W=function(r){return new b.Semigroup(function(e){return function(t){return n.defer(function(u){return b.append(r)(n.force(e))(n.force(t))})}})},E=function(r){return new L.Ring(function(){return S(r.Semiring0())},function(e){return function(t){return n.defer(function(u){return L.sub(r)(n.force(e))(n.force(t))})}})},B=function(r){return new z.Monoid(function(){return W(r.Semigroup0())},n.defer(function(n){return z.mempty(r)}))},T=new o.Lazy(function(r){return n.defer(function(e){return n.force(r(I.unit))})}),M=new m.Functor(function(r){return function(e){return n.defer(function(t){return r(n.force(e))})}}),O=new g.FunctorWithIndex(function(){return M},function(n){return m.map(M)(n(I.unit))}),H=new q.Invariant(q.imapF(M)),U=new p.Foldable(function(r){return function(r){return function(e){return r(n.force(e))}}},function(r){return function(e){return function(t){return r(e)(n.force(t))}}},function(r){return function(e){return function(t){return r(n.force(t))(e)}}}),_=new y.FoldableWithIndex(function(){return U},function(n){return function(r){return p.foldMap(U)(n)(r(I.unit))}},function(n){return p.foldl(U)(n(I.unit))},function(n){return p.foldr(U)(n(I.unit))}),k=new A.Traversable(function(){return U},function(){return M},function(r){return function(e){return m.map(r.Apply0().Functor0())(function(r){return n.defer(x.const(r))})(n.force(e))}},function(r){return function(e){return function(t){return m.map(r.Apply0().Functor0())(function(r){return n.defer(x.const(r))})(e(n.force(t)))}}}),G=new C.TraversableWithIndex(function(){return _},function(){return O},function(){return k},function(n){return function(r){return A.traverse(k)(n)(r(I.unit))}}),J=new D.Foldable1(function(){return U},function(n){return D.fold1Default(J)(n)},function(r){return function(r){return function(e){return r(n.force(e))}}}),K=new v.Traversable1(function(){return J},function(){return k},function(r){return function(e){return m.map(r.Functor0())(function(r){return n.defer(x.const(r))})(n.force(e))}},function(r){return function(e){return function(t){return m.map(r.Functor0())(function(r){return n.defer(x.const(r))})(e(n.force(t)))}}}),N=new i.Extend(function(){return M},function(r){return function(e){return n.defer(function(n){return r(e)})}}),P=function(r){return new l.Eq(function(e){return function(t){return l.eq(r)(n.force(e))(n.force(t))}})},Q=function(r){return new j.Ord(function(){return P(r.Eq0())},function(e){return function(t){return j.compare(r)(n.force(e))(n.force(t))}})},V=new l.Eq1(function(n){return l.eq(P(n))}),X=new j.Ord1(function(){return V},function(n){return j.compare(Q(n))}),Y=new u.Comonad(function(){return N},n.force),Z=function(n){return new d.CommutativeRing(function(){return E(n.Ring0())})},$=function(r){return new s.EuclideanRing(function(){return Z(r.CommutativeRing0())},(e=s.degree(r),function(r){return e(n.force(r))}),function(e){return function(t){return n.defer(function(u){return s.div(r)(n.force(e))(n.force(t))})}},function(e){return function(t){return n.defer(function(u){return s.mod(r)(n.force(e))(n.force(t))})}});var e},nn=function(r){return new a.Bounded(function(){return Q(r.Ord0())},n.defer(function(n){return a.bottom(r)}),n.defer(function(n){return a.top(r)}))},rn=new e.Apply(function(){return M},function(r){return function(e){return n.defer(function(t){return n.force(r)(n.force(e))})}}),en=new t.Bind(function(){return rn},function(r){return function(e){return n.defer(function(t){return n.force(e(n.force(r)))})}}),tn=function(r){return new w.HeytingAlgebra(function(n){return function(t){return e.apply(rn)(m.map(M)(w.conj(r))(n))(t)}},function(n){return function(t){return e.apply(rn)(m.map(M)(w.disj(r))(n))(t)}},n.defer(function(n){return w.ff(r)}),function(n){return function(t){return e.apply(rn)(m.map(M)(w.implies(r))(n))(t)}},function(n){return m.map(M)(w.not(r))(n)},n.defer(function(n){return w.tt(r)}))},un=function(n){return new c.BooleanAlgebra(function(){return tn(n.HeytingAlgebra0())})},on=new r.Applicative(function(){return rn},function(r){return n.defer(function(n){return r})}),fn=new f.Monad(function(){return on},function(){return en});module.exports={semiringLazy:S,ringLazy:E,commutativeRingLazy:Z,euclideanRingLazy:$,eqLazy:P,eq1Lazy:V,ordLazy:Q,ord1Lazy:X,boundedLazy:nn,semigroupLazy:W,monoidLazy:B,heytingAlgebraLazy:tn,booleanAlgebraLazy:un,functorLazy:M,functorWithIndexLazy:O,foldableLazy:U,foldableWithIndexLazy:_,foldable1Lazy:J,traversableLazy:k,traversableWithIndexLazy:G,traversable1Lazy:K,invariantLazy:H,applyLazy:rn,applicativeLazy:on,bindLazy:en,monadLazy:fn,extendLazy:N,comonadLazy:Y,showLazy:R,lazyLazy:T,defer:n.defer,force:n.force}; +},{"./foreign.js":"9xeJ","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Comonad/index.js":"U0zO","../Control.Extend/index.js":"JIoJ","../Control.Lazy/index.js":"y9cE","../Control.Monad/index.js":"U/Ix","../Data.BooleanAlgebra/index.js":"e7y+","../Data.Bounded/index.js":"kcUU","../Data.CommutativeRing/index.js":"60TQ","../Data.Eq/index.js":"Pq4F","../Data.EuclideanRing/index.js":"2IRB","../Data.Foldable/index.js":"eVDl","../Data.FoldableWithIndex/index.js":"9Efi","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Functor.Invariant/index.js":"AXkC","../Data.FunctorWithIndex/index.js":"OHRN","../Data.HeytingAlgebra/index.js":"paZe","../Data.Monoid/index.js":"TiEB","../Data.Ord/index.js":"r4Vb","../Data.Ring/index.js":"E2qH","../Data.Semigroup/index.js":"EsAJ","../Data.Semigroup.Foldable/index.js":"ht+A","../Data.Semigroup.Traversable/index.js":"qkfi","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7","../Data.Traversable/index.js":"n7EE","../Data.TraversableWithIndex/index.js":"V4EF","../Data.Unit/index.js":"NhVk"}],"EJF+":[function(require,module,exports) { +"use strict";var n=require("../Control.Alt/index.js"),t=require("../Control.Alternative/index.js"),e=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),u=require("../Control.Bind/index.js"),o=require("../Control.Category/index.js"),i=require("../Control.Comonad/index.js"),a=require("../Control.Extend/index.js"),c=require("../Control.Lazy/index.js"),f=require("../Control.Monad/index.js"),l=require("../Control.MonadPlus/index.js"),d=require("../Control.MonadZero/index.js"),s=require("../Control.Plus/index.js"),p=require("../Data.Eq/index.js"),v=require("../Data.Foldable/index.js"),m=require("../Data.FoldableWithIndex/index.js"),y=require("../Data.Function/index.js"),w=require("../Data.Functor/index.js"),L=require("../Data.FunctorWithIndex/index.js"),x=require("../Data.Lazy/index.js"),h=require("../Data.Maybe/index.js"),E=require("../Data.Monoid/index.js"),b=require("../Data.Newtype/index.js"),N=require("../Data.NonEmpty/index.js"),q=require("../Data.Ord/index.js"),j=require("../Data.Ordering/index.js"),I=require("../Data.Semigroup/index.js"),D=require("../Data.Semiring/index.js"),F=require("../Data.Show/index.js"),W=require("../Data.Traversable/index.js"),T=require("../Data.TraversableWithIndex/index.js"),z=require("../Data.Tuple/index.js"),g=require("../Data.Unfoldable/index.js"),A=require("../Data.Unfoldable1/index.js"),C=function(n){return n},M=function(){function n(){}return n.value=new n,n}(),S=function(){function n(n,t){this.value0=n,this.value1=t}return n.create=function(t){return function(e){return new n(t,e)}},n}(),P=function(n){return n},U=C(x.defer(function(n){return M.value})),O=new b.Newtype(function(n){return n},P),B=new b.Newtype(function(n){return n},C),Z=function(){var n=b.unwrap(B);return function(t){return x.force(n(t))}}(),J=new I.Semigroup(function(n){return function(t){return w.map(x.functorLazy)(function(n){if(n instanceof M)return Z(t);if(n instanceof S)return new S(n.value0,I.append(J)(n.value1)(t));throw new Error("Failed pattern match at Data.List.Lazy.Types (line 98, column 5 - line 98, column 21): "+[n.constructor.name])})(b.unwrap(B)(n))}}),Q=function(n){return new F.Show(function(t){return"fromStrict ("+function t(e){if(e instanceof M)return"Nil";if(e instanceof S)return"(Cons "+F.show(n)(e.value0)+" "+t(Z(e.value1))+")";throw new Error("Failed pattern match at Data.List.Lazy.Types (line 64, column 5 - line 64, column 19): "+[e.constructor.name])}(Z(t))+")"})},G=function(n){return new F.Show(function(t){return"(NonEmptyList "+F.show(x.showLazy(N.showNonEmpty(n)(Q(n))))(t)+")"})},k=new E.Monoid(function(){return J},U),H=new c.Lazy(function(n){return C(x.defer(function(t){return Z(n(t))}))}),K=new w.Functor(function(n){return function(t){return w.map(x.functorLazy)(function(t){if(t instanceof M)return M.value;if(t instanceof S)return new S(n(t.value0),w.map(K)(n)(t.value1));throw new Error("Failed pattern match at Data.List.Lazy.Types (line 107, column 5 - line 107, column 17): "+[t.constructor.name])})(b.unwrap(B)(t))}}),R=new w.Functor(function(n){return function(t){return w.map(x.functorLazy)(w.map(N.functorNonEmpty(K))(n))(t)}}),V=new p.Eq1(function(n){return function(t){return function(e){var r;return(r=Z(t),function(t){for(var e,u,o,i=r,a=!1;!a;)o=t,e=(u=i)instanceof M&&o instanceof M?(a=!0,!0):u instanceof S&&o instanceof S&&p.eq(n)(u.value0)(o.value0)?(i=Z(u.value1),void(t=Z(o.value1))):(a=!0,!1);return e})(Z(e))}}}),X=function(n){return new p.Eq(p.eq1(V)(n))},Y=function(n){return x.eqLazy(N.eqNonEmpty(V)(n))},$=new q.Ord1(function(){return V},function(n){return function(t){return function(e){var r;return(r=Z(t),function(t){var e,u=r,o=!1;function i(e,r){if(e instanceof M&&r instanceof M)return o=!0,j.EQ.value;if(e instanceof M)return o=!0,j.LT.value;if(r instanceof M)return o=!0,j.GT.value;if(e instanceof S&&r instanceof S){var i=q.compare(n)(e.value0)(r.value0);return i instanceof j.EQ?(u=Z(e.value1),void(t=Z(r.value1))):(o=!0,i)}throw new Error("Failed pattern match at Data.List.Lazy.Types (line 84, column 5 - line 84, column 20): "+[e.constructor.name,r.constructor.name])}for(;!o;)e=i(u,t);return e})(Z(e))}}}),_=function(n){return new q.Ord(function(){return X(n.Eq0())},q.compare1($)(n))},nn=function(n){return x.ordLazy(N.ordNonEmpty($)(n))},tn=function(n){return function(t){return C(x.defer(function(e){return new S(n,t)}))}},en=new v.Foldable(function(n){return function(t){return v.foldl(en)(function(e){return function(r){return I.append(n.Semigroup0())(e)(t(r))}})(E.mempty(n))}},function(n){return function(t){return function(e){var r,u=t,o=!1;function i(t,r){var i=Z(r);if(i instanceof M)return o=!0,t;if(i instanceof S)return u=n(t)(i.value0),void(e=i.value1);throw new Error("Failed pattern match at Data.List.Lazy.Types (line 122, column 7 - line 124, column 40): "+[i.constructor.name])}for(;!o;)r=i(u,e);return r}}},function(n){return function(t){return function(e){var r=v.foldl(en)(y.flip(tn))(U);return v.foldl(en)(y.flip(n))(t)(r(e))}}}),rn=new a.Extend(function(){return K},function(n){return function(t){var e=Z(t);if(e instanceof M)return U;if(e instanceof S)return tn(n(t))(v.foldr(en)(function(t){return function(e){var r=tn(t)(e.acc);return{val:tn(n(r))(e.val),acc:r}}})({val:U,acc:U})(e.value1).val);throw new Error("Failed pattern match at Data.List.Lazy.Types (line 194, column 5 - line 197, column 55): "+[e.constructor.name])}}),un=new a.Extend(function(){return R},function(n){return function(t){var e=function(t){return function(e){return{val:tn(n(x.defer(function(n){return new N.NonEmpty(t,e.acc)})))(e.val),acc:tn(t)(e.acc)}}},r=x.force(t);return P(x.defer(function(u){return new N.NonEmpty(n(t),v.foldr(en)(e)({val:U,acc:U})(r.value1).val)}))}}),on=new v.Foldable(function(n){return function(t){return function(e){return v.foldMap(N.foldableNonEmpty(en))(n)(t)(x.force(e))}}},function(n){return function(t){return function(e){return v.foldl(N.foldableNonEmpty(en))(n)(t)(x.force(e))}}},function(n){return function(t){return function(e){return v.foldr(N.foldableNonEmpty(en))(n)(t)(x.force(e))}}}),an=new m.FoldableWithIndex(function(){return en},function(n){return function(t){return m.foldlWithIndex(an)(function(e){return function(r){var u=I.append(n.Semigroup0())(r),o=t(e);return function(n){return u(o(n))}}})(E.mempty(n))}},function(n){return function(t){var e=v.foldl(en)(function(t){return function(e){return new z.Tuple(t.value0+1|0,n(t.value0)(t.value1)(e))}})(new z.Tuple(0,t));return function(n){return z.snd(e(n))}}},function(n){return function(t){return function(e){var r=v.foldl(en)(function(n){return function(t){return new z.Tuple(n.value0+1|0,tn(t)(n.value1))}})(new z.Tuple(0,U))(e);return z.snd(v.foldl(en)(function(t){return function(e){return new z.Tuple(t.value0-1|0,n(t.value0-1|0)(e)(t.value1))}})(new z.Tuple(r.value0,t))(r.value1))}}}),cn=new m.FoldableWithIndex(function(){return on},function(n){return function(t){return function(e){return m.foldMapWithIndex(N.foldableWithIndexNonEmpty(an))(n)((r=h.maybe(0)(D.add(D.semiringInt)(1)),function(n){return t(r(n))}))(x.force(e));var r}}},function(n){return function(t){return function(e){return m.foldlWithIndex(N.foldableWithIndexNonEmpty(an))((r=h.maybe(0)(D.add(D.semiringInt)(1)),function(t){return n(r(t))}))(t)(x.force(e));var r}}},function(n){return function(t){return function(e){return m.foldrWithIndex(N.foldableWithIndexNonEmpty(an))((r=h.maybe(0)(D.add(D.semiringInt)(1)),function(t){return n(r(t))}))(t)(x.force(e));var r}}}),fn=new L.FunctorWithIndex(function(){return K},function(n){return m.foldrWithIndex(an)(function(t){return function(e){return function(r){return tn(n(t)(e))(r)}}})(U)}),ln=new L.FunctorWithIndex(function(){return R},function(n){return function(t){return P(x.defer(function(e){return L.mapWithIndex(N.functorWithIndex(fn))((r=h.maybe(0)(D.add(D.semiringInt)(1)),function(t){return n(r(t))}))(x.force(t));var r}))}}),dn=function(n){return c.defer(H)(function(t){var e=x.force(n);return tn(e.value0)(e.value1)})},sn=new I.Semigroup(function(n){return function(t){var e=x.force(n);return x.defer(function(n){return new N.NonEmpty(e.value0,I.append(J)(e.value1)(dn(t)))})}}),pn=new W.Traversable(function(){return en},function(){return K},function(n){return W.traverse(pn)(n)(o.identity(o.categoryFn))},function(n){return function(t){return v.foldr(en)(function(e){return function(u){return r.apply(n.Apply0())(w.map(n.Apply0().Functor0())(tn)(t(e)))(u)}})(e.pure(n)(U))}}),vn=new W.Traversable(function(){return on},function(){return R},function(n){return function(t){return w.map(n.Apply0().Functor0())(function(n){return P(x.defer(function(t){return n}))})(W.sequence(N.traversableNonEmpty(pn))(n)(x.force(t)))}},function(n){return function(t){return function(e){return w.map(n.Apply0().Functor0())(function(n){return P(x.defer(function(t){return n}))})(W.traverse(N.traversableNonEmpty(pn))(n)(t)(x.force(e)))}}}),mn=new T.TraversableWithIndex(function(){return an},function(){return fn},function(){return pn},function(n){return function(t){return m.foldrWithIndex(an)(function(e){return function(u){return function(o){return r.apply(n.Apply0())(w.map(n.Apply0().Functor0())(tn)(t(e)(u)))(o)}}})(e.pure(n)(U))}}),yn=new T.TraversableWithIndex(function(){return cn},function(){return ln},function(){return vn},function(n){return function(t){return function(e){return w.map(n.Apply0().Functor0())(function(n){return P(x.defer(function(t){return n}))})(T.traverseWithIndex(N.traversableWithIndexNonEmpty(mn))(n)((r=h.maybe(0)(D.add(D.semiringInt)(1)),function(n){return t(r(n))}))(x.force(e)));var r}}}),wn=new A.Unfoldable1(function n(t){return function(e){return c.defer(H)(function(r){var u=t(e);if(u.value1 instanceof h.Just)return tn(u.value0)(n(t)(u.value1.value0));if(u.value1 instanceof h.Nothing)return tn(u.value0)(U);throw new Error("Failed pattern match at Data.List.Lazy.Types (line 146, column 28 - line 148, column 33): "+[u.constructor.name])})}}),Ln=new g.Unfoldable(function(){return wn},function n(t){return function(e){return c.defer(H)(function(r){var u=t(e);if(u instanceof h.Nothing)return U;if(u instanceof h.Just)return tn(u.value0.value0)(n(t)(u.value0.value1));throw new Error("Failed pattern match at Data.List.Lazy.Types (line 152, column 28 - line 154, column 39): "+[u.constructor.name])})}}),xn=new A.Unfoldable1(function(n){return function(t){return P(x.defer(function(e){return A.unfoldr1(N.unfoldable1NonEmpty(Ln))(n)(t)}))}}),hn=new i.Comonad(function(){return un},function(n){return N.head(x.force(n))}),En=new f.Monad(function(){return qn},function(){return bn}),bn=new u.Bind(function(){return Nn},function(n){return function(t){return w.map(x.functorLazy)(function(n){if(n instanceof M)return M.value;if(n instanceof S)return Z(I.append(J)(t(n.value0))(u.bind(bn)(n.value1)(t)));throw new Error("Failed pattern match at Data.List.Lazy.Types (line 175, column 5 - line 175, column 17): "+[n.constructor.name])})(b.unwrap(B)(n))}}),Nn=new r.Apply(function(){return K},f.ap(En)),qn=new e.Applicative(function(){return Nn},function(n){return tn(n)(U)}),jn=new r.Apply(function(){return R},function(n){return function(t){var e=x.force(t),u=x.force(n);return x.defer(function(n){return new N.NonEmpty(u.value0(e.value0),I.append(J)(r.apply(Nn)(u.value1)(tn(e.value0)(U)))(r.apply(Nn)(tn(u.value0)(u.value1))(e.value1)))})}}),In=new u.Bind(function(){return jn},function(n){return function(t){var e=x.force(n),r=x.force(b.unwrap(O)(t(e.value0)));return x.defer(function(n){return new N.NonEmpty(r.value0,I.append(J)(r.value1)(u.bind(bn)(e.value1)(function(n){return dn(t(n))})))})}}),Dn=new n.Alt(function(){return R},I.append(sn)),Fn=new n.Alt(function(){return K},I.append(J)),Wn=new s.Plus(function(){return Fn},U),Tn=new t.Alternative(function(){return qn},function(){return Wn}),zn=new d.MonadZero(function(){return Tn},function(){return En}),gn=new l.MonadPlus(function(){return zn}),An=new e.Applicative(function(){return jn},function(n){return x.defer(function(t){return N.singleton(Wn)(n)})}),Cn=new f.Monad(function(){return An},function(){return In});module.exports={List:C,Nil:M,Cons:S,step:Z,nil:U,cons:tn,NonEmptyList:P,toList:dn,newtypeList:B,showList:Q,eqList:X,eq1List:V,ordList:_,ord1List:$,lazyList:H,semigroupList:J,monoidList:k,functorList:K,functorWithIndexList:fn,foldableList:en,foldableWithIndexList:an,unfoldable1List:wn,unfoldableList:Ln,traversableList:pn,traversableWithIndexList:mn,applyList:Nn,applicativeList:qn,bindList:bn,monadList:En,altList:Fn,plusList:Wn,alternativeList:Tn,monadZeroList:zn,monadPlusList:gn,extendList:rn,newtypeNonEmptyList:O,eqNonEmptyList:Y,ordNonEmptyList:nn,showNonEmptyList:G,functorNonEmptyList:R,applyNonEmptyList:jn,applicativeNonEmptyList:An,bindNonEmptyList:In,monadNonEmptyList:Cn,altNonEmptyList:Dn,extendNonEmptyList:un,comonadNonEmptyList:hn,semigroupNonEmptyList:sn,foldableNonEmptyList:on,traversableNonEmptyList:vn,unfoldable1NonEmptyList:xn,functorWithIndexNonEmptyList:ln,foldableWithIndexNonEmptyList:cn,traversableWithIndexNonEmptyList:yn}; +},{"../Control.Alt/index.js":"lN+m","../Control.Alternative/index.js":"aHia","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Control.Comonad/index.js":"U0zO","../Control.Extend/index.js":"JIoJ","../Control.Lazy/index.js":"y9cE","../Control.Monad/index.js":"U/Ix","../Control.MonadPlus/index.js":"HkJx","../Control.MonadZero/index.js":"lD5R","../Control.Plus/index.js":"oMBg","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.FoldableWithIndex/index.js":"9Efi","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.FunctorWithIndex/index.js":"OHRN","../Data.Lazy/index.js":"aRUE","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Newtype/index.js":"lz8k","../Data.NonEmpty/index.js":"qF8i","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Semigroup/index.js":"EsAJ","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7","../Data.Traversable/index.js":"n7EE","../Data.TraversableWithIndex/index.js":"V4EF","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z","../Data.Unfoldable1/index.js":"S0Nl"}],"sNBV":[function(require,module,exports) { +"use strict";var n=require("../Control.Alt/index.js"),t=require("../Control.Applicative/index.js"),e=require("../Control.Apply/index.js"),r=require("../Control.Bind/index.js"),u=require("../Control.Category/index.js"),i=require("../Control.Lazy/index.js"),o=require("../Control.Monad.Rec.Class/index.js"),a=require("../Data.Boolean/index.js"),c=require("../Data.Eq/index.js"),l=require("../Data.Foldable/index.js"),f=require("../Data.Function/index.js"),s=require("../Data.Functor/index.js"),p=require("../Data.HeytingAlgebra/index.js"),m=require("../Data.Lazy/index.js"),v=require("../Data.List.Lazy.Types/index.js"),d=require("../Data.Maybe/index.js"),w=require("../Data.Newtype/index.js"),L=require("../Data.NonEmpty/index.js"),y=require("../Data.Ord/index.js"),h=require("../Data.Ordering/index.js"),z=require("../Data.Semigroup/index.js"),C=require("../Data.Show/index.js"),N=require("../Data.Traversable/index.js"),D=require("../Data.Tuple/index.js"),b=require("../Data.Unfoldable/index.js"),q=function(n){return n},x=function n(t){return function(r){return function(u){return e.apply(m.applyLazy)(s.map(m.functorLazy)(function(e){return function(r){if(e instanceof v.Nil)return v.Nil.value;if(r instanceof v.Nil)return v.Nil.value;if(e instanceof v.Cons&&r instanceof v.Cons)return new v.Cons(t(e.value0)(r.value0),n(t)(e.value1)(r.value1));throw new Error("Failed pattern match at Data.List.Lazy (line 693, column 3 - line 693, column 35): "+[e.constructor.name,r.constructor.name])}})(w.unwrap(v.newtypeList)(r)))(w.unwrap(v.newtypeList)(u))}}},F=function(n){return function(t){return function(e){return function(r){return N.sequence(v.traversableList)(n)(x(t)(e)(r))}}}},E=x(D.Tuple.create),g=function n(t){return function(e){return function(r){var u;return s.map(m.functorLazy)((u=t,function(t){if(t instanceof v.Nil)return v.Nil.value;if(0===u&&t instanceof v.Cons)return new v.Cons(e,t.value1);if(t instanceof v.Cons)return new v.Cons(t.value0,n(u-1|0)(e)(t.value1));throw new Error("Failed pattern match at Data.List.Lazy (line 367, column 3 - line 367, column 17): "+[u.constructor.name,t.constructor.name])}))(w.unwrap(v.newtypeList)(r))}}},j=l.foldr(v.foldableList)(function(n){return function(t){return new D.Tuple(v.cons(n.value0)(t.value0),v.cons(n.value1)(t.value1))}})(new D.Tuple(v.nil,v.nil)),A=function(n){var t=v.step(n);if(t instanceof v.Nil)return d.Nothing.value;if(t instanceof v.Cons)return new d.Just({head:t.value0,tail:t.value1});throw new Error("Failed pattern match at Data.List.Lazy (line 285, column 13 - line 287, column 44): "+[t.constructor.name])},M=function(n){return b.unfoldr(n)(function(n){return s.map(d.functorMaybe)(function(n){return new D.Tuple(n.head,n.tail)})(A(n))})},J=function n(t){var e=s.map(m.functorLazy)(function(e){return e instanceof v.Cons&&t(e.value0)?new v.Cons(e.value0,n(t)(e.value1)):v.Nil.value}),r=w.unwrap(v.newtypeList);return function(n){return v.List(e(r(n)))}},B=function n(t){if(t<=0)return f.const(v.nil);var e,r=s.map(m.functorLazy)((e=t,function(t){if(t instanceof v.Nil)return v.Nil.value;if(t instanceof v.Cons)return new v.Cons(t.value0,n(e-1|0)(t.value1));throw new Error("Failed pattern match at Data.List.Lazy (line 517, column 3 - line 517, column 32): "+[e.constructor.name,t.constructor.name])})),u=w.unwrap(v.newtypeList);return function(n){return v.List(r(u(n)))}},T=function(n){return s.map(d.functorMaybe)(function(n){return n.tail})(A(n))},P=function(n){return function(t){return function(e){return o.tailRecM2(o.monadRecMaybe)(function(t){return function(e){var r=v.step(t);if(r instanceof v.Nil)return d.Just.create(new o.Done(e));if(r instanceof v.Cons){var u=v.step(e);return u instanceof v.Cons&&c.eq(n)(r.value0)(u.value0)?d.Just.create(new o.Loop({a:r.value1,b:u.value1})):d.Nothing.value}throw new Error("Failed pattern match at Data.List.Lazy (line 499, column 21 - line 503, column 19): "+[r.constructor.name])}})(t)(e)}}},I=function n(t){return function(e){var r=A(e);if(r instanceof d.Just&&t(r.value0.head)){var u=n(t)(r.value0.tail);return{init:v.cons(r.value0.head)(u.init),rest:u.rest}}return{init:v.nil,rest:e}}},W=function(n){return function(t){return l.foldr(v.foldableList)(v.cons)(v.cons(t)(v.nil))(n)}},O=function(n){return v.cons(n)(v.nil)},R=function(n){return new C.Show(function(t){return"(Pattern "+C.show(v.showList(n))(t)+")"})},S=function n(t){return function(e){return function(r){return s.map(m.functorLazy)(function(r){if(r instanceof v.Nil)return v.Nil.value;if(r instanceof v.Cons){var u=t(r.value0)(e);return v.Cons.create(u)(n(t)(u)(r.value1))}throw new Error("Failed pattern match at Data.List.Lazy (line 764, column 5 - line 764, column 27): "+[r.constructor.name])})(w.unwrap(v.newtypeList)(r))}}},k=function(n){return i.defer(v.lazyList)(function(t){return l.foldl(v.foldableList)(f.flip(v.cons))(v.nil)(n)})},U=function n(e){return function(u){return function(i){if(u<1)return t.pure(e.Applicative0())(v.nil);if(a.otherwise)return r.bind(e.Bind1())(i)(function(o){return r.bind(e.Bind1())(n(e)(u-1|0)(i))(function(n){return t.pure(e.Applicative0())(v.cons(o)(n))})});throw new Error("Failed pattern match at Data.List.Lazy (line 161, column 1 - line 161, column 62): "+[u.constructor.name,i.constructor.name])}}},G=function(n){return i.fix(v.lazyList)(function(t){return v.cons(n)(t)})},H=function(n){return function(t){return B(n)(G(t))}},K=function(n){return function(t){if(n>t){return b.unfoldr(v.unfoldableList)(function(n){if(n>=t)return new d.Just(new D.Tuple(n,n-1|0));if(a.otherwise)return d.Nothing.value;throw new Error("Failed pattern match at Data.List.Lazy (line 148, column 13 - line 149, column 38): "+[n.constructor.name])})(n)}if(a.otherwise){return b.unfoldr(v.unfoldableList)(function(n){if(n<=t)return new d.Just(new D.Tuple(n,n+1|0));if(a.otherwise)return d.Nothing.value;throw new Error("Failed pattern match at Data.List.Lazy (line 153, column 5 - line 154, column 30): "+[n.constructor.name])})(n)}throw new Error("Failed pattern match at Data.List.Lazy (line 145, column 1 - line 145, column 32): "+[n.constructor.name,t.constructor.name])}},Q=function(n){return l.foldr(v.foldableList)(function(t){return function(e){return n(t)?{yes:v.cons(t)(e.yes),no:e.no}:{yes:e.yes,no:v.cons(t)(e.no)}}})({yes:v.nil,no:v.nil})},V=function(n){return d.isNothing(A(n))},X=new w.Newtype(function(n){return n},q),Y=function n(t){var e=s.map(m.functorLazy)(function(e){var r,u=!1;function i(r){if(r instanceof v.Nil)return u=!0,v.Nil.value;if(r instanceof v.Cons){var i=t(r.value0);if(i instanceof d.Nothing)return void(e=v.step(r.value1));if(i instanceof d.Just)return u=!0,new v.Cons(i.value0,n(t)(r.value1));throw new Error("Failed pattern match at Data.List.Lazy (line 460, column 5 - line 462, column 39): "+[i.constructor.name])}throw new Error("Failed pattern match at Data.List.Lazy (line 458, column 3 - line 458, column 15): "+[r.constructor.name])}for(;!u;)r=i(e);return r}),r=w.unwrap(v.newtypeList);return function(n){return v.List(e(r(n)))}},Z=function(n){return function(t){return function(r){return e.apply(n.Applicative0().Apply0())(s.map(n.Plus1().Alt0().Functor0())(v.cons)(r))(i.defer(t)(function(e){return $(n)(t)(r)}))}}},$=function(e){return function(r){return function(u){return n.alt(e.Plus1().Alt0())(Z(e)(r)(u))(t.pure(e.Applicative0())(v.nil))}}},_=l.foldl(v.foldableList)(function(n){return function(t){return n+1|0}})(0),nn=function(n){return function(n){var t,e=!1;function r(t){if(t instanceof v.Cons){if(V(t.value1))return e=!0,new d.Just(t.value0);if(a.otherwise)return void(n=v.step(t.value1))}return e=!0,d.Nothing.value}for(;!e;)t=r(n);return t}(v.step(n))},tn=function(n){return function(t){return i.fix(v.lazyList)(function(e){return v.cons(t)(s.map(v.functorList)(n)(e))})}},en=function n(t){return function(e){return function(r){if(0===t)return v.cons(e)(r);return s.map(m.functorLazy)(function(r){if(r instanceof v.Nil)return new v.Cons(e,v.nil);if(r instanceof v.Cons)return new v.Cons(r.value0,n(t-1|0)(e)(r.value1));throw new Error("Failed pattern match at Data.List.Lazy (line 340, column 3 - line 340, column 22): "+[r.constructor.name])})(w.unwrap(v.newtypeList)(r))}}},rn=function(n){return function n(t){if(t instanceof v.Cons){if(V(t.value1))return new d.Just(v.nil);if(a.otherwise)return s.map(d.functorMaybe)(v.cons(t.value0))(n(v.step(t.value1)))}return d.Nothing.value}(v.step(n))},un=function(n){var t;return t=v.step(n),function(n){var e,r=t,u=!1;function i(t,e){if(t instanceof v.Nil)return u=!0,d.Nothing.value;if(t instanceof v.Cons&&0===e)return u=!0,new d.Just(t.value0);if(t instanceof v.Cons)return r=v.step(t.value1),void(n=e-1|0);throw new Error("Failed pattern match at Data.List.Lazy (line 299, column 3 - line 299, column 21): "+[t.constructor.name,e.constructor.name])}for(;!u;)e=i(r,n);return e}},on=function(n){return s.map(d.functorMaybe)(function(n){return n.head})(A(n))},an=function n(t){var e=A(t);if(e instanceof d.Nothing)return t;if(e instanceof d.Just){var r=A(e.value0.head);if(r instanceof d.Nothing)return n(e.value0.tail);if(r instanceof d.Just)return v.cons(v.cons(r.value0.head)(Y(on)(e.value0.tail)))(n(v.cons(r.value0.tail)(Y(T)(e.value0.tail))));throw new Error("Failed pattern match at Data.List.Lazy (line 734, column 7 - line 738, column 72): "+[r.constructor.name])}throw new Error("Failed pattern match at Data.List.Lazy (line 730, column 3 - line 738, column 72): "+[e.constructor.name])},cn=function n(t){var e=s.map(m.functorLazy)(function(e){if(e instanceof v.Nil)return v.Nil.value;if(e instanceof v.Cons){var r=I(t(e.value0))(e.value1);return new v.Cons(m.defer(function(n){return new L.NonEmpty(e.value0,r.init)}),n(t)(r.rest))}throw new Error("Failed pattern match at Data.List.Lazy (line 588, column 3 - line 588, column 15): "+[e.constructor.name])}),r=w.unwrap(v.newtypeList);return function(n){return v.List(e(r(n)))}},ln=function(n){return cn(c.eq(n))},fn=function(){var n=t.pure(m.applicativeLazy);return function(t){return v.List(n(t))}}(),sn=function n(t){return function(e){return function(r){return s.map(m.functorLazy)(function(r){if(r instanceof v.Nil)return new v.Cons(e,v.nil);if(r instanceof v.Cons)return t(e)(r.value0)instanceof h.GT?new v.Cons(r.value0,n(t)(e)(r.value1)):new v.Cons(e,fn(r));throw new Error("Failed pattern match at Data.List.Lazy (line 235, column 3 - line 235, column 22): "+[r.constructor.name])})(w.unwrap(v.newtypeList)(r))}}},pn=function(n){return sn(y.compare(n))},mn=function(n){return l.foldr(n)(v.cons)(v.nil)},vn=function(n){return function(t){return function(e){return function r(u){var o=v.step(u);if(o instanceof v.Cons)return i.defer(n)(function(n){return t(o.value0)(r(o.value1))});if(o instanceof v.Nil)return e;throw new Error("Failed pattern match at Data.List.Lazy (line 756, column 13 - line 758, column 15): "+[o.constructor.name])}}}},dn=function n(e){return function(u){return function(i){return function(o){var a=A(o);if(a instanceof d.Nothing)return t.pure(e.Applicative0())(i);if(a instanceof d.Just)return r.bind(e.Bind1())(u(i)(a.value0.head))(function(t){return n(e)(u)(t)(a.value0.tail)});throw new Error("Failed pattern match at Data.List.Lazy (line 747, column 5 - line 750, column 54): "+[a.constructor.name])}}}},wn=function(n){return function e(u){return function(i){return r.bind(d.bindMaybe)(A(i))(function(r){return n(r.head)?t.pure(d.applicativeMaybe)(u):e(u+1|0)(r.tail)})}}(0)},Ln=function(n){return function(t){return s.map(d.functorMaybe)(function(n){return(_(t)-1|0)-n|0})(wn(n)(k(t)))}},yn=function n(e){return function(u){return function(i){var o=A(i);if(o instanceof d.Nothing)return t.pure(e.Applicative0())(v.nil);if(o instanceof d.Just)return r.bind(e.Bind1())(u(o.value0.head))(function(i){return r.bind(e.Bind1())(n(e)(u)(o.value0.tail))(function(n){return t.pure(e.Applicative0())(i?v.cons(o.value0.head)(n):n)})});throw new Error("Failed pattern match at Data.List.Lazy (line 443, column 5 - line 448, column 48): "+[o.constructor.name])}}},hn=function n(t){var e=s.map(m.functorLazy)(function(e){var r,u=!1;function i(r){if(r instanceof v.Nil)return u=!0,v.Nil.value;if(r instanceof v.Cons){if(t(r.value0))return u=!0,new v.Cons(r.value0,n(t)(r.value1));if(a.otherwise)return void(e=v.step(r.value1))}throw new Error("Failed pattern match at Data.List.Lazy (line 428, column 3 - line 428, column 15): "+[r.constructor.name])}for(;!u;)r=i(e);return r}),r=w.unwrap(v.newtypeList);return function(n){return v.List(e(r(n)))}},zn=function(n){return function(t){return function(e){return hn(function(t){return l.any(v.foldableList)(p.heytingAlgebraBoolean)(n(t))(e)})(t)}}},Cn=function(n){return zn(c.eq(n))},Nn=function n(t){var e=s.map(m.functorLazy)(function(e){if(e instanceof v.Nil)return v.Nil.value;if(e instanceof v.Cons)return new v.Cons(e.value0,n(t)(hn(function(n){return!t(e.value0)(n)})(e.value1)));throw new Error("Failed pattern match at Data.List.Lazy (line 621, column 3 - line 621, column 15): "+[e.constructor.name])}),r=w.unwrap(v.newtypeList);return function(n){return v.List(e(r(n)))}},Dn=function(n){return Nn(c.eq(n))},bn=function(n){return new c.Eq(function(t){return function(e){return c.eq(v.eqList(n))(t)(e)}})},qn=function(n){return new y.Ord(function(){return bn(n.Eq0())},function(t){return function(e){return y.compare(v.ordList(n))(t)(e)}})},xn=function(n){return function(t){return Ln(function(e){return c.eq(n)(e)(t)})}},Fn=function(n){return function(t){return wn(function(e){return c.eq(n)(e)(t)})}},En=function(n){return function(t){return function(t){var e,r=!1;function u(e){if(!(e instanceof v.Cons&&n(e.value0)))return r=!0,fn(e);t=v.step(e.value1)}for(;!r;)e=u(t);return e}(v.step(t))}},gn=function(n){var t,e=s.map(m.functorLazy)((t=n,function(n){var e,r=t,u=!1;function i(t,e){if(0===t)return u=!0,e;if(e instanceof v.Nil)return u=!0,v.Nil.value;if(e instanceof v.Cons)return r=t-1|0,void(n=v.step(e.value1));throw new Error("Failed pattern match at Data.List.Lazy (line 536, column 3 - line 536, column 15): "+[t.constructor.name,e.constructor.name])}for(;!u;)e=i(r,n);return e})),r=w.unwrap(v.newtypeList);return function(n){return v.List(e(r(n)))}},jn=function(n){return function(t){return function(e){return B(t-n|0)(gn(n)(e))}}},An=function n(t){return function(e){return function(r){return s.map(m.functorLazy)(function(r){if(r instanceof v.Nil)return v.Nil.value;if(r instanceof v.Cons){if(t(e)(r.value0))return v.step(r.value1);if(a.otherwise)return new v.Cons(r.value0,n(t)(e)(r.value1))}throw new Error("Failed pattern match at Data.List.Lazy (line 650, column 3 - line 650, column 15): "+[r.constructor.name])})(w.unwrap(v.newtypeList)(r))}}},Mn=function(n){return function(t){return function(e){return z.append(v.semigroupList)(t)(l.foldl(v.foldableList)(f.flip(An(n)))(Nn(n)(e))(t))}}},Jn=function(n){return Mn(c.eq(n))},Bn=function n(t){return function(e){var r;return s.map(m.functorLazy)((r=t,function(t){if(t instanceof v.Nil)return v.Nil.value;if(0===r&&t instanceof v.Cons)return v.step(t.value1);if(t instanceof v.Cons)return new v.Cons(t.value0,n(r-1|0)(t.value1));throw new Error("Failed pattern match at Data.List.Lazy (line 353, column 3 - line 353, column 17): "+[r.constructor.name,t.constructor.name])}))(w.unwrap(v.newtypeList)(e))}},Tn=function(n){return An(c.eq(n))},Pn=function(n){return l.foldl(v.foldableList)(f.flip(Tn(n)))},In=function(n){return i.fix(v.lazyList)(function(t){return z.append(v.semigroupList)(n)(t)})},Wn=f.flip(r.bind(v.bindList)),On=function(n){return r.bind(v.bindList)(n)(u.identity(u.categoryFn))},Rn=Y(u.identity(u.categoryFn)),Sn=function n(t){return function(e){return function(r){var u;return s.map(m.functorLazy)((u=t,function(t){if(t instanceof v.Nil)return v.Nil.value;if(0===u&&t instanceof v.Cons){var r=e(t.value0);if(r instanceof d.Nothing)return v.step(t.value1);if(r instanceof d.Just)return new v.Cons(r.value0,t.value1);throw new Error("Failed pattern match at Data.List.Lazy (line 394, column 22 - line 396, column 26): "+[r.constructor.name])}if(t instanceof v.Cons)return new v.Cons(t.value0,n(u-1|0)(e)(t.value1));throw new Error("Failed pattern match at Data.List.Lazy (line 393, column 3 - line 393, column 17): "+[u.constructor.name,t.constructor.name])}))(w.unwrap(v.newtypeList)(r))}}},kn=function(n){return function(t){return Sn(n)(function(n){return d.Just.create(t(n))})}};module.exports={toUnfoldable:M,fromFoldable:mn,singleton:O,range:K,replicate:H,replicateM:U,some:Z,many:$,repeat:G,iterate:tn,cycle:In,null:V,length:_,snoc:W,insert:pn,insertBy:sn,head:on,last:nn,tail:T,init:rn,uncons:A,index:un,elemIndex:Fn,elemLastIndex:xn,findIndex:wn,findLastIndex:Ln,insertAt:en,deleteAt:Bn,updateAt:g,modifyAt:kn,alterAt:Sn,reverse:k,concat:On,concatMap:Wn,filter:hn,filterM:yn,mapMaybe:Y,catMaybes:Rn,Pattern:q,stripPrefix:P,slice:jn,take:B,takeWhile:J,drop:gn,dropWhile:En,span:I,group:ln,groupBy:cn,partition:Q,nub:Dn,nubBy:Nn,union:Jn,unionBy:Mn,delete:Tn,deleteBy:An,difference:Pn,intersect:Cn,intersectBy:zn,zipWith:x,zipWithA:F,zip:E,unzip:j,transpose:an,foldM:dn,foldrLazy:vn,scanrLazy:S,eqPattern:bn,ordPattern:qn,newtypePattern:X,showPattern:R}; +},{"../Control.Alt/index.js":"lN+m","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Control.Lazy/index.js":"y9cE","../Control.Monad.Rec.Class/index.js":"UVIy","../Data.Boolean/index.js":"ObQr","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.HeytingAlgebra/index.js":"paZe","../Data.Lazy/index.js":"aRUE","../Data.List.Lazy.Types/index.js":"EJF+","../Data.Maybe/index.js":"5mN7","../Data.Newtype/index.js":"lz8k","../Data.NonEmpty/index.js":"qF8i","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7","../Data.Traversable/index.js":"n7EE","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z"}],"RRDs":[function(require,module,exports) { +"use strict";var e=require("../Control.Applicative/index.js"),n=require("../Control.Apply/index.js"),u=require("../Control.Category/index.js"),a=require("../Data.Eq/index.js"),t=require("../Data.Foldable/index.js"),l=require("../Data.FoldableWithIndex/index.js"),r=require("../Data.Function/index.js"),v=require("../Data.Functor/index.js"),i=require("../Data.FunctorWithIndex/index.js"),o=require("../Data.HeytingAlgebra/index.js"),c=require("../Data.List/index.js"),f=require("../Data.List.Lazy/index.js"),s=require("../Data.List.Lazy.Types/index.js"),p=require("../Data.List.Types/index.js"),m=require("../Data.Maybe/index.js"),w=require("../Data.Monoid/index.js"),d=require("../Data.Ord/index.js"),h=require("../Data.Ordering/index.js"),y=require("../Data.Semigroup/index.js"),E=require("../Data.Show/index.js"),M=require("../Data.Traversable/index.js"),I=require("../Data.TraversableWithIndex/index.js"),L=require("../Data.Tuple/index.js"),D=require("../Data.Unfoldable/index.js"),F=function(){function e(){}return e.value=new e,e}(),T=function(){function e(e,n,u,a){this.value0=e,this.value1=n,this.value2=u,this.value3=a}return e.create=function(n){return function(u){return function(a){return function(t){return new e(n,u,a,t)}}}},e}(),b=function(){function e(e,n,u,a,t,l,r){this.value0=e,this.value1=n,this.value2=u,this.value3=a,this.value4=t,this.value5=l,this.value6=r}return e.create=function(n){return function(u){return function(a){return function(t){return function(l){return function(r){return function(v){return new e(n,u,a,t,l,r,v)}}}}}}},e}(),g=function(){function e(e,n,u){this.value0=e,this.value1=n,this.value2=u}return e.create=function(n){return function(u){return function(a){return new e(n,u,a)}}},e}(),x=function(){function e(e,n,u){this.value0=e,this.value1=n,this.value2=u}return e.create=function(n){return function(u){return function(a){return new e(n,u,a)}}},e}(),C=function(){function e(e,n,u,a,t,l){this.value0=e,this.value1=n,this.value2=u,this.value3=a,this.value4=t,this.value5=l}return e.create=function(n){return function(u){return function(a){return function(t){return function(l){return function(r){return new e(n,u,a,t,l,r)}}}}}},e}(),q=function(){function e(e,n,u,a,t,l){this.value0=e,this.value1=n,this.value2=u,this.value3=a,this.value4=t,this.value5=l}return e.create=function(n){return function(u){return function(a){return function(t){return function(l){return function(r){return new e(n,u,a,t,l,r)}}}}}},e}(),J=function(){function e(e,n,u,a,t,l){this.value0=e,this.value1=n,this.value2=u,this.value3=a,this.value4=t,this.value5=l}return e.create=function(n){return function(u){return function(a){return function(t){return function(l){return function(r){return new e(n,u,a,t,l,r)}}}}}},e}(),N=function(){function e(e,n,u,a){this.value0=e,this.value1=n,this.value2=u,this.value3=a}return e.create=function(n){return function(u){return function(a){return function(t){return new e(n,u,a,t)}}}},e}(),A=function n(u){if(u instanceof F)return p.Nil.value;if(u instanceof T)return y.append(p.semigroupList)(n(u.value0))(y.append(p.semigroupList)(e.pure(p.applicativeList)(u.value2))(n(u.value3)));if(u instanceof b)return y.append(p.semigroupList)(n(u.value0))(y.append(p.semigroupList)(e.pure(p.applicativeList)(u.value2))(y.append(p.semigroupList)(n(u.value3))(y.append(p.semigroupList)(e.pure(p.applicativeList)(u.value5))(n(u.value6)))));throw new Error("Failed pattern match at Data.Map.Internal (line 612, column 1 - line 612, column 40): "+[u.constructor.name])},k=function e(n){if(n instanceof F)return 0;if(n instanceof T)return(1+e(n.value0)|0)+e(n.value3)|0;if(n instanceof b)return((2+e(n.value0)|0)+e(n.value3)|0)+e(n.value6)|0;throw new Error("Failed pattern match at Data.Map.Internal (line 662, column 1 - line 662, column 35): "+[n.constructor.name])},W=function(e){return function(n){return new T(F.value,e,n,F.value)}},j=function(e){return function(n){return D.unfoldr(e)(function(e){var n,u=!1;function a(n){if(n instanceof p.Nil)return u=!0,m.Nothing.value;if(n instanceof p.Cons){if(n.value0 instanceof F)return void(e=n.value1);if(n.value0 instanceof T&&n.value0.value0 instanceof F&&n.value0.value3 instanceof F)return u=!0,m.Just.create(new L.Tuple(new L.Tuple(n.value0.value1,n.value0.value2),n.value1));if(n.value0 instanceof T&&n.value0.value0 instanceof F)return u=!0,m.Just.create(new L.Tuple(new L.Tuple(n.value0.value1,n.value0.value2),new p.Cons(n.value0.value3,n.value1)));if(n.value0 instanceof T)return void(e=new p.Cons(n.value0.value0,new p.Cons(W(n.value0.value1)(n.value0.value2),new p.Cons(n.value0.value3,n.value1))));if(n.value0 instanceof b)return void(e=new p.Cons(n.value0.value0,new p.Cons(W(n.value0.value1)(n.value0.value2),new p.Cons(n.value0.value3,new p.Cons(W(n.value0.value4)(n.value0.value5),new p.Cons(n.value0.value6,n.value1))))));throw new Error("Failed pattern match at Data.Map.Internal (line 577, column 18 - line 586, column 71): "+[n.value0.constructor.name])}throw new Error("Failed pattern match at Data.Map.Internal (line 576, column 3 - line 576, column 19): "+[n.constructor.name])}for(;!u;)n=a(e);return n})(new p.Cons(n,p.Nil.value))}},Q=j(D.unfoldableArray),G=function(e){return function(n){return D.unfoldr(e)(function(e){var n,u=!1;function a(n){if(n instanceof p.Nil)return u=!0,m.Nothing.value;if(n instanceof p.Cons){if(n.value0 instanceof F)return void(e=n.value1);if(n.value0 instanceof T)return u=!0,m.Just.create(new L.Tuple(new L.Tuple(n.value0.value1,n.value0.value2),new p.Cons(n.value0.value0,new p.Cons(n.value0.value3,n.value1))));if(n.value0 instanceof b)return u=!0,m.Just.create(new L.Tuple(new L.Tuple(n.value0.value1,n.value0.value2),new p.Cons(W(n.value0.value4)(n.value0.value5),new p.Cons(n.value0.value0,new p.Cons(n.value0.value3,new p.Cons(n.value0.value6,n.value1))))));throw new Error("Failed pattern match at Data.Map.Internal (line 598, column 18 - line 603, column 77): "+[n.value0.constructor.name])}throw new Error("Failed pattern match at Data.Map.Internal (line 597, column 3 - line 597, column 19): "+[n.constructor.name])}for(;!u;)n=a(e);return n})(new p.Cons(n,p.Nil.value))}},S=function e(n){return function(u){return function(a){if(a instanceof F)return"Leaf";if(a instanceof T)return"Two ("+e(n)(u)(a.value0)+") ("+E.show(n)(a.value1)+") ("+E.show(u)(a.value2)+") ("+e(n)(u)(a.value3)+")";if(a instanceof b)return"Three ("+e(n)(u)(a.value0)+") ("+E.show(n)(a.value1)+") ("+E.show(u)(a.value2)+") ("+e(n)(u)(a.value3)+") ("+E.show(n)(a.value4)+") ("+E.show(u)(a.value5)+") ("+e(n)(u)(a.value6)+")";throw new Error("Failed pattern match at Data.Map.Internal (line 153, column 1 - line 153, column 62): "+[a.constructor.name])}}},O=function(e){return function(n){return new E.Show(function(u){return"(fromFoldable "+E.show(E.showArray(L.showTuple(e)(n)))(Q(u))+")"})}},U=function(e){return function(n){var u=d.compare(e);return function e(a){if(a instanceof F)return m.Nothing.value;if(a instanceof T){var t=u(n)(a.value1);if(t instanceof h.EQ)return new m.Just({key:a.value1,value:a.value2});if(t instanceof h.GT)return m.Just.create(m.fromMaybe({key:a.value1,value:a.value2})(e(a.value3)));if(t instanceof h.LT)return e(a.value0);throw new Error("Failed pattern match at Data.Map.Internal (line 225, column 33 - line 228, column 20): "+[t.constructor.name])}if(a instanceof b){var l=u(n)(a.value4);if(l instanceof h.EQ)return new m.Just({key:a.value4,value:a.value5});if(l instanceof h.GT)return m.Just.create(m.fromMaybe({key:a.value4,value:a.value5})(e(a.value6)));if(l instanceof h.LT)return e(new T(a.value0,a.value1,a.value2,a.value3));throw new Error("Failed pattern match at Data.Map.Internal (line 229, column 45 - line 232, column 36): "+[l.constructor.name])}throw new Error("Failed pattern match at Data.Map.Internal (line 224, column 5 - line 224, column 22): "+[a.constructor.name])}}},z=function(e){return function(n){var u=d.compare(e);return function e(a){if(a instanceof F)return m.Nothing.value;if(a instanceof T){var t=u(n)(a.value1);if(t instanceof h.EQ)return new m.Just({key:a.value1,value:a.value2});if(t instanceof h.LT)return m.Just.create(m.fromMaybe({key:a.value1,value:a.value2})(e(a.value0)));if(t instanceof h.GT)return e(a.value3);throw new Error("Failed pattern match at Data.Map.Internal (line 259, column 33 - line 262, column 21): "+[t.constructor.name])}if(a instanceof b){var l=u(n)(a.value1);if(l instanceof h.EQ)return new m.Just({key:a.value1,value:a.value2});if(l instanceof h.LT)return m.Just.create(m.fromMaybe({key:a.value1,value:a.value2})(e(a.value0)));if(l instanceof h.GT)return e(new T(a.value3,a.value4,a.value5,a.value6));throw new Error("Failed pattern match at Data.Map.Internal (line 263, column 45 - line 266, column 37): "+[l.constructor.name])}throw new Error("Failed pattern match at Data.Map.Internal (line 258, column 5 - line 258, column 22): "+[a.constructor.name])}}},K=function(e){return function(n){var u=d.compare(e);return function(e){var a,t=!1;function l(a){if(a instanceof F)return t=!0,m.Nothing.value;if(a instanceof T){var l=u(n)(a.value1);return l instanceof h.EQ?(t=!0,new m.Just(a.value2)):l instanceof h.LT?void(e=a.value0):void(e=a.value3)}if(a instanceof b){var r=u(n)(a.value1);if(r instanceof h.EQ)return t=!0,new m.Just(a.value2);var v=u(n)(a.value4);return v instanceof h.EQ?(t=!0,new m.Just(a.value5)):r instanceof h.LT?void(e=a.value0):v instanceof h.GT?void(e=a.value6):void(e=a.value3)}throw new Error("Failed pattern match at Data.Map.Internal (line 200, column 5 - line 200, column 22): "+[a.constructor.name])}for(;!t;)a=l(e);return a}}},B=function(e){return function(n){return function(u){return m.isJust(K(e)(n)(u))}}},H=function n(u){if(u instanceof F)return p.Nil.value;if(u instanceof T)return y.append(p.semigroupList)(n(u.value0))(y.append(p.semigroupList)(e.pure(p.applicativeList)(u.value1))(n(u.value3)));if(u instanceof b)return y.append(p.semigroupList)(n(u.value0))(y.append(p.semigroupList)(e.pure(p.applicativeList)(u.value1))(y.append(p.semigroupList)(n(u.value3))(y.append(p.semigroupList)(e.pure(p.applicativeList)(u.value4))(n(u.value6)))));throw new Error("Failed pattern match at Data.Map.Internal (line 606, column 1 - line 606, column 38): "+[u.constructor.name])},V=function(e){return function(n){return function(u){return function(l){return t.all(s.foldableList)(o.heytingAlgebraBoolean)(function(u){return a.eq(m.eqMaybe(n))(K(e)(u.value0)(l))(new m.Just(u.value1))})(j(s.unfoldableList)(u))}}}},P=function(e){return e instanceof F},R=new v.Functor(function(e){return function(n){if(n instanceof F)return F.value;if(n instanceof T)return new T(v.map(R)(e)(n.value0),n.value1,e(n.value2),v.map(R)(e)(n.value3));if(n instanceof b)return new b(v.map(R)(e)(n.value0),n.value1,e(n.value2),v.map(R)(e)(n.value3),n.value4,e(n.value5),v.map(R)(e)(n.value6));throw new Error("Failed pattern match at Data.Map.Internal (line 96, column 1 - line 99, column 110): "+[e.constructor.name,n.constructor.name])}}),X=new i.FunctorWithIndex(function(){return R},function(e){return function(n){if(n instanceof F)return F.value;if(n instanceof T)return new T(i.mapWithIndex(X)(e)(n.value0),n.value1,e(n.value1)(n.value2),i.mapWithIndex(X)(e)(n.value3));if(n instanceof b)return new b(i.mapWithIndex(X)(e)(n.value0),n.value1,e(n.value1)(n.value2),i.mapWithIndex(X)(e)(n.value3),n.value4,e(n.value4)(n.value5),i.mapWithIndex(X)(e)(n.value6));throw new Error("Failed pattern match at Data.Map.Internal (line 101, column 1 - line 104, column 152): "+[e.constructor.name,n.constructor.name])}}),Y=function(e){return function(n){return function(u){var a,t=e,l=n,r=!1;function v(e,n,a){if(n instanceof p.Nil)return r=!0,a;if(n instanceof p.Cons){if(n.value0 instanceof g)return t=e,l=n.value1,void(u=new T(a,n.value0.value0,n.value0.value1,n.value0.value2));if(n.value0 instanceof x)return t=e,l=n.value1,void(u=new T(n.value0.value0,n.value0.value1,n.value0.value2,a));if(n.value0 instanceof C)return t=e,l=n.value1,void(u=new b(a,n.value0.value0,n.value0.value1,n.value0.value2,n.value0.value3,n.value0.value4,n.value0.value5));if(n.value0 instanceof q)return t=e,l=n.value1,void(u=new b(n.value0.value0,n.value0.value1,n.value0.value2,a,n.value0.value3,n.value0.value4,n.value0.value5));if(n.value0 instanceof J)return t=e,l=n.value1,void(u=new b(n.value0.value0,n.value0.value1,n.value0.value2,n.value0.value3,n.value0.value4,n.value0.value5,a));throw new Error("Failed pattern match at Data.Map.Internal (line 418, column 3 - line 423, column 88): "+[n.value0.constructor.name])}throw new Error("Failed pattern match at Data.Map.Internal (line 415, column 1 - line 415, column 80): "+[n.constructor.name,a.constructor.name])}for(;!r;)a=v(t,l,u);return a}}},Z=function(e){return function(n){return function(u){var a,t=function(n){return function(u){var a,t=n,l=!1;function r(n,a){if(n instanceof p.Nil)return l=!0,new T(a.value0,a.value1,a.value2,a.value3);if(n instanceof p.Cons){if(n.value0 instanceof g)return l=!0,Y(e)(n.value1)(new b(a.value0,a.value1,a.value2,a.value3,n.value0.value0,n.value0.value1,n.value0.value2));if(n.value0 instanceof x)return l=!0,Y(e)(n.value1)(new b(n.value0.value0,n.value0.value1,n.value0.value2,a.value0,a.value1,a.value2,a.value3));if(n.value0 instanceof C)return t=n.value1,void(u=new N(new T(a.value0,a.value1,a.value2,a.value3),n.value0.value0,n.value0.value1,new T(n.value0.value2,n.value0.value3,n.value0.value4,n.value0.value5)));if(n.value0 instanceof q)return t=n.value1,void(u=new N(new T(n.value0.value0,n.value0.value1,n.value0.value2,a.value0),a.value1,a.value2,new T(a.value3,n.value0.value3,n.value0.value4,n.value0.value5)));if(n.value0 instanceof J)return t=n.value1,void(u=new N(new T(n.value0.value0,n.value0.value1,n.value0.value2,n.value0.value3),n.value0.value4,n.value0.value5,new T(a.value0,a.value1,a.value2,a.value3)));throw new Error("Failed pattern match at Data.Map.Internal (line 454, column 5 - line 459, column 108): "+[n.value0.constructor.name,a.constructor.name])}throw new Error("Failed pattern match at Data.Map.Internal (line 451, column 3 - line 451, column 56): "+[n.constructor.name,a.constructor.name])}for(;!l;)a=r(t,u);return a}},l=d.compare(e);return a=p.Nil.value,function(r){var v,i=a,o=!1;function c(a,v){if(v instanceof F)return o=!0,t(a)(new N(F.value,n,u,F.value));if(v instanceof T){var c=l(n)(v.value1);return c instanceof h.EQ?(o=!0,Y(e)(a)(new T(v.value0,n,u,v.value3))):c instanceof h.LT?(i=new p.Cons(new g(v.value1,v.value2,v.value3),a),void(r=v.value0)):(i=new p.Cons(new x(v.value0,v.value1,v.value2),a),void(r=v.value3))}if(v instanceof b){var f=l(n)(v.value1);if(f instanceof h.EQ)return o=!0,Y(e)(a)(new b(v.value0,n,u,v.value3,v.value4,v.value5,v.value6));var s=l(n)(v.value4);return s instanceof h.EQ?(o=!0,Y(e)(a)(new b(v.value0,v.value1,v.value2,v.value3,n,u,v.value6))):f instanceof h.LT?(i=new p.Cons(new C(v.value1,v.value2,v.value3,v.value4,v.value5,v.value6),a),void(r=v.value0)):f instanceof h.GT&&s instanceof h.LT?(i=new p.Cons(new q(v.value0,v.value1,v.value2,v.value4,v.value5,v.value6),a),void(r=v.value3)):(i=new p.Cons(new J(v.value0,v.value1,v.value2,v.value3,v.value4,v.value5),a),void(r=v.value6))}throw new Error("Failed pattern match at Data.Map.Internal (line 434, column 3 - line 434, column 55): "+[a.constructor.name,v.constructor.name])}for(;!o;)v=c(i,r);return v}}}},$=function(e){return function(n){var u,a=function(n){return function(u){var a,t=n,l=!1;function r(n,a){if(n instanceof p.Nil)return l=!0,a;if(n instanceof p.Cons){if(n.value0 instanceof g&&n.value0.value2 instanceof F&&a instanceof F)return l=!0,Y(e)(n.value1)(new T(F.value,n.value0.value0,n.value0.value1,F.value));if(n.value0 instanceof x&&n.value0.value0 instanceof F&&a instanceof F)return l=!0,Y(e)(n.value1)(new T(F.value,n.value0.value1,n.value0.value2,F.value));if(n.value0 instanceof g&&n.value0.value2 instanceof T)return t=n.value1,void(u=new b(a,n.value0.value0,n.value0.value1,n.value0.value2.value0,n.value0.value2.value1,n.value0.value2.value2,n.value0.value2.value3));if(n.value0 instanceof x&&n.value0.value0 instanceof T)return t=n.value1,void(u=new b(n.value0.value0.value0,n.value0.value0.value1,n.value0.value0.value2,n.value0.value0.value3,n.value0.value1,n.value0.value2,a));if(n.value0 instanceof g&&n.value0.value2 instanceof b)return l=!0,Y(e)(n.value1)(new T(new T(a,n.value0.value0,n.value0.value1,n.value0.value2.value0),n.value0.value2.value1,n.value0.value2.value2,new T(n.value0.value2.value3,n.value0.value2.value4,n.value0.value2.value5,n.value0.value2.value6)));if(n.value0 instanceof x&&n.value0.value0 instanceof b)return l=!0,Y(e)(n.value1)(new T(new T(n.value0.value0.value0,n.value0.value0.value1,n.value0.value0.value2,n.value0.value0.value3),n.value0.value0.value4,n.value0.value0.value5,new T(n.value0.value0.value6,n.value0.value1,n.value0.value2,a)));if(n.value0 instanceof C&&n.value0.value2 instanceof F&&n.value0.value5 instanceof F&&a instanceof F)return l=!0,Y(e)(n.value1)(new b(F.value,n.value0.value0,n.value0.value1,F.value,n.value0.value3,n.value0.value4,F.value));if(n.value0 instanceof q&&n.value0.value0 instanceof F&&n.value0.value5 instanceof F&&a instanceof F)return l=!0,Y(e)(n.value1)(new b(F.value,n.value0.value1,n.value0.value2,F.value,n.value0.value3,n.value0.value4,F.value));if(n.value0 instanceof J&&n.value0.value0 instanceof F&&n.value0.value3 instanceof F&&a instanceof F)return l=!0,Y(e)(n.value1)(new b(F.value,n.value0.value1,n.value0.value2,F.value,n.value0.value4,n.value0.value5,F.value));if(n.value0 instanceof C&&n.value0.value2 instanceof T)return l=!0,Y(e)(n.value1)(new T(new b(a,n.value0.value0,n.value0.value1,n.value0.value2.value0,n.value0.value2.value1,n.value0.value2.value2,n.value0.value2.value3),n.value0.value3,n.value0.value4,n.value0.value5));if(n.value0 instanceof q&&n.value0.value0 instanceof T)return l=!0,Y(e)(n.value1)(new T(new b(n.value0.value0.value0,n.value0.value0.value1,n.value0.value0.value2,n.value0.value0.value3,n.value0.value1,n.value0.value2,a),n.value0.value3,n.value0.value4,n.value0.value5));if(n.value0 instanceof q&&n.value0.value5 instanceof T)return l=!0,Y(e)(n.value1)(new T(n.value0.value0,n.value0.value1,n.value0.value2,new b(a,n.value0.value3,n.value0.value4,n.value0.value5.value0,n.value0.value5.value1,n.value0.value5.value2,n.value0.value5.value3)));if(n.value0 instanceof J&&n.value0.value3 instanceof T)return l=!0,Y(e)(n.value1)(new T(n.value0.value0,n.value0.value1,n.value0.value2,new b(n.value0.value3.value0,n.value0.value3.value1,n.value0.value3.value2,n.value0.value3.value3,n.value0.value4,n.value0.value5,a)));if(n.value0 instanceof C&&n.value0.value2 instanceof b)return l=!0,Y(e)(n.value1)(new b(new T(a,n.value0.value0,n.value0.value1,n.value0.value2.value0),n.value0.value2.value1,n.value0.value2.value2,new T(n.value0.value2.value3,n.value0.value2.value4,n.value0.value2.value5,n.value0.value2.value6),n.value0.value3,n.value0.value4,n.value0.value5));if(n.value0 instanceof q&&n.value0.value0 instanceof b)return l=!0,Y(e)(n.value1)(new b(new T(n.value0.value0.value0,n.value0.value0.value1,n.value0.value0.value2,n.value0.value0.value3),n.value0.value0.value4,n.value0.value0.value5,new T(n.value0.value0.value6,n.value0.value1,n.value0.value2,a),n.value0.value3,n.value0.value4,n.value0.value5));if(n.value0 instanceof q&&n.value0.value5 instanceof b)return l=!0,Y(e)(n.value1)(new b(n.value0.value0,n.value0.value1,n.value0.value2,new T(a,n.value0.value3,n.value0.value4,n.value0.value5.value0),n.value0.value5.value1,n.value0.value5.value2,new T(n.value0.value5.value3,n.value0.value5.value4,n.value0.value5.value5,n.value0.value5.value6)));if(n.value0 instanceof J&&n.value0.value3 instanceof b)return l=!0,Y(e)(n.value1)(new b(n.value0.value0,n.value0.value1,n.value0.value2,new T(n.value0.value3.value0,n.value0.value3.value1,n.value0.value3.value2,n.value0.value3.value3),n.value0.value3.value4,n.value0.value3.value5,new T(n.value0.value3.value6,n.value0.value4,n.value0.value5,a)));throw new Error("Failed pattern match at Data.Map.Internal (line 511, column 9 - line 528, column 136): "+[n.value0.constructor.name,a.constructor.name])}throw new Error("Failed pattern match at Data.Map.Internal (line 508, column 5 - line 528, column 136): "+[n.constructor.name])}for(;!l;)a=r(t,u);return a}},t=function(e){return function(n){var u,t=e,l=!1;function r(e,u){if(u instanceof T&&u.value0 instanceof F&&u.value3 instanceof F)return l=!0,a(e)(F.value);if(u instanceof T)return t=new p.Cons(new x(u.value0,u.value1,u.value2),e),void(n=u.value3);if(u instanceof b&&u.value0 instanceof F&&u.value3 instanceof F&&u.value6 instanceof F)return l=!0,a(new p.Cons(new x(F.value,u.value1,u.value2),e))(F.value);if(u instanceof b)return t=new p.Cons(new J(u.value0,u.value1,u.value2,u.value3,u.value4,u.value5),e),void(n=u.value6);throw new Error("Failed pattern match at Data.Map.Internal (line 540, column 5 - line 544, column 107): "+[u.constructor.name])}for(;!l;)u=r(t,n);return u}},l=function(e){var n,u=!1;function a(n){if(n instanceof T&&n.value3 instanceof F)return u=!0,{key:n.value1,value:n.value2};if(n instanceof T)e=n.value3;else{if(n instanceof b&&n.value6 instanceof F)return u=!0,{key:n.value4,value:n.value5};if(!(n instanceof b))throw new Error("Failed pattern match at Data.Map.Internal (line 531, column 33 - line 535, column 45): "+[n.constructor.name]);e=n.value6}}for(;!u;)n=a(e);return n},r=d.compare(e);return u=p.Nil.value,function(v){var i,o=u,c=!1;function f(u,i){if(i instanceof F)return c=!0,m.Nothing.value;if(i instanceof T){var f=r(n)(i.value1);if(i.value3 instanceof F&&f instanceof h.EQ)return c=!0,new m.Just(new L.Tuple(i.value2,a(u)(F.value)));if(f instanceof h.EQ){var s=l(i.value0);return c=!0,new m.Just(new L.Tuple(i.value2,t(new p.Cons(new g(s.key,s.value,i.value3),u))(i.value0)))}return f instanceof h.LT?(o=new p.Cons(new g(i.value1,i.value2,i.value3),u),void(v=i.value0)):(o=new p.Cons(new x(i.value0,i.value1,i.value2),u),void(v=i.value3))}if(i instanceof b){var w=i.value0 instanceof F&&i.value3 instanceof F&&i.value6 instanceof F,d=(f=r(n)(i.value4),r(n)(i.value1));return w&&d instanceof h.EQ?(c=!0,new m.Just(new L.Tuple(i.value2,Y(e)(u)(new T(F.value,i.value4,i.value5,F.value))))):w&&f instanceof h.EQ?(c=!0,new m.Just(new L.Tuple(i.value5,Y(e)(u)(new T(F.value,i.value1,i.value2,F.value))))):d instanceof h.EQ?(s=l(i.value0),c=!0,new m.Just(new L.Tuple(i.value2,t(new p.Cons(new C(s.key,s.value,i.value3,i.value4,i.value5,i.value6),u))(i.value0)))):f instanceof h.EQ?(s=l(i.value3),c=!0,new m.Just(new L.Tuple(i.value5,t(new p.Cons(new q(i.value0,i.value1,i.value2,s.key,s.value,i.value6),u))(i.value3)))):d instanceof h.LT?(o=new p.Cons(new C(i.value1,i.value2,i.value3,i.value4,i.value5,i.value6),u),void(v=i.value0)):d instanceof h.GT&&f instanceof h.LT?(o=new p.Cons(new q(i.value0,i.value1,i.value2,i.value4,i.value5,i.value6),u),void(v=i.value3)):(o=new p.Cons(new J(i.value0,i.value1,i.value2,i.value3,i.value4,i.value5),u),void(v=i.value6))}throw new Error("Failed pattern match at Data.Map.Internal (line 481, column 34 - line 504, column 80): "+[i.constructor.name])}for(;!c;)i=f(o,v);return i}}},_=new t.Foldable(function(e){return function(n){return function(u){return t.foldMap(p.foldableList)(e)(n)(A(u))}}},function(e){return function(n){return function(u){return t.foldl(p.foldableList)(e)(n)(A(u))}}},function(e){return function(n){return function(u){return t.foldr(p.foldableList)(e)(n)(A(u))}}}),ee=new M.Traversable(function(){return _},function(){return R},function(e){return M.traverse(ee)(e)(u.identity(u.categoryFn))},function(u){return function(a){return function(t){if(t instanceof F)return e.pure(u)(F.value);if(t instanceof T)return n.apply(u.Apply0())(n.apply(u.Apply0())(n.apply(u.Apply0())(v.map(u.Apply0().Functor0())(T.create)(M.traverse(ee)(u)(a)(t.value0)))(e.pure(u)(t.value1)))(a(t.value2)))(M.traverse(ee)(u)(a)(t.value3));if(t instanceof b)return n.apply(u.Apply0())(n.apply(u.Apply0())(n.apply(u.Apply0())(n.apply(u.Apply0())(n.apply(u.Apply0())(n.apply(u.Apply0())(v.map(u.Apply0().Functor0())(b.create)(M.traverse(ee)(u)(a)(t.value0)))(e.pure(u)(t.value1)))(a(t.value2)))(M.traverse(ee)(u)(a)(t.value3)))(e.pure(u)(t.value4)))(a(t.value5)))(M.traverse(ee)(u)(a)(t.value6));throw new Error("Failed pattern match at Data.Map.Internal (line 119, column 1 - line 134, column 31): "+[a.constructor.name,t.constructor.name])}}}),ne=function(e){return function(n){return function(u){return function(a){return function(t){var l=function(){if(u instanceof m.Just)return function(n){return d.lessThan(e)(n)(u.value0)};if(u instanceof m.Nothing)return r.const(!1);throw new Error("Failed pattern match at Data.Map.Internal (line 319, column 7 - line 323, column 22): "+[u.constructor.name])}(),v=function(){if(a instanceof m.Just)return function(n){return d.greaterThan(e)(n)(a.value0)};if(a instanceof m.Nothing)return r.const(!1);throw new Error("Failed pattern match at Data.Map.Internal (line 326, column 7 - line 330, column 22): "+[a.constructor.name])}(),i=function(){if(u instanceof m.Just&&a instanceof m.Just)return function(n){return d.lessThanOrEq(e)(u.value0)(n)&&d.lessThanOrEq(e)(n)(a.value0)};if(u instanceof m.Just&&a instanceof m.Nothing)return function(n){return d.lessThanOrEq(e)(u.value0)(n)};if(u instanceof m.Nothing&&a instanceof m.Just)return function(n){return d.lessThanOrEq(e)(n)(a.value0)};if(u instanceof m.Nothing&&a instanceof m.Nothing)return r.const(!0);throw new Error("Failed pattern match at Data.Map.Internal (line 333, column 7 - line 341, column 21): "+[u.constructor.name,a.constructor.name])}();return function e(u){if(u instanceof F)return w.mempty(n);if(u instanceof T)return y.append(n.Semigroup0())(l(u.value1)?w.mempty(n):e(u.value0))(y.append(n.Semigroup0())(i(u.value1)?t(u.value1)(u.value2):w.mempty(n))(v(u.value1)?w.mempty(n):e(u.value3)));if(u instanceof b)return y.append(n.Semigroup0())(l(u.value1)?w.mempty(n):e(u.value0))(y.append(n.Semigroup0())(i(u.value1)?t(u.value1)(u.value2):w.mempty(n))(y.append(n.Semigroup0())(l(u.value4)||v(u.value1)?w.mempty(n):e(u.value3))(y.append(n.Semigroup0())(i(u.value4)?t(u.value4)(u.value5):w.mempty(n))(v(u.value4)?w.mempty(n):e(u.value6)))));throw new Error("Failed pattern match at Data.Map.Internal (line 359, column 10 - line 371, column 54): "+[u.constructor.name])}}}}}},ue=function(){var e;return e=m.Nothing.value,function(n){var u,a=e,t=!1;function l(e,u){if(u instanceof F)return t=!0,e;if(u instanceof T)return a=new m.Just({key:u.value1,value:u.value2}),void(n=u.value0);if(u instanceof b)return a=new m.Just({key:u.value1,value:u.value2}),void(n=u.value0);throw new Error("Failed pattern match at Data.Map.Internal (line 297, column 5 - line 297, column 22): "+[e.constructor.name,u.constructor.name])}for(;!t;)u=l(a,n);return u}}(),ae=function(e){return function(n){var u=d.compare(e);return function e(a){if(a instanceof F)return m.Nothing.value;if(a instanceof T){var t=u(n)(a.value1);if(t instanceof h.EQ)return ue(a.value3);if(t instanceof h.LT)return m.Just.create(m.fromMaybe({key:a.value1,value:a.value2})(e(a.value0)));if(t instanceof h.GT)return e(a.value3);throw new Error("Failed pattern match at Data.Map.Internal (line 276, column 33 - line 279, column 21): "+[t.constructor.name])}if(a instanceof b){var l=u(n)(a.value1);if(l instanceof h.EQ)return ue(new T(a.value3,a.value4,a.value5,a.value6));if(l instanceof h.LT)return m.Just.create(m.fromMaybe({key:a.value1,value:a.value2})(e(a.value0)));if(l instanceof h.GT)return e(new T(a.value3,a.value4,a.value5,a.value6));throw new Error("Failed pattern match at Data.Map.Internal (line 280, column 45 - line 283, column 37): "+[l.constructor.name])}throw new Error("Failed pattern match at Data.Map.Internal (line 275, column 5 - line 275, column 22): "+[a.constructor.name])}}},te=function(){var e;return e=m.Nothing.value,function(n){var u,a=e,t=!1;function l(e,u){if(u instanceof F)return t=!0,e;if(u instanceof T)return a=new m.Just({key:u.value1,value:u.value2}),void(n=u.value3);if(u instanceof b)return a=new m.Just({key:u.value4,value:u.value5}),void(n=u.value6);throw new Error("Failed pattern match at Data.Map.Internal (line 289, column 5 - line 289, column 22): "+[e.constructor.name,u.constructor.name])}for(;!t;)u=l(a,n);return u}}(),le=function(e){return function(n){var u=d.compare(e);return function e(a){if(a instanceof F)return m.Nothing.value;if(a instanceof T){var t=u(n)(a.value1);if(t instanceof h.EQ)return te(a.value0);if(t instanceof h.GT)return m.Just.create(m.fromMaybe({key:a.value1,value:a.value2})(e(a.value3)));if(t instanceof h.LT)return e(a.value0);throw new Error("Failed pattern match at Data.Map.Internal (line 242, column 33 - line 245, column 20): "+[t.constructor.name])}if(a instanceof b){var l=u(n)(a.value4);if(l instanceof h.EQ)return te(new T(a.value0,a.value1,a.value2,a.value3));if(l instanceof h.GT)return m.Just.create(m.fromMaybe({key:a.value4,value:a.value5})(e(a.value6)));if(l instanceof h.LT)return e(new T(a.value0,a.value1,a.value2,a.value3));throw new Error("Failed pattern match at Data.Map.Internal (line 246, column 45 - line 249, column 36): "+[l.constructor.name])}throw new Error("Failed pattern match at Data.Map.Internal (line 241, column 5 - line 241, column 22): "+[a.constructor.name])}}},re=function(e){return function(n){return new a.Eq(function(u){return function(t){return a.eq(a.eqArray(L.eqTuple(e)(n)))(Q(u))(Q(t))}})}},ve=function(e){return function(n){return new d.Ord(function(){return re(e.Eq0())(n.Eq0())},function(u){return function(a){return d.compare(d.ordArray(L.ordTuple(e)(n)))(Q(u))(Q(a))}})}},ie=function(e){return new a.Eq1(function(n){return a.eq(re(e)(n))})},oe=function(e){return new d.Ord1(function(){return ie(e.Eq0())},function(n){return d.compare(ve(e)(n))})},ce=F.value,fe=function(e){return function(n){return t.foldl(n)(function(n){return function(u){return Z(e)(u.value0)(u.value1)(n)}})(ce)}},se=function(e){return function(n){var u=fe(e)(s.foldableList),a=f.filter(L.uncurry(n)),t=j(s.unfoldableList);return function(e){return u(a(t(e)))}}},pe=function(e){return function(n){return se(e)(r.const(n))}},me=function(e){return function(n){return se(e)(function(e){return r.const(n(e))})}},we=function(e){return function(n){return l.foldlWithIndex(n)(function(n){return function(u){return function(a){return Z(e)(n)(a)(u)}}})(ce)}},de=function(e){return function(n){return function(u){return function(a){var t;return(t=j(p.unfoldableList)(u),function(u){return function(a){var l,r=t,v=u,i=!1;function o(u,t,l){if(u instanceof p.Nil)return i=!0,l;if(t instanceof p.Nil)return i=!0,l;if(u instanceof p.Cons&&t instanceof p.Cons){var o=d.compare(e)(u.value0.value0)(t.value0.value0);if(o instanceof h.LT)return r=u.value1,v=t,void(a=l);if(o instanceof h.EQ)return r=u.value1,v=t.value1,void(a=Z(e)(u.value0.value0)(n(u.value0.value1)(t.value0.value1))(l));if(o instanceof h.GT)return r=u,v=t.value1,void(a=l);throw new Error("Failed pattern match at Data.Map.Internal (line 641, column 5 - line 644, column 27): "+[o.constructor.name])}throw new Error("Failed pattern match at Data.Map.Internal (line 638, column 3 - line 638, column 17): "+[u.constructor.name,t.constructor.name,l.constructor.name])}for(;!i;)l=o(r,v,a);return l}})(j(p.unfoldableList)(a))(ce)}}}},he=function(e){return de(e)(r.const)},ye=function(e){return function(n){return function(u){return m.maybe(u)(L.snd)($(e)(n)(u))}}},Ee=function(e){return function(n){return function(u){return t.foldl(p.foldableList)(r.flip(ye(e)))(n)(H(u))}}},Me=function(n){return 1===c.length(c.nub(a.eqInt)(function n(u){if(u instanceof F)return e.pure(p.applicativeList)(0);if(u instanceof T)return v.map(p.functorList)(function(e){return e+1|0})(y.append(p.semigroupList)(n(u.value0))(n(u.value3)));if(u instanceof b)return v.map(p.functorList)(function(e){return e+1|0})(y.append(p.semigroupList)(n(u.value0))(y.append(p.semigroupList)(n(u.value3))(n(u.value6))));throw new Error("Failed pattern match at Data.Map.Internal (line 188, column 3 - line 188, column 36): "+[u.constructor.name])}(n)))},Ie=u.identity(u.categoryFn),Le=new l.FoldableWithIndex(function(){return _},function(e){return function(n){return function(u){return t.foldMap(p.foldableList)(e)(L.uncurry(n))(Ie(j(p.unfoldableList)(u)))}}},function(e){return function(n){return function(u){return t.foldl(p.foldableList)((a=r.flip(e),function(e){return L.uncurry(a(e))}))(n)(Ie(j(p.unfoldableList)(u)));var a}}},function(e){return function(n){return function(u){return t.foldr(p.foldableList)(L.uncurry(e))(n)(Ie(j(p.unfoldableList)(u)))}}}),De=function(e){return function(n){return l.foldrWithIndex(Le)(function(u){return function(a){return function(t){return m.maybe(t)(function(n){return Z(e)(u)(n)(t)})(n(u)(a))}}})(ce)}},Fe=function(e){var n=De(e);return function(e){return n(r.const(e))}},Te=new I.TraversableWithIndex(function(){return Le},function(){return X},function(){return ee},function(u){return function(a){return function(t){if(t instanceof F)return e.pure(u)(F.value);if(t instanceof T)return n.apply(u.Apply0())(n.apply(u.Apply0())(n.apply(u.Apply0())(v.map(u.Apply0().Functor0())(T.create)(I.traverseWithIndex(Te)(u)(a)(t.value0)))(e.pure(u)(t.value1)))(a(t.value1)(t.value2)))(I.traverseWithIndex(Te)(u)(a)(t.value3));if(t instanceof b)return n.apply(u.Apply0())(n.apply(u.Apply0())(n.apply(u.Apply0())(n.apply(u.Apply0())(n.apply(u.Apply0())(n.apply(u.Apply0())(v.map(u.Apply0().Functor0())(b.create)(I.traverseWithIndex(Te)(u)(a)(t.value0)))(e.pure(u)(t.value1)))(a(t.value1)(t.value2)))(I.traverseWithIndex(Te)(u)(a)(t.value3)))(e.pure(u)(t.value4)))(a(t.value4)(t.value5)))(I.traverseWithIndex(Te)(u)(a)(t.value6));throw new Error("Failed pattern match at Data.Map.Internal (line 136, column 1 - line 150, column 40): "+[a.constructor.name,t.constructor.name])}}}),be=function(e){return function(n){return function(u){return function(a){var t=n(K(e)(u)(a));if(t instanceof m.Nothing)return ye(e)(u)(a);if(t instanceof m.Just)return Z(e)(u)(t.value0)(a);throw new Error("Failed pattern match at Data.Map.Internal (line 549, column 15 - line 551, column 25): "+[t.constructor.name])}}}},ge=function(e){return function(n){return function(u){return t.foldl(n)(function(n){return function(a){return be(e)(function(e){return function(n){if(n instanceof m.Just)return m.Just.create(u(e)(n.value0));if(n instanceof m.Nothing)return new m.Just(e);throw new Error("Failed pattern match at Data.Map.Internal (line 566, column 3 - line 566, column 38): "+[e.constructor.name,n.constructor.name])}}(a.value1))(a.value0)(n)}})(ce)}}},xe=function(e){return function(n){return function(u){return function(a){return be(e)((t=m.maybe(a)(r.flip(n)(a)),function(e){return m.Just.create(t(e))}))(u);var t}}}},Ce=function(e){return function(n){return function(u){return function(a){return t.foldl(p.foldableList)(function(u){return function(a){return be(e)((t=m.maybe(a.value1)(n(a.value1)),function(e){return m.Just.create(t(e))}))(a.value0)(u);var t}})(a)(j(p.unfoldableList)(u))}}}},qe=function(e){return Ce(e)(r.const)},Je=function(e){return new y.Semigroup(qe(e))},Ne=function(e){return new w.Monoid(function(){return Je(e)},ce)},Ae=function(e){return function(n){return function(u){return ne(e)(Ne(e))(n)(u)(W)}}},ke=function(e){return function(n){return t.foldl(n)(qe(e))(ce)}},We=function(e){return function(n){return function(u){return function(a){return be(e)(m.maybe(m.Nothing.value)(n))(u)(a)}}}};module.exports={showTree:S,empty:ce,isEmpty:P,singleton:W,checkValid:Me,insert:Z,insertWith:xe,lookup:K,lookupLE:U,lookupLT:le,lookupGE:z,lookupGT:ae,findMin:ue,findMax:te,foldSubmap:ne,submap:Ae,fromFoldable:fe,fromFoldableWith:ge,fromFoldableWithIndex:we,toUnfoldable:j,toUnfoldableUnordered:G,delete:ye,pop:$,member:B,alter:be,update:We,keys:H,values:A,union:qe,unionWith:Ce,unions:ke,intersection:he,intersectionWith:de,difference:Ee,isSubmap:V,size:k,filterWithKey:se,filterKeys:me,filter:pe,mapMaybeWithKey:De,mapMaybe:Fe,eq1Map:ie,eqMap:re,ord1Map:oe,ordMap:ve,showMap:O,semigroupMap:Je,monoidMap:Ne,functorMap:R,functorWithIndexMap:X,foldableMap:_,foldableWithIndexMap:Le,traversableMap:ee,traversableWithIndexMap:Te}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Category/index.js":"IAi2","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.FoldableWithIndex/index.js":"9Efi","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.FunctorWithIndex/index.js":"OHRN","../Data.HeytingAlgebra/index.js":"paZe","../Data.List/index.js":"ezw6","../Data.List.Lazy/index.js":"sNBV","../Data.List.Lazy.Types/index.js":"EJF+","../Data.List.Types/index.js":"Xxuc","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7","../Data.Traversable/index.js":"n7EE","../Data.TraversableWithIndex/index.js":"V4EF","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z"}],"jHR9":[function(require,module,exports) { +"use strict";var t=require("../Control.Alt/index.js"),e=require("../Control.Alternative/index.js"),n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),a=require("../Control.Bind/index.js"),i=require("../Control.Plus/index.js"),u=require("../Data.Array/index.js"),o=require("../Data.Either/index.js"),l=require("../Data.Foldable/index.js"),c=require("../Data.Function/index.js"),f=require("../Data.Functor/index.js"),s=require("../Data.List/index.js"),m=require("../Data.List.Types/index.js"),p=require("../Data.Map.Internal/index.js"),h=require("../Data.Maybe/index.js"),v=require("../Data.Monoid/index.js"),d=require("../Data.Unit/index.js"),w=function(t,e){this.compact=t,this.separate=e},g=function(e){return function(r){return function(a){return l.foldl(r)(function(r){return function(a){if(a instanceof o.Left)return{left:t.alt(e.Plus1().Alt0())(r.left)(n.pure(e.Applicative0())(a.value0)),right:r.right};if(a instanceof o.Right)return{right:t.alt(e.Plus1().Alt0())(r.right)(n.pure(e.Applicative0())(a.value0)),left:r.left};throw new Error("Failed pattern match at Data.Compactable (line 113, column 14 - line 115, column 54): "+[a.constructor.name])}})({left:i.empty(e.Plus1()),right:i.empty(e.Plus1())})}}},b=function(t){return t.separate},y=function(t){return p.toUnfoldable(m.unfoldableList)},D=new w(a.join(h.bindMaybe),function(t){if(t instanceof h.Nothing)return{left:h.Nothing.value,right:h.Nothing.value};if(t instanceof h.Just){if(t.value0 instanceof o.Left)return{left:new h.Just(t.value0.value0),right:h.Nothing.value};if(t.value0 instanceof o.Right)return{left:h.Nothing.value,right:new h.Just(t.value0.value0)};throw new Error("Failed pattern match at Data.Compactable (line 87, column 23 - line 89, column 48): "+[t.value0.constructor.name])}throw new Error("Failed pattern match at Data.Compactable (line 83, column 1 - line 89, column 48): "+[t.constructor.name])}),L=function(t){return new w((r=l.foldr(m.foldableList)(function(e){return function(n){return p.alter(t)(c.const(e.value1))(e.value0)(n)}})(p.empty),a=y(t),function(t){return r(a(t))}),(e=l.foldr(m.foldableList)(function(e){return function(n){if(e.value1 instanceof o.Left)return{left:p.insert(t)(e.value0)(e.value1.value0)(n.left),right:n.right};if(e.value1 instanceof o.Right)return{left:n.left,right:p.insert(t)(e.value0)(e.value1.value0)(n.right)};throw new Error("Failed pattern match at Data.Compactable (line 124, column 44 - line 126, column 63): "+[e.value1.constructor.name])}})({left:p.empty,right:p.empty}),n=y(t),function(t){return e(n(t))}));var e,n,r,a},j=new w(s.catMaybes,function(t){return g(m.alternativeList)(m.foldableList)(j)(t)}),x=function(t){return new w(function(e){if(e instanceof o.Left)return new o.Left(e.value0);if(e instanceof o.Right){if(e.value0 instanceof h.Just)return new o.Right(e.value0.value0);if(e.value0 instanceof h.Nothing)return new o.Left(v.mempty(t));throw new Error("Failed pattern match at Data.Compactable (line 93, column 23 - line 95, column 27): "+[e.value0.constructor.name])}throw new Error("Failed pattern match at Data.Compactable (line 91, column 1 - line 100, column 53): "+[e.constructor.name])},function(e){if(e instanceof o.Left)return{left:new o.Left(e.value0),right:new o.Left(e.value0)};if(e instanceof o.Right){if(e.value0 instanceof o.Left)return{left:new o.Right(e.value0.value0),right:new o.Left(v.mempty(t))};if(e.value0 instanceof o.Right)return{left:new o.Left(v.mempty(t)),right:new o.Right(e.value0.value0)};throw new Error("Failed pattern match at Data.Compactable (line 98, column 24 - line 100, column 53): "+[e.value0.constructor.name])}throw new Error("Failed pattern match at Data.Compactable (line 91, column 1 - line 100, column 53): "+[e.constructor.name])})},q=new w(u.catMaybes,function(t){return g(e.alternativeArray)(l.foldableArray)(q)(t)}),C=function(t){return function(e){var n=b(e),r=f.map(t)(o.note(d.unit));return function(t){return n(r(t)).right}}},E=function(t){return t.compact},A=function(t){return function(e){return function(n){return{left:E(e)(f.map(t)(function(t){return o.hush(function(t){if(t instanceof o.Left)return new o.Right(t.value0);if(t instanceof o.Right)return new o.Left(t.value0);throw new Error("Failed pattern match at Data.Compactable (line 79, column 20 - line 81, column 24): "+[t.constructor.name])}(t))})(n)),right:E(e)(f.map(t)(o.hush)(n))}}}},F=function(t){return function(e){return function(n){var r=E(e),i=a.bind(t)(n);return function(t){return r(i(t))}}}},R=function(t){return function(e){return function(n){var r=b(e),i=a.bind(t)(n);return function(t){return r(i(t))}}}},M=function(t){return function(e){return function(n){var a=E(e),i=r.apply(t)(n);return function(t){return a(i(t))}}}},N=function(t){return function(e){return function(n){var a=b(e),i=r.apply(t)(n);return function(t){return a(i(t))}}}};module.exports={Compactable:w,compact:E,separate:b,compactDefault:C,separateDefault:A,applyMaybe:M,applyEither:N,bindMaybe:F,bindEither:R,compactableMaybe:D,compactableEither:x,compactableArray:q,compactableList:j,compactableMap:L}; +},{"../Control.Alt/index.js":"lN+m","../Control.Alternative/index.js":"aHia","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Plus/index.js":"oMBg","../Data.Array/index.js":"4t4C","../Data.Either/index.js":"B2JL","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.List/index.js":"ezw6","../Data.List.Types/index.js":"Xxuc","../Data.Map.Internal/index.js":"RRDs","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Unit/index.js":"NhVk"}],"6hfS":[function(require,module,exports) { +"use strict";var t=require("../Control.Bind/index.js"),n=require("../Data.Array/index.js"),e=require("../Data.Compactable/index.js"),r=require("../Data.Either/index.js"),i=require("../Data.Foldable/index.js"),u=require("../Data.Function/index.js"),a=require("../Data.Functor/index.js"),o=require("../Data.HeytingAlgebra/index.js"),l=require("../Data.List/index.js"),f=require("../Data.List.Types/index.js"),c=require("../Data.Map.Internal/index.js"),s=require("../Data.Maybe/index.js"),h=require("../Data.Monoid/index.js"),m=require("../Data.Semigroup/index.js"),p=function(t,n,e,r,i,u){this.Compactable0=t,this.Functor1=n,this.filter=e,this.filterMap=r,this.partition=i,this.partitionMap=u},g=function(t){return function(n){var r=e.separate(t.Compactable0()),i=a.map(t.Functor1())(n);return function(t){return r(i(t))}}},b=function(t){return t.partitionMap},d=function(t){return t.partition},v=function(t){return function(n){return t(n)?new s.Just(n):s.Nothing.value}},w=new p(function(){return e.compactableList},function(){return f.functorList},l.filter,function(t){return l.mapMaybe(t)},function(t){return function(n){return i.foldr(f.foldableList)(function(n){return function(e){return t(n)?{no:e.no,yes:new f.Cons(n,e.yes)}:{no:new f.Cons(n,e.no),yes:e.yes}}})({no:f.Nil.value,yes:f.Nil.value})(n)}},function(t){return function(n){return i.foldr(f.foldableList)(function(n){return function(e){var i=t(n);if(i instanceof r.Left)return{left:new f.Cons(i.value0,e.left),right:e.right};if(i instanceof r.Right)return{left:e.left,right:new f.Cons(i.value0,e.right)};throw new Error("Failed pattern match at Data.Filterable (line 190, column 36 - line 192, column 83): "+[i.constructor.name])}})({left:f.Nil.value,right:f.Nil.value})(n)}}),y=new p(function(){return e.compactableArray},function(){return a.functorArray},n.filter,n.mapMaybe,n.partition,function(t){return i.foldl(i.foldableArray)(function(n){return function(e){var i=t(e);if(i instanceof r.Left)return{left:m.append(m.semigroupArray)(n.left)([i.value0]),right:n.right};if(i instanceof r.Right)return{right:m.append(m.semigroupArray)(n.right)([i.value0]),left:n.left};throw new Error("Failed pattern match at Data.Filterable (line 149, column 16 - line 151, column 50): "+[i.constructor.name])}})({left:[],right:[]})}),D=function(t){return function(n){var r=e.compact(t.Compactable0()),i=a.map(t.Functor1())(n);return function(t){return r(i(t))}}},F=function(t){return t.filterMap},L=function(t){return function(n){return function(e){return{yes:F(t)(v(n))(e),no:F(t)(v(o.not(o.heytingAlgebraFunction(o.heytingAlgebraBoolean))(n)))(e)}}}},M=function(t){return function(n){return function(e){return d(t)(n)(e).yes}}},x=function(t){var n=F(t);return function(t){return n(v(t))}},j=function(t){return t.filter},q=function(t){return function(n){return function(e){return{yes:j(t)(n)(e),no:j(t)(o.not(o.heytingAlgebraFunction(o.heytingAlgebraBoolean))(n))(e)}}}},E=function(t){return function(n){return t(n)?new r.Right(n):new r.Left(n)}},A=function(t){return function(n){return function(e){return b(t)(E(n))(e).right}}},N=function(t){return function(n){return function(e){var r=b(t)(E(n))(e);return{no:r.left,yes:r.right}}}},R=function t(n){return new p(function(){return e.compactableEither(n)},function(){return r.functorEither},function(e){return x(t(n))(e)},function(t){return function(e){if(e instanceof r.Left)return new r.Left(e.value0);if(e instanceof r.Right){var i=t(e.value0);if(i instanceof s.Nothing)return new r.Left(h.mempty(n));if(i instanceof s.Just)return new r.Right(i.value0);throw new Error("Failed pattern match at Data.Filterable (line 180, column 27 - line 182, column 22): "+[i.constructor.name])}throw new Error("Failed pattern match at Data.Filterable (line 171, column 1 - line 184, column 29): "+[t.constructor.name,e.constructor.name])}},function(e){return N(t(n))(e)},function(t){return function(e){if(e instanceof r.Left)return{left:new r.Left(e.value0),right:new r.Left(e.value0)};if(e instanceof r.Right){var i=t(e.value0);if(i instanceof r.Left)return{left:new r.Right(i.value0),right:new r.Left(h.mempty(n))};if(i instanceof r.Right)return{left:new r.Left(h.mempty(n)),right:new r.Right(i.value0)};throw new Error("Failed pattern match at Data.Filterable (line 173, column 30 - line 175, column 53): "+[i.constructor.name])}throw new Error("Failed pattern match at Data.Filterable (line 171, column 1 - line 184, column 29): "+[t.constructor.name,e.constructor.name])}})},C=function t(n){return new p(function(){return e.compactableMap(n)},function(){return c.functorMap},function(e){return x(t(n))(e)},function(t){return function(e){var r=c.toUnfoldable(f.unfoldableList);return i.foldr(f.foldableList)(function(e){return function(r){return c.alter(n)(u.const(t(e.value1)))(e.value0)(r)}})(c.empty)(r(e))}},function(e){return N(t(n))(e)},function(t){return function(e){var u=c.toUnfoldable(f.unfoldableList);return i.foldr(f.foldableList)(function(e){return function(i){var u=t(e.value1);if(u instanceof r.Left)return{left:c.insert(n)(e.value0)(u.value0)(i.left),right:i.right};if(u instanceof r.Right)return{left:i.left,right:c.insert(n)(e.value0)(u.value0)(i.right)};throw new Error("Failed pattern match at Data.Filterable (line 215, column 44 - line 217, column 57): "+[u.constructor.name])}})({left:c.empty,right:c.empty})(u(e))}})},B=new p(function(){return e.compactableMaybe},function(){return s.functorMaybe},function(t){return x(B)(t)},t.bindFlipped(s.bindMaybe),function(t){return N(B)(t)},function(t){return function(n){if(n instanceof s.Nothing)return{left:s.Nothing.value,right:s.Nothing.value};if(n instanceof s.Just){var e=t(n.value0);if(e instanceof r.Left)return{left:new s.Just(e.value0),right:s.Nothing.value};if(e instanceof r.Right)return{left:s.Nothing.value,right:new s.Just(e.value0)};throw new Error("Failed pattern match at Data.Filterable (line 161, column 29 - line 163, column 48): "+[e.constructor.name])}throw new Error("Failed pattern match at Data.Filterable (line 159, column 1 - line 169, column 29): "+[t.constructor.name,n.constructor.name])}}),J=function(t){return F(t)(u.const(s.Nothing.value))};module.exports={Filterable:p,partitionMap:b,partition:d,filterMap:F,filter:j,eitherBool:E,partitionDefault:N,partitionDefaultFilter:q,partitionDefaultFilterMap:L,partitionMapDefault:g,maybeBool:v,filterDefault:x,filterDefaultPartition:M,filterDefaultPartitionMap:A,filterMapDefault:D,cleared:J,filterableArray:y,filterableMaybe:B,filterableEither:R,filterableList:w,filterableMap:C}; +},{"../Control.Bind/index.js":"7VcT","../Data.Array/index.js":"4t4C","../Data.Compactable/index.js":"jHR9","../Data.Either/index.js":"B2JL","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.HeytingAlgebra/index.js":"paZe","../Data.List/index.js":"ezw6","../Data.List.Types/index.js":"Xxuc","../Data.Map.Internal/index.js":"RRDs","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Semigroup/index.js":"EsAJ"}],"AuzG":[function(require,module,exports) { +"use strict";var n=require("../Data.Maybe/index.js"),t=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}(),e=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}(),r=function(){function n(n,t){this.value0=n,this.value1=t}return n.create=function(t){return function(e){return new n(t,e)}},n}(),u=function(){function n(){}return n.value=new n,n}(),o=function(n){return n},i=function(n){return n},c=function(n,t){this.from=n,this.to=t},a=function(n){return n.to},f=new c(function(r){if(r instanceof n.Nothing)return new t(u.value);if(r instanceof n.Just)return new e(r.value0);throw new Error("Failed pattern match at Data.Generic.Rep (line 40, column 1 - line 47, column 49): "+[r.constructor.name])},function(r){if(r instanceof t)return n.Nothing.value;if(r instanceof e)return new n.Just(r.value0);throw new Error("Failed pattern match at Data.Generic.Rep (line 40, column 1 - line 47, column 49): "+[r.constructor.name])}),l=function(n){return n.from};module.exports={Generic:c,to:a,from:l,NoArguments:u,Inl:t,Inr:e,Product:r,Constructor:o,Argument:i,genericMaybe:f}; +},{"../Data.Maybe/index.js":"5mN7"}],"lpst":[function(require,module,exports) { +"use strict";var n=require("../Data.Foldable/index.js"),e=require("../Data.Generic.Rep/index.js"),r=require("../Data.Monoid/index.js"),t=require("../Data.Semigroup/index.js"),o=require("../Data.Show/index.js"),i=require("../Data.Symbol/index.js"),u=function(n){this.genericShowArgs=n},c=function(n){this["genericShow'"]=n},a=new u(function(n){return[]}),s=function(n){return new u(function(e){return[o.show(n)(e)]})},f=function(n){return n.genericShowArgs},g=function(n){return function(e){return new u(function(r){return t.append(t.semigroupArray)(f(n)(r.value0))(f(e)(r.value1))})}},w=function(e){return function(o){return new c(function(u){var c=i.reflectSymbol(o)(i.SProxy.value),a=f(e)(u);return 0===a.length?c:"("+n.intercalate(n.foldableArray)(r.monoidString)(" ")(t.append(t.semigroupArray)([c])(a))+")"})}},h=function(n){return n["genericShow'"]},S=new c(function(n){return h(S)(n)}),l=function(n){return function(r){return new c(function(t){if(t instanceof e.Inl)return h(n)(t.value0);if(t instanceof e.Inr)return h(r)(t.value0);throw new Error("Failed pattern match at Data.Generic.Rep.Show (line 26, column 1 - line 28, column 40): "+[t.constructor.name])})}},d=function(n){return function(r){return function(t){return h(r)(e.from(n)(t))}}};module.exports={GenericShow:c,"genericShow'":h,genericShow:d,GenericShowArgs:u,genericShowArgs:f,genericShowNoConstructors:S,genericShowArgsNoArguments:a,genericShowSum:l,genericShowArgsProduct:g,genericShowConstructor:w,genericShowArgsArgument:s}; +},{"../Data.Foldable/index.js":"eVDl","../Data.Generic.Rep/index.js":"AuzG","../Data.Monoid/index.js":"TiEB","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7","../Data.Symbol/index.js":"4oJQ"}],"u1pL":[function(require,module,exports) { +"use strict";var n=require("../Data.Tuple/index.js"),t=require("../Data.Unit/index.js"),u=function(n,t){this.Monad0=n,this.state=t},e=function(n){return n.state},r=function(u){return function(r){return e(u)(function(u){return new n.Tuple(t.unit,r)})}},i=function(u){return function(r){return e(u)(function(u){return new n.Tuple(t.unit,r(u))})}},o=function(t){return function(u){return e(t)(function(t){var e=u(t);return new n.Tuple(e,e)})}},f=function(t){return function(u){return e(t)(function(t){return new n.Tuple(u(t),t)})}},c=function(t){return e(t)(function(t){return new n.Tuple(t,t)})};module.exports={state:e,MonadState:u,get:c,gets:f,put:r,modify:o,modify_:i}; +},{"../Data.Tuple/index.js":"II/O","../Data.Unit/index.js":"NhVk"}],"89+t":[function(require,module,exports) { +"use strict";var n=require("../Data.Functor/index.js"),r=require("../Data.Void/index.js"),t=function(n){this.cmap=n},u=function(n){return n.cmap},e=function(n){return function(r){return function(t){return u(n)(t)(r)}}},i=function(t){return function(e){return function(i){return n.map(e)(r.absurd)(u(t)(r.absurd)(i))}}},c=function(n){return function(r){return function(r){return u(n)(r)}}};module.exports={cmap:u,Contravariant:t,cmapFlipped:e,coerce:i,imapC:c}; +},{"../Data.Functor/index.js":"+0AE","../Data.Void/index.js":"bncE"}],"OmNG":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),t=require("../Control.Semigroupoid/index.js"),e=require("../Data.Bifoldable/index.js"),u=require("../Data.Bifunctor/index.js"),i=require("../Data.Bitraversable/index.js"),o=require("../Data.Eq/index.js"),c=require("../Data.Foldable/index.js"),f=require("../Data.FoldableWithIndex/index.js"),a=require("../Data.Functor/index.js"),s=require("../Data.Functor.Contravariant/index.js"),d=require("../Data.Functor.Invariant/index.js"),l=require("../Data.FunctorWithIndex/index.js"),p=require("../Data.Monoid/index.js"),C=require("../Data.Newtype/index.js"),x=require("../Data.Ord/index.js"),q=require("../Data.Semigroup/index.js"),b=require("../Data.Show/index.js"),w=require("../Data.Traversable/index.js"),m=require("../Data.TraversableWithIndex/index.js"),j=function(n){return n},v=function(n){return new b.Show(function(r){return"(Const "+b.show(n)(r)+")"})},D=function(n){return n},h=new t.Semigroupoid(function(n){return function(n){return n}}),g=function(n){return n},F=function(n){return n},y=function(n){return n},I=new C.Newtype(function(n){return n},j),W=function(n){return n},A=function(n){return n},B=new a.Functor(function(n){return function(n){return n}}),S=new l.FunctorWithIndex(function(){return B},function(n){return function(n){return n}}),T=new d.Invariant(d.imapF(B)),E=new c.Foldable(function(n){return function(r){return function(r){return p.mempty(n)}}},function(n){return function(n){return function(r){return n}}},function(n){return function(n){return function(r){return n}}}),N=new f.FoldableWithIndex(function(){return E},function(n){return function(r){return function(r){return p.mempty(n)}}},function(n){return function(n){return function(r){return n}}},function(n){return function(n){return function(r){return n}}}),O=new w.Traversable(function(){return E},function(){return B},function(r){return function(t){return n.pure(r)(t)}},function(r){return function(t){return function(t){return n.pure(r)(t)}}}),R=new m.TraversableWithIndex(function(){return N},function(){return S},function(){return O},function(r){return function(t){return function(t){return n.pure(r)(t)}}}),M=function(n){return n},k=function(n){return n},z=function(n){return new o.Eq1(function(r){return o.eq(k(n))})},G=function(n){return new x.Ord1(function(){return z(n.Eq0())},function(r){return x.compare(y(n))})},H=new s.Contravariant(function(n){return function(n){return n}}),J=function(n){return n},K=function(n){return n},L=function(n){return n},P=new u.Bifunctor(function(n){return function(r){return function(r){return n(r)}}}),Q=new e.Bifoldable(function(n){return function(n){return function(r){return function(r){return n(r)}}}},function(n){return function(r){return function(r){return function(t){return n(r)(t)}}}},function(n){return function(r){return function(r){return function(t){return n(t)(r)}}}}),U=new i.Bitraversable(function(){return Q},function(){return P},function(n){return function(r){return a.map(n.Apply0().Functor0())(j)(r)}},function(n){return function(r){return function(t){return function(t){return a.map(n.Apply0().Functor0())(j)(r(t))}}}}),V=function(n){return new r.Apply(function(){return B},function(r){return function(t){return q.append(n)(r)(t)}})},X=function(r){return new n.Applicative(function(){return V(r.Semigroup0())},function(n){return p.mempty(r)})};module.exports={Const:j,newtypeConst:I,eqConst:k,eq1Const:z,ordConst:y,ord1Const:G,boundedConst:K,showConst:v,semigroupoidConst:h,semigroupConst:g,monoidConst:W,semiringConst:D,ringConst:F,euclideanRingConst:M,commutativeRingConst:J,heytingAlgebraConst:A,booleanAlgebraConst:L,functorConst:B,bifunctorConst:P,functorWithIndexConst:S,invariantConst:T,contravariantConst:H,applyConst:V,applicativeConst:X,foldableConst:E,foldableWithIndexConst:N,bifoldableConst:Q,traversableConst:O,traversableWithIndexConst:R,bitraversableConst:U}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Semigroupoid/index.js":"/riR","../Data.Bifoldable/index.js":"wjQo","../Data.Bifunctor/index.js":"e2Wc","../Data.Bitraversable/index.js":"8nb9","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.FoldableWithIndex/index.js":"9Efi","../Data.Functor/index.js":"+0AE","../Data.Functor.Contravariant/index.js":"89+t","../Data.Functor.Invariant/index.js":"AXkC","../Data.FunctorWithIndex/index.js":"OHRN","../Data.Monoid/index.js":"TiEB","../Data.Newtype/index.js":"lz8k","../Data.Ord/index.js":"r4Vb","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7","../Data.Traversable/index.js":"n7EE","../Data.TraversableWithIndex/index.js":"V4EF"}],"0DaD":[function(require,module,exports) { +"use strict";var n=require("../Control.Category/index.js"),r=require("../Data.Newtype/index.js"),t=function(n){this.dimap=n},u=new t(function(n){return function(r){return function(t){return function(u){return r(t(n(u)))}}}}),e=function(n){return n.dimap},i=function(r){return function(t){return e(r)(t)(n.identity(n.categoryFn))}},o=function(r){return function(t){return e(r)(n.identity(n.categoryFn))(t)}},c=function(n){return function(t){return e(n)(r.wrap(t))(r.unwrap(t))}},f=function(n){return function(t){return function(u){return e(n)(r.unwrap(t))(r.wrap(t))}}},a=function(r){return function(t){return function(u){return o(t)(u)(n.identity(r))}}};module.exports={dimap:e,Profunctor:t,lcmap:i,rmap:o,arr:a,unwrapIso:c,wrapIso:f,profunctorFn:u}; +},{"../Control.Category/index.js":"IAi2","../Data.Newtype/index.js":"lz8k"}],"nkqb":[function(require,module,exports) { +"use strict";var t=require("../Control.Category/index.js"),n=require("../Control.Semigroupoid/index.js"),r=require("../Data.Either/index.js"),e=require("../Data.Functor/index.js"),i=require("../Data.Profunctor/index.js"),o=function(t,n,r){this.Profunctor0=t,this.left=n,this.right=r},u=function(t){return t.right},c=function(t){return t.left},f=function(t){return function(r){return function(e){return function(i){return n.composeFlipped(t.Semigroupoid0())(c(r)(e))(u(r)(i))}}}},a=function(e){return function(o){return function(u){return function(c){var a=i.dimap(o.Profunctor0())(r.either(t.identity(t.categoryFn))(t.identity(t.categoryFn)))(t.identity(t.categoryFn))(t.identity(e));return n.composeFlipped(e.Semigroupoid0())(f(e)(o)(u)(c))(a)}}}},s=new o(function(){return i.profunctorFn},function(t){return function(n){if(n instanceof r.Left)return r.Left.create(t(n.value0));if(n instanceof r.Right)return new r.Right(n.value0);throw new Error("Failed pattern match at Data.Profunctor.Choice (line 32, column 1 - line 35, column 16): "+[t.constructor.name,n.constructor.name])}},e.map(r.functorEither));module.exports={left:c,right:u,Choice:o,splitChoice:f,fanin:a,choiceFn:s}; +},{"../Control.Category/index.js":"IAi2","../Control.Semigroupoid/index.js":"/riR","../Data.Either/index.js":"B2JL","../Data.Functor/index.js":"+0AE","../Data.Profunctor/index.js":"0DaD"}],"af4y":[function(require,module,exports) { +"use strict";var o=require("../Control.Semigroupoid/index.js"),e=require("../Data.Profunctor/index.js"),r=function(o,e){this.Profunctor0=o,this.closed=e},n=new r(function(){return e.profunctorFn},o.compose(o.semigroupoidFn)),t=function(o){return o.closed};module.exports={closed:t,Closed:r,closedFunction:n}; +},{"../Control.Semigroupoid/index.js":"/riR","../Data.Profunctor/index.js":"0DaD"}],"w9p6":[function(require,module,exports) { +"use strict";var n=require("../Control.Category/index.js"),r=require("../Control.Semigroupoid/index.js"),t=require("../Data.Functor/index.js"),e=require("../Data.Profunctor/index.js"),u=require("../Data.Tuple/index.js"),o=function(n,r,t){this.Profunctor0=n,this.first=r,this.second=t},i=new o(function(){return e.profunctorFn},function(n){return function(r){return new u.Tuple(n(r.value0),r.value1)}},t.map(u.functorTuple)),c=function(n){return n.second},f=function(n){return n.first},s=function(n){return function(t){return function(e){return function(u){return r.composeFlipped(n.Semigroupoid0())(f(t)(e))(c(t)(u))}}}},p=function(t){return function(o){return function(i){return function(c){var f=e.dimap(o.Profunctor0())(n.identity(n.categoryFn))(function(n){return new u.Tuple(n,n)})(n.identity(t));return r.composeFlipped(t.Semigroupoid0())(f)(s(t)(o)(i)(c))}}}};module.exports={first:f,second:c,Strong:o,splitStrong:s,fanout:p,strongFn:i}; +},{"../Control.Category/index.js":"IAi2","../Control.Semigroupoid/index.js":"/riR","../Data.Functor/index.js":"+0AE","../Data.Profunctor/index.js":"0DaD","../Data.Tuple/index.js":"II/O"}],"tj5E":[function(require,module,exports) { +"use strict";var n=require("../Control.Alt/index.js"),r=require("../Control.Alternative/index.js"),t=require("../Control.Applicative/index.js"),e=require("../Control.Apply/index.js"),u=require("../Control.Bind/index.js"),i=require("../Control.Category/index.js"),o=require("../Control.Monad/index.js"),c=require("../Control.MonadPlus/index.js"),a=require("../Control.MonadZero/index.js"),f=require("../Control.Plus/index.js"),l=require("../Control.Semigroupoid/index.js"),p=require("../Data.Distributive/index.js"),d=require("../Data.Either/index.js"),s=require("../Data.Functor/index.js"),v=require("../Data.Functor.Invariant/index.js"),S=require("../Data.Newtype/index.js"),w=require("../Data.Profunctor/index.js"),x=require("../Data.Profunctor.Choice/index.js"),j=require("../Data.Profunctor.Closed/index.js"),q=require("../Data.Profunctor.Strong/index.js"),A=require("../Data.Tuple/index.js"),C=function(n){return n},m=function(n){return new l.Semigroupoid(function(r){return function(t){return function(e){return u.bind(n)(t(e))(r)}}})},y=function(n){return new w.Profunctor(function(r){return function(t){return function(e){var u=s.map(n)(t);return function(n){return u(e(r(n)))}}}})},D=function(n){return new q.Strong(function(){return y(n)},function(r){return function(t){return s.map(n)(function(n){return new A.Tuple(n,t.value1)})(r(t.value0))}},function(r){return function(t){return s.map(n)(A.Tuple.create(t.value0))(r(t.value1))}})},g=new S.Newtype(function(n){return n},C),F=function(n){return new v.Invariant(function(r){return function(t){return function(e){var u=v.imap(n)(r)(t);return function(n){return u(e(n))}}}})},P=function(n){return function(r){return function(t){return n(r(t))}}},h=function(n){return new s.Functor(function(r){return function(t){var e=s.map(n)(r);return function(n){return e(t(n))}}})},b=function n(r){return new p.Distributive(function(){return h(r.Functor0())},function(t){return function(e){var u=p.distribute(n(r))(t),i=s.map(t)(e);return function(n){return u(i(n))}}},function(n){return function(t){return function(e){return p.collect(r)(n)(function(n){return n(e)})(t)}}})},M=function(n){return new j.Closed(function(){return y(n.Functor0())},function(r){return function(t){return p.distribute(n)(s.functorFn)(function(n){return r(t(n))})}})},B=function(n){return new x.Choice(function(){return y(n.Apply0().Functor0())},function(r){return C(d.either((u=s.map(n.Apply0().Functor0())(d.Left.create),function(n){return u(r(n))}))((e=t.pure(n),function(n){return e(d.Right.create(n))})));var e,u},function(r){return C(d.either((u=t.pure(n),function(n){return u(d.Left.create(n))}))((e=s.map(n.Apply0().Functor0())(d.Right.create),function(n){return e(r(n))})));var e,u})},Z=function(n){return new i.Category(function(){return m(n.Bind1())},t.pure(n.Applicative0()))},T=function(n){return new e.Apply(function(){return h(n.Functor0())},function(r){return function(t){return function(u){return e.apply(n)(r(u))(t(u))}}})},I=function(n){return new u.Bind(function(){return T(n.Apply0())},function(r){return function(t){return function(e){return u.bind(n)(r(e))(function(n){return t(n)(e)})}}})},L=function(n){return new t.Applicative(function(){return T(n.Apply0())},function(r){return function(e){return t.pure(n)(r)}})},N=function(n){return new o.Monad(function(){return L(n.Applicative0())},function(){return I(n.Bind1())})},R=function(r){return new n.Alt(function(){return h(r.Functor0())},function(t){return function(e){return function(u){return n.alt(r)(t(u))(e(u))}}})},E=function(n){return new f.Plus(function(){return R(n.Alt0())},function(r){return f.empty(n)})},k=function(n){return new r.Alternative(function(){return L(n.Applicative0())},function(){return E(n.Plus1())})},z=function(n){return new a.MonadZero(function(){return k(n.Alternative1())},function(){return N(n.Monad0())})},G=function(n){return new c.MonadPlus(function(){return z(n.MonadZero0())})};module.exports={Star:C,hoistStar:P,newtypeStar:g,semigroupoidStar:m,categoryStar:Z,functorStar:h,invariantStar:F,applyStar:T,applicativeStar:L,bindStar:I,monadStar:N,altStar:R,plusStar:E,alternativeStar:k,monadZeroStar:z,monadPlusStar:G,distributiveStar:b,profunctorStar:y,strongStar:D,choiceStar:B,closedStar:M}; +},{"../Control.Alt/index.js":"lN+m","../Control.Alternative/index.js":"aHia","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Control.Monad/index.js":"U/Ix","../Control.MonadPlus/index.js":"HkJx","../Control.MonadZero/index.js":"lD5R","../Control.Plus/index.js":"oMBg","../Control.Semigroupoid/index.js":"/riR","../Data.Distributive/index.js":"8PTu","../Data.Either/index.js":"B2JL","../Data.Functor/index.js":"+0AE","../Data.Functor.Invariant/index.js":"AXkC","../Data.Newtype/index.js":"lz8k","../Data.Profunctor/index.js":"0DaD","../Data.Profunctor.Choice/index.js":"nkqb","../Data.Profunctor.Closed/index.js":"af4y","../Data.Profunctor.Strong/index.js":"w9p6","../Data.Tuple/index.js":"II/O"}],"i7fd":[function(require,module,exports) { +"use strict";var n=require("../Data.Functor/index.js"),t=require("../Data.Identity/index.js"),r=require("../Data.Newtype/index.js"),e=require("../Data.Profunctor.Choice/index.js"),i=require("../Data.Profunctor.Star/index.js"),u=require("../Data.Profunctor.Strong/index.js"),o=function(n,t,r){this.Choice1=n,this.Strong0=t,this.wander=r},a=function(n){return new o(function(){return i.choiceStar(n)},function(){return i.strongStar(n.Apply0().Functor0())},function(t){return function(r){return t(n)(r)}})},c=new o(function(){return e.choiceFn},function(){return u.strongFn},function(e){return r.alaF(n.functorFn)(n.functorFn)(t.newtypeIdentity)(t.newtypeIdentity)(t.Identity)(e(t.applicativeIdentity))}),d=function(n){return n.wander};module.exports={wander:d,Wander:o,wanderFunction:c,wanderStar:a}; +},{"../Data.Functor/index.js":"+0AE","../Data.Identity/index.js":"2OKT","../Data.Newtype/index.js":"lz8k","../Data.Profunctor.Choice/index.js":"nkqb","../Data.Profunctor.Star/index.js":"tj5E","../Data.Profunctor.Strong/index.js":"w9p6"}],"FnLc":[function(require,module,exports) { +"use strict";var t=function(t,n,u){this.Profunctor0=t,this.unleft=n,this.unright=u},n=function(t){return t.unright},u=function(t){return t.unleft};module.exports={unleft:u,unright:n,Cochoice:t}; +},{}],"mj9z":[function(require,module,exports) { +"use strict";var n=require("../Data.Const/index.js"),r=require("../Data.Either/index.js"),e=require("../Data.Functor/index.js"),t=require("../Data.Lens.Internal.Wander/index.js"),o=require("../Data.Monoid/index.js"),u=require("../Data.Newtype/index.js"),i=require("../Data.Profunctor/index.js"),c=require("../Data.Profunctor.Choice/index.js"),f=require("../Data.Profunctor.Cochoice/index.js"),a=require("../Data.Profunctor.Strong/index.js"),s=require("../Data.Semigroup/index.js"),d=require("../Data.Tuple/index.js"),F=function(n){return n},g=function(n){return s.semigroupFn(n)},p=new i.Profunctor(function(n){return function(r){return function(r){return function(e){return r(n(e))}}}}),x=new a.Strong(function(){return p},function(n){return function(r){return n(d.fst(r))}},function(n){return function(r){return n(d.snd(r))}}),j=new u.Newtype(function(n){return n},F),m=function(n){return o.monoidFn(n)},q=new f.Cochoice(function(){return p},function(n){return function(e){return n(r.Left.create(e))}},function(n){return function(e){return n(r.Right.create(e))}}),w=function(n){return new c.Choice(function(){return p},function(e){return r.either(e)(o.mempty(o.monoidFn(n)))},function(e){return r.either(o.mempty(o.monoidFn(n)))(e)})},D=function(r){return new t.Wander(function(){return w(r)},function(){return x},function(t){return function(o){return u.alaF(e.functorFn)(e.functorFn)(n.newtypeConst)(n.newtypeConst)(n.Const)(t(n.applicativeConst(r)))(o)}})};module.exports={Forget:F,newtypeForget:j,semigroupForget:g,monoidForget:m,profunctorForget:p,choiceForget:w,strongForget:x,cochoiceForget:q,wanderForget:D}; +},{"../Data.Const/index.js":"OmNG","../Data.Either/index.js":"B2JL","../Data.Functor/index.js":"+0AE","../Data.Lens.Internal.Wander/index.js":"i7fd","../Data.Monoid/index.js":"TiEB","../Data.Newtype/index.js":"lz8k","../Data.Profunctor/index.js":"0DaD","../Data.Profunctor.Choice/index.js":"nkqb","../Data.Profunctor.Cochoice/index.js":"FnLc","../Data.Profunctor.Strong/index.js":"w9p6","../Data.Semigroup/index.js":"EsAJ","../Data.Tuple/index.js":"II/O"}],"V4/H":[function(require,module,exports) { +"use strict";var e=require("../Data.Either/index.js"),n=require("../Data.Lens.Internal.Wander/index.js"),r=require("../Data.Newtype/index.js"),t=require("../Data.Profunctor/index.js"),u=require("../Data.Profunctor.Choice/index.js"),o=require("../Data.Profunctor.Strong/index.js"),c=require("../Data.Tuple/index.js"),i=function(e){return e},a=function(e){return new t.Profunctor(function(n){return function(r){return function(u){return t.dimap(e)(o.second(o.strongFn)(n))(r)(u)}}})},f=function(e){return new o.Strong(function(){return a(e.Profunctor0())},function(n){return i(t.lcmap(e.Profunctor0())(function(e){return new c.Tuple(new c.Tuple(e.value0,e.value1.value0),e.value1.value1)})(o.first(e)(n)))},function(n){return i(t.lcmap(e.Profunctor0())(function(e){return new c.Tuple(e.value1.value0,new c.Tuple(e.value0,e.value1.value1))})(o.second(e)(n)))})},l=new r.Newtype(function(e){return e},i),d=function(n){return new u.Choice(function(){return a(n.Profunctor0())},function(r){return i(t.lcmap(n.Profunctor0())(function(n){return e.either((r=c.Tuple.create(n.value0),function(n){return e.Left.create(r(n))}))(e.Right.create)(n.value1);var r})(u.left(n)(r)))},function(r){return i(t.lcmap(n.Profunctor0())(function(n){return e.either(e.Left.create)((r=c.Tuple.create(n.value0),function(n){return e.Right.create(r(n))}))(n.value1);var r})(u.right(n)(r)))})},v=function(e){return new n.Wander(function(){return d(e.Choice1())},function(){return f(e.Strong0())},function(r){return function(t){return i(n.wander(e)(function(e){return function(n){return function(t){return r(e)((u=c.Tuple.create(t.value0),function(e){return n(u(e))}))(t.value1);var u}}})(t))}})};module.exports={Indexed:i,newtypeIndexed:l,profunctorIndexed:a,strongIndexed:f,choiceIndexed:d,wanderIndexed:v}; +},{"../Data.Either/index.js":"B2JL","../Data.Lens.Internal.Wander/index.js":"i7fd","../Data.Newtype/index.js":"lz8k","../Data.Profunctor/index.js":"0DaD","../Data.Profunctor.Choice/index.js":"nkqb","../Data.Profunctor.Strong/index.js":"w9p6","../Data.Tuple/index.js":"II/O"}],"OPOX":[function(require,module,exports) { +"use strict";var n=require("../Control.Category/index.js"),e=require("../Control.Monad.State.Class/index.js"),t=require("../Data.Lens.Internal.Forget/index.js"),r=require("../Data.Lens.Internal.Indexed/index.js"),u=require("../Data.Newtype/index.js"),o=require("../Data.Profunctor.Strong/index.js"),i=function(e){return u.unwrap(t.newtypeForget)(e(n.identity(n.categoryFn)))},a=function(n){return function(e){return i(e)(n)}},c=function(n){return function(t){return e.gets(n)(function(n){return a(n)(t)})}},s=function(n){return function(e){var r=u.unwrap(t.newtypeForget)(e);return function(e){return r(n(e))}}},f=function(e){return function(t){return s(o.fanout(n.categoryFn)(o.strongFn)(i(e))(i(t)))}},d=function(e){return u.unwrap(t.newtypeForget)(e(r.Indexed(n.identity(n.categoryFn))))},g=function(n){return function(t){return e.gets(n)(d(t))}},w=function(n){return s(i(n))};module.exports={viewOn:a,view:i,to:s,takeBoth:f,use:c,iview:d,iuse:g,cloneGetter:w}; +},{"../Control.Category/index.js":"IAi2","../Control.Monad.State.Class/index.js":"u1pL","../Data.Lens.Internal.Forget/index.js":"mj9z","../Data.Lens.Internal.Indexed/index.js":"V4/H","../Data.Newtype/index.js":"lz8k","../Data.Profunctor.Strong/index.js":"w9p6"}],"eUa0":[function(require,module,exports) { +"use strict";var n=require("../Data.Functor/index.js"),r=require("../Data.Profunctor/index.js"),u=function(){function n(n,r){this.value0=n,this.value1=r}return n.create=function(r){return function(u){return new n(r,u)}},n}(),t=new r.Profunctor(function(n){return function(r){return function(t){return new u(function(r){return t.value0(n(r))},function(n){return r(t.value1(n))})}}}),e=new n.Functor(function(n){return function(r){return new u(r.value0,function(u){return n(r.value1(u))})}});module.exports={Exchange:u,functorExchange:e,profunctorExchange:t}; +},{"../Data.Functor/index.js":"+0AE","../Data.Profunctor/index.js":"0DaD"}],"NfU6":[function(require,module,exports) { +"use strict";var n=function(n,t,u){this.Profunctor0=n,this.unfirst=t,this.unsecond=u},t=function(n){return n.unsecond},u=function(n){return n.unfirst};module.exports={unfirst:u,unsecond:t,Costrong:n}; +},{}],"IZDD":[function(require,module,exports) { +"use strict";var n=require("../Data.Newtype/index.js"),r=require("../Data.Profunctor/index.js"),t=require("../Data.Profunctor.Choice/index.js"),u=require("../Data.Profunctor.Cochoice/index.js"),e=require("../Data.Profunctor.Costrong/index.js"),o=require("../Data.Profunctor.Strong/index.js"),c=function(n){return n},i=function(n){return new r.Profunctor(function(t){return function(u){return function(e){var o=r.dimap(n)(u)(t);return function(n){return e(o(n))}}}})},f=function(n){return new e.Costrong(function(){return i(n.Profunctor0())},function(r){var t=o.first(n);return function(n){return r(t(n))}},function(r){var t=o.second(n);return function(n){return r(t(n))}})},a=new n.Newtype(function(n){return n},c),s=function(n){return new o.Strong(function(){return i(n.Profunctor0())},function(r){var t=e.unfirst(n);return function(n){return r(t(n))}},function(r){var t=e.unsecond(n);return function(n){return r(t(n))}})},d=function(n){return new t.Choice(function(){return i(n.Profunctor0())},function(r){var t=u.unleft(n);return function(n){return r(t(n))}},function(r){var t=u.unright(n);return function(n){return r(t(n))}})},v=function(n){return new u.Cochoice(function(){return i(n.Profunctor0())},function(r){var u=t.left(n);return function(n){return r(u(n))}},function(r){var u=t.right(n);return function(n){return r(u(n))}})};module.exports={Re:c,newtypeRe:a,profunctorRe:i,choiceRe:v,cochoiceRe:d,strongRe:f,costrongRe:s}; +},{"../Data.Newtype/index.js":"lz8k","../Data.Profunctor/index.js":"0DaD","../Data.Profunctor.Choice/index.js":"nkqb","../Data.Profunctor.Cochoice/index.js":"FnLc","../Data.Profunctor.Costrong/index.js":"NfU6","../Data.Profunctor.Strong/index.js":"w9p6"}],"fFCp":[function(require,module,exports) { +"use strict";var n=require("../Control.Category/index.js"),r=require("../Data.Boolean/index.js"),t=require("../Data.Eq/index.js"),u=require("../Data.Function/index.js"),e=require("../Data.Functor/index.js"),i=require("../Data.Lens.Internal.Exchange/index.js"),o=require("../Data.Lens.Internal.Re/index.js"),c=require("../Data.Maybe/index.js"),f=require("../Data.Newtype/index.js"),a=require("../Data.Profunctor/index.js"),d=require("../Data.Tuple/index.js"),s=function(r){return function(t){var u=r(new i.Exchange(n.identity(n.categoryFn),n.identity(n.categoryFn)));return t(u.value0)(u.value1)}},p=function(n){return s(n)(function(n){return function(r){return function(t){return function(u){return n(t(r(u)))}}}})},l=function(r){return f.unwrap(o.newtypeRe)(r(n.identity(n.categoryFn)))},y=function(n){return function(r){return function(t){return function(u){return a.dimap(t)(n)(r)(u)}}}},m=function(n){return function(r){return function(t){return function(u){return s(t)(function(t){return function(i){return y(e.map(n)(t))(e.map(r)(i))(u)}})}}}},x=function(n){return function(u){return function(e){return y(c.fromMaybe(u))(function(e){if(t.eq(n)(e)(u))return c.Nothing.value;if(r.otherwise)return new c.Just(e);throw new Error("Failed pattern match at Data.Lens.Iso (line 45, column 9 - line 46, column 33): "+[e.constructor.name])})(e)}}},q=function(n){return y(d.uncurry)(d.curry)(n)},j=function(n){return y(u.flip)(u.flip)(n)},D=function(n){return function(r){return function(t){return function(u){return function(e){return s(t)(function(t){return function(i){return s(u)(function(u){return function(o){return y(a.dimap(n)(t)(u))(a.dimap(r)(i)(o))(e)}})}})}}}}},g=function(n){return y(d.curry)(d.uncurry)(n)},w=function(n){return function(r){return s(n)(function(n){return function(t){return function(u){return y(n)(t)(r)(u)}}})}},h=function(n){return function(r){return s(r)(function(r){return function(t){return function(u){return function(e){return function(i){return t(u(a.rmap(n)(r)(e))(i))}}}}})}},F=function(n){return s(n)(function(n){return function(r){return function(t){return function(u){return n(t(r)(u))}}}})};module.exports={iso:y,withIso:s,cloneIso:w,re:l,au:F,auf:h,under:p,non:x,curried:g,uncurried:q,flipped:j,mapping:m,dimapping:D}; +},{"../Control.Category/index.js":"IAi2","../Data.Boolean/index.js":"ObQr","../Data.Eq/index.js":"Pq4F","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Lens.Internal.Exchange/index.js":"eUa0","../Data.Lens.Internal.Re/index.js":"IZDD","../Data.Maybe/index.js":"5mN7","../Data.Newtype/index.js":"lz8k","../Data.Profunctor/index.js":"0DaD","../Data.Tuple/index.js":"II/O"}],"CiFJ":[function(require,module,exports) { +"use strict";var e=require("../Data.Lens.Iso/index.js"),r=require("../Data.Newtype/index.js"),n=function(n){return function(t){return function(u){return e.iso(r.unwrap(n))(r.wrap(t))(u)}}};module.exports={_Newtype:n}; +},{"../Data.Lens.Iso/index.js":"fFCp","../Data.Newtype/index.js":"lz8k"}],"ONWB":[function(require,module,exports) { +"use strict";var o=function(o,e,t,s,n,i){this.Monad0=o,this.chooseBool=e,this.chooseFloat=t,this.chooseInt=s,this.resize=n,this.sized=i},e=function(o){return o.sized},t=function(o){return o.resize},s=function(o){return o.chooseInt},n=function(o){return o.chooseFloat},i=function(o){return o.chooseBool};module.exports={chooseBool:i,chooseFloat:n,chooseInt:s,resize:t,sized:e,MonadGen:o}; +},{}],"s7H0":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),e=require("../Control.Bind/index.js"),t=require("../Control.Monad.Gen.Class/index.js"),r=require("../Control.Monad.Rec.Class/index.js"),u=require("../Data.Boolean/index.js"),i=require("../Data.Foldable/index.js"),o=require("../Data.Function/index.js"),a=require("../Data.Functor/index.js"),c=require("../Data.Maybe/index.js"),l=require("../Data.Monoid.Additive/index.js"),d=require("../Data.Newtype/index.js"),f=require("../Data.Semigroup/index.js"),s=require("../Data.Semigroup.Foldable/index.js"),p=require("../Data.Semiring/index.js"),v=require("../Data.Tuple/index.js"),m=require("../Data.Unfoldable/index.js"),w=require("../Data.Unit/index.js"),M=function(){function n(n,e){this.value0=n,this.value1=e}return n.create=function(e){return function(t){return new n(e,t)}},n}(),h=function(){function n(){}return n.value=new n,n}(),F=function(n){return n},q=function(n){return n},x=function(i){return function(o){return function(l){return function(d){var f,s,p=function(t){if(t.value1<=0)return n.pure(o.Monad0().Applicative0())(new r.Done(t.value0));if(u.otherwise)return e.bind(o.Monad0().Bind1())(d)(function(e){return n.pure(o.Monad0().Applicative0())(new r.Loop(new v.Tuple(new M(e,t.value0),t.value1-1|0)))});throw new Error("Failed pattern match at Control.Monad.Gen (line 93, column 3 - line 93, column 68): "+[t.constructor.name])};return a.map(o.Monad0().Bind1().Apply0().Functor0())(m.unfoldr(l)(function(n){if(n instanceof h)return c.Nothing.value;if(n instanceof M)return new c.Just(new v.Tuple(n.value0,n.value1));throw new Error("Failed pattern match at Control.Monad.Gen (line 101, column 12 - line 103, column 35): "+[n.constructor.name])}))(t.sized(o)((f=r.tailRecM(i)(p),s=v.Tuple.create(h.value),function(n){return f(s(n))})))}}}},j=new f.Semigroup(function(n){return function(e){return function(t){var r=n(t);return r.value0 instanceof c.Just?e(r.value0.value0):r}}}),D=new f.Semigroup(function(n){return function(e){return function(t){return t<=0?n(t):e(t-1|0)}}}),b=function(n){return function(e){return v.snd(n(e))}},g=function(n){return n},A=function(n){return function(e){return e>=n.value0?new v.Tuple(new c.Just(e-n.value0),n.value1):new v.Tuple(c.Nothing.value,n.value1)}},B=function(n){return function(r){return function(u){var o=d.alaF(a.functorFn)(a.functorFn)(d.newtypeAdditive)(d.newtypeAdditive)(l.Additive)(i.foldMap(r.Foldable0())(l.monoidAdditive(p.semiringNumber)))(v.fst)(u);return e.bind(n.Monad0().Bind1())(t.chooseFloat(n)(0)(o))(b(s.foldMap1(r)(j)(A)(u)))}}},C=function(n){return function(e){return function(t){return r.tailRecM(n)(function(n){return a.mapFlipped(e.Monad0().Bind1().Apply0().Functor0())(t)(function(n){if(n instanceof c.Nothing)return new r.Loop(w.unit);if(n instanceof c.Just)return new r.Done(n.value0);throw new Error("Failed pattern match at Control.Monad.Gen (line 117, column 24 - line 119, column 23): "+[n.constructor.name])})})(w.unit)}}},y=function(n){return function(e){return function(t){return function(r){return C(n)(e)(a.mapFlipped(e.Monad0().Bind1().Apply0().Functor0())(t)(function(n){return r(n)?new c.Just(n):c.Nothing.value}))}}}},T=function(n){return function(r){return function(u){return e.bind(n.Monad0().Bind1())(t.chooseBool(n))(function(n){return n?r:u})}}},N=function(n){return q(o.const(n))},J=function(n){return function(e){return function(t){return g(s.foldMap1(n)(D)(N)(t))(e)}}},S=function(r){return function(u){return function(o){return e.bind(r.Monad0().Bind1())(t.chooseInt(r)(0)(i.length(u.Foldable0())(p.semiringInt)(o)-1|0))(function(e){return n.pure(r.Monad0().Applicative0())(J(u)(e)(o))})}}},G=function(n){return function(r){return function(u){return e.bind(n.Monad0().Bind1())(t.chooseInt(n)(0)(i.length(r.Foldable0())(p.semiringInt)(u)-1|0))(function(n){return J(r)(n)(u)})}}};module.exports={choose:T,oneOf:G,frequency:B,elements:S,unfoldable:x,suchThat:y,filtered:C}; +},{"../Control.Applicative/index.js":"qYya","../Control.Bind/index.js":"7VcT","../Control.Monad.Gen.Class/index.js":"ONWB","../Control.Monad.Rec.Class/index.js":"UVIy","../Data.Boolean/index.js":"ObQr","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Maybe/index.js":"5mN7","../Data.Monoid.Additive/index.js":"fHyj","../Data.Newtype/index.js":"lz8k","../Data.Semigroup/index.js":"EsAJ","../Data.Semigroup.Foldable/index.js":"ht+A","../Data.Semiring/index.js":"11NF","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z","../Data.Unit/index.js":"NhVk"}],"K4TW":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),e=require("../Control.Apply/index.js"),r=require("../Control.Bind/index.js"),t=require("../Control.Monad.Gen/index.js"),i=require("../Control.Monad.Gen.Class/index.js"),u=require("../Data.Either/index.js"),o=require("../Data.Functor/index.js"),a=require("../Data.Identity/index.js"),d=require("../Data.Maybe/index.js"),c=require("../Data.NonEmpty/index.js"),p=require("../Data.Ord/index.js"),l=require("../Data.Tuple/index.js"),f=function(n){return e.lift2(n)(l.Tuple.create)},s=function(n){return function(r){return function(u){return function(a){return e.apply(r.Monad0().Bind1().Apply0())(o.map(r.Monad0().Bind1().Apply0().Functor0())(c.NonEmpty.create)(a))(i.resize(r)((d=p.max(p.ordInt)(0),function(n){return d(n-1|0)}))(t.unfoldable(n)(r)(u)(a)));var d}}}},y=function(e){return function(t){return function(u){return r.bind(e.Monad0().Bind1())(i.chooseFloat(e)(0)(1))(function(r){return r0)return new f.Just(x(n));if(u.otherwise)return f.Nothing.value;throw new Error("Failed pattern match at Data.Array.NonEmpty (line 134, column 1 - line 134, column 58): "+[n.constructor.name])},O=function(n){var r=t.fromFoldable(n);return function(n){return R(r(n))}},S=function(n){return function(r){return t.difference(n)(A(r))}},G=function(n){return function(r){return x(t.cons(n)(r))}},H=function(n){return G(n.value0)(n.value1)},K=o.flip(n.bind(r.bindNonEmptyArray)),P=function(){var n=c.map(r.functorNonEmptyArray)(A);return function(r){return x(t.concat(A(n(r))))}}(),Q=function(n){return function(t){return x(s.append(s.semigroupArray)(A(n))(t))}},V=function(n){return function(r){var e=t.alterAt(n)(r);return function(n){return e(A(n))}}},X=function(n){var t=f.fromJust();return function(r){return t(n(A(r)))}},Y=X(t.head),Z=X(t.init),$=X(t.last),_=X(t.tail),nn=X(t.uncons),tn=function(n){return t=nn(n),new a.NonEmpty(t.head,t.tail);var t},rn=X(t.unsnoc),en=function(n){return function(t){return n(A(t))}},un=en(t.catMaybes),on=function(n){return function(r){return en(t.delete(n)(r))}},cn=function(n){return en(t.deleteAt(n))},fn=function(n){return function(r){return en(t.deleteBy(n)(r))}},an=function(n){return function(t){return en(S(n)(t))}},dn=function(n){return en(t.drop(n))},sn=function(n){return en(t.dropEnd(n))},ln=function(n){return en(t.dropWhile(n))},pn=function(n){return function(r){return en(t.elemIndex(n)(r))}},yn=function(n){return function(r){return en(t.elemLastIndex(n)(r))}},mn=function(n){return en(t.filter(n))},xn=function(n){return function(r){return en(t.filterA(n)(r))}},An=function(n){return en(t.findIndex(n))},bn=function(n){return en(t.findLastIndex(n))},qn=function(n){return function(r){return function(e){return en(t.foldM(n)(r)(e))}}},vn=function(n){return function(r){return function(e){return en(t.foldRecM(n)(r)(e))}}},hn=en(t.index),Bn=en(t.length),En=function(n){return en(t.mapMaybe(n))},In=function(n){return en(t.partition(n))},jn=function(n){return function(r){return en(t.slice(n)(r))}},Dn=function(n){return en(t.span(n))},gn=function(n){return en(t.take(n))},Mn=function(n){return en(t.takeEnd(n))},Nn=function(n){return en(t.takeWhile(n))},Wn=function(n){return en(t.toUnfoldable(n))},zn=function(n){var t=en(n);return function(n){return x(t(n))}},Fn=function(n){return zn(t.cons(n))},kn=function(n){return function(r){return zn(t.insert(n)(r))}},wn=function(n){return function(r){return zn(t.insertBy(n)(r))}},Cn=function(n){return function(r){return function(e){return zn(t.modifyAtIndices(n)(r)(e))}}},Un=function(n){return zn(t.nub(n))},Ln=function(n){return zn(t.nubBy(n))},Jn=function(n){return zn(t.nubByEq(n))},Tn=function(n){return zn(t.nubEq(n))},Rn=zn(t.reverse),On=function(n){return zn(t.sort(n))},Sn=function(n){return zn(t.sortBy(n))},Gn=function(n){return function(r){return zn(t.sortWith(n)(r))}},Hn=function(n){return function(r){return zn(t.updateAtIndices(n)(r))}},Kn=function(n){return en(t.unsafeIndex(n))},Pn=function(n){return function(t){var r=Bn(t);return p.unfoldr1(n)(function(n){return l.Tuple.create(Kn()(t)(n))(n<(r-1|0)?new f.Just(n+1|0):f.Nothing.value)})(0)}};module.exports={fromArray:R,fromNonEmpty:H,toArray:A,toNonEmpty:tn,fromFoldable:O,fromFoldable1:T,toUnfoldable:Wn,toUnfoldable1:Pn,singleton:W,range:F,replicate:z,some:g,length:Bn,cons:Fn,"cons'":G,snoc:N,"snoc'":M,appendArray:Q,insert:kn,insertBy:wn,head:Y,last:$,tail:_,init:Z,uncons:nn,unsnoc:rn,index:hn,elemIndex:pn,elemLastIndex:yn,findIndex:An,findLastIndex:bn,insertAt:J,deleteAt:cn,updateAt:E,updateAtIndices:Hn,modifyAt:k,modifyAtIndices:Cn,alterAt:V,reverse:Rn,concat:P,concatMap:K,filter:mn,partition:In,filterA:xn,mapMaybe:En,catMaybes:un,sort:On,sortBy:Sn,sortWith:Gn,slice:jn,take:gn,takeEnd:Mn,takeWhile:Nn,drop:dn,dropEnd:sn,dropWhile:ln,span:Dn,nub:Un,nubBy:Ln,nubEq:Tn,nubByEq:Jn,union:h,"union'":q,unionBy:v,"unionBy'":b,delete:on,deleteBy:fn,difference:an,"difference'":S,intersect:L,"intersect'":U,intersectBy:C,"intersectBy'":w,zipWith:j,zipWithA:D,zip:I,unzip:B,foldM:qn,foldRecM:vn,unsafeIndex:Kn}; +},{"../Control.Bind/index.js":"7VcT","../Data.Array/index.js":"4t4C","../Data.Array.NonEmpty.Internal/index.js":"PmFL","../Data.Bifunctor/index.js":"e2Wc","../Data.Boolean/index.js":"ObQr","../Data.Eq/index.js":"Pq4F","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Maybe/index.js":"5mN7","../Data.NonEmpty/index.js":"qF8i","../Data.Ord/index.js":"r4Vb","../Data.Semigroup/index.js":"EsAJ","../Data.Tuple/index.js":"II/O","../Data.Unfoldable1/index.js":"S0Nl","../Unsafe.Coerce/index.js":"ETUV"}],"Yzse":[function(require,module,exports) { +"use strict";exports.toCharCode=function(r){return r.charCodeAt(0)},exports.fromCharCode=function(r){return String.fromCharCode(r)}; +},{}],"oOsU":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),t=require("../Control.Apply/index.js"),e=require("../Control.Bind/index.js"),r=require("../Control.MonadZero/index.js"),u=require("../Data.Boolean/index.js"),o=require("../Data.Bounded/index.js"),i=require("../Data.Either/index.js"),a=require("../Data.Eq/index.js"),c=require("../Data.Function/index.js"),f=require("../Data.Functor/index.js"),l=require("../Data.Maybe/index.js"),d=require("../Data.Newtype/index.js"),m=require("../Data.Ord/index.js"),s=require("../Data.Ordering/index.js"),h=require("../Data.Show/index.js"),w=require("../Data.Tuple/index.js"),E=require("../Data.Unfoldable/index.js"),v=require("../Data.Unfoldable1/index.js"),p=require("../Data.Unit/index.js"),b=function(n){return n},g=function(n,t,e){this.Ord0=n,this.pred=t,this.succ=e},J=function(n,t,e,r,u){this.Bounded0=n,this.Enum1=t,this.cardinality=e,this.fromEnum=r,this.toEnum=u},y=function(n){return n.toEnum},D=function(n){return n.succ},T=function(n){return function(e){return v.unfoldr1(e)(t.apply(t.applyFn)(w.Tuple.create)(D(n)))}},C=new h.Show(function(n){return"(Cardinality "+h.show(h.showInt)(n)+")"}),q=function(n){return n.pred},N=m.ordInt,F=new d.Newtype(function(n){return n},b),j=function(n){return n.fromEnum},x=function(n){return function(t){return function(e){return function(r){var u=y(n)(r);if(u instanceof l.Just)return u.value0;if(u instanceof l.Nothing)return ro.bottom(o.boundedInt)?new l.Just(n-1|0):l.Nothing.value},function(n){return n=o.bottom(o.boundedInt)&&t<=o.top(o.boundedInt)?new l.Just(n.fromCharCode(t)):l.Nothing.value},Y=new g(function(){return m.ordChar},H(X)(n.toCharCode),z(X)(n.toCharCode)),$=function(n){return n.cardinality},_=new J(function(){return o.boundedUnit},function(){return B},1,c.const(0),function(n){return 0===n?new l.Just(p.unit):l.Nothing.value}),nn=new J(function(){return o.boundedOrdering},function(){return I},3,function(n){if(n instanceof s.LT)return 0;if(n instanceof s.EQ)return 1;if(n instanceof s.GT)return 2;throw new Error("Failed pattern match at Data.Enum (line 137, column 1 - line 145, column 18): "+[n.constructor.name])},function(n){return 0===n?new l.Just(s.LT.value):1===n?new l.Just(s.EQ.value):2===n?new l.Just(s.GT.value):l.Nothing.value}),tn=new J(function(){return o.boundedChar},function(){return Y},n.toCharCode(o.top(o.boundedChar))-n.toCharCode(o.bottom(o.boundedChar))|0,n.toCharCode,X),en=new J(function(){return o.boundedBoolean},function(){return S},2,function(n){if(!n)return 0;if(n)return 1;throw new Error("Failed pattern match at Data.Enum (line 118, column 1 - line 124, column 20): "+[n.constructor.name])},function(n){return 0===n?new l.Just(!1):1===n?new l.Just(!0):l.Nothing.value});module.exports={Enum:g,succ:D,pred:q,BoundedEnum:J,cardinality:$,toEnum:y,fromEnum:j,toEnumWithDefaults:x,Cardinality:b,enumFromTo:Q,enumFromThenTo:G,upFrom:W,upFromIncluding:T,downFrom:P,downFromIncluding:Z,defaultSucc:z,defaultPred:H,defaultCardinality:V,defaultToEnum:k,defaultFromEnum:K,enumBoolean:S,enumInt:U,enumChar:Y,enumUnit:B,enumOrdering:I,enumMaybe:L,enumEither:R,enumTuple:M,boundedEnumBoolean:en,boundedEnumChar:tn,boundedEnumUnit:_,boundedEnumOrdering:nn,newtypeCardinality:F,eqCardinality:O,ordCardinality:N,showCardinality:C}; +},{"./foreign.js":"Yzse","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.MonadZero/index.js":"lD5R","../Data.Boolean/index.js":"ObQr","../Data.Bounded/index.js":"kcUU","../Data.Either/index.js":"B2JL","../Data.Eq/index.js":"Pq4F","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Maybe/index.js":"5mN7","../Data.Newtype/index.js":"lz8k","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Show/index.js":"mFY7","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z","../Data.Unfoldable1/index.js":"S0Nl","../Data.Unit/index.js":"NhVk"}],"EM+K":[function(require,module,exports) { +"use strict";var n=require("../Data.Array.NonEmpty/index.js"),r=require("../Data.Maybe/index.js"),t=require("../Data.Semigroup.Foldable/index.js"),e=require("../Data.String.CodeUnits/index.js"),u=require("../Data.String.NonEmpty.Internal/index.js"),o=require("../Data.String.Unsafe/index.js"),i=require("../Unsafe.Coerce/index.js"),a=i.unsafeCoerce,f=function(n){return function(r){return a(r+e.singleton(n))}},c=function(n){return a(e.singleton(n))},s=i.unsafeCoerce,l=function(n){var r=s(e.takeWhile(n));return function(n){return u.fromString(r(n))}},h=function(n){var r=e["lastIndexOf'"](n);return function(n){return s(r(n))}},g=function(n){return s(e.lastIndexOf(n))},d=function(n){var r=e["indexOf'"](n);return function(n){return s(r(n))}},m=function(n){return s(e.indexOf(n))},v=i.unsafeCoerce,x=function(n){return e.length(v(n))},p=function(n){return function(r){var t=e.splitAt(n)(v(r));return{before:u.fromString(t.before),after:u.fromString(t.after)}}},y=function(n){return function(t){var u=v(t);return n<1?r.Nothing.value:new r.Just(a(e.take(n)(u)))}},A=function(n){return function(t){var u=v(t);return n<1?r.Nothing.value:new r.Just(a(e.takeRight(n)(u)))}},C=function(n){return e.toChar(v(n))},N=function(n){return e.toCharArray(v(n))},S=function(){var t=r.fromJust();return function(r){return t(n.fromArray(N(r)))}}(),O=function(n){var r=v(n);return{head:o.charAt(0)(r),tail:u.fromString(e.drop(1)(r))}},j=function(n){var r=t.fold1(n)(u.semigroupNonEmptyString);return function(n){return r(n)}},q=function(n){return 0===n.length?r.Nothing.value:new r.Just(a(e.fromCharArray(n)))},J=function(){var t=r.fromJust();return function(r){return t(q(n.toArray(r)))}}(),k=function(n){var r=s(e.dropWhile(n));return function(n){return u.fromString(r(n))}},D=function(n){return function(t){var u=v(t);return n>=e.length(u)?r.Nothing.value:new r.Just(a(e.dropRight(n)(u)))}},b=function(n){return function(t){var u=v(t);return n>=e.length(u)?r.Nothing.value:new r.Just(a(e.drop(n)(u)))}},w=function(n){return s(e.countPrefix(n))},E=function(n){return function(r){return a(e.singleton(n)+r)}},I=function(n){return s(e.charAt(n))};module.exports={fromCharArray:q,fromNonEmptyCharArray:J,singleton:c,cons:E,snoc:f,fromFoldable1:j,toCharArray:N,toNonEmptyCharArray:S,charAt:I,toChar:C,indexOf:m,"indexOf'":d,lastIndexOf:g,"lastIndexOf'":h,uncons:O,length:x,take:y,takeRight:A,takeWhile:l,drop:b,dropRight:D,dropWhile:k,countPrefix:w,splitAt:p}; +},{"../Data.Array.NonEmpty/index.js":"eTKN","../Data.Maybe/index.js":"5mN7","../Data.Semigroup.Foldable/index.js":"ht+A","../Data.String.CodeUnits/index.js":"6c6X","../Data.String.NonEmpty.Internal/index.js":"Ph6A","../Data.String.Unsafe/index.js":"5UWM","../Unsafe.Coerce/index.js":"ETUV"}],"nKWe":[function(require,module,exports) { +"use strict";var n=require("../Data.Eq/index.js"),e=require("../Data.Newtype/index.js"),t=require("../Data.Ord/index.js"),r=require("../Data.Show/index.js"),u=function(n){return n},o=function(n){return n},i=new r.Show(function(n){return"(Replacement "+r.show(r.showString)(n)+")"}),c=new r.Show(function(n){return"(Pattern "+r.show(r.showString)(n)+")"}),a=new e.Newtype(function(n){return n},u),w=new e.Newtype(function(n){return n},o),f=new n.Eq(function(n){return function(e){return n===e}}),p=new t.Ord(function(){return f},function(n){return function(e){return t.compare(t.ordString)(n)(e)}}),s=new n.Eq(function(n){return function(e){return n===e}}),d=new t.Ord(function(){return s},function(n){return function(e){return t.compare(t.ordString)(n)(e)}});module.exports={Pattern:o,Replacement:u,eqPattern:s,ordPattern:d,newtypePattern:w,showPattern:c,eqReplacement:f,ordReplacement:p,newtypeReplacement:a,showReplacement:i}; +},{"../Data.Eq/index.js":"Pq4F","../Data.Newtype/index.js":"lz8k","../Data.Ord/index.js":"r4Vb","../Data.Show/index.js":"mFY7"}],"3koD":[function(require,module,exports) { +"use strict";exports.unsafeUnionFn=function(r,n){var a={};for(var o in n)({}).hasOwnProperty.call(n,o)&&(a[o]=n[o]);for(var t in r)({}).hasOwnProperty.call(r,t)&&(a[t]=r[t]);return a}; +},{}],"cB+g":[function(require,module,exports) { +"use strict";exports.mkFn0=function(n){return function(){return n({})}},exports.mkFn2=function(n){return function(r,t){return n(r)(t)}},exports.mkFn3=function(n){return function(r,t,u){return n(r)(t)(u)}},exports.mkFn4=function(n){return function(r,t,u,e){return n(r)(t)(u)(e)}},exports.mkFn5=function(n){return function(r,t,u,e,o){return n(r)(t)(u)(e)(o)}},exports.mkFn6=function(n){return function(r,t,u,e,o,c){return n(r)(t)(u)(e)(o)(c)}},exports.mkFn7=function(n){return function(r,t,u,e,o,c,i){return n(r)(t)(u)(e)(o)(c)(i)}},exports.mkFn8=function(n){return function(r,t,u,e,o,c,i,f){return n(r)(t)(u)(e)(o)(c)(i)(f)}},exports.mkFn9=function(n){return function(r,t,u,e,o,c,i,f,s){return n(r)(t)(u)(e)(o)(c)(i)(f)(s)}},exports.mkFn10=function(n){return function(r,t,u,e,o,c,i,f,s,p){return n(r)(t)(u)(e)(o)(c)(i)(f)(s)(p)}},exports.runFn0=function(n){return n()},exports.runFn2=function(n){return function(r){return function(t){return n(r,t)}}},exports.runFn3=function(n){return function(r){return function(t){return function(u){return n(r,t,u)}}}},exports.runFn4=function(n){return function(r){return function(t){return function(u){return function(e){return n(r,t,u,e)}}}}},exports.runFn5=function(n){return function(r){return function(t){return function(u){return function(e){return function(o){return n(r,t,u,e,o)}}}}}},exports.runFn6=function(n){return function(r){return function(t){return function(u){return function(e){return function(o){return function(c){return n(r,t,u,e,o,c)}}}}}}},exports.runFn7=function(n){return function(r){return function(t){return function(u){return function(e){return function(o){return function(c){return function(i){return n(r,t,u,e,o,c,i)}}}}}}}},exports.runFn8=function(n){return function(r){return function(t){return function(u){return function(e){return function(o){return function(c){return function(i){return function(f){return n(r,t,u,e,o,c,i,f)}}}}}}}}},exports.runFn9=function(n){return function(r){return function(t){return function(u){return function(e){return function(o){return function(c){return function(i){return function(f){return function(s){return n(r,t,u,e,o,c,i,f,s)}}}}}}}}}},exports.runFn10=function(n){return function(r){return function(t){return function(u){return function(e){return function(o){return function(c){return function(i){return function(f){return function(s){return function(p){return n(r,t,u,e,o,c,i,f,s,p)}}}}}}}}}}}; +},{}],"TowT":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),F=function(n){return n},r=function(n){return n};module.exports={mkFn1:r,runFn1:F,mkFn0:n.mkFn0,mkFn2:n.mkFn2,mkFn3:n.mkFn3,mkFn4:n.mkFn4,mkFn5:n.mkFn5,mkFn6:n.mkFn6,mkFn7:n.mkFn7,mkFn8:n.mkFn8,mkFn9:n.mkFn9,mkFn10:n.mkFn10,runFn0:n.runFn0,runFn2:n.runFn2,runFn3:n.runFn3,runFn4:n.runFn4,runFn5:n.runFn5,runFn6:n.runFn6,runFn7:n.runFn7,runFn8:n.runFn8,runFn9:n.runFn9,runFn10:n.runFn10}; +},{"./foreign.js":"cB+g"}],"WmUk":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),e=require("../Data.Function.Uncurried/index.js"),i=e.runFn2(n.unsafeUnionFn);module.exports={unsafeUnion:i,unsafeUnionFn:n.unsafeUnionFn}; +},{"./foreign.js":"3koD","../Data.Function.Uncurried/index.js":"TowT"}],"0gG4":[function(require,module,exports) { +"use strict";var n=require("../Data.Eq/index.js"),r=require("../Data.Symbol/index.js"),u=require("../Record.Unsafe/index.js"),t=require("../Record.Unsafe.Union/index.js"),e=require("../Type.Data.RowList/index.js"),i=require("../Unsafe.Coerce/index.js"),o=function(n){this.equalFields=n},f=function(n){return function(n){return function(r){return t.unsafeUnionFn(n,r)}}},c=function(n){return function(t){return function(t){return function(t){return function(e){return function(i){return u.unsafeSet(r.reflectSymbol(n)(t))(e)(i)}}}}}},s=function(n){return i.unsafeCoerce},a=function(n){return function(n){return function(n){return function(r){return t.unsafeUnionFn(n,r)}}}},l=function(n){return function(t){return function(t){return function(t){return function(e){return function(i){return u.unsafeSet(r.reflectSymbol(n)(t))(e)(i)}}}}}},d=function(n){return function(t){return function(t){return function(e){return u.unsafeGet(r.reflectSymbol(n)(t))(e)}}}},q=function(n){return function(r){return function(u){return function(t){return function(e){return function(i){return c(n)(r)(u)(t)(e(d(n)(r)(t)(i)))(i)}}}}}},x=new o(function(n){return function(n){return function(n){return!0}}}),y=function(n){return n.equalFields},m=function(u){return function(t){return function(i){return function(f){return new o(function(o){return function(o){return function(c){var s=d(u)(i)(r.SProxy.value),a=y(f)(e.RLProxy.value);return n.eq(t)(s(o))(s(c))&&a(o)(c)}}})}}}},F=function(n){return function(n){return function(r){return function(u){return y(n)(e.RLProxy.value)(r)(u)}}}},S=function(n){return function(n){return function(n){return function(r){return t.unsafeUnionFn(n,r)}}}},U=function(n){return function(t){return function(t){return function(t){return function(e){return u.unsafeDelete(r.reflectSymbol(n)(t))(e)}}}}},j=function(n){return function(r){return function(u){return function(t){return function(e){return function(i){return function(o){return function(f){return function(c){return l(r)(i)(e)(f)(d(n)(u)(o)(c))(U(n)(t)(u)(o)(c))}}}}}}}}};module.exports={get:d,set:c,modify:q,insert:l,delete:U,rename:j,equal:F,merge:a,union:f,disjointUnion:S,nub:s,EqualFields:o,equalFields:y,equalFieldsCons:m,equalFieldsNil:x}; +},{"../Data.Eq/index.js":"Pq4F","../Data.Symbol/index.js":"4oJQ","../Record.Unsafe/index.js":"KG04","../Record.Unsafe.Union/index.js":"WmUk","../Type.Data.RowList/index.js":"XaXP","../Unsafe.Coerce/index.js":"ETUV"}],"/s47":[function(require,module,exports) { +"use strict";exports.float32ToInt32=function(r){var t=new ArrayBuffer(4),n=new Float32Array(t),e=new Int32Array(t);return n[0]=r,e[0]}; +},{}],"IpNh":[function(require,module,exports) { +"use strict";var t=function(t,n){this.Monad0=t,this.callCC=n},n=function(t){return t.callCC};module.exports={MonadCont:t,callCC:n}; +},{}],"OvLS":[function(require,module,exports) { +"use strict";exports.showErrorImpl=function(r){return r.stack||r.toString()},exports.error=function(r){return new Error(r)},exports.message=function(r){return r.message},exports.name=function(r){return r.name||"Error"},exports.stackImpl=function(r){return function(t){return function(n){return n.stack?r(n.stack):t}}},exports.throwException=function(r){return function(){throw r}},exports.catchException=function(r){return function(t){return function(){try{return t()}catch(n){return n instanceof Error||"[object Error]"===Object.prototype.toString.call(n)?r(n)():r(new Error(n.toString()))()}}}}; +},{}],"0OCW":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),r=require("../Control.Applicative/index.js"),t=require("../Data.Either/index.js"),i=require("../Data.Functor/index.js"),o=require("../Data.Maybe/index.js"),n=require("../Data.Show/index.js"),a=require("../Effect/index.js"),c=function(o){return e.catchException((n=r.pure(a.applicativeEffect),function(e){return n(t.Left.create(e))}))(i.map(a.functorEffect)(t.Right.create)(o));var n},u=function(r){return e.throwException(e.error(r))},s=e.stackImpl(o.Just.create)(o.Nothing.value),p=new n.Show(e.showErrorImpl);module.exports={stack:s,throw:u,try:c,showError:p,error:e.error,message:e.message,name:e.name,throwException:e.throwException,catchException:e.catchException}; +},{"./foreign.js":"OvLS","../Control.Applicative/index.js":"qYya","../Data.Either/index.js":"B2JL","../Data.Functor/index.js":"+0AE","../Data.Maybe/index.js":"5mN7","../Data.Show/index.js":"mFY7","../Effect/index.js":"oTWB"}],"L8Lk":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Bind/index.js"),t=require("../Data.Either/index.js"),o=require("../Data.Function/index.js"),e=require("../Data.Functor/index.js"),i=require("../Data.Maybe/index.js"),u=require("../Data.Unit/index.js"),a=require("../Effect/index.js"),c=require("../Effect.Exception/index.js"),f=function(n,r){this.Monad0=n,this.throwError=r},d=function(n,r){this.MonadThrow0=n,this.catchError=r},h=function(n){return n.throwError},s=new f(function(){return i.monadMaybe},o.const(i.Nothing.value)),l=new f(function(){return t.monadEither},t.Left.create),w=new f(function(){return a.monadEffect},c.throwException),E=new d(function(){return s},function(n){return function(r){if(n instanceof i.Nothing)return r(u.unit);if(n instanceof i.Just)return new i.Just(n.value0);throw new Error("Failed pattern match at Control.Monad.Error.Class (line 79, column 1 - line 81, column 33): "+[n.constructor.name,r.constructor.name])}}),m=new d(function(){return l},function(n){return function(r){if(n instanceof t.Left)return r(n.value0);if(n instanceof t.Right)return new t.Right(n.value0);throw new Error("Failed pattern match at Control.Monad.Error.Class (line 72, column 1 - line 74, column 35): "+[n.constructor.name,r.constructor.name])}}),M=new d(function(){return w},o.flip(c.catchException)),p=function(n){return n.catchError},x=function(n){return function(r){return function(t){return function(o){return p(n)(t)(function(t){var e=r(t);if(e instanceof i.Nothing)return h(n.MonadThrow0())(t);if(e instanceof i.Just)return o(e.value0);throw new Error("Failed pattern match at Control.Monad.Error.Class (line 57, column 5 - line 59, column 26): "+[e.constructor.name])})}}}},T=function(r){return function(o){return p(r)(e.map(r.MonadThrow0().Monad0().Bind1().Apply0().Functor0())(t.Right.create)(o))((i=n.pure(r.MonadThrow0().Monad0().Applicative0()),function(n){return i(t.Left.create(n))}));var i}},v=function(o){return function(e){return function(i){return function(u){return r.bind(o.MonadThrow0().Monad0().Bind1())(e)(function(e){return r.bind(o.MonadThrow0().Monad0().Bind1())(T(o)(u(e)))(function(u){return r.discard(r.discardUnit)(o.MonadThrow0().Monad0().Bind1())(i(e))(function(){return t.either(h(o.MonadThrow0()))(n.pure(o.MonadThrow0().Monad0().Applicative0()))(u)})})})}}}};module.exports={catchError:p,throwError:h,MonadThrow:f,MonadError:d,catchJust:x,try:T,withResource:v,monadThrowEither:l,monadErrorEither:m,monadThrowMaybe:s,monadErrorMaybe:E,monadThrowEffect:w,monadErrorEffect:M}; +},{"../Control.Applicative/index.js":"qYya","../Control.Bind/index.js":"7VcT","../Data.Either/index.js":"B2JL","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Maybe/index.js":"5mN7","../Data.Unit/index.js":"NhVk","../Effect/index.js":"oTWB","../Effect.Exception/index.js":"0OCW"}],"c2ZJ":[function(require,module,exports) { +"use strict";var n=require("../Control.Category/index.js"),o=require("../Control.Monad/index.js"),e=require("../Control.Semigroupoid/index.js"),r=require("../Data.Functor/index.js"),t=function(n,o){this.Monad0=n,this.ask=o},i=function(n,o){this.MonadAsk0=n,this.local=o},u=new t(function(){return o.monadFn},n.identity(n.categoryFn)),a=new i(function(){return u},e.composeFlipped(e.semigroupoidFn)),d=function(n){return n.local},s=function(n){return n.ask},c=function(n){return function(o){return r.map(n.Monad0().Bind1().Apply0().Functor0())(o)(s(n))}};module.exports={ask:s,local:d,MonadAsk:t,asks:c,MonadReader:i,monadAskFun:u,monadReaderFun:a}; +},{"../Control.Category/index.js":"IAi2","../Control.Monad/index.js":"U/Ix","../Control.Semigroupoid/index.js":"/riR","../Data.Functor/index.js":"+0AE"}],"5tIR":[function(require,module,exports) { +"use strict";var t=function(t){this.lift=t},i=function(t){return t.lift};module.exports={lift:i,MonadTrans:t}; +},{}],"gxgA":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),e=require("../Control.Bind/index.js"),t=require("../Data.Tuple/index.js"),i=function(n,e){this.Monad0=n,this.tell=e},r=function(n,e,t){this.MonadTell0=n,this.listen=e,this.pass=t},u=function(n){return n.tell},l=function(n){return n.pass},o=function(n){return n.listen},a=function(i){return function(r){return function(u){return e.bind(i.MonadTell0().Monad0().Bind1())(o(i)(u))(function(e){return n.pure(i.MonadTell0().Monad0().Applicative0())(new t.Tuple(e.value0,r(e.value1)))})}}},s=function(i){return function(r){return function(u){return l(i)(e.bind(i.MonadTell0().Monad0().Bind1())(u)(function(e){return n.pure(i.MonadTell0().Monad0().Applicative0())(new t.Tuple(e,r))}))}}};module.exports={listen:o,pass:l,tell:u,MonadTell:i,MonadWriter:r,listens:a,censor:s}; +},{"../Control.Applicative/index.js":"qYya","../Control.Bind/index.js":"7VcT","../Data.Tuple/index.js":"II/O"}],"dWtH":[function(require,module,exports) { +"use strict";var t=require("../Control.Category/index.js"),e=require("../Effect/index.js"),f=function(t,e){this.Monad0=t,this.liftEffect=e},n=new f(function(){return e.monadEffect},t.identity(t.categoryFn)),i=function(t){return t.liftEffect};module.exports={liftEffect:i,MonadEffect:f,monadEffectEffect:n}; +},{"../Control.Category/index.js":"IAi2","../Effect/index.js":"oTWB"}],"34Kp":[function(require,module,exports) { +"use strict";var n=require("../Control.Alt/index.js"),t=require("../Control.Alternative/index.js"),e=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),u=require("../Control.Bind/index.js"),o=require("../Control.Lazy/index.js"),i=require("../Control.Monad/index.js"),a=require("../Control.Monad.Cont.Class/index.js"),c=require("../Control.Monad.Error.Class/index.js"),l=require("../Control.Monad.Reader.Class/index.js"),f=require("../Control.Monad.Rec.Class/index.js"),d=require("../Control.Monad.State.Class/index.js"),s=require("../Control.Monad.Trans.Class/index.js"),p=require("../Control.Monad.Writer.Class/index.js"),T=require("../Control.MonadPlus/index.js"),M=require("../Control.MonadZero/index.js"),v=require("../Control.Plus/index.js"),w=require("../Data.Functor/index.js"),S=require("../Data.Newtype/index.js"),C=require("../Data.Tuple/index.js"),m=require("../Data.Unit/index.js"),x=require("../Effect.Class/index.js"),j=function(n){return n},q=function(n){return function(t){return function(e){return t(n(e))}}},A=function(n){return n},y=new S.Newtype(function(n){return n},j),E=new s.MonadTrans(function(n){return function(t){return function(r){return u.bind(n.Bind1())(t)(function(t){return e.pure(n.Applicative0())(new C.Tuple(t,r))})}}}),h=function(n){return function(t){return function(e){return n(t(e))}}},B=new o.Lazy(function(n){return function(t){return n(m.unit)(t)}}),R=function(n){return new w.Functor(function(t){return function(e){return function(r){return w.map(n)(function(n){return new C.Tuple(t(n.value0),n.value1)})(e(r))}}})},b=function(n){return function(t){return function(e){return w.map(n)(C.snd)(t(e))}}},D=function(n){return function(t){return function(e){return w.map(n)(C.fst)(t(e))}}},P=function(n){return new i.Monad(function(){return L(n)},function(){return F(n)})},F=function(n){return new u.Bind(function(){return k(n)},function(t){return function(e){return function(r){return u.bind(n.Bind1())(t(r))(function(n){return e(n.value0)(n.value1)})}}})},k=function(n){return new r.Apply(function(){return R(n.Bind1().Apply0().Functor0())},i.ap(P(n)))},L=function(n){return new e.Applicative(function(){return k(n)},function(t){return function(r){return e.pure(n.Applicative0())(new C.Tuple(t,r))}})},Z=function(n){return new l.MonadAsk(function(){return P(n.Monad0())},s.lift(E)(n.Monad0())(l.ask(n)))},z=function(n){return new l.MonadReader(function(){return Z(n.MonadAsk0())},(t=l.local(n),function(n){return h(t(n))}));var t},W=function(n){return new a.MonadCont(function(){return P(n.Monad0())},function(t){return function(e){return a.callCC(n)(function(n){return t(function(t){return function(e){return n(new C.Tuple(t,e))}})(e)})}})},N=function(n){return new x.MonadEffect(function(){return P(n.Monad0())},(t=s.lift(E)(n.Monad0()),e=x.liftEffect(n),function(n){return t(e(n))}));var t,e},U=function(n){return new f.MonadRec(function(){return P(n.Monad0())},function(t){return function(r){var o=function(r){var o=t(r.value0);return u.bind(n.Monad0().Bind1())(o(r.value1))(function(t){return e.pure(n.Monad0().Applicative0())(function(){if(t.value0 instanceof f.Loop)return new f.Loop(new C.Tuple(t.value0.value0,t.value1));if(t.value0 instanceof f.Done)return new f.Done(new C.Tuple(t.value0.value0,t.value1));throw new Error("Failed pattern match at Control.Monad.State.Trans (line 87, column 16 - line 89, column 40): "+[t.value0.constructor.name])}())})};return function(t){return f.tailRecM(n)(o)(new C.Tuple(r,t))}}})},g=function(n){return new d.MonadState(function(){return P(n)},function(t){return j((r=e.pure(n.Applicative0()),function(n){return r(t(n))}));var r})},G=function(n){return new p.MonadTell(function(){return P(n.Monad0())},(t=s.lift(E)(n.Monad0()),e=p.tell(n),function(n){return t(e(n))}));var t,e},H=function(n){return new p.MonadWriter(function(){return G(n.MonadTell0())},function(t){return function(r){return u.bind(n.MonadTell0().Monad0().Bind1())(p.listen(n)(t(r)))(function(t){return e.pure(n.MonadTell0().Monad0().Applicative0())(new C.Tuple(new C.Tuple(t.value0.value0,t.value1),t.value0.value1))})}},function(t){return function(r){return p.pass(n)(u.bind(n.MonadTell0().Monad0().Bind1())(t(r))(function(t){return e.pure(n.MonadTell0().Monad0().Applicative0())(new C.Tuple(new C.Tuple(t.value0.value0,t.value1),t.value0.value1))}))}})},I=function(n){return new c.MonadThrow(function(){return P(n.Monad0())},function(t){return s.lift(E)(n.Monad0())(c.throwError(n)(t))})},J=function(n){return new c.MonadError(function(){return I(n.MonadThrow0())},function(t){return function(e){return function(r){return c.catchError(n)(t(r))(function(n){return e(n)(r)})}}})},K=function(t){return function(t){return new n.Alt(function(){return R(t.Functor0())},function(e){return function(r){return function(u){return n.alt(t)(e(u))(r(u))}}})}},O=function(n){return function(t){return new v.Plus(function(){return K(n)(t.Alt0())},function(n){return v.empty(t)})}},Q=function(n){return function(e){return new t.Alternative(function(){return L(n)},function(){return O(n)(e.Plus1())})}},V=function(n){return new M.MonadZero(function(){return Q(n.Monad0())(n.Alternative1())},function(){return P(n.Monad0())})},X=function(n){return new T.MonadPlus(function(){return V(n.MonadZero0())})};module.exports={StateT:j,runStateT:A,evalStateT:D,execStateT:b,mapStateT:h,withStateT:q,newtypeStateT:y,functorStateT:R,applyStateT:k,applicativeStateT:L,altStateT:K,plusStateT:O,alternativeStateT:Q,bindStateT:F,monadStateT:P,monadRecStateT:U,monadZeroStateT:V,monadPlusStateT:X,monadTransStateT:E,lazyStateT:B,monadEffectState:N,monadContStateT:W,monadThrowStateT:I,monadErrorStateT:J,monadAskStateT:Z,monadReaderStateT:z,monadStateStateT:g,monadTellStateT:G,monadWriterStateT:H}; +},{"../Control.Alt/index.js":"lN+m","../Control.Alternative/index.js":"aHia","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Lazy/index.js":"y9cE","../Control.Monad/index.js":"U/Ix","../Control.Monad.Cont.Class/index.js":"IpNh","../Control.Monad.Error.Class/index.js":"L8Lk","../Control.Monad.Reader.Class/index.js":"c2ZJ","../Control.Monad.Rec.Class/index.js":"UVIy","../Control.Monad.State.Class/index.js":"u1pL","../Control.Monad.Trans.Class/index.js":"5tIR","../Control.Monad.Writer.Class/index.js":"gxgA","../Control.MonadPlus/index.js":"HkJx","../Control.MonadZero/index.js":"lD5R","../Control.Plus/index.js":"oMBg","../Data.Functor/index.js":"+0AE","../Data.Newtype/index.js":"lz8k","../Data.Tuple/index.js":"II/O","../Data.Unit/index.js":"NhVk","../Effect.Class/index.js":"dWtH"}],"mGZW":[function(require,module,exports) { +"use strict";var t=require("../Control.Monad.State.Trans/index.js"),e=require("../Data.Identity/index.js"),n=require("../Data.Newtype/index.js"),r=t.withStateT,u=function(t){var r=n.unwrap(e.newtypeIdentity);return function(e){return r(t(e))}},a=function(r){return t.mapStateT((u=n.unwrap(e.newtypeIdentity),function(t){return e.Identity(r(u(t)))}));var u},i=function(t){return function(e){return t(e).value1}},o=function(t){return function(e){return t(e).value0}};module.exports={runState:u,evalState:o,execState:i,mapState:a,withState:r}; +},{"../Control.Monad.State.Trans/index.js":"34Kp","../Data.Identity/index.js":"2OKT","../Data.Newtype/index.js":"lz8k"}],"7S1u":[function(require,module,exports) { +"use strict";exports.random=Math.random; +},{}],"V+tx":[function(require,module,exports) { +"use strict";var r=require("./foreign.js"),n=require("../Data.Functor/index.js"),e=require("../Data.Int/index.js"),t=require("../Effect/index.js"),o=function(n){return function(e){return function(){return r.random()*(e-n)+n}}},u=function(n){return function(t){return function(){var o=r.random(),u=(e.toNumber(t)-e.toNumber(n)+1)*o+e.toNumber(n);return e.floor(u)}}},a=n.map(t.functorEffect)(function(r){return r<.5})(r.random);module.exports={randomInt:u,randomRange:o,randomBool:a,random:r.random}; +},{"./foreign.js":"7S1u","../Data.Functor/index.js":"+0AE","../Data.Int/index.js":"xNJb","../Effect/index.js":"oTWB"}],"1RqQ":[function(require,module,exports) { +"use strict";var e=require("../Data.Eq/index.js"),r=require("../Data.EuclideanRing/index.js"),n=require("../Data.Functor/index.js"),t=require("../Data.Int/index.js"),u=require("../Data.Maybe/index.js"),i=require("../Data.Ord/index.js"),o=require("../Data.Show/index.js"),d=require("../Effect/index.js"),a=require("../Effect.Random/index.js"),c=require("../Math/index.js"),f=function(e){return e},s=function(e){return e},m=new o.Show(function(e){return"Seed "+o.show(o.showInt)(e)}),q=1,x=2147483647,j=x-1|0,S=function(e){var n;return(n=q,function(e){return function(t){var u=e-n|0,i=r.mod(r.euclideanRingInt)(t)(u);return in){var f=o.value0.toEnum(n);return f instanceof u.Just?(l=!0,u.Just.create({type:t.value0,value:f.value0})):(l=!0,u.Nothing.value)}if(e.otherwise)return i=n-o.value0.cardinality|0,c=t.value1,void(a=o.value1)}return l=!0,u.Nothing.value}for(;!l;)o=f(i,c,a);return o}}},E=function(n){return function(t){var u,a=!1;function o(u){if(u instanceof r.Cons){if(u.value0===n)return a=!0,!0;if(e.otherwise)return void(t=u.value1)}if(u instanceof r.Nil)return a=!0,!1;throw new Error("Failed pattern match at Data.Variant.Internal (line 94, column 8 - line 98, column 18): "+[u.constructor.name])}for(;!a;)u=o(t);return u}},F=function(){var n;return n=0,function(t){var e,u=n,a=!1;function o(n,e){if(e instanceof r.Cons)return u=n+e.value0.cardinality|0,void(t=e.value1);if(e instanceof r.Nil)return a=!0,n;throw new Error("Failed pattern match at Data.Variant.Internal (line 216, column 12 - line 218, column 16): "+[e.constructor.name])}for(;!a;)e=o(u,t);return e}}(),q=function(n){return c.unsafeCrashWith("Data.Variant: impossible `"+n+"`")},V=function(n){return function(t){return function(u){return function(a){var o,i=u,c=!1;function l(u,o){if(u instanceof r.Cons&&o instanceof r.Cons){if(u.value0===t)return c=!0,o.value0;if(e.otherwise)return i=u.value1,void(a=o.value1)}return c=!0,q(n)}for(;!c;)o=l(i,a);return o}}}},k=function(n){return function(t){return function(r){return function(u){if(r.type===u.type)return V("eq")(r.type)(n)(t)(r.value)(u.value);if(e.otherwise)return!1;throw new Error("Failed pattern match at Data.Variant.Internal (line 100, column 1 - line 105, column 12): "+[n.constructor.name,t.constructor.name,r.constructor.name,u.constructor.name])}}}},j=function(n){return function(t){return function(e){return function(r){var u=a.compare(a.ordString)(e.type)(r.type);return u instanceof o.EQ?V("compare")(e.type)(n)(t)(e.value)(r.value):u}}}},J=function(n){return function(t){return function(e){return function(u){return e instanceof r.Cons&&u instanceof r.Cons?{type:e.value0,value:t(u.value0)}:q(n)}}}},T=function(n){var t;return t=0,function(u){return function(a){var o,i=t,c=u,l=!1;function f(t,u,o){if(u instanceof r.Cons&&o instanceof r.Cons){if(u.value0===n.type)return l=!0,t+o.value0.fromEnum(n.value)|0;if(e.otherwise)return i=t+o.value0.cardinality|0,c=u.value1,void(a=o.value1)}return l=!0,q("fromEnum")}for(;!l;)o=f(i,c,a);return o}}},I=function(n){return function(t){return function(e){return function(u){for(var a,o,i,c=e,l=!1;!l;)i=u,a=(o=c)instanceof r.Cons&&o.value1 instanceof r.Nil&&i instanceof r.Cons&&i.value1 instanceof r.Nil?(l=!0,{type:o.value0,value:t(i.value0)}):o instanceof r.Cons&&i instanceof r.Cons?(c=o.value1,void(u=i.value1)):(l=!0,q(n));return a}}}},P=function(n){return function(t){return function(a){return function(o){if(t instanceof r.Cons&&a instanceof r.Cons&&o instanceof r.Cons){if(t.value0===n.type){var i=o.value0.pred(n.value);if(i instanceof u.Nothing)return u.Nothing.value;if(i instanceof u.Just)return u.Just.create({type:n.type,value:i.value0});throw new Error("Failed pattern match at Data.Variant.Internal (line 175, column 11 - line 177, column 69): "+[i.constructor.name])}if(e.otherwise)return(c=t.value0,function(t){return function(a){return function(a){return function(o){return function(i){var l,f=c,s=t,v=a,p=o,m=!1;function h(t,a,o,c,l,h){if(c instanceof r.Cons&&l instanceof r.Cons&&h instanceof r.Cons){if(c.value0===n.type){var d=h.value0.pred(n.value);if(d instanceof u.Nothing)return m=!0,u.Just.create({type:t,value:a.top});if(d instanceof u.Just)return m=!0,u.Just.create({type:n.type,value:d.value0});throw new Error("Failed pattern match at Data.Variant.Internal (line 184, column 11 - line 186, column 69): "+[d.constructor.name])}if(e.otherwise)return f=c.value0,s=l.value0,h.value0,v=c.value1,p=l.value1,void(i=h.value1)}return m=!0,q("pred")}for(;!m;)l=h(f,s,0,v,p,i);return l}}}}})(a.value0)(o.value0)(t.value1)(a.value1)(o.value1)}var c;return q("pred")}}}},b=function(n){return function(t){return function(a){return function(o){var i,c=t,l=a,f=!1;function s(t,a,i){if(t instanceof r.Cons&&a instanceof r.Cons&&i instanceof r.Cons){if(t.value0===n.type){var s=i.value0.succ(n.value);if(s instanceof u.Just)return f=!0,u.Just.create({type:t.value0,value:s.value0});if(s instanceof u.Nothing)return t.value1 instanceof r.Cons&&a.value1 instanceof r.Cons?(f=!0,u.Just.create({type:t.value1.value0,value:a.value1.value0.bottom})):(f=!0,u.Nothing.value);throw new Error("Failed pattern match at Data.Variant.Internal (line 202, column 11 - line 206, column 29): "+[s.constructor.name])}if(e.otherwise)return c=t.value1,l=a.value1,void(o=i.value1)}return f=!0,q("succ")}for(;!f;)i=s(c,l,o);return i}}}},M=function(r){return function(r){return function(r){return new h(function(u){return function(a){return function(o){return function(i){return function(c){if(E(i)(C(r)(l.RLProxy.value)))return n.pure(u.Applicative0())(c);if(e.otherwise)return t.empty(u.Plus1());throw new Error("Failed pattern match at Data.Variant.Internal (line 254, column 1 - line 263, column 24): "+[a.constructor.name,o.constructor.name,i.constructor.name,c.constructor.name])}}}}})}}},L=function(n){return n.contractWith};module.exports={FProxy:s,VariantRep:f,VariantTags:v,variantTags:C,Contractable:h,contractWith:L,VariantMatchCases:p,VariantFMatchCases:m,lookup:V,lookupTag:E,lookupEq:k,lookupOrd:j,lookupLast:I,lookupFirst:J,lookupPred:P,lookupSucc:b,lookupCardinality:F,lookupFromEnum:T,lookupToEnum:N,impossible:q,variantMatchCons:g,variantMatchNil:w,variantFMatchCons:D,variantFMatchNil:x,variantTagsNil:d,variantTagsCons:y,contractWithInstance:M}; +},{"../Control.Applicative/index.js":"qYya","../Control.Plus/index.js":"oMBg","../Data.Boolean/index.js":"ObQr","../Data.List.Types/index.js":"Xxuc","../Data.Maybe/index.js":"5mN7","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Symbol/index.js":"4oJQ","../Partial.Unsafe/index.js":"aoR+","../Type.Data.RowList/index.js":"XaXP"}],"hgdh":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Plus/index.js"),t=require("../Data.Bounded/index.js"),u=require("../Data.Enum/index.js"),e=require("../Data.Eq/index.js"),o=require("../Data.Function/index.js"),i=require("../Data.List.Types/index.js"),a=require("../Data.Ord/index.js"),c=require("../Data.Show/index.js"),f=require("../Data.Symbol/index.js"),s=require("../Data.Variant.Internal/index.js"),l=require("../Partial.Unsafe/index.js"),v=require("../Record.Unsafe/index.js"),d=require("../Type.Data.Row/index.js"),y=require("../Type.Data.RowList/index.js"),x=require("../Unsafe.Coerce/index.js"),p=function(n){return n},w=function(n){this.variantShows=n},m=function(n){this.variantOrds=n},P=function(n){this.variantEqs=n},R=function(n){this.variantBounded=n},V=function(n,r){this.VariantBounded0=n,this.variantBoundedEnums=r},L=function(n){return n.variantShows},q=function(n){return n.variantOrds},h=function(n){return n.variantEqs},E=function(n){return n.variantBoundedEnums},j=function(n){return n.variantBounded},B=function(n){return function(r){return(t={reflectSymbol:o.const(n.type)},function(n){return r(t)(n)})({})(f.SProxy.value)(n.value);var t}},C=new w(function(n){return i.Nil.value}),S=function(n){return function(r){return new w(function(t){return new i.Cons(c.show(r),L(n)(y.RLProxy.value))})}},T=function(n){return function(n){return function(r){return new c.Show(function(t){var u=s.variantTags(n)(y.RLProxy.value),e=L(r)(y.RLProxy.value),o=s.lookup("show")(t.type)(u)(e)(t.value);return"(inj @"+c.show(c.showString)(t.type)+" "+o+")"})}}},b=new m(function(n){return i.Nil.value}),D=function(n){return function(r){return new m(function(t){return new i.Cons(a.compare(r),q(n)(y.RLProxy.value))})}},g=function(n){return function(n){return function(n){return function(n){return function(r){return function(t){return v.unsafeHas(t.type)(n)?v.unsafeGet(t.type)(n)(t.value):r(t)}}}}}},k=function(n){return function(n){return function(r){return function(t){return function(u){return function(e){return e.type===f.reflectSymbol(n)(r)?t(e.value):u(e)}}}}}},N=function(t){return function(u){return function(e){return function(i){return k(t)(u)(i)(n.pure(e.Applicative0()))(o.const(r.empty(e.Plus1())))}}}},O=function(n){return function(n){return function(r){return function(t){return{type:f.reflectSymbol(n)(r),value:t}}}}},U=function(n){return n(function(n){return function(r){return O(r)(n)}})},F=function(n){return x.unsafeCoerce},A=new P(function(n){return i.Nil.value}),W=function(n){return function(r){return new P(function(t){return new i.Cons(e.eq(r),h(n)(y.RLProxy.value))})}},G=function(n){return function(n){return function(r){return new e.Eq(function(t){return function(u){var e=s.variantTags(n)(y.RLProxy.value),o=h(r)(y.RLProxy.value);return s.lookupEq(e)(o)(t)(u)}})}}},H=function(n){return function(r){return function(t){return function(u){return new a.Ord(function(){return G(n)(r)(t)},function(n){return function(t){var e=s.variantTags(r)(y.RLProxy.value),o=q(u)(y.RLProxy.value);return s.lookupOrd(e)(o)(n)(t)}})}}}},I=function(n){return function(r){return function(t){return function(e){return function(o){return new u.Enum(function(){return H(n)(r)(t)(e)},function(n){var t=s.variantTags(r)(y.RLProxy.value),u=E(o)(y.RLProxy.value),e=j(o.VariantBounded0())(y.RLProxy.value);return s.lookupPred(n)(t)(e)(u)},function(n){var t=s.variantTags(r)(y.RLProxy.value),u=E(o)(y.RLProxy.value),e=j(o.VariantBounded0())(y.RLProxy.value);return s.lookupSucc(n)(t)(e)(u)})}}}}},M=function(n){return function(r){return n}},_=function(n){return function(r){return function(t){return s.contractWith(r)(n)(d.RProxy.value)(d.RProxy.value)(t.type)(t)}}},z=function(n){return l.unsafeCrashWith("Data.Variant: pattern match failure ["+n.type+"]")},J=function(n){return function(r){return function(t){return function(u){return g(n)(r)(t)(u)(z)}}}},K=new R(function(n){return i.Nil.value}),Q=new V(function(){return K},function(n){return i.Nil.value}),X=function(n){return function(r){return new R(function(u){var e={top:t.top(r),bottom:t.bottom(r)};return new i.Cons(e,j(n)(y.RLProxy.value))})}},Y=function(n){return function(r){return new V(function(){return X(n.VariantBounded0())(r.Bounded0())},function(t){var e={pred:u.pred(r.Enum1()),succ:u.succ(r.Enum1()),fromEnum:u.fromEnum(r),toEnum:u.toEnum(r),cardinality:u.cardinality(r)};return new i.Cons(e,E(n)(y.RLProxy.value))})}},Z=function(n){return function(r){return function(u){return function(e){return function(o){return new t.Bounded(function(){return H(n)(r)(u)(e)},(i=s.variantTags(r)(y.RLProxy.value),a=j(o)(y.RLProxy.value),s.VariantRep(s.lookupFirst("bottom")(function(n){return n.bottom})(i)(a))),function(){var n=s.variantTags(r)(y.RLProxy.value),t=j(o)(y.RLProxy.value);return s.VariantRep(s.lookupLast("top")(function(n){return n.top})(n)(t))}());var i,a}}}}},$=function(n){return function(r){return function(t){return function(e){return function(o){return new u.BoundedEnum(function(){return Z(n)(r)(t)(e)(o.VariantBounded0())},function(){return I(n)(r)(t)(e)(o)},u.Cardinality(s.lookupCardinality(E(o)(y.RLProxy.value))),function(n){var t=s.variantTags(r)(y.RLProxy.value),u=E(o)(y.RLProxy.value);return s.lookupFromEnum(n)(t)(u)},function(n){var t=s.variantTags(r)(y.RLProxy.value),u=E(o)(y.RLProxy.value);return s.lookupToEnum(n)(t)(u)})}}}}};module.exports={inj:O,prj:N,on:k,onMatch:g,case_:z,match:J,default:M,expand:F,contract:_,Unvariant:p,unvariant:B,revariant:U,VariantEqs:P,variantEqs:h,VariantOrds:m,variantOrds:q,VariantShows:w,variantShows:L,VariantBounded:R,variantBounded:j,VariantBoundedEnums:V,variantBoundedEnums:E,eqVariantNil:A,eqVariantCons:W,eqVariant:G,boundedVariantNil:K,boundedVariantCons:X,boundedVariant:Z,enumVariantNil:Q,enumVariantCons:Y,enumVariant:I,boundedEnumVariant:$,ordVariantNil:b,ordVariantCons:D,ordVariant:H,showVariantNil:C,showVariantCons:S,showVariant:T}; +},{"../Control.Applicative/index.js":"qYya","../Control.Plus/index.js":"oMBg","../Data.Bounded/index.js":"kcUU","../Data.Enum/index.js":"oOsU","../Data.Eq/index.js":"Pq4F","../Data.Function/index.js":"ImXJ","../Data.List.Types/index.js":"Xxuc","../Data.Ord/index.js":"r4Vb","../Data.Show/index.js":"mFY7","../Data.Symbol/index.js":"4oJQ","../Data.Variant.Internal/index.js":"kYoO","../Partial.Unsafe/index.js":"aoR+","../Record.Unsafe/index.js":"KG04","../Type.Data.Row/index.js":"ukdD","../Type.Data.RowList/index.js":"XaXP","../Unsafe.Coerce/index.js":"ETUV"}],"idq0":[function(require,module,exports) { +"use strict";var n=function(){var n={},r="Pure",e="Throw",t="Catch",u="Sync",i="Async",l="Bind",o="Bracket",f="Fork",c="Sequential",a="Map",s="Apply",_="Alt",h="Cons",w="Resume",p="Release",k="Finalizer",d="Finalized",v="Forked";function m(n,r,e,t){this.tag=n,this._1=r,this._2=e,this._3=t}function b(n){var r=function(r,e,t){return new m(n,r,e,t)};return r.tag=n,r}function g(n){return new m(r,void 0)}function y(n){try{n()}catch(r){setTimeout(function(){throw r},0)}}function A(n,r,e){try{return r(e())}catch(t){return n(t)}}function P(n,r,e){try{return r(e)()}catch(t){return e(n(t))(),g}}var x=function(){var n=1024,r=0,e=0,t=new Array(n),u=!1;function i(){var i;for(u=!0;0!==r;)r--,i=t[e],t[e]=void 0,e=(e+1)%n,i();u=!1}return{isDraining:function(){return u},enqueue:function(l){var o;r===n&&(o=u,i(),u=o),t[(e+r)%n]=l,r++,u||i()}}}();var L=0,S=1,F=2,T=3,R=4,B=5,C=6;function q(n,a,s){var _=0,v=L,b=s,g=null,E=null,M=null,I=null,z=null,D=0,j=0,Y=null,G=!0;function H(s){for(var j,J,K;;)switch(j=null,J=null,K=null,v){case F:v=S,b=M(b),null===I?M=null:(M=I._1,I=I._2);break;case T:n.isLeft(b)?(v=B,g=b,b=null):null===M?v=B:(v=F,b=n.fromRight(b));break;case S:switch(b.tag){case l:M&&(I=new m(h,M,I)),M=b._2,v=S,b=b._1;break;case r:null===M?(v=B,b=n.right(b._1)):(v=F,b=b._1);break;case u:v=T,b=A(n.left,n.right,b._1);break;case i:return v=R,void(b=P(n.left,b._1,function(n){return function(){_===s&&(_++,x.enqueue(function(){_===s+1&&(v=T,b=n,H(_))}))}}));case e:v=B,g=n.left(b._1),b=null;break;case t:z=new m(h,b,null===M?z:new m(h,new m(w,M,I),z,E),E),M=null,I=null,v=S,b=b._1;break;case o:D++,z=new m(h,b,null===M?z:new m(h,new m(w,M,I),z,E),E),M=null,I=null,v=S,b=b._1;break;case f:v=T,j=q(n,a,b._2),a&&a.register(j),b._1&&j.run(),b=n.right(j);break;case c:v=S,b=O(n,a,b._1)}break;case B:if(M=null,I=null,null===z)v=C,b=E||g||b;else switch(j=z._3,K=z._1,z=z._2,K.tag){case t:E&&E!==j&&0===D?v=B:g&&(v=S,b=K._2(n.fromLeft(g)),g=null);break;case w:E&&E!==j&&0===D||g?v=B:(M=K._1,I=K._2,v=F,b=n.fromRight(b));break;case o:D--,null===g&&(J=n.fromRight(b),z=new m(h,new m(p,K._2,J),z,j),(E===j||D>0)&&(v=S,b=K._3(J)));break;case p:z=new m(h,new m(d,b,g),z,E),v=S,b=E&&E!==j&&0===D?K._1.killed(n.fromLeft(E))(K._2):g?K._1.failed(n.fromLeft(g))(K._2):K._1.completed(n.fromRight(b))(K._2),g=null,D++;break;case k:D++,z=new m(h,new m(d,b,g),z,E),v=S,b=K._1;break;case d:D--,v=B,b=K._1,g=K._2}break;case C:for(var N in Y)Y.hasOwnProperty(N)&&(G=G&&Y[N].rethrow,y(Y[N].handler(b)));return Y=null,void(E&&g?setTimeout(function(){throw n.fromLeft(g)},0):n.isLeft(b)&&G&&setTimeout(function(){if(G)throw n.fromLeft(b)},0));case L:v=S;break;case R:return}}function J(n){return function(){if(v===C)return G=G&&n.rethrow,n.handler(b)(),function(){};var r=j++;return(Y=Y||{})[r]=n,function(){null!==Y&&delete Y[r]}}}return{kill:function(r,e){return function(){if(v===C)return e(n.right(void 0))(),function(){};var t=J({rethrow:!1,handler:function(){return e(n.right(void 0))}})();switch(v){case L:E=n.left(r),v=C,b=E,H(_);break;case R:null===E&&(E=n.left(r)),0===D&&(v===R&&(z=new m(h,new m(k,b(r)),z,E)),v=B,b=null,g=null,H(++_));break;default:null===E&&(E=n.left(r)),0===D&&(v=B,b=null,g=null)}return t}},join:function(n){return function(){var r=J({rethrow:!1,handler:n})();return v===L&&H(_),r}},onComplete:J,isSuspended:function(){return v===L},run:function(){v===L&&(x.isDraining()?H(_):x.enqueue(function(){H(_)}))}}}function E(r,e,t,u){var l=0,o={},f=0,c={},w=new Error("[ParAff] Early exit"),p=null,k=n;function d(e,t,u){var i,l,f=t,c=null,w=null,p=0,k={};n:for(;;)switch(i=null,f.tag){case v:if(f._3===n&&(i=o[f._1],k[p++]=i.kill(e,function(n){return function(){0===--p&&u(n)()}})),null===c)break n;f=c._2,null===w?c=null:(c=w._1,w=w._2);break;case a:f=f._2;break;case s:case _:c&&(w=new m(h,c,w)),c=f,f=f._1}if(0===p)u(r.right(void 0))();else for(l=0,i=p;l=f)return o;if(t)for(var c=i[Symbol.iterator](),a=u;;--a){var p=c.next();if(p.done)return o;if(0===a)return r(e(p.value))}return n(u)(i)}}}}}},exports._countPrefix=function(n){return function(r){return t?function(n){return function(t){for(var o=t[Symbol.iterator](),e=0;;++e){var u=o.next();if(u.done)return e;var i=r(u.value);if(!n(i))return e}}}:n}},exports._fromCodePointArray=function(n){return r?function(t){return t.length<1e4?String.fromCodePoint.apply(String,t):t.map(n).join("")}:function(t){return t.map(n).join("")}},exports._singleton=function(n){return r?String.fromCodePoint:n},exports._take=function(n){return function(r){return t?function(n){for(var t="",o=n[Symbol.iterator](),e=0;e1){var t=u.fromEnum(u.boundedEnumChar)(h.charAt(1)(n));return b(t)?g(r)(t):r}return r},j=n._unsafeCodePointAt0(D),A=n._toCodePointArray(P)(j),y=function(n){return r.length(A(n))},J=function(n){return function(r){return a.map(d.functorMaybe)(function(n){return y(s.take(n)(r))})(s.lastIndexOf(n)(r))}},O=function(n){return function(r){return a.map(d.functorMaybe)(function(n){return y(s.take(n)(r))})(s.indexOf(n)(r))}},I=function(){var n=u.toEnumWithDefaults(u.boundedEnumChar)(e.bottom(e.boundedChar))(e.top(e.boundedChar));return function(r){return s.singleton(n(r))}}(),S=function(n){if(n<=65535)return I(n);var r=i.div(i.euclideanRingInt)(n-65536|0)(1024)+55296|0,t=i.mod(i.euclideanRingInt)(n-65536|0)(1024)+56320|0;return I(r)+I(t)},k=n._fromCodePointArray(S),_=n._singleton(S),M=function n(r){return function(t){if(r<1)return"";var e=q(t);return e instanceof d.Just?_(e.value0.head)+n(r-1|0)(e.value0.tail):t}},N=n._take(M),B=function(n){return function(r){return function(t){var e=s.length(N(r)(t));return a.map(d.functorMaybe)(function(n){return y(s.take(n)(t))})(s["lastIndexOf'"](n)(e)(t))}}},U=function(n){return function(r){var t=N(n)(r);return{before:t,after:s.drop(s.length(t))(r)}}},F=new o.Eq(function(n){return function(r){return n===r}}),R=new c.Ord(function(){return F},function(n){return function(r){return c.compare(c.ordInt)(n)(r)}}),W=function(n){return function(r){return s.drop(s.length(N(n)(r)))(r)}},T=function(n){return function(r){return function(t){var e=W(r)(t);return a.map(d.functorMaybe)(function(n){return r+y(s.take(n)(e))|0})(s.indexOf(n)(e))}}},z=function(n){return function(r){return function(t){var e,u,o,i,a=n,f=r,c=!1;for(;!c;)u=a,o=t,i=void 0,e=(i=q(f))instanceof d.Just&&u(i.value0.head)?(a=u,f=i.value0.tail,void(t=o+1|0)):(c=!0,o);return e}}},G=function(n){return function(r){return z(n)(r)(0)}},H=n._countPrefix(G)(j),K=function(n){return function(r){return W(H(n)(r))(r)}},L=function(n){return function(r){return N(H(n)(r))(r)}},Q=function(){var n=u.fromEnum(u.boundedEnumChar);return function(r){return E(n(r))}}(),V=function(n){return function(r){var t,e,u,o=n,i=!1;for(;!i;)e=o,u=void 0,t=(u=q(r))instanceof d.Just?0===e?(i=!0,new d.Just(u.value0.head)):(o=e-1|0,void(r=u.value0.tail)):(i=!0,d.Nothing.value);return t}},X=function(r){return function(t){return r<0?d.Nothing.value:0===r&&""===t?d.Nothing.value:0===r?new d.Just(j(t)):n._codePointAt(V)(d.Just.create)(d.Nothing.value)(j)(r)(t)}},Y=new e.Bounded(function(){return R},0,1114111),Z=new u.BoundedEnum(function(){return Y},function(){return $},1114112,function(n){return n},function(n){if(n>=0&&n<=1114111)return new d.Just(n);if(t.otherwise)return d.Nothing.value;throw new Error("Failed pattern match at Data.String.CodePoints (line 63, column 1 - line 68, column 26): "+[n.constructor.name])}),$=new u.Enum(function(){return R},u.defaultPred(u.toEnum(Z))(u.fromEnum(Z)),u.defaultSucc(u.toEnum(Z))(u.fromEnum(Z)));module.exports={codePointFromChar:Q,singleton:_,fromCodePointArray:k,toCodePointArray:A,codePointAt:X,uncons:q,length:y,countPrefix:H,indexOf:O,"indexOf'":T,lastIndexOf:J,"lastIndexOf'":B,take:N,takeWhile:L,drop:W,dropWhile:K,splitAt:U,eqCodePoint:F,ordCodePoint:R,showCodePoint:C,boundedCodePoint:Y,enumCodePoint:$,boundedEnumCodePoint:Z}; +},{"./foreign.js":"t65A","../Data.Array/index.js":"4t4C","../Data.Boolean/index.js":"ObQr","../Data.Bounded/index.js":"kcUU","../Data.Enum/index.js":"oOsU","../Data.Eq/index.js":"Pq4F","../Data.EuclideanRing/index.js":"2IRB","../Data.Functor/index.js":"+0AE","../Data.Int/index.js":"xNJb","../Data.Maybe/index.js":"5mN7","../Data.Ord/index.js":"r4Vb","../Data.Show/index.js":"mFY7","../Data.String.CodeUnits/index.js":"6c6X","../Data.String.Common/index.js":"OSrc","../Data.String.Unsafe/index.js":"5UWM","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z"}],"rsyP":[function(require,module,exports) { +"use strict";exports["showRegex'"]=function(n){return""+n},exports["regex'"]=function(n){return function(r){return function(t){return function(e){try{return r(new RegExp(t,e))}catch(u){return n(u.message)}}}}},exports.source=function(n){return n.source},exports["flags'"]=function(n){return{multiline:n.multiline,ignoreCase:n.ignoreCase,global:n.global,sticky:!!n.sticky,unicode:!!n.unicode}},exports.test=function(n){return function(r){var t=n.lastIndex,e=n.test(r);return n.lastIndex=t,e}},exports._match=function(n){return function(r){return function(t){return function(e){var u=e.match(t);if(null==u||0===u.length)return r;for(var o=0;o ")(o)+")"}),d=new a.Semigroup(function(e){return function(i){return new l({global:e.value0.global||i.value0.global,ignoreCase:e.value0.ignoreCase||i.value0.ignoreCase,multiline:e.value0.multiline||i.value0.multiline,sticky:e.value0.sticky||i.value0.sticky,unicode:e.value0.unicode||i.value0.unicode})}}),c=new l({global:!1,ignoreCase:!1,multiline:!1,sticky:!1,unicode:!1}),v=new l({global:!1,ignoreCase:!1,multiline:!0,sticky:!1,unicode:!1}),m=new r.Monoid(function(){return d},c),y=new l({global:!1,ignoreCase:!0,multiline:!1,sticky:!1,unicode:!1}),f=new l({global:!0,ignoreCase:!1,multiline:!1,sticky:!1,unicode:!1}),p=new i.Eq(function(e){return function(i){return e.value0.global===i.value0.global&&e.value0.ignoreCase===i.value0.ignoreCase&&e.value0.multiline===i.value0.multiline&&e.value0.sticky===i.value0.sticky&&e.value0.unicode===i.value0.unicode}});module.exports={RegexFlags:l,noFlags:c,global:f,ignoreCase:y,multiline:v,sticky:g,unicode:t,semigroupRegexFlags:d,monoidRegexFlags:m,eqRegexFlags:p,showRegexFlags:s}; +},{"../Control.MonadZero/index.js":"lD5R","../Data.Eq/index.js":"Pq4F","../Data.Functor/index.js":"+0AE","../Data.Monoid/index.js":"TiEB","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7","../Data.String.Common/index.js":"OSrc"}],"lBFq":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),t=require("../Data.Either/index.js"),a=require("../Data.Maybe/index.js"),r=require("../Data.Show/index.js"),n=require("../Data.String.CodeUnits/index.js"),i=require("../Data.String.Regex.Flags/index.js"),s=new r.Show(e["showRegex'"]),u=e._search(a.Just.create)(a.Nothing.value),c=function(e){return(e.value0.global?"g":"")+(e.value0.ignoreCase?"i":"")+(e.value0.multiline?"m":"")+(e.value0.sticky?"y":"")+(e.value0.unicode?"u":"")},l=function(a){return function(r){return e["regex'"](t.Left.create)(t.Right.create)(a)(c(r))}},o=function(e){return new i.RegexFlags({global:n.contains("g")(e),ignoreCase:n.contains("i")(e),multiline:n.contains("m")(e),sticky:n.contains("y")(e),unicode:n.contains("u")(e)})},g=e._match(a.Just.create)(a.Nothing.value),x=function(t){return i.RegexFlags.create(e["flags'"](t))};module.exports={regex:l,flags:x,renderFlags:c,parseFlags:o,match:g,search:u,showRegex:s,source:e.source,test:e.test,replace:e.replace,"replace'":e["replace'"],split:e.split}; +},{"./foreign.js":"rsyP","../Data.Either/index.js":"B2JL","../Data.Maybe/index.js":"5mN7","../Data.Show/index.js":"mFY7","../Data.String.CodeUnits/index.js":"6c6X","../Data.String.Regex.Flags/index.js":"W1/V"}],"f3ma":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Bind/index.js"),t=require("../Data.Array.NonEmpty/index.js"),e=require("../Data.Boolean/index.js"),u=require("../Data.Either/index.js"),o=require("../Data.Eq/index.js"),i=require("../Data.Foldable/index.js"),a=require("../Data.Function/index.js"),c=require("../Data.Functor/index.js"),f=require("../Data.Int/index.js"),l=require("../Data.Maybe/index.js"),s=require("../Data.Ord/index.js"),v=require("../Data.Show/index.js"),m=require("../Data.String.CodePoints/index.js"),b=require("../Data.String.Regex/index.js"),h=require("../Math/index.js"),d=function(n){return n},w=function(){function n(){}return n.value=new n,n}(),g=function(){function n(){}return n.value=new n,n}(),p=function(){function n(){}return n.value=new n,n}(),x=function(){function n(){}return n.value=new n,n}(),y=function(){function n(n,r,t,e){this.value0=n,this.value1=r,this.value2=t,this.value3=e}return n.create=function(r){return function(t){return function(e){return function(u){return new n(r,t,e,u)}}}},n}(),q=function(n){return function(r){return h.remainder(h.remainder(n)(r)+r)(r)}},j=function(n){return function(r){return function(t){return function(u){var o=s.clamp(s.ordInt)(0)(255)(n),i=f.toNumber(o)/255,a=s.clamp(s.ordInt)(0)(255)(r),c=f.toNumber(a)/255,l=s.clamp(s.ordInt)(0)(255)(t),v=s.max(s.ordInt)(s.max(s.ordInt)(o)(a))(l),m=s.min(s.ordInt)(s.min(s.ordInt)(o)(a))(l),b=v-m|0,d=f.toNumber(b)/255,w=f.toNumber(v+m|0)/510,g=function(){if(0===b)return 0;if(e.otherwise)return d/(1-h.abs(2*w-1));throw new Error("Failed pattern match at Color (line 157, column 5 - line 158, column 75): "+[])}(),p=f.toNumber(l)/255,x=60*function(n){if(0===n)return 0;if(v===o)return q((c-p)/d)(6);if(v===a)return(p-i)/d+2;if(e.otherwise)return(i-c)/d+4;throw new Error("Failed pattern match at Color (line 148, column 5 - line 148, column 17): "+[n.constructor.name])}(b);return new y(x,g,w,u)}}}},C=function(n){return function(r){return function(t){return j(n)(r)(t)(1)}}},I=function(n){return function(r){return function(t){return function(e){return j(f.round(255*n))(f.round(255*r))(f.round(255*t))(e)}}}},M=function(n){return function(r){return function(t){return I(n)(r)(t)(1)}}},N=function(n){return function(r){return function(t){var u=function(n){if(n<=.0031308)return 12.92*n;if(e.otherwise)return 1.055*h.pow(n)(1/2.4)-.055;throw new Error("Failed pattern match at Color (line 224, column 5 - line 225, column 65): "+[n.constructor.name])},o=u(-.9689*n+1.8758*r+.0415*t),i=u(3.2406*n-1.5372*r-.4986*t),a=u(.0557*n-.204*r+1.057*t);return M(i)(o)(a)}}},E=function(n){return function(r){return function(t){return r+n*(t-r)}}},F=function(n){return function(r){return function(t){var e=[{from:r,to:t},{from:r,to:t+360},{from:r+360,to:t}],u=l.fromJust()(i.minimumBy(i.foldableArray)(s.comparing(s.ordNumber)(function(n){return h.abs(n.to-n.from)}))(e));return E(n)(u.from)(u.to)}}},S=function(n){return function(r){return function(t){var e=h.pi/180,u=t.value1-r.value1,o=t.value2-r.value2,i=(r.value0+120)*e,a=(t.value0+120)*e-i;return function(e){var c=h.pow(r.value2+o*e)(n),f=i+a*e,l=(r.value1+u*e)*c*(1-c),s=c+l*(1.97294*h.cos(f)),v=c+l*(-.29227*h.cos(f)-.90649*h.sin(f)),m=c+l*(-.14861*h.cos(f)+1.78277*h.sin(f)),b=E(e)(r.value3)(t.value3);return I(m)(v)(s)(b)}}}},D=function(n){return function(r){return function(t){return function(e){var u=s.clamp(s.ordNumber)(0)(1)(r),o=s.clamp(s.ordNumber)(0)(1)(t),i=s.clamp(s.ordNumber)(0)(1)(e);return new y(n,u,o,i)}}}},A=function(n){return function(r){return function(t){return function(e){var u=r;if(0===t)return D(n)(u/(2-u))(0)(e);if(0===r&&1===t)return D(n)(0)(1)(e);var o=(2-r)*t,i=(u=r*t/(o<1?o:2-o),o/2);return D(n)(u)(i)(e)}}}},L=function(n){return function(r){return function(t){return A(n)(r)(t)(1)}}},B=function(n){return function(r){return D(r.value0)(r.value1)(r.value2+n)(r.value3)}},H=function(n){return function(r){return D(r.value0+n)(r.value1)(r.value2)(r.value3)}},z=function(n){return function(r){return D(r.value0)(r.value1+n)(r.value2)(r.value3)}},R=function(n){return function(r){return function(t){return D(n)(r)(t)(1)}}},G=R(0)(0)(1),k=function(n){return R(0)(0)(n)},J=function(n){var r=s.clamp(s.ordInt)(0)(16777215)(n),t=r>>8&255,e=255&r;return C(r>>16&255)(t)(e)},O=function(e){var o,i,s=(o=l.fromMaybe(0),i=f.fromStringAs(f.hexadecimal),function(n){return o(i(n))}),v=4===m.length(e),h=u.either(a.const(l.Nothing.value))(l.Just.create),d="([0-9a-f][0-9a-f])",w=v?"([0-9a-f])([0-9a-f])([0-9a-f])":d+(d+d),g=b.regex("^#(?:"+w+")$")(b.parseFlags("i"));return r.bind(l.bindMaybe)(h(g))(function(u){return r.bind(l.bindMaybe)(b.match(u)(e))(function(e){return r.bind(l.bindMaybe)(c.map(l.functorMaybe)(s)(r.join(l.bindMaybe)(t.index(e)(1))))(function(u){return r.bind(l.bindMaybe)(c.map(l.functorMaybe)(s)(r.join(l.bindMaybe)(t.index(e)(2))))(function(o){return r.bind(l.bindMaybe)(c.map(l.functorMaybe)(s)(r.join(l.bindMaybe)(t.index(e)(3))))(function(r){return v?n.pure(l.applicativeMaybe)(C((16*u|0)+u|0)((16*o|0)+o|0)((16*r|0)+r|0)):n.pure(l.applicativeMaybe)(C(u)(o)(r))})})})})})},P=function(n){return z(-n)},V=function(n){return B(-n)},X={xn:.95047,yn:1,zn:1.08883},Y=function(n){return function(r){return function(t){var u=(n+16)/116,o=function(n){if(n>6/29)return h.pow(n)(3);if(e.otherwise)return 6/29*3*(6/29)*(n-4/29);throw new Error("Failed pattern match at Color (line 249, column 5 - line 250, column 64): "+[n.constructor.name])},i=X.xn*o(u+r/500),a=X.yn*o(u),c=X.zn*o(u-t/200);return N(i)(a)(c)}}},Z=function(n){return function(r){return function(t){var e=h.pi/180,u=r*h.sin(t*e),o=r*h.cos(t*e);return Y(n)(o)(u)}}},$=function(n){var r=function(n){return v.show(v.showNumber)(f.toNumber(f.round(100*n))/100)},t=r(100*n.value1)+"%",e=r(100*n.value2)+"%",u=r(n.value0),o=v.show(v.showNumber)(n.value3);return 1===n.value3?"hsl("+u+", "+t+", "+e+")":"hsla("+u+", "+t+", "+e+", "+o+")"},K=H(180),Q=function(n){return 360===n?n:q(n)(360)},T=function(n){return{h:Q(n.value0),s:n.value1,l:n.value2,a:n.value3}},U=function(n){var r=n.value1;if(0===n.value2)return{h:Q(n.value0),s:2*r/(1+r),v:0,a:n.value3};if(0===n.value1&&1===n.value2)return{h:Q(n.value0),s:0,v:1,a:n.value3};var t=n.value1*(n.value2<.5?n.value2:1-n.value2),e=n.value2+t;r=2*t/(n.value2+t);return{h:Q(n.value0),s:r,v:e,a:n.value3}},W=function(n){var r=Q(n.value0)/60,t=(1-h.abs(2*n.value2-1))*n.value1,u=n.value2-t/2,o=t*(1-h.abs(h.remainder(r)(2)-1)),i=function(){if(r<1)return{r:t,g:o,b:0};if(1<=r&&r<2)return{r:o,g:t,b:0};if(2<=r&&r<3)return{r:0,g:t,b:o};if(3<=r&&r<4)return{r:0,g:o,b:t};if(4<=r&&r<5)return{r:o,g:0,b:t};if(e.otherwise)return{r:t,g:0,b:o};throw new Error("Failed pattern match at Color (line 342, column 5 - line 347, column 61): "+[])}();return{r:i.r+u,g:i.g+u,b:i.b+u,a:n.value3}},_=function(n){var r=W(n),t=function(n){if(n<=.03928)return n/12.92;if(e.otherwise)return h.pow((n+.055)/1.055)(2.4);throw new Error("Failed pattern match at Color (line 604, column 9 - line 605, column 61): "+[n.constructor.name])},u=t(r.g);return.2126*t(r.r)+.7152*u+.0722*t(r.b)},nn=function(n){return function(r){var t=_(r),e=_(n);return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)}},rn=function(n){return function(r){return nn(n)(r)>4.5}},tn=function(n){var r=W(n),t=f.round(255*r.g);return{r:f.round(255*r.r),g:t,b:f.round(255*r.b),a:r.a}},en=function(n){var r=tn(n),t=v.show(v.showInt)(r.g),e=v.show(v.showInt)(r.r),u=v.show(v.showInt)(r.b),o=v.show(v.showNumber)(r.a);return 1===r.a?"rgb("+e+", "+t+", "+u+")":"rgba("+e+", "+t+", "+u+", "+o+")"},un=new o.Eq(function(n){return function(r){var t=tn(r),e=tn(n);return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}}),on=new v.Show(function(n){var r=tn(n);return"rgba "+v.show(v.showInt)(r.r)+" "+v.show(v.showInt)(r.g)+" "+v.show(v.showInt)(r.b)+" "+v.show(v.showNumber)(r.a)}),an=function(n){var r=function(n){var r=f.toStringAs(f.hexadecimal)(n);return 1===m.length(r)?"0"+r:r},t=tn(n);return"#"+(r(t.r)+(r(t.g)+r(t.b)))},cn=function(n){var r=W(n),t=function(n){if(n<=.04045)return n/12.92;if(e.otherwise)return h.pow((n+.055)/1.055)(2.4);throw new Error("Failed pattern match at Color (line 366, column 5 - line 367, column 63): "+[n.constructor.name])},u=t(r.g),o=t(r.r),i=t(r.b);return{x:.4124*o+.3576*u+.1805*i,y:.2126*o+.7152*u+.0722*i,z:.0193*o+.1192*u+.9505*i}},fn=function(n){var r=cn(n),t=h.pow(6/29)(3),u=function(n){if(n>t)return h.pow(n)(1/3);if(e.otherwise)return 1/3*h.pow(29/6)(2)*n+4/29;throw new Error("Failed pattern match at Color (line 384, column 5 - line 385, column 76): "+[n.constructor.name])},o=u(r.y/X.yn),i=116*o-16,a=200*(o-u(r.z/X.zn));return{l:i,a:500*(u(r.x/X.xn)-o),b:a}},ln=function(n){return function(r){var t=function(n){return h.pow(n)(2)},e=fn(r),u=fn(n);return h.sqrt(t(u.l-e.l)+t(u.a-e.a)+t(u.b-e.b))}},sn=function(n){var r=fn(n),t=180/h.pi,e=h.sqrt(r.a*r.a+r.b*r.b),u=q(h.atan2(r.b)(r.a)*t)(360);return{l:r.l,c:e,h:u}},vn=function(n){return function(r){return function(t){return function(e){if(n instanceof g){var u=T(t),o=T(r);return D(F(e)(o.h)(u.h))(E(e)(o.s)(u.s))(E(e)(o.l)(u.l))(E(e)(o.a)(u.a))}if(n instanceof w){u=W(t),o=W(r);return I(E(e)(o.r)(u.r))(E(e)(o.g)(u.g))(E(e)(o.b)(u.b))(E(e)(o.a)(u.a))}if(n instanceof p){u=sn(t),o=sn(r);return Z(E(e)(o.l)(u.l))(E(e)(o.c)(u.c))(F(e)(o.h)(u.h))}if(n instanceof x){u=fn(t),o=fn(r);return Y(E(e)(o.l)(u.l))(E(e)(o.a)(u.a))(E(e)(o.b)(u.b))}throw new Error("Failed pattern match at Color (line 520, column 1 - line 520, column 34): "+[n.constructor.name,r.constructor.name,t.constructor.name,e.constructor.name])}}}},mn=function(n){var r=sn(n);return P(1)(Z(r.l)(0)(0))},bn=function(n){var r=W(n);return(299*r.r+587*r.g+114*r.b)/1e3},hn=function(n){return bn(n)>.5},dn=R(0)(0)(0),wn=function(n){if(hn(n))return dn;if(e.otherwise)return G;throw new Error("Failed pattern match at Color (line 643, column 1 - line 643, column 28): "+[n.constructor.name])};module.exports={RGB:w,HSL:g,LCh:p,Lab:x,rgba:j,rgb:C,"rgba'":I,"rgb'":M,hsla:D,hsl:R,hsva:A,hsv:L,xyz:N,lab:Y,lch:Z,fromHexString:O,fromInt:J,toHSLA:T,toHSVA:U,toRGBA:tn,"toRGBA'":W,toXYZ:cn,toLab:fn,toLCh:sn,toHexString:an,cssStringHSLA:$,cssStringRGBA:en,black:dn,white:G,graytone:k,rotateHue:H,complementary:K,lighten:B,darken:V,saturate:z,desaturate:P,toGray:mn,mix:vn,mixCubehelix:S,brightness:bn,luminance:_,contrast:nn,isLight:hn,isReadable:rn,textColor:wn,distance:ln,showColor:on,eqColor:un}; +},{"../Control.Applicative/index.js":"qYya","../Control.Bind/index.js":"7VcT","../Data.Array.NonEmpty/index.js":"eTKN","../Data.Boolean/index.js":"ObQr","../Data.Either/index.js":"B2JL","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Int/index.js":"xNJb","../Data.Maybe/index.js":"5mN7","../Data.Ord/index.js":"r4Vb","../Data.Show/index.js":"mFY7","../Data.String.CodePoints/index.js":"mAJY","../Data.String.Regex/index.js":"lBFq","../Math/index.js":"Rpaz"}],"rp+n":[function(require,module,exports) { +"use strict";var r=require("../Color/index.js"),o=r.fromInt(16768e3),n=r.fromInt(3787980),t=r.fromInt(14540253),m=r.fromInt(16728374),e=r.fromInt(11603401),f=r.fromInt(16745755),I=r.fromInt(4036976),l=r.fromInt(7999),a=r.fromInt(8721483),i=r.fromInt(130928),u=r.fromInt(3066944),s=r.fromInt(11184810),v=r.fromInt(15733438),c=r.fromInt(29913),d=r.fromInt(1118481),g=r.fromInt(8379391);module.exports={navy:l,blue:c,aqua:g,teal:n,olive:I,green:u,lime:i,yellow:o,orange:f,red:m,maroon:a,fuchsia:v,purple:e,"black'":d,gray:s,silver:t}; +},{"../Color/index.js":"f3ma"}],"BG0s":[function(require,module,exports) { +function t(t){return function(o){return function(e){return t.apply(e,[o])}}}exports.toPrecisionNative=t(Number.prototype.toPrecision),exports.toFixedNative=t(Number.prototype.toFixed),exports.toExponentialNative=t(Number.prototype.toExponential),exports.toString=function(t){return t.toString()}; +},{}],"VX77":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),t=require("../Data.Ord/index.js"),e=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}(),r=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}(),i=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}(),u=function(t){if(t instanceof e)return n.toPrecisionNative(t.value0);if(t instanceof r)return n.toFixedNative(t.value0);if(t instanceof i)return n.toExponentialNative(t.value0);throw new Error("Failed pattern match at Data.Number.Format (line 59, column 1 - line 59, column 40): "+[t.constructor.name])},o=function(){var n=t.clamp(t.ordInt)(1)(21);return function(t){return e.create(n(t))}}(),a=function(){var n=t.clamp(t.ordInt)(0)(20);return function(t){return r.create(n(t))}}(),c=function(){var n=t.clamp(t.ordInt)(0)(20);return function(t){return i.create(n(t))}}();module.exports={precision:o,fixed:a,exponential:c,toStringWith:u,toString:n.toString}; +},{"./foreign.js":"BG0s","../Data.Ord/index.js":"r4Vb"}],"KkC9":[function(require,module,exports) { +"use strict";exports.unsafeCreateElementImpl=function(e,t,n){var o=document.createElement(e);return o.id=t,o.className=n,o},exports.initializeCanvasImpl=function(e,t){e.width=t.width,e.height=t.height;var n=e.getContext("2d");!0===n.imageSmoothingEnabled&&(n.imageSmoothingEnabled=!1)},exports.setElementStyleImpl=function(e,t,n){e.style[t]=n},exports.appendElem=function(e){return function(t){return function(){e.appendChild(t)}}},exports.setContainerStyle=function(e){return function(t){return function(){e.style.position="relative",e.style.border="1px solid black",e.style.display="block",e.style.margin="0",e.style.padding="0",e.style.width=t.width-2+"px",e.style.height=t.height+"px"}}},exports.drawCopies=function(e,t,n,o,i){Math.round(t.width),Math.round(t.height);i.forEach(function(i){o(i)&&n.drawImage(e,Math.floor(i.x-t.width/2),Math.floor(i.y-t.height/2))})},exports.setCanvasTranslation=function(e){return function(t){return function(){t.getContext("2d").setTransform(1,0,0,1,e.x,e.y)}}},exports.elementClickImpl=function(e,t){e.addEventListener("mousedown",function(n){var o=e.getBoundingClientRect(),i=n.clientX-o.left+window.scrollX,r=n.clientY-o.top+window.scrollY;t({x:i,y:r})()})},exports.scrollCanvasImpl=function(e,t,n){var o=e.getContext("2d");o.save(),o.globalCompositeOperation="copy",o.drawImage(t,0,0),o.restore();var i=t.getContext("2d");i.save(),i.globalCompositeOperation="copy",i.setTransform(1,0,0,1,0,0),i.drawImage(e,n.x,n.y),i.restore()},exports.zoomCanvasImpl=function(e,t,n){var o=e.getContext("2d");o.save(),o.globalCompositeOperation="copy",o.drawImage(t,0,0),o.restore();var i=t.getContext("2d"),r=t.width,a=t.height,l=n.left*r,s=(n.right-n.left)*r;i.save(),i.globalCompositeOperation="copy",i.setTransform(1,0,0,1,0,0),i.drawImage(e,l,0,s,a,0,0,r,a),i.restore()},exports.canvasDragImpl=function(e){return function(t){return function(){var n=function(e){var n=e.clientX,o=e.clientY,i=e.clientX,r=e.clientY,a=function(e){t({during:{x:i-e.clientX,y:r-e.clientY}})(),i=e.clientX,r=e.clientY};document.addEventListener("mousemove",a),document.addEventListener("mouseup",function(e){document.removeEventListener("mousemove",a),t({total:{x:e.clientX-n,y:e.clientY-o}})()},{once:!0})};return e.addEventListener("mousedown",n),function(){e.removeEventListener("mousedown",n)}}}},exports.canvasWheelCBImpl=function(e){return function(t){return function(){e.addEventListener("wheel",function(n){n.preventDefault();var o=e.getBoundingClientRect(),i=n.clientX-o.left+window.scrollX,r=n.clientY-o.top+window.scrollY;t({x:i,y:r})(Math.sign(n.deltaY))()})}}}; +},{}],"fCig":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),t=require("../Control.Category/index.js"),e=require("../Data.Either/index.js"),u=require("../Data.Eq/index.js"),i=require("../Data.Foldable/index.js"),o=require("../Data.Function/index.js"),f=require("../Data.Functor/index.js"),c=require("../Data.HeytingAlgebra/index.js"),a=require("../Data.Lens.Internal.Forget/index.js"),p=require("../Data.Lens.Internal.Indexed/index.js"),d=require("../Data.List.Types/index.js"),l=require("../Data.Maybe/index.js"),s=require("../Data.Maybe.First/index.js"),y=require("../Data.Maybe.Last/index.js"),w=require("../Data.Monoid/index.js"),v=require("../Data.Monoid.Additive/index.js"),j=require("../Data.Monoid.Conj/index.js"),D=require("../Data.Monoid.Disj/index.js"),q=require("../Data.Monoid.Dual/index.js"),x=require("../Data.Monoid.Endo/index.js"),g=require("../Data.Monoid.Multiplicative/index.js"),O=require("../Data.Newtype/index.js"),m=require("../Data.Ord/index.js"),F=require("../Data.Profunctor/index.js"),h=require("../Data.Profunctor.Choice/index.js"),M=require("../Data.Semigroup/index.js"),A=require("../Data.Tuple/index.js"),E=require("../Data.Unit/index.js"),C=function(n){return function(r){return function(t){var e,u=(e=l.maybe(w.mempty(n))(function(r){return M.append(n.Semigroup0())(O.unwrap(a.newtypeForget)(t)(r.value0))(u(r.value1))}),function(n){return e(r(n))});return u}}},b=function(n){return function(r){return function(t){return function r(t){return function(e){return 0===t?w.mempty(w.monoidFn(n)):M.append(M.semigroupFn(n.Semigroup0()))(e)(r(t-1|0)(e))}}(r)(t)}}},L=function(n){return function(r){return O.unwrap(a.newtypeForget)(n(p.Indexed(A.uncurry(r))))}},J=function(n){return function(r){return function(t){var e=o.flip(O.unwrap(O.newtypeEndo))(t),u=O.unwrap(O.newtypeDual),i=L(n)(function(n){var t=o.flip(r(n));return function(n){return q.Dual(x.Endo(t(n)))}});return function(n){return e(u(i(n)))}}}},N=function(n){return function(r){return function(t){var e=o.flip(O.unwrap(O.newtypeEndo))(t),u=L(n)(function(n){var t=r(n);return function(n){return x.Endo(t(n))}});return function(n){return e(u(n))}}}},S=function(n){return N(n)(function(n){return function(r){return function(t){return new d.Cons(new A.Tuple(n,r),t)}}})(d.Nil.value)},T=function(t){return function(e){return function(u){return N(e)(function(n){return function(e){return function(i){return r.applySecond(t.Apply0())(f.void(t.Apply0().Functor0())(u(n)(e)))(i)}}})(n.pure(t)(E.unit))}}},I=function(n){var r=T(n);return function(n){return o.flip(r(n))}},P=function(n){return function(r){return N(n)(function(n){return function(t){return l.maybe(r(n)(t)?new l.Just(t):l.Nothing.value)(l.Just.create)}})(l.Nothing.value)}},_=function(n){return function(n){return function(r){var t=O.unwrap(O.newtypeDisj),e=L(n)(function(n){var t=r(n);return function(n){return D.Disj(t(n))}});return function(n){return t(e(n))}}}},B=function(n){return function(n){return function(r){var t=O.unwrap(O.newtypeConj),e=L(n)(function(n){var t=r(n);return function(n){return j.Conj(t(n))}});return function(n){return t(e(n))}}}},H=function(n){return function(r){return function(t){return i.foldMap(r)(n)(t)}}},R=O.under(a.newtypeForget)(a.newtypeForget)(a.Forget),U=function(n){return R(n)(t.identity(t.categoryFn))},k=function(n){return function(r){return function(t){var e,u=o.flip(O.unwrap(O.newtypeEndo))(t),i=O.unwrap(O.newtypeDual),f=R(n)((e=o.flip(r),function(n){return q.Dual(x.Endo(e(n)))}));return function(n){return u(i(f(n)))}}}},z=function(n){return function(r){return function(t){var e=o.flip(O.unwrap(O.newtypeEndo))(t),u=R(n)(function(n){return x.Endo(r(n))});return function(n){return e(u(n))}}}},G=function(n){return function(r){return z(r)(function(r){var t=l.maybe(r)(function(r){return function(t){return m.greaterThan(n)(r)(t)?r:t}}(r));return function(n){return l.Just.create(t(n))}})(l.Nothing.value)}},K=function(n){return function(r){return z(r)(function(r){var t=l.maybe(r)(function(r){return function(t){return m.lessThan(n)(r)(t)?r:t}}(r));return function(n){return l.Just.create(t(n))}})(l.Nothing.value)}},Q=function(n){return z(n)(d.Cons.create)(d.Nil.value)},V=function(n){return function(r){return Q(r)(n)}},W=function(t){return function(e){return function(u){return z(e)(function(n){return function(e){return r.applySecond(t.Apply0())(f.void(t.Apply0().Functor0())(u(n)))(e)}})(n.pure(t)(E.unit))}}},X=function(n){return function(r){var t=O.unwrap(O.newtypeDisj),e=R(r)(o.const(c.tt(n)));return function(n){return t(e(n))}}},Y=function(n){return function(r){var t=O.unwrap(O.newtypeConj),e=R(r)(o.const(c.ff(n)));return function(n){return t(e(n))}}},Z=function(n){var r=O.unwrap(y.newtypeLast),t=R(n)(function(n){return y.Last(l.Just.create(n))});return function(n){return r(t(n))}},$=function(n){var r=O.unwrap(O.newtypeAdditive),t=R(n)(o.const(1));return function(n){return r(t(n))}},nn=function(n){var r=O.unwrap(s.newtypeFirst),t=R(n)(function(n){return s.First(l.Just.create(n))});return function(n){return r(t(n))}},rn=function(n){return function(r){return nn(r)(n)}},tn=function(n){return function(n){var r=O.unwrap(O.newtypeMultiplicative),t=R(n)(g.Multiplicative);return function(n){return r(t(n))}}},en=function(t){return function(e){var u=o.flip(O.unwrap(O.newtypeEndo))(n.pure(t)(E.unit)),i=R(e)(function(n){return function(e){return r.applySecond(t.Apply0())(n)(e)}});return function(n){return u(i(n))}}},un=function(n){return function(n){var r=O.unwrap(O.newtypeAdditive),t=R(n)(v.Additive);return function(n){return r(t(n))}}},on=function(n){var r=O.unwrap(s.newtypeFirst),t=R(n)(function(n){return s.First(l.Just.create(n))});return function(n){return r(t(n))}},fn=function(n){return function(r){return z(n)(function(n){return l.maybe(r(n)?new l.Just(n):l.Nothing.value)(l.Just.create)})(l.Nothing.value)}},cn=function(n){return function(r){var u=F.dimap(n.Profunctor0())(function(n){return r(n)?new e.Right(n):new e.Left(n)})(e.either(t.identity(t.categoryFn))(t.identity(t.categoryFn))),i=h.right(n);return function(n){return u(i(n))}}},an=function(n){return function(n){return function(r){var t=O.unwrap(O.newtypeDisj),e=R(n)(function(n){return D.Disj(r(n))});return function(n){return t(e(n))}}}},pn=function(n){return function(r){return function(t){return an(c.heytingAlgebraBoolean)(r)(function(r){return u.eq(n)(r)(t)})}}},dn=function(n){return function(r){return an(n)(r)(t.identity(t.categoryFn))}},ln=function(n){return function(n){return function(r){var t=O.unwrap(O.newtypeConj),e=R(n)(function(n){return j.Conj(r(n))});return function(n){return t(e(n))}}}},sn=function(n){return function(r){return ln(n)(r)(t.identity(t.categoryFn))}},yn=function(n){return function(r){return function(t){return ln(c.heytingAlgebraBoolean)(r)(function(r){return u.notEq(n)(r)(t)})}}};module.exports={previewOn:rn,toListOfOn:V,preview:nn,foldOf:U,foldMapOf:R,foldrOf:z,foldlOf:k,toListOf:Q,firstOf:on,lastOf:Z,maximumOf:G,minimumOf:K,allOf:ln,anyOf:an,andOf:sn,orOf:dn,elemOf:pn,notElemOf:yn,sumOf:un,productOf:tn,lengthOf:$,findOf:fn,sequenceOf_:en,traverseOf_:W,has:X,"hasn't":Y,replicated:b,filtered:cn,folded:H,unfolded:C,ifoldMapOf:L,ifoldrOf:N,ifoldlOf:J,iallOf:B,ianyOf:_,itoListOf:S,itraverseOf_:T}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Category/index.js":"IAi2","../Data.Either/index.js":"B2JL","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.HeytingAlgebra/index.js":"paZe","../Data.Lens.Internal.Forget/index.js":"mj9z","../Data.Lens.Internal.Indexed/index.js":"V4/H","../Data.List.Types/index.js":"Xxuc","../Data.Maybe/index.js":"5mN7","../Data.Maybe.First/index.js":"W/l6","../Data.Maybe.Last/index.js":"aQky","../Data.Monoid/index.js":"TiEB","../Data.Monoid.Additive/index.js":"fHyj","../Data.Monoid.Conj/index.js":"U/G5","../Data.Monoid.Disj/index.js":"9bR7","../Data.Monoid.Dual/index.js":"ULyl","../Data.Monoid.Endo/index.js":"2o47","../Data.Monoid.Multiplicative/index.js":"y5cd","../Data.Newtype/index.js":"lz8k","../Data.Ord/index.js":"r4Vb","../Data.Profunctor/index.js":"0DaD","../Data.Profunctor.Choice/index.js":"nkqb","../Data.Semigroup/index.js":"EsAJ","../Data.Tuple/index.js":"II/O","../Data.Unit/index.js":"NhVk"}],"KFxX":[function(require,module,exports) { +"use strict";var e=require("../Data.Bifunctor/index.js"),r=require("../Data.Either/index.js"),t=require("../Data.Functor/index.js"),n=require("../Data.Profunctor/index.js"),u=require("../Data.Profunctor.Choice/index.js"),i=function(){function e(e,r){this.value0=e,this.value1=r}return e.create=function(r){return function(t){return new e(r,t)}},e}(),c=new n.Profunctor(function(t){return function(n){return function(u){return new i(function(e){return n(u.value0(e))},(c=e.lmap(r.bifunctorEither)(n),function(e){return c(u.value1(t(e)))}));var c}}}),o=new t.Functor(function(t){return function(n){return new i(function(e){return t(n.value0(e))},(u=e.lmap(r.bifunctorEither)(t),function(e){return u(n.value1(e))}));var u}}),a=new u.Choice(function(){return c},function(t){return new i(function(e){return r.Left.create(t.value0(e))},r.either((n=e.lmap(r.bifunctorEither)(r.Left.create),function(e){return n(t.value1(e))}))(function(e){return r.Left.create(r.Right.create(e))}));var n},function(t){return new i(function(e){return r.Right.create(t.value0(e))},r.either(function(e){return r.Left.create(r.Left.create(e))})((n=e.lmap(r.bifunctorEither)(r.Right.create),function(e){return n(t.value1(e))})));var n});module.exports={Market:i,functorMarket:o,profunctorMarket:c,choiceMarket:a}; +},{"../Data.Bifunctor/index.js":"e2Wc","../Data.Either/index.js":"B2JL","../Data.Functor/index.js":"+0AE","../Data.Profunctor/index.js":"0DaD","../Data.Profunctor.Choice/index.js":"nkqb"}],"h1YV":[function(require,module,exports) { +"use strict";var n=require("../Data.Either/index.js"),r=require("../Data.Eq/index.js"),e=require("../Data.Foldable/index.js"),t=require("../Data.Function/index.js"),u=require("../Data.Functor/index.js"),o=require("../Data.Newtype/index.js"),i=require("../Data.Ord/index.js"),c=require("../Data.Profunctor/index.js"),a=require("../Data.Profunctor.Choice/index.js"),f=require("../Data.Profunctor.Closed/index.js"),d=require("../Data.Profunctor.Costrong/index.js"),g=require("../Data.Traversable/index.js"),s=function(n){return n},q=new c.Profunctor(function(n){return function(n){return function(r){return n(r)}}}),l=new d.Costrong(function(){return q},function(n){return n.value0},function(n){return n.value1}),w=new f.Closed(function(){return q},function(n){return t.const(n)}),x=new a.Choice(function(){return q},function(r){return new n.Left(r)},function(r){return new n.Right(r)}),j=new o.Newtype(function(n){return n},s),p=new u.Functor(function(n){return function(r){return n(r)}}),D=new e.Foldable(function(n){return function(n){return function(r){return n(r)}}},function(n){return function(r){return function(e){return n(r)(e)}}},function(n){return function(r){return function(e){return n(e)(r)}}}),T=new g.Traversable(function(){return D},function(){return p},function(n){return function(r){return u.map(n.Apply0().Functor0())(s)(r)}},function(n){return function(r){return function(e){return u.map(n.Apply0().Functor0())(s)(r(e))}}}),C=function(n){return new r.Eq(function(e){return function(t){return r.eq(n)(e)(t)}})},F=function(n){return new i.Ord(function(){return C(n.Eq0())},function(r){return function(e){return i.compare(n)(r)(e)}})},b=new r.Eq1(function(n){return r.eq(C(n))}),v=new i.Ord1(function(){return b},function(n){return i.compare(F(n))});module.exports={Tagged:s,newtypeTagged:j,eqTagged:C,eq1Tagged:b,ordTagged:F,ord1Tagged:v,functorTagged:p,taggedProfunctor:q,taggedChoice:x,taggedCostrong:l,taggedClosed:w,foldableTagged:D,traversableTagged:T}; +},{"../Data.Either/index.js":"B2JL","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Newtype/index.js":"lz8k","../Data.Ord/index.js":"r4Vb","../Data.Profunctor/index.js":"0DaD","../Data.Profunctor.Choice/index.js":"nkqb","../Data.Profunctor.Closed/index.js":"af4y","../Data.Profunctor.Costrong/index.js":"NfU6","../Data.Traversable/index.js":"n7EE"}],"4AcV":[function(require,module,exports) { +"use strict";var n=require("../Control.Category/index.js"),r=require("../Control.MonadZero/index.js"),e=require("../Data.Either/index.js"),t=require("../Data.Eq/index.js"),u=require("../Data.Function/index.js"),i=require("../Data.HeytingAlgebra/index.js"),o=require("../Data.Lens.Internal.Market/index.js"),a=require("../Data.Lens.Internal.Tagged/index.js"),c=require("../Data.Maybe/index.js"),f=require("../Data.Newtype/index.js"),s=require("../Data.Profunctor/index.js"),d=require("../Data.Profunctor.Choice/index.js"),g=function(r){return function(t){var u=r(new o.Market(n.identity(n.categoryFn),e.Right.create));return t(u.value0)(u.value1)}},y=f.under(a.newtypeTagged)(a.newtypeTagged)(a.Tagged),q=function(r){return function(t){return function(u){return function(i){return s.dimap(u.Profunctor0())(t)(e.either(n.identity(n.categoryFn))(n.identity(n.categoryFn)))(d.right(u)(s.rmap(u.Profunctor0())(r)(i)))}}}},x=function(n){return function(r){return function(t){return q(n)(function(n){return c.maybe(new e.Left(n))(e.Right.create)(r(n))})(t)}}},j=function(n){return function(e){return function(t){return x(u.const(n))((i=r.guard(c.monadZeroMaybe),function(n){return i(e(n))}))(t);var i}}},l=function(n){return function(r){return function(e){return j(r)(function(e){return t.eq(n)(e)(r)})(e)}}},m=function(n){return g(n)(function(n){return function(n){return n}})},D=function(n){return function(r){var t=e.either(u.const(i.ff(n)))(u.const(i.tt(n))),o=m(r);return function(n){return t(o(n))}}},h=function(n){return function(r){var e=i.not(n),t=D(n)(r);return function(n){return e(t(n))}}},p=function(n){return function(r){return g(n)(function(n){return function(e){return function(t){return q(n)(e)(r)(t)}}})}};module.exports={"prism'":x,prism:q,only:l,nearly:j,review:y,is:D,"isn't":h,matching:m,clonePrism:p,withPrism:g}; +},{"../Control.Category/index.js":"IAi2","../Control.MonadZero/index.js":"lD5R","../Data.Either/index.js":"B2JL","../Data.Eq/index.js":"Pq4F","../Data.Function/index.js":"ImXJ","../Data.HeytingAlgebra/index.js":"paZe","../Data.Lens.Internal.Market/index.js":"KFxX","../Data.Lens.Internal.Tagged/index.js":"h1YV","../Data.Maybe/index.js":"5mN7","../Data.Newtype/index.js":"lz8k","../Data.Profunctor/index.js":"0DaD","../Data.Profunctor.Choice/index.js":"nkqb"}],"kg0W":[function(require,module,exports) { +"use strict";var n=require("../Data.Profunctor/index.js"),u=require("../Data.Profunctor.Strong/index.js"),r=require("../Data.Tuple/index.js"),e=function(){function n(n,u){this.value0=n,this.value1=u}return n.create=function(u){return function(r){return new n(u,r)}},n}(),t=new n.Profunctor(function(n){return function(u){return function(r){return new e(function(u){return r.value0(n(u))},function(e){var t=r.value1(n(e));return function(n){return u(t(n))}})}}}),o=new u.Strong(function(){return t},function(n){return new e(function(u){return n.value0(u.value0)},function(u){return function(e){return new r.Tuple(n.value1(u.value0)(e),u.value1)}})},function(n){return new e(function(u){return n.value0(u.value1)},function(u){return function(e){return new r.Tuple(u.value0,n.value1(u.value1)(e))}})});module.exports={Shop:e,profunctorShop:t,strongShop:o}; +},{"../Data.Profunctor/index.js":"0DaD","../Data.Profunctor.Strong/index.js":"w9p6","../Data.Tuple/index.js":"II/O"}],"hi+g":[function(require,module,exports) { +"use strict";var n=require("../Control.Category/index.js"),e=require("../Data.Lens.Internal.Indexed/index.js"),r=require("../Data.Lens.Internal.Shop/index.js"),t=require("../Data.Newtype/index.js"),u=require("../Data.Profunctor/index.js"),i=require("../Data.Profunctor.Strong/index.js"),o=require("../Data.Tuple/index.js"),c=function(e){return function(t){var u=e(new r.Shop(n.identity(n.categoryFn),function(n){return function(n){return n}}));return t(u.value0)(u.value1)}},f=function(e){return function(t){var u=e(new r.Shop(n.identity(n.categoryFn),function(n){return function(n){return n}}));return t(u.value0)(u.value1)}},a=function(n){return function(e){return function(r){return u.dimap(e.Profunctor0())(n)(function(n){return n.value1(n.value0)})(i.first(e)(r))}}},d=function(n){return function(e){return function(r){return a(function(r){return new o.Tuple(n(r),function(n){return e(r)(n)})})(r)}}},s=function(n){return function(r){return function(o){return u.dimap(r.Profunctor0())(n)(function(n){return n.value1(n.value0)})(i.first(r)(t.un(e.newtypeIndexed)(e.Indexed)(o)))}}},l=function(n){return function(e){return function(r){return s(function(r){return new o.Tuple(n(r),function(n){return e(r)(n)})})(r)}}},x=function(n){return function(e){return c(n)(function(n){return function(r){return function(t){return d(n)(r)(e)(t)}}})}},p=function(n){return function(e){return f(n)(function(n){return function(r){return function(t){return l(n)(r)(e)(t)}}})}};module.exports={lens:d,"lens'":a,withLens:c,cloneLens:x,ilens:l,"ilens'":s,withIndexedLens:f,cloneIndexedLens:p}; +},{"../Control.Category/index.js":"IAi2","../Data.Lens.Internal.Indexed/index.js":"V4/H","../Data.Lens.Internal.Shop/index.js":"kg0W","../Data.Newtype/index.js":"lz8k","../Data.Profunctor/index.js":"0DaD","../Data.Profunctor.Strong/index.js":"w9p6","../Data.Tuple/index.js":"II/O"}],"nwoH":[function(require,module,exports) { +"use strict";var e=require("../Data.Function/index.js"),n=require("../Data.Lens.Lens/index.js"),r=require("../Record/index.js"),t=function(t){return function(u){return function(i){return function(o){return function(s){return n.lens(r.get(t)(u)(o))(e.flip(r.set(t)(u)(i)(o)))(s)}}}}};module.exports={prop:t}; +},{"../Data.Function/index.js":"ImXJ","../Data.Lens.Lens/index.js":"hi+g","../Record/index.js":"0gG4"}],"62zx":[function(require,module,exports) { +"use strict";var r=require("../Data.Functor/index.js"),e=require("../Data.Map.Internal/index.js"),n=function(){var n=r.void(e.functorMap);return function(r){return n(r)}}();module.exports={keys:n}; +},{"../Data.Functor/index.js":"+0AE","../Data.Map.Internal/index.js":"RRDs"}],"10U2":[function(require,module,exports) { +"use strict";exports.null=null,exports.nullable=function(l,n,t){return null==l?n:t(l)},exports.notNull=function(l){return l}; +},{}],"YQ8o":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),n=require("../Data.Eq/index.js"),r=require("../Data.Function/index.js"),u=require("../Data.Maybe/index.js"),l=require("../Data.Ord/index.js"),t=require("../Data.Show/index.js"),o=u.maybe(e.null)(e.notNull),a=function(n){return e.nullable(n,u.Nothing.value,u.Just.create)},i=function(e){return new t.Show((n=u.maybe("null")(t.show(e)),function(e){return n(a(e))}));var n},q=function(e){return new n.Eq(r.on(n.eq(u.eqMaybe(e)))(a))},c=function(e){return new l.Ord(function(){return q(e.Eq0())},r.on(l.compare(u.ordMaybe(e)))(a))},b=new n.Eq1(function(e){return n.eq(q(e))}),d=new l.Ord1(function(){return b},function(e){return l.compare(c(e))});module.exports={toMaybe:a,toNullable:o,showNullable:i,eqNullable:q,eq1Nullable:b,ordNullable:c,ord1Nullable:d,null:e.null,notNull:e.notNull}; +},{"./foreign.js":"10U2","../Data.Eq/index.js":"Pq4F","../Data.Function/index.js":"ImXJ","../Data.Maybe/index.js":"5mN7","../Data.Ord/index.js":"r4Vb","../Data.Show/index.js":"mFY7"}],"+Eae":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Bind/index.js"),e=require("../Control.Monad.Rec.Class/index.js"),t=require("../Control.Monad.ST.Internal/index.js"),u=require("../Data.Array/index.js"),i=require("../Data.Array.ST/index.js"),o=require("../Data.Eq/index.js"),f=require("../Data.Foldable/index.js"),c=require("../Data.Function/index.js"),a=require("../Data.Functor/index.js"),d=require("../Data.List/index.js"),l=require("../Data.List.Types/index.js"),s=require("../Data.Map.Internal/index.js"),p=require("../Data.Maybe/index.js"),q=require("../Data.Monoid/index.js"),b=require("../Data.Ord/index.js"),m=require("../Data.Ordering/index.js"),x=require("../Data.Semigroup/index.js"),S=require("../Data.Show/index.js"),j=require("../Data.Unit/index.js"),w=function(n){return n},y=function(n){return function(r){return function(e){return s.union(n)(r)(e)}}},D=function(n){return s.keys(n)},M=function(n){var r=d.toUnfoldable(n);return function(n){return r(D(n))}},h=function(n){return s.size(n)},L=function(n){return s.singleton(n)(j.unit)},v=function(n){return new S.Show(function(r){return"(fromFoldable "+S.show(l.showList(n))(D(r))+")"})},T=function(n){return new x.Semigroup(y(n))},E=function(n){return function(r){return function(e){return s.member(n)(r)(e)}}},F=function(n){return s.isEmpty(n)},g=function(n){return function(r){return function(e){return s.insert(n)(r)(j.unit)(e)}}},k=new f.Foldable(function(n){return function(r){var e=f.foldMap(l.foldableList)(n)(r);return function(n){return e(D(n))}}},function(n){return function(r){var e=f.foldl(l.foldableList)(n)(r);return function(n){return e(D(n))}}},function(n){return function(r){var e=f.foldr(l.foldableList)(n)(r);return function(n){return e(D(n))}}}),C=function(n){return a.map(p.functorMaybe)(function(n){return n.key})(s.findMin(n))},A=function(n){return a.map(p.functorMaybe)(function(n){return n.key})(s.findMax(n))},O=function(n){return function(r){return function(e){return s.filterWithKey(n)(function(n){return function(e){return r(n)}})(e)}}},U=function(n){return new o.Eq(function(r){return function(e){return o.eq(s.eqMap(n)(o.eqUnit))(r)(e)}})},z=function(n){return new b.Ord(function(){return U(n.Eq0())},function(r){return function(e){return b.compare(l.ordList(n))(D(r))(D(e))}})},R=new o.Eq1(function(n){return o.eq(U(n))}),I=new b.Ord1(function(){return R},function(n){return b.compare(z(n))}),V=s.empty,B=function(n){return function(r){return f.foldl(n)(function(n){return function(e){return g(r)(e)(n)}})(V)}},G=function(o){return function(c){return function(a){var d,s=(d=u.fromFoldable(l.foldableList),function(n){return d(D(n))}),p=s(a),q=u.length(p),x=s(c),S=u.length(x);return B(f.foldableArray)(o)(r.bind(t.bindST)(r.bind(t.bindST)(i.empty)(function(r){return e.tailRecM2(t.monadRecST)(function(u){return function(f){if(ue.x&&n.ye.y}},_n={width:15,height:300},An=function(n){return function(i){return t.bind(W.bindAff)(H.liftEffect(W.monadEffectAff)(Z.read(i.tracks)))(function(t){var i=b.lookup(S.ordString)(n)(t);if(i instanceof C.Just)return e.pure(W.applicativeAff)(i.value0);if(i instanceof C.Nothing)return r.throwError(W.monadThrowAff)(V.error("Could not find track '"+n+"'!"));throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 448, column 3 - line 452, column 55): "+[i.constructor.name])})}},On=function(n){return function(e){return H.liftEffect(n)(Z.read(e.layers))}},Gn=function(n){return function(e){return H.liftEffect(n)(Z.read(e.dimensions))}},Pn=l.map(l.functorFn)(Q.getContext2D)(function(){var n=j.unwrap(Nn);return function(e){return n(e).front}}()),zn=function(n){return function(e){return function(r){return t.bind(n.Monad0().Bind1())(H.liftEffect(n)(Z.read(e.tracks)))(function(e){return R.for(n.Monad0().Applicative0())(b.traversableMap)(e)(r)})}}},Un=function(n){return function(e){var t=l.void(n.Monad0().Bind1().Apply0().Functor0()),r=zn(n)(e);return function(n){return t(r(n))}}},Wn=new u.Eq(function(n){return function(e){return n instanceof sn&&e instanceof sn||(n instanceof dn&&e instanceof dn||n instanceof pn&&e instanceof pn)}}),Jn=function(e){return K.runEffectFn2(n.elementClickImpl)(e)},Hn=function(e){return function(t){return function(){var r=l.map(U.functorEffect)(on.unsafeCoerce)(yn({elementType:"canvas",id:t}))();return n.initializeCanvasImpl(r,e),r}}},Vn=function(e){return function(t){return function(r){return function(){var i=yn({elementType:"div",id:r})();n.setContainerStyle(i)(e)();var o=Hn(_n)("glyphBuffer")(),u=Z.new({size:e,padding:t})();return{layers:Z.new(q.mempty(b.monoidMap(S.ordString)))(),dimensions:u,element:i,glyphBuffer:o}}}}},Zn=function(n){return function(e){return l.void(U.functorEffect)(Q.clearRect(n)({x:0,y:0,width:e.width,height:e.height}))}},Kn=function(e){return function(t){return function(r){return function(i){return function(){var o=Q.getContext2D(e)(),u=_n.width/2,a=_n.height/2;Zn(o)(_n)(),$.render(o)($.translate(u)(a)(i.drawing))();return n.drawCopies(e,_n,t,function(n){return n.x>=r.value0&&n.x<=r.value1},i.points)}}}}},Xn=function(e){return function(t){var r;return n.canvasDragImpl(e)((r=t,function(n){var e=D.toMaybe(n.during);if(e instanceof C.Just)return r(new o.Right(e.value0));if(e instanceof C.Nothing)return r(o.Left.create(C.fromMaybe({x:0,y:0})(D.toMaybe(n.total))));throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 311, column 36 - line 313, column 73): "+[e.constructor.name])}))}},Yn=function(n){return function(t){return function(){Z.read(n.tracks)();return Xn(n.element)(function(n){if(n instanceof o.Left)return e.pure(U.applicativeEffect)(G.unit);if(n instanceof o.Right)return t(n.value0);throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 326, column 40 - line 328, column 20): "+[n.constructor.name])})()}}},Qn=function(n){return function(t){return Xn(n.element)(function(n){if(n instanceof o.Left)return e.pure(U.applicativeEffect)(G.unit);if(n instanceof o.Right)return t(n.value0);throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 335, column 40 - line 337, column 20): "+[n.constructor.name])})}},$n=function(n){return function(e){return H.liftEffect(n)(function(){return{tracks:Z.new(q.mempty(b.monoidMap(S.ordString)))(),element:e}})}},ne=function(n){return function(){bn({x:0,y:0})(n)();var e=Q.getCanvasDimensions(n.back)();return f.for_(U.applicativeEffect)(f.foldableArray)([n.back,n.front])(t.composeKleisliFlipped(U.bindEffect)(c.flip(Zn)(e))(Q.getContext2D))()}},ee=function(n){return function(e){return function(){var t={back:Hn(n)(e+"-buffer")(),front:Hn(n)(e)()};return ne(t)(),t}}},te=function(n){return function(e){return function(){Q.setCanvasDimensions(e.back)(n)(),Q.setCanvasDimensions(e.front)(n)();return ne(e)(),G.unit}}},re=function(n){return function(e){return function(t){return H.liftEffect(n)(function(){if(t instanceof vn)return l.void(U.functorEffect)(Q.setCanvasDimensions(t.value0)(e));if(t instanceof wn)return te(e)(t.value0);throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 594, column 3 - line 596, column 45): "+[t.constructor.name])}())}}},ie=function(e){return function(r){return function(i){return H.liftEffect(e)(function(){return Z.modify_(function(n){return{size:r,padding:n.padding}})(i.dimensions)(),n.setContainerStyle(i.element)(r)(),t.bindFlipped(U.bindEffect)(f.traverse_(U.applicativeEffect)(b.foldableMap)(re(H.monadEffectEffect)(r)))(On(H.monadEffectEffect)(i))()})}}},oe=function(e){return function(t){return n.appendElem(e)(t)}},ue=function(n){return function(e){return f.any(x.foldableList)(s.heytingAlgebraBoolean)(function(n){return!u.eq(u.eqRec()(u.eqRowCons(u.eqRowCons(u.eqRowCons(u.eqRowCons(u.eqRowNil)()(new L.IsSymbol(function(){return"y"}))(u.eqNumber))()(new L.IsSymbol(function(){return"x"}))(u.eqNumber))()(new L.IsSymbol(function(){return"width"}))(u.eqNumber))()(new L.IsSymbol(function(){return"height"}))(u.eqNumber)))(e.rect)(n.rect)&&Rn(e.rect)(n.rect)})(n)?n:new x.Cons(e,n)}},ae=function(n){return function(e){return function(t){var r=a.filter(a.filterableArray)(function(e){return e.point.xn.value0})(i.fromFoldable(x.foldableList)(e));return function(){var e=R.for(U.applicativeEffect)(R.traversableArray)(r)(function(e){return l.map(U.functorEffect)(function(n){return{text:e.text,rect:n}})(Tn(n)(t)(e))})(),i=f.foldl(f.foldableArray)(ue)(q.mempty(x.monoidList))(e);return Q.withContext(t)(function(){Q.setFont(t)(Ln)();return f.for_(U.applicativeEffect)(x.foldableList)(i)(function(n){return Q.fillText(t)(n.text)(n.rect.x-n.rect.width/2)(n.rect.y)})()})()}}}},fe=function(e){return function(t){return function(r){return function(i){return H.liftEffect(e)(function(){return Z.modify_(b.insert(S.ordString)(r)(j.wrap(Bn)(i)))(t.tracks)(),n.appendElem(t.element)(i.element)()})}}}},ce=L.SProxy.value,le=L.SProxy.value,se=L.SProxy.value,de=L.SProxy.value,pe=function(n){return E["prism'"](vn.create)(function(n){if(n instanceof vn)return new C.Just(n.value0);if(n instanceof wn)return C.Nothing.value;throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 769, column 27 - line 771, column 23): "+[n.constructor.name])})(n)},me=function(n){var e=w._Newtype(Bn)(Bn)(n.Profunctor0()),t=h.prop(new L.IsSymbol(function(){return"layers"}))()()(L.SProxy.value)(n);return function(n){return e(t(n))}},ve=m.to(function(n){if(n instanceof vn)return n.value0;if(n instanceof wn)return j.unwrap(Nn)(n.value0).front;throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 759, column 19 - line 761, column 31): "+[n.constructor.name])}),we=function(n){return function(r){return function(i){return function(o){return function(u){return function(a){return t.bind(n.MonadEffect0().Monad0().Bind1())(l.map(n.MonadEffect0().Monad0().Bind1().Apply0().Functor0())(function(n){return n.size})(Gn(n.MonadEffect0())(o)))(function(c){return t.bind(n.MonadEffect0().Monad0().Bind1())(Gn(n.MonadEffect0())(o))(function(s){var d={left:0,top:0},p=function(n){return m.viewOn(a.value2)(Y._Component)(new A.Tuple(n,Y.slotSize(s)(Y.asSlot(a.value2))))};return t.bind(n.MonadEffect0().Monad0().Bind1())(H.liftEffect(n.MonadEffect0())(function(){var n=function(){if(a.value0 instanceof Y.Fixed)return l.map(U.functorEffect)(vn.create)(Hn(c)(u))();if(a.value0 instanceof Y.Scrolling)return l.map(U.functorEffect)(wn.create)(ee(c)(u))();throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 812, column 11 - line 814, column 67): "+[a.value0.constructor.name])}();return Sn(d)(m.viewOn(n)(ve))(),n}))(function(c){var s=j.unwrap(Bn)(o).layers;return t.discard(t.discardUnit)(n.MonadEffect0().Monad0().Bind1())(H.liftEffect(n.MonadEffect0())(function(){return Z.modify_(b.insert(S.ordString)(u)(c))(s)(),oe(j.unwrap(Bn)(o).element)(m.viewOn(c)(ve))()}))(function(){return t.bind(n.MonadEffect0().Monad0().Bind1())(J.liftAff(n)(X.new(r)(i)(p)))(function(r){return e.pure(n.MonadEffect0().Monad0().Applicative0())({drawOnCanvas:function(r){return function(i){return t.bind(n.MonadEffect0().Monad0().Bind1())(On(n.MonadEffect0())(o))(function(c){return t.bind(n.MonadEffect0().Monad0().Bind1())(function(){var t=b.lookup(S.ordString)(u)(c);if(t instanceof C.Nothing)return en.unsafeCrashWith("Tried to render layer '"+u+"', but it did not exist!");if(t instanceof C.Just)return e.pure(n.MonadEffect0().Monad0().Applicative0())(m.viewOn(t.value0)(ve));throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 830, column 16 - line 832, column 53): "+[t.constructor.name])}())(function(u){return t.bind(n.MonadEffect0().Monad0().Bind1())(Gn(n.MonadEffect0())(o))(function(c){return t.bind(n.MonadEffect0().Monad0().Bind1())(Y.slotContext(n.MonadEffect0())(a)(c)(u))(function(u){return t.discard(t.discardUnit)(n.MonadEffect0().Monad0().Bind1())(H.liftEffect(n.MonadEffect0())(Q.withContext(u)(function(){return Y.setContextTranslation(N.zero(N.semiringRecord()(N.semiringRecordCons(new L.IsSymbol(function(){return"x"}))()(N.semiringRecordCons(new L.IsSymbol(function(){return"y"}))()(N.semiringRecordNil)(N.semiringNumber))(N.semiringNumber))))(u)(),l.void(U.functorEffect)(Q.clearRect(u)(tn.merge()()({x:0,y:0})(c.size)))()})))(function(){return t.bind(n.MonadEffect0().Monad0().Bind1())(H.liftEffect(n.MonadEffect0())(Q.translate(u)({translateX:-r.value0,translateY:0})))(function(a){var c=function(e){return H.liftEffect(n.MonadEffect0())(ae(new F.Pair(r.value0,r.value1))(e)(u))},l=function(e){return H.liftEffect(n.MonadEffect0())(f.for_(U.applicativeEffect)(f.foldableArray)(e)(Kn(j.unwrap(Bn)(o).glyphBuffer)(u)(new F.Pair(r.value0,r.value1))))},s=function(e){return H.liftEffect(n.MonadEffect0())($.render(u)(e))},d=function(t){return H.liftEffect(n.MonadEffect0())(e.when(U.applicativeEffect)(t.topLeft.x<=r.value1&&t.bottomRight.x>=r.value0)($.render(u)($.translate(t.topLeft.x)(t.topLeft.y)(t.drawing(G.unit)))))},p=O.unfoldr(x.unfoldableList)(function(n){return g.null(n)?C.Nothing.value:new C.Just(new A.Tuple(g.take(250)(n),g.drop(250)(n)))})(i);return f.for_(n.MonadEffect0().Monad0().Applicative0())(x.foldableList)(p)(function(e){return t.discard(t.discardUnit)(n.MonadEffect0().Monad0().Bind1())(f.for_(n.MonadEffect0().Monad0().Applicative0())(x.foldableList)(e)(function(n){return P.onMatch()(z.variantMatchCons(z.variantMatchCons(z.variantMatchCons(z.variantMatchCons(z.variantMatchNil)()(rn.refl))()(rn.refl))()(rn.refl))()(rn.refl))()({drawing:s,bigDrawing:d,drawingBatch:l,labels:c})(P.case_)(n)}))(function(){return J.liftAff(n)(W.delay(j.wrap(T.newtypeMilliseconds)(.01)))})})})})})})})})}},run:r.run,last:r.last})})})})})})}}}}}},Ee=function(n){return function(e){return function(t){return H.liftEffect(n)(function(){var n=Z.read(e.layers)(),r=y.keys(n);f.length(k.foldableSet)(N.semiringInt)(r);return g.null(g.difference(u.eqString)(t)(g.fromFoldable(k.foldableSet)(r)))?l.void(U.functorEffect)(_.forWithIndex(U.applicativeEffect)(x.traversableWithIndexList)(t)(function(e){return function(t){return f.traverse_(U.applicativeEffect)(f.foldableMaybe)(function(n){return Dn(m.viewOn(n)(ve))(e)})(b.lookup(S.ordString)(t)(n))}}))():en.unsafeCrashWith("Called `zIndexLayers` with an order that did not contain all layers")()})}}},he=function(n){return function(e){var t=w._Newtype(n)(n)(e.Profunctor0()),r=h.prop(new L.IsSymbol(function(){return"element"}))()()(L.SProxy.value)(e);return function(n){return t(r(n))}}},ge=function(n){return function(e){return function(t){return function(r){return H.liftEffect(n)(function(){var n=On(H.monadEffectEffect)(e)();Z.modify_(b.insert(S.ordString)(t)(r))(m.viewOn(e)(me(v.strongForget)))();var i=function(n){return m.viewOn(n)(ve)};return l.void(U.functorEffect)(function(){var o=b.lookup(S.ordString)(t)(n);if(o instanceof C.Just)return an.replaceChild(i(r))(i(o.value0))(m.viewOn(e)(he(Bn)(v.strongForget)));if(o instanceof C.Nothing)return an.appendChild(i(r))(m.viewOn(e)(he(Bn)(v.strongForget)));throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 613, column 10 - line 615, column 95): "+[o.constructor.name])}())()})}}}},xe=function(n){return function(e){return function(t){return H.liftEffect(n)(function(){var n=On(H.monadEffectEffect)(e)();return function(){var r,i=b.lookup(S.ordString)(t)(n);if(i instanceof C.Nothing)return G.unit;if(i instanceof C.Just)return l.void(U.functorEffect)(an.removeChild((r=i.value0,m.viewOn(r)(ve)))(m.viewOn(e)(he(Bn)(v.strongForget))))();throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 628, column 3 - line 630, column 83): "+[i.constructor.name])}(),Z.modify_(b.delete(S.ordString)(t))(m.viewOn(e)(me(v.strongForget)))()})}}},ye=function(n){return function(e){return function(t){return H.liftEffect(n)(function(){var n=Gn(H.monadEffectEffect)(e)(),r=m.viewOn(t)(Y._Component);return Jn(m.viewOn(e)(he(Bn)(v.strongForget)))(function(e){return r((i=e,B.sub(B.ringRecord()(B.ringRecordCons(new L.IsSymbol(function(){return"x"}))()(B.ringRecordCons(new L.IsSymbol(function(){return"y"}))()(B.ringRecordNil)(B.ringNumber))(B.ringNumber)))(i)(Y.slotOffset(n)(Y.asSlot(t)))));var i})()})}}},be=function(e){return function(t){return function(){var r=Gn(H.monadEffectEffect)(e)(),i=m.viewOn(t)(Y._Component);return n.canvasWheelCBImpl(m.viewOn(e)(he(Bn)(v.strongForget)))(function(n){return i((e=n,B.sub(B.ringRecord()(B.ringRecordCons(new L.IsSymbol(function(){return"x"}))()(B.ringRecordCons(new L.IsSymbol(function(){return"y"}))()(B.ringRecordNil)(B.ringNumber))(B.ringNumber)))(e)(Y.slotOffset(r)(Y.asSlot(t)))));var e})()}}},Ce=function(n){return function(r){return function(i){var o=un.toNode(m.viewOn(r)(he(Bn)(v.strongForget)));return t.discard(t.discardUnit)(n.Monad0().Bind1())(H.liftEffect(n)(an.setTextContent("loading")(o)))(function(){return t.bind(n.Monad0().Bind1())(i)(function(r){return t.discard(t.discardUnit)(n.Monad0().Bind1())(H.liftEffect(n)(an.setTextContent("")(o)))(function(){return e.pure(n.Monad0().Applicative0())(r)})})})}}},Me=function(n){return E["prism'"](wn.create)(function(n){if(n instanceof vn)return C.Nothing.value;if(n instanceof wn)return new C.Just(n.value0);throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 765, column 9 - line 765, column 34): "+[n.constructor.name])})(n)},qe=function(n){return function(t){return function(){var r=Z.read(n.layers)(),i=a.filterMap(a.filterableMap(S.ordString))(p.preview(Me(v.choiceForget(M.monoidFirst))))(r);return f.for_(U.applicativeEffect)(b.foldableMap)(i)(function(r){if(t instanceof fn)return function(){var e=l.map(U.functorEffect)(function(n){return Y.trackSlots(n).center.size.width})(Gn(H.monadEffectEffect)(j.wrap(Bn)(n)))();return Fn(r)({x:-t.value0*e,y:0})()};if(t instanceof cn)return gn(r)(t.value0);if(t instanceof ln)return e.pure(U.applicativeEffect)(G.unit);throw new Error("Failed pattern match at Genetics.Browser.Canvas (line 284, column 26 - line 293, column 29): "+[t.constructor.name])})()}}},je=function(n){return function(e){return function(){var t=Z.read(n.layers)(),r=a.filterMap(a.filterableMap(S.ordString))(p.preview(Me(v.choiceForget(M.monoidFirst))))(t);return f.for_(U.applicativeEffect)(b.foldableMap)(r)(function(n){return Fn(n)(e)})()}}};module.exports={LLeft:sn,LCenter:dn,LRight:pn,_drawing:se,_bigDrawing:de,_drawingBatch:le,_labels:ce,newLayer:we,getDimensions:Gn,_Container:he,dragScroll:Yn,dragScrollTrack:Qn,wheelZoom:xn,trackWheel:be,trackClickHandler:ye,trackContainer:Vn,withLoadingIndicator:Ce,setTrackContainerSize:ie,setElementStyle:Cn,browserContainer:$n,addTrack:fe,getTrack:An,forTracks:zn,forTracks_:Un,Scrolling:fn,Zooming:cn,Jump:ln,animateTrack:qe,newtypeBrowserContainer:kn,eqLabelPlace:Wn}; +},{"./foreign.js":"KkC9","../Control.Applicative/index.js":"qYya","../Control.Bind/index.js":"7VcT","../Control.Monad.Error.Class/index.js":"L8Lk","../Data.Array/index.js":"4t4C","../Data.Either/index.js":"B2JL","../Data.Eq/index.js":"Pq4F","../Data.Filterable/index.js":"6hfS","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.HeytingAlgebra/index.js":"paZe","../Data.Int/index.js":"xNJb","../Data.Lens.Fold/index.js":"fCig","../Data.Lens.Getter/index.js":"OPOX","../Data.Lens.Internal.Forget/index.js":"mj9z","../Data.Lens.Iso.Newtype/index.js":"CiFJ","../Data.Lens.Prism/index.js":"4AcV","../Data.Lens.Record/index.js":"nwoH","../Data.List/index.js":"ezw6","../Data.List.Types/index.js":"Xxuc","../Data.Map/index.js":"62zx","../Data.Map.Internal/index.js":"RRDs","../Data.Maybe/index.js":"5mN7","../Data.Maybe.First/index.js":"W/l6","../Data.Monoid/index.js":"TiEB","../Data.Newtype/index.js":"lz8k","../Data.Nullable/index.js":"YQ8o","../Data.Ord/index.js":"r4Vb","../Data.Pair/index.js":"PpsX","../Data.Ring/index.js":"E2qH","../Data.Semiring/index.js":"11NF","../Data.Set/index.js":"+Eae","../Data.Show/index.js":"mFY7","../Data.Symbol/index.js":"4oJQ","../Data.Time.Duration/index.js":"AnkF","../Data.Traversable/index.js":"n7EE","../Data.TraversableWithIndex/index.js":"V4EF","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z","../Data.Unit/index.js":"NhVk","../Data.Variant/index.js":"hgdh","../Data.Variant.Internal/index.js":"kYoO","../Effect/index.js":"oTWB","../Effect.Aff/index.js":"I7lu","../Effect.Aff.Class/index.js":"I4H+","../Effect.Class/index.js":"dWtH","../Effect.Exception/index.js":"0OCW","../Effect.Ref/index.js":"/Jaj","../Effect.Uncurried/index.js":"qn3Z","../Genetics.Browser.Cacher/index.js":"61ee","../Genetics.Browser.Layer/index.js":"YWUW","../Graphics.Canvas/index.js":"rm6N","../Graphics.Drawing/index.js":"0WVi","../Graphics.Drawing.Font/index.js":"fMOI","../Partial.Unsafe/index.js":"aoR+","../Record/index.js":"0gG4","../Type.Equality/index.js":"Uq/R","../Unsafe.Coerce/index.js":"ETUV","../Web.DOM.Element/index.js":"S4h2","../Web.DOM.Node/index.js":"P+X4"}],"7rcn":[function(require,module,exports) { +"use strict";exports.unsafeStringify=function(n){return JSON.stringify(n)},exports.unsafeToFixed=function(n){return function(e){return e.toFixed(n)}},exports.unsafeToExponential=function(n){return function(e){return e.toExponential(n)}},exports.unsafeToPrecision=function(n){return function(e){return e.toPrecision(n)}},exports.unsafeDecodeURI=decodeURI,exports.unsafeEncodeURI=encodeURI,exports.unsafeDecodeURIComponent=decodeURIComponent,exports.unsafeEncodeURIComponent=encodeURIComponent; +},{}],"qSZP":[function(require,module,exports) { +"use strict";var e=require("./foreign.js");module.exports={unsafeStringify:e.unsafeStringify,unsafeToFixed:e.unsafeToFixed,unsafeToExponential:e.unsafeToExponential,unsafeToPrecision:e.unsafeToPrecision,unsafeDecodeURI:e.unsafeDecodeURI,unsafeEncodeURI:e.unsafeEncodeURI,unsafeDecodeURIComponent:e.unsafeDecodeURIComponent,unsafeEncodeURIComponent:e.unsafeEncodeURIComponent}; +},{"./foreign.js":"7rcn"}],"7bYH":[function(require,module,exports) { +"use strict";var n=require("../Data.Array/index.js"),r=require("../Data.BigInt/index.js"),e=require("../Data.Boolean/index.js"),t=require("../Data.Eq/index.js"),i=require("../Data.EuclideanRing/index.js"),u=require("../Data.Foldable/index.js"),a=require("../Data.Functor/index.js"),o=require("../Data.Generic.Rep/index.js"),c=require("../Data.Lens.Getter/index.js"),f=require("../Data.Lens.Internal.Forget/index.js"),l=require("../Data.Lens.Iso.Newtype/index.js"),d=require("../Data.Map.Internal/index.js"),s=require("../Data.Maybe/index.js"),m=require("../Data.Monoid.Additive/index.js"),g=require("../Data.Newtype/index.js"),v=require("../Data.Ord/index.js"),p=require("../Data.Pair/index.js"),w=require("../Data.Ring/index.js"),x=require("../Data.Semiring/index.js"),b=require("../Data.Traversable/index.js"),q=require("../Global.Unsafe/index.js"),h=function(n){return n},B=function(n){return n},I=function(n){return n},P=function(n){return n},y=function(n){return r.toNumber(n.coordWidth)/n.pixelWidth},j=q.unsafeStringify,S=function(n){return function(e){return r.toNumber(e)*(n.pixelWidth/r.toNumber(n.coordWidth))}},D=function(n){return function(r){return function(e){var t=new p.Pair(v.min(n)(r.value0)(e.value0),v.min(n)(r.value1)(e.value1)),i=new p.Pair(v.max(n)(r.value0)(e.value0),v.max(n)(r.value1)(e.value1));return v.greaterThanOrEq(n)(t.value1)(i.value0)}}},N=function(n){return function(r){return w.sub(n)(r.value1)(r.value0)}},F=function(n){return function(e){var t=v.max(v.ordNumber)(0)(e),i=a.map(p.functorPair)(r.toNumber)(n),u=(N(w.ringNumber)(i)*t-N(w.ringNumber)(i))/2,o=a.map(p.functorPair)(r.fromNumber)(new p.Pair(i.value0-u,i.value1+u));return a.map(p.functorPair)(s.fromJust())(o)}},z=function(n){return function(e){var t=N(r.ringBigInt)(e),u=i.div(r.euclideanRingBigInt)(w.sub(r.ringBigInt)(n)(t))(r.fromInt(2));return new p.Pair(w.sub(r.ringBigInt)(e.value0)(u),x.add(r.semiringBigInt)(e.value1)(u))}},T=function(n){return function(e){var t=a.map(a.functorFn)(s.fromJust())(r.fromNumber)(e*r.toNumber(N(r.ringBigInt)(n)));return a.map(p.functorPair)(function(n){return x.add(r.semiringBigInt)(n)(t)})(n)}},W=function(n){return function(e){var t=N(r.ringBigInt)(e);return{pixelWidth:n.width,coordWidth:t}}},A=function(n){return function(r){return function(e){return function(t){return i.div(n)(w.sub(n.CommutativeRing0().Ring0())(t)(r))(w.sub(n.CommutativeRing0().Ring0())(e)(r))}}}},C=new g.Newtype(function(n){return n},B),M=new g.Newtype(function(n){return n},P),R=function(n){return function(r){return function(e){return function(t){return x.add(n.Semiring0())(x.mul(n.Semiring0())(w.sub(n)(x.one(n.Semiring0()))(t))(r))(x.mul(n.Semiring0())(t)(e))}}}},E=new o.Generic(function(n){return n},function(n){return n}),G=new a.Functor(function(n){return function(r){return P(a.map(d.functorMap)(a.map(p.functorPair)(n))(r))}}),O=new t.Eq(function(n){return function(e){return t.eq(r.eqBigInt)(n.coordWidth)(e.coordWidth)&&n.pixelWidth===e.pixelWidth}}),L=new g.Newtype(function(n){return n},I),V=function(r){return function(e){return function(t){var i,a,o=n.unzip(t);return P(d.fromFoldable(r)(u.foldableArray)(n.zip(o.value0)((i=o.value1,a=b.scanl(b.traversableArray)(function(n){return function(r){return x.add(e)(n)(r)}})(x.zero(e))(i),n.zipWith(p.Pair.create)(n.cons(x.zero(e))(a))(a)))))}}},_=function(n){return function(r){return function(e){return new p.Pair(w.sub(n)(e.value0)(r),x.add(n.Semiring0())(e.value1)(r))}}},J=function(n){return l._Newtype(M)(M)(n.Profunctor0())},U=function(n){var r=J(f.strongForget),e=c.to(g.alaF(a.functorFn)(a.functorFn)(g.newtypeAdditive)(g.newtypeAdditive)(m.Additive)(u.foldMap(d.foldableMap)(m.monoidAdditive(n.Semiring0())))(N(n)));return function(n){return r(e(n))}},k=function(n){return function(e){return function(t){var i=c.viewOn(n)(U(r.ringBigInt)),u=g.unwrap(L)(t),a=w.sub(r.ringBigInt)(u.value1)(u.value0),o=function(){var n=v.greaterThan(r.ordBigInt)(u.value1)(i),e=v.lessThan(r.ordBigInt)(u.value0)(x.zero(r.semiringBigInt));if(e&&!n)return new p.Pair(x.zero(r.semiringBigInt),a);if(!e&&n)return new p.Pair(w.sub(r.ringBigInt)(i)(a),i);if(e&&n)return new p.Pair(x.zero(r.semiringBigInt),i);if(!e&&!n)return new p.Pair(u.value0,u.value1);throw new Error("Failed pattern match at Genetics.Browser.Coordinates (line 182, column 22 - line 186, column 39): "+[e.constructor.name,n.constructor.name])}();return z(v.min(r.ordBigInt)(i)(v.max(r.ordBigInt)(a)(e)))(new p.Pair(o.value0,o.value1))}}},H=function(n){return function(r){return a.map(d.functorMap)(a.map(p.functorPair)(S(r)))(c.viewOn(n)(J(f.strongForget)))}},K=function(n){return function(r){return function(t){return function(i){return d.filter(n)(function(n){if(v.lessThan(r)(n.value0)(i.value0)&&v.greaterThan(r)(n.value1)(i.value1))return!0;if(v.lessThan(r)(n.value0)(i.value0)&&v.lessThan(r)(n.value1)(i.value0))return!1;if(v.greaterThan(r)(n.value0)(i.value1)&&v.greaterThan(r)(n.value1)(i.value1))return!1;if(e.otherwise)return!0;throw new Error("Failed pattern match at Genetics.Browser.Coordinates (line 142, column 9 - line 146, column 29): "+[n.constructor.name])})(c.viewOn(t)(J(f.strongForget)))}}}},Q=function(n){return function(e){return function(t){return function(i){return a.map(d.functorMap)(a.map(p.functorPair)(S(i)))(K(n)(r.ordBigInt)(e)(g.unwrap(L)(t)))}}}};module.exports={CoordSysView:I,pairSize:N,_TotalSize:U,normalizeView:k,aroundPair:_,normalize:A,scalePairBy:F,scaledSegments:H,"scaledSegments'":Q,translatePairBy:T,viewScale:W,xPerPixel:y,_Segments:J,pairsOverlap:D,coordSys:V,scaleToScreen:S,newtypeNormalized:C,functorCoordSys:G,newtypeCoordSys:M,genericCoordSys:E,eqViewScale:O,coordsysviewNewtype:L}; +},{"../Data.Array/index.js":"4t4C","../Data.BigInt/index.js":"Zx+T","../Data.Boolean/index.js":"ObQr","../Data.Eq/index.js":"Pq4F","../Data.EuclideanRing/index.js":"2IRB","../Data.Foldable/index.js":"eVDl","../Data.Functor/index.js":"+0AE","../Data.Generic.Rep/index.js":"AuzG","../Data.Lens.Getter/index.js":"OPOX","../Data.Lens.Internal.Forget/index.js":"mj9z","../Data.Lens.Iso.Newtype/index.js":"CiFJ","../Data.Map.Internal/index.js":"RRDs","../Data.Maybe/index.js":"5mN7","../Data.Monoid.Additive/index.js":"fHyj","../Data.Newtype/index.js":"lz8k","../Data.Ord/index.js":"r4Vb","../Data.Pair/index.js":"PpsX","../Data.Ring/index.js":"E2qH","../Data.Semiring/index.js":"11NF","../Data.Traversable/index.js":"n7EE","../Global.Unsafe/index.js":"qSZP"}],"71qG":[function(require,module,exports) { +"use strict";var e=require("../Control.Applicative/index.js"),r=require("../Control.Monad.Except.Trans/index.js"),n=require("../Data.Boolean/index.js"),t=require("../Data.Identity/index.js"),i=require("../Foreign/index.js"),a=function(e){return"Object"===i.tagOf(e)},o=function(o){if(a(o))return e.pure(r.applicativeExceptT(t.monadIdentity))(i.unsafeFromForeign(o));if(n.otherwise)return i.fail(new i.TypeMismatch("Object",i.tagOf(o)));throw new Error("Failed pattern match at Foreign.Generic.Internal (line 13, column 1 - line 13, column 44): "+[o.constructor.name])};module.exports={isObject:a,readObject:o}; +},{"../Control.Applicative/index.js":"qYya","../Control.Monad.Except.Trans/index.js":"gr8B","../Data.Boolean/index.js":"ObQr","../Data.Identity/index.js":"2OKT","../Foreign/index.js":"pu1p"}],"eqin":[function(require,module,exports) { +"use strict";exports.unsafeReadPropImpl=function(r,t,e,n){return null==n?r:t(n[e])},exports.unsafeHasOwnProperty=function(r,t){return Object.prototype.hasOwnProperty.call(t,r)},exports.unsafeHasProperty=function(r,t){return r in t}; +},{}],"Ryy1":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),n=require("../Control.Applicative/index.js"),r=require("../Control.Bind/index.js"),t=require("../Control.Monad.Except.Trans/index.js"),i=require("../Data.Function/index.js"),o=require("../Data.Identity/index.js"),u=require("../Foreign/index.js"),d=function(e){this.ix=e},f=function(e,n,r,t){this.errorAt=e,this.hasOwnProperty=n,this.hasProperty=r,this.index=t},a=function(r){return function(i){return e.unsafeReadPropImpl(u.fail(new u.TypeMismatch("object",u.typeOf(i))),n.pure(t.applicativeExceptT(o.monadIdentity)),r,i)}},c=a,p=a,s=function(e){return e.ix},x=function(e){return e.index},l=new d(function(e){return function(n){return function(u){return r.bindFlipped(t.bindExceptT(o.monadIdentity))(i.flip(x(e))(u))(n)}}}),y=new d(function(e){return x(e)}),h=function(n){return function(r){return!u.isNull(r)&&(!u.isUndefined(r)&&(("object"===u.typeOf(r)||"function"===u.typeOf(r))&&e.unsafeHasProperty(n,r)))}},P=function(e){return e.hasProperty},j=function(n){return function(r){return!u.isNull(r)&&(!u.isUndefined(r)&&(("object"===u.typeOf(r)||"function"===u.typeOf(r))&&e.unsafeHasOwnProperty(n,r)))}},w=new f(u.ErrorAtIndex.create,j,h,i.flip(p)),I=new f(u.ErrorAtProperty.create,j,h,i.flip(c)),O=function(e){return e.hasOwnProperty},b=function(e){return e.errorAt};module.exports={Index:f,Indexable:d,readProp:c,readIndex:p,ix:s,index:x,hasProperty:P,hasOwnProperty:O,errorAt:b,indexString:I,indexInt:w,indexableForeign:y,indexableExceptT:l}; +},{"./foreign.js":"eqin","../Control.Applicative/index.js":"qYya","../Control.Bind/index.js":"7VcT","../Control.Monad.Except.Trans/index.js":"gr8B","../Data.Function/index.js":"ImXJ","../Data.Identity/index.js":"2OKT","../Foreign/index.js":"pu1p"}],"dhzu":[function(require,module,exports) { +exports.null=null,exports[void 0]=void 0; +},{}],"k5yP":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),n=require("../Control.Applicative/index.js"),r=require("../Control.Monad.Except.Trans/index.js"),i=require("../Data.Functor/index.js"),t=require("../Data.Identity/index.js"),u=require("../Data.Maybe/index.js"),d=require("../Foreign/index.js"),a=function(e){return function(a){return d.isNull(a)||d.isUndefined(a)?n.pure(r.applicativeExceptT(t.monadIdentity))(u.Nothing.value):i.map(r.functorExceptT(t.functorIdentity))(u.Just.create)(e(a))}};module.exports={readNullOrUndefined:a,undefined:e[void 0],null:e.null}; +},{"./foreign.js":"dhzu","../Control.Applicative/index.js":"qYya","../Control.Monad.Except.Trans/index.js":"gr8B","../Data.Functor/index.js":"+0AE","../Data.Identity/index.js":"2OKT","../Data.Maybe/index.js":"5mN7","../Foreign/index.js":"pu1p"}],"cO3i":[function(require,module,exports) { +"use strict";function r(r){return function(n){var t=[];for(var e in n)hasOwnProperty.call(n,e)&&t.push(r(e)(n[e]));return t}}exports._copyST=function(r){return function(){var n={};for(var t in r)hasOwnProperty.call(r,t)&&(n[t]=r[t]);return n}},exports.empty={},exports.runST=function(r){return r()},exports._fmapObject=function(r,n){var t={};for(var e in r)hasOwnProperty.call(r,e)&&(t[e]=n(r[e]));return t},exports._mapWithKey=function(r,n){var t={};for(var e in r)hasOwnProperty.call(r,e)&&(t[e]=n(e)(r[e]));return t},exports._foldM=function(r){return function(n){return function(t){return function(e){var o=t;function u(r){return function(t){return n(t)(r)(e[r])}}for(var i in e)hasOwnProperty.call(e,i)&&(o=r(o)(u(i)));return o}}}},exports._foldSCObject=function(r,n,t,e){var o=n;for(var u in r)if(hasOwnProperty.call(r,u)){var i=t(o)(u)(r[u]),f=e(null)(i);if(null===f)return o;o=f}return o},exports.all=function(r){return function(n){for(var t in n)if(hasOwnProperty.call(n,t)&&!r(t)(n[t]))return!1;return!0}},exports.size=function(r){var n=0;for(var t in r)hasOwnProperty.call(r,t)&&++n;return n},exports._lookup=function(r,n,t,e){return t in e?n(e[t]):r},exports._unsafeDeleteObject=function(r,n){return delete r[n],r},exports._lookupST=function(r,n,t,e){return function(){return t in e?n(e[t]):r}},exports.toArrayWithKey=r,exports.keys=Object.keys||r(function(r){return function(){return r}}); +},{}],"hgKu":[function(require,module,exports) { +"use strict";exports.new=function(){return{}},exports.peekImpl=function(n){return function(t){return function(r){return function(e){return function(){return{}.hasOwnProperty.call(e,r)?n(e[r]):t}}}}},exports.poke=function(n){return function(t){return function(r){return function(){return r[n]=t,r}}}},exports.delete=function(n){return function(t){return function(){return delete t[n],t}}}; +},{}],"fXGJ":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),r=require("../Data.Maybe/index.js"),t=e.peekImpl(r.Just.create)(r.Nothing.value);module.exports={peek:t,new:e.new,poke:e.poke,delete:e.delete}; +},{"./foreign.js":"hgKu","../Data.Maybe/index.js":"5mN7"}],"jsiz":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),r=require("../Control.Applicative/index.js"),e=require("../Control.Apply/index.js"),t=require("../Control.Bind/index.js"),u=require("../Control.Category/index.js"),o=require("../Control.Monad.ST.Internal/index.js"),i=require("../Data.Array/index.js"),c=require("../Data.Eq/index.js"),f=require("../Data.Foldable/index.js"),a=require("../Data.FoldableWithIndex/index.js"),l=require("../Data.Function/index.js"),d=require("../Data.Function.Uncurried/index.js"),p=require("../Data.Functor/index.js"),s=require("../Data.FunctorWithIndex/index.js"),b=require("../Data.Maybe/index.js"),y=require("../Data.Monoid/index.js"),j=require("../Data.Ord/index.js"),m=require("../Data.Semigroup/index.js"),h=require("../Data.Show/index.js"),x=require("../Data.Traversable/index.js"),v=require("../Data.TraversableWithIndex/index.js"),q=require("../Data.Tuple/index.js"),T=require("../Data.Unfoldable/index.js"),S=require("../Foreign.Object.ST/index.js"),w=require("../Unsafe.Coerce/index.js"),F=n.toArrayWithKey(function(n){return function(n){return n}}),W=function(r){var e=i.toUnfoldable(r),t=n.toArrayWithKey(q.Tuple.create);return function(n){return e(t(n))}},A=function(r){var e=i.toUnfoldable(r),t=i.sortWith(j.ordString)(q.fst),u=n.toArrayWithKey(q.Tuple.create);return function(n){return e(t(u(n)))}},O=A(T.unfoldableArray),g=n.toArrayWithKey(q.Tuple.create),D=n._copyST,k=function(r){return function(e){return n.runST(t.bindFlipped(o.bindST)(S.poke(r)(e))(S.new))}},_=function(n){return new h.Show(function(r){return"(fromFoldable "+h.show(h.showArray(q.showTuple(h.showString)(n)))(g(r))+")"})},I=function(r){return function(e){return n.runST(function(){var n=D(e)();r(n)();return n})}},K=d.runFn4(n._lookup)(!1)(l.const(!0)),M=function(r){return function(e){return n._mapWithKey(e,r)}},C=d.runFn4(n._lookup)(b.Nothing.value)(b.Just.create),U=function(r){return function(e){return function(t){return n.all(function(e){return function(u){return n._lookup(!1,c.eq(r)(u),e,t)}})(e)}}},E=n.all(function(n){return function(n){return!1}}),z=function(n){return function(r){return I(S.poke(n)(r))}},N=new p.Functor(function(r){return function(e){return n._fmapObject(e,r)}}),B=new s.FunctorWithIndex(function(){return N},M),J=function(n){return w.unsafeCoerce},H=function(r){return function(e){return function(t){return n.runST(function(){var u=S.new();return f.for_(o.applicativeST)(r)(t)(function(r){return function(){var t=n._lookupST(r.value1,e(r.value1),r.value0,u)();return S.poke(r.value0)(t)(u)()}})(),u})}}},G=function(r){return function(e){return n.runST(function(){var n=S.new();return o.foreach(i.fromFoldable(r)(e))(function(r){return p.void(o.functorST)(S.poke(r.value0)(r.value1)(n))})(),n})}},L=n._copyST,P=function(r){return function(e){return function(t){return n._foldSCObject(t,e,r,b.fromMaybe)}}},Q=function(e){return function(u){return function(o){return n._foldM(t.bind(e.Bind1()))(u)(r.pure(e.Applicative0())(o))}}},R=function(r){return new m.Semigroup(function(e){return function(t){return I(function(u){return Q(o.monadST)(function(e){return function(u){return function(o){return S.poke(u)(n._lookup(o,function(n){return m.append(r)(n)(o)},u,t))(e)}}})(u)(e)})(t)}})},V=function(r){return new y.Monoid(function(){return R(r)},n.empty)},X=function(n){return I(function(r){return Q(o.monadST)(function(n){return function(r){return function(e){return S.poke(r)(e)(n)}}})(r)(n)})},Y=function(r){return f.foldl(r)(X)(n.empty)},Z=n._foldM(l.applyFlipped),$=function(n){return function(r){return Z(function(e){return function(t){return function(u){return m.append(n.Semigroup0())(e)(r(t)(u))}}})(y.mempty(n))}},nn=new f.Foldable(function(n){return function(r){return $(n)(l.const(r))}},function(n){return Z(function(r){return function(e){return n(r)}})},function(n){return function(r){return function(e){return f.foldr(f.foldableArray)(n)(r)(F(e))}}}),rn=new a.FoldableWithIndex(function(){return nn},function(n){return $(n)},function(n){return Z(l.flip(n))},function(r){return function(e){return function(t){return f.foldr(f.foldableArray)(q.uncurry(r))(e)(n.toArrayWithKey(q.Tuple.create)(t))}}}),en=new v.TraversableWithIndex(function(){return rn},function(){return B},function(){return tn},function(t){return function(u){return function(o){return Z(function(n){return function(r){return function(o){return e.apply(t.Apply0())(p.map(t.Apply0().Functor0())(l.flip(z(r)))(n))(u(r)(o))}}})(r.pure(t)(n.empty))(o)}}}),tn=new x.Traversable(function(){return nn},function(){return N},function(n){return x.traverse(tn)(n)(u.identity(u.categoryFn))},function(n){var r=v.traverseWithIndex(en)(n);return function(n){return r(l.const(n))}}),un=function(e){return function(t){var u,i=(u=function(n){return function(t){return function(u){return e(t)(u)?S.poke(t)(u)(n):r.pure(o.applicativeST)(n)}}},function(){var n=S.new();return Q(o.monadST)(u)(n)(t)()});return n.runST(i)}},on=function(n){return un(function(r){return l.const(n(r))})},cn=function(n){return un(l.const(n))},fn=function(n){return new c.Eq(function(r){return function(e){return U(n)(r)(e)&&U(n)(e)(r)}})},an=function(n){return new j.Ord(function(){return fn(n.Eq0())},function(r){return function(e){return j.compare(j.ordArray(q.ordTuple(j.ordString)(n)))(O(r))(O(e))}})},ln=new c.Eq1(function(n){return c.eq(fn(n))}),dn=function(n){return I(S.delete(n))},pn=function(n){return function(r){return p.mapFlipped(b.functorMaybe)(C(n)(r))(function(e){return new q.Tuple(e,dn(n)(r))})}},sn=function(n){return function(r){return function(e){var t=n(C(r)(e));if(t instanceof b.Nothing)return dn(r)(e);if(t instanceof b.Just)return z(r)(t.value0)(e);throw new Error("Failed pattern match at Foreign.Object (line 208, column 15 - line 210, column 25): "+[t.constructor.name])}}},bn=function(n){return function(r){return function(e){return sn(b.maybe(b.Nothing.value)(n))(r)(e)}}};module.exports={isEmpty:E,singleton:k,insert:z,lookup:C,toUnfoldable:W,toAscUnfoldable:A,fromFoldable:G,fromFoldableWith:H,fromHomogeneous:J,delete:dn,pop:pn,member:K,alter:sn,update:bn,mapWithKey:M,filterWithKey:un,filterKeys:on,filter:cn,values:F,union:X,unions:Y,isSubmap:U,fold:Z,foldMap:$,foldM:Q,foldMaybe:P,thawST:D,freezeST:L,functorObject:N,functorWithIndexObject:B,foldableObject:nn,foldableWithIndexObject:rn,traversableObject:tn,traversableWithIndexObject:en,eqObject:fn,eq1Object:ln,ordObject:an,showObject:_,semigroupObject:R,monoidObject:V,empty:n.empty,size:n.size,keys:n.keys,all:n.all,runST:n.runST,toArrayWithKey:n.toArrayWithKey}; +},{"./foreign.js":"cO3i","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Control.Monad.ST.Internal/index.js":"Sedc","../Data.Array/index.js":"4t4C","../Data.Eq/index.js":"Pq4F","../Data.Foldable/index.js":"eVDl","../Data.FoldableWithIndex/index.js":"9Efi","../Data.Function/index.js":"ImXJ","../Data.Function.Uncurried/index.js":"TowT","../Data.Functor/index.js":"+0AE","../Data.FunctorWithIndex/index.js":"OHRN","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Ord/index.js":"r4Vb","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7","../Data.Traversable/index.js":"n7EE","../Data.TraversableWithIndex/index.js":"V4EF","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z","../Foreign.Object.ST/index.js":"fXGJ","../Unsafe.Coerce/index.js":"ETUV"}],"hJ/N":[function(require,module,exports) { +"use strict";exports.copyRecord=function(n){var r={};for(var e in n)({}).hasOwnProperty.call(n,e)&&(r[e]=n[e]);return r},exports.unsafeInsert=function(n){return function(r){return function(e){return e[n]=r,e}}},exports.unsafeModify=function(n){return function(r){return function(e){return e[n]=r(e[n]),e}}},exports.unsafeDelete=function(n){return function(r){return delete r[n],r}},exports.unsafeRename=function(n){return function(r){return function(e){return e[r]=e[n],delete e[n],e}}}; +},{}],"VeY4":[function(require,module,exports) { +"use strict";var n=require("./foreign.js"),r=require("../Control.Category/index.js"),e=require("../Control.Semigroupoid/index.js"),u=require("../Data.Symbol/index.js"),t=require("../Record.Unsafe.Union/index.js"),o=require("../Unsafe.Coerce/index.js"),i=function(n){return n},f=function(n){return function(n){return function(r){return t.unsafeUnionFn(r,n)}}},c=e.semigroupoidFn,s=function(r){return function(e){return function(t){return function(t){return function(t){return function(t){return function(t){return function(o){return function(i){return n.unsafeRename(u.reflectSymbol(r)(t))(u.reflectSymbol(e)(o))(i)}}}}}}}}},l=function(n){return o.unsafeCoerce},a=function(r){return function(r){return function(r){return function(e){return function(t){return function(o){return n.unsafeModify(u.reflectSymbol(r)(e))(t)(o)}}}}}},d=function(n){return function(n){return function(n){return function(r){return t.unsafeUnionFn(r,n)}}}},m=function(r){return function(r){return function(r){return function(e){return function(t){return function(o){return n.unsafeInsert(u.reflectSymbol(r)(e))(t)(o)}}}}}},y=function(n){return function(n){return function(n){return function(r){return t.unsafeUnionFn(n,r)}}}},b=function(r){return function(e){return function(e){return function(e){return function(t){return n.unsafeDelete(u.reflectSymbol(r)(e))(t)}}}}},g=r.categoryFn,j=function(r){return function(e){return r(n.copyRecord(e))}};module.exports={build:j,insert:m,modify:a,delete:b,rename:s,merge:d,union:f,disjointUnion:y,nub:l,semigroupoidBuilder:c,categoryBuilder:g}; +},{"./foreign.js":"hJ/N","../Control.Category/index.js":"IAi2","../Control.Semigroupoid/index.js":"/riR","../Data.Symbol/index.js":"4oJQ","../Record.Unsafe.Union/index.js":"WmUk","../Unsafe.Coerce/index.js":"ETUV"}],"ZOFT":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),e=require("../Control.Bind/index.js"),u=require("../Control.Monad/index.js"),t=require("../Data.BooleanAlgebra/index.js"),o=require("../Data.Bounded/index.js"),i=require("../Data.CommutativeRing/index.js"),a=require("../Data.Eq/index.js"),c=require("../Data.Functor/index.js"),f=require("../Data.HeytingAlgebra/index.js"),l=require("../Data.Ord/index.js"),v=require("../Data.Ordering/index.js"),x=require("../Data.Ring/index.js"),d=require("../Data.Semigroup/index.js"),y=require("../Data.Semiring/index.js"),g=require("../Data.Show/index.js"),w=function(){function n(){}return n.value=new n,n}(),P=function(){function n(){}return n.value=new n,n}(),s=function(){function n(){}return n.value=new n,n}(),m=new g.Show(function(n){return"Proxy3"}),b=new g.Show(function(n){return"Proxy2"}),q=new g.Show(function(n){return"Proxy"}),p=new y.Semiring(function(n){return function(n){return w.value}},function(n){return function(n){return w.value}},w.value,w.value),A=new y.Semiring(function(n){return function(n){return P.value}},function(n){return function(n){return P.value}},P.value,P.value),j=new y.Semiring(function(n){return function(n){return s.value}},function(n){return function(n){return s.value}},s.value,s.value),D=new d.Semigroup(function(n){return function(n){return w.value}}),S=new d.Semigroup(function(n){return function(n){return P.value}}),R=new d.Semigroup(function(n){return function(n){return s.value}}),h=new x.Ring(function(){return p},function(n){return function(n){return w.value}}),B=new x.Ring(function(){return A},function(n){return function(n){return P.value}}),C=new x.Ring(function(){return j},function(n){return function(n){return s.value}}),E=new f.HeytingAlgebra(function(n){return function(n){return w.value}},function(n){return function(n){return w.value}},w.value,function(n){return function(n){return w.value}},function(n){return w.value},w.value),O=new f.HeytingAlgebra(function(n){return function(n){return P.value}},function(n){return function(n){return P.value}},P.value,function(n){return function(n){return P.value}},function(n){return P.value},P.value),H=new f.HeytingAlgebra(function(n){return function(n){return s.value}},function(n){return function(n){return s.value}},s.value,function(n){return function(n){return s.value}},function(n){return s.value},s.value),Q=new c.Functor(function(n){return function(n){return s.value}}),F=new a.Eq(function(n){return function(n){return!0}}),M=new l.Ord(function(){return F},function(n){return function(n){return v.EQ.value}}),k=new a.Eq(function(n){return function(n){return!0}}),z=new l.Ord(function(){return k},function(n){return function(n){return v.EQ.value}}),G=new a.Eq(function(n){return function(n){return!0}}),I=new l.Ord(function(){return G},function(n){return function(n){return v.EQ.value}}),J=new e.Discard(function(n){return e.bind(n)}),K=new e.Discard(function(n){return e.bind(n)}),L=new e.Discard(function(n){return e.bind(n)}),N=new i.CommutativeRing(function(){return h}),T=new i.CommutativeRing(function(){return B}),U=new i.CommutativeRing(function(){return C}),V=new o.Bounded(function(){return M},w.value,w.value),W=new o.Bounded(function(){return z},P.value,P.value),X=new o.Bounded(function(){return I},s.value,s.value),Y=new t.BooleanAlgebra(function(){return E}),Z=new t.BooleanAlgebra(function(){return O}),$=new t.BooleanAlgebra(function(){return H}),_=new r.Apply(function(){return Q},function(n){return function(n){return s.value}}),nn=new e.Bind(function(){return _},function(n){return function(n){return s.value}}),rn=new n.Applicative(function(){return _},function(n){return s.value}),en=new u.Monad(function(){return rn},function(){return nn});module.exports={Proxy:s,Proxy2:P,Proxy3:w,eqProxy:G,functorProxy:Q,ordProxy:I,applicativeProxy:rn,applyProxy:_,bindProxy:nn,booleanAlgebraProxy:$,boundedProxy:X,commutativeRingProxy:U,discardProxy:L,heytingAlgebraProxy:H,monadProxy:en,ringProxy:C,semigroupProxy:R,semiringProxy:j,showProxy:q,eqProxy2:k,ordProxy2:z,booleanAlgebraProxy2:Z,boundedProxy2:W,commutativeRingProxy2:T,discardProxy2:K,heytingAlgebraProxy2:O,ringProxy2:B,semigroupProxy2:S,semiringProxy2:A,showProxy2:b,eqProxy3:F,ordProxy3:M,booleanAlgebraProxy3:Y,boundedProxy3:V,commutativeRingProxy3:N,discardProxy3:J,heytingAlgebraProxy3:E,ringProxy3:h,semigroupProxy3:D,semiringProxy3:p,showProxy3:m}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Monad/index.js":"U/Ix","../Data.BooleanAlgebra/index.js":"e7y+","../Data.Bounded/index.js":"kcUU","../Data.CommutativeRing/index.js":"60TQ","../Data.Eq/index.js":"Pq4F","../Data.Functor/index.js":"+0AE","../Data.HeytingAlgebra/index.js":"paZe","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Ring/index.js":"E2qH","../Data.Semigroup/index.js":"EsAJ","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7"}],"aDiV":[function(require,module,exports) { +"use strict";var n=require("../Control.Alt/index.js"),e=require("../Control.Applicative/index.js"),t=require("../Control.Bind/index.js"),r=require("../Control.Category/index.js"),i=require("../Control.Monad.Except/index.js"),o=require("../Control.Monad.Except.Trans/index.js"),u=require("../Control.Semigroupoid/index.js"),c=require("../Data.Array/index.js"),d=require("../Data.Bifunctor/index.js"),a=require("../Data.Either/index.js"),s=require("../Data.Foldable/index.js"),f=require("../Data.Function/index.js"),p=require("../Data.Functor/index.js"),l=require("../Data.Generic.Rep/index.js"),m=require("../Data.Identity/index.js"),g=require("../Data.List/index.js"),E=require("../Data.List.Types/index.js"),x=require("../Data.Maybe/index.js"),y=require("../Data.Monoid/index.js"),w=require("../Data.Newtype/index.js"),v=require("../Data.Semigroup/index.js"),T=require("../Data.Show/index.js"),b=require("../Data.Symbol/index.js"),h=require("../Data.Traversable/index.js"),I=require("../Data.Unfoldable/index.js"),A=require("../Data.Unit/index.js"),F=require("../Data.Void/index.js"),D=require("../Foreign/index.js"),j=require("../Foreign.Generic.Internal/index.js"),q=require("../Foreign.Index/index.js"),S=require("../Foreign.NullOrUndefined/index.js"),N=require("../Foreign.Object/index.js"),O=require("../Record/index.js"),R=require("../Record.Builder/index.js"),C=require("../Type.Data.RowList/index.js"),L=require("../Type.Proxy/index.js"),P=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),W=function(n){this.encodeArgs=n},G=function(n){this.encodeOpts=n},U=function(n){this.decodeArgs=n},B=function(n){this.decodeOpts=n},K=function(n){this.countArgs=n},M=function(n){this.encodeWithOptions=n},J=function(n){this.encodeRecordWithOptions=n},z=function(n){this.encode=n},V=function(n){this.decodeWithOptions=n},k=function(n){this.decodeRecordWithOptions=n},H=function(n){this.decode=n},Q=new z(F.absurd),X=new H(function(n){return o.except(m.applicativeIdentity)(new a.Left(e.pure(E.applicativeNonEmptyList)(new D.ForeignError("Decode: void"))))}),Y=new z(function(n){return D.unsafeToForeign({})}),Z=new H(function(n){return e.pure(o.applicativeExceptT(m.monadIdentity))(A.unit)}),$=new z(D.unsafeToForeign),_=new H(D.readString),nn=new z(D.unsafeToForeign),en=new H(D.readNumber),tn=new z(D.unsafeToForeign),rn=new H(D.readInt),on=new W(function(n){return y.mempty(y.monoidFn(E.monoidList))}),un=new B(function(n){return function(n){return D.fail(new D.ForeignError("No constructors"))}}),cn=new U(function(n){return function(n){return function(t){return t instanceof E.Nil?e.pure(o.applicativeExceptT(m.monadIdentity))({result:l.NoArguments.value,rest:E.Nil.value,next:n}):D.fail(new D.ForeignError("Too many constructor arguments"))}}}),dn=new K(function(n){return new a.Left(l.NoArguments.value)}),an=new K(function(n){return new a.Right(1)}),sn=new z(r.identity(r.categoryFn)),fn=new H(e.pure(o.applicativeExceptT(m.monadIdentity))),pn=function(n){return n.encodeWithOptions},ln=function(n){return new W(function(e){return function(t){return g.singleton(pn(n)(e)(t))}})},mn=function(n){return n.encodeRecordWithOptions},gn=function(n){return function(n){return new M(function(e){var t=mn(n)(C.RLProxy.value)(e);return function(n){return D.unsafeToForeign(t(n))}})}},En=new J(function(n){return function(n){return function(n){return N.empty}}}),xn=function(n){return function(e){return function(t){return function(r){return new J(function(i){return function(i){return function(o){var u=mn(e)(C.RLProxy.value)(i)(o),c=b.reflectSymbol(t)(b.SProxy.value);return N.insert(i.fieldTransform(c))(pn(r)(i)(O.get(t)(n)(b.SProxy.value)(o)))(u)}}})}}}},yn=function(n){return n.encodeOpts},wn=new G(function(n){return function(e){return yn(wn)(n)(e)}}),vn=function(n){return function(e){return new G(function(t){return function(r){if(r instanceof l.Inl)return yn(n)({sumEncoding:t.sumEncoding,unwrapSingleConstructors:!1,unwrapSingleArguments:t.unwrapSingleArguments,fieldTransform:t.fieldTransform})(r.value0);if(r instanceof l.Inr)return yn(e)({sumEncoding:t.sumEncoding,unwrapSingleConstructors:!1,unwrapSingleArguments:t.unwrapSingleArguments,fieldTransform:t.fieldTransform})(r.value0);throw new Error("Failed pattern match at Foreign.Generic.Class (line 351, column 1 - line 355, column 85): "+[t.constructor.name,r.constructor.name])}})}},Tn=function(n){return n.encodeArgs},bn=function(n){return function(e){return new W(function(t){return function(r){return v.append(E.semigroupList)(Tn(n)(t)(r.value0))(Tn(e)(t)(r.value1))}})}},hn=function(n){return function(e){return new G(function(t){return function(r){var i,o,u=(i=g.toUnfoldable(I.unfoldableArray),o=Tn(e)(t),function(n){return 0===(e=i(o(n))).length?x.Nothing.value:1===e.length&&t.unwrapSingleArguments?new x.Just(e[0]):new x.Just(D.unsafeToForeign(e));var e}),c=b.reflectSymbol(n)(b.SProxy.value);return t.unwrapSingleConstructors?x.maybe(D.unsafeToForeign({}))(D.unsafeToForeign)(u(r)):D.unsafeToForeign(N.union(N.singleton(t.sumEncoding.value0.tagFieldName)(D.unsafeToForeign(t.sumEncoding.value0.constructorTagTransform(c))))(x.maybe(N.empty)(N.singleton(t.sumEncoding.value0.contentsFieldName))(u(r))))}})}},In=function(n){return n.encode},An=function(n){return new M(function(e){return In(n)})},Fn=function(n){return new z((e=In(n),t=w.unwrap(m.newtypeIdentity),function(n){return e(t(n))}));var e,t},Dn=function(n){return new z(x.maybe(S.null)(In(n)))},jn=function(n){return new z((e=N.mapWithKey(function(e){return In(n)}),function(n){return D.unsafeToForeign(e(n))}));var e},qn={sumEncoding:new P({tagFieldName:"tag",contentsFieldName:"contents",constructorTagTransform:r.identity(r.categoryFn)}),unwrapSingleConstructors:!1,unwrapSingleArguments:!0,fieldTransform:r.identity(r.categoryFn)},Sn=function(n){return function(e){return new z(pn(gn(n)(e))(qn))}},Nn=function(n){return n.decodeWithOptions},On=function(n){return new U(function(r){return function(u){return function(c){return c instanceof E.Cons?t.bind(o.bindExceptT(m.monadIdentity))(i.mapExcept(d.lmap(a.bifunctorEither)(p.map(E.functorNonEmptyList)(D.ErrorAtIndex.create(u))))(Nn(n)(r)(c.value0)))(function(n){return e.pure(o.applicativeExceptT(m.monadIdentity))({result:n,rest:c.value1,next:u+1|0})}):D.fail(new D.ForeignError("Not enough constructor arguments"))}}})},Rn=function(n){return n.decodeRecordWithOptions},Cn=function(n){return function(n){return new V(function(e){return p.map(p.functorFn)(p.map(o.functorExceptT(m.functorIdentity))(f.flip(R.build)({})))(Rn(n)(C.RLProxy.value)(e))})}},Ln=function(n){return function(e){return new H(Nn(Cn(n)(e))(qn))}},Pn=new k(function(n){return function(n){return function(n){return e.pure(o.applicativeExceptT(m.monadIdentity))(r.identity(R.categoryBuilder))}}}),Wn=function(n){return function(r){return function(c){return function(s){return function(f){return new k(function(l){return function(l){return function(g){return t.bind(o.bindExceptT(m.monadIdentity))(Rn(r)(C.RLProxy.value)(l)(g))(function(r){var x=b.reflectSymbol(c)(b.SProxy.value),y=l.fieldTransform(x);return t.bind(o.bindExceptT(m.monadIdentity))(q.index(q.indexString)(g)(y))(function(g){return t.bind(o.bindExceptT(m.monadIdentity))(i.mapExcept(d.lmap(a.bifunctorEither)(p.map(E.functorNonEmptyList)(D.ErrorAtProperty.create(y))))(Nn(s)(l)(g)))(function(t){return e.pure(o.applicativeExceptT(m.monadIdentity))(u.composeFlipped(R.semigroupoidBuilder)(r)(R.insert(n)(f)(c)(b.SProxy.value)(t)))})})})}}})}}}}},Gn=function(n){return n.decodeOpts},Un=function(e){return function(t){return new B(function(r){return function(i){var u={unwrapSingleConstructors:!1,fieldTransform:r.fieldTransform,sumEncoding:r.sumEncoding,unwrapSingleArguments:r.unwrapSingleArguments};return n.alt(o.altExceptT(E.semigroupNonEmptyList)(m.monadIdentity))(p.map(o.functorExceptT(m.functorIdentity))(l.Inl.create)(Gn(e)(u)(i)))(p.map(o.functorExceptT(m.functorIdentity))(l.Inr.create)(Gn(t)(u)(i)))}})}},Bn=function(n){return n.decodeArgs},Kn=function(n){return function(r){return new U(function(i){return function(u){return function(c){return t.bind(o.bindExceptT(m.monadIdentity))(Bn(n)(i)(u)(c))(function(n){return t.bind(o.bindExceptT(m.monadIdentity))(Bn(r)(i)(n.next)(n.rest))(function(t){return e.pure(o.applicativeExceptT(m.monadIdentity))({result:new l.Product(n.result,t.result),rest:t.rest,next:t.next})})})}}})}},Mn=function(n){return n.decode},Jn=function(n){return new V(function(e){return Mn(n)})},zn=function(n){return new H((e=p.map(o.functorExceptT(m.functorIdentity))(m.Identity),t=Mn(n),function(n){return e(t(n))}));var e,t},Vn=function(n){return new H(S.readNullOrUndefined(Mn(n)))},kn=function(n){return new H(t.composeKleisliFlipped(o.bindExceptT(m.monadIdentity))((e=h.sequence(N.traversableObject)(o.applicativeExceptT(m.monadIdentity)),r=N.mapWithKey(function(e){return Mn(n)}),function(n){return e(r(n))}))(j.readObject));var e,r},Hn=function(n){return n.countArgs},Qn=function(n){return function(e){return new K(function(t){var r=Hn(e)(L.Proxy.value),i=Hn(n)(L.Proxy.value);if(i instanceof a.Left&&r instanceof a.Left)return new a.Left(new l.Product(i.value0,r.value0));if(i instanceof a.Left&&r instanceof a.Right)return new a.Right(r.value0);if(i instanceof a.Right&&r instanceof a.Left)return new a.Right(i.value0);if(i instanceof a.Right&&r instanceof a.Right)return new a.Right(i.value0+r.value0|0);throw new Error("Failed pattern match at Foreign.Generic.Class (line 400, column 5 - line 404, column 40): "+[i.constructor.name,r.constructor.name])})}},Xn=function(n){return function(r){return function(u){return new B(function(c){return function(f){var x=Hn(u)(L.Proxy.value),y=function(n){if(x instanceof a.Left)return e.pure(o.applicativeExceptT(m.monadIdentity))(x.value0);if(x instanceof a.Right&&1===x.value0&&c.unwrapSingleArguments)return t.bind(o.bindExceptT(m.monadIdentity))(Bn(r)(c)(0)(g.singleton(n)))(function(n){return t.discard(t.discardUnit)(o.bindExceptT(m.monadIdentity))(e.unless(o.applicativeExceptT(m.monadIdentity))(g.null(n.rest))(D.fail(new D.ForeignError("Expected a single argument"))))(function(){return e.pure(o.applicativeExceptT(m.monadIdentity))(n.result)})});if(x instanceof a.Right)return t.bind(o.bindExceptT(m.monadIdentity))(D.readArray(n))(function(n){return t.bind(o.bindExceptT(m.monadIdentity))(Bn(r)(c)(0)(g.fromFoldable(s.foldableArray)(n)))(function(n){return t.discard(t.discardUnit)(o.bindExceptT(m.monadIdentity))(e.unless(o.applicativeExceptT(m.monadIdentity))(g.null(n.rest))(D.fail(new D.ForeignError("Expected "+T.show(T.showInt)(x.value0)+" constructor arguments"))))(function(){return e.pure(o.applicativeExceptT(m.monadIdentity))(n.result)})})});throw new Error("Failed pattern match at Foreign.Generic.Class (line 307, column 9 - line 319, column 24): "+[x.constructor.name])},w=b.reflectSymbol(n)(b.SProxy.value);return c.unwrapSingleConstructors?p.map(o.functorExceptT(m.functorIdentity))(l.Constructor)(y(f)):t.bind(o.bindExceptT(m.monadIdentity))(i.mapExcept(d.lmap(a.bifunctorEither)(p.map(E.functorNonEmptyList)(D.ErrorAtProperty.create(c.sumEncoding.value0.tagFieldName))))(t.bind(o.bindExceptT(m.monadIdentity))(t.bind(o.bindExceptT(m.monadIdentity))(q.index(q.indexString)(f)(c.sumEncoding.value0.tagFieldName))(D.readString))(function(n){var r=c.sumEncoding.value0.constructorTagTransform(w);return t.discard(t.discardUnit)(o.bindExceptT(m.monadIdentity))(e.unless(o.applicativeExceptT(m.monadIdentity))(n===r)(D.fail(new D.ForeignError("Expected "+T.show(T.showString)(r)+" tag"))))(function(){return e.pure(o.applicativeExceptT(m.monadIdentity))(n)})})))(function(n){return t.bind(o.bindExceptT(m.monadIdentity))(i.mapExcept(d.lmap(a.bifunctorEither)(p.map(E.functorNonEmptyList)(D.ErrorAtProperty.create(c.sumEncoding.value0.contentsFieldName))))(t.bind(o.bindExceptT(m.monadIdentity))(q.index(q.indexString)(f)(c.sumEncoding.value0.contentsFieldName))(y)))(function(n){return e.pure(o.applicativeExceptT(m.monadIdentity))(n)})})}})}}},Yn=new z(D.unsafeToForeign),Zn=new H(D.readChar),$n=new z(D.unsafeToForeign),_n=new H(D.readBoolean),ne=function(n){return new z((e=p.map(p.functorArray)(In(n)),function(n){return D.unsafeToForeign(e(n))}));var e},ee=function(n){return new H((e=function(e){return function(t){return i.mapExcept(d.lmap(a.bifunctorEither)(p.map(E.functorNonEmptyList)(D.ErrorAtIndex.create(e))))(Mn(n)(t))}},t.composeKleisli(o.bindExceptT(m.monadIdentity))(D.readArray)(function(n){return h.sequence(h.traversableArray)(o.applicativeExceptT(m.monadIdentity))(c.zipWith(e)(c.range(0)(c.length(n)))(n))})));var e};module.exports={countArgs:Hn,decode:Mn,decodeArgs:Bn,decodeOpts:Gn,decodeRecordWithOptions:Rn,decodeWithOptions:Nn,encode:In,encodeArgs:Tn,encodeOpts:yn,encodeRecordWithOptions:mn,encodeWithOptions:pn,TaggedObject:P,defaultOptions:qn,Decode:H,Encode:z,DecodeWithOptions:V,EncodeWithOptions:M,DecodeRecord:k,EncodeRecord:J,GenericDecode:B,GenericEncode:G,GenericDecodeArgs:U,GenericEncodeArgs:W,GenericCountArgs:K,voidDecode:X,unitDecode:Z,foreignDecode:fn,stringDecode:_,charDecode:Zn,booleanDecode:_n,numberDecode:en,intDecode:rn,identityDecode:zn,arrayDecode:ee,maybeDecode:Vn,objectDecode:kn,recordDecode:Ln,voidEncode:Q,unitEncode:Y,foreignEncode:sn,stringEncode:$,charEncode:Yn,booleanEncode:$n,numberEncode:nn,intEncode:tn,identityEncode:Fn,arrayEncode:ne,maybeEncode:Dn,objectEncode:jn,recordEncode:Sn,decodeWithOptionsRecord:Cn,decodeWithOptionsOther:Jn,encodeWithOptionsRecord:gn,encodeWithOptionsOther:An,decodeRecordNil:Pn,encodeRecordNil:En,decodeRecordCons:Wn,encodeRecordCons:xn,genericDecodeNoConstructors:un,genericEncodeNoConstructors:wn,genericDecodeConstructor:Xn,genericEncodeConstructor:hn,genericDecodeSum:Un,genericEncodeSum:vn,genericDecodeArgsNoArguments:cn,genericEncodeArgsNoArguments:on,genericDecodeArgsArgument:On,genericEncodeArgsArgument:ln,genericDecodeArgsProduct:Kn,genericEncodeArgsProduct:bn,genericCountArgsNoArguments:dn,genericCountArgsArgument:an,genericCountArgsProduct:Qn}; +},{"../Control.Alt/index.js":"lN+m","../Control.Applicative/index.js":"qYya","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Control.Monad.Except/index.js":"Fye2","../Control.Monad.Except.Trans/index.js":"gr8B","../Control.Semigroupoid/index.js":"/riR","../Data.Array/index.js":"4t4C","../Data.Bifunctor/index.js":"e2Wc","../Data.Either/index.js":"B2JL","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Generic.Rep/index.js":"AuzG","../Data.Identity/index.js":"2OKT","../Data.List/index.js":"ezw6","../Data.List.Types/index.js":"Xxuc","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Newtype/index.js":"lz8k","../Data.Semigroup/index.js":"EsAJ","../Data.Show/index.js":"mFY7","../Data.Symbol/index.js":"4oJQ","../Data.Traversable/index.js":"n7EE","../Data.Unfoldable/index.js":"77+Z","../Data.Unit/index.js":"NhVk","../Data.Void/index.js":"bncE","../Foreign/index.js":"pu1p","../Foreign.Generic.Internal/index.js":"71qG","../Foreign.Index/index.js":"Ryy1","../Foreign.NullOrUndefined/index.js":"k5yP","../Foreign.Object/index.js":"jsiz","../Record/index.js":"0gG4","../Record.Builder/index.js":"VeY4","../Type.Data.RowList/index.js":"XaXP","../Type.Proxy/index.js":"ZOFT"}],"HhmG":[function(require,module,exports) { +"use strict";var e=require("../Data.CommutativeRing/index.js"),n=require("../Data.DivisionRing/index.js"),r=require("../Data.Eq/index.js"),t=require("../Data.EuclideanRing/index.js"),i=require("../Data.Lens.Getter/index.js"),u=require("../Data.Lens.Iso/index.js"),o=require("../Data.Lens.Iso.Newtype/index.js"),a=require("../Data.Maybe/index.js"),c=require("../Data.Newtype/index.js"),d=require("../Data.Number.Format/index.js"),s=require("../Data.Ord/index.js"),p=require("../Data.Ring/index.js"),w=require("../Data.Semiring/index.js"),f=require("../Data.Show/index.js"),g=require("../Data.String.CodeUnits/index.js"),m=require("../Data.String.Common/index.js"),h=require("../Data.String.Pattern/index.js"),x=require("../Foreign.Generic.Class/index.js"),q=require("../Math/index.js"),l=function(e){return e},D=function(e){return e},N=function(e){return e},j=new f.Show(function(e){return e}),B=new f.Show(function(e){return d.toStringWith(d.fixed(0))(e)+" Bp"}),y=w.semiringNumber,v=p.ringNumber,C=s.ordNumber,I=new c.Newtype(function(e){return e},l),S=new c.Newtype(function(e){return e},D),b=function(e){var n=m.toLower(c.unwrap(S)(e)),r=g.stripPrefix(c.wrap(h.newtypePattern)("chr"))(n);if(r instanceof a.Nothing)return c.wrap(S)("chr"+n);if(r instanceof a.Just)return c.wrap(S)(r.value0);throw new Error("Failed pattern match at Genetics.Browser.Types (line 54, column 6 - line 56, column 27): "+[r.constructor.name])},R=new c.Newtype(function(e){return e},N),L=t.euclideanRingNumber,_=new r.Eq(function(e){return function(n){return b(e)===b(n)}}),E=new s.Ord(function(){return _},function(e){return function(n){var r=b(e),t=b(n);return s.compare(s.ordString)(r)(t)}}),P=r.eqNumber,F=x.stringEncode,G=x.numberEncode,W=n.divisionringNumber,J=x.stringDecode,M=x.numberDecode,O=e.commutativeRingNumber,T=function(e){var n=m.toLower(e),r=g.stripPrefix(c.wrap(h.newtypePattern)("chr"))(n);if(r instanceof a.Nothing)return c.wrap(S)("chr"+n);if(r instanceof a.Just)return c.wrap(S)(r.value0);throw new Error("Failed pattern match at Genetics.Browser.Types (line 47, column 6 - line 49, column 28): "+[r.constructor.name])},U=function(e){return i.to(d.toStringWith(d.precision(e)))},k=function(e){return i.to(d.toStringWith(d.fixed(e)))},z=function(e){return i.to(d.toStringWith(d.exponential(e)))},A=function(e){return u.iso(function(e){return c.wrap(I)(-q.log(e)/q.ln10)})(function(e){return q.pow(10)(-e)})(e)},H=function(e){return o._Newtype(S)(S)(e)},K=function(e){return o._Newtype(R)(R)(e)};module.exports={Bp:N,_Bp:K,ChrId:D,chrId:T,validChrId:b,_ChrId:H,NegLog10:l,_NegLog10:A,_prec:U,_fixed:k,_exp:z,newtypeBp:R,eqBp:P,ordBp:C,semiringBp:y,ringBp:v,divisionRingBp:W,euclideanRingBp:L,commutativeRingBp:O,encodeBp:G,decodeBp:M,showBp:B,newtypeChrId:S,eqChrId:_,ordChrId:E,encodeChrId:F,decodeChrId:J,showChrId:j,newtypeNegLog10:I}; +},{"../Data.CommutativeRing/index.js":"60TQ","../Data.DivisionRing/index.js":"xYq2","../Data.Eq/index.js":"Pq4F","../Data.EuclideanRing/index.js":"2IRB","../Data.Lens.Getter/index.js":"OPOX","../Data.Lens.Iso/index.js":"fFCp","../Data.Lens.Iso.Newtype/index.js":"CiFJ","../Data.Maybe/index.js":"5mN7","../Data.Newtype/index.js":"lz8k","../Data.Number.Format/index.js":"VX77","../Data.Ord/index.js":"r4Vb","../Data.Ring/index.js":"E2qH","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7","../Data.String.CodeUnits/index.js":"6c6X","../Data.String.Common/index.js":"OSrc","../Data.String.Pattern/index.js":"nKWe","../Foreign.Generic.Class/index.js":"aDiV","../Math/index.js":"Rpaz"}],"BQGe":[function(require,module,exports) { +exports._parseJSON=JSON.parse,exports._undefined=void 0; +},{}],"DqNI":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),n=require("../Control.Alt/index.js"),r=require("../Control.Applicative/index.js"),t=require("../Control.Apply/index.js"),i=require("../Control.Bind/index.js"),u=require("../Control.Category/index.js"),o=require("../Control.Monad.Except/index.js"),a=require("../Control.Monad.Except.Trans/index.js"),c=require("../Control.Semigroupoid/index.js"),f=require("../Data.Bifunctor/index.js"),d=require("../Data.Boolean/index.js"),l=require("../Data.Either/index.js"),p=require("../Data.Function/index.js"),s=require("../Data.Functor/index.js"),m=require("../Data.Identity/index.js"),y=require("../Data.List.Types/index.js"),x=require("../Data.Maybe/index.js"),w=require("../Data.Nullable/index.js"),g=require("../Data.Semigroup/index.js"),F=require("../Data.Symbol/index.js"),v=require("../Data.Traversable/index.js"),b=require("../Data.TraversableWithIndex/index.js"),E=require("../Data.Variant/index.js"),I=require("../Effect.Exception/index.js"),T=require("../Effect.Uncurried/index.js"),h=require("../Effect.Unsafe/index.js"),j=require("../Foreign/index.js"),q=require("../Foreign.Index/index.js"),S=require("../Foreign.Object/index.js"),N=require("../Global.Unsafe/index.js"),L=require("../Partial.Unsafe/index.js"),P=require("../Record/index.js"),R=require("../Record.Builder/index.js"),D=require("../Type.Data.RowList/index.js"),O=function(e){this.writeVariantImpl=e},V=function(e){this.writeImplFields=e},C=function(e){this.writeImpl=e},W=function(e){this.readVariantImpl=e},A=function(e){this.getFields=e},B=function(e){this.readImpl=e},M=function(e){return e.writeVariantImpl},J=function(e){return e.writeImplFields},K=function(e){return e.writeImpl},U=function(e){var n=K(e);return function(e){return N.unsafeStringify(n(e))}},_=function(e){return function(e){return new C(function(n){return M(e)(D.RLProxy.value)(n)})}},G=new C(j.unsafeToForeign),k=function(e){return new C((n=S.mapWithKey(p.const(K(e))),function(e){return j.unsafeToForeign(n(e))}));var n},z=new C(j.unsafeToForeign),H=function(e){return new C((n=x.maybe(j.unsafeToForeign(w.toNullable(x.Nothing.value)))(K(e)),function(e){return n(w.toMaybe(e))}));var n},Q=new C(j.unsafeToForeign),X=new C(u.identity(u.categoryFn)),Y=new C(j.unsafeToForeign),Z=new C(j.unsafeToForeign),$=function(e){return new C(function(n){return j.unsafeToForeign(s.map(s.functorArray)(K(e))(n))})},ee=function(e){return K(e)},ne=e._undefined,re=function(e){return new C(x.maybe(ne)(K(e)))},te=function(e){return function(e){return new C(function(n){var r=J(e)(D.RLProxy.value)(n);return j.unsafeToForeign(R.build(r)({}))})}},ie=new W(function(e){return function(e){return j.fail(new j.ForeignError("Unable to match any variant member."))}}),ue=function(e){return e.readVariantImpl},oe=new B(j.readString),ae=new B(j.readNumber),ce=new B(j.readInt),fe=function(e){return e.readImpl},de=function(e){return new B((n=fe(e),function(e){return j.isNull(e)||j.isUndefined(e)?r.pure(a.applicativeExceptT(m.monadIdentity))(x.Nothing.value):s.map(a.functorExceptT(m.functorIdentity))(x.Just.create)(n(e))}));var n},le=function(e){return new B(function(n){return o.withExcept(s.map(y.functorNonEmptyList)(function(e){return e instanceof j.TypeMismatch?new j.TypeMismatch("Nullable "+e.value0,e.value1):e}))(i.bindFlipped(a.bindExceptT(m.monadIdentity))(s.map(s.functorFn)(s.map(a.functorExceptT(m.functorIdentity))(w.toNullable))(v.traverse(v.traversableMaybe)(a.applicativeExceptT(m.monadIdentity))(fe(e))))(j.readNull(n)))})},pe=function(e){return new B(i.composeKleisliFlipped(a.bindExceptT(m.monadIdentity))((n=v.sequence(S.traversableObject)(a.applicativeExceptT(m.monadIdentity)),t=S.mapWithKey(p.const(fe(e))),function(e){return n(t(e))}))(function(e){if("Object"===j.tagOf(e))return r.pure(a.applicativeExceptT(m.monadIdentity))(j.unsafeFromForeign(e));if(d.otherwise)return j.fail(new j.TypeMismatch("Object",j.tagOf(e)));throw new Error("Failed pattern match at Simple.JSON (line 188, column 7 - line 188, column 51): "+[e.constructor.name])}));var n,t},se=function(e){return function(e){return new B(function(n){return ue(e)(D.RLProxy.value)(n)})}},me=new B(r.pure(a.applicativeExceptT(m.monadIdentity))),ye=new A(function(e){return function(e){return r.pure(a.applicativeExceptT(m.monadIdentity))(u.identity(R.categoryBuilder))}}),xe=new B(j.readChar),we=new B(j.readBoolean),ge=function(e){return new B(i.composeKleisliFlipped(a.bindExceptT(m.monadIdentity))(b.traverseWithIndex(b.traversableWithIndexArray)(a.applicativeExceptT(m.monadIdentity))(function(n){return function(r){return o.withExcept(s.map(y.functorNonEmptyList)(j.ErrorAtIndex.create(n)))(fe(e)(r))}}))(j.readArray))},Fe=function(e){return fe(e)},ve=function(e){var n=fe(e);return function(e){return o.runExcept(n(e))}},be=function(e){var n=ve(e);return function(e){return n(j.unsafeToForeign(e))}},Ee=function(e){var n=ve(e);return function(e){return l.hush(n(e))}},Ie=function(){var n,t=f.lmap(l.bifunctorEither)((n=r.pure(y.applicativeNonEmptyList),function(e){return n(j.ForeignError.create(I.message(e)))})),i=T.runEffectFn1(e._parseJSON);return function(e){return a.ExceptT(m.Identity(t(h.unsafePerformEffect(I.try(i(e))))))}}(),Te=function(e){var n=i.composeKleisliFlipped(a.bindExceptT(m.monadIdentity))(fe(e))(Ie);return function(e){return o.runExcept(n(e))}},he=function(e){var n=Te(e);return function(e){return l.hush(n(e))}},je=function(e){return i.composeKleisliFlipped(a.bindExceptT(m.monadIdentity))(fe(e))(Ie)},qe=new O(function(e){return function(e){return L.unsafeCrashWith("Variant was not able to be writen row WriteForeign.")}}),Se=new V(function(e){return function(e){return u.identity(R.categoryBuilder)}}),Ne=function(e){return e.getFields},Le=function(e){return function(e){return new B(function(n){return s.map(a.functorExceptT(m.functorIdentity))(p.flip(R.build)({}))(Ne(e)(D.RLProxy.value)(n))})}},Pe=function(e){return function(n){return function(r){return function(t){return new O(function(i){return function(i){return E.on(r)(e)(F.SProxy.value)(function(r){return j.unsafeToForeign({type:F.reflectSymbol(e)(F.SProxy.value),value:K(n)(r)})})(M(t)(D.RLProxy.value))(i)}})}}}},Re=function(e){return function(n){return function(r){return function(t){return function(i){return function(u){return new V(function(o){return function(o){var a=J(r)(D.RLProxy.value)(o),f=K(n)(P.get(e)(t)(F.SProxy.value)(o));return c.compose(R.semigroupoidBuilder)(R.insert(u)(i)(e)(F.SProxy.value)(f))(a)}})}}}}}},De=function(e){return function(n){return function(r){if(n instanceof l.Left&&r instanceof l.Right)return new l.Left(n.value0);if(n instanceof l.Left&&r instanceof l.Left)return new l.Left(g.append(e)(n.value0)(r.value0));if(n instanceof l.Right&&r instanceof l.Left)return new l.Left(r.value0);if(n instanceof l.Right&&r instanceof l.Right)return new l.Right(n.value0(r.value0));throw new Error("Failed pattern match at Simple.JSON (line 232, column 1 - line 232, column 90): "+[n.constructor.name,r.constructor.name])}}},Oe=function(e){return function(n){return function(r){return function(i){return a.ExceptT(t.apply(n.Apply0())(s.map(n.Apply0().Functor0())(De(e))(a.runExceptT(r)))(a.runExceptT(i)))}}}},Ve=function(e){return function(n){return function(t){return function(u){return function(f){return new A(function(d){return function(d){var l=Ne(t)(D.RLProxy.value)(d),p=F.reflectSymbol(e)(F.SProxy.value),x=o.withExcept(s.map(y.functorNonEmptyList)(j.ErrorAtProperty.create(p))),w=i.bind(a.bindExceptT(m.monadIdentity))(x(i.bindFlipped(a.bindExceptT(m.monadIdentity))(fe(n))(q.readProp(p)(d))))(function(n){return r.pure(a.applicativeExceptT(m.monadIdentity))(R.insert(f)(u)(e)(F.SProxy.value)(n))});return Oe(y.semigroupNonEmptyList)(m.applicativeIdentity)(s.map(a.functorExceptT(m.functorIdentity))(c.compose(R.semigroupoidBuilder))(w))(l)}})}}}}},Ce=function(e){return function(t){return function(u){return function(o){return new W(function(c){return function(c){var f=F.reflectSymbol(e)(F.SProxy.value);return n.alt(a.altExceptT(y.semigroupNonEmptyList)(m.monadIdentity))(i.bind(a.bindExceptT(m.monadIdentity))(fe(Le()(Ve(new F.IsSymbol(function(){return"type"}))(oe)(Ve(new F.IsSymbol(function(){return"value"}))(me)(ye)()())()()))(c))(function(n){return n.type===f?i.bind(a.bindExceptT(m.monadIdentity))(fe(t)(n.value))(function(n){return r.pure(a.applicativeExceptT(m.monadIdentity))(E.inj(u)(e)(F.SProxy.value)(n))}):j.fail(j.ForeignError.create("Did not match variant tag "+f))}))(ue(o)(D.RLProxy.value)(c))}})}}}};module.exports={readJSON:Te,"readJSON'":je,readJSON_:he,writeJSON:U,write:ee,read:ve,"read'":Fe,read_:Ee,parseJSON:Ie,undefined:ne,ReadForeign:B,readImpl:fe,ReadForeignFields:A,getFields:Ne,ReadForeignVariant:W,readVariantImpl:ue,WriteForeign:C,writeImpl:K,WriteForeignFields:V,writeImplFields:J,WriteForeignVariant:O,writeVariantImpl:M,readForeign:me,readChar:xe,readNumber:ae,readInt:ce,readString:oe,readBoolean:we,readArray:ge,readMaybe:de,readNullable:le,readObject:pe,readRecord:Le,readFieldsCons:Ve,readFieldsNil:ye,readForeignVariant:se,readVariantNil:ie,readVariantCons:Ce,writeForeignForeign:X,writeForeignString:G,writeForeignInt:Q,writeForeignChar:Y,writeForeignNumber:z,writeForeignBoolean:Z,writeForeignArray:$,writeForeignMaybe:re,writeForeignNullable:H,writeForeignObject:k,recordWriteForeign:te,consWriteForeignFields:Re,nilWriteForeignFields:Se,writeForeignVariant:_,nilWriteForeignVariant:qe,consWriteForeignVariant:Pe}; +},{"./foreign.js":"BQGe","../Control.Alt/index.js":"lN+m","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Control.Monad.Except/index.js":"Fye2","../Control.Monad.Except.Trans/index.js":"gr8B","../Control.Semigroupoid/index.js":"/riR","../Data.Bifunctor/index.js":"e2Wc","../Data.Boolean/index.js":"ObQr","../Data.Either/index.js":"B2JL","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Identity/index.js":"2OKT","../Data.List.Types/index.js":"Xxuc","../Data.Maybe/index.js":"5mN7","../Data.Nullable/index.js":"YQ8o","../Data.Semigroup/index.js":"EsAJ","../Data.Symbol/index.js":"4oJQ","../Data.Traversable/index.js":"n7EE","../Data.TraversableWithIndex/index.js":"V4EF","../Data.Variant/index.js":"hgdh","../Effect.Exception/index.js":"0OCW","../Effect.Uncurried/index.js":"qn3Z","../Effect.Unsafe/index.js":"tPW2","../Foreign/index.js":"pu1p","../Foreign.Index/index.js":"Ryy1","../Foreign.Object/index.js":"jsiz","../Global.Unsafe/index.js":"qSZP","../Partial.Unsafe/index.js":"aoR+","../Record/index.js":"0gG4","../Record.Builder/index.js":"VeY4","../Type.Data.RowList/index.js":"XaXP"}],"X0te":[function(require,module,exports) { +"use strict";var e=require("../Color/index.js"),n=require("../Color.Scheme.Clrs/index.js"),r=require("../Control.Applicative/index.js"),t=require("../Control.Bind/index.js"),i=require("../Control.Monad.Except.Trans/index.js"),a=require("../Control.Monad.State/index.js"),o=require("../Control.Monad.State.Class/index.js"),u=require("../Control.Monad.State.Trans/index.js"),d=require("../Data.Array/index.js"),l=require("../Data.BigInt/index.js"),s=require("../Data.Either/index.js"),c=require("../Data.EuclideanRing/index.js"),f=require("../Data.Foldable/index.js"),p=require("../Data.Function/index.js"),m=require("../Data.Functor/index.js"),g=require("../Data.FunctorWithIndex/index.js"),x=require("../Data.HeytingAlgebra/index.js"),v=require("../Data.Identity/index.js"),w=require("../Data.Int/index.js"),h=require("../Data.Lens.Getter/index.js"),y=require("../Data.List/index.js"),S=require("../Data.List.Types/index.js"),b=require("../Data.Map.Internal/index.js"),j=require("../Data.Maybe/index.js"),q=require("../Data.Monoid/index.js"),D=require("../Data.Newtype/index.js"),C=require("../Data.Number.Format/index.js"),I=require("../Data.Ord/index.js"),L=require("../Data.Pair/index.js"),N=require("../Data.Ring/index.js"),F=require("../Data.Semigroup/index.js"),P=require("../Data.Semiring/index.js"),M=require("../Data.Show/index.js"),T=require("../Data.String.CodePoints/index.js"),A=require("../Data.Symbol/index.js"),B=require("../Data.Traversable/index.js"),k=require("../Data.Tuple/index.js"),O=require("../Data.Variant/index.js"),z=require("../Foreign/index.js"),G=require("../Genetics.Browser.Canvas/index.js"),E=require("../Genetics.Browser.Coordinates/index.js"),R=require("../Genetics.Browser.Layer/index.js"),_=require("../Genetics.Browser.Types/index.js"),W=require("../Graphics.Drawing/index.js"),H=require("../Graphics.Drawing.Font/index.js"),U=require("../Math/index.js"),V=require("../Record/index.js"),J=require("../Simple.JSON/index.js"),K=function(e){return e},X=function(e){return function(n){return function(r){return function(t){return d.nubBy(p.on(I.compare(I.ordString))(function(e){return e.text}))(d.fromFoldable(e)(m.map(n)(r)(t)))}}}},Q=function(e){return function(n){return function(r){return function(t){return function(i){return m.map(b.functorMap)(E.aroundPair(N.ringNumber)(-n.segmentPadding))(E["scaledSegments'"](e)(r)(i)(E.viewScale(t)(i)))}}}}},Y=function(e){return function(n){return function(r){return function(t){return m.map(b.functorMap)(E.aroundPair(N.ringNumber)(-e.segmentPadding))(E.scaledSegments(n)(E.viewScale(r)(t)))}}}},Z=function(e){return function(n){return function(r){return function(t){return function(i){var a=Y(r)(r.coordinateSystem),o=m.map(R.functorComponent)(function(r){return function(i){return r(V.get(e)(n)(t)(i.value0))(a(i.value1)(i.value0.view))(i.value1)}})(i);return new R.Layer(R.Scrolling.value,new R.Masked(5),o)}}}}},$=t.composeKleisliFlipped(i.bindExceptT(v.monadIdentity))(function(n){return i.except(v.applicativeIdentity)(s.note(r.pure(S.applicativeNonEmptyList)(new z.ForeignError("Could not parse color: expected hex string")))(e.fromHexString(n)))})(z.readString),ee=new D.Newtype(function(e){return e},K),ne=new J.ReadForeign(m.map(m.functorFn)(m.map(i.functorExceptT(v.functorIdentity))(D.wrap(ee)))($)),re=function(e){var n=e.value1.height-E.normalize(c.euclideanRingNumber)(e.value0.threshold.min)(e.value0.threshold.max)(e.value0.threshold.sig)*e.value1.height,r="P = "+h.viewOn(U.pow(10)(-e.value0.threshold.sig))(_._exp(1)),t=F.append(W.semigroupOutlineStyle)(W.outlineColor(D.unwrap(ee)(e.value0.rulerColor)))(W.lineWidth(2)),i=W.outlined(t)(W.path(f.foldableArray)([{x:-5,y:n},{x:e.value1.width+5,y:n}])),a=H.font(H.sansSerif)(16)(q.mempty(H.monoidFontOptions)),o=W.text(a)(e.value1.width+10)(n-6)(W.fillColor(D.unwrap(ee)(e.value0.rulerColor)))(r);return{renderables:y.fromFoldable(f.foldableArray)([O.inj()(new A.IsSymbol(function(){return"drawing"}))(G._drawing)(i),O.inj()(new A.IsSymbol(function(){return"drawing"}))(G._drawing)(o)])}},te=function(e){return function(n){return function(t){return function(i){return function(a){return f.foldl(t)(function(t){return function(o){return b.alter(n)((u=o,function(n){return F.append(j.semigroupMaybe(e.Semigroup0()))(r.pure(j.applicativeMaybe)(r.pure(i)(u)))(n)}))(a(o))(t);var u}})(q.mempty(b.monoidMap(n)))}}}}},ie=function(e){return R.Layer.create(R.Fixed.value)(R.NoMask.value)(m.map(R.functorComponent)(function(e){return function(n){return{renderables:r.pure(S.applicativeList)(O.inj()(new A.IsSymbol(function(){return"drawing"}))(G._drawing)(e(n.value1)))}}})(e))},ae=function(e){return D.wrap(E.newtypeNormalized)(D.unwrap(_.newtypeBp)(c.div(_.euclideanRingBp)(e.position.value0)(e.frameSize)))},oe=function(n){return function(r){var t=m.map(m.functorArray)(function(e){return w.toNumber(e)/w.toNumber(n.numSteps)})(d.range(0)(n.numSteps)),i=r.width*n.hPad,a=f.foldMap(f.foldableArray)(W.monoidDrawing)(function(t){return W.text(H.font(H.sansSerif)(n.fonts.scaleSize)(q.mempty(H.monoidFontOptions)))(.6*r.width-i)(t*r.height+5)(W.fillColor(e.black))(C.toStringWith(C.fixed(0))((a=n.min+(1-t)*(n.max-n.min),I.min(I.ordNumber)(n.max)(a))));var a})(t),o=W.translate(.4*r.width-i)(.72*r.height)(W.rotate(-U.pi/2)(W.text(H.font(H.sansSerif)(n.fonts.labelSize)(q.mempty(H.monoidFontOptions)))(0)(0)(W.fillColor(e.black))("-log10 (P value)"))),u=7*i,l=W.path(f.foldableArray)([{x:u,y:0},{x:u,y:r.height}]),s=F.append(W.semigroupShape)(l)(f.foldMap(f.foldableArray)(W.monoidShape)(function(e){return(n=8,function(e){return W.path(f.foldableArray)([{x:u-n,y:e},{x:u,y:e}])})(e*r.height);var n})(t)),c=F.append(W.semigroupOutlineStyle)(W.outlineColor(D.unwrap(ee)(n.color)))(W.lineWidth(2));return F.append(W.semigroupDrawing)(W.outlined(c)(s))(F.append(W.semigroupDrawing)(a)(o))}},ue=function(n){var r=H.font(H.sansSerif)(12)(q.mempty(H.monoidFontOptions)),t=W.text(r)(12)(0)(W.fillColor(e.black))(n.text);return F.append(W.semigroupDrawing)(n.icon)(t)},de=function(n){return function(r){var t=r.height*n.vPad,i=r.width*n.hPad,a=H.font(H.sansSerif)(n.fontSize)(q.mempty(H.monoidFontOptions)),o=g.mapWithIndex(g.functorWithIndexArray)(function(n){return function(r){return(o=t*w.toNumber(n+1|0),function(n){return W.translate(i)(o)(F.append(W.semigroupDrawing)(n.icon)(W.text(a)(12)(0)(W.fillColor(e.black))(n.text)))})(r);var o}})(n.entries);r.height,f.length(f.foldableArray)(P.semiringNumber)(n.entries);return f.fold(f.foldableArray)(W.monoidDrawing)(o)}},le={color:D.wrap(ee)(e.black),hPad:.125,numSteps:3,fonts:{labelSize:18,scaleSize:14}},se={hPad:.2,vPad:.2,fontSize:12},ce=function(n){return function(r){var t=function(n){return function(t){return function(i){return W.text(H.font(H.sansSerif)(r.fontSize)(q.mempty(H.monoidFontOptions)))(function(e){return function(n){var r=I.min(I.ordNumber)(e.value1)(n.value1),t=I.max(I.ordNumber)(e.value0)(n.value0);return t+(r-t)/2}}(function(e){return function(n){var r=m.map(L.functorPair)(l.toNumber)(D.unwrap(E.coordsysviewNewtype)(n)),t=E.viewScale(e)(n);return m.map(L.functorPair)(function(e){return e/E.xPerPixel(t)})(r)}}(n)(t))(i.value1)-(a=i.value0,.3*w.toNumber(r.fontSize*T.length(M.show(_.showChrId)(a))|0)))(.7*n.height)(W.fillColor(e.black))(M.show(_.showChrId)(i.value0));var a}}};return R.Layer.create(R.Scrolling.value)(new R.Masked(5))(new R.CBottom(function(e){return{renderables:m.map(S.functorList)((r=O.inj()(new A.IsSymbol(function(){return"drawing"}))(G._drawing),i=t(e.value1)(e.value0.view),function(e){return r(i(e))}))(b.toUnfoldable(S.unfoldableList)(Y(n)(n.coordinateSystem)(e.value1)(e.value0.view)))};var r,i}))}},fe=function(e){return function(n){return function(i){var d,l;return{renderables:m.map(S.functorList)((d=O.inj()(new A.IsSymbol(function(){return"drawing"}))(G._drawing),l=k.uncurry(function(e){return function(n){return W.filled(W.fillColor(e))(n)}}),function(e){return d(l(e))}))(a.evalState(B.traverse(S.traversableList)(u.applicativeStateT(v.monadIdentity))(function(n){return t.bind(u.bindStateT(v.monadIdentity))(o.get(u.monadStateStateT(v.monadIdentity)))(function(a){return t.discard(t.discardUnit)(u.bindStateT(v.monadIdentity))(o.modify_(u.monadStateStateT(v.monadIdentity))(x.not(x.heytingAlgebraBoolean)))(function(){return r.pure(u.applicativeStateT(v.monadIdentity))(new k.Tuple(D.unwrap(ee)(a?e.chrBG1:e.chrBG2),W.rectangle(n.value0-e.segmentPadding)(-5)(n.value1-n.value0+2*e.segmentPadding)(i.height+10)))})})})(b.values(n)))(!1))}}}};module.exports={featureNormX:ae,groupToMap:te,pixelSegments:Y,pixelSegmentsOpt:Q,trackLikeLayer:Z,fixedUILayer:ie,thresholdRuler:re,chrLabelsLayer:ce,chrBackgroundLayer:fe,HexColor:K,parseColor:$,defaultVScaleConfig:le,drawVScaleInSlot:oe,drawLegendItem:ue,defaultLegendConfig:se,drawLegendInSlot:de,trackLegend:X,newtypeHexColor:ee,readforeignHexColor:ne}; +},{"../Color/index.js":"f3ma","../Color.Scheme.Clrs/index.js":"rp+n","../Control.Applicative/index.js":"qYya","../Control.Bind/index.js":"7VcT","../Control.Monad.Except.Trans/index.js":"gr8B","../Control.Monad.State/index.js":"mGZW","../Control.Monad.State.Class/index.js":"u1pL","../Control.Monad.State.Trans/index.js":"34Kp","../Data.Array/index.js":"4t4C","../Data.BigInt/index.js":"Zx+T","../Data.Either/index.js":"B2JL","../Data.EuclideanRing/index.js":"2IRB","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.FunctorWithIndex/index.js":"OHRN","../Data.HeytingAlgebra/index.js":"paZe","../Data.Identity/index.js":"2OKT","../Data.Int/index.js":"xNJb","../Data.Lens.Getter/index.js":"OPOX","../Data.List/index.js":"ezw6","../Data.List.Types/index.js":"Xxuc","../Data.Map.Internal/index.js":"RRDs","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Newtype/index.js":"lz8k","../Data.Number.Format/index.js":"VX77","../Data.Ord/index.js":"r4Vb","../Data.Pair/index.js":"PpsX","../Data.Ring/index.js":"E2qH","../Data.Semigroup/index.js":"EsAJ","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7","../Data.String.CodePoints/index.js":"mAJY","../Data.Symbol/index.js":"4oJQ","../Data.Traversable/index.js":"n7EE","../Data.Tuple/index.js":"II/O","../Data.Variant/index.js":"hgdh","../Foreign/index.js":"pu1p","../Genetics.Browser.Canvas/index.js":"VVkU","../Genetics.Browser.Coordinates/index.js":"7bYH","../Genetics.Browser.Layer/index.js":"YWUW","../Genetics.Browser.Types/index.js":"HhmG","../Graphics.Drawing/index.js":"0WVi","../Graphics.Drawing.Font/index.js":"fMOI","../Math/index.js":"Rpaz","../Record/index.js":"0gG4","../Simple.JSON/index.js":"DqNI"}],"GTi5":[function(require,module,exports) { + +var t,e,n=module.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}function u(t){if(e===clearTimeout)return clearTimeout(t);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{return e(t)}catch(n){try{return e.call(null,t)}catch(n){return e.call(this,t)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(n){t=r}try{e="function"==typeof clearTimeout?clearTimeout:o}catch(n){e=o}}();var c,s=[],l=!1,a=-1;function f(){l&&c&&(l=!1,c.length?s=c.concat(s):a=-1,s.length&&h())}function h(){if(!l){var t=i(f);l=!0;for(var e=s.length;e;){for(c=s,s=[];++a1)for(var n=1;n0}).map(function(r){var t=r.indexOf(":");return e(r.substring(0,t))(r.substring(t+2))}),body:r.getResponse(u)})},u.responseType=t.responseType,u.withCredentials=t.withCredentials,u.send(t.content),function(e,r,t){try{u.abort()}catch(f){return r(f)}return t()}}}}(); +},{"process":"GTi5"}],"PJcd":[function(require,module,exports) { +"use strict";var t="text/xml",a="text/plain",i="text/html",p="text/csv",e="multipart/form-data",o="image/png",l="image/jpeg",c="image/gif",m="application/xml",n="application/octet-stream",r="application/javascript",x="application/json",g="application/x-www-form-urlencoded";module.exports={applicationFormURLEncoded:g,applicationJSON:x,applicationJavascript:r,applicationOctetStream:n,applicationXML:m,imageGIF:c,imageJPEG:l,imagePNG:o,multipartFormData:e,textCSV:p,textHTML:i,textPlain:a,textXML:t}; +},{}],"TX3z":[function(require,module,exports) { +"use strict";var n=require("../Data.Maybe/index.js"),e=require("../Data.MediaType.Common/index.js"),t=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),r=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),u=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),i=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),o=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),c=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),a=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),f=function(t){return t instanceof c?new n.Just(e.applicationFormURLEncoded):t instanceof a?new n.Just(e.applicationJSON):n.Nothing.value},s=i.create,l=a.create,d=c.create,w=o.create,m=u.create,v=r.create,h=function(n){return new t(function(e){return e(n)})};module.exports={ArrayView:t,Blob:r,Document:u,String:i,FormData:o,FormURLEncoded:c,Json:a,arrayView:h,blob:v,document:m,string:s,formData:w,formURLEncoded:d,json:l,toMediaType:f}; +},{"../Data.Maybe/index.js":"5mN7","../Data.MediaType.Common/index.js":"PJcd"}],"cjQ0":[function(require,module,exports) { +"use strict";var e=require("../Data.Eq/index.js"),n=require("../Data.Newtype/index.js"),r=require("../Data.Ord/index.js"),t=require("../Data.Show/index.js"),i=function(e){return e},u=new t.Show(function(e){return"(MediaType "+t.show(t.showString)(e)+")"}),o=new n.Newtype(function(e){return e},i),a=new e.Eq(function(e){return function(n){return e===n}}),d=new r.Ord(function(){return a},function(e){return function(n){return r.compare(r.ordString)(e)(n)}});module.exports={MediaType:i,newtypeMediaType:o,eqMediaType:a,ordMediaType:d,showMediaType:u}; +},{"../Data.Eq/index.js":"Pq4F","../Data.Newtype/index.js":"lz8k","../Data.Ord/index.js":"r4Vb","../Data.Show/index.js":"mFY7"}],"QBMh":[function(require,module,exports) { +"use strict";var e=require("../Data.Eq/index.js"),n=require("../Data.MediaType/index.js"),t=require("../Data.Newtype/index.js"),r=require("../Data.Ord/index.js"),a=require("../Data.Ordering/index.js"),u=require("../Data.Show/index.js"),i=function(){function e(e){this.value0=e}return e.create=function(n){return new e(n)},e}(),o=function(){function e(e){this.value0=e}return e.create=function(n){return new e(n)},e}(),c=function(){function e(e,n){this.value0=e,this.value1=n}return e.create=function(n){return function(t){return new e(n,t)}},e}(),f=function(e){if(e instanceof i)return t.unwrap(n.newtypeMediaType)(e.value0);if(e instanceof o)return t.unwrap(n.newtypeMediaType)(e.value0);if(e instanceof c)return e.value1;throw new Error("Failed pattern match at Affjax.RequestHeader (line 26, column 1 - line 26, column 33): "+[e.constructor.name])},s=new u.Show(function(e){if(e instanceof i)return"(Accept "+u.show(n.showMediaType)(e.value0)+")";if(e instanceof o)return"(ContentType "+u.show(n.showMediaType)(e.value0)+")";if(e instanceof c)return"(RequestHeader "+u.show(u.showString)(e.value0)+" "+u.show(u.showString)(e.value1)+")";throw new Error("Failed pattern match at Affjax.RequestHeader (line 16, column 1 - line 19, column 81): "+[e.constructor.name])}),l=function(e){if(e instanceof i)return"Accept";if(e instanceof o)return"Content-Type";if(e instanceof c)return e.value0;throw new Error("Failed pattern match at Affjax.RequestHeader (line 21, column 1 - line 21, column 32): "+[e.constructor.name])},d=new e.Eq(function(t){return function(r){return t instanceof i&&r instanceof i?e.eq(n.eqMediaType)(t.value0)(r.value0):t instanceof o&&r instanceof o?e.eq(n.eqMediaType)(t.value0)(r.value0):t instanceof c&&r instanceof c&&(t.value0===r.value0&&t.value1===r.value1)}}),v=new r.Ord(function(){return d},function(e){return function(t){if(e instanceof i&&t instanceof i)return r.compare(n.ordMediaType)(e.value0)(t.value0);if(e instanceof i)return a.LT.value;if(t instanceof i)return a.GT.value;if(e instanceof o&&t instanceof o)return r.compare(n.ordMediaType)(e.value0)(t.value0);if(e instanceof o)return a.LT.value;if(t instanceof o)return a.GT.value;if(e instanceof c&&t instanceof c){var u=r.compare(r.ordString)(e.value0)(t.value0);return u instanceof a.LT?a.LT.value:u instanceof a.GT?a.GT.value:r.compare(r.ordString)(e.value1)(t.value1)}throw new Error("Failed pattern match at Affjax.RequestHeader (line 14, column 1 - line 14, column 54): "+[e.constructor.name,t.constructor.name])}});module.exports={Accept:i,ContentType:o,RequestHeader:c,name:l,value:f,eqRequestHeader:d,ordRequestHeader:v,showRequestHeader:s}; +},{"../Data.Eq/index.js":"Pq4F","../Data.MediaType/index.js":"cjQ0","../Data.Newtype/index.js":"lz8k","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Show/index.js":"mFY7"}],"QSsR":[function(require,module,exports) { +"use strict";var n=require("../Control.Category/index.js"),e=require("../Data.Maybe/index.js"),t=require("../Data.MediaType.Common/index.js"),r=require("../Foreign/index.js"),i=function(){function n(n,e){this.value0=n,this.value1=e}return n.create=function(e){return function(t){return new n(e,t)}},n}(),o=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),u=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),a=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),c=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),f=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),s=function(){function n(n){this.value0=n}return n.create=function(e){return new n(e)},n}(),l=function(n){if(n instanceof o)return"arraybuffer";if(n instanceof u)return"blob";if(n instanceof a)return"document";if(n instanceof c)return"text";if(n instanceof f)return"text";if(n instanceof s)return"";throw new Error("Failed pattern match at Affjax.ResponseFormat (line 46, column 3 - line 52, column 19): "+[n.constructor.name])},y=function(n){return n instanceof c?new e.Just(t.applicationJSON):e.Nothing.value},d=new f(n.identity(n.categoryFn)),w=function(n){return r.renderForeignError(n.value0)},g=new c(n.identity(n.categoryFn)),m=new s(n.identity(n.categoryFn)),p=new a(n.identity(n.categoryFn)),F=new u(n.identity(n.categoryFn)),h=new o(n.identity(n.categoryFn));module.exports={ArrayBuffer:o,Blob:u,Document:a,Json:c,String:f,Ignore:s,arrayBuffer:h,blob:F,document:p,json:g,string:d,ignore:m,toResponseType:l,toMediaType:y,ResponseFormatError:i,printResponseFormatError:w}; +},{"../Control.Category/index.js":"IAi2","../Data.Maybe/index.js":"5mN7","../Data.MediaType.Common/index.js":"PJcd","../Foreign/index.js":"pu1p"}],"ev5/":[function(require,module,exports) { +"use strict";var e=require("../Data.Eq/index.js"),n=require("../Data.Ord/index.js"),r=require("../Data.Ordering/index.js"),u=require("../Data.Show/index.js"),t=function(){function e(e,n){this.value0=e,this.value1=n}return e.create=function(n){return function(r){return new e(n,r)}},e}(),a=function(e){return e.value1},o=new u.Show(function(e){return"(ResponseHeader "+u.show(u.showString)(e.value0)+" "+u.show(u.showString)(e.value1)+")"}),i=function(e){return e.value0},s=new e.Eq(function(e){return function(n){return e.value0===n.value0&&e.value1===n.value1}}),v=new n.Ord(function(){return s},function(e){return function(u){var t=n.compare(n.ordString)(e.value0)(u.value0);return t instanceof r.LT?r.LT.value:t instanceof r.GT?r.GT.value:n.compare(n.ordString)(e.value1)(u.value1)}});module.exports={ResponseHeader:t,name:i,value:a,eqResponseHeader:s,ordResponseHeader:v,showResponseHeader:o}; +},{"../Data.Eq/index.js":"Pq4F","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Show/index.js":"mFY7"}],"fv/y":[function(require,module,exports) { +"use strict";function r(r){return r}exports.fromBoolean=r,exports.fromNumber=r,exports.fromString=r,exports.fromArray=r,exports.fromObject=r,exports.jsonNull=null,exports.stringify=function(r){return JSON.stringify(r)};var t=Object.prototype.toString,e=Object.keys;function n(r){return"[object Array]"===t.call(r)}exports._caseJson=function(r,e,n,o,f,u,l){return null==l?r():"boolean"==typeof l?e(l):"number"==typeof l?n(l):"string"==typeof l?o(l):"[object Array]"===t.call(l)?f(l):u(l)},exports._compare=function r(t,o,f,u,l){if(null==u)return null==l?t:f;if("boolean"==typeof u)return"boolean"==typeof l?u===l?t:!1===u?f:o:null==l?o:f;if("number"==typeof u)return"number"==typeof l?u===l?t:ua.length)return o;for(var s=y.concat(a).sort(),g=0;g1})(t.feature.blocks));return O.append(de.semigroupDrawing)(de.outlined(O.append(de.semigroupOutlineStyle)(de.outlineColor(i.darkgrey))(de.lineWidth(1)))(n))(de.filled(de.fillColor(i.lightgrey))(n))};if(f<1)return M.Nothing.value;var l={x:n.value0+ue.pairSize(R.ringNumber)(n)*T.unwrap(ue.newtypeNormalized)(ie.featureNormX(t)),y:.5*e.height},s={x:l.x+f,y:l.y+15};return o.pure(M.applicativeMaybe)({bigDrawing:{drawing:function(e){return O.append(de.semigroupDrawing)((J.unit,n=de.rectangle(1.5)(14)(f-1.5)(2),O.append(de.semigroupDrawing)(de.outlined(O.append(de.semigroupOutlineStyle)(de.outlineColor(r.black))(de.lineWidth(3)))(n))(de.filled(de.fillColor(r.black))(n))))(d(J.unit));var n},topLeft:l,bottomRight:s},label:{text:t.feature.geneName,point:l,gravity:ae.LCenter.value}})}}},Le=function(e){return function(n){return function(n){return function(r){var t,i=F.toUnfoldable(D.unfoldableList)(A.map(F.functorMap)(B.fromFoldable(h.foldableArray))(e)),u=B.concatMap(function(e){return M.fromMaybe(N.mempty(D.monoidList))(a.bind(M.bindMaybe)(F.lookup(ce.ordChrId)(e.value0)(n))(function(n){return o.pure(M.applicativeMaybe)(g.filterMap(g.filterableList)(qe(r)(n))(e.value1))}))})(i),f=X.inj()(new U.IsSymbol(function(){return"labels"}))(ae._labels)(A.map(D.functorList)(function(e){return e.label})(u)),c=A.map(D.functorList)((t=X.inj()(new U.IsSymbol(function(){return"bigDrawing"}))(ae._bigDrawing),function(e){return t(e.bigDrawing)}))(u);return{renderables:new D.Cons(f,c)}}}}},Ee=function(e){return function(n){var r=e.y-n.y,t=e.x-n.x;return le.sqrt(le.pow(t)(2)+le.pow(r)(2))}},Be=function(e){return function(n){var r,t,i,a=A.map(F.functorMap)(B.fromFoldable(h.foldableArray))(e),f=function(e){return v.foldMapWithIndex(F.foldableWithIndexMap)(D.monoidList)(function(r){return function(t){return h.foldMap(h.foldableMaybe)(D.monoidList)(A.map(D.functorList)(G.fanout(u.categoryFn)(G.strongFn)(u.identity(u.categoryFn))((i=t,function(r){return{x:i.value0+ue.pairSize(R.ringNumber)(i)*T.unwrap(ue.newtypeNormalized)(ie.featureNormX(r)),y:e.height*(1-Ie(n.threshold)(r.feature.score))}}))))(F.lookup(ce.ordChrId)(r)(a));var i}})},c=function(e){return function(r){return function(t){return s.fromFoldable(D.foldableList)(g.filterMap(g.filterableList)(function(e){if(Ee(e.value1)(t)<=n.render.radius+r)return new M.Just(e.value0);if(m.otherwise)return M.Nothing.value;throw new Error("Failed pattern match at Genetics.Browser.Demo (line 500, column 15 - line 500, column 63): "+[e.constructor.name])})(e))}}},d=(r=de.circle(n.render.pixelOffset.x)(n.render.pixelOffset.y)(n.render.radius),t=de.filled(de.fillColor(T.unwrap(ie.newtypeHexColor)(n.render.color.fill)))(r),i=de.outlined(O.append(de.semigroupOutlineStyle)(de.outlineColor(T.unwrap(ie.newtypeHexColor)(n.render.color.outline)))(de.lineWidth(n.render.lineWidth)))(r),O.append(de.semigroupDrawing)(i)(t)),l=function(e){return o.pure(o.applicativeArray)({drawing:d,points:A.map(A.functorArray)(C.view(E._2(j.strongForget)))(s.fromFoldable(D.foldableList)(e))})};return function(e){return function(n){var r=f(n)(e);return{renderables:o.pure(D.applicativeList)(X.inj()(new U.IsSymbol(function(){return"drawingBatch"}))(ae._drawingBatch)(l(r))),hotspots:c(r)}}}}},De={radius:3.75,lineWidth:1,color:{outline:T.wrap(ie.newtypeHexColor)(i.darkblue),fill:T.wrap(ie.newtypeHexColor)(i.darkblue)},pixelOffset:{x:0,y:0}},Fe={radius:5.5,outline:T.wrap(ie.newtypeHexColor)(r.black),snpColor:T.wrap(ie.newtypeHexColor)(t.blue),geneColor:T.wrap(ie.newtypeHexColor)(t.red)},Me=function(e){return ie.fixedUILayer(fe.CRight.create(ie.drawLegendInSlot(e)))},Ne=function(e){return function(e){return function(n){return S.mapWithIndex(F.functorWithIndexMap)(function(r){return function(t){return M.fromMaybe([])(a.bind(M.bindMaybe)(F.lookup(ce.ordChrId)(r)(e))(function(e){return a.bind(M.bindMaybe)(F.lookup(ce.ordChrId)(r)(n))(function(n){return a.bind(M.bindMaybe)(A.map(M.functorMaybe)(function(e){return e.frameSize})(s.head(e)))(function(r){var i=w.div(ce.euclideanRingBp)(_.mul(ce.semiringBp)(T.wrap(ce.newtypeBp)(3.75))(r))(T.wrap(ce.newtypeBp)(ue.pairSize(R.ringNumber)(t)));return o.pure(M.applicativeMaybe)(A.map(A.functorArray)(function(e){return{elements:g.filter(g.filterableArray)((r=ue.pairsOverlap(ce.ordBp)(e.covers),function(e){return r(e.position)}))(n),covers:e.covers,y:e.y};var r})(Ae(i)(e)))})})}))}})}}},Te=function(e){return function(n){var r=function(n){return O.append(O.semigroupFn(de.semigroupDrawing))(de.outlined(O.append(de.semigroupOutlineStyle)(de.outlineColor(T.unwrap(ie.newtypeHexColor)(e.outline)))(de.lineWidth(2))))(de.filled(de.fillColor(T.unwrap(ie.newtypeHexColor)(n))))(de.circle(0)(0)(e.radius))};if(n.feature.gene instanceof M.Nothing)return{text:"SNP name",icon:r(e.snpColor)};if(n.feature.gene instanceof M.Just)return{text:"Gene name",icon:r(e.geneColor)};throw new Error("Failed pattern match at Genetics.Browser.Demo (line 389, column 6 - line 391, column 69): "+[n.feature.gene.constructor.name])}},ke=function(e){return function(n){return function(n){return function(r){var t=s.concat(s.fromFoldable(D.foldableList)(A.map(D.functorList)(s.fromFoldable(e))(F.values(r))));return ie.trackLegend(h.foldableArray)(A.functorArray)(Te(n))(t)}}}},Pe=function(e){return function(n){return function(t){return function(i){return function(u){var f=.06*u.height,c=function(e){var n=e.covers.value0+.5*(e.covers.value1-e.covers.value0),i=s.null(e.elements)?N.mempty(de.monoidDrawing):de.outlined(O.append(de.semigroupOutlineStyle)(de.lineWidth(1.3))(de.outlineColor(r.black)))(de.path(h.foldableArray)([{x:0,y:0},{x:0,y:-f}])),o=de.translate(0)(-f)(h.foldr(h.foldableArray)(function(e){return function(n){return de.translate(0)(-6.5)(O.append(de.semigroupDrawing)(Te(t)(e).icon)(n))}})(N.mempty(de.monoidDrawing))(e.elements)),a=14*h.length(h.foldableArray)(_.semiringNumber)(e.elements),u={drawing:O.append(de.semigroupDrawing)(i)(o),points:[{x:n,y:e.y}]},c=function(e){var n=f+4.5*h.length(h.foldableArray)(_.semiringNumber)(e.elements),r=e.y-n;return{x:e.covers.value0,y:r,width:14,height:n}}(e),d=c.y>a?{g:ae.LCenter.value,y0:c.y}:{g:ae.LLeft.value,y0:e.y},l=K.snd(h.foldr(h.foldableArray)(function(e){return function(r){return K.Tuple.create(r.value0-8)(new D.Cons({text:M.fromMaybe(e.feature.name)(e.feature.gene),point:{x:n,y:r.value0},gravity:d.g},r.value1))}})(new K.Tuple(d.y0,N.mempty(D.monoidList)))(e.elements));return new K.Tuple([u],l)};return function(r){var t,f=(t=function(r){return S.mapWithIndex(F.functorWithIndexMap)(function(t){return function(i){return M.fromMaybe([])(a.bind(M.bindMaybe)(A.map(M.functorMaybe)((f=T.wrap(ce.newtypeBp),c=ue.pairSize(p.ringBigInt),function(e){return f(p.toNumber(c(e)))}))(F.lookup(ce.ordChrId)(t)(C.viewOn(e)(ue._Segments(j.strongForget)))))(function(e){return a.bind(M.bindMaybe)(F.lookup(ce.ordChrId)(t)(r))(function(r){return o.pure(M.applicativeMaybe)(A.map(A.functorArray)(function(t){return{covers:A.map(P.functorPair)(function(n){return r.value0+ue.pairSize(R.ringNumber)(r)*T.unwrap(ce.newtypeBp)(w.div(ce.euclideanRingBp)(n)(e))})(t.covers),y:u.height*(1-Ie(n)(t.y)),elements:t.elements}})(i))})}));var f,c}})(i)}(r),h.foldMap(F.foldableMap)(K.monoidTuple(N.monoidArray)(D.monoidList))(h.foldMap(h.foldableArray)(K.monoidTuple(N.monoidArray)(D.monoidList))(c))(t));return{drawingBatch:f.value0,labels:f.value1}}}}}}},Ge=function(e){return function(n){return function(r){return function(t){var i=Ne(e)(n)(r);return function(n){return function(r){var o=Pe(e)(t.threshold)(t.render)(i(n))(r)(n);return{renderables:B.fromFoldable(h.foldableArray)([X.inj()(new U.IsSymbol(function(){return"drawingBatch"}))(ae._drawingBatch)(o.drawingBatch),X.inj()(new U.IsSymbol(function(){return"labels"}))(ae._labels)(o.labels)])}}}}}}},Re=function(e){return function(e){return me.keys()(me.consKeys(new U.IsSymbol(function(){return"chr"}))(me.consKeys(new U.IsSymbol(function(){return"gene"}))(me.consKeys(new U.IsSymbol(function(){return"name"}))(me.consKeys(new U.IsSymbol(function(){return"pos"}))(me.consKeys(new U.IsSymbol(function(){return"url"}))(me.nilKeys))))))(J.unit)}},Oe=function(e){return a.bind(d.bindExceptT(I.monadIdentity))(A.map(d.functorExceptT(I.functorIdentity))(B.fromFoldable(h.foldableArray))(te.keys(e)))(function(n){var r=B.difference(b.eqString)(n)(Re(me.consKeys(new U.IsSymbol(function(){return"chr"}))(me.consKeys(new U.IsSymbol(function(){return"gene"}))(me.consKeys(new U.IsSymbol(function(){return"name"}))(me.consKeys(new U.IsSymbol(function(){return"pos"}))(me.consKeys(new U.IsSymbol(function(){return"url"}))(me.nilKeys))))))());return W.for(d.applicativeExceptT(I.monadIdentity))(D.traversableList)(r)(function(n){return A.map(d.functorExceptT(I.functorIdentity))(function(e){return{field:n,value:e}})(re.readProp(n)(e))})})},_e=function(e){return function(n){return a.bind(d.bindExceptT(I.monadIdentity))(ye["read'"](ye.readRecord()(ye.readFieldsCons(new U.IsSymbol(function(){return"chr"}))(ye.readString)(ye.readFieldsCons(new U.IsSymbol(function(){return"gene"}))(ye.readMaybe(ye.readString))(ye.readFieldsCons(new U.IsSymbol(function(){return"name"}))(ye.readString)(ye.readFieldsCons(new U.IsSymbol(function(){return"pos"}))(ye.readNumber)(ye.readFieldsCons(new U.IsSymbol(function(){return"url"}))(ye.readMaybe(ye.readString))(ye.readFieldsNil)()())()())()())()())()()))(n))(function(r){return a.bind(d.bindExceptT(I.monadIdentity))(Oe(n))(function(n){var t,i=pe.build(l.composeFlipped(pe.semigroupoidBuilder)(pe.insert()()(new U.IsSymbol(function(){return"rest"}))(U.SProxy.value)(n))(l.composeFlipped(pe.semigroupoidBuilder)(pe.modify()()(new U.IsSymbol(function(){return"chr"}))(U.SProxy.value)(ce.ChrId))(pe.modify()()(new U.IsSymbol(function(){return"pos"}))(U.SProxy.value)(ce.Bp))))(r),u=(t=i.pos,new P.Pair(t,t));return a.bind(d.bindExceptT(I.monadIdentity))(function(){var n=F.lookup(ce.ordChrId)(i.chr)(C.view(ue._Segments(j.strongForget))(e));if(n instanceof M.Nothing)return f.throwError(d.monadThrowExceptT(I.monadIdentity))(o.pure(D.applicativeNonEmptyList)(new ne.ForeignError("Annotation chr not found in coordinate system!")));if(n instanceof M.Just)return o.pure(d.applicativeExceptT(I.monadIdentity))(ce.Bp(p.toNumber(ue.pairSize(p.ringBigInt)(n.value0))));throw new Error("Failed pattern match at Genetics.Browser.Demo (line 221, column 16 - line 228, column 49): "+[n.constructor.name])}())(function(e){return o.pure(d.applicativeExceptT(I.monadIdentity))({position:u,frameSize:e,feature:i})})})})}},ze=function(r){return function(t){return a.bind(Y.bindAff)(e.get(n.json)(t))(function(e){return a.bind(Y.bindAff)(y.either((t=f.throwError(Y.monadThrowAff),function(e){return t(ee.error(n.printResponseFormatError(e)))}))(o.pure(Y.applicativeAff))(e.body))(function(e){return a.bind(Y.bindAff)(function(){var n=c.runExcept(ne.readArray(e));if(n instanceof y.Left)return f.throwError(Y.monadThrowAff)(ee.error("Annotations data is not an array"));if(n instanceof y.Right)return o.pure(Y.applicativeAff)(n.value0);throw new Error("Failed pattern match at Genetics.Browser.Demo (line 303, column 16 - line 307, column 37): "+[n.constructor.name])}())(function(e){var n,t=g.partitionMap(g.filterableArray)((n=_e(r),function(e){return c.runExcept(n(e))}))(e);return a.discard(a.discardUnit)(Y.bindAff)(Z.liftEffect(Y.monadEffectAff)(function(){return $.log(Z.monadEffectEffect)("Raw annotations array length: "+z.show(z.showInt)(s.length(e)))(),$.log(Z.monadEffectEffect)("Could not parse "+z.show(z.showInt)(h.length(h.foldableArray)(_.semiringInt)(t.left))+" annotations.")(),$.log(Z.monadEffectEffect)("Successfully parsed "+z.show(z.showInt)(h.length(h.foldableArray)(_.semiringInt)(t.right))+" annotations.")(),$.log(Z.monadEffectEffect)(t.right)()}))(function(){return a.discard(a.discardUnit)(Y.bindAff)(function(){var e=s.head(t.right);if(e instanceof M.Nothing)return o.pure(Y.applicativeAff)(J.unit);if(e instanceof M.Just)return Z.liftEffect(Y.monadEffectAff)(function(){return $.log(Z.monadEffectEffect)("first annotation: ")(),h.sequence_(V.applicativeEffect)(D.foldableList)(A.map(D.functorList)($.log(Z.monadEffectEffect))(A.map(D.functorList)(function(e){return"> "+e})(ve(e.value0))))()});throw new Error("Failed pattern match at Genetics.Browser.Demo (line 325, column 3 - line 329, column 62): "+[e.constructor.name])}())(function(){return o.pure(Y.applicativeAff)(ie.groupToMap(N.monoidArray)(ce.ordChrId)(h.foldableArray)(o.applicativeArray)(function(e){return e.feature.chr})(t.right))})})})});var t})}},Ue=function(e){return function(n){return function(n){return function(r){var t={segmentPadding:12,coordinateSystem:e},i=ie.trackLikeLayer(new U.IsSymbol(function(){return"genes"}))()(t)(U.SProxy.value)(fe.Center.create(Le(n.genes)));return a.bind(Y.bindAff)(ae.newLayer(Q.monadAffAff)()(oe.cacherAffCons(new U.IsSymbol(function(){return"renderables"}))()()()()(oe.cacherAffNil(be.refl)))(r)("genes")(i))(function(e){return o.pure(Y.applicativeAff)({genes:function(n){return function(r){return a.discard(a.discardUnit)(Y.bindAff)(e.run({genes:{},view:r}))(function(){return a.bind(Y.bindAff)(e.last.renderables)(e.drawOnCanvas(n))})}}})})}}}},We=function(e){return function(n){return function(r){return a.bind(Y.bindAff)(ae.newLayer(Q.monadAffAff)()(oe.cacherAffCons(new U.IsSymbol(function(){return"renderables"}))()()()()(oe.cacherAffNil(be.refl)))(r)("chrBackground")(ie.trackLikeLayer(new U.IsSymbol(function(){return"background"}))()(e)(U.SProxy.value)(new fe.Center(ie.chrBackgroundLayer))))(function(t){return a.bind(Y.bindAff)(ae.newLayer(Q.monadAffAff)()(oe.cacherAffCons(new U.IsSymbol(function(){return"renderables"}))()()()()(oe.cacherAffNil(be.refl)))(r)("chrLabels")(ie.chrLabelsLayer(e)({fontSize:n.chrLabels.fontSize})))(function(r){return o.pure(Y.applicativeAff)(function(i){return function(o){var u={background:{chrBG1:n.chrBG1,chrBG2:n.chrBG2,segmentPadding:e.segmentPadding},view:o};return h.traverse_(Y.applicativeAff)(h.foldableArray)(function(e){return a.discard(a.discardUnit)(Y.bindAff)(e.run(u))(function(){return a.bind(Y.bindAff)(e.last.renderables)(e.drawOnCanvas(i))})})([t,r])}})})})}}},Ke=U.SProxy.value,He=U.SProxy.value,Je=function(e){return function(n){return function(r){var i=pe.build(pe.merge()()(n.vscale))(n.score),u=je(n.score)(r.snps),f=se.insert(new U.IsSymbol(function(){return"entries"}))()()(U.SProxy.value)(ke(h.foldableArray)(A.functorArray)(n.annotations)(r.annotations))(n.legend),c={segmentPadding:12,coordinateSystem:e},d=ie.trackLikeLayer(new U.IsSymbol(function(){return"snps"}))()(c)(Ke)(fe.Center.create(Be(r.snps))),l=ie.trackLikeLayer(new U.IsSymbol(function(){return"annotations"}))()(c)(He)(fe.Center.create(Ge(e)(u)(r.annotations)));return function(e){return a.bind(Y.bindAff)(ae.newLayer(Q.monadAffAff)()(oe.cacherAffCons(new U.IsSymbol(function(){return"renderables"}))()()()()(oe.cacherAffNil(be.refl)))(e)("ruler")(new fe.Layer(fe.Fixed.value,fe.NoMask.value,new fe.Center(ie.thresholdRuler))))(function(r){return a.bind(Y.bindAff)(ae.newLayer(Q.monadAffAff)()(oe.cacherAffCons(new U.IsSymbol(function(){return"hotspots"}))()()()()(oe.cacherAffCons(new U.IsSymbol(function(){return"renderables"}))()()()()(oe.cacherAffNil(be.refl))))(e)("snps")(d))(function(u){return a.bind(Y.bindAff)(ae.newLayer(Q.monadAffAff)()(oe.cacherAffCons(new U.IsSymbol(function(){return"renderables"}))()()()()(oe.cacherAffNil(be.refl)))(e)("annotations")(l))(function(c){return a.bind(Y.bindAff)(ae.newLayer(Q.monadAffAff)()(oe.cacherAffCons(new U.IsSymbol(function(){return"renderables"}))()()()()(oe.cacherAffNil(be.refl)))(e)("vscale")(we(i)))(function(i){return a.bind(Y.bindAff)(ae.newLayer(Q.monadAffAff)()(oe.cacherAffCons(new U.IsSymbol(function(){return"renderables"}))()()()()(oe.cacherAffNil(be.refl)))(e)("legend")(Me(f)))(function(e){var f,d=(f={rulerColor:T.wrap(ie.newtypeHexColor)(t.red),threshold:n.score},h.traverse_(Y.applicativeAff)(h.foldableArray)(function(e){return a.discard(a.discardUnit)(Y.bindAff)(e.run(f))(function(){return a.bind(Y.bindAff)(e.last.renderables)(e.drawOnCanvas(new P.Pair(0,0)))})})([e,i,r]));return o.pure(Y.applicativeAff)({snps:function(e){return function(r){return a.discard(a.discardUnit)(Y.bindAff)(u.run({snps:{threshold:n.score,render:n.snps},view:r}))(function(){return a.bind(Y.bindAff)(u.last.renderables)(u.drawOnCanvas(e))})}},annotations:function(e){return function(r){return a.discard(a.discardUnit)(Y.bindAff)(c.run({annotations:{threshold:n.score,render:n.annotations},view:r}))(function(){return a.bind(Y.bindAff)(c.last.renderables)(c.drawOnCanvas(e))})}},hotspots:u.last.hotspots,fixedUI:d})})})})})})}}}};module.exports={renderGenes:Le,drawGene:qe,parseSNP:Se,annotationFields:Re,parseAnnotation:_e,parseAnnotationRest:Oe,showAnnotationField:he,showAnnotation:ve,getSNPs:Ce,getAnnotations:ze,snpPeak:ge,peak1:xe,peaks:Ae,defaultAnnotationsConfig:Fe,annotationLegendEntry:Te,annotationLegendTest:ke,normYLogScore:Ie,dist:Ee,filterSig:je,snpsUI:we,annotationsUI:Me,defaultSNPConfig:De,renderSNPs:Be,annotationsForScale:Ne,renderAnnotationPeaks:Pe,renderAnnotations:Ge,_snps:Ke,_annotations:He,addChrLayers:We,addGWASLayers:Je,addGeneLayers:Ue}; +},{"../Affjax/index.js":"IjAr","../Affjax.ResponseFormat/index.js":"QSsR","../Color/index.js":"f3ma","../Color.Scheme.Clrs/index.js":"rp+n","../Color.Scheme.X11/index.js":"bDzA","../Control.Applicative/index.js":"qYya","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Control.Monad.Error.Class/index.js":"L8Lk","../Control.Monad.Except/index.js":"Fye2","../Control.Monad.Except.Trans/index.js":"gr8B","../Control.Semigroupoid/index.js":"/riR","../Data.Array/index.js":"4t4C","../Data.BigInt/index.js":"Zx+T","../Data.Boolean/index.js":"ObQr","../Data.Either/index.js":"B2JL","../Data.Eq/index.js":"Pq4F","../Data.EuclideanRing/index.js":"2IRB","../Data.Filterable/index.js":"6hfS","../Data.Foldable/index.js":"eVDl","../Data.FoldableWithIndex/index.js":"9Efi","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.FunctorWithIndex/index.js":"OHRN","../Data.Identity/index.js":"2OKT","../Data.Lens.Getter/index.js":"OPOX","../Data.Lens.Internal.Forget/index.js":"mj9z","../Data.Lens.Internal.Re/index.js":"IZDD","../Data.Lens.Iso/index.js":"fFCp","../Data.Lens.Lens.Tuple/index.js":"RTVM","../Data.List/index.js":"ezw6","../Data.List.Types/index.js":"Xxuc","../Data.Map.Internal/index.js":"RRDs","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Newtype/index.js":"lz8k","../Data.Ord/index.js":"r4Vb","../Data.Pair/index.js":"PpsX","../Data.Profunctor.Strong/index.js":"w9p6","../Data.Ring/index.js":"E2qH","../Data.Semigroup/index.js":"EsAJ","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7","../Data.Symbol/index.js":"4oJQ","../Data.Traversable/index.js":"n7EE","../Data.Tuple/index.js":"II/O","../Data.Unfoldable/index.js":"77+Z","../Data.Unit/index.js":"NhVk","../Data.Variant/index.js":"hgdh","../Effect/index.js":"oTWB","../Effect.Aff/index.js":"I7lu","../Effect.Aff.Class/index.js":"I4H+","../Effect.Class/index.js":"dWtH","../Effect.Class.Console/index.js":"3Dts","../Effect.Exception/index.js":"0OCW","../Foreign/index.js":"pu1p","../Foreign.Index/index.js":"Ryy1","../Foreign.Keys/index.js":"hcOM","../Genetics.Browser/index.js":"X0te","../Genetics.Browser.Cacher/index.js":"61ee","../Genetics.Browser.Canvas/index.js":"VVkU","../Genetics.Browser.Coordinates/index.js":"7bYH","../Genetics.Browser.Layer/index.js":"YWUW","../Genetics.Browser.Types/index.js":"HhmG","../Graphics.Drawing/index.js":"0WVi","../Math/index.js":"Rpaz","../Record/index.js":"0gG4","../Record.Builder/index.js":"VeY4","../Record.Extra/index.js":"KzZr","../Simple.JSON/index.js":"DqNI","../Type.Equality/index.js":"Uq/R"}],"HH6s":[function(require,module,exports) { +"use strict";var n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),t=require("../Control.Bind/index.js"),u=require("../Data.Foldable/index.js"),e=require("../Data.Functor/index.js"),o=require("../Data.Monoid/index.js"),i=require("../Data.Semigroup/index.js"),f=require("../Data.Symbol/index.js"),c=require("../Effect/index.js"),a=require("../Effect.Aff/index.js"),l=require("../Genetics.Browser.Canvas/index.js"),s=require("../Record/index.js"),d=require("../Type.Data.RowList/index.js"),p=require("../Type.Equality/index.js"),m=function(n){return n},y={},v=function(n){this.buildTrack=n},x=function(n){this.fetchDataImpl=n},g=function(n){this.makeContainersImpl=n},C={},P=function(n){this.getTrackConfigImpl=n},S=function(n){this.getLayerConfigImpl=n},h=function(n){this.getBrowserConfigImpl=n},b={},k={},A=function(n){this.combineFunsImpl=n},w={},R=function(n){this.applyLayerDefImpl=n},I=y,L=function(n){return y},F=function(n){return new v(function(n){return function(n){return function(n){return o.mempty(a.monoidAff(o.monoidRecord()(o.monoidRecordCons(new f.IsSymbol(function(){return"hotspots"}))(a.monoidAff(o.monoidFn(o.monoidFn(o.monoidArray))))()(o.monoidRecordCons(new f.IsSymbol(function(){return"render"}))(o.monoidFn(o.monoidFn(a.monoidAff(o.monoidUnit))))()(o.monoidRecordNil)))))}}})},D=function(r){return new x(function(t){return function(t){return function(t){return n.pure(a.applicativeAff)(p.from(r)({}))}}})},q=function(r){return new g(function(t){return function(t){return function(t){return n.pure(c.applicativeEffect)(p.from(r)({}))}}})},j=function(n){return function(n){return function(n){return function(n){return function(n){return C}}}}},T=function(n){return n.makeContainersImpl},N=function(n){return function(r){return function(t){return function(u){return function(e){return function(o){return function(i){return new g(function(c){return function(c){return function(a){var m=p.from(i)(s.get(n)(t)(f.SProxy.value)(a));return function(){var i=l.trackContainer({width:c,height:m.trackHeight})(m.padding)(f.reflectSymbol(n)(f.SProxy.value))(),y=T(r)(d.RLProxy.value)(c)(s.delete(n)(u)(t)(f.SProxy.value)(p.from(p.refl)(a)))();return s.insert(n)(o)(e)(f.SProxy.value)(i)(y)}}}})}}}}}}},U=function(n){return function(n){return T(n)(d.RLProxy.value)}},E=function(n){return n.getTrackConfigImpl},W=function(n){return function(r){return function(t){return function(u){return function(e){return function(o){return function(i){return function(i){return function(c){return function(c){return function(a){return new P(function(l){return function(d){var m=s.get(n)(o)(p.from(r)(f.SProxy.value))(l),y=s.get(e)(i)(p.from(p.refl)(f.SProxy.value))(m);return s.delete(t)(a)(c)(p.from(u)(f.SProxy.value))(y)}})}}}}}}}}}}},B=function(n){return n.getLayerConfigImpl},M=function(n){return function(r){return function(t){return function(u){return function(e){return function(o){return function(i){return function(c){return function(c){return function(a){return function(a){return function(l){return function(l){return function(d){return new S(function(d){return function(m){return function(m){var y=s.get(n)(i)(p.from(r)(f.SProxy.value))(d),v=s.get(e)(c)(p.from(p.refl)(f.SProxy.value))(y),x=s.get(t)(a)(p.from(u)(f.SProxy.value))(v);return s.get(o)(l)(p.from(p.refl)(f.SProxy.value))(x)}}})}}}}}}}}}}}}}},H=function(n){return n.getBrowserConfigImpl},G=function(n){return function(r){return function(t){return function(u){return function(e){return function(o){return function(o){return function(i){return new h(function(c){var a=s.get(n)(e)(p.from(r)(f.SProxy.value))(c);return s.delete(t)(i)(o)(p.from(u)(f.SProxy.value))(a)})}}}}}}}},z=function(n){return n.fetchDataImpl},J=function(r){return function(e){return function(o){return function(i){return function(c){return function(l){return function(p){return function(m){return new x(function(y){return function(y){return function(v){return t.bind(a.bindAff)(z(m)(d.RLProxy.value)(s.delete(r)(e)(o)(f.SProxy.value)(y))(v))(function(e){return t.bind(a.bindAff)(u.foldMap(u.foldableMaybe)(a.monoidAff(i))(s.get(r)(o)(f.SProxy.value)(y))(s.get(r)(c)(f.SProxy.value)(v)))(function(t){return n.pure(a.applicativeAff)(s.insert(r)(l)(p)(f.SProxy.value)(t)(e))})})}}})}}}}}}}},K=function(n){return function(n){return function(n){return function(r){return function(t){return function(u){return l.withLoadingIndicator(a.monadEffectAff)(r)(z(n)(d.RLProxy.value)(t)(u))}}}}}},O=b,Q=b,V=function(n){return b},X=function(n){return b},Y=k,Z=function(n){return function(n){return function(n){return k}}},$=function(n){return n.combineFunsImpl},_=function(n){return function(n){return function(r){return function(t){return $(n)(d.RLProxy.value)(r)(t)}}}},nn=function(n){return new A(function(r){return function(r){return function(r){return p.from(n)({})}}})},rn=function(n){return function(r){return function(t){return function(u){return function(u){return function(e){return function(o){return new A(function(i){return function(i){return function(c){var a=$(o)(d.RLProxy.value)(s.delete(n)(r)(t)(f.SProxy.value)(i))(c),l=s.get(n)(t)(f.SProxy.value)(i);return s.insert(n)(u)(e)(f.SProxy.value)(l(c))(a)}}})}}}}}}},tn=function(n){return n.buildTrack},un=function(n){return function(n){return function(r){return function(t){return tn(n)(d.RLProxy.value)(r)(t)}}}},en=function(u){return function(o){return function(c){return function(l){return function(m){return new v(function(y){return function(y){return function(v){return t.bind(a.bindAff)(tn(m)(d.RLProxy.value)(s.delete(u)(o)(c)(f.SProxy.value)(y))(v))(function(t){var o=r.apply(a.applyAff)(e.map(a.functorAff)(function(n){return function(r){return function(t){return function(u){return i.append(i.semigroupArray)(n(t)(p.from(l)(u)))(r(t)(u))}}}})(s.get(u)(c)(f.SProxy.value)(y)))(t.hotspots);return n.pure(a.applicativeAff)({render:t.render,hotspots:o})})}}})}}}}},on=function(r){return function(u){return function(e){return function(o){return new v(function(c){return function(c){return function(l){return t.bind(a.bindAff)(tn(o)(d.RLProxy.value)(s.delete(r)(u)(e)(f.SProxy.value)(c))(l))(function(t){return n.pure(a.applicativeAff)({render:i.append(i.semigroupFn(i.semigroupFn(a.semigroupAff(i.semigroupUnit))))(function(n){return function(t){return s.get(r)(e)(f.SProxy.value)(c)(n)(t)}})(t.render),hotspots:t.hotspots})})}}})}}}},fn=function(r){return function(u){return function(e){return function(o){return new v(function(c){return function(c){return function(l){return t.bind(a.bindAff)(tn(o)(d.RLProxy.value)(s.delete(r)(u)(e)(f.SProxy.value)(c))(l))(function(t){return n.pure(a.applicativeAff)({render:i.append(i.semigroupFn(i.semigroupFn(a.semigroupAff(i.semigroupUnit))))(function(n){return function(n){return s.get(r)(e)(f.SProxy.value)(c)}})(t.render),hotspots:t.hotspots})})}}})}}}},cn=function(n){return function(n){return function(n){return function(r){return function(t){return new R(function(u){return function(e){return function(o){return function(i){var f=E(r)(i)(e),c=B(t)(i)(e)(o),a=H(n)(i);return u({browserConfig:a,trackConfig:f,layerConfig:c})}}}})}}}}},an=function(n){return n.applyLayerDefImpl},ln=function(n){return function(n){return function(n){return an(n)}}};module.exports={TrackRecord:v,buildTrack:tn,makeTrack:un,TrackConfig:g,makeContainersImpl:T,makeContainers:U,TrackData:x,fetchDataImpl:z,fetchData:K,CombineFuns:A,combineFunsImpl:$,combineFuns:_,SafeUnion:C,UnionConflict:y,ConflictingList:k,ConflictsWith:b,LayerDef:m,trackRecordRender:on,trackRecordUI:fn,trackRecordHotspots:en,trackRecordNil:F,trackConfigNil:q,trackConfigCons:N,trackDataCons:J,trackDataNil:D,combineFunCons:rn,combineFunNil:nn,conflictsWithNil:O,conflictsWithCons1:X,conflictsWithCons3:Q,conflictsWithCons2:V,conflictingListNil:Y,conflictingListCons:Z,unionConflictFail:L,unionConflictSuccess:I,safeUnion:j}; +},{"../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Data.Foldable/index.js":"eVDl","../Data.Functor/index.js":"+0AE","../Data.Monoid/index.js":"TiEB","../Data.Semigroup/index.js":"EsAJ","../Data.Symbol/index.js":"4oJQ","../Effect/index.js":"oTWB","../Effect.Aff/index.js":"I7lu","../Genetics.Browser.Canvas/index.js":"VVkU","../Record/index.js":"0gG4","../Type.Data.RowList/index.js":"XaXP","../Type.Equality/index.js":"Uq/R"}],"nvf7":[function(require,module,exports) { +"use strict";exports.onTimeout=function(n){return function(t){return function(){var u=null;return{run:function(){u&&clearTimeout(u),u=setTimeout(function(){u=null,t()},n)},cancel:function(){clearTimeout(u)}}}}},exports.onFrame=function(n){return function(){var t=null;return{run:function(){t&&window.cancelAnimationFrame(t),t=window.requestAnimationFrame(function(u){n(),t=null})},cancel:function(){t&&(window.cancelAnimationFrame(t),t=null)}}}}; +},{}],"Tmz+":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),n=require("../Control.Bind/index.js"),r=require("../Control.Category/index.js"),t=require("../Data.BigInt/index.js"),i=require("../Data.Either/index.js"),o=require("../Data.Foldable/index.js"),u=require("../Data.Function/index.js"),a=require("../Data.Lens.Getter/index.js"),c=require("../Data.List.Types/index.js"),s=require("../Data.Monoid/index.js"),f=require("../Data.Newtype/index.js"),l=require("../Data.Ord/index.js"),d=require("../Data.Pair/index.js"),w=require("../Data.Semigroup/index.js"),m=require("../Data.Semiring/index.js"),v=require("../Data.Show/index.js"),p=require("../Effect/index.js"),g=require("../Effect.Class/index.js"),q=require("../Effect.Ref/index.js"),h=require("../Genetics.Browser.Canvas/index.js"),y=require("../Genetics.Browser.Coordinates/index.js"),j=function(){function e(e){this.value0=e}return e.create=function(n){return new e(n)},e}(),x=function(){function e(e){this.value0=e}return e.create=function(n){return new e(n)},e}(),B=function(){function e(e){this.value0=e}return e.create=function(n){return new e(n)},e}(),V=function(e){return f.over(y.coordsysviewNewtype)(y.coordsysviewNewtype)(y.CoordSysView)(function(){if(e instanceof x)return function(n){return y.scalePairBy(n)(e.value0)};if(e instanceof j)return function(n){return y.translatePairBy(n)(e.value0)};if(e instanceof B)return e.value0;throw new Error("Failed pattern match at Genetics.Browser.UI.View (line 58, column 39 - line 61, column 20): "+[e.constructor.name])}())},E=new v.Show(function(e){return e instanceof j?"(Scroll by "+v.show(v.showNumber)(e.value0)+")":e instanceof x?"(Zoom by "+v.show(v.showNumber)(e.value0)+")":"(ModView)"}),D=new w.Semigroup(function(e){return function(n){return e instanceof j&&n instanceof j?new j(e.value0+n.value0):e instanceof x&&n instanceof x?new x(e.value0*n.value0):n}}),I=new s.Monoid(function(){return D},new B(r.identity(r.categoryFn))),S=function(n){return function(r){return function(t){return function(o){return function(u){return function(){var a=q.new(o.position)(),c=q.new(o.velocity)(),f=e.onTimeout(u)(function(){var e=q.read(a)();return t(new i.Left(e))()})(),l=e.onFrame(function(){var e=q.read(c)();q.write(s.mempty(n))(c)();var o=q.read(a)();return q.write(r.step(e)(o))(a)(),t(i.Right.create(r.animate(e)(o)))(),f.run()})(),d=q.read(c);return{update:function(e){return function(){return q.modify_(function(r){return w.append(n.Semigroup0())(r)(e)})(c)(),l.run()}},position:q.read(a),velocity:d}}}}}}},T=function(e){return function(r){return function(f){return function(w){return function(){var v=q.new(s.mempty(c.monoidList))(),E={position:f.initialView,velocity:s.mempty(I)},D=S(I)({step:function(n){var r=y.normalizeView(e)(t.fromInt(2e5)),i=V(n);return function(e){return r(i(e))}},animate:function(n){return function(r){if(n instanceof j)return new h.Scrolling((i=r,function(n){return n<0?l.lessThanOrEq(t.ordBigInt)(i.value0)(m.zero(t.semiringBigInt))?0:n:l.greaterThanOrEq(t.ordBigInt)(i.value1)(a.viewOn(e)(y._TotalSize(t.ringBigInt)))?0:n})(n.value0));var i;if(n instanceof x)return new h.Zooming(function(n){return function(r){var i=(r-1)/2,o=l.lessThanOrEq(t.ordBigInt)(n.value0)(m.zero(t.semiringBigInt))?0:-i,u=l.greaterThanOrEq(t.ordBigInt)(n.value1)(a.viewOn(e)(y._TotalSize(t.ringBigInt)))?1:1+i;return new d.Pair(o,u)}}(r)(n.value0));if(n instanceof B)return h.Jump.value;throw new Error("Failed pattern match at Genetics.Browser.UI.View (line 130, column 24 - line 133, column 29): "+[n.constructor.name])}}})(function(e){if(e instanceof i.Right)return h.forTracks_(g.monadEffectEffect)(w)(u.flip(h.animateTrack)(e.value0));if(e instanceof i.Left)return n.bind(p.bindEffect)(q.read(v))(o.traverse_(p.applicativeEffect)(c.foldableList)(function(n){return n(e.value0)}));throw new Error("Failed pattern match at Genetics.Browser.UI.View (line 151, column 18 - line 153, column 54): "+[e.constructor.name])})(E)(r)();return{updateView:D.update,browserView:D.position,addCallback:function(e){return q.modify_(c.Cons.create(e))(v)}}}}}}};module.exports={ScrollView:j,ZoomView:x,ModView:B,updateViewFold:V,animateDelta:S,browserViewManager:T,showUpdateView:E,semigroupUpdateView:D,monoidUpdateView:I,onTimeout:e.onTimeout,onFrame:e.onFrame}; +},{"./foreign.js":"nvf7","../Control.Bind/index.js":"7VcT","../Control.Category/index.js":"IAi2","../Data.BigInt/index.js":"Zx+T","../Data.Either/index.js":"B2JL","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Lens.Getter/index.js":"OPOX","../Data.List.Types/index.js":"Xxuc","../Data.Monoid/index.js":"TiEB","../Data.Newtype/index.js":"lz8k","../Data.Ord/index.js":"r4Vb","../Data.Pair/index.js":"PpsX","../Data.Semigroup/index.js":"EsAJ","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7","../Effect/index.js":"oTWB","../Effect.Class/index.js":"dWtH","../Effect.Ref/index.js":"/Jaj","../Genetics.Browser.Canvas/index.js":"VVkU","../Genetics.Browser.Coordinates/index.js":"7bYH"}],"CI3f":[function(require,module,exports) { +"use strict";var t=function(t){return function(e){return function(){return e[t]}}};exports.url=t("URL"),exports.documentURI=t("documentURI"),exports.origin=t("origin"),exports.compatMode=t("compatMode"),exports.characterSet=t("characterSet"),exports.contentType=t("contentType"),exports._doctype=t("doctype"),exports._documentElement=t("documentElement"),exports.getElementsByTagName=function(t){return function(e){return function(){return e.getElementsByTagName(t)}}},exports._getElementsByTagNameNS=function(t){return function(e){return function(n){return function(){return n.getElementsByTagNameNS(t,e)}}}},exports.getElementsByClassName=function(t){return function(e){return function(){return e.getElementsByClassName(t)}}},exports.createElement=function(t){return function(e){return function(){return e.createElement(t)}}},exports._createElementNS=function(t){return function(e){return function(n){return function(){return n.createElementNS(t,e)}}}},exports.createDocumentFragment=function(t){return function(){return t.createDocumentFragment()}},exports.createTextNode=function(t){return function(e){return function(){return e.createTextNode(t)}}},exports.createComment=function(t){return function(e){return function(){return e.createComment(t)}}},exports.createProcessingInstruction=function(t){return function(e){return function(n){return function(){return n.createProcessingInstruction(t,e)}}}},exports.importNode=function(t){return function(e){return function(n){return function(){return n.importNode(t,e)}}}},exports.adoptNode=function(t){return function(e){return function(){return e.adoptNode(t)}}}; +},{}],"0hiR":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),t=require("../Data.Functor/index.js"),n=require("../Data.Nullable/index.js"),o=require("../Effect/index.js"),r=require("../Unsafe.Coerce/index.js"),a=require("../Web.Internal.FFI/index.js"),c=r.unsafeCoerce,u=r.unsafeCoerce,m=r.unsafeCoerce,d=r.unsafeCoerce,s=function(t){return e._getElementsByTagNameNS(n.toNullable(t))},i=a.unsafeReadProtoTagged("Document"),l=a.unsafeReadProtoTagged("Document"),f=a.unsafeReadProtoTagged("Document"),g=a.unsafeReadProtoTagged("Document"),N=function(){var r=t.map(o.functorEffect)(n.toMaybe);return function(t){return r(e._documentElement(t))}}(),E=function(){var r=t.map(o.functorEffect)(n.toMaybe);return function(t){return r(e._doctype(t))}}(),T=function(t){return e._createElementNS(n.toNullable(t))};module.exports={fromNode:f,fromParentNode:i,fromNonElementParentNode:l,fromEventTarget:g,toNode:m,toParentNode:c,toNonElementParentNode:u,toEventTarget:d,doctype:E,documentElement:N,getElementsByTagNameNS:s,createElementNS:T,url:e.url,documentURI:e.documentURI,origin:e.origin,compatMode:e.compatMode,characterSet:e.characterSet,contentType:e.contentType,getElementsByTagName:e.getElementsByTagName,getElementsByClassName:e.getElementsByClassName,createElement:e.createElement,createDocumentFragment:e.createDocumentFragment,createTextNode:e.createTextNode,createComment:e.createComment,createProcessingInstruction:e.createProcessingInstruction,importNode:e.importNode,adoptNode:e.adoptNode}; +},{"./foreign.js":"CI3f","../Data.Functor/index.js":"+0AE","../Data.Nullable/index.js":"YQ8o","../Effect/index.js":"oTWB","../Unsafe.Coerce/index.js":"ETUV","../Web.Internal.FFI/index.js":"fdUh"}],"9SEv":[function(require,module,exports) { +"use strict";var e=function(e){return function(t){return function(){return t[e]}}};exports.children=e("children"),exports._firstElementChild=e("firstElementChild"),exports._lastElementChild=e("lastElementChild"),exports.childElementCount=e("childElementCount"),exports._querySelector=function(e){return function(t){return function(){return t.querySelector(e)}}},exports.querySelectorAll=function(e){return function(t){return function(){return t.querySelectorAll(e)}}}; +},{}],"lU5U":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),r=require("../Data.Eq/index.js"),t=require("../Data.Functor/index.js"),n=require("../Data.Newtype/index.js"),u=require("../Data.Nullable/index.js"),i=require("../Data.Ord/index.js"),l=require("../Effect/index.js"),o=function(e){return e},c=function(r){var n=t.map(l.functorEffect)(u.toMaybe),i=e._querySelector(r);return function(e){return n(i(e))}},a=i.ordString,f=new n.Newtype(function(e){return e},o),d=function(){var r=t.map(l.functorEffect)(u.toMaybe);return function(t){return r(e._lastElementChild(t))}}(),q=function(){var r=t.map(l.functorEffect)(u.toMaybe);return function(t){return r(e._firstElementChild(t))}}(),s=r.eqString;module.exports={firstElementChild:q,lastElementChild:d,QuerySelector:o,querySelector:c,eqQuerySelector:s,ordQuerySelector:a,newtypeQuerySelector:f,children:e.children,childElementCount:e.childElementCount,querySelectorAll:e.querySelectorAll}; +},{"./foreign.js":"9SEv","../Data.Eq/index.js":"Pq4F","../Data.Functor/index.js":"+0AE","../Data.Newtype/index.js":"lz8k","../Data.Nullable/index.js":"YQ8o","../Data.Ord/index.js":"r4Vb","../Effect/index.js":"oTWB"}],"UOgE":[function(require,module,exports) { +"use strict";exports.window=function(){return window}; +},{}],"UQRJ":[function(require,module,exports) { +"use strict";var e=require("./foreign.js");module.exports={window:e.window}; +},{"./foreign.js":"UOgE"}],"dln3":[function(require,module,exports) { +"use strict";exports._body=function(t){return function(){return t.body}},exports._readyState=function(t){return function(){return t.readyState}},exports._activeElement=function(t){return function(){return t.activeElement}},exports._currentScript=function(t){return function(){return t.currentScript}},exports.referrer=function(t){return function(){return t.referrer}},exports.title=function(t){return function(){return t.title}},exports.setTitle=function(t){return function(r){return function(){return r.title=t,{}}}}; +},{}],"v4VO":[function(require,module,exports) { +"use strict";var n=require("../Data.Eq/index.js"),e=require("../Data.Maybe/index.js"),t=require("../Data.Ord/index.js"),r=require("../Data.Ordering/index.js"),a=require("../Data.Show/index.js"),i=function(){function n(){}return n.value=new n,n}(),o=function(){function n(){}return n.value=new n,n}(),u=function(){function n(){}return n.value=new n,n}(),c=new a.Show(function(n){if(n instanceof i)return"Loading";if(n instanceof o)return"Interactive";if(n instanceof u)return"Complete";throw new Error("Failed pattern match at Web.HTML.HTMLDocument.ReadyState (line 15, column 10 - line 18, column 27): "+[n.constructor.name])}),f=function(n){if(n instanceof i)return"loading";if(n instanceof o)return"interactive";if(n instanceof u)return"complete";throw new Error("Failed pattern match at Web.HTML.HTMLDocument.ReadyState (line 21, column 9 - line 24, column 25): "+[n.constructor.name])},s=function(n){return"loading"===n?new e.Just(i.value):"interactive"===n?new e.Just(o.value):"complete"===n?new e.Just(u.value):e.Nothing.value},l=new n.Eq(function(n){return function(e){return n instanceof i&&e instanceof i||(n instanceof o&&e instanceof o||n instanceof u&&e instanceof u)}}),d=new t.Ord(function(){return l},function(n){return function(e){if(n instanceof i&&e instanceof i)return r.EQ.value;if(n instanceof i)return r.LT.value;if(e instanceof i)return r.GT.value;if(n instanceof o&&e instanceof o)return r.EQ.value;if(n instanceof o)return r.LT.value;if(e instanceof o)return r.GT.value;if(n instanceof u&&e instanceof u)return r.EQ.value;throw new Error("Failed pattern match at Web.HTML.HTMLDocument.ReadyState (line 12, column 1 - line 12, column 48): "+[n.constructor.name,e.constructor.name])}});module.exports={Loading:i,Interactive:o,Complete:u,print:f,parse:s,eqReadyState:l,ordReadyState:d,showReadyState:c}; +},{"../Data.Eq/index.js":"Pq4F","../Data.Maybe/index.js":"5mN7","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Data.Show/index.js":"mFY7"}],"EU5r":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),r=require("../Data.Functor/index.js"),t=require("../Data.Maybe/index.js"),n=require("../Data.Nullable/index.js"),o=require("../Effect/index.js"),a=require("../Unsafe.Coerce/index.js"),u=require("../Web.HTML.HTMLDocument.ReadyState/index.js"),f=require("../Web.Internal.FFI/index.js"),c=a.unsafeCoerce,i=a.unsafeCoerce,d=a.unsafeCoerce,s=a.unsafeCoerce,m=a.unsafeCoerce,T=function(){var n,a=r.map(o.functorEffect)((n=t.fromMaybe(u.Loading.value),function(e){return n(u.parse(e))}));return function(r){return a(e._readyState(r))}}(),g=f.unsafeReadProtoTagged("HTMLDocument"),l=f.unsafeReadProtoTagged("HTMLDocument"),M=f.unsafeReadProtoTagged("HTMLDocument"),D=f.unsafeReadProtoTagged("HTMLDocument"),E=f.unsafeReadProtoTagged("HTMLDocument"),b=function(){var t=r.map(o.functorEffect)(n.toMaybe);return function(r){return t(e._currentScript(r))}}(),v=function(){var t=r.map(o.functorEffect)(n.toMaybe);return function(r){return t(e._body(r))}}(),y=function(){var t=r.map(o.functorEffect)(n.toMaybe);return function(r){return t(e._activeElement(r))}}();module.exports={fromDocument:E,fromNode:M,fromParentNode:g,fromNonElementParentNode:l,fromEventTarget:D,toDocument:m,toNode:d,toParentNode:c,toNonElementParentNode:i,toEventTarget:s,body:v,readyState:T,activeElement:y,currentScript:b,referrer:e.referrer,title:e.title,setTitle:e.setTitle}; +},{"./foreign.js":"dln3","../Data.Functor/index.js":"+0AE","../Data.Maybe/index.js":"5mN7","../Data.Nullable/index.js":"YQ8o","../Effect/index.js":"oTWB","../Unsafe.Coerce/index.js":"ETUV","../Web.HTML.HTMLDocument.ReadyState/index.js":"v4VO","../Web.Internal.FFI/index.js":"fdUh"}],"qu+f":[function(require,module,exports) { +"use strict";exports.document=function(n){return function(){return n.document}},exports.navigator=function(n){return function(){return n.navigator}},exports.location=function(n){return function(){return n.location}},exports.history=function(n){return function(){return n.history}},exports.innerWidth=function(n){return function(){return n.innerWidth}},exports.innerHeight=function(n){return function(){return n.innerHeight}},exports.alert=function(n){return function(r){return function(){return r.alert(n),{}}}},exports.confirm=function(n){return function(r){return function(){return r.confirm(n)}}},exports.moveBy=function(n){return function(r){return function(t){return function(){return t.moveBy(n,r),{}}}}},exports.moveTo=function(n){return function(r){return function(t){return function(){return t.moveTo(n,r),{}}}}},exports._open=function(n){return function(r){return function(t){return function(e){return function(){return e.open(n,r,t)}}}}},exports.outerHeight=function(n){return function(){return n.outerHeight}},exports.outerWidth=function(n){return function(){return n.outerWidth}},exports.print=function(n){return function(){return n.print(),{}}},exports._prompt=function(n){return function(r){return function(t){return function(){return t.prompt(n,r)}}}},exports.resizeBy=function(n){return function(r){return function(t){return function(){return t.resizeBy(n,r),{}}}}},exports.resizeTo=function(n){return function(r){return function(t){return function(){return t.resizeTo(n,r),{}}}}},exports.screenX=function(n){return function(){return n.screenX}},exports.screenY=function(n){return function(){return n.screenY}},exports.scroll=function(n){return function(r){return function(t){return function(){return t.scroll(n,r),{}}}}},exports.scrollBy=function(n){return function(r){return function(t){return function(){return t.scrollBy(n,r),{}}}}},exports.scrollX=function(n){return function(){return n.scrollX}},exports.scrollY=function(n){return function(){return n.scrollY}},exports.localStorage=function(n){return function(){return n.localStorage}},exports.sessionStorage=function(n){return function(){return n.sessionStorage}},exports._requestAnimationFrame=function(n){return function(r){return function(){return r.requestAnimationFrame(n)}}},exports._cancelAnimationFrame=function(n){return function(r){return function(){return r.cancelAnimationFrame(n)}}},exports._requestIdleCallback=function(n){return function(r){return function(t){return function(){return t.requestIdleCallback(r,n)}}}},exports._cancelIdleCallback=function(n){return function(r){return function(){return r.cancelIdleCallback(n)}}},exports.parent=function(n){return function(){return n.parent}},exports._opener=function(n){return function(){return n.opener}}; +},{}],"o+50":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),n=require("../Data.Eq/index.js"),r=require("../Data.Functor/index.js"),t=require("../Data.Newtype/index.js"),o=require("../Data.Nullable/index.js"),u=require("../Data.Ord/index.js"),i=require("../Effect/index.js"),c=require("../Unsafe.Coerce/index.js"),a=function(e){return e},f=function(e){return e},l=c.unsafeCoerce,s=function(n){return function(t){var o=r.map(i.functorEffect)(a),u=e._requestIdleCallback(n)(t);return function(e){return o(u(e))}}},m=function(n){var t=r.map(i.functorEffect)(f),o=e._requestAnimationFrame(n);return function(e){return t(o(e))}},d=function(n){return function(t){return function(u){return r.map(i.functorEffect)(o.toMaybe)(e._prompt(n)(t)(u))}}},p=function(n){return function(t){return r.map(i.functorEffect)(o.toMaybe)(e._prompt(n)("")(t))}},q=function(n){return r.map(i.functorEffect)(o.toMaybe)(e._opener(n))},y=function(n){return function(t){return function(u){return function(c){return r.map(i.functorEffect)(o.toMaybe)(e._open(n)(t)(u)(c))}}}},I=new t.Newtype(function(e){return e},a),w=new t.Newtype(function(e){return e},f),b=new n.Eq(function(e){return function(n){return e===n}}),g=new u.Ord(function(){return b},function(e){return function(n){return u.compare(u.ordInt)(e)(n)}}),E=new n.Eq(function(e){return function(n){return e===n}}),h=new u.Ord(function(){return E},function(e){return function(n){return u.compare(u.ordInt)(e)(n)}}),v=function(n){return e._cancelIdleCallback(t.unwrap(I)(n))},C=function(n){return e._cancelAnimationFrame(t.unwrap(w)(n))};module.exports={toEventTarget:l,open:y,prompt:p,promptDefault:d,requestAnimationFrame:m,cancelAnimationFrame:C,requestIdleCallback:s,cancelIdleCallback:v,opener:q,newtypeRequestAnimationFrameId:w,eqRequestAnimationFrameId:E,ordRequestAnimationFrameId:h,newtypeRequestIdleCallbackId:I,eqRequestIdleCallbackId:b,ordRequestIdleCallbackId:g,document:e.document,navigator:e.navigator,location:e.location,history:e.history,innerWidth:e.innerWidth,innerHeight:e.innerHeight,alert:e.alert,confirm:e.confirm,moveBy:e.moveBy,moveTo:e.moveTo,outerHeight:e.outerHeight,outerWidth:e.outerWidth,print:e.print,resizeBy:e.resizeBy,resizeTo:e.resizeTo,screenX:e.screenX,screenY:e.screenY,scroll:e.scroll,scrollBy:e.scrollBy,scrollX:e.scrollX,scrollY:e.scrollY,localStorage:e.localStorage,sessionStorage:e.sessionStorage,parent:e.parent}; +},{"./foreign.js":"qu+f","../Data.Eq/index.js":"Pq4F","../Data.Functor/index.js":"+0AE","../Data.Newtype/index.js":"lz8k","../Data.Nullable/index.js":"YQ8o","../Data.Ord/index.js":"r4Vb","../Effect/index.js":"oTWB","../Unsafe.Coerce/index.js":"ETUV"}],"MKE0":[function(require,module,exports) { +"use strict";exports.key=function(t){return t.key},exports.code=function(t){return t.code},exports.locationIndex=function(t){return t.location},exports.ctrlKey=function(t){return t.ctrlKey},exports.shiftKey=function(t){return t.shiftKey},exports.altKey=function(t){return t.altKey},exports.metaKey=function(t){return t.metaKey},exports.repeat=function(t){return t.repeat},exports.isComposing=function(t){return t.isComposing},exports.getModifierState=function(t){return function(e){return function(){return e.getModifierState(t)}}}; +},{}],"o/+T":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),n=require("../Data.Bounded/index.js"),t=require("../Data.Enum/index.js"),r=require("../Data.Eq/index.js"),o=require("../Data.Maybe/index.js"),u=require("../Data.Ord/index.js"),a=require("../Data.Ordering/index.js"),i=require("../Unsafe.Coerce/index.js"),c=require("../Web.Internal.FFI/index.js"),f=function(){function e(){}return e.value=new e,e}(),s=function(){function e(){}return e.value=new e,e}(),d=function(){function e(){}return e.value=new e,e}(),l=function(){function e(){}return e.value=new e,e}(),v=i.unsafeCoerce,m=i.unsafeCoerce,E=function(e){return 0===e?new o.Just(f.value):1===e?new o.Just(s.value):2===e?new o.Just(d.value):3===e?new o.Just(l.value):o.Nothing.value},y=c.unsafeReadProtoTagged("KeyboardEvent"),K=c.unsafeReadProtoTagged("KeyboardEvent"),w=function(e){if(e instanceof f)return 0;if(e instanceof s)return 1;if(e instanceof d)return 2;if(e instanceof l)return 3;throw new Error("Failed pattern match at Web.UIEvent.KeyboardEvent (line 107, column 3 - line 111, column 16): "+[e.constructor.name])},g=new r.Eq(function(e){return function(n){return e instanceof f&&n instanceof f||(e instanceof s&&n instanceof s||(e instanceof d&&n instanceof d||e instanceof l&&n instanceof l))}}),q=new u.Ord(function(){return g},function(e){return function(n){if(e instanceof f&&n instanceof f)return a.EQ.value;if(e instanceof f)return a.LT.value;if(n instanceof f)return a.GT.value;if(e instanceof s&&n instanceof s)return a.EQ.value;if(e instanceof s)return a.LT.value;if(n instanceof s)return a.GT.value;if(e instanceof d&&n instanceof d)return a.EQ.value;if(e instanceof d)return a.LT.value;if(n instanceof d)return a.GT.value;if(e instanceof l&&n instanceof l)return a.EQ.value;throw new Error("Failed pattern match at Web.UIEvent.KeyboardEvent (line 81, column 1 - line 81, column 50): "+[e.constructor.name,n.constructor.name])}}),x=new t.Enum(function(){return q},t.defaultPred(E)(w),t.defaultSucc(E)(w)),L=new n.Bounded(function(){return q},f.value,l.value),b=new t.BoundedEnum(function(){return L},function(){return x},4,w,E),j=function(n){var r=o.fromJust(n),u=t.toEnum(b);return function(n){return r(u(e.locationIndex(n)))}};module.exports={fromUIEvent:y,fromEvent:K,toUIEvent:v,toEvent:m,location:j,Standard:f,Left:s,Right:d,Numpad:l,toEnumKeyLocation:E,fromEnumKeyLocation:w,eqKeyLocation:g,ordKeyLocation:q,boundedKeyLocation:L,enumKeyLocation:x,boundedEnumKeyLocation:b,key:e.key,code:e.code,locationIndex:e.locationIndex,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,repeat:e.repeat,isComposing:e.isComposing,getModifierState:e.getModifierState}; +},{"./foreign.js":"MKE0","../Data.Bounded/index.js":"kcUU","../Data.Enum/index.js":"oOsU","../Data.Eq/index.js":"Pq4F","../Data.Maybe/index.js":"5mN7","../Data.Ord/index.js":"r4Vb","../Data.Ordering/index.js":"5Eun","../Unsafe.Coerce/index.js":"ETUV","../Web.Internal.FFI/index.js":"fdUh"}],"JuOH":[function(require,module,exports) { +"use strict";var e=require("./foreign.js"),n=require("../Control.Applicative/index.js"),r=require("../Control.Apply/index.js"),t=require("../Control.Bind/index.js"),i=require("../Data.Array/index.js"),o=require("../Data.Bifunctor/index.js"),a=require("../Data.BigInt/index.js"),u=require("../Data.Either/index.js"),f=require("../Data.Filterable/index.js"),s=require("../Data.Foldable/index.js"),d=require("../Data.Function/index.js"),c=require("../Data.Functor/index.js"),l=require("../Data.Generic.Rep/index.js"),w=require("../Data.Generic.Rep.Show/index.js"),m=require("../Data.Int/index.js"),b=require("../Data.Lens.Getter/index.js"),p=require("../Data.Lens.Internal.Forget/index.js"),y=require("../Data.Lens.Iso.Newtype/index.js"),I=require("../Data.List.Types/index.js"),S=require("../Data.Map.Internal/index.js"),g=require("../Data.Maybe/index.js"),v=require("../Data.Monoid/index.js"),h=require("../Data.Newtype/index.js"),C=require("../Data.Pair/index.js"),A=require("../Data.Semigroup/index.js"),E=require("../Data.Semiring/index.js"),x=require("../Data.Show/index.js"),F=require("../Data.Symbol/index.js"),N=require("../Data.Time.Duration/index.js"),M=require("../Data.Tuple/index.js"),j=require("../Data.Unit/index.js"),q=require("../Data.Variant/index.js"),D=require("../Data.Variant.Internal/index.js"),k=require("../Effect/index.js"),B=require("../Effect.Aff/index.js"),T=require("../Effect.Aff.AVar/index.js"),R=require("../Effect.Class/index.js"),G=require("../Effect.Class.Console/index.js"),L=require("../Effect.Exception/index.js"),U=require("../Effect.Ref/index.js"),z=require("../Foreign/index.js"),H=require("../Genetics.Browser/index.js"),V=require("../Genetics.Browser.Bed/index.js"),P=require("../Genetics.Browser.Canvas/index.js"),_=require("../Genetics.Browser.Coordinates/index.js"),O=require("../Genetics.Browser.Demo/index.js"),W=require("../Genetics.Browser.Layer/index.js"),J=require("../Genetics.Browser.Track/index.js"),Z=require("../Genetics.Browser.Types/index.js"),X=require("../Genetics.Browser.UI.View/index.js"),Y=require("../Global.Unsafe/index.js"),K=require("../Math/index.js"),Q=require("../Record/index.js"),$=require("../Simple.JSON/index.js"),ee=require("../Type.Equality/index.js"),ne=require("../Web.DOM.Document/index.js"),re=require("../Web.DOM.Element/index.js"),te=require("../Web.DOM.Node/index.js"),ie=require("../Web.DOM.ParentNode/index.js"),oe=require("../Web.HTML/index.js"),ae=require("../Web.HTML.HTMLDocument/index.js"),ue=require("../Web.HTML.Window/index.js"),fe=require("../Web.UIEvent.KeyboardEvent/index.js"),se=function(){function e(){}return e.value=new e,e}(),de=function(){function e(){}return e.value=new e,e}(),ce=function(){function e(e){this.value0=e}return e.create=function(n){return new e(n)},e}(),le=function(){function e(e){this.value0=e}return e.create=function(n){return new e(n)},e}(),we=function(){function e(e){this.value0=e}return e.create=function(n){return new e(n)},e}(),me=function(e){return function(n){return"<"+e+">"+n+""}},be=function(n){return function(r){if(r instanceof se)return P.setElementStyle(n)("visibility")("visible");if(r instanceof de)return P.setElementStyle(n)("visibility")("hidden");if(r instanceof le)return P.setElementStyle(n)("left")(x.show(x.showInt)(r.value0)+"px");if(r instanceof ce)return P.setElementStyle(n)("top")(x.show(x.showInt)(r.value0)+"px");if(r instanceof we)return e.setElementContents(n)(r.value0);throw new Error("Failed pattern match at Genetics.Browser.UI (line 335, column 3 - line 345, column 33): "+[r.constructor.name])}},pe=function(e){var n,r,t,i=s.foldMap(s.foldableArray)(v.monoidString)(me("p"))(["SNP: "+e.feature.name,"Chr: "+x.show(Z.showChrId)(e.feature.chrId),"Pos: "+x.show(Z.showBp)(C.fst(e.position)),"-log10: "+b.viewOn(e.feature.score)((n=Z._NegLog10(p.profunctorForget),r=y._Newtype(Z.newtypeNegLog10)(Z.newtypeNegLog10)(p.profunctorForget),t=Z._prec(4),function(e){return n(r(t(e)))}))]);return me("div")(i)},ye=function(e){var n=s.length(s.foldableArray)(E.semiringInt)(e);return function(){return G.log(R.monadEffectEffect)("showing "+x.show(x.showInt)(5)+" out of "+x.show(x.showInt)(n)+" clicked glyphs")(),s.for_(k.applicativeEffect)(s.foldableArray)(i.take(5)(e))((r=G.log(R.monadEffectEffect),function(e){return r(e)}))();var r}},Ie=function(e){return function(n){var r=i.uncons(n.elements);if(r instanceof g.Nothing)return"";if(r instanceof g.Just&&0===r.value0.tail.length)return e(r.value0.head);if(r instanceof g.Just)return me("div")(me("p")(x.show(x.showInt)(s.length(s.foldableArray)(E.semiringInt)(r.value0.tail)+1|0)+" annotations"));throw new Error("Failed pattern match at Genetics.Browser.UI (line 244, column 3 - line 249, column 51): "+[r.constructor.name])}},Se=c.map(c.functorArray)(o.bimap(M.bifunctorTuple)(Z.ChrId)(function(){var e=g.fromJust();return function(n){return e(a.fromString(n))}}()))([new M.Tuple("1","195471971"),new M.Tuple("2","182113224"),new M.Tuple("3","160039680"),new M.Tuple("4","156508116"),new M.Tuple("5","151834684"),new M.Tuple("6","149736546"),new M.Tuple("7","145441459"),new M.Tuple("8","129401213"),new M.Tuple("9","124595110"),new M.Tuple("10","130694993"),new M.Tuple("11","122082543"),new M.Tuple("12","120129022"),new M.Tuple("13","120421639"),new M.Tuple("14","124902244"),new M.Tuple("15","104043685"),new M.Tuple("16","98207768"),new M.Tuple("17","94987271"),new M.Tuple("18","90702639"),new M.Tuple("19","61431566")]),ge=function(r){return function(t){return function(i){return e.keydownEvent(r)(function(e){var r=fe.key(e);return"ArrowLeft"===r?i(new X.ScrollView(-t.scrollMod)):"ArrowRight"===r?i(new X.ScrollView(t.scrollMod)):n.pure(k.applicativeEffect)(j.unit)})}}},ve="infoBox",he=function(){var e=c.map(k.functorEffect)(ae.toDocument)(t.bindFlipped(k.bindEffect)(ue.document)(oe.window))(),n=ne.createElement("div")(e)();return re.setId(ve)(n)(),function(){var r=ne.documentElement(e)();if(r instanceof g.Nothing)return L.throw("Couldn't find document body!")();if(r instanceof g.Just)return c.void(k.functorEffect)(te.appendChild(re.toNode(n))(re.toNode(r.value0)))();throw new Error("Failed pattern match at Genetics.Browser.UI (line 358, column 31 - line 360, column 84): "+[r.constructor.name])}(),be(n)},Ce=new l.Generic(function(e){if(e instanceof se)return new l.Inl(l.NoArguments.value);if(e instanceof de)return new l.Inr(new l.Inl(l.NoArguments.value));if(e instanceof ce)return new l.Inr(new l.Inr(new l.Inl(e.value0)));if(e instanceof le)return new l.Inr(new l.Inr(new l.Inr(new l.Inl(e.value0))));if(e instanceof we)return new l.Inr(new l.Inr(new l.Inr(new l.Inr(e.value0))));throw new Error("Failed pattern match at Genetics.Browser.UI (line 328, column 1 - line 328, column 54): "+[e.constructor.name])},function(e){if(e instanceof l.Inl)return se.value;if(e instanceof l.Inr&&e.value0 instanceof l.Inl)return de.value;if(e instanceof l.Inr&&e.value0 instanceof l.Inr&&e.value0.value0 instanceof l.Inl)return new ce(e.value0.value0.value0);if(e instanceof l.Inr&&e.value0 instanceof l.Inr&&e.value0.value0 instanceof l.Inr&&e.value0.value0.value0 instanceof l.Inl)return new le(e.value0.value0.value0.value0);if(e instanceof l.Inr&&e.value0 instanceof l.Inr&&e.value0.value0 instanceof l.Inr&&e.value0.value0.value0 instanceof l.Inr)return new we(e.value0.value0.value0.value0);throw new Error("Failed pattern match at Genetics.Browser.UI (line 328, column 1 - line 328, column 54): "+[e.constructor.name])}),Ae=new x.Show(w.genericShow(Ce)(w.genericShowSum(w.genericShowConstructor(w.genericShowArgsNoArguments)(new F.IsSymbol(function(){return"IBoxShow"})))(w.genericShowSum(w.genericShowConstructor(w.genericShowArgsNoArguments)(new F.IsSymbol(function(){return"IBoxHide"})))(w.genericShowSum(w.genericShowConstructor(w.genericShowArgsArgument(x.showInt))(new F.IsSymbol(function(){return"IBoxSetY"})))(w.genericShowSum(w.genericShowConstructor(w.genericShowArgsArgument(x.showInt))(new F.IsSymbol(function(){return"IBoxSetX"})))(w.genericShowConstructor(w.genericShowArgsArgument(x.showString))(new F.IsSymbol(function(){return"IBoxSetContents"})))))))),Ee=function(n){return function(r){return function(){return e.buttonEvent("scrollLeft")(r(new X.ScrollView(-n.scrollMod)))(),e.buttonEvent("scrollRight")(r(new X.ScrollView(n.scrollMod)))(),e.buttonEvent("zoomOut")(r(X.ZoomView.create(1+n.zoomMod)))(),e.buttonEvent("zoomIn")(r(X.ZoomView.create(1-n.zoomMod)))()}}},xe=Ee({scrollMod:.5,zoomMod:1}),Fe=function(e){var n=g.fromMaybe(e.feature.name)(e.feature.gene),r=function(){if(e.feature.url instanceof g.Nothing)return n;if(e.feature.url instanceof g.Just)return""+n+"";throw new Error("Failed pattern match at Genetics.Browser.UI (line 308, column 18 - line 310, column 84): "+[e.feature.url.constructor.name])}();return me("p")(r)},Ne=function(e){return function(n){var r=g.fromMaybe("No URL")(c.map(g.functorMaybe)(function(e){return"URL: "+e+""})(n.feature.url)),t=g.fromMaybe("Annotated SNP: "+n.feature.name)(c.map(g.functorMaybe)(function(e){return"Gene: "+e})(n.feature.gene)),o=s.foldMap(s.foldableArray)(v.monoidString)(me("p"))(A.append(A.semigroupArray)([t,r])(f.filterMap(f.filterableArray)(e)(i.fromFoldable(I.foldableList)(n.feature.rest))));return me("div")(o)}},Me=Ne(function(){var e=n.pure(g.applicativeMaybe);return function(n){return e(O.showAnnotationField(n))}}()),je=Ne(function(e){return n.pure(g.applicativeMaybe)("p_lrt"===e.field?"p_lrt: "+b.viewOn(e.value)((r=Z._NegLog10(p.profunctorForget),t=y._Newtype(Z.newtypeNegLog10)(Z.newtypeNegLog10)(p.profunctorForget),i=Z._prec(4),function(e){return r(t(i(e)))})):O.showAnnotationField(e));var r,t,i}),qe=function(e){var n=i.uncons(e.elements);if(n instanceof g.Nothing)return"";if(n instanceof g.Just&&0===n.value0.tail.length)return Me(n.value0.head);if(n instanceof g.Just)return me("div")(me("p")("Annotations:")+s.foldMap(s.foldableArray)(v.monoidString)(Fe)(e.elements));throw new Error("Failed pattern match at Genetics.Browser.UI (line 256, column 3 - line 261, column 75): "+[n.constructor.name])},De=F.SProxy.value,ke=function(e){return function(r){return function(i){return function(i){return function(o){return function(a){return t.bind(B.bindAff)(T.empty)(function(u){return t.bind(B.bindAff)(T.empty)(function(f){return t.bind(B.bindAff)(J.makeTrack(e)(r)(i)(a))(function(e){var r=d.flip(T.put)(f),i=t.bind(B.bindAff)(T.take(f))(function(f){return t.discard(t.discardUnit)(B.bindAff)(q.match()(D.variantMatchCons(D.variantMatchCons(D.variantMatchNil)()(ee.refl))()(ee.refl))()({render:function(e){return n.pure(B.applicativeAff)(j.unit)},docResize:function(e){return t.bind(B.bindAff)(c.map(B.functorAff)(function(e){return e.size})(P.getDimensions(B.monadEffectAff)(a)))(function(n){return t.discard(t.discardUnit)(B.bindAff)(P.setTrackContainerSize(B.monadEffectAff)({width:e.width,height:n.height})(a))(function(){return t.discard(t.discardUnit)(B.bindAff)(r(q.inj()(new F.IsSymbol(function(){return"render"}))(De)(j.unit)))(function(){return i})})})}})(f))(function(){return t.discard(t.discardUnit)(B.bindAff)(t.bindFlipped(B.bindAff)(s.traverse_(B.applicativeAff)(s.foldableMaybe)(B.killFiber(L.error("Resetting renderer"))))(T.tryTake(u)))(function(){return t.bind(B.bindAff)(R.liftEffect(B.monadEffectAff)(o))(function(n){return t.bind(B.bindAff)(P.getDimensions(B.monadEffectAff)(a))(function(r){var o=W.trackSlots(r).center,a=_.viewScale(o.size)(n),f=c.map(C.functorPair)(_.scaleToScreen(a))(h.unwrap(_.coordsysviewNewtype)(n));return t.bind(B.bindAff)(B.forkAff(e.render(f)(n)))(function(e){return t.discard(t.discardUnit)(B.bindAff)(T.put(e)(u))(function(){return i})})})})})})});return t.bind(B.bindAff)(B.forkAff(i))(function(i){return t.discard(t.discardUnit)(B.bindAff)(r(q.inj()(new F.IsSymbol(function(){return"render"}))(De)(j.unit)))(function(){return n.pure(B.applicativeAff)({lastHotspots:e.hotspots,queueCommand:r})})})})})})}}}}}},Be=F.SProxy.value,Te=function(r){return function(t){return function(i){return R.liftEffect(B.monadEffectAff)(function(){return e.resizeEvent(function(e){return B.launchAff_(i.queueCommand(q.inj()(new F.IsSymbol(function(){return"docResize"}))(Be)(e)))})(),P.dragScrollTrack(t)(function(e){return n.when(k.applicativeEffect)(K.abs(e.x)>=1)(function(){var n=c.map(k.functorEffect)(function(e){return W.trackSlots(e).center})(P.getDimensions(R.monadEffectEffect)(t))(),i=X.ScrollView.create(e.x/n.size.width);return r.updateView(i)()})})()})}}},Re=function(e){return function(r){return t.bind(B.bindAff)(R.liftEffect(B.monadEffectAff)(U.read(e)))(function(e){return t.bind(B.bindAff)(P.getTrack("gene")(e.container))(function(i){return t.bind(B.bindAff)(J.fetchData()()(J.trackDataCons(new F.IsSymbol(function(){return"genes"}))()()(S.monoidMap(Z.ordChrId))()()()(J.trackDataNil(ee.refl)))(i)({genes:V.getGenes(e.coordSys)})(r.urls))(function(o){return t.bind(B.bindAff)(t.bind(B.bindAff)(O.addChrLayers({coordinateSystem:e.coordSys,segmentPadding:12})(r.chrs)(i))(function(a){return t.bind(B.bindAff)(O.addGeneLayers(e.coordSys)(r.tracks.gene)(o)(i))(function(e){return n.pure(B.applicativeAff)(Q.merge()()({chrs:a})(e))})}))(function(n){return t.bind(B.bindAff)(ke()(J.trackRecordRender(new F.IsSymbol(function(){return"chrs"}))()()(J.trackRecordRender(new F.IsSymbol(function(){return"genes"}))()()(J.trackRecordNil(ee.refl))))(e.coordSys)(n)(e.viewManager.browserView)(i))(function(n){return t.discard(t.discardUnit)(B.bindAff)(Te(e.viewManager)(i)(n))(function(){return R.liftEffect(B.monadEffectAff)(e.viewManager.addCallback(function(e){return B.launchAff_(n.queueCommand(q.inj()(new F.IsSymbol(function(){return"render"}))(De)(j.unit)))}))})})})})})})}},Ge=function(e){return function(r){return t.bind(B.bindAff)(R.liftEffect(B.monadEffectAff)(U.read(e)))(function(e){return t.bind(B.bindAff)(P.getTrack("gwas")(e.container))(function(o){return t.bind(B.bindAff)(J.fetchData()()(J.trackDataCons(new F.IsSymbol(function(){return"annotations"}))()()(S.monoidMap(Z.ordChrId))()()()(J.trackDataCons(new F.IsSymbol(function(){return"snps"}))()()(S.monoidMap(Z.ordChrId))()()()(J.trackDataNil(ee.refl))))(o)({snps:O.getSNPs(e.coordSys),annotations:O.getAnnotations(e.coordSys)})(r.urls))(function(a){return t.bind(B.bindAff)(t.bind(B.bindAff)(O.addChrLayers({coordinateSystem:e.coordSys,segmentPadding:12})(r.chrs)(o))(function(i){return t.bind(B.bindAff)(O.addGWASLayers(e.coordSys)(r.tracks.gwas)(a)(o))(function(e){return n.pure(B.applicativeAff)(Q.merge()()({chrs:i})(e))})}))(function(n){return t.bind(B.bindAff)(ke()(J.trackRecordRender(new F.IsSymbol(function(){return"annotations"}))()()(J.trackRecordRender(new F.IsSymbol(function(){return"chrs"}))()()(J.trackRecordUI(new F.IsSymbol(function(){return"fixedUI"}))()()(J.trackRecordHotspots(new F.IsSymbol(function(){return"hotspots"}))()()(ee.refl)(J.trackRecordRender(new F.IsSymbol(function(){return"snps"}))()()(J.trackRecordNil(ee.refl)))))))(e.coordSys)(n)(e.viewManager.browserView)(o))(function(n){return t.discard(t.discardUnit)(B.bindAff)(Te(e.viewManager)(o)(n))(function(){return t.discard(t.discardUnit)(B.bindAff)(R.liftEffect(B.monadEffectAff)(e.viewManager.addCallback(function(e){return B.launchAff_(n.queueCommand(q.inj()(new F.IsSymbol(function(){return"render"}))(De)(j.unit)))})))(function(){return R.liftEffect(B.monadEffectAff)((u=O.filterSig(r.score)(a.snps),P.trackClickHandler(R.monadEffectEffect)(o)(new W.Center(function(r){return B.launchAff_(t.bind(B.bindAff)(R.liftEffect(B.monadEffectAff)(e.viewManager.browserView))(function(f){return t.bind(B.bindAff)(c.map(B.functorAff)(function(e){return W.trackSlots(e).center})(P.getDimensions(B.monadEffectAff)(o)))(function(o){var d=H.pixelSegments({segmentPadding:12})(e.coordSys)(o.size)(f),c=O.annotationsForScale(e.coordSys)(u)(a.annotations)(d);return t.bind(B.bindAff)(n.lastHotspots)(function(n){var o=n(1)(r);return R.liftEffect(B.monadEffectAff)(function(){var n=i.head(o);if(n instanceof g.Nothing)return e.cmdInfoBox(de.value);if(n instanceof g.Just)return function(){return e.cmdInfoBox(se.value)(),e.cmdInfoBox(le.create(m.round(r.x)))(),e.cmdInfoBox(ce.create(m.round(r.y)))(),e.cmdInfoBox(we.create(pe(n.value0)+s.foldMap(s.foldableMaybe)(v.monoidString)(qe)((i=c,function(e){return t.bindFlipped(g.bindMaybe)(s.find(s.foldableArray)(function(n){return _.pairsOverlap(Z.ordBp)(n.covers)(e.position)}))(S.lookup(Z.ordChrId)(e.feature.chrId)(i))})(n.value0))))();var i};throw new Error("Failed pattern match at Genetics.Browser.UI (line 436, column 15 - line 444, column 70): "+[n.constructor.name])}())})})}))}))));var u})})})})})})})}},Le=function(i){return function(o){return B.launchAff((u=_.coordSys(Z.ordChrId)(a.semiringBigInt)(Se),f=g.fromMaybe(h.wrap(_.coordsysviewNewtype)(new C.Pair(E.zero(a.semiringBigInt),b.viewOn(u)(_._TotalSize(a.ringBigInt)))))(t.bind(g.bindMaybe)(i.initialChrs)(function(e){return t.bind(g.bindMaybe)(S.lookup(Z.ordChrId)(h.wrap(Z.newtypeChrId)(e.left))(b.viewOn(u)(_._Segments(p.strongForget))))(function(r){return t.bind(g.bindMaybe)(S.lookup(Z.ordChrId)(h.wrap(Z.newtypeChrId)(e.right))(b.viewOn(u)(_._Segments(p.strongForget))))(function(e){return n.pure(g.applicativeMaybe)(h.wrap(_.coordsysviewNewtype)(new C.Pair(r.value0,e.value1)))})})})),t.discard(t.discardUnit)(B.bindAff)(R.liftEffect(B.monadEffectAff)(e.initDebugDiv(1)))(function(){return t.bind(B.bindAff)(R.liftEffect(B.monadEffectAff)(he))(function(a){return t.bind(B.bindAff)(R.liftEffect(B.monadEffectAff)(X.browserViewManager(u)(h.wrap(N.newtypeMilliseconds)(200))({initialView:f})(o)))(function(s){return t.bind(B.bindAff)(R.liftEffect(B.monadEffectAff)(U.new({viewManager:s,cmdInfoBox:a,container:o,coordSys:u})))(function(a){return t.discard(t.discardUnit)(B.bindAff)(R.liftEffect(B.monadEffectAff)((u={scrollMod:.1,zoomMod:.15},function(){var n;return Ee(u)(function(e){return s.updateView(e)})(),e.buttonEvent("reset")((n=new X.ModView(d.const(h.unwrap(_.coordsysviewNewtype)(f))),s.updateView(n)))(),ge(b.viewOn(o)(P._Container(P.newtypeBrowserContainer)(p.strongForget)))({scrollMod:.075})(function(e){return s.updateView(e)})(),P.wheelZoom(P.newtypeBrowserContainer)(o)(function(e){var n=X.ZoomView.create(1+.06*e);return s.updateView(n)})()})))(function(){if(i.urls.snps instanceof g.Just)return r.applySecond(B.applyAff)(Ge(a)(i))(n.pure(B.applicativeAff)(j.unit));if(i.urls.snps instanceof g.Nothing)return n.pure(B.applicativeAff)(j.unit);throw new Error("Failed pattern match at Genetics.Browser.UI (line 527, column 3 - line 529, column 25): "+[i.urls.snps.constructor.name])});var u})})})})));var u,f}},Ue=function(i){return function(){var o,a=function(){var e=c.map(k.functorEffect)(ae.toDocument)(t.bindFlipped(k.bindEffect)(ue.document)(oe.window))();return ie.querySelector(h.wrap(ie.newtypeQuerySelector)("#browser"))(ne.toParentNode(e))()}();if(a instanceof g.Nothing)return G.log(R.monadEffectEffect)("Could not find element '#browser'")();if(a instanceof g.Just){var f=$.read($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"chrs"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"chrBG1"}))(H.readforeignHexColor)($.readFieldsCons(new F.IsSymbol(function(){return"chrBG2"}))(H.readforeignHexColor)($.readFieldsCons(new F.IsSymbol(function(){return"chrLabels"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"fontSize"}))($.readInt)($.readFieldsNil)()()))($.readFieldsNil)()())()())()()))($.readFieldsCons(new F.IsSymbol(function(){return"initialChrs"}))($.readMaybe($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"left"}))($.readString)($.readFieldsCons(new F.IsSymbol(function(){return"right"}))($.readString)($.readFieldsNil)()())()())))($.readFieldsCons(new F.IsSymbol(function(){return"score"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"max"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"min"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"sig"}))($.readNumber)($.readFieldsNil)()())()())()()))($.readFieldsCons(new F.IsSymbol(function(){return"tracks"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"gwas"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"annotations"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"geneColor"}))(H.readforeignHexColor)($.readFieldsCons(new F.IsSymbol(function(){return"outline"}))(H.readforeignHexColor)($.readFieldsCons(new F.IsSymbol(function(){return"radius"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"snpColor"}))(H.readforeignHexColor)($.readFieldsNil)()())()())()())()()))($.readFieldsCons(new F.IsSymbol(function(){return"legend"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"fontSize"}))($.readInt)($.readFieldsCons(new F.IsSymbol(function(){return"hPad"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"vPad"}))($.readNumber)($.readFieldsNil)()())()())()()))($.readFieldsCons(new F.IsSymbol(function(){return"padding"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"bottom"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"left"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"right"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"top"}))($.readNumber)($.readFieldsNil)()())()())()())()()))($.readFieldsCons(new F.IsSymbol(function(){return"score"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"max"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"min"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"sig"}))($.readNumber)($.readFieldsNil)()())()())()()))($.readFieldsCons(new F.IsSymbol(function(){return"snps"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"color"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"fill"}))(H.readforeignHexColor)($.readFieldsCons(new F.IsSymbol(function(){return"outline"}))(H.readforeignHexColor)($.readFieldsNil)()())()()))($.readFieldsCons(new F.IsSymbol(function(){return"lineWidth"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"pixelOffset"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"x"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"y"}))($.readNumber)($.readFieldsNil)()())()()))($.readFieldsCons(new F.IsSymbol(function(){return"radius"}))($.readNumber)($.readFieldsNil)()())()())()())()()))($.readFieldsCons(new F.IsSymbol(function(){return"trackHeight"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"vscale"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"color"}))(H.readforeignHexColor)($.readFieldsCons(new F.IsSymbol(function(){return"fonts"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"labelSize"}))($.readInt)($.readFieldsCons(new F.IsSymbol(function(){return"scaleSize"}))($.readInt)($.readFieldsNil)()())()()))($.readFieldsCons(new F.IsSymbol(function(){return"hPad"}))($.readNumber)($.readFieldsCons(new F.IsSymbol(function(){return"numSteps"}))($.readInt)($.readFieldsNil)()())()())()())()()))($.readFieldsNil)()())()())()())()())()())()())()()))($.readFieldsNil)()()))($.readFieldsCons(new F.IsSymbol(function(){return"urls"}))($.readRecord()($.readFieldsCons(new F.IsSymbol(function(){return"annotations"}))($.readMaybe($.readString))($.readFieldsCons(new F.IsSymbol(function(){return"genes"}))($.readMaybe($.readString))($.readFieldsCons(new F.IsSymbol(function(){return"snps"}))($.readMaybe($.readString))($.readFieldsNil)()())()())()()))($.readFieldsNil)()())()())()())()())()()))(i);if(f instanceof u.Left)return e.setElementContents(a.value0)("

    Error when parsing provided config object:

    "+s.foldMap(I.foldableNonEmptyList)(v.monoidString)((o=me("p"),function(e){return o(z.renderForeignError(e))}))(f.value0))();if(f instanceof u.Right){var d=e.windowInnerSize(),l=J.makeContainers()(J.trackConfigCons(new F.IsSymbol(function(){return"gwas"}))(J.trackConfigNil(ee.refl))()()()()(ee.refl))(d.width)(f.value0.tracks)(),w=P.browserContainer(R.monadEffectEffect)(a.value0)();return function(){if(f.value0.urls.snps instanceof g.Just)return r.applySecond(k.applyEffect)(P.addTrack(R.monadEffectEffect)(w)("gwas")(l.gwas))(n.pure(k.applicativeEffect)(j.unit))();if(f.value0.urls.snps instanceof g.Nothing)return j.unit;throw new Error("Failed pattern match at Genetics.Browser.UI (line 586, column 11 - line 588, column 33): "+[f.value0.urls.snps.constructor.name])}(),G.log(R.monadEffectEffect)(Y.unsafeStringify(f.value0))(),c.void(k.functorEffect)(Le(f.value0)(w))()}throw new Error("Failed pattern match at Genetics.Browser.UI (line 572, column 7 - line 595, column 33): "+[f.constructor.name])}throw new Error("Failed pattern match at Genetics.Browser.UI (line 568, column 3 - line 595, column 33): "+[a.constructor.name])}};module.exports={_render:De,_docResize:Be,initializeTrack:ke,btnUI:Ee,btnUIFixed:xe,keyUI:ge,printSNPInfo:ye,wrapWith:me,snpHTML:pe,peakHTML:Ie,annoPeakHTML:qe,annotationHTML:Ne,annotationHTMLAll:Me,annotationHTMLDefault:je,annotationHTMLShort:Fe,IBoxShow:se,IBoxHide:de,IBoxSetY:ce,IBoxSetX:le,IBoxSetContents:we,updateInfoBox:be,infoBoxId:ve,initInfoBox:he,setHandlers:Te,mkGwas:Ge,mkGene:Re,runBrowser:Le,main:Ue,mouseChrSizes:Se,genericInfoBoxF:Ce,showInfoBoxF:Ae,windowInnerSize:e.windowInnerSize,buttonEvent:e.buttonEvent,keydownEvent:e.keydownEvent,resizeEvent:e.resizeEvent,initDebugDiv:e.initDebugDiv,setDebugDivVisibility:e.setDebugDivVisibility,setDebugDivPoint:e.setDebugDivPoint,setElementContents:e.setElementContents,setWindow:e.setWindow}; +},{"./foreign.js":"DuPX","../Control.Applicative/index.js":"qYya","../Control.Apply/index.js":"QcLv","../Control.Bind/index.js":"7VcT","../Data.Array/index.js":"4t4C","../Data.Bifunctor/index.js":"e2Wc","../Data.BigInt/index.js":"Zx+T","../Data.Either/index.js":"B2JL","../Data.Filterable/index.js":"6hfS","../Data.Foldable/index.js":"eVDl","../Data.Function/index.js":"ImXJ","../Data.Functor/index.js":"+0AE","../Data.Generic.Rep/index.js":"AuzG","../Data.Generic.Rep.Show/index.js":"lpst","../Data.Int/index.js":"xNJb","../Data.Lens.Getter/index.js":"OPOX","../Data.Lens.Internal.Forget/index.js":"mj9z","../Data.Lens.Iso.Newtype/index.js":"CiFJ","../Data.List.Types/index.js":"Xxuc","../Data.Map.Internal/index.js":"RRDs","../Data.Maybe/index.js":"5mN7","../Data.Monoid/index.js":"TiEB","../Data.Newtype/index.js":"lz8k","../Data.Pair/index.js":"PpsX","../Data.Semigroup/index.js":"EsAJ","../Data.Semiring/index.js":"11NF","../Data.Show/index.js":"mFY7","../Data.Symbol/index.js":"4oJQ","../Data.Time.Duration/index.js":"AnkF","../Data.Tuple/index.js":"II/O","../Data.Unit/index.js":"NhVk","../Data.Variant/index.js":"hgdh","../Data.Variant.Internal/index.js":"kYoO","../Effect/index.js":"oTWB","../Effect.Aff/index.js":"I7lu","../Effect.Aff.AVar/index.js":"hACG","../Effect.Class/index.js":"dWtH","../Effect.Class.Console/index.js":"3Dts","../Effect.Exception/index.js":"0OCW","../Effect.Ref/index.js":"/Jaj","../Foreign/index.js":"pu1p","../Genetics.Browser/index.js":"X0te","../Genetics.Browser.Bed/index.js":"UuEA","../Genetics.Browser.Canvas/index.js":"VVkU","../Genetics.Browser.Coordinates/index.js":"7bYH","../Genetics.Browser.Demo/index.js":"mKwt","../Genetics.Browser.Layer/index.js":"YWUW","../Genetics.Browser.Track/index.js":"HH6s","../Genetics.Browser.Types/index.js":"HhmG","../Genetics.Browser.UI.View/index.js":"Tmz+","../Global.Unsafe/index.js":"qSZP","../Math/index.js":"Rpaz","../Record/index.js":"0gG4","../Simple.JSON/index.js":"DqNI","../Type.Equality/index.js":"Uq/R","../Web.DOM.Document/index.js":"0hiR","../Web.DOM.Element/index.js":"S4h2","../Web.DOM.Node/index.js":"P+X4","../Web.DOM.ParentNode/index.js":"lU5U","../Web.HTML/index.js":"UQRJ","../Web.HTML.HTMLDocument/index.js":"EU5r","../Web.HTML.Window/index.js":"o+50","../Web.UIEvent.KeyboardEvent/index.js":"o/+T"}],"Focm":[function(require,module,exports) { +var e=require("./output/Genetics.Browser.UI");window.GenomeBrowser=e; +},{"./output/Genetics.Browser.UI":"JuOH"}]},{},["Focm"], null) \ No newline at end of file -- cgit v1.2.3 From 4e6c8eba35a5ecd9e6b5b1c5faa98021656acb9d Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 12 Aug 2019 16:34:05 -0500 Subject: Fixed some things to update the genome browser and get it running correctly Fixed issue where trait page for genotype traits didn't work Removed bad y axis title on probability plot --- .../marker_regression/display_mapping_results.py | 9 + wqflask/wqflask/marker_regression/run_mapping.py | 49 +- wqflask/wqflask/show_trait/show_trait.py | 4 +- .../static/new/javascript/init_genome_browser.js | 168 +- .../new/javascript/plotly_probability_plot.js | 1 - .../css/purescript-genetics-browser.css | 1 + .../css/purescript_genetics_browser_v01.css | 1 - .../js/purescript-genetics-browser.js | 63016 +++++++++++++++++++ .../js/purescript-genetics-browser_v01.js | 659 - wqflask/wqflask/templates/mapping_results.html | 10 +- wqflask/wqflask/views.py | 4 +- 11 files changed, 63166 insertions(+), 756 deletions(-) create mode 100644 wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript-genetics-browser.css delete mode 100644 wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript_genetics_browser_v01.css create mode 100644 wqflask/wqflask/static/packages/purescript_genome_browser/js/purescript-genetics-browser.js delete mode 100644 wqflask/wqflask/static/packages/purescript_genome_browser/js/purescript-genetics-browser_v01.js diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index ea1ca5ed..b1e9dad4 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -31,6 +31,7 @@ import piddle as pid import sys,os import cPickle import httplib +import json from flask import Flask, g @@ -1696,6 +1697,14 @@ class DisplayMappingResults(object): else: LRS_LOD_Max = self.lrsMax + #ZS: Needed to pass to genome browser + js_data = json.loads(self.js_data) + if self.LRS_LOD == "LRS": + js_data['max_score'] = LRS_LOD_Max/4.16 + else: + js_data['max_score'] = LRS_LOD_Max + self.js_data = json.dumps(js_data) + if LRS_LOD_Max > 100: LRSScale = 20.0 elif LRS_LOD_Max > 20: diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 7f6bb0a5..11ad7aa4 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -7,6 +7,7 @@ from pprint import pformat as pf import string import math +from decimal import Decimal import random import sys import datetime @@ -314,30 +315,41 @@ class RunMapping(object): else: self.qtl_results = [] self.qtl_results_for_browser = [] + self.annotations_for_browser = [] highest_chr = 1 #This is needed in order to convert the highest chr to X/Y for marker in results: browser_marker = dict( chr = str(marker['chr']), rs = marker['name'], - ps = marker['Mb']*1000000 + ps = marker['Mb']*1000000, + url = "/show_trait?trait_id=" + marker['name'] + "&dataset=" + self.dataset.group.name + "Geno" ) - if 'p_value' in marker: - browser_marker['p_wald'] = marker['p_value'] + annot_marker = dict( + name = str(marker['name']), + chr = str(marker['chr']), + rs = marker['name'], + pos = marker['Mb']*1000000, + url = "/show_trait?trait_id=" + marker['name'] + "&dataset=" + self.dataset.group.name + "Geno" + ) + #if 'p_value' in marker: + # logger.debug("P EXISTS:", marker['p_value']) + #else: + if 'lrs_value' in marker and marker['lrs_value'] > 0: + browser_marker['p_wald'] = 10**-(marker['lrs_value']/4.61) + elif 'lod_score' in marker and marker['lod_score'] > 0: + browser_marker['p_wald'] = 10**-(marker['lod_score']) else: - if 'lrs_value' in marker and marker['lrs_value'] > 0: - browser_marker['p_wald'] = -math.log10(marker['lrs_value']/4.16) - elif 'lod_score' in marker and marker['lod_score'] > 0: - browser_marker['p_wald'] = -math.log10(marker['lod_score']) - else: - browser_marker['p_wald'] = 0 + browser_marker['p_wald'] = 0 + self.qtl_results_for_browser.append(browser_marker) + self.annotations_for_browser.append(annot_marker) if marker['chr'] > 0 or marker['chr'] == "X" or marker['chr'] == "X/Y": if marker['chr'] > highest_chr or marker['chr'] == "X" or marker['chr'] == "X/Y": highest_chr = marker['chr'] if ('lod_score' in marker.keys()) or ('lrs_value' in marker.keys()): self.qtl_results.append(marker) - browser_files = write_input_for_browser(self.dataset, self.qtl_results_for_browser) + browser_files = write_input_for_browser(self.dataset, self.qtl_results_for_browser, self.annotations_for_browser) with Bench("Exporting Results"): export_mapping_results(self.dataset, self.this_trait, self.qtl_results, self.mapping_results_path, self.mapping_scale, self.score_type) @@ -350,6 +362,11 @@ class RunMapping(object): self.trimmed_markers = trim_markers_for_table(results) if self.mapping_method != "gemma": + if self.score_type == "LRS": + significant_for_browser = self.significant / 4.16 + else: + significant_for_browser = self.significant + self.js_data = dict( #result_score_type = self.score_type, #this_trait = self.this_trait.name, @@ -361,7 +378,8 @@ class RunMapping(object): #qtl_results = self.qtl_results, num_perm = self.num_perm, perm_results = self.perm_output, - browser_files = browser_files + browser_files = browser_files, + significant = significant_for_browser ) else: self.js_data = dict( @@ -406,6 +424,7 @@ class RunMapping(object): def export_mapping_results(dataset, trait, markers, results_path, mapping_scale, score_type): with open(results_path, "w+") as output_file: + output_file.write("Time/Date: " + datetime.datetime.now().strftime("%x / %X") + "\n") output_file.write("Population: " + dataset.group.species.title() + " " + dataset.group.name + "\n") output_file.write("Data Set: " + dataset.fullname + "\n") if dataset.type == "ProbeSet": @@ -413,6 +432,8 @@ def export_mapping_results(dataset, trait, markers, results_path, mapping_scale, output_file.write("Location: " + str(trait.chr) + " @ " + str(trait.mb) + " Mb\n") output_file.write("\n") output_file.write("Name,Chr,") + if score_type.lower() == "-log(p)": + score_type = "'-log(p)" if mapping_scale == "physic": output_file.write("Mb," + score_type) else: @@ -491,7 +512,7 @@ def trim_markers_for_table(markers): else: return sorted_markers -def write_input_for_browser(this_dataset, markers): +def write_input_for_browser(this_dataset, gwas_results, annotations): file_base = this_dataset.group.name + "_" + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6)) gwas_filename = file_base + "_GWAS" annot_filename = file_base + "_ANNOT" @@ -499,8 +520,8 @@ def write_input_for_browser(this_dataset, markers): annot_path = "{}/gn2/".format(TEMPDIR) + annot_filename with open(gwas_path + ".json", "w") as gwas_file, open(annot_path + ".json", "w") as annot_file: - gwas_file.write(json.dumps(markers)) - annot_file.write(json.dumps([])) + gwas_file.write(json.dumps(gwas_results)) + annot_file.write(json.dumps(annotations)) return [gwas_filename, annot_filename] #return [gwas_filename, annot_filename] \ No newline at end of file diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index b0a46b32..02c65d47 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -194,10 +194,10 @@ class ShowTrait(object): trait_symbol = self.this_trait.symbol short_description = trait_symbol - elif self.this_trait.post_publication_abbreviation: + elif hasattr(self.this_trait, 'post_publication_abbreviation'): short_description = self.this_trait.post_publication_abbreviation - elif self.this_trait.pre_publication_abbreviation: + elif hasattr(self.this_trait, 'pre_publication_abbreviation'): short_description = self.this_trait.pre_publication_abbreviation # Todo: Add back in the ones we actually need from below, as we discover we need them diff --git a/wqflask/wqflask/static/new/javascript/init_genome_browser.js b/wqflask/wqflask/static/new/javascript/init_genome_browser.js index 64a300bc..7dfd6712 100644 --- a/wqflask/wqflask/static/new/javascript/init_genome_browser.js +++ b/wqflask/wqflask/static/new/javascript/init_genome_browser.js @@ -1,73 +1,97 @@ -console.log("THE FILES:", js_data.browser_files) - -snps_filename = "/browser_input?filename=" + js_data.browser_files[0] -annot_filename = "/browser_input?filename=" + js_data.browser_files[1] - -localUrls = -{ - snps: snps_filename, - annotations: null -}; - -var vscaleWidth = 90.0; -var legendWidth = 140.0; -var score = { min: 0.0, max: 30.0, sig: 4 }; -var gwasPadding = { top: 35.0, - bottom: 35.0, - left: vscaleWidth, - right: legendWidth }; -var gwasHeight = 420.0; -var genePadding = { top: 10.0, - bottom: 35.0, - left: vscaleWidth, - right: legendWidth }; -var geneHeight = 140.0; - - -var config = -{ trackHeight: 400.0, - padding: gwasPadding, - score: score, - urls: localUrls, - tracks: { - gwas: { - trackHeight: gwasHeight, - padding: gwasPadding, - snps: { - radius: 3.75, - lineWidth: 1.0, - color: { outline: "#FFFFFF", - fill: "#00008B" }, - pixelOffset: {x: 0.0, y: 0.0} - }, - annotations: { - radius: 5.5, - outline: "#000000", - snpColor: "#0074D9", - geneColor: "#FF4136" - }, - score: score, - legend: { - fontSize: 14, - hPad: 0.2, - vPad: 0.2 - }, - vscale: { - color: "#000000", - hPad: 0.125, - numSteps: 3, - fonts: { labelSize: 18, scaleSize: 16 } - }, - } - }, - chrs: { - chrBG1: "#FFFFFF", - chrBG2: "#DDDDDD", - chrLabels: { fontSize: 16 }, - }, - initialChrs: { left: "1", right: "19" } -}; - -GenomeBrowser.main(config)(); - +console.log("THE FILES:", js_data.browser_files) + +snps_filename = "/browser_input?filename=" + js_data.browser_files[0] +annot_filename = "/browser_input?filename=" + js_data.browser_files[1] + +localUrls = +{ + snps: snps_filename, + annotations: annot_filename +}; + +var coordinateSystem = + [ + { chr: "1", size: "195471971" }, + { chr: "2", size: "182113224" }, + { chr: "3", size: "160039680" }, + { chr: "4", size: "156508116" }, + { chr: "5", size: "151834684" }, + { chr: "6", size: "149736546" }, + { chr: "7", size: "145441459" }, + { chr: "8", size: "129401213" }, + { chr: "9", size: "124595110" }, + { chr: "10", size: "130694993" }, + { chr: "11", size: "122082543" }, + { chr: "12", size: "120129022" }, + { chr: "13", size: "120421639" }, + { chr: "14", size: "124902244" }, + { chr: "15", size: "104043685" }, + { chr: "16", size: "98207768" }, + { chr: "17", size: "94987271" }, + { chr: "18", size: "90702639" }, + { chr: "19", size: "61431566" }, + ]; + +var vscaleWidth = 90.0; +var legendWidth = 140.0; + +if ('significant' in js_data) { + var significant_score = parseFloat(js_data.significant) +} else { + var significant_score = 4 +} +var score = { min: 0.0, max: js_data.max_score, sig: significant_score }; +var gwasPadding = { top: 35.0, + bottom: 35.0, + left: vscaleWidth, + right: legendWidth }; +var gwasHeight = 320.0; +var config = +{ score: score, + urls: localUrls, + tracks: { + gwas: { + trackHeight: gwasHeight, + padding: gwasPadding, + snps: { + radius: 3.75, + lineWidth: 1.0, + color: { outline: "#FFFFFF", + fill: "#00008B" }, + pixelOffset: {x: 0.0, y: 0.0} + }, + annotations: { + urls: { + url: "GeneNetwork" + }, + radius: 5.5, + outline: "#000000", + snpColor: "#0074D9", + geneColor: "#FF4136" + }, + score: score, + legend: { + fontSize: 14, + hPad: 0.2, + vPad: 0.2 + }, + vscale: { + color: "#000000", + hPad: 0.125, + numSteps: 3, + fonts: { labelSize: 18, scaleSize: 16 } + }, + }, + }, + chrs: { + chrBG1: "#FFFFFF", + chrBG2: "#EEEEEE", + chrLabels: { fontSize: 16 }, + }, + // initialChrs: { left: "1", right: "5" } + coordinateSystem: coordinateSystem, + }; + +GenomeBrowser.main(config)(); + document.getElementById("controls").style.visibility = "visible"; \ No newline at end of file diff --git a/wqflask/wqflask/static/new/javascript/plotly_probability_plot.js b/wqflask/wqflask/static/new/javascript/plotly_probability_plot.js index cc4195e4..e8b7ab83 100644 --- a/wqflask/wqflask/static/new/javascript/plotly_probability_plot.js +++ b/wqflask/wqflask/static/new/javascript/plotly_probability_plot.js @@ -195,7 +195,6 @@ } }, yaxis: { - title: "Data Quantiles", zeroline: false, visible: true, linecolor: 'black', diff --git a/wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript-genetics-browser.css b/wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript-genetics-browser.css new file mode 100644 index 00000000..135292ac --- /dev/null +++ b/wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript-genetics-browser.css @@ -0,0 +1 @@ +body,html{max-width:100%;overflow-x:hidden}#browser{position:absolute;margin:0}#info-line{border:1px solid #aaa;padding:2px;position:absolute;right:0;top:1px;min-width:14%;font-size:9pt}#controls{visibility:hidden;position:absolute;top:4px;left:100px;z-index:1000}#controls>button{border:1px solid #aaa;border-radius:2px;padding-left:6px;padding-right:6px;height:23px;min-width:20px}button#scrollRight,button#zoomIn{margin-left:-2px;margin-right:4px}#infoBox{position:absolute;display:inline-block;z-index:10000;visibility:hidden;padding:5px;border:2px solid grey;border-radius:5%;background-color:#fff;min-height:100px;min-width:10px;max-width:80%;margin-top:9.7em;font-family:sans-serif}#infoBox>div{float:left;margin:1em 1.2em}#infoBox>div>p{margin:.1em} \ No newline at end of file diff --git a/wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript_genetics_browser_v01.css b/wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript_genetics_browser_v01.css deleted file mode 100644 index 135292ac..00000000 --- a/wqflask/wqflask/static/packages/purescript_genome_browser/css/purescript_genetics_browser_v01.css +++ /dev/null @@ -1 +0,0 @@ -body,html{max-width:100%;overflow-x:hidden}#browser{position:absolute;margin:0}#info-line{border:1px solid #aaa;padding:2px;position:absolute;right:0;top:1px;min-width:14%;font-size:9pt}#controls{visibility:hidden;position:absolute;top:4px;left:100px;z-index:1000}#controls>button{border:1px solid #aaa;border-radius:2px;padding-left:6px;padding-right:6px;height:23px;min-width:20px}button#scrollRight,button#zoomIn{margin-left:-2px;margin-right:4px}#infoBox{position:absolute;display:inline-block;z-index:10000;visibility:hidden;padding:5px;border:2px solid grey;border-radius:5%;background-color:#fff;min-height:100px;min-width:10px;max-width:80%;margin-top:9.7em;font-family:sans-serif}#infoBox>div{float:left;margin:1em 1.2em}#infoBox>div>p{margin:.1em} \ No newline at end of file diff --git a/wqflask/wqflask/static/packages/purescript_genome_browser/js/purescript-genetics-browser.js b/wqflask/wqflask/static/packages/purescript_genome_browser/js/purescript-genetics-browser.js new file mode 100644 index 00000000..27bb4b2f --- /dev/null +++ b/wqflask/wqflask/static/packages/purescript_genome_browser/js/purescript-genetics-browser.js @@ -0,0 +1,63016 @@ +// modules are defined as an array +// [ module function, map of requires ] +// +// map of requires is short require name -> numeric require +// +// anything defined in a previous bundle is accessed via the +// orig method which is the require for previous bundles +parcelRequire = (function (modules, cache, entry, globalName) { + // Save the require from previous bundle to this closure if any + var previousRequire = typeof parcelRequire === 'function' && parcelRequire; + var nodeRequire = typeof require === 'function' && require; + + function newRequire(name, jumped) { + if (!cache[name]) { + if (!modules[name]) { + // if we cannot find the module within our internal map or + // cache jump to the current global require ie. the last bundle + // that was added to the page. + var currentRequire = typeof parcelRequire === 'function' && parcelRequire; + if (!jumped && currentRequire) { + return currentRequire(name, true); + } + + // If there are other bundles on this page the require from the + // previous one is saved to 'previousRequire'. Repeat this as + // many times as there are bundles until the module is found or + // we exhaust the require chain. + if (previousRequire) { + return previousRequire(name, true); + } + + // Try the node require function if it exists. + if (nodeRequire && typeof name === 'string') { + return nodeRequire(name); + } + + var err = new Error('Cannot find module \'' + name + '\''); + err.code = 'MODULE_NOT_FOUND'; + throw err; + } + + localRequire.resolve = resolve; + localRequire.cache = {}; + + var module = cache[name] = new newRequire.Module(name); + + modules[name][0].call(module.exports, localRequire, module, module.exports, this); + } + + return cache[name].exports; + + function localRequire(x){ + return newRequire(localRequire.resolve(x)); + } + + function resolve(x){ + return modules[name][1][x] || x; + } + } + + function Module(moduleName) { + this.id = moduleName; + this.bundle = newRequire; + this.exports = {}; + } + + newRequire.isParcelRequire = true; + newRequire.Module = Module; + newRequire.modules = modules; + newRequire.cache = cache; + newRequire.parent = previousRequire; + newRequire.register = function (id, exports) { + modules[id] = [function (require, module) { + module.exports = exports; + }, {}]; + }; + + var error; + for (var i = 0; i < entry.length; i++) { + try { + newRequire(entry[i]); + } catch (e) { + // Save first error but execute all entries + if (!error) { + error = e; + } + } + } + + if (entry.length) { + // Expose entry point to Node, AMD or browser globals + // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js + var mainExports = newRequire(entry[entry.length - 1]); + + // CommonJS + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = mainExports; + + // RequireJS + } else if (typeof define === "function" && define.amd) { + define(function () { + return mainExports; + }); + + // - + {% endblock %} diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index becb139a..189f8abc 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -19,8 +19,8 @@ - {% if gwa_filename is defined %} - + {% if output_files is defined %} + {% endif %} {% if reaper_version is defined %} @@ -171,7 +171,7 @@ {% endif %} -

    +
    {{header}}Max LRS{{header}}{{header}}{{header}}Additive Effect{{header}}{{header}}{{header}}Sample rNSample p(r)Lit rTissue rTissue p(r)Sample rhoNSample p(rho)Lit rTissue rhoTissue p(rho)Sample r  NSample p(r)Sample rho  NSample p(rho)Sample rNSample p(r)Sample rhoNSample p(rho)
    {{ trait.description_display }} {{ trait.location_repr }} {{ '%0.3f' % trait.mean|float }}{% if trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % trait.LRS_score_repr|float }}{% else %}N/A{% endif %}{{ trait.LRS_location_repr }}{% if trait.additive != "" %}{{ '%0.3f' % trait.additive|float }}{% else %}N/A{% endif %} {{'%0.3f'|format(trait.sample_r)}} {{ trait.num_overlap }} {{'%0.3e'|format(trait.sample_p)}}{{'%0.3f'|format(trait.tissue_corr)}} {{'%0.3e'|format(trait.tissue_pvalue)}}{% if trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % trait.LRS_score_repr|float }}{% else %}N/A{% endif %}{{ trait.LRS_location_repr }}{% if trait.additive != "" %}{{ '%0.3f' % trait.additive|float }}{% else %}N/A{% endif %}{{ trait.description_display }} {{ trait.authors }} {{ trait.LRS_score_repr }}{{ trait.LRS_location_repr }}{% if trait.additive != "" %}{{ '%0.3f' % trait.additive|float }}{% else %}N/A{% endif %} {{'%0.3f'|format(trait.sample_r)}} {{ trait.num_overlap }} {{'%0.3e'|format(trait.sample_p)}}{{ trait.LRS_score_repr }}{{ trait.LRS_location_repr }}{% if trait.additive != "" %}{{ '%0.3f' % trait.additive|float }}{% else %}N/A{% endif %}{{ trait.location_repr }} {{'%0.3f'|format(trait.sample_r)}}{{ '%0.2f' | format(marker.lod_score|float) }}{{ '%0.2f' | format(marker.lrs_value|float / 4.16) }}{{ '%0.2f' | format(marker.lrs_value|float / 4.61) }}{{ '%0.2f' | format(marker.lod_score|float * 4.16) }}{{ '%0.2f' | format(marker.lod_score|float * 4.61) }}{{ '%0.2f' | format(marker.lrs_value|float) }}
    "; - if ($('.corr_compute').length){ - the_html += ""; - } else { - the_html += ""; - } + the_html += " "; + the_html += "
    RecordData SetDescriptionMean
    RecordData SetDescription
    "; + the_html += ""; the_html += ""; for (_i = 0, _len = trait_data.length; _i < _len; _i++) { trait = trait_data[_i]; the_html += ""; - if ($('.corr_compute').length){ - the_html += ""; + the_html += ""; + if ("abbreviation" in trait) { + the_html += ""; + } else if ("symbol" in trait) { + the_html += ""; + } else { + the_html += ""; } - the_html += ""; - the_html += ""; - the_html += ""; + the_html += ""; + the_html += ""; } the_html += ""; the_html += "
    RecordData SetDescription
    " + trait.name + "" + trait.name + "" + trait.name + "" + trait.name + "" + trait.dataset + "" + trait.description + "" + trait.dataset_name + "" + trait.description + "
    "; - the_html += "
    " - the_html += collection_list - the_html += "
    " - the_html += "" + the_html += "" $("#collections_holder").html(the_html); return $('#collections_holder').colorbox.resize(); }; diff --git a/wqflask/wqflask/static/new/javascript/network_graph.js b/wqflask/wqflask/static/new/javascript/network_graph.js index bc02181f..4d507a18 100644 --- a/wqflask/wqflask/static/new/javascript/network_graph.js +++ b/wqflask/wqflask/static/new/javascript/network_graph.js @@ -144,7 +144,7 @@ window.onload=function() { cy.layout({ name: $('select[name=layout_select]').val(), fit: true, // whether to fit the viewport to the graph padding: 25 // the padding on fit - }); + }).run(); }); $('#pos_slide').change(function() { @@ -157,7 +157,7 @@ window.onload=function() { cy.layout({ name: $('select[name=layout_select]').val(), fit: true, // whether to fit the viewport to the graph padding: 25 // the padding on fit - }); + }).run(); }); @@ -168,7 +168,7 @@ window.onload=function() { cy.layout({ name: $('select[name=layout_select]').val(), fit: true, // whether to fit the viewport to the graph padding: 25 // the padding on fit - }); + }).run(); }); $('select[name=focus_select]').change(function() { @@ -180,7 +180,7 @@ window.onload=function() { cy.layout({ name: $('select[name=layout_select]').val(), fit: true, // whether to fit the viewport to the graph padding: 25 // the padding on fit - }); + }).run(); }); $('select[name=layout_select]').change(function() { @@ -188,7 +188,7 @@ window.onload=function() { cy.layout({ name: layout_type, fit: true, // whether to fit the viewport to the graph padding: 25 // the padding on fit - }); + }).run(); }); $('select[name=font_size]').change(function() { @@ -219,7 +219,7 @@ window.onload=function() { cy.layout({ name: $('select[name=layout_select]').val(), fit: true, // whether to fit the viewport to the graph padding: 25 // the padding on fit - }); + }).run(); }); $('select[name=edge_width]').change(function() { @@ -243,7 +243,7 @@ window.onload=function() { cy.layout({ name: $('select[name=layout_select]').val(), fit: true, // whether to fit the viewport to the graph padding: 25 // the padding on fit - }); + }).run(); }); $("a#image_link").click(function(e) { @@ -251,9 +251,6 @@ window.onload=function() { $(this).attr('href', pngData); $(this).attr('download', 'network_graph.png'); - - console.log("TESTING:", image_link) - }); diff --git a/wqflask/wqflask/static/new/packages/nvd3/nv.d3.css b/wqflask/wqflask/static/new/packages/nvd3/nv.d3.css deleted file mode 100644 index 593d3889..00000000 --- a/wqflask/wqflask/static/new/packages/nvd3/nv.d3.css +++ /dev/null @@ -1,641 +0,0 @@ -/* nvd3 version 1.8.1 (https://github.com/novus/nvd3) 2015-05-25 */ -.nvd3 .nv-axis { - pointer-events:none; - opacity: 1; -} - -.nvd3 .nv-axis path { - fill: none; - stroke: #000; - stroke-opacity: .75; - shape-rendering: crispEdges; -} - -.nvd3 .nv-axis path.domain { - stroke-opacity: .75; -} - -.nvd3 .nv-axis.nv-x path.domain { - stroke-opacity: 1; -} - -.nvd3 .nv-axis line { - fill: none; - stroke: #e5e5e5; - shape-rendering: crispEdges; -} - -.nvd3 .nv-axis .zero line, - /*this selector may not be necessary*/ .nvd3 .nv-axis line.zero { - stroke-opacity: .75; -} - -.nvd3 .nv-axis .nv-axisMaxMin text { - font-weight: bold; -} - -.nvd3 .x .nv-axis .nv-axisMaxMin text, -.nvd3 .x2 .nv-axis .nv-axisMaxMin text, -.nvd3 .x3 .nv-axis .nv-axisMaxMin text { - text-anchor: middle -} - -.nvd3 .nv-axis.nv-disabled { - opacity: 0; -} - -.nvd3 .nv-bars rect { - fill-opacity: .75; - - transition: fill-opacity 250ms linear; - -moz-transition: fill-opacity 250ms linear; - -webkit-transition: fill-opacity 250ms linear; -} - -.nvd3 .nv-bars rect.hover { - fill-opacity: 1; -} - -.nvd3 .nv-bars .hover rect { - fill: lightblue; -} - -.nvd3 .nv-bars text { - fill: rgba(0,0,0,0); -} - -.nvd3 .nv-bars .hover text { - fill: rgba(0,0,0,1); -} - -.nvd3 .nv-multibar .nv-groups rect, -.nvd3 .nv-multibarHorizontal .nv-groups rect, -.nvd3 .nv-discretebar .nv-groups rect { - stroke-opacity: 0; - - transition: fill-opacity 250ms linear; - -moz-transition: fill-opacity 250ms linear; - -webkit-transition: fill-opacity 250ms linear; -} - -.nvd3 .nv-multibar .nv-groups rect:hover, -.nvd3 .nv-multibarHorizontal .nv-groups rect:hover, -.nvd3 .nv-candlestickBar .nv-ticks rect:hover, -.nvd3 .nv-discretebar .nv-groups rect:hover { - fill-opacity: 1; -} - -.nvd3 .nv-discretebar .nv-groups text, -.nvd3 .nv-multibarHorizontal .nv-groups text { - font-weight: bold; - fill: rgba(0,0,0,1); - stroke: rgba(0,0,0,0); -} - -/* boxplot CSS */ -.nvd3 .nv-boxplot circle { - fill-opacity: 0.5; -} - -.nvd3 .nv-boxplot circle:hover { - fill-opacity: 1; -} - -.nvd3 .nv-boxplot rect:hover { - fill-opacity: 1; -} - -.nvd3 line.nv-boxplot-median { - stroke: black; -} - -.nv-boxplot-tick:hover { - stroke-width: 2.5px; -} -/* bullet */ -.nvd3.nv-bullet { font: 10px sans-serif; } -.nvd3.nv-bullet .nv-measure { fill-opacity: .8; } -.nvd3.nv-bullet .nv-measure:hover { fill-opacity: 1; } -.nvd3.nv-bullet .nv-marker { stroke: #000; stroke-width: 2px; } -.nvd3.nv-bullet .nv-markerTriangle { stroke: #000; fill: #fff; stroke-width: 1.5px; } -.nvd3.nv-bullet .nv-tick line { stroke: #666; stroke-width: .5px; } -.nvd3.nv-bullet .nv-range.nv-s0 { fill: #eee; } -.nvd3.nv-bullet .nv-range.nv-s1 { fill: #ddd; } -.nvd3.nv-bullet .nv-range.nv-s2 { fill: #ccc; } -.nvd3.nv-bullet .nv-title { font-size: 14px; font-weight: bold; } -.nvd3.nv-bullet .nv-subtitle { fill: #999; } - - -.nvd3.nv-bullet .nv-range { - fill: #bababa; - fill-opacity: .4; -} -.nvd3.nv-bullet .nv-range:hover { - fill-opacity: .7; -} - -.nvd3.nv-candlestickBar .nv-ticks .nv-tick { - stroke-width: 1px; -} - -.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover { - stroke-width: 2px; -} - -.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect { - stroke: #2ca02c; - fill: #2ca02c; -} - -.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect { - stroke: #d62728; - fill: #d62728; -} - -.with-transitions .nv-candlestickBar .nv-ticks .nv-tick { - transition: stroke-width 250ms linear, stroke-opacity 250ms linear; - -moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear; - -webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear; - -} - -.nvd3.nv-candlestickBar .nv-ticks line { - stroke: #333; -} - - -.nvd3 .nv-legend .nv-disabled rect { - /*fill-opacity: 0;*/ -} - -.nvd3 .nv-check-box .nv-box { - fill-opacity:0; - stroke-width:2; -} - -.nvd3 .nv-check-box .nv-check { - fill-opacity:0; - stroke-width:4; -} - -.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check { - fill-opacity:0; - stroke-opacity:0; -} - -.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check { - opacity: 0; -} - -/* line plus bar */ -.nvd3.nv-linePlusBar .nv-bar rect { - fill-opacity: .75; -} - -.nvd3.nv-linePlusBar .nv-bar rect:hover { - fill-opacity: 1; -} -.nvd3 .nv-groups path.nv-line { - fill: none; -} - -.nvd3 .nv-groups path.nv-area { - stroke: none; -} - -.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point { - fill-opacity: 0; - stroke-opacity: 0; -} - -.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point { - fill-opacity: .5 !important; - stroke-opacity: .5 !important; -} - - -.with-transitions .nvd3 .nv-groups .nv-point { - transition: stroke-width 250ms linear, stroke-opacity 250ms linear; - -moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear; - -webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear; - -} - -.nvd3.nv-scatter .nv-groups .nv-point.hover, -.nvd3 .nv-groups .nv-point.hover { - stroke-width: 7px; - fill-opacity: .95 !important; - stroke-opacity: .95 !important; -} - - -.nvd3 .nv-point-paths path { - stroke: #aaa; - stroke-opacity: 0; - fill: #eee; - fill-opacity: 0; -} - - - -.nvd3 .nv-indexLine { - cursor: ew-resize; -} - -/******************** - * SVG CSS - */ - -/******************** - Default CSS for an svg element nvd3 used -*/ -svg.nvd3-svg { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -ms-user-select: none; - -moz-user-select: none; - user-select: none; - display: block; - width:100%; - height:100%; -} - -/******************** - Box shadow and border radius styling -*/ -.nvtooltip.with-3d-shadow, .with-3d-shadow .nvtooltip { - -moz-box-shadow: 0 5px 10px rgba(0,0,0,.2); - -webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2); - box-shadow: 0 5px 10px rgba(0,0,0,.2); - - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; -} - - -.nvd3 text { - font: normal 14px Arial; -} - -.nvd3 .title { - font: bold 14px Arial; -} - -.nvd3 .nv-background { - fill: white; - fill-opacity: 0; -} - -.nvd3.nv-noData { - font-size: 18px; - font-weight: bold; -} - - -/********** -* Brush -*/ - -.nv-brush .extent { - fill-opacity: .125; - shape-rendering: crispEdges; -} - -.nv-brush .resize path { - fill: #eee; - stroke: #666; -} - - -/********** -* Legend -*/ - -.nvd3 .nv-legend .nv-series { - cursor: pointer; -} - -.nvd3 .nv-legend .nv-disabled circle { - fill-opacity: 0; -} - -/* focus */ -.nvd3 .nv-brush .extent { - fill-opacity: 0 !important; -} - -.nvd3 .nv-brushBackground rect { - stroke: #000; - stroke-width: .4; - fill: #fff; - fill-opacity: .7; -} - - -.nvd3.nv-ohlcBar .nv-ticks .nv-tick { - stroke-width: 1px; -} - -.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover { - stroke-width: 2px; -} - -.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive { - stroke: #2ca02c; -} - -.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative { - stroke: #d62728; -} - - -.nvd3 .background path { - fill: none; - stroke: #EEE; - stroke-opacity: .4; - shape-rendering: crispEdges; -} - -.nvd3 .foreground path { - fill: none; - stroke-opacity: .7; -} - -.nvd3 .nv-parallelCoordinates-brush .extent -{ - fill: #fff; - fill-opacity: .6; - stroke: gray; - shape-rendering: crispEdges; -} - -.nvd3 .nv-parallelCoordinates .hover { - fill-opacity: 1; - stroke-width: 3px; -} - - -.nvd3 .missingValuesline line { - fill: none; - stroke: black; - stroke-width: 1; - stroke-opacity: 1; - stroke-dasharray: 5, 5; -} -.nvd3.nv-pie path { - stroke-opacity: 0; - transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear; - -moz-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear; - -webkit-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear; - -} - -.nvd3.nv-pie .nv-pie-title { - font-size: 24px; - fill: rgba(19, 196, 249, 0.59); -} - -.nvd3.nv-pie .nv-slice text { - stroke: #000; - stroke-width: 0; -} - -.nvd3.nv-pie path { - stroke: #fff; - stroke-width: 1px; - stroke-opacity: 1; -} - -.nvd3.nv-pie .hover path { - fill-opacity: .7; -} -.nvd3.nv-pie .nv-label { - pointer-events: none; -} -.nvd3.nv-pie .nv-label rect { - fill-opacity: 0; - stroke-opacity: 0; -} - -/* scatter */ -.nvd3 .nv-groups .nv-point.hover { - stroke-width: 20px; - stroke-opacity: .5; -} - -.nvd3 .nv-scatter .nv-point.hover { - fill-opacity: 1; -} -.nv-noninteractive { - pointer-events: none; -} - -.nv-distx, .nv-disty { - pointer-events: none; -} - -/* sparkline */ -.nvd3.nv-sparkline path { - fill: none; -} - -.nvd3.nv-sparklineplus g.nv-hoverValue { - pointer-events: none; -} - -.nvd3.nv-sparklineplus .nv-hoverValue line { - stroke: #333; - stroke-width: 1.5px; -} - -.nvd3.nv-sparklineplus, -.nvd3.nv-sparklineplus g { - pointer-events: all; -} - -.nvd3 .nv-hoverArea { - fill-opacity: 0; - stroke-opacity: 0; -} - -.nvd3.nv-sparklineplus .nv-xValue, -.nvd3.nv-sparklineplus .nv-yValue { - stroke-width: 0; - font-size: .9em; - font-weight: normal; -} - -.nvd3.nv-sparklineplus .nv-yValue { - stroke: #f66; -} - -.nvd3.nv-sparklineplus .nv-maxValue { - stroke: #2ca02c; - fill: #2ca02c; -} - -.nvd3.nv-sparklineplus .nv-minValue { - stroke: #d62728; - fill: #d62728; -} - -.nvd3.nv-sparklineplus .nv-currentValue { - font-weight: bold; - font-size: 1.1em; -} -/* stacked area */ -.nvd3.nv-stackedarea path.nv-area { - fill-opacity: .7; - stroke-opacity: 0; - transition: fill-opacity 250ms linear, stroke-opacity 250ms linear; - -moz-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear; - -webkit-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear; -} - -.nvd3.nv-stackedarea path.nv-area.hover { - fill-opacity: .9; -} - - -.nvd3.nv-stackedarea .nv-groups .nv-point { - stroke-opacity: 0; - fill-opacity: 0; -} - - -.nvtooltip { - position: absolute; - background-color: rgba(255,255,255,1.0); - color: rgba(0,0,0,1.0); - padding: 1px; - border: 1px solid rgba(0,0,0,.2); - z-index: 10000; - display: block; - - font-family: Arial; - font-size: 13px; - text-align: left; - pointer-events: none; - - white-space: nowrap; - - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.nvtooltip { - background: rgba(255,255,255, 0.8); - border: 1px solid rgba(0,0,0,0.5); - border-radius: 4px; -} - -/*Give tooltips that old fade in transition by - putting a "with-transitions" class on the container div. -*/ -.nvtooltip.with-transitions, .with-transitions .nvtooltip { - transition: opacity 50ms linear; - -moz-transition: opacity 50ms linear; - -webkit-transition: opacity 50ms linear; - - transition-delay: 200ms; - -moz-transition-delay: 200ms; - -webkit-transition-delay: 200ms; -} - -.nvtooltip.x-nvtooltip, -.nvtooltip.y-nvtooltip { - padding: 8px; -} - -.nvtooltip h3 { - margin: 0; - padding: 4px 14px; - line-height: 18px; - font-weight: normal; - background-color: rgba(247,247,247,0.75); - color: rgba(0,0,0,1.0); - text-align: center; - - border-bottom: 1px solid #ebebeb; - - -webkit-border-radius: 5px 5px 0 0; - -moz-border-radius: 5px 5px 0 0; - border-radius: 5px 5px 0 0; -} - -.nvtooltip p { - margin: 0; - padding: 5px 14px; - text-align: center; -} - -.nvtooltip span { - display: inline-block; - margin: 2px 0; -} - -.nvtooltip table { - margin: 6px; - border-spacing:0; -} - - -.nvtooltip table td { - padding: 2px 9px 2px 0; - vertical-align: middle; -} - -.nvtooltip table td.key { - font-weight:normal; -} -.nvtooltip table td.value { - text-align: right; - font-weight: bold; -} - -.nvtooltip table tr.highlight td { - padding: 1px 9px 1px 0; - border-bottom-style: solid; - border-bottom-width: 1px; - border-top-style: solid; - border-top-width: 1px; -} - -.nvtooltip table td.legend-color-guide div { - width: 8px; - height: 8px; - vertical-align: middle; -} - -.nvtooltip table td.legend-color-guide div { - width: 12px; - height: 12px; - border: 1px solid #999; -} - -.nvtooltip .footer { - padding: 3px; - text-align: center; -} - -.nvtooltip-pending-removal { - pointer-events: none; - display: none; -} - - -/**** -Interactive Layer -*/ -.nvd3 .nv-interactiveGuideLine { - pointer-events:none; -} -.nvd3 line.nv-guideline { - stroke: #ccc; -} \ No newline at end of file diff --git a/wqflask/wqflask/static/new/packages/nvd3/nv.d3.js b/wqflask/wqflask/static/new/packages/nvd3/nv.d3.js deleted file mode 100644 index f64a6c14..00000000 --- a/wqflask/wqflask/static/new/packages/nvd3/nv.d3.js +++ /dev/null @@ -1,13363 +0,0 @@ -/* nvd3 version 1.8.1 (https://github.com/novus/nvd3) 2015-05-25 */ -(function(){ - -// set up main nv object -var nv = {}; - -// the major global objects under the nv namespace -nv.dev = false; //set false when in production -nv.tooltip = nv.tooltip || {}; // For the tooltip system -nv.utils = nv.utils || {}; // Utility subsystem -nv.models = nv.models || {}; //stores all the possible models/components -nv.charts = {}; //stores all the ready to use charts -nv.logs = {}; //stores some statistics and potential error messages -nv.dom = {}; //DOM manipulation functions - -nv.dispatch = d3.dispatch('render_start', 'render_end'); - -// Function bind polyfill -// Needed ONLY for phantomJS as it's missing until version 2.0 which is unreleased as of this comment -// https://github.com/ariya/phantomjs/issues/10522 -// http://kangax.github.io/compat-table/es5/#Function.prototype.bind -// phantomJS is used for running the test suite -if (!Function.prototype.bind) { - Function.prototype.bind = function (oThis) { - if (typeof this !== "function") { - // closest thing possible to the ECMAScript 5 internal IsCallable function - throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); - } - - var aArgs = Array.prototype.slice.call(arguments, 1), - fToBind = this, - fNOP = function () {}, - fBound = function () { - return fToBind.apply(this instanceof fNOP && oThis - ? this - : oThis, - aArgs.concat(Array.prototype.slice.call(arguments))); - }; - - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - return fBound; - }; -} - -// Development render timers - disabled if dev = false -if (nv.dev) { - nv.dispatch.on('render_start', function(e) { - nv.logs.startTime = +new Date(); - }); - - nv.dispatch.on('render_end', function(e) { - nv.logs.endTime = +new Date(); - nv.logs.totalTime = nv.logs.endTime - nv.logs.startTime; - nv.log('total', nv.logs.totalTime); // used for development, to keep track of graph generation times - }); -} - -// Logs all arguments, and returns the last so you can test things in place -// Note: in IE8 console.log is an object not a function, and if modernizr is used -// then calling Function.prototype.bind with with anything other than a function -// causes a TypeError to be thrown. -nv.log = function() { - if (nv.dev && window.console && console.log && console.log.apply) - console.log.apply(console, arguments); - else if (nv.dev && window.console && typeof console.log == "function" && Function.prototype.bind) { - var log = Function.prototype.bind.call(console.log, console); - log.apply(console, arguments); - } - return arguments[arguments.length - 1]; -}; - -// print console warning, should be used by deprecated functions -nv.deprecated = function(name, info) { - if (console && console.warn) { - console.warn('nvd3 warning: `' + name + '` has been deprecated. ', info || ''); - } -}; - -// The nv.render function is used to queue up chart rendering -// in non-blocking async functions. -// When all queued charts are done rendering, nv.dispatch.render_end is invoked. -nv.render = function render(step) { - // number of graphs to generate in each timeout loop - step = step || 1; - - nv.render.active = true; - nv.dispatch.render_start(); - - var renderLoop = function() { - var chart, graph; - - for (var i = 0; i < step && (graph = nv.render.queue[i]); i++) { - chart = graph.generate(); - if (typeof graph.callback == typeof(Function)) graph.callback(chart); - } - - nv.render.queue.splice(0, i); - - if (nv.render.queue.length) { - setTimeout(renderLoop); - } - else { - nv.dispatch.render_end(); - nv.render.active = false; - } - }; - - setTimeout(renderLoop); -}; - -nv.render.active = false; -nv.render.queue = []; - -/* -Adds a chart to the async rendering queue. This method can take arguments in two forms: -nv.addGraph({ - generate: - callback: -}) - -or - -nv.addGraph(, ) - -The generate function should contain code that creates the NVD3 model, sets options -on it, adds data to an SVG element, and invokes the chart model. The generate function -should return the chart model. See examples/lineChart.html for a usage example. - -The callback function is optional, and it is called when the generate function completes. -*/ -nv.addGraph = function(obj) { - if (typeof arguments[0] === typeof(Function)) { - obj = {generate: arguments[0], callback: arguments[1]}; - } - - nv.render.queue.push(obj); - - if (!nv.render.active) { - nv.render(); - } -}; - -// Node/CommonJS exports -if (typeof(module) !== 'undefined' && typeof(exports) !== 'undefined') { - module.exports = nv; -} - -if (typeof(window) !== 'undefined') { - window.nv = nv; -} -/* Facade for queueing DOM write operations - * with Fastdom (https://github.com/wilsonpage/fastdom) - * if available. - * This could easily be extended to support alternate - * implementations in the future. - */ -nv.dom.write = function(callback) { - if (window.fastdom !== undefined) { - return fastdom.write(callback); - } - return callback(); -}; - -/* Facade for queueing DOM read operations - * with Fastdom (https://github.com/wilsonpage/fastdom) - * if available. - * This could easily be extended to support alternate - * implementations in the future. - */ -nv.dom.read = function(callback) { - if (window.fastdom !== undefined) { - return fastdom.read(callback); - } - return callback(); -};/* Utility class to handle creation of an interactive layer. - This places a rectangle on top of the chart. When you mouse move over it, it sends a dispatch - containing the X-coordinate. It can also render a vertical line where the mouse is located. - - dispatch.elementMousemove is the important event to latch onto. It is fired whenever the mouse moves over - the rectangle. The dispatch is given one object which contains the mouseX/Y location. - It also has 'pointXValue', which is the conversion of mouseX to the x-axis scale. - */ -nv.interactiveGuideline = function() { - "use strict"; - - var tooltip = nv.models.tooltip(); - tooltip.duration(0).hideDelay(0)._isInteractiveLayer(true).hidden(false); - - //Public settings - var width = null; - var height = null; - - //Please pass in the bounding chart's top and left margins - //This is important for calculating the correct mouseX/Y positions. - var margin = {left: 0, top: 0} - , xScale = d3.scale.linear() - , dispatch = d3.dispatch('elementMousemove', 'elementMouseout', 'elementClick', 'elementDblclick') - , showGuideLine = true; - //Must pass in the bounding chart's container. - //The mousemove event is attached to this container. - var svgContainer = null; - - // check if IE by looking for activeX - var isMSIE = "ActiveXObject" in window; - - - function layer(selection) { - selection.each(function(data) { - var container = d3.select(this); - var availableWidth = (width || 960), availableHeight = (height || 400); - var wrap = container.selectAll("g.nv-wrap.nv-interactiveLineLayer") - .data([data]); - var wrapEnter = wrap.enter() - .append("g").attr("class", " nv-wrap nv-interactiveLineLayer"); - wrapEnter.append("g").attr("class","nv-interactiveGuideLine"); - - if (!svgContainer) { - return; - } - - function mouseHandler() { - var d3mouse = d3.mouse(this); - var mouseX = d3mouse[0]; - var mouseY = d3mouse[1]; - var subtractMargin = true; - var mouseOutAnyReason = false; - if (isMSIE) { - /* - D3.js (or maybe SVG.getScreenCTM) has a nasty bug in Internet Explorer 10. - d3.mouse() returns incorrect X,Y mouse coordinates when mouse moving - over a rect in IE 10. - However, d3.event.offsetX/Y also returns the mouse coordinates - relative to the triggering . So we use offsetX/Y on IE. - */ - mouseX = d3.event.offsetX; - mouseY = d3.event.offsetY; - - /* - On IE, if you attach a mouse event listener to the container, - it will actually trigger it for all the child elements (like , , etc). - When this happens on IE, the offsetX/Y is set to where ever the child element - is located. - As a result, we do NOT need to subtract margins to figure out the mouse X/Y - position under this scenario. Removing the line below *will* cause - the interactive layer to not work right on IE. - */ - if(d3.event.target.tagName !== "svg") { - subtractMargin = false; - } - - if (d3.event.target.className.baseVal.match("nv-legend")) { - mouseOutAnyReason = true; - } - - } - - if(subtractMargin) { - mouseX -= margin.left; - mouseY -= margin.top; - } - - /* If mouseX/Y is outside of the chart's bounds, - trigger a mouseOut event. - */ - if (mouseX < 0 || mouseY < 0 - || mouseX > availableWidth || mouseY > availableHeight - || (d3.event.relatedTarget && d3.event.relatedTarget.ownerSVGElement === undefined) - || mouseOutAnyReason - ) { - - if (isMSIE) { - if (d3.event.relatedTarget - && d3.event.relatedTarget.ownerSVGElement === undefined - && (d3.event.relatedTarget.className === undefined - || d3.event.relatedTarget.className.match(tooltip.nvPointerEventsClass))) { - - return; - } - } - dispatch.elementMouseout({ - mouseX: mouseX, - mouseY: mouseY - }); - layer.renderGuideLine(null); //hide the guideline - tooltip.hidden(true); - return; - } else { - tooltip.hidden(false); - } - - var pointXValue = xScale.invert(mouseX); - dispatch.elementMousemove({ - mouseX: mouseX, - mouseY: mouseY, - pointXValue: pointXValue - }); - - //If user double clicks the layer, fire a elementDblclick - if (d3.event.type === "dblclick") { - dispatch.elementDblclick({ - mouseX: mouseX, - mouseY: mouseY, - pointXValue: pointXValue - }); - } - - // if user single clicks the layer, fire elementClick - if (d3.event.type === 'click') { - dispatch.elementClick({ - mouseX: mouseX, - mouseY: mouseY, - pointXValue: pointXValue - }); - } - } - - svgContainer - .on("touchmove",mouseHandler) - .on("mousemove",mouseHandler, true) - .on("mouseout" ,mouseHandler,true) - .on("dblclick" ,mouseHandler) - .on("click", mouseHandler) - ; - - layer.guideLine = null; - //Draws a vertical guideline at the given X postion. - layer.renderGuideLine = function(x) { - if (!showGuideLine) return; - if (layer.guideLine && layer.guideLine.attr("x1") === x) return; - nv.dom.write(function() { - var line = wrap.select(".nv-interactiveGuideLine") - .selectAll("line") - .data((x != null) ? [nv.utils.NaNtoZero(x)] : [], String); - line.enter() - .append("line") - .attr("class", "nv-guideline") - .attr("x1", function(d) { return d;}) - .attr("x2", function(d) { return d;}) - .attr("y1", availableHeight) - .attr("y2",0); - line.exit().remove(); - }); - } - }); - } - - layer.dispatch = dispatch; - layer.tooltip = tooltip; - - layer.margin = function(_) { - if (!arguments.length) return margin; - margin.top = typeof _.top != 'undefined' ? _.top : margin.top; - margin.left = typeof _.left != 'undefined' ? _.left : margin.left; - return layer; - }; - - layer.width = function(_) { - if (!arguments.length) return width; - width = _; - return layer; - }; - - layer.height = function(_) { - if (!arguments.length) return height; - height = _; - return layer; - }; - - layer.xScale = function(_) { - if (!arguments.length) return xScale; - xScale = _; - return layer; - }; - - layer.showGuideLine = function(_) { - if (!arguments.length) return showGuideLine; - showGuideLine = _; - return layer; - }; - - layer.svgContainer = function(_) { - if (!arguments.length) return svgContainer; - svgContainer = _; - return layer; - }; - - return layer; -}; - -/* Utility class that uses d3.bisect to find the index in a given array, where a search value can be inserted. - This is different from normal bisectLeft; this function finds the nearest index to insert the search value. - - For instance, lets say your array is [1,2,3,5,10,30], and you search for 28. - Normal d3.bisectLeft will return 4, because 28 is inserted after the number 10. But interactiveBisect will return 5 - because 28 is closer to 30 than 10. - - Unit tests can be found in: interactiveBisectTest.html - - Has the following known issues: - * Will not work if the data points move backwards (ie, 10,9,8,7, etc) or if the data points are in random order. - * Won't work if there are duplicate x coordinate values. - */ -nv.interactiveBisect = function (values, searchVal, xAccessor) { - "use strict"; - if (! (values instanceof Array)) { - return null; - } - var _xAccessor; - if (typeof xAccessor !== 'function') { - _xAccessor = function(d) { - return d.x; - } - } else { - _xAccessor = xAccessor; - } - var _cmp = function(d, v) { - // Accessors are no longer passed the index of the element along with - // the element itself when invoked by d3.bisector. - // - // Starting at D3 v3.4.4, d3.bisector() started inspecting the - // function passed to determine if it should consider it an accessor - // or a comparator. This meant that accessors that take two arguments - // (expecting an index as the second parameter) are treated as - // comparators where the second argument is the search value against - // which the first argument is compared. - return _xAccessor(d) - v; - }; - - var bisect = d3.bisector(_cmp).left; - var index = d3.max([0, bisect(values,searchVal) - 1]); - var currentValue = _xAccessor(values[index]); - - if (typeof currentValue === 'undefined') { - currentValue = index; - } - - if (currentValue === searchVal) { - return index; //found exact match - } - - var nextIndex = d3.min([index+1, values.length - 1]); - var nextValue = _xAccessor(values[nextIndex]); - - if (typeof nextValue === 'undefined') { - nextValue = nextIndex; - } - - if (Math.abs(nextValue - searchVal) >= Math.abs(currentValue - searchVal)) { - return index; - } else { - return nextIndex - } -}; - -/* - Returns the index in the array "values" that is closest to searchVal. - Only returns an index if searchVal is within some "threshold". - Otherwise, returns null. - */ -nv.nearestValueIndex = function (values, searchVal, threshold) { - "use strict"; - var yDistMax = Infinity, indexToHighlight = null; - values.forEach(function(d,i) { - var delta = Math.abs(searchVal - d); - if ( d != null && delta <= yDistMax && delta < threshold) { - yDistMax = delta; - indexToHighlight = i; - } - }); - return indexToHighlight; -}; -/* Tooltip rendering model for nvd3 charts. - window.nv.models.tooltip is the updated,new way to render tooltips. - - window.nv.tooltip.show is the old tooltip code. - window.nv.tooltip.* also has various helper methods. - */ -(function() { - "use strict"; - - /* Model which can be instantiated to handle tooltip rendering. - Example usage: - var tip = nv.models.tooltip().gravity('w').distance(23) - .data(myDataObject); - - tip(); //just invoke the returned function to render tooltip. - */ - nv.models.tooltip = function() { - - /* - Tooltip data. If data is given in the proper format, a consistent tooltip is generated. - Example Format of data: - { - key: "Date", - value: "August 2009", - series: [ - {key: "Series 1", value: "Value 1", color: "#000"}, - {key: "Series 2", value: "Value 2", color: "#00f"} - ] - } - */ - var data = null; - var gravity = 'w' //Can be 'n','s','e','w'. Determines how tooltip is positioned. - , distance = 25 //Distance to offset tooltip from the mouse location. - , snapDistance = 0 //Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect) - , fixedTop = null //If not null, this fixes the top position of the tooltip. - , classes = null //Attaches additional CSS classes to the tooltip DIV that is created. - , chartContainer = null //Parent dom element of the SVG that holds the chart. - , hidden = true // start off hidden, toggle with hide/show functions below - , hideDelay = 400 // delay before the tooltip hides after calling hide() - , tooltip = null // d3 select of tooltipElem below - , tooltipElem = null //actual DOM element representing the tooltip. - , position = {left: null, top: null} //Relative position of the tooltip inside chartContainer. - , offset = {left: 0, top: 0} //Offset of tooltip against the pointer - , enabled = true //True -> tooltips are rendered. False -> don't render tooltips. - , duration = 100 // duration for tooltip movement - , headerEnabled = true - ; - - // set to true by interactive layer to adjust tooltip positions - // eventually we should probably fix interactive layer to get the position better. - // for now this is needed if you want to set chartContainer for normal tooltips, else it "fixes" it to broken - var isInteractiveLayer = false; - - //Generates a unique id when you create a new tooltip() object - var id = "nvtooltip-" + Math.floor(Math.random() * 100000); - - //CSS class to specify whether element should not have mouse events. - var nvPointerEventsClass = "nv-pointer-events-none"; - - //Format function for the tooltip values column - var valueFormatter = function(d,i) { - return d; - }; - - //Format function for the tooltip header value. - var headerFormatter = function(d) { - return d; - }; - - var keyFormatter = function(d, i) { - return d; - }; - - //By default, the tooltip model renders a beautiful table inside a DIV. - //You can override this function if a custom tooltip is desired. - var contentGenerator = function(d) { - if (d === null) { - return ''; - } - - var table = d3.select(document.createElement("table")); - if (headerEnabled) { - var theadEnter = table.selectAll("thead") - .data([d]) - .enter().append("thead"); - - theadEnter.append("tr") - .append("td") - .attr("colspan", 3) - .append("strong") - .classed("x-value", true) - .html(headerFormatter(d.value)); - } - - var tbodyEnter = table.selectAll("tbody") - .data([d]) - .enter().append("tbody"); - - var trowEnter = tbodyEnter.selectAll("tr") - .data(function(p) { return p.series}) - .enter() - .append("tr") - .classed("highlight", function(p) { return p.highlight}); - - trowEnter.append("td") - .classed("legend-color-guide",true) - .append("div") - .style("background-color", function(p) { return p.color}); - - trowEnter.append("td") - .classed("key",true) - .html(function(p, i) {return keyFormatter(p.key, i)}); - - trowEnter.append("td") - .classed("value",true) - .html(function(p, i) { return valueFormatter(p.value, i) }); - - - trowEnter.selectAll("td").each(function(p) { - if (p.highlight) { - var opacityScale = d3.scale.linear().domain([0,1]).range(["#fff",p.color]); - var opacity = 0.6; - d3.select(this) - .style("border-bottom-color", opacityScale(opacity)) - .style("border-top-color", opacityScale(opacity)) - ; - } - }); - - var html = table.node().outerHTML; - if (d.footer !== undefined) - html += ""; - return html; - - }; - - var dataSeriesExists = function(d) { - if (d && d.series) { - if (d.series instanceof Array) { - return !!d.series.length; - } - // if object, it's okay just convert to array of the object - if (d.series instanceof Object) { - d.series = [d.series]; - return true; - } - } - return false; - }; - - var calcTooltipPosition = function(pos) { - if (!tooltipElem) return; - - nv.dom.read(function() { - var height = parseInt(tooltipElem.offsetHeight, 10), - width = parseInt(tooltipElem.offsetWidth, 10), - windowWidth = nv.utils.windowSize().width, - windowHeight = nv.utils.windowSize().height, - scrollTop = window.pageYOffset, - scrollLeft = window.pageXOffset, - left, top; - - windowHeight = window.innerWidth >= document.body.scrollWidth ? windowHeight : windowHeight - 16; - windowWidth = window.innerHeight >= document.body.scrollHeight ? windowWidth : windowWidth - 16; - - - //Helper functions to find the total offsets of a given DOM element. - //Looks up the entire ancestry of an element, up to the first relatively positioned element. - var tooltipTop = function ( Elem ) { - var offsetTop = top; - do { - if( !isNaN( Elem.offsetTop ) ) { - offsetTop += (Elem.offsetTop); - } - Elem = Elem.offsetParent; - } while( Elem ); - return offsetTop; - }; - var tooltipLeft = function ( Elem ) { - var offsetLeft = left; - do { - if( !isNaN( Elem.offsetLeft ) ) { - offsetLeft += (Elem.offsetLeft); - } - Elem = Elem.offsetParent; - } while( Elem ); - return offsetLeft; - }; - - // calculate position based on gravity - var tLeft, tTop; - switch (gravity) { - case 'e': - left = pos[0] - width - distance; - top = pos[1] - (height / 2); - tLeft = tooltipLeft(tooltipElem); - tTop = tooltipTop(tooltipElem); - if (tLeft < scrollLeft) left = pos[0] + distance > scrollLeft ? pos[0] + distance : scrollLeft - tLeft + left; - if (tTop < scrollTop) top = scrollTop - tTop + top; - if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height; - break; - case 'w': - left = pos[0] + distance; - top = pos[1] - (height / 2); - tLeft = tooltipLeft(tooltipElem); - tTop = tooltipTop(tooltipElem); - if (tLeft + width > windowWidth) left = pos[0] - width - distance; - if (tTop < scrollTop) top = scrollTop + 5; - if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height; - break; - case 'n': - left = pos[0] - (width / 2) - 5; - top = pos[1] + distance; - tLeft = tooltipLeft(tooltipElem); - tTop = tooltipTop(tooltipElem); - if (tLeft < scrollLeft) left = scrollLeft + 5; - if (tLeft + width > windowWidth) left = left - width/2 + 5; - if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height; - break; - case 's': - left = pos[0] - (width / 2); - top = pos[1] - height - distance; - tLeft = tooltipLeft(tooltipElem); - tTop = tooltipTop(tooltipElem); - if (tLeft < scrollLeft) left = scrollLeft + 5; - if (tLeft + width > windowWidth) left = left - width/2 + 5; - if (scrollTop > tTop) top = scrollTop; - break; - case 'none': - left = pos[0]; - top = pos[1] - distance; - tLeft = tooltipLeft(tooltipElem); - tTop = tooltipTop(tooltipElem); - break; - } - - // adjust tooltip offsets - left -= offset.left; - top -= offset.top; - - // using tooltip.style('transform') returns values un-usable for tween - var box = tooltipElem.getBoundingClientRect(); - var scrollTop = window.pageYOffset || document.documentElement.scrollTop; - var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft; - var old_translate = 'translate(' + (box.left + scrollLeft) + 'px, ' + (box.top + scrollTop) + 'px)'; - var new_translate = 'translate(' + left + 'px, ' + top + 'px)'; - var translateInterpolator = d3.interpolateString(old_translate, new_translate); - - var is_hidden = tooltip.style('opacity') < 0.1; - - // delay hiding a bit to avoid flickering - if (hidden) { - tooltip - .transition() - .delay(hideDelay) - .duration(0) - .style('opacity', 0); - } else { - tooltip - .interrupt() // cancel running transitions - .transition() - .duration(is_hidden ? 0 : duration) - // using tween since some versions of d3 can't auto-tween a translate on a div - .styleTween('transform', function (d) { - return translateInterpolator; - }, 'important') - // Safari has its own `-webkit-transform` and does not support `transform` - // transform tooltip without transition only in Safari - .style('-webkit-transform', new_translate) - .style('opacity', 1); - } - - - - }); - }; - - //In situations where the chart is in a 'viewBox', re-position the tooltip based on how far chart is zoomed. - function convertViewBoxRatio() { - if (chartContainer) { - var svg = d3.select(chartContainer); - if (svg.node().tagName !== "svg") { - svg = svg.select("svg"); - } - var viewBox = (svg.node()) ? svg.attr('viewBox') : null; - if (viewBox) { - viewBox = viewBox.split(' '); - var ratio = parseInt(svg.style('width'), 10) / viewBox[2]; - - position.left = position.left * ratio; - position.top = position.top * ratio; - } - } - } - - //Creates new tooltip container, or uses existing one on DOM. - function initTooltip() { - if (!tooltip) { - var body; - if (chartContainer) { - body = chartContainer; - } else { - body = document.body; - } - //Create new tooltip div if it doesn't exist on DOM. - tooltip = d3.select(body).append("div") - .attr("class", "nvtooltip " + (classes ? classes : "xy-tooltip")) - .attr("id", id); - tooltip.style("top", 0).style("left", 0); - tooltip.style('opacity', 0); - tooltip.selectAll("div, table, td, tr").classed(nvPointerEventsClass, true); - tooltip.classed(nvPointerEventsClass, true); - tooltipElem = tooltip.node(); - } - } - - //Draw the tooltip onto the DOM. - function nvtooltip() { - if (!enabled) return; - if (!dataSeriesExists(data)) return; - - convertViewBoxRatio(); - - var left = position.left; - var top = (fixedTop !== null) ? fixedTop : position.top; - - nv.dom.write(function () { - initTooltip(); - // generate data and set it into tooltip - // Bonus - If you override contentGenerator and return falsey you can use something like - // React or Knockout to bind the data for your tooltip - var newContent = contentGenerator(data); - if (newContent) { - tooltipElem.innerHTML = newContent; - } - - if (chartContainer && isInteractiveLayer) { - nv.dom.read(function() { - var svgComp = chartContainer.getElementsByTagName("svg")[0]; - var svgOffset = {left:0,top:0}; - if (svgComp) { - var svgBound = svgComp.getBoundingClientRect(); - var chartBound = chartContainer.getBoundingClientRect(); - var svgBoundTop = svgBound.top; - - //Defensive code. Sometimes, svgBoundTop can be a really negative - // number, like -134254. That's a bug. - // If such a number is found, use zero instead. FireFox bug only - if (svgBoundTop < 0) { - var containerBound = chartContainer.getBoundingClientRect(); - svgBoundTop = (Math.abs(svgBoundTop) > containerBound.height) ? 0 : svgBoundTop; - } - svgOffset.top = Math.abs(svgBoundTop - chartBound.top); - svgOffset.left = Math.abs(svgBound.left - chartBound.left); - } - //If the parent container is an overflow
    with scrollbars, subtract the scroll offsets. - //You need to also add any offset between the element and its containing
    - //Finally, add any offset of the containing
    on the whole page. - left += chartContainer.offsetLeft + svgOffset.left - 2*chartContainer.scrollLeft; - top += chartContainer.offsetTop + svgOffset.top - 2*chartContainer.scrollTop; - - if (snapDistance && snapDistance > 0) { - top = Math.floor(top/snapDistance) * snapDistance; - } - calcTooltipPosition([left,top]); - }); - } else { - calcTooltipPosition([left,top]); - } - }); - - return nvtooltip; - } - - nvtooltip.nvPointerEventsClass = nvPointerEventsClass; - nvtooltip.options = nv.utils.optionsFunc.bind(nvtooltip); - - nvtooltip._options = Object.create({}, { - // simple read/write options - duration: {get: function(){return duration;}, set: function(_){duration=_;}}, - gravity: {get: function(){return gravity;}, set: function(_){gravity=_;}}, - distance: {get: function(){return distance;}, set: function(_){distance=_;}}, - snapDistance: {get: function(){return snapDistance;}, set: function(_){snapDistance=_;}}, - classes: {get: function(){return classes;}, set: function(_){classes=_;}}, - chartContainer: {get: function(){return chartContainer;}, set: function(_){chartContainer=_;}}, - fixedTop: {get: function(){return fixedTop;}, set: function(_){fixedTop=_;}}, - enabled: {get: function(){return enabled;}, set: function(_){enabled=_;}}, - hideDelay: {get: function(){return hideDelay;}, set: function(_){hideDelay=_;}}, - contentGenerator: {get: function(){return contentGenerator;}, set: function(_){contentGenerator=_;}}, - valueFormatter: {get: function(){return valueFormatter;}, set: function(_){valueFormatter=_;}}, - headerFormatter: {get: function(){return headerFormatter;}, set: function(_){headerFormatter=_;}}, - keyFormatter: {get: function(){return keyFormatter;}, set: function(_){keyFormatter=_;}}, - headerEnabled: {get: function(){return headerEnabled;}, set: function(_){headerEnabled=_;}}, - - // internal use only, set by interactive layer to adjust position. - _isInteractiveLayer: {get: function(){return isInteractiveLayer;}, set: function(_){isInteractiveLayer=!!_;}}, - - // options with extra logic - position: {get: function(){return position;}, set: function(_){ - position.left = _.left !== undefined ? _.left : position.left; - position.top = _.top !== undefined ? _.top : position.top; - }}, - offset: {get: function(){return offset;}, set: function(_){ - offset.left = _.left !== undefined ? _.left : offset.left; - offset.top = _.top !== undefined ? _.top : offset.top; - }}, - hidden: {get: function(){return hidden;}, set: function(_){ - if (hidden != _) { - hidden = !!_; - nvtooltip(); - } - }}, - data: {get: function(){return data;}, set: function(_){ - // if showing a single data point, adjust data format with that - if (_.point) { - _.value = _.point.x; - _.series = _.series || {}; - _.series.value = _.point.y; - _.series.color = _.point.color || _.series.color; - } - data = _; - }}, - - // read only properties - tooltipElem: {get: function(){return tooltipElem;}, set: function(_){}}, - id: {get: function(){return id;}, set: function(_){}} - }); - - nv.utils.initOptions(nvtooltip); - return nvtooltip; - }; - -})(); - - -/* -Gets the browser window size - -Returns object with height and width properties - */ -nv.utils.windowSize = function() { - // Sane defaults - var size = {width: 640, height: 480}; - - // Most recent browsers use - if (window.innerWidth && window.innerHeight) { - size.width = window.innerWidth; - size.height = window.innerHeight; - return (size); - } - - // IE can use depending on mode it is in - if (document.compatMode=='CSS1Compat' && - document.documentElement && - document.documentElement.offsetWidth ) { - - size.width = document.documentElement.offsetWidth; - size.height = document.documentElement.offsetHeight; - return (size); - } - - // Earlier IE uses Doc.body - if (document.body && document.body.offsetWidth) { - size.width = document.body.offsetWidth; - size.height = document.body.offsetHeight; - return (size); - } - - return (size); -}; - -/* -Binds callback function to run when window is resized - */ -nv.utils.windowResize = function(handler) { - if (window.addEventListener) { - window.addEventListener('resize', handler); - } else { - nv.log("ERROR: Failed to bind to window.resize with: ", handler); - } - // return object with clear function to remove the single added callback. - return { - callback: handler, - clear: function() { - window.removeEventListener('resize', handler); - } - } -}; - - -/* -Backwards compatible way to implement more d3-like coloring of graphs. -Can take in nothing, an array, or a function/scale -To use a normal scale, get the range and pass that because we must be able -to take two arguments and use the index to keep backward compatibility -*/ -nv.utils.getColor = function(color) { - //if you pass in nothing, get default colors back - if (color === undefined) { - return nv.utils.defaultColor(); - - //if passed an array, turn it into a color scale - // use isArray, instanceof fails if d3 range is created in an iframe - } else if(Array.isArray(color)) { - var color_scale = d3.scale.ordinal().range(color); - return function(d, i) { - var key = i === undefined ? d : i; - return d.color || color_scale(key); - }; - - //if passed a function or scale, return it, or whatever it may be - //external libs, such as angularjs-nvd3-directives use this - } else { - //can't really help it if someone passes rubbish as color - return color; - } -}; - - -/* -Default color chooser uses a color scale of 20 colors from D3 - https://github.com/mbostock/d3/wiki/Ordinal-Scales#categorical-colors - */ -nv.utils.defaultColor = function() { - // get range of the scale so we'll turn it into our own function. - return nv.utils.getColor(d3.scale.category20().range()); -}; - - -/* -Returns a color function that takes the result of 'getKey' for each series and -looks for a corresponding color from the dictionary -*/ -nv.utils.customTheme = function(dictionary, getKey, defaultColors) { - // use default series.key if getKey is undefined - getKey = getKey || function(series) { return series.key }; - defaultColors = defaultColors || d3.scale.category20().range(); - - // start at end of default color list and walk back to index 0 - var defIndex = defaultColors.length; - - return function(series, index) { - var key = getKey(series); - if (typeof dictionary[key] === 'function') { - return dictionary[key](); - } else if (dictionary[key] !== undefined) { - return dictionary[key]; - } else { - // no match in dictionary, use a default color - if (!defIndex) { - // used all the default colors, start over - defIndex = defaultColors.length; - } - defIndex = defIndex - 1; - return defaultColors[defIndex]; - } - }; -}; - - -/* -From the PJAX example on d3js.org, while this is not really directly needed -it's a very cool method for doing pjax, I may expand upon it a little bit, -open to suggestions on anything that may be useful -*/ -nv.utils.pjax = function(links, content) { - - var load = function(href) { - d3.html(href, function(fragment) { - var target = d3.select(content).node(); - target.parentNode.replaceChild( - d3.select(fragment).select(content).node(), - target); - nv.utils.pjax(links, content); - }); - }; - - d3.selectAll(links).on("click", function() { - history.pushState(this.href, this.textContent, this.href); - load(this.href); - d3.event.preventDefault(); - }); - - d3.select(window).on("popstate", function() { - if (d3.event.state) { - load(d3.event.state); - } - }); -}; - - -/* -For when we want to approximate the width in pixels for an SVG:text element. -Most common instance is when the element is in a display:none; container. -Forumla is : text.length * font-size * constant_factor -*/ -nv.utils.calcApproxTextWidth = function (svgTextElem) { - if (typeof svgTextElem.style === 'function' - && typeof svgTextElem.text === 'function') { - - var fontSize = parseInt(svgTextElem.style("font-size").replace("px",""), 10); - var textLength = svgTextElem.text().length; - return textLength * fontSize * 0.5; - } - return 0; -}; - - -/* -Numbers that are undefined, null or NaN, convert them to zeros. -*/ -nv.utils.NaNtoZero = function(n) { - if (typeof n !== 'number' - || isNaN(n) - || n === null - || n === Infinity - || n === -Infinity) { - - return 0; - } - return n; -}; - -/* -Add a way to watch for d3 transition ends to d3 -*/ -d3.selection.prototype.watchTransition = function(renderWatch){ - var args = [this].concat([].slice.call(arguments, 1)); - return renderWatch.transition.apply(renderWatch, args); -}; - - -/* -Helper object to watch when d3 has rendered something -*/ -nv.utils.renderWatch = function(dispatch, duration) { - if (!(this instanceof nv.utils.renderWatch)) { - return new nv.utils.renderWatch(dispatch, duration); - } - - var _duration = duration !== undefined ? duration : 250; - var renderStack = []; - var self = this; - - this.models = function(models) { - models = [].slice.call(arguments, 0); - models.forEach(function(model){ - model.__rendered = false; - (function(m){ - m.dispatch.on('renderEnd', function(arg){ - m.__rendered = true; - self.renderEnd('model'); - }); - })(model); - - if (renderStack.indexOf(model) < 0) { - renderStack.push(model); - } - }); - return this; - }; - - this.reset = function(duration) { - if (duration !== undefined) { - _duration = duration; - } - renderStack = []; - }; - - this.transition = function(selection, args, duration) { - args = arguments.length > 1 ? [].slice.call(arguments, 1) : []; - - if (args.length > 1) { - duration = args.pop(); - } else { - duration = _duration !== undefined ? _duration : 250; - } - selection.__rendered = false; - - if (renderStack.indexOf(selection) < 0) { - renderStack.push(selection); - } - - if (duration === 0) { - selection.__rendered = true; - selection.delay = function() { return this; }; - selection.duration = function() { return this; }; - return selection; - } else { - if (selection.length === 0) { - selection.__rendered = true; - } else if (selection.every( function(d){ return !d.length; } )) { - selection.__rendered = true; - } else { - selection.__rendered = false; - } - - var n = 0; - return selection - .transition() - .duration(duration) - .each(function(){ ++n; }) - .each('end', function(d, i) { - if (--n === 0) { - selection.__rendered = true; - self.renderEnd.apply(this, args); - } - }); - } - }; - - this.renderEnd = function() { - if (renderStack.every( function(d){ return d.__rendered; } )) { - renderStack.forEach( function(d){ d.__rendered = false; }); - dispatch.renderEnd.apply(this, arguments); - } - } - -}; - - -/* -Takes multiple objects and combines them into the first one (dst) -example: nv.utils.deepExtend({a: 1}, {a: 2, b: 3}, {c: 4}); -gives: {a: 2, b: 3, c: 4} -*/ -nv.utils.deepExtend = function(dst){ - var sources = arguments.length > 1 ? [].slice.call(arguments, 1) : []; - sources.forEach(function(source) { - for (var key in source) { - var isArray = dst[key] instanceof Array; - var isObject = typeof dst[key] === 'object'; - var srcObj = typeof source[key] === 'object'; - - if (isObject && !isArray && srcObj) { - nv.utils.deepExtend(dst[key], source[key]); - } else { - dst[key] = source[key]; - } - } - }); -}; - - -/* -state utility object, used to track d3 states in the models -*/ -nv.utils.state = function(){ - if (!(this instanceof nv.utils.state)) { - return new nv.utils.state(); - } - var state = {}; - var _self = this; - var _setState = function(){}; - var _getState = function(){ return {}; }; - var init = null; - var changed = null; - - this.dispatch = d3.dispatch('change', 'set'); - - this.dispatch.on('set', function(state){ - _setState(state, true); - }); - - this.getter = function(fn){ - _getState = fn; - return this; - }; - - this.setter = function(fn, callback) { - if (!callback) { - callback = function(){}; - } - _setState = function(state, update){ - fn(state); - if (update) { - callback(); - } - }; - return this; - }; - - this.init = function(state){ - init = init || {}; - nv.utils.deepExtend(init, state); - }; - - var _set = function(){ - var settings = _getState(); - - if (JSON.stringify(settings) === JSON.stringify(state)) { - return false; - } - - for (var key in settings) { - if (state[key] === undefined) { - state[key] = {}; - } - state[key] = settings[key]; - changed = true; - } - return true; - }; - - this.update = function(){ - if (init) { - _setState(init, false); - init = null; - } - if (_set.call(this)) { - this.dispatch.change(state); - } - }; - -}; - - -/* -Snippet of code you can insert into each nv.models.* to give you the ability to -do things like: -chart.options({ - showXAxis: true, - tooltips: true -}); - -To enable in the chart: -chart.options = nv.utils.optionsFunc.bind(chart); -*/ -nv.utils.optionsFunc = function(args) { - if (args) { - d3.map(args).forEach((function(key,value) { - if (typeof this[key] === "function") { - this[key](value); - } - }).bind(this)); - } - return this; -}; - - -/* -numTicks: requested number of ticks -data: the chart data - -returns the number of ticks to actually use on X axis, based on chart data -to avoid duplicate ticks with the same value -*/ -nv.utils.calcTicksX = function(numTicks, data) { - // find max number of values from all data streams - var numValues = 1; - var i = 0; - for (i; i < data.length; i += 1) { - var stream_len = data[i] && data[i].values ? data[i].values.length : 0; - numValues = stream_len > numValues ? stream_len : numValues; - } - nv.log("Requested number of ticks: ", numTicks); - nv.log("Calculated max values to be: ", numValues); - // make sure we don't have more ticks than values to avoid duplicates - numTicks = numTicks > numValues ? numTicks = numValues - 1 : numTicks; - // make sure we have at least one tick - numTicks = numTicks < 1 ? 1 : numTicks; - // make sure it's an integer - numTicks = Math.floor(numTicks); - nv.log("Calculating tick count as: ", numTicks); - return numTicks; -}; - - -/* -returns number of ticks to actually use on Y axis, based on chart data -*/ -nv.utils.calcTicksY = function(numTicks, data) { - // currently uses the same logic but we can adjust here if needed later - return nv.utils.calcTicksX(numTicks, data); -}; - - -/* -Add a particular option from an options object onto chart -Options exposed on a chart are a getter/setter function that returns chart -on set to mimic typical d3 option chaining, e.g. svg.option1('a').option2('b'); - -option objects should be generated via Object.create() to provide -the option of manipulating data via get/set functions. -*/ -nv.utils.initOption = function(chart, name) { - // if it's a call option, just call it directly, otherwise do get/set - if (chart._calls && chart._calls[name]) { - chart[name] = chart._calls[name]; - } else { - chart[name] = function (_) { - if (!arguments.length) return chart._options[name]; - chart._overrides[name] = true; - chart._options[name] = _; - return chart; - }; - // calling the option as _option will ignore if set by option already - // so nvd3 can set options internally but the stop if set manually - chart['_' + name] = function(_) { - if (!arguments.length) return chart._options[name]; - if (!chart._overrides[name]) { - chart._options[name] = _; - } - return chart; - } - } -}; - - -/* -Add all options in an options object to the chart -*/ -nv.utils.initOptions = function(chart) { - chart._overrides = chart._overrides || {}; - var ops = Object.getOwnPropertyNames(chart._options || {}); - var calls = Object.getOwnPropertyNames(chart._calls || {}); - ops = ops.concat(calls); - for (var i in ops) { - nv.utils.initOption(chart, ops[i]); - } -}; - - -/* -Inherit options from a D3 object -d3.rebind makes calling the function on target actually call it on source -Also use _d3options so we can track what we inherit for documentation and chained inheritance -*/ -nv.utils.inheritOptionsD3 = function(target, d3_source, oplist) { - target._d3options = oplist.concat(target._d3options || []); - oplist.unshift(d3_source); - oplist.unshift(target); - d3.rebind.apply(this, oplist); -}; - - -/* -Remove duplicates from an array -*/ -nv.utils.arrayUnique = function(a) { - return a.sort().filter(function(item, pos) { - return !pos || item != a[pos - 1]; - }); -}; - - -/* -Keeps a list of custom symbols to draw from in addition to d3.svg.symbol -Necessary since d3 doesn't let you extend its list -_- -Add new symbols by doing nv.utils.symbols.set('name', function(size){...}); -*/ -nv.utils.symbolMap = d3.map(); - - -/* -Replaces d3.svg.symbol so that we can look both there and our own map - */ -nv.utils.symbol = function() { - var type, - size = 64; - function symbol(d,i) { - var t = type.call(this,d,i); - var s = size.call(this,d,i); - if (d3.svg.symbolTypes.indexOf(t) !== -1) { - return d3.svg.symbol().type(t).size(s)(); - } else { - return nv.utils.symbolMap.get(t)(s); - } - } - symbol.type = function(_) { - if (!arguments.length) return type; - type = d3.functor(_); - return symbol; - }; - symbol.size = function(_) { - if (!arguments.length) return size; - size = d3.functor(_); - return symbol; - }; - return symbol; -}; - - -/* -Inherit option getter/setter functions from source to target -d3.rebind makes calling the function on target actually call it on source -Also track via _inherited and _d3options so we can track what we inherit -for documentation generation purposes and chained inheritance -*/ -nv.utils.inheritOptions = function(target, source) { - // inherit all the things - var ops = Object.getOwnPropertyNames(source._options || {}); - var calls = Object.getOwnPropertyNames(source._calls || {}); - var inherited = source._inherited || []; - var d3ops = source._d3options || []; - var args = ops.concat(calls).concat(inherited).concat(d3ops); - args.unshift(source); - args.unshift(target); - d3.rebind.apply(this, args); - // pass along the lists to keep track of them, don't allow duplicates - target._inherited = nv.utils.arrayUnique(ops.concat(calls).concat(inherited).concat(ops).concat(target._inherited || [])); - target._d3options = nv.utils.arrayUnique(d3ops.concat(target._d3options || [])); -}; - - -/* -Runs common initialize code on the svg before the chart builds -*/ -nv.utils.initSVG = function(svg) { - svg.classed({'nvd3-svg':true}); -}; - - -/* -Sanitize and provide default for the container height. -*/ -nv.utils.sanitizeHeight = function(height, container) { - return (height || parseInt(container.style('height'), 10) || 400); -}; - - -/* -Sanitize and provide default for the container width. -*/ -nv.utils.sanitizeWidth = function(width, container) { - return (width || parseInt(container.style('width'), 10) || 960); -}; - - -/* -Calculate the available height for a chart. -*/ -nv.utils.availableHeight = function(height, container, margin) { - return nv.utils.sanitizeHeight(height, container) - margin.top - margin.bottom; -}; - -/* -Calculate the available width for a chart. -*/ -nv.utils.availableWidth = function(width, container, margin) { - return nv.utils.sanitizeWidth(width, container) - margin.left - margin.right; -}; - -/* -Clear any rendered chart components and display a chart's 'noData' message -*/ -nv.utils.noData = function(chart, container) { - var opt = chart.options(), - margin = opt.margin(), - noData = opt.noData(), - data = (noData == null) ? ["No Data Available."] : [noData], - height = nv.utils.availableHeight(opt.height(), container, margin), - width = nv.utils.availableWidth(opt.width(), container, margin), - x = margin.left + width/2, - y = margin.top + height/2; - - //Remove any previously created chart components - container.selectAll('g').remove(); - - var noDataText = container.selectAll('.nv-noData').data(data); - - noDataText.enter().append('text') - .attr('class', 'nvd3 nv-noData') - .attr('dy', '-.7em') - .style('text-anchor', 'middle'); - - noDataText - .attr('x', x) - .attr('y', y) - .text(function(t){ return t; }); -}; - -nv.models.axis = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var axis = d3.svg.axis(); - var scale = d3.scale.linear(); - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = 75 //only used for tickLabel currently - , height = 60 //only used for tickLabel currently - , axisLabelText = null - , showMaxMin = false //TODO: showMaxMin should be disabled on all ordinal scaled axes - , rotateLabels = 0 - , rotateYLabel = true - , staggerLabels = false - , isOrdinal = false - , ticks = null - , axisLabelDistance = 0 - , duration = 250 - , dispatch = d3.dispatch('renderEnd') - ; - axis - .scale(scale) - .orient('bottom') - .tickFormat(function(d) { return d }) - ; - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var scale0; - var renderWatch = nv.utils.renderWatch(dispatch, duration); - - function chart(selection) { - renderWatch.reset(); - selection.each(function(data) { - var container = d3.select(this); - nv.utils.initSVG(container); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-axis').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-axis'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - if (ticks !== null) - axis.ticks(ticks); - else if (axis.orient() == 'top' || axis.orient() == 'bottom') - axis.ticks(Math.abs(scale.range()[1] - scale.range()[0]) / 100); - - //TODO: consider calculating width/height based on whether or not label is added, for reference in charts using this component - g.watchTransition(renderWatch, 'axis').call(axis); - - scale0 = scale0 || axis.scale(); - - var fmt = axis.tickFormat(); - if (fmt == null) { - fmt = scale0.tickFormat(); - } - - var axisLabel = g.selectAll('text.nv-axislabel') - .data([axisLabelText || null]); - axisLabel.exit().remove(); - - var xLabelMargin; - var axisMaxMin; - var w; - switch (axis.orient()) { - case 'top': - axisLabel.enter().append('text').attr('class', 'nv-axislabel'); - if (scale.range().length < 2) { - w = 0; - } else if (scale.range().length === 2) { - w = scale.range()[1]; - } else { - w = scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]); - } - axisLabel - .attr('text-anchor', 'middle') - .attr('y', 0) - .attr('x', w/2); - if (showMaxMin) { - axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') - .data(scale.domain()); - axisMaxMin.enter().append('g').attr('class',function(d,i){ - return ['nv-axisMaxMin','nv-axisMaxMin-x',(i == 0 ? 'nv-axisMin-x':'nv-axisMax-x')].join(' ') - }).append('text'); - axisMaxMin.exit().remove(); - axisMaxMin - .attr('transform', function(d,i) { - return 'translate(' + nv.utils.NaNtoZero(scale(d)) + ',0)' - }) - .select('text') - .attr('dy', '-0.5em') - .attr('y', -axis.tickPadding()) - .attr('text-anchor', 'middle') - .text(function(d,i) { - var v = fmt(d); - return ('' + v).match('NaN') ? '' : v; - }); - axisMaxMin.watchTransition(renderWatch, 'min-max top') - .attr('transform', function(d,i) { - return 'translate(' + nv.utils.NaNtoZero(scale.range()[i]) + ',0)' - }); - } - break; - case 'bottom': - xLabelMargin = axisLabelDistance + 36; - var maxTextWidth = 30; - var textHeight = 0; - var xTicks = g.selectAll('g').select("text"); - var rotateLabelsRule = ''; - if (rotateLabels%360) { - //Calculate the longest xTick width - xTicks.each(function(d,i){ - var box = this.getBoundingClientRect(); - var width = box.width; - textHeight = box.height; - if(width > maxTextWidth) maxTextWidth = width; - }); - rotateLabelsRule = 'rotate(' + rotateLabels + ' 0,' + (textHeight/2 + axis.tickPadding()) + ')'; - //Convert to radians before calculating sin. Add 30 to margin for healthy padding. - var sin = Math.abs(Math.sin(rotateLabels*Math.PI/180)); - xLabelMargin = (sin ? sin*maxTextWidth : maxTextWidth)+30; - //Rotate all xTicks - xTicks - .attr('transform', rotateLabelsRule) - .style('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end'); - } - axisLabel.enter().append('text').attr('class', 'nv-axislabel'); - if (scale.range().length < 2) { - w = 0; - } else if (scale.range().length === 2) { - w = scale.range()[1]; - } else { - w = scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0]); - } - axisLabel - .attr('text-anchor', 'middle') - .attr('y', xLabelMargin) - .attr('x', w/2); - if (showMaxMin) { - //if (showMaxMin && !isOrdinal) { - axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') - //.data(scale.domain()) - .data([scale.domain()[0], scale.domain()[scale.domain().length - 1]]); - axisMaxMin.enter().append('g').attr('class',function(d,i){ - return ['nv-axisMaxMin','nv-axisMaxMin-x',(i == 0 ? 'nv-axisMin-x':'nv-axisMax-x')].join(' ') - }).append('text'); - axisMaxMin.exit().remove(); - axisMaxMin - .attr('transform', function(d,i) { - return 'translate(' + nv.utils.NaNtoZero((scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0))) + ',0)' - }) - .select('text') - .attr('dy', '.71em') - .attr('y', axis.tickPadding()) - .attr('transform', rotateLabelsRule) - .style('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle') - .text(function(d,i) { - var v = fmt(d); - return ('' + v).match('NaN') ? '' : v; - }); - axisMaxMin.watchTransition(renderWatch, 'min-max bottom') - .attr('transform', function(d,i) { - return 'translate(' + nv.utils.NaNtoZero((scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0))) + ',0)' - }); - } - if (staggerLabels) - xTicks - .attr('transform', function(d,i) { - return 'translate(0,' + (i % 2 == 0 ? '0' : '12') + ')' - }); - - break; - case 'right': - axisLabel.enter().append('text').attr('class', 'nv-axislabel'); - axisLabel - .style('text-anchor', rotateYLabel ? 'middle' : 'begin') - .attr('transform', rotateYLabel ? 'rotate(90)' : '') - .attr('y', rotateYLabel ? (-Math.max(margin.right, width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart - .attr('x', rotateYLabel ? (d3.max(scale.range()) / 2) : axis.tickPadding()); - if (showMaxMin) { - axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') - .data(scale.domain()); - axisMaxMin.enter().append('g').attr('class',function(d,i){ - return ['nv-axisMaxMin','nv-axisMaxMin-y',(i == 0 ? 'nv-axisMin-y':'nv-axisMax-y')].join(' ') - }).append('text') - .style('opacity', 0); - axisMaxMin.exit().remove(); - axisMaxMin - .attr('transform', function(d,i) { - return 'translate(0,' + nv.utils.NaNtoZero(scale(d)) + ')' - }) - .select('text') - .attr('dy', '.32em') - .attr('y', 0) - .attr('x', axis.tickPadding()) - .style('text-anchor', 'start') - .text(function(d, i) { - var v = fmt(d); - return ('' + v).match('NaN') ? '' : v; - }); - axisMaxMin.watchTransition(renderWatch, 'min-max right') - .attr('transform', function(d,i) { - return 'translate(0,' + nv.utils.NaNtoZero(scale.range()[i]) + ')' - }) - .select('text') - .style('opacity', 1); - } - break; - case 'left': - /* - //For dynamically placing the label. Can be used with dynamically-sized chart axis margins - var yTicks = g.selectAll('g').select("text"); - yTicks.each(function(d,i){ - var labelPadding = this.getBoundingClientRect().width + axis.tickPadding() + 16; - if(labelPadding > width) width = labelPadding; - }); - */ - axisLabel.enter().append('text').attr('class', 'nv-axislabel'); - axisLabel - .style('text-anchor', rotateYLabel ? 'middle' : 'end') - .attr('transform', rotateYLabel ? 'rotate(-90)' : '') - .attr('y', rotateYLabel ? (-Math.max(margin.left, width) + 25 - (axisLabelDistance || 0)) : -10) - .attr('x', rotateYLabel ? (-d3.max(scale.range()) / 2) : -axis.tickPadding()); - if (showMaxMin) { - axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') - .data(scale.domain()); - axisMaxMin.enter().append('g').attr('class',function(d,i){ - return ['nv-axisMaxMin','nv-axisMaxMin-y',(i == 0 ? 'nv-axisMin-y':'nv-axisMax-y')].join(' ') - }).append('text') - .style('opacity', 0); - axisMaxMin.exit().remove(); - axisMaxMin - .attr('transform', function(d,i) { - return 'translate(0,' + nv.utils.NaNtoZero(scale0(d)) + ')' - }) - .select('text') - .attr('dy', '.32em') - .attr('y', 0) - .attr('x', -axis.tickPadding()) - .attr('text-anchor', 'end') - .text(function(d,i) { - var v = fmt(d); - return ('' + v).match('NaN') ? '' : v; - }); - axisMaxMin.watchTransition(renderWatch, 'min-max right') - .attr('transform', function(d,i) { - return 'translate(0,' + nv.utils.NaNtoZero(scale.range()[i]) + ')' - }) - .select('text') - .style('opacity', 1); - } - break; - } - axisLabel.text(function(d) { return d }); - - if (showMaxMin && (axis.orient() === 'left' || axis.orient() === 'right')) { - //check if max and min overlap other values, if so, hide the values that overlap - g.selectAll('g') // the g's wrapping each tick - .each(function(d,i) { - d3.select(this).select('text').attr('opacity', 1); - if (scale(d) < scale.range()[1] + 10 || scale(d) > scale.range()[0] - 10) { // 10 is assuming text height is 16... if d is 0, leave it! - if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL - d3.select(this).attr('opacity', 0); - - d3.select(this).select('text').attr('opacity', 0); // Don't remove the ZERO line!! - } - }); - - //if Max and Min = 0 only show min, Issue #281 - if (scale.domain()[0] == scale.domain()[1] && scale.domain()[0] == 0) { - wrap.selectAll('g.nv-axisMaxMin').style('opacity', function (d, i) { - return !i ? 1 : 0 - }); - } - } - - if (showMaxMin && (axis.orient() === 'top' || axis.orient() === 'bottom')) { - var maxMinRange = []; - wrap.selectAll('g.nv-axisMaxMin') - .each(function(d,i) { - try { - if (i) // i== 1, max position - maxMinRange.push(scale(d) - this.getBoundingClientRect().width - 4); //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case) - else // i==0, min position - maxMinRange.push(scale(d) + this.getBoundingClientRect().width + 4) - }catch (err) { - if (i) // i== 1, max position - maxMinRange.push(scale(d) - 4); //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case) - else // i==0, min position - maxMinRange.push(scale(d) + 4); - } - }); - // the g's wrapping each tick - g.selectAll('g').each(function(d, i) { - if (scale(d) < maxMinRange[0] || scale(d) > maxMinRange[1]) { - if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL - d3.select(this).remove(); - else - d3.select(this).select('text').remove(); // Don't remove the ZERO line!! - } - }); - } - - //Highlight zero tick line - g.selectAll('.tick') - .filter(function (d) { - /* - The filter needs to return only ticks at or near zero. - Numbers like 0.00001 need to count as zero as well, - and the arithmetic trick below solves that. - */ - return !parseFloat(Math.round(d * 100000) / 1000000) && (d !== undefined) - }) - .classed('zero', true); - - //store old scales for use in transitions on update - scale0 = scale.copy(); - - }); - - renderWatch.renderEnd('axis immediate'); - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.axis = axis; - chart.dispatch = dispatch; - - chart.options = nv.utils.optionsFunc.bind(chart); - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - axisLabelDistance: {get: function(){return axisLabelDistance;}, set: function(_){axisLabelDistance=_;}}, - staggerLabels: {get: function(){return staggerLabels;}, set: function(_){staggerLabels=_;}}, - rotateLabels: {get: function(){return rotateLabels;}, set: function(_){rotateLabels=_;}}, - rotateYLabel: {get: function(){return rotateYLabel;}, set: function(_){rotateYLabel=_;}}, - showMaxMin: {get: function(){return showMaxMin;}, set: function(_){showMaxMin=_;}}, - axisLabel: {get: function(){return axisLabelText;}, set: function(_){axisLabelText=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - ticks: {get: function(){return ticks;}, set: function(_){ticks=_;}}, - width: {get: function(){return width;}, set: function(_){width=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration=_; - renderWatch.reset(duration); - }}, - scale: {get: function(){return scale;}, set: function(_){ - scale = _; - axis.scale(scale); - isOrdinal = typeof scale.rangeBands === 'function'; - nv.utils.inheritOptionsD3(chart, scale, ['domain', 'range', 'rangeBand', 'rangeBands']); - }} - }); - - nv.utils.initOptions(chart); - nv.utils.inheritOptionsD3(chart, axis, ['orient', 'tickValues', 'tickSubdivide', 'tickSize', 'tickPadding', 'tickFormat']); - nv.utils.inheritOptionsD3(chart, scale, ['domain', 'range', 'rangeBand', 'rangeBands']); - - return chart; -}; -nv.models.boxPlot = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = 960 - , height = 500 - , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one - , x = d3.scale.ordinal() - , y = d3.scale.linear() - , getX = function(d) { return d.x } - , getY = function(d) { return d.y } - , color = nv.utils.defaultColor() - , container = null - , xDomain - , yDomain - , xRange - , yRange - , dispatch = d3.dispatch('elementMouseover', 'elementMouseout', 'elementMousemove', 'renderEnd') - , duration = 250 - , maxBoxWidth = null - ; - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var x0, y0; - var renderWatch = nv.utils.renderWatch(dispatch, duration); - - function chart(selection) { - renderWatch.reset(); - selection.each(function(data) { - var availableWidth = width - margin.left - margin.right, - availableHeight = height - margin.top - margin.bottom; - - container = d3.select(this); - nv.utils.initSVG(container); - - // Setup Scales - x .domain(xDomain || data.map(function(d,i) { return getX(d,i); })) - .rangeBands(xRange || [0, availableWidth], .1); - - // if we know yDomain, no need to calculate - var yData = [] - if (!yDomain) { - // (y-range is based on quartiles, whiskers and outliers) - - // lower values - var yMin = d3.min(data.map(function(d) { - var min_arr = []; - - min_arr.push(d.values.Q1); - if (d.values.hasOwnProperty('whisker_low') && d.values.whisker_low !== null) { min_arr.push(d.values.whisker_low); } - if (d.values.hasOwnProperty('outliers') && d.values.outliers !== null) { min_arr = min_arr.concat(d.values.outliers); } - - return d3.min(min_arr); - })); - - // upper values - var yMax = d3.max(data.map(function(d) { - var max_arr = []; - - max_arr.push(d.values.Q3); - if (d.values.hasOwnProperty('whisker_high') && d.values.whisker_high !== null) { max_arr.push(d.values.whisker_high); } - if (d.values.hasOwnProperty('outliers') && d.values.outliers !== null) { max_arr = max_arr.concat(d.values.outliers); } - - return d3.max(max_arr); - })); - - yData = [ yMin, yMax ] ; - } - - y.domain(yDomain || yData); - y.range(yRange || [availableHeight, 0]); - - //store old scales if they exist - x0 = x0 || x; - y0 = y0 || y.copy().range([y(0),y(0)]); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap'); - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - var boxplots = wrap.selectAll('.nv-boxplot').data(function(d) { return d }); - var boxEnter = boxplots.enter().append('g').style('stroke-opacity', 1e-6).style('fill-opacity', 1e-6); - boxplots - .attr('class', 'nv-boxplot') - .attr('transform', function(d,i,j) { return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05) + ', 0)'; }) - .classed('hover', function(d) { return d.hover }); - boxplots - .watchTransition(renderWatch, 'nv-boxplot: boxplots') - .style('stroke-opacity', 1) - .style('fill-opacity', .75) - .delay(function(d,i) { return i * duration / data.length }) - .attr('transform', function(d,i) { - return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05) + ', 0)'; - }); - boxplots.exit().remove(); - - // ----- add the SVG elements for each boxPlot ----- - - // conditionally append whisker lines - boxEnter.each(function(d,i) { - var box = d3.select(this); - - ['low', 'high'].forEach(function(key) { - if (d.values.hasOwnProperty('whisker_' + key) && d.values['whisker_' + key] !== null) { - box.append('line') - .style('stroke', (d.color) ? d.color : color(d,i)) - .attr('class', 'nv-boxplot-whisker nv-boxplot-' + key); - - box.append('line') - .style('stroke', (d.color) ? d.color : color(d,i)) - .attr('class', 'nv-boxplot-tick nv-boxplot-' + key); - } - }); - }); - - // outliers - // TODO: support custom colors here - var outliers = boxplots.selectAll('.nv-boxplot-outlier').data(function(d) { - if (d.values.hasOwnProperty('outliers') && d.values.outliers !== null) { return d.values.outliers; } - else { return []; } - }); - outliers.enter().append('circle') - .style('fill', function(d,i,j) { return color(d,j) }).style('stroke', function(d,i,j) { return color(d,j) }) - .on('mouseover', function(d,i,j) { - d3.select(this).classed('hover', true); - dispatch.elementMouseover({ - series: { key: d, color: color(d,j) }, - e: d3.event - }); - }) - .on('mouseout', function(d,i,j) { - d3.select(this).classed('hover', false); - dispatch.elementMouseout({ - series: { key: d, color: color(d,j) }, - e: d3.event - }); - }) - .on('mousemove', function(d,i) { - dispatch.elementMousemove({e: d3.event}); - }); - - outliers.attr('class', 'nv-boxplot-outlier'); - outliers - .watchTransition(renderWatch, 'nv-boxplot: nv-boxplot-outlier') - .attr('cx', x.rangeBand() * .45) - .attr('cy', function(d,i,j) { return y(d); }) - .attr('r', '3'); - outliers.exit().remove(); - - var box_width = function() { return (maxBoxWidth === null ? x.rangeBand() * .9 : Math.min(75, x.rangeBand() * .9)); }; - var box_left = function() { return x.rangeBand() * .45 - box_width()/2; }; - var box_right = function() { return x.rangeBand() * .45 + box_width()/2; }; - - // update whisker lines and ticks - ['low', 'high'].forEach(function(key) { - var endpoint = (key === 'low') ? 'Q1' : 'Q3'; - - boxplots.select('line.nv-boxplot-whisker.nv-boxplot-' + key) - .watchTransition(renderWatch, 'nv-boxplot: boxplots') - .attr('x1', x.rangeBand() * .45 ) - .attr('y1', function(d,i) { return y(d.values['whisker_' + key]); }) - .attr('x2', x.rangeBand() * .45 ) - .attr('y2', function(d,i) { return y(d.values[endpoint]); }); - - boxplots.select('line.nv-boxplot-tick.nv-boxplot-' + key) - .watchTransition(renderWatch, 'nv-boxplot: boxplots') - .attr('x1', box_left ) - .attr('y1', function(d,i) { return y(d.values['whisker_' + key]); }) - .attr('x2', box_right ) - .attr('y2', function(d,i) { return y(d.values['whisker_' + key]); }); - }); - - ['low', 'high'].forEach(function(key) { - boxEnter.selectAll('.nv-boxplot-' + key) - .on('mouseover', function(d,i,j) { - d3.select(this).classed('hover', true); - dispatch.elementMouseover({ - series: { key: d.values['whisker_' + key], color: color(d,j) }, - e: d3.event - }); - }) - .on('mouseout', function(d,i,j) { - d3.select(this).classed('hover', false); - dispatch.elementMouseout({ - series: { key: d.values['whisker_' + key], color: color(d,j) }, - e: d3.event - }); - }) - .on('mousemove', function(d,i) { - dispatch.elementMousemove({e: d3.event}); - }); - }); - - // boxes - boxEnter.append('rect') - .attr('class', 'nv-boxplot-box') - // tooltip events - .on('mouseover', function(d,i) { - d3.select(this).classed('hover', true); - dispatch.elementMouseover({ - key: d.label, - value: d.label, - series: [ - { key: 'Q3', value: d.values.Q3, color: d.color || color(d,i) }, - { key: 'Q2', value: d.values.Q2, color: d.color || color(d,i) }, - { key: 'Q1', value: d.values.Q1, color: d.color || color(d,i) } - ], - data: d, - index: i, - e: d3.event - }); - }) - .on('mouseout', function(d,i) { - d3.select(this).classed('hover', false); - dispatch.elementMouseout({ - key: d.label, - value: d.label, - series: [ - { key: 'Q3', value: d.values.Q3, color: d.color || color(d,i) }, - { key: 'Q2', value: d.values.Q2, color: d.color || color(d,i) }, - { key: 'Q1', value: d.values.Q1, color: d.color || color(d,i) } - ], - data: d, - index: i, - e: d3.event - }); - }) - .on('mousemove', function(d,i) { - dispatch.elementMousemove({e: d3.event}); - }); - - // box transitions - boxplots.select('rect.nv-boxplot-box') - .watchTransition(renderWatch, 'nv-boxplot: boxes') - .attr('y', function(d,i) { return y(d.values.Q3); }) - .attr('width', box_width) - .attr('x', box_left ) - - .attr('height', function(d,i) { return Math.abs(y(d.values.Q3) - y(d.values.Q1)) || 1 }) - .style('fill', function(d,i) { return d.color || color(d,i) }) - .style('stroke', function(d,i) { return d.color || color(d,i) }); - - // median line - boxEnter.append('line').attr('class', 'nv-boxplot-median'); - - boxplots.select('line.nv-boxplot-median') - .watchTransition(renderWatch, 'nv-boxplot: boxplots line') - .attr('x1', box_left) - .attr('y1', function(d,i) { return y(d.values.Q2); }) - .attr('x2', box_right) - .attr('y2', function(d,i) { return y(d.values.Q2); }); - - //store old scales for use in transitions on update - x0 = x.copy(); - y0 = y.copy(); - }); - - renderWatch.renderEnd('nv-boxplot immediate'); - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - maxBoxWidth: {get: function(){return maxBoxWidth;}, set: function(_){maxBoxWidth=_;}}, - x: {get: function(){return getX;}, set: function(_){getX=_;}}, - y: {get: function(){return getY;}, set: function(_){getY=_;}}, - xScale: {get: function(){return x;}, set: function(_){x=_;}}, - yScale: {get: function(){return y;}, set: function(_){y=_;}}, - xDomain: {get: function(){return xDomain;}, set: function(_){xDomain=_;}}, - yDomain: {get: function(){return yDomain;}, set: function(_){yDomain=_;}}, - xRange: {get: function(){return xRange;}, set: function(_){xRange=_;}}, - yRange: {get: function(){return yRange;}, set: function(_){yRange=_;}}, - id: {get: function(){return id;}, set: function(_){id=_;}}, - // rectClass: {get: function(){return rectClass;}, set: function(_){rectClass=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - }} - }); - - nv.utils.initOptions(chart); - - return chart; -}; -nv.models.boxPlotChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var boxplot = nv.models.boxPlot() - , xAxis = nv.models.axis() - , yAxis = nv.models.axis() - ; - - var margin = {top: 15, right: 10, bottom: 50, left: 60} - , width = null - , height = null - , color = nv.utils.getColor() - , showXAxis = true - , showYAxis = true - , rightAlignYAxis = false - , staggerLabels = false - , tooltip = nv.models.tooltip() - , x - , y - , noData = "No Data Available." - , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'beforeUpdate', 'renderEnd') - , duration = 250 - ; - - xAxis - .orient('bottom') - .showMaxMin(false) - .tickFormat(function(d) { return d }) - ; - yAxis - .orient((rightAlignYAxis) ? 'right' : 'left') - .tickFormat(d3.format(',.1f')) - ; - - tooltip.duration(0); - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var renderWatch = nv.utils.renderWatch(dispatch, duration); - - function chart(selection) { - renderWatch.reset(); - renderWatch.models(boxplot); - if (showXAxis) renderWatch.models(xAxis); - if (showYAxis) renderWatch.models(yAxis); - - selection.each(function(data) { - var container = d3.select(this), - that = this; - nv.utils.initSVG(container); - var availableWidth = (width || parseInt(container.style('width')) || 960) - - margin.left - margin.right, - availableHeight = (height || parseInt(container.style('height')) || 400) - - margin.top - margin.bottom; - - chart.update = function() { - dispatch.beforeUpdate(); - container.transition().duration(duration).call(chart); - }; - chart.container = this; - - // Display No Data message if there's nothing to show. (quartiles required at minimum) - if (!data || !data.length || - !data.filter(function(d) { return d.values.hasOwnProperty("Q1") && d.values.hasOwnProperty("Q2") && d.values.hasOwnProperty("Q3"); }).length) { - var noDataText = container.selectAll('.nv-noData').data([noData]); - - noDataText.enter().append('text') - .attr('class', 'nvd3 nv-noData') - .attr('dy', '-.7em') - .style('text-anchor', 'middle'); - - noDataText - .attr('x', margin.left + availableWidth / 2) - .attr('y', margin.top + availableHeight / 2) - .text(function(d) { return d }); - - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - // Setup Scales - x = boxplot.xScale(); - y = boxplot.yScale().clamp(true); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-boxPlotWithAxes').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-boxPlotWithAxes').append('g'); - var defsEnter = gEnter.append('defs'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-x nv-axis'); - gEnter.append('g').attr('class', 'nv-y nv-axis') - .append('g').attr('class', 'nv-zeroLine') - .append('line'); - - gEnter.append('g').attr('class', 'nv-barsWrap'); - - g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - if (rightAlignYAxis) { - g.select(".nv-y.nv-axis") - .attr("transform", "translate(" + availableWidth + ",0)"); - } - - // Main Chart Component(s) - boxplot - .width(availableWidth) - .height(availableHeight); - - var barsWrap = g.select('.nv-barsWrap') - .datum(data.filter(function(d) { return !d.disabled })) - - barsWrap.transition().call(boxplot); - - - defsEnter.append('clipPath') - .attr('id', 'nv-x-label-clip-' + boxplot.id()) - .append('rect'); - - g.select('#nv-x-label-clip-' + boxplot.id() + ' rect') - .attr('width', x.rangeBand() * (staggerLabels ? 2 : 1)) - .attr('height', 16) - .attr('x', -x.rangeBand() / (staggerLabels ? 1 : 2 )); - - // Setup Axes - if (showXAxis) { - xAxis - .scale(x) - .ticks( nv.utils.calcTicksX(availableWidth/100, data) ) - .tickSize(-availableHeight, 0); - - g.select('.nv-x.nv-axis').attr('transform', 'translate(0,' + y.range()[0] + ')'); - g.select('.nv-x.nv-axis').call(xAxis); - - var xTicks = g.select('.nv-x.nv-axis').selectAll('g'); - if (staggerLabels) { - xTicks - .selectAll('text') - .attr('transform', function(d,i,j) { return 'translate(0,' + (j % 2 == 0 ? '5' : '17') + ')' }) - } - } - - if (showYAxis) { - yAxis - .scale(y) - .ticks( Math.floor(availableHeight/36) ) // can't use nv.utils.calcTicksY with Object data - .tickSize( -availableWidth, 0); - - g.select('.nv-y.nv-axis').call(yAxis); - } - - // Zero line - g.select(".nv-zeroLine line") - .attr("x1",0) - .attr("x2",availableWidth) - .attr("y1", y(0)) - .attr("y2", y(0)) - ; - - //============================================================ - // Event Handling/Dispatching (in chart's scope) - //------------------------------------------------------------ - }); - - renderWatch.renderEnd('nv-boxplot chart immediate'); - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - boxplot.dispatch.on('elementMouseover.tooltip', function(evt) { - tooltip.data(evt).hidden(false); - }); - - boxplot.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.data(evt).hidden(true); - }); - - boxplot.dispatch.on('elementMousemove.tooltip', function(evt) { - tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); - }); - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.boxplot = boxplot; - chart.xAxis = xAxis; - chart.yAxis = yAxis; - chart.tooltip = tooltip; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - staggerLabels: {get: function(){return staggerLabels;}, set: function(_){staggerLabels=_;}}, - showXAxis: {get: function(){return showXAxis;}, set: function(_){showXAxis=_;}}, - showYAxis: {get: function(){return showYAxis;}, set: function(_){showYAxis=_;}}, - tooltips: {get: function(){return tooltips;}, set: function(_){tooltips=_;}}, - tooltipContent: {get: function(){return tooltip;}, set: function(_){tooltip=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - boxplot.duration(duration); - xAxis.duration(duration); - yAxis.duration(duration); - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - boxplot.color(color); - }}, - rightAlignYAxis: {get: function(){return rightAlignYAxis;}, set: function(_){ - rightAlignYAxis = _; - yAxis.orient( (_) ? 'right' : 'left'); - }} - }); - - nv.utils.inheritOptions(chart, boxplot); - nv.utils.initOptions(chart); - - return chart; -} -// Chart design based on the recommendations of Stephen Few. Implementation -// based on the work of Clint Ivy, Jamie Love, and Jason Davies. -// http://projects.instantcognition.com/protovis/bulletchart/ - -nv.models.bullet = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , orient = 'left' // TODO top & bottom - , reverse = false - , ranges = function(d) { return d.ranges } - , markers = function(d) { return d.markers ? d.markers : [0] } - , measures = function(d) { return d.measures } - , rangeLabels = function(d) { return d.rangeLabels ? d.rangeLabels : [] } - , markerLabels = function(d) { return d.markerLabels ? d.markerLabels : [] } - , measureLabels = function(d) { return d.measureLabels ? d.measureLabels : [] } - , forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.) - , width = 380 - , height = 30 - , container = null - , tickFormat = null - , color = nv.utils.getColor(['#1f77b4']) - , dispatch = d3.dispatch('elementMouseover', 'elementMouseout', 'elementMousemove') - ; - - function chart(selection) { - selection.each(function(d, i) { - var availableWidth = width - margin.left - margin.right, - availableHeight = height - margin.top - margin.bottom; - - container = d3.select(this); - nv.utils.initSVG(container); - - var rangez = ranges.call(this, d, i).slice().sort(d3.descending), - markerz = markers.call(this, d, i).slice().sort(d3.descending), - measurez = measures.call(this, d, i).slice().sort(d3.descending), - rangeLabelz = rangeLabels.call(this, d, i).slice(), - markerLabelz = markerLabels.call(this, d, i).slice(), - measureLabelz = measureLabels.call(this, d, i).slice(); - - // Setup Scales - // Compute the new x-scale. - var x1 = d3.scale.linear() - .domain( d3.extent(d3.merge([forceX, rangez])) ) - .range(reverse ? [availableWidth, 0] : [0, availableWidth]); - - // Retrieve the old x-scale, if this is an update. - var x0 = this.__chart__ || d3.scale.linear() - .domain([0, Infinity]) - .range(x1.range()); - - // Stash the new scale. - this.__chart__ = x1; - - var rangeMin = d3.min(rangez), //rangez[2] - rangeMax = d3.max(rangez), //rangez[0] - rangeAvg = rangez[1]; - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-bullet').data([d]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bullet'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - gEnter.append('rect').attr('class', 'nv-range nv-rangeMax'); - gEnter.append('rect').attr('class', 'nv-range nv-rangeAvg'); - gEnter.append('rect').attr('class', 'nv-range nv-rangeMin'); - gEnter.append('rect').attr('class', 'nv-measure'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0) - w1 = function(d) { return Math.abs(x1(d) - x1(0)) }; - var xp0 = function(d) { return d < 0 ? x0(d) : x0(0) }, - xp1 = function(d) { return d < 0 ? x1(d) : x1(0) }; - - g.select('rect.nv-rangeMax') - .attr('height', availableHeight) - .attr('width', w1(rangeMax > 0 ? rangeMax : rangeMin)) - .attr('x', xp1(rangeMax > 0 ? rangeMax : rangeMin)) - .datum(rangeMax > 0 ? rangeMax : rangeMin) - - g.select('rect.nv-rangeAvg') - .attr('height', availableHeight) - .attr('width', w1(rangeAvg)) - .attr('x', xp1(rangeAvg)) - .datum(rangeAvg) - - g.select('rect.nv-rangeMin') - .attr('height', availableHeight) - .attr('width', w1(rangeMax)) - .attr('x', xp1(rangeMax)) - .attr('width', w1(rangeMax > 0 ? rangeMin : rangeMax)) - .attr('x', xp1(rangeMax > 0 ? rangeMin : rangeMax)) - .datum(rangeMax > 0 ? rangeMin : rangeMax) - - g.select('rect.nv-measure') - .style('fill', color) - .attr('height', availableHeight / 3) - .attr('y', availableHeight / 3) - .attr('width', measurez < 0 ? - x1(0) - x1(measurez[0]) - : x1(measurez[0]) - x1(0)) - .attr('x', xp1(measurez)) - .on('mouseover', function() { - dispatch.elementMouseover({ - value: measurez[0], - label: measureLabelz[0] || 'Current', - color: d3.select(this).style("fill") - }) - }) - .on('mousemove', function() { - dispatch.elementMousemove({ - value: measurez[0], - label: measureLabelz[0] || 'Current', - color: d3.select(this).style("fill") - }) - }) - .on('mouseout', function() { - dispatch.elementMouseout({ - value: measurez[0], - label: measureLabelz[0] || 'Current', - color: d3.select(this).style("fill") - }) - }); - - var h3 = availableHeight / 6; - - var markerData = markerz.map( function(marker, index) { - return {value: marker, label: markerLabelz[index]} - }); - gEnter - .selectAll("path.nv-markerTriangle") - .data(markerData) - .enter() - .append('path') - .attr('class', 'nv-markerTriangle') - .attr('transform', function(d) { return 'translate(' + x1(d.value) + ',' + (availableHeight / 2) + ')' }) - .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z') - .on('mouseover', function(d) { - dispatch.elementMouseover({ - value: d.value, - label: d.label || 'Previous', - color: d3.select(this).style("fill"), - pos: [x1(d.value), availableHeight/2] - }) - - }) - .on('mousemove', function(d) { - dispatch.elementMousemove({ - value: d.value, - label: d.label || 'Previous', - color: d3.select(this).style("fill") - }) - }) - .on('mouseout', function(d, i) { - dispatch.elementMouseout({ - value: d.value, - label: d.label || 'Previous', - color: d3.select(this).style("fill") - }) - }); - - wrap.selectAll('.nv-range') - .on('mouseover', function(d,i) { - var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum"); - dispatch.elementMouseover({ - value: d, - label: label, - color: d3.select(this).style("fill") - }) - }) - .on('mousemove', function() { - dispatch.elementMousemove({ - value: measurez[0], - label: measureLabelz[0] || 'Previous', - color: d3.select(this).style("fill") - }) - }) - .on('mouseout', function(d,i) { - var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum"); - dispatch.elementMouseout({ - value: d, - label: label, - color: d3.select(this).style("fill") - }) - }); - }); - - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - ranges: {get: function(){return ranges;}, set: function(_){ranges=_;}}, // ranges (bad, satisfactory, good) - markers: {get: function(){return markers;}, set: function(_){markers=_;}}, // markers (previous, goal) - measures: {get: function(){return measures;}, set: function(_){measures=_;}}, // measures (actual, forecast) - forceX: {get: function(){return forceX;}, set: function(_){forceX=_;}}, - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - tickFormat: {get: function(){return tickFormat;}, set: function(_){tickFormat=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - orient: {get: function(){return orient;}, set: function(_){ // left, right, top, bottom - orient = _; - reverse = orient == 'right' || orient == 'bottom'; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }} - }); - - nv.utils.initOptions(chart); - return chart; -}; - - - -// Chart design based on the recommendations of Stephen Few. Implementation -// based on the work of Clint Ivy, Jamie Love, and Jason Davies. -// http://projects.instantcognition.com/protovis/bulletchart/ -nv.models.bulletChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var bullet = nv.models.bullet(); - var tooltip = nv.models.tooltip(); - - var orient = 'left' // TODO top & bottom - , reverse = false - , margin = {top: 5, right: 40, bottom: 20, left: 120} - , ranges = function(d) { return d.ranges } - , markers = function(d) { return d.markers ? d.markers : [0] } - , measures = function(d) { return d.measures } - , width = null - , height = 55 - , tickFormat = null - , ticks = null - , noData = null - , dispatch = d3.dispatch('tooltipShow', 'tooltipHide') - ; - - tooltip.duration(0).headerEnabled(false); - - function chart(selection) { - selection.each(function(d, i) { - var container = d3.select(this); - nv.utils.initSVG(container); - - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = height - margin.top - margin.bottom, - that = this; - - chart.update = function() { chart(selection) }; - chart.container = this; - - // Display No Data message if there's nothing to show. - if (!d || !ranges.call(this, d, i)) { - nv.utils.noData(chart, container) - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - var rangez = ranges.call(this, d, i).slice().sort(d3.descending), - markerz = markers.call(this, d, i).slice().sort(d3.descending), - measurez = measures.call(this, d, i).slice().sort(d3.descending); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-bulletChart').data([d]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bulletChart'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-bulletWrap'); - gEnter.append('g').attr('class', 'nv-titles'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - // Compute the new x-scale. - var x1 = d3.scale.linear() - .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) // TODO: need to allow forceX and forceY, and xDomain, yDomain - .range(reverse ? [availableWidth, 0] : [0, availableWidth]); - - // Retrieve the old x-scale, if this is an update. - var x0 = this.__chart__ || d3.scale.linear() - .domain([0, Infinity]) - .range(x1.range()); - - // Stash the new scale. - this.__chart__ = x1; - - var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0) - w1 = function(d) { return Math.abs(x1(d) - x1(0)) }; - - var title = gEnter.select('.nv-titles').append('g') - .attr('text-anchor', 'end') - .attr('transform', 'translate(-6,' + (height - margin.top - margin.bottom) / 2 + ')'); - title.append('text') - .attr('class', 'nv-title') - .text(function(d) { return d.title; }); - - title.append('text') - .attr('class', 'nv-subtitle') - .attr('dy', '1em') - .text(function(d) { return d.subtitle; }); - - bullet - .width(availableWidth) - .height(availableHeight) - - var bulletWrap = g.select('.nv-bulletWrap'); - d3.transition(bulletWrap).call(bullet); - - // Compute the tick format. - var format = tickFormat || x1.tickFormat( availableWidth / 100 ); - - // Update the tick groups. - var tick = g.selectAll('g.nv-tick') - .data(x1.ticks( ticks ? ticks : (availableWidth / 50) ), function(d) { - return this.textContent || format(d); - }); - - // Initialize the ticks with the old scale, x0. - var tickEnter = tick.enter().append('g') - .attr('class', 'nv-tick') - .attr('transform', function(d) { return 'translate(' + x0(d) + ',0)' }) - .style('opacity', 1e-6); - - tickEnter.append('line') - .attr('y1', availableHeight) - .attr('y2', availableHeight * 7 / 6); - - tickEnter.append('text') - .attr('text-anchor', 'middle') - .attr('dy', '1em') - .attr('y', availableHeight * 7 / 6) - .text(format); - - // Transition the updating ticks to the new scale, x1. - var tickUpdate = d3.transition(tick) - .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' }) - .style('opacity', 1); - - tickUpdate.select('line') - .attr('y1', availableHeight) - .attr('y2', availableHeight * 7 / 6); - - tickUpdate.select('text') - .attr('y', availableHeight * 7 / 6); - - // Transition the exiting ticks to the new scale, x1. - d3.transition(tick.exit()) - .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' }) - .style('opacity', 1e-6) - .remove(); - }); - - d3.timer.flush(); - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - bullet.dispatch.on('elementMouseover.tooltip', function(evt) { - evt['series'] = { - key: evt.label, - value: evt.value, - color: evt.color - }; - tooltip.data(evt).hidden(false); - }); - - bullet.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true); - }); - - bullet.dispatch.on('elementMousemove.tooltip', function(evt) { - tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); - }); - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.bullet = bullet; - chart.dispatch = dispatch; - chart.tooltip = tooltip; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - ranges: {get: function(){return ranges;}, set: function(_){ranges=_;}}, // ranges (bad, satisfactory, good) - markers: {get: function(){return markers;}, set: function(_){markers=_;}}, // markers (previous, goal) - measures: {get: function(){return measures;}, set: function(_){measures=_;}}, // measures (actual, forecast) - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - tickFormat: {get: function(){return tickFormat;}, set: function(_){tickFormat=_;}}, - ticks: {get: function(){return ticks;}, set: function(_){ticks=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - orient: {get: function(){return orient;}, set: function(_){ // left, right, top, bottom - orient = _; - reverse = orient == 'right' || orient == 'bottom'; - }} - }); - - nv.utils.inheritOptions(chart, bullet); - nv.utils.initOptions(chart); - - return chart; -}; - - - -nv.models.candlestickBar = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = null - , height = null - , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one - , container - , x = d3.scale.linear() - , y = d3.scale.linear() - , getX = function(d) { return d.x } - , getY = function(d) { return d.y } - , getOpen = function(d) { return d.open } - , getClose = function(d) { return d.close } - , getHigh = function(d) { return d.high } - , getLow = function(d) { return d.low } - , forceX = [] - , forceY = [] - , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart - , clipEdge = true - , color = nv.utils.defaultColor() - , interactive = false - , xDomain - , yDomain - , xRange - , yRange - , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState', 'renderEnd', 'chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout', 'elementMousemove') - ; - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - function chart(selection) { - selection.each(function(data) { - container = d3.select(this); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - nv.utils.initSVG(container); - - // Width of the candlestick bars. - var barWidth = (availableWidth / data[0].values.length) * .45; - - // Setup Scales - x.domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) )); - - if (padData) - x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); - else - x.range(xRange || [5 + barWidth / 2, availableWidth - barWidth / 2 - 5]); - - y.domain(yDomain || [ - d3.min(data[0].values.map(getLow).concat(forceY)), - d3.max(data[0].values.map(getHigh).concat(forceY)) - ] - ).range(yRange || [availableHeight, 0]); - - // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point - if (x.domain()[0] === x.domain()[1]) - x.domain()[0] ? - x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) - : x.domain([-1,1]); - - if (y.domain()[0] === y.domain()[1]) - y.domain()[0] ? - y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) - : y.domain([-1,1]); - - // Setup containers and skeleton of chart - var wrap = d3.select(this).selectAll('g.nv-wrap.nv-candlestickBar').data([data[0].values]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-candlestickBar'); - var defsEnter = wrapEnter.append('defs'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-ticks'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - container - .on('click', function(d,i) { - dispatch.chartClick({ - data: d, - index: i, - pos: d3.event, - id: id - }); - }); - - defsEnter.append('clipPath') - .attr('id', 'nv-chart-clip-path-' + id) - .append('rect'); - - wrap.select('#nv-chart-clip-path-' + id + ' rect') - .attr('width', availableWidth) - .attr('height', availableHeight); - - g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : ''); - - var ticks = wrap.select('.nv-ticks').selectAll('.nv-tick') - .data(function(d) { return d }); - ticks.exit().remove(); - - // The colors are currently controlled by CSS. - var tickGroups = ticks.enter().append('g') - .attr('class', function(d, i, j) { return (getOpen(d, i) > getClose(d, i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i}); - - var lines = tickGroups.append('line') - .attr('class', 'nv-candlestick-lines') - .attr('transform', function(d, i) { return 'translate(' + x(getX(d, i)) + ',0)'; }) - .attr('x1', 0) - .attr('y1', function(d, i) { return y(getHigh(d, i)); }) - .attr('x2', 0) - .attr('y2', function(d, i) { return y(getLow(d, i)); }); - - var rects = tickGroups.append('rect') - .attr('class', 'nv-candlestick-rects nv-bars') - .attr('transform', function(d, i) { - return 'translate(' + (x(getX(d, i)) - barWidth/2) + ',' - + (y(getY(d, i)) - (getOpen(d, i) > getClose(d, i) ? (y(getClose(d, i)) - y(getOpen(d, i))) : 0)) - + ')'; - }) - .attr('x', 0) - .attr('y', 0) - .attr('width', barWidth) - .attr('height', function(d, i) { - var open = getOpen(d, i); - var close = getClose(d, i); - return open > close ? y(close) - y(open) : y(open) - y(close); - }); - - container.selectAll('.nv-candlestick-lines').transition() - .attr('transform', function(d, i) { return 'translate(' + x(getX(d, i)) + ',0)'; }) - .attr('x1', 0) - .attr('y1', function(d, i) { return y(getHigh(d, i)); }) - .attr('x2', 0) - .attr('y2', function(d, i) { return y(getLow(d, i)); }); - - container.selectAll('.nv-candlestick-rects').transition() - .attr('transform', function(d, i) { - return 'translate(' + (x(getX(d, i)) - barWidth/2) + ',' - + (y(getY(d, i)) - (getOpen(d, i) > getClose(d, i) ? (y(getClose(d, i)) - y(getOpen(d, i))) : 0)) - + ')'; - }) - .attr('x', 0) - .attr('y', 0) - .attr('width', barWidth) - .attr('height', function(d, i) { - var open = getOpen(d, i); - var close = getClose(d, i); - return open > close ? y(close) - y(open) : y(open) - y(close); - }); - }); - - return chart; - } - - - //Create methods to allow outside functions to highlight a specific bar. - chart.highlightPoint = function(pointIndex, isHoverOver) { - chart.clearHighlights(); - container.select(".nv-candlestickBar .nv-tick-0-" + pointIndex) - .classed("hover", isHoverOver) - ; - }; - - chart.clearHighlights = function() { - container.select(".nv-candlestickBar .nv-tick.hover") - .classed("hover", false) - ; - }; - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - xScale: {get: function(){return x;}, set: function(_){x=_;}}, - yScale: {get: function(){return y;}, set: function(_){y=_;}}, - xDomain: {get: function(){return xDomain;}, set: function(_){xDomain=_;}}, - yDomain: {get: function(){return yDomain;}, set: function(_){yDomain=_;}}, - xRange: {get: function(){return xRange;}, set: function(_){xRange=_;}}, - yRange: {get: function(){return yRange;}, set: function(_){yRange=_;}}, - forceX: {get: function(){return forceX;}, set: function(_){forceX=_;}}, - forceY: {get: function(){return forceY;}, set: function(_){forceY=_;}}, - padData: {get: function(){return padData;}, set: function(_){padData=_;}}, - clipEdge: {get: function(){return clipEdge;}, set: function(_){clipEdge=_;}}, - id: {get: function(){return id;}, set: function(_){id=_;}}, - interactive: {get: function(){return interactive;}, set: function(_){interactive=_;}}, - - x: {get: function(){return getX;}, set: function(_){getX=_;}}, - y: {get: function(){return getY;}, set: function(_){getY=_;}}, - open: {get: function(){return getOpen();}, set: function(_){getOpen=_;}}, - close: {get: function(){return getClose();}, set: function(_){getClose=_;}}, - high: {get: function(){return getHigh;}, set: function(_){getHigh=_;}}, - low: {get: function(){return getLow;}, set: function(_){getLow=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top != undefined ? _.top : margin.top; - margin.right = _.right != undefined ? _.right : margin.right; - margin.bottom = _.bottom != undefined ? _.bottom : margin.bottom; - margin.left = _.left != undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }} - }); - - nv.utils.initOptions(chart); - return chart; -}; - -nv.models.cumulativeLineChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var lines = nv.models.line() - , xAxis = nv.models.axis() - , yAxis = nv.models.axis() - , legend = nv.models.legend() - , controls = nv.models.legend() - , interactiveLayer = nv.interactiveGuideline() - , tooltip = nv.models.tooltip() - ; - - var margin = {top: 30, right: 30, bottom: 50, left: 60} - , color = nv.utils.defaultColor() - , width = null - , height = null - , showLegend = true - , showXAxis = true - , showYAxis = true - , rightAlignYAxis = false - , showControls = true - , useInteractiveGuideline = false - , rescaleY = true - , x //can be accessed via chart.xScale() - , y //can be accessed via chart.yScale() - , id = lines.id() - , state = nv.utils.state() - , defaultState = null - , noData = null - , average = function(d) { return d.average } - , dispatch = d3.dispatch('stateChange', 'changeState', 'renderEnd') - , transitionDuration = 250 - , duration = 250 - , noErrorCheck = false //if set to TRUE, will bypass an error check in the indexify function. - ; - - state.index = 0; - state.rescaleY = rescaleY; - - xAxis.orient('bottom').tickPadding(7); - yAxis.orient((rightAlignYAxis) ? 'right' : 'left'); - - tooltip.valueFormatter(function(d, i) { - return yAxis.tickFormat()(d, i); - }).headerFormatter(function(d, i) { - return xAxis.tickFormat()(d, i); - }); - - controls.updateState(false); - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var dx = d3.scale.linear() - , index = {i: 0, x: 0} - , renderWatch = nv.utils.renderWatch(dispatch, duration) - ; - - var stateGetter = function(data) { - return function(){ - return { - active: data.map(function(d) { return !d.disabled }), - index: index.i, - rescaleY: rescaleY - }; - } - }; - - var stateSetter = function(data) { - return function(state) { - if (state.index !== undefined) - index.i = state.index; - if (state.rescaleY !== undefined) - rescaleY = state.rescaleY; - if (state.active !== undefined) - data.forEach(function(series,i) { - series.disabled = !state.active[i]; - }); - } - }; - - function chart(selection) { - renderWatch.reset(); - renderWatch.models(lines); - if (showXAxis) renderWatch.models(xAxis); - if (showYAxis) renderWatch.models(yAxis); - selection.each(function(data) { - var container = d3.select(this); - nv.utils.initSVG(container); - container.classed('nv-chart-' + id, true); - var that = this; - - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - chart.update = function() { - if (duration === 0) - container.call(chart); - else - container.transition().duration(duration).call(chart) - }; - chart.container = this; - - state - .setter(stateSetter(data), chart.update) - .getter(stateGetter(data)) - .update(); - - // DEPRECATED set state.disableddisabled - state.disabled = data.map(function(d) { return !!d.disabled }); - - if (!defaultState) { - var key; - defaultState = {}; - for (key in state) { - if (state[key] instanceof Array) - defaultState[key] = state[key].slice(0); - else - defaultState[key] = state[key]; - } - } - - var indexDrag = d3.behavior.drag() - .on('dragstart', dragStart) - .on('drag', dragMove) - .on('dragend', dragEnd); - - - function dragStart(d,i) { - d3.select(chart.container) - .style('cursor', 'ew-resize'); - } - - function dragMove(d,i) { - index.x = d3.event.x; - index.i = Math.round(dx.invert(index.x)); - updateZero(); - } - - function dragEnd(d,i) { - d3.select(chart.container) - .style('cursor', 'auto'); - - // update state and send stateChange with new index - state.index = index.i; - dispatch.stateChange(state); - } - - // Display No Data message if there's nothing to show. - if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { - nv.utils.noData(chart, container) - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - // Setup Scales - x = lines.xScale(); - y = lines.yScale(); - - if (!rescaleY) { - var seriesDomains = data - .filter(function(series) { return !series.disabled }) - .map(function(series,i) { - var initialDomain = d3.extent(series.values, lines.y()); - - //account for series being disabled when losing 95% or more - if (initialDomain[0] < -.95) initialDomain[0] = -.95; - - return [ - (initialDomain[0] - initialDomain[1]) / (1 + initialDomain[1]), - (initialDomain[1] - initialDomain[0]) / (1 + initialDomain[0]) - ]; - }); - - var completeDomain = [ - d3.min(seriesDomains, function(d) { return d[0] }), - d3.max(seriesDomains, function(d) { return d[1] }) - ]; - - lines.yDomain(completeDomain); - } else { - lines.yDomain(null); - } - - dx.domain([0, data[0].values.length - 1]) //Assumes all series have same length - .range([0, availableWidth]) - .clamp(true); - - var data = indexify(index.i, data); - - // Setup containers and skeleton of chart - var interactivePointerEvents = (useInteractiveGuideline) ? "none" : "all"; - var wrap = container.selectAll('g.nv-wrap.nv-cumulativeLine').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-cumulativeLine').append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-interactive'); - gEnter.append('g').attr('class', 'nv-x nv-axis').style("pointer-events","none"); - gEnter.append('g').attr('class', 'nv-y nv-axis'); - gEnter.append('g').attr('class', 'nv-background'); - gEnter.append('g').attr('class', 'nv-linesWrap').style("pointer-events",interactivePointerEvents); - gEnter.append('g').attr('class', 'nv-avgLinesWrap').style("pointer-events","none"); - gEnter.append('g').attr('class', 'nv-legendWrap'); - gEnter.append('g').attr('class', 'nv-controlsWrap'); - - // Legend - if (showLegend) { - legend.width(availableWidth); - - g.select('.nv-legendWrap') - .datum(data) - .call(legend); - - if ( margin.top != legend.height()) { - margin.top = legend.height(); - availableHeight = nv.utils.availableHeight(height, container, margin); - } - - g.select('.nv-legendWrap') - .attr('transform', 'translate(0,' + (-margin.top) +')') - } - - // Controls - if (showControls) { - var controlsData = [ - { key: 'Re-scale y-axis', disabled: !rescaleY } - ]; - - controls - .width(140) - .color(['#444', '#444', '#444']) - .rightAlign(false) - .margin({top: 5, right: 0, bottom: 5, left: 20}) - ; - - g.select('.nv-controlsWrap') - .datum(controlsData) - .attr('transform', 'translate(0,' + (-margin.top) +')') - .call(controls); - } - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - if (rightAlignYAxis) { - g.select(".nv-y.nv-axis") - .attr("transform", "translate(" + availableWidth + ",0)"); - } - - // Show error if series goes below 100% - var tempDisabled = data.filter(function(d) { return d.tempDisabled }); - - wrap.select('.tempDisabled').remove(); //clean-up and prevent duplicates - if (tempDisabled.length) { - wrap.append('text').attr('class', 'tempDisabled') - .attr('x', availableWidth / 2) - .attr('y', '-.71em') - .style('text-anchor', 'end') - .text(tempDisabled.map(function(d) { return d.key }).join(', ') + ' values cannot be calculated for this time period.'); - } - - //Set up interactive layer - if (useInteractiveGuideline) { - interactiveLayer - .width(availableWidth) - .height(availableHeight) - .margin({left:margin.left,top:margin.top}) - .svgContainer(container) - .xScale(x); - wrap.select(".nv-interactive").call(interactiveLayer); - } - - gEnter.select('.nv-background') - .append('rect'); - - g.select('.nv-background rect') - .attr('width', availableWidth) - .attr('height', availableHeight); - - lines - //.x(function(d) { return d.x }) - .y(function(d) { return d.display.y }) - .width(availableWidth) - .height(availableHeight) - .color(data.map(function(d,i) { - return d.color || color(d, i); - }).filter(function(d,i) { return !data[i].disabled && !data[i].tempDisabled; })); - - var linesWrap = g.select('.nv-linesWrap') - .datum(data.filter(function(d) { return !d.disabled && !d.tempDisabled })); - - linesWrap.call(lines); - - //Store a series index number in the data array. - data.forEach(function(d,i) { - d.seriesIndex = i; - }); - - var avgLineData = data.filter(function(d) { - return !d.disabled && !!average(d); - }); - - var avgLines = g.select(".nv-avgLinesWrap").selectAll("line") - .data(avgLineData, function(d) { return d.key; }); - - var getAvgLineY = function(d) { - //If average lines go off the svg element, clamp them to the svg bounds. - var yVal = y(average(d)); - if (yVal < 0) return 0; - if (yVal > availableHeight) return availableHeight; - return yVal; - }; - - avgLines.enter() - .append('line') - .style('stroke-width',2) - .style('stroke-dasharray','10,10') - .style('stroke',function (d,i) { - return lines.color()(d,d.seriesIndex); - }) - .attr('x1',0) - .attr('x2',availableWidth) - .attr('y1', getAvgLineY) - .attr('y2', getAvgLineY); - - avgLines - .style('stroke-opacity',function(d){ - //If average lines go offscreen, make them transparent - var yVal = y(average(d)); - if (yVal < 0 || yVal > availableHeight) return 0; - return 1; - }) - .attr('x1',0) - .attr('x2',availableWidth) - .attr('y1', getAvgLineY) - .attr('y2', getAvgLineY); - - avgLines.exit().remove(); - - //Create index line - var indexLine = linesWrap.selectAll('.nv-indexLine') - .data([index]); - indexLine.enter().append('rect').attr('class', 'nv-indexLine') - .attr('width', 3) - .attr('x', -2) - .attr('fill', 'red') - .attr('fill-opacity', .5) - .style("pointer-events","all") - .call(indexDrag); - - indexLine - .attr('transform', function(d) { return 'translate(' + dx(d.i) + ',0)' }) - .attr('height', availableHeight); - - // Setup Axes - if (showXAxis) { - xAxis - .scale(x) - ._ticks( nv.utils.calcTicksX(availableWidth/70, data) ) - .tickSize(-availableHeight, 0); - - g.select('.nv-x.nv-axis') - .attr('transform', 'translate(0,' + y.range()[0] + ')'); - g.select('.nv-x.nv-axis') - .call(xAxis); - } - - if (showYAxis) { - yAxis - .scale(y) - ._ticks( nv.utils.calcTicksY(availableHeight/36, data) ) - .tickSize( -availableWidth, 0); - - g.select('.nv-y.nv-axis') - .call(yAxis); - } - - //============================================================ - // Event Handling/Dispatching (in chart's scope) - //------------------------------------------------------------ - - function updateZero() { - indexLine - .data([index]); - - //When dragging the index line, turn off line transitions. - // Then turn them back on when done dragging. - var oldDuration = chart.duration(); - chart.duration(0); - chart.update(); - chart.duration(oldDuration); - } - - g.select('.nv-background rect') - .on('click', function() { - index.x = d3.mouse(this)[0]; - index.i = Math.round(dx.invert(index.x)); - - // update state and send stateChange with new index - state.index = index.i; - dispatch.stateChange(state); - - updateZero(); - }); - - lines.dispatch.on('elementClick', function(e) { - index.i = e.pointIndex; - index.x = dx(index.i); - - // update state and send stateChange with new index - state.index = index.i; - dispatch.stateChange(state); - - updateZero(); - }); - - controls.dispatch.on('legendClick', function(d,i) { - d.disabled = !d.disabled; - rescaleY = !d.disabled; - - state.rescaleY = rescaleY; - dispatch.stateChange(state); - chart.update(); - }); - - legend.dispatch.on('stateChange', function(newState) { - for (var key in newState) - state[key] = newState[key]; - dispatch.stateChange(state); - chart.update(); - }); - - interactiveLayer.dispatch.on('elementMousemove', function(e) { - lines.clearHighlights(); - var singlePoint, pointIndex, pointXLocation, allData = []; - - data - .filter(function(series, i) { - series.seriesIndex = i; - return !series.disabled; - }) - .forEach(function(series,i) { - pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x()); - lines.highlightPoint(i, pointIndex, true); - var point = series.values[pointIndex]; - if (typeof point === 'undefined') return; - if (typeof singlePoint === 'undefined') singlePoint = point; - if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex)); - allData.push({ - key: series.key, - value: chart.y()(point, pointIndex), - color: color(series,series.seriesIndex) - }); - }); - - //Highlight the tooltip entry based on which point the mouse is closest to. - if (allData.length > 2) { - var yValue = chart.yScale().invert(e.mouseY); - var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]); - var threshold = 0.03 * domainExtent; - var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold); - if (indexToHighlight !== null) - allData[indexToHighlight].highlight = true; - } - - var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex), pointIndex); - interactiveLayer.tooltip - .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top}) - .chartContainer(that.parentNode) - .valueFormatter(function(d,i) { - return yAxis.tickFormat()(d); - }) - .data( - { - value: xValue, - series: allData - } - )(); - - interactiveLayer.renderGuideLine(pointXLocation); - }); - - interactiveLayer.dispatch.on("elementMouseout",function(e) { - lines.clearHighlights(); - }); - - // Update chart from a state object passed to event handler - dispatch.on('changeState', function(e) { - if (typeof e.disabled !== 'undefined') { - data.forEach(function(series,i) { - series.disabled = e.disabled[i]; - }); - - state.disabled = e.disabled; - } - - if (typeof e.index !== 'undefined') { - index.i = e.index; - index.x = dx(index.i); - - state.index = e.index; - - indexLine - .data([index]); - } - - if (typeof e.rescaleY !== 'undefined') { - rescaleY = e.rescaleY; - } - - chart.update(); - }); - - }); - - renderWatch.renderEnd('cumulativeLineChart immediate'); - - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - lines.dispatch.on('elementMouseover.tooltip', function(evt) { - var point = { - x: chart.x()(evt.point), - y: chart.y()(evt.point), - color: evt.point.color - }; - evt.point = point; - tooltip.data(evt).position(evt.pos).hidden(false); - }); - - lines.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true) - }); - - //============================================================ - // Functions - //------------------------------------------------------------ - - var indexifyYGetter = null; - /* Normalize the data according to an index point. */ - function indexify(idx, data) { - if (!indexifyYGetter) indexifyYGetter = lines.y(); - return data.map(function(line, i) { - if (!line.values) { - return line; - } - var indexValue = line.values[idx]; - if (indexValue == null) { - return line; - } - var v = indexifyYGetter(indexValue, idx); - - //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue - if (v < -.95 && !noErrorCheck) { - //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100) - - line.tempDisabled = true; - return line; - } - - line.tempDisabled = false; - - line.values = line.values.map(function(point, pointIndex) { - point.display = {'y': (indexifyYGetter(point, pointIndex) - v) / (1 + v) }; - return point; - }); - - return line; - }) - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.dispatch = dispatch; - chart.lines = lines; - chart.legend = legend; - chart.controls = controls; - chart.xAxis = xAxis; - chart.yAxis = yAxis; - chart.interactiveLayer = interactiveLayer; - chart.state = state; - chart.tooltip = tooltip; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - rescaleY: {get: function(){return rescaleY;}, set: function(_){rescaleY=_;}}, - showControls: {get: function(){return showControls;}, set: function(_){showControls=_;}}, - showLegend: {get: function(){return showLegend;}, set: function(_){showLegend=_;}}, - average: {get: function(){return average;}, set: function(_){average=_;}}, - defaultState: {get: function(){return defaultState;}, set: function(_){defaultState=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - showXAxis: {get: function(){return showXAxis;}, set: function(_){showXAxis=_;}}, - showYAxis: {get: function(){return showYAxis;}, set: function(_){showYAxis=_;}}, - noErrorCheck: {get: function(){return noErrorCheck;}, set: function(_){noErrorCheck=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - legend.color(color); - }}, - useInteractiveGuideline: {get: function(){return useInteractiveGuideline;}, set: function(_){ - useInteractiveGuideline = _; - if (_ === true) { - chart.interactive(false); - chart.useVoronoi(false); - } - }}, - rightAlignYAxis: {get: function(){return rightAlignYAxis;}, set: function(_){ - rightAlignYAxis = _; - yAxis.orient( (_) ? 'right' : 'left'); - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - lines.duration(duration); - xAxis.duration(duration); - yAxis.duration(duration); - renderWatch.reset(duration); - }} - }); - - nv.utils.inheritOptions(chart, lines); - nv.utils.initOptions(chart); - - return chart; -}; -//TODO: consider deprecating by adding necessary features to multiBar model -nv.models.discreteBar = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = 960 - , height = 500 - , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one - , container - , x = d3.scale.ordinal() - , y = d3.scale.linear() - , getX = function(d) { return d.x } - , getY = function(d) { return d.y } - , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove - , color = nv.utils.defaultColor() - , showValues = false - , valueFormat = d3.format(',.2f') - , xDomain - , yDomain - , xRange - , yRange - , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout', 'elementMousemove', 'renderEnd') - , rectClass = 'discreteBar' - , duration = 250 - ; - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var x0, y0; - var renderWatch = nv.utils.renderWatch(dispatch, duration); - - function chart(selection) { - renderWatch.reset(); - selection.each(function(data) { - var availableWidth = width - margin.left - margin.right, - availableHeight = height - margin.top - margin.bottom; - - container = d3.select(this); - nv.utils.initSVG(container); - - //add series index to each data point for reference - data.forEach(function(series, i) { - series.values.forEach(function(point) { - point.series = i; - }); - }); - - // Setup Scales - // remap and flatten the data for use in calculating the scales' domains - var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate - data.map(function(d) { - return d.values.map(function(d,i) { - return { x: getX(d,i), y: getY(d,i), y0: d.y0 } - }) - }); - - x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x })) - .rangeBands(xRange || [0, availableWidth], .1); - y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y }).concat(forceY))); - - // If showValues, pad the Y axis range to account for label height - if (showValues) y.range(yRange || [availableHeight - (y.domain()[0] < 0 ? 12 : 0), y.domain()[1] > 0 ? 12 : 0]); - else y.range(yRange || [availableHeight, 0]); - - //store old scales if they exist - x0 = x0 || x; - y0 = y0 || y.copy().range([y(0),y(0)]); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-discretebar').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discretebar'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-groups'); - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - //TODO: by definition, the discrete bar should not have multiple groups, will modify/remove later - var groups = wrap.select('.nv-groups').selectAll('.nv-group') - .data(function(d) { return d }, function(d) { return d.key }); - groups.enter().append('g') - .style('stroke-opacity', 1e-6) - .style('fill-opacity', 1e-6); - groups.exit() - .watchTransition(renderWatch, 'discreteBar: exit groups') - .style('stroke-opacity', 1e-6) - .style('fill-opacity', 1e-6) - .remove(); - groups - .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) - .classed('hover', function(d) { return d.hover }); - groups - .watchTransition(renderWatch, 'discreteBar: groups') - .style('stroke-opacity', 1) - .style('fill-opacity', .75); - - var bars = groups.selectAll('g.nv-bar') - .data(function(d) { return d.values }); - bars.exit().remove(); - - var barsEnter = bars.enter().append('g') - .attr('transform', function(d,i,j) { - return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05 ) + ', ' + y(0) + ')' - }) - .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here - d3.select(this).classed('hover', true); - dispatch.elementMouseover({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - }) - .on('mouseout', function(d,i) { - d3.select(this).classed('hover', false); - dispatch.elementMouseout({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - }) - .on('mousemove', function(d,i) { - dispatch.elementMousemove({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - }) - .on('click', function(d,i) { - dispatch.elementClick({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - d3.event.stopPropagation(); - }) - .on('dblclick', function(d,i) { - dispatch.elementDblClick({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - d3.event.stopPropagation(); - }); - - barsEnter.append('rect') - .attr('height', 0) - .attr('width', x.rangeBand() * .9 / data.length ) - - if (showValues) { - barsEnter.append('text') - .attr('text-anchor', 'middle') - ; - - bars.select('text') - .text(function(d,i) { return valueFormat(getY(d,i)) }) - .watchTransition(renderWatch, 'discreteBar: bars text') - .attr('x', x.rangeBand() * .9 / 2) - .attr('y', function(d,i) { return getY(d,i) < 0 ? y(getY(d,i)) - y(0) + 12 : -4 }) - - ; - } else { - bars.selectAll('text').remove(); - } - - bars - .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive' }) - .style('fill', function(d,i) { return d.color || color(d,i) }) - .style('stroke', function(d,i) { return d.color || color(d,i) }) - .select('rect') - .attr('class', rectClass) - .watchTransition(renderWatch, 'discreteBar: bars rect') - .attr('width', x.rangeBand() * .9 / data.length); - bars.watchTransition(renderWatch, 'discreteBar: bars') - //.delay(function(d,i) { return i * 1200 / data[0].values.length }) - .attr('transform', function(d,i) { - var left = x(getX(d,i)) + x.rangeBand() * .05, - top = getY(d,i) < 0 ? - y(0) : - y(0) - y(getY(d,i)) < 1 ? - y(0) - 1 : //make 1 px positive bars show up above y=0 - y(getY(d,i)); - - return 'translate(' + left + ', ' + top + ')' - }) - .select('rect') - .attr('height', function(d,i) { - return Math.max(Math.abs(y(getY(d,i)) - y((yDomain && yDomain[0]) || 0)) || 1) - }); - - - //store old scales for use in transitions on update - x0 = x.copy(); - y0 = y.copy(); - - }); - - renderWatch.renderEnd('discreteBar immediate'); - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - forceY: {get: function(){return forceY;}, set: function(_){forceY=_;}}, - showValues: {get: function(){return showValues;}, set: function(_){showValues=_;}}, - x: {get: function(){return getX;}, set: function(_){getX=_;}}, - y: {get: function(){return getY;}, set: function(_){getY=_;}}, - xScale: {get: function(){return x;}, set: function(_){x=_;}}, - yScale: {get: function(){return y;}, set: function(_){y=_;}}, - xDomain: {get: function(){return xDomain;}, set: function(_){xDomain=_;}}, - yDomain: {get: function(){return yDomain;}, set: function(_){yDomain=_;}}, - xRange: {get: function(){return xRange;}, set: function(_){xRange=_;}}, - yRange: {get: function(){return yRange;}, set: function(_){yRange=_;}}, - valueFormat: {get: function(){return valueFormat;}, set: function(_){valueFormat=_;}}, - id: {get: function(){return id;}, set: function(_){id=_;}}, - rectClass: {get: function(){return rectClass;}, set: function(_){rectClass=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - }} - }); - - nv.utils.initOptions(chart); - - return chart; -}; - -nv.models.discreteBarChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var discretebar = nv.models.discreteBar() - , xAxis = nv.models.axis() - , yAxis = nv.models.axis() - , tooltip = nv.models.tooltip() - ; - - var margin = {top: 15, right: 10, bottom: 50, left: 60} - , width = null - , height = null - , color = nv.utils.getColor() - , showXAxis = true - , showYAxis = true - , rightAlignYAxis = false - , staggerLabels = false - , x - , y - , noData = null - , dispatch = d3.dispatch('beforeUpdate','renderEnd') - , duration = 250 - ; - - xAxis - .orient('bottom') - .showMaxMin(false) - .tickFormat(function(d) { return d }) - ; - yAxis - .orient((rightAlignYAxis) ? 'right' : 'left') - .tickFormat(d3.format(',.1f')) - ; - - tooltip - .duration(0) - .headerEnabled(false) - .valueFormatter(function(d, i) { - return yAxis.tickFormat()(d, i); - }) - .keyFormatter(function(d, i) { - return xAxis.tickFormat()(d, i); - }); - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var renderWatch = nv.utils.renderWatch(dispatch, duration); - - function chart(selection) { - renderWatch.reset(); - renderWatch.models(discretebar); - if (showXAxis) renderWatch.models(xAxis); - if (showYAxis) renderWatch.models(yAxis); - - selection.each(function(data) { - var container = d3.select(this), - that = this; - nv.utils.initSVG(container); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - chart.update = function() { - dispatch.beforeUpdate(); - container.transition().duration(duration).call(chart); - }; - chart.container = this; - - // Display No Data message if there's nothing to show. - if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { - nv.utils.noData(chart, container); - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - // Setup Scales - x = discretebar.xScale(); - y = discretebar.yScale().clamp(true); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-discreteBarWithAxes').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discreteBarWithAxes').append('g'); - var defsEnter = gEnter.append('defs'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-x nv-axis'); - gEnter.append('g').attr('class', 'nv-y nv-axis') - .append('g').attr('class', 'nv-zeroLine') - .append('line'); - - gEnter.append('g').attr('class', 'nv-barsWrap'); - - g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - if (rightAlignYAxis) { - g.select(".nv-y.nv-axis") - .attr("transform", "translate(" + availableWidth + ",0)"); - } - - // Main Chart Component(s) - discretebar - .width(availableWidth) - .height(availableHeight); - - var barsWrap = g.select('.nv-barsWrap') - .datum(data.filter(function(d) { return !d.disabled })); - - barsWrap.transition().call(discretebar); - - - defsEnter.append('clipPath') - .attr('id', 'nv-x-label-clip-' + discretebar.id()) - .append('rect'); - - g.select('#nv-x-label-clip-' + discretebar.id() + ' rect') - .attr('width', x.rangeBand() * (staggerLabels ? 2 : 1)) - .attr('height', 16) - .attr('x', -x.rangeBand() / (staggerLabels ? 1 : 2 )); - - // Setup Axes - if (showXAxis) { - xAxis - .scale(x) - ._ticks( nv.utils.calcTicksX(availableWidth/100, data) ) - .tickSize(-availableHeight, 0); - - g.select('.nv-x.nv-axis') - .attr('transform', 'translate(0,' + (y.range()[0] + ((discretebar.showValues() && y.domain()[0] < 0) ? 16 : 0)) + ')'); - g.select('.nv-x.nv-axis').call(xAxis); - - var xTicks = g.select('.nv-x.nv-axis').selectAll('g'); - if (staggerLabels) { - xTicks - .selectAll('text') - .attr('transform', function(d,i,j) { return 'translate(0,' + (j % 2 == 0 ? '5' : '17') + ')' }) - } - } - - if (showYAxis) { - yAxis - .scale(y) - ._ticks( nv.utils.calcTicksY(availableHeight/36, data) ) - .tickSize( -availableWidth, 0); - - g.select('.nv-y.nv-axis').call(yAxis); - } - - // Zero line - g.select(".nv-zeroLine line") - .attr("x1",0) - .attr("x2",availableWidth) - .attr("y1", y(0)) - .attr("y2", y(0)) - ; - }); - - renderWatch.renderEnd('discreteBar chart immediate'); - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - discretebar.dispatch.on('elementMouseover.tooltip', function(evt) { - evt['series'] = { - key: chart.x()(evt.data), - value: chart.y()(evt.data), - color: evt.color - }; - tooltip.data(evt).hidden(false); - }); - - discretebar.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true); - }); - - discretebar.dispatch.on('elementMousemove.tooltip', function(evt) { - tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); - }); - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.discretebar = discretebar; - chart.xAxis = xAxis; - chart.yAxis = yAxis; - chart.tooltip = tooltip; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - staggerLabels: {get: function(){return staggerLabels;}, set: function(_){staggerLabels=_;}}, - showXAxis: {get: function(){return showXAxis;}, set: function(_){showXAxis=_;}}, - showYAxis: {get: function(){return showYAxis;}, set: function(_){showYAxis=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - discretebar.duration(duration); - xAxis.duration(duration); - yAxis.duration(duration); - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - discretebar.color(color); - }}, - rightAlignYAxis: {get: function(){return rightAlignYAxis;}, set: function(_){ - rightAlignYAxis = _; - yAxis.orient( (_) ? 'right' : 'left'); - }} - }); - - nv.utils.inheritOptions(chart, discretebar); - nv.utils.initOptions(chart); - - return chart; -} - -nv.models.distribution = function() { - "use strict"; - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = 400 //technically width or height depending on x or y.... - , size = 8 - , axis = 'x' // 'x' or 'y'... horizontal or vertical - , getData = function(d) { return d[axis] } // defaults d.x or d.y - , color = nv.utils.defaultColor() - , scale = d3.scale.linear() - , domain - , duration = 250 - , dispatch = d3.dispatch('renderEnd') - ; - - //============================================================ - - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var scale0; - var renderWatch = nv.utils.renderWatch(dispatch, duration); - - //============================================================ - - - function chart(selection) { - renderWatch.reset(); - selection.each(function(data) { - var availableLength = width - (axis === 'x' ? margin.left + margin.right : margin.top + margin.bottom), - naxis = axis == 'x' ? 'y' : 'x', - container = d3.select(this); - nv.utils.initSVG(container); - - //------------------------------------------------------------ - // Setup Scales - - scale0 = scale0 || scale; - - //------------------------------------------------------------ - - - //------------------------------------------------------------ - // Setup containers and skeleton of chart - - var wrap = container.selectAll('g.nv-distribution').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-distribution'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')') - - //------------------------------------------------------------ - - - var distWrap = g.selectAll('g.nv-dist') - .data(function(d) { return d }, function(d) { return d.key }); - - distWrap.enter().append('g'); - distWrap - .attr('class', function(d,i) { return 'nv-dist nv-series-' + i }) - .style('stroke', function(d,i) { return color(d, i) }); - - var dist = distWrap.selectAll('line.nv-dist' + axis) - .data(function(d) { return d.values }) - dist.enter().append('line') - .attr(axis + '1', function(d,i) { return scale0(getData(d,i)) }) - .attr(axis + '2', function(d,i) { return scale0(getData(d,i)) }) - renderWatch.transition(distWrap.exit().selectAll('line.nv-dist' + axis), 'dist exit') - // .transition() - .attr(axis + '1', function(d,i) { return scale(getData(d,i)) }) - .attr(axis + '2', function(d,i) { return scale(getData(d,i)) }) - .style('stroke-opacity', 0) - .remove(); - dist - .attr('class', function(d,i) { return 'nv-dist' + axis + ' nv-dist' + axis + '-' + i }) - .attr(naxis + '1', 0) - .attr(naxis + '2', size); - renderWatch.transition(dist, 'dist') - // .transition() - .attr(axis + '1', function(d,i) { return scale(getData(d,i)) }) - .attr(axis + '2', function(d,i) { return scale(getData(d,i)) }) - - - scale0 = scale.copy(); - - }); - renderWatch.renderEnd('distribution immediate'); - return chart; - } - - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - chart.options = nv.utils.optionsFunc.bind(chart); - chart.dispatch = dispatch; - - chart.margin = function(_) { - if (!arguments.length) return margin; - margin.top = typeof _.top != 'undefined' ? _.top : margin.top; - margin.right = typeof _.right != 'undefined' ? _.right : margin.right; - margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; - margin.left = typeof _.left != 'undefined' ? _.left : margin.left; - return chart; - }; - - chart.width = function(_) { - if (!arguments.length) return width; - width = _; - return chart; - }; - - chart.axis = function(_) { - if (!arguments.length) return axis; - axis = _; - return chart; - }; - - chart.size = function(_) { - if (!arguments.length) return size; - size = _; - return chart; - }; - - chart.getData = function(_) { - if (!arguments.length) return getData; - getData = d3.functor(_); - return chart; - }; - - chart.scale = function(_) { - if (!arguments.length) return scale; - scale = _; - return chart; - }; - - chart.color = function(_) { - if (!arguments.length) return color; - color = nv.utils.getColor(_); - return chart; - }; - - chart.duration = function(_) { - if (!arguments.length) return duration; - duration = _; - renderWatch.reset(duration); - return chart; - }; - //============================================================ - - - return chart; -} -nv.models.furiousLegend = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 5, right: 0, bottom: 5, left: 0} - , width = 400 - , height = 20 - , getKey = function(d) { return d.key } - , color = nv.utils.getColor() - , align = true - , padding = 28 //define how much space between legend items. - recommend 32 for furious version - , rightAlign = true - , updateState = true //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. - , radioButtonMode = false //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at a time) - , expanded = false - , dispatch = d3.dispatch('legendClick', 'legendDblclick', 'legendMouseover', 'legendMouseout', 'stateChange') - , vers = 'classic' //Options are "classic" and "furious" - ; - - function chart(selection) { - selection.each(function(data) { - var availableWidth = width - margin.left - margin.right, - container = d3.select(this); - nv.utils.initSVG(container); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-legend').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-legend').append('g'); - var g = wrap.select('g'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - var series = g.selectAll('.nv-series') - .data(function(d) { - if(vers != 'furious') return d; - - return d.filter(function(n) { - return expanded ? true : !n.disengaged; - }); - }); - var seriesEnter = series.enter().append('g').attr('class', 'nv-series') - - var seriesShape; - - if(vers == 'classic') { - seriesEnter.append('circle') - .style('stroke-width', 2) - .attr('class','nv-legend-symbol') - .attr('r', 5); - - seriesShape = series.select('circle'); - } else if (vers == 'furious') { - seriesEnter.append('rect') - .style('stroke-width', 2) - .attr('class','nv-legend-symbol') - .attr('rx', 3) - .attr('ry', 3); - - seriesShape = series.select('rect'); - - seriesEnter.append('g') - .attr('class', 'nv-check-box') - .property('innerHTML','') - .attr('transform', 'translate(-10,-8)scale(0.5)'); - - var seriesCheckbox = series.select('.nv-check-box'); - - seriesCheckbox.each(function(d,i) { - d3.select(this).selectAll('path') - .attr('stroke', setTextColor(d,i)); - }); - } - - seriesEnter.append('text') - .attr('text-anchor', 'start') - .attr('class','nv-legend-text') - .attr('dy', '.32em') - .attr('dx', '8'); - - var seriesText = series.select('text.nv-legend-text'); - - series - .on('mouseover', function(d,i) { - dispatch.legendMouseover(d,i); //TODO: Make consistent with other event objects - }) - .on('mouseout', function(d,i) { - dispatch.legendMouseout(d,i); - }) - .on('click', function(d,i) { - dispatch.legendClick(d,i); - // make sure we re-get data in case it was modified - var data = series.data(); - if (updateState) { - if(vers =='classic') { - if (radioButtonMode) { - //Radio button mode: set every series to disabled, - // and enable the clicked series. - data.forEach(function(series) { series.disabled = true}); - d.disabled = false; - } - else { - d.disabled = !d.disabled; - if (data.every(function(series) { return series.disabled})) { - //the default behavior of NVD3 legends is, if every single series - // is disabled, turn all series' back on. - data.forEach(function(series) { series.disabled = false}); - } - } - } else if(vers == 'furious') { - if(expanded) { - d.disengaged = !d.disengaged; - d.userDisabled = d.userDisabled == undefined ? !!d.disabled : d.userDisabled; - d.disabled = d.disengaged || d.userDisabled; - } else if (!expanded) { - d.disabled = !d.disabled; - d.userDisabled = d.disabled; - var engaged = data.filter(function(d) { return !d.disengaged; }); - if (engaged.every(function(series) { return series.userDisabled })) { - //the default behavior of NVD3 legends is, if every single series - // is disabled, turn all series' back on. - data.forEach(function(series) { - series.disabled = series.userDisabled = false; - }); - } - } - } - dispatch.stateChange({ - disabled: data.map(function(d) { return !!d.disabled }), - disengaged: data.map(function(d) { return !!d.disengaged }) - }); - - } - }) - .on('dblclick', function(d,i) { - if(vers == 'furious' && expanded) return; - dispatch.legendDblclick(d,i); - if (updateState) { - // make sure we re-get data in case it was modified - var data = series.data(); - //the default behavior of NVD3 legends, when double clicking one, - // is to set all other series' to false, and make the double clicked series enabled. - data.forEach(function(series) { - series.disabled = true; - if(vers == 'furious') series.userDisabled = series.disabled; - }); - d.disabled = false; - if(vers == 'furious') d.userDisabled = d.disabled; - dispatch.stateChange({ - disabled: data.map(function(d) { return !!d.disabled }) - }); - } - }); - - series.classed('nv-disabled', function(d) { return d.userDisabled }); - series.exit().remove(); - - seriesText - .attr('fill', setTextColor) - .text(getKey); - - //TODO: implement fixed-width and max-width options (max-width is especially useful with the align option) - // NEW ALIGNING CODE, TODO: clean up - - var versPadding; - switch(vers) { - case 'furious' : - versPadding = 23; - break; - case 'classic' : - versPadding = 20; - } - - if (align) { - - var seriesWidths = []; - series.each(function(d,i) { - var legendText = d3.select(this).select('text'); - var nodeTextLength; - try { - nodeTextLength = legendText.node().getComputedTextLength(); - // If the legendText is display:none'd (nodeTextLength == 0), simulate an error so we approximate, instead - if(nodeTextLength <= 0) throw Error(); - } - catch(e) { - nodeTextLength = nv.utils.calcApproxTextWidth(legendText); - } - - seriesWidths.push(nodeTextLength + padding); - }); - - var seriesPerRow = 0; - var legendWidth = 0; - var columnWidths = []; - - while ( legendWidth < availableWidth && seriesPerRow < seriesWidths.length) { - columnWidths[seriesPerRow] = seriesWidths[seriesPerRow]; - legendWidth += seriesWidths[seriesPerRow++]; - } - if (seriesPerRow === 0) seriesPerRow = 1; //minimum of one series per row - - while ( legendWidth > availableWidth && seriesPerRow > 1 ) { - columnWidths = []; - seriesPerRow--; - - for (var k = 0; k < seriesWidths.length; k++) { - if (seriesWidths[k] > (columnWidths[k % seriesPerRow] || 0) ) - columnWidths[k % seriesPerRow] = seriesWidths[k]; - } - - legendWidth = columnWidths.reduce(function(prev, cur, index, array) { - return prev + cur; - }); - } - - var xPositions = []; - for (var i = 0, curX = 0; i < seriesPerRow; i++) { - xPositions[i] = curX; - curX += columnWidths[i]; - } - - series - .attr('transform', function(d, i) { - return 'translate(' + xPositions[i % seriesPerRow] + ',' + (5 + Math.floor(i / seriesPerRow) * versPadding) + ')'; - }); - - //position legend as far right as possible within the total width - if (rightAlign) { - g.attr('transform', 'translate(' + (width - margin.right - legendWidth) + ',' + margin.top + ')'); - } - else { - g.attr('transform', 'translate(0' + ',' + margin.top + ')'); - } - - height = margin.top + margin.bottom + (Math.ceil(seriesWidths.length / seriesPerRow) * versPadding); - - } else { - - var ypos = 5, - newxpos = 5, - maxwidth = 0, - xpos; - series - .attr('transform', function(d, i) { - var length = d3.select(this).select('text').node().getComputedTextLength() + padding; - xpos = newxpos; - - if (width < margin.left + margin.right + xpos + length) { - newxpos = xpos = 5; - ypos += versPadding; - } - - newxpos += length; - if (newxpos > maxwidth) maxwidth = newxpos; - - return 'translate(' + xpos + ',' + ypos + ')'; - }); - - //position legend as far right as possible within the total width - g.attr('transform', 'translate(' + (width - margin.right - maxwidth) + ',' + margin.top + ')'); - - height = margin.top + margin.bottom + ypos + 15; - } - - if(vers == 'furious') { - // Size rectangles after text is placed - seriesShape - .attr('width', function(d,i) { - return seriesText[0][i].getComputedTextLength() + 27; - }) - .attr('height', 18) - .attr('y', -9) - .attr('x', -15) - } - - seriesShape - .style('fill', setBGColor) - .style('stroke', function(d,i) { return d.color || color(d, i) }); - }); - - function setTextColor(d,i) { - if(vers != 'furious') return '#000'; - if(expanded) { - return d.disengaged ? color(d,i) : '#fff'; - } else if (!expanded) { - return !!d.disabled ? color(d,i) : '#fff'; - } - } - - function setBGColor(d,i) { - if(expanded && vers == 'furious') { - return d.disengaged ? '#fff' : color(d,i); - } else { - return !!d.disabled ? '#fff' : color(d,i); - } - } - - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - key: {get: function(){return getKey;}, set: function(_){getKey=_;}}, - align: {get: function(){return align;}, set: function(_){align=_;}}, - rightAlign: {get: function(){return rightAlign;}, set: function(_){rightAlign=_;}}, - padding: {get: function(){return padding;}, set: function(_){padding=_;}}, - updateState: {get: function(){return updateState;}, set: function(_){updateState=_;}}, - radioButtonMode: {get: function(){return radioButtonMode;}, set: function(_){radioButtonMode=_;}}, - expanded: {get: function(){return expanded;}, set: function(_){expanded=_;}}, - vers: {get: function(){return vers;}, set: function(_){vers=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }} - }); - - nv.utils.initOptions(chart); - - return chart; -}; -//TODO: consider deprecating and using multibar with single series for this -nv.models.historicalBar = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = null - , height = null - , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one - , container = null - , x = d3.scale.linear() - , y = d3.scale.linear() - , getX = function(d) { return d.x } - , getY = function(d) { return d.y } - , forceX = [] - , forceY = [0] - , padData = false - , clipEdge = true - , color = nv.utils.defaultColor() - , xDomain - , yDomain - , xRange - , yRange - , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout', 'elementMousemove', 'renderEnd') - , interactive = true - ; - - var renderWatch = nv.utils.renderWatch(dispatch, 0); - - function chart(selection) { - selection.each(function(data) { - renderWatch.reset(); - - container = d3.select(this); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - nv.utils.initSVG(container); - - // Setup Scales - x.domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) )); - - if (padData) - x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); - else - x.range(xRange || [0, availableWidth]); - - y.domain(yDomain || d3.extent(data[0].values.map(getY).concat(forceY) )) - .range(yRange || [availableHeight, 0]); - - // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point - if (x.domain()[0] === x.domain()[1]) - x.domain()[0] ? - x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) - : x.domain([-1,1]); - - if (y.domain()[0] === y.domain()[1]) - y.domain()[0] ? - y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) - : y.domain([-1,1]); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-historicalBar-' + id).data([data[0].values]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBar-' + id); - var defsEnter = wrapEnter.append('defs'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-bars'); - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - container - .on('click', function(d,i) { - dispatch.chartClick({ - data: d, - index: i, - pos: d3.event, - id: id - }); - }); - - defsEnter.append('clipPath') - .attr('id', 'nv-chart-clip-path-' + id) - .append('rect'); - - wrap.select('#nv-chart-clip-path-' + id + ' rect') - .attr('width', availableWidth) - .attr('height', availableHeight); - - g.attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : ''); - - var bars = wrap.select('.nv-bars').selectAll('.nv-bar') - .data(function(d) { return d }, function(d,i) {return getX(d,i)}); - bars.exit().remove(); - - bars.enter().append('rect') - .attr('x', 0 ) - .attr('y', function(d,i) { return nv.utils.NaNtoZero(y(Math.max(0, getY(d,i)))) }) - .attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.abs(y(getY(d,i)) - y(0))) }) - .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; }) - .on('mouseover', function(d,i) { - if (!interactive) return; - d3.select(this).classed('hover', true); - dispatch.elementMouseover({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - - }) - .on('mouseout', function(d,i) { - if (!interactive) return; - d3.select(this).classed('hover', false); - dispatch.elementMouseout({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - }) - .on('mousemove', function(d,i) { - if (!interactive) return; - dispatch.elementMousemove({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - }) - .on('click', function(d,i) { - if (!interactive) return; - dispatch.elementClick({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - d3.event.stopPropagation(); - }) - .on('dblclick', function(d,i) { - if (!interactive) return; - dispatch.elementDblClick({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - d3.event.stopPropagation(); - }); - - bars - .attr('fill', function(d,i) { return color(d, i); }) - .attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i }) - .watchTransition(renderWatch, 'bars') - .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; }) - //TODO: better width calculations that don't assume always uniform data spacing;w - .attr('width', (availableWidth / data[0].values.length) * .9 ); - - bars.watchTransition(renderWatch, 'bars') - .attr('y', function(d,i) { - var rval = getY(d,i) < 0 ? - y(0) : - y(0) - y(getY(d,i)) < 1 ? - y(0) - 1 : - y(getY(d,i)); - return nv.utils.NaNtoZero(rval); - }) - .attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.max(Math.abs(y(getY(d,i)) - y(0)),1)) }); - - }); - - renderWatch.renderEnd('historicalBar immediate'); - return chart; - } - - //Create methods to allow outside functions to highlight a specific bar. - chart.highlightPoint = function(pointIndex, isHoverOver) { - container - .select(".nv-bars .nv-bar-0-" + pointIndex) - .classed("hover", isHoverOver) - ; - }; - - chart.clearHighlights = function() { - container - .select(".nv-bars .nv-bar.hover") - .classed("hover", false) - ; - }; - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - forceX: {get: function(){return forceX;}, set: function(_){forceX=_;}}, - forceY: {get: function(){return forceY;}, set: function(_){forceY=_;}}, - padData: {get: function(){return padData;}, set: function(_){padData=_;}}, - x: {get: function(){return getX;}, set: function(_){getX=_;}}, - y: {get: function(){return getY;}, set: function(_){getY=_;}}, - xScale: {get: function(){return x;}, set: function(_){x=_;}}, - yScale: {get: function(){return y;}, set: function(_){y=_;}}, - xDomain: {get: function(){return xDomain;}, set: function(_){xDomain=_;}}, - yDomain: {get: function(){return yDomain;}, set: function(_){yDomain=_;}}, - xRange: {get: function(){return xRange;}, set: function(_){xRange=_;}}, - yRange: {get: function(){return yRange;}, set: function(_){yRange=_;}}, - clipEdge: {get: function(){return clipEdge;}, set: function(_){clipEdge=_;}}, - id: {get: function(){return id;}, set: function(_){id=_;}}, - interactive: {get: function(){return interactive;}, set: function(_){interactive=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }} - }); - - nv.utils.initOptions(chart); - - return chart; -}; - -nv.models.historicalBarChart = function(bar_model) { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var bars = bar_model || nv.models.historicalBar() - , xAxis = nv.models.axis() - , yAxis = nv.models.axis() - , legend = nv.models.legend() - , interactiveLayer = nv.interactiveGuideline() - , tooltip = nv.models.tooltip() - ; - - - var margin = {top: 30, right: 90, bottom: 50, left: 90} - , color = nv.utils.defaultColor() - , width = null - , height = null - , showLegend = false - , showXAxis = true - , showYAxis = true - , rightAlignYAxis = false - , useInteractiveGuideline = false - , x - , y - , state = {} - , defaultState = null - , noData = null - , dispatch = d3.dispatch('tooltipHide', 'stateChange', 'changeState', 'renderEnd') - , transitionDuration = 250 - ; - - xAxis.orient('bottom').tickPadding(7); - yAxis.orient( (rightAlignYAxis) ? 'right' : 'left'); - tooltip - .duration(0) - .headerEnabled(false) - .valueFormatter(function(d, i) { - return yAxis.tickFormat()(d, i); - }) - .headerFormatter(function(d, i) { - return xAxis.tickFormat()(d, i); - }); - - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var renderWatch = nv.utils.renderWatch(dispatch, 0); - - function chart(selection) { - selection.each(function(data) { - renderWatch.reset(); - renderWatch.models(bars); - if (showXAxis) renderWatch.models(xAxis); - if (showYAxis) renderWatch.models(yAxis); - - var container = d3.select(this), - that = this; - nv.utils.initSVG(container); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; - chart.container = this; - - //set state.disabled - state.disabled = data.map(function(d) { return !!d.disabled }); - - if (!defaultState) { - var key; - defaultState = {}; - for (key in state) { - if (state[key] instanceof Array) - defaultState[key] = state[key].slice(0); - else - defaultState[key] = state[key]; - } - } - - // Display noData message if there's nothing to show. - if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { - nv.utils.noData(chart, container) - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - // Setup Scales - x = bars.xScale(); - y = bars.yScale(); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-historicalBarChart').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBarChart').append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-x nv-axis'); - gEnter.append('g').attr('class', 'nv-y nv-axis'); - gEnter.append('g').attr('class', 'nv-barsWrap'); - gEnter.append('g').attr('class', 'nv-legendWrap'); - gEnter.append('g').attr('class', 'nv-interactive'); - - // Legend - if (showLegend) { - legend.width(availableWidth); - - g.select('.nv-legendWrap') - .datum(data) - .call(legend); - - if ( margin.top != legend.height()) { - margin.top = legend.height(); - availableHeight = nv.utils.availableHeight(height, container, margin); - } - - wrap.select('.nv-legendWrap') - .attr('transform', 'translate(0,' + (-margin.top) +')') - } - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - if (rightAlignYAxis) { - g.select(".nv-y.nv-axis") - .attr("transform", "translate(" + availableWidth + ",0)"); - } - - //Set up interactive layer - if (useInteractiveGuideline) { - interactiveLayer - .width(availableWidth) - .height(availableHeight) - .margin({left:margin.left, top:margin.top}) - .svgContainer(container) - .xScale(x); - wrap.select(".nv-interactive").call(interactiveLayer); - } - bars - .width(availableWidth) - .height(availableHeight) - .color(data.map(function(d,i) { - return d.color || color(d, i); - }).filter(function(d,i) { return !data[i].disabled })); - - var barsWrap = g.select('.nv-barsWrap') - .datum(data.filter(function(d) { return !d.disabled })); - barsWrap.transition().call(bars); - - // Setup Axes - if (showXAxis) { - xAxis - .scale(x) - ._ticks( nv.utils.calcTicksX(availableWidth/100, data) ) - .tickSize(-availableHeight, 0); - - g.select('.nv-x.nv-axis') - .attr('transform', 'translate(0,' + y.range()[0] + ')'); - g.select('.nv-x.nv-axis') - .transition() - .call(xAxis); - } - - if (showYAxis) { - yAxis - .scale(y) - ._ticks( nv.utils.calcTicksY(availableHeight/36, data) ) - .tickSize( -availableWidth, 0); - - g.select('.nv-y.nv-axis') - .transition() - .call(yAxis); - } - - //============================================================ - // Event Handling/Dispatching (in chart's scope) - //------------------------------------------------------------ - - interactiveLayer.dispatch.on('elementMousemove', function(e) { - bars.clearHighlights(); - - var singlePoint, pointIndex, pointXLocation, allData = []; - data - .filter(function(series, i) { - series.seriesIndex = i; - return !series.disabled; - }) - .forEach(function(series,i) { - pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x()); - bars.highlightPoint(pointIndex,true); - var point = series.values[pointIndex]; - if (point === undefined) return; - if (singlePoint === undefined) singlePoint = point; - if (pointXLocation === undefined) pointXLocation = chart.xScale()(chart.x()(point,pointIndex)); - allData.push({ - key: series.key, - value: chart.y()(point, pointIndex), - color: color(series,series.seriesIndex), - data: series.values[pointIndex] - }); - }); - - var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex)); - interactiveLayer.tooltip - .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top}) - .chartContainer(that.parentNode) - .valueFormatter(function(d,i) { - return yAxis.tickFormat()(d); - }) - .data({ - value: xValue, - index: pointIndex, - series: allData - })(); - - interactiveLayer.renderGuideLine(pointXLocation); - - }); - - interactiveLayer.dispatch.on("elementMouseout",function(e) { - dispatch.tooltipHide(); - bars.clearHighlights(); - }); - - legend.dispatch.on('legendClick', function(d,i) { - d.disabled = !d.disabled; - - if (!data.filter(function(d) { return !d.disabled }).length) { - data.map(function(d) { - d.disabled = false; - wrap.selectAll('.nv-series').classed('disabled', false); - return d; - }); - } - - state.disabled = data.map(function(d) { return !!d.disabled }); - dispatch.stateChange(state); - - selection.transition().call(chart); - }); - - legend.dispatch.on('legendDblclick', function(d) { - //Double clicking should always enable current series, and disabled all others. - data.forEach(function(d) { - d.disabled = true; - }); - d.disabled = false; - - state.disabled = data.map(function(d) { return !!d.disabled }); - dispatch.stateChange(state); - chart.update(); - }); - - dispatch.on('changeState', function(e) { - if (typeof e.disabled !== 'undefined') { - data.forEach(function(series,i) { - series.disabled = e.disabled[i]; - }); - - state.disabled = e.disabled; - } - - chart.update(); - }); - }); - - renderWatch.renderEnd('historicalBarChart immediate'); - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - bars.dispatch.on('elementMouseover.tooltip', function(evt) { - evt['series'] = { - key: chart.x()(evt.data), - value: chart.y()(evt.data), - color: evt.color - }; - tooltip.data(evt).hidden(false); - }); - - bars.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true); - }); - - bars.dispatch.on('elementMousemove.tooltip', function(evt) { - tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); - }); - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.dispatch = dispatch; - chart.bars = bars; - chart.legend = legend; - chart.xAxis = xAxis; - chart.yAxis = yAxis; - chart.interactiveLayer = interactiveLayer; - chart.tooltip = tooltip; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - showLegend: {get: function(){return showLegend;}, set: function(_){showLegend=_;}}, - showXAxis: {get: function(){return showXAxis;}, set: function(_){showXAxis=_;}}, - showYAxis: {get: function(){return showYAxis;}, set: function(_){showYAxis=_;}}, - defaultState: {get: function(){return defaultState;}, set: function(_){defaultState=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - legend.color(color); - bars.color(color); - }}, - duration: {get: function(){return transitionDuration;}, set: function(_){ - transitionDuration=_; - renderWatch.reset(transitionDuration); - yAxis.duration(transitionDuration); - xAxis.duration(transitionDuration); - }}, - rightAlignYAxis: {get: function(){return rightAlignYAxis;}, set: function(_){ - rightAlignYAxis = _; - yAxis.orient( (_) ? 'right' : 'left'); - }}, - useInteractiveGuideline: {get: function(){return useInteractiveGuideline;}, set: function(_){ - useInteractiveGuideline = _; - if (_ === true) { - chart.interactive(false); - } - }} - }); - - nv.utils.inheritOptions(chart, bars); - nv.utils.initOptions(chart); - - return chart; -}; - - -// ohlcChart is just a historical chart with ohlc bars and some tweaks -nv.models.ohlcBarChart = function() { - var chart = nv.models.historicalBarChart(nv.models.ohlcBar()); - - // special default tooltip since we show multiple values per x - chart.useInteractiveGuideline(true); - chart.interactiveLayer.tooltip.contentGenerator(function(data) { - // we assume only one series exists for this chart - var d = data.series[0].data; - // match line colors as defined in nv.d3.css - var color = d.open < d.close ? "2ca02c" : "d62728"; - return '' + - '

    ' + data.value + '

    ' + - '' + - '' + - '' + - '' + - '' + - '
    open:' + chart.yAxis.tickFormat()(d.open) + '
    close:' + chart.yAxis.tickFormat()(d.close) + '
    high' + chart.yAxis.tickFormat()(d.high) + '
    low:' + chart.yAxis.tickFormat()(d.low) + '
    '; - }); - return chart; -}; - -// candlestickChart is just a historical chart with candlestick bars and some tweaks -nv.models.candlestickBarChart = function() { - var chart = nv.models.historicalBarChart(nv.models.candlestickBar()); - - // special default tooltip since we show multiple values per x - chart.useInteractiveGuideline(true); - chart.interactiveLayer.tooltip.contentGenerator(function(data) { - // we assume only one series exists for this chart - var d = data.series[0].data; - // match line colors as defined in nv.d3.css - var color = d.open < d.close ? "2ca02c" : "d62728"; - return '' + - '

    ' + data.value + '

    ' + - '' + - '' + - '' + - '' + - '' + - '
    open:' + chart.yAxis.tickFormat()(d.open) + '
    close:' + chart.yAxis.tickFormat()(d.close) + '
    high' + chart.yAxis.tickFormat()(d.high) + '
    low:' + chart.yAxis.tickFormat()(d.low) + '
    '; - }); - return chart; -}; -nv.models.legend = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 5, right: 0, bottom: 5, left: 0} - , width = 400 - , height = 20 - , getKey = function(d) { return d.key } - , color = nv.utils.getColor() - , align = true - , padding = 32 //define how much space between legend items. - recommend 32 for furious version - , rightAlign = true - , updateState = true //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. - , radioButtonMode = false //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at a time) - , expanded = false - , dispatch = d3.dispatch('legendClick', 'legendDblclick', 'legendMouseover', 'legendMouseout', 'stateChange') - , vers = 'classic' //Options are "classic" and "furious" - ; - - function chart(selection) { - selection.each(function(data) { - var availableWidth = width - margin.left - margin.right, - container = d3.select(this); - nv.utils.initSVG(container); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-legend').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-legend').append('g'); - var g = wrap.select('g'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - var series = g.selectAll('.nv-series') - .data(function(d) { - if(vers != 'furious') return d; - - return d.filter(function(n) { - return expanded ? true : !n.disengaged; - }); - }); - - var seriesEnter = series.enter().append('g').attr('class', 'nv-series'); - var seriesShape; - - var versPadding; - switch(vers) { - case 'furious' : - versPadding = 23; - break; - case 'classic' : - versPadding = 20; - } - - if(vers == 'classic') { - seriesEnter.append('circle') - .style('stroke-width', 2) - .attr('class','nv-legend-symbol') - .attr('r', 5); - - seriesShape = series.select('circle'); - } else if (vers == 'furious') { - seriesEnter.append('rect') - .style('stroke-width', 2) - .attr('class','nv-legend-symbol') - .attr('rx', 3) - .attr('ry', 3); - - seriesShape = series.select('.nv-legend-symbol'); - - seriesEnter.append('g') - .attr('class', 'nv-check-box') - .property('innerHTML','') - .attr('transform', 'translate(-10,-8)scale(0.5)'); - - var seriesCheckbox = series.select('.nv-check-box'); - - seriesCheckbox.each(function(d,i) { - d3.select(this).selectAll('path') - .attr('stroke', setTextColor(d,i)); - }); - } - - seriesEnter.append('text') - .attr('text-anchor', 'start') - .attr('class','nv-legend-text') - .attr('dy', '.32em') - .attr('dx', '8'); - - var seriesText = series.select('text.nv-legend-text'); - - series - .on('mouseover', function(d,i) { - dispatch.legendMouseover(d,i); //TODO: Make consistent with other event objects - }) - .on('mouseout', function(d,i) { - dispatch.legendMouseout(d,i); - }) - .on('click', function(d,i) { - dispatch.legendClick(d,i); - // make sure we re-get data in case it was modified - var data = series.data(); - if (updateState) { - if(vers =='classic') { - if (radioButtonMode) { - //Radio button mode: set every series to disabled, - // and enable the clicked series. - data.forEach(function(series) { series.disabled = true}); - d.disabled = false; - } - else { - d.disabled = !d.disabled; - if (data.every(function(series) { return series.disabled})) { - //the default behavior of NVD3 legends is, if every single series - // is disabled, turn all series' back on. - data.forEach(function(series) { series.disabled = false}); - } - } - } else if(vers == 'furious') { - if(expanded) { - d.disengaged = !d.disengaged; - d.userDisabled = d.userDisabled == undefined ? !!d.disabled : d.userDisabled; - d.disabled = d.disengaged || d.userDisabled; - } else if (!expanded) { - d.disabled = !d.disabled; - d.userDisabled = d.disabled; - var engaged = data.filter(function(d) { return !d.disengaged; }); - if (engaged.every(function(series) { return series.userDisabled })) { - //the default behavior of NVD3 legends is, if every single series - // is disabled, turn all series' back on. - data.forEach(function(series) { - series.disabled = series.userDisabled = false; - }); - } - } - } - dispatch.stateChange({ - disabled: data.map(function(d) { return !!d.disabled }), - disengaged: data.map(function(d) { return !!d.disengaged }) - }); - - } - }) - .on('dblclick', function(d,i) { - if(vers == 'furious' && expanded) return; - dispatch.legendDblclick(d,i); - if (updateState) { - // make sure we re-get data in case it was modified - var data = series.data(); - //the default behavior of NVD3 legends, when double clicking one, - // is to set all other series' to false, and make the double clicked series enabled. - data.forEach(function(series) { - series.disabled = true; - if(vers == 'furious') series.userDisabled = series.disabled; - }); - d.disabled = false; - if(vers == 'furious') d.userDisabled = d.disabled; - dispatch.stateChange({ - disabled: data.map(function(d) { return !!d.disabled }) - }); - } - }); - - series.classed('nv-disabled', function(d) { return d.userDisabled }); - series.exit().remove(); - - seriesText - .attr('fill', setTextColor) - .text(getKey); - - //TODO: implement fixed-width and max-width options (max-width is especially useful with the align option) - // NEW ALIGNING CODE, TODO: clean up - var legendWidth = 0; - if (align) { - - var seriesWidths = []; - series.each(function(d,i) { - var legendText = d3.select(this).select('text'); - var nodeTextLength; - try { - nodeTextLength = legendText.node().getComputedTextLength(); - // If the legendText is display:none'd (nodeTextLength == 0), simulate an error so we approximate, instead - if(nodeTextLength <= 0) throw Error(); - } - catch(e) { - nodeTextLength = nv.utils.calcApproxTextWidth(legendText); - } - - seriesWidths.push(nodeTextLength + padding); - }); - - var seriesPerRow = 0; - var columnWidths = []; - legendWidth = 0; - - while ( legendWidth < availableWidth && seriesPerRow < seriesWidths.length) { - columnWidths[seriesPerRow] = seriesWidths[seriesPerRow]; - legendWidth += seriesWidths[seriesPerRow++]; - } - if (seriesPerRow === 0) seriesPerRow = 1; //minimum of one series per row - - while ( legendWidth > availableWidth && seriesPerRow > 1 ) { - columnWidths = []; - seriesPerRow--; - - for (var k = 0; k < seriesWidths.length; k++) { - if (seriesWidths[k] > (columnWidths[k % seriesPerRow] || 0) ) - columnWidths[k % seriesPerRow] = seriesWidths[k]; - } - - legendWidth = columnWidths.reduce(function(prev, cur, index, array) { - return prev + cur; - }); - } - - var xPositions = []; - for (var i = 0, curX = 0; i < seriesPerRow; i++) { - xPositions[i] = curX; - curX += columnWidths[i]; - } - - series - .attr('transform', function(d, i) { - return 'translate(' + xPositions[i % seriesPerRow] + ',' + (5 + Math.floor(i / seriesPerRow) * versPadding) + ')'; - }); - - //position legend as far right as possible within the total width - if (rightAlign) { - g.attr('transform', 'translate(' + (width - margin.right - legendWidth) + ',' + margin.top + ')'); - } - else { - g.attr('transform', 'translate(0' + ',' + margin.top + ')'); - } - - height = margin.top + margin.bottom + (Math.ceil(seriesWidths.length / seriesPerRow) * versPadding); - - } else { - - var ypos = 5, - newxpos = 5, - maxwidth = 0, - xpos; - series - .attr('transform', function(d, i) { - var length = d3.select(this).select('text').node().getComputedTextLength() + padding; - xpos = newxpos; - - if (width < margin.left + margin.right + xpos + length) { - newxpos = xpos = 5; - ypos += versPadding; - } - - newxpos += length; - if (newxpos > maxwidth) maxwidth = newxpos; - - if(legendWidth < xpos + maxwidth) { - legendWidth = xpos + maxwidth; - } - return 'translate(' + xpos + ',' + ypos + ')'; - }); - - //position legend as far right as possible within the total width - g.attr('transform', 'translate(' + (width - margin.right - maxwidth) + ',' + margin.top + ')'); - - height = margin.top + margin.bottom + ypos + 15; - } - - if(vers == 'furious') { - // Size rectangles after text is placed - seriesShape - .attr('width', function(d,i) { - return seriesText[0][i].getComputedTextLength() + 27; - }) - .attr('height', 18) - .attr('y', -9) - .attr('x', -15); - - // The background for the expanded legend (UI) - gEnter.insert('rect',':first-child') - .attr('class', 'nv-legend-bg') - .attr('fill', '#eee') - // .attr('stroke', '#444') - .attr('opacity',0); - - var seriesBG = g.select('.nv-legend-bg'); - - seriesBG - .transition().duration(300) - .attr('x', -versPadding ) - .attr('width', legendWidth + versPadding - 12) - .attr('height', height + 10) - .attr('y', -margin.top - 10) - .attr('opacity', expanded ? 1 : 0); - - - } - - seriesShape - .style('fill', setBGColor) - .style('fill-opacity', setBGOpacity) - .style('stroke', setBGColor); - }); - - function setTextColor(d,i) { - if(vers != 'furious') return '#000'; - if(expanded) { - return d.disengaged ? '#000' : '#fff'; - } else if (!expanded) { - if(!d.color) d.color = color(d,i); - return !!d.disabled ? d.color : '#fff'; - } - } - - function setBGColor(d,i) { - if(expanded && vers == 'furious') { - return d.disengaged ? '#eee' : d.color || color(d,i); - } else { - return d.color || color(d,i); - } - } - - - function setBGOpacity(d,i) { - if(expanded && vers == 'furious') { - return 1; - } else { - return !!d.disabled ? 0 : 1; - } - } - - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - key: {get: function(){return getKey;}, set: function(_){getKey=_;}}, - align: {get: function(){return align;}, set: function(_){align=_;}}, - rightAlign: {get: function(){return rightAlign;}, set: function(_){rightAlign=_;}}, - padding: {get: function(){return padding;}, set: function(_){padding=_;}}, - updateState: {get: function(){return updateState;}, set: function(_){updateState=_;}}, - radioButtonMode: {get: function(){return radioButtonMode;}, set: function(_){radioButtonMode=_;}}, - expanded: {get: function(){return expanded;}, set: function(_){expanded=_;}}, - vers: {get: function(){return vers;}, set: function(_){vers=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }} - }); - - nv.utils.initOptions(chart); - - return chart; -}; - -nv.models.line = function() { - "use strict"; - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var scatter = nv.models.scatter() - ; - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = 960 - , height = 500 - , container = null - , strokeWidth = 1.5 - , color = nv.utils.defaultColor() // a function that returns a color - , getX = function(d) { return d.x } // accessor to get the x value from a data point - , getY = function(d) { return d.y } // accessor to get the y value from a data point - , defined = function(d,i) { return !isNaN(getY(d,i)) && getY(d,i) !== null } // allows a line to be not continuous when it is not defined - , isArea = function(d) { return d.area } // decides if a line is an area or just a line - , clipEdge = false // if true, masks lines within x and y scale - , x //can be accessed via chart.xScale() - , y //can be accessed via chart.yScale() - , interpolate = "linear" // controls the line interpolation - , duration = 250 - , dispatch = d3.dispatch('elementClick', 'elementMouseover', 'elementMouseout', 'renderEnd') - ; - - scatter - .pointSize(16) // default size - .pointDomain([16,256]) //set to speed up calculation, needs to be unset if there is a custom size accessor - ; - - //============================================================ - - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var x0, y0 //used to store previous scales - , renderWatch = nv.utils.renderWatch(dispatch, duration) - ; - - //============================================================ - - - function chart(selection) { - renderWatch.reset(); - renderWatch.models(scatter); - selection.each(function(data) { - container = d3.select(this); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - nv.utils.initSVG(container); - - // Setup Scales - x = scatter.xScale(); - y = scatter.yScale(); - - x0 = x0 || x; - y0 = y0 || y; - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-line').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line'); - var defsEnter = wrapEnter.append('defs'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-groups'); - gEnter.append('g').attr('class', 'nv-scatterWrap'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - scatter - .width(availableWidth) - .height(availableHeight); - - var scatterWrap = wrap.select('.nv-scatterWrap'); - scatterWrap.call(scatter); - - defsEnter.append('clipPath') - .attr('id', 'nv-edge-clip-' + scatter.id()) - .append('rect'); - - wrap.select('#nv-edge-clip-' + scatter.id() + ' rect') - .attr('width', availableWidth) - .attr('height', (availableHeight > 0) ? availableHeight : 0); - - g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : ''); - scatterWrap - .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : ''); - - var groups = wrap.select('.nv-groups').selectAll('.nv-group') - .data(function(d) { return d }, function(d) { return d.key }); - groups.enter().append('g') - .style('stroke-opacity', 1e-6) - .style('stroke-width', function(d) { return d.strokeWidth || strokeWidth }) - .style('fill-opacity', 1e-6); - - groups.exit().remove(); - - groups - .attr('class', function(d,i) { - return (d.classed || '') + ' nv-group nv-series-' + i; - }) - .classed('hover', function(d) { return d.hover }) - .style('fill', function(d,i){ return color(d, i) }) - .style('stroke', function(d,i){ return color(d, i)}); - groups.watchTransition(renderWatch, 'line: groups') - .style('stroke-opacity', 1) - .style('fill-opacity', function(d) { return d.fillOpacity || .5}); - - var areaPaths = groups.selectAll('path.nv-area') - .data(function(d) { return isArea(d) ? [d] : [] }); // this is done differently than lines because I need to check if series is an area - areaPaths.enter().append('path') - .attr('class', 'nv-area') - .attr('d', function(d) { - return d3.svg.area() - .interpolate(interpolate) - .defined(defined) - .x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) }) - .y0(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) }) - .y1(function(d,i) { return y0( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) }) - //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this - .apply(this, [d.values]) - }); - groups.exit().selectAll('path.nv-area') - .remove(); - - areaPaths.watchTransition(renderWatch, 'line: areaPaths') - .attr('d', function(d) { - return d3.svg.area() - .interpolate(interpolate) - .defined(defined) - .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) }) - .y0(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) }) - .y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) }) - //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this - .apply(this, [d.values]) - }); - - var linePaths = groups.selectAll('path.nv-line') - .data(function(d) { return [d.values] }); - - linePaths.enter().append('path') - .attr('class', 'nv-line') - .attr('d', - d3.svg.line() - .interpolate(interpolate) - .defined(defined) - .x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) }) - .y(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) }) - ); - - linePaths.watchTransition(renderWatch, 'line: linePaths') - .attr('d', - d3.svg.line() - .interpolate(interpolate) - .defined(defined) - .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) }) - .y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) }) - ); - - //store old scales for use in transitions on update - x0 = x.copy(); - y0 = y.copy(); - }); - renderWatch.renderEnd('line immediate'); - return chart; - } - - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.scatter = scatter; - // Pass through events - scatter.dispatch.on('elementClick', function(){ dispatch.elementClick.apply(this, arguments); }); - scatter.dispatch.on('elementMouseover', function(){ dispatch.elementMouseover.apply(this, arguments); }); - scatter.dispatch.on('elementMouseout', function(){ dispatch.elementMouseout.apply(this, arguments); }); - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - defined: {get: function(){return defined;}, set: function(_){defined=_;}}, - interpolate: {get: function(){return interpolate;}, set: function(_){interpolate=_;}}, - clipEdge: {get: function(){return clipEdge;}, set: function(_){clipEdge=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - scatter.duration(duration); - }}, - isArea: {get: function(){return isArea;}, set: function(_){ - isArea = d3.functor(_); - }}, - x: {get: function(){return getX;}, set: function(_){ - getX = _; - scatter.x(_); - }}, - y: {get: function(){return getY;}, set: function(_){ - getY = _; - scatter.y(_); - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - scatter.color(color); - }} - }); - - nv.utils.inheritOptions(chart, scatter); - nv.utils.initOptions(chart); - - return chart; -}; -nv.models.lineChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var lines = nv.models.line() - , xAxis = nv.models.axis() - , yAxis = nv.models.axis() - , legend = nv.models.legend() - , interactiveLayer = nv.interactiveGuideline() - , tooltip = nv.models.tooltip() - ; - - var margin = {top: 30, right: 20, bottom: 50, left: 60} - , color = nv.utils.defaultColor() - , width = null - , height = null - , showLegend = true - , showXAxis = true - , showYAxis = true - , rightAlignYAxis = false - , useInteractiveGuideline = false - , x - , y - , state = nv.utils.state() - , defaultState = null - , noData = null - , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState', 'renderEnd') - , duration = 250 - ; - - // set options on sub-objects for this chart - xAxis.orient('bottom').tickPadding(7); - yAxis.orient(rightAlignYAxis ? 'right' : 'left'); - tooltip.valueFormatter(function(d, i) { - return yAxis.tickFormat()(d, i); - }).headerFormatter(function(d, i) { - return xAxis.tickFormat()(d, i); - }); - - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var renderWatch = nv.utils.renderWatch(dispatch, duration); - - var stateGetter = function(data) { - return function(){ - return { - active: data.map(function(d) { return !d.disabled }) - }; - } - }; - - var stateSetter = function(data) { - return function(state) { - if (state.active !== undefined) - data.forEach(function(series,i) { - series.disabled = !state.active[i]; - }); - } - }; - - function chart(selection) { - renderWatch.reset(); - renderWatch.models(lines); - if (showXAxis) renderWatch.models(xAxis); - if (showYAxis) renderWatch.models(yAxis); - - selection.each(function(data) { - var container = d3.select(this), - that = this; - nv.utils.initSVG(container); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - chart.update = function() { - if (duration === 0) - container.call(chart); - else - container.transition().duration(duration).call(chart) - }; - chart.container = this; - - state - .setter(stateSetter(data), chart.update) - .getter(stateGetter(data)) - .update(); - - // DEPRECATED set state.disableddisabled - state.disabled = data.map(function(d) { return !!d.disabled }); - - if (!defaultState) { - var key; - defaultState = {}; - for (key in state) { - if (state[key] instanceof Array) - defaultState[key] = state[key].slice(0); - else - defaultState[key] = state[key]; - } - } - - // Display noData message if there's nothing to show. - if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { - nv.utils.noData(chart, container) - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - - // Setup Scales - x = lines.xScale(); - y = lines.yScale(); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g'); - var g = wrap.select('g'); - - gEnter.append("rect").style("opacity",0); - gEnter.append('g').attr('class', 'nv-x nv-axis'); - gEnter.append('g').attr('class', 'nv-y nv-axis'); - gEnter.append('g').attr('class', 'nv-linesWrap'); - gEnter.append('g').attr('class', 'nv-legendWrap'); - gEnter.append('g').attr('class', 'nv-interactive'); - - g.select("rect") - .attr("width",availableWidth) - .attr("height",(availableHeight > 0) ? availableHeight : 0); - - // Legend - if (showLegend) { - legend.width(availableWidth); - - g.select('.nv-legendWrap') - .datum(data) - .call(legend); - - if ( margin.top != legend.height()) { - margin.top = legend.height(); - availableHeight = nv.utils.availableHeight(height, container, margin); - } - - wrap.select('.nv-legendWrap') - .attr('transform', 'translate(0,' + (-margin.top) +')') - } - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - if (rightAlignYAxis) { - g.select(".nv-y.nv-axis") - .attr("transform", "translate(" + availableWidth + ",0)"); - } - - //Set up interactive layer - if (useInteractiveGuideline) { - interactiveLayer - .width(availableWidth) - .height(availableHeight) - .margin({left:margin.left, top:margin.top}) - .svgContainer(container) - .xScale(x); - wrap.select(".nv-interactive").call(interactiveLayer); - } - - lines - .width(availableWidth) - .height(availableHeight) - .color(data.map(function(d,i) { - return d.color || color(d, i); - }).filter(function(d,i) { return !data[i].disabled })); - - - var linesWrap = g.select('.nv-linesWrap') - .datum(data.filter(function(d) { return !d.disabled })); - - linesWrap.call(lines); - - // Setup Axes - if (showXAxis) { - xAxis - .scale(x) - ._ticks(nv.utils.calcTicksX(availableWidth/100, data) ) - .tickSize(-availableHeight, 0); - - g.select('.nv-x.nv-axis') - .attr('transform', 'translate(0,' + y.range()[0] + ')'); - g.select('.nv-x.nv-axis') - .call(xAxis); - } - - if (showYAxis) { - yAxis - .scale(y) - ._ticks(nv.utils.calcTicksY(availableHeight/36, data) ) - .tickSize( -availableWidth, 0); - - g.select('.nv-y.nv-axis') - .call(yAxis); - } - - //============================================================ - // Event Handling/Dispatching (in chart's scope) - //------------------------------------------------------------ - - legend.dispatch.on('stateChange', function(newState) { - for (var key in newState) - state[key] = newState[key]; - dispatch.stateChange(state); - chart.update(); - }); - - interactiveLayer.dispatch.on('elementMousemove', function(e) { - lines.clearHighlights(); - var singlePoint, pointIndex, pointXLocation, allData = []; - data - .filter(function(series, i) { - series.seriesIndex = i; - return !series.disabled; - }) - .forEach(function(series,i) { - pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x()); - var point = series.values[pointIndex]; - var pointYValue = chart.y()(point, pointIndex); - if (pointYValue != null) { - lines.highlightPoint(i, pointIndex, true); - } - if (point === undefined) return; - if (singlePoint === undefined) singlePoint = point; - if (pointXLocation === undefined) pointXLocation = chart.xScale()(chart.x()(point,pointIndex)); - allData.push({ - key: series.key, - value: pointYValue, - color: color(series,series.seriesIndex) - }); - }); - //Highlight the tooltip entry based on which point the mouse is closest to. - if (allData.length > 2) { - var yValue = chart.yScale().invert(e.mouseY); - var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]); - var threshold = 0.03 * domainExtent; - var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold); - if (indexToHighlight !== null) - allData[indexToHighlight].highlight = true; - } - - var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex)); - interactiveLayer.tooltip - .position({left: e.mouseX + margin.left, top: e.mouseY + margin.top}) - .chartContainer(that.parentNode) - .valueFormatter(function(d,i) { - return d == null ? "N/A" : yAxis.tickFormat()(d); - }) - .data({ - value: xValue, - index: pointIndex, - series: allData - })(); - - interactiveLayer.renderGuideLine(pointXLocation); - - }); - - interactiveLayer.dispatch.on('elementClick', function(e) { - var pointXLocation, allData = []; - - data.filter(function(series, i) { - series.seriesIndex = i; - return !series.disabled; - }).forEach(function(series) { - var pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x()); - var point = series.values[pointIndex]; - if (typeof point === 'undefined') return; - if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex)); - var yPos = chart.yScale()(chart.y()(point,pointIndex)); - allData.push({ - point: point, - pointIndex: pointIndex, - pos: [pointXLocation, yPos], - seriesIndex: series.seriesIndex, - series: series - }); - }); - - lines.dispatch.elementClick(allData); - }); - - interactiveLayer.dispatch.on("elementMouseout",function(e) { - lines.clearHighlights(); - }); - - dispatch.on('changeState', function(e) { - if (typeof e.disabled !== 'undefined' && data.length === e.disabled.length) { - data.forEach(function(series,i) { - series.disabled = e.disabled[i]; - }); - - state.disabled = e.disabled; - } - - chart.update(); - }); - - }); - - renderWatch.renderEnd('lineChart immediate'); - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - lines.dispatch.on('elementMouseover.tooltip', function(evt) { - tooltip.data(evt).position(evt.pos).hidden(false); - }); - - lines.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true) - }); - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.dispatch = dispatch; - chart.lines = lines; - chart.legend = legend; - chart.xAxis = xAxis; - chart.yAxis = yAxis; - chart.interactiveLayer = interactiveLayer; - chart.tooltip = tooltip; - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - showLegend: {get: function(){return showLegend;}, set: function(_){showLegend=_;}}, - showXAxis: {get: function(){return showXAxis;}, set: function(_){showXAxis=_;}}, - showYAxis: {get: function(){return showYAxis;}, set: function(_){showYAxis=_;}}, - defaultState: {get: function(){return defaultState;}, set: function(_){defaultState=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - lines.duration(duration); - xAxis.duration(duration); - yAxis.duration(duration); - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - legend.color(color); - lines.color(color); - }}, - rightAlignYAxis: {get: function(){return rightAlignYAxis;}, set: function(_){ - rightAlignYAxis = _; - yAxis.orient( rightAlignYAxis ? 'right' : 'left'); - }}, - useInteractiveGuideline: {get: function(){return useInteractiveGuideline;}, set: function(_){ - useInteractiveGuideline = _; - if (useInteractiveGuideline) { - lines.interactive(false); - lines.useVoronoi(false); - } - }} - }); - - nv.utils.inheritOptions(chart, lines); - nv.utils.initOptions(chart); - - return chart; -}; -nv.models.linePlusBarChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var lines = nv.models.line() - , lines2 = nv.models.line() - , bars = nv.models.historicalBar() - , bars2 = nv.models.historicalBar() - , xAxis = nv.models.axis() - , x2Axis = nv.models.axis() - , y1Axis = nv.models.axis() - , y2Axis = nv.models.axis() - , y3Axis = nv.models.axis() - , y4Axis = nv.models.axis() - , legend = nv.models.legend() - , brush = d3.svg.brush() - , tooltip = nv.models.tooltip() - ; - - var margin = {top: 30, right: 30, bottom: 30, left: 60} - , margin2 = {top: 0, right: 30, bottom: 20, left: 60} - , width = null - , height = null - , getX = function(d) { return d.x } - , getY = function(d) { return d.y } - , color = nv.utils.defaultColor() - , showLegend = true - , focusEnable = true - , focusShowAxisY = false - , focusShowAxisX = true - , focusHeight = 50 - , extent - , brushExtent = null - , x - , x2 - , y1 - , y2 - , y3 - , y4 - , noData = null - , dispatch = d3.dispatch('brush', 'stateChange', 'changeState') - , transitionDuration = 0 - , state = nv.utils.state() - , defaultState = null - , legendLeftAxisHint = ' (left axis)' - , legendRightAxisHint = ' (right axis)' - ; - - lines.clipEdge(true); - lines2.interactive(false); - xAxis.orient('bottom').tickPadding(5); - y1Axis.orient('left'); - y2Axis.orient('right'); - x2Axis.orient('bottom').tickPadding(5); - y3Axis.orient('left'); - y4Axis.orient('right'); - - tooltip.headerEnabled(true).headerFormatter(function(d, i) { - return xAxis.tickFormat()(d, i); - }); - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var stateGetter = function(data) { - return function(){ - return { - active: data.map(function(d) { return !d.disabled }) - }; - } - }; - - var stateSetter = function(data) { - return function(state) { - if (state.active !== undefined) - data.forEach(function(series,i) { - series.disabled = !state.active[i]; - }); - } - }; - - function chart(selection) { - selection.each(function(data) { - var container = d3.select(this), - that = this; - nv.utils.initSVG(container); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight1 = nv.utils.availableHeight(height, container, margin) - - (focusEnable ? focusHeight : 0), - availableHeight2 = focusHeight - margin2.top - margin2.bottom; - - chart.update = function() { container.transition().duration(transitionDuration).call(chart); }; - chart.container = this; - - state - .setter(stateSetter(data), chart.update) - .getter(stateGetter(data)) - .update(); - - // DEPRECATED set state.disableddisabled - state.disabled = data.map(function(d) { return !!d.disabled }); - - if (!defaultState) { - var key; - defaultState = {}; - for (key in state) { - if (state[key] instanceof Array) - defaultState[key] = state[key].slice(0); - else - defaultState[key] = state[key]; - } - } - - // Display No Data message if there's nothing to show. - if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { - nv.utils.noData(chart, container) - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - // Setup Scales - var dataBars = data.filter(function(d) { return !d.disabled && d.bar }); - var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240 - - x = bars.xScale(); - x2 = x2Axis.scale(); - y1 = bars.yScale(); - y2 = lines.yScale(); - y3 = bars2.yScale(); - y4 = lines2.yScale(); - - var series1 = data - .filter(function(d) { return !d.disabled && d.bar }) - .map(function(d) { - return d.values.map(function(d,i) { - return { x: getX(d,i), y: getY(d,i) } - }) - }); - - var series2 = data - .filter(function(d) { return !d.disabled && !d.bar }) - .map(function(d) { - return d.values.map(function(d,i) { - return { x: getX(d,i), y: getY(d,i) } - }) - }); - - x.range([0, availableWidth]); - - x2 .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } )) - .range([0, availableWidth]); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-linePlusBar').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-legendWrap'); - - // this is the main chart - var focusEnter = gEnter.append('g').attr('class', 'nv-focus'); - focusEnter.append('g').attr('class', 'nv-x nv-axis'); - focusEnter.append('g').attr('class', 'nv-y1 nv-axis'); - focusEnter.append('g').attr('class', 'nv-y2 nv-axis'); - focusEnter.append('g').attr('class', 'nv-barsWrap'); - focusEnter.append('g').attr('class', 'nv-linesWrap'); - - // context chart is where you can focus in - var contextEnter = gEnter.append('g').attr('class', 'nv-context'); - contextEnter.append('g').attr('class', 'nv-x nv-axis'); - contextEnter.append('g').attr('class', 'nv-y1 nv-axis'); - contextEnter.append('g').attr('class', 'nv-y2 nv-axis'); - contextEnter.append('g').attr('class', 'nv-barsWrap'); - contextEnter.append('g').attr('class', 'nv-linesWrap'); - contextEnter.append('g').attr('class', 'nv-brushBackground'); - contextEnter.append('g').attr('class', 'nv-x nv-brush'); - - //============================================================ - // Legend - //------------------------------------------------------------ - - if (showLegend) { - var legendWidth = legend.align() ? availableWidth / 2 : availableWidth; - var legendXPosition = legend.align() ? legendWidth : 0; - - legend.width(legendWidth); - - g.select('.nv-legendWrap') - .datum(data.map(function(series) { - series.originalKey = series.originalKey === undefined ? series.key : series.originalKey; - series.key = series.originalKey + (series.bar ? legendLeftAxisHint : legendRightAxisHint); - return series; - })) - .call(legend); - - if ( margin.top != legend.height()) { - margin.top = legend.height(); - // FIXME: shouldn't this be "- (focusEnabled ? focusHeight : 0)"? - availableHeight1 = nv.utils.availableHeight(height, container, margin) - focusHeight; - } - - g.select('.nv-legendWrap') - .attr('transform', 'translate(' + legendXPosition + ',' + (-margin.top) +')'); - } - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - //============================================================ - // Context chart (focus chart) components - //------------------------------------------------------------ - - // hide or show the focus context chart - g.select('.nv-context').style('display', focusEnable ? 'initial' : 'none'); - - bars2 - .width(availableWidth) - .height(availableHeight2) - .color(data.map(function (d, i) { - return d.color || color(d, i); - }).filter(function (d, i) { - return !data[i].disabled && data[i].bar - })); - lines2 - .width(availableWidth) - .height(availableHeight2) - .color(data.map(function (d, i) { - return d.color || color(d, i); - }).filter(function (d, i) { - return !data[i].disabled && !data[i].bar - })); - - var bars2Wrap = g.select('.nv-context .nv-barsWrap') - .datum(dataBars.length ? dataBars : [ - {values: []} - ]); - var lines2Wrap = g.select('.nv-context .nv-linesWrap') - .datum(!dataLines[0].disabled ? dataLines : [ - {values: []} - ]); - - g.select('.nv-context') - .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')'); - - bars2Wrap.transition().call(bars2); - lines2Wrap.transition().call(lines2); - - // context (focus chart) axis controls - if (focusShowAxisX) { - x2Axis - ._ticks( nv.utils.calcTicksX(availableWidth / 100, data)) - .tickSize(-availableHeight2, 0); - g.select('.nv-context .nv-x.nv-axis') - .attr('transform', 'translate(0,' + y3.range()[0] + ')'); - g.select('.nv-context .nv-x.nv-axis').transition() - .call(x2Axis); - } - - if (focusShowAxisY) { - y3Axis - .scale(y3) - ._ticks( availableHeight2 / 36 ) - .tickSize( -availableWidth, 0); - y4Axis - .scale(y4) - ._ticks( availableHeight2 / 36 ) - .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none - - g.select('.nv-context .nv-y3.nv-axis') - .style('opacity', dataBars.length ? 1 : 0) - .attr('transform', 'translate(0,' + x2.range()[0] + ')'); - g.select('.nv-context .nv-y2.nv-axis') - .style('opacity', dataLines.length ? 1 : 0) - .attr('transform', 'translate(' + x2.range()[1] + ',0)'); - - g.select('.nv-context .nv-y1.nv-axis').transition() - .call(y3Axis); - g.select('.nv-context .nv-y2.nv-axis').transition() - .call(y4Axis); - } - - // Setup Brush - brush.x(x2).on('brush', onBrush); - - if (brushExtent) brush.extent(brushExtent); - - var brushBG = g.select('.nv-brushBackground').selectAll('g') - .data([brushExtent || brush.extent()]); - - var brushBGenter = brushBG.enter() - .append('g'); - - brushBGenter.append('rect') - .attr('class', 'left') - .attr('x', 0) - .attr('y', 0) - .attr('height', availableHeight2); - - brushBGenter.append('rect') - .attr('class', 'right') - .attr('x', 0) - .attr('y', 0) - .attr('height', availableHeight2); - - var gBrush = g.select('.nv-x.nv-brush') - .call(brush); - gBrush.selectAll('rect') - //.attr('y', -5) - .attr('height', availableHeight2); - gBrush.selectAll('.resize').append('path').attr('d', resizePath); - - //============================================================ - // Event Handling/Dispatching (in chart's scope) - //------------------------------------------------------------ - - legend.dispatch.on('stateChange', function(newState) { - for (var key in newState) - state[key] = newState[key]; - dispatch.stateChange(state); - chart.update(); - }); - - // Update chart from a state object passed to event handler - dispatch.on('changeState', function(e) { - if (typeof e.disabled !== 'undefined') { - data.forEach(function(series,i) { - series.disabled = e.disabled[i]; - }); - state.disabled = e.disabled; - } - chart.update(); - }); - - //============================================================ - // Functions - //------------------------------------------------------------ - - // Taken from crossfilter (http://square.github.com/crossfilter/) - function resizePath(d) { - var e = +(d == 'e'), - x = e ? 1 : -1, - y = availableHeight2 / 3; - return 'M' + (.5 * x) + ',' + y - + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6) - + 'V' + (2 * y - 6) - + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y) - + 'Z' - + 'M' + (2.5 * x) + ',' + (y + 8) - + 'V' + (2 * y - 8) - + 'M' + (4.5 * x) + ',' + (y + 8) - + 'V' + (2 * y - 8); - } - - - function updateBrushBG() { - if (!brush.empty()) brush.extent(brushExtent); - brushBG - .data([brush.empty() ? x2.domain() : brushExtent]) - .each(function(d,i) { - var leftWidth = x2(d[0]) - x2.range()[0], - rightWidth = x2.range()[1] - x2(d[1]); - d3.select(this).select('.left') - .attr('width', leftWidth < 0 ? 0 : leftWidth); - - d3.select(this).select('.right') - .attr('x', x2(d[1])) - .attr('width', rightWidth < 0 ? 0 : rightWidth); - }); - } - - function onBrush() { - brushExtent = brush.empty() ? null : brush.extent(); - extent = brush.empty() ? x2.domain() : brush.extent(); - dispatch.brush({extent: extent, brush: brush}); - updateBrushBG(); - - // Prepare Main (Focus) Bars and Lines - bars - .width(availableWidth) - .height(availableHeight1) - .color(data.map(function(d,i) { - return d.color || color(d, i); - }).filter(function(d,i) { return !data[i].disabled && data[i].bar })); - - lines - .width(availableWidth) - .height(availableHeight1) - .color(data.map(function(d,i) { - return d.color || color(d, i); - }).filter(function(d,i) { return !data[i].disabled && !data[i].bar })); - - var focusBarsWrap = g.select('.nv-focus .nv-barsWrap') - .datum(!dataBars.length ? [{values:[]}] : - dataBars - .map(function(d,i) { - return { - key: d.key, - values: d.values.filter(function(d,i) { - return bars.x()(d,i) >= extent[0] && bars.x()(d,i) <= extent[1]; - }) - } - }) - ); - - var focusLinesWrap = g.select('.nv-focus .nv-linesWrap') - .datum(dataLines[0].disabled ? [{values:[]}] : - dataLines - .map(function(d,i) { - return { - area: d.area, - fillOpacity: d.fillOpacity, - key: d.key, - values: d.values.filter(function(d,i) { - return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1]; - }) - } - }) - ); - - // Update Main (Focus) X Axis - if (dataBars.length) { - x = bars.xScale(); - } else { - x = lines.xScale(); - } - - xAxis - .scale(x) - ._ticks( nv.utils.calcTicksX(availableWidth/100, data) ) - .tickSize(-availableHeight1, 0); - - xAxis.domain([Math.ceil(extent[0]), Math.floor(extent[1])]); - - g.select('.nv-x.nv-axis').transition().duration(transitionDuration) - .call(xAxis); - - // Update Main (Focus) Bars and Lines - focusBarsWrap.transition().duration(transitionDuration).call(bars); - focusLinesWrap.transition().duration(transitionDuration).call(lines); - - // Setup and Update Main (Focus) Y Axes - g.select('.nv-focus .nv-x.nv-axis') - .attr('transform', 'translate(0,' + y1.range()[0] + ')'); - - y1Axis - .scale(y1) - ._ticks( nv.utils.calcTicksY(availableHeight1/36, data) ) - .tickSize(-availableWidth, 0); - y2Axis - .scale(y2) - ._ticks( nv.utils.calcTicksY(availableHeight1/36, data) ) - .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none - - g.select('.nv-focus .nv-y1.nv-axis') - .style('opacity', dataBars.length ? 1 : 0); - g.select('.nv-focus .nv-y2.nv-axis') - .style('opacity', dataLines.length && !dataLines[0].disabled ? 1 : 0) - .attr('transform', 'translate(' + x.range()[1] + ',0)'); - - g.select('.nv-focus .nv-y1.nv-axis').transition().duration(transitionDuration) - .call(y1Axis); - g.select('.nv-focus .nv-y2.nv-axis').transition().duration(transitionDuration) - .call(y2Axis); - } - - onBrush(); - - }); - - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - lines.dispatch.on('elementMouseover.tooltip', function(evt) { - tooltip - .duration(100) - .valueFormatter(function(d, i) { - return y2Axis.tickFormat()(d, i); - }) - .data(evt) - .position(evt.pos) - .hidden(false); - }); - - lines.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true) - }); - - bars.dispatch.on('elementMouseover.tooltip', function(evt) { - evt.value = chart.x()(evt.data); - evt['series'] = { - value: chart.y()(evt.data), - color: evt.color - }; - tooltip - .duration(0) - .valueFormatter(function(d, i) { - return y1Axis.tickFormat()(d, i); - }) - .data(evt) - .hidden(false); - }); - - bars.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true); - }); - - bars.dispatch.on('elementMousemove.tooltip', function(evt) { - tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); - }); - - //============================================================ - - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.dispatch = dispatch; - chart.legend = legend; - chart.lines = lines; - chart.lines2 = lines2; - chart.bars = bars; - chart.bars2 = bars2; - chart.xAxis = xAxis; - chart.x2Axis = x2Axis; - chart.y1Axis = y1Axis; - chart.y2Axis = y2Axis; - chart.y3Axis = y3Axis; - chart.y4Axis = y4Axis; - chart.tooltip = tooltip; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - showLegend: {get: function(){return showLegend;}, set: function(_){showLegend=_;}}, - brushExtent: {get: function(){return brushExtent;}, set: function(_){brushExtent=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - focusEnable: {get: function(){return focusEnable;}, set: function(_){focusEnable=_;}}, - focusHeight: {get: function(){return focusHeight;}, set: function(_){focusHeight=_;}}, - focusShowAxisX: {get: function(){return focusShowAxisX;}, set: function(_){focusShowAxisX=_;}}, - focusShowAxisY: {get: function(){return focusShowAxisY;}, set: function(_){focusShowAxisY=_;}}, - legendLeftAxisHint: {get: function(){return legendLeftAxisHint;}, set: function(_){legendLeftAxisHint=_;}}, - legendRightAxisHint: {get: function(){return legendRightAxisHint;}, set: function(_){legendRightAxisHint=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - duration: {get: function(){return transitionDuration;}, set: function(_){ - transitionDuration = _; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - legend.color(color); - }}, - x: {get: function(){return getX;}, set: function(_){ - getX = _; - lines.x(_); - lines2.x(_); - bars.x(_); - bars2.x(_); - }}, - y: {get: function(){return getY;}, set: function(_){ - getY = _; - lines.y(_); - lines2.y(_); - bars.y(_); - bars2.y(_); - }} - }); - - nv.utils.inheritOptions(chart, lines); - nv.utils.initOptions(chart); - - return chart; -}; -nv.models.lineWithFocusChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var lines = nv.models.line() - , lines2 = nv.models.line() - , xAxis = nv.models.axis() - , yAxis = nv.models.axis() - , x2Axis = nv.models.axis() - , y2Axis = nv.models.axis() - , legend = nv.models.legend() - , brush = d3.svg.brush() - , tooltip = nv.models.tooltip() - , interactiveLayer = nv.interactiveGuideline() - ; - - var margin = {top: 30, right: 30, bottom: 30, left: 60} - , margin2 = {top: 0, right: 30, bottom: 20, left: 60} - , color = nv.utils.defaultColor() - , width = null - , height = null - , height2 = 50 - , useInteractiveGuideline = false - , x - , y - , x2 - , y2 - , showLegend = true - , brushExtent = null - , noData = null - , dispatch = d3.dispatch('brush', 'stateChange', 'changeState') - , transitionDuration = 250 - , state = nv.utils.state() - , defaultState = null - ; - - lines.clipEdge(true).duration(0); - lines2.interactive(false); - xAxis.orient('bottom').tickPadding(5); - yAxis.orient('left'); - x2Axis.orient('bottom').tickPadding(5); - y2Axis.orient('left'); - - tooltip.valueFormatter(function(d, i) { - return yAxis.tickFormat()(d, i); - }).headerFormatter(function(d, i) { - return xAxis.tickFormat()(d, i); - }); - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var stateGetter = function(data) { - return function(){ - return { - active: data.map(function(d) { return !d.disabled }) - }; - } - }; - - var stateSetter = function(data) { - return function(state) { - if (state.active !== undefined) - data.forEach(function(series,i) { - series.disabled = !state.active[i]; - }); - } - }; - - function chart(selection) { - selection.each(function(data) { - var container = d3.select(this), - that = this; - nv.utils.initSVG(container); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight1 = nv.utils.availableHeight(height, container, margin) - height2, - availableHeight2 = height2 - margin2.top - margin2.bottom; - - chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; - chart.container = this; - - state - .setter(stateSetter(data), chart.update) - .getter(stateGetter(data)) - .update(); - - // DEPRECATED set state.disableddisabled - state.disabled = data.map(function(d) { return !!d.disabled }); - - if (!defaultState) { - var key; - defaultState = {}; - for (key in state) { - if (state[key] instanceof Array) - defaultState[key] = state[key].slice(0); - else - defaultState[key] = state[key]; - } - } - - // Display No Data message if there's nothing to show. - if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { - nv.utils.noData(chart, container) - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - // Setup Scales - x = lines.xScale(); - y = lines.yScale(); - x2 = lines2.xScale(); - y2 = lines2.yScale(); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-lineWithFocusChart').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineWithFocusChart').append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-legendWrap'); - - var focusEnter = gEnter.append('g').attr('class', 'nv-focus'); - focusEnter.append('g').attr('class', 'nv-x nv-axis'); - focusEnter.append('g').attr('class', 'nv-y nv-axis'); - focusEnter.append('g').attr('class', 'nv-linesWrap'); - focusEnter.append('g').attr('class', 'nv-interactive'); - - var contextEnter = gEnter.append('g').attr('class', 'nv-context'); - contextEnter.append('g').attr('class', 'nv-x nv-axis'); - contextEnter.append('g').attr('class', 'nv-y nv-axis'); - contextEnter.append('g').attr('class', 'nv-linesWrap'); - contextEnter.append('g').attr('class', 'nv-brushBackground'); - contextEnter.append('g').attr('class', 'nv-x nv-brush'); - - // Legend - if (showLegend) { - legend.width(availableWidth); - - g.select('.nv-legendWrap') - .datum(data) - .call(legend); - - if ( margin.top != legend.height()) { - margin.top = legend.height(); - availableHeight1 = nv.utils.availableHeight(height, container, margin) - height2; - } - - g.select('.nv-legendWrap') - .attr('transform', 'translate(0,' + (-margin.top) +')') - } - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - - //Set up interactive layer - if (useInteractiveGuideline) { - interactiveLayer - .width(availableWidth) - .height(availableHeight1) - .margin({left:margin.left, top:margin.top}) - .svgContainer(container) - .xScale(x); - wrap.select(".nv-interactive").call(interactiveLayer); - } - - // Main Chart Component(s) - lines - .width(availableWidth) - .height(availableHeight1) - .color( - data - .map(function(d,i) { - return d.color || color(d, i); - }) - .filter(function(d,i) { - return !data[i].disabled; - }) - ); - - lines2 - .defined(lines.defined()) - .width(availableWidth) - .height(availableHeight2) - .color( - data - .map(function(d,i) { - return d.color || color(d, i); - }) - .filter(function(d,i) { - return !data[i].disabled; - }) - ); - - g.select('.nv-context') - .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')') - - var contextLinesWrap = g.select('.nv-context .nv-linesWrap') - .datum(data.filter(function(d) { return !d.disabled })) - - d3.transition(contextLinesWrap).call(lines2); - - // Setup Main (Focus) Axes - xAxis - .scale(x) - ._ticks( nv.utils.calcTicksX(availableWidth/100, data) ) - .tickSize(-availableHeight1, 0); - - yAxis - .scale(y) - ._ticks( nv.utils.calcTicksY(availableHeight1/36, data) ) - .tickSize( -availableWidth, 0); - - g.select('.nv-focus .nv-x.nv-axis') - .attr('transform', 'translate(0,' + availableHeight1 + ')'); - - // Setup Brush - brush - .x(x2) - .on('brush', function() { - onBrush(); - }); - - if (brushExtent) brush.extent(brushExtent); - - var brushBG = g.select('.nv-brushBackground').selectAll('g') - .data([brushExtent || brush.extent()]) - - var brushBGenter = brushBG.enter() - .append('g'); - - brushBGenter.append('rect') - .attr('class', 'left') - .attr('x', 0) - .attr('y', 0) - .attr('height', availableHeight2); - - brushBGenter.append('rect') - .attr('class', 'right') - .attr('x', 0) - .attr('y', 0) - .attr('height', availableHeight2); - - var gBrush = g.select('.nv-x.nv-brush') - .call(brush); - gBrush.selectAll('rect') - .attr('height', availableHeight2); - gBrush.selectAll('.resize').append('path').attr('d', resizePath); - - onBrush(); - - // Setup Secondary (Context) Axes - x2Axis - .scale(x2) - ._ticks( nv.utils.calcTicksX(availableWidth/100, data) ) - .tickSize(-availableHeight2, 0); - - g.select('.nv-context .nv-x.nv-axis') - .attr('transform', 'translate(0,' + y2.range()[0] + ')'); - d3.transition(g.select('.nv-context .nv-x.nv-axis')) - .call(x2Axis); - - y2Axis - .scale(y2) - ._ticks( nv.utils.calcTicksY(availableHeight2/36, data) ) - .tickSize( -availableWidth, 0); - - d3.transition(g.select('.nv-context .nv-y.nv-axis')) - .call(y2Axis); - - g.select('.nv-context .nv-x.nv-axis') - .attr('transform', 'translate(0,' + y2.range()[0] + ')'); - - //============================================================ - // Event Handling/Dispatching (in chart's scope) - //------------------------------------------------------------ - - legend.dispatch.on('stateChange', function(newState) { - for (var key in newState) - state[key] = newState[key]; - dispatch.stateChange(state); - chart.update(); - }); - - interactiveLayer.dispatch.on('elementMousemove', function(e) { - lines.clearHighlights(); - var singlePoint, pointIndex, pointXLocation, allData = []; - data - .filter(function(series, i) { - series.seriesIndex = i; - return !series.disabled; - }) - .forEach(function(series,i) { - var extent = brush.empty() ? x2.domain() : brush.extent(); - var currentValues = series.values.filter(function(d,i) { - return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1]; - }); - - pointIndex = nv.interactiveBisect(currentValues, e.pointXValue, lines.x()); - var point = currentValues[pointIndex]; - var pointYValue = chart.y()(point, pointIndex); - if (pointYValue != null) { - lines.highlightPoint(i, pointIndex, true); - } - if (point === undefined) return; - if (singlePoint === undefined) singlePoint = point; - if (pointXLocation === undefined) pointXLocation = chart.xScale()(chart.x()(point,pointIndex)); - allData.push({ - key: series.key, - value: chart.y()(point, pointIndex), - color: color(series,series.seriesIndex) - }); - }); - //Highlight the tooltip entry based on which point the mouse is closest to. - if (allData.length > 2) { - var yValue = chart.yScale().invert(e.mouseY); - var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]); - var threshold = 0.03 * domainExtent; - var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold); - if (indexToHighlight !== null) - allData[indexToHighlight].highlight = true; - } - - var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex)); - interactiveLayer.tooltip - .position({left: e.mouseX + margin.left, top: e.mouseY + margin.top}) - .chartContainer(that.parentNode) - .valueFormatter(function(d,i) { - return d == null ? "N/A" : yAxis.tickFormat()(d); - }) - .data({ - value: xValue, - index: pointIndex, - series: allData - })(); - - interactiveLayer.renderGuideLine(pointXLocation); - - }); - - interactiveLayer.dispatch.on("elementMouseout",function(e) { - lines.clearHighlights(); - }); - - dispatch.on('changeState', function(e) { - if (typeof e.disabled !== 'undefined') { - data.forEach(function(series,i) { - series.disabled = e.disabled[i]; - }); - } - chart.update(); - }); - - //============================================================ - // Functions - //------------------------------------------------------------ - - // Taken from crossfilter (http://square.github.com/crossfilter/) - function resizePath(d) { - var e = +(d == 'e'), - x = e ? 1 : -1, - y = availableHeight2 / 3; - return 'M' + (.5 * x) + ',' + y - + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6) - + 'V' + (2 * y - 6) - + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y) - + 'Z' - + 'M' + (2.5 * x) + ',' + (y + 8) - + 'V' + (2 * y - 8) - + 'M' + (4.5 * x) + ',' + (y + 8) - + 'V' + (2 * y - 8); - } - - - function updateBrushBG() { - if (!brush.empty()) brush.extent(brushExtent); - brushBG - .data([brush.empty() ? x2.domain() : brushExtent]) - .each(function(d,i) { - var leftWidth = x2(d[0]) - x.range()[0], - rightWidth = availableWidth - x2(d[1]); - d3.select(this).select('.left') - .attr('width', leftWidth < 0 ? 0 : leftWidth); - - d3.select(this).select('.right') - .attr('x', x2(d[1])) - .attr('width', rightWidth < 0 ? 0 : rightWidth); - }); - } - - - function onBrush() { - brushExtent = brush.empty() ? null : brush.extent(); - var extent = brush.empty() ? x2.domain() : brush.extent(); - - //The brush extent cannot be less than one. If it is, don't update the line chart. - if (Math.abs(extent[0] - extent[1]) <= 1) { - return; - } - - dispatch.brush({extent: extent, brush: brush}); - - - updateBrushBG(); - - // Update Main (Focus) - var focusLinesWrap = g.select('.nv-focus .nv-linesWrap') - .datum( - data - .filter(function(d) { return !d.disabled }) - .map(function(d,i) { - return { - key: d.key, - area: d.area, - values: d.values.filter(function(d,i) { - return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1]; - }) - } - }) - ); - focusLinesWrap.transition().duration(transitionDuration).call(lines); - - - // Update Main (Focus) Axes - g.select('.nv-focus .nv-x.nv-axis').transition().duration(transitionDuration) - .call(xAxis); - g.select('.nv-focus .nv-y.nv-axis').transition().duration(transitionDuration) - .call(yAxis); - } - }); - - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - lines.dispatch.on('elementMouseover.tooltip', function(evt) { - tooltip.data(evt).position(evt.pos).hidden(false); - }); - - lines.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true) - }); - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.dispatch = dispatch; - chart.legend = legend; - chart.lines = lines; - chart.lines2 = lines2; - chart.xAxis = xAxis; - chart.yAxis = yAxis; - chart.x2Axis = x2Axis; - chart.y2Axis = y2Axis; - chart.interactiveLayer = interactiveLayer; - chart.tooltip = tooltip; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - focusHeight: {get: function(){return height2;}, set: function(_){height2=_;}}, - showLegend: {get: function(){return showLegend;}, set: function(_){showLegend=_;}}, - brushExtent: {get: function(){return brushExtent;}, set: function(_){brushExtent=_;}}, - defaultState: {get: function(){return defaultState;}, set: function(_){defaultState=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - legend.color(color); - // line color is handled above? - }}, - interpolate: {get: function(){return lines.interpolate();}, set: function(_){ - lines.interpolate(_); - lines2.interpolate(_); - }}, - xTickFormat: {get: function(){return xAxis.tickFormat();}, set: function(_){ - xAxis.tickFormat(_); - x2Axis.tickFormat(_); - }}, - yTickFormat: {get: function(){return yAxis.tickFormat();}, set: function(_){ - yAxis.tickFormat(_); - y2Axis.tickFormat(_); - }}, - duration: {get: function(){return transitionDuration;}, set: function(_){ - transitionDuration=_; - yAxis.duration(transitionDuration); - y2Axis.duration(transitionDuration); - xAxis.duration(transitionDuration); - x2Axis.duration(transitionDuration); - }}, - x: {get: function(){return lines.x();}, set: function(_){ - lines.x(_); - lines2.x(_); - }}, - y: {get: function(){return lines.y();}, set: function(_){ - lines.y(_); - lines2.y(_); - }}, - useInteractiveGuideline: {get: function(){return useInteractiveGuideline;}, set: function(_){ - useInteractiveGuideline = _; - if (useInteractiveGuideline) { - lines.interactive(false); - lines.useVoronoi(false); - } - }} - }); - - nv.utils.inheritOptions(chart, lines); - nv.utils.initOptions(chart); - - return chart; -}; -nv.models.multiBar = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = 960 - , height = 500 - , x = d3.scale.ordinal() - , y = d3.scale.linear() - , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one - , container = null - , getX = function(d) { return d.x } - , getY = function(d) { return d.y } - , getYerr = function(d) { return d.yErr } - , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove - , clipEdge = true - , stacked = false - , stackOffset = 'zero' // options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function - , color = nv.utils.defaultColor() - , errorBarColor = nv.utils.defaultColor() - , hideable = false - , barColor = null // adding the ability to set the color for each rather than the whole group - , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled - , duration = 500 - , xDomain - , yDomain - , xRange - , yRange - , groupSpacing = 0.1 - , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout', 'elementMousemove', 'renderEnd') - ; - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var x0, y0 //used to store previous scales - , renderWatch = nv.utils.renderWatch(dispatch, duration) - ; - - var last_datalength = 0; - - function chart(selection) { - renderWatch.reset(); - selection.each(function(data) { - var availableWidth = width - margin.left - margin.right, - availableHeight = height - margin.top - margin.bottom; - - container = d3.select(this); - nv.utils.initSVG(container); - var nonStackableCount = 0; - // This function defines the requirements for render complete - var endFn = function(d, i) { - if (d.series === data.length - 1 && i === data[0].values.length - 1) - return true; - return false; - }; - - if(hideable && data.length) hideable = [{ - values: data[0].values.map(function(d) { - return { - x: d.x, - y: 0, - series: d.series, - size: 0.01 - };} - )}]; - - if (stacked) { - var parsed = d3.layout.stack() - .offset(stackOffset) - .values(function(d){ return d.values }) - .y(getY) - (!data.length && hideable ? hideable : data); - - parsed.forEach(function(series, i){ - // if series is non-stackable, use un-parsed data - if (series.nonStackable) { - data[i].nonStackableSeries = nonStackableCount++; - parsed[i] = data[i]; - } else { - // don't stack this seires on top of the nonStackable seriees - if (i > 0 && parsed[i - 1].nonStackable){ - parsed[i].values.map(function(d,j){ - d.y0 -= parsed[i - 1].values[j].y; - d.y1 = d.y0 + d.y; - }); - } - } - }); - data = parsed; - } - //add series index and key to each data point for reference - data.forEach(function(series, i) { - series.values.forEach(function(point) { - point.series = i; - point.key = series.key; - }); - }); - - // HACK for negative value stacking - if (stacked) { - data[0].values.map(function(d,i) { - var posBase = 0, negBase = 0; - data.map(function(d, idx) { - if (!data[idx].nonStackable) { - var f = d.values[i] - f.size = Math.abs(f.y); - if (f.y<0) { - f.y1 = negBase; - negBase = negBase - f.size; - } else - { - f.y1 = f.size + posBase; - posBase = posBase + f.size; - } - } - - }); - }); - } - // Setup Scales - // remap and flatten the data for use in calculating the scales' domains - var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate - data.map(function(d, idx) { - return d.values.map(function(d,i) { - return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1, idx:idx, yErr: getYerr(d,i)} - }) - }); - - x.domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x })) - .rangeBands(xRange || [0, availableWidth], groupSpacing); - - y.domain(yDomain || d3.extent(d3.merge( - d3.merge(seriesData).map(function(d) { - var domain = d.y; - // increase the domain range if this series is stackable - if (stacked && !data[d.idx].nonStackable) { - if (d.y > 0){ - domain = d.y1 - } else { - domain = d.y1 + d.y - } - } - var yerr = d.yErr; - if (yerr) { - if (yerr.length) { - return [domain + yerr[0], domain + yerr[1]]; - } else { - yerr = Math.abs(yerr) - return [domain - yerr, domain + yerr]; - } - } else { - return [domain]; - } - })).concat(forceY))) - .range(yRange || [availableHeight, 0]); - - // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point - if (x.domain()[0] === x.domain()[1]) - x.domain()[0] ? - x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) - : x.domain([-1,1]); - - if (y.domain()[0] === y.domain()[1]) - y.domain()[0] ? - y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) - : y.domain([-1,1]); - - x0 = x0 || x; - y0 = y0 || y; - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar'); - var defsEnter = wrapEnter.append('defs'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-groups'); - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - defsEnter.append('clipPath') - .attr('id', 'nv-edge-clip-' + id) - .append('rect'); - wrap.select('#nv-edge-clip-' + id + ' rect') - .attr('width', availableWidth) - .attr('height', availableHeight); - - g.attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); - - var groups = wrap.select('.nv-groups').selectAll('.nv-group') - .data(function(d) { return d }, function(d,i) { return i }); - groups.enter().append('g') - .style('stroke-opacity', 1e-6) - .style('fill-opacity', 1e-6); - - var exitTransition = renderWatch - .transition(groups.exit().selectAll('g.nv-bar'), 'multibarExit', Math.min(100, duration)) - .attr('y', function(d, i, j) { - var yVal = y0(0) || 0; - if (stacked) { - if (data[d.series] && !data[d.series].nonStackable) { - yVal = y0(d.y0); - } - } - return yVal; - }) - .attr('height', 0) - .remove(); - if (exitTransition.delay) - exitTransition.delay(function(d,i) { - var delay = i * (duration / (last_datalength + 1)) - i; - return delay; - }); - groups - .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) - .classed('hover', function(d) { return d.hover }) - .style('fill', function(d,i){ return color(d, i) }) - .style('stroke', function(d,i){ return color(d, i) }); - groups - .style('stroke-opacity', 1) - .style('fill-opacity', 0.75); - - var bars = groups.selectAll('g.nv-bar') - .data(function(d) { return (hideable && !data.length) ? hideable.values : d.values }); - bars.exit().remove(); - - var barsEnter = bars.enter().append('g') - .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'}) - .attr('transform', function(d,i,j) { - var _x = stacked && !data[j].nonStackable ? 0 : (j * x.rangeBand() / data.length ); - var _y = y0(stacked && !data[j].nonStackable ? d.y0 : 0) || 0; - return 'translate(' + _x + ',' + _y + ')'; - }) - ; - - barsEnter.append('rect') - .attr('height', 0) - .attr('width', function(d,i,j) { return x.rangeBand() / (stacked && !data[j].nonStackable ? 1 : data.length) }) - .style('fill', function(d,i,j){ return color(d, j, i); }) - .style('stroke', function(d,i,j){ return color(d, j, i); }) - ; - bars - .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here - d3.select(this).classed('hover', true); - dispatch.elementMouseover({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - }) - .on('mouseout', function(d,i) { - d3.select(this).classed('hover', false); - dispatch.elementMouseout({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - }) - .on('mousemove', function(d,i) { - dispatch.elementMousemove({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - }) - .on('click', function(d,i) { - dispatch.elementClick({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - d3.event.stopPropagation(); - }) - .on('dblclick', function(d,i) { - dispatch.elementDblClick({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - d3.event.stopPropagation(); - }); - - if (getYerr(data[0].values[0], 0)) { - barsEnter.append('polyline'); - - bars.select('polyline') - .attr('fill', 'none') - .attr('stroke', 'black') - //.attr('stroke', function(d, i, j) { return errorBarColor(d, j, i); }) - .attr('points', function(d,i) { - var yerr = getYerr(d,i) - , mid = 0.8 * x.rangeBand() / ((stacked ? 1 : data.length) * 2); - yerr = yerr.length ? yerr : [-Math.abs(yerr), Math.abs(yerr)]; - yerr = yerr.map(function(e) { return y(e) - y(0); }); - var a = [[-mid, yerr[0]], [mid, yerr[0]], [0, yerr[0]], [0, yerr[1]], [-mid, yerr[1]], [mid, yerr[1]]]; - return a.map(function (path) { return path.join(',') }).join(' '); - }) - .attr('transform', function(d, i) { - var xOffset = x.rangeBand() / ((stacked ? 1 : data.length) * 2); - var yOffset = getY(d,i) < 0 ? y(getY(d, i)) - y(0) : 0; - return 'translate(' + xOffset + ', ' + yOffset + ')'; - }) - } - - bars - .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'}) - - if (barColor) { - if (!disabled) disabled = data.map(function() { return true }); - bars.select('rect') - .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }) - .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }); - } - - var barSelection = - bars.watchTransition(renderWatch, 'multibar', Math.min(250, duration)) - .delay(function(d,i) { - return i * duration / data[0].values.length; - }); - if (stacked){ - barSelection - .attr('transform', function(d,i,j) { - var yVal = 0; - // if stackable, stack it on top of the previous series - if (!data[j].nonStackable) { - yVal = y(d.y1); - } else { - if (getY(d,i) < 0){ - yVal = y(0); - } else { - if (y(0) - y(getY(d,i)) < -1){ - yVal = y(0) - 1; - } else { - yVal = y(getY(d, i)) || 0; - } - } - } - var width = 0; - if (data[j].nonStackable) { - width = d.series * x.rangeBand() / data.length; - if (data.length !== nonStackableCount){ - width = data[j].nonStackableSeries * x.rangeBand()/(nonStackableCount*2); - } - } - var xVal = width + x(getX(d, i)); - return 'translate(' + xVal + ',' + yVal + ')'; - }) - .select('rect') - .attr('height', function(d,i,j) { - if (!data[j].nonStackable) { - return Math.max(Math.abs(y(d.y+d.y0) - y(d.y0)), 1); - } else { - return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) || 0; - } - }) - .attr('width', function(d,i,j){ - if (!data[j].nonStackable) { - return x.rangeBand(); - } else { - // if all series are nonStacable, take the full width - var width = (x.rangeBand() / nonStackableCount); - // otherwise, nonStackable graph will be only taking the half-width - // of the x rangeBand - if (data.length !== nonStackableCount) { - width = x.rangeBand()/(nonStackableCount*2); - } - return width; - } - }); - } - else { - barSelection.attr('transform', function(d,i) { - var xVal = d.series * x.rangeBand() / data.length + x(getX(d, i)); - var yVal = getY(d,i) < 0 ? - y(0) : - y(0) - y(getY(d,i)) < 1 ? - y(0) - 1 : - y(getY(d,i)) || 0; - return 'translate(' + xVal + ',' + yVal + ')'; - }) - .select('rect') - .attr('width', x.rangeBand() / data.length) - .attr('height', function(d,i) { - return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) || 0; - }); - } - - //store old scales for use in transitions on update - x0 = x.copy(); - y0 = y.copy(); - - // keep track of the last data value length for transition calculations - if (data[0] && data[0].values) { - last_datalength = data[0].values.length; - } - - }); - - renderWatch.renderEnd('multibar immediate'); - - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - x: {get: function(){return getX;}, set: function(_){getX=_;}}, - y: {get: function(){return getY;}, set: function(_){getY=_;}}, - yErr: {get: function(){return getYerr;}, set: function(_){getYerr=_;}}, - xScale: {get: function(){return x;}, set: function(_){x=_;}}, - yScale: {get: function(){return y;}, set: function(_){y=_;}}, - xDomain: {get: function(){return xDomain;}, set: function(_){xDomain=_;}}, - yDomain: {get: function(){return yDomain;}, set: function(_){yDomain=_;}}, - xRange: {get: function(){return xRange;}, set: function(_){xRange=_;}}, - yRange: {get: function(){return yRange;}, set: function(_){yRange=_;}}, - forceY: {get: function(){return forceY;}, set: function(_){forceY=_;}}, - stacked: {get: function(){return stacked;}, set: function(_){stacked=_;}}, - stackOffset: {get: function(){return stackOffset;}, set: function(_){stackOffset=_;}}, - clipEdge: {get: function(){return clipEdge;}, set: function(_){clipEdge=_;}}, - disabled: {get: function(){return disabled;}, set: function(_){disabled=_;}}, - id: {get: function(){return id;}, set: function(_){id=_;}}, - hideable: {get: function(){return hideable;}, set: function(_){hideable=_;}}, - groupSpacing:{get: function(){return groupSpacing;}, set: function(_){groupSpacing=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }}, - barColor: {get: function(){return barColor;}, set: function(_){ - barColor = _ ? nv.utils.getColor(_) : null; - }}, - errorBarColor: {get: function(){return errorBarColor;}, set: function(_){ - errorBarColor = _ ? nv.utils.getColor(_) : null; - }} - }); - - nv.utils.initOptions(chart); - - return chart; -}; - -nv.models.multiBarChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var multibar = nv.models.multiBar() - , xAxis = nv.models.axis() - , yAxis = nv.models.axis() - , legend = nv.models.legend() - , controls = nv.models.legend() - , tooltip = nv.models.tooltip() - ; - - var margin = {top: 30, right: 20, bottom: 50, left: 60} - , width = null - , height = null - , color = nv.utils.defaultColor() - , showControls = true - , controlLabels = {} - , showLegend = true - , showXAxis = true - , showYAxis = true - , rightAlignYAxis = false - , reduceXTicks = true // if false a tick will show for every data point - , staggerLabels = false - , rotateLabels = 0 - , x //can be accessed via chart.xScale() - , y //can be accessed via chart.yScale() - , state = nv.utils.state() - , defaultState = null - , noData = null - , dispatch = d3.dispatch('stateChange', 'changeState', 'renderEnd') - , controlWidth = function() { return showControls ? 180 : 0 } - , duration = 250 - ; - - state.stacked = false // DEPRECATED Maintained for backward compatibility - - multibar.stacked(false); - xAxis - .orient('bottom') - .tickPadding(7) - .showMaxMin(false) - .tickFormat(function(d) { return d }) - ; - yAxis - .orient((rightAlignYAxis) ? 'right' : 'left') - .tickFormat(d3.format(',.1f')) - ; - - tooltip - .duration(0) - .valueFormatter(function(d, i) { - return yAxis.tickFormat()(d, i); - }) - .headerFormatter(function(d, i) { - return xAxis.tickFormat()(d, i); - }); - - controls.updateState(false); - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var renderWatch = nv.utils.renderWatch(dispatch); - var stacked = false; - - var stateGetter = function(data) { - return function(){ - return { - active: data.map(function(d) { return !d.disabled }), - stacked: stacked - }; - } - }; - - var stateSetter = function(data) { - return function(state) { - if (state.stacked !== undefined) - stacked = state.stacked; - if (state.active !== undefined) - data.forEach(function(series,i) { - series.disabled = !state.active[i]; - }); - } - }; - - function chart(selection) { - renderWatch.reset(); - renderWatch.models(multibar); - if (showXAxis) renderWatch.models(xAxis); - if (showYAxis) renderWatch.models(yAxis); - - selection.each(function(data) { - var container = d3.select(this), - that = this; - nv.utils.initSVG(container); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - chart.update = function() { - if (duration === 0) - container.call(chart); - else - container.transition() - .duration(duration) - .call(chart); - }; - chart.container = this; - - state - .setter(stateSetter(data), chart.update) - .getter(stateGetter(data)) - .update(); - - // DEPRECATED set state.disableddisabled - state.disabled = data.map(function(d) { return !!d.disabled }); - - if (!defaultState) { - var key; - defaultState = {}; - for (key in state) { - if (state[key] instanceof Array) - defaultState[key] = state[key].slice(0); - else - defaultState[key] = state[key]; - } - } - - // Display noData message if there's nothing to show. - if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { - nv.utils.noData(chart, container) - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - // Setup Scales - x = multibar.xScale(); - y = multibar.yScale(); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-x nv-axis'); - gEnter.append('g').attr('class', 'nv-y nv-axis'); - gEnter.append('g').attr('class', 'nv-barsWrap'); - gEnter.append('g').attr('class', 'nv-legendWrap'); - gEnter.append('g').attr('class', 'nv-controlsWrap'); - - // Legend - if (showLegend) { - legend.width(availableWidth - controlWidth()); - - g.select('.nv-legendWrap') - .datum(data) - .call(legend); - - if ( margin.top != legend.height()) { - margin.top = legend.height(); - availableHeight = nv.utils.availableHeight(height, container, margin); - } - - g.select('.nv-legendWrap') - .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')'); - } - - // Controls - if (showControls) { - var controlsData = [ - { key: controlLabels.grouped || 'Grouped', disabled: multibar.stacked() }, - { key: controlLabels.stacked || 'Stacked', disabled: !multibar.stacked() } - ]; - - controls.width(controlWidth()).color(['#444', '#444', '#444']); - g.select('.nv-controlsWrap') - .datum(controlsData) - .attr('transform', 'translate(0,' + (-margin.top) +')') - .call(controls); - } - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - if (rightAlignYAxis) { - g.select(".nv-y.nv-axis") - .attr("transform", "translate(" + availableWidth + ",0)"); - } - - // Main Chart Component(s) - multibar - .disabled(data.map(function(series) { return series.disabled })) - .width(availableWidth) - .height(availableHeight) - .color(data.map(function(d,i) { - return d.color || color(d, i); - }).filter(function(d,i) { return !data[i].disabled })); - - - var barsWrap = g.select('.nv-barsWrap') - .datum(data.filter(function(d) { return !d.disabled })); - - barsWrap.call(multibar); - - // Setup Axes - if (showXAxis) { - xAxis - .scale(x) - ._ticks( nv.utils.calcTicksX(availableWidth/100, data) ) - .tickSize(-availableHeight, 0); - - g.select('.nv-x.nv-axis') - .attr('transform', 'translate(0,' + y.range()[0] + ')'); - g.select('.nv-x.nv-axis') - .call(xAxis); - - var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g'); - - xTicks - .selectAll('line, text') - .style('opacity', 1) - - if (staggerLabels) { - var getTranslate = function(x,y) { - return "translate(" + x + "," + y + ")"; - }; - - var staggerUp = 5, staggerDown = 17; //pixels to stagger by - // Issue #140 - xTicks - .selectAll("text") - .attr('transform', function(d,i,j) { - return getTranslate(0, (j % 2 == 0 ? staggerUp : staggerDown)); - }); - - var totalInBetweenTicks = d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length; - g.selectAll(".nv-x.nv-axis .nv-axisMaxMin text") - .attr("transform", function(d,i) { - return getTranslate(0, (i === 0 || totalInBetweenTicks % 2 !== 0) ? staggerDown : staggerUp); - }); - } - - if (reduceXTicks) - xTicks - .filter(function(d,i) { - return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0; - }) - .selectAll('text, line') - .style('opacity', 0); - - if(rotateLabels) - xTicks - .selectAll('.tick text') - .attr('transform', 'rotate(' + rotateLabels + ' 0,0)') - .style('text-anchor', rotateLabels > 0 ? 'start' : 'end'); - - g.select('.nv-x.nv-axis').selectAll('g.nv-axisMaxMin text') - .style('opacity', 1); - } - - if (showYAxis) { - yAxis - .scale(y) - ._ticks( nv.utils.calcTicksY(availableHeight/36, data) ) - .tickSize( -availableWidth, 0); - - g.select('.nv-y.nv-axis') - .call(yAxis); - } - - //============================================================ - // Event Handling/Dispatching (in chart's scope) - //------------------------------------------------------------ - - legend.dispatch.on('stateChange', function(newState) { - for (var key in newState) - state[key] = newState[key]; - dispatch.stateChange(state); - chart.update(); - }); - - controls.dispatch.on('legendClick', function(d,i) { - if (!d.disabled) return; - controlsData = controlsData.map(function(s) { - s.disabled = true; - return s; - }); - d.disabled = false; - - switch (d.key) { - case 'Grouped': - case controlLabels.grouped: - multibar.stacked(false); - break; - case 'Stacked': - case controlLabels.stacked: - multibar.stacked(true); - break; - } - - state.stacked = multibar.stacked(); - dispatch.stateChange(state); - chart.update(); - }); - - // Update chart from a state object passed to event handler - dispatch.on('changeState', function(e) { - if (typeof e.disabled !== 'undefined') { - data.forEach(function(series,i) { - series.disabled = e.disabled[i]; - }); - state.disabled = e.disabled; - } - if (typeof e.stacked !== 'undefined') { - multibar.stacked(e.stacked); - state.stacked = e.stacked; - stacked = e.stacked; - } - chart.update(); - }); - }); - - renderWatch.renderEnd('multibarchart immediate'); - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - multibar.dispatch.on('elementMouseover.tooltip', function(evt) { - evt.value = chart.x()(evt.data); - evt['series'] = { - key: evt.data.key, - value: chart.y()(evt.data), - color: evt.color - }; - tooltip.data(evt).hidden(false); - }); - - multibar.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true); - }); - - multibar.dispatch.on('elementMousemove.tooltip', function(evt) { - tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); - }); - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.dispatch = dispatch; - chart.multibar = multibar; - chart.legend = legend; - chart.controls = controls; - chart.xAxis = xAxis; - chart.yAxis = yAxis; - chart.state = state; - chart.tooltip = tooltip; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - showLegend: {get: function(){return showLegend;}, set: function(_){showLegend=_;}}, - showControls: {get: function(){return showControls;}, set: function(_){showControls=_;}}, - controlLabels: {get: function(){return controlLabels;}, set: function(_){controlLabels=_;}}, - showXAxis: {get: function(){return showXAxis;}, set: function(_){showXAxis=_;}}, - showYAxis: {get: function(){return showYAxis;}, set: function(_){showYAxis=_;}}, - defaultState: {get: function(){return defaultState;}, set: function(_){defaultState=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - reduceXTicks: {get: function(){return reduceXTicks;}, set: function(_){reduceXTicks=_;}}, - rotateLabels: {get: function(){return rotateLabels;}, set: function(_){rotateLabels=_;}}, - staggerLabels: {get: function(){return staggerLabels;}, set: function(_){staggerLabels=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - multibar.duration(duration); - xAxis.duration(duration); - yAxis.duration(duration); - renderWatch.reset(duration); - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - legend.color(color); - }}, - rightAlignYAxis: {get: function(){return rightAlignYAxis;}, set: function(_){ - rightAlignYAxis = _; - yAxis.orient( rightAlignYAxis ? 'right' : 'left'); - }}, - barColor: {get: function(){return multibar.barColor;}, set: function(_){ - multibar.barColor(_); - legend.color(function(d,i) {return d3.rgb('#ccc').darker(i * 1.5).toString();}) - }} - }); - - nv.utils.inheritOptions(chart, multibar); - nv.utils.initOptions(chart); - - return chart; -}; - -nv.models.multiBarHorizontal = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = 960 - , height = 500 - , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one - , container = null - , x = d3.scale.ordinal() - , y = d3.scale.linear() - , getX = function(d) { return d.x } - , getY = function(d) { return d.y } - , getYerr = function(d) { return d.yErr } - , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove - , color = nv.utils.defaultColor() - , barColor = null // adding the ability to set the color for each rather than the whole group - , errorBarColor = nv.utils.defaultColor() - , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled - , stacked = false - , showValues = false - , showBarLabels = false - , valuePadding = 60 - , groupSpacing = 0.1 - , valueFormat = d3.format(',.2f') - , delay = 1200 - , xDomain - , yDomain - , xRange - , yRange - , duration = 250 - , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout', 'elementMousemove', 'renderEnd') - ; - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var x0, y0; //used to store previous scales - var renderWatch = nv.utils.renderWatch(dispatch, duration); - - function chart(selection) { - renderWatch.reset(); - selection.each(function(data) { - var availableWidth = width - margin.left - margin.right, - availableHeight = height - margin.top - margin.bottom; - - container = d3.select(this); - nv.utils.initSVG(container); - - if (stacked) - data = d3.layout.stack() - .offset('zero') - .values(function(d){ return d.values }) - .y(getY) - (data); - - //add series index and key to each data point for reference - data.forEach(function(series, i) { - series.values.forEach(function(point) { - point.series = i; - point.key = series.key; - }); - }); - - // HACK for negative value stacking - if (stacked) - data[0].values.map(function(d,i) { - var posBase = 0, negBase = 0; - data.map(function(d) { - var f = d.values[i] - f.size = Math.abs(f.y); - if (f.y<0) { - f.y1 = negBase - f.size; - negBase = negBase - f.size; - } else - { - f.y1 = posBase; - posBase = posBase + f.size; - } - }); - }); - - // Setup Scales - // remap and flatten the data for use in calculating the scales' domains - var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate - data.map(function(d) { - return d.values.map(function(d,i) { - return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1, yErr: getYerr(d,i) } - }) - }); - - x.domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x })) - .rangeBands(xRange || [0, availableHeight], groupSpacing); - - y.domain(yDomain || d3.extent(d3.merge( - d3.merge(seriesData).map(function(d) { - var domain = d.y; - if (stacked) { - if (d.y > 0){ - domain = d.y1 + d.y - } else { - domain = d.y1 - } - } - var yerr = d.yErr; - if (yerr) { - if (yerr.length) { - return [domain + yerr[0], domain + yerr[1]]; - } else { - yerr = Math.abs(yerr) - return [domain - yerr, domain + yerr]; - } - } else { - return [domain]; - } - })).concat(forceY))) - - if (showValues && !stacked) - y.range(yRange || [(y.domain()[0] < 0 ? valuePadding : 0), availableWidth - (y.domain()[1] > 0 ? valuePadding : 0) ]); - else - y.range(yRange || [0, availableWidth]); - - x0 = x0 || x; - y0 = y0 || d3.scale.linear().domain(y.domain()).range([y(0),y(0)]); - - // Setup containers and skeleton of chart - var wrap = d3.select(this).selectAll('g.nv-wrap.nv-multibarHorizontal').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibarHorizontal'); - var defsEnter = wrapEnter.append('defs'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-groups'); - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - var groups = wrap.select('.nv-groups').selectAll('.nv-group') - .data(function(d) { return d }, function(d,i) { return i }); - groups.enter().append('g') - .style('stroke-opacity', 1e-6) - .style('fill-opacity', 1e-6); - groups.exit().watchTransition(renderWatch, 'multibarhorizontal: exit groups') - .style('stroke-opacity', 1e-6) - .style('fill-opacity', 1e-6) - .remove(); - groups - .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) - .classed('hover', function(d) { return d.hover }) - .style('fill', function(d,i){ return color(d, i) }) - .style('stroke', function(d,i){ return color(d, i) }); - groups.watchTransition(renderWatch, 'multibarhorizontal: groups') - .style('stroke-opacity', 1) - .style('fill-opacity', .75); - - var bars = groups.selectAll('g.nv-bar') - .data(function(d) { return d.values }); - bars.exit().remove(); - - var barsEnter = bars.enter().append('g') - .attr('transform', function(d,i,j) { - return 'translate(' + y0(stacked ? d.y0 : 0) + ',' + (stacked ? 0 : (j * x.rangeBand() / data.length ) + x(getX(d,i))) + ')' - }); - - barsEnter.append('rect') - .attr('width', 0) - .attr('height', x.rangeBand() / (stacked ? 1 : data.length) ) - - bars - .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here - d3.select(this).classed('hover', true); - dispatch.elementMouseover({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - }) - .on('mouseout', function(d,i) { - d3.select(this).classed('hover', false); - dispatch.elementMouseout({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - }) - .on('mouseout', function(d,i) { - dispatch.elementMouseout({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - }) - .on('mousemove', function(d,i) { - dispatch.elementMousemove({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - }) - .on('click', function(d,i) { - dispatch.elementClick({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - d3.event.stopPropagation(); - }) - .on('dblclick', function(d,i) { - dispatch.elementDblClick({ - data: d, - index: i, - color: d3.select(this).style("fill") - }); - d3.event.stopPropagation(); - }); - - if (getYerr(data[0].values[0], 0)) { - barsEnter.append('polyline'); - - bars.select('polyline') - .attr('fill', 'none') - .attr('stroke', function(d,i,j) { return errorBarColor(d, j, i); }) - .attr('points', function(d,i) { - var xerr = getYerr(d,i) - , mid = 0.8 * x.rangeBand() / ((stacked ? 1 : data.length) * 2); - xerr = xerr.length ? xerr : [-Math.abs(xerr), Math.abs(xerr)]; - xerr = xerr.map(function(e) { return y(e) - y(0); }); - var a = [[xerr[0],-mid], [xerr[0],mid], [xerr[0],0], [xerr[1],0], [xerr[1],-mid], [xerr[1],mid]]; - return a.map(function (path) { return path.join(',') }).join(' '); - }) - .attr('transform', function(d,i) { - var mid = x.rangeBand() / ((stacked ? 1 : data.length) * 2); - return 'translate(' + (getY(d,i) < 0 ? 0 : y(getY(d,i)) - y(0)) + ', ' + mid + ')' - }); - } - - barsEnter.append('text'); - - if (showValues && !stacked) { - bars.select('text') - .attr('text-anchor', function(d,i) { return getY(d,i) < 0 ? 'end' : 'start' }) - .attr('y', x.rangeBand() / (data.length * 2)) - .attr('dy', '.32em') - .text(function(d,i) { - var t = valueFormat(getY(d,i)) - , yerr = getYerr(d,i); - if (yerr === undefined) - return t; - if (!yerr.length) - return t + '±' + valueFormat(Math.abs(yerr)); - return t + '+' + valueFormat(Math.abs(yerr[1])) + '-' + valueFormat(Math.abs(yerr[0])); - }); - bars.watchTransition(renderWatch, 'multibarhorizontal: bars') - .select('text') - .attr('x', function(d,i) { return getY(d,i) < 0 ? -4 : y(getY(d,i)) - y(0) + 4 }) - } else { - bars.selectAll('text').text(''); - } - - if (showBarLabels && !stacked) { - barsEnter.append('text').classed('nv-bar-label',true); - bars.select('text.nv-bar-label') - .attr('text-anchor', function(d,i) { return getY(d,i) < 0 ? 'start' : 'end' }) - .attr('y', x.rangeBand() / (data.length * 2)) - .attr('dy', '.32em') - .text(function(d,i) { return getX(d,i) }); - bars.watchTransition(renderWatch, 'multibarhorizontal: bars') - .select('text.nv-bar-label') - .attr('x', function(d,i) { return getY(d,i) < 0 ? y(0) - y(getY(d,i)) + 4 : -4 }); - } - else { - bars.selectAll('text.nv-bar-label').text(''); - } - - bars - .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'}) - - if (barColor) { - if (!disabled) disabled = data.map(function() { return true }); - bars - .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }) - .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }); - } - - if (stacked) - bars.watchTransition(renderWatch, 'multibarhorizontal: bars') - .attr('transform', function(d,i) { - return 'translate(' + y(d.y1) + ',' + x(getX(d,i)) + ')' - }) - .select('rect') - .attr('width', function(d,i) { - return Math.abs(y(getY(d,i) + d.y0) - y(d.y0)) - }) - .attr('height', x.rangeBand() ); - else - bars.watchTransition(renderWatch, 'multibarhorizontal: bars') - .attr('transform', function(d,i) { - //TODO: stacked must be all positive or all negative, not both? - return 'translate(' + - (getY(d,i) < 0 ? y(getY(d,i)) : y(0)) - + ',' + - (d.series * x.rangeBand() / data.length - + - x(getX(d,i)) ) - + ')' - }) - .select('rect') - .attr('height', x.rangeBand() / data.length ) - .attr('width', function(d,i) { - return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) - }); - - //store old scales for use in transitions on update - x0 = x.copy(); - y0 = y.copy(); - - }); - - renderWatch.renderEnd('multibarHorizontal immediate'); - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - x: {get: function(){return getX;}, set: function(_){getX=_;}}, - y: {get: function(){return getY;}, set: function(_){getY=_;}}, - yErr: {get: function(){return getYerr;}, set: function(_){getYerr=_;}}, - xScale: {get: function(){return x;}, set: function(_){x=_;}}, - yScale: {get: function(){return y;}, set: function(_){y=_;}}, - xDomain: {get: function(){return xDomain;}, set: function(_){xDomain=_;}}, - yDomain: {get: function(){return yDomain;}, set: function(_){yDomain=_;}}, - xRange: {get: function(){return xRange;}, set: function(_){xRange=_;}}, - yRange: {get: function(){return yRange;}, set: function(_){yRange=_;}}, - forceY: {get: function(){return forceY;}, set: function(_){forceY=_;}}, - stacked: {get: function(){return stacked;}, set: function(_){stacked=_;}}, - showValues: {get: function(){return showValues;}, set: function(_){showValues=_;}}, - // this shows the group name, seems pointless? - //showBarLabels: {get: function(){return showBarLabels;}, set: function(_){showBarLabels=_;}}, - disabled: {get: function(){return disabled;}, set: function(_){disabled=_;}}, - id: {get: function(){return id;}, set: function(_){id=_;}}, - valueFormat: {get: function(){return valueFormat;}, set: function(_){valueFormat=_;}}, - valuePadding: {get: function(){return valuePadding;}, set: function(_){valuePadding=_;}}, - groupSpacing:{get: function(){return groupSpacing;}, set: function(_){groupSpacing=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }}, - barColor: {get: function(){return barColor;}, set: function(_){ - barColor = _ ? nv.utils.getColor(_) : null; - }}, - errorBarColor: {get: function(){return errorBarColor;}, set: function(_){ - errorBarColor = _ ? nv.utils.getColor(_) : null; - }} - }); - - nv.utils.initOptions(chart); - - return chart; -}; - -nv.models.multiBarHorizontalChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var multibar = nv.models.multiBarHorizontal() - , xAxis = nv.models.axis() - , yAxis = nv.models.axis() - , legend = nv.models.legend().height(30) - , controls = nv.models.legend().height(30) - , tooltip = nv.models.tooltip() - ; - - var margin = {top: 30, right: 20, bottom: 50, left: 60} - , width = null - , height = null - , color = nv.utils.defaultColor() - , showControls = true - , controlLabels = {} - , showLegend = true - , showXAxis = true - , showYAxis = true - , stacked = false - , x //can be accessed via chart.xScale() - , y //can be accessed via chart.yScale() - , state = nv.utils.state() - , defaultState = null - , noData = null - , dispatch = d3.dispatch('stateChange', 'changeState','renderEnd') - , controlWidth = function() { return showControls ? 180 : 0 } - , duration = 250 - ; - - state.stacked = false; // DEPRECATED Maintained for backward compatibility - - multibar.stacked(stacked); - - xAxis - .orient('left') - .tickPadding(5) - .showMaxMin(false) - .tickFormat(function(d) { return d }) - ; - yAxis - .orient('bottom') - .tickFormat(d3.format(',.1f')) - ; - - tooltip - .duration(0) - .valueFormatter(function(d, i) { - return yAxis.tickFormat()(d, i); - }) - .headerFormatter(function(d, i) { - return xAxis.tickFormat()(d, i); - }); - - controls.updateState(false); - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var stateGetter = function(data) { - return function(){ - return { - active: data.map(function(d) { return !d.disabled }), - stacked: stacked - }; - } - }; - - var stateSetter = function(data) { - return function(state) { - if (state.stacked !== undefined) - stacked = state.stacked; - if (state.active !== undefined) - data.forEach(function(series,i) { - series.disabled = !state.active[i]; - }); - } - }; - - var renderWatch = nv.utils.renderWatch(dispatch, duration); - - function chart(selection) { - renderWatch.reset(); - renderWatch.models(multibar); - if (showXAxis) renderWatch.models(xAxis); - if (showYAxis) renderWatch.models(yAxis); - - selection.each(function(data) { - var container = d3.select(this), - that = this; - nv.utils.initSVG(container); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - chart.update = function() { container.transition().duration(duration).call(chart) }; - chart.container = this; - - stacked = multibar.stacked(); - - state - .setter(stateSetter(data), chart.update) - .getter(stateGetter(data)) - .update(); - - // DEPRECATED set state.disableddisabled - state.disabled = data.map(function(d) { return !!d.disabled }); - - if (!defaultState) { - var key; - defaultState = {}; - for (key in state) { - if (state[key] instanceof Array) - defaultState[key] = state[key].slice(0); - else - defaultState[key] = state[key]; - } - } - - // Display No Data message if there's nothing to show. - if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { - nv.utils.noData(chart, container) - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - // Setup Scales - x = multibar.xScale(); - y = multibar.yScale(); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-multiBarHorizontalChart').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarHorizontalChart').append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-x nv-axis'); - gEnter.append('g').attr('class', 'nv-y nv-axis') - .append('g').attr('class', 'nv-zeroLine') - .append('line'); - gEnter.append('g').attr('class', 'nv-barsWrap'); - gEnter.append('g').attr('class', 'nv-legendWrap'); - gEnter.append('g').attr('class', 'nv-controlsWrap'); - - // Legend - if (showLegend) { - legend.width(availableWidth - controlWidth()); - - g.select('.nv-legendWrap') - .datum(data) - .call(legend); - - if ( margin.top != legend.height()) { - margin.top = legend.height(); - availableHeight = nv.utils.availableHeight(height, container, margin); - } - - g.select('.nv-legendWrap') - .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')'); - } - - // Controls - if (showControls) { - var controlsData = [ - { key: controlLabels.grouped || 'Grouped', disabled: multibar.stacked() }, - { key: controlLabels.stacked || 'Stacked', disabled: !multibar.stacked() } - ]; - - controls.width(controlWidth()).color(['#444', '#444', '#444']); - g.select('.nv-controlsWrap') - .datum(controlsData) - .attr('transform', 'translate(0,' + (-margin.top) +')') - .call(controls); - } - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - // Main Chart Component(s) - multibar - .disabled(data.map(function(series) { return series.disabled })) - .width(availableWidth) - .height(availableHeight) - .color(data.map(function(d,i) { - return d.color || color(d, i); - }).filter(function(d,i) { return !data[i].disabled })); - - var barsWrap = g.select('.nv-barsWrap') - .datum(data.filter(function(d) { return !d.disabled })); - - barsWrap.transition().call(multibar); - - // Setup Axes - if (showXAxis) { - xAxis - .scale(x) - ._ticks( nv.utils.calcTicksY(availableHeight/24, data) ) - .tickSize(-availableWidth, 0); - - g.select('.nv-x.nv-axis').call(xAxis); - - var xTicks = g.select('.nv-x.nv-axis').selectAll('g'); - - xTicks - .selectAll('line, text'); - } - - if (showYAxis) { - yAxis - .scale(y) - ._ticks( nv.utils.calcTicksX(availableWidth/100, data) ) - .tickSize( -availableHeight, 0); - - g.select('.nv-y.nv-axis') - .attr('transform', 'translate(0,' + availableHeight + ')'); - g.select('.nv-y.nv-axis').call(yAxis); - } - - // Zero line - g.select(".nv-zeroLine line") - .attr("x1", y(0)) - .attr("x2", y(0)) - .attr("y1", 0) - .attr("y2", -availableHeight) - ; - - //============================================================ - // Event Handling/Dispatching (in chart's scope) - //------------------------------------------------------------ - - legend.dispatch.on('stateChange', function(newState) { - for (var key in newState) - state[key] = newState[key]; - dispatch.stateChange(state); - chart.update(); - }); - - controls.dispatch.on('legendClick', function(d,i) { - if (!d.disabled) return; - controlsData = controlsData.map(function(s) { - s.disabled = true; - return s; - }); - d.disabled = false; - - switch (d.key) { - case 'Grouped': - multibar.stacked(false); - break; - case 'Stacked': - multibar.stacked(true); - break; - } - - state.stacked = multibar.stacked(); - dispatch.stateChange(state); - stacked = multibar.stacked(); - - chart.update(); - }); - - // Update chart from a state object passed to event handler - dispatch.on('changeState', function(e) { - - if (typeof e.disabled !== 'undefined') { - data.forEach(function(series,i) { - series.disabled = e.disabled[i]; - }); - - state.disabled = e.disabled; - } - - if (typeof e.stacked !== 'undefined') { - multibar.stacked(e.stacked); - state.stacked = e.stacked; - stacked = e.stacked; - } - - chart.update(); - }); - }); - renderWatch.renderEnd('multibar horizontal chart immediate'); - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - multibar.dispatch.on('elementMouseover.tooltip', function(evt) { - evt.value = chart.x()(evt.data); - evt['series'] = { - key: evt.data.key, - value: chart.y()(evt.data), - color: evt.color - }; - tooltip.data(evt).hidden(false); - }); - - multibar.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true); - }); - - multibar.dispatch.on('elementMousemove.tooltip', function(evt) { - tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); - }); - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.dispatch = dispatch; - chart.multibar = multibar; - chart.legend = legend; - chart.controls = controls; - chart.xAxis = xAxis; - chart.yAxis = yAxis; - chart.state = state; - chart.tooltip = tooltip; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - showLegend: {get: function(){return showLegend;}, set: function(_){showLegend=_;}}, - showControls: {get: function(){return showControls;}, set: function(_){showControls=_;}}, - controlLabels: {get: function(){return controlLabels;}, set: function(_){controlLabels=_;}}, - showXAxis: {get: function(){return showXAxis;}, set: function(_){showXAxis=_;}}, - showYAxis: {get: function(){return showYAxis;}, set: function(_){showYAxis=_;}}, - defaultState: {get: function(){return defaultState;}, set: function(_){defaultState=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - multibar.duration(duration); - xAxis.duration(duration); - yAxis.duration(duration); - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - legend.color(color); - }}, - barColor: {get: function(){return multibar.barColor;}, set: function(_){ - multibar.barColor(_); - legend.color(function(d,i) {return d3.rgb('#ccc').darker(i * 1.5).toString();}) - }} - }); - - nv.utils.inheritOptions(chart, multibar); - nv.utils.initOptions(chart); - - return chart; -}; -nv.models.multiChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 30, right: 20, bottom: 50, left: 60}, - color = nv.utils.defaultColor(), - width = null, - height = null, - showLegend = true, - noData = null, - yDomain1, - yDomain2, - getX = function(d) { return d.x }, - getY = function(d) { return d.y}, - interpolate = 'monotone', - useVoronoi = true - ; - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var x = d3.scale.linear(), - yScale1 = d3.scale.linear(), - yScale2 = d3.scale.linear(), - - lines1 = nv.models.line().yScale(yScale1), - lines2 = nv.models.line().yScale(yScale2), - - bars1 = nv.models.multiBar().stacked(false).yScale(yScale1), - bars2 = nv.models.multiBar().stacked(false).yScale(yScale2), - - stack1 = nv.models.stackedArea().yScale(yScale1), - stack2 = nv.models.stackedArea().yScale(yScale2), - - xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5), - yAxis1 = nv.models.axis().scale(yScale1).orient('left'), - yAxis2 = nv.models.axis().scale(yScale2).orient('right'), - - legend = nv.models.legend().height(30), - tooltip = nv.models.tooltip(), - dispatch = d3.dispatch(); - - function chart(selection) { - selection.each(function(data) { - var container = d3.select(this), - that = this; - nv.utils.initSVG(container); - - chart.update = function() { container.transition().call(chart); }; - chart.container = this; - - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - var dataLines1 = data.filter(function(d) {return d.type == 'line' && d.yAxis == 1}); - var dataLines2 = data.filter(function(d) {return d.type == 'line' && d.yAxis == 2}); - var dataBars1 = data.filter(function(d) {return d.type == 'bar' && d.yAxis == 1}); - var dataBars2 = data.filter(function(d) {return d.type == 'bar' && d.yAxis == 2}); - var dataStack1 = data.filter(function(d) {return d.type == 'area' && d.yAxis == 1}); - var dataStack2 = data.filter(function(d) {return d.type == 'area' && d.yAxis == 2}); - - // Display noData message if there's nothing to show. - if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { - nv.utils.noData(chart, container); - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - var series1 = data.filter(function(d) {return !d.disabled && d.yAxis == 1}) - .map(function(d) { - return d.values.map(function(d,i) { - return { x: d.x, y: d.y } - }) - }); - - var series2 = data.filter(function(d) {return !d.disabled && d.yAxis == 2}) - .map(function(d) { - return d.values.map(function(d,i) { - return { x: d.x, y: d.y } - }) - }); - - x .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } )) - .range([0, availableWidth]); - - var wrap = container.selectAll('g.wrap.multiChart').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 multiChart').append('g'); - - gEnter.append('g').attr('class', 'nv-x nv-axis'); - gEnter.append('g').attr('class', 'nv-y1 nv-axis'); - gEnter.append('g').attr('class', 'nv-y2 nv-axis'); - gEnter.append('g').attr('class', 'lines1Wrap'); - gEnter.append('g').attr('class', 'lines2Wrap'); - gEnter.append('g').attr('class', 'bars1Wrap'); - gEnter.append('g').attr('class', 'bars2Wrap'); - gEnter.append('g').attr('class', 'stack1Wrap'); - gEnter.append('g').attr('class', 'stack2Wrap'); - gEnter.append('g').attr('class', 'legendWrap'); - - var g = wrap.select('g'); - - var color_array = data.map(function(d,i) { - return data[i].color || color(d, i); - }); - - if (showLegend) { - var legendWidth = legend.align() ? availableWidth / 2 : availableWidth; - var legendXPosition = legend.align() ? legendWidth : 0; - - legend.width(legendWidth); - legend.color(color_array); - - g.select('.legendWrap') - .datum(data.map(function(series) { - series.originalKey = series.originalKey === undefined ? series.key : series.originalKey; - series.key = series.originalKey + (series.yAxis == 1 ? '' : ' (right axis)'); - return series; - })) - .call(legend); - - if ( margin.top != legend.height()) { - margin.top = legend.height(); - availableHeight = nv.utils.availableHeight(height, container, margin); - } - - g.select('.legendWrap') - .attr('transform', 'translate(' + legendXPosition + ',' + (-margin.top) +')'); - } - - lines1 - .width(availableWidth) - .height(availableHeight) - .interpolate(interpolate) - .color(color_array.filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'line'})); - lines2 - .width(availableWidth) - .height(availableHeight) - .interpolate(interpolate) - .color(color_array.filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'line'})); - bars1 - .width(availableWidth) - .height(availableHeight) - .color(color_array.filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'bar'})); - bars2 - .width(availableWidth) - .height(availableHeight) - .color(color_array.filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'bar'})); - stack1 - .width(availableWidth) - .height(availableHeight) - .color(color_array.filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'area'})); - stack2 - .width(availableWidth) - .height(availableHeight) - .color(color_array.filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'area'})); - - g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - var lines1Wrap = g.select('.lines1Wrap') - .datum(dataLines1.filter(function(d){return !d.disabled})); - var bars1Wrap = g.select('.bars1Wrap') - .datum(dataBars1.filter(function(d){return !d.disabled})); - var stack1Wrap = g.select('.stack1Wrap') - .datum(dataStack1.filter(function(d){return !d.disabled})); - var lines2Wrap = g.select('.lines2Wrap') - .datum(dataLines2.filter(function(d){return !d.disabled})); - var bars2Wrap = g.select('.bars2Wrap') - .datum(dataBars2.filter(function(d){return !d.disabled})); - var stack2Wrap = g.select('.stack2Wrap') - .datum(dataStack2.filter(function(d){return !d.disabled})); - - var extraValue1 = dataStack1.length ? dataStack1.map(function(a){return a.values}).reduce(function(a,b){ - return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}}) - }).concat([{x:0, y:0}]) : []; - var extraValue2 = dataStack2.length ? dataStack2.map(function(a){return a.values}).reduce(function(a,b){ - return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}}) - }).concat([{x:0, y:0}]) : []; - - yScale1 .domain(yDomain1 || d3.extent(d3.merge(series1).concat(extraValue1), function(d) { return d.y } )) - .range([0, availableHeight]); - - yScale2 .domain(yDomain2 || d3.extent(d3.merge(series2).concat(extraValue2), function(d) { return d.y } )) - .range([0, availableHeight]); - - lines1.yDomain(yScale1.domain()); - bars1.yDomain(yScale1.domain()); - stack1.yDomain(yScale1.domain()); - - lines2.yDomain(yScale2.domain()); - bars2.yDomain(yScale2.domain()); - stack2.yDomain(yScale2.domain()); - - if(dataStack1.length){d3.transition(stack1Wrap).call(stack1);} - if(dataStack2.length){d3.transition(stack2Wrap).call(stack2);} - - if(dataBars1.length){d3.transition(bars1Wrap).call(bars1);} - if(dataBars2.length){d3.transition(bars2Wrap).call(bars2);} - - if(dataLines1.length){d3.transition(lines1Wrap).call(lines1);} - if(dataLines2.length){d3.transition(lines2Wrap).call(lines2);} - - xAxis - ._ticks( nv.utils.calcTicksX(availableWidth/100, data) ) - .tickSize(-availableHeight, 0); - - g.select('.nv-x.nv-axis') - .attr('transform', 'translate(0,' + availableHeight + ')'); - d3.transition(g.select('.nv-x.nv-axis')) - .call(xAxis); - - yAxis1 - ._ticks( nv.utils.calcTicksY(availableHeight/36, data) ) - .tickSize( -availableWidth, 0); - - - d3.transition(g.select('.nv-y1.nv-axis')) - .call(yAxis1); - - yAxis2 - ._ticks( nv.utils.calcTicksY(availableHeight/36, data) ) - .tickSize( -availableWidth, 0); - - d3.transition(g.select('.nv-y2.nv-axis')) - .call(yAxis2); - - g.select('.nv-y1.nv-axis') - .classed('nv-disabled', series1.length ? false : true) - .attr('transform', 'translate(' + x.range()[0] + ',0)'); - - g.select('.nv-y2.nv-axis') - .classed('nv-disabled', series2.length ? false : true) - .attr('transform', 'translate(' + x.range()[1] + ',0)'); - - legend.dispatch.on('stateChange', function(newState) { - chart.update(); - }); - - //============================================================ - // Event Handling/Dispatching - //------------------------------------------------------------ - - function mouseover_line(evt) { - var yaxis = data[evt.seriesIndex].yAxis === 2 ? yAxis2 : yAxis1; - evt.value = evt.point.x; - evt.series = { - value: evt.point.y, - color: evt.point.color - }; - tooltip - .duration(100) - .valueFormatter(function(d, i) { - return yaxis.tickFormat()(d, i); - }) - .data(evt) - .position(evt.pos) - .hidden(false); - } - - function mouseover_stack(evt) { - var yaxis = data[evt.seriesIndex].yAxis === 2 ? yAxis2 : yAxis1; - evt.point['x'] = stack1.x()(evt.point); - evt.point['y'] = stack1.y()(evt.point); - tooltip - .duration(100) - .valueFormatter(function(d, i) { - return yaxis.tickFormat()(d, i); - }) - .data(evt) - .position(evt.pos) - .hidden(false); - } - - function mouseover_bar(evt) { - var yaxis = data[evt.data.series].yAxis === 2 ? yAxis2 : yAxis1; - - evt.value = bars1.x()(evt.data); - evt['series'] = { - value: bars1.y()(evt.data), - color: evt.color - }; - tooltip - .duration(0) - .valueFormatter(function(d, i) { - return yaxis.tickFormat()(d, i); - }) - .data(evt) - .hidden(false); - } - - lines1.dispatch.on('elementMouseover.tooltip', mouseover_line); - lines2.dispatch.on('elementMouseover.tooltip', mouseover_line); - lines1.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true) - }); - lines2.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true) - }); - - stack1.dispatch.on('elementMouseover.tooltip', mouseover_stack); - stack2.dispatch.on('elementMouseover.tooltip', mouseover_stack); - stack1.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true) - }); - stack2.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true) - }); - - bars1.dispatch.on('elementMouseover.tooltip', mouseover_bar); - bars2.dispatch.on('elementMouseover.tooltip', mouseover_bar); - - bars1.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true); - }); - bars2.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true); - }); - bars1.dispatch.on('elementMousemove.tooltip', function(evt) { - tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); - }); - bars2.dispatch.on('elementMousemove.tooltip', function(evt) { - tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); - }); - - }); - - return chart; - } - - //============================================================ - // Global getters and setters - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.lines1 = lines1; - chart.lines2 = lines2; - chart.bars1 = bars1; - chart.bars2 = bars2; - chart.stack1 = stack1; - chart.stack2 = stack2; - chart.xAxis = xAxis; - chart.yAxis1 = yAxis1; - chart.yAxis2 = yAxis2; - chart.tooltip = tooltip; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - showLegend: {get: function(){return showLegend;}, set: function(_){showLegend=_;}}, - yDomain1: {get: function(){return yDomain1;}, set: function(_){yDomain1=_;}}, - yDomain2: {get: function(){return yDomain2;}, set: function(_){yDomain2=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - interpolate: {get: function(){return interpolate;}, set: function(_){interpolate=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }}, - x: {get: function(){return getX;}, set: function(_){ - getX = _; - lines1.x(_); - lines2.x(_); - bars1.x(_); - bars2.x(_); - stack1.x(_); - stack2.x(_); - }}, - y: {get: function(){return getY;}, set: function(_){ - getY = _; - lines1.y(_); - lines2.y(_); - stack1.y(_); - stack2.y(_); - bars1.y(_); - bars2.y(_); - }}, - useVoronoi: {get: function(){return useVoronoi;}, set: function(_){ - useVoronoi=_; - lines1.useVoronoi(_); - lines2.useVoronoi(_); - stack1.useVoronoi(_); - stack2.useVoronoi(_); - }} - }); - - nv.utils.initOptions(chart); - - return chart; -}; - - -nv.models.ohlcBar = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = null - , height = null - , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one - , container = null - , x = d3.scale.linear() - , y = d3.scale.linear() - , getX = function(d) { return d.x } - , getY = function(d) { return d.y } - , getOpen = function(d) { return d.open } - , getClose = function(d) { return d.close } - , getHigh = function(d) { return d.high } - , getLow = function(d) { return d.low } - , forceX = [] - , forceY = [] - , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart - , clipEdge = true - , color = nv.utils.defaultColor() - , interactive = false - , xDomain - , yDomain - , xRange - , yRange - , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState', 'renderEnd', 'chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout', 'elementMousemove') - ; - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - function chart(selection) { - selection.each(function(data) { - container = d3.select(this); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - nv.utils.initSVG(container); - - // ohlc bar width. - var w = (availableWidth / data[0].values.length) * .9; - - // Setup Scales - x.domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) )); - - if (padData) - x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); - else - x.range(xRange || [5 + w/2, availableWidth - w/2 - 5]); - - y.domain(yDomain || [ - d3.min(data[0].values.map(getLow).concat(forceY)), - d3.max(data[0].values.map(getHigh).concat(forceY)) - ] - ).range(yRange || [availableHeight, 0]); - - // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point - if (x.domain()[0] === x.domain()[1]) - x.domain()[0] ? - x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) - : x.domain([-1,1]); - - if (y.domain()[0] === y.domain()[1]) - y.domain()[0] ? - y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) - : y.domain([-1,1]); - - // Setup containers and skeleton of chart - var wrap = d3.select(this).selectAll('g.nv-wrap.nv-ohlcBar').data([data[0].values]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-ohlcBar'); - var defsEnter = wrapEnter.append('defs'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-ticks'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - container - .on('click', function(d,i) { - dispatch.chartClick({ - data: d, - index: i, - pos: d3.event, - id: id - }); - }); - - defsEnter.append('clipPath') - .attr('id', 'nv-chart-clip-path-' + id) - .append('rect'); - - wrap.select('#nv-chart-clip-path-' + id + ' rect') - .attr('width', availableWidth) - .attr('height', availableHeight); - - g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : ''); - - var ticks = wrap.select('.nv-ticks').selectAll('.nv-tick') - .data(function(d) { return d }); - ticks.exit().remove(); - - ticks.enter().append('path') - .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i }) - .attr('d', function(d,i) { - return 'm0,0l0,' - + (y(getOpen(d,i)) - - y(getHigh(d,i))) - + 'l' - + (-w/2) - + ',0l' - + (w/2) - + ',0l0,' - + (y(getLow(d,i)) - y(getOpen(d,i))) - + 'l0,' - + (y(getClose(d,i)) - - y(getLow(d,i))) - + 'l' - + (w/2) - + ',0l' - + (-w/2) - + ',0z'; - }) - .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; }) - .attr('fill', function(d,i) { return color[0]; }) - .attr('stroke', function(d,i) { return color[0]; }) - .attr('x', 0 ) - .attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) }) - .attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) }); - - // the bar colors are controlled by CSS currently - ticks.attr('class', function(d,i,j) { - return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i; - }); - - d3.transition(ticks) - .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; }) - .attr('d', function(d,i) { - var w = (availableWidth / data[0].values.length) * .9; - return 'm0,0l0,' - + (y(getOpen(d,i)) - - y(getHigh(d,i))) - + 'l' - + (-w/2) - + ',0l' - + (w/2) - + ',0l0,' - + (y(getLow(d,i)) - - y(getOpen(d,i))) - + 'l0,' - + (y(getClose(d,i)) - - y(getLow(d,i))) - + 'l' - + (w/2) - + ',0l' - + (-w/2) - + ',0z'; - }); - }); - - return chart; - } - - - //Create methods to allow outside functions to highlight a specific bar. - chart.highlightPoint = function(pointIndex, isHoverOver) { - chart.clearHighlights(); - container.select(".nv-ohlcBar .nv-tick-0-" + pointIndex) - .classed("hover", isHoverOver) - ; - }; - - chart.clearHighlights = function() { - container.select(".nv-ohlcBar .nv-tick.hover") - .classed("hover", false) - ; - }; - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - xScale: {get: function(){return x;}, set: function(_){x=_;}}, - yScale: {get: function(){return y;}, set: function(_){y=_;}}, - xDomain: {get: function(){return xDomain;}, set: function(_){xDomain=_;}}, - yDomain: {get: function(){return yDomain;}, set: function(_){yDomain=_;}}, - xRange: {get: function(){return xRange;}, set: function(_){xRange=_;}}, - yRange: {get: function(){return yRange;}, set: function(_){yRange=_;}}, - forceX: {get: function(){return forceX;}, set: function(_){forceX=_;}}, - forceY: {get: function(){return forceY;}, set: function(_){forceY=_;}}, - padData: {get: function(){return padData;}, set: function(_){padData=_;}}, - clipEdge: {get: function(){return clipEdge;}, set: function(_){clipEdge=_;}}, - id: {get: function(){return id;}, set: function(_){id=_;}}, - interactive: {get: function(){return interactive;}, set: function(_){interactive=_;}}, - - x: {get: function(){return getX;}, set: function(_){getX=_;}}, - y: {get: function(){return getY;}, set: function(_){getY=_;}}, - open: {get: function(){return getOpen();}, set: function(_){getOpen=_;}}, - close: {get: function(){return getClose();}, set: function(_){getClose=_;}}, - high: {get: function(){return getHigh;}, set: function(_){getHigh=_;}}, - low: {get: function(){return getLow;}, set: function(_){getLow=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top != undefined ? _.top : margin.top; - margin.right = _.right != undefined ? _.right : margin.right; - margin.bottom = _.bottom != undefined ? _.bottom : margin.bottom; - margin.left = _.left != undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }} - }); - - nv.utils.initOptions(chart); - return chart; -}; -// Code adapted from Jason Davies' "Parallel Coordinates" -// http://bl.ocks.org/jasondavies/1341281 -nv.models.parallelCoordinates = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 30, right: 0, bottom: 10, left: 0} - , width = null - , height = null - , x = d3.scale.ordinal() - , y = {} - , dimensionNames = [] - , dimensionFormats = [] - , color = nv.utils.defaultColor() - , filters = [] - , active = [] - , dragging = [] - , lineTension = 1 - , dispatch = d3.dispatch('brush', 'elementMouseover', 'elementMouseout') - ; - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - function chart(selection) { - selection.each(function(data) { - var container = d3.select(this); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - nv.utils.initSVG(container); - - active = data; //set all active before first brush call - - // Setup Scales - x.rangePoints([0, availableWidth], 1).domain(dimensionNames); - - //Set as true if all values on an axis are missing. - var onlyNanValues = {}; - // Extract the list of dimensions and create a scale for each. - dimensionNames.forEach(function(d) { - var extent = d3.extent(data, function(p) { return +p[d]; }); - onlyNanValues[d] = false; - //If there is no values to display on an axis, set the extent to 0 - if (extent[0] === undefined) { - onlyNanValues[d] = true; - extent[0] = 0; - extent[1] = 0; - } - //Scale axis if there is only one value - if (extent[0] === extent[1]) { - extent[0] = extent[0] - 1; - extent[1] = extent[1] + 1; - } - //Use 90% of (availableHeight - 12) for the axis range, 12 reprensenting the space necessary to display "undefined values" text. - //The remaining 10% are used to display the missingValue line. - y[d] = d3.scale.linear() - .domain(extent) - .range([(availableHeight - 12) * 0.9, 0]); - - y[d].brush = d3.svg.brush().y(y[d]).on('brush', brush); - - return d != 'name'; - }); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-parallelCoordinates').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-parallelCoordinates'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-parallelCoordinates background'); - gEnter.append('g').attr('class', 'nv-parallelCoordinates foreground'); - gEnter.append('g').attr('class', 'nv-parallelCoordinates missingValuesline'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - var line = d3.svg.line().interpolate('cardinal').tension(lineTension), - axis = d3.svg.axis().orient('left'), - axisDrag = d3.behavior.drag() - .on('dragstart', dragStart) - .on('drag', dragMove) - .on('dragend', dragEnd); - - //Add missing value line at the bottom of the chart - var missingValuesline, missingValueslineText; - var step = x.range()[1] - x.range()[0]; - var axisWithMissingValues = []; - var lineData = [0 + step / 2, availableHeight - 12, availableWidth - step / 2, availableHeight - 12]; - missingValuesline = wrap.select('.missingValuesline').selectAll('line').data([lineData]); - missingValuesline.enter().append('line'); - missingValuesline.exit().remove(); - missingValuesline.attr("x1", function(d) { return d[0]; }) - .attr("y1", function(d) { return d[1]; }) - .attr("x2", function(d) { return d[2]; }) - .attr("y2", function(d) { return d[3]; }); - - //Add the text "undefined values" under the missing value line - missingValueslineText = wrap.select('.missingValuesline').selectAll('text').data(["undefined values"]); - missingValueslineText.append('text').data(["undefined values"]); - missingValueslineText.enter().append('text'); - missingValueslineText.exit().remove(); - missingValueslineText.attr("y", availableHeight) - //To have the text right align with the missingValues line, substract 92 representing the text size. - .attr("x", availableWidth - 92 - step / 2) - .text(function(d) { return d; }); - - // Add grey background lines for context. - var background = wrap.select('.background').selectAll('path').data(data); - background.enter().append('path'); - background.exit().remove(); - background.attr('d', path); - - // Add blue foreground lines for focus. - var foreground = wrap.select('.foreground').selectAll('path').data(data); - foreground.enter().append('path') - foreground.exit().remove(); - foreground.attr('d', path).attr('stroke', color); - foreground.on("mouseover", function (d, i) { - d3.select(this).classed('hover', true); - dispatch.elementMouseover({ - label: d.name, - data: d.data, - index: i, - pos: [d3.mouse(this.parentNode)[0], d3.mouse(this.parentNode)[1]] - }); - - }); - foreground.on("mouseout", function (d, i) { - d3.select(this).classed('hover', false); - dispatch.elementMouseout({ - label: d.name, - data: d.data, - index: i - }); - }); - - // Add a group element for each dimension. - var dimensions = g.selectAll('.dimension').data(dimensionNames); - var dimensionsEnter = dimensions.enter().append('g').attr('class', 'nv-parallelCoordinates dimension'); - dimensionsEnter.append('g').attr('class', 'nv-parallelCoordinates nv-axis'); - dimensionsEnter.append('g').attr('class', 'nv-parallelCoordinates-brush'); - dimensionsEnter.append('text').attr('class', 'nv-parallelCoordinates nv-label'); - - dimensions.attr('transform', function(d) { return 'translate(' + x(d) + ',0)'; }); - dimensions.exit().remove(); - - // Add an axis and title. - dimensions.select('.nv-label') - .style("cursor", "move") - .attr('dy', '-1em') - .attr('text-anchor', 'middle') - .text(String) - .on("mouseover", function(d, i) { - dispatch.elementMouseover({ - dim: d, - pos: [d3.mouse(this.parentNode.parentNode)[0], d3.mouse(this.parentNode.parentNode)[1]] - }); - }) - .on("mouseout", function(d, i) { - dispatch.elementMouseout({ - dim: d - }); - }) - .call(axisDrag); - - dimensions.select('.nv-axis') - .each(function (d, i) { - d3.select(this).call(axis.scale(y[d]).tickFormat(d3.format(dimensionFormats[i]))); - }); - - dimensions.select('.nv-parallelCoordinates-brush') - .each(function (d) { - d3.select(this).call(y[d].brush); - }) - .selectAll('rect') - .attr('x', -8) - .attr('width', 16); - - // Returns the path for a given data point. - function path(d) { - return line(dimensionNames.map(function (p) { - //If value if missing, put the value on the missing value line - if(isNaN(d[p]) || isNaN(parseFloat(d[p]))) { - var domain = y[p].domain(); - var range = y[p].range(); - var min = domain[0] - (domain[1] - domain[0]) / 9; - - //If it's not already the case, allow brush to select undefined values - if(axisWithMissingValues.indexOf(p) < 0) { - - var newscale = d3.scale.linear().domain([min, domain[1]]).range([availableHeight - 12, range[1]]); - y[p].brush.y(newscale); - axisWithMissingValues.push(p); - } - - return [x(p), y[p](min)]; - } - - //If parallelCoordinate contain missing values show the missing values line otherwise, hide it. - if(axisWithMissingValues.length > 0) { - missingValuesline.style("display", "inline"); - missingValueslineText.style("display", "inline"); - } else { - missingValuesline.style("display", "none"); - missingValueslineText.style("display", "none"); - } - - return [x(p), y[p](d[p])]; - })); - } - - // Handles a brush event, toggling the display of foreground lines. - function brush() { - var actives = dimensionNames.filter(function(p) { return !y[p].brush.empty(); }), - extents = actives.map(function(p) { return y[p].brush.extent(); }); - - filters = []; //erase current filters - actives.forEach(function(d,i) { - filters[i] = { - dimension: d, - extent: extents[i] - } - }); - - active = []; //erase current active list - foreground.style('display', function(d) { - var isActive = actives.every(function(p, i) { - if(isNaN(d[p]) && extents[i][0] == y[p].brush.y().domain()[0]) return true; - return extents[i][0] <= d[p] && d[p] <= extents[i][1]; - }); - if (isActive) active.push(d); - return isActive ? null : 'none'; - }); - - dispatch.brush({ - filters: filters, - active: active - }); - } - - function dragStart(d, i) { - dragging[d] = this.parentNode.__origin__ = x(d); - background.attr("visibility", "hidden"); - - } - - function dragMove(d, i) { - dragging[d] = Math.min(availableWidth, Math.max(0, this.parentNode.__origin__ += d3.event.x)); - foreground.attr("d", path); - dimensionNames.sort(function (a, b) { return position(a) - position(b); }); - x.domain(dimensionNames); - dimensions.attr("transform", function(d) { return "translate(" + position(d) + ")"; }); - } - - function dragEnd(d, i) { - delete this.parentNode.__origin__; - delete dragging[d]; - d3.select(this.parentNode).attr("transform", "translate(" + x(d) + ")"); - foreground - .attr("d", path); - background - .attr("d", path) - .attr("visibility", null); - - } - - function position(d) { - var v = dragging[d]; - return v == null ? x(d) : v; - } - }); - - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width= _;}}, - height: {get: function(){return height;}, set: function(_){height= _;}}, - dimensionNames: {get: function() { return dimensionNames;}, set: function(_){dimensionNames= _;}}, - dimensionFormats : {get: function(){return dimensionFormats;}, set: function (_){dimensionFormats=_;}}, - lineTension: {get: function(){return lineTension;}, set: function(_){lineTension = _;}}, - - // deprecated options - dimensions: {get: function (){return dimensionNames;}, set: function(_){ - // deprecated after 1.8.1 - nv.deprecated('dimensions', 'use dimensionNames instead'); - dimensionNames = _; - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }} - }); - - nv.utils.initOptions(chart); - return chart; -}; -nv.models.pie = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = 500 - , height = 500 - , getX = function(d) { return d.x } - , getY = function(d) { return d.y } - , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one - , container = null - , color = nv.utils.defaultColor() - , valueFormat = d3.format(',.2f') - , showLabels = true - , labelsOutside = false - , labelType = "key" - , labelThreshold = .02 //if slice percentage is under this, don't show label - , donut = false - , title = false - , growOnHover = true - , titleOffset = 0 - , labelSunbeamLayout = false - , startAngle = false - , padAngle = false - , endAngle = false - , cornerRadius = 0 - , donutRatio = 0.5 - , arcsRadius = [] - , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout', 'elementMousemove', 'renderEnd') - ; - - var arcs = []; - var arcsOver = []; - - //============================================================ - // chart function - //------------------------------------------------------------ - - var renderWatch = nv.utils.renderWatch(dispatch); - - function chart(selection) { - renderWatch.reset(); - selection.each(function(data) { - var availableWidth = width - margin.left - margin.right - , availableHeight = height - margin.top - margin.bottom - , radius = Math.min(availableWidth, availableHeight) / 2 - , arcsRadiusOuter = [] - , arcsRadiusInner = [] - ; - - container = d3.select(this) - if (arcsRadius.length === 0) { - var outer = radius - radius / 5; - var inner = donutRatio * radius; - for (var i = 0; i < data[0].length; i++) { - arcsRadiusOuter.push(outer); - arcsRadiusInner.push(inner); - } - } else { - arcsRadiusOuter = arcsRadius.map(function (d) { return (d.outer - d.outer / 5) * radius; }); - arcsRadiusInner = arcsRadius.map(function (d) { return (d.inner - d.inner / 5) * radius; }); - donutRatio = d3.min(arcsRadius.map(function (d) { return (d.inner - d.inner / 5); })); - } - nv.utils.initSVG(container); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('.nv-wrap.nv-pie').data(data); - var wrapEnter = wrap.enter().append('g').attr('class','nvd3 nv-wrap nv-pie nv-chart-' + id); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - var g_pie = gEnter.append('g').attr('class', 'nv-pie'); - gEnter.append('g').attr('class', 'nv-pieLabels'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - g.select('.nv-pie').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')'); - g.select('.nv-pieLabels').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')'); - - // - container.on('click', function(d,i) { - dispatch.chartClick({ - data: d, - index: i, - pos: d3.event, - id: id - }); - }); - - arcs = []; - arcsOver = []; - for (var i = 0; i < data[0].length; i++) { - - var arc = d3.svg.arc().outerRadius(arcsRadiusOuter[i]); - var arcOver = d3.svg.arc().outerRadius(arcsRadiusOuter[i] + 5); - - if (startAngle !== false) { - arc.startAngle(startAngle); - arcOver.startAngle(startAngle); - } - if (endAngle !== false) { - arc.endAngle(endAngle); - arcOver.endAngle(endAngle); - } - if (donut) { - arc.innerRadius(arcsRadiusInner[i]); - arcOver.innerRadius(arcsRadiusInner[i]); - } - - if (arc.cornerRadius && cornerRadius) { - arc.cornerRadius(cornerRadius); - arcOver.cornerRadius(cornerRadius); - } - - arcs.push(arc); - arcsOver.push(arcOver); - } - - // Setup the Pie chart and choose the data element - var pie = d3.layout.pie() - .sort(null) - .value(function(d) { return d.disabled ? 0 : getY(d) }); - - // padAngle added in d3 3.5 - if (pie.padAngle && padAngle) { - pie.padAngle(padAngle); - } - - // if title is specified and donut, put it in the middle - if (donut && title) { - g_pie.append("text").attr('class', 'nv-pie-title'); - - wrap.select('.nv-pie-title') - .style("text-anchor", "middle") - .text(function (d) { - return title; - }) - .style("font-size", (Math.min(availableWidth, availableHeight)) * donutRatio * 2 / (title.length + 2) + "px") - .attr("dy", "0.35em") // trick to vertically center text - .attr('transform', function(d, i) { - return 'translate(0, '+ titleOffset + ')'; - }); - } - - var slices = wrap.select('.nv-pie').selectAll('.nv-slice').data(pie); - var pieLabels = wrap.select('.nv-pieLabels').selectAll('.nv-label').data(pie); - - slices.exit().remove(); - pieLabels.exit().remove(); - - var ae = slices.enter().append('g'); - ae.attr('class', 'nv-slice'); - ae.on('mouseover', function(d, i) { - d3.select(this).classed('hover', true); - if (growOnHover) { - d3.select(this).select("path").transition() - .duration(70) - .attr("d", arcsOver[i]); - } - dispatch.elementMouseover({ - data: d.data, - index: i, - color: d3.select(this).style("fill") - }); - }); - ae.on('mouseout', function(d, i) { - d3.select(this).classed('hover', false); - if (growOnHover) { - d3.select(this).select("path").transition() - .duration(50) - .attr("d", arcs[i]); - } - dispatch.elementMouseout({data: d.data, index: i}); - }); - ae.on('mousemove', function(d, i) { - dispatch.elementMousemove({data: d.data, index: i}); - }); - ae.on('click', function(d, i) { - dispatch.elementClick({ - data: d.data, - index: i, - color: d3.select(this).style("fill") - }); - }); - ae.on('dblclick', function(d, i) { - dispatch.elementDblClick({ - data: d.data, - index: i, - color: d3.select(this).style("fill") - }); - }); - - slices.attr('fill', function(d,i) { return color(d.data, i); }); - slices.attr('stroke', function(d,i) { return color(d.data, i); }); - - var paths = ae.append('path').each(function(d) { - this._current = d; - }); - - slices.select('path') - .transition() - .attr('d', function (d, i) { return arcs[i](d); }) - .attrTween('d', arcTween); - - if (showLabels) { - // This does the normal label - var labelsArc = []; - for (var i = 0; i < data[0].length; i++) { - labelsArc.push(arcs[i]); - - if (labelsOutside) { - if (donut) { - labelsArc[i] = d3.svg.arc().outerRadius(arcs[i].outerRadius()); - if (startAngle !== false) labelsArc[i].startAngle(startAngle); - if (endAngle !== false) labelsArc[i].endAngle(endAngle); - } - } else if (!donut) { - labelsArc[i].innerRadius(0); - } - } - - pieLabels.enter().append("g").classed("nv-label",true).each(function(d,i) { - var group = d3.select(this); - - group.attr('transform', function (d, i) { - if (labelSunbeamLayout) { - d.outerRadius = arcsRadiusOuter[i] + 10; // Set Outer Coordinate - d.innerRadius = arcsRadiusOuter[i] + 15; // Set Inner Coordinate - var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI); - if ((d.startAngle + d.endAngle) / 2 < Math.PI) { - rotateAngle -= 90; - } else { - rotateAngle += 90; - } - return 'translate(' + labelsArc[i].centroid(d) + ') rotate(' + rotateAngle + ')'; - } else { - d.outerRadius = radius + 10; // Set Outer Coordinate - d.innerRadius = radius + 15; // Set Inner Coordinate - return 'translate(' + labelsArc[i].centroid(d) + ')' - } - }); - - group.append('rect') - .style('stroke', '#fff') - .style('fill', '#fff') - .attr("rx", 3) - .attr("ry", 3); - - group.append('text') - .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned - .style('fill', '#000') - }); - - var labelLocationHash = {}; - var avgHeight = 14; - var avgWidth = 140; - var createHashKey = function(coordinates) { - return Math.floor(coordinates[0]/avgWidth) * avgWidth + ',' + Math.floor(coordinates[1]/avgHeight) * avgHeight; - }; - - pieLabels.watchTransition(renderWatch, 'pie labels').attr('transform', function (d, i) { - if (labelSunbeamLayout) { - d.outerRadius = arcsRadiusOuter[i] + 10; // Set Outer Coordinate - d.innerRadius = arcsRadiusOuter[i] + 15; // Set Inner Coordinate - var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI); - if ((d.startAngle + d.endAngle) / 2 < Math.PI) { - rotateAngle -= 90; - } else { - rotateAngle += 90; - } - return 'translate(' + labelsArc[i].centroid(d) + ') rotate(' + rotateAngle + ')'; - } else { - d.outerRadius = radius + 10; // Set Outer Coordinate - d.innerRadius = radius + 15; // Set Inner Coordinate - - /* - Overlapping pie labels are not good. What this attempts to do is, prevent overlapping. - Each label location is hashed, and if a hash collision occurs, we assume an overlap. - Adjust the label's y-position to remove the overlap. - */ - var center = labelsArc[i].centroid(d); - if (d.value) { - var hashKey = createHashKey(center); - if (labelLocationHash[hashKey]) { - center[1] -= avgHeight; - } - labelLocationHash[createHashKey(center)] = true; - } - return 'translate(' + center + ')' - } - }); - - pieLabels.select(".nv-label text") - .style('text-anchor', function(d,i) { - //center the text on it's origin or begin/end if orthogonal aligned - return labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle'; - }) - .text(function(d, i) { - var percent = (d.endAngle - d.startAngle) / (2 * Math.PI); - var label = ''; - if (!d.value || percent < labelThreshold) return ''; - - if(typeof labelType === 'function') { - label = labelType(d, i, { - 'key': getX(d.data), - 'value': getY(d.data), - 'percent': valueFormat(percent) - }); - } else { - switch (labelType) { - case 'key': - label = getX(d.data); - break; - case 'value': - label = valueFormat(getY(d.data)); - break; - case 'percent': - label = d3.format('%')(percent); - break; - } - } - return label; - }) - ; - } - - - // Computes the angle of an arc, converting from radians to degrees. - function angle(d) { - var a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90; - return a > 90 ? a - 180 : a; - } - - function arcTween(a, idx) { - a.endAngle = isNaN(a.endAngle) ? 0 : a.endAngle; - a.startAngle = isNaN(a.startAngle) ? 0 : a.startAngle; - if (!donut) a.innerRadius = 0; - var i = d3.interpolate(this._current, a); - this._current = i(0); - return function (t) { - return arcs[idx](i(t)); - }; - } - }); - - renderWatch.renderEnd('pie immediate'); - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - arcsRadius: { get: function () { return arcsRadius; }, set: function (_) { arcsRadius = _; } }, - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - showLabels: {get: function(){return showLabels;}, set: function(_){showLabels=_;}}, - title: {get: function(){return title;}, set: function(_){title=_;}}, - titleOffset: {get: function(){return titleOffset;}, set: function(_){titleOffset=_;}}, - labelThreshold: {get: function(){return labelThreshold;}, set: function(_){labelThreshold=_;}}, - valueFormat: {get: function(){return valueFormat;}, set: function(_){valueFormat=_;}}, - x: {get: function(){return getX;}, set: function(_){getX=_;}}, - id: {get: function(){return id;}, set: function(_){id=_;}}, - endAngle: {get: function(){return endAngle;}, set: function(_){endAngle=_;}}, - startAngle: {get: function(){return startAngle;}, set: function(_){startAngle=_;}}, - padAngle: {get: function(){return padAngle;}, set: function(_){padAngle=_;}}, - cornerRadius: {get: function(){return cornerRadius;}, set: function(_){cornerRadius=_;}}, - donutRatio: {get: function(){return donutRatio;}, set: function(_){donutRatio=_;}}, - labelsOutside: {get: function(){return labelsOutside;}, set: function(_){labelsOutside=_;}}, - labelSunbeamLayout: {get: function(){return labelSunbeamLayout;}, set: function(_){labelSunbeamLayout=_;}}, - donut: {get: function(){return donut;}, set: function(_){donut=_;}}, - growOnHover: {get: function(){return growOnHover;}, set: function(_){growOnHover=_;}}, - - // depreciated after 1.7.1 - pieLabelsOutside: {get: function(){return labelsOutside;}, set: function(_){ - labelsOutside=_; - nv.deprecated('pieLabelsOutside', 'use labelsOutside instead'); - }}, - // depreciated after 1.7.1 - donutLabelsOutside: {get: function(){return labelsOutside;}, set: function(_){ - labelsOutside=_; - nv.deprecated('donutLabelsOutside', 'use labelsOutside instead'); - }}, - // deprecated after 1.7.1 - labelFormat: {get: function(){ return valueFormat;}, set: function(_) { - valueFormat=_; - nv.deprecated('labelFormat','use valueFormat instead'); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = typeof _.top != 'undefined' ? _.top : margin.top; - margin.right = typeof _.right != 'undefined' ? _.right : margin.right; - margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; - margin.left = typeof _.left != 'undefined' ? _.left : margin.left; - }}, - y: {get: function(){return getY;}, set: function(_){ - getY=d3.functor(_); - }}, - color: {get: function(){return color;}, set: function(_){ - color=nv.utils.getColor(_); - }}, - labelType: {get: function(){return labelType;}, set: function(_){ - labelType= _ || 'key'; - }} - }); - - nv.utils.initOptions(chart); - return chart; -}; -nv.models.pieChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var pie = nv.models.pie(); - var legend = nv.models.legend(); - var tooltip = nv.models.tooltip(); - - var margin = {top: 30, right: 20, bottom: 20, left: 20} - , width = null - , height = null - , showLegend = true - , legendPosition = "top" - , color = nv.utils.defaultColor() - , state = nv.utils.state() - , defaultState = null - , noData = null - , duration = 250 - , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState','renderEnd') - ; - - tooltip - .headerEnabled(false) - .duration(0) - .valueFormatter(function(d, i) { - return pie.valueFormat()(d, i); - }); - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var renderWatch = nv.utils.renderWatch(dispatch); - - var stateGetter = function(data) { - return function(){ - return { - active: data.map(function(d) { return !d.disabled }) - }; - } - }; - - var stateSetter = function(data) { - return function(state) { - if (state.active !== undefined) { - data.forEach(function (series, i) { - series.disabled = !state.active[i]; - }); - } - } - }; - - //============================================================ - // Chart function - //------------------------------------------------------------ - - function chart(selection) { - renderWatch.reset(); - renderWatch.models(pie); - - selection.each(function(data) { - var container = d3.select(this); - nv.utils.initSVG(container); - - var that = this; - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - chart.update = function() { container.transition().call(chart); }; - chart.container = this; - - state.setter(stateSetter(data), chart.update) - .getter(stateGetter(data)) - .update(); - - //set state.disabled - state.disabled = data.map(function(d) { return !!d.disabled }); - - if (!defaultState) { - var key; - defaultState = {}; - for (key in state) { - if (state[key] instanceof Array) - defaultState[key] = state[key].slice(0); - else - defaultState[key] = state[key]; - } - } - - // Display No Data message if there's nothing to show. - if (!data || !data.length) { - nv.utils.noData(chart, container); - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-pieChart').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-pieChart').append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-pieWrap'); - gEnter.append('g').attr('class', 'nv-legendWrap'); - - // Legend - if (showLegend) { - if (legendPosition === "top") { - legend.width( availableWidth ).key(pie.x()); - - wrap.select('.nv-legendWrap') - .datum(data) - .call(legend); - - if ( margin.top != legend.height()) { - margin.top = legend.height(); - availableHeight = nv.utils.availableHeight(height, container, margin); - } - - wrap.select('.nv-legendWrap') - .attr('transform', 'translate(0,' + (-margin.top) +')'); - } else if (legendPosition === "right") { - var legendWidth = nv.models.legend().width(); - if (availableWidth / 2 < legendWidth) { - legendWidth = (availableWidth / 2) - } - legend.height(availableHeight).key(pie.x()); - legend.width(legendWidth); - availableWidth -= legend.width(); - - wrap.select('.nv-legendWrap') - .datum(data) - .call(legend) - .attr('transform', 'translate(' + (availableWidth) +',0)'); - } - } - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - // Main Chart Component(s) - pie.width(availableWidth).height(availableHeight); - var pieWrap = g.select('.nv-pieWrap').datum([data]); - d3.transition(pieWrap).call(pie); - - //============================================================ - // Event Handling/Dispatching (in chart's scope) - //------------------------------------------------------------ - - legend.dispatch.on('stateChange', function(newState) { - for (var key in newState) { - state[key] = newState[key]; - } - dispatch.stateChange(state); - chart.update(); - }); - - // Update chart from a state object passed to event handler - dispatch.on('changeState', function(e) { - if (typeof e.disabled !== 'undefined') { - data.forEach(function(series,i) { - series.disabled = e.disabled[i]; - }); - state.disabled = e.disabled; - } - chart.update(); - }); - }); - - renderWatch.renderEnd('pieChart immediate'); - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - pie.dispatch.on('elementMouseover.tooltip', function(evt) { - evt['series'] = { - key: chart.x()(evt.data), - value: chart.y()(evt.data), - color: evt.color - }; - tooltip.data(evt).hidden(false); - }); - - pie.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true); - }); - - pie.dispatch.on('elementMousemove.tooltip', function(evt) { - tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); - }); - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.legend = legend; - chart.dispatch = dispatch; - chart.pie = pie; - chart.tooltip = tooltip; - chart.options = nv.utils.optionsFunc.bind(chart); - - // use Object get/set functionality to map between vars and chart functions - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - showLegend: {get: function(){return showLegend;}, set: function(_){showLegend=_;}}, - legendPosition: {get: function(){return legendPosition;}, set: function(_){legendPosition=_;}}, - defaultState: {get: function(){return defaultState;}, set: function(_){defaultState=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - - // options that require extra logic in the setter - color: {get: function(){return color;}, set: function(_){ - color = _; - legend.color(color); - pie.color(color); - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - }}, - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }} - }); - nv.utils.inheritOptions(chart, pie); - nv.utils.initOptions(chart); - return chart; -}; - -nv.models.scatter = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = null - , height = null - , color = nv.utils.defaultColor() // chooses color - , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't select one - , container = null - , x = d3.scale.linear() - , y = d3.scale.linear() - , z = d3.scale.linear() //linear because d3.svg.shape.size is treated as area - , getX = function(d) { return d.x } // accessor to get the x value - , getY = function(d) { return d.y } // accessor to get the y value - , getSize = function(d) { return d.size || 1} // accessor to get the point size - , getShape = function(d) { return d.shape || 'circle' } // accessor to get point shape - , forceX = [] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.) - , forceY = [] // List of numbers to Force into the Y scale - , forceSize = [] // List of numbers to Force into the Size scale - , interactive = true // If true, plots a voronoi overlay for advanced point intersection - , pointActive = function(d) { return !d.notActive } // any points that return false will be filtered out - , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart - , padDataOuter = .1 //outerPadding to imitate ordinal scale outer padding - , clipEdge = false // if true, masks points within x and y scale - , clipVoronoi = true // if true, masks each point with a circle... can turn off to slightly increase performance - , showVoronoi = false // display the voronoi areas - , clipRadius = function() { return 25 } // function to get the radius for voronoi point clips - , xDomain = null // Override x domain (skips the calculation from data) - , yDomain = null // Override y domain - , xRange = null // Override x range - , yRange = null // Override y range - , sizeDomain = null // Override point size domain - , sizeRange = null - , singlePoint = false - , dispatch = d3.dispatch('elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout', 'renderEnd') - , useVoronoi = true - , duration = 250 - ; - - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var x0, y0, z0 // used to store previous scales - , timeoutID - , needsUpdate = false // Flag for when the points are visually updating, but the interactive layer is behind, to disable tooltips - , renderWatch = nv.utils.renderWatch(dispatch, duration) - , _sizeRange_def = [16, 256] - ; - - function chart(selection) { - renderWatch.reset(); - selection.each(function(data) { - container = d3.select(this); - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - nv.utils.initSVG(container); - - //add series index to each data point for reference - data.forEach(function(series, i) { - series.values.forEach(function(point) { - point.series = i; - }); - }); - - // Setup Scales - // remap and flatten the data for use in calculating the scales' domains - var seriesData = (xDomain && yDomain && sizeDomain) ? [] : // if we know xDomain and yDomain and sizeDomain, no need to calculate.... if Size is constant remember to set sizeDomain to speed up performance - d3.merge( - data.map(function(d) { - return d.values.map(function(d,i) { - return { x: getX(d,i), y: getY(d,i), size: getSize(d,i) } - }) - }) - ); - - x .domain(xDomain || d3.extent(seriesData.map(function(d) { return d.x; }).concat(forceX))) - - if (padData && data[0]) - x.range(xRange || [(availableWidth * padDataOuter + availableWidth) / (2 *data[0].values.length), availableWidth - availableWidth * (1 + padDataOuter) / (2 * data[0].values.length) ]); - //x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); - else - x.range(xRange || [0, availableWidth]); - - y .domain(yDomain || d3.extent(seriesData.map(function(d) { return d.y }).concat(forceY))) - .range(yRange || [availableHeight, 0]); - - z .domain(sizeDomain || d3.extent(seriesData.map(function(d) { return d.size }).concat(forceSize))) - .range(sizeRange || _sizeRange_def); - - // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point - singlePoint = x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]; - - if (x.domain()[0] === x.domain()[1]) - x.domain()[0] ? - x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) - : x.domain([-1,1]); - - if (y.domain()[0] === y.domain()[1]) - y.domain()[0] ? - y.domain([y.domain()[0] - y.domain()[0] * 0.01, y.domain()[1] + y.domain()[1] * 0.01]) - : y.domain([-1,1]); - - if ( isNaN(x.domain()[0])) { - x.domain([-1,1]); - } - - if ( isNaN(y.domain()[0])) { - y.domain([-1,1]); - } - - x0 = x0 || x; - y0 = y0 || y; - z0 = z0 || z; - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-scatter').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatter nv-chart-' + id); - var defsEnter = wrapEnter.append('defs'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - wrap.classed('nv-single-point', singlePoint); - gEnter.append('g').attr('class', 'nv-groups'); - gEnter.append('g').attr('class', 'nv-point-paths'); - wrapEnter.append('g').attr('class', 'nv-point-clips'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - defsEnter.append('clipPath') - .attr('id', 'nv-edge-clip-' + id) - .append('rect'); - - wrap.select('#nv-edge-clip-' + id + ' rect') - .attr('width', availableWidth) - .attr('height', (availableHeight > 0) ? availableHeight : 0); - - g.attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); - - function updateInteractiveLayer() { - // Always clear needs-update flag regardless of whether or not - // we will actually do anything (avoids needless invocations). - needsUpdate = false; - - if (!interactive) return false; - - // inject series and point index for reference into voronoi - if (useVoronoi === true) { - var vertices = d3.merge(data.map(function(group, groupIndex) { - return group.values - .map(function(point, pointIndex) { - // *Adding noise to make duplicates very unlikely - // *Injecting series and point index for reference - /* *Adding a 'jitter' to the points, because there's an issue in d3.geom.voronoi. - */ - var pX = getX(point,pointIndex); - var pY = getY(point,pointIndex); - - return [x(pX)+ Math.random() * 1e-4, - y(pY)+ Math.random() * 1e-4, - groupIndex, - pointIndex, point]; //temp hack to add noise until I think of a better way so there are no duplicates - }) - .filter(function(pointArray, pointIndex) { - return pointActive(pointArray[4], pointIndex); // Issue #237.. move filter to after map, so pointIndex is correct! - }) - }) - ); - - if (vertices.length == 0) return false; // No active points, we're done - if (vertices.length < 3) { - // Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work - vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]); - vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]); - vertices.push([x.range()[0] - 20, y.range()[0] + 20, null, null]); - vertices.push([x.range()[1] + 20, y.range()[1] - 20, null, null]); - } - - // keep voronoi sections from going more than 10 outside of graph - // to avoid overlap with other things like legend etc - var bounds = d3.geom.polygon([ - [-10,-10], - [-10,height + 10], - [width + 10,height + 10], - [width + 10,-10] - ]); - - var voronoi = d3.geom.voronoi(vertices).map(function(d, i) { - return { - 'data': bounds.clip(d), - 'series': vertices[i][2], - 'point': vertices[i][3] - } - }); - - // nuke all voronoi paths on reload and recreate them - wrap.select('.nv-point-paths').selectAll('path').remove(); - var pointPaths = wrap.select('.nv-point-paths').selectAll('path').data(voronoi); - var vPointPaths = pointPaths - .enter().append("svg:path") - .attr("d", function(d) { - if (!d || !d.data || d.data.length === 0) - return 'M 0 0'; - else - return "M" + d.data.join(",") + "Z"; - }) - .attr("id", function(d,i) { - return "nv-path-"+i; }) - .attr("clip-path", function(d,i) { return "url(#nv-clip-"+i+")"; }) - ; - - // good for debugging point hover issues - if (showVoronoi) { - vPointPaths.style("fill", d3.rgb(230, 230, 230)) - .style('fill-opacity', 0.4) - .style('stroke-opacity', 1) - .style("stroke", d3.rgb(200,200,200)); - } - - if (clipVoronoi) { - // voronoi sections are already set to clip, - // just create the circles with the IDs they expect - wrap.select('.nv-point-clips').selectAll('clipPath').remove(); - wrap.select('.nv-point-clips').selectAll("clipPath") - .data(vertices) - .enter().append("svg:clipPath") - .attr("id", function(d, i) { return "nv-clip-"+i;}) - .append("svg:circle") - .attr('cx', function(d) { return d[0]; }) - .attr('cy', function(d) { return d[1]; }) - .attr('r', clipRadius); - } - - var mouseEventCallback = function(d, mDispatch) { - if (needsUpdate) return 0; - var series = data[d.series]; - if (series === undefined) return; - var point = series.values[d.point]; - point['color'] = color(series, d.series); - - // standardize attributes for tooltip. - point['x'] = getX(point); - point['y'] = getY(point); - - // can't just get box of event node since it's actually a voronoi polygon - var box = container.node().getBoundingClientRect(); - var scrollTop = window.pageYOffset || document.documentElement.scrollTop; - var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft; - - var pos = { - left: x(getX(point, d.point)) + box.left + scrollLeft + margin.left + 10, - top: y(getY(point, d.point)) + box.top + scrollTop + margin.top + 10 - }; - - mDispatch({ - point: point, - series: series, - pos: pos, - seriesIndex: d.series, - pointIndex: d.point - }); - }; - - pointPaths - .on('click', function(d) { - mouseEventCallback(d, dispatch.elementClick); - }) - .on('dblclick', function(d) { - mouseEventCallback(d, dispatch.elementDblClick); - }) - .on('mouseover', function(d) { - mouseEventCallback(d, dispatch.elementMouseover); - }) - .on('mouseout', function(d, i) { - mouseEventCallback(d, dispatch.elementMouseout); - }); - - } else { - // add event handlers to points instead voronoi paths - wrap.select('.nv-groups').selectAll('.nv-group') - .selectAll('.nv-point') - //.data(dataWithPoints) - //.style('pointer-events', 'auto') // recativate events, disabled by css - .on('click', function(d,i) { - //nv.log('test', d, i); - if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point - var series = data[d.series], - point = series.values[i]; - - dispatch.elementClick({ - point: point, - series: series, - pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top], - seriesIndex: d.series, - pointIndex: i - }); - }) - .on('dblclick', function(d,i) { - if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point - var series = data[d.series], - point = series.values[i]; - - dispatch.elementDblClick({ - point: point, - series: series, - pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top], - seriesIndex: d.series, - pointIndex: i - }); - }) - .on('mouseover', function(d,i) { - if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point - var series = data[d.series], - point = series.values[i]; - - dispatch.elementMouseover({ - point: point, - series: series, - pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top], - seriesIndex: d.series, - pointIndex: i, - color: color(d, i) - }); - }) - .on('mouseout', function(d,i) { - if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point - var series = data[d.series], - point = series.values[i]; - - dispatch.elementMouseout({ - point: point, - series: series, - seriesIndex: d.series, - pointIndex: i, - color: color(d, i) - }); - }); - } - } - - needsUpdate = true; - var groups = wrap.select('.nv-groups').selectAll('.nv-group') - .data(function(d) { return d }, function(d) { return d.key }); - groups.enter().append('g') - .style('stroke-opacity', 1e-6) - .style('fill-opacity', 1e-6); - groups.exit() - .remove(); - groups - .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) - .classed('hover', function(d) { return d.hover }); - groups.watchTransition(renderWatch, 'scatter: groups') - .style('fill', function(d,i) { return color(d, i) }) - .style('stroke', function(d,i) { return color(d, i) }) - .style('stroke-opacity', 1) - .style('fill-opacity', .5); - - // create the points, maintaining their IDs from the original data set - var points = groups.selectAll('path.nv-point') - .data(function(d) { - return d.values.map( - function (point, pointIndex) { - return [point, pointIndex] - }).filter( - function(pointArray, pointIndex) { - return pointActive(pointArray[0], pointIndex) - }) - }); - points.enter().append('path') - .style('fill', function (d) { return d.color }) - .style('stroke', function (d) { return d.color }) - .attr('transform', function(d) { - return 'translate(' + x0(getX(d[0],d[1])) + ',' + y0(getY(d[0],d[1])) + ')' - }) - .attr('d', - nv.utils.symbol() - .type(function(d) { return getShape(d[0]); }) - .size(function(d) { return z(getSize(d[0],d[1])) }) - ); - points.exit().remove(); - groups.exit().selectAll('path.nv-point') - .watchTransition(renderWatch, 'scatter exit') - .attr('transform', function(d) { - return 'translate(' + x(getX(d[0],d[1])) + ',' + y(getY(d[0],d[1])) + ')' - }) - .remove(); - points.each(function(d) { - d3.select(this) - .classed('nv-point', true) - .classed('nv-point-' + d[1], true) - .classed('nv-noninteractive', !interactive) - .classed('hover',false) - ; - }); - points - .watchTransition(renderWatch, 'scatter points') - .attr('transform', function(d) { - //nv.log(d, getX(d[0],d[1]), x(getX(d[0],d[1]))); - return 'translate(' + x(getX(d[0],d[1])) + ',' + y(getY(d[0],d[1])) + ')' - }) - .attr('d', - nv.utils.symbol() - .type(function(d) { return getShape(d[0]); }) - .size(function(d) { return z(getSize(d[0],d[1])) }) - ); - - // Delay updating the invisible interactive layer for smoother animation - clearTimeout(timeoutID); // stop repeat calls to updateInteractiveLayer - timeoutID = setTimeout(updateInteractiveLayer, 300); - //updateInteractiveLayer(); - - //store old scales for use in transitions on update - x0 = x.copy(); - y0 = y.copy(); - z0 = z.copy(); - - }); - renderWatch.renderEnd('scatter immediate'); - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - // utility function calls provided by this chart - chart._calls = new function() { - this.clearHighlights = function () { - nv.dom.write(function() { - container.selectAll(".nv-point.hover").classed("hover", false); - }); - return null; - }; - this.highlightPoint = function (seriesIndex, pointIndex, isHoverOver) { - nv.dom.write(function() { - container.select(" .nv-series-" + seriesIndex + " .nv-point-" + pointIndex) - .classed("hover", isHoverOver); - }); - }; - }; - - // trigger calls from events too - dispatch.on('elementMouseover.point', function(d) { - if (interactive) chart._calls.highlightPoint(d.seriesIndex,d.pointIndex,true); - }); - - dispatch.on('elementMouseout.point', function(d) { - if (interactive) chart._calls.highlightPoint(d.seriesIndex,d.pointIndex,false); - }); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - xScale: {get: function(){return x;}, set: function(_){x=_;}}, - yScale: {get: function(){return y;}, set: function(_){y=_;}}, - pointScale: {get: function(){return z;}, set: function(_){z=_;}}, - xDomain: {get: function(){return xDomain;}, set: function(_){xDomain=_;}}, - yDomain: {get: function(){return yDomain;}, set: function(_){yDomain=_;}}, - pointDomain: {get: function(){return sizeDomain;}, set: function(_){sizeDomain=_;}}, - xRange: {get: function(){return xRange;}, set: function(_){xRange=_;}}, - yRange: {get: function(){return yRange;}, set: function(_){yRange=_;}}, - pointRange: {get: function(){return sizeRange;}, set: function(_){sizeRange=_;}}, - forceX: {get: function(){return forceX;}, set: function(_){forceX=_;}}, - forceY: {get: function(){return forceY;}, set: function(_){forceY=_;}}, - forcePoint: {get: function(){return forceSize;}, set: function(_){forceSize=_;}}, - interactive: {get: function(){return interactive;}, set: function(_){interactive=_;}}, - pointActive: {get: function(){return pointActive;}, set: function(_){pointActive=_;}}, - padDataOuter: {get: function(){return padDataOuter;}, set: function(_){padDataOuter=_;}}, - padData: {get: function(){return padData;}, set: function(_){padData=_;}}, - clipEdge: {get: function(){return clipEdge;}, set: function(_){clipEdge=_;}}, - clipVoronoi: {get: function(){return clipVoronoi;}, set: function(_){clipVoronoi=_;}}, - clipRadius: {get: function(){return clipRadius;}, set: function(_){clipRadius=_;}}, - showVoronoi: {get: function(){return showVoronoi;}, set: function(_){showVoronoi=_;}}, - id: {get: function(){return id;}, set: function(_){id=_;}}, - - - // simple functor options - x: {get: function(){return getX;}, set: function(_){getX = d3.functor(_);}}, - y: {get: function(){return getY;}, set: function(_){getY = d3.functor(_);}}, - pointSize: {get: function(){return getSize;}, set: function(_){getSize = d3.functor(_);}}, - pointShape: {get: function(){return getShape;}, set: function(_){getShape = d3.functor(_);}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }}, - useVoronoi: {get: function(){return useVoronoi;}, set: function(_){ - useVoronoi = _; - if (useVoronoi === false) { - clipVoronoi = false; - } - }} - }); - - nv.utils.initOptions(chart); - return chart; -}; - -nv.models.scatterChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var scatter = nv.models.scatter() - , xAxis = nv.models.axis() - , yAxis = nv.models.axis() - , legend = nv.models.legend() - , distX = nv.models.distribution() - , distY = nv.models.distribution() - , tooltip = nv.models.tooltip() - ; - - var margin = {top: 30, right: 20, bottom: 50, left: 75} - , width = null - , height = null - , container = null - , color = nv.utils.defaultColor() - , x = scatter.xScale() - , y = scatter.yScale() - , showDistX = false - , showDistY = false - , showLegend = true - , showXAxis = true - , showYAxis = true - , rightAlignYAxis = false - , state = nv.utils.state() - , defaultState = null - , dispatch = d3.dispatch('stateChange', 'changeState', 'renderEnd') - , noData = null - , duration = 250 - ; - - scatter.xScale(x).yScale(y); - xAxis.orient('bottom').tickPadding(10); - yAxis - .orient((rightAlignYAxis) ? 'right' : 'left') - .tickPadding(10) - ; - distX.axis('x'); - distY.axis('y'); - tooltip - .headerFormatter(function(d, i) { - return xAxis.tickFormat()(d, i); - }) - .valueFormatter(function(d, i) { - return yAxis.tickFormat()(d, i); - }); - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var x0, y0 - , renderWatch = nv.utils.renderWatch(dispatch, duration); - - var stateGetter = function(data) { - return function(){ - return { - active: data.map(function(d) { return !d.disabled }) - }; - } - }; - - var stateSetter = function(data) { - return function(state) { - if (state.active !== undefined) - data.forEach(function(series,i) { - series.disabled = !state.active[i]; - }); - } - }; - - function chart(selection) { - renderWatch.reset(); - renderWatch.models(scatter); - if (showXAxis) renderWatch.models(xAxis); - if (showYAxis) renderWatch.models(yAxis); - if (showDistX) renderWatch.models(distX); - if (showDistY) renderWatch.models(distY); - - selection.each(function(data) { - var that = this; - - container = d3.select(this); - nv.utils.initSVG(container); - - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - chart.update = function() { - if (duration === 0) - container.call(chart); - else - container.transition().duration(duration).call(chart); - }; - chart.container = this; - - state - .setter(stateSetter(data), chart.update) - .getter(stateGetter(data)) - .update(); - - // DEPRECATED set state.disableddisabled - state.disabled = data.map(function(d) { return !!d.disabled }); - - if (!defaultState) { - var key; - defaultState = {}; - for (key in state) { - if (state[key] instanceof Array) - defaultState[key] = state[key].slice(0); - else - defaultState[key] = state[key]; - } - } - - // Display noData message if there's nothing to show. - if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { - nv.utils.noData(chart, container); - renderWatch.renderEnd('scatter immediate'); - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - // Setup Scales - x = scatter.xScale(); - y = scatter.yScale(); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id()); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - // background for pointer events - gEnter.append('rect').attr('class', 'nvd3 nv-background').style("pointer-events","none"); - - gEnter.append('g').attr('class', 'nv-x nv-axis'); - gEnter.append('g').attr('class', 'nv-y nv-axis'); - gEnter.append('g').attr('class', 'nv-scatterWrap'); - gEnter.append('g').attr('class', 'nv-regressionLinesWrap'); - gEnter.append('g').attr('class', 'nv-distWrap'); - gEnter.append('g').attr('class', 'nv-legendWrap'); - - if (rightAlignYAxis) { - g.select(".nv-y.nv-axis") - .attr("transform", "translate(" + availableWidth + ",0)"); - } - - // Legend - if (showLegend) { - var legendWidth = availableWidth; - legend.width(legendWidth); - - wrap.select('.nv-legendWrap') - .datum(data) - .call(legend); - - if ( margin.top != legend.height()) { - margin.top = legend.height(); - availableHeight = nv.utils.availableHeight(height, container, margin); - } - - wrap.select('.nv-legendWrap') - .attr('transform', 'translate(0' + ',' + (-margin.top) +')'); - } - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - // Main Chart Component(s) - scatter - .width(availableWidth) - .height(availableHeight) - .color(data.map(function(d,i) { - return d.color || color(d, i); - }).filter(function(d,i) { return !data[i].disabled })); - - wrap.select('.nv-scatterWrap') - .datum(data.filter(function(d) { return !d.disabled })) - .call(scatter); - - - wrap.select('.nv-regressionLinesWrap') - .attr('clip-path', 'url(#nv-edge-clip-' + scatter.id() + ')'); - - var regWrap = wrap.select('.nv-regressionLinesWrap').selectAll('.nv-regLines') - .data(function (d) { - return d; - }); - - regWrap.enter().append('g').attr('class', 'nv-regLines'); - - var regLine = regWrap.selectAll('.nv-regLine') - .data(function (d) { - return [d] - }); - - regLine.enter() - .append('line').attr('class', 'nv-regLine') - .style('stroke-opacity', 0); - - // don't add lines unless we have slope and intercept to use - regLine.filter(function(d) { - return d.intercept && d.slope; - }) - .watchTransition(renderWatch, 'scatterPlusLineChart: regline') - .attr('x1', x.range()[0]) - .attr('x2', x.range()[1]) - .attr('y1', function (d, i) { - return y(x.domain()[0] * d.slope + d.intercept) - }) - .attr('y2', function (d, i) { - return y(x.domain()[1] * d.slope + d.intercept) - }) - .style('stroke', function (d, i, j) { - return color(d, j) - }) - .style('stroke-opacity', function (d, i) { - return (d.disabled || typeof d.slope === 'undefined' || typeof d.intercept === 'undefined') ? 0 : 1 - }); - - // Setup Axes - if (showXAxis) { - xAxis - .scale(x) - ._ticks( nv.utils.calcTicksX(availableWidth/100, data) ) - .tickSize( -availableHeight , 0); - - g.select('.nv-x.nv-axis') - .attr('transform', 'translate(0,' + y.range()[0] + ')') - .call(xAxis); - } - - if (showYAxis) { - yAxis - .scale(y) - ._ticks( nv.utils.calcTicksY(availableHeight/36, data) ) - .tickSize( -availableWidth, 0); - - g.select('.nv-y.nv-axis') - .call(yAxis); - } - - - if (showDistX) { - distX - .getData(scatter.x()) - .scale(x) - .width(availableWidth) - .color(data.map(function(d,i) { - return d.color || color(d, i); - }).filter(function(d,i) { return !data[i].disabled })); - gEnter.select('.nv-distWrap').append('g') - .attr('class', 'nv-distributionX'); - g.select('.nv-distributionX') - .attr('transform', 'translate(0,' + y.range()[0] + ')') - .datum(data.filter(function(d) { return !d.disabled })) - .call(distX); - } - - if (showDistY) { - distY - .getData(scatter.y()) - .scale(y) - .width(availableHeight) - .color(data.map(function(d,i) { - return d.color || color(d, i); - }).filter(function(d,i) { return !data[i].disabled })); - gEnter.select('.nv-distWrap').append('g') - .attr('class', 'nv-distributionY'); - g.select('.nv-distributionY') - .attr('transform', 'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)') - .datum(data.filter(function(d) { return !d.disabled })) - .call(distY); - } - - //============================================================ - // Event Handling/Dispatching (in chart's scope) - //------------------------------------------------------------ - - legend.dispatch.on('stateChange', function(newState) { - for (var key in newState) - state[key] = newState[key]; - dispatch.stateChange(state); - chart.update(); - }); - - // Update chart from a state object passed to event handler - dispatch.on('changeState', function(e) { - if (typeof e.disabled !== 'undefined') { - data.forEach(function(series,i) { - series.disabled = e.disabled[i]; - }); - state.disabled = e.disabled; - } - chart.update(); - }); - - // mouseover needs availableHeight so we just keep scatter mouse events inside the chart block - scatter.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true); - container.select('.nv-chart-' + scatter.id() + ' .nv-series-' + evt.seriesIndex + ' .nv-distx-' + evt.pointIndex) - .attr('y1', 0); - container.select('.nv-chart-' + scatter.id() + ' .nv-series-' + evt.seriesIndex + ' .nv-disty-' + evt.pointIndex) - .attr('x2', distY.size()); - }); - - scatter.dispatch.on('elementMouseover.tooltip', function(evt) { - container.select('.nv-series-' + evt.seriesIndex + ' .nv-distx-' + evt.pointIndex) - .attr('y1', evt.pos.top - availableHeight - margin.top); - container.select('.nv-series-' + evt.seriesIndex + ' .nv-disty-' + evt.pointIndex) - .attr('x2', evt.pos.left + distX.size() - margin.left); - tooltip.position(evt.pos).data(evt).hidden(false); - }); - - //store old scales for use in transitions on update - x0 = x.copy(); - y0 = y.copy(); - - }); - - renderWatch.renderEnd('scatter with line immediate'); - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.dispatch = dispatch; - chart.scatter = scatter; - chart.legend = legend; - chart.xAxis = xAxis; - chart.yAxis = yAxis; - chart.distX = distX; - chart.distY = distY; - chart.tooltip = tooltip; - - chart.options = nv.utils.optionsFunc.bind(chart); - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - container: {get: function(){return container;}, set: function(_){container=_;}}, - showDistX: {get: function(){return showDistX;}, set: function(_){showDistX=_;}}, - showDistY: {get: function(){return showDistY;}, set: function(_){showDistY=_;}}, - showLegend: {get: function(){return showLegend;}, set: function(_){showLegend=_;}}, - showXAxis: {get: function(){return showXAxis;}, set: function(_){showXAxis=_;}}, - showYAxis: {get: function(){return showYAxis;}, set: function(_){showYAxis=_;}}, - defaultState: {get: function(){return defaultState;}, set: function(_){defaultState=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - duration: {get: function(){return duration;}, set: function(_){duration=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - tooltipXContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'This option is removed, put values into main tooltip.'); - }}, - tooltipYContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'This option is removed, put values into main tooltip.'); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - rightAlignYAxis: {get: function(){return rightAlignYAxis;}, set: function(_){ - rightAlignYAxis = _; - yAxis.orient( (_) ? 'right' : 'left'); - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - legend.color(color); - distX.color(color); - distY.color(color); - }} - }); - - nv.utils.inheritOptions(chart, scatter); - nv.utils.initOptions(chart); - return chart; -}; - -nv.models.sparkline = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 2, right: 0, bottom: 2, left: 0} - , width = 400 - , height = 32 - , container = null - , animate = true - , x = d3.scale.linear() - , y = d3.scale.linear() - , getX = function(d) { return d.x } - , getY = function(d) { return d.y } - , color = nv.utils.getColor(['#000']) - , xDomain - , yDomain - , xRange - , yRange - ; - - function chart(selection) { - selection.each(function(data) { - var availableWidth = width - margin.left - margin.right, - availableHeight = height - margin.top - margin.bottom; - - container = d3.select(this); - nv.utils.initSVG(container); - - // Setup Scales - x .domain(xDomain || d3.extent(data, getX )) - .range(xRange || [0, availableWidth]); - - y .domain(yDomain || d3.extent(data, getY )) - .range(yRange || [availableHeight, 0]); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-sparkline').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparkline'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')') - - var paths = wrap.selectAll('path') - .data(function(d) { return [d] }); - paths.enter().append('path'); - paths.exit().remove(); - paths - .style('stroke', function(d,i) { return d.color || color(d, i) }) - .attr('d', d3.svg.line() - .x(function(d,i) { return x(getX(d,i)) }) - .y(function(d,i) { return y(getY(d,i)) }) - ); - - // TODO: Add CURRENT data point (Need Min, Mac, Current / Most recent) - var points = wrap.selectAll('circle.nv-point') - .data(function(data) { - var yValues = data.map(function(d, i) { return getY(d,i); }); - function pointIndex(index) { - if (index != -1) { - var result = data[index]; - result.pointIndex = index; - return result; - } else { - return null; - } - } - var maxPoint = pointIndex(yValues.lastIndexOf(y.domain()[1])), - minPoint = pointIndex(yValues.indexOf(y.domain()[0])), - currentPoint = pointIndex(yValues.length - 1); - return [minPoint, maxPoint, currentPoint].filter(function (d) {return d != null;}); - }); - points.enter().append('circle'); - points.exit().remove(); - points - .attr('cx', function(d,i) { return x(getX(d,d.pointIndex)) }) - .attr('cy', function(d,i) { return y(getY(d,d.pointIndex)) }) - .attr('r', 2) - .attr('class', function(d,i) { - return getX(d, d.pointIndex) == x.domain()[1] ? 'nv-point nv-currentValue' : - getY(d, d.pointIndex) == y.domain()[0] ? 'nv-point nv-minValue' : 'nv-point nv-maxValue' - }); - }); - - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - xDomain: {get: function(){return xDomain;}, set: function(_){xDomain=_;}}, - yDomain: {get: function(){return yDomain;}, set: function(_){yDomain=_;}}, - xRange: {get: function(){return xRange;}, set: function(_){xRange=_;}}, - yRange: {get: function(){return yRange;}, set: function(_){yRange=_;}}, - xScale: {get: function(){return x;}, set: function(_){x=_;}}, - yScale: {get: function(){return y;}, set: function(_){y=_;}}, - animate: {get: function(){return animate;}, set: function(_){animate=_;}}, - - //functor options - x: {get: function(){return getX;}, set: function(_){getX=d3.functor(_);}}, - y: {get: function(){return getY;}, set: function(_){getY=d3.functor(_);}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }} - }); - - nv.utils.initOptions(chart); - return chart; -}; - -nv.models.sparklinePlus = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var sparkline = nv.models.sparkline(); - - var margin = {top: 15, right: 100, bottom: 10, left: 50} - , width = null - , height = null - , x - , y - , index = [] - , paused = false - , xTickFormat = d3.format(',r') - , yTickFormat = d3.format(',.2f') - , showLastValue = true - , alignValue = true - , rightAlignValue = false - , noData = null - ; - - function chart(selection) { - selection.each(function(data) { - var container = d3.select(this); - nv.utils.initSVG(container); - - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - chart.update = function() { chart(selection) }; - chart.container = this; - - // Display No Data message if there's nothing to show. - if (!data || !data.length) { - nv.utils.noData(chart, container) - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - var currentValue = sparkline.y()(data[data.length-1], data.length-1); - - // Setup Scales - x = sparkline.xScale(); - y = sparkline.yScale(); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-sparklineplus').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparklineplus'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-sparklineWrap'); - gEnter.append('g').attr('class', 'nv-valueWrap'); - gEnter.append('g').attr('class', 'nv-hoverArea'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - // Main Chart Component(s) - var sparklineWrap = g.select('.nv-sparklineWrap'); - - sparkline.width(availableWidth).height(availableHeight); - sparklineWrap.call(sparkline); - - if (showLastValue) { - var valueWrap = g.select('.nv-valueWrap'); - var value = valueWrap.selectAll('.nv-currentValue') - .data([currentValue]); - - value.enter().append('text').attr('class', 'nv-currentValue') - .attr('dx', rightAlignValue ? -8 : 8) - .attr('dy', '.9em') - .style('text-anchor', rightAlignValue ? 'end' : 'start'); - - value - .attr('x', availableWidth + (rightAlignValue ? margin.right : 0)) - .attr('y', alignValue ? function (d) { - return y(d) - } : 0) - .style('fill', sparkline.color()(data[data.length - 1], data.length - 1)) - .text(yTickFormat(currentValue)); - } - - gEnter.select('.nv-hoverArea').append('rect') - .on('mousemove', sparklineHover) - .on('click', function() { paused = !paused }) - .on('mouseout', function() { index = []; updateValueLine(); }); - - g.select('.nv-hoverArea rect') - .attr('transform', function(d) { return 'translate(' + -margin.left + ',' + -margin.top + ')' }) - .attr('width', availableWidth + margin.left + margin.right) - .attr('height', availableHeight + margin.top); - - //index is currently global (within the chart), may or may not keep it that way - function updateValueLine() { - if (paused) return; - - var hoverValue = g.selectAll('.nv-hoverValue').data(index); - - var hoverEnter = hoverValue.enter() - .append('g').attr('class', 'nv-hoverValue') - .style('stroke-opacity', 0) - .style('fill-opacity', 0); - - hoverValue.exit() - .transition().duration(250) - .style('stroke-opacity', 0) - .style('fill-opacity', 0) - .remove(); - - hoverValue - .attr('transform', function(d) { return 'translate(' + x(sparkline.x()(data[d],d)) + ',0)' }) - .transition().duration(250) - .style('stroke-opacity', 1) - .style('fill-opacity', 1); - - if (!index.length) return; - - hoverEnter.append('line') - .attr('x1', 0) - .attr('y1', -margin.top) - .attr('x2', 0) - .attr('y2', availableHeight); - - hoverEnter.append('text').attr('class', 'nv-xValue') - .attr('x', -6) - .attr('y', -margin.top) - .attr('text-anchor', 'end') - .attr('dy', '.9em'); - - g.select('.nv-hoverValue .nv-xValue') - .text(xTickFormat(sparkline.x()(data[index[0]], index[0]))); - - hoverEnter.append('text').attr('class', 'nv-yValue') - .attr('x', 6) - .attr('y', -margin.top) - .attr('text-anchor', 'start') - .attr('dy', '.9em'); - - g.select('.nv-hoverValue .nv-yValue') - .text(yTickFormat(sparkline.y()(data[index[0]], index[0]))); - } - - function sparklineHover() { - if (paused) return; - - var pos = d3.mouse(this)[0] - margin.left; - - function getClosestIndex(data, x) { - var distance = Math.abs(sparkline.x()(data[0], 0) - x); - var closestIndex = 0; - for (var i = 0; i < data.length; i++){ - if (Math.abs(sparkline.x()(data[i], i) - x) < distance) { - distance = Math.abs(sparkline.x()(data[i], i) - x); - closestIndex = i; - } - } - return closestIndex; - } - - index = [getClosestIndex(data, Math.round(x.invert(pos)))]; - updateValueLine(); - } - - }); - - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.sparkline = sparkline; - - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - xTickFormat: {get: function(){return xTickFormat;}, set: function(_){xTickFormat=_;}}, - yTickFormat: {get: function(){return yTickFormat;}, set: function(_){yTickFormat=_;}}, - showLastValue: {get: function(){return showLastValue;}, set: function(_){showLastValue=_;}}, - alignValue: {get: function(){return alignValue;}, set: function(_){alignValue=_;}}, - rightAlignValue: {get: function(){return rightAlignValue;}, set: function(_){rightAlignValue=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }} - }); - - nv.utils.inheritOptions(chart, sparkline); - nv.utils.initOptions(chart); - - return chart; -}; - -nv.models.stackedArea = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = 960 - , height = 500 - , color = nv.utils.defaultColor() // a function that computes the color - , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't selet one - , container = null - , getX = function(d) { return d.x } // accessor to get the x value from a data point - , getY = function(d) { return d.y } // accessor to get the y value from a data point - , style = 'stack' - , offset = 'zero' - , order = 'default' - , interpolate = 'linear' // controls the line interpolation - , clipEdge = false // if true, masks lines within x and y scale - , x //can be accessed via chart.xScale() - , y //can be accessed via chart.yScale() - , scatter = nv.models.scatter() - , duration = 250 - , dispatch = d3.dispatch('areaClick', 'areaMouseover', 'areaMouseout','renderEnd', 'elementClick', 'elementMouseover', 'elementMouseout') - ; - - scatter - .pointSize(2.2) // default size - .pointDomain([2.2, 2.2]) // all the same size by default - ; - - /************************************ - * offset: - * 'wiggle' (stream) - * 'zero' (stacked) - * 'expand' (normalize to 100%) - * 'silhouette' (simple centered) - * - * order: - * 'inside-out' (stream) - * 'default' (input order) - ************************************/ - - var renderWatch = nv.utils.renderWatch(dispatch, duration); - - function chart(selection) { - renderWatch.reset(); - renderWatch.models(scatter); - selection.each(function(data) { - var availableWidth = width - margin.left - margin.right, - availableHeight = height - margin.top - margin.bottom; - - container = d3.select(this); - nv.utils.initSVG(container); - - // Setup Scales - x = scatter.xScale(); - y = scatter.yScale(); - - var dataRaw = data; - // Injecting point index into each point because d3.layout.stack().out does not give index - data.forEach(function(aseries, i) { - aseries.seriesIndex = i; - aseries.values = aseries.values.map(function(d, j) { - d.index = j; - d.seriesIndex = i; - return d; - }); - }); - - var dataFiltered = data.filter(function(series) { - return !series.disabled; - }); - - data = d3.layout.stack() - .order(order) - .offset(offset) - .values(function(d) { return d.values }) //TODO: make values customizeable in EVERY model in this fashion - .x(getX) - .y(getY) - .out(function(d, y0, y) { - d.display = { - y: y, - y0: y0 - }; - }) - (dataFiltered); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-stackedarea').data([data]); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedarea'); - var defsEnter = wrapEnter.append('defs'); - var gEnter = wrapEnter.append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-areaWrap'); - gEnter.append('g').attr('class', 'nv-scatterWrap'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - // If the user has not specified forceY, make sure 0 is included in the domain - // Otherwise, use user-specified values for forceY - if (scatter.forceY().length == 0) { - scatter.forceY().push(0); - } - - scatter - .width(availableWidth) - .height(availableHeight) - .x(getX) - .y(function(d) { return d.display.y + d.display.y0 }) - .forceY([0]) - .color(data.map(function(d,i) { - return d.color || color(d, d.seriesIndex); - })); - - var scatterWrap = g.select('.nv-scatterWrap') - .datum(data); - - scatterWrap.call(scatter); - - defsEnter.append('clipPath') - .attr('id', 'nv-edge-clip-' + id) - .append('rect'); - - wrap.select('#nv-edge-clip-' + id + ' rect') - .attr('width', availableWidth) - .attr('height', availableHeight); - - g.attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); - - var area = d3.svg.area() - .x(function(d,i) { return x(getX(d,i)) }) - .y0(function(d) { - return y(d.display.y0) - }) - .y1(function(d) { - return y(d.display.y + d.display.y0) - }) - .interpolate(interpolate); - - var zeroArea = d3.svg.area() - .x(function(d,i) { return x(getX(d,i)) }) - .y0(function(d) { return y(d.display.y0) }) - .y1(function(d) { return y(d.display.y0) }); - - var path = g.select('.nv-areaWrap').selectAll('path.nv-area') - .data(function(d) { return d }); - - path.enter().append('path').attr('class', function(d,i) { return 'nv-area nv-area-' + i }) - .attr('d', function(d,i){ - return zeroArea(d.values, d.seriesIndex); - }) - .on('mouseover', function(d,i) { - d3.select(this).classed('hover', true); - dispatch.areaMouseover({ - point: d, - series: d.key, - pos: [d3.event.pageX, d3.event.pageY], - seriesIndex: d.seriesIndex - }); - }) - .on('mouseout', function(d,i) { - d3.select(this).classed('hover', false); - dispatch.areaMouseout({ - point: d, - series: d.key, - pos: [d3.event.pageX, d3.event.pageY], - seriesIndex: d.seriesIndex - }); - }) - .on('click', function(d,i) { - d3.select(this).classed('hover', false); - dispatch.areaClick({ - point: d, - series: d.key, - pos: [d3.event.pageX, d3.event.pageY], - seriesIndex: d.seriesIndex - }); - }); - - path.exit().remove(); - path.style('fill', function(d,i){ - return d.color || color(d, d.seriesIndex) - }) - .style('stroke', function(d,i){ return d.color || color(d, d.seriesIndex) }); - path.watchTransition(renderWatch,'stackedArea path') - .attr('d', function(d,i) { - return area(d.values,i) - }); - - //============================================================ - // Event Handling/Dispatching (in chart's scope) - //------------------------------------------------------------ - - scatter.dispatch.on('elementMouseover.area', function(e) { - g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', true); - }); - scatter.dispatch.on('elementMouseout.area', function(e) { - g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', false); - }); - - //Special offset functions - chart.d3_stackedOffset_stackPercent = function(stackData) { - var n = stackData.length, //How many series - m = stackData[0].length, //how many points per series - i, - j, - o, - y0 = []; - - for (j = 0; j < m; ++j) { //Looping through all points - for (i = 0, o = 0; i < dataRaw.length; i++) { //looping through all series - o += getY(dataRaw[i].values[j]); //total y value of all series at a certian point in time. - } - - if (o) for (i = 0; i < n; i++) { //(total y value of all series at point in time i) != 0 - stackData[i][j][1] /= o; - } else { //(total y value of all series at point in time i) == 0 - for (i = 0; i < n; i++) { - stackData[i][j][1] = 0; - } - } - } - for (j = 0; j < m; ++j) y0[j] = 0; - return y0; - }; - - }); - - renderWatch.renderEnd('stackedArea immediate'); - return chart; - } - - //============================================================ - // Global getters and setters - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.scatter = scatter; - - scatter.dispatch.on('elementClick', function(){ dispatch.elementClick.apply(this, arguments); }); - scatter.dispatch.on('elementMouseover', function(){ dispatch.elementMouseover.apply(this, arguments); }); - scatter.dispatch.on('elementMouseout', function(){ dispatch.elementMouseout.apply(this, arguments); }); - - chart.interpolate = function(_) { - if (!arguments.length) return interpolate; - interpolate = _; - return chart; - }; - - chart.duration = function(_) { - if (!arguments.length) return duration; - duration = _; - renderWatch.reset(duration); - scatter.duration(duration); - return chart; - }; - - chart.dispatch = dispatch; - chart.scatter = scatter; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - clipEdge: {get: function(){return clipEdge;}, set: function(_){clipEdge=_;}}, - offset: {get: function(){return offset;}, set: function(_){offset=_;}}, - order: {get: function(){return order;}, set: function(_){order=_;}}, - interpolate: {get: function(){return interpolate;}, set: function(_){interpolate=_;}}, - - // simple functor options - x: {get: function(){return getX;}, set: function(_){getX = d3.functor(_);}}, - y: {get: function(){return getY;}, set: function(_){getY = d3.functor(_);}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - }}, - style: {get: function(){return style;}, set: function(_){ - style = _; - switch (style) { - case 'stack': - chart.offset('zero'); - chart.order('default'); - break; - case 'stream': - chart.offset('wiggle'); - chart.order('inside-out'); - break; - case 'stream-center': - chart.offset('silhouette'); - chart.order('inside-out'); - break; - case 'expand': - chart.offset('expand'); - chart.order('default'); - break; - case 'stack_percent': - chart.offset(chart.d3_stackedOffset_stackPercent); - chart.order('default'); - break; - } - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - scatter.duration(duration); - }} - }); - - nv.utils.inheritOptions(chart, scatter); - nv.utils.initOptions(chart); - - return chart; -}; - -nv.models.stackedAreaChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var stacked = nv.models.stackedArea() - , xAxis = nv.models.axis() - , yAxis = nv.models.axis() - , legend = nv.models.legend() - , controls = nv.models.legend() - , interactiveLayer = nv.interactiveGuideline() - , tooltip = nv.models.tooltip() - ; - - var margin = {top: 30, right: 25, bottom: 50, left: 60} - , width = null - , height = null - , color = nv.utils.defaultColor() - , showControls = true - , showLegend = true - , showXAxis = true - , showYAxis = true - , rightAlignYAxis = false - , useInteractiveGuideline = false - , x //can be accessed via chart.xScale() - , y //can be accessed via chart.yScale() - , state = nv.utils.state() - , defaultState = null - , noData = null - , dispatch = d3.dispatch('stateChange', 'changeState','renderEnd') - , controlWidth = 250 - , controlOptions = ['Stacked','Stream','Expanded'] - , controlLabels = {} - , duration = 250 - ; - - state.style = stacked.style(); - xAxis.orient('bottom').tickPadding(7); - yAxis.orient((rightAlignYAxis) ? 'right' : 'left'); - - tooltip - .headerFormatter(function(d, i) { - return xAxis.tickFormat()(d, i); - }) - .valueFormatter(function(d, i) { - return yAxis.tickFormat()(d, i); - }); - - interactiveLayer.tooltip - .headerFormatter(function(d, i) { - return xAxis.tickFormat()(d, i); - }) - .valueFormatter(function(d, i) { - return yAxis.tickFormat()(d, i); - }); - - var oldYTickFormat = null, - oldValueFormatter = null; - - controls.updateState(false); - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var renderWatch = nv.utils.renderWatch(dispatch); - var style = stacked.style(); - - var stateGetter = function(data) { - return function(){ - return { - active: data.map(function(d) { return !d.disabled }), - style: stacked.style() - }; - } - }; - - var stateSetter = function(data) { - return function(state) { - if (state.style !== undefined) - style = state.style; - if (state.active !== undefined) - data.forEach(function(series,i) { - series.disabled = !state.active[i]; - }); - } - }; - - var percentFormatter = d3.format('%'); - - function chart(selection) { - renderWatch.reset(); - renderWatch.models(stacked); - if (showXAxis) renderWatch.models(xAxis); - if (showYAxis) renderWatch.models(yAxis); - - selection.each(function(data) { - var container = d3.select(this), - that = this; - nv.utils.initSVG(container); - - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - chart.update = function() { container.transition().duration(duration).call(chart); }; - chart.container = this; - - state - .setter(stateSetter(data), chart.update) - .getter(stateGetter(data)) - .update(); - - // DEPRECATED set state.disabled - state.disabled = data.map(function(d) { return !!d.disabled }); - - if (!defaultState) { - var key; - defaultState = {}; - for (key in state) { - if (state[key] instanceof Array) - defaultState[key] = state[key].slice(0); - else - defaultState[key] = state[key]; - } - } - - // Display No Data message if there's nothing to show. - if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { - nv.utils.noData(chart, container) - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - // Setup Scales - x = stacked.xScale(); - y = stacked.yScale(); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-stackedAreaChart').data([data]); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedAreaChart').append('g'); - var g = wrap.select('g'); - - gEnter.append("rect").style("opacity",0); - gEnter.append('g').attr('class', 'nv-x nv-axis'); - gEnter.append('g').attr('class', 'nv-y nv-axis'); - gEnter.append('g').attr('class', 'nv-stackedWrap'); - gEnter.append('g').attr('class', 'nv-legendWrap'); - gEnter.append('g').attr('class', 'nv-controlsWrap'); - gEnter.append('g').attr('class', 'nv-interactive'); - - g.select("rect").attr("width",availableWidth).attr("height",availableHeight); - - // Legend - if (showLegend) { - var legendWidth = (showControls) ? availableWidth - controlWidth : availableWidth; - - legend.width(legendWidth); - g.select('.nv-legendWrap').datum(data).call(legend); - - if ( margin.top != legend.height()) { - margin.top = legend.height(); - availableHeight = nv.utils.availableHeight(height, container, margin); - } - - g.select('.nv-legendWrap') - .attr('transform', 'translate(' + (availableWidth-legendWidth) + ',' + (-margin.top) +')'); - } - - // Controls - if (showControls) { - var controlsData = [ - { - key: controlLabels.stacked || 'Stacked', - metaKey: 'Stacked', - disabled: stacked.style() != 'stack', - style: 'stack' - }, - { - key: controlLabels.stream || 'Stream', - metaKey: 'Stream', - disabled: stacked.style() != 'stream', - style: 'stream' - }, - { - key: controlLabels.expanded || 'Expanded', - metaKey: 'Expanded', - disabled: stacked.style() != 'expand', - style: 'expand' - }, - { - key: controlLabels.stack_percent || 'Stack %', - metaKey: 'Stack_Percent', - disabled: stacked.style() != 'stack_percent', - style: 'stack_percent' - } - ]; - - controlWidth = (controlOptions.length/3) * 260; - controlsData = controlsData.filter(function(d) { - return controlOptions.indexOf(d.metaKey) !== -1; - }); - - controls - .width( controlWidth ) - .color(['#444', '#444', '#444']); - - g.select('.nv-controlsWrap') - .datum(controlsData) - .call(controls); - - if ( margin.top != Math.max(controls.height(), legend.height()) ) { - margin.top = Math.max(controls.height(), legend.height()); - availableHeight = nv.utils.availableHeight(height, container, margin); - } - - g.select('.nv-controlsWrap') - .attr('transform', 'translate(0,' + (-margin.top) +')'); - } - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - if (rightAlignYAxis) { - g.select(".nv-y.nv-axis") - .attr("transform", "translate(" + availableWidth + ",0)"); - } - - //Set up interactive layer - if (useInteractiveGuideline) { - interactiveLayer - .width(availableWidth) - .height(availableHeight) - .margin({left: margin.left, top: margin.top}) - .svgContainer(container) - .xScale(x); - wrap.select(".nv-interactive").call(interactiveLayer); - } - - stacked - .width(availableWidth) - .height(availableHeight); - - var stackedWrap = g.select('.nv-stackedWrap') - .datum(data); - - stackedWrap.transition().call(stacked); - - // Setup Axes - if (showXAxis) { - xAxis.scale(x) - ._ticks( nv.utils.calcTicksX(availableWidth/100, data) ) - .tickSize( -availableHeight, 0); - - g.select('.nv-x.nv-axis') - .attr('transform', 'translate(0,' + availableHeight + ')'); - - g.select('.nv-x.nv-axis') - .transition().duration(0) - .call(xAxis); - } - - if (showYAxis) { - var ticks; - if (stacked.offset() === 'wiggle') { - ticks = 0; - } - else { - ticks = nv.utils.calcTicksY(availableHeight/36, data); - } - yAxis.scale(y) - ._ticks(ticks) - .tickSize(-availableWidth, 0); - - if (stacked.style() === 'expand' || stacked.style() === 'stack_percent') { - var currentFormat = yAxis.tickFormat(); - - if ( !oldYTickFormat || currentFormat !== percentFormatter ) - oldYTickFormat = currentFormat; - - //Forces the yAxis to use percentage in 'expand' mode. - yAxis.tickFormat(percentFormatter); - } - else { - if (oldYTickFormat) { - yAxis.tickFormat(oldYTickFormat); - oldYTickFormat = null; - } - } - - g.select('.nv-y.nv-axis') - .transition().duration(0) - .call(yAxis); - } - - //============================================================ - // Event Handling/Dispatching (in chart's scope) - //------------------------------------------------------------ - - stacked.dispatch.on('areaClick.toggle', function(e) { - if (data.filter(function(d) { return !d.disabled }).length === 1) - data.forEach(function(d) { - d.disabled = false; - }); - else - data.forEach(function(d,i) { - d.disabled = (i != e.seriesIndex); - }); - - state.disabled = data.map(function(d) { return !!d.disabled }); - dispatch.stateChange(state); - - chart.update(); - }); - - legend.dispatch.on('stateChange', function(newState) { - for (var key in newState) - state[key] = newState[key]; - dispatch.stateChange(state); - chart.update(); - }); - - controls.dispatch.on('legendClick', function(d,i) { - if (!d.disabled) return; - - controlsData = controlsData.map(function(s) { - s.disabled = true; - return s; - }); - d.disabled = false; - - stacked.style(d.style); - - - state.style = stacked.style(); - dispatch.stateChange(state); - - chart.update(); - }); - - interactiveLayer.dispatch.on('elementMousemove', function(e) { - stacked.clearHighlights(); - var singlePoint, pointIndex, pointXLocation, allData = []; - data - .filter(function(series, i) { - series.seriesIndex = i; - return !series.disabled; - }) - .forEach(function(series,i) { - pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x()); - var point = series.values[pointIndex]; - var pointYValue = chart.y()(point, pointIndex); - if (pointYValue != null) { - stacked.highlightPoint(i, pointIndex, true); - } - if (typeof point === 'undefined') return; - if (typeof singlePoint === 'undefined') singlePoint = point; - if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex)); - - //If we are in 'expand' mode, use the stacked percent value instead of raw value. - var tooltipValue = (stacked.style() == 'expand') ? point.display.y : chart.y()(point,pointIndex); - allData.push({ - key: series.key, - value: tooltipValue, - color: color(series,series.seriesIndex), - stackedValue: point.display - }); - }); - - allData.reverse(); - - //Highlight the tooltip entry based on which stack the mouse is closest to. - if (allData.length > 2) { - var yValue = chart.yScale().invert(e.mouseY); - var yDistMax = Infinity, indexToHighlight = null; - allData.forEach(function(series,i) { - - //To handle situation where the stacked area chart is negative, we need to use absolute values - //when checking if the mouse Y value is within the stack area. - yValue = Math.abs(yValue); - var stackedY0 = Math.abs(series.stackedValue.y0); - var stackedY = Math.abs(series.stackedValue.y); - if ( yValue >= stackedY0 && yValue <= (stackedY + stackedY0)) - { - indexToHighlight = i; - return; - } - }); - if (indexToHighlight != null) - allData[indexToHighlight].highlight = true; - } - - var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex)); - - var valueFormatter = interactiveLayer.tooltip.valueFormatter(); - // Keeps track of the tooltip valueFormatter if the chart changes to expanded view - if (stacked.style() === 'expand' || stacked.style() === 'stack_percent') { - if ( !oldValueFormatter ) { - oldValueFormatter = valueFormatter; - } - //Forces the tooltip to use percentage in 'expand' mode. - valueFormatter = d3.format(".1%"); - } - else { - if (oldValueFormatter) { - valueFormatter = oldValueFormatter; - oldValueFormatter = null; - } - } - - interactiveLayer.tooltip - .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top}) - .chartContainer(that.parentNode) - .valueFormatter(valueFormatter) - .data( - { - value: xValue, - series: allData - } - )(); - - interactiveLayer.renderGuideLine(pointXLocation); - - }); - - interactiveLayer.dispatch.on("elementMouseout",function(e) { - stacked.clearHighlights(); - }); - - // Update chart from a state object passed to event handler - dispatch.on('changeState', function(e) { - - if (typeof e.disabled !== 'undefined' && data.length === e.disabled.length) { - data.forEach(function(series,i) { - series.disabled = e.disabled[i]; - }); - - state.disabled = e.disabled; - } - - if (typeof e.style !== 'undefined') { - stacked.style(e.style); - style = e.style; - } - - chart.update(); - }); - - }); - - renderWatch.renderEnd('stacked Area chart immediate'); - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - stacked.dispatch.on('elementMouseover.tooltip', function(evt) { - evt.point['x'] = stacked.x()(evt.point); - evt.point['y'] = stacked.y()(evt.point); - tooltip.data(evt).position(evt.pos).hidden(false); - }); - - stacked.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true) - }); - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.dispatch = dispatch; - chart.stacked = stacked; - chart.legend = legend; - chart.controls = controls; - chart.xAxis = xAxis; - chart.yAxis = yAxis; - chart.interactiveLayer = interactiveLayer; - chart.tooltip = tooltip; - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - showLegend: {get: function(){return showLegend;}, set: function(_){showLegend=_;}}, - showXAxis: {get: function(){return showXAxis;}, set: function(_){showXAxis=_;}}, - showYAxis: {get: function(){return showYAxis;}, set: function(_){showYAxis=_;}}, - defaultState: {get: function(){return defaultState;}, set: function(_){defaultState=_;}}, - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - showControls: {get: function(){return showControls;}, set: function(_){showControls=_;}}, - controlLabels: {get: function(){return controlLabels;}, set: function(_){controlLabels=_;}}, - controlOptions: {get: function(){return controlOptions;}, set: function(_){controlOptions=_;}}, - - // deprecated options - tooltips: {get: function(){return tooltip.enabled();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltips', 'use chart.tooltip.enabled() instead'); - tooltip.enabled(!!_); - }}, - tooltipContent: {get: function(){return tooltip.contentGenerator();}, set: function(_){ - // deprecated after 1.7.1 - nv.deprecated('tooltipContent', 'use chart.tooltip.contentGenerator() instead'); - tooltip.contentGenerator(_); - }}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - stacked.duration(duration); - xAxis.duration(duration); - yAxis.duration(duration); - }}, - color: {get: function(){return color;}, set: function(_){ - color = nv.utils.getColor(_); - legend.color(color); - stacked.color(color); - }}, - rightAlignYAxis: {get: function(){return rightAlignYAxis;}, set: function(_){ - rightAlignYAxis = _; - yAxis.orient( rightAlignYAxis ? 'right' : 'left'); - }}, - useInteractiveGuideline: {get: function(){return useInteractiveGuideline;}, set: function(_){ - useInteractiveGuideline = !!_; - chart.interactive(!_); - chart.useVoronoi(!_); - stacked.scatter.interactive(!_); - }} - }); - - nv.utils.inheritOptions(chart, stacked); - nv.utils.initOptions(chart); - - return chart; -}; -// based on http://bl.ocks.org/kerryrodden/477c1bfb081b783f80ad -nv.models.sunburst = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var margin = {top: 0, right: 0, bottom: 0, left: 0} - , width = null - , height = null - , mode = "count" - , modes = {count: function(d) { return 1; }, size: function(d) { return d.size }} - , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one - , container = null - , color = nv.utils.defaultColor() - , duration = 500 - , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMousemove', 'elementMouseover', 'elementMouseout', 'renderEnd') - ; - - var x = d3.scale.linear().range([0, 2 * Math.PI]); - var y = d3.scale.sqrt(); - - var partition = d3.layout.partition() - .sort(null) - .value(function(d) { return 1; }); - - var arc = d3.svg.arc() - .startAngle(function(d) { return Math.max(0, Math.min(2 * Math.PI, x(d.x))); }) - .endAngle(function(d) { return Math.max(0, Math.min(2 * Math.PI, x(d.x + d.dx))); }) - .innerRadius(function(d) { return Math.max(0, y(d.y)); }) - .outerRadius(function(d) { return Math.max(0, y(d.y + d.dy)); }); - - // Keep track of the current and previous node being displayed as the root. - var node, prevNode; - // Keep track of the root node - var rootNode; - - //============================================================ - // chart function - //------------------------------------------------------------ - - var renderWatch = nv.utils.renderWatch(dispatch); - - function chart(selection) { - renderWatch.reset(); - selection.each(function(data) { - container = d3.select(this); - var availableWidth = nv.utils.availableWidth(width, container, margin); - var availableHeight = nv.utils.availableHeight(height, container, margin); - var radius = Math.min(availableWidth, availableHeight) / 2; - var path; - - nv.utils.initSVG(container); - - // Setup containers and skeleton of chart - var wrap = container.selectAll('.nv-wrap.nv-sunburst').data(data); - var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sunburst nv-chart-' + id); - - var g = wrapEnter.selectAll('nv-sunburst'); - - wrap.attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')'); - - container.on('click', function (d, i) { - dispatch.chartClick({ - data: d, - index: i, - pos: d3.event, - id: id - }); - }); - - y.range([0, radius]); - - node = node || data; - rootNode = data[0]; - partition.value(modes[mode] || modes["count"]); - path = g.data(partition.nodes).enter() - .append("path") - .attr("d", arc) - .style("fill", function (d) { - return color((d.children ? d : d.parent).name); - }) - .style("stroke", "#FFF") - .on("click", function(d) { - if (prevNode !== node && node !== d) prevNode = node; - node = d; - path.transition() - .duration(duration) - .attrTween("d", arcTweenZoom(d)); - }) - .each(stash) - .on("dblclick", function(d) { - if (prevNode.parent == d) { - path.transition() - .duration(duration) - .attrTween("d", arcTweenZoom(rootNode)); - } - }) - .each(stash) - .on('mouseover', function(d,i){ - d3.select(this).classed('hover', true).style('opacity', 0.8); - dispatch.elementMouseover({ - data: d, - color: d3.select(this).style("fill") - }); - }) - .on('mouseout', function(d,i){ - d3.select(this).classed('hover', false).style('opacity', 1); - dispatch.elementMouseout({ - data: d - }); - }) - .on('mousemove', function(d,i){ - dispatch.elementMousemove({ - data: d - }); - }); - - - - // Setup for switching data: stash the old values for transition. - function stash(d) { - d.x0 = d.x; - d.dx0 = d.dx; - } - - // When switching data: interpolate the arcs in data space. - function arcTweenData(a, i) { - var oi = d3.interpolate({x: a.x0, dx: a.dx0}, a); - - function tween(t) { - var b = oi(t); - a.x0 = b.x; - a.dx0 = b.dx; - return arc(b); - } - - if (i == 0) { - // If we are on the first arc, adjust the x domain to match the root node - // at the current zoom level. (We only need to do this once.) - var xd = d3.interpolate(x.domain(), [node.x, node.x + node.dx]); - return function (t) { - x.domain(xd(t)); - return tween(t); - }; - } else { - return tween; - } - } - - // When zooming: interpolate the scales. - function arcTweenZoom(d) { - var xd = d3.interpolate(x.domain(), [d.x, d.x + d.dx]), - yd = d3.interpolate(y.domain(), [d.y, 1]), - yr = d3.interpolate(y.range(), [d.y ? 20 : 0, radius]); - return function (d, i) { - return i - ? function (t) { - return arc(d); - } - : function (t) { - x.domain(xd(t)); - y.domain(yd(t)).range(yr(t)); - return arc(d); - }; - }; - } - - }); - - renderWatch.renderEnd('sunburst immediate'); - return chart; - } - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - chart.dispatch = dispatch; - chart.options = nv.utils.optionsFunc.bind(chart); - - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - width: {get: function(){return width;}, set: function(_){width=_;}}, - height: {get: function(){return height;}, set: function(_){height=_;}}, - mode: {get: function(){return mode;}, set: function(_){mode=_;}}, - id: {get: function(){return id;}, set: function(_){id=_;}}, - duration: {get: function(){return duration;}, set: function(_){duration=_;}}, - - // options that require extra logic in the setter - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top != undefined ? _.top : margin.top; - margin.right = _.right != undefined ? _.right : margin.right; - margin.bottom = _.bottom != undefined ? _.bottom : margin.bottom; - margin.left = _.left != undefined ? _.left : margin.left; - }}, - color: {get: function(){return color;}, set: function(_){ - color=nv.utils.getColor(_); - }} - }); - - nv.utils.initOptions(chart); - return chart; -}; -nv.models.sunburstChart = function() { - "use strict"; - - //============================================================ - // Public Variables with Default Settings - //------------------------------------------------------------ - - var sunburst = nv.models.sunburst(); - var tooltip = nv.models.tooltip(); - - var margin = {top: 30, right: 20, bottom: 20, left: 20} - , width = null - , height = null - , color = nv.utils.defaultColor() - , id = Math.round(Math.random() * 100000) - , defaultState = null - , noData = null - , duration = 250 - , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState','renderEnd') - ; - - //============================================================ - // Private Variables - //------------------------------------------------------------ - - var renderWatch = nv.utils.renderWatch(dispatch); - tooltip.headerEnabled(false).duration(0).valueFormatter(function(d, i) { - return d; - }); - - //============================================================ - // Chart function - //------------------------------------------------------------ - - function chart(selection) { - renderWatch.reset(); - renderWatch.models(sunburst); - - selection.each(function(data) { - var container = d3.select(this); - nv.utils.initSVG(container); - - var that = this; - var availableWidth = nv.utils.availableWidth(width, container, margin), - availableHeight = nv.utils.availableHeight(height, container, margin); - - chart.update = function() { - if (duration === 0) - container.call(chart); - else - container.transition().duration(duration).call(chart) - }; - chart.container = this; - - // Display No Data message if there's nothing to show. - if (!data || !data.length) { - nv.utils.noData(chart, container); - return chart; - } else { - container.selectAll('.nv-noData').remove(); - } - - // Setup containers and skeleton of chart - var wrap = container.selectAll('g.nv-wrap.nv-sunburstChart').data(data); - var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sunburstChart').append('g'); - var g = wrap.select('g'); - - gEnter.append('g').attr('class', 'nv-sunburstWrap'); - - wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); - - // Main Chart Component(s) - sunburst.width(availableWidth).height(availableHeight); - var sunWrap = g.select('.nv-sunburstWrap').datum(data); - d3.transition(sunWrap).call(sunburst); - - }); - - renderWatch.renderEnd('sunburstChart immediate'); - return chart; - } - - //============================================================ - // Event Handling/Dispatching (out of chart's scope) - //------------------------------------------------------------ - - sunburst.dispatch.on('elementMouseover.tooltip', function(evt) { - evt['series'] = { - key: evt.data.name, - value: evt.data.size, - color: evt.color - }; - tooltip.data(evt).hidden(false); - }); - - sunburst.dispatch.on('elementMouseout.tooltip', function(evt) { - tooltip.hidden(true); - }); - - sunburst.dispatch.on('elementMousemove.tooltip', function(evt) { - tooltip.position({top: d3.event.pageY, left: d3.event.pageX})(); - }); - - //============================================================ - // Expose Public Variables - //------------------------------------------------------------ - - // expose chart's sub-components - chart.dispatch = dispatch; - chart.sunburst = sunburst; - chart.tooltip = tooltip; - chart.options = nv.utils.optionsFunc.bind(chart); - - // use Object get/set functionality to map between vars and chart functions - chart._options = Object.create({}, { - // simple options, just get/set the necessary values - noData: {get: function(){return noData;}, set: function(_){noData=_;}}, - defaultState: {get: function(){return defaultState;}, set: function(_){defaultState=_;}}, - - // options that require extra logic in the setter - color: {get: function(){return color;}, set: function(_){ - color = _; - sunburst.color(color); - }}, - duration: {get: function(){return duration;}, set: function(_){ - duration = _; - renderWatch.reset(duration); - sunburst.duration(duration); - }}, - margin: {get: function(){return margin;}, set: function(_){ - margin.top = _.top !== undefined ? _.top : margin.top; - margin.right = _.right !== undefined ? _.right : margin.right; - margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom; - margin.left = _.left !== undefined ? _.left : margin.left; - }} - }); - nv.utils.inheritOptions(chart, sunburst); - nv.utils.initOptions(chart); - return chart; -}; - -nv.version = "1.8.1"; -})(); \ No newline at end of file diff --git a/wqflask/wqflask/static/new/packages/nvd3/nv.d3.min.css b/wqflask/wqflask/static/new/packages/nvd3/nv.d3.min.css deleted file mode 100644 index 7a6f7fe9..00000000 --- a/wqflask/wqflask/static/new/packages/nvd3/nv.d3.min.css +++ /dev/null @@ -1 +0,0 @@ -.nvd3 .nv-axis{pointer-events:none;opacity:1}.nvd3 .nv-axis path{fill:none;stroke:#000;stroke-opacity:.75;shape-rendering:crispEdges}.nvd3 .nv-axis path.domain{stroke-opacity:.75}.nvd3 .nv-axis.nv-x path.domain{stroke-opacity:0}.nvd3 .nv-axis line{fill:none;stroke:#e5e5e5;shape-rendering:crispEdges}.nvd3 .nv-axis .zero line,.nvd3 .nv-axis line.zero{stroke-opacity:.75}.nvd3 .nv-axis .nv-axisMaxMin text{font-weight:700}.nvd3 .x .nv-axis .nv-axisMaxMin text,.nvd3 .x2 .nv-axis .nv-axisMaxMin text,.nvd3 .x3 .nv-axis .nv-axisMaxMin text{text-anchor:middle}.nvd3 .nv-axis.nv-disabled{opacity:0}.nvd3 .nv-bars rect{fill-opacity:.75;transition:fill-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear}.nvd3 .nv-bars rect.hover{fill-opacity:1}.nvd3 .nv-bars .hover rect{fill:#add8e6}.nvd3 .nv-bars text{fill:rgba(0,0,0,0)}.nvd3 .nv-bars .hover text{fill:rgba(0,0,0,1)}.nvd3 .nv-multibar .nv-groups rect,.nvd3 .nv-multibarHorizontal .nv-groups rect,.nvd3 .nv-discretebar .nv-groups rect{stroke-opacity:0;transition:fill-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear}.nvd3 .nv-multibar .nv-groups rect:hover,.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,.nvd3 .nv-candlestickBar .nv-ticks rect:hover,.nvd3 .nv-discretebar .nv-groups rect:hover{fill-opacity:1}.nvd3 .nv-discretebar .nv-groups text,.nvd3 .nv-multibarHorizontal .nv-groups text{font-weight:700;fill:rgba(0,0,0,1);stroke:rgba(0,0,0,0)}.nvd3 .nv-boxplot circle{fill-opacity:.5}.nvd3 .nv-boxplot circle:hover{fill-opacity:1}.nvd3 .nv-boxplot rect:hover{fill-opacity:1}.nvd3 line.nv-boxplot-median{stroke:#000}.nv-boxplot-tick:hover{stroke-width:2.5px}.nvd3.nv-bullet{font:10px sans-serif}.nvd3.nv-bullet .nv-measure{fill-opacity:.8}.nvd3.nv-bullet .nv-measure:hover{fill-opacity:1}.nvd3.nv-bullet .nv-marker{stroke:#000;stroke-width:2px}.nvd3.nv-bullet .nv-markerTriangle{stroke:#000;fill:#fff;stroke-width:1.5px}.nvd3.nv-bullet .nv-tick line{stroke:#666;stroke-width:.5px}.nvd3.nv-bullet .nv-range.nv-s0{fill:#eee}.nvd3.nv-bullet .nv-range.nv-s1{fill:#ddd}.nvd3.nv-bullet .nv-range.nv-s2{fill:#ccc}.nvd3.nv-bullet .nv-title{font-size:14px;font-weight:700}.nvd3.nv-bullet .nv-subtitle{fill:#999}.nvd3.nv-bullet .nv-range{fill:#bababa;fill-opacity:.4}.nvd3.nv-bullet .nv-range:hover{fill-opacity:.7}.nvd3.nv-candlestickBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect{stroke:#d62728;fill:#d62728}.with-transitions .nv-candlestickBar .nv-ticks .nv-tick{transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-moz-transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-webkit-transition:stroke-width 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-candlestickBar .nv-ticks line{stroke:#333}.nvd3 .nv-legend .nv-disabled rect{}.nvd3 .nv-check-box .nv-box{fill-opacity:0;stroke-width:2}.nvd3 .nv-check-box .nv-check{fill-opacity:0;stroke-width:4}.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check{fill-opacity:0;stroke-opacity:0}.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check{opacity:0}.nvd3.nv-linePlusBar .nv-bar rect{fill-opacity:.75}.nvd3.nv-linePlusBar .nv-bar rect:hover{fill-opacity:1}.nvd3 .nv-groups path.nv-line{fill:none}.nvd3 .nv-groups path.nv-area{stroke:none}.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point{fill-opacity:0;stroke-opacity:0}.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point{fill-opacity:.5!important;stroke-opacity:.5!important}.with-transitions .nvd3 .nv-groups .nv-point{transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-moz-transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-webkit-transition:stroke-width 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-scatter .nv-groups .nv-point.hover,.nvd3 .nv-groups .nv-point.hover{stroke-width:7px;fill-opacity:.95!important;stroke-opacity:.95!important}.nvd3 .nv-point-paths path{stroke:#aaa;stroke-opacity:0;fill:#eee;fill-opacity:0}.nvd3 .nv-indexLine{cursor:ew-resize}svg.nvd3-svg{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-ms-user-select:none;-moz-user-select:none;user-select:none;display:block;width:100%;height:100%}.nvtooltip.with-3d-shadow,.with-3d-shadow .nvtooltip{-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.nvd3 text{font:400 12px Arial}.nvd3 .title{font:700 14px Arial}.nvd3 .nv-background{fill:#fff;fill-opacity:0}.nvd3.nv-noData{font-size:18px;font-weight:700}.nv-brush .extent{fill-opacity:.125;shape-rendering:crispEdges}.nv-brush .resize path{fill:#eee;stroke:#666}.nvd3 .nv-legend .nv-series{cursor:pointer}.nvd3 .nv-legend .nv-disabled circle{fill-opacity:0}.nvd3 .nv-brush .extent{fill-opacity:0!important}.nvd3 .nv-brushBackground rect{stroke:#000;stroke-width:.4;fill:#fff;fill-opacity:.7}.nvd3.nv-ohlcBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive{stroke:#2ca02c}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative{stroke:#d62728}.nvd3 .background path{fill:none;stroke:#EEE;stroke-opacity:.4;shape-rendering:crispEdges}.nvd3 .foreground path{fill:none;stroke-opacity:.7}.nvd3 .nv-parallelCoordinates-brush .extent{fill:#fff;fill-opacity:.6;stroke:gray;shape-rendering:crispEdges}.nvd3 .nv-parallelCoordinates .hover{fill-opacity:1;stroke-width:3px}.nvd3 .missingValuesline line{fill:none;stroke:#000;stroke-width:1;stroke-opacity:1;stroke-dasharray:5,5}.nvd3.nv-pie path{stroke-opacity:0;transition:fill-opacity 250ms linear,stroke-width 250ms linear,stroke-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear,stroke-width 250ms linear,stroke-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear,stroke-width 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-pie .nv-pie-title{font-size:24px;fill:rgba(19,196,249,.59)}.nvd3.nv-pie .nv-slice text{stroke:#000;stroke-width:0}.nvd3.nv-pie path{stroke:#fff;stroke-width:1px;stroke-opacity:1}.nvd3.nv-pie .hover path{fill-opacity:.7}.nvd3.nv-pie .nv-label{pointer-events:none}.nvd3.nv-pie .nv-label rect{fill-opacity:0;stroke-opacity:0}.nvd3 .nv-groups .nv-point.hover{stroke-width:20px;stroke-opacity:.5}.nvd3 .nv-scatter .nv-point.hover{fill-opacity:1}.nv-noninteractive{pointer-events:none}.nv-distx,.nv-disty{pointer-events:none}.nvd3.nv-sparkline path{fill:none}.nvd3.nv-sparklineplus g.nv-hoverValue{pointer-events:none}.nvd3.nv-sparklineplus .nv-hoverValue line{stroke:#333;stroke-width:1.5px}.nvd3.nv-sparklineplus,.nvd3.nv-sparklineplus g{pointer-events:all}.nvd3 .nv-hoverArea{fill-opacity:0;stroke-opacity:0}.nvd3.nv-sparklineplus .nv-xValue,.nvd3.nv-sparklineplus .nv-yValue{stroke-width:0;font-size:.9em;font-weight:400}.nvd3.nv-sparklineplus .nv-yValue{stroke:#f66}.nvd3.nv-sparklineplus .nv-maxValue{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-sparklineplus .nv-minValue{stroke:#d62728;fill:#d62728}.nvd3.nv-sparklineplus .nv-currentValue{font-weight:700;font-size:1.1em}.nvd3.nv-stackedarea path.nv-area{fill-opacity:.7;stroke-opacity:0;transition:fill-opacity 250ms linear,stroke-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear,stroke-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-stackedarea path.nv-area.hover{fill-opacity:.9}.nvd3.nv-stackedarea .nv-groups .nv-point{stroke-opacity:0;fill-opacity:0}.nvtooltip{position:absolute;background-color:rgba(255,255,255,1);color:rgba(0,0,0,1);padding:1px;border:1px solid rgba(0,0,0,.2);z-index:10000;display:block;font-family:Arial;font-size:13px;text-align:left;pointer-events:none;white-space:nowrap;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.nvtooltip{background:rgba(255,255,255,.8);border:1px solid rgba(0,0,0,.5);border-radius:4px}.nvtooltip.with-transitions,.with-transitions .nvtooltip{transition:opacity 50ms linear;-moz-transition:opacity 50ms linear;-webkit-transition:opacity 50ms linear;transition-delay:200ms;-moz-transition-delay:200ms;-webkit-transition-delay:200ms}.nvtooltip.x-nvtooltip,.nvtooltip.y-nvtooltip{padding:8px}.nvtooltip h3{margin:0;padding:4px 14px;line-height:18px;font-weight:400;background-color:rgba(247,247,247,.75);color:rgba(0,0,0,1);text-align:center;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.nvtooltip p{margin:0;padding:5px 14px;text-align:center}.nvtooltip span{display:inline-block;margin:2px 0}.nvtooltip table{margin:6px;border-spacing:0}.nvtooltip table td{padding:2px 9px 2px 0;vertical-align:middle}.nvtooltip table td.key{font-weight:400}.nvtooltip table td.value{text-align:right;font-weight:700}.nvtooltip table tr.highlight td{padding:1px 9px 1px 0;border-bottom-style:solid;border-bottom-width:1px;border-top-style:solid;border-top-width:1px}.nvtooltip table td.legend-color-guide div{width:8px;height:8px;vertical-align:middle}.nvtooltip table td.legend-color-guide div{width:12px;height:12px;border:1px solid #999}.nvtooltip .footer{padding:3px;text-align:center}.nvtooltip-pending-removal{pointer-events:none;display:none}.nvd3 .nv-interactiveGuideLine{pointer-events:none}.nvd3 line.nv-guideline{stroke:#ccc} \ No newline at end of file diff --git a/wqflask/wqflask/static/new/packages/nvd3/nv.d3.min.js b/wqflask/wqflask/static/new/packages/nvd3/nv.d3.min.js deleted file mode 100644 index ab17e9fe..00000000 --- a/wqflask/wqflask/static/new/packages/nvd3/nv.d3.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/* nvd3 version 1.8.1 (https://github.com/novus/nvd3) 2015-05-25 */ -!function(){var a={};a.dev=!1,a.tooltip=a.tooltip||{},a.utils=a.utils||{},a.models=a.models||{},a.charts={},a.logs={},a.dom={},a.dispatch=d3.dispatch("render_start","render_end"),Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e}),a.dev&&(a.dispatch.on("render_start",function(b){a.logs.startTime=+new Date}),a.dispatch.on("render_end",function(b){a.logs.endTime=+new Date,a.logs.totalTime=a.logs.endTime-a.logs.startTime,a.log("total",a.logs.totalTime)})),a.log=function(){if(a.dev&&window.console&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(a.dev&&window.console&&"function"==typeof console.log&&Function.prototype.bind){var b=Function.prototype.bind.call(console.log,console);b.apply(console,arguments)}return arguments[arguments.length-1]},a.deprecated=function(a,b){console&&console.warn&&console.warn("nvd3 warning: `"+a+"` has been deprecated. ",b||"")},a.render=function(b){b=b||1,a.render.active=!0,a.dispatch.render_start();var c=function(){for(var d,e,f=0;b>f&&(e=a.render.queue[f]);f++)d=e.generate(),typeof e.callback==typeof Function&&e.callback(d);a.render.queue.splice(0,f),a.render.queue.length?setTimeout(c):(a.dispatch.render_end(),a.render.active=!1)};setTimeout(c)},a.render.active=!1,a.render.queue=[],a.addGraph=function(b){typeof arguments[0]==typeof Function&&(b={generate:arguments[0],callback:arguments[1]}),a.render.queue.push(b),a.render.active||a.render()},"undefined"!=typeof module&&"undefined"!=typeof exports&&(module.exports=a),"undefined"!=typeof window&&(window.nv=a),a.dom.write=function(a){return void 0!==window.fastdom?fastdom.write(a):a()},a.dom.read=function(a){return void 0!==window.fastdom?fastdom.read(a):a()},a.interactiveGuideline=function(){"use strict";function b(l){l.each(function(l){function m(){var a=d3.mouse(this),d=a[0],e=a[1],i=!0,j=!1;if(k&&(d=d3.event.offsetX,e=d3.event.offsetY,"svg"!==d3.event.target.tagName&&(i=!1),d3.event.target.className.baseVal.match("nv-legend")&&(j=!0)),i&&(d-=f.left,e-=f.top),0>d||0>e||d>o||e>p||d3.event.relatedTarget&&void 0===d3.event.relatedTarget.ownerSVGElement||j){if(k&&d3.event.relatedTarget&&void 0===d3.event.relatedTarget.ownerSVGElement&&(void 0===d3.event.relatedTarget.className||d3.event.relatedTarget.className.match(c.nvPointerEventsClass)))return;return h.elementMouseout({mouseX:d,mouseY:e}),b.renderGuideLine(null),void c.hidden(!0)}c.hidden(!1);var l=g.invert(d);h.elementMousemove({mouseX:d,mouseY:e,pointXValue:l}),"dblclick"===d3.event.type&&h.elementDblclick({mouseX:d,mouseY:e,pointXValue:l}),"click"===d3.event.type&&h.elementClick({mouseX:d,mouseY:e,pointXValue:l})}var n=d3.select(this),o=d||960,p=e||400,q=n.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([l]),r=q.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");r.append("g").attr("class","nv-interactiveGuideLine"),j&&(j.on("touchmove",m).on("mousemove",m,!0).on("mouseout",m,!0).on("dblclick",m).on("click",m),b.guideLine=null,b.renderGuideLine=function(c){i&&(b.guideLine&&b.guideLine.attr("x1")===c||a.dom.write(function(){var b=q.select(".nv-interactiveGuideLine").selectAll("line").data(null!=c?[a.utils.NaNtoZero(c)]:[],String);b.enter().append("line").attr("class","nv-guideline").attr("x1",function(a){return a}).attr("x2",function(a){return a}).attr("y1",p).attr("y2",0),b.exit().remove()}))})})}var c=a.models.tooltip();c.duration(0).hideDelay(0)._isInteractiveLayer(!0).hidden(!1);var d=null,e=null,f={left:0,top:0},g=d3.scale.linear(),h=d3.dispatch("elementMousemove","elementMouseout","elementClick","elementDblclick"),i=!0,j=null,k="ActiveXObject"in window;return b.dispatch=h,b.tooltip=c,b.margin=function(a){return arguments.length?(f.top="undefined"!=typeof a.top?a.top:f.top,f.left="undefined"!=typeof a.left?a.left:f.left,b):f},b.width=function(a){return arguments.length?(d=a,b):d},b.height=function(a){return arguments.length?(e=a,b):e},b.xScale=function(a){return arguments.length?(g=a,b):g},b.showGuideLine=function(a){return arguments.length?(i=a,b):i},b.svgContainer=function(a){return arguments.length?(j=a,b):j},b},a.interactiveBisect=function(a,b,c){"use strict";if(!(a instanceof Array))return null;var d;d="function"!=typeof c?function(a){return a.x}:c;var e=function(a,b){return d(a)-b},f=d3.bisector(e).left,g=d3.max([0,f(a,b)-1]),h=d(a[g]);if("undefined"==typeof h&&(h=g),h===b)return g;var i=d3.min([g+1,a.length-1]),j=d(a[i]);return"undefined"==typeof j&&(j=i),Math.abs(j-b)>=Math.abs(h-b)?g:i},a.nearestValueIndex=function(a,b,c){"use strict";var d=1/0,e=null;return a.forEach(function(a,f){var g=Math.abs(b-a);null!=a&&d>=g&&c>g&&(d=g,e=f)}),e},function(){"use strict";a.models.tooltip=function(){function b(){if(k){var a=d3.select(k);"svg"!==a.node().tagName&&(a=a.select("svg"));var b=a.node()?a.attr("viewBox"):null;if(b){b=b.split(" ");var c=parseInt(a.style("width"),10)/b[2];p.left=p.left*c,p.top=p.top*c}}}function c(){if(!n){var a;a=k?k:document.body,n=d3.select(a).append("div").attr("class","nvtooltip "+(j?j:"xy-tooltip")).attr("id",v),n.style("top",0).style("left",0),n.style("opacity",0),n.selectAll("div, table, td, tr").classed(w,!0),n.classed(w,!0),o=n.node()}}function d(){if(r&&B(e)){b();var f=p.left,g=null!==i?i:p.top;return a.dom.write(function(){c();var b=A(e);b&&(o.innerHTML=b),k&&u?a.dom.read(function(){var a=k.getElementsByTagName("svg")[0],b={left:0,top:0};if(a){var c=a.getBoundingClientRect(),d=k.getBoundingClientRect(),e=c.top;if(0>e){var i=k.getBoundingClientRect();e=Math.abs(e)>i.height?0:e}b.top=Math.abs(e-d.top),b.left=Math.abs(c.left-d.left)}f+=k.offsetLeft+b.left-2*k.scrollLeft,g+=k.offsetTop+b.top-2*k.scrollTop,h&&h>0&&(g=Math.floor(g/h)*h),C([f,g])}):C([f,g])}),d}}var e=null,f="w",g=25,h=0,i=null,j=null,k=null,l=!0,m=400,n=null,o=null,p={left:null,top:null},q={left:0,top:0},r=!0,s=100,t=!0,u=!1,v="nvtooltip-"+Math.floor(1e5*Math.random()),w="nv-pointer-events-none",x=function(a,b){return a},y=function(a){return a},z=function(a,b){return a},A=function(a){if(null===a)return"";var b=d3.select(document.createElement("table"));if(t){var c=b.selectAll("thead").data([a]).enter().append("thead");c.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",!0).html(y(a.value))}var d=b.selectAll("tbody").data([a]).enter().append("tbody"),e=d.selectAll("tr").data(function(a){return a.series}).enter().append("tr").classed("highlight",function(a){return a.highlight});e.append("td").classed("legend-color-guide",!0).append("div").style("background-color",function(a){return a.color}),e.append("td").classed("key",!0).html(function(a,b){return z(a.key,b)}),e.append("td").classed("value",!0).html(function(a,b){return x(a.value,b)}),e.selectAll("td").each(function(a){if(a.highlight){var b=d3.scale.linear().domain([0,1]).range(["#fff",a.color]),c=.6;d3.select(this).style("border-bottom-color",b(c)).style("border-top-color",b(c))}});var f=b.node().outerHTML;return void 0!==a.footer&&(f+=""),f},B=function(a){if(a&&a.series){if(a.series instanceof Array)return!!a.series.length;if(a.series instanceof Object)return a.series=[a.series],!0}return!1},C=function(b){o&&a.dom.read(function(){var c,d,e=parseInt(o.offsetHeight,10),h=parseInt(o.offsetWidth,10),i=a.utils.windowSize().width,j=a.utils.windowSize().height,k=window.pageYOffset,p=window.pageXOffset;j=window.innerWidth>=document.body.scrollWidth?j:j-16,i=window.innerHeight>=document.body.scrollHeight?i:i-16;var r,t,u=function(a){var b=d;do isNaN(a.offsetTop)||(b+=a.offsetTop),a=a.offsetParent;while(a);return b},v=function(a){var b=c;do isNaN(a.offsetLeft)||(b+=a.offsetLeft),a=a.offsetParent;while(a);return b};switch(f){case"e":c=b[0]-h-g,d=b[1]-e/2,r=v(o),t=u(o),p>r&&(c=b[0]+g>p?b[0]+g:p-r+c),k>t&&(d=k-t+d),t+e>k+j&&(d=k+j-t+d-e);break;case"w":c=b[0]+g,d=b[1]-e/2,r=v(o),t=u(o),r+h>i&&(c=b[0]-h-g),k>t&&(d=k+5),t+e>k+j&&(d=k+j-t+d-e);break;case"n":c=b[0]-h/2-5,d=b[1]+g,r=v(o),t=u(o),p>r&&(c=p+5),r+h>i&&(c=c-h/2+5),t+e>k+j&&(d=k+j-t+d-e);break;case"s":c=b[0]-h/2,d=b[1]-e-g,r=v(o),t=u(o),p>r&&(c=p+5),r+h>i&&(c=c-h/2+5),k>t&&(d=k);break;case"none":c=b[0],d=b[1]-g,r=v(o),t=u(o)}c-=q.left,d-=q.top;var w=o.getBoundingClientRect(),k=window.pageYOffset||document.documentElement.scrollTop,p=window.pageXOffset||document.documentElement.scrollLeft,x="translate("+(w.left+p)+"px, "+(w.top+k)+"px)",y="translate("+c+"px, "+d+"px)",z=d3.interpolateString(x,y),A=n.style("opacity")<.1;l?n.transition().delay(m).duration(0).style("opacity",0):n.interrupt().transition().duration(A?0:s).styleTween("transform",function(a){return z},"important").style("-webkit-transform",y).style("opacity",1)})};return d.nvPointerEventsClass=w,d.options=a.utils.optionsFunc.bind(d),d._options=Object.create({},{duration:{get:function(){return s},set:function(a){s=a}},gravity:{get:function(){return f},set:function(a){f=a}},distance:{get:function(){return g},set:function(a){g=a}},snapDistance:{get:function(){return h},set:function(a){h=a}},classes:{get:function(){return j},set:function(a){j=a}},chartContainer:{get:function(){return k},set:function(a){k=a}},fixedTop:{get:function(){return i},set:function(a){i=a}},enabled:{get:function(){return r},set:function(a){r=a}},hideDelay:{get:function(){return m},set:function(a){m=a}},contentGenerator:{get:function(){return A},set:function(a){A=a}},valueFormatter:{get:function(){return x},set:function(a){x=a}},headerFormatter:{get:function(){return y},set:function(a){y=a}},keyFormatter:{get:function(){return z},set:function(a){z=a}},headerEnabled:{get:function(){return t},set:function(a){t=a}},_isInteractiveLayer:{get:function(){return u},set:function(a){u=!!a}},position:{get:function(){return p},set:function(a){p.left=void 0!==a.left?a.left:p.left,p.top=void 0!==a.top?a.top:p.top}},offset:{get:function(){return q},set:function(a){q.left=void 0!==a.left?a.left:q.left,q.top=void 0!==a.top?a.top:q.top}},hidden:{get:function(){return l},set:function(a){l!=a&&(l=!!a,d())}},data:{get:function(){return e},set:function(a){a.point&&(a.value=a.point.x,a.series=a.series||{},a.series.value=a.point.y,a.series.color=a.point.color||a.series.color),e=a}},tooltipElem:{get:function(){return o},set:function(a){}},id:{get:function(){return v},set:function(a){}}}),a.utils.initOptions(d),d}}(),a.utils.windowSize=function(){var a={width:640,height:480};return window.innerWidth&&window.innerHeight?(a.width=window.innerWidth,a.height=window.innerHeight,a):"CSS1Compat"==document.compatMode&&document.documentElement&&document.documentElement.offsetWidth?(a.width=document.documentElement.offsetWidth,a.height=document.documentElement.offsetHeight,a):document.body&&document.body.offsetWidth?(a.width=document.body.offsetWidth,a.height=document.body.offsetHeight,a):a},a.utils.windowResize=function(b){return window.addEventListener?window.addEventListener("resize",b):a.log("ERROR: Failed to bind to window.resize with: ",b),{callback:b,clear:function(){window.removeEventListener("resize",b)}}},a.utils.getColor=function(b){if(void 0===b)return a.utils.defaultColor();if(Array.isArray(b)){var c=d3.scale.ordinal().range(b);return function(a,b){var d=void 0===b?a:b;return a.color||c(d)}}return b},a.utils.defaultColor=function(){return a.utils.getColor(d3.scale.category20().range())},a.utils.customTheme=function(a,b,c){b=b||function(a){return a.key},c=c||d3.scale.category20().range();var d=c.length;return function(e,f){var g=b(e);return"function"==typeof a[g]?a[g]():void 0!==a[g]?a[g]:(d||(d=c.length),d-=1,c[d])}},a.utils.pjax=function(b,c){var d=function(d){d3.html(d,function(d){var e=d3.select(c).node();e.parentNode.replaceChild(d3.select(d).select(c).node(),e),a.utils.pjax(b,c)})};d3.selectAll(b).on("click",function(){history.pushState(this.href,this.textContent,this.href),d(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&d(d3.event.state)})},a.utils.calcApproxTextWidth=function(a){if("function"==typeof a.style&&"function"==typeof a.text){var b=parseInt(a.style("font-size").replace("px",""),10),c=a.text().length;return c*b*.5}return 0},a.utils.NaNtoZero=function(a){return"number"!=typeof a||isNaN(a)||null===a||a===1/0||a===-(1/0)?0:a},d3.selection.prototype.watchTransition=function(a){var b=[this].concat([].slice.call(arguments,1));return a.transition.apply(a,b)},a.utils.renderWatch=function(b,c){if(!(this instanceof a.utils.renderWatch))return new a.utils.renderWatch(b,c);var d=void 0!==c?c:250,e=[],f=this;this.models=function(a){return a=[].slice.call(arguments,0),a.forEach(function(a){a.__rendered=!1,function(a){a.dispatch.on("renderEnd",function(b){a.__rendered=!0,f.renderEnd("model")})}(a),e.indexOf(a)<0&&e.push(a)}),this},this.reset=function(a){void 0!==a&&(d=a),e=[]},this.transition=function(a,b,c){if(b=arguments.length>1?[].slice.call(arguments,1):[],c=b.length>1?b.pop():void 0!==d?d:250,a.__rendered=!1,e.indexOf(a)<0&&e.push(a),0===c)return a.__rendered=!0,a.delay=function(){return this},a.duration=function(){return this},a;0===a.length?a.__rendered=!0:a.every(function(a){return!a.length})?a.__rendered=!0:a.__rendered=!1;var g=0;return a.transition().duration(c).each(function(){++g}).each("end",function(c,d){0===--g&&(a.__rendered=!0,f.renderEnd.apply(this,b))})},this.renderEnd=function(){e.every(function(a){return a.__rendered})&&(e.forEach(function(a){a.__rendered=!1}),b.renderEnd.apply(this,arguments))}},a.utils.deepExtend=function(b){var c=arguments.length>1?[].slice.call(arguments,1):[];c.forEach(function(c){for(var d in c){var e=b[d]instanceof Array,f="object"==typeof b[d],g="object"==typeof c[d];f&&!e&&g?a.utils.deepExtend(b[d],c[d]):b[d]=c[d]}})},a.utils.state=function(){if(!(this instanceof a.utils.state))return new a.utils.state;var b={},c=function(){},d=function(){return{}},e=null,f=null;this.dispatch=d3.dispatch("change","set"),this.dispatch.on("set",function(a){c(a,!0)}),this.getter=function(a){return d=a,this},this.setter=function(a,b){return b||(b=function(){}),c=function(c,d){a(c),d&&b()},this},this.init=function(b){e=e||{},a.utils.deepExtend(e,b)};var g=function(){var a=d();if(JSON.stringify(a)===JSON.stringify(b))return!1;for(var c in a)void 0===b[c]&&(b[c]={}),b[c]=a[c],f=!0;return!0};this.update=function(){e&&(c(e,!1),e=null),g.call(this)&&this.dispatch.change(b)}},a.utils.optionsFunc=function(a){return a&&d3.map(a).forEach(function(a,b){"function"==typeof this[a]&&this[a](b)}.bind(this)),this},a.utils.calcTicksX=function(b,c){var d=1,e=0;for(e;ed?f:d}return a.log("Requested number of ticks: ",b),a.log("Calculated max values to be: ",d),b=b>d?b=d-1:b,b=1>b?1:b,b=Math.floor(b),a.log("Calculating tick count as: ",b),b},a.utils.calcTicksY=function(b,c){return a.utils.calcTicksX(b,c)},a.utils.initOption=function(a,b){a._calls&&a._calls[b]?a[b]=a._calls[b]:(a[b]=function(c){return arguments.length?(a._overrides[b]=!0,a._options[b]=c,a):a._options[b]},a["_"+b]=function(c){return arguments.length?(a._overrides[b]||(a._options[b]=c),a):a._options[b]})},a.utils.initOptions=function(b){b._overrides=b._overrides||{};var c=Object.getOwnPropertyNames(b._options||{}),d=Object.getOwnPropertyNames(b._calls||{});c=c.concat(d);for(var e in c)a.utils.initOption(b,c[e])},a.utils.inheritOptionsD3=function(a,b,c){a._d3options=c.concat(a._d3options||[]),c.unshift(b),c.unshift(a),d3.rebind.apply(this,c)},a.utils.arrayUnique=function(a){return a.sort().filter(function(b,c){return!c||b!=a[c-1]})},a.utils.symbolMap=d3.map(),a.utils.symbol=function(){function b(b,e){var f=c.call(this,b,e),g=d.call(this,b,e);return-1!==d3.svg.symbolTypes.indexOf(f)?d3.svg.symbol().type(f).size(g)():a.utils.symbolMap.get(f)(g)}var c,d=64;return b.type=function(a){return arguments.length?(c=d3.functor(a),b):c},b.size=function(a){return arguments.length?(d=d3.functor(a),b):d},b},a.utils.inheritOptions=function(b,c){var d=Object.getOwnPropertyNames(c._options||{}),e=Object.getOwnPropertyNames(c._calls||{}),f=c._inherited||[],g=c._d3options||[],h=d.concat(e).concat(f).concat(g);h.unshift(c),h.unshift(b),d3.rebind.apply(this,h),b._inherited=a.utils.arrayUnique(d.concat(e).concat(f).concat(d).concat(b._inherited||[])),b._d3options=a.utils.arrayUnique(g.concat(b._d3options||[]))},a.utils.initSVG=function(a){a.classed({"nvd3-svg":!0})},a.utils.sanitizeHeight=function(a,b){return a||parseInt(b.style("height"),10)||400},a.utils.sanitizeWidth=function(a,b){return a||parseInt(b.style("width"),10)||960},a.utils.availableHeight=function(b,c,d){return a.utils.sanitizeHeight(b,c)-d.top-d.bottom},a.utils.availableWidth=function(b,c,d){return a.utils.sanitizeWidth(b,c)-d.left-d.right},a.utils.noData=function(b,c){var d=b.options(),e=d.margin(),f=d.noData(),g=null==f?["No Data Available."]:[f],h=a.utils.availableHeight(d.height(),c,e),i=a.utils.availableWidth(d.width(),c,e),j=e.left+i/2,k=e.top+h/2;c.selectAll("g").remove();var l=c.selectAll(".nv-noData").data(g);l.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),l.attr("x",j).attr("y",k).text(function(a){return a})},a.models.axis=function(){"use strict";function b(g){return s.reset(),g.each(function(b){var g=d3.select(this);a.utils.initSVG(g);var p=g.selectAll("g.nv-wrap.nv-axis").data([b]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),t=(q.append("g"),p.select("g"));null!==n?c.ticks(n):("top"==c.orient()||"bottom"==c.orient())&&c.ticks(Math.abs(d.range()[1]-d.range()[0])/100),t.watchTransition(s,"axis").call(c),r=r||c.scale();var u=c.tickFormat();null==u&&(u=r.tickFormat());var v=t.selectAll("text.nv-axislabel").data([h||null]);v.exit().remove();var w,x,y;switch(c.orient()){case"top":v.enter().append("text").attr("class","nv-axislabel"),y=d.range().length<2?0:2===d.range().length?d.range()[1]:d.range()[d.range().length-1]+(d.range()[1]-d.range()[0]),v.attr("text-anchor","middle").attr("y",0).attr("x",y/2),i&&(x=p.selectAll("g.nv-axisMaxMin").data(d.domain()),x.enter().append("g").attr("class",function(a,b){return["nv-axisMaxMin","nv-axisMaxMin-x",0==b?"nv-axisMin-x":"nv-axisMax-x"].join(" ")}).append("text"),x.exit().remove(),x.attr("transform",function(b,c){return"translate("+a.utils.NaNtoZero(d(b))+",0)"}).select("text").attr("dy","-0.5em").attr("y",-c.tickPadding()).attr("text-anchor","middle").text(function(a,b){var c=u(a);return(""+c).match("NaN")?"":c}),x.watchTransition(s,"min-max top").attr("transform",function(b,c){return"translate("+a.utils.NaNtoZero(d.range()[c])+",0)"}));break;case"bottom":w=o+36;var z=30,A=0,B=t.selectAll("g").select("text"),C="";if(j%360){B.each(function(a,b){var c=this.getBoundingClientRect(),d=c.width;A=c.height,d>z&&(z=d)}),C="rotate("+j+" 0,"+(A/2+c.tickPadding())+")";var D=Math.abs(Math.sin(j*Math.PI/180));w=(D?D*z:z)+30,B.attr("transform",C).style("text-anchor",j%360>0?"start":"end")}v.enter().append("text").attr("class","nv-axislabel"),y=d.range().length<2?0:2===d.range().length?d.range()[1]:d.range()[d.range().length-1]+(d.range()[1]-d.range()[0]),v.attr("text-anchor","middle").attr("y",w).attr("x",y/2),i&&(x=p.selectAll("g.nv-axisMaxMin").data([d.domain()[0],d.domain()[d.domain().length-1]]),x.enter().append("g").attr("class",function(a,b){return["nv-axisMaxMin","nv-axisMaxMin-x",0==b?"nv-axisMin-x":"nv-axisMax-x"].join(" ")}).append("text"),x.exit().remove(),x.attr("transform",function(b,c){return"translate("+a.utils.NaNtoZero(d(b)+(m?d.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",c.tickPadding()).attr("transform",C).style("text-anchor",j?j%360>0?"start":"end":"middle").text(function(a,b){var c=u(a);return(""+c).match("NaN")?"":c}),x.watchTransition(s,"min-max bottom").attr("transform",function(b,c){return"translate("+a.utils.NaNtoZero(d(b)+(m?d.rangeBand()/2:0))+",0)"})),l&&B.attr("transform",function(a,b){return"translate(0,"+(b%2==0?"0":"12")+")"});break;case"right":v.enter().append("text").attr("class","nv-axislabel"),v.style("text-anchor",k?"middle":"begin").attr("transform",k?"rotate(90)":"").attr("y",k?-Math.max(e.right,f)+12:-10).attr("x",k?d3.max(d.range())/2:c.tickPadding()),i&&(x=p.selectAll("g.nv-axisMaxMin").data(d.domain()),x.enter().append("g").attr("class",function(a,b){return["nv-axisMaxMin","nv-axisMaxMin-y",0==b?"nv-axisMin-y":"nv-axisMax-y"].join(" ")}).append("text").style("opacity",0),x.exit().remove(),x.attr("transform",function(b,c){return"translate(0,"+a.utils.NaNtoZero(d(b))+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",c.tickPadding()).style("text-anchor","start").text(function(a,b){var c=u(a);return(""+c).match("NaN")?"":c}),x.watchTransition(s,"min-max right").attr("transform",function(b,c){return"translate(0,"+a.utils.NaNtoZero(d.range()[c])+")"}).select("text").style("opacity",1));break;case"left":v.enter().append("text").attr("class","nv-axislabel"),v.style("text-anchor",k?"middle":"end").attr("transform",k?"rotate(-90)":"").attr("y",k?-Math.max(e.left,f)+25-(o||0):-10).attr("x",k?-d3.max(d.range())/2:-c.tickPadding()),i&&(x=p.selectAll("g.nv-axisMaxMin").data(d.domain()),x.enter().append("g").attr("class",function(a,b){return["nv-axisMaxMin","nv-axisMaxMin-y",0==b?"nv-axisMin-y":"nv-axisMax-y"].join(" ")}).append("text").style("opacity",0),x.exit().remove(),x.attr("transform",function(b,c){return"translate(0,"+a.utils.NaNtoZero(r(b))+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-c.tickPadding()).attr("text-anchor","end").text(function(a,b){var c=u(a);return(""+c).match("NaN")?"":c}),x.watchTransition(s,"min-max right").attr("transform",function(b,c){return"translate(0,"+a.utils.NaNtoZero(d.range()[c])+")"}).select("text").style("opacity",1))}if(v.text(function(a){return a}),!i||"left"!==c.orient()&&"right"!==c.orient()||(t.selectAll("g").each(function(a,b){d3.select(this).select("text").attr("opacity",1),(d(a)d.range()[0]-10)&&((a>1e-10||-1e-10>a)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0))}),d.domain()[0]==d.domain()[1]&&0==d.domain()[0]&&p.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1})),i&&("top"===c.orient()||"bottom"===c.orient())){var E=[];p.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?E.push(d(a)-this.getBoundingClientRect().width-4):E.push(d(a)+this.getBoundingClientRect().width+4)}catch(c){b?E.push(d(a)-4):E.push(d(a)+4)}}),t.selectAll("g").each(function(a,b){(d(a)E[1])&&(a>1e-10||-1e-10>a?d3.select(this).remove():d3.select(this).select("text").remove())})}t.selectAll(".tick").filter(function(a){return!parseFloat(Math.round(1e5*a)/1e6)&&void 0!==a}).classed("zero",!0),r=d.copy()}),s.renderEnd("axis immediate"),b}var c=d3.svg.axis(),d=d3.scale.linear(),e={top:0,right:0,bottom:0,left:0},f=75,g=60,h=null,i=!0,j=0,k=!0,l=!1,m=!1,n=null,o=0,p=250,q=d3.dispatch("renderEnd");c.scale(d).orient("bottom").tickFormat(function(a){return a});var r,s=a.utils.renderWatch(q,p);return b.axis=c,b.dispatch=q,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{axisLabelDistance:{get:function(){return o},set:function(a){o=a}},staggerLabels:{get:function(){return l},set:function(a){l=a}},rotateLabels:{get:function(){return j},set:function(a){j=a}},rotateYLabel:{get:function(){return k},set:function(a){k=a}},showMaxMin:{get:function(){return i},set:function(a){i=a}},axisLabel:{get:function(){return h},set:function(a){h=a}},height:{get:function(){return g},set:function(a){g=a}},ticks:{get:function(){return n},set:function(a){n=a}},width:{get:function(){return f},set:function(a){f=a}},margin:{get:function(){return e},set:function(a){e.top=void 0!==a.top?a.top:e.top,e.right=void 0!==a.right?a.right:e.right,e.bottom=void 0!==a.bottom?a.bottom:e.bottom,e.left=void 0!==a.left?a.left:e.left}},duration:{get:function(){return p},set:function(a){p=a,s.reset(p)}},scale:{get:function(){return d},set:function(e){d=e,c.scale(d),m="function"==typeof d.rangeBands,a.utils.inheritOptionsD3(b,d,["domain","range","rangeBand","rangeBands"])}}}),a.utils.initOptions(b),a.utils.inheritOptionsD3(b,c,["orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"]),a.utils.inheritOptionsD3(b,d,["domain","range","rangeBand","rangeBands"]),b},a.models.boxPlot=function(){"use strict";function b(l){return v.reset(),l.each(function(b){var l=j-i.left-i.right,p=k-i.top-i.bottom;r=d3.select(this),a.utils.initSVG(r),m.domain(c||b.map(function(a,b){return o(a,b)})).rangeBands(e||[0,l],.1);var w=[];if(!d){var x=d3.min(b.map(function(a){var b=[];return b.push(a.values.Q1),a.values.hasOwnProperty("whisker_low")&&null!==a.values.whisker_low&&b.push(a.values.whisker_low),a.values.hasOwnProperty("outliers")&&null!==a.values.outliers&&(b=b.concat(a.values.outliers)),d3.min(b)})),y=d3.max(b.map(function(a){var b=[];return b.push(a.values.Q3),a.values.hasOwnProperty("whisker_high")&&null!==a.values.whisker_high&&b.push(a.values.whisker_high),a.values.hasOwnProperty("outliers")&&null!==a.values.outliers&&(b=b.concat(a.values.outliers)),d3.max(b)}));w=[x,y]}n.domain(d||w),n.range(f||[p,0]),g=g||m,h=h||n.copy().range([n(0),n(0)]);var z=r.selectAll("g.nv-wrap").data([b]);z.enter().append("g").attr("class","nvd3 nv-wrap");z.attr("transform","translate("+i.left+","+i.top+")");var A=z.selectAll(".nv-boxplot").data(function(a){return a}),B=A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);A.attr("class","nv-boxplot").attr("transform",function(a,b,c){return"translate("+(m(o(a,b))+.05*m.rangeBand())+", 0)"}).classed("hover",function(a){return a.hover}),A.watchTransition(v,"nv-boxplot: boxplots").style("stroke-opacity",1).style("fill-opacity",.75).delay(function(a,c){return c*t/b.length}).attr("transform",function(a,b){return"translate("+(m(o(a,b))+.05*m.rangeBand())+", 0)"}),A.exit().remove(),B.each(function(a,b){var c=d3.select(this);["low","high"].forEach(function(d){a.values.hasOwnProperty("whisker_"+d)&&null!==a.values["whisker_"+d]&&(c.append("line").style("stroke",a.color?a.color:q(a,b)).attr("class","nv-boxplot-whisker nv-boxplot-"+d),c.append("line").style("stroke",a.color?a.color:q(a,b)).attr("class","nv-boxplot-tick nv-boxplot-"+d))})});var C=A.selectAll(".nv-boxplot-outlier").data(function(a){return a.values.hasOwnProperty("outliers")&&null!==a.values.outliers?a.values.outliers:[]});C.enter().append("circle").style("fill",function(a,b,c){return q(a,c)}).style("stroke",function(a,b,c){return q(a,c)}).on("mouseover",function(a,b,c){d3.select(this).classed("hover",!0),s.elementMouseover({series:{key:a,color:q(a,c)},e:d3.event})}).on("mouseout",function(a,b,c){d3.select(this).classed("hover",!1),s.elementMouseout({series:{key:a,color:q(a,c)},e:d3.event})}).on("mousemove",function(a,b){s.elementMousemove({e:d3.event})}),C.attr("class","nv-boxplot-outlier"),C.watchTransition(v,"nv-boxplot: nv-boxplot-outlier").attr("cx",.45*m.rangeBand()).attr("cy",function(a,b,c){return n(a)}).attr("r","3"),C.exit().remove();var D=function(){return null===u?.9*m.rangeBand():Math.min(75,.9*m.rangeBand())},E=function(){return.45*m.rangeBand()-D()/2},F=function(){return.45*m.rangeBand()+D()/2};["low","high"].forEach(function(a){var b="low"===a?"Q1":"Q3";A.select("line.nv-boxplot-whisker.nv-boxplot-"+a).watchTransition(v,"nv-boxplot: boxplots").attr("x1",.45*m.rangeBand()).attr("y1",function(b,c){return n(b.values["whisker_"+a])}).attr("x2",.45*m.rangeBand()).attr("y2",function(a,c){return n(a.values[b])}),A.select("line.nv-boxplot-tick.nv-boxplot-"+a).watchTransition(v,"nv-boxplot: boxplots").attr("x1",E).attr("y1",function(b,c){return n(b.values["whisker_"+a])}).attr("x2",F).attr("y2",function(b,c){return n(b.values["whisker_"+a])})}),["low","high"].forEach(function(a){B.selectAll(".nv-boxplot-"+a).on("mouseover",function(b,c,d){d3.select(this).classed("hover",!0),s.elementMouseover({series:{key:b.values["whisker_"+a],color:q(b,d)},e:d3.event})}).on("mouseout",function(b,c,d){d3.select(this).classed("hover",!1),s.elementMouseout({series:{key:b.values["whisker_"+a],color:q(b,d)},e:d3.event})}).on("mousemove",function(a,b){s.elementMousemove({e:d3.event})})}),B.append("rect").attr("class","nv-boxplot-box").on("mouseover",function(a,b){d3.select(this).classed("hover",!0),s.elementMouseover({key:a.label,value:a.label,series:[{key:"Q3",value:a.values.Q3,color:a.color||q(a,b)},{key:"Q2",value:a.values.Q2,color:a.color||q(a,b)},{key:"Q1",value:a.values.Q1,color:a.color||q(a,b)}],data:a,index:b,e:d3.event})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),s.elementMouseout({key:a.label,value:a.label,series:[{key:"Q3",value:a.values.Q3,color:a.color||q(a,b)},{key:"Q2",value:a.values.Q2,color:a.color||q(a,b)},{key:"Q1",value:a.values.Q1,color:a.color||q(a,b)}],data:a,index:b,e:d3.event})}).on("mousemove",function(a,b){s.elementMousemove({e:d3.event})}),A.select("rect.nv-boxplot-box").watchTransition(v,"nv-boxplot: boxes").attr("y",function(a,b){return n(a.values.Q3)}).attr("width",D).attr("x",E).attr("height",function(a,b){return Math.abs(n(a.values.Q3)-n(a.values.Q1))||1}).style("fill",function(a,b){return a.color||q(a,b)}).style("stroke",function(a,b){return a.color||q(a,b)}),B.append("line").attr("class","nv-boxplot-median"),A.select("line.nv-boxplot-median").watchTransition(v,"nv-boxplot: boxplots line").attr("x1",E).attr("y1",function(a,b){return n(a.values.Q2)}).attr("x2",F).attr("y2",function(a,b){return n(a.values.Q2)}),g=m.copy(),h=n.copy()}),v.renderEnd("nv-boxplot immediate"),b}var c,d,e,f,g,h,i={top:0,right:0,bottom:0,left:0},j=960,k=500,l=Math.floor(1e4*Math.random()),m=d3.scale.ordinal(),n=d3.scale.linear(),o=function(a){return a.x},p=function(a){return a.y},q=a.utils.defaultColor(),r=null,s=d3.dispatch("elementMouseover","elementMouseout","elementMousemove","renderEnd"),t=250,u=null,v=a.utils.renderWatch(s,t);return b.dispatch=s,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return j},set:function(a){j=a}},height:{get:function(){return k},set:function(a){k=a}},maxBoxWidth:{get:function(){return u},set:function(a){u=a}},x:{get:function(){return o},set:function(a){o=a}},y:{get:function(){return p},set:function(a){p=a}},xScale:{get:function(){return m},set:function(a){m=a}},yScale:{get:function(){return n},set:function(a){n=a}},xDomain:{get:function(){return c},set:function(a){c=a}},yDomain:{get:function(){return d},set:function(a){d=a}},xRange:{get:function(){return e},set:function(a){e=a}},yRange:{get:function(){return f},set:function(a){f=a}},id:{get:function(){return l},set:function(a){l=a}},margin:{get:function(){return i},set:function(a){i.top=void 0!==a.top?a.top:i.top,i.right=void 0!==a.right?a.right:i.right,i.bottom=void 0!==a.bottom?a.bottom:i.bottom,i.left=void 0!==a.left?a.left:i.left}},color:{get:function(){return q},set:function(b){q=a.utils.getColor(b)}},duration:{get:function(){return t},set:function(a){t=a,v.reset(t)}}}),a.utils.initOptions(b),b},a.models.boxPlotChart=function(){"use strict";function b(k){return t.reset(),t.models(e),l&&t.models(f),m&&t.models(g),k.each(function(k){var p=d3.select(this);a.utils.initSVG(p);var t=(i||parseInt(p.style("width"))||960)-h.left-h.right,u=(j||parseInt(p.style("height"))||400)-h.top-h.bottom;if(b.update=function(){r.beforeUpdate(),p.transition().duration(s).call(b)},b.container=this,!(k&&k.length&&k.filter(function(a){return a.values.hasOwnProperty("Q1")&&a.values.hasOwnProperty("Q2")&&a.values.hasOwnProperty("Q3")}).length)){var v=p.selectAll(".nv-noData").data([q]);return v.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),v.attr("x",h.left+t/2).attr("y",h.top+u/2).text(function(a){return a}),b}p.selectAll(".nv-noData").remove(), -c=e.xScale(),d=e.yScale().clamp(!0);var w=p.selectAll("g.nv-wrap.nv-boxPlotWithAxes").data([k]),x=w.enter().append("g").attr("class","nvd3 nv-wrap nv-boxPlotWithAxes").append("g"),y=x.append("defs"),z=w.select("g");x.append("g").attr("class","nv-x nv-axis"),x.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),x.append("g").attr("class","nv-barsWrap"),z.attr("transform","translate("+h.left+","+h.top+")"),n&&z.select(".nv-y.nv-axis").attr("transform","translate("+t+",0)"),e.width(t).height(u);var A=z.select(".nv-barsWrap").datum(k.filter(function(a){return!a.disabled}));if(A.transition().call(e),y.append("clipPath").attr("id","nv-x-label-clip-"+e.id()).append("rect"),z.select("#nv-x-label-clip-"+e.id()+" rect").attr("width",c.rangeBand()*(o?2:1)).attr("height",16).attr("x",-c.rangeBand()/(o?1:2)),l){f.scale(c).ticks(a.utils.calcTicksX(t/100,k)).tickSize(-u,0),z.select(".nv-x.nv-axis").attr("transform","translate(0,"+d.range()[0]+")"),z.select(".nv-x.nv-axis").call(f);var B=z.select(".nv-x.nv-axis").selectAll("g");o&&B.selectAll("text").attr("transform",function(a,b,c){return"translate(0,"+(c%2==0?"5":"17")+")"})}m&&(g.scale(d).ticks(Math.floor(u/36)).tickSize(-t,0),z.select(".nv-y.nv-axis").call(g)),z.select(".nv-zeroLine line").attr("x1",0).attr("x2",t).attr("y1",d(0)).attr("y2",d(0))}),t.renderEnd("nv-boxplot chart immediate"),b}var c,d,e=a.models.boxPlot(),f=a.models.axis(),g=a.models.axis(),h={top:15,right:10,bottom:50,left:60},i=null,j=null,k=a.utils.getColor(),l=!0,m=!0,n=!1,o=!1,p=a.models.tooltip(),q="No Data Available.",r=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate","renderEnd"),s=250;f.orient("bottom").showMaxMin(!1).tickFormat(function(a){return a}),g.orient(n?"right":"left").tickFormat(d3.format(",.1f")),p.duration(0);var t=a.utils.renderWatch(r,s);return e.dispatch.on("elementMouseover.tooltip",function(a){p.data(a).hidden(!1)}),e.dispatch.on("elementMouseout.tooltip",function(a){p.data(a).hidden(!0)}),e.dispatch.on("elementMousemove.tooltip",function(a){p.position({top:d3.event.pageY,left:d3.event.pageX})()}),b.dispatch=r,b.boxplot=e,b.xAxis=f,b.yAxis=g,b.tooltip=p,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return i},set:function(a){i=a}},height:{get:function(){return j},set:function(a){j=a}},staggerLabels:{get:function(){return o},set:function(a){o=a}},showXAxis:{get:function(){return l},set:function(a){l=a}},showYAxis:{get:function(){return m},set:function(a){m=a}},tooltips:{get:function(){return tooltips},set:function(a){tooltips=a}},tooltipContent:{get:function(){return p},set:function(a){p=a}},noData:{get:function(){return q},set:function(a){q=a}},margin:{get:function(){return h},set:function(a){h.top=void 0!==a.top?a.top:h.top,h.right=void 0!==a.right?a.right:h.right,h.bottom=void 0!==a.bottom?a.bottom:h.bottom,h.left=void 0!==a.left?a.left:h.left}},duration:{get:function(){return s},set:function(a){s=a,t.reset(s),e.duration(s),f.duration(s),g.duration(s)}},color:{get:function(){return k},set:function(b){k=a.utils.getColor(b),e.color(k)}},rightAlignYAxis:{get:function(){return n},set:function(a){n=a,g.orient(a?"right":"left")}}}),a.utils.inheritOptions(b,e),a.utils.initOptions(b),b},a.models.bullet=function(){"use strict";function b(d){return d.each(function(b,d){var p=m-c.left-c.right,s=n-c.top-c.bottom;o=d3.select(this),a.utils.initSVG(o);var t=f.call(this,b,d).slice().sort(d3.descending),u=g.call(this,b,d).slice().sort(d3.descending),v=h.call(this,b,d).slice().sort(d3.descending),w=i.call(this,b,d).slice(),x=j.call(this,b,d).slice(),y=k.call(this,b,d).slice(),z=d3.scale.linear().domain(d3.extent(d3.merge([l,t]))).range(e?[p,0]:[0,p]);this.__chart__||d3.scale.linear().domain([0,1/0]).range(z.range());this.__chart__=z;var A=d3.min(t),B=d3.max(t),C=t[1],D=o.selectAll("g.nv-wrap.nv-bullet").data([b]),E=D.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),F=E.append("g"),G=D.select("g");F.append("rect").attr("class","nv-range nv-rangeMax"),F.append("rect").attr("class","nv-range nv-rangeAvg"),F.append("rect").attr("class","nv-range nv-rangeMin"),F.append("rect").attr("class","nv-measure"),D.attr("transform","translate("+c.left+","+c.top+")");var H=function(a){return Math.abs(z(a)-z(0))},I=function(a){return z(0>a?a:0)};G.select("rect.nv-rangeMax").attr("height",s).attr("width",H(B>0?B:A)).attr("x",I(B>0?B:A)).datum(B>0?B:A),G.select("rect.nv-rangeAvg").attr("height",s).attr("width",H(C)).attr("x",I(C)).datum(C),G.select("rect.nv-rangeMin").attr("height",s).attr("width",H(B)).attr("x",I(B)).attr("width",H(B>0?A:B)).attr("x",I(B>0?A:B)).datum(B>0?A:B),G.select("rect.nv-measure").style("fill",q).attr("height",s/3).attr("y",s/3).attr("width",0>v?z(0)-z(v[0]):z(v[0])-z(0)).attr("x",I(v)).on("mouseover",function(){r.elementMouseover({value:v[0],label:y[0]||"Current",color:d3.select(this).style("fill")})}).on("mousemove",function(){r.elementMousemove({value:v[0],label:y[0]||"Current",color:d3.select(this).style("fill")})}).on("mouseout",function(){r.elementMouseout({value:v[0],label:y[0]||"Current",color:d3.select(this).style("fill")})});var J=s/6,K=u.map(function(a,b){return{value:a,label:x[b]}});F.selectAll("path.nv-markerTriangle").data(K).enter().append("path").attr("class","nv-markerTriangle").attr("transform",function(a){return"translate("+z(a.value)+","+s/2+")"}).attr("d","M0,"+J+"L"+J+","+-J+" "+-J+","+-J+"Z").on("mouseover",function(a){r.elementMouseover({value:a.value,label:a.label||"Previous",color:d3.select(this).style("fill"),pos:[z(a.value),s/2]})}).on("mousemove",function(a){r.elementMousemove({value:a.value,label:a.label||"Previous",color:d3.select(this).style("fill")})}).on("mouseout",function(a,b){r.elementMouseout({value:a.value,label:a.label||"Previous",color:d3.select(this).style("fill")})}),D.selectAll(".nv-range").on("mouseover",function(a,b){var c=w[b]||(b?1==b?"Mean":"Minimum":"Maximum");r.elementMouseover({value:a,label:c,color:d3.select(this).style("fill")})}).on("mousemove",function(){r.elementMousemove({value:v[0],label:y[0]||"Previous",color:d3.select(this).style("fill")})}).on("mouseout",function(a,b){var c=w[b]||(b?1==b?"Mean":"Minimum":"Maximum");r.elementMouseout({value:a,label:c,color:d3.select(this).style("fill")})})}),b}var c={top:0,right:0,bottom:0,left:0},d="left",e=!1,f=function(a){return a.ranges},g=function(a){return a.markers?a.markers:[0]},h=function(a){return a.measures},i=function(a){return a.rangeLabels?a.rangeLabels:[]},j=function(a){return a.markerLabels?a.markerLabels:[]},k=function(a){return a.measureLabels?a.measureLabels:[]},l=[0],m=380,n=30,o=null,p=null,q=a.utils.getColor(["#1f77b4"]),r=d3.dispatch("elementMouseover","elementMouseout","elementMousemove");return b.dispatch=r,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{ranges:{get:function(){return f},set:function(a){f=a}},markers:{get:function(){return g},set:function(a){g=a}},measures:{get:function(){return h},set:function(a){h=a}},forceX:{get:function(){return l},set:function(a){l=a}},width:{get:function(){return m},set:function(a){m=a}},height:{get:function(){return n},set:function(a){n=a}},tickFormat:{get:function(){return p},set:function(a){p=a}},margin:{get:function(){return c},set:function(a){c.top=void 0!==a.top?a.top:c.top,c.right=void 0!==a.right?a.right:c.right,c.bottom=void 0!==a.bottom?a.bottom:c.bottom,c.left=void 0!==a.left?a.left:c.left}},orient:{get:function(){return d},set:function(a){d=a,e="right"==d||"bottom"==d}},color:{get:function(){return q},set:function(b){q=a.utils.getColor(b)}}}),a.utils.initOptions(b),b},a.models.bulletChart=function(){"use strict";function b(d){return d.each(function(e,o){var p=d3.select(this);a.utils.initSVG(p);var q=a.utils.availableWidth(k,p,g),r=l-g.top-g.bottom;if(b.update=function(){b(d)},b.container=this,!e||!h.call(this,e,o))return a.utils.noData(b,p),b;p.selectAll(".nv-noData").remove();var s=h.call(this,e,o).slice().sort(d3.descending),t=i.call(this,e,o).slice().sort(d3.descending),u=j.call(this,e,o).slice().sort(d3.descending),v=p.selectAll("g.nv-wrap.nv-bulletChart").data([e]),w=v.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),x=w.append("g"),y=v.select("g");x.append("g").attr("class","nv-bulletWrap"),x.append("g").attr("class","nv-titles"),v.attr("transform","translate("+g.left+","+g.top+")");var z=d3.scale.linear().domain([0,Math.max(s[0],t[0],u[0])]).range(f?[q,0]:[0,q]),A=this.__chart__||d3.scale.linear().domain([0,1/0]).range(z.range());this.__chart__=z;var B=x.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(l-g.top-g.bottom)/2+")");B.append("text").attr("class","nv-title").text(function(a){return a.title}),B.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(a){return a.subtitle}),c.width(q).height(r);var C=y.select(".nv-bulletWrap");d3.transition(C).call(c);var D=m||z.tickFormat(q/100),E=y.selectAll("g.nv-tick").data(z.ticks(n?n:q/50),function(a){return this.textContent||D(a)}),F=E.enter().append("g").attr("class","nv-tick").attr("transform",function(a){return"translate("+A(a)+",0)"}).style("opacity",1e-6);F.append("line").attr("y1",r).attr("y2",7*r/6),F.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",7*r/6).text(D);var G=d3.transition(E).attr("transform",function(a){return"translate("+z(a)+",0)"}).style("opacity",1);G.select("line").attr("y1",r).attr("y2",7*r/6),G.select("text").attr("y",7*r/6),d3.transition(E.exit()).attr("transform",function(a){return"translate("+z(a)+",0)"}).style("opacity",1e-6).remove()}),d3.timer.flush(),b}var c=a.models.bullet(),d=a.models.tooltip(),e="left",f=!1,g={top:5,right:40,bottom:20,left:120},h=function(a){return a.ranges},i=function(a){return a.markers?a.markers:[0]},j=function(a){return a.measures},k=null,l=55,m=null,n=null,o=null,p=d3.dispatch("tooltipShow","tooltipHide");return d.duration(0).headerEnabled(!1),c.dispatch.on("elementMouseover.tooltip",function(a){a.series={key:a.label,value:a.value,color:a.color},d.data(a).hidden(!1)}),c.dispatch.on("elementMouseout.tooltip",function(a){d.hidden(!0)}),c.dispatch.on("elementMousemove.tooltip",function(a){d.position({top:d3.event.pageY,left:d3.event.pageX})()}),b.bullet=c,b.dispatch=p,b.tooltip=d,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{ranges:{get:function(){return h},set:function(a){h=a}},markers:{get:function(){return i},set:function(a){i=a}},measures:{get:function(){return j},set:function(a){j=a}},width:{get:function(){return k},set:function(a){k=a}},height:{get:function(){return l},set:function(a){l=a}},tickFormat:{get:function(){return m},set:function(a){m=a}},ticks:{get:function(){return n},set:function(a){n=a}},noData:{get:function(){return o},set:function(a){o=a}},tooltips:{get:function(){return d.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),d.enabled(!!b)}},tooltipContent:{get:function(){return d.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),d.contentGenerator(b)}},margin:{get:function(){return g},set:function(a){g.top=void 0!==a.top?a.top:g.top,g.right=void 0!==a.right?a.right:g.right,g.bottom=void 0!==a.bottom?a.bottom:g.bottom,g.left=void 0!==a.left?a.left:g.left}},orient:{get:function(){return e},set:function(a){e=a,f="right"==e||"bottom"==e}}}),a.utils.inheritOptions(b,c),a.utils.initOptions(b),b},a.models.candlestickBar=function(){"use strict";function b(x){return x.each(function(b){c=d3.select(this);var x=a.utils.availableWidth(i,c,h),y=a.utils.availableHeight(j,c,h);a.utils.initSVG(c);var A=x/b[0].values.length*.45;l.domain(d||d3.extent(b[0].values.map(n).concat(t))),v?l.range(f||[.5*x/b[0].values.length,x*(b[0].values.length-.5)/b[0].values.length]):l.range(f||[5+A/2,x-A/2-5]),m.domain(e||[d3.min(b[0].values.map(s).concat(u)),d3.max(b[0].values.map(r).concat(u))]).range(g||[y,0]),l.domain()[0]===l.domain()[1]&&(l.domain()[0]?l.domain([l.domain()[0]-.01*l.domain()[0],l.domain()[1]+.01*l.domain()[1]]):l.domain([-1,1])),m.domain()[0]===m.domain()[1]&&(m.domain()[0]?m.domain([m.domain()[0]+.01*m.domain()[0],m.domain()[1]-.01*m.domain()[1]]):m.domain([-1,1]));var B=d3.select(this).selectAll("g.nv-wrap.nv-candlestickBar").data([b[0].values]),C=B.enter().append("g").attr("class","nvd3 nv-wrap nv-candlestickBar"),D=C.append("defs"),E=C.append("g"),F=B.select("g");E.append("g").attr("class","nv-ticks"),B.attr("transform","translate("+h.left+","+h.top+")"),c.on("click",function(a,b){z.chartClick({data:a,index:b,pos:d3.event,id:k})}),D.append("clipPath").attr("id","nv-chart-clip-path-"+k).append("rect"),B.select("#nv-chart-clip-path-"+k+" rect").attr("width",x).attr("height",y),F.attr("clip-path",w?"url(#nv-chart-clip-path-"+k+")":"");var G=B.select(".nv-ticks").selectAll(".nv-tick").data(function(a){return a});G.exit().remove();var H=G.enter().append("g").attr("class",function(a,b,c){return(p(a,b)>q(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b});H.append("line").attr("class","nv-candlestick-lines").attr("transform",function(a,b){return"translate("+l(n(a,b))+",0)"}).attr("x1",0).attr("y1",function(a,b){return m(r(a,b))}).attr("x2",0).attr("y2",function(a,b){return m(s(a,b))}),H.append("rect").attr("class","nv-candlestick-rects nv-bars").attr("transform",function(a,b){return"translate("+(l(n(a,b))-A/2)+","+(m(o(a,b))-(p(a,b)>q(a,b)?m(q(a,b))-m(p(a,b)):0))+")"}).attr("x",0).attr("y",0).attr("width",A).attr("height",function(a,b){var c=p(a,b),d=q(a,b);return c>d?m(d)-m(c):m(c)-m(d)});c.selectAll(".nv-candlestick-lines").transition().attr("transform",function(a,b){return"translate("+l(n(a,b))+",0)"}).attr("x1",0).attr("y1",function(a,b){return m(r(a,b))}).attr("x2",0).attr("y2",function(a,b){return m(s(a,b))}),c.selectAll(".nv-candlestick-rects").transition().attr("transform",function(a,b){return"translate("+(l(n(a,b))-A/2)+","+(m(o(a,b))-(p(a,b)>q(a,b)?m(q(a,b))-m(p(a,b)):0))+")"}).attr("x",0).attr("y",0).attr("width",A).attr("height",function(a,b){var c=p(a,b),d=q(a,b);return c>d?m(d)-m(c):m(c)-m(d)})}),b}var c,d,e,f,g,h={top:0,right:0,bottom:0,left:0},i=null,j=null,k=Math.floor(1e4*Math.random()),l=d3.scale.linear(),m=d3.scale.linear(),n=function(a){return a.x},o=function(a){return a.y},p=function(a){return a.open},q=function(a){return a.close},r=function(a){return a.high},s=function(a){return a.low},t=[],u=[],v=!1,w=!0,x=a.utils.defaultColor(),y=!1,z=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState","renderEnd","chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove");return b.highlightPoint=function(a,d){b.clearHighlights(),c.select(".nv-candlestickBar .nv-tick-0-"+a).classed("hover",d)},b.clearHighlights=function(){c.select(".nv-candlestickBar .nv-tick.hover").classed("hover",!1)},b.dispatch=z,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return i},set:function(a){i=a}},height:{get:function(){return j},set:function(a){j=a}},xScale:{get:function(){return l},set:function(a){l=a}},yScale:{get:function(){return m},set:function(a){m=a}},xDomain:{get:function(){return d},set:function(a){d=a}},yDomain:{get:function(){return e},set:function(a){e=a}},xRange:{get:function(){return f},set:function(a){f=a}},yRange:{get:function(){return g},set:function(a){g=a}},forceX:{get:function(){return t},set:function(a){t=a}},forceY:{get:function(){return u},set:function(a){u=a}},padData:{get:function(){return v},set:function(a){v=a}},clipEdge:{get:function(){return w},set:function(a){w=a}},id:{get:function(){return k},set:function(a){k=a}},interactive:{get:function(){return y},set:function(a){y=a}},x:{get:function(){return n},set:function(a){n=a}},y:{get:function(){return o},set:function(a){o=a}},open:{get:function(){return p()},set:function(a){p=a}},close:{get:function(){return q()},set:function(a){q=a}},high:{get:function(){return r},set:function(a){r=a}},low:{get:function(){return s},set:function(a){s=a}},margin:{get:function(){return h},set:function(a){h.top=void 0!=a.top?a.top:h.top,h.right=void 0!=a.right?a.right:h.right,h.bottom=void 0!=a.bottom?a.bottom:h.bottom,h.left=void 0!=a.left?a.left:h.left}},color:{get:function(){return x},set:function(b){x=a.utils.getColor(b)}}}),a.utils.initOptions(b),b},a.models.cumulativeLineChart=function(){"use strict";function b(l){return H.reset(),H.models(f),r&&H.models(g),s&&H.models(h),l.each(function(l){function A(a,c){d3.select(b.container).style("cursor","ew-resize")}function E(a,b){G.x=d3.event.x,G.i=Math.round(F.invert(G.x)),K()}function H(a,c){d3.select(b.container).style("cursor","auto"),y.index=G.i,C.stateChange(y)}function K(){ba.data([G]);var a=b.duration();b.duration(0),b.update(),b.duration(a)}var L=d3.select(this);a.utils.initSVG(L),L.classed("nv-chart-"+x,!0);var M=this,N=a.utils.availableWidth(o,L,m),O=a.utils.availableHeight(p,L,m);if(b.update=function(){0===D?L.call(b):L.transition().duration(D).call(b)},b.container=this,y.setter(J(l),b.update).getter(I(l)).update(),y.disabled=l.map(function(a){return!!a.disabled}),!z){var P;z={};for(P in y)y[P]instanceof Array?z[P]=y[P].slice(0):z[P]=y[P]}var Q=d3.behavior.drag().on("dragstart",A).on("drag",E).on("dragend",H);if(!(l&&l.length&&l.filter(function(a){return a.values.length}).length))return a.utils.noData(b,L),b;if(L.selectAll(".nv-noData").remove(),d=f.xScale(),e=f.yScale(),w)f.yDomain(null);else{var R=l.filter(function(a){return!a.disabled}).map(function(a,b){var c=d3.extent(a.values,f.y());return c[0]<-.95&&(c[0]=-.95),[(c[0]-c[1])/(1+c[1]),(c[1]-c[0])/(1+c[0])]}),S=[d3.min(R,function(a){return a[0]}),d3.max(R,function(a){return a[1]})];f.yDomain(S)}F.domain([0,l[0].values.length-1]).range([0,N]).clamp(!0);var l=c(G.i,l),T=v?"none":"all",U=L.selectAll("g.nv-wrap.nv-cumulativeLine").data([l]),V=U.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),W=U.select("g");if(V.append("g").attr("class","nv-interactive"),V.append("g").attr("class","nv-x nv-axis").style("pointer-events","none"),V.append("g").attr("class","nv-y nv-axis"),V.append("g").attr("class","nv-background"),V.append("g").attr("class","nv-linesWrap").style("pointer-events",T),V.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none"),V.append("g").attr("class","nv-legendWrap"),V.append("g").attr("class","nv-controlsWrap"),q&&(i.width(N),W.select(".nv-legendWrap").datum(l).call(i),m.top!=i.height()&&(m.top=i.height(),O=a.utils.availableHeight(p,L,m)),W.select(".nv-legendWrap").attr("transform","translate(0,"+-m.top+")")),u){var X=[{key:"Re-scale y-axis",disabled:!w}];j.width(140).color(["#444","#444","#444"]).rightAlign(!1).margin({top:5,right:0,bottom:5,left:20}),W.select(".nv-controlsWrap").datum(X).attr("transform","translate(0,"+-m.top+")").call(j)}U.attr("transform","translate("+m.left+","+m.top+")"),t&&W.select(".nv-y.nv-axis").attr("transform","translate("+N+",0)");var Y=l.filter(function(a){return a.tempDisabled});U.select(".tempDisabled").remove(),Y.length&&U.append("text").attr("class","tempDisabled").attr("x",N/2).attr("y","-.71em").style("text-anchor","end").text(Y.map(function(a){return a.key}).join(", ")+" values cannot be calculated for this time period."),v&&(k.width(N).height(O).margin({left:m.left,top:m.top}).svgContainer(L).xScale(d),U.select(".nv-interactive").call(k)),V.select(".nv-background").append("rect"),W.select(".nv-background rect").attr("width",N).attr("height",O),f.y(function(a){return a.display.y}).width(N).height(O).color(l.map(function(a,b){return a.color||n(a,b)}).filter(function(a,b){return!l[b].disabled&&!l[b].tempDisabled}));var Z=W.select(".nv-linesWrap").datum(l.filter(function(a){return!a.disabled&&!a.tempDisabled}));Z.call(f),l.forEach(function(a,b){a.seriesIndex=b});var $=l.filter(function(a){return!a.disabled&&!!B(a)}),_=W.select(".nv-avgLinesWrap").selectAll("line").data($,function(a){return a.key}),aa=function(a){var b=e(B(a));return 0>b?0:b>O?O:b};_.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(a,b){return f.color()(a,a.seriesIndex)}).attr("x1",0).attr("x2",N).attr("y1",aa).attr("y2",aa),_.style("stroke-opacity",function(a){var b=e(B(a));return 0>b||b>O?0:1}).attr("x1",0).attr("x2",N).attr("y1",aa).attr("y2",aa),_.exit().remove();var ba=Z.selectAll(".nv-indexLine").data([G]);ba.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(Q),ba.attr("transform",function(a){return"translate("+F(a.i)+",0)"}).attr("height",O),r&&(g.scale(d)._ticks(a.utils.calcTicksX(N/70,l)).tickSize(-O,0),W.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),W.select(".nv-x.nv-axis").call(g)),s&&(h.scale(e)._ticks(a.utils.calcTicksY(O/36,l)).tickSize(-N,0),W.select(".nv-y.nv-axis").call(h)),W.select(".nv-background rect").on("click",function(){G.x=d3.mouse(this)[0],G.i=Math.round(F.invert(G.x)),y.index=G.i,C.stateChange(y),K()}),f.dispatch.on("elementClick",function(a){G.i=a.pointIndex,G.x=F(G.i),y.index=G.i,C.stateChange(y),K()}),j.dispatch.on("legendClick",function(a,c){a.disabled=!a.disabled,w=!a.disabled,y.rescaleY=w,C.stateChange(y),b.update()}),i.dispatch.on("stateChange",function(a){for(var c in a)y[c]=a[c];C.stateChange(y),b.update()}),k.dispatch.on("elementMousemove",function(c){f.clearHighlights();var d,e,i,j=[];if(l.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(g,h){e=a.interactiveBisect(g.values,c.pointXValue,b.x()),f.highlightPoint(h,e,!0);var k=g.values[e];"undefined"!=typeof k&&("undefined"==typeof d&&(d=k),"undefined"==typeof i&&(i=b.xScale()(b.x()(k,e))),j.push({key:g.key,value:b.y()(k,e),color:n(g,g.seriesIndex)}))}),j.length>2){var o=b.yScale().invert(c.mouseY),p=Math.abs(b.yScale().domain()[0]-b.yScale().domain()[1]),q=.03*p,r=a.nearestValueIndex(j.map(function(a){return a.value}),o,q);null!==r&&(j[r].highlight=!0)}var s=g.tickFormat()(b.x()(d,e),e);k.tooltip.position({left:i+m.left,top:c.mouseY+m.top}).chartContainer(M.parentNode).valueFormatter(function(a,b){return h.tickFormat()(a)}).data({value:s,series:j})(),k.renderGuideLine(i)}),k.dispatch.on("elementMouseout",function(a){f.clearHighlights()}),C.on("changeState",function(a){"undefined"!=typeof a.disabled&&(l.forEach(function(b,c){b.disabled=a.disabled[c]}),y.disabled=a.disabled),"undefined"!=typeof a.index&&(G.i=a.index,G.x=F(G.i),y.index=a.index,ba.data([G])),"undefined"!=typeof a.rescaleY&&(w=a.rescaleY),b.update()})}),H.renderEnd("cumulativeLineChart immediate"),b}function c(a,b){return K||(K=f.y()),b.map(function(b,c){if(!b.values)return b;var d=b.values[a];if(null==d)return b;var e=K(d,a);return-.95>e&&!E?(b.tempDisabled=!0,b):(b.tempDisabled=!1,b.values=b.values.map(function(a,b){return a.display={y:(K(a,b)-e)/(1+e)},a}),b)})}var d,e,f=a.models.line(),g=a.models.axis(),h=a.models.axis(),i=a.models.legend(),j=a.models.legend(),k=a.interactiveGuideline(),l=a.models.tooltip(),m={top:30,right:30,bottom:50,left:60},n=a.utils.defaultColor(),o=null,p=null,q=!0,r=!0,s=!0,t=!1,u=!0,v=!1,w=!0,x=f.id(),y=a.utils.state(),z=null,A=null,B=function(a){return a.average},C=d3.dispatch("stateChange","changeState","renderEnd"),D=250,E=!1;y.index=0,y.rescaleY=w,g.orient("bottom").tickPadding(7),h.orient(t?"right":"left"),l.valueFormatter(function(a,b){return h.tickFormat()(a,b)}).headerFormatter(function(a,b){return g.tickFormat()(a,b)}),j.updateState(!1);var F=d3.scale.linear(),G={i:0,x:0},H=a.utils.renderWatch(C,D),I=function(a){return function(){return{active:a.map(function(a){return!a.disabled}),index:G.i,rescaleY:w}}},J=function(a){return function(b){void 0!==b.index&&(G.i=b.index),void 0!==b.rescaleY&&(w=b.rescaleY),void 0!==b.active&&a.forEach(function(a,c){a.disabled=!b.active[c]})}};f.dispatch.on("elementMouseover.tooltip",function(a){var c={x:b.x()(a.point),y:b.y()(a.point),color:a.point.color};a.point=c,l.data(a).position(a.pos).hidden(!1)}),f.dispatch.on("elementMouseout.tooltip",function(a){l.hidden(!0)});var K=null;return b.dispatch=C,b.lines=f,b.legend=i,b.controls=j,b.xAxis=g,b.yAxis=h,b.interactiveLayer=k,b.state=y,b.tooltip=l,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return o},set:function(a){o=a}},height:{get:function(){return p},set:function(a){p=a}},rescaleY:{get:function(){return w},set:function(a){w=a}},showControls:{get:function(){return u},set:function(a){u=a}},showLegend:{get:function(){return q},set:function(a){q=a}},average:{get:function(){return B},set:function(a){B=a}},defaultState:{get:function(){return z},set:function(a){z=a}},noData:{get:function(){return A},set:function(a){A=a}},showXAxis:{get:function(){return r},set:function(a){r=a}},showYAxis:{get:function(){return s},set:function(a){s=a}},noErrorCheck:{get:function(){return E},set:function(a){E=a}},tooltips:{get:function(){return l.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),l.enabled(!!b)}},tooltipContent:{get:function(){return l.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),l.contentGenerator(b)}},margin:{get:function(){return m},set:function(a){m.top=void 0!==a.top?a.top:m.top,m.right=void 0!==a.right?a.right:m.right,m.bottom=void 0!==a.bottom?a.bottom:m.bottom,m.left=void 0!==a.left?a.left:m.left}},color:{get:function(){return n},set:function(b){n=a.utils.getColor(b),i.color(n)}},useInteractiveGuideline:{get:function(){return v},set:function(a){v=a,a===!0&&(b.interactive(!1),b.useVoronoi(!1))}},rightAlignYAxis:{get:function(){return t},set:function(a){t=a,h.orient(a?"right":"left")}},duration:{get:function(){return D},set:function(a){D=a,f.duration(D),g.duration(D),h.duration(D),H.reset(D)}}}),a.utils.inheritOptions(b,f),a.utils.initOptions(b),b},a.models.discreteBar=function(){"use strict";function b(m){return y.reset(),m.each(function(b){var m=k-j.left-j.right,x=l-j.top-j.bottom;c=d3.select(this),a.utils.initSVG(c),b.forEach(function(a,b){a.values.forEach(function(a){a.series=b})});var z=d&&e?[]:b.map(function(a){return a.values.map(function(a,b){return{x:p(a,b),y:q(a,b),y0:a.y0}})});n.domain(d||d3.merge(z).map(function(a){return a.x})).rangeBands(f||[0,m],.1),o.domain(e||d3.extent(d3.merge(z).map(function(a){return a.y}).concat(r))),t?o.range(g||[x-(o.domain()[0]<0?12:0),o.domain()[1]>0?12:0]):o.range(g||[x,0]),h=h||n,i=i||o.copy().range([o(0),o(0)]);var A=c.selectAll("g.nv-wrap.nv-discretebar").data([b]),B=A.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),C=B.append("g");A.select("g");C.append("g").attr("class","nv-groups"),A.attr("transform","translate("+j.left+","+j.top+")");var D=A.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});D.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),D.exit().watchTransition(y,"discreteBar: exit groups").style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),D.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),D.watchTransition(y,"discreteBar: groups").style("stroke-opacity",1).style("fill-opacity",.75);var E=D.selectAll("g.nv-bar").data(function(a){return a.values});E.exit().remove();var F=E.enter().append("g").attr("transform",function(a,b,c){return"translate("+(n(p(a,b))+.05*n.rangeBand())+", "+o(0)+")"}).on("mouseover",function(a,b){d3.select(this).classed("hover",!0),v.elementMouseover({data:a,index:b,color:d3.select(this).style("fill")})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),v.elementMouseout({data:a,index:b,color:d3.select(this).style("fill")})}).on("mousemove",function(a,b){v.elementMousemove({data:a,index:b,color:d3.select(this).style("fill")})}).on("click",function(a,b){v.elementClick({data:a,index:b,color:d3.select(this).style("fill")}),d3.event.stopPropagation()}).on("dblclick",function(a,b){v.elementDblClick({data:a,index:b,color:d3.select(this).style("fill")}),d3.event.stopPropagation()});F.append("rect").attr("height",0).attr("width",.9*n.rangeBand()/b.length),t?(F.append("text").attr("text-anchor","middle"),E.select("text").text(function(a,b){return u(q(a,b))}).watchTransition(y,"discreteBar: bars text").attr("x",.9*n.rangeBand()/2).attr("y",function(a,b){return q(a,b)<0?o(q(a,b))-o(0)+12:-4})):E.selectAll("text").remove(),E.attr("class",function(a,b){return q(a,b)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(a,b){return a.color||s(a,b)}).style("stroke",function(a,b){return a.color||s(a,b)}).select("rect").attr("class",w).watchTransition(y,"discreteBar: bars rect").attr("width",.9*n.rangeBand()/b.length),E.watchTransition(y,"discreteBar: bars").attr("transform",function(a,b){var c=n(p(a,b))+.05*n.rangeBand(),d=q(a,b)<0?o(0):o(0)-o(q(a,b))<1?o(0)-1:o(q(a,b));return"translate("+c+", "+d+")"}).select("rect").attr("height",function(a,b){return Math.max(Math.abs(o(q(a,b))-o(e&&e[0]||0))||1)}),h=n.copy(),i=o.copy()}),y.renderEnd("discreteBar immediate"),b}var c,d,e,f,g,h,i,j={top:0,right:0,bottom:0,left:0},k=960,l=500,m=Math.floor(1e4*Math.random()),n=d3.scale.ordinal(),o=d3.scale.linear(),p=function(a){return a.x},q=function(a){return a.y},r=[0],s=a.utils.defaultColor(),t=!1,u=d3.format(",.2f"),v=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),w="discreteBar",x=250,y=a.utils.renderWatch(v,x);return b.dispatch=v,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return k},set:function(a){k=a}},height:{get:function(){return l},set:function(a){l=a}},forceY:{get:function(){return r},set:function(a){r=a}},showValues:{get:function(){return t},set:function(a){t=a}},x:{get:function(){return p},set:function(a){p=a}},y:{get:function(){return q},set:function(a){q=a}},xScale:{get:function(){return n},set:function(a){n=a}},yScale:{get:function(){return o},set:function(a){o=a}},xDomain:{get:function(){return d},set:function(a){d=a}},yDomain:{get:function(){return e},set:function(a){e=a}},xRange:{get:function(){return f},set:function(a){f=a}},yRange:{get:function(){return g},set:function(a){g=a}},valueFormat:{get:function(){return u},set:function(a){u=a}},id:{get:function(){return m},set:function(a){m=a}},rectClass:{get:function(){return w},set:function(a){w=a}},margin:{get:function(){return j},set:function(a){j.top=void 0!==a.top?a.top:j.top,j.right=void 0!==a.right?a.right:j.right,j.bottom=void 0!==a.bottom?a.bottom:j.bottom,j.left=void 0!==a.left?a.left:j.left}},color:{get:function(){return s},set:function(b){s=a.utils.getColor(b)}},duration:{get:function(){return x},set:function(a){x=a,y.reset(x)}}}),a.utils.initOptions(b),b},a.models.discreteBarChart=function(){"use strict";function b(h){return t.reset(),t.models(e),m&&t.models(f),n&&t.models(g),h.each(function(h){var l=d3.select(this);a.utils.initSVG(l);var q=a.utils.availableWidth(j,l,i),t=a.utils.availableHeight(k,l,i);if(b.update=function(){r.beforeUpdate(),l.transition().duration(s).call(b)},b.container=this,!(h&&h.length&&h.filter(function(a){return a.values.length}).length))return a.utils.noData(b,l),b;l.selectAll(".nv-noData").remove(),c=e.xScale(),d=e.yScale().clamp(!0);var u=l.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([h]),v=u.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),w=v.append("defs"),x=u.select("g");v.append("g").attr("class","nv-x nv-axis"),v.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),v.append("g").attr("class","nv-barsWrap"),x.attr("transform","translate("+i.left+","+i.top+")"),o&&x.select(".nv-y.nv-axis").attr("transform","translate("+q+",0)"),e.width(q).height(t);var y=x.select(".nv-barsWrap").datum(h.filter(function(a){return!a.disabled}));if(y.transition().call(e),w.append("clipPath").attr("id","nv-x-label-clip-"+e.id()).append("rect"), -x.select("#nv-x-label-clip-"+e.id()+" rect").attr("width",c.rangeBand()*(p?2:1)).attr("height",16).attr("x",-c.rangeBand()/(p?1:2)),m){f.scale(c)._ticks(a.utils.calcTicksX(q/100,h)).tickSize(-t,0),x.select(".nv-x.nv-axis").attr("transform","translate(0,"+(d.range()[0]+(e.showValues()&&d.domain()[0]<0?16:0))+")"),x.select(".nv-x.nv-axis").call(f);var z=x.select(".nv-x.nv-axis").selectAll("g");p&&z.selectAll("text").attr("transform",function(a,b,c){return"translate(0,"+(c%2==0?"5":"17")+")"})}n&&(g.scale(d)._ticks(a.utils.calcTicksY(t/36,h)).tickSize(-q,0),x.select(".nv-y.nv-axis").call(g)),x.select(".nv-zeroLine line").attr("x1",0).attr("x2",q).attr("y1",d(0)).attr("y2",d(0))}),t.renderEnd("discreteBar chart immediate"),b}var c,d,e=a.models.discreteBar(),f=a.models.axis(),g=a.models.axis(),h=a.models.tooltip(),i={top:15,right:10,bottom:50,left:60},j=null,k=null,l=a.utils.getColor(),m=!0,n=!0,o=!1,p=!1,q=null,r=d3.dispatch("beforeUpdate","renderEnd"),s=250;f.orient("bottom").showMaxMin(!1).tickFormat(function(a){return a}),g.orient(o?"right":"left").tickFormat(d3.format(",.1f")),h.duration(0).headerEnabled(!1).valueFormatter(function(a,b){return g.tickFormat()(a,b)}).keyFormatter(function(a,b){return f.tickFormat()(a,b)});var t=a.utils.renderWatch(r,s);return e.dispatch.on("elementMouseover.tooltip",function(a){a.series={key:b.x()(a.data),value:b.y()(a.data),color:a.color},h.data(a).hidden(!1)}),e.dispatch.on("elementMouseout.tooltip",function(a){h.hidden(!0)}),e.dispatch.on("elementMousemove.tooltip",function(a){h.position({top:d3.event.pageY,left:d3.event.pageX})()}),b.dispatch=r,b.discretebar=e,b.xAxis=f,b.yAxis=g,b.tooltip=h,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return j},set:function(a){j=a}},height:{get:function(){return k},set:function(a){k=a}},staggerLabels:{get:function(){return p},set:function(a){p=a}},showXAxis:{get:function(){return m},set:function(a){m=a}},showYAxis:{get:function(){return n},set:function(a){n=a}},noData:{get:function(){return q},set:function(a){q=a}},tooltips:{get:function(){return h.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),h.enabled(!!b)}},tooltipContent:{get:function(){return h.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),h.contentGenerator(b)}},margin:{get:function(){return i},set:function(a){i.top=void 0!==a.top?a.top:i.top,i.right=void 0!==a.right?a.right:i.right,i.bottom=void 0!==a.bottom?a.bottom:i.bottom,i.left=void 0!==a.left?a.left:i.left}},duration:{get:function(){return s},set:function(a){s=a,t.reset(s),e.duration(s),f.duration(s),g.duration(s)}},color:{get:function(){return l},set:function(b){l=a.utils.getColor(b),e.color(l)}},rightAlignYAxis:{get:function(){return o},set:function(a){o=a,g.orient(a?"right":"left")}}}),a.utils.inheritOptions(b,e),a.utils.initOptions(b),b},a.models.distribution=function(){"use strict";function b(k){return m.reset(),k.each(function(b){var k=(e-("x"===g?d.left+d.right:d.top+d.bottom),"x"==g?"y":"x"),l=d3.select(this);a.utils.initSVG(l),c=c||j;var n=l.selectAll("g.nv-distribution").data([b]),o=n.enter().append("g").attr("class","nvd3 nv-distribution"),p=(o.append("g"),n.select("g"));n.attr("transform","translate("+d.left+","+d.top+")");var q=p.selectAll("g.nv-dist").data(function(a){return a},function(a){return a.key});q.enter().append("g"),q.attr("class",function(a,b){return"nv-dist nv-series-"+b}).style("stroke",function(a,b){return i(a,b)});var r=q.selectAll("line.nv-dist"+g).data(function(a){return a.values});r.enter().append("line").attr(g+"1",function(a,b){return c(h(a,b))}).attr(g+"2",function(a,b){return c(h(a,b))}),m.transition(q.exit().selectAll("line.nv-dist"+g),"dist exit").attr(g+"1",function(a,b){return j(h(a,b))}).attr(g+"2",function(a,b){return j(h(a,b))}).style("stroke-opacity",0).remove(),r.attr("class",function(a,b){return"nv-dist"+g+" nv-dist"+g+"-"+b}).attr(k+"1",0).attr(k+"2",f),m.transition(r,"dist").attr(g+"1",function(a,b){return j(h(a,b))}).attr(g+"2",function(a,b){return j(h(a,b))}),c=j.copy()}),m.renderEnd("distribution immediate"),b}var c,d={top:0,right:0,bottom:0,left:0},e=400,f=8,g="x",h=function(a){return a[g]},i=a.utils.defaultColor(),j=d3.scale.linear(),k=250,l=d3.dispatch("renderEnd"),m=a.utils.renderWatch(l,k);return b.options=a.utils.optionsFunc.bind(b),b.dispatch=l,b.margin=function(a){return arguments.length?(d.top="undefined"!=typeof a.top?a.top:d.top,d.right="undefined"!=typeof a.right?a.right:d.right,d.bottom="undefined"!=typeof a.bottom?a.bottom:d.bottom,d.left="undefined"!=typeof a.left?a.left:d.left,b):d},b.width=function(a){return arguments.length?(e=a,b):e},b.axis=function(a){return arguments.length?(g=a,b):g},b.size=function(a){return arguments.length?(f=a,b):f},b.getData=function(a){return arguments.length?(h=d3.functor(a),b):h},b.scale=function(a){return arguments.length?(j=a,b):j},b.color=function(c){return arguments.length?(i=a.utils.getColor(c),b):i},b.duration=function(a){return arguments.length?(k=a,m.reset(k),b):k},b},a.models.furiousLegend=function(){"use strict";function b(p){function q(a,b){return"furious"!=o?"#000":m?a.disengaged?g(a,b):"#fff":m?void 0:a.disabled?g(a,b):"#fff"}function r(a,b){return m&&"furious"==o?a.disengaged?"#fff":g(a,b):a.disabled?"#fff":g(a,b)}return p.each(function(b){var p=d-c.left-c.right,s=d3.select(this);a.utils.initSVG(s);var t=s.selectAll("g.nv-legend").data([b]),u=(t.enter().append("g").attr("class","nvd3 nv-legend").append("g"),t.select("g"));t.attr("transform","translate("+c.left+","+c.top+")");var v,w=u.selectAll(".nv-series").data(function(a){return"furious"!=o?a:a.filter(function(a){return m?!0:!a.disengaged})}),x=w.enter().append("g").attr("class","nv-series");if("classic"==o)x.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5),v=w.select("circle");else if("furious"==o){x.append("rect").style("stroke-width",2).attr("class","nv-legend-symbol").attr("rx",3).attr("ry",3),v=w.select("rect"),x.append("g").attr("class","nv-check-box").property("innerHTML",'').attr("transform","translate(-10,-8)scale(0.5)");var y=w.select(".nv-check-box");y.each(function(a,b){d3.select(this).selectAll("path").attr("stroke",q(a,b))})}x.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");var z=w.select("text.nv-legend-text");w.on("mouseover",function(a,b){n.legendMouseover(a,b)}).on("mouseout",function(a,b){n.legendMouseout(a,b)}).on("click",function(a,b){n.legendClick(a,b);var c=w.data();if(k){if("classic"==o)l?(c.forEach(function(a){a.disabled=!0}),a.disabled=!1):(a.disabled=!a.disabled,c.every(function(a){return a.disabled})&&c.forEach(function(a){a.disabled=!1}));else if("furious"==o)if(m)a.disengaged=!a.disengaged,a.userDisabled=void 0==a.userDisabled?!!a.disabled:a.userDisabled,a.disabled=a.disengaged||a.userDisabled;else if(!m){a.disabled=!a.disabled,a.userDisabled=a.disabled;var d=c.filter(function(a){return!a.disengaged});d.every(function(a){return a.userDisabled})&&c.forEach(function(a){a.disabled=a.userDisabled=!1})}n.stateChange({disabled:c.map(function(a){return!!a.disabled}),disengaged:c.map(function(a){return!!a.disengaged})})}}).on("dblclick",function(a,b){if(("furious"!=o||!m)&&(n.legendDblclick(a,b),k)){var c=w.data();c.forEach(function(a){a.disabled=!0,"furious"==o&&(a.userDisabled=a.disabled)}),a.disabled=!1,"furious"==o&&(a.userDisabled=a.disabled),n.stateChange({disabled:c.map(function(a){return!!a.disabled})})}}),w.classed("nv-disabled",function(a){return a.userDisabled}),w.exit().remove(),z.attr("fill",q).text(f);var A;switch(o){case"furious":A=23;break;case"classic":A=20}if(h){var B=[];w.each(function(b,c){var d,e=d3.select(this).select("text");try{if(d=e.node().getComputedTextLength(),0>=d)throw Error()}catch(f){d=a.utils.calcApproxTextWidth(e)}B.push(d+i)});for(var C=0,D=0,E=[];p>D&&Cp&&C>1;){E=[],C--;for(var F=0;F(E[F%C]||0)&&(E[F%C]=B[F]);D=E.reduce(function(a,b,c,d){return a+b})}for(var G=[],H=0,I=0;C>H;H++)G[H]=I,I+=E[H];w.attr("transform",function(a,b){return"translate("+G[b%C]+","+(5+Math.floor(b/C)*A)+")"}),j?u.attr("transform","translate("+(d-c.right-D)+","+c.top+")"):u.attr("transform","translate(0,"+c.top+")"),e=c.top+c.bottom+Math.ceil(B.length/C)*A}else{var J,K=5,L=5,M=0;w.attr("transform",function(a,b){var e=d3.select(this).select("text").node().getComputedTextLength()+i;return J=L,dM&&(M=L),"translate("+J+","+K+")"}),u.attr("transform","translate("+(d-c.right-M)+","+c.top+")"),e=c.top+c.bottom+K+15}"furious"==o&&v.attr("width",function(a,b){return z[0][b].getComputedTextLength()+27}).attr("height",18).attr("y",-9).attr("x",-15),v.style("fill",r).style("stroke",function(a,b){return a.color||g(a,b)})}),b}var c={top:5,right:0,bottom:5,left:0},d=400,e=20,f=function(a){return a.key},g=a.utils.getColor(),h=!0,i=28,j=!0,k=!0,l=!1,m=!1,n=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),o="classic";return b.dispatch=n,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return d},set:function(a){d=a}},height:{get:function(){return e},set:function(a){e=a}},key:{get:function(){return f},set:function(a){f=a}},align:{get:function(){return h},set:function(a){h=a}},rightAlign:{get:function(){return j},set:function(a){j=a}},padding:{get:function(){return i},set:function(a){i=a}},updateState:{get:function(){return k},set:function(a){k=a}},radioButtonMode:{get:function(){return l},set:function(a){l=a}},expanded:{get:function(){return m},set:function(a){m=a}},vers:{get:function(){return o},set:function(a){o=a}},margin:{get:function(){return c},set:function(a){c.top=void 0!==a.top?a.top:c.top,c.right=void 0!==a.right?a.right:c.right,c.bottom=void 0!==a.bottom?a.bottom:c.bottom,c.left=void 0!==a.left?a.left:c.left}},color:{get:function(){return g},set:function(b){g=a.utils.getColor(b)}}}),a.utils.initOptions(b),b},a.models.historicalBar=function(){"use strict";function b(x){return x.each(function(b){w.reset(),k=d3.select(this);var x=a.utils.availableWidth(h,k,g),y=a.utils.availableHeight(i,k,g);a.utils.initSVG(k),l.domain(c||d3.extent(b[0].values.map(n).concat(p))),r?l.range(e||[.5*x/b[0].values.length,x*(b[0].values.length-.5)/b[0].values.length]):l.range(e||[0,x]),m.domain(d||d3.extent(b[0].values.map(o).concat(q))).range(f||[y,0]),l.domain()[0]===l.domain()[1]&&(l.domain()[0]?l.domain([l.domain()[0]-.01*l.domain()[0],l.domain()[1]+.01*l.domain()[1]]):l.domain([-1,1])),m.domain()[0]===m.domain()[1]&&(m.domain()[0]?m.domain([m.domain()[0]+.01*m.domain()[0],m.domain()[1]-.01*m.domain()[1]]):m.domain([-1,1]));var z=k.selectAll("g.nv-wrap.nv-historicalBar-"+j).data([b[0].values]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+j),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-bars"),z.attr("transform","translate("+g.left+","+g.top+")"),k.on("click",function(a,b){u.chartClick({data:a,index:b,pos:d3.event,id:j})}),B.append("clipPath").attr("id","nv-chart-clip-path-"+j).append("rect"),z.select("#nv-chart-clip-path-"+j+" rect").attr("width",x).attr("height",y),D.attr("clip-path",s?"url(#nv-chart-clip-path-"+j+")":"");var E=z.select(".nv-bars").selectAll(".nv-bar").data(function(a){return a},function(a,b){return n(a,b)});E.exit().remove(),E.enter().append("rect").attr("x",0).attr("y",function(b,c){return a.utils.NaNtoZero(m(Math.max(0,o(b,c))))}).attr("height",function(b,c){return a.utils.NaNtoZero(Math.abs(m(o(b,c))-m(0)))}).attr("transform",function(a,c){return"translate("+(l(n(a,c))-x/b[0].values.length*.45)+",0)"}).on("mouseover",function(a,b){v&&(d3.select(this).classed("hover",!0),u.elementMouseover({data:a,index:b,color:d3.select(this).style("fill")}))}).on("mouseout",function(a,b){v&&(d3.select(this).classed("hover",!1),u.elementMouseout({data:a,index:b,color:d3.select(this).style("fill")}))}).on("mousemove",function(a,b){v&&u.elementMousemove({data:a,index:b,color:d3.select(this).style("fill")})}).on("click",function(a,b){v&&(u.elementClick({data:a,index:b,color:d3.select(this).style("fill")}),d3.event.stopPropagation())}).on("dblclick",function(a,b){v&&(u.elementDblClick({data:a,index:b,color:d3.select(this).style("fill")}),d3.event.stopPropagation())}),E.attr("fill",function(a,b){return t(a,b)}).attr("class",function(a,b,c){return(o(a,b)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+c+"-"+b}).watchTransition(w,"bars").attr("transform",function(a,c){return"translate("+(l(n(a,c))-x/b[0].values.length*.45)+",0)"}).attr("width",x/b[0].values.length*.9),E.watchTransition(w,"bars").attr("y",function(b,c){var d=o(b,c)<0?m(0):m(0)-m(o(b,c))<1?m(0)-1:m(o(b,c));return a.utils.NaNtoZero(d)}).attr("height",function(b,c){return a.utils.NaNtoZero(Math.max(Math.abs(m(o(b,c))-m(0)),1))})}),w.renderEnd("historicalBar immediate"),b}var c,d,e,f,g={top:0,right:0,bottom:0,left:0},h=null,i=null,j=Math.floor(1e4*Math.random()),k=null,l=d3.scale.linear(),m=d3.scale.linear(),n=function(a){return a.x},o=function(a){return a.y},p=[],q=[0],r=!1,s=!0,t=a.utils.defaultColor(),u=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),v=!0,w=a.utils.renderWatch(u,0);return b.highlightPoint=function(a,b){k.select(".nv-bars .nv-bar-0-"+a).classed("hover",b)},b.clearHighlights=function(){k.select(".nv-bars .nv-bar.hover").classed("hover",!1)},b.dispatch=u,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return h},set:function(a){h=a}},height:{get:function(){return i},set:function(a){i=a}},forceX:{get:function(){return p},set:function(a){p=a}},forceY:{get:function(){return q},set:function(a){q=a}},padData:{get:function(){return r},set:function(a){r=a}},x:{get:function(){return n},set:function(a){n=a}},y:{get:function(){return o},set:function(a){o=a}},xScale:{get:function(){return l},set:function(a){l=a}},yScale:{get:function(){return m},set:function(a){m=a}},xDomain:{get:function(){return c},set:function(a){c=a}},yDomain:{get:function(){return d},set:function(a){d=a}},xRange:{get:function(){return e},set:function(a){e=a}},yRange:{get:function(){return f},set:function(a){f=a}},clipEdge:{get:function(){return s},set:function(a){s=a}},id:{get:function(){return j},set:function(a){j=a}},interactive:{get:function(){return v},set:function(a){v=a}},margin:{get:function(){return g},set:function(a){g.top=void 0!==a.top?a.top:g.top,g.right=void 0!==a.right?a.right:g.right,g.bottom=void 0!==a.bottom?a.bottom:g.bottom,g.left=void 0!==a.left?a.left:g.left}},color:{get:function(){return t},set:function(b){t=a.utils.getColor(b)}}}),a.utils.initOptions(b),b},a.models.historicalBarChart=function(b){"use strict";function c(b){return b.each(function(k){z.reset(),z.models(f),q&&z.models(g),r&&z.models(h);var w=d3.select(this),A=this;a.utils.initSVG(w);var B=a.utils.availableWidth(n,w,l),C=a.utils.availableHeight(o,w,l);if(c.update=function(){w.transition().duration(y).call(c)},c.container=this,u.disabled=k.map(function(a){return!!a.disabled}),!v){var D;v={};for(D in u)u[D]instanceof Array?v[D]=u[D].slice(0):v[D]=u[D]}if(!(k&&k.length&&k.filter(function(a){return a.values.length}).length))return a.utils.noData(c,w),c;w.selectAll(".nv-noData").remove(),d=f.xScale(),e=f.yScale();var E=w.selectAll("g.nv-wrap.nv-historicalBarChart").data([k]),F=E.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g"),G=E.select("g");F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y nv-axis"),F.append("g").attr("class","nv-barsWrap"),F.append("g").attr("class","nv-legendWrap"),F.append("g").attr("class","nv-interactive"),p&&(i.width(B),G.select(".nv-legendWrap").datum(k).call(i),l.top!=i.height()&&(l.top=i.height(),C=a.utils.availableHeight(o,w,l)),E.select(".nv-legendWrap").attr("transform","translate(0,"+-l.top+")")),E.attr("transform","translate("+l.left+","+l.top+")"),s&&G.select(".nv-y.nv-axis").attr("transform","translate("+B+",0)"),t&&(j.width(B).height(C).margin({left:l.left,top:l.top}).svgContainer(w).xScale(d),E.select(".nv-interactive").call(j)),f.width(B).height(C).color(k.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!k[b].disabled}));var H=G.select(".nv-barsWrap").datum(k.filter(function(a){return!a.disabled}));H.transition().call(f),q&&(g.scale(d)._ticks(a.utils.calcTicksX(B/100,k)).tickSize(-C,0),G.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),G.select(".nv-x.nv-axis").transition().call(g)),r&&(h.scale(e)._ticks(a.utils.calcTicksY(C/36,k)).tickSize(-B,0),G.select(".nv-y.nv-axis").transition().call(h)),j.dispatch.on("elementMousemove",function(b){f.clearHighlights();var d,e,i,n=[];k.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(g,h){e=a.interactiveBisect(g.values,b.pointXValue,c.x()),f.highlightPoint(e,!0);var j=g.values[e];void 0!==j&&(void 0===d&&(d=j),void 0===i&&(i=c.xScale()(c.x()(j,e))),n.push({key:g.key,value:c.y()(j,e),color:m(g,g.seriesIndex),data:g.values[e]}))});var o=g.tickFormat()(c.x()(d,e));j.tooltip.position({left:i+l.left,top:b.mouseY+l.top}).chartContainer(A.parentNode).valueFormatter(function(a,b){return h.tickFormat()(a)}).data({value:o,index:e,series:n})(),j.renderGuideLine(i)}),j.dispatch.on("elementMouseout",function(a){x.tooltipHide(),f.clearHighlights()}),i.dispatch.on("legendClick",function(a,d){a.disabled=!a.disabled,k.filter(function(a){return!a.disabled}).length||k.map(function(a){return a.disabled=!1,E.selectAll(".nv-series").classed("disabled",!1),a}),u.disabled=k.map(function(a){return!!a.disabled}),x.stateChange(u),b.transition().call(c)}),i.dispatch.on("legendDblclick",function(a){k.forEach(function(a){a.disabled=!0}),a.disabled=!1,u.disabled=k.map(function(a){return!!a.disabled}),x.stateChange(u),c.update()}),x.on("changeState",function(a){"undefined"!=typeof a.disabled&&(k.forEach(function(b,c){b.disabled=a.disabled[c]}),u.disabled=a.disabled),c.update()})}),z.renderEnd("historicalBarChart immediate"),c}var d,e,f=b||a.models.historicalBar(),g=a.models.axis(),h=a.models.axis(),i=a.models.legend(),j=a.interactiveGuideline(),k=a.models.tooltip(),l={top:30,right:90,bottom:50,left:90},m=a.utils.defaultColor(),n=null,o=null,p=!1,q=!0,r=!0,s=!1,t=!1,u={},v=null,w=null,x=d3.dispatch("tooltipHide","stateChange","changeState","renderEnd"),y=250;g.orient("bottom").tickPadding(7),h.orient(s?"right":"left"),k.duration(0).headerEnabled(!1).valueFormatter(function(a,b){return h.tickFormat()(a,b)}).headerFormatter(function(a,b){return g.tickFormat()(a,b)});var z=a.utils.renderWatch(x,0);return f.dispatch.on("elementMouseover.tooltip",function(a){a.series={key:c.x()(a.data),value:c.y()(a.data),color:a.color},k.data(a).hidden(!1)}),f.dispatch.on("elementMouseout.tooltip",function(a){k.hidden(!0)}),f.dispatch.on("elementMousemove.tooltip",function(a){k.position({top:d3.event.pageY,left:d3.event.pageX})()}),c.dispatch=x,c.bars=f,c.legend=i,c.xAxis=g,c.yAxis=h,c.interactiveLayer=j,c.tooltip=k,c.options=a.utils.optionsFunc.bind(c),c._options=Object.create({},{width:{get:function(){return n},set:function(a){n=a}},height:{get:function(){return o},set:function(a){o=a}},showLegend:{get:function(){return p},set:function(a){p=a}},showXAxis:{get:function(){return q},set:function(a){q=a}},showYAxis:{get:function(){return r},set:function(a){r=a}},defaultState:{get:function(){return v},set:function(a){v=a}},noData:{get:function(){return w},set:function(a){w=a}},tooltips:{get:function(){return k.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),k.enabled(!!b)}},tooltipContent:{get:function(){return k.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),k.contentGenerator(b)}},margin:{get:function(){return l},set:function(a){l.top=void 0!==a.top?a.top:l.top,l.right=void 0!==a.right?a.right:l.right,l.bottom=void 0!==a.bottom?a.bottom:l.bottom,l.left=void 0!==a.left?a.left:l.left}},color:{get:function(){return m},set:function(b){m=a.utils.getColor(b),i.color(m),f.color(m)}},duration:{get:function(){return y},set:function(a){y=a,z.reset(y),h.duration(y),g.duration(y)}},rightAlignYAxis:{get:function(){return s},set:function(a){s=a,h.orient(a?"right":"left")}},useInteractiveGuideline:{get:function(){return t},set:function(a){t=a,a===!0&&c.interactive(!1)}}}),a.utils.inheritOptions(c,f),a.utils.initOptions(c),c},a.models.ohlcBarChart=function(){var b=a.models.historicalBarChart(a.models.ohlcBar());return b.useInteractiveGuideline(!0),b.interactiveLayer.tooltip.contentGenerator(function(a){var c=a.series[0].data,d=c.open'+a.value+"
    open:"+b.yAxis.tickFormat()(c.open)+"
    close:"+b.yAxis.tickFormat()(c.close)+"
    high"+b.yAxis.tickFormat()(c.high)+"
    low:"+b.yAxis.tickFormat()(c.low)+"
    "}),b},a.models.candlestickBarChart=function(){var b=a.models.historicalBarChart(a.models.candlestickBar());return b.useInteractiveGuideline(!0),b.interactiveLayer.tooltip.contentGenerator(function(a){var c=a.series[0].data,d=c.open'+a.value+"
    open:"+b.yAxis.tickFormat()(c.open)+"
    close:"+b.yAxis.tickFormat()(c.close)+"
    high"+b.yAxis.tickFormat()(c.high)+"
    low:"+b.yAxis.tickFormat()(c.low)+"
    "}),b},a.models.legend=function(){"use strict";function b(p){function q(a,b){return"furious"!=o?"#000":m?a.disengaged?"#000":"#fff":m?void 0:(a.color||(a.color=g(a,b)),a.disabled?a.color:"#fff")}function r(a,b){return m&&"furious"==o&&a.disengaged?"#eee":a.color||g(a,b)}function s(a,b){return m&&"furious"==o?1:a.disabled?0:1}return p.each(function(b){var g=d-c.left-c.right,p=d3.select(this);a.utils.initSVG(p);var t=p.selectAll("g.nv-legend").data([b]),u=t.enter().append("g").attr("class","nvd3 nv-legend").append("g"),v=t.select("g");t.attr("transform","translate("+c.left+","+c.top+")");var w,x,y=v.selectAll(".nv-series").data(function(a){return"furious"!=o?a:a.filter(function(a){return m?!0:!a.disengaged})}),z=y.enter().append("g").attr("class","nv-series");switch(o){case"furious":x=23;break;case"classic":x=20}if("classic"==o)z.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5),w=y.select("circle");else if("furious"==o){z.append("rect").style("stroke-width",2).attr("class","nv-legend-symbol").attr("rx",3).attr("ry",3),w=y.select(".nv-legend-symbol"),z.append("g").attr("class","nv-check-box").property("innerHTML",'').attr("transform","translate(-10,-8)scale(0.5)");var A=y.select(".nv-check-box");A.each(function(a,b){d3.select(this).selectAll("path").attr("stroke",q(a,b))})}z.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");var B=y.select("text.nv-legend-text");y.on("mouseover",function(a,b){n.legendMouseover(a,b)}).on("mouseout",function(a,b){n.legendMouseout(a,b)}).on("click",function(a,b){n.legendClick(a,b);var c=y.data();if(k){if("classic"==o)l?(c.forEach(function(a){a.disabled=!0}),a.disabled=!1):(a.disabled=!a.disabled,c.every(function(a){return a.disabled})&&c.forEach(function(a){a.disabled=!1}));else if("furious"==o)if(m)a.disengaged=!a.disengaged,a.userDisabled=void 0==a.userDisabled?!!a.disabled:a.userDisabled,a.disabled=a.disengaged||a.userDisabled;else if(!m){a.disabled=!a.disabled,a.userDisabled=a.disabled;var d=c.filter(function(a){return!a.disengaged});d.every(function(a){return a.userDisabled})&&c.forEach(function(a){a.disabled=a.userDisabled=!1})}n.stateChange({disabled:c.map(function(a){return!!a.disabled}),disengaged:c.map(function(a){return!!a.disengaged})})}}).on("dblclick",function(a,b){if(("furious"!=o||!m)&&(n.legendDblclick(a,b),k)){var c=y.data();c.forEach(function(a){a.disabled=!0,"furious"==o&&(a.userDisabled=a.disabled)}),a.disabled=!1,"furious"==o&&(a.userDisabled=a.disabled),n.stateChange({disabled:c.map(function(a){return!!a.disabled})})}}),y.classed("nv-disabled",function(a){return a.userDisabled}),y.exit().remove(),B.attr("fill",q).text(f);var C=0;if(h){var D=[];y.each(function(b,c){var d,e=d3.select(this).select("text");try{if(d=e.node().getComputedTextLength(),0>=d)throw Error()}catch(f){d=a.utils.calcApproxTextWidth(e)}D.push(d+i)});var E=0,F=[];for(C=0;g>C&&Eg&&E>1;){F=[],E--;for(var G=0;G(F[G%E]||0)&&(F[G%E]=D[G]);C=F.reduce(function(a,b,c,d){return a+b})}for(var H=[],I=0,J=0;E>I;I++)H[I]=J,J+=F[I];y.attr("transform",function(a,b){return"translate("+H[b%E]+","+(5+Math.floor(b/E)*x)+")"}),j?v.attr("transform","translate("+(d-c.right-C)+","+c.top+")"):v.attr("transform","translate(0,"+c.top+")"),e=c.top+c.bottom+Math.ceil(D.length/E)*x}else{var K,L=5,M=5,N=0;y.attr("transform",function(a,b){var e=d3.select(this).select("text").node().getComputedTextLength()+i;return K=M,dN&&(N=M),K+N>C&&(C=K+N),"translate("+K+","+L+")"}),v.attr("transform","translate("+(d-c.right-N)+","+c.top+")"),e=c.top+c.bottom+L+15}if("furious"==o){w.attr("width",function(a,b){return B[0][b].getComputedTextLength()+27}).attr("height",18).attr("y",-9).attr("x",-15),u.insert("rect",":first-child").attr("class","nv-legend-bg").attr("fill","#eee").attr("opacity",0);var O=v.select(".nv-legend-bg");O.transition().duration(300).attr("x",-x).attr("width",C+x-12).attr("height",e+10).attr("y",-c.top-10).attr("opacity",m?1:0)}w.style("fill",r).style("fill-opacity",s).style("stroke",r)}),b}var c={top:5,right:0,bottom:5,left:0},d=400,e=20,f=function(a){return a.key},g=a.utils.getColor(),h=!0,i=32,j=!0,k=!0,l=!1,m=!1,n=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),o="classic";return b.dispatch=n,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return d},set:function(a){d=a}},height:{get:function(){return e},set:function(a){e=a}},key:{get:function(){return f},set:function(a){f=a}},align:{get:function(){return h},set:function(a){h=a}},rightAlign:{get:function(){return j},set:function(a){j=a}},padding:{get:function(){return i},set:function(a){i=a}},updateState:{get:function(){return k},set:function(a){k=a}},radioButtonMode:{get:function(){return l},set:function(a){l=a}},expanded:{get:function(){return m},set:function(a){m=a}},vers:{get:function(){return o},set:function(a){o=a}},margin:{get:function(){return c},set:function(a){c.top=void 0!==a.top?a.top:c.top,c.right=void 0!==a.right?a.right:c.right,c.bottom=void 0!==a.bottom?a.bottom:c.bottom,c.left=void 0!==a.left?a.left:c.left}},color:{get:function(){return g},set:function(b){g=a.utils.getColor(b)}}}),a.utils.initOptions(b),b},a.models.line=function(){"use strict";function b(r){return v.reset(),v.models(e),r.each(function(b){i=d3.select(this);var r=a.utils.availableWidth(g,i,f),s=a.utils.availableHeight(h,i,f);a.utils.initSVG(i),c=e.xScale(),d=e.yScale(),t=t||c,u=u||d;var w=i.selectAll("g.nv-wrap.nv-line").data([b]),x=w.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),y=x.append("defs"),z=x.append("g"),A=w.select("g");z.append("g").attr("class","nv-groups"),z.append("g").attr("class","nv-scatterWrap"),w.attr("transform","translate("+f.left+","+f.top+")"),e.width(r).height(s);var B=w.select(".nv-scatterWrap");B.call(e),y.append("clipPath").attr("id","nv-edge-clip-"+e.id()).append("rect"),w.select("#nv-edge-clip-"+e.id()+" rect").attr("width",r).attr("height",s>0?s:0),A.attr("clip-path",p?"url(#nv-edge-clip-"+e.id()+")":""),B.attr("clip-path",p?"url(#nv-edge-clip-"+e.id()+")":"");var C=w.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});C.enter().append("g").style("stroke-opacity",1e-6).style("stroke-width",function(a){return a.strokeWidth||j}).style("fill-opacity",1e-6),C.exit().remove(),C.attr("class",function(a,b){return(a.classed||"")+" nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return k(a,b)}).style("stroke",function(a,b){return k(a,b)}),C.watchTransition(v,"line: groups").style("stroke-opacity",1).style("fill-opacity",function(a){return a.fillOpacity||.5});var D=C.selectAll("path.nv-area").data(function(a){return o(a)?[a]:[]});D.enter().append("path").attr("class","nv-area").attr("d",function(b){return d3.svg.area().interpolate(q).defined(n).x(function(b,c){return a.utils.NaNtoZero(t(l(b,c)))}).y0(function(b,c){return a.utils.NaNtoZero(u(m(b,c)))}).y1(function(a,b){return u(d.domain()[0]<=0?d.domain()[1]>=0?0:d.domain()[1]:d.domain()[0])}).apply(this,[b.values])}),C.exit().selectAll("path.nv-area").remove(),D.watchTransition(v,"line: areaPaths").attr("d",function(b){return d3.svg.area().interpolate(q).defined(n).x(function(b,d){return a.utils.NaNtoZero(c(l(b,d)))}).y0(function(b,c){return a.utils.NaNtoZero(d(m(b,c)))}).y1(function(a,b){return d(d.domain()[0]<=0?d.domain()[1]>=0?0:d.domain()[1]:d.domain()[0])}).apply(this,[b.values])});var E=C.selectAll("path.nv-line").data(function(a){return[a.values]});E.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(q).defined(n).x(function(b,c){return a.utils.NaNtoZero(t(l(b,c)))}).y(function(b,c){return a.utils.NaNtoZero(u(m(b,c)))})),E.watchTransition(v,"line: linePaths").attr("d",d3.svg.line().interpolate(q).defined(n).x(function(b,d){return a.utils.NaNtoZero(c(l(b,d)))}).y(function(b,c){return a.utils.NaNtoZero(d(m(b,c)))})),t=c.copy(),u=d.copy()}),v.renderEnd("line immediate"),b}var c,d,e=a.models.scatter(),f={top:0,right:0,bottom:0,left:0},g=960,h=500,i=null,j=1.5,k=a.utils.defaultColor(),l=function(a){return a.x},m=function(a){return a.y},n=function(a,b){return!isNaN(m(a,b))&&null!==m(a,b)},o=function(a){return a.area},p=!1,q="linear",r=250,s=d3.dispatch("elementClick","elementMouseover","elementMouseout","renderEnd");e.pointSize(16).pointDomain([16,256]);var t,u,v=a.utils.renderWatch(s,r);return b.dispatch=s,b.scatter=e,e.dispatch.on("elementClick",function(){s.elementClick.apply(this,arguments)}),e.dispatch.on("elementMouseover",function(){s.elementMouseover.apply(this,arguments)}),e.dispatch.on("elementMouseout",function(){s.elementMouseout.apply(this,arguments)}),b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return g},set:function(a){g=a}},height:{get:function(){return h},set:function(a){h=a}},defined:{get:function(){return n},set:function(a){n=a}},interpolate:{get:function(){return q},set:function(a){q=a}},clipEdge:{get:function(){return p},set:function(a){p=a}},margin:{get:function(){return f},set:function(a){f.top=void 0!==a.top?a.top:f.top,f.right=void 0!==a.right?a.right:f.right,f.bottom=void 0!==a.bottom?a.bottom:f.bottom,f.left=void 0!==a.left?a.left:f.left}},duration:{get:function(){return r},set:function(a){r=a,v.reset(r),e.duration(r)}},isArea:{get:function(){return o},set:function(a){o=d3.functor(a)}},x:{get:function(){return l},set:function(a){l=a,e.x(a)}},y:{get:function(){return m},set:function(a){m=a,e.y(a)}},color:{get:function(){return k},set:function(b){k=a.utils.getColor(b),e.color(k)}}}),a.utils.inheritOptions(b,e),a.utils.initOptions(b),b},a.models.lineChart=function(){"use strict";function b(j){return y.reset(),y.models(e), -p&&y.models(f),q&&y.models(g),j.each(function(j){var v=d3.select(this),y=this;a.utils.initSVG(v);var B=a.utils.availableWidth(m,v,k),C=a.utils.availableHeight(n,v,k);if(b.update=function(){0===x?v.call(b):v.transition().duration(x).call(b)},b.container=this,t.setter(A(j),b.update).getter(z(j)).update(),t.disabled=j.map(function(a){return!!a.disabled}),!u){var D;u={};for(D in t)t[D]instanceof Array?u[D]=t[D].slice(0):u[D]=t[D]}if(!(j&&j.length&&j.filter(function(a){return a.values.length}).length))return a.utils.noData(b,v),b;v.selectAll(".nv-noData").remove(),c=e.xScale(),d=e.yScale();var E=v.selectAll("g.nv-wrap.nv-lineChart").data([j]),F=E.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),G=E.select("g");F.append("rect").style("opacity",0),F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y nv-axis"),F.append("g").attr("class","nv-linesWrap"),F.append("g").attr("class","nv-legendWrap"),F.append("g").attr("class","nv-interactive"),G.select("rect").attr("width",B).attr("height",C>0?C:0),o&&(h.width(B),G.select(".nv-legendWrap").datum(j).call(h),k.top!=h.height()&&(k.top=h.height(),C=a.utils.availableHeight(n,v,k)),E.select(".nv-legendWrap").attr("transform","translate(0,"+-k.top+")")),E.attr("transform","translate("+k.left+","+k.top+")"),r&&G.select(".nv-y.nv-axis").attr("transform","translate("+B+",0)"),s&&(i.width(B).height(C).margin({left:k.left,top:k.top}).svgContainer(v).xScale(c),E.select(".nv-interactive").call(i)),e.width(B).height(C).color(j.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!j[b].disabled}));var H=G.select(".nv-linesWrap").datum(j.filter(function(a){return!a.disabled}));H.call(e),p&&(f.scale(c)._ticks(a.utils.calcTicksX(B/100,j)).tickSize(-C,0),G.select(".nv-x.nv-axis").attr("transform","translate(0,"+d.range()[0]+")"),G.select(".nv-x.nv-axis").call(f)),q&&(g.scale(d)._ticks(a.utils.calcTicksY(C/36,j)).tickSize(-B,0),G.select(".nv-y.nv-axis").call(g)),h.dispatch.on("stateChange",function(a){for(var c in a)t[c]=a[c];w.stateChange(t),b.update()}),i.dispatch.on("elementMousemove",function(c){e.clearHighlights();var d,h,m,n=[];if(j.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(f,g){h=a.interactiveBisect(f.values,c.pointXValue,b.x());var i=f.values[h],j=b.y()(i,h);null!=j&&e.highlightPoint(g,h,!0),void 0!==i&&(void 0===d&&(d=i),void 0===m&&(m=b.xScale()(b.x()(i,h))),n.push({key:f.key,value:j,color:l(f,f.seriesIndex)}))}),n.length>2){var o=b.yScale().invert(c.mouseY),p=Math.abs(b.yScale().domain()[0]-b.yScale().domain()[1]),q=.03*p,r=a.nearestValueIndex(n.map(function(a){return a.value}),o,q);null!==r&&(n[r].highlight=!0)}var s=f.tickFormat()(b.x()(d,h));i.tooltip.position({left:c.mouseX+k.left,top:c.mouseY+k.top}).chartContainer(y.parentNode).valueFormatter(function(a,b){return null==a?"N/A":g.tickFormat()(a)}).data({value:s,index:h,series:n})(),i.renderGuideLine(m)}),i.dispatch.on("elementClick",function(c){var d,f=[];j.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(e){var g=a.interactiveBisect(e.values,c.pointXValue,b.x()),h=e.values[g];if("undefined"!=typeof h){"undefined"==typeof d&&(d=b.xScale()(b.x()(h,g)));var i=b.yScale()(b.y()(h,g));f.push({point:h,pointIndex:g,pos:[d,i],seriesIndex:e.seriesIndex,series:e})}}),e.dispatch.elementClick(f)}),i.dispatch.on("elementMouseout",function(a){e.clearHighlights()}),w.on("changeState",function(a){"undefined"!=typeof a.disabled&&j.length===a.disabled.length&&(j.forEach(function(b,c){b.disabled=a.disabled[c]}),t.disabled=a.disabled),b.update()})}),y.renderEnd("lineChart immediate"),b}var c,d,e=a.models.line(),f=a.models.axis(),g=a.models.axis(),h=a.models.legend(),i=a.interactiveGuideline(),j=a.models.tooltip(),k={top:30,right:20,bottom:50,left:60},l=a.utils.defaultColor(),m=null,n=null,o=!0,p=!0,q=!0,r=!1,s=!1,t=a.utils.state(),u=null,v=null,w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState","renderEnd"),x=250;f.orient("bottom").tickPadding(7),g.orient(r?"right":"left"),j.valueFormatter(function(a,b){return g.tickFormat()(a,b)}).headerFormatter(function(a,b){return f.tickFormat()(a,b)});var y=a.utils.renderWatch(w,x),z=function(a){return function(){return{active:a.map(function(a){return!a.disabled})}}},A=function(a){return function(b){void 0!==b.active&&a.forEach(function(a,c){a.disabled=!b.active[c]})}};return e.dispatch.on("elementMouseover.tooltip",function(a){j.data(a).position(a.pos).hidden(!1)}),e.dispatch.on("elementMouseout.tooltip",function(a){j.hidden(!0)}),b.dispatch=w,b.lines=e,b.legend=h,b.xAxis=f,b.yAxis=g,b.interactiveLayer=i,b.tooltip=j,b.dispatch=w,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return m},set:function(a){m=a}},height:{get:function(){return n},set:function(a){n=a}},showLegend:{get:function(){return o},set:function(a){o=a}},showXAxis:{get:function(){return p},set:function(a){p=a}},showYAxis:{get:function(){return q},set:function(a){q=a}},defaultState:{get:function(){return u},set:function(a){u=a}},noData:{get:function(){return v},set:function(a){v=a}},tooltips:{get:function(){return j.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),j.enabled(!!b)}},tooltipContent:{get:function(){return j.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),j.contentGenerator(b)}},margin:{get:function(){return k},set:function(a){k.top=void 0!==a.top?a.top:k.top,k.right=void 0!==a.right?a.right:k.right,k.bottom=void 0!==a.bottom?a.bottom:k.bottom,k.left=void 0!==a.left?a.left:k.left}},duration:{get:function(){return x},set:function(a){x=a,y.reset(x),e.duration(x),f.duration(x),g.duration(x)}},color:{get:function(){return l},set:function(b){l=a.utils.getColor(b),h.color(l),e.color(l)}},rightAlignYAxis:{get:function(){return r},set:function(a){r=a,g.orient(r?"right":"left")}},useInteractiveGuideline:{get:function(){return s},set:function(a){s=a,s&&(e.interactive(!1),e.useVoronoi(!1))}}}),a.utils.inheritOptions(b,e),a.utils.initOptions(b),b},a.models.linePlusBarChart=function(){"use strict";function b(v){return v.each(function(v){function J(a){var b=+("e"==a),c=b?1:-1,d=X/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"ZM"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)}function S(){u.empty()||u.extent(I),ka.data([u.empty()?e.domain():I]).each(function(a,b){var c=e(a[0])-e.range()[0],d=e.range()[1]-e(a[1]);d3.select(this).select(".left").attr("width",0>c?0:c),d3.select(this).select(".right").attr("x",e(a[1])).attr("width",0>d?0:d)})}function T(){I=u.empty()?null:u.extent(),c=u.empty()?e.domain():u.extent(),K.brush({extent:c,brush:u}),S(),l.width(V).height(W).color(v.map(function(a,b){return a.color||C(a,b)}).filter(function(a,b){return!v[b].disabled&&v[b].bar})),j.width(V).height(W).color(v.map(function(a,b){return a.color||C(a,b)}).filter(function(a,b){return!v[b].disabled&&!v[b].bar}));var b=da.select(".nv-focus .nv-barsWrap").datum(Z.length?Z.map(function(a,b){return{key:a.key,values:a.values.filter(function(a,b){return l.x()(a,b)>=c[0]&&l.x()(a,b)<=c[1]})}}):[{values:[]}]),h=da.select(".nv-focus .nv-linesWrap").datum($[0].disabled?[{values:[]}]:$.map(function(a,b){return{area:a.area,fillOpacity:a.fillOpacity,key:a.key,values:a.values.filter(function(a,b){return j.x()(a,b)>=c[0]&&j.x()(a,b)<=c[1]})}}));d=Z.length?l.xScale():j.xScale(),n.scale(d)._ticks(a.utils.calcTicksX(V/100,v)).tickSize(-W,0),n.domain([Math.ceil(c[0]),Math.floor(c[1])]),da.select(".nv-x.nv-axis").transition().duration(L).call(n),b.transition().duration(L).call(l),h.transition().duration(L).call(j),da.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+f.range()[0]+")"),p.scale(f)._ticks(a.utils.calcTicksY(W/36,v)).tickSize(-V,0),q.scale(g)._ticks(a.utils.calcTicksY(W/36,v)).tickSize(Z.length?0:-V,0),da.select(".nv-focus .nv-y1.nv-axis").style("opacity",Z.length?1:0),da.select(".nv-focus .nv-y2.nv-axis").style("opacity",$.length&&!$[0].disabled?1:0).attr("transform","translate("+d.range()[1]+",0)"),da.select(".nv-focus .nv-y1.nv-axis").transition().duration(L).call(p),da.select(".nv-focus .nv-y2.nv-axis").transition().duration(L).call(q)}var U=d3.select(this);a.utils.initSVG(U);var V=a.utils.availableWidth(y,U,w),W=a.utils.availableHeight(z,U,w)-(E?H:0),X=H-x.top-x.bottom;if(b.update=function(){U.transition().duration(L).call(b)},b.container=this,M.setter(R(v),b.update).getter(Q(v)).update(),M.disabled=v.map(function(a){return!!a.disabled}),!N){var Y;N={};for(Y in M)M[Y]instanceof Array?N[Y]=M[Y].slice(0):N[Y]=M[Y]}if(!(v&&v.length&&v.filter(function(a){return a.values.length}).length))return a.utils.noData(b,U),b;U.selectAll(".nv-noData").remove();var Z=v.filter(function(a){return!a.disabled&&a.bar}),$=v.filter(function(a){return!a.bar});d=l.xScale(),e=o.scale(),f=l.yScale(),g=j.yScale(),h=m.yScale(),i=k.yScale();var _=v.filter(function(a){return!a.disabled&&a.bar}).map(function(a){return a.values.map(function(a,b){return{x:A(a,b),y:B(a,b)}})}),aa=v.filter(function(a){return!a.disabled&&!a.bar}).map(function(a){return a.values.map(function(a,b){return{x:A(a,b),y:B(a,b)}})});d.range([0,V]),e.domain(d3.extent(d3.merge(_.concat(aa)),function(a){return a.x})).range([0,V]);var ba=U.selectAll("g.nv-wrap.nv-linePlusBar").data([v]),ca=ba.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),da=ba.select("g");ca.append("g").attr("class","nv-legendWrap");var ea=ca.append("g").attr("class","nv-focus");ea.append("g").attr("class","nv-x nv-axis"),ea.append("g").attr("class","nv-y1 nv-axis"),ea.append("g").attr("class","nv-y2 nv-axis"),ea.append("g").attr("class","nv-barsWrap"),ea.append("g").attr("class","nv-linesWrap");var fa=ca.append("g").attr("class","nv-context");if(fa.append("g").attr("class","nv-x nv-axis"),fa.append("g").attr("class","nv-y1 nv-axis"),fa.append("g").attr("class","nv-y2 nv-axis"),fa.append("g").attr("class","nv-barsWrap"),fa.append("g").attr("class","nv-linesWrap"),fa.append("g").attr("class","nv-brushBackground"),fa.append("g").attr("class","nv-x nv-brush"),D){var ga=t.align()?V/2:V,ha=t.align()?ga:0;t.width(ga),da.select(".nv-legendWrap").datum(v.map(function(a){return a.originalKey=void 0===a.originalKey?a.key:a.originalKey,a.key=a.originalKey+(a.bar?O:P),a})).call(t),w.top!=t.height()&&(w.top=t.height(),W=a.utils.availableHeight(z,U,w)-H),da.select(".nv-legendWrap").attr("transform","translate("+ha+","+-w.top+")")}ba.attr("transform","translate("+w.left+","+w.top+")"),da.select(".nv-context").style("display",E?"initial":"none"),m.width(V).height(X).color(v.map(function(a,b){return a.color||C(a,b)}).filter(function(a,b){return!v[b].disabled&&v[b].bar})),k.width(V).height(X).color(v.map(function(a,b){return a.color||C(a,b)}).filter(function(a,b){return!v[b].disabled&&!v[b].bar}));var ia=da.select(".nv-context .nv-barsWrap").datum(Z.length?Z:[{values:[]}]),ja=da.select(".nv-context .nv-linesWrap").datum($[0].disabled?[{values:[]}]:$);da.select(".nv-context").attr("transform","translate(0,"+(W+w.bottom+x.top)+")"),ia.transition().call(m),ja.transition().call(k),G&&(o._ticks(a.utils.calcTicksX(V/100,v)).tickSize(-X,0),da.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+h.range()[0]+")"),da.select(".nv-context .nv-x.nv-axis").transition().call(o)),F&&(r.scale(h)._ticks(X/36).tickSize(-V,0),s.scale(i)._ticks(X/36).tickSize(Z.length?0:-V,0),da.select(".nv-context .nv-y3.nv-axis").style("opacity",Z.length?1:0).attr("transform","translate(0,"+e.range()[0]+")"),da.select(".nv-context .nv-y2.nv-axis").style("opacity",$.length?1:0).attr("transform","translate("+e.range()[1]+",0)"),da.select(".nv-context .nv-y1.nv-axis").transition().call(r),da.select(".nv-context .nv-y2.nv-axis").transition().call(s)),u.x(e).on("brush",T),I&&u.extent(I);var ka=da.select(".nv-brushBackground").selectAll("g").data([I||u.extent()]),la=ka.enter().append("g");la.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",X),la.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",X);var ma=da.select(".nv-x.nv-brush").call(u);ma.selectAll("rect").attr("height",X),ma.selectAll(".resize").append("path").attr("d",J),t.dispatch.on("stateChange",function(a){for(var c in a)M[c]=a[c];K.stateChange(M),b.update()}),K.on("changeState",function(a){"undefined"!=typeof a.disabled&&(v.forEach(function(b,c){b.disabled=a.disabled[c]}),M.disabled=a.disabled),b.update()}),T()}),b}var c,d,e,f,g,h,i,j=a.models.line(),k=a.models.line(),l=a.models.historicalBar(),m=a.models.historicalBar(),n=a.models.axis(),o=a.models.axis(),p=a.models.axis(),q=a.models.axis(),r=a.models.axis(),s=a.models.axis(),t=a.models.legend(),u=d3.svg.brush(),v=a.models.tooltip(),w={top:30,right:30,bottom:30,left:60},x={top:0,right:30,bottom:20,left:60},y=null,z=null,A=function(a){return a.x},B=function(a){return a.y},C=a.utils.defaultColor(),D=!0,E=!0,F=!1,G=!0,H=50,I=null,J=null,K=d3.dispatch("brush","stateChange","changeState"),L=0,M=a.utils.state(),N=null,O=" (left axis)",P=" (right axis)";j.clipEdge(!0),k.interactive(!1),n.orient("bottom").tickPadding(5),p.orient("left"),q.orient("right"),o.orient("bottom").tickPadding(5),r.orient("left"),s.orient("right"),v.headerEnabled(!0).headerFormatter(function(a,b){return n.tickFormat()(a,b)});var Q=function(a){return function(){return{active:a.map(function(a){return!a.disabled})}}},R=function(a){return function(b){void 0!==b.active&&a.forEach(function(a,c){a.disabled=!b.active[c]})}};return j.dispatch.on("elementMouseover.tooltip",function(a){v.duration(100).valueFormatter(function(a,b){return q.tickFormat()(a,b)}).data(a).position(a.pos).hidden(!1)}),j.dispatch.on("elementMouseout.tooltip",function(a){v.hidden(!0)}),l.dispatch.on("elementMouseover.tooltip",function(a){a.value=b.x()(a.data),a.series={value:b.y()(a.data),color:a.color},v.duration(0).valueFormatter(function(a,b){return p.tickFormat()(a,b)}).data(a).hidden(!1)}),l.dispatch.on("elementMouseout.tooltip",function(a){v.hidden(!0)}),l.dispatch.on("elementMousemove.tooltip",function(a){v.position({top:d3.event.pageY,left:d3.event.pageX})()}),b.dispatch=K,b.legend=t,b.lines=j,b.lines2=k,b.bars=l,b.bars2=m,b.xAxis=n,b.x2Axis=o,b.y1Axis=p,b.y2Axis=q,b.y3Axis=r,b.y4Axis=s,b.tooltip=v,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return y},set:function(a){y=a}},height:{get:function(){return z},set:function(a){z=a}},showLegend:{get:function(){return D},set:function(a){D=a}},brushExtent:{get:function(){return I},set:function(a){I=a}},noData:{get:function(){return J},set:function(a){J=a}},focusEnable:{get:function(){return E},set:function(a){E=a}},focusHeight:{get:function(){return H},set:function(a){H=a}},focusShowAxisX:{get:function(){return G},set:function(a){G=a}},focusShowAxisY:{get:function(){return F},set:function(a){F=a}},legendLeftAxisHint:{get:function(){return O},set:function(a){O=a}},legendRightAxisHint:{get:function(){return P},set:function(a){P=a}},tooltips:{get:function(){return v.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),v.enabled(!!b)}},tooltipContent:{get:function(){return v.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),v.contentGenerator(b)}},margin:{get:function(){return w},set:function(a){w.top=void 0!==a.top?a.top:w.top,w.right=void 0!==a.right?a.right:w.right,w.bottom=void 0!==a.bottom?a.bottom:w.bottom,w.left=void 0!==a.left?a.left:w.left}},duration:{get:function(){return L},set:function(a){L=a}},color:{get:function(){return C},set:function(b){C=a.utils.getColor(b),t.color(C)}},x:{get:function(){return A},set:function(a){A=a,j.x(a),k.x(a),l.x(a),m.x(a)}},y:{get:function(){return B},set:function(a){B=a,j.y(a),k.y(a),l.y(a),m.y(a)}}}),a.utils.inheritOptions(b,j),a.utils.initOptions(b),b},a.models.lineWithFocusChart=function(){"use strict";function b(o){return o.each(function(o){function z(a){var b=+("e"==a),c=b?1:-1,d=M/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"ZM"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)}function G(){n.empty()||n.extent(y),U.data([n.empty()?e.domain():y]).each(function(a,b){var d=e(a[0])-c.range()[0],f=K-e(a[1]);d3.select(this).select(".left").attr("width",0>d?0:d),d3.select(this).select(".right").attr("x",e(a[1])).attr("width",0>f?0:f)})}function H(){y=n.empty()?null:n.extent();var a=n.empty()?e.domain():n.extent();if(!(Math.abs(a[0]-a[1])<=1)){A.brush({extent:a,brush:n}),G();var b=Q.select(".nv-focus .nv-linesWrap").datum(o.filter(function(a){return!a.disabled}).map(function(b,c){return{key:b.key,area:b.area,values:b.values.filter(function(b,c){return g.x()(b,c)>=a[0]&&g.x()(b,c)<=a[1]})}}));b.transition().duration(B).call(g),Q.select(".nv-focus .nv-x.nv-axis").transition().duration(B).call(i),Q.select(".nv-focus .nv-y.nv-axis").transition().duration(B).call(j)}}var I=d3.select(this),J=this;a.utils.initSVG(I);var K=a.utils.availableWidth(t,I,q),L=a.utils.availableHeight(u,I,q)-v,M=v-r.top-r.bottom;if(b.update=function(){I.transition().duration(B).call(b)},b.container=this,C.setter(F(o),b.update).getter(E(o)).update(),C.disabled=o.map(function(a){return!!a.disabled}),!D){var N;D={};for(N in C)C[N]instanceof Array?D[N]=C[N].slice(0):D[N]=C[N]}if(!(o&&o.length&&o.filter(function(a){return a.values.length}).length))return a.utils.noData(b,I),b;I.selectAll(".nv-noData").remove(),c=g.xScale(),d=g.yScale(),e=h.xScale(),f=h.yScale();var O=I.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([o]),P=O.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),Q=O.select("g");P.append("g").attr("class","nv-legendWrap");var R=P.append("g").attr("class","nv-focus");R.append("g").attr("class","nv-x nv-axis"),R.append("g").attr("class","nv-y nv-axis"),R.append("g").attr("class","nv-linesWrap"),R.append("g").attr("class","nv-interactive");var S=P.append("g").attr("class","nv-context");S.append("g").attr("class","nv-x nv-axis"),S.append("g").attr("class","nv-y nv-axis"),S.append("g").attr("class","nv-linesWrap"),S.append("g").attr("class","nv-brushBackground"),S.append("g").attr("class","nv-x nv-brush"),x&&(m.width(K),Q.select(".nv-legendWrap").datum(o).call(m),q.top!=m.height()&&(q.top=m.height(),L=a.utils.availableHeight(u,I,q)-v),Q.select(".nv-legendWrap").attr("transform","translate(0,"+-q.top+")")),O.attr("transform","translate("+q.left+","+q.top+")"),w&&(p.width(K).height(L).margin({left:q.left,top:q.top}).svgContainer(I).xScale(c),O.select(".nv-interactive").call(p)),g.width(K).height(L).color(o.map(function(a,b){return a.color||s(a,b)}).filter(function(a,b){return!o[b].disabled})),h.defined(g.defined()).width(K).height(M).color(o.map(function(a,b){return a.color||s(a,b)}).filter(function(a,b){return!o[b].disabled})),Q.select(".nv-context").attr("transform","translate(0,"+(L+q.bottom+r.top)+")");var T=Q.select(".nv-context .nv-linesWrap").datum(o.filter(function(a){return!a.disabled}));d3.transition(T).call(h),i.scale(c)._ticks(a.utils.calcTicksX(K/100,o)).tickSize(-L,0),j.scale(d)._ticks(a.utils.calcTicksY(L/36,o)).tickSize(-K,0),Q.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+L+")"),n.x(e).on("brush",function(){H()}),y&&n.extent(y);var U=Q.select(".nv-brushBackground").selectAll("g").data([y||n.extent()]),V=U.enter().append("g");V.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",M),V.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",M);var W=Q.select(".nv-x.nv-brush").call(n);W.selectAll("rect").attr("height",M),W.selectAll(".resize").append("path").attr("d",z),H(),k.scale(e)._ticks(a.utils.calcTicksX(K/100,o)).tickSize(-M,0),Q.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+f.range()[0]+")"),d3.transition(Q.select(".nv-context .nv-x.nv-axis")).call(k),l.scale(f)._ticks(a.utils.calcTicksY(M/36,o)).tickSize(-K,0),d3.transition(Q.select(".nv-context .nv-y.nv-axis")).call(l),Q.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+f.range()[0]+")"),m.dispatch.on("stateChange",function(a){for(var c in a)C[c]=a[c];A.stateChange(C),b.update()}),p.dispatch.on("elementMousemove",function(c){g.clearHighlights();var d,f,h,k=[];if(o.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(i,j){var l=n.empty()?e.domain():n.extent(),m=i.values.filter(function(a,b){return g.x()(a,b)>=l[0]&&g.x()(a,b)<=l[1]});f=a.interactiveBisect(m,c.pointXValue,g.x());var o=m[f],p=b.y()(o,f);null!=p&&g.highlightPoint(j,f,!0),void 0!==o&&(void 0===d&&(d=o),void 0===h&&(h=b.xScale()(b.x()(o,f))),k.push({key:i.key,value:b.y()(o,f),color:s(i,i.seriesIndex)}))}),k.length>2){var l=b.yScale().invert(c.mouseY),m=Math.abs(b.yScale().domain()[0]-b.yScale().domain()[1]),r=.03*m,t=a.nearestValueIndex(k.map(function(a){return a.value}),l,r);null!==t&&(k[t].highlight=!0)}var u=i.tickFormat()(b.x()(d,f));p.tooltip.position({left:c.mouseX+q.left,top:c.mouseY+q.top}).chartContainer(J.parentNode).valueFormatter(function(a,b){return null==a?"N/A":j.tickFormat()(a)}).data({value:u,index:f,series:k})(),p.renderGuideLine(h)}),p.dispatch.on("elementMouseout",function(a){g.clearHighlights()}),A.on("changeState",function(a){"undefined"!=typeof a.disabled&&o.forEach(function(b,c){b.disabled=a.disabled[c]}),b.update()})}),b}var c,d,e,f,g=a.models.line(),h=a.models.line(),i=a.models.axis(),j=a.models.axis(),k=a.models.axis(),l=a.models.axis(),m=a.models.legend(),n=d3.svg.brush(),o=a.models.tooltip(),p=a.interactiveGuideline(),q={top:30,right:30,bottom:30,left:60},r={top:0,right:30,bottom:20,left:60},s=a.utils.defaultColor(),t=null,u=null,v=50,w=!1,x=!0,y=null,z=null,A=d3.dispatch("brush","stateChange","changeState"),B=250,C=a.utils.state(),D=null;g.clipEdge(!0).duration(0),h.interactive(!1),i.orient("bottom").tickPadding(5),j.orient("left"),k.orient("bottom").tickPadding(5),l.orient("left"),o.valueFormatter(function(a,b){return j.tickFormat()(a,b)}).headerFormatter(function(a,b){return i.tickFormat()(a,b)});var E=function(a){return function(){return{active:a.map(function(a){return!a.disabled})}}},F=function(a){return function(b){void 0!==b.active&&a.forEach(function(a,c){a.disabled=!b.active[c]})}};return g.dispatch.on("elementMouseover.tooltip",function(a){o.data(a).position(a.pos).hidden(!1)}),g.dispatch.on("elementMouseout.tooltip",function(a){o.hidden(!0)}),b.dispatch=A,b.legend=m,b.lines=g,b.lines2=h,b.xAxis=i,b.yAxis=j,b.x2Axis=k,b.y2Axis=l,b.interactiveLayer=p,b.tooltip=o,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return t},set:function(a){t=a}},height:{get:function(){return u},set:function(a){u=a}},focusHeight:{get:function(){return v},set:function(a){v=a}},showLegend:{get:function(){return x},set:function(a){x=a}},brushExtent:{get:function(){return y},set:function(a){y=a}},defaultState:{get:function(){return D},set:function(a){D=a}},noData:{get:function(){return z},set:function(a){z=a}},tooltips:{get:function(){return o.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),o.enabled(!!b)}},tooltipContent:{get:function(){return o.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),o.contentGenerator(b)}},margin:{get:function(){return q},set:function(a){q.top=void 0!==a.top?a.top:q.top,q.right=void 0!==a.right?a.right:q.right,q.bottom=void 0!==a.bottom?a.bottom:q.bottom,q.left=void 0!==a.left?a.left:q.left}},color:{get:function(){return s},set:function(b){s=a.utils.getColor(b),m.color(s)}},interpolate:{get:function(){return g.interpolate()},set:function(a){g.interpolate(a),h.interpolate(a)}},xTickFormat:{get:function(){return i.tickFormat()},set:function(a){i.tickFormat(a),k.tickFormat(a)}},yTickFormat:{get:function(){return j.tickFormat()},set:function(a){j.tickFormat(a),l.tickFormat(a)}},duration:{get:function(){return B},set:function(a){B=a,j.duration(B),l.duration(B),i.duration(B),k.duration(B)}},x:{get:function(){return g.x()},set:function(a){g.x(a),h.x(a)}},y:{get:function(){return g.y()},set:function(a){g.y(a),h.y(a)}},useInteractiveGuideline:{get:function(){return w},set:function(a){w=a,w&&(g.interactive(!1),g.useVoronoi(!1))}}}),a.utils.inheritOptions(b,g),a.utils.initOptions(b),b},a.models.multiBar=function(){"use strict";function b(G){return E.reset(),G.each(function(b){var G=k-j.left-j.right,H=l-j.top-j.bottom;p=d3.select(this),a.utils.initSVG(p);var I=0;if(z&&b.length&&(z=[{values:b[0].values.map(function(a){return{x:a.x,y:0,series:a.series,size:.01}})}]),v){var J=d3.layout.stack().offset(w).values(function(a){return a.values}).y(r)(!b.length&&z?z:b);J.forEach(function(a,c){a.nonStackable?(b[c].nonStackableSeries=I++,J[c]=b[c]):c>0&&J[c-1].nonStackable&&J[c].values.map(function(a,b){a.y0-=J[c-1].values[b].y,a.y1=a.y0+a.y})}),b=J}b.forEach(function(a,b){a.values.forEach(function(c){c.series=b,c.key=a.key})}),v&&b[0].values.map(function(a,c){var d=0,e=0;b.map(function(a,f){if(!b[f].nonStackable){var g=a.values[c];g.size=Math.abs(g.y),g.y<0?(g.y1=e,e-=g.size):(g.y1=g.size+d,d+=g.size)}})});var K=d&&e?[]:b.map(function(a,b){return a.values.map(function(a,c){return{x:q(a,c),y:r(a,c),y0:a.y0,y1:a.y1,idx:b,yErr:s(a,c)}})});m.domain(d||d3.merge(K).map(function(a){return a.x})).rangeBands(f||[0,G],C),n.domain(e||d3.extent(d3.merge(d3.merge(K).map(function(a){var c=a.y;v&&!b[a.idx].nonStackable&&(c=a.y>0?a.y1:a.y1+a.y);var d=a.yErr;return d?d.length?[c+d[0],c+d[1]]:(d=Math.abs(d),[c-d,c+d]):[c]})).concat(t))).range(g||[H,0]),m.domain()[0]===m.domain()[1]&&(m.domain()[0]?m.domain([m.domain()[0]-.01*m.domain()[0],m.domain()[1]+.01*m.domain()[1]]):m.domain([-1,1])),n.domain()[0]===n.domain()[1]&&(n.domain()[0]?n.domain([n.domain()[0]+.01*n.domain()[0],n.domain()[1]-.01*n.domain()[1]]):n.domain([-1,1])),h=h||m,i=i||n;var L=p.selectAll("g.nv-wrap.nv-multibar").data([b]),M=L.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),N=M.append("defs"),O=M.append("g"),P=L.select("g");O.append("g").attr("class","nv-groups"),L.attr("transform","translate("+j.left+","+j.top+")"),N.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect"),L.select("#nv-edge-clip-"+o+" rect").attr("width",G).attr("height",H),P.attr("clip-path",u?"url(#nv-edge-clip-"+o+")":"");var Q=L.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a,b){return b});Q.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);var R=E.transition(Q.exit().selectAll("g.nv-bar"),"multibarExit",Math.min(100,B)).attr("y",function(a,c,d){var e=i(0)||0;return v&&b[a.series]&&!b[a.series].nonStackable&&(e=i(a.y0)),e}).attr("height",0).remove();R.delay&&R.delay(function(a,b){var c=b*(B/(F+1))-b;return c}),Q.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return x(a,b)}).style("stroke",function(a,b){return x(a,b)}),Q.style("stroke-opacity",1).style("fill-opacity",.75);var S=Q.selectAll("g.nv-bar").data(function(a){return z&&!b.length?z.values:a.values});S.exit().remove();var T=S.enter().append("g").attr("class",function(a,b){return r(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(a,c,d){var e=v&&!b[d].nonStackable?0:d*m.rangeBand()/b.length,f=i(v&&!b[d].nonStackable?a.y0:0)||0;return"translate("+e+","+f+")"});T.append("rect").attr("height",0).attr("width",function(a,c,d){return m.rangeBand()/(v&&!b[d].nonStackable?1:b.length)}).style("fill",function(a,b,c){return x(a,c,b)}).style("stroke",function(a,b,c){return x(a,c,b)}),S.on("mouseover",function(a,b){d3.select(this).classed("hover",!0),D.elementMouseover({data:a,index:b,color:d3.select(this).style("fill")})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),D.elementMouseout({data:a,index:b,color:d3.select(this).style("fill")})}).on("mousemove",function(a,b){D.elementMousemove({data:a,index:b,color:d3.select(this).style("fill")})}).on("click",function(a,b){D.elementClick({data:a,index:b,color:d3.select(this).style("fill")}),d3.event.stopPropagation()}).on("dblclick",function(a,b){D.elementDblClick({data:a,index:b,color:d3.select(this).style("fill")}),d3.event.stopPropagation()}),s(b[0].values[0],0)&&(T.append("polyline"),S.select("polyline").attr("fill","none").attr("stroke",function(a,b,c){return y(a,c,b)}).attr("points",function(a,c){var d=s(a,c),e=.8*m.rangeBand()/(2*(v?1:b.length));d=d.length?d:[-Math.abs(d),Math.abs(d)],d=d.map(function(a){return n(a)-n(0)});var f=[[-e,d[0]],[e,d[0]],[0,d[0]],[0,d[1]],[-e,d[1]],[e,d[1]]];return f.map(function(a){return a.join(",")}).join(" ")}).attr("transform",function(a,c){var d=m.rangeBand()/(2*(v?1:b.length)),e=r(a,c)<0?n(r(a,c))-n(0):0;return"translate("+d+", "+e+")"})),S.attr("class",function(a,b){return r(a,b)<0?"nv-bar negative":"nv-bar positive"}),A&&(c||(c=b.map(function(){return!0})),S.select("rect").style("fill",function(a,b,d){return d3.rgb(A(a,b)).darker(c.map(function(a,b){return b}).filter(function(a,b){return!c[b]})[d]).toString()}).style("stroke",function(a,b,d){return d3.rgb(A(a,b)).darker(c.map(function(a,b){return b}).filter(function(a,b){return!c[b]})[d]).toString()}));var U=S.watchTransition(E,"multibar",Math.min(250,B)).delay(function(a,c){return c*B/b[0].values.length});v?U.attr("transform",function(a,c,d){var e=0;e=b[d].nonStackable?r(a,c)<0?n(0):n(0)-n(r(a,c))<-1?n(0)-1:n(r(a,c))||0:n(a.y1);var f=0;b[d].nonStackable&&(f=a.series*m.rangeBand()/b.length,b.length!==I&&(f=b[d].nonStackableSeries*m.rangeBand()/(2*I)));var g=f+m(q(a,c));return"translate("+g+","+e+")"}).select("rect").attr("height",function(a,c,d){return b[d].nonStackable?Math.max(Math.abs(n(r(a,c))-n(0)),1)||0:Math.max(Math.abs(n(a.y+a.y0)-n(a.y0)),1)}).attr("width",function(a,c,d){if(b[d].nonStackable){var e=m.rangeBand()/I;return b.length!==I&&(e=m.rangeBand()/(2*I)),e}return m.rangeBand()}):U.attr("transform",function(a,c){var d=a.series*m.rangeBand()/b.length+m(q(a,c)),e=r(a,c)<0?n(0):n(0)-n(r(a,c))<1?n(0)-1:n(r(a,c))||0;return"translate("+d+","+e+")"}).select("rect").attr("width",m.rangeBand()/b.length).attr("height",function(a,b){return Math.max(Math.abs(n(r(a,b))-n(0)),1)||0}),h=m.copy(),i=n.copy(),b[0]&&b[0].values&&(F=b[0].values.length)}),E.renderEnd("multibar immediate"),b}var c,d,e,f,g,h,i,j={top:0,right:0,bottom:0,left:0},k=960,l=500,m=d3.scale.ordinal(),n=d3.scale.linear(),o=Math.floor(1e4*Math.random()),p=null,q=function(a){return a.x},r=function(a){return a.y},s=function(a){return a.yErr},t=[0],u=!0,v=!1,w="zero",x=a.utils.defaultColor(),y=a.utils.defaultColor(),z=!1,A=null,B=500,C=.1,D=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),E=a.utils.renderWatch(D,B),F=0;return b.dispatch=D,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return k},set:function(a){k=a}},height:{get:function(){return l},set:function(a){l=a}},x:{get:function(){return q},set:function(a){q=a}},y:{get:function(){return r},set:function(a){r=a}},yErr:{get:function(){return s},set:function(a){s=a}},xScale:{get:function(){return m},set:function(a){m=a}},yScale:{get:function(){return n},set:function(a){n=a}},xDomain:{get:function(){return d},set:function(a){d=a}},yDomain:{get:function(){return e},set:function(a){e=a}},xRange:{get:function(){return f},set:function(a){f=a}},yRange:{get:function(){return g},set:function(a){g=a}},forceY:{get:function(){return t},set:function(a){t=a}},stacked:{get:function(){return v},set:function(a){v=a}},stackOffset:{get:function(){return w},set:function(a){w=a}},clipEdge:{get:function(){return u},set:function(a){u=a}},disabled:{get:function(){return c},set:function(a){c=a}},id:{get:function(){return o},set:function(a){o=a}},hideable:{get:function(){ -return z},set:function(a){z=a}},groupSpacing:{get:function(){return C},set:function(a){C=a}},margin:{get:function(){return j},set:function(a){j.top=void 0!==a.top?a.top:j.top,j.right=void 0!==a.right?a.right:j.right,j.bottom=void 0!==a.bottom?a.bottom:j.bottom,j.left=void 0!==a.left?a.left:j.left}},duration:{get:function(){return B},set:function(a){B=a,E.reset(B)}},color:{get:function(){return x},set:function(b){x=a.utils.getColor(b)}},barColor:{get:function(){return A},set:function(b){A=b?a.utils.getColor(b):null}},errorBarColor:{get:function(){return y},set:function(b){y=b?a.utils.getColor(b):null}}}),a.utils.initOptions(b),b},a.models.multiBarChart=function(){"use strict";function b(j){return D.reset(),D.models(e),r&&D.models(f),s&&D.models(g),j.each(function(j){var z=d3.select(this);a.utils.initSVG(z);var D=a.utils.availableWidth(l,z,k),H=a.utils.availableHeight(m,z,k);if(b.update=function(){0===C?z.call(b):z.transition().duration(C).call(b)},b.container=this,x.setter(G(j),b.update).getter(F(j)).update(),x.disabled=j.map(function(a){return!!a.disabled}),!y){var I;y={};for(I in x)x[I]instanceof Array?y[I]=x[I].slice(0):y[I]=x[I]}if(!(j&&j.length&&j.filter(function(a){return a.values.length}).length))return a.utils.noData(b,z),b;z.selectAll(".nv-noData").remove(),c=e.xScale(),d=e.yScale();var J=z.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([j]),K=J.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),L=J.select("g");if(K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y nv-axis"),K.append("g").attr("class","nv-barsWrap"),K.append("g").attr("class","nv-legendWrap"),K.append("g").attr("class","nv-controlsWrap"),q&&(h.width(D-B()),L.select(".nv-legendWrap").datum(j).call(h),k.top!=h.height()&&(k.top=h.height(),H=a.utils.availableHeight(m,z,k)),L.select(".nv-legendWrap").attr("transform","translate("+B()+","+-k.top+")")),o){var M=[{key:p.grouped||"Grouped",disabled:e.stacked()},{key:p.stacked||"Stacked",disabled:!e.stacked()}];i.width(B()).color(["#444","#444","#444"]),L.select(".nv-controlsWrap").datum(M).attr("transform","translate(0,"+-k.top+")").call(i)}J.attr("transform","translate("+k.left+","+k.top+")"),t&&L.select(".nv-y.nv-axis").attr("transform","translate("+D+",0)"),e.disabled(j.map(function(a){return a.disabled})).width(D).height(H).color(j.map(function(a,b){return a.color||n(a,b)}).filter(function(a,b){return!j[b].disabled}));var N=L.select(".nv-barsWrap").datum(j.filter(function(a){return!a.disabled}));if(N.call(e),r){f.scale(c)._ticks(a.utils.calcTicksX(D/100,j)).tickSize(-H,0),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+d.range()[0]+")"),L.select(".nv-x.nv-axis").call(f);var O=L.select(".nv-x.nv-axis > g").selectAll("g");if(O.selectAll("line, text").style("opacity",1),v){var P=function(a,b){return"translate("+a+","+b+")"},Q=5,R=17;O.selectAll("text").attr("transform",function(a,b,c){return P(0,c%2==0?Q:R)});var S=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;L.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(a,b){return P(0,0===b||S%2!==0?R:Q)})}u&&O.filter(function(a,b){return b%Math.ceil(j[0].values.length/(D/100))!==0}).selectAll("text, line").style("opacity",0),w&&O.selectAll(".tick text").attr("transform","rotate("+w+" 0,0)").style("text-anchor",w>0?"start":"end"),L.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}s&&(g.scale(d)._ticks(a.utils.calcTicksY(H/36,j)).tickSize(-D,0),L.select(".nv-y.nv-axis").call(g)),h.dispatch.on("stateChange",function(a){for(var c in a)x[c]=a[c];A.stateChange(x),b.update()}),i.dispatch.on("legendClick",function(a,c){if(a.disabled){switch(M=M.map(function(a){return a.disabled=!0,a}),a.disabled=!1,a.key){case"Grouped":case p.grouped:e.stacked(!1);break;case"Stacked":case p.stacked:e.stacked(!0)}x.stacked=e.stacked(),A.stateChange(x),b.update()}}),A.on("changeState",function(a){"undefined"!=typeof a.disabled&&(j.forEach(function(b,c){b.disabled=a.disabled[c]}),x.disabled=a.disabled),"undefined"!=typeof a.stacked&&(e.stacked(a.stacked),x.stacked=a.stacked,E=a.stacked),b.update()})}),D.renderEnd("multibarchart immediate"),b}var c,d,e=a.models.multiBar(),f=a.models.axis(),g=a.models.axis(),h=a.models.legend(),i=a.models.legend(),j=a.models.tooltip(),k={top:30,right:20,bottom:50,left:60},l=null,m=null,n=a.utils.defaultColor(),o=!0,p={},q=!0,r=!0,s=!0,t=!1,u=!0,v=!1,w=0,x=a.utils.state(),y=null,z=null,A=d3.dispatch("stateChange","changeState","renderEnd"),B=function(){return o?180:0},C=250;x.stacked=!1,e.stacked(!1),f.orient("bottom").tickPadding(7).showMaxMin(!1).tickFormat(function(a){return a}),g.orient(t?"right":"left").tickFormat(d3.format(",.1f")),j.duration(0).valueFormatter(function(a,b){return g.tickFormat()(a,b)}).headerFormatter(function(a,b){return f.tickFormat()(a,b)}),i.updateState(!1);var D=a.utils.renderWatch(A),E=!1,F=function(a){return function(){return{active:a.map(function(a){return!a.disabled}),stacked:E}}},G=function(a){return function(b){void 0!==b.stacked&&(E=b.stacked),void 0!==b.active&&a.forEach(function(a,c){a.disabled=!b.active[c]})}};return e.dispatch.on("elementMouseover.tooltip",function(a){a.value=b.x()(a.data),a.series={key:a.data.key,value:b.y()(a.data),color:a.color},j.data(a).hidden(!1)}),e.dispatch.on("elementMouseout.tooltip",function(a){j.hidden(!0)}),e.dispatch.on("elementMousemove.tooltip",function(a){j.position({top:d3.event.pageY,left:d3.event.pageX})()}),b.dispatch=A,b.multibar=e,b.legend=h,b.controls=i,b.xAxis=f,b.yAxis=g,b.state=x,b.tooltip=j,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return l},set:function(a){l=a}},height:{get:function(){return m},set:function(a){m=a}},showLegend:{get:function(){return q},set:function(a){q=a}},showControls:{get:function(){return o},set:function(a){o=a}},controlLabels:{get:function(){return p},set:function(a){p=a}},showXAxis:{get:function(){return r},set:function(a){r=a}},showYAxis:{get:function(){return s},set:function(a){s=a}},defaultState:{get:function(){return y},set:function(a){y=a}},noData:{get:function(){return z},set:function(a){z=a}},reduceXTicks:{get:function(){return u},set:function(a){u=a}},rotateLabels:{get:function(){return w},set:function(a){w=a}},staggerLabels:{get:function(){return v},set:function(a){v=a}},tooltips:{get:function(){return j.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),j.enabled(!!b)}},tooltipContent:{get:function(){return j.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),j.contentGenerator(b)}},margin:{get:function(){return k},set:function(a){k.top=void 0!==a.top?a.top:k.top,k.right=void 0!==a.right?a.right:k.right,k.bottom=void 0!==a.bottom?a.bottom:k.bottom,k.left=void 0!==a.left?a.left:k.left}},duration:{get:function(){return C},set:function(a){C=a,e.duration(C),f.duration(C),g.duration(C),D.reset(C)}},color:{get:function(){return n},set:function(b){n=a.utils.getColor(b),h.color(n)}},rightAlignYAxis:{get:function(){return t},set:function(a){t=a,g.orient(t?"right":"left")}},barColor:{get:function(){return e.barColor},set:function(a){e.barColor(a),h.color(function(a,b){return d3.rgb("#ccc").darker(1.5*b).toString()})}}}),a.utils.inheritOptions(b,e),a.utils.initOptions(b),b},a.models.multiBarHorizontal=function(){"use strict";function b(m){return F.reset(),m.each(function(b){var m=k-j.left-j.right,D=l-j.top-j.bottom;n=d3.select(this),a.utils.initSVG(n),x&&(b=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(r)(b)),b.forEach(function(a,b){a.values.forEach(function(c){c.series=b,c.key=a.key})}),x&&b[0].values.map(function(a,c){var d=0,e=0;b.map(function(a){var b=a.values[c];b.size=Math.abs(b.y),b.y<0?(b.y1=e-b.size,e-=b.size):(b.y1=d,d+=b.size)})});var G=d&&e?[]:b.map(function(a){return a.values.map(function(a,b){return{x:q(a,b),y:r(a,b),y0:a.y0,y1:a.y1,yErr:s(a,b)}})});o.domain(d||d3.merge(G).map(function(a){return a.x})).rangeBands(f||[0,D],B),p.domain(e||d3.extent(d3.merge(d3.merge(G).map(function(a){var b=a.y;x&&(b=a.y>0?a.y1+a.y:a.y1);var c=a.yErr;return c?c.length?[b+c[0],b+c[1]]:(c=Math.abs(c),[b-c,b+c]):[b]})).concat(t))),y&&!x?p.range(g||[p.domain()[0]<0?A:0,m-(p.domain()[1]>0?A:0)]):p.range(g||[0,m]),h=h||o,i=i||d3.scale.linear().domain(p.domain()).range([p(0),p(0)]);var H=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([b]),I=H.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),J=(I.append("defs"),I.append("g"));H.select("g");J.append("g").attr("class","nv-groups"),H.attr("transform","translate("+j.left+","+j.top+")");var K=H.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a,b){return b});K.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),K.exit().watchTransition(F,"multibarhorizontal: exit groups").style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),K.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return u(a,b)}).style("stroke",function(a,b){return u(a,b)}),K.watchTransition(F,"multibarhorizontal: groups").style("stroke-opacity",1).style("fill-opacity",.75);var L=K.selectAll("g.nv-bar").data(function(a){return a.values});L.exit().remove();var M=L.enter().append("g").attr("transform",function(a,c,d){return"translate("+i(x?a.y0:0)+","+(x?0:d*o.rangeBand()/b.length+o(q(a,c)))+")"});M.append("rect").attr("width",0).attr("height",o.rangeBand()/(x?1:b.length)),L.on("mouseover",function(a,b){d3.select(this).classed("hover",!0),E.elementMouseover({data:a,index:b,color:d3.select(this).style("fill")})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),E.elementMouseout({data:a,index:b,color:d3.select(this).style("fill")})}).on("mouseout",function(a,b){E.elementMouseout({data:a,index:b,color:d3.select(this).style("fill")})}).on("mousemove",function(a,b){E.elementMousemove({data:a,index:b,color:d3.select(this).style("fill")})}).on("click",function(a,b){E.elementClick({data:a,index:b,color:d3.select(this).style("fill")}),d3.event.stopPropagation()}).on("dblclick",function(a,b){E.elementDblClick({data:a,index:b,color:d3.select(this).style("fill")}),d3.event.stopPropagation()}),s(b[0].values[0],0)&&(M.append("polyline"),L.select("polyline").attr("fill","none").attr("stroke",function(a,b,c){return w(a,c,b)}).attr("points",function(a,c){var d=s(a,c),e=.8*o.rangeBand()/(2*(x?1:b.length));d=d.length?d:[-Math.abs(d),Math.abs(d)],d=d.map(function(a){return p(a)-p(0)});var f=[[d[0],-e],[d[0],e],[d[0],0],[d[1],0],[d[1],-e],[d[1],e]];return f.map(function(a){return a.join(",")}).join(" ")}).attr("transform",function(a,c){var d=o.rangeBand()/(2*(x?1:b.length));return"translate("+(r(a,c)<0?0:p(r(a,c))-p(0))+", "+d+")"})),M.append("text"),y&&!x?(L.select("text").attr("text-anchor",function(a,b){return r(a,b)<0?"end":"start"}).attr("y",o.rangeBand()/(2*b.length)).attr("dy",".32em").text(function(a,b){var c=C(r(a,b)),d=s(a,b);return void 0===d?c:d.length?c+"+"+C(Math.abs(d[1]))+"-"+C(Math.abs(d[0])):c+"±"+C(Math.abs(d))}),L.watchTransition(F,"multibarhorizontal: bars").select("text").attr("x",function(a,b){return r(a,b)<0?-4:p(r(a,b))-p(0)+4})):L.selectAll("text").text(""),z&&!x?(M.append("text").classed("nv-bar-label",!0),L.select("text.nv-bar-label").attr("text-anchor",function(a,b){return r(a,b)<0?"start":"end"}).attr("y",o.rangeBand()/(2*b.length)).attr("dy",".32em").text(function(a,b){return q(a,b)}),L.watchTransition(F,"multibarhorizontal: bars").select("text.nv-bar-label").attr("x",function(a,b){return r(a,b)<0?p(0)-p(r(a,b))+4:-4})):L.selectAll("text.nv-bar-label").text(""),L.attr("class",function(a,b){return r(a,b)<0?"nv-bar negative":"nv-bar positive"}),v&&(c||(c=b.map(function(){return!0})),L.style("fill",function(a,b,d){return d3.rgb(v(a,b)).darker(c.map(function(a,b){return b}).filter(function(a,b){return!c[b]})[d]).toString()}).style("stroke",function(a,b,d){return d3.rgb(v(a,b)).darker(c.map(function(a,b){return b}).filter(function(a,b){return!c[b]})[d]).toString()})),x?L.watchTransition(F,"multibarhorizontal: bars").attr("transform",function(a,b){return"translate("+p(a.y1)+","+o(q(a,b))+")"}).select("rect").attr("width",function(a,b){return Math.abs(p(r(a,b)+a.y0)-p(a.y0))}).attr("height",o.rangeBand()):L.watchTransition(F,"multibarhorizontal: bars").attr("transform",function(a,c){return"translate("+p(r(a,c)<0?r(a,c):0)+","+(a.series*o.rangeBand()/b.length+o(q(a,c)))+")"}).select("rect").attr("height",o.rangeBand()/b.length).attr("width",function(a,b){return Math.max(Math.abs(p(r(a,b))-p(0)),1)}),h=o.copy(),i=p.copy()}),F.renderEnd("multibarHorizontal immediate"),b}var c,d,e,f,g,h,i,j={top:0,right:0,bottom:0,left:0},k=960,l=500,m=Math.floor(1e4*Math.random()),n=null,o=d3.scale.ordinal(),p=d3.scale.linear(),q=function(a){return a.x},r=function(a){return a.y},s=function(a){return a.yErr},t=[0],u=a.utils.defaultColor(),v=null,w=a.utils.defaultColor(),x=!1,y=!1,z=!1,A=60,B=.1,C=d3.format(",.2f"),D=250,E=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),F=a.utils.renderWatch(E,D);return b.dispatch=E,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return k},set:function(a){k=a}},height:{get:function(){return l},set:function(a){l=a}},x:{get:function(){return q},set:function(a){q=a}},y:{get:function(){return r},set:function(a){r=a}},yErr:{get:function(){return s},set:function(a){s=a}},xScale:{get:function(){return o},set:function(a){o=a}},yScale:{get:function(){return p},set:function(a){p=a}},xDomain:{get:function(){return d},set:function(a){d=a}},yDomain:{get:function(){return e},set:function(a){e=a}},xRange:{get:function(){return f},set:function(a){f=a}},yRange:{get:function(){return g},set:function(a){g=a}},forceY:{get:function(){return t},set:function(a){t=a}},stacked:{get:function(){return x},set:function(a){x=a}},showValues:{get:function(){return y},set:function(a){y=a}},disabled:{get:function(){return c},set:function(a){c=a}},id:{get:function(){return m},set:function(a){m=a}},valueFormat:{get:function(){return C},set:function(a){C=a}},valuePadding:{get:function(){return A},set:function(a){A=a}},groupSpacing:{get:function(){return B},set:function(a){B=a}},margin:{get:function(){return j},set:function(a){j.top=void 0!==a.top?a.top:j.top,j.right=void 0!==a.right?a.right:j.right,j.bottom=void 0!==a.bottom?a.bottom:j.bottom,j.left=void 0!==a.left?a.left:j.left}},duration:{get:function(){return D},set:function(a){D=a,F.reset(D)}},color:{get:function(){return u},set:function(b){u=a.utils.getColor(b)}},barColor:{get:function(){return v},set:function(b){v=b?a.utils.getColor(b):null}},errorBarColor:{get:function(){return w},set:function(b){w=b?a.utils.getColor(b):null}}}),a.utils.initOptions(b),b},a.models.multiBarHorizontalChart=function(){"use strict";function b(j){return C.reset(),C.models(e),r&&C.models(f),s&&C.models(g),j.each(function(j){var w=d3.select(this);a.utils.initSVG(w);var C=a.utils.availableWidth(l,w,k),D=a.utils.availableHeight(m,w,k);if(b.update=function(){w.transition().duration(z).call(b)},b.container=this,t=e.stacked(),u.setter(B(j),b.update).getter(A(j)).update(),u.disabled=j.map(function(a){return!!a.disabled}),!v){var E;v={};for(E in u)u[E]instanceof Array?v[E]=u[E].slice(0):v[E]=u[E]}if(!(j&&j.length&&j.filter(function(a){return a.values.length}).length))return a.utils.noData(b,w),b;w.selectAll(".nv-noData").remove(),c=e.xScale(),d=e.yScale();var F=w.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([j]),G=F.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),H=F.select("g");if(G.append("g").attr("class","nv-x nv-axis"),G.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),G.append("g").attr("class","nv-barsWrap"),G.append("g").attr("class","nv-legendWrap"),G.append("g").attr("class","nv-controlsWrap"),q&&(h.width(C-y()),H.select(".nv-legendWrap").datum(j).call(h),k.top!=h.height()&&(k.top=h.height(),D=a.utils.availableHeight(m,w,k)),H.select(".nv-legendWrap").attr("transform","translate("+y()+","+-k.top+")")),o){var I=[{key:p.grouped||"Grouped",disabled:e.stacked()},{key:p.stacked||"Stacked",disabled:!e.stacked()}];i.width(y()).color(["#444","#444","#444"]),H.select(".nv-controlsWrap").datum(I).attr("transform","translate(0,"+-k.top+")").call(i)}F.attr("transform","translate("+k.left+","+k.top+")"),e.disabled(j.map(function(a){return a.disabled})).width(C).height(D).color(j.map(function(a,b){return a.color||n(a,b)}).filter(function(a,b){return!j[b].disabled}));var J=H.select(".nv-barsWrap").datum(j.filter(function(a){return!a.disabled}));if(J.transition().call(e),r){f.scale(c)._ticks(a.utils.calcTicksY(D/24,j)).tickSize(-C,0),H.select(".nv-x.nv-axis").call(f);var K=H.select(".nv-x.nv-axis").selectAll("g");K.selectAll("line, text")}s&&(g.scale(d)._ticks(a.utils.calcTicksX(C/100,j)).tickSize(-D,0),H.select(".nv-y.nv-axis").attr("transform","translate(0,"+D+")"),H.select(".nv-y.nv-axis").call(g)),H.select(".nv-zeroLine line").attr("x1",d(0)).attr("x2",d(0)).attr("y1",0).attr("y2",-D),h.dispatch.on("stateChange",function(a){for(var c in a)u[c]=a[c];x.stateChange(u),b.update()}),i.dispatch.on("legendClick",function(a,c){if(a.disabled){switch(I=I.map(function(a){return a.disabled=!0,a}),a.disabled=!1,a.key){case"Grouped":e.stacked(!1);break;case"Stacked":e.stacked(!0)}u.stacked=e.stacked(),x.stateChange(u),t=e.stacked(),b.update()}}),x.on("changeState",function(a){"undefined"!=typeof a.disabled&&(j.forEach(function(b,c){b.disabled=a.disabled[c]}),u.disabled=a.disabled),"undefined"!=typeof a.stacked&&(e.stacked(a.stacked),u.stacked=a.stacked,t=a.stacked),b.update()})}),C.renderEnd("multibar horizontal chart immediate"),b}var c,d,e=a.models.multiBarHorizontal(),f=a.models.axis(),g=a.models.axis(),h=a.models.legend().height(30),i=a.models.legend().height(30),j=a.models.tooltip(),k={top:30,right:20,bottom:50,left:60},l=null,m=null,n=a.utils.defaultColor(),o=!0,p={},q=!0,r=!0,s=!0,t=!1,u=a.utils.state(),v=null,w=null,x=d3.dispatch("stateChange","changeState","renderEnd"),y=function(){return o?180:0},z=250;u.stacked=!1,e.stacked(t),f.orient("left").tickPadding(5).showMaxMin(!1).tickFormat(function(a){return a}),g.orient("bottom").tickFormat(d3.format(",.1f")),j.duration(0).valueFormatter(function(a,b){return g.tickFormat()(a,b)}).headerFormatter(function(a,b){return f.tickFormat()(a,b)}),i.updateState(!1);var A=function(a){return function(){return{active:a.map(function(a){return!a.disabled}),stacked:t}}},B=function(a){return function(b){void 0!==b.stacked&&(t=b.stacked),void 0!==b.active&&a.forEach(function(a,c){a.disabled=!b.active[c]})}},C=a.utils.renderWatch(x,z);return e.dispatch.on("elementMouseover.tooltip",function(a){a.value=b.x()(a.data),a.series={key:a.data.key,value:b.y()(a.data),color:a.color},j.data(a).hidden(!1)}),e.dispatch.on("elementMouseout.tooltip",function(a){j.hidden(!0)}),e.dispatch.on("elementMousemove.tooltip",function(a){j.position({top:d3.event.pageY,left:d3.event.pageX})()}),b.dispatch=x,b.multibar=e,b.legend=h,b.controls=i,b.xAxis=f,b.yAxis=g,b.state=u,b.tooltip=j,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return l},set:function(a){l=a}},height:{get:function(){return m},set:function(a){m=a}},showLegend:{get:function(){return q},set:function(a){q=a}},showControls:{get:function(){return o},set:function(a){o=a}},controlLabels:{get:function(){return p},set:function(a){p=a}},showXAxis:{get:function(){return r},set:function(a){r=a}},showYAxis:{get:function(){return s},set:function(a){s=a}},defaultState:{get:function(){return v},set:function(a){v=a}},noData:{get:function(){return w},set:function(a){w=a}},tooltips:{get:function(){return j.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),j.enabled(!!b)}},tooltipContent:{get:function(){return j.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),j.contentGenerator(b)}},margin:{get:function(){return k},set:function(a){k.top=void 0!==a.top?a.top:k.top,k.right=void 0!==a.right?a.right:k.right,k.bottom=void 0!==a.bottom?a.bottom:k.bottom,k.left=void 0!==a.left?a.left:k.left}},duration:{get:function(){return z},set:function(a){z=a,C.reset(z),e.duration(z),f.duration(z),g.duration(z)}},color:{get:function(){return n},set:function(b){n=a.utils.getColor(b),h.color(n)}},barColor:{get:function(){return e.barColor},set:function(a){e.barColor(a),h.color(function(a,b){return d3.rgb("#ccc").darker(1.5*b).toString()})}}}),a.utils.inheritOptions(b,e),a.utils.initOptions(b),b},a.models.multiChart=function(){"use strict";function b(j){return j.each(function(j){function k(a){var b=2===j[a.seriesIndex].yAxis?z:y;a.value=a.point.x,a.series={value:a.point.y,color:a.point.color},B.duration(100).valueFormatter(function(a,c){return b.tickFormat()(a,c)}).data(a).position(a.pos).hidden(!1)}function l(a){var b=2===j[a.seriesIndex].yAxis?z:y;a.point.x=v.x()(a.point),a.point.y=v.y()(a.point),B.duration(100).valueFormatter(function(a,c){return b.tickFormat()(a,c)}).data(a).position(a.pos).hidden(!1)}function n(a){var b=2===j[a.data.series].yAxis?z:y;a.value=t.x()(a.data),a.series={value:t.y()(a.data),color:a.color},B.duration(0).valueFormatter(function(a,c){return b.tickFormat()(a,c)}).data(a).hidden(!1)}var C=d3.select(this);a.utils.initSVG(C),b.update=function(){C.transition().call(b)},b.container=this;var D=a.utils.availableWidth(g,C,e),E=a.utils.availableHeight(h,C,e),F=j.filter(function(a){return"line"==a.type&&1==a.yAxis}),G=j.filter(function(a){return"line"==a.type&&2==a.yAxis}),H=j.filter(function(a){return"bar"==a.type&&1==a.yAxis}),I=j.filter(function(a){return"bar"==a.type&&2==a.yAxis}),J=j.filter(function(a){return"area"==a.type&&1==a.yAxis}),K=j.filter(function(a){return"area"==a.type&&2==a.yAxis});if(!(j&&j.length&&j.filter(function(a){return a.values.length}).length))return a.utils.noData(b,C),b;C.selectAll(".nv-noData").remove();var L=j.filter(function(a){return!a.disabled&&1==a.yAxis}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})}),M=j.filter(function(a){return!a.disabled&&2==a.yAxis}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})});o.domain(d3.extent(d3.merge(L.concat(M)),function(a){return a.x})).range([0,D]);var N=C.selectAll("g.wrap.multiChart").data([j]),O=N.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");O.append("g").attr("class","nv-x nv-axis"),O.append("g").attr("class","nv-y1 nv-axis"),O.append("g").attr("class","nv-y2 nv-axis"),O.append("g").attr("class","lines1Wrap"),O.append("g").attr("class","lines2Wrap"),O.append("g").attr("class","bars1Wrap"),O.append("g").attr("class","bars2Wrap"),O.append("g").attr("class","stack1Wrap"),O.append("g").attr("class","stack2Wrap"),O.append("g").attr("class","legendWrap");var P=N.select("g"),Q=j.map(function(a,b){return j[b].color||f(a,b)});if(i){var R=A.align()?D/2:D,S=A.align()?R:0;A.width(R),A.color(Q),P.select(".legendWrap").datum(j.map(function(a){return a.originalKey=void 0===a.originalKey?a.key:a.originalKey,a.key=a.originalKey+(1==a.yAxis?"":" (right axis)"),a})).call(A),e.top!=A.height()&&(e.top=A.height(),E=a.utils.availableHeight(h,C,e)),P.select(".legendWrap").attr("transform","translate("+S+","+-e.top+")")}r.width(D).height(E).interpolate(m).color(Q.filter(function(a,b){return!j[b].disabled&&1==j[b].yAxis&&"line"==j[b].type})),s.width(D).height(E).interpolate(m).color(Q.filter(function(a,b){return!j[b].disabled&&2==j[b].yAxis&&"line"==j[b].type})),t.width(D).height(E).color(Q.filter(function(a,b){return!j[b].disabled&&1==j[b].yAxis&&"bar"==j[b].type})),u.width(D).height(E).color(Q.filter(function(a,b){return!j[b].disabled&&2==j[b].yAxis&&"bar"==j[b].type})),v.width(D).height(E).color(Q.filter(function(a,b){return!j[b].disabled&&1==j[b].yAxis&&"area"==j[b].type})),w.width(D).height(E).color(Q.filter(function(a,b){return!j[b].disabled&&2==j[b].yAxis&&"area"==j[b].type})),P.attr("transform","translate("+e.left+","+e.top+")");var T=P.select(".lines1Wrap").datum(F.filter(function(a){return!a.disabled})),U=P.select(".bars1Wrap").datum(H.filter(function(a){return!a.disabled})),V=P.select(".stack1Wrap").datum(J.filter(function(a){return!a.disabled})),W=P.select(".lines2Wrap").datum(G.filter(function(a){return!a.disabled})),X=P.select(".bars2Wrap").datum(I.filter(function(a){return!a.disabled})),Y=P.select(".stack2Wrap").datum(K.filter(function(a){return!a.disabled})),Z=J.length?J.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[],$=K.length?K.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[];p.domain(c||d3.extent(d3.merge(L).concat(Z),function(a){return a.y})).range([0,E]),q.domain(d||d3.extent(d3.merge(M).concat($),function(a){return a.y})).range([0,E]),r.yDomain(p.domain()),t.yDomain(p.domain()),v.yDomain(p.domain()),s.yDomain(q.domain()),u.yDomain(q.domain()),w.yDomain(q.domain()),J.length&&d3.transition(V).call(v),K.length&&d3.transition(Y).call(w),H.length&&d3.transition(U).call(t),I.length&&d3.transition(X).call(u),F.length&&d3.transition(T).call(r),G.length&&d3.transition(W).call(s),x._ticks(a.utils.calcTicksX(D/100,j)).tickSize(-E,0),P.select(".nv-x.nv-axis").attr("transform","translate(0,"+E+")"),d3.transition(P.select(".nv-x.nv-axis")).call(x),y._ticks(a.utils.calcTicksY(E/36,j)).tickSize(-D,0),d3.transition(P.select(".nv-y1.nv-axis")).call(y),z._ticks(a.utils.calcTicksY(E/36,j)).tickSize(-D,0),d3.transition(P.select(".nv-y2.nv-axis")).call(z),P.select(".nv-y1.nv-axis").classed("nv-disabled",L.length?!1:!0).attr("transform","translate("+o.range()[0]+",0)"),P.select(".nv-y2.nv-axis").classed("nv-disabled",M.length?!1:!0).attr("transform","translate("+o.range()[1]+",0)"),A.dispatch.on("stateChange",function(a){b.update()}),r.dispatch.on("elementMouseover.tooltip",k),s.dispatch.on("elementMouseover.tooltip",k),r.dispatch.on("elementMouseout.tooltip",function(a){B.hidden(!0)}),s.dispatch.on("elementMouseout.tooltip",function(a){B.hidden(!0)}),v.dispatch.on("elementMouseover.tooltip",l),w.dispatch.on("elementMouseover.tooltip",l),v.dispatch.on("elementMouseout.tooltip",function(a){B.hidden(!0)}),w.dispatch.on("elementMouseout.tooltip",function(a){B.hidden(!0)}),t.dispatch.on("elementMouseover.tooltip",n),u.dispatch.on("elementMouseover.tooltip",n),t.dispatch.on("elementMouseout.tooltip",function(a){B.hidden(!0)}),u.dispatch.on("elementMouseout.tooltip",function(a){B.hidden(!0)}),t.dispatch.on("elementMousemove.tooltip",function(a){B.position({top:d3.event.pageY,left:d3.event.pageX})()}),u.dispatch.on("elementMousemove.tooltip",function(a){B.position({top:d3.event.pageY,left:d3.event.pageX})()})}),b}var c,d,e={top:30,right:20,bottom:50,left:60},f=a.utils.defaultColor(),g=null,h=null,i=!0,j=null,k=function(a){return a.x},l=function(a){return a.y},m="monotone",n=!0,o=d3.scale.linear(),p=d3.scale.linear(),q=d3.scale.linear(),r=a.models.line().yScale(p),s=a.models.line().yScale(q),t=a.models.multiBar().stacked(!1).yScale(p),u=a.models.multiBar().stacked(!1).yScale(q),v=a.models.stackedArea().yScale(p),w=a.models.stackedArea().yScale(q),x=a.models.axis().scale(o).orient("bottom").tickPadding(5),y=a.models.axis().scale(p).orient("left"),z=a.models.axis().scale(q).orient("right"),A=a.models.legend().height(30),B=a.models.tooltip(),C=d3.dispatch();return b.dispatch=C,b.lines1=r,b.lines2=s,b.bars1=t,b.bars2=u,b.stack1=v,b.stack2=w,b.xAxis=x,b.yAxis1=y,b.yAxis2=z,b.tooltip=B,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return g},set:function(a){g=a}},height:{get:function(){return h},set:function(a){h=a}},showLegend:{get:function(){return i},set:function(a){i=a}},yDomain1:{get:function(){return c},set:function(a){c=a}},yDomain2:{get:function(){return d},set:function(a){d=a}},noData:{get:function(){return j},set:function(a){j=a}},interpolate:{get:function(){return m},set:function(a){m=a}},tooltips:{get:function(){return B.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),B.enabled(!!b)}},tooltipContent:{get:function(){return B.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),B.contentGenerator(b)}},margin:{get:function(){return e},set:function(a){e.top=void 0!==a.top?a.top:e.top,e.right=void 0!==a.right?a.right:e.right,e.bottom=void 0!==a.bottom?a.bottom:e.bottom,e.left=void 0!==a.left?a.left:e.left}},color:{get:function(){return f},set:function(b){f=a.utils.getColor(b)}},x:{get:function(){return k},set:function(a){k=a,r.x(a),s.x(a),t.x(a),u.x(a),v.x(a),w.x(a)}},y:{get:function(){return l},set:function(a){l=a,r.y(a),s.y(a),v.y(a),w.y(a),t.y(a),u.y(a)}},useVoronoi:{get:function(){return n},set:function(a){n=a,r.useVoronoi(a),s.useVoronoi(a),v.useVoronoi(a),w.useVoronoi(a)}}}),a.utils.initOptions(b),b},a.models.ohlcBar=function(){"use strict";function b(y){return y.each(function(b){k=d3.select(this);var y=a.utils.availableWidth(h,k,g),A=a.utils.availableHeight(i,k,g);a.utils.initSVG(k);var B=y/b[0].values.length*.9;l.domain(c||d3.extent(b[0].values.map(n).concat(t))),v?l.range(e||[.5*y/b[0].values.length,y*(b[0].values.length-.5)/b[0].values.length]):l.range(e||[5+B/2,y-B/2-5]),m.domain(d||[d3.min(b[0].values.map(s).concat(u)),d3.max(b[0].values.map(r).concat(u))]).range(f||[A,0]),l.domain()[0]===l.domain()[1]&&(l.domain()[0]?l.domain([l.domain()[0]-.01*l.domain()[0],l.domain()[1]+.01*l.domain()[1]]):l.domain([-1,1])),m.domain()[0]===m.domain()[1]&&(m.domain()[0]?m.domain([m.domain()[0]+.01*m.domain()[0],m.domain()[1]-.01*m.domain()[1]]):m.domain([-1,1]));var C=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([b[0].values]),D=C.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),E=D.append("defs"),F=D.append("g"),G=C.select("g");F.append("g").attr("class","nv-ticks"),C.attr("transform","translate("+g.left+","+g.top+")"),k.on("click",function(a,b){z.chartClick({data:a,index:b,pos:d3.event,id:j})}),E.append("clipPath").attr("id","nv-chart-clip-path-"+j).append("rect"),C.select("#nv-chart-clip-path-"+j+" rect").attr("width",y).attr("height",A),G.attr("clip-path",w?"url(#nv-chart-clip-path-"+j+")":"");var H=C.select(".nv-ticks").selectAll(".nv-tick").data(function(a){return a});H.exit().remove(),H.enter().append("path").attr("class",function(a,b,c){return(p(a,b)>q(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}).attr("d",function(a,b){return"m0,0l0,"+(m(p(a,b))-m(r(a,b)))+"l"+-B/2+",0l"+B/2+",0l0,"+(m(s(a,b))-m(p(a,b)))+"l0,"+(m(q(a,b))-m(s(a,b)))+"l"+B/2+",0l"+-B/2+",0z"}).attr("transform",function(a,b){return"translate("+l(n(a,b))+","+m(r(a,b))+")"}).attr("fill",function(a,b){return x[0]}).attr("stroke",function(a,b){return x[0]}).attr("x",0).attr("y",function(a,b){return m(Math.max(0,o(a,b)))}).attr("height",function(a,b){return Math.abs(m(o(a,b))-m(0))}),H.attr("class",function(a,b,c){return(p(a,b)>q(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}),d3.transition(H).attr("transform",function(a,b){return"translate("+l(n(a,b))+","+m(r(a,b))+")"}).attr("d",function(a,c){var d=y/b[0].values.length*.9;return"m0,0l0,"+(m(p(a,c))-m(r(a,c)))+"l"+-d/2+",0l"+d/2+",0l0,"+(m(s(a,c))-m(p(a,c)))+"l0,"+(m(q(a,c))-m(s(a,c)))+"l"+d/2+",0l"+-d/2+",0z"})}),b}var c,d,e,f,g={top:0,right:0,bottom:0,left:0},h=null,i=null,j=Math.floor(1e4*Math.random()),k=null,l=d3.scale.linear(),m=d3.scale.linear(),n=function(a){return a.x},o=function(a){return a.y},p=function(a){return a.open},q=function(a){return a.close},r=function(a){return a.high},s=function(a){return a.low; -},t=[],u=[],v=!1,w=!0,x=a.utils.defaultColor(),y=!1,z=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState","renderEnd","chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove");return b.highlightPoint=function(a,c){b.clearHighlights(),k.select(".nv-ohlcBar .nv-tick-0-"+a).classed("hover",c)},b.clearHighlights=function(){k.select(".nv-ohlcBar .nv-tick.hover").classed("hover",!1)},b.dispatch=z,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return h},set:function(a){h=a}},height:{get:function(){return i},set:function(a){i=a}},xScale:{get:function(){return l},set:function(a){l=a}},yScale:{get:function(){return m},set:function(a){m=a}},xDomain:{get:function(){return c},set:function(a){c=a}},yDomain:{get:function(){return d},set:function(a){d=a}},xRange:{get:function(){return e},set:function(a){e=a}},yRange:{get:function(){return f},set:function(a){f=a}},forceX:{get:function(){return t},set:function(a){t=a}},forceY:{get:function(){return u},set:function(a){u=a}},padData:{get:function(){return v},set:function(a){v=a}},clipEdge:{get:function(){return w},set:function(a){w=a}},id:{get:function(){return j},set:function(a){j=a}},interactive:{get:function(){return y},set:function(a){y=a}},x:{get:function(){return n},set:function(a){n=a}},y:{get:function(){return o},set:function(a){o=a}},open:{get:function(){return p()},set:function(a){p=a}},close:{get:function(){return q()},set:function(a){q=a}},high:{get:function(){return r},set:function(a){r=a}},low:{get:function(){return s},set:function(a){s=a}},margin:{get:function(){return g},set:function(a){g.top=void 0!=a.top?a.top:g.top,g.right=void 0!=a.right?a.right:g.right,g.bottom=void 0!=a.bottom?a.bottom:g.bottom,g.left=void 0!=a.left?a.left:g.left}},color:{get:function(){return x},set:function(b){x=a.utils.getColor(b)}}}),a.utils.initOptions(b),b},a.models.parallelCoordinates=function(){"use strict";function b(p){return p.each(function(b){function p(a){return F(h.map(function(b){if(isNaN(a[b])||isNaN(parseFloat(a[b]))){var c=g[b].domain(),d=g[b].range(),e=c[0]-(c[1]-c[0])/9;if(J.indexOf(b)<0){var h=d3.scale.linear().domain([e,c[1]]).range([x-12,d[1]]);g[b].brush.y(h),J.push(b)}return[f(b),g[b](e)]}return J.length>0?(D.style("display","inline"),E.style("display","inline")):(D.style("display","none"),E.style("display","none")),[f(b),g[b](a[b])]}))}function q(){var a=h.filter(function(a){return!g[a].brush.empty()}),b=a.map(function(a){return g[a].brush.extent()});k=[],a.forEach(function(a,c){k[c]={dimension:a,extent:b[c]}}),l=[],M.style("display",function(c){var d=a.every(function(a,d){return isNaN(c[a])&&b[d][0]==g[a].brush.y().domain()[0]?!0:b[d][0]<=c[a]&&c[a]<=b[d][1]});return d&&l.push(c),d?null:"none"}),o.brush({filters:k,active:l})}function r(a,b){m[a]=this.parentNode.__origin__=f(a),L.attr("visibility","hidden")}function s(a,b){m[a]=Math.min(w,Math.max(0,this.parentNode.__origin__+=d3.event.x)),M.attr("d",p),h.sort(function(a,b){return u(a)-u(b)}),f.domain(h),N.attr("transform",function(a){return"translate("+u(a)+")"})}function t(a,b){delete this.parentNode.__origin__,delete m[a],d3.select(this.parentNode).attr("transform","translate("+f(a)+")"),M.attr("d",p),L.attr("d",p).attr("visibility",null)}function u(a){var b=m[a];return null==b?f(a):b}var v=d3.select(this),w=a.utils.availableWidth(d,v,c),x=a.utils.availableHeight(e,v,c);a.utils.initSVG(v),l=b,f.rangePoints([0,w],1).domain(h);var y={};h.forEach(function(a){var c=d3.extent(b,function(b){return+b[a]});return y[a]=!1,void 0===c[0]&&(y[a]=!0,c[0]=0,c[1]=0),c[0]===c[1]&&(c[0]=c[0]-1,c[1]=c[1]+1),g[a]=d3.scale.linear().domain(c).range([.9*(x-12),0]),g[a].brush=d3.svg.brush().y(g[a]).on("brush",q),"name"!=a});var z=v.selectAll("g.nv-wrap.nv-parallelCoordinates").data([b]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-parallelCoordinates"),B=A.append("g"),C=z.select("g");B.append("g").attr("class","nv-parallelCoordinates background"),B.append("g").attr("class","nv-parallelCoordinates foreground"),B.append("g").attr("class","nv-parallelCoordinates missingValuesline"),z.attr("transform","translate("+c.left+","+c.top+")");var D,E,F=d3.svg.line().interpolate("cardinal").tension(n),G=d3.svg.axis().orient("left"),H=d3.behavior.drag().on("dragstart",r).on("drag",s).on("dragend",t),I=f.range()[1]-f.range()[0],J=[],K=[0+I/2,x-12,w-I/2,x-12];D=z.select(".missingValuesline").selectAll("line").data([K]),D.enter().append("line"),D.exit().remove(),D.attr("x1",function(a){return a[0]}).attr("y1",function(a){return a[1]}).attr("x2",function(a){return a[2]}).attr("y2",function(a){return a[3]}),E=z.select(".missingValuesline").selectAll("text").data(["undefined values"]),E.append("text").data(["undefined values"]),E.enter().append("text"),E.exit().remove(),E.attr("y",x).attr("x",w-92-I/2).text(function(a){return a});var L=z.select(".background").selectAll("path").data(b);L.enter().append("path"),L.exit().remove(),L.attr("d",p);var M=z.select(".foreground").selectAll("path").data(b);M.enter().append("path"),M.exit().remove(),M.attr("d",p).attr("stroke",j),M.on("mouseover",function(a,b){d3.select(this).classed("hover",!0),o.elementMouseover({label:a.name,data:a.data,index:b,pos:[d3.mouse(this.parentNode)[0],d3.mouse(this.parentNode)[1]]})}),M.on("mouseout",function(a,b){d3.select(this).classed("hover",!1),o.elementMouseout({label:a.name,data:a.data,index:b})});var N=C.selectAll(".dimension").data(h),O=N.enter().append("g").attr("class","nv-parallelCoordinates dimension");O.append("g").attr("class","nv-parallelCoordinates nv-axis"),O.append("g").attr("class","nv-parallelCoordinates-brush"),O.append("text").attr("class","nv-parallelCoordinates nv-label"),N.attr("transform",function(a){return"translate("+f(a)+",0)"}),N.exit().remove(),N.select(".nv-label").style("cursor","move").attr("dy","-1em").attr("text-anchor","middle").text(String).on("mouseover",function(a,b){o.elementMouseover({dim:a,pos:[d3.mouse(this.parentNode.parentNode)[0],d3.mouse(this.parentNode.parentNode)[1]]})}).on("mouseout",function(a,b){o.elementMouseout({dim:a})}).call(H),N.select(".nv-axis").each(function(a,b){d3.select(this).call(G.scale(g[a]).tickFormat(d3.format(i[b])))}),N.select(".nv-parallelCoordinates-brush").each(function(a){d3.select(this).call(g[a].brush)}).selectAll("rect").attr("x",-8).attr("width",16)}),b}var c={top:30,right:0,bottom:10,left:0},d=null,e=null,f=d3.scale.ordinal(),g={},h=[],i=[],j=a.utils.defaultColor(),k=[],l=[],m=[],n=1,o=d3.dispatch("brush","elementMouseover","elementMouseout");return b.dispatch=o,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return d},set:function(a){d=a}},height:{get:function(){return e},set:function(a){e=a}},dimensionNames:{get:function(){return h},set:function(a){h=a}},dimensionFormats:{get:function(){return i},set:function(a){i=a}},lineTension:{get:function(){return n},set:function(a){n=a}},dimensions:{get:function(){return h},set:function(b){a.deprecated("dimensions","use dimensionNames instead"),h=b}},margin:{get:function(){return c},set:function(a){c.top=void 0!==a.top?a.top:c.top,c.right=void 0!==a.right?a.right:c.right,c.bottom=void 0!==a.bottom?a.bottom:c.bottom,c.left=void 0!==a.left?a.left:c.left}},color:{get:function(){return j},set:function(b){j=a.utils.getColor(b)}}}),a.utils.initOptions(b),b},a.models.pie=function(){"use strict";function b(E){return D.reset(),E.each(function(b){function E(a,b){a.endAngle=isNaN(a.endAngle)?0:a.endAngle,a.startAngle=isNaN(a.startAngle)?0:a.startAngle,p||(a.innerRadius=0);var c=d3.interpolate(this._current,a);return this._current=c(0),function(a){return B[b](c(a))}}var F=d-c.left-c.right,G=e-c.top-c.bottom,H=Math.min(F,G)/2,I=[],J=[];if(i=d3.select(this),0===z.length)for(var K=H-H/5,L=y*H,M=0;Mc)return"";if("function"==typeof n)d=n(a,b,{key:f(a.data),value:g(a.data),percent:k(c)});else switch(n){case"key":d=f(a.data);break;case"value":d=k(g(a.data));break;case"percent":d=d3.format("%")(c)}return d})}}),D.renderEnd("pie immediate"),b}var c={top:0,right:0,bottom:0,left:0},d=500,e=500,f=function(a){return a.x},g=function(a){return a.y},h=Math.floor(1e4*Math.random()),i=null,j=a.utils.defaultColor(),k=d3.format(",.2f"),l=!0,m=!1,n="key",o=.02,p=!1,q=!1,r=!0,s=0,t=!1,u=!1,v=!1,w=!1,x=0,y=.5,z=[],A=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),B=[],C=[],D=a.utils.renderWatch(A);return b.dispatch=A,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{arcsRadius:{get:function(){return z},set:function(a){z=a}},width:{get:function(){return d},set:function(a){d=a}},height:{get:function(){return e},set:function(a){e=a}},showLabels:{get:function(){return l},set:function(a){l=a}},title:{get:function(){return q},set:function(a){q=a}},titleOffset:{get:function(){return s},set:function(a){s=a}},labelThreshold:{get:function(){return o},set:function(a){o=a}},valueFormat:{get:function(){return k},set:function(a){k=a}},x:{get:function(){return f},set:function(a){f=a}},id:{get:function(){return h},set:function(a){h=a}},endAngle:{get:function(){return w},set:function(a){w=a}},startAngle:{get:function(){return u},set:function(a){u=a}},padAngle:{get:function(){return v},set:function(a){v=a}},cornerRadius:{get:function(){return x},set:function(a){x=a}},donutRatio:{get:function(){return y},set:function(a){y=a}},labelsOutside:{get:function(){return m},set:function(a){m=a}},labelSunbeamLayout:{get:function(){return t},set:function(a){t=a}},donut:{get:function(){return p},set:function(a){p=a}},growOnHover:{get:function(){return r},set:function(a){r=a}},pieLabelsOutside:{get:function(){return m},set:function(b){m=b,a.deprecated("pieLabelsOutside","use labelsOutside instead")}},donutLabelsOutside:{get:function(){return m},set:function(b){m=b,a.deprecated("donutLabelsOutside","use labelsOutside instead")}},labelFormat:{get:function(){return k},set:function(b){k=b,a.deprecated("labelFormat","use valueFormat instead")}},margin:{get:function(){return c},set:function(a){c.top="undefined"!=typeof a.top?a.top:c.top,c.right="undefined"!=typeof a.right?a.right:c.right,c.bottom="undefined"!=typeof a.bottom?a.bottom:c.bottom,c.left="undefined"!=typeof a.left?a.left:c.left}},y:{get:function(){return g},set:function(a){g=d3.functor(a)}},color:{get:function(){return j},set:function(b){j=a.utils.getColor(b)}},labelType:{get:function(){return n},set:function(a){n=a||"key"}}}),a.utils.initOptions(b),b},a.models.pieChart=function(){"use strict";function b(e){return q.reset(),q.models(c),e.each(function(e){var k=d3.select(this);a.utils.initSVG(k);var n=a.utils.availableWidth(g,k,f),o=a.utils.availableHeight(h,k,f);if(b.update=function(){k.transition().call(b)},b.container=this,l.setter(s(e),b.update).getter(r(e)).update(),l.disabled=e.map(function(a){return!!a.disabled}),!m){var q;m={};for(q in l)l[q]instanceof Array?m[q]=l[q].slice(0):m[q]=l[q]}if(!e||!e.length)return a.utils.noData(b,k),b;k.selectAll(".nv-noData").remove();var t=k.selectAll("g.nv-wrap.nv-pieChart").data([e]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),v=t.select("g");if(u.append("g").attr("class","nv-pieWrap"),u.append("g").attr("class","nv-legendWrap"),i)if("top"===j)d.width(n).key(c.x()),t.select(".nv-legendWrap").datum(e).call(d),f.top!=d.height()&&(f.top=d.height(),o=a.utils.availableHeight(h,k,f)),t.select(".nv-legendWrap").attr("transform","translate(0,"+-f.top+")");else if("right"===j){var w=a.models.legend().width();w>n/2&&(w=n/2),d.height(o).key(c.x()),d.width(w),n-=d.width(),t.select(".nv-legendWrap").datum(e).call(d).attr("transform","translate("+n+",0)")}t.attr("transform","translate("+f.left+","+f.top+")"),c.width(n).height(o);var x=v.select(".nv-pieWrap").datum([e]);d3.transition(x).call(c),d.dispatch.on("stateChange",function(a){for(var c in a)l[c]=a[c];p.stateChange(l),b.update()}),p.on("changeState",function(a){"undefined"!=typeof a.disabled&&(e.forEach(function(b,c){b.disabled=a.disabled[c]}),l.disabled=a.disabled),b.update()})}),q.renderEnd("pieChart immediate"),b}var c=a.models.pie(),d=a.models.legend(),e=a.models.tooltip(),f={top:30,right:20,bottom:20,left:20},g=null,h=null,i=!0,j="top",k=a.utils.defaultColor(),l=a.utils.state(),m=null,n=null,o=250,p=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState","renderEnd");e.headerEnabled(!1).duration(0).valueFormatter(function(a,b){return c.valueFormat()(a,b)});var q=a.utils.renderWatch(p),r=function(a){return function(){return{active:a.map(function(a){return!a.disabled})}}},s=function(a){return function(b){void 0!==b.active&&a.forEach(function(a,c){a.disabled=!b.active[c]})}};return c.dispatch.on("elementMouseover.tooltip",function(a){a.series={key:b.x()(a.data),value:b.y()(a.data),color:a.color},e.data(a).hidden(!1)}),c.dispatch.on("elementMouseout.tooltip",function(a){e.hidden(!0)}),c.dispatch.on("elementMousemove.tooltip",function(a){e.position({top:d3.event.pageY,left:d3.event.pageX})()}),b.legend=d,b.dispatch=p,b.pie=c,b.tooltip=e,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{noData:{get:function(){return n},set:function(a){n=a}},showLegend:{get:function(){return i},set:function(a){i=a}},legendPosition:{get:function(){return j},set:function(a){j=a}},defaultState:{get:function(){return m},set:function(a){m=a}},tooltips:{get:function(){return e.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),e.enabled(!!b)}},tooltipContent:{get:function(){return e.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),e.contentGenerator(b)}},color:{get:function(){return k},set:function(a){k=a,d.color(k),c.color(k)}},duration:{get:function(){return o},set:function(a){o=a,q.reset(o)}},margin:{get:function(){return f},set:function(a){f.top=void 0!==a.top?a.top:f.top,f.right=void 0!==a.right?a.right:f.right,f.bottom=void 0!==a.bottom?a.bottom:f.bottom,f.left=void 0!==a.left?a.left:f.left}}}),a.utils.inheritOptions(b,c),a.utils.initOptions(b),b},a.models.scatter=function(){"use strict";function b(N){return P.reset(),N.each(function(b){function N(){if(O=!1,!w)return!1;if(M===!0){var a=d3.merge(b.map(function(a,b){return a.values.map(function(a,c){var d=p(a,c),e=q(a,c);return[m(d)+1e-4*Math.random(),n(e)+1e-4*Math.random(),b,c,a]}).filter(function(a,b){return x(a[4],b)})}));if(0==a.length)return!1;a.length<3&&(a.push([m.range()[0]-20,n.range()[0]-20,null,null]),a.push([m.range()[1]+20,n.range()[1]+20,null,null]),a.push([m.range()[0]-20,n.range()[0]+20,null,null]),a.push([m.range()[1]+20,n.range()[1]-20,null,null]));var c=d3.geom.polygon([[-10,-10],[-10,i+10],[h+10,i+10],[h+10,-10]]),d=d3.geom.voronoi(a).map(function(b,d){return{data:c.clip(b),series:a[d][2],point:a[d][3]}});U.select(".nv-point-paths").selectAll("path").remove();var e=U.select(".nv-point-paths").selectAll("path").data(d),f=e.enter().append("svg:path").attr("d",function(a){return a&&a.data&&0!==a.data.length?"M"+a.data.join(",")+"Z":"M 0 0"}).attr("id",function(a,b){return"nv-path-"+b}).attr("clip-path",function(a,b){return"url(#nv-clip-"+b+")"});C&&f.style("fill",d3.rgb(230,230,230)).style("fill-opacity",.4).style("stroke-opacity",1).style("stroke",d3.rgb(200,200,200)),B&&(U.select(".nv-point-clips").selectAll("clipPath").remove(),U.select(".nv-point-clips").selectAll("clipPath").data(a).enter().append("svg:clipPath").attr("id",function(a,b){return"nv-clip-"+b}).append("svg:circle").attr("cx",function(a){return a[0]}).attr("cy",function(a){return a[1]}).attr("r",D));var k=function(a,c){if(O)return 0;var d=b[a.series];if(void 0!==d){var e=d.values[a.point];e.color=j(d,a.series),e.x=p(e),e.y=q(e);var f=l.node().getBoundingClientRect(),h=window.pageYOffset||document.documentElement.scrollTop,i=window.pageXOffset||document.documentElement.scrollLeft,k={left:m(p(e,a.point))+f.left+i+g.left+10,top:n(q(e,a.point))+f.top+h+g.top+10};c({point:e,series:d,pos:k,seriesIndex:a.series,pointIndex:a.point})}};e.on("click",function(a){k(a,L.elementClick)}).on("dblclick",function(a){k(a,L.elementDblClick)}).on("mouseover",function(a){k(a,L.elementMouseover)}).on("mouseout",function(a,b){k(a,L.elementMouseout)})}else U.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(a,c){if(O||!b[a.series])return 0;var d=b[a.series],e=d.values[c];L.elementClick({point:e,series:d,pos:[m(p(e,c))+g.left,n(q(e,c))+g.top],seriesIndex:a.series,pointIndex:c})}).on("dblclick",function(a,c){if(O||!b[a.series])return 0;var d=b[a.series],e=d.values[c];L.elementDblClick({point:e,series:d,pos:[m(p(e,c))+g.left,n(q(e,c))+g.top],seriesIndex:a.series,pointIndex:c})}).on("mouseover",function(a,c){if(O||!b[a.series])return 0;var d=b[a.series],e=d.values[c];L.elementMouseover({point:e,series:d,pos:[m(p(e,c))+g.left,n(q(e,c))+g.top],seriesIndex:a.series,pointIndex:c,color:j(a,c)})}).on("mouseout",function(a,c){if(O||!b[a.series])return 0;var d=b[a.series],e=d.values[c];L.elementMouseout({point:e,series:d,seriesIndex:a.series,pointIndex:c,color:j(a,c)})})}l=d3.select(this);var R=a.utils.availableWidth(h,l,g),S=a.utils.availableHeight(i,l,g);a.utils.initSVG(l),b.forEach(function(a,b){a.values.forEach(function(a){a.series=b})});var T=E&&F&&I?[]:d3.merge(b.map(function(a){return a.values.map(function(a,b){return{x:p(a,b),y:q(a,b),size:r(a,b)}})}));m.domain(E||d3.extent(T.map(function(a){return a.x}).concat(t))),y&&b[0]?m.range(G||[(R*z+R)/(2*b[0].values.length),R-R*(1+z)/(2*b[0].values.length)]):m.range(G||[0,R]),n.domain(F||d3.extent(T.map(function(a){return a.y}).concat(u))).range(H||[S,0]),o.domain(I||d3.extent(T.map(function(a){return a.size}).concat(v))).range(J||Q),K=m.domain()[0]===m.domain()[1]||n.domain()[0]===n.domain()[1],m.domain()[0]===m.domain()[1]&&(m.domain()[0]?m.domain([m.domain()[0]-.01*m.domain()[0],m.domain()[1]+.01*m.domain()[1]]):m.domain([-1,1])),n.domain()[0]===n.domain()[1]&&(n.domain()[0]?n.domain([n.domain()[0]-.01*n.domain()[0],n.domain()[1]+.01*n.domain()[1]]):n.domain([-1,1])),isNaN(m.domain()[0])&&m.domain([-1,1]),isNaN(n.domain()[0])&&n.domain([-1,1]),c=c||m,d=d||n,e=e||o;var U=l.selectAll("g.nv-wrap.nv-scatter").data([b]),V=U.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+k),W=V.append("defs"),X=V.append("g"),Y=U.select("g");U.classed("nv-single-point",K),X.append("g").attr("class","nv-groups"),X.append("g").attr("class","nv-point-paths"),V.append("g").attr("class","nv-point-clips"),U.attr("transform","translate("+g.left+","+g.top+")"),W.append("clipPath").attr("id","nv-edge-clip-"+k).append("rect"),U.select("#nv-edge-clip-"+k+" rect").attr("width",R).attr("height",S>0?S:0),Y.attr("clip-path",A?"url(#nv-edge-clip-"+k+")":""),O=!0;var Z=U.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});Z.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),Z.exit().remove(),Z.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),Z.watchTransition(P,"scatter: groups").style("fill",function(a,b){return j(a,b)}).style("stroke",function(a,b){return j(a,b)}).style("stroke-opacity",1).style("fill-opacity",.5);var $=Z.selectAll("path.nv-point").data(function(a){return a.values.map(function(a,b){return[a,b]}).filter(function(a,b){return x(a[0],b)})});$.enter().append("path").style("fill",function(a){return a.color}).style("stroke",function(a){return a.color}).attr("transform",function(a){return"translate("+c(p(a[0],a[1]))+","+d(q(a[0],a[1]))+")"}).attr("d",a.utils.symbol().type(function(a){return s(a[0])}).size(function(a){return o(r(a[0],a[1]))})),$.exit().remove(),Z.exit().selectAll("path.nv-point").watchTransition(P,"scatter exit").attr("transform",function(a){return"translate("+m(p(a[0],a[1]))+","+n(q(a[0],a[1]))+")"}).remove(),$.each(function(a){d3.select(this).classed("nv-point",!0).classed("nv-point-"+a[1],!0).classed("nv-noninteractive",!w).classed("hover",!1)}),$.watchTransition(P,"scatter points").attr("transform",function(a){return"translate("+m(p(a[0],a[1]))+","+n(q(a[0],a[1]))+")"}).attr("d",a.utils.symbol().type(function(a){return s(a[0])}).size(function(a){return o(r(a[0],a[1]))})),clearTimeout(f),f=setTimeout(N,300),c=m.copy(),d=n.copy(),e=o.copy()}),P.renderEnd("scatter immediate"),b}var c,d,e,f,g={top:0,right:0,bottom:0,left:0},h=null,i=null,j=a.utils.defaultColor(),k=Math.floor(1e5*Math.random()),l=null,m=d3.scale.linear(),n=d3.scale.linear(),o=d3.scale.linear(),p=function(a){return a.x},q=function(a){return a.y},r=function(a){return a.size||1},s=function(a){return a.shape||"circle"},t=[],u=[],v=[],w=!0,x=function(a){return!a.notActive},y=!1,z=.1,A=!1,B=!0,C=!1,D=function(){return 25},E=null,F=null,G=null,H=null,I=null,J=null,K=!1,L=d3.dispatch("elementClick","elementDblClick","elementMouseover","elementMouseout","renderEnd"),M=!0,N=250,O=!1,P=a.utils.renderWatch(L,N),Q=[16,256];return b.dispatch=L,b.options=a.utils.optionsFunc.bind(b),b._calls=new function(){this.clearHighlights=function(){return a.dom.write(function(){l.selectAll(".nv-point.hover").classed("hover",!1)}),null},this.highlightPoint=function(b,c,d){a.dom.write(function(){l.select(" .nv-series-"+b+" .nv-point-"+c).classed("hover",d)})}},L.on("elementMouseover.point",function(a){w&&b._calls.highlightPoint(a.seriesIndex,a.pointIndex,!0)}),L.on("elementMouseout.point",function(a){w&&b._calls.highlightPoint(a.seriesIndex,a.pointIndex,!1)}),b._options=Object.create({},{width:{get:function(){return h},set:function(a){h=a}},height:{get:function(){return i},set:function(a){i=a}},xScale:{get:function(){return m},set:function(a){m=a}},yScale:{get:function(){return n},set:function(a){n=a}},pointScale:{get:function(){return o},set:function(a){o=a}},xDomain:{get:function(){return E},set:function(a){E=a}},yDomain:{get:function(){return F},set:function(a){F=a}},pointDomain:{get:function(){return I},set:function(a){I=a}},xRange:{get:function(){return G},set:function(a){G=a}},yRange:{get:function(){return H},set:function(a){H=a}},pointRange:{get:function(){return J},set:function(a){J=a}},forceX:{get:function(){return t},set:function(a){t=a}},forceY:{get:function(){return u},set:function(a){u=a}},forcePoint:{get:function(){return v},set:function(a){v=a}},interactive:{get:function(){return w},set:function(a){w=a}},pointActive:{get:function(){return x},set:function(a){x=a}},padDataOuter:{get:function(){return z},set:function(a){z=a}},padData:{get:function(){return y},set:function(a){y=a}},clipEdge:{get:function(){return A},set:function(a){A=a}},clipVoronoi:{get:function(){return B},set:function(a){B=a}},clipRadius:{get:function(){return D},set:function(a){D=a}},showVoronoi:{get:function(){return C},set:function(a){C=a}},id:{get:function(){return k},set:function(a){k=a}},x:{get:function(){return p},set:function(a){p=d3.functor(a)}},y:{get:function(){return q},set:function(a){q=d3.functor(a)}},pointSize:{get:function(){return r},set:function(a){r=d3.functor(a)}},pointShape:{get:function(){return s},set:function(a){s=d3.functor(a)}},margin:{get:function(){return g},set:function(a){g.top=void 0!==a.top?a.top:g.top,g.right=void 0!==a.right?a.right:g.right,g.bottom=void 0!==a.bottom?a.bottom:g.bottom,g.left=void 0!==a.left?a.left:g.left}},duration:{get:function(){return N},set:function(a){N=a,P.reset(N)}},color:{get:function(){return j},set:function(b){j=a.utils.getColor(b)}},useVoronoi:{get:function(){return M},set:function(a){M=a,M===!1&&(B=!1)}}}),a.utils.initOptions(b),b},a.models.scatterChart=function(){"use strict";function b(z){return D.reset(),D.models(c),t&&D.models(d),u&&D.models(e),q&&D.models(g),r&&D.models(h),z.each(function(z){m=d3.select(this),a.utils.initSVG(m);var G=a.utils.availableWidth(k,m,j),H=a.utils.availableHeight(l,m,j);if(b.update=function(){0===A?m.call(b):m.transition().duration(A).call(b)},b.container=this,w.setter(F(z),b.update).getter(E(z)).update(),w.disabled=z.map(function(a){return!!a.disabled}),!x){var I;x={};for(I in w)w[I]instanceof Array?x[I]=w[I].slice(0):x[I]=w[I]}if(!(z&&z.length&&z.filter(function(a){return a.values.length}).length))return a.utils.noData(b,m),D.renderEnd("scatter immediate"),b;m.selectAll(".nv-noData").remove(),o=c.xScale(),p=c.yScale();var J=m.selectAll("g.nv-wrap.nv-scatterChart").data([z]),K=J.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+c.id()),L=K.append("g"),M=J.select("g");if(L.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none"),L.append("g").attr("class","nv-x nv-axis"),L.append("g").attr("class","nv-y nv-axis"),L.append("g").attr("class","nv-scatterWrap"),L.append("g").attr("class","nv-regressionLinesWrap"),L.append("g").attr("class","nv-distWrap"),L.append("g").attr("class","nv-legendWrap"),v&&M.select(".nv-y.nv-axis").attr("transform","translate("+G+",0)"),s){var N=G;f.width(N),J.select(".nv-legendWrap").datum(z).call(f),j.top!=f.height()&&(j.top=f.height(),H=a.utils.availableHeight(l,m,j)),J.select(".nv-legendWrap").attr("transform","translate(0,"+-j.top+")")}J.attr("transform","translate("+j.left+","+j.top+")"),c.width(G).height(H).color(z.map(function(a,b){return a.color||n(a,b)}).filter(function(a,b){return!z[b].disabled})),J.select(".nv-scatterWrap").datum(z.filter(function(a){return!a.disabled})).call(c),J.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+c.id()+")");var O=J.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(a){return a});O.enter().append("g").attr("class","nv-regLines");var P=O.selectAll(".nv-regLine").data(function(a){return[a]});P.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0),P.filter(function(a){return a.intercept&&a.slope}).watchTransition(D,"scatterPlusLineChart: regline").attr("x1",o.range()[0]).attr("x2",o.range()[1]).attr("y1",function(a,b){return p(o.domain()[0]*a.slope+a.intercept)}).attr("y2",function(a,b){return p(o.domain()[1]*a.slope+a.intercept)}).style("stroke",function(a,b,c){return n(a,c)}).style("stroke-opacity",function(a,b){return a.disabled||"undefined"==typeof a.slope||"undefined"==typeof a.intercept?0:1}),t&&(d.scale(o)._ticks(a.utils.calcTicksX(G/100,z)).tickSize(-H,0),M.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(d)),u&&(e.scale(p)._ticks(a.utils.calcTicksY(H/36,z)).tickSize(-G,0),M.select(".nv-y.nv-axis").call(e)),q&&(g.getData(c.x()).scale(o).width(G).color(z.map(function(a,b){return a.color||n(a,b)}).filter(function(a,b){return!z[b].disabled})),L.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),M.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(z.filter(function(a){return!a.disabled})).call(g)),r&&(h.getData(c.y()).scale(p).width(H).color(z.map(function(a,b){return a.color||n(a,b)}).filter(function(a,b){return!z[b].disabled})),L.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),M.select(".nv-distributionY").attr("transform","translate("+(v?G:-h.size())+",0)").datum(z.filter(function(a){return!a.disabled})).call(h)),f.dispatch.on("stateChange",function(a){for(var c in a)w[c]=a[c];y.stateChange(w),b.update()}),y.on("changeState",function(a){"undefined"!=typeof a.disabled&&(z.forEach(function(b,c){b.disabled=a.disabled[c]}),w.disabled=a.disabled),b.update()}),c.dispatch.on("elementMouseout.tooltip",function(a){i.hidden(!0),m.select(".nv-chart-"+c.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),m.select(".nv-chart-"+c.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",h.size())}),c.dispatch.on("elementMouseover.tooltip",function(a){m.select(".nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos.top-H-j.top),m.select(".nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos.left+g.size()-j.left),i.position(a.pos).data(a).hidden(!1); -}),B=o.copy(),C=p.copy()}),D.renderEnd("scatter with line immediate"),b}var c=a.models.scatter(),d=a.models.axis(),e=a.models.axis(),f=a.models.legend(),g=a.models.distribution(),h=a.models.distribution(),i=a.models.tooltip(),j={top:30,right:20,bottom:50,left:75},k=null,l=null,m=null,n=a.utils.defaultColor(),o=c.xScale(),p=c.yScale(),q=!1,r=!1,s=!0,t=!0,u=!0,v=!1,w=a.utils.state(),x=null,y=d3.dispatch("stateChange","changeState","renderEnd"),z=null,A=250;c.xScale(o).yScale(p),d.orient("bottom").tickPadding(10),e.orient(v?"right":"left").tickPadding(10),g.axis("x"),h.axis("y"),i.headerFormatter(function(a,b){return d.tickFormat()(a,b)}).valueFormatter(function(a,b){return e.tickFormat()(a,b)});var B,C,D=a.utils.renderWatch(y,A),E=function(a){return function(){return{active:a.map(function(a){return!a.disabled})}}},F=function(a){return function(b){void 0!==b.active&&a.forEach(function(a,c){a.disabled=!b.active[c]})}};return b.dispatch=y,b.scatter=c,b.legend=f,b.xAxis=d,b.yAxis=e,b.distX=g,b.distY=h,b.tooltip=i,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return k},set:function(a){k=a}},height:{get:function(){return l},set:function(a){l=a}},container:{get:function(){return m},set:function(a){m=a}},showDistX:{get:function(){return q},set:function(a){q=a}},showDistY:{get:function(){return r},set:function(a){r=a}},showLegend:{get:function(){return s},set:function(a){s=a}},showXAxis:{get:function(){return t},set:function(a){t=a}},showYAxis:{get:function(){return u},set:function(a){u=a}},defaultState:{get:function(){return x},set:function(a){x=a}},noData:{get:function(){return z},set:function(a){z=a}},duration:{get:function(){return A},set:function(a){A=a}},tooltips:{get:function(){return i.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),i.enabled(!!b)}},tooltipContent:{get:function(){return i.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),i.contentGenerator(b)}},tooltipXContent:{get:function(){return i.contentGenerator()},set:function(b){a.deprecated("tooltipContent","This option is removed, put values into main tooltip.")}},tooltipYContent:{get:function(){return i.contentGenerator()},set:function(b){a.deprecated("tooltipContent","This option is removed, put values into main tooltip.")}},margin:{get:function(){return j},set:function(a){j.top=void 0!==a.top?a.top:j.top,j.right=void 0!==a.right?a.right:j.right,j.bottom=void 0!==a.bottom?a.bottom:j.bottom,j.left=void 0!==a.left?a.left:j.left}},rightAlignYAxis:{get:function(){return v},set:function(a){v=a,e.orient(a?"right":"left")}},color:{get:function(){return n},set:function(b){n=a.utils.getColor(b),f.color(n),g.color(n),h.color(n)}}}),a.utils.inheritOptions(b,c),a.utils.initOptions(b),b},a.models.sparkline=function(){"use strict";function b(k){return k.each(function(b){var k=h-g.left-g.right,q=i-g.top-g.bottom;j=d3.select(this),a.utils.initSVG(j),l.domain(c||d3.extent(b,n)).range(e||[0,k]),m.domain(d||d3.extent(b,o)).range(f||[q,0]);var r=j.selectAll("g.nv-wrap.nv-sparkline").data([b]),s=r.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");s.append("g"),r.select("g");r.attr("transform","translate("+g.left+","+g.top+")");var t=r.selectAll("path").data(function(a){return[a]});t.enter().append("path"),t.exit().remove(),t.style("stroke",function(a,b){return a.color||p(a,b)}).attr("d",d3.svg.line().x(function(a,b){return l(n(a,b))}).y(function(a,b){return m(o(a,b))}));var u=r.selectAll("circle.nv-point").data(function(a){function b(b){if(-1!=b){var c=a[b];return c.pointIndex=b,c}return null}var c=a.map(function(a,b){return o(a,b)}),d=b(c.lastIndexOf(m.domain()[1])),e=b(c.indexOf(m.domain()[0])),f=b(c.length-1);return[e,d,f].filter(function(a){return null!=a})});u.enter().append("circle"),u.exit().remove(),u.attr("cx",function(a,b){return l(n(a,a.pointIndex))}).attr("cy",function(a,b){return m(o(a,a.pointIndex))}).attr("r",2).attr("class",function(a,b){return n(a,a.pointIndex)==l.domain()[1]?"nv-point nv-currentValue":o(a,a.pointIndex)==m.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),b}var c,d,e,f,g={top:2,right:0,bottom:2,left:0},h=400,i=32,j=null,k=!0,l=d3.scale.linear(),m=d3.scale.linear(),n=function(a){return a.x},o=function(a){return a.y},p=a.utils.getColor(["#000"]);return b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return h},set:function(a){h=a}},height:{get:function(){return i},set:function(a){i=a}},xDomain:{get:function(){return c},set:function(a){c=a}},yDomain:{get:function(){return d},set:function(a){d=a}},xRange:{get:function(){return e},set:function(a){e=a}},yRange:{get:function(){return f},set:function(a){f=a}},xScale:{get:function(){return l},set:function(a){l=a}},yScale:{get:function(){return m},set:function(a){m=a}},animate:{get:function(){return k},set:function(a){k=a}},x:{get:function(){return n},set:function(a){n=d3.functor(a)}},y:{get:function(){return o},set:function(a){o=d3.functor(a)}},margin:{get:function(){return g},set:function(a){g.top=void 0!==a.top?a.top:g.top,g.right=void 0!==a.right?a.right:g.right,g.bottom=void 0!==a.bottom?a.bottom:g.bottom,g.left=void 0!==a.left?a.left:g.left}},color:{get:function(){return p},set:function(b){p=a.utils.getColor(b)}}}),a.utils.initOptions(b),b},a.models.sparklinePlus=function(){"use strict";function b(p){return p.each(function(q){function r(){if(!j){var a=A.selectAll(".nv-hoverValue").data(i),b=a.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);a.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove(),a.attr("transform",function(a){return"translate("+c(e.x()(q[a],a))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1),i.length&&(b.append("line").attr("x1",0).attr("y1",-f.top).attr("x2",0).attr("y2",v),b.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-f.top).attr("text-anchor","end").attr("dy",".9em"),A.select(".nv-hoverValue .nv-xValue").text(k(e.x()(q[i[0]],i[0]))),b.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-f.top).attr("text-anchor","start").attr("dy",".9em"),A.select(".nv-hoverValue .nv-yValue").text(l(e.y()(q[i[0]],i[0]))))}}function s(){function a(a,b){for(var c=Math.abs(e.x()(a[0],0)-b),d=0,f=0;fc;++c){for(b=0,d=0;bb;b++)a[b][c][1]/=d;else for(b=0;e>b;b++)a[b][c][1]=0}for(c=0;f>c;++c)g[c]=0;return g}}),u.renderEnd("stackedArea immediate"),b}var c,d,e={top:0,right:0,bottom:0,left:0},f=960,g=500,h=a.utils.defaultColor(),i=Math.floor(1e5*Math.random()),j=null,k=function(a){return a.x},l=function(a){return a.y},m="stack",n="zero",o="default",p="linear",q=!1,r=a.models.scatter(),s=250,t=d3.dispatch("areaClick","areaMouseover","areaMouseout","renderEnd","elementClick","elementMouseover","elementMouseout");r.pointSize(2.2).pointDomain([2.2,2.2]);var u=a.utils.renderWatch(t,s);return b.dispatch=t,b.scatter=r,r.dispatch.on("elementClick",function(){t.elementClick.apply(this,arguments)}),r.dispatch.on("elementMouseover",function(){t.elementMouseover.apply(this,arguments)}),r.dispatch.on("elementMouseout",function(){t.elementMouseout.apply(this,arguments)}),b.interpolate=function(a){return arguments.length?(p=a,b):p},b.duration=function(a){return arguments.length?(s=a,u.reset(s),r.duration(s),b):s},b.dispatch=t,b.scatter=r,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return f},set:function(a){f=a}},height:{get:function(){return g},set:function(a){g=a}},clipEdge:{get:function(){return q},set:function(a){q=a}},offset:{get:function(){return n},set:function(a){n=a}},order:{get:function(){return o},set:function(a){o=a}},interpolate:{get:function(){return p},set:function(a){p=a}},x:{get:function(){return k},set:function(a){k=d3.functor(a)}},y:{get:function(){return l},set:function(a){l=d3.functor(a)}},margin:{get:function(){return e},set:function(a){e.top=void 0!==a.top?a.top:e.top,e.right=void 0!==a.right?a.right:e.right,e.bottom=void 0!==a.bottom?a.bottom:e.bottom,e.left=void 0!==a.left?a.left:e.left}},color:{get:function(){return h},set:function(b){h=a.utils.getColor(b)}},style:{get:function(){return m},set:function(a){switch(m=a){case"stack":b.offset("zero"),b.order("default");break;case"stream":b.offset("wiggle"),b.order("inside-out");break;case"stream-center":b.offset("silhouette"),b.order("inside-out");break;case"expand":b.offset("expand"),b.order("default");break;case"stack_percent":b.offset(b.d3_stackedOffset_stackPercent),b.order("default")}}},duration:{get:function(){return s},set:function(a){s=a,u.reset(s),r.duration(s)}}}),a.utils.inheritOptions(b,r),a.utils.initOptions(b),b},a.models.stackedAreaChart=function(){"use strict";function b(k){return F.reset(),F.models(e),r&&F.models(f),s&&F.models(g),k.each(function(k){var x=d3.select(this),F=this;a.utils.initSVG(x);var K=a.utils.availableWidth(m,x,l),L=a.utils.availableHeight(n,x,l);if(b.update=function(){x.transition().duration(C).call(b)},b.container=this,v.setter(I(k),b.update).getter(H(k)).update(),v.disabled=k.map(function(a){return!!a.disabled}),!w){var M;w={};for(M in v)v[M]instanceof Array?w[M]=v[M].slice(0):w[M]=v[M]}if(!(k&&k.length&&k.filter(function(a){return a.values.length}).length))return a.utils.noData(b,x),b;x.selectAll(".nv-noData").remove(),c=e.xScale(),d=e.yScale();var N=x.selectAll("g.nv-wrap.nv-stackedAreaChart").data([k]),O=N.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),P=N.select("g");if(O.append("rect").style("opacity",0),O.append("g").attr("class","nv-x nv-axis"),O.append("g").attr("class","nv-y nv-axis"),O.append("g").attr("class","nv-stackedWrap"),O.append("g").attr("class","nv-legendWrap"),O.append("g").attr("class","nv-controlsWrap"),O.append("g").attr("class","nv-interactive"),P.select("rect").attr("width",K).attr("height",L),q){var Q=p?K-z:K;h.width(Q),P.select(".nv-legendWrap").datum(k).call(h),l.top!=h.height()&&(l.top=h.height(),L=a.utils.availableHeight(n,x,l)),P.select(".nv-legendWrap").attr("transform","translate("+(K-Q)+","+-l.top+")")}if(p){var R=[{key:B.stacked||"Stacked",metaKey:"Stacked",disabled:"stack"!=e.style(),style:"stack"},{key:B.stream||"Stream",metaKey:"Stream",disabled:"stream"!=e.style(),style:"stream"},{key:B.expanded||"Expanded",metaKey:"Expanded",disabled:"expand"!=e.style(),style:"expand"},{key:B.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:"stack_percent"!=e.style(),style:"stack_percent"}];z=A.length/3*260,R=R.filter(function(a){return-1!==A.indexOf(a.metaKey)}),i.width(z).color(["#444","#444","#444"]),P.select(".nv-controlsWrap").datum(R).call(i),l.top!=Math.max(i.height(),h.height())&&(l.top=Math.max(i.height(),h.height()),L=a.utils.availableHeight(n,x,l)),P.select(".nv-controlsWrap").attr("transform","translate(0,"+-l.top+")")}N.attr("transform","translate("+l.left+","+l.top+")"),t&&P.select(".nv-y.nv-axis").attr("transform","translate("+K+",0)"),u&&(j.width(K).height(L).margin({left:l.left,top:l.top}).svgContainer(x).xScale(c),N.select(".nv-interactive").call(j)),e.width(K).height(L);var S=P.select(".nv-stackedWrap").datum(k);if(S.transition().call(e),r&&(f.scale(c)._ticks(a.utils.calcTicksX(K/100,k)).tickSize(-L,0),P.select(".nv-x.nv-axis").attr("transform","translate(0,"+L+")"),P.select(".nv-x.nv-axis").transition().duration(0).call(f)),s){var T;if(T="wiggle"===e.offset()?0:a.utils.calcTicksY(L/36,k),g.scale(d)._ticks(T).tickSize(-K,0),"expand"===e.style()||"stack_percent"===e.style()){var U=g.tickFormat();D&&U===J||(D=U),g.tickFormat(J)}else D&&(g.tickFormat(D),D=null);P.select(".nv-y.nv-axis").transition().duration(0).call(g)}e.dispatch.on("areaClick.toggle",function(a){1===k.filter(function(a){return!a.disabled}).length?k.forEach(function(a){a.disabled=!1}):k.forEach(function(b,c){b.disabled=c!=a.seriesIndex}),v.disabled=k.map(function(a){return!!a.disabled}),y.stateChange(v),b.update()}),h.dispatch.on("stateChange",function(a){for(var c in a)v[c]=a[c];y.stateChange(v),b.update()}),i.dispatch.on("legendClick",function(a,c){a.disabled&&(R=R.map(function(a){return a.disabled=!0,a}),a.disabled=!1,e.style(a.style),v.style=e.style(),y.stateChange(v),b.update())}),j.dispatch.on("elementMousemove",function(c){e.clearHighlights();var d,g,h,i=[];if(k.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(f,j){g=a.interactiveBisect(f.values,c.pointXValue,b.x());var k=f.values[g],l=b.y()(k,g);if(null!=l&&e.highlightPoint(j,g,!0),"undefined"!=typeof k){"undefined"==typeof d&&(d=k),"undefined"==typeof h&&(h=b.xScale()(b.x()(k,g)));var m="expand"==e.style()?k.display.y:b.y()(k,g);i.push({key:f.key,value:m,color:o(f,f.seriesIndex),stackedValue:k.display})}}),i.reverse(),i.length>2){var m=b.yScale().invert(c.mouseY),n=null;i.forEach(function(a,b){m=Math.abs(m);var c=Math.abs(a.stackedValue.y0),d=Math.abs(a.stackedValue.y);return m>=c&&d+c>=m?void(n=b):void 0}),null!=n&&(i[n].highlight=!0)}var p=f.tickFormat()(b.x()(d,g)),q=j.tooltip.valueFormatter();"expand"===e.style()||"stack_percent"===e.style()?(E||(E=q),q=d3.format(".1%")):E&&(q=E,E=null),j.tooltip.position({left:h+l.left,top:c.mouseY+l.top}).chartContainer(F.parentNode).valueFormatter(q).data({value:p,series:i})(),j.renderGuideLine(h)}),j.dispatch.on("elementMouseout",function(a){e.clearHighlights()}),y.on("changeState",function(a){"undefined"!=typeof a.disabled&&k.length===a.disabled.length&&(k.forEach(function(b,c){b.disabled=a.disabled[c]}),v.disabled=a.disabled),"undefined"!=typeof a.style&&(e.style(a.style),G=a.style),b.update()})}),F.renderEnd("stacked Area chart immediate"),b}var c,d,e=a.models.stackedArea(),f=a.models.axis(),g=a.models.axis(),h=a.models.legend(),i=a.models.legend(),j=a.interactiveGuideline(),k=a.models.tooltip(),l={top:30,right:25,bottom:50,left:60},m=null,n=null,o=a.utils.defaultColor(),p=!0,q=!0,r=!0,s=!0,t=!1,u=!1,v=a.utils.state(),w=null,x=null,y=d3.dispatch("stateChange","changeState","renderEnd"),z=250,A=["Stacked","Stream","Expanded"],B={},C=250;v.style=e.style(),f.orient("bottom").tickPadding(7),g.orient(t?"right":"left"),k.headerFormatter(function(a,b){return f.tickFormat()(a,b)}).valueFormatter(function(a,b){return g.tickFormat()(a,b)}),j.tooltip.headerFormatter(function(a,b){return f.tickFormat()(a,b)}).valueFormatter(function(a,b){return g.tickFormat()(a,b)});var D=null,E=null;i.updateState(!1);var F=a.utils.renderWatch(y),G=e.style(),H=function(a){return function(){return{active:a.map(function(a){return!a.disabled}),style:e.style()}}},I=function(a){return function(b){void 0!==b.style&&(G=b.style),void 0!==b.active&&a.forEach(function(a,c){a.disabled=!b.active[c]})}},J=d3.format("%");return e.dispatch.on("elementMouseover.tooltip",function(a){a.point.x=e.x()(a.point),a.point.y=e.y()(a.point),k.data(a).position(a.pos).hidden(!1)}),e.dispatch.on("elementMouseout.tooltip",function(a){k.hidden(!0)}),b.dispatch=y,b.stacked=e,b.legend=h,b.controls=i,b.xAxis=f,b.yAxis=g,b.interactiveLayer=j,b.tooltip=k,b.dispatch=y,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return m},set:function(a){m=a}},height:{get:function(){return n},set:function(a){n=a}},showLegend:{get:function(){return q},set:function(a){q=a}},showXAxis:{get:function(){return r},set:function(a){r=a}},showYAxis:{get:function(){return s},set:function(a){s=a}},defaultState:{get:function(){return w},set:function(a){w=a}},noData:{get:function(){return x},set:function(a){x=a}},showControls:{get:function(){return p},set:function(a){p=a}},controlLabels:{get:function(){return B},set:function(a){B=a}},controlOptions:{get:function(){return A},set:function(a){A=a}},tooltips:{get:function(){return k.enabled()},set:function(b){a.deprecated("tooltips","use chart.tooltip.enabled() instead"),k.enabled(!!b)}},tooltipContent:{get:function(){return k.contentGenerator()},set:function(b){a.deprecated("tooltipContent","use chart.tooltip.contentGenerator() instead"),k.contentGenerator(b)}},margin:{get:function(){return l},set:function(a){l.top=void 0!==a.top?a.top:l.top,l.right=void 0!==a.right?a.right:l.right,l.bottom=void 0!==a.bottom?a.bottom:l.bottom,l.left=void 0!==a.left?a.left:l.left}},duration:{get:function(){return C},set:function(a){C=a,F.reset(C),e.duration(C),f.duration(C),g.duration(C)}},color:{get:function(){return o},set:function(b){o=a.utils.getColor(b),h.color(o),e.color(o)}},rightAlignYAxis:{get:function(){return t},set:function(a){t=a,g.orient(t?"right":"left")}},useInteractiveGuideline:{get:function(){return u},set:function(a){u=!!a,b.interactive(!a),b.useVoronoi(!a),e.scatter.interactive(!a)}}}),a.utils.inheritOptions(b,e),a.utils.initOptions(b),b},a.models.sunburst=function(){"use strict";function b(u){return t.reset(),u.each(function(b){function t(a){a.x0=a.x,a.dx0=a.dx}function u(a){var b=d3.interpolate(p.domain(),[a.x,a.x+a.dx]),c=d3.interpolate(q.domain(),[a.y,1]),d=d3.interpolate(q.range(),[a.y?20:0,y]);return function(a,e){return e?function(b){return s(a)}:function(e){return p.domain(b(e)),q.domain(c(e)).range(d(e)),s(a)}}}l=d3.select(this);var v,w=a.utils.availableWidth(g,l,f),x=a.utils.availableHeight(h,l,f),y=Math.min(w,x)/2;a.utils.initSVG(l);var z=l.selectAll(".nv-wrap.nv-sunburst").data(b),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-sunburst nv-chart-"+k),B=A.selectAll("nv-sunburst");z.attr("transform","translate("+w/2+","+x/2+")"),l.on("click",function(a,b){o.chartClick({data:a,index:b,pos:d3.event,id:k})}),q.range([0,y]),c=c||b,e=b[0],r.value(j[i]||j.count),v=B.data(r.nodes).enter().append("path").attr("d",s).style("fill",function(a){return m((a.children?a:a.parent).name)}).style("stroke","#FFF").on("click",function(a){d!==c&&c!==a&&(d=c),c=a,v.transition().duration(n).attrTween("d",u(a))}).each(t).on("dblclick",function(a){d.parent==a&&v.transition().duration(n).attrTween("d",u(e))}).each(t).on("mouseover",function(a,b){d3.select(this).classed("hover",!0).style("opacity",.8),o.elementMouseover({data:a,color:d3.select(this).style("fill")})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1).style("opacity",1),o.elementMouseout({data:a})}).on("mousemove",function(a,b){o.elementMousemove({data:a})})}),t.renderEnd("sunburst immediate"),b}var c,d,e,f={top:0,right:0,bottom:0,left:0},g=null,h=null,i="count",j={count:function(a){return 1},size:function(a){return a.size}},k=Math.floor(1e4*Math.random()),l=null,m=a.utils.defaultColor(),n=500,o=d3.dispatch("chartClick","elementClick","elementDblClick","elementMousemove","elementMouseover","elementMouseout","renderEnd"),p=d3.scale.linear().range([0,2*Math.PI]),q=d3.scale.sqrt(),r=d3.layout.partition().sort(null).value(function(a){return 1}),s=d3.svg.arc().startAngle(function(a){return Math.max(0,Math.min(2*Math.PI,p(a.x)))}).endAngle(function(a){return Math.max(0,Math.min(2*Math.PI,p(a.x+a.dx)))}).innerRadius(function(a){return Math.max(0,q(a.y))}).outerRadius(function(a){return Math.max(0,q(a.y+a.dy))}),t=a.utils.renderWatch(o);return b.dispatch=o,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return g},set:function(a){g=a}},height:{get:function(){return h},set:function(a){h=a}},mode:{get:function(){return i},set:function(a){i=a}},id:{get:function(){return k},set:function(a){k=a}},duration:{get:function(){return n},set:function(a){n=a}},margin:{get:function(){return f},set:function(a){f.top=void 0!=a.top?a.top:f.top,f.right=void 0!=a.right?a.right:f.right,f.bottom=void 0!=a.bottom?a.bottom:f.bottom,f.left=void 0!=a.left?a.left:f.left}},color:{get:function(){return m},set:function(b){m=a.utils.getColor(b)}}}),a.utils.initOptions(b),b},a.models.sunburstChart=function(){"use strict";function b(d){return m.reset(),m.models(c),d.each(function(d){var h=d3.select(this);a.utils.initSVG(h);var i=a.utils.availableWidth(f,h,e),j=a.utils.availableHeight(g,h,e);if(b.update=function(){0===k?h.call(b):h.transition().duration(k).call(b)},b.container=this,!d||!d.length)return a.utils.noData(b,h),b;h.selectAll(".nv-noData").remove();var l=h.selectAll("g.nv-wrap.nv-sunburstChart").data(d),m=l.enter().append("g").attr("class","nvd3 nv-wrap nv-sunburstChart").append("g"),n=l.select("g");m.append("g").attr("class","nv-sunburstWrap"),l.attr("transform","translate("+e.left+","+e.top+")"),c.width(i).height(j);var o=n.select(".nv-sunburstWrap").datum(d);d3.transition(o).call(c)}),m.renderEnd("sunburstChart immediate"),b}var c=a.models.sunburst(),d=a.models.tooltip(),e={top:30,right:20,bottom:20,left:20},f=null,g=null,h=a.utils.defaultColor(),i=(Math.round(1e5*Math.random()),null),j=null,k=250,l=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState","renderEnd"),m=a.utils.renderWatch(l);return d.headerEnabled(!1).duration(0).valueFormatter(function(a,b){return a}),c.dispatch.on("elementMouseover.tooltip",function(a){a.series={key:a.data.name,value:a.data.size,color:a.color},d.data(a).hidden(!1)}),c.dispatch.on("elementMouseout.tooltip",function(a){d.hidden(!0)}),c.dispatch.on("elementMousemove.tooltip",function(a){d.position({top:d3.event.pageY,left:d3.event.pageX})()}),b.dispatch=l,b.sunburst=c,b.tooltip=d,b.options=a.utils.optionsFunc.bind(b),b._options=Object.create({},{noData:{get:function(){return j},set:function(a){j=a}},defaultState:{get:function(){return i},set:function(a){i=a}},color:{get:function(){return h},set:function(a){h=a,c.color(h)}},duration:{get:function(){return k},set:function(a){k=a,m.reset(k),c.duration(k)}},margin:{get:function(){return e},set:function(a){e.top=void 0!==a.top?a.top:e.top,e.right=void 0!==a.right?a.right:e.right,e.bottom=void 0!==a.bottom?a.bottom:e.bottom,e.left=void 0!==a.left?a.left:e.left}}}),a.utils.inheritOptions(b,c),a.utils.initOptions(b),b},a.version="1.8.1"}(); \ No newline at end of file diff --git a/wqflask/wqflask/static/packages/DT_bootstrap/DT_bootstrap.css b/wqflask/wqflask/static/packages/DT_bootstrap/DT_bootstrap.css deleted file mode 100644 index 9adaabb1..00000000 --- a/wqflask/wqflask/static/packages/DT_bootstrap/DT_bootstrap.css +++ /dev/null @@ -1,179 +0,0 @@ - -div.dataTables_length label { - float: left; - text-align: left; -} - -div.dataTables_length select { - width: 75px; -} - -div.dataTables_filter label { - float: right; -} - -div.dataTables_info { - padding-top: 8px; -} - -div.dataTables_paginate { - float: right; - margin: 0; -} - -table.table { - clear: both; - margin-bottom: 6px !important; - max-width: none !important; -} - -table.table thead .sorting, -table.table thead .sorting_asc, -table.table thead .sorting_desc, -table.table thead .sorting_asc_disabled, -table.table thead .sorting_desc_disabled { - cursor: pointer; - *cursor: hand; -} - -table.table thead .sorting { background: url('images/sort_both.png') no-repeat center right; } -table.table thead .sorting_asc { background: url('images/sort_asc.png') no-repeat center right; } -table.table thead .sorting_desc { background: url('images/sort_desc.png') no-repeat center right; } - -table.table thead .sorting_asc_disabled { background: url('images/sort_asc_disabled.png') no-repeat center right; } -table.table thead .sorting_desc_disabled { background: url('images/sort_desc_disabled.png') no-repeat center right; } - -table.dataTable th:active { - outline: none; -} - -/* Scrolling */ -div.dataTables_scrollHead table { - margin-bottom: 0 !important; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; -} - -div.dataTables_scrollHead table thead tr:last-child th:first-child, -div.dataTables_scrollHead table thead tr:last-child td:first-child { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.dataTables_scrollBody table { - border-top: none; - margin-bottom: 0 !important; -} - -div.dataTables_scrollBody tbody tr:first-child th, -div.dataTables_scrollBody tbody tr:first-child td { - border-top: none; -} - -div.dataTables_scrollFoot table { - border-top: none; -} - - - - -/* - * TableTools styles - */ -.table tbody tr.active td, -.table tbody tr.active th { - background-color: #08C; - color: white; -} - -.table tbody tr.active:hover td, -.table tbody tr.active:hover th { - background-color: #0075b0 !important; -} - -.table-striped tbody tr.active:nth-child(odd) td, -.table-striped tbody tr.active:nth-child(odd) th { - background-color: #017ebc; -} - -table.DTTT_selectable tbody tr { - cursor: pointer; - *cursor: hand; -} - -div.DTTT .btn { - color: #333 !important; - font-size: 12px; -} - -div.DTTT .btn:hover { - text-decoration: none !important; -} - - -ul.DTTT_dropdown.dropdown-menu a { - color: #333 !important; /* needed only when demo_page.css is included */ -} - -ul.DTTT_dropdown.dropdown-menu li:hover a { - background-color: #0088cc; - color: white !important; -} - -/* TableTools information display */ -div.DTTT_print_info.modal { - height: 150px; - margin-top: -75px; - text-align: center; -} - -div.DTTT_print_info h6 { - font-weight: normal; - font-size: 28px; - line-height: 28px; - margin: 1em; -} - -div.DTTT_print_info p { - font-size: 14px; - line-height: 20px; -} - - - -/* - * FixedColumns styles - */ -div.DTFC_LeftHeadWrapper table, -div.DTFC_LeftFootWrapper table, -table.DTFC_Cloned tr.even { - background-color: white; -} - -div.DTFC_LeftHeadWrapper table { - margin-bottom: 0 !important; - border-top-right-radius: 0 !important; - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child, -div.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.DTFC_LeftBodyWrapper table { - border-top: none; - margin-bottom: 0 !important; -} - -div.DTFC_LeftBodyWrapper tbody tr:first-child th, -div.DTFC_LeftBodyWrapper tbody tr:first-child td { - border-top: none; -} - -div.DTFC_LeftFootWrapper table { - border-top: none; -} - diff --git a/wqflask/wqflask/static/packages/DT_bootstrap/DT_bootstrap.js b/wqflask/wqflask/static/packages/DT_bootstrap/DT_bootstrap.js deleted file mode 100644 index cfe3e9d2..00000000 --- a/wqflask/wqflask/static/packages/DT_bootstrap/DT_bootstrap.js +++ /dev/null @@ -1,159 +0,0 @@ -/* Set the defaults for DataTables initialisation */ -$.extend( true, $.fn.dataTable.defaults, { - "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>", - "sPaginationType": "bootstrap", - "oLanguage": { - "sLengthMenu": "_MENU_ records per page" - } -} ); - - -/* Default class modification */ -$.extend( $.fn.dataTableExt.oStdClasses, { - "sWrapper": "dataTables_wrapper form-inline" -} ); - - -/* API method to get paging information */ -$.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings ) -{ - return { - "iStart": oSettings._iDisplayStart, - "iEnd": oSettings.fnDisplayEnd(), - "iLength": oSettings._iDisplayLength, - "iTotal": oSettings.fnRecordsTotal(), - "iFilteredTotal": oSettings.fnRecordsDisplay(), - "iPage": oSettings._iDisplayLength === -1 ? - 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ), - "iTotalPages": oSettings._iDisplayLength === -1 ? - 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength ) - }; -}; - - -/* Bootstrap style pagination control */ -$.extend( $.fn.dataTableExt.oPagination, { - "bootstrap": { - "fnInit": function( oSettings, nPaging, fnDraw ) { - var oLang = oSettings.oLanguage.oPaginate; - var fnClickHandler = function ( e ) { - e.preventDefault(); - if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) { - fnDraw( oSettings ); - } - }; - - $(nPaging).addClass('pagination').append( - '' - ); - var els = $('a', nPaging); - $(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler ); - $(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler ); - }, - - "fnUpdate": function ( oSettings, fnDraw ) { - var iListLength = 5; - var oPaging = oSettings.oInstance.fnPagingInfo(); - var an = oSettings.aanFeatures.p; - var i, ien, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2); - - if ( oPaging.iTotalPages < iListLength) { - iStart = 1; - iEnd = oPaging.iTotalPages; - } - else if ( oPaging.iPage <= iHalf ) { - iStart = 1; - iEnd = iListLength; - } else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) { - iStart = oPaging.iTotalPages - iListLength + 1; - iEnd = oPaging.iTotalPages; - } else { - iStart = oPaging.iPage - iHalf + 1; - iEnd = iStart + iListLength - 1; - } - - for ( i=0, ien=an.length ; i'+j+'') - .insertBefore( $('li:last', an[i])[0] ) - .bind('click', function (e) { - e.preventDefault(); - oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength; - fnDraw( oSettings ); - } ); - } - - // Add / remove disabled classes from the static elements - if ( oPaging.iPage === 0 ) { - $('li:first', an[i]).addClass('disabled'); - } else { - $('li:first', an[i]).removeClass('disabled'); - } - - if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) { - $('li:last', an[i]).addClass('disabled'); - } else { - $('li:last', an[i]).removeClass('disabled'); - } - } - } - } -} ); - - -/* - * TableTools Bootstrap compatibility - * Required TableTools 2.1+ - */ -if ( $.fn.DataTable.TableTools ) { - // Set the classes that TableTools uses to something suitable for Bootstrap - $.extend( true, $.fn.DataTable.TableTools.classes, { - "container": "DTTT btn-group", - "buttons": { - "normal": "btn", - "disabled": "disabled" - }, - "collection": { - "container": "DTTT_dropdown dropdown-menu", - "buttons": { - "normal": "", - "disabled": "disabled" - } - }, - "print": { - "info": "DTTT_print_info modal" - }, - "select": { - "row": "active" - } - } ); - - // Have the collection use a bootstrap compatible dropdown - $.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, { - "collection": { - "container": "ul", - "button": "li", - "liner": "a" - } - } ); -} - - -/* Table initialisation */ -//$(document).ready(function() { -// $('#example').dataTable( { -// "sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>", -// "sPaginationType": "bootstrap", -// "oLanguage": { -// "sLengthMenu": "_MENU_ records per page" -// } -// } ); -//} ); \ No newline at end of file diff --git a/wqflask/wqflask/static/packages/DT_bootstrap/images b/wqflask/wqflask/static/packages/DT_bootstrap/images deleted file mode 120000 index f5f1b7d0..00000000 --- a/wqflask/wqflask/static/packages/DT_bootstrap/images +++ /dev/null @@ -1 +0,0 @@ -../../new/packages/DataTables/images/ \ No newline at end of file diff --git a/wqflask/wqflask/templates/index_page_orig.html b/wqflask/wqflask/templates/index_page_orig.html index 48ed0ec5..92392b39 100755 --- a/wqflask/wqflask/templates/index_page_orig.html +++ b/wqflask/wqflask/templates/index_page_orig.html @@ -202,7 +202,9 @@ +
    +
    -
    +
    - --> - + + -->
    + {% if editable == "true" %} + - + + {% endif %}
    {{content|safe}}
    diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index cef5f8ec..70748040 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -216,7 +216,7 @@ def gsearch_updating(): @app.route("/docedit") def docedit(): logger.info(request.url) - doc = docs.Docs(request.args['entry']) + doc = docs.Docs(request.args['entry'], request.args) return render_template("docedit.html", **doc.__dict__) @app.route('/generated/') @@ -227,7 +227,7 @@ def generated_file(filename): @app.route("/help") def help(): logger.info(request.url) - doc = docs.Docs("help") + doc = docs.Docs("help", request.args) return render_template("docs.html", **doc.__dict__) @app.route("/wgcna_setup", methods=('POST',)) @@ -260,46 +260,42 @@ def ctl_results(): result = ctl.process_results(ctlA) # After the analysis is finished store the result return render_template("ctl_results.html", **result) # Display them using the template -#@app.route("/news") -#def news_route(): -# newsobject = news.News() -# return render_template("news.html", **newsobject.__dict__) - @app.route("/news") def news(): - doc = docs.Docs("news") + doc = docs.Docs("news", request.args) return render_template("docs.html", **doc.__dict__) @app.route("/references") def references(): - # doc = docs.Docs("references") - # return render_template("docs.html", **doc.__dict__) - return render_template("reference.html") + doc = docs.Docs("references", request.args) + return render_template("docs.html", **doc.__dict__) + # return render_template("reference.html") @app.route("/intro") def intro(): - doc = docs.Docs("intro") + doc = docs.Docs("intro", request.args) return render_template("docs.html", **doc.__dict__) @app.route("/policies") def policies(): - doc = docs.Docs("policies") + doc = docs.Docs("policies", request.args) return render_template("docs.html", **doc.__dict__) @app.route("/links") def links(): - doc = docs.Docs("links") - return render_template("docs.html", **doc.__dict__) + #doc = docs.Docs("links") + #return render_template("docs.html", **doc.__dict__) + return render_template("links.html") @app.route("/environments") def environments(): - doc = docs.Docs("environments") + doc = docs.Docs("environments", request.args) return render_template("docs.html", **doc.__dict__) @app.route("/update_text", methods=('POST',)) def update_page(): docs.update_text(request.form) - doc = docs.Docs(request.form['entry_type']) + doc = docs.Docs(request.form['entry_type'], request.form) return render_template("docs.html", **doc.__dict__) @app.route("/submit_trait") -- cgit v1.2.3 From dcdb588f736df433d3a09aedd0fe50cb9f80e794 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 27 Sep 2019 10:50:44 -0500 Subject: Added extra larger buttons to submit changes to news and other pages + fixed issue where encoding was sometimes weird for Authors in search result (still need to do this in other places) --- wqflask/wqflask/templates/docedit.html | 8 +++++++- wqflask/wqflask/templates/search_result_page.html | 9 +++++++-- wqflask/wqflask/views.py | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/wqflask/wqflask/templates/docedit.html b/wqflask/wqflask/templates/docedit.html index e8aa7da1..b87c5b41 100644 --- a/wqflask/wqflask/templates/docedit.html +++ b/wqflask/wqflask/templates/docedit.html @@ -5,20 +5,26 @@ {% block content %}

    Edit: {{title}}

    -
    + {% if editable is defined %} {% endif %} + +
    diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 2c67f6c3..262a563d 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -348,9 +348,14 @@ 'render': function(data, type, row, meta) { author_list = data.authors.split(",") if (author_list.length >= 6) { - return author_list.slice(0, 6).join(",") + ", et al." + author_string = author_list.slice(0, 6).join(",") + ", et al." } else{ - return data.authors + author_string = data.authors + } + try { + return decodeURIComponent(escape(author_string)) + } catch(err){ + return escape(author_string) } } }, diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 70748040..bff9f9d2 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -307,7 +307,7 @@ def submit_trait_form(): @app.route("/create_temp_trait", methods=('POST',)) def create_temp_trait(): logger.info(request.url) - print("REQUEST.FORM:", request.form) + #template_vars = submit_trait.SubmitTrait(request.form) doc = docs.Docs("links") -- cgit v1.2.3 From 1f290b05d6fce851a01a1ce54194382b734ea596 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 27 Sep 2019 12:42:32 -0500 Subject: Fixed an issue that caused Redis to throw an error when creating collections --- wqflask/wqflask/collect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index 7e3337a0..22d3f7ee 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -259,7 +259,7 @@ def create_new(collection_name): if "hash" in params: unprocessed_traits = Redis.get(params['hash']) - Redis.delete(hash) + Redis.delete(params['hash']) else: unprocessed_traits = params['traits'] -- cgit v1.2.3 From 1bbf80ac9ff7f28409c1469070bc2e66df74899e Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 1 Oct 2019 11:33:35 -0500 Subject: Changed alias search to only search aliases in symbol field Fixed issue where authors sometimes weren't encoded correctly for global search --- wqflask/wqflask/do_search.py | 19 +++++++++++-------- wqflask/wqflask/templates/gsearch_pheno.html | 11 +++++++++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index e0f4eb17..a7f117ec 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -109,23 +109,26 @@ class MrnaAssaySearch(DoSearch): 'Additive Effect'] def get_where_clause(self): - - aliases = get_aliases(escape(self.search_term[0]), self.dataset.group.species) - if len(aliases) > 0: - search_string = " ".join(aliases) - else: - search_string = escape(self.search_term[0]) + search_string = escape(self.search_term[0]) if self.search_term[0] != "*": - match_clause = """(MATCH (ProbeSet.Name, + match_clause = """((MATCH (ProbeSet.Name, ProbeSet.description, ProbeSet.symbol, alias, GenbankId, UniGeneId, Probe_Target_Description) - AGAINST ('%s' IN BOOLEAN MODE)) and + AGAINST ('%s' IN BOOLEAN MODE)) """ % (search_string) + + aliases = get_aliases(search_string, self.dataset.group.species) + if len(aliases) > 0: + match_clause += " or " + alias_string = " ".join(aliases) + match_clause += "(MATCH (ProbeSet.symbol) AGAINST ('%s' IN BOOLEAN MODE))) and " % alias_string + else: + match_clause += ") and " else: match_clause = "" diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index 4e142846..c626a589 100644 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -184,10 +184,17 @@ 'render': function(data, type, row, meta) { author_list = data.authors.split(",") if (author_list.length >= 6) { - return author_list.slice(0, 6).join(",") + ", et al." + author_string = author_list.slice(0, 6).join(",") + ", et al." } else{ - return data.authors + author_string = data.authors } + + try { + return decodeURIComponent(escape(author_string)) + } catch(err) { + return author_string + } + } }, { -- cgit v1.2.3 From 1f74f44c2a066833b735690664eea2efca0e8466 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 3 Oct 2019 11:48:36 -0500 Subject: Bar chart y axis range should update with transforms Changed the way aliases are used in searches to hopefully limit results to things that make sense Fixed issue where headers didn't appear correctly for correlation results when correlating against a genotype dataset --- wqflask/wqflask/correlation/show_corr_results.py | 4 ++-- wqflask/wqflask/do_search.py | 5 ++++- .../wqflask/static/new/javascript/show_trait.js | 24 +++++++++++++--------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py index 0db8fa38..be27da7b 100644 --- a/wqflask/wqflask/correlation/show_corr_results.py +++ b/wqflask/wqflask/correlation/show_corr_results.py @@ -610,14 +610,14 @@ def get_header_fields(data_type, corr_method): if corr_method == "pearson": header_fields = ['Index', 'ID', - 'Location' + 'Location', 'Sample r', 'N', 'Sample p(r)'] else: header_fields = ['Index', 'ID', - 'Location' + 'Location', 'Sample rho', 'N', 'Sample p(rho)'] diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index a7f117ec..3ea841ab 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -125,7 +125,10 @@ class MrnaAssaySearch(DoSearch): aliases = get_aliases(search_string, self.dataset.group.species) if len(aliases) > 0: match_clause += " or " - alias_string = " ".join(aliases) + alias_string_list = [] + for alias in aliases: + alias_string_list.append('"'+alias+'"') + alias_string = " ".join(alias_string_list) match_clause += "(MATCH (ProbeSet.symbol) AGAINST ('%s' IN BOOLEAN MODE))) and " % alias_string else: match_clause += ") and " diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 830dbf7f..9813fca8 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -261,6 +261,10 @@ update_bar_chart = function() { } } + new_chart_range = get_bar_range(trait_vals, trait_vars) + + root.bar_layout['yaxis']['range'] = new_chart_range + root.bar_data[0]['y'] = trait_vals root.bar_data[0]['error_y'] = { type: 'data', @@ -886,16 +890,16 @@ var bar_trace = { root.bar_data = [bar_trace] -get_bar_range = function(sample_list){ +get_bar_range = function(sample_vals, sample_errors = null){ positive_error_vals = [] negative_error_vals = [] - for (i = 0;i < get_sample_vals(sample_list).length; i++){ - if (get_sample_errors(sample_list)[0][i] != undefined) { - positive_error_vals.push(get_sample_vals(sample_list)[i] + get_sample_errors(sample_list)[0][i]) - negative_error_vals.push(get_sample_vals(sample_list)[i] - get_sample_errors(sample_list)[0][i]) + for (i = 0;i < sample_vals.length; i++){ + if (sample_errors[i] != undefined) { + positive_error_vals.push(sample_vals[i] + sample_errors[i]) + negative_error_vals.push(sample_vals[i] - sample_errors[i]) } else { - positive_error_vals.push(get_sample_vals(sample_list)[i]) - negative_error_vals.push(get_sample_vals(sample_list)[i]) + positive_error_vals.push(sample_vals[i]) + negative_error_vals.push(sample_vals[i]) } } @@ -920,12 +924,12 @@ get_bar_range = function(sample_list){ return [range_bottom, range_top] } -root.chart_range = get_bar_range(sample_lists[0]) +root.chart_range = get_bar_range(get_sample_vals(sample_lists[0]), get_sample_errors(sample_lists[0])[0]) val_range = root.chart_range[1] - root.chart_range[0] -if (val_range < 4){ +if (val_range < 5){ tick_digits = '.1f' -} else if (val_range < 0.4) { +} else if (val_range < 0.5) { tick_digits = '.2f' } else { tick_digits = 'f' -- cgit v1.2.3 From 4a1c68a1e63ade4eceab4e700fb22911885e8bbb Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 4 Oct 2019 11:03:12 -0500 Subject: Added back in the Probes option that was missing from GN2, though need to verify that the logic for showing it is correct --- wqflask/wqflask/show_trait/show_trait.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 3b057427..4fe08b2b 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -122,6 +122,9 @@ class ShowTrait(object): self.UCSC_BLAT_URL = "" self.UTHSC_BLAT_URL = "" + if self.dataset.type == "ProbeSet": + self.show_probes = "True" + trait_units = get_trait_units(self.this_trait) self.get_external_links() self.build_correlation_tools() -- cgit v1.2.3 From 5cffa1eacdb7fbb3d65b49744b0bee43e4cb130d Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 4 Oct 2019 12:12:59 -0500 Subject: Fixed issue where there was an error if the REST API used for aliases was down Added option to download as JPEG in addition to SVG for basic stats figures --- wqflask/base/trait.py | 22 ++++++++++++---------- wqflask/wqflask/do_search.py | 19 ++++++++++--------- .../wqflask/static/new/javascript/show_trait.js | 9 ++++++++- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 58169b5c..322fb252 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -138,17 +138,19 @@ class GeneralTrait(object): human_response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol.upper()) mouse_response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol.capitalize()) other_response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol.lower()) - alias_list = json.loads(human_response.content) + json.loads(mouse_response.content) + json.loads(other_response.content) - filtered_aliases = [] - seen = set() - for item in alias_list: - if item in seen: - continue - else: - filtered_aliases.append(item) - seen.add(item) - alias = "; ".join(filtered_aliases) + if human_response and mouse_response and other_response: + alias_list = json.loads(human_response.content) + json.loads(mouse_response.content) + json.loads(other_response.content) + + filtered_aliases = [] + seen = set() + for item in alias_list: + if item in seen: + continue + else: + filtered_aliases.append(item) + seen.add(item) + alias = "; ".join(filtered_aliases) return alias diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index 3ea841ab..c7f3fe41 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -888,17 +888,18 @@ def get_aliases(symbol, species): elif species == "human": symbol_string = symbol.upper() + filtered_aliases = [] response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + symbol_string) - alias_list = json.loads(response.content) + if response: + alias_list = json.loads(response.content) - filtered_aliases = [] - seen = set() - for item in alias_list: - if item in seen: - continue - else: - filtered_aliases.append(item) - seen.add(item) + seen = set() + for item in alias_list: + if item in seen: + continue + else: + filtered_aliases.append(item) + seen.add(item) return filtered_aliases diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 9813fca8..871582d2 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -864,10 +864,17 @@ if (Object.keys(js_data.sample_group_types).length > 1) { root.modebar_options = { modeBarButtonsToAdd:[{ name: 'Export as SVG', - icon: Plotly.Icons.disk, + icon: Plotly.Icons.camera, click: function(gd) { Plotly.downloadImage(gd, {format: 'svg'}) } + }, + { + name: 'Export as JPEG', + icon: Plotly.Icons.disk, + click: function(gd) { + Plotly.downloadImage(gd, {format: 'jpeg'}) + } }], modeBarButtonsToRemove:['toImage', 'sendDataToCloud', 'hoverClosest', 'hoverCompare', 'hoverClosestCartesian', 'hoverCompareCartesian', 'lasso2d', 'toggleSpikelines'], displaylogo: false -- cgit v1.2.3 From bd13472a05b947b809a8199584d6a3cf5dfad703 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 8 Oct 2019 14:28:42 -0500 Subject: Fixed serious issue that caused output to be wrong for new reaper mapping Haplotype analyst now works for GEMMA Increased margin a bit to fix minor issue with buttons getting cut off on certain Safari versions for bar chart --- wqflask/utility/gen_geno_ob.py | 15 ++++++++------- .../marker_regression/display_mapping_results.py | 2 +- wqflask/wqflask/marker_regression/qtlreaper_mapping.py | 17 ++++++++++++++++- wqflask/wqflask/templates/mapping_results.html | 2 +- wqflask/wqflask/templates/show_trait_statistics.html | 2 +- 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/wqflask/utility/gen_geno_ob.py b/wqflask/utility/gen_geno_ob.py index e8780879..44e2722f 100644 --- a/wqflask/utility/gen_geno_ob.py +++ b/wqflask/utility/gen_geno_ob.py @@ -47,20 +47,20 @@ class genotype(object): elif line[0] == "@": label = line.split(":")[0][1:] if label == "name": - self.group = line.split(":")[1] + self.group = line.split(":")[1].strip() elif label == "filler": - if line.split(":")[1] == "yes": + if line.split(":")[1].strip() == "yes": self.filler = True elif label == "type": - self.type = line.split(":")[1] + self.type = line.split(":")[1].strip() elif label == "mat": - self.mat = line.split(":")[1] + self.mat = line.split(":")[1].strip() elif label == "pat": - self.pat = line.split(":")[1] + self.pat = line.split(":")[1].strip() elif label == "het": - self.het = line.split(":")[1] + self.het = line.split(":")[1].strip() elif label == "unk": - self.unk = line.split(":")[1] + self.unk = line.split(":")[1].strip() else: continue elif line[:3] == "Chr": @@ -133,6 +133,7 @@ class Locus(object): start_pos = 4 else: start_pos = 3 + for allele in marker_row[start_pos:]: if allele in geno_table.keys(): self.genotype.append(geno_table[allele]) diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index f3755758..a2f9651b 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -1341,7 +1341,7 @@ class DisplayMappingResults(object): for i, _chr in enumerate(self.genotype): if _chr.name == self.ChrList[self.selectedChr][0]: - for j, _geno in enumerate(_chr[1]): + for j, _geno in enumerate(_chr[1].genotype): plotbxd=0 for item in smd: diff --git a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py index 50e6bd7e..fe216166 100644 --- a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py +++ b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py @@ -1,4 +1,4 @@ -import os, math, string, random, json +import os, math, string, random, json, re from base import webqtlConfig from base.trait import GeneralTrait @@ -105,6 +105,9 @@ def parse_reaper_output(gwa_filename, permu_filename, bootstrap_filename): marker['additive'] = float(line.split("\t")[6]) marker_obs.append(marker) + #ZS: Results have to be reordered because the new reaper returns results sorted alphabetically by chr for some reason, resulting in chr 1 being followed by 10, etc + sorted_indices = natural_sort(marker_obs) + permu_vals = [] if permu_filename: with open("{}{}.txt".format(webqtlConfig.GENERATED_IMAGE_DIR, permu_filename)) as permu_file: @@ -117,6 +120,9 @@ def parse_reaper_output(gwa_filename, permu_filename, bootstrap_filename): for line in bootstrap_file: bootstrap_vals.append(int(line)) + marker_obs = [marker_obs[i] for i in sorted_indices] + bootstrap_vals = [bootstrap_vals[i] for i in sorted_indices] + return marker_obs, permu_vals, bootstrap_vals def run_original_reaper(this_trait, dataset, samples_before, trait_vals, json_data, num_perm, bootCheck, num_bootstrap, do_control, control_marker, manhattan_plot): @@ -210,3 +216,12 @@ def run_original_reaper(this_trait, dataset, samples_before, trait_vals, json_da "cM":reaper_locus.cM, "name":reaper_locus.name, "additive":qtl.additive, "dominance":qtl.dominance} qtl_results.append(qtl) return qtl_results, json_data, perm_output, suggestive, significant, bootstrap_results + +def natural_sort(marker_list): + """ + Function to naturally sort numbers + strings, adopted from user Mark Byers here: https://stackoverflow.com/questions/4836710/does-python-have-a-built-in-function-for-string-natural-sort + Changed to return indices instead of values, though, since the same reordering needs to be applied to bootstrap results + """ + convert = lambda text: int(text) if text.isdigit() else text.lower() + alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', str(marker_list[key]['chr'])) ] + return sorted(range(len(marker_list)), key = alphanum_key) \ No newline at end of file diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index 1fc792d8..8422b1d2 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -144,7 +144,7 @@ *
    Gene Track *
    - {% if plotScale != "morgan" and mapping_method != "gemma" and mapping_method != "plink" %} + {% if plotScale != "morgan" %} Haplotype Analyst *
    {% endif %} Legend diff --git a/wqflask/wqflask/templates/show_trait_statistics.html b/wqflask/wqflask/templates/show_trait_statistics.html index 1093e1bb..4653b398 100644 --- a/wqflask/wqflask/templates/show_trait_statistics.html +++ b/wqflask/wqflask/templates/show_trait_statistics.html @@ -70,7 +70,7 @@
    {% endif %} -
    +
    -- cgit v1.2.3 From 32effb3bc371828208c610fdf6f0e5296ea50560 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 9 Oct 2019 11:27:06 -0500 Subject: Fixed issue where it threw an error for species other than mouse or human due to alias search --- wqflask/wqflask/do_search.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index c7f3fe41..be4742e9 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -887,6 +887,8 @@ def get_aliases(symbol, species): symbol_string = symbol.capitalize() elif species == "human": symbol_string = symbol.upper() + else: + return [] filtered_aliases = [] response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + symbol_string) -- cgit v1.2.3 From 32776182dbf37039edb3589dab73be4a9b0d8b23 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 9 Oct 2019 12:50:38 -0500 Subject: Added a couple affiliates to the index page --- wqflask/wqflask/templates/index_page_orig.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wqflask/wqflask/templates/index_page_orig.html b/wqflask/wqflask/templates/index_page_orig.html index bde1c50d..b28b7714 100755 --- a/wqflask/wqflask/templates/index_page_orig.html +++ b/wqflask/wqflask/templates/index_page_orig.html @@ -190,8 +190,10 @@
    -- cgit v1.2.3 From 5318f317b592698423f26763a14a71588344e608 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 9 Oct 2019 12:55:09 -0500 Subject: Made a couple more changes to syntax in affiliates list, since it was inconsistent --- wqflask/wqflask/templates/index_page_orig.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wqflask/wqflask/templates/index_page_orig.html b/wqflask/wqflask/templates/index_page_orig.html index b28b7714..108c87ed 100755 --- a/wqflask/wqflask/templates/index_page_orig.html +++ b/wqflask/wqflask/templates/index_page_orig.html @@ -188,12 +188,12 @@ -- cgit v1.2.3 From f80b5e760cafa82745307774998f7ae9fdf66a19 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 9 Oct 2019 16:06:14 -0500 Subject: Removed All Species option from search dropdown since it wasn't working and isn't necessary --- wqflask/wqflask/api/gen_menu.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/wqflask/wqflask/api/gen_menu.py b/wqflask/wqflask/api/gen_menu.py index 5182ea13..d7a59f29 100644 --- a/wqflask/wqflask/api/gen_menu.py +++ b/wqflask/wqflask/api/gen_menu.py @@ -22,13 +22,13 @@ def gen_dropdown_json(): types = get_types(groups) datasets = get_datasets(types) - species.append(('All Species', 'All Species')) - groups['All Species'] = [('All Groups', 'All Groups')] - types['All Species'] = {} - types['All Species']['All Groups'] = [('Phenotypes', 'Phenotypes')] - datasets['All Species'] = {} - datasets['All Species']['All Groups'] = {} - datasets['All Species']['All Groups']['Phenotypes'] = [('All Phenotypes','All Phenotypes')] + #species.append(('All Species', 'All Species')) + #groups['All Species'] = [('All Groups', 'All Groups')] + #types['All Species'] = {} + #types['All Species']['All Groups'] = [('Phenotypes', 'Phenotypes')] + #datasets['All Species'] = {} + #datasets['All Species']['All Groups'] = {} + #datasets['All Species']['All Groups']['Phenotypes'] = [('All Phenotypes','All Phenotypes')] data = dict(species=species, groups=groups, -- cgit v1.2.3 From 36e0847ea15191d136f85068529928d69b317368 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 10 Oct 2019 11:08:18 -0500 Subject: Fixed issue related to Redis upgrade and changed some text on Affiliates part of home page --- wqflask/wqflask/collect.py | 2 +- wqflask/wqflask/templates/index_page_orig.html | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index 22d3f7ee..73269c4d 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -53,7 +53,7 @@ class AnonCollection(object): #ZS: Find id and set it if the collection doesn't already exist if Redis.get(self.key) == "None" or Redis.get(self.key) == None: - Redis.set(self.key, None) #ZS: For some reason I get the error "Operation against a key holding the wrong kind of value" if I don't do this + Redis.set(self.key, "None") #ZS: For some reason I get the error "Operation against a key holding the wrong kind of value" if I don't do this else: collections_list = json.loads(Redis.get(self.key)) collection_position = 0 #ZS: Position of collection in collection_list, if it exists diff --git a/wqflask/wqflask/templates/index_page_orig.html b/wqflask/wqflask/templates/index_page_orig.html index 108c87ed..7d5cd95b 100755 --- a/wqflask/wqflask/templates/index_page_orig.html +++ b/wqflask/wqflask/templates/index_page_orig.html @@ -188,12 +188,12 @@ -- cgit v1.2.3 From fa592507a55e8be7a7916c82dac6c093c775cf0f Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 11 Oct 2019 18:09:03 -0500 Subject: Committing updated dataset menu file since rest api isn't working for something --- wqflask/wqflask/static/new/javascript/dataset_menu_structure.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 492d4313..73b251ab 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -238,7 +238,7 @@ [ "None", "Aging-Brain-UCIPublish", - "Aging-Brain-UCI Phenotypes" + "Aging-Brain-UCI Published Phenotypes" ] ], "Postcentral Gyrus mRNA": [ @@ -3144,6 +3144,11 @@ ] ], "Liver mRNA": [ + [ + "877", + "UTHSC-BXD-Harv_Liv-1019", + "UTHSC BXD Harvested Liver RNA-Seq (Oct19) TPM Log2" + ], [ "843", "UTHSC-BXD-Harv_Liv-0118", -- cgit v1.2.3 From e3ebbb26cd20aeb096d9b735dd160604894efbce Mon Sep 17 00:00:00 2001 From: zsloan Date: Sat, 12 Oct 2019 14:04:19 -0500 Subject: The correct drop-down options should appear for the BXD-Harvested group under correlations now --- wqflask/wqflask/show_trait/show_trait.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 4fe08b2b..48d0faf5 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -335,7 +335,7 @@ class ShowTrait(object): # We're checking a string here! assert isinstance(this_group, basestring), "We need a string type thing here" - if this_group[:3] == 'BXD': + if this_group[:3] == 'BXD' and this_group != "BXD-Harvested": this_group = 'BXD' if this_group: -- cgit v1.2.3 From 976d9f6d26c10fe4d6fed511506c7b419d0cb637 Mon Sep 17 00:00:00 2001 From: zsloan Date: Sun, 13 Oct 2019 11:43:13 -0500 Subject: Updating dataset structure again to include bxd longevity genotypes --- .../wqflask/static/new/javascript/dataset_menu_structure.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 73b251ab..cf44ab40 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -3136,6 +3136,13 @@ ] }, "BXD-Harvested": { + "Genotypes": [ + [ + "None", + "BXD-HarvestedGeno", + "BXD-Harvested Genotypes" + ] + ], "Hippocampus mRNA": [ [ "873", @@ -5349,6 +5356,10 @@ "Phenotypes", "Phenotypes" ], + [ + "Genotypes", + "Genotypes" + ], [ "Hippocampus mRNA", "Hippocampus mRNA" -- cgit v1.2.3 From 1df4248f88a1bbbc82446cd5e51daf07597b57bc Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 15 Oct 2019 10:52:38 -0500 Subject: Added a description with the marker name for genotype traits in collections page Fixed X/Y axis labels on correlation scatterplot page to correctly show genotype traits --- wqflask/wqflask/templates/collections/view.html | 6 ++++++ wqflask/wqflask/templates/corr_scatterplot.html | 22 +++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index a23f3f70..26dcef65 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -134,7 +134,13 @@ {% else %} N/A {% endif %} + {% if this_trait.dataset.type == "Geno" %} + Marker: {{ this_trait.name }} + {% elif this_trait.description_display != "" %} {{ this_trait.description_display }} + {% else %} + N/A + {% endif %} {{ this_trait.location_repr }} {{ '%0.3f' % this_trait.mean|float }} {{ '%0.3f' % this_trait.LRS_score_repr|float }} diff --git a/wqflask/wqflask/templates/corr_scatterplot.html b/wqflask/wqflask/templates/corr_scatterplot.html index f60a7129..545c0b94 100644 --- a/wqflask/wqflask/templates/corr_scatterplot.html +++ b/wqflask/wqflask/templates/corr_scatterplot.html @@ -25,7 +25,7 @@ - +
    Width pxWidth px Height px
    @@ -192,6 +192,16 @@ PubMed: {{trait_1.pubmed_text}} {{trait_1.description_display}}
    + {% elif trait_1.dataset.type == "Geno" %} +
    + X axis: + + {{trait_1.dataset.group.species + " " + trait_1.dataset.group.name + " " + trait_1.dataset.name + ": " + trait_1.name|string}} + +
    +
    + Location: {{trait_1.location_repr}} Mb +
    {% endif %}
    @@ -218,6 +228,16 @@ PubMed: {{trait_2.pubmed_text}} {{trait_2.description_display}}
    + {% elif trait_2.dataset.type == "Geno" %} +
    + Y axis: + + {{trait_2.dataset.group.species + " " + trait_2.dataset.group.name + " " + trait_2.dataset.name + ": " + trait_2.name|string}} + +
    +
    + Location: {{trait_2.location_repr}} Mb +
    {% endif %} -- cgit v1.2.3 From 1598eb9692eefdb98e3cebe313480ace18ec65ff Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 15 Oct 2019 12:16:43 -0500 Subject: Fixed issue that caused scatterplot covariates feature to not work --- wqflask/wqflask/static/new/javascript/get_traits_from_collection.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js index a34394a1..6f03b98f 100644 --- a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js +++ b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js @@ -182,7 +182,7 @@ trait_row_click = function() { var dataset, this_trait_url, trait; console.log("Clicking on:", $(this)); trait = $(this).find('.trait').text(); - dataset = $(this).find('.dataset').text(); + dataset = $(this).find('.dataset').data("dataset"); this_trait_url = "/trait/get_sample_data?trait=" + trait + "&dataset=" + dataset; $.ajax({ dataType: "json", @@ -340,7 +340,6 @@ get_this_trait_vals = function(samples) { this_trait_vals.push(null); } } - console.log("this_trait_vals:", this_trait_vals); this_vals_json = '[' + this_trait_vals.toString() + ']'; return this_trait_vals; }; @@ -390,7 +389,7 @@ process_traits = function(trait_data, textStatus, jqXHR) { } the_html += ""; the_html += ""; - the_html += "" + the_html += "" $("#collections_holder").html(the_html); return $('#collections_holder').colorbox.resize(); }; -- cgit v1.2.3 From f7de6d95543a1ded140b08ff280c2c8c5a9a8818 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 17 Oct 2019 15:26:58 -0500 Subject: Updated footer and fixed issue where Info button wouldn't work correctly with certain screen sizes --- wqflask/wqflask/templates/base.html | 20 ++++++++++---------- wqflask/wqflask/templates/index_page_orig.html | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 42e57523..c6713189 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -114,22 +114,22 @@