-
Notifications
You must be signed in to change notification settings - Fork 1
/
vizgrimoire.min.js
40 lines (40 loc) · 325 KB
/
vizgrimoire.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* VizGrimoire.js - https://github.com/VizGrimoire/VizGrimoireJS
* Copyright (C) 2012 Bitergia
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Authors:
* Alvaro del Castillo San Felix <[email protected]>
*
* Underscore.js 1.1.7 (c) 2011 Jeremy Ashkenas, DocumentCloud Inc. MIT license
* bean.js - copyright Jacob Thornton 2011, MIT license
* Flotr2 (c) 2012 Carl Sutherland, MIT license
* Bonzo: DOM Utility (c) Dustin Diaz 2011, MIT license
* Envision.js (c) 2012 Carl Sutherland, Humble Software, MIT license
* gridster.js Copyright (c) 2012 ducksboard; Licensed MIT
* d3.js: Copyright (c) 2012, Michael Bostocks
*
*/function resizedw(){Report.convertGlobal(),Report.convertStudiesGlobal(),Report.convertStudies(),Convert.activateHelp()}function DataSource(e,t){function n(e,t){if(e instanceof Array)return e;var n={};return $.each(e,function(e,r){var i=e,s=e.split("_");isNaN(s[s.length-1])===!1&&(i=s.slice(0,s.length-1).join("_"));var o=t.getName()+"_"+i,u=t.getName()+"_"+e;t.getMetrics()[o]===undefined?n[e]=r:n[u]=r}),n}this.top_data_file=this.data_dir+"/"+this.name+"-top.json",this.getTopDataFile=function(){return this.top_data_file},this.getMetrics=function(){return this.basic_metrics},this.setMetrics=function(e){this.basic_metrics=e},this.setMetricsDefinition=function(e){if(e===undefined)return;this.setMetrics(e)},this.data_file=this.data_dir+"/"+this.name+"-evolutionary.json",this.getDataFile=function(){return this.data_file},this.setDataFile=function(e){this.data_file=e},this.data=null,this.getData=function(){return this.data},this.setData=function(e,t){t===undefined&&(t=this),t.data=n(e,t)},this.demographics_aging_file=this.data_dir+"/"+this.name+"-demographics-aging.json",this.demographics_birth_file=this.data_dir+"/"+this.name+"-demographics-birth.json",this.getDemographicsAgingFile=function(){return this.demographics_aging_file},this.getDemographicsBirthFile=function(){return this.demographics_birth_file},this.demographics_data={},this.getDemographicsData=function(){return this.demographics_data},this.setDemographicsAgingData=function(e,t){t===undefined&&(t=this),t.demographics_data.aging=e},this.setDemographicsBirthData=function(e,t){t===undefined&&(t=this),t.demographics_data.birth=e},this.data_dir="data/json",this.getDataDir=function(){return this.data_dir},this.setDataDir=function(e){this.data_dir=e,this.data_file=e+"/"+this.name+"-evolutionary.json",this.demographics_aging_file=e+"/"+this.name+"-demographics-aging.json",this.demographics_birth_file=e+"/"+this.name+"-demographics-birth.json",this.global_data_file=e+"/"+this.name+"-static.json",this.top_data_file=e+"/"+this.name+"-top.json",this.companies_data_file=e+"/"+this.name+"-companies.json",this.repos_data_file=e+"/"+this.name+"-repos.json",this.countries_data_file=e+"/"+this.name+"-countries.json",this.domains_data_file=e+"/"+this.name+"-domains.json",this.time_to_fix_data_file=e+"/"+this.name+"-quantiles-month-time_to_fix_hour.json"},this.global_data_file=this.data_dir+"/"+this.name+"-static.json",this.getGlobalDataFile=function(){return this.global_data_file},this.global_data=null,this.getGlobalData=function(){return this.global_data},this.setGlobalData=function(e,t){t===undefined&&(t=this),t.global_data=n(e,t)},this.global_top_data=null,this.getGlobalTopData=function(){return this.global_top_data},this.setGlobalTopData=function(e,t){t===undefined&&(t=this),t.global_top_data=e},this.name=e,this.getName=function(){return this.name},this.people_data_file=this.data_dir+"/"+this.name+"-people.json",this.getPeopleDataFile=function(){return this.people_data_file},this.people=null,this.getPeopleData=function(){return this.people},this.setPeopleData=function(e,t){t===undefined&&(t=this),t.people=e},this.time_to_fix_data_file=this.data_dir+"/"+this.name+"-quantiles-month-time_to_fix_hour.json",this.getTimeToFixDataFile=function(){return this.time_to_fix_data_file},this.time_to_fix_data=null,this.getTimeToFixData=function(){return this.time_to_fix_data},this.setTimeToFixData=function(e,t){t===undefined&&(t=this),t.time_to_fix_data=e},this.time_to_attention_data_file=this.data_dir+"/"+this.name+"-quantiles-month-time_to_attention_hour.json",this.getTimeToAttentionDataFile=function(){return this.time_to_attention_data_file},this.time_to_attention_data=null,this.getTimeToAttentionData=function(){return this.time_to_attention_data},this.setTimeToAttentionData=function(e,t){t===undefined&&(t=this),t.time_to_attention_data=e},this.project=null,this.getProject=function(){return this.project},this.setProject=function(e){this.project=e},this.markov_table_data_file=this.data_dir+"/"+this.name+"-markov.json",this.getMarkovTableDataFile=function(){return this.markov_table_data_file},this.markov_table_data=null,this.getMarkovTableData=function(){return this.markov_table_data},this.setMarkovTableData=function(e,t){t===undefined&&(t=this),t.markov_table_data=e},this.companies_data_file=this.data_dir+"/"+this.name+"-companies.json",this.getCompaniesDataFile=function(){return this.companies_data_file},this.companies=null,this.getCompaniesData=function(){return this.companies},this.setCompaniesData=function(e,t){e===null&&(e=[]),e instanceof Array||(e=[e]),t===undefined&&(t=this),t.companies=e},this.companies_metrics_data={},this.addCompanyMetricsData=function(e,t,r){r===undefined&&(r=this),r.companies_metrics_data[e]=n(t,r)},this.getCompaniesMetricsData=function(){return this.companies_metrics_data},this.companies_global_data={},this.addCompanyGlobalData=function(e,t,r){r===undefined&&(r=this),r.companies_global_data[e]=n(t,r)},this.getCompaniesGlobalData=function(){return this.companies_global_data},this.companies_top_data={},this.addCompanyTopData=function(e,t,n){n===undefined&&(n=this),n.companies_top_data[e]===undefined&&(n.companies_top_data[e]={}),n.companies_top_data[e]=t},this.getCompaniesTopData=function(){return this.companies_top_data},this.setCompaniesTopData=function(e,t){t===undefined&&(t=this),t.companies_top_data=e},this.repos_data_file=this.data_dir+"/"+this.name+"-repos.json",this.getReposDataFile=function(){return this.repos_data_file},this.repos=null,this.getReposDataFull=function(){return this.repos},this.getReposData=function(){var e=this.repos;return this.getName()==="scr"&&e instanceof Array==0&&(e=this.repos.name),e},this.setReposData=function(e,t){t===undefined&&(t=this),t.repos=e},this.repos_metrics_data={},this.addRepoMetricsData=function(e,t,r){r===undefined&&(r=this),r.repos_metrics_data[e]=n(t,r)},this.getReposMetricsData=function(){return this.repos_metrics_data},this.repos_global_data={},this.addRepoGlobalData=function(e,t,r){r===undefined&&(r=this),r.repos_global_data[e]=n(t,r)},this.getReposGlobalData=function(){return this.repos_global_data},this.countries_data_file=this.data_dir+"/"+this.name+"-countries.json",this.getCountriesDataFile=function(){return this.countries_data_file},this.countries=null,this.getCountriesData=function(){return this.countries},this.setCountriesData=function(e,t){t===undefined&&(t=this),t.countries=e},this.countries_metrics_data={},this.addCountryMetricsData=function(e,t,r){r===undefined&&(r=this),r.countries_metrics_data[e]=n(t,r)},this.getCountriesMetricsData=function(){return this.countries_metrics_data},this.countries_global_data={},this.addCountryGlobalData=function(e,t,r){r===undefined&&(r=this),r.countries_global_data[e]=n(t,r)},this.getCountriesGlobalData=function(){return this.countries_global_data},this.domains_data_file=this.data_dir+"/"+this.name+"-domains.json",this.getDomainsDataFile=function(){return this.domains_data_file},this.domains=null,this.getDomainsData=function(){return this.domains},this.setDomainsData=function(e,t){e===null&&(e=[]),e instanceof Array||(e=[e]),t===undefined&&(t=this),t.domains=e},this.domains_metrics_data={},this.addDomainMetricsData=function(e,t,r){r===undefined&&(r=this),r.domains_metrics_data[e]=n(t,r)},this.getDomainsMetricsData=function(){return this.domains_metrics_data},this.domains_global_data={},this.addDomainGlobalData=function(e,t,r){r===undefined&&(r=this),r.domains_global_data[e]=n(t,r)},this.getDomainsGlobalData=function(){return this.domains_global_data},this.people_metrics_data={},this.addPeopleMetricsData=function(e,t,r){r===undefined&&(r=this),r.people_metrics_data[e]=n(t,r)},this.getPeopleMetricsData=function(){return this.people_metrics_data},this.people_global_data={},this.addPeopleGlobalData=function(e,t,r){r===undefined&&(r=this),r.people_global_data[e]=n(t,r)},this.getPeopleGlobalData=function(){return this.people_global_data},this.getCompanyQuery=function(){var e=null,t=window.location.search.substr(1);return t&&t.split("&")[0].split("=")[0]==="company"&&(e=t.split("&")[0].split("=")[1]),e},this.displayMetricCompanies=function(e,t,n,r,i){var s=this.getCompaniesMetricsData();Viz.displayMetricCompanies(e,s,t,n,r,i)},this.displayMetricMyCompanies=function(e,t,n,r,i,s){var o={},u=this;$.each(e,function(e,t){o[t]=u.getCompaniesMetricsData()[t]}),Viz.displayMetricCompanies(t,o,n,r,i,s)},this.displayMetricRepos=function(e,t,n,r,i){var s=this.getReposMetricsData();Viz.displayMetricRepos(e,s,t,n,r,i)},this.displayBasicMetricMyRepos=function(e,t,n,r,i,s){var o={},u=Report.getReposMap(),a=this;$.each(e,function(e,t){var n=a.getReposMetricsData()[t];n||(u[t]instanceof Object?t=u[t][a.getName()]:t=u[t],n=a.getReposMetricsData()[t]),o[t]=n}),Viz.displayMetricRepos(t,o,n,r,i,s)},this.displayMetricDomains=function(e,t,n,r,i){var s=this.getDomainsMetricsData();Viz.displayMetricDomains(e,s,t,n,r,i)},this.displayMetricCompaniesStatic=function(e,t,n,r,i){this.displayMetricSubReportStatic("companies",e,t,n,r,i)},this.displayMetricReposStatic=function(e,t,n,r,i){this.displayMetricSubReportStatic("repos",e,t,n,r,i)},this.displayMetricCountriesStatic=function(e,t,n,r,i){this.displayMetricSubReportStatic("countries",e,t,n,r,i)},this.displayMetricDomainsStatic=function(e,t,n,r,i){this.displayMetricSubReportStatic("domains",e,t,n,r,i)},this.displayMetricSubReportStatic=function(e,t,n,r,i,s){i===undefined&&(i=t);var o=null;if(e=="companies")o=this.getCompaniesGlobalData();else if(e=="repos")o=this.getReposGlobalData();else if(e=="countries")o=this.getCountriesGlobalData();else{if(e!="domains")return;o=this.getDomainsGlobalData()}if($.isEmptyObject(o))return;var u=null;e=="companies"?u=DataProcess.sortCompanies(this,i):e=="repos"?u=DataProcess.sortRepos(this,i):e=="countries"?u=DataProcess.sortCountries(this,i):e=="domains"&&(u=DataProcess.sortDomains(this,i)),u=DataProcess.paginate(u,Report.getCurrentPage()),Viz.displayMetricSubReportStatic(t,o,u,n,r)},this.displayMetricsCompany=function(e,t,n,r){var i=this.getCompaniesMetricsData()[e];if(i===undefined){$("#"+n).hide();return}Viz.displayMetricsCompany(e,t,i,n,r)},this.displayMetricsRepo=function(e,t,n,r){var i=this.getReposMetricsData()[e];if(i===undefined){$("#"+n).hide();return}Viz.displayMetricsRepo(e,t,i,n,r)},this.displayMetricsCountry=function(e,t,n,r){var i=this.getCountriesMetricsData()[e];if(i===undefined){$("#"+n).hide();return}Viz.displayMetricsCountry(e,t,i,n,r)},this.displayMetricsDomain=function(e,t,n,r){var i=this.getDomainsMetricsData()[e];if(i===undefined)return;Viz.displayMetricsDomain(e,t,i,n,r)},this.displayMetricsPeople=function(e,t,n,r,i){var s=this.getPeopleMetricsData()[e];if(s===undefined||s instanceof Array){$("#"+r).hide();return}Viz.displayMetricsPeople(t,n,s,r,i)},this.displayMetricsEvol=function(e,t,n,r){var i=this.getData();r&&(i=DataProcess.convert(i,r,e)),Viz.displayMetricsEvol(this,e,i,t,n)},this.isPageDisplayed=function(e,t,n,r){var i=Math.floor((r-3)/2),s=e-i,o=e+i;return t===1||t===n||t==e?!0:t>=s&&t<e?!0:t<=o&&t>e?!0:!1},this.displayItemsNav=function(e,t,n,r){var i=parseInt(n,null);isNaN(i)&&(i=1);var s=null,o="",u=0,a=5;if(t==="companies")s=this.getCompaniesData(),o="List of companies";else if(t==="repos")s=this.getReposData(),r&&(s=DataProcess.sortRepos(this,r));else if(t==="countries")s=this.getCountriesData();else{if(t!=="domains")return;s=this.getDomainsData()}u=s.length;var f="",l=Report.getPageSize();if(i){f+="<div class='pagination'>";var c=Math.ceil(u/l),h=(i-1)*l+1,p=i*l;p>u&&(p=u),f+="<ul class='pagination'>",i>1?f+="<li><a href='?page="+(i-1)+"'>«</a></li>":f+="<li class='disabled'><a href='?page="+i+"'>«</a></li>";for(var d=0;d*Report.getPageSize()<u;d++)if(this.isPageDisplayed(i,d+1,c,a)===!0)i===d+1?f+="<li class='active'><a href='?page="+(d+1)+"'>"+(d+1)+"</a></li>":f+="<li><a href='?page="+(d+1)+"'>"+(d+1)+"</a></li>";else if(d+1+1===c||d+1-1===1)f+="<li class='disabled'><a href='#'> .. </a></li>";i*Report.getPageSize()<s.length&&(f+="<li><a href='?page="+(parseInt(i,null)+1)+"'>",f+="»</a></li>"),f+="</ul>",f+="<span class='pagination-text'> ("+h+" - "+p+"/"+u+")</span>",f+="</div>"}Report.getPageSize()>10&&$.each(s,function(e,t){var n=Report.cleanLabel(t);f+="<a href='#"+t+"-nav'>"+n+"</a> "}),$("#"+e).append(f)},this.displayCompaniesLinks=function(e,t,n){var r=DataProcess.sortCompanies(this,n),i="",s=0;$.each(r,function(e,n){i+='<a href="company.html?company='+n,Report.addDataDir()&&(i+="&"+Report.addDataDir()),i+='">'+n+"</a>| ";if(s++>=t-1)return!1}),$("#"+e).append(i)},this.displayCompaniesList=function(e,t,n,r,i,s,o,u,a){this.displaySubReportList("companies",e,t,n,r,i,s,o,u,a)},this.displayReposList=function(e,t,n,r,i,s,o,u,a){this.displaySubReportList("repos",e,t,n,r,i,s,o,u,a)},this.displayCountriesList=function(e,t,n,r,i,s,o,u,a){this.displaySubReportList("countries",e,t,n,r,i,s,o,u,a)},this.displayDomainsList=function(e,t,n,r,i,s,o,u,a){this.displaySubReportList("domains",e,t,n,r,i,s,o,u,a)},this.displaySubReportList=function(e,t,n,r,i,s,o,u,a,f){var l=parseInt(s,null);isNaN(l)&&(l=1);var c="",h=(l-1)*Report.getPageSize()+1,p=this,d=null,v=null;o===undefined&&(o=!0);if(e==="companies")d=this.getCompaniesMetricsData(),v=DataProcess.sortCompanies(this,i);else if(e==="repos")d=this.getReposMetricsData(),v=DataProcess.sortRepos(this,i);else if(e==="countries")d=this.getCountriesMetricsData(),v=DataProcess.sortCountries(this,i);else{if(e!=="domains")return;d=this.getDomainsMetricsData(),v=DataProcess.sortDomains(this,i)}v=DataProcess.paginate(v,l),c+='<table class="table table-hover table-repositories">',c+="<tr><th></th>",$.each(t,function(e,t){p.getMetrics()[t]?(title=p.getMetrics()[t].name,c+="<th>"+title+"</th>"):c+="<th>"+t+"</th>"}),c+="</tr>",$.each(v,function(n,r){c+="<tr><td class='span2 repository-name'>",c+="#"+h+" ",h++;var i=null;Report.addDataDir()&&(i=Report.addDataDir()),o&&(e==="companies"?(c+="<a href='company.html?company="+r,i&&(c+="&"+i),c+="'>"):e==="repos"?(c+="<a href='",c+="repository.html",c+="?repository="+encodeURIComponent(r),i&&(c+="&"+i),c+="'>"):e==="countries"?(c+="<a href='country.html?country="+r,i&&(c+="&"+i),c+="'>"):e==="domains"&&(c+="<a href='domain.html?domain="+r,i&&(c+="&"+i),c+="'>")),c+="<strong>",c+=Report.cleanLabel(r),c+="</strong>",o&&(c+="</a>"),c+="</td>",$.each(t,function(t,n){c+="<td class='span5'>",c+="<div id='"+e+"-"+r+"-"+n+"'",c+=" class='subreport-list-item'>"}),c+="</td></tr>"}),c+="</table>",$("#"+n).append(c);var m=null,g=null,y=null;u&&(m=u.split(",")),a&&(g=a.split(",")),f&&(y=f.split(",")),$.each(v,function(n,i){var s=0;$.each(t,function(t,n){var o=null,u=null,a=null;m&&(o=m[s]),g&&(u=g[s]),y&&(a=y[s]);if(i in d==0)return;var f=d[i];if(f[n]===undefined)return;var l=e+"-"+i+"-"+n,c={};c[i]=f;var h="";Viz.displayMetricSubReportLines(l,n,c,h,r,o,u,a),s++})})},this.displayGlobalSummary=function(e){this.displaySummary(null,e,null,this)},this.displayCompanySummary=function(e,t,n){this.displaySummary("companies",e,t,n)},this.displayRepoSummary=function(e,t,n){this.displaySummary("repositories",e,t,n)},this.displayCountrySummary=function(e,t,n){this.displaySummary("countries",e,t,n)},this.displayDomainSummary=function(e,t,n){this.displaySummary("domains",e,t,n)},this.displayPeopleSummary=function(e,t,n,r){var i=r.getPeopleGlobalData()[t];if(i===undefined||i instanceof Array)return;html="<h6>"+r.getTitle()+"</h6>",html+="<table class='table-condensed table-hover'>",html+="<tr><td>",html+="Start</td><td>"+i.first_date,html+="</td></tr><tr><td>",html+="End</td><td>"+i.last_date,html+="</td></tr><tr><td>",r.getName()=="scm"?html+="Commits</td><td>"+i.scm_commits:r.getName()=="its"?html+="Closed</td><td>"+i.its_closed:r.getName()=="mls"?html+="Sent</td><td>"+i.mls_sent:r.getName()=="irc"?html+="Sent</td><td>"+i.irc_sent:r.getName()=="scr"&&(html+="Closed</td><td>"+i.scr_closed),html+="</td></tr>",html+="</table>",$("#"+e).append(html)},this.displayCompaniesSummary=function(e,t){var n="",r=t.getGlobalData();n+="Total companies: "+r.companies+"<br>",r.companies_2006&&(n+="Companies in 2006: "+r.companies_2006+"<br>"),r.companies_2009&&(n+="Companies in 2009: "+r.companies_2009+"<br>"),r.companies_2012&&(n+="Companies in 2012: "+r.companies_2012+"<br>"),$("#"+e).append(n)},this.getSummaryLabels=function(){},this.displaySummary=function(e,t,n,r){n||(n="");var i="<h6>"+r.getTitle()+"</h6>",s=this.getSummaryLabels(),o=null;e==="companies"?o=r.getCompaniesGlobalData()[n]:e==="countries"?o=r.getCountriesGlobalData()[n]:e==="repositories"?o=r.getReposGlobalData()[n]:e==="domains"?o=r.getDomainsGlobalData()[n]:o=r.getGlobalData();if(!o)return;var u=this;i+="<table class='table-condensed table-hover'>",$.each(o,function(t,n){i+="<tr><td>",u.getMetrics()[t]?i+=u.getMetrics()[t].name+"</td><td>"+Report.formatValue(n):s[t]?i+=s[t]+"</td><td>"+Report.formatValue(n):e&&(i+=t+"</td><td>"+Report.formatValue(n)),i+="</td></tr>"}),i+="</table>",$("#"+t).append(i)},this.displayReposSummary=function(e,t){var n="",r=t.getGlobalData();n+="Total repositories: "+r[t.getName()+"_repositories"]+"<br>",$("#"+e).append(n)},this.displayCountriesSummary=function(e,t){var n="",r=t.getGlobalData();n+="Total countries: "+r.countries+"<br>",$("#"+e).append(n)},this.displayDomainsSummary=function(e,t){var n="",r=t.getGlobalData();n+="Total domains: "+r.domains+"<br>",$("#"+e).append(n)},this.displayDemographics=function(e,t){var n=this.getDemographicsData();Viz.displayDemographicsChart(e,this,n,t)},this.displayTimeToAttention=function(e,t,n,r){n=!0,r="Time to Attention "+t;var i=this.getTimeToAttentionData();if(i instanceof Array)return;Viz.displayTimeToAttention(e,i,t,n,r)},this.displayTimeToFix=function(e,t,n,r){n=!0,r="Time to Fix "+t;var i=this.getTimeToFixData();if(i instanceof Array)return;Viz.displayTimeToFix(e,this.getTimeToFixData(),t,n,r)},this.displayMarkovTable=function(e,t){var n=this.getMarkovTableData();if(n===undefined){Report.log("No Markov data available");return}Viz.displayMarkovTable(e,n,t)},this.displayTop=function(e,t,n,r,i,s,o,u,a){t===undefined&&(t=!0);var f=null;this.getName()=="mls"&&n=="threads"?Viz.displayTopThreads(e,this,t,n,r,i,o,u,a):Viz.displayTop(e,this,t,n,r,i,s,f,o,u)},this.displayTopCompany=function(e,t,n,r,i){var s=this.getCompaniesTopData()[e];if(s===undefined)return;var o=this.getMetrics()[n];Viz.displayTopCompany(e,s,t,o,r,i)},this.displayTopGlobal=function(e,t,n,r){Viz.displayTopGlobal(e,this,t,n,r)},this.envisionEvo=function(e,t,n,r,i){config=Report.getVizConfig();var s=Viz.getEnvisionOptions(e,t,this.getName(),Report.getVizConfig()[this.getName()+"_hide"],i);s.legend_show=r,n&&DataProcess.addRelativeValues(s.data,this.getMainMetric()),new envision.templates.Envision_Report(s,[this])},this.displayEnvision=function(e,t,n,r){var i=Report.getProjectsDataSources();this.envisionEvo(e,i,t,n,r)}}function IRC(){var e=this;this.basic_metrics={irc_sent:{divid:"irc_sent",column:"sent",name:"Sent",desc:"Messages sent"},irc_senders:{divid:"irc_senders",column:"senders",name:"Senders",desc:"Messages senders",action:"sent"},irc_repositories:{divid:"irc_repositories",column:"repositories",name:"Repositories",desc:"Number of active repositories"}},this.getMainMetric=function(){return"irc_sent"},this.getSummaryLabels=function(){var e={first_date:"Start",last_date:"End"};return e},this.displayData=function(e){var t="#"+e,n=this.global_data.url;if(!n||n.length===0){$(t+" .irc_info").hide();return}var r="";this.global_data.repositories===1?r=this.global_data.url:r=Report.getProjectData().irc_url,this.global_data.type&&$(t+" #irc_type").text(this.global_data.type),this.global_data.url&&this.global_data.url!=="."&&this.global_data.type!==undefined?($(t+" #irc_url").attr("href",r),$(t+" #irc_name").text("IRC "+this.global_data.type)):($(t+" #irc_url").attr("href",Report.getProjectData().irc_url),$(t+" #irc_name").text(Report.getProjectData().irc_name),$(t+" #irc_type").text(Report.getProjectData().irc_type));var i=this.getGlobalData();$(t+" #ircFirst").text(i.first_date),$(t+" #ircLast").text(i.last_date),$(t+" #ircSent").text(i.irc_sent),$(t+" #ircRepositories").text(i.irc_repositories),i.repositories===1&&$(t+" #ircRepositories").hide()},this.displayBubbles=function(e,t){},this.getTitle=function(){return"IRC Messages"}}function ITS(){this.basic_metrics={its_opened:{divid:"its_opened",column:"opened",name:"Opened",desc:"Number of opened tickets",envision:{y_labels:!0,show_markers:!0}},its_openers:{divid:"its_openers",column:"openers",name:"Openers",desc:"Unique identities opening tickets",action:"opened",envision:{gtype:"whiskers"}},its_closed:{divid:"its_closed",column:"closed",name:"Closed",desc:"Number of closed tickets"},its_closers:{divid:"its_closers",column:"closers",name:"Closers",desc:"Number of identities closing tickets",action:"closed",envision:{gtype:"whiskers"}},its_changed:{divid:"its_changed",column:"changed",name:"Changed",desc:"Number of changes to the state of tickets"},its_changers:{divid:"its_changers",column:"changers",name:"Changers",desc:"Number of identities changing the state of tickets",action:"changed",envision:{gtype:"whiskers"}},its_companies:{divid:"its_companies",column:"companies",name:"Companies",desc:"Number of active companies"},its_countries:{divid:"its_countries",column:"countries",name:"Countries",desc:"Number of active countries"},its_repositories:{divid:"its_repositories",column:"repositories",name:"Respositories",desc:"Number of active respositories"},its_domains:{divid:"its_domains",column:"domains",name:"Domains",desc:"Number of active domains"},its_people:{divid:"its_people",column:"people",name:"People",desc:"Number of active people"}},this.getMainMetric=function(){return"its_opened"},this.setReposData=function(e,t){t===undefined&&(t=this),e instanceof Array||(e=[e]);var n=[];for(var r=0;r<e.length;r++)n.push(e[r].replace(/\//g,"_"));t.repos=n},this.getSummaryLabels=function(){var e={first_date:"Start",last_date:"End",tickets:"Tickets",trackers:"Trackers"};return e},this.displayData=function(e){var t="#"+e,n=this.global_data.url;if(!n||n.length===0){$(t+" .its-info").hide();return}$(t+" #its_type").text(this.global_data.type);var r="";this.global_data.repositories===1?r=this.global_data.url:r=Report.getProjectData().its_url,r===undefined&&(r=""),this.global_data.type==="allura"?r=r.replace("rest/",""):this.global_data.type==="github"&&(r=r.replace("api.",""),r=r.replace("repos/","")),$(t+" #its_url").attr("href",r);var i=this.global_data.type.charAt(0).toUpperCase()+this.global_data.type.slice(1);$(t+" #its_name").text(i+" Tickets");var s=this.getGlobalData();$(t+" #itsFirst").text(s.first_date),$(t+" #itsLast").text(s.last_date),$(t+" #itsTickets").text(s.its_opened),$(t+" #itsOpeners").text(s.its_openers),$(t+" #itsRepositories").text(s.its_repositories),s.repositories===1&&$(t+" #itsRepositories").hide()},this.getTitle=function(){return"Tickets"},this.displayBubbles=function(e,t){Viz.displayBubbles(e,"its_opened","its_openers",t)}}function MediaWiki(){var e=this;this.basic_metrics={mediawiki_reviews:{divid:"mediawiki_reviews",column:"reviews",name:"Editions",desc:"Wiki page editions"},mediawiki_authors:{divid:"mediawiki_authors",column:"authors",name:"Editors",desc:"Editors doing editions",action:"reviews"},mediawiki_pages:{divid:"mediawiki_pages",column:"pages",name:"Pages",desc:"Wiki pages"}},this.getMainMetric=function(){return"mediawiki_reviews"},this.getSummaryLabels=function(){var e={first_date:"Start",last_date:"End"};return e},this.displayData=function(e){var t="#"+e,n=this.global_data.url;if(!n||n.length===0){$(t+" .mediawiki_info").hide();return}var r="";this.global_data.repositories===1?r=this.global_data.url:r=Report.getProjectData().mediawiki_url,this.global_data.type&&$(t+" #mediawiki_type").text(this.global_data.type),this.global_data.url&&this.global_data.url!=="."&&this.global_data.type!==undefined?($(t+" #mediawiki_url").attr("href",r),$(t+" #mediawiki_name").text("MediaWiki "+this.global_data.type)):($(t+" #mediawiki_url").attr("href",Report.getProjectData().mediawiki_url),$(t+" #mediawiki_name").text(Report.getProjectData().mediawiki_name),$(t+" #mediawiki_type").text(Report.getProjectData().mediawiki_type));var i=this.getGlobalData();$(t+" #mediawikiFirst").text(i.first_date),$(t+" #mediawikiLast").text(i.last_date),$(t+" #mediawikiSent").text(i.mediawiki_reviews)},this.displayBubbles=function(e,t){},this.getTitle=function(){return"MediaWiki Reviews"}}function MLS(){function t(){var e=document.getElementById("form_mls_selector"),t=[];for(var n=0;n<e.elements.length;n++)e.elements[n].checked&&t.push(e.elements[n].value);return localStorage&&localStorage.setItem(i(),JSON.stringify(t)),t}function n(e,t,n,r){var i=Viz.checkBasicConfig(r);for(var s in basic_metrics){var o=basic_metrics[s],u="";i.show_title&&(u=o.name);if($.inArray(o.column,Report.getConfig().mls_hide)>-1)continue;var a="<div class='info-pill m0-box-div flotr2-"+o.column+"'>";a+="<h4>"+o.name+" "+MLS.displayMLSListName(t)+"</h4>",a+="<div id='"+o.divid+"_"+t+"' class='m0-box flotr2-"+o.column+"'></div>",i.show_desc&&(a+="<p>"+o.desc+"</p>"),a+="</div>",$("#"+e).append(a),Viz.displayBasicLinesFile(o.divid+"_"+t,n,o.column,i.show_labels,u)}}function r(){var e=Report.getProjectData();return e.date+"_"+e.project_name}function i(){return r()+"_mls_lists"}function s(){localStorage&&localStorage.length&&localStorage.getItem(i())&&localStorage.removeItem(i())}function o(e){return typeof e.id=="number"&&$.each(e,function(e,t){t=[t]}),e}var e=this;this.basic_metrics={mls_responses:{divid:"mls_responses",column:"responses",name:"Responses",desc:"Number of messages that are responses"},mls_sent:{divid:"mls_sent",column:"sent",name:"Sent",desc:"Number of messages"},mls_senders:{divid:"mls_senders",column:"senders",name:"Senders",desc:"Number of unique message senders",action:"sent"},mls_threads:{divid:"mls_threads",column:"threads",name:"Threads",desc:"Number of messages threads"},mls_companies:{divid:"mls_companies",column:"companies",name:"Companies",desc:"Number of active companies"},mls_countries:{divid:"mls_countries",column:"countries",name:"Countries",desc:"Number of active countries"},mls_repositories:{divid:"mls_repositories",column:"repositories",name:"Respositories",desc:"Number of active respositories"},mls_domains:{divid:"mls_domains",column:"domains",name:"Domains",desc:"Number of active domains"},mls_people:{divid:"mls_people",column:"people",name:"People",desc:"Number of active people"}},this.data_lists_file=this.data_dir+"/mls-lists.json",this.getListsFile=function(){return this.data_lists_file},this.data_lists=null,this.getListsData=function(){return this.data_lists},this.setListsData=function(e,t){t===undefined&&(t=this),t.data_lists=e},this.setDataDir=function(e){this.data_dir=e,this.data_lists_file=this.data_dir+"/mls-lists.json",MLS.prototype.setDataDir.call(this,e)},this.getMainMetric=function(){return"mls_sent"},this.getSummaryLabels=function(){var e={first_date:"Start",last_date:"End"};return e},this.displayData=function(e){var t="#"+e,n=this.global_data.url;(!n||n.length===0)&&$(t+" .mls_info").hide();var r="";this.global_data.repositories===1?r=this.global_data.url:r=Report.getProjectData().mls_url,this.global_data.type&&$(t+" #mls_type").text(this.global_data.type),this.global_data.url&&this.global_data.url!=="."&&this.global_data.type!==undefined?($(t+" #mls_url").attr("href",r),$(t+" #mls_name").text("MLS "+this.global_data.type)):($(t+" #mls_url").attr("href",Report.getProjectData().mls_url),$(t+" #mls_name").text(Report.getProjectData().mls_name),$(t+" #mls_type").text(Report.getProjectData().mls_type));var i=this.getGlobalData();$(t+" #mlsFirst").text(i.first_date),$(t+" #mlsLast").text(i.last_date),$(t+" #mlsMessages").text(i.mls_sent),$(t+" #mlsSenders").text(i.mls_senders),$(t+" #mlsRepositories").text(i.mls_repositories),i.repositories===1&&$(t+" #mlsRepositories").hide()},this.displayBubbles=function(e,t){Viz.displayBubbles(e,"mls_sent","mls_senders",t)},MLS.displayMLSListName=function(e){var t=e.split("_"),n="";return t.length>1?(n=t[t.length-1],n===""&&(n=t[t.length-2])):(n=e.replace("<",""),n=n.replace(">",""),t=n.split("."),n=t[0]),n},this.displayBasicUserAll=function(e,t){var n=document.getElementById("form_mls_selector");for(var r=0;r<n.elements.length;r++)n.elements[r].type=="checkbox"&&(n.elements[r].checked=t);this.displayBasicUser(e)},this.displayBasicUser=function(e){$("#"+e).empty(),lists=t();for(var r=0;r<lists.length;r++){var i=lists[r];file_messages=this.getDataDir()+"/mls-",file_messages+=i,file_messages+="-evolutionary.json",n(e,i,file_messages)}},this.displayBasic=function(e,t){var r=this.getListsData();lists_hide=Report.getConfig().mls_hide_lists,r=r.mailing_list;if(r===undefined)return null;var s=!1;typeof r=="string"&&(r=[r]),localStorage&&localStorage.length&&localStorage.getItem(i())&&(r=JSON.parse(localStorage.getItem(i())),s=!0);for(var o=0;o<r.length;o++){var u=r[o];if(!s&&$.inArray(u,lists_hide)>-1)continue;file_messages=this.getDataDir()+"/mls-",file_messages+=u,file_messages+="-evolutionary.json",n(e,u,file_messages,t)}},this.getTitle=function(){return"Mailing Lists"},this.displayEvoListsMain=function(e){if(localStorage&&localStorage.length&&localStorage.getItem(i()))return lists=JSON.parse(localStorage.getItem(i())),this.displayEvoLists(e,lists);history=this.getListsData(),lists=history.mailing_list;if(lists===undefined)return;var t=Report.getConfig();lists_hide=t.mls_hide_lists,typeof lists=="string"&&(lists=[lists]);var n=[];for(var r=0;r<lists.length;r++)$.inArray(lists[r],lists_hide)==-1&&n.push(lists[r]);localStorage&&(localStorage.getItem(i())||localStorage.setItem(i(),JSON.stringify(n))),this.displayEvoLists(e,n)},this.getDefaultLists=function(){var e=[],t=Report.getConfig().mls_hide_lists;return $.each(this.getListsData().mailing_list,function(n,r){$.inArray(r,t)===-1&&e.push(r)}),e},this.displaySelectorCheckDefault=function(){var e=this.getDefaultLists(),t=document.getElementById("form_mls_selector");for(var n=0;n<t.elements.length;n++)if(t.elements[n].type=="checkbox"){var r=t.elements[n].id;l=r.split("_check")[0],$.inArray(l,e)>-1?t.elements[n].checked=!0:t.elements[n].checked=!1}},this.displayBasicDefault=function(t){var n=e;this instanceof MLS&&(n=this),s(),n.displaySelectorCheckDefault(),$("#"+t).empty(),n.displayBasic(t)},this.displayEvoDefault=function(t){var n=e;this instanceof MLS&&(n=this),s(),document.getElementById("form_mls_selector")&&n.displaySelectorCheckDefault(),$("#"+t).empty(),n.displayEvoLists(t,n.getDefaultLists())},this.displayEvoUserAll=function(e,t){var n=document.getElementById("form_mls_selector");for(var r=0;r<n.elements.length;r++)n.elements[r].type=="checkbox"&&(n.elements[r].checked=t);this.displayEvoUser(e)},this.displayEvoUser=function(n){$("#"+n).empty();var r=e;this instanceof MLS&&(r=this),r.displayEvoLists(n,t())},this.displayEvoListSelector=function(e,t){this.displayEvoBasicListSelector(e,t,null)},this.displayBasicListSelector=function(e,t){this.displayEvoBasicListSelector(e,null,t)},this.displayEvoBasicListSelector=function(e,t,n){var r=this.getListsData(),s=r.mailing_list,o=[];if(s===undefined)return;localStorage&&localStorage.length&&localStorage.getItem(i())&&(o=JSON.parse(localStorage.getItem(i()))),Report.displayBasicUser=this.displayBasicUser,Report.displayBasicUserAll=this.displayBasicUserAll,Report.displayBasicDefault=
this.displayBasicDefault,Report.displayEvoDefault=this.displayEvoDefault,Report.displayEvoUser=this.displayEvoUser,Report.displayEvoUserAll=this.displayEvoUserAll;var u="Mailing list selector:";u+="<form id='form_mls_selector'>",typeof s=="string"&&(s=[s]);for(var a=0;a<s.length;a++){var f=s[a];u+='<input type=checkbox name="check_list" value="'+f+'" ',u+='onClick="',t&&(u+="Report.displayEvoUser('"+t+"');"),n&&(u+="Report.displayBasicUser('"+n+"')\";"),u+='" ',u+='id="'+f+'_check" ',$.inArray(f,o)>-1&&(u+="checked "),u+=">",u+=MLS.displayMLSListName(f),u+="<br>"}u+='<input type=button value="All" ',u+='onClick="',t&&(u+="Report.displayEvoUserAll('"+t+"',true);"),n&&(u+="Report.displayBasicUserAll('"+n+"',true);"),u+='">',u+='<input type=button value="None" ',u+='onClick="',t&&(u+="Report.displayEvoUserAll('"+t+"',false);"),n&&(u+="Report.displayBasicUserAll('"+n+"',false);"),u+='">',u+='<input type=button value="Default" ',u+='onClick="',t&&(u+="Report.displayEvoDefault('"+t+"');"),n&&(u+="Report.displayBasicDefault('"+n+"')"),u+='">',u+="</form>",$("#"+e).html(u),Report.getProjectsList().length>1&&($("#"+e).append("Not supported in multiproject"),$("#"+e+" :input").attr("disabled",!0))},this.displayEvoLists=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];file_messages=this.getDataDir()+"/mls-",file_messages+=r,file_messages+="-evolutionary.json",this.displayEvoList(MLS.displayMLSListName(r),e,file_messages)}},this.displayEvoList=function(e,t,n){var r=this;$.getJSON(n,function(n){r.envisionEvoList(e,t,n)})},this.envisionEvoList=function(e,t,n){var r=Report.getConfig(),i=Viz.getEnvisionOptionsMin(t,n,r.mls_hide);i.data.list_label=MLS.displayMLSListName(e),new envision.templates.Envision_Report(i,[this])}}function SCM(){this.basic_metrics={scm_commits:{divid:"scm_commits",column:"commits",name:"Commits",desc:"Evolution of the number of commits (aggregating branches)",envision:{y_labels:!0,show_markers:!0}},scm_committers:{divid:"scm_committers",column:"committers",name:"Committers",desc:"Unique committers making changes to the source code",action:"commits",envision:{gtype:"whiskers"}},scm_authors:{divid:"scm_authors",column:"authors",name:"Authors",desc:"Unique authors making changes to the source code",action:"commits",envision:{gtype:"whiskers"}},scm_authors_rev:{divid:"scm_authors-rev",column:"authors_rev",name:"Authors",desc:"Unique authors making changes reviewed to the source code",action:"commits_rev",envision:{gtype:"whiskers"}},scm_commits_rev:{divid:"scm_commits-rev",column:"commits_rev",name:"Commits Reviewed",desc:"Evolution of the number of commits reviewed (aggregating branches)",envision:{y_labels:!0,show_markers:!0}},scm_reviewers:{divid:"scm_reviewers",column:"reviewers",name:"Reviewers",desc:"Unique reviewers making reviews to the source code changes",action:"commits-rev",envision:{gtype:"whiskers"}},scm_branches:{divid:"scm_branches",column:"branches",name:"Branches",desc:"Evolution of the number of branches"},scm_files:{divid:"scm_files",column:"files",name:"Files",desc:"Evolution of the number of unique files handled by the community"},scm_added_lines:{divid:"scm_added_lines",column:"added_lines",name:"Lines Added",desc:"Evolution of the source code lines added"},scm_removed_lines:{divid:"scm_removed_lines",column:"removed_lines",name:"Lines Removed",desc:"Evolution of the source code lines removed"},scm_repositories:{divid:"scm_repositories",column:"repositories",name:"Repositories",desc:"Evolution of the number of repositories",envision:{gtype:"whiskers"}},scm_companies:{divid:"scm_companies",column:"companies",name:"Companies",desc:"Number of active companies"},scm_countries:{divid:"scm_countries",column:"countries",name:"Countries",desc:"Number of active countries"},scm_domains:{divid:"scm_domains",column:"domains",name:"Domains",desc:"Number of active domains"},scm_people:{divid:"scm_people",column:"people",name:"People",desc:"Number of active people"}},this.getMainMetric=function(){return"scm_commits"},this.setITS=function(e){this.its=e},this.getITS=function(e){return this.its},this.getTitle=function(){return"Source Code Management"},this.getSummaryLabels=function(){var e={first_date:"Start",last_date:"End",actions:"Files actions",avg_commits_month:"Commits/month",avg_files_month:"Files/month",avg_authors_month:"Authors/month",avg_reviewers_month:"Reviewers/moth",avg_commits_week:"Commits/week",avg_files_week:"Files/week",avg_authors_week:"Authors/week",avg_reviewers_week:"Reviewers/week",avg_commits_author:"Commits/author",avg_files_author:"Files/author"};return e},this.displayData=function(e){var t="#"+e,n=this.global_data.url;if(!n||n.length===0){$(t+" .scm-info").hide();return}var r=this.global_data.type.charAt(0).toUpperCase()+this.global_data.type.slice(1);$(t+" #scm_type").text(r);var i="";this.global_data.repositories===1?i=this.global_data.url:i=Report.getProjectData().scm_url,this.global_data.type==="git"&&i&&(i=i.replace("git://","http://")),$(t+" #scm_url").attr("href",i),$(t+" #scm_name").text(r);var s=this.getGlobalData();$(t+" #scmFirst").text(s.first_date),$(t+" #scmLast").text(s.last_date),$(t+" #scmCommits").text(s.scm_commits),$(t+" #scmAuthors").text(s.scm_authors),s.reviewers&&$(t+" #scmReviewers").text(s.scm_reviewers),$(t+" #scmCommitters").text(s.scm_committers),$(t+" #scmRepositories").text(s.scm_repositories),s.repositories===1&&$(t+" #scmRepositories").hide()},this.displayBubbles=function(e,t){Viz.displayBubbles(e,"scm_commits","scm_committers",t)}}function SCR(){var e=this;this.basic_metrics={scr_opened:{divid:"scr_opened",column:"opened",name:"Reviews opened",desc:"Reviews in status new or inprogress"},scr_closed:{divid:"scr_closed",column:"closed",name:"Reviews closed",desc:"Reviews merged or abandoned"},scr_merged:{divid:"scr_merged",column:"merged",name:"Reviews merged",desc:"Reviews merged"},scr_mergers:{divid:"scr_mergers",column:"mergers",name:"Reviews mergers",action:"merged",desc:"People merging reviews"},scr_new:{divid:"scr_new",column:"new",name:"Reviews new",desc:"Reviews in status new"},scr_abandoned:{divid:"scr_abandoned",column:"abandoned",name:"Reviews abandoned",desc:"Reviews abandoned"},scr_pending:{divid:"scr_pending",column:"pending",name:"Reviews pending",desc:"Reviews pending to be attended"},scr_review_time_days_avg:{divid:"scr_review_time_days_avg",column:"review_time_days_avg",name:"Average review time",desc:"Average review time in days"},scr_verified:{divid:"scr_verified",column:"verified",name:"Patches verified",desc:"Patches verified"},scr_approved:{divid:"scr_approved",column:"approved",name:"Patches approved",desc:"Patches approved"},scr_codereview:{divid:"scr_codereview",column:"codereview",name:"Patches codereview",desc:"Patches in code review process"},scr_WaitingForReviewer:{divid:"scr_WaitingForReviewer",column:"WaitingForReviewer",name:"Patches waiting reviewer",desc:"Patches waiting for reviewer"},scr_WaitingForSubmitter:{divid:"scr_WaitingForSubmitter",column:"WaitingForSubmitter",name:"Patches waiting submitter",desc:"Patches waiting for a new version"},scr_submitted:{divid:"scr_submitted",column:"submitted",name:"Reviews submitted",desc:"Reviews submitted"},scr_sent:{divid:"scr_sent",column:"sent",name:"Patches Sent",desc:"Patches sent"},scr_companies:{divid:"scr_companies",column:"companies",name:"Companies",desc:"Number of active companies"},scr_countries:{divid:"scr_countries",column:"countries",name:"Countries",desc:"Number of active countries"},scr_repositories:{divid:"scr_repositories",column:"repositories",name:"Respositories",desc:"Number of active respositories"},scr_people:{divid:"scr_people",column:"people",name:"People",desc:"Number of active people"},scr_closers:{divid:"scr_closers",column:"closers",name:"Closers",desc:"Reviews closers",action:"closed"},scr_openers:{divid:"scr_openers",column:"openers",name:"Openers",desc:"Reviews openers",action:"opened"}},this.getMainMetric=function(){return"scr_merged"},this.getSummaryLabels=function(){var e={first_date:"Start",last_date:"End"};return e},this.displayData=function(e){var t="#"+e,n=this.global_data.url;if(!n||n.length===0){$(t+" .scr_info").hide();return}var r="";this.global_data.repositories===1?r=this.global_data.url:r=Report.getProjectData().scr_url,this.global_data.type&&$(t+" #scr_type").text(this.global_data.type),this.global_data.url&&this.global_data.url!=="."&&this.global_data.type!==undefined?($(t+" #scr_url").attr("href",r),$(t+" #scr_name").text("SCR "+this.global_data.type)):($(t+" #scr_url").attr("href",Report.getProjectData().mls_url),$(t+" #scr_name").text(Report.getProjectData().scr_name),$(t+" #scr_type").text(Report.getProjectData().scr_type));var i=this.getCompanyQuery(),s=this.getGlobalData();i&&(s=this.getCompaniesGlobalData()[i]),$(t+" #scrFirst").text(s.first_date),$(t+" #scrLast").text(s.last_date),$(t+" #scrReviews").text(s.scr_opened)},this.displayBubbles=function(e,t){},SCR.displaySCRListName=function(e){var t=e.split("_"),n="";return t.length>1?(n=t[t.length-1],n===""&&(n=t[t.length-2])):(n=e.replace("<",""),n=n.replace(">",""),t=n.split("."),n=t[0]),n},this.getTitle=function(){return"Source Code Review"}}function People(){this.basic_metrics={people_members:{column:"members",name:"Members",desc:"Community Members"}},this.getMainMetric=function(){return"people_members"},this.displayData=function(e){var t="#"+e,n=this.global_data.url;if(!n||n.length===0){$(t+" .mediawiki_info").hide();return}var r="";this.global_data.repositories===1?r=this.global_data.url:r=Report.getProjectData().mediawiki_url,this.global_data.type&&$(t+" #mediawiki_type").text(this.global_data.type),this.global_data.url&&this.global_data.url!=="."&&this.global_data.type!==undefined?($(t+" #mediawiki_url").attr("href",r),$(t+" #mediawiki_name").text("MediaWiki "+this.global_data.type)):($(t+" #mediawiki_url").attr("href",Report.getProjectData().mediawiki_url),$(t+" #mediawiki_name").text(Report.getProjectData().mediawiki_name),$(t+" #mediawiki_type").text(Report.getProjectData().mediawiki_type));var i=this.getGlobalData();$(t+" #mediawikiFirst").text(i.first_date),$(t+" #mediawikiLast").text(i.last_date),$(t+" #mediawikiSent").text(i.mediawiki_reviews)},this.displayBubbles=function(e,t){},this.getTitle=function(){return"Community Members"}}function Downloads(){var e=this;this.basic_metrics={downloads_downloads:{name:"Total downloads",column:"downloads"},downloads_packages:{divid:"",column:"packages",name:"Packages downloaded",desc:"",action:"downloads"},downloads_ips:{divid:"",column:"ips",name:"IP addresses",desc:"",action:"downloads"}},this.getMainMetric=function(){return"downloads_downloads"},this.displayData=function(e){var t="#"+e,n=this.global_data.url;if(!n||n.length===0){$(t+" .irc_info").hide();return}var r="";this.global_data.repositories===1?r=this.global_data.url:r=Report.getProjectData().irc_url,this.global_data.type&&$(t+" #irc_type").text(this.global_data.type),this.global_data.url&&this.global_data.url!=="."&&this.global_data.type!==undefined?($(t+" #irc_url").attr("href",r),$(t+" #irc_name").text("IRC "+this.global_data.type)):($(t+" #irc_url").attr("href",Report.getProjectData().irc_url),$(t+" #irc_name").text(Report.getProjectData().irc_name),$(t+" #irc_type").text(Report.getProjectData().irc_type));var i=this.getGlobalData();$(t+" #ircFirst").text(i.first_date),$(t+" #ircLast").text(i.last_date),$(t+" #ircSent").text(i.irc_sent),$(t+" #ircRepositories").text(i.irc_repositories),i.repositories===1&&$(t+" #ircRepositories").hide()},this.displayBubbles=function(e,t){},this.getTitle=function(){return"Downloads"}}(function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.slice,u=r.unshift,a=i.toString,f=i.hasOwnProperty,l=r.forEach,c=r.map,h=r.reduce,p=r.reduceRight,d=r.filter,v=r.every,m=r.some,g=r.indexOf,y=r.lastIndexOf,b=Array.isArray,w=Object.keys,E=s.bind,S=function(e){return new k(e)};typeof module!="undefined"&&module.exports?(module.exports=S,S._=S):e._=S,S.VERSION="1.1.7";var x=S.each=S.forEach=function(e,t,r){if(e==null)return;if(l&&e.forEach===l)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(i in e&&t.call(r,e[i],i,e)===n)return}else for(var o in e)if(f.call(e,o)&&t.call(r,e[o],o,e)===n)return};S.map=function(e,t,n){var r=[];return e==null?r:c&&e.map===c?e.map(t,n):(x(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)},S.reduce=S.foldl=S.inject=function(e,t,n,r){var i=n!==void 0;e==null&&(e=[]);if(h&&e.reduce===h)return r&&(t=S.bind(t,r)),i?e.reduce(t,n):e.reduce(t);x(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},S.reduceRight=S.foldr=function(e,t,n,r){e==null&&(e=[]);if(p&&e.reduceRight===p)return r&&(t=S.bind(t,r)),n!==void 0?e.reduceRight(t,n):e.reduceRight(t);var i=(S.isArray(e)?e.slice():S.toArray(e)).reverse();return S.reduce(i,t,n,r)},S.find=S.detect=function(e,t,n){var r;return T(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},S.filter=S.select=function(e,t,n){var r=[];return e==null?r:d&&e.filter===d?e.filter(t,n):(x(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},S.reject=function(e,t,n){var r=[];return e==null?r:(x(e,function(e,i,s){t.call(n,e,i,s)||(r[r.length]=e)}),r)},S.every=S.all=function(e,t,r){var i=!0;return e==null?i:v&&e.every===v?e.every(t,r):(x(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),i)};var T=S.some=S.any=function(e,t,r){t=t||S.identity;var i=!1;return e==null?i:m&&e.some===m?e.some(t,r):(x(e,function(e,s,o){if(i|=t.call(r,e,s,o))return n}),!!i)};S.include=S.contains=function(e,t){var n=!1;return e==null?n:g&&e.indexOf===g?e.indexOf(t)!=-1:(T(e,function(e){if(n=e===t)return!0}),n)},S.invoke=function(e,t){var n=o.call(arguments,2);return S.map(e,function(e){return(t.call?t||e:e[t]).apply(e,n)})},S.pluck=function(e,t){return S.map(e,function(e){return e[t]})},S.max=function(e,t,n){if(!t&&S.isArray(e))return Math.max.apply(Math,e);var r={computed:-Infinity};return x(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},S.min=function(e,t,n){if(!t&&S.isArray(e))return Math.min.apply(Math,e);var r={computed:Infinity};return x(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},S.sortBy=function(e,t,n){return S.pluck(S.map(e,function(e,r,i){return{value:e,criteria:t.call(n,e,r,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;return n<r?-1:n>r?1:0}),"value")},S.groupBy=function(e,t){var n={};return x(e,function(e,r){var i=t(e,r);(n[i]||(n[i]=[])).push(e)}),n},S.sortedIndex=function(e,t,n){n||(n=S.identity);var r=0,i=e.length;while(r<i){var s=r+i>>1;n(e[s])<n(t)?r=s+1:i=s}return r},S.toArray=function(e){return e?e.toArray?e.toArray():S.isArray(e)?o.call(e):S.isArguments(e)?o.call(e):S.values(e):[]},S.size=function(e){return S.toArray(e).length},S.first=S.head=function(e,t,n){return t!=null&&!n?o.call(e,0,t):e[0]},S.rest=S.tail=function(e,t,n){return o.call(e,t==null||n?1:t)},S.last=function(e){return e[e.length-1]},S.compact=function(e){return S.filter(e,function(e){return!!e})},S.flatten=function(e){return S.reduce(e,function(e,t){return S.isArray(t)?e.concat(S.flatten(t)):(e[e.length]=t,e)},[])},S.without=function(e){return S.difference(e,o.call(arguments,1))},S.uniq=S.unique=function(e,t){return S.reduce(e,function(e,n,r){if(0==r||(t===!0?S.last(e)!=n:!S.include(e,n)))e[e.length]=n;return e},[])},S.union=function(){return S.uniq(S.flatten(arguments))},S.intersection=S.intersect=function(e){var t=o.call(arguments,1);return S.filter(S.uniq(e),function(e){return S.every(t,function(t){return S.indexOf(t,e)>=0})})},S.difference=function(e,t){return S.filter(e,function(e){return!S.include(t,e)})},S.zip=function(){var e=o.call(arguments),t=S.max(S.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=S.pluck(e,""+r);return n},S.indexOf=function(e,t,n){if(e==null)return-1;var r,i;if(n)return r=S.sortedIndex(e,t),e[r]===t?r:-1;if(g&&e.indexOf===g)return e.indexOf(t);for(r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1},S.lastIndexOf=function(e,t){if(e==null)return-1;if(y&&e.lastIndexOf===y)return e.lastIndexOf(t);var n=e.length;while(n--)if(e[n]===t)return n;return-1},S.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s},S.bind=function(e,t){if(e.bind===E&&E)return E.apply(e,o.call(arguments,1));var n=o.call(arguments,2);return function(){return e.apply(t,n.concat(o.call(arguments)))}},S.bindAll=function(e){var t=o.call(arguments,1);return t.length==0&&(t=S.functions(e)),x(t,function(t){e[t]=S.bind(e[t],e)}),e},S.memoize=function(e,t){var n={};return t||(t=S.identity),function(){var r=t.apply(this,arguments);return f.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},S.delay=function(e,t){var n=o.call(arguments,2);return setTimeout(function(){return e.apply(e,n)},t)},S.defer=function(e){return S.delay.apply(S,[e,1].concat(o.call(arguments,1)))};var N=function(e,t,n){var r;return function(){var i=this,s=arguments,o=function(){r=null,e.apply(i,s)};n&&clearTimeout(r);if(n||!r)r=setTimeout(o,t)}};S.throttle=function(e,t){return N(e,t,!1)},S.debounce=function(e,t){return N(e,t,!0)},S.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments))}},S.wrap=function(e,t){return function(){var n=[e].concat(o.call(arguments));return t.apply(this,n)}},S.compose=function(){var e=o.call(arguments);return function(){var t=o.call(arguments);for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},S.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},S.keys=w||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)f.call(e,n)&&(t[t.length]=n);return t},S.values=function(e){return S.map(e,S.identity)},S.functions=S.methods=function(e){var t=[];for(var n in e)S.isFunction(e[n])&&t.push(n);return t.sort()},S.extend=function(e){return x(o.call(arguments,1),function(t){for(var n in t)t[n]!==void 0&&(e[n]=t[n])}),e},S.defaults=function(e){return x(o.call(arguments,1),function(t){for(var n in t)e[n]==null&&(e[n]=t[n])}),e},S.clone=function(e){return S.isArray(e)?e.slice():S.extend({},e)},S.tap=function(e,t){return t(e),e},S.isEqual=function(e,t){if(e===t)return!0;var n=typeof e,r=typeof t;if(n!=r)return!1;if(e==t)return!0;if(!e&&t||e&&!t)return!1;e._chain&&(e=e._wrapped),t._chain&&(t=t._wrapped);if(e.isEqual)return e.isEqual(t);if(t.isEqual)return t.isEqual(e);if(S.isDate(e)&&S.isDate(t))return e.getTime()===t.getTime();if(S.isNaN(e)&&S.isNaN(t))return!1;if(S.isRegExp(e)&&S.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.ignoreCase===t.ignoreCase&&e.multiline===t.multiline;if(n!=="object")return!1;if(e.length&&e.length!==t.length)return!1;var i=S.keys(e),s=S.keys(t);if(i.length!=s.length)return!1;for(var o in e)if(!(o in t)||!S.isEqual(e[o],t[o]))return!1;return!0},S.isEmpty=function(e){if(S.isArray(e)||S.isString(e))return e.length===0;for(var t in e)if(f.call(e,t))return!1;return!0},S.isElement=function(e){return!!e&&e.nodeType==1},S.isArray=b||function(e){return a.call(e)==="[object Array]"},S.isObject=function(e){return e===Object(e)},S.isArguments=function(e){return!!e&&!!f.call(e,"callee")},S.isFunction=function(e){return!!(e&&e.constructor&&e.call&&e.apply)},S.isString=function(e){return!!(e===""||e&&e.charCodeAt&&e.substr)},S.isNumber=function(e){return!!(e===0||e&&e.toExponential&&e.toFixed)},S.isNaN=function(e){return e!==e},S.isBoolean=function(e){return e===!0||e===!1},S.isDate=function(e){return!!(e&&e.getTimezoneOffset&&e.setUTCFullYear)},S.isRegExp=function(e){return!(!(e&&e.test&&e.exec)||!e.ignoreCase&&e.ignoreCase!==!1)},S.isNull=function(e){return e===null},S.isUndefined=function(e){return e===void 0},S.noConflict=function(){return e._=t,this},S.identity=function(e){return e},S.times=function(e,t,n){for(var r=0;r<e;r++)t.call(n,r)},S.mixin=function(e){x(S.functions(e),function(t){A(t,S[t]=e[t])})};var C=0;S.uniqueId=function(e){var t=C++;return e?e+t:t},S.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},S.template=function(e,t){var n=S.templateSettings,r="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(n.interpolate,function(e,t){return"',"+t.replace(/\\'/g,"'")+",'"}).replace(n.evaluate||null,function(e,t){return"');"+t.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",i=new Function("obj",r);return t?i(t):i};var k=function(e){this._wrapped=e};S.prototype=k.prototype;var L=function(e,t){return t?S(e).chain():e},A=function(e,t){k.prototype[e]=function(){var e=o.call(arguments);return u.call(e,this._wrapped),L(t.apply(S,e),this._chain)}};S.mixin(S),x(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];k.prototype[e]=function(){return t.apply(this._wrapped,arguments),L(this._wrapped,this._chain)}}),x(["concat","join","slice"],function(e){var t=r[e];k.prototype[e]=function(){return L(t.apply(this._wrapped,arguments),this._chain)}}),k.prototype.chain=function(){return this._chain=!0,this},k.prototype.value=function(){return this._wrapped}})(),!function(e,t,n){typeof module!="undefined"?module.exports=n(e,t):typeof define=="function"&&typeof define.amd=="object"?define(n):t[e]=n(e,t)}("bean",this,function(e,t){var n=window,r=t[e],i=/over|out/,s=/[^\.]*(?=\..*)\.|.*/,o=/\..*/,u="addEventListener",a="attachEvent",f="removeEventListener",l="detachEvent",c=document||{},h=c.documentElement||{},p=h[u],d=p?u:a,v=Array.prototype.slice,m=/click|mouse|menu|drag|drop/i,g=/^touch|^gesture/i,y={one:1},b=function(e,t,n){for(n=0;n<t.length;n++)e[t[n]]=1;return e}({},("click dblclick mouseup mousedown contextmenu mousewheel DOMMouseScroll mouseover mouseout mousemove selectstart selectend keydown keypress keyup orientationchange focus blur change reset select submit load unload beforeunload resize move DOMContentLoaded readystatechange error abort scroll "+(p?"show input invalid touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend message readystatechange pageshow pagehide popstate hashchange offline online afterprint beforeprint dragstart dragenter dragover dragleave drag drop dragend loadstart progress suspend emptied stalled loadmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate play pause ratechange volumechange cuechange checking noupdate downloading cached updateready obsolete ":"")).split(" ")),w=function(){function e(e,t){while((t=t.parentNode)!==null)if(t===e)return!0;return!1}function t(t){var n=t.relatedTarget;return n?n!==this&&n.prefix!=="xul"&&!/document/.test(this.toString())&&!e(this,n):n===null}return{mouseenter:{base:"mouseover",condition:t},mouseleave:{base:"mouseout",condition:t},mousewheel:{base:/Firefox/.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel"}}}(),E=function(){var e="altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which".split(" "),t=e.concat("button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" ")),n=e.concat("char charCode key keyCode".split(" ")),r=e.concat("touches targetTouches changedTouches scale rotation".split(" ")),s="preventDefault",o=function(e){return function(){e[s]?e[s]():e.returnValue=!1}},u="stopPropagation",a=function(e){return function(){e[u]?e[u]():e.cancelBubble=!0}},f=function(e){return function(){e[s](),e[u](),e.stopped=!0}},l=function(e,t,n){var r,i;for(r=n.length;r--;)i=n[r],!(i in t)&&i in e&&(t[i]=e[i])};return function(p,d){var v={originalEvent:p,isNative:d};if(!p)return v;var y,b=p.type,w=p.target||p.srcElement;v[s]=o(p),v[u]=a(p),v.stop=f(v),v.target=w&&w.nodeType===3?w.parentNode:w;if(d){if(b.indexOf("key")!==-1)y=n,v.keyCode=p.which||p.keyCode;else if(m.test(b)){y=t,v.rightClick=p.which===3||p.button===2,v.pos={x:0,y:0};if(p.pageX||p.pageY)v.clientX=p.pageX,v.clientY=p.pageY;else if(p.clientX||p.clientY)v.clientX=p.clientX+c.body.scrollLeft+h.scrollLeft,v.clientY=p.clientY+c.body.scrollTop+h.scrollTop;i.test(b)&&(v.relatedTarget=p.relatedTarget||p[(b==="mouseover"?"from":"to")+"Element"])}else g.test(b)&&(y=r);l(p,v,y||e)}return v}}(),S=function(e,t){return!p&&!t&&(e===c||e===n)?h:e},x=function(){function e(e,t,n,r,i){this.element=e,this.type=t,this.handler=n,this.original=r,this.namespaces=i,this.custom=w[t],this.isNative=b[t]&&e[d],this.eventType=p||this.isNative?t:"propertychange",this.customType=!p&&!this.isNative&&t,this.target=S(e,this.isNative),this.eventSupport=this.target[d]}return e.prototype={inNamespaces:function(e){var t,n;if(!e)return!0;if(!this.namespaces)return!1;for(t=e.length;t--;)for(n=this.namespaces.length;n--;)if(e[t]===this.namespaces[n])return!0;return!1},matches:function(e,t,n){return this.element===e&&(!t||this.original===t)&&(!n||this.handler===n)}},e}(),T=function(){var e={},t=function(n,r,i,s,o){if(!r||r==="*")for(var u in e)u.charAt(0)==="$"&&t(n,u.substr(1),i,s,o);else{var a=0,f,l=e["$"+r],c=n==="*";if(!l)return;for(f=l.length;a<f;a++)if(c||l[a].matches(n,i,s))if(!o(l[a],l,a,r))return}},n=function(t,n,r){var i,s=e["$"+n];if(s)for(i=s.length;i--;)if(s[i].matches(t,r,null))return!0;return!1},r=function(e,n,r){var i=[];return t(e,n,r,null,function(e){return i.push(e)}),i},i=function(t){return(e["$"+t.type]||(e["$"+t.type]=[])).push(t),t},s=function(n){t(n.element,n.type,null,n.handler,function(t,n,r){return n.splice(r,1),n.length===0&&delete e["$"+t.type],!1})},o=function(){var t,n=[];for(t in e)t.charAt(0)==="$"&&(n=n.concat(e[t]));return n};return{has:n,get:r,put:i,del:s,entries:o}}(),N=p?function(e,t,n,r){e[r?u:f](t,n,!1)}:function(e,t,n,r,i){i&&r&&e["_on"+i]===null&&(e["_on"+i]=0),e[r?a:l]("on"+t,n)},C=function(e,t,r){return function(i){return i=E(i||((this.ownerDocument||this.document||this).parentWindow||n).event,!0),t.apply(e,[i].concat(r))}},k=function(e,t,r,i,s,o){return function(u){if(i?i.apply(this,arguments):p?!0:u&&u.propertyName==="_on"+r||!u)u&&(u=E(u||((this.ownerDocument||this.document||this).parentWindow||n).event,o)),t.apply(e,u&&(!s||s.length===0)?arguments:v.call(arguments,u?0:1).concat(s))}},L=function(e,t,n,r,i){return function(){e(t,n,i),r.apply(this,arguments)}},A=function(e,t,n,r){var i,s,u,a=t&&t.replace(o,""),f=T.get(e,a,n);for(i=0,s=f.length;i<s;i++)f[i].inNamespaces(r)&&((u=f[i]).eventSupport&&N(u.target,u.eventType,u.handler,!1,u.type),T.del(u))},O=function(e,t,n,r,i){var u,a=t.replace(o,""),f=t.replace(s,"").split(".");if(T.has(e,a,n))return e;a==="unload"&&(n=L(A,e,a,n,r)),w[a]&&(w[a].condition&&(n=k(e,n,a,w[a].condition,!0)),a=w[a].base||a),u=T.put(new x(e,a,n,r,f[0]&&f)),u.handler=u.isNative?C(e,u.handler,i):k(e,u.handler,a,!1,i,!1),u.eventSupport&&N(u.target,u.eventType,u.handler,!0,u.customType)},M=function(e,t,n){return function(r){var i,s,o=typeof e=="string"?n(e,this):e;for(i=r.target;i&&i!==this;i=i.parentNode)for(s=o.length;s--;)if(o[s]===i)return t.apply(i,arguments)}},_=function(e,t,n){var r,i,u,a,f,l=A,c=t&&typeof t=="string";if(c&&t.indexOf(" ")>0){t=t.split(" ");for(f=t.length;f--;)_(e,t[f],n);return e}u=c&&t.replace(o,""),u&&w[u]&&(u=w[u].type);if(!t||c){if(a=c&&t.replace(s,""))a=a.split(".");l(e,u,n,a)}else if(typeof t=="function")l(e,null,t);else for(r in t)t.hasOwnProperty(r)&&_(e,r,t[r]);return e},D=function(e,t,n,r,i){var s,o,u,a,f=n,l=n&&typeof n=="string";if(t&&!n&&typeof t=="object")for(s in t)t.hasOwnProperty(s)&&D.apply(this,[e,s,t[s]]);else{a=arguments.length>3?v.call(arguments,3):[],o=(l?n:t).split(" "),l&&(n=M(t,f=r,i))&&(a=v.call(a,1)),this===y&&(n=L(_,e,t,n,f));for(u=o.length;u--;)O(e,o[u],n,f,a)}return e},P=function(){return D.apply(y,arguments)},H=p?function(e,t,r){var i=c.createEvent(e?"HTMLEvents":"UIEvents");i[e?"initEvent":"initUIEvent"](t,!0,!0,n,1),r.dispatchEvent(i)}:function(e,t,n){n=S(n,e),e?n.fireEvent("on"+t,c.createEventObject()):n["_on"+t]++},B=function(e,t,n){var r,i,u,a,f,l=t.split(" ");for(r=l.length;r--;){t=l[r].replace(o,"");if(a=l[r].replace(s,""))a=a.split(".");if(!a&&!n&&e[d])H(b[t],t,e);else{f=T.get(e,t),n=[!1].concat(n);for(i=0,u=f.length;i<u;i++)f[i].inNamespaces(a)&&f[i].handler.apply(e,n)}}return e},j=function(e,t,n){var r=0,i=T.get(t,n),s=i.length;for(;r<s;r++)i[r].original&&D(e,i[r].type,i[r].original);return e},F={add:D,one:P,remove:_,clone:j,fire:B,noConflict:function(){return t[e]=r,this}};if(n[a]){var I=function(){var e,t=T.entries();for(e in t)t[e].type&&t[e].type!=="unload"&&_(t[e].element,t[e].type);n[l]("onunload",I),n.CollectGarbage&&n.CollectGarbage()};n[a]("onunload",I)}return F}),function(){var e=this,t=this.Flotr,n;n={_:_,bean:bean,isIphone:/iphone/i.test(navigator.userAgent),isIE:navigator.appVersion.indexOf("MSIE")!=-1?parseFloat(navigator.appVersion.split("MSIE")[1]):!1,graphTypes:{},plugins:{},addType:function(e,t){n.graphTypes[e]=t,n.defaultOptions[e]=t.options||{},n.defaultOptions.defaultType=n.defaultOptions.defaultType||e},addPlugin:function(e,t){n.plugins[e]=t,n.defaultOptions[e]=t.options||{}},draw:function(e,t,r,i){return i=i||n.Graph,new i(e,t,r)},merge:function(e,t){var r,i,s=t||{};for(r in e)i=e[r],i&&typeof i=="object"?i.constructor===Array?s[r]=this._.clone(i):i.constructor!==RegExp&&!this._.isElement(i)&&!i.jquery?s[r]=n.merge(i,t?t[r]:undefined):s[r]=i:s[r]=i;return s},clone:function(e){return n.merge(e,{})},getTickSize:function(e,t,r,i){var s=(r-t)/e,o=n.getMagnitude(s),u=10,a=s/o;return a<1.5?u=1:a<2.25?u=2:a<3?u=i===0?2:2.5:a<7.5&&(u=5),u*o},defaultTickFormatter:function(e,t){return e+""},defaultTrackFormatter:function(e){return"("+e.x+", "+e.y+")"},engineeringNotation:function(e,t,n){var r=["Y","Z","E","P","T","G","M","k",""],i=["y","z","a","f","p","n","µ","m",""],s=r.length;n=n||1e3,t=Math.pow(10,t||2);if(e===0)return 0;if(e>1)while(s--&&e>=n)e/=n;else{r=i,s=r.length;while(s--&&e<1)e*=n}return Math.round(e*t)/t+r[s]},getMagnitude:function(e){return Math.pow(10,Math.floor(Math.log(e)/Math.LN10))},toPixel:function(e){return Math.floor(e)+.5},toRad:function(e){return-e*(Math.PI/180)},floorInBase:function(e,t){return t*Math.floor(e/t)},drawText:function(e,t,r,i,s){if(!e.fillText){e.drawText(t,r,i,s);return}s=this._.extend({size:n.defaultOptions.fontSize,color:"#000000",textAlign:"left",textBaseline:"bottom",weight:1,angle:0},s),e.save(),e.translate(r,i),e.rotate(s.angle),e.fillStyle=s.color,e.font=(s.weight>1?"bold ":"")+s.size*1.3+"px sans-serif",e.textAlign=s.textAlign,e.textBaseline=s.textBaseline,e.fillText(t,0,0),e.restore()},getBestTextAlign:function(e,t){return t=t||{textAlign:"center",textBaseline:"middle"},e+=n.getTextAngleFromAlign(t),Math.abs(Math.cos(e))>.01&&(t.textAlign=Math.cos(e)>0?"right":"left"),Math.abs(Math.sin(e))>.01&&(t.textBaseline=Math.sin(e)>0?"top":"bottom"),t},alignTable:{"right middle":0,"right top":Math.PI/4,"center top":Math.PI/2,"left top":3*(Math.PI/4),"left middle":Math.PI,"left bottom":-3*(Math.PI/4),"center bottom":-Math.PI/2,"right bottom":-Math.PI/4,"center middle":0},getTextAngleFromAlign:function(e){return n.alignTable[e.textAlign+" "+e.textBaseline]||0},noConflict:function(){return e.Flotr=t,this}},e.Flotr=n}(),Flotr.defaultOptions={colors:["#00A8F0","#C0D800","#CB4B4B","#4DA74D","#9440ED"],ieBackgroundColor:"#FFFFFF",title:null,subtitle:null,shadowSize:4,defaultType:null,HtmlText:!0,fontColor:"#545454",fontSize:7.5,resolution:1,parseFloat:!0,preventDefault:!0,xaxis:{ticks:null,minorTicks:null,showLabels:!0,showMinorLabels:!1,labelsAngle:0,title:null,titleAngle:0,noTicks:5,minorTickFreq:null,tickFormatter:Flotr.defaultTickFormatter,tickDecimals:null,min:null,max:null,autoscale:!1,autoscaleMargin:0,color:null,mode:"normal",timeFormat:null,timeMode:"UTC",timeUnit:"millisecond",scaling:"linear",base:Math.E,titleAlign:"center",margin:!0},x2axis:{},yaxis:{ticks:null,minorTicks:null,showLabels:!0,showMinorLabels:!1,labelsAngle:0,title:null,titleAngle:90,noTicks:5,minorTickFreq:null,tickFormatter:Flotr.defaultTickFormatter,tickDecimals:null,min:null,max:null,autoscale:!1,autoscaleMargin:0,color:null,scaling:"linear",base:Math.E,titleAlign:"center",margin:!0},y2axis:{titleAngle:270},grid:{color:"#545454",backgroundColor:null,backgroundImage:null,watermarkAlpha:.4,tickColor:"#DDDDDD",labelMargin:3,verticalLines:!0,minorVerticalLines:null,horizontalLines:!0,minorHorizontalLines:null,outlineWidth:1,outline:"nsew",circular:!1},mouse:{track:!1,trackAll:!1,position:"se",relative:!1,trackFormatter
:Flotr.defaultTrackFormatter,margin:5,lineColor:"#FF3F19",trackDecimals:1,sensibility:2,trackY:!0,radius:3,fillColor:null,fillOpacity:.4}},function(){function t(e,t,n,r){this.rgba=["r","g","b","a"];var i=4;while(-1<--i)this[this.rgba[i]]=arguments[i]||(i==3?1:0);this.normalize()}var e=Flotr._,n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]};t.prototype={scale:function(t,n,r,i){var s=4;while(-1<--s)e.isUndefined(arguments[s])||(this[this.rgba[s]]*=arguments[s]);return this.normalize()},alpha:function(t){return!e.isUndefined(t)&&!e.isNull(t)&&(this.a=t),this.normalize()},clone:function(){return new t(this.r,this.b,this.g,this.a)},limit:function(e,t,n){return Math.max(Math.min(e,n),t)},normalize:function(){var e=this.limit;return this.r=e(parseInt(this.r,10),0,255),this.g=e(parseInt(this.g,10),0,255),this.b=e(parseInt(this.b,10),0,255),this.a=e(this.a,0,1),this},distance:function(e){if(!e)return;e=new t.parse(e);var n=0,r=3;while(-1<--r)n+=Math.abs(this[this.rgba[r]]-e[this.rgba[r]]);return n},toString:function(){return this.a>=1?"rgb("+[this.r,this.g,this.b].join(",")+")":"rgba("+[this.r,this.g,this.b,this.a].join(",")+")"},contrast:function(){var e=1-(.299*this.r+.587*this.g+.114*this.b)/255;return e<.5?"#000000":"#ffffff"}},e.extend(t,{parse:function(e){if(e instanceof t)return e;var r;if(r=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e))return new t(parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16));if(r=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e))return new t(parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10));if(r=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(e))return new t(parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16));if(r=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(e))return new t(parseInt(r[1],10),parseInt(r[2],10),parseInt(r[3],10),parseFloat(r[4]));if(r=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(e))return new t(parseFloat(r[1])*2.55,parseFloat(r[2])*2.55,parseFloat(r[3])*2.55);if(r=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(e))return new t(parseFloat(r[1])*2.55,parseFloat(r[2])*2.55,parseFloat(r[3])*2.55,parseFloat(r[4]));var i=(e+"").replace(/^\s*([\S\s]*?)\s*$/,"$1").toLowerCase();return i=="transparent"?new t(255,255,255,0):(r=n[i])?new t(r[0],r[1],r[2]):new t(0,0,0,0)},processColor:function(n,r){var i=r.opacity;if(!n)return"rgba(0, 0, 0, 0)";if(n instanceof t)return n.alpha(i).toString();if(e.isString(n))return t.parse(n).alpha(i).toString();var s=n.colors?n:{colors:n};if(!r.ctx)return e.isArray(s.colors)?t.parse(e.isArray(s.colors[0])?s.colors[0][1]:s.colors[0]).alpha(i).toString():"rgba(0, 0, 0, 0)";s=e.extend({start:"top",end:"bottom"},s),/top/i.test(s.start)&&(r.x1=0),/left/i.test(s.start)&&(r.y1=0),/bottom/i.test(s.end)&&(r.x2=0),/right/i.test(s.end)&&(r.y2=0);var o,u,a,f=r.ctx.createLinearGradient(r.x1,r.y1,r.x2,r.y2);for(o=0;o<s.colors.length;o++)u=s.colors[o],e.isArray(u)?(a=u[0],u=u[1]):a=o/(s.colors.length-1),f.addColorStop(a,t.parse(u).alpha(i));return f}}),Flotr.Color=t}(),Flotr.Date={set:function(e,t,n,r){n=n||"UTC",t="set"+(n==="UTC"?"UTC":"")+t,e[t](r)},get:function(e,t,n){return n=n||"UTC",t="get"+(n==="UTC"?"UTC":"")+t,e[t]()},format:function(e,t,n){function s(e){return e+="",e.length==1?"0"+e:e}if(!e)return;var r=this.get,i={h:r(e,"Hours",n).toString(),H:s(r(e,"Hours",n)),M:s(r(e,"Minutes",n)),S:s(r(e,"Seconds",n)),s:r(e,"Milliseconds",n),d:r(e,"Date",n).toString(),m:(r(e,"Month",n)+1).toString(),y:r(e,"FullYear",n).toString(),b:Flotr.Date.monthNames[r(e,"Month",n)]},o=[],u,a=!1;for(var f=0;f<t.length;++f)u=t.charAt(f),a?(o.push(i[u]||u),a=!1):u=="%"?a=!0:o.push(u);return o.join("")},getFormat:function(e,t){var n=Flotr.Date.timeUnits;return e<n.second?"%h:%M:%S.%s":e<n.minute?"%h:%M:%S":e<n.day?t<2*n.day?"%h:%M":"%b %d %h:%M":e<n.month?"%b %d":e<n.year?t<n.year?"%b":"%b %y":"%y"},formatter:function(e,t){var n=t.options,r=Flotr.Date.timeUnits[n.timeUnit],i=new Date(e*r);if(t.options.timeFormat)return Flotr.Date.format(i,n.timeFormat,n.timeMode);var s=(t.max-t.min)*r,o=t.tickSize*Flotr.Date.timeUnits[t.tickUnit];return Flotr.Date.format(i,Flotr.Date.getFormat(o,s),n.timeMode)},generator:function(e){function y(e){t(m,e,o,Flotr.floorInBase(n(m,e,o),h))}var t=this.set,n=this.get,r=this.timeUnits,i=this.spec,s=e.options,o=s.timeMode,u=r[s.timeUnit],a=e.min*u,f=e.max*u,l=(f-a)/s.noTicks,c=[],h=e.tickSize,p,d,v;d=s.tickFormatter===Flotr.defaultTickFormatter?this.formatter:s.tickFormatter;for(v=0;v<i.length-1;++v){var m=i[v][0]*r[i[v][1]];if(l<(m+i[v+1][0]*r[i[v+1][1]])/2&&m>=h)break}h=i[v][0],p=i[v][1],p=="year"&&(h=Flotr.getTickSize(s.noTicks*r.year,a,f,0),h==.5&&(p="month",h=6)),e.tickUnit=p,e.tickSize=h;var g=h*r[p];m=new Date(a);switch(p){case"millisecond":y("Milliseconds");break;case"second":y("Seconds");break;case"minute":y("Minutes");break;case"hour":y("Hours");break;case"month":y("Month");break;case"year":y("FullYear")}g>=r.second&&t(m,"Milliseconds",o,0),g>=r.minute&&t(m,"Seconds",o,0),g>=r.hour&&t(m,"Minutes",o,0),g>=r.day&&t(m,"Hours",o,0),g>=r.day*4&&t(m,"Date",o,1),g>=r.year&&t(m,"Month",o,0);var b=0,w=NaN,E;do{E=w,w=m.getTime(),c.push({v:w/u,label:d(w/u,e)});if(p=="month")if(h<1){t(m,"Date",o,1);var S=m.getTime();t(m,"Month",o,n(m,"Month",o)+1);var x=m.getTime();m.setTime(w+b*r.hour+(x-S)*h),b=n(m,"Hours",o),t(m,"Hours",o,0)}else t(m,"Month",o,n(m,"Month",o)+h);else p=="year"?t(m,"FullYear",o,n(m,"FullYear",o)+h):m.setTime(w+g)}while(w<f&&w!=E);return c},timeUnits:{millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31556952e3},spec:[[1,"millisecond"],[20,"millisecond"],[50,"millisecond"],[100,"millisecond"],[200,"millisecond"],[500,"millisecond"],[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[.25,"month"],[.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},function(){function t(e){return e&&e.jquery?e[0]:e}var e=Flotr._;Flotr.DOM={addClass:function(n,r){n=t(n);var i=n.className?n.className:"";if(e.include(i.split(/\s+/g),r))return;n.className=(i?i+" ":"")+r},create:function(e){return document.createElement(e)},node:function(e){var t=Flotr.DOM.create("div"),n;return t.innerHTML=e,n=t.children[0],t.innerHTML="",n},empty:function(e){e=t(e),e.innerHTML=""},remove:function(e){e=t(e),e.parentNode.removeChild(e)},hide:function(e){e=t(e),Flotr.DOM.setStyles(e,{display:"none"})},insert:function(n,r){n=t(n),e.isString(r)?n.innerHTML+=r:e.isElement(r)&&n.appendChild(r)},opacity:function(e,n){e=t(e),e.style.opacity=n},position:function(e,n){return e=t(e),e.offsetParent?(n=this.position(e.offsetParent),n.left+=e.offsetLeft,n.top+=e.offsetTop,n):{left:e.offsetLeft||0,top:e.offsetTop||0}},removeClass:function(n,r){var i=n.className?n.className:"";n=t(n),n.className=e.filter(i.split(/\s+/g),function(e){if(e!=r)return!0}).join(" ")},setStyles:function(n,r){n=t(n),e.each(r,function(e,t){n.style[t]=e})},show:function(e){e=t(e),Flotr.DOM.setStyles(e,{display:""})},size:function(e){return e=t(e),{height:e.offsetHeight,width:e.offsetWidth}}}}(),function(){var e=Flotr,t=e.bean;e.EventAdapter={observe:function(e,n,r){return t.add(e,n,r),this},fire:function(e,n,r){return t.fire(e,n,r),typeof Prototype!="undefined"&&Event.fire(e,n,r),this},stopObserving:function(e,n,r){return t.remove(e,n,r),this},eventPointer:function(t){if(!e._.isUndefined(t.touches)&&t.touches.length>0)return{x:t.touches[0].pageX,y:t.touches[0].pageY};if(!e._.isUndefined(t.changedTouches)&&t.changedTouches.length>0)return{x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY};if(t.pageX||t.pageY)return{x:t.pageX,y:t.pageY};if(t.clientX||t.clientY){var n=document,r=n.body,i=n.documentElement;return{x:t.clientX+r.scrollLeft+i.scrollLeft,y:t.clientY+r.scrollTop+i.scrollTop}}}}}(),function(){function i(e,n,r){return t.observe.apply(this,arguments),this._handles.push(arguments),this}var e=Flotr.DOM,t=Flotr.EventAdapter,n=Flotr._,r=Flotr;Graph=function(e,i,s){this._setEl(e),this._initMembers(),this._initPlugins(),t.fire(this.el,"flotr:beforeinit",[this]),this.data=i,this.series=r.Series.getSeries(i),this._initOptions(s),this._initGraphTypes(),this._initCanvas(),this._text=new r.Text({element:this.el,ctx:this.ctx,html:this.options.HtmlText,textEnabled:this.textEnabled}),t.fire(this.el,"flotr:afterconstruct",[this]),this._initEvents(),this.findDataRanges(),this.calculateSpacing(),this.draw(n.bind(function(){t.fire(this.el,"flotr:afterinit",[this])},this))},Graph.prototype={destroy:function(){t.fire(this.el,"flotr:destroy"),n.each(this._handles,function(e){t.stopObserving.apply(this,e)}),this._handles=[],this.el.graph=null},observe:i,_observe:i,processColor:function(e,t){var i={x1:0,y1:0,x2:this.plotWidth,y2:this.plotHeight,opacity:1,ctx:this.ctx};return n.extend(i,t),r.Color.processColor(e,i)},findDataRanges:function(){var e=this.axes,t,i,s;n.each(this.series,function(e){s=e.getRange(),s&&(t=e.xaxis,i=e.yaxis,t.datamin=Math.min(s.xmin,t.datamin),t.datamax=Math.max(s.xmax,t.datamax),i.datamin=Math.min(s.ymin,i.datamin),i.datamax=Math.max(s.ymax,i.datamax),t.used=t.used||s.xused,i.used=i.used||s.yused)},this),!e.x.used&&!e.x2.used&&(e.x.used=!0),!e.y.used&&!e.y2.used&&(e.y.used=!0),n.each(e,function(e){e.calculateRange()});var o=n.keys(r.graphTypes),u=!1;n.each(this.series,function(e){if(e.hide)return;n.each(o,function(t){e[t]&&e[t].show&&(this.extendRange(t,e),u=!0)},this),u||this.extendRange(this.options.defaultType,e)},this)},extendRange:function(e,t){this[e].extendRange&&this[e].extendRange(t,t.data,t[e],this[e]),this[e].extendYRange&&this[e].extendYRange(t.yaxis,t.data,t[e],this[e]),this[e].extendXRange&&this[e].extendXRange(t.xaxis,t.data,t[e],this[e])},calculateSpacing:function(){var e=this.axes,t=this.options,r=this.series,i=t.grid.labelMargin,s=this._text,o=e.x,u=e.x2,a=e.y,f=e.y2,l=t.grid.outlineWidth,c,h,p,d;n.each(e,function(e){e.calculateTicks(),e.calculateTextDimensions(s,t)}),d=s.dimensions(t.title,{size:t.fontSize*1.5},"font-size:1em;font-weight:bold;","flotr-title"),this.titleHeight=d.height,d=s.dimensions(t.subtitle,{size:t.fontSize},"font-size:smaller;","flotr-subtitle"),this.subtitleHeight=d.height;for(h=0;h<t.length;++h)r[h].points.show&&(l=Math.max(l,r[h].points.radius+r[h].points.lineWidth/2));var v=this.plotOffset;o.options.margin===!1?(v.bottom=0,v.top=0):o.options.margin===!0?(v.bottom+=(t.grid.circular?0:o.used&&o.options.showLabels?o.maxLabel.height+i:0)+(o.used&&o.options.title?o.titleSize.height+i:0)+l,v.top+=(t.grid.circular?0:u.used&&u.options.showLabels?u.maxLabel.height+i:0)+(u.used&&u.options.title?u.titleSize.height+i:0)+this.subtitleHeight+this.titleHeight+l):(v.bottom=o.options.margin,v.top=o.options.margin),a.options.margin===!1?(v.left=0,v.right=0):a.options.margin===!0?(v.left+=(t.grid.circular?0:a.used&&a.options.showLabels?a.maxLabel.width+i:0)+(a.used&&a.options.title?a.titleSize.width+i:0)+l,v.right+=(t.grid.circular?0:f.used&&f.options.showLabels?f.maxLabel.width+i:0)+(f.used&&f.options.title?f.titleSize.width+i:0)+l):(v.left=a.options.margin,v.right=a.options.margin),v.top=Math.floor(v.top),this.plotWidth=this.canvasWidth-v.left-v.right,this.plotHeight=this.canvasHeight-v.bottom-v.top,o.length=u.length=this.plotWidth,a.length=f.length=this.plotHeight,a.offset=f.offset=this.plotHeight,o.setScale(),u.setScale(),a.setScale(),f.setScale()},draw:function(e){var n=this.ctx,r;t.fire(this.el,"flotr:beforedraw",[this.series,this]);if(this.series.length){n.save(),n.translate(this.plotOffset.left,this.plotOffset.top);for(r=0;r<this.series.length;r++)this.series[r].hide||this.drawSeries(this.series[r]);n.restore(),this.clip()}t.fire(this.el,"flotr:afterdraw",[this.series,this]),e&&e()},drawSeries:function(e){function t(e,t){var n=this.getOptions(e,t);this[t].draw(n)}var i=!1;e=e||this.series,n.each(r.graphTypes,function(n,r){e[r]&&e[r].show&&this[r]&&(i=!0,t.call(this,e,r))},this),i||t.call(this,e,this.options.defaultType)},getOptions:function(e,t){var n=e[t],i=this[t],s=e.xaxis,o=e.yaxis,u={context:this.ctx,width:this.plotWidth,height:this.plotHeight,fontSize:this.options.fontSize,fontColor:this.options.fontColor,textEnabled:this.textEnabled,htmlText:this.options.HtmlText,text:this._text,element:this.el,data:e.data,color:e.color,shadowSize:e.shadowSize,xScale:s.d2p,yScale:o.d2p,xInverse:s.p2d,yInverse:o.p2d};return u=r.merge(n,u),u.fillStyle=this.processColor(n.fillColor||e.color,{opacity:n.fillOpacity}),u},getEventPosition:function(n){var r=document,i=r.body,s=r.documentElement,o=this.axes,u=this.plotOffset,a=this.lastMousePos,f=t.eventPointer(n),l=f.x-a.pageX,c=f.y-a.pageY,h,p,d;return"ontouchstart"in this.el?(h=e.position(this.overlay),p=f.x-h.left-u.left,d=f.y-h.top-u.top):(h=this.overlay.getBoundingClientRect(),p=n.clientX-h.left-u.left-i.scrollLeft-s.scrollLeft,d=n.clientY-h.top-u.top-i.scrollTop-s.scrollTop),{x:o.x.p2d(p),x2:o.x2.p2d(p),y:o.y.p2d(d),y2:o.y2.p2d(d),relX:p,relY:d,dX:l,dY:c,absX:f.x,absY:f.y,pageX:f.x,pageY:f.y}},clickHandler:function(e){if(this.ignoreClick)return this.ignoreClick=!1,this.ignoreClick;t.fire(this.el,"flotr:click",[this.getEventPosition(e),this])},mouseMoveHandler:function(e){if(this.mouseDownMoveHandler)return;var n=this.getEventPosition(e);t.fire(this.el,"flotr:mousemove",[e,n,this]),this.lastMousePos=n},mouseDownHandler:function(e){if(this.mouseUpHandler)return;this.mouseUpHandler=n.bind(function(e){t.stopObserving(document,"mouseup",this.mouseUpHandler),t.stopObserving(document,"mousemove",this.mouseDownMoveHandler),this.mouseDownMoveHandler=null,this.mouseUpHandler=null,t.fire(this.el,"flotr:mouseup",[e,this])},this),this.mouseDownMoveHandler=n.bind(function(n){var r=this.getEventPosition(n);t.fire(this.el,"flotr:mousemove",[e,r,this]),this.lastMousePos=r},this),t.observe(document,"mouseup",this.mouseUpHandler),t.observe(document,"mousemove",this.mouseDownMoveHandler),t.fire(this.el,"flotr:mousedown",[e,this]),this.ignoreClick=!1},drawTooltip:function(t,n,r,i){var s=this.getMouseTrack(),o="opacity:0.7;background-color:#000;color:#fff;display:none;position:absolute;padding:2px 8px;-moz-border-radius:4px;border-radius:4px;white-space:nowrap;",u=i.position,a=i.margin,f=this.plotOffset;n!==null&&r!==null?(i.relative?(u.charAt(0)=="n"?o+="bottom:"+(a-f.top-r+this.canvasHeight)+"px;top:auto;":u.charAt(0)=="s"&&(o+="top:"+(a+f.top+r)+"px;bottom:auto;"),u.charAt(1)=="e"?o+="left:"+(a+f.left+n)+"px;right:auto;":u.charAt(1)=="w"&&(o+="right:"+(a-f.left-n+this.canvasWidth)+"px;left:auto;")):(u.charAt(0)=="n"?o+="top:"+(a+f.top)+"px;bottom:auto;":u.charAt(0)=="s"&&(o+="bottom:"+(a+f.bottom)+"px;top:auto;"),u.charAt(1)=="e"?o+="right:"+(a+f.right)+"px;left:auto;":u.charAt(1)=="w"&&(o+="left:"+(a+f.left)+"px;right:auto;")),s.style.cssText=o,e.empty(s),e.insert(s,t),e.show(s)):e.hide(s)},clip:function(e){var t=this.plotOffset,n=this.canvasWidth,i=this.canvasHeight;e=e||this.ctx;if(r.isIE&&r.isIE<9&&!r.isFlashCanvas){if(e===this.octx)return;e.save(),e.fillStyle=this.processColor(this.options.ieBackgroundColor),e.fillRect(0,0,n,t.top),e.fillRect(0,0,t.left,i),e.fillRect(0,i-t.bottom,n,t.bottom),e.fillRect(n-t.right,0,t.right,i),e.restore()}else e.clearRect(0,0,n,t.top),e.clearRect(0,0,t.left,i),e.clearRect(0,i-t.bottom,n,t.bottom),e.clearRect(n-t.right,0,t.right,i)},_initMembers:function(){this._handles=[],this.lastMousePos={pageX:null,pageY:null},this.plotOffset={left:0,right:0,top:0,bottom:0},this.ignoreClick=!0,this.prevHit=null},_initGraphTypes:function(){n.each(r.graphTypes,function(e,t){this[t]=r.clone(e)},this)},_initEvents:function(){var e=this.el,r,i,s;"ontouchstart"in e?(r=n.bind(function(n){s=!0,t.stopObserving(document,"touchend",r),t.fire(e,"flotr:mouseup",[event,this]),this.multitouches=null,i||this.clickHandler(n)},this),this.observe(this.overlay,"touchstart",n.bind(function(n){i=!1,s=!1,this.ignoreClick=!1,n.touches&&n.touches.length>1&&(this.multitouches=n.touches),t.fire(e,"flotr:mousedown",[event,this]),this.observe(document,"touchend",r)},this)),this.observe(this.overlay,"touchmove",n.bind(function(n){var r=this.getEventPosition(n);this.options.preventDefault&&n.preventDefault(),i=!0,this.multitouches||n.touches&&n.touches.length>1?this.multitouches=n.touches:s||t.fire(e,"flotr:mousemove",[event,r,this]),this.lastMousePos=r},this))):this.observe(this.overlay,"mousedown",n.bind(this.mouseDownHandler,this)).observe(e,"mousemove",n.bind(this.mouseMoveHandler,this)).observe(this.overlay,"click",n.bind(this.clickHandler,this)).observe(e,"mouseout",function(n){t.fire(e,"flotr:mouseout",n)})},_initCanvas:function(){function l(i,s){return i||(i=e.create("canvas"),typeof FlashCanvas!="undefined"&&typeof i.getContext=="function"&&(FlashCanvas.initElement(i),this.isFlashCanvas=!0),i.className="flotr-"+s,i.style.cssText="position:absolute;left:0px;top:0px;",e.insert(t,i)),n.each(a,function(t,n){e.show(i);if(s=="canvas"&&i.getAttribute(n)===t)return;i.setAttribute(n,t*r.resolution),i.style[n]=t+"px"}),i.context_=null,i}function c(e){window.G_vmlCanvasManager&&window.G_vmlCanvasManager.initElement(e);var t=e.getContext("2d");return window.G_vmlCanvasManager||t.scale(r.resolution,r.resolution),t}var t=this.el,r=this.options,i=t.children,s=[],o,u,a,f;for(u=i.length;u--;)o=i[u],!this.canvas&&o.className==="flotr-canvas"?this.canvas=o:!this.overlay&&o.className==="flotr-overlay"?this.overlay=o:s.push(o);for(u=s.length;u--;)t.removeChild(s[u]);e.setStyles(t,{position:"relative"}),a={},a.width=t.clientWidth,a.height=t.clientHeight;if(a.width<=0||a.height<=0||r.resolution<=0)throw"Invalid dimensions for plot, width = "+a.width+", height = "+a.height+", resolution = "+r.resolution;this.canvas=l(this.canvas,"canvas"),this.overlay=l(this.overlay,"overlay"),this.ctx=c(this.canvas),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.octx=c(this.overlay),this.octx.clearRect(0,0,this.overlay.width,this.overlay.height),this.canvasHeight=a.height,this.canvasWidth=a.width,this.textEnabled=!!this.ctx.drawText||!!this.ctx.fillText},_initPlugins:function(){n.each(r.plugins,function(e,t){n.each(e.callbacks,function(e,t){this.observe(this.el,t,n.bind(e,this))},this),this[t]=r.clone(e),n.each(this[t],function(e,r){n.isFunction(e)&&(this[t][r]=n.bind(e,this))},this)},this)},_initOptions:function(e){var i=r.clone(r.defaultOptions);i.x2axis=n.extend(n.clone(i.xaxis),i.x2axis),i.y2axis=n.extend(n.clone(i.yaxis),i.y2axis),this.options=r.merge(e||{},i),this.options.grid.minorVerticalLines===null&&this.options.xaxis.scaling==="logarithmic"&&(this.options.grid.minorVerticalLines=!0),this.options.grid.minorHorizontalLines===null&&this.options.yaxis.scaling==="logarithmic"&&(this.options.grid.minorHorizontalLines=!0),t.fire(this.el,"flotr:afterinitoptions",[this]),this.axes=r.Axis.getAxes(this.options);var s=[],o=[],u=this.series.length,a=this.series.length,f=this.options.colors,l=[],c=0,h,p,d,v;for(p=a-1;p>-1;--p)h=this.series[p].color,h&&(--a,n.isNumber(h)?s.push(h):l.push(r.Color.parse(h)));for(p=s.length-1;p>-1;--p)a=Math.max(a,s[p]+1);for(p=0;o.length<a;){h=f.length==p?new r.Color(100,100,100):r.Color.parse(f[p]);var m=c%2==1?-1:1,g=1+m*Math.ceil(c/2)*.2;h.scale(g,g,g),o.push(h),++p>=f.length&&(p=0,++c)}for(p=0,d=0;p<u;++p){v=this.series[p],v.color?n.isNumber(v.color)&&(v.color=o[v.color].toString()):v.color=o[d++].toString(),v.xaxis||(v.xaxis=this.axes.x),v.xaxis==1?v.xaxis=this.axes.x:v.xaxis==2&&(v.xaxis=this.axes.x2),v.yaxis||(v.yaxis=this.axes.y),v.yaxis==1?v.yaxis=this.axes.y:v.yaxis==2&&(v.yaxis=this.axes.y2);for(var y in r.graphTypes)v[y]=n.extend(n.clone(this.options[y]),v[y]);v.mouse=n.extend(n.clone(this.options.mouse),v.mouse),n.isUndefined(v.shadowSize)&&(v.shadowSize=this.options.shadowSize)}},_setEl:function(e){if(!e)throw"The target container doesn't exist";if(e.graph instanceof Graph)e.graph.destroy();else if(!e.clientWidth)throw"The target container must be visible";e.graph=this,this.el=e}},Flotr.Graph=Graph}(),function(){function n(t){this.orientation=1,this.offset=0,this.datamin=Number.MAX_VALUE,this.datamax=-Number.MAX_VALUE,e.extend(this,t)}function r(e,t){return e=Math.log(Math.max(e,Number.MIN_VALUE)),t!==Math.E&&(e/=Math.log(t)),e}function s(e,t){return t===Math.E?Math.exp(e):Math.pow(t,e)}var e=Flotr._,t="logarithmic";n.prototype={setScale:function(){var e=this.length,n=this.max,i=this.min,o=this.offset,u=this.orientation,a=this.options,f=a.scaling===t,l;f?l=e/(r(n,a.base)-r(i,a.base)):l=e/(n-i),this.scale=l,f?(this.d2p=function(e){return o+u*(r(e,a.base)-r(i,a.base))*l},this.p2d=function(e){return s((o+u*e)/l+r(i,a.base),a.base)}):(this.d2p=function(e){return o+u*(e-i)*l},this.p2d=function(e){return(o+u*e)/l+i})},calculateTicks:function(){var t=this.options;this.ticks=[],this.minorTicks=[],t.ticks?(this._cleanUserTicks(t.ticks,this.ticks),this._cleanUserTicks(t.minorTicks||[],this.minorTicks)):t.mode=="time"?this._calculateTimeTicks():t.scaling==="logarithmic"?this._calculateLogTicks():this._calculateTicks(),e.each(this.ticks,function(e){e.label+=""}),e.each(this.minorTicks,function(e){e.label+=""})},calculateRange:function(){if(!this.used)return;var e=this,t=e.options,n=t.min!==null?t.min:e.datamin,r=t.max!==null?t.max:e.datamax,i=t.autoscaleMargin;t.scaling=="logarithmic"&&(n<=0&&(n=e.datamin),r<=0&&(r=n));if(r==n){var s=r?.01:1;t.min===null&&(n-=s),t.max===null&&(r+=s)}if(t.scaling==="logarithmic"){n<0&&(n=r/t.base);var o=Math.log(r);t.base!=Math.E&&(o/=Math.log(t.base)),o=Math.ceil(o);var u=Math.log(n);t.base!=Math.E&&(u/=Math.log(t.base)),u=Math.ceil(u),e.tickSize=Flotr.getTickSize(t.noTicks,u,o,t.tickDecimals===null?0:t.tickDecimals),t.minorTickFreq===null&&(o-u>10?t.minorTickFreq=0:o-u>5?t.minorTickFreq=2:t.minorTickFreq=5)}else e.tickSize=Flotr.getTickSize(t.noTicks,n,r,t.tickDecimals);e.min=n,e.max=r,t.min===null&&t.autoscale&&(e.min-=e.tickSize*i,e.min<0&&e.datamin>=0&&(e.min=0),e.min=e.tickSize*Math.floor(e.min/e.tickSize)),t.max===null&&t.autoscale&&(e.max+=e.tickSize*i,e.max>0&&e.datamax<=0&&e.datamax!=e.datamin&&(e.max=0),e.max=e.tickSize*Math.ceil(e.max/e.tickSize)),e.min==e.max&&(e.max=e.min+1)},calculateTextDimensions:function(e,t){var n="",r,i;if(this.options.showLabels)for(i=0;i<this.ticks.length;++i)r=this.ticks[i].label.length,r>n.length&&(n=this.ticks[i].label);this.maxLabel=e.dimensions(n,{size:t.fontSize,angle:Flotr.toRad(this.options.labelsAngle)},"font-size:smaller;","flotr-grid-label"),this.titleSize=e.dimensions(this.options.title,{size:t.fontSize*1.2,angle:Flotr.toRad(this.options.titleAngle)},"font-weight:bold;","flotr-axis-title")},_cleanUserTicks:function(t,n){var r=this,i=this.options,s,o,u,a;e.isFunction(t)&&(t=t({min:r.min,max:r.max}));for(o=0;o<t.length;++o)a=t[o],typeof a=="object"?(s=a[0],u=a.length>1?a[1]:i.tickFormatter(s,{min:r.min,max:r.max})):(s=a,u=i.tickFormatter(s,{min:this.min,max:this.max})),n[o]={v:s,label:u}},_calculateTimeTicks:function(){this.ticks=Flotr.Date.generator(this)},_calculateLogTicks:function(){var e=this,t=e.options,n,r,s=Math.log(e.max);t.base!=Math.E&&(s/=Math.log(t.base)),s=Math.ceil(s);var o=Math.log(e.min);t.base!=Math.E&&(o/=Math.log(t.base)),o=Math.ceil(o);for(i=o;i<s;i+=e.tickSize){r=t.base==Math.E?Math.exp(i):Math.pow(t.base,i);var u=r*(t.base==Math.E?Math.exp(e.tickSize):Math.pow(t.base,e.tickSize)),a=(u-r)/t.minorTickFreq;e.ticks.push({v:r,label:t.tickFormatter(r,{min:e.min,max:e.max})});for(n=r+a;n<u;n+=a)e.minorTicks.push({v:n,label:t.tickFormatter(n,{min:e.min,max:e.max})})}r=t.base==Math.E?Math.exp(i):Math.pow(t.base,i),e.ticks.push({v:r,label:t.tickFormatter(r,{min:e.min,max:e.max})})},_calculateTicks:function(){var e=this,t=e.options,n=e.tickSize,r=e.min,i=e.max,s=n*Math.ceil(r/n),o,u,a,f,l,c;t.minorTickFreq&&(u=n/t.minorTickFreq);for(l=0;(a=f=s+l*n)<=i;++l){o=t.tickDecimals,o===null&&(o=1-Math.floor(Math.log(n)/Math.LN10)),o<0&&(o=0),a=a.toFixed(o),e.ticks.push({v:a,label:t.tickFormatter(a,{min:e.min,max:e.max})});if(t.minorTickFreq)for(c=0;c<t.minorTickFreq&&l*n+c*u<i;++c)a=f+c*u,e.minorTicks.push({v:a,label:t.tickFormatter(a,{min:e.min,max:e.max})})}}},e.extend(n,{getAxes:function(e){return{x:new n({options:e.xaxis,n:1,length:this.plotWidth}),x2:new n({options:e.x2axis,n:2,length:this.plotWidth}),y:new n({options:e.yaxis,n:1,length:this.plotHeight,offset:this.plotHeight,orientation:-1}),y2:new n({options:e.y2axis,n:2,length:this.plotHeight,offset:this.plotHeight,orientation:-1})}}}),Flotr.Axis=n}(),function(){function t(t){e.extend(this,t)}var e=Flotr._;t.prototype={getRange:function(){var e=this.data,t=e.length,n=Number.MAX_VALUE,r=Number.MAX_VALUE,i=-Number.MAX_VALUE,s=-Number.MAX_VALUE,o=!1,u=!1,a,f,l;if(t<0||this.hide)return!1;for(l=0;l<t;l++)a=e[l][0],f=e[l][1],a!==null&&(a<n&&(n=a,o=!0),a>i&&(i=a,o=!0)),f!==null&&(f<r&&(r=f,u=!0),f>s&&(s=f,u=!0));return{xmin:n,xmax:i,ymin:r,ymax:s,xused:o,yused:u}}},e.extend(t,{getSeries:function(n){return e.map(n,function(n){var r;return n.data?(r=new t,e.extend(r,n)):r=new t({data:n}),r})}}),Flotr.Series=t}(),function(){var e=Flotr,t=e.DOM,n=e._,r=function(e){this.o=e};r.prototype={dimensions:function(e,t,n,r){return e?this.o.html?this.html(e,this.o.element,n,r):this.canvas(e,t):{width:0,height:0}},canvas:function(t,n){if(!this.o.textEnabled)return;n=n||{};var r=this.measureText(t,n),i=r.width,s=n.size||e.defaultOptions.fontSize,o=n.angle||0,u=Math.cos(o),a=Math.sin(o),f=2,l=6,c;return c={width:Math.abs(u*i)+Math.abs(a*s)+f,height:Math.abs(a*i)+Math.abs(u*s)+l},c},html:function(e,n,r,i){var s=t.create("div");return t.setStyles(s,{position:"absolute",top:"-100000px"}),t.insert(s,'<div style="'+r+'" class="'+i+' flotr-dummy-div">'+e+"</div>"),t.insert(this.o.element,s),t.size(s)},measureText:function(t,r){var i=this.o.ctx,s;return!i.fillText||e.isIphone&&i.measure?{width:i.measure(t,r)}:(r=n.extend({size:e.defaultOptions.fontSize,weight:1,angle:0},r),i.save(),i.font=(r.weight>1?"bold ":"")+r.size*1.3+"px sans-serif",s=i.measureText(t),i.restore(),s)}},Flotr.Text=r}(),Flotr.addType("lines",{options:{show:!1,lineWidth:2,fill:!1,fillBorder:!1,fillColor:null,fillOpacity:.4,steps:!1,stacked:!1},stack:{values:[]},draw:function(e){var t=e.context,n=e.lineWidth,r=e.shadowSize,i;t.save(),t.lineJoin="round",r&&!1&&(t.lineWidth=r/2,i=n/2+t.lineWidth/2,t.strokeStyle="rgba(0,0,0,0.1)",this.plot(e,i+r/2,!1),t.strokeStyle="rgba(0,0,0,0.2)",this.plot(e,i,!1)),t.lineWidth=n,t.strokeStyle=e.color,this.plot(e,0,!0),t.restore()},plot:function(e,t,n){function T(t){var n=null;for(n=l-1;n>=0;--n){if(!e.fill)return;if(!t[n])return;t[n][1]===null&&(t[n][1]=0),x=o(t[n][0]),y=u(t[n][1]);if(y>s||x>i||y<0||x<0)return;r.lineTo(x,y),r.stroke()}}function N(e){var t=[],n=a[0][0];for(S=0;S<e.length;++S)t.push([S+n,e[S]]);return t}function C(){if(!t&&e.fill&&d){e.fillBorder&&r.stroke(),v=o(d[0]),r.fillStyle=e.fillStyle;if(!f||f.values.length===0)r.lineTo(m,p),r.lineTo(v,p),r.lineTo(v,u(d[1]));else{var n=N(f.values);stack_x1=o(n[0][0]),stack_y2=u(n[n.length-1][1]),r.lineTo(m,stack_y2),T(n),r.lineTo(stack_x1,u(a[0][1]))}r.fill()}}var r=e.context,i=e.width,s=e.height,o=e.xScale,u=e.yScale,a=e.data,f=e.stacked?this.stack:!1,l=a.length-1,c=null,h=null,p=u(0),d=null,v,m,g,b,w,E,S;if(l<1)return;r.beginPath();for(S=0;S<l;++S){if(a[S][1]===null||a[S+1][1]===null){e.fill&&S>0&&a[S][1]&&(r.stroke(),C(),d=null,r.closePath(),r.beginPath());continue}v=o(a[S][0]),m=o(a[S+1][0]),d===null&&(d=a[S]),f?(w=f.values[S]||0,E=f.values[S+1]||0,g=u(a[S][1]+w),b=u(a[S+1][1]+E)):(g=u(a[S][1]),b=u(a[S+1][1]));if(g>s&&b>s||g<0&&b<0||v<0&&m<0||v>i&&m>i)continue;(c!=v||h!=g+t)&&r.moveTo(v,g+t),c=m,h=b+t,e.steps?(r.lineTo(c+t/2,g+t),r.lineTo(c+t/2,h)):r.lineTo(c,h)}(!e.fill||e.fill&&!e.fillBorder)&&r.stroke(),C();if(f)for(S=0;S<l;++S)w=f.values[S]||0,E=f.values[S+1]||0,n&&(f.values[S]=a[S][1]+w,S==l-1&&(f.values[S+1]=a[S+1][1]+E))},extendYRange:function(e,t,n,r){var i=e.options;if(n.stacked&&(!i.max&&i.max!==0||!i.min&&i.min!==0)){var s=e.max,o=e.min,u=r.positiveSums||{},a=r.negativeSums||{},f,l;for(l=0;l<t.length;l++)f=t[l][0]+"",t[l][1]>0?(u[f]=(u[f]||0)+t[l][1],s=Math.max(s,u[f])):(a[f]=(a[f]||0)+t[l][1],o=Math.min(o,a[f]));r.negativeSums=a,r.positiveSums=u,e.max=s,e.min=o}n.steps&&(this.hit=function(e){var t=e.data,n=e.args,r=e.yScale,i=n[0],s=t.length,o=n[1],u=e.xInverse(i.relX),a=i.relY,f;for(f=0;f<s-1;f++)if(u>=t[f][0]&&u<=t[f+1][0]){Math.abs(r(t[f][1])-a)<8&&(o.x=t[f][0],o.y=t[f][1],o.index=f,o.seriesIndex=e.index);break}},this.drawHit=function(e){var t=e.context,n=e.args,r=e.data,i=e.xScale,s=n.index,o=i(n.x),u=e.yScale(n.y),a;r.length-1>s&&(a=e.xScale(r[s+1][0]),t.save(),t.strokeStyle=e.color,t.lineWidth=e.lineWidth,t.beginPath(),t.moveTo(o,u),t.lineTo(a,u),t.stroke(),t.closePath(),t.restore())},this.clearHit=function(e){var t=e.context,n=e.args,r=e.data,i=e.xScale,s=e.lineWidth,o=n.index,u=i(n.x),a=e.yScale(n.y),f;r.length-1>o&&(f=e.xScale(r[o+1][0]),t.clearRect(u-s,a-s,f-u+2*s,2*s))})}}),Flotr.addType("bars",{options:{show:!1,lineWidth:2,barWidth:1,fill:!0,fillColor:null,fillOpacity:.4,horizontal:!1,stacked:!1,centered:!0,topPadding:.1,grouped:!1},stack:{positive:[],negative:[],_positive:[],_negative:[]},draw:function(e){var t=e.context;this.current+=1,t.save(),t.lineJoin="miter",t.lineWidth=e.lineWidth,t.strokeStyle=e.color,e.fill&&(t.fillStyle=e.fillStyle),this.plot(e),t.restore()},plot:function(e){var t=e.data,n=e.context,r=e.shadowSize,i,s,o,u,a,f;if(t.length<1)return;this.translate(n,e.horizontal);for(i=0;i<t.length;i++){s=this.getBarGeometry(t[i][0],t[i][1],e);if(s===null)continue;o=s.left,u=s.top,a=s.width,f=s.height,e.fill&&n.fillRect(o,u,a,f),r&&(n.save(),n.fillStyle="rgba(0,0,0,0.05)",n.fillRect(o+r,u+r,a,f),n.restore()),e.lineWidth&&n.strokeRect(o,u,a,f)}},translate:function(e,t){t&&(e.rotate(-Math.PI/2),e.scale(-1,1))},getBarGeometry:function(e,t,n){var r=n.horizontal,i=n.barWidth,s=n.centered,o=n.stacked?this.stack:!1,u=n.lineWidth,a=s?i/2:0,f=r?n.yScale:n.xScale,l=r?n.xScale:n.yScale,c=r?t:e,h=r?e:t,p=0,d,v,m,g,y;return n.grouped&&(this.current/this.groups,c-=a,i/=this.groups,a=i/2,c=c+i*this.current-a),o&&(d=h>0?o.positive:o.negative,p=d[c]||p,d[c]=p+h),v=f(c-a),m=f(c+i-a),g=l(h+p),y=l(p),y<0&&(y=0),e===null||t===null?null:{x:c,y:h,xScale:f,yScale:l,top:g,left:Math.min(v,m)-u/2,width:Math.abs(m-v)-u,height:y-g}},hit:function(e){var t=e.data,n=e.args,r=n[0],i=n[1],s=e.xInverse(r.relX),o=e.yInverse(r.relY),u=this.getBarGeometry(s,o,e),a=u.width/2,f=u.left,l=u.y,c,h;for(h=t.length;h--;)c=this.getBarGeometry(t[h][0],t[h][1],e),(l>0&&l<c.y||l<0&&l>c.y)&&Math.abs(f-c.left)<a&&(i.x=t[h][0],i.y=t[h][1],i.index=h,i.seriesIndex=e.index)},drawHit:function(e){var t=e.context,n=e.args,r=this.getBarGeometry(n.x,n.y,e),i=r.left,s=r.top,o=r.width,u=r.height;t.save(),t.strokeStyle=e.color,t.lineWidth=e.lineWidth,this.translate(t,e.horizontal),t.beginPath(),t.moveTo(i,s+u),t.lineTo(i,s),t.lineTo(i+o,s),t.lineTo(i+o,s+u),e.fill&&(t.fillStyle=e.fillStyle,t.fill()),t.stroke(),t.closePath(),t.restore()},clearHit:function(e){var t=e.context,n=e.args,r=this.getBarGeometry(n.x,n.y,e),i=r.left,s=r.width,o=r.top,u=r.height,a=2*e.lineWidth;t.save(),this.translate(t,e.horizontal),t.clearRect(i-a,Math.min(o,o+u)-a,s+2*a,Math.abs(u)+2*a),t.restore()},extendXRange:function(e,t,n,r){this._extendRange(e,t,n,r),this.groups=this.groups+1||1,this.current=0},extendYRange:function(e,t,n,r){this._extendRange(e,t,n,r)},_extendRange:function(e,t,n,r){var i=e.options.max;if(_.isNumber(i)||_.isString(i))return;var s=e.min,o=e.max,u=n.horizontal,a=e.orientation,f=this.positiveSums||{},l=this.negativeSums||{},c,h,p,d;(a==1&&!u||a==-1&&u)&&n.centered&&(o=Math.max(e.datamax+
n.barWidth,o),s=Math.min(e.datamin-n.barWidth,s));if(n.stacked&&(a==1&&u||a==-1&&!u))for(d=t.length;d--;)c=t[d][a==1?1:0]+"",h=t[d][a==1?0:1],h>0?(f[c]=(f[c]||0)+h,o=Math.max(o,f[c])):(l[c]=(l[c]||0)+h,s=Math.min(s,l[c]));(a==1&&u||a==-1&&!u)&&n.topPadding&&(e.max===e.datamax||n.stacked&&this.stackMax!==o)&&(o+=n.topPadding*(o-s)),this.stackMin=s,this.stackMax=o,this.negativeSums=l,this.positiveSums=f,e.max=o,e.min=s}}),Flotr.addType("bubbles",{options:{show:!1,lineWidth:2,fill:!0,fillOpacity:.4,baseRadius:2},draw:function(e){var t=e.context,n=e.shadowSize;t.save(),t.lineWidth=e.lineWidth,t.fillStyle="rgba(0,0,0,0.05)",t.strokeStyle="rgba(0,0,0,0.05)",this.plot(e,n/2),t.strokeStyle="rgba(0,0,0,0.1)",this.plot(e,n/4),t.strokeStyle=e.color,t.fillStyle=e.fillStyle,this.plot(e),t.restore()},plot:function(e,t){var n=e.data,r=e.context,i,s,o,u,a;t=t||0;for(s=0;s<n.length;++s)i=this.getGeometry(n[s],e),r.beginPath(),r.arc(i.x+t,i.y+t,i.z,0,2*Math.PI,!0),r.stroke(),e.fill&&r.fill(),r.closePath()},getGeometry:function(e,t){return{x:t.xScale(e[0]),y:t.yScale(e[1]),z:e[2]*t.baseRadius}},hit:function(e){var t=e.data,n=e.args,r=n[0],s=n[1],o=r.relX,u=r.relY,a,f,l,c;s.best=s.best||Number.MAX_VALUE;for(i=t.length;i--;)f=this.getGeometry(t[i],e),l=f.x-o,c=f.y-u,a=Math.sqrt(l*l+c*c),a<f.z&&f.z<s.best&&(s.x=t[i][0],s.y=t[i][1],s.index=i,s.seriesIndex=e.index,s.best=f.z)},drawHit:function(e){var t=e.context,n=this.getGeometry(e.data[e.args.index],e);t.save(),t.lineWidth=e.lineWidth,t.fillStyle=e.fillStyle,t.strokeStyle=e.color,t.beginPath(),t.arc(n.x,n.y,n.z,0,2*Math.PI,!0),t.fill(),t.stroke(),t.closePath(),t.restore()},clearHit:function(e){var t=e.context,n=this.getGeometry(e.data[e.args.index],e),r=n.z+e.lineWidth;t.save(),t.clearRect(n.x-r,n.y-r,2*r,2*r),t.restore()}}),function(){function e(e){return typeof e=="object"&&e.constructor&&(Image?!0:e.constructor===Image)}Flotr.defaultMarkerFormatter=function(e){return Math.round(e.y*100)/100+""},Flotr.addType("markers",{options:{show:!1,lineWidth:1,color:"#000000",fill:!1,fillColor:"#FFFFFF",fillOpacity:.4,stroke:!1,position:"ct",verticalMargin:0,labelFormatter:Flotr.defaultMarkerFormatter,fontSize:Flotr.defaultOptions.fontSize,stacked:!1,stackingType:"b",horizontal:!1},stack:{positive:[],negative:[],values:[]},draw:function(e){function h(e,t){return o=r.negative[e]||0,s=r.positive[e]||0,t>0?(r.positive[e]=o+t,o+t):(r.negative[e]=s+t,s+t)}var t=e.data,n=e.context,r=e.stacked?e.stack:!1,i=e.stackingType,s,o,u,a,f,l,c;n.save(),n.lineJoin="round",n.lineWidth=e.lineWidth,n.strokeStyle="rgba(0,0,0,0.5)",n.fillStyle=e.fillStyle;for(a=0;a<t.length;++a)f=t[a][0],l=t[a][1],r&&(i=="b"?e.horizontal?l=h(l,f):f=h(f,l):i=="a"&&(u=r.values[f]||0,r.values[f]=u+l,l=u+l)),c=e.labelFormatter({x:f,y:l,index:a,data:t}),this.plot(e.xScale(f),e.yScale(l),c,e);n.restore()},plot:function(t,n,r,i){var s=i.context;if(e(r)&&!r.complete)throw"Marker image not loaded.";this._plot(t,n,r,i)},_plot:function(t,n,r,i){var s=i.context,o=2,u=t,a=n,f;e(r)?f={height:r.height,width:r.width}:f=i.text.canvas(r),f.width=Math.floor(f.width+o*2),f.height=Math.floor(f.height+o*2),i.position.indexOf("c")!=-1?u-=f.width/2+o:i.position.indexOf("l")!=-1&&(u-=f.width),i.position.indexOf("m")!=-1?a-=f.height/2+o:i.position.indexOf("t")!=-1?a-=f.height+i.verticalMargin:a+=i.verticalMargin,u=Math.floor(u)+.5,a=Math.floor(a)+.5,i.fill&&s.fillRect(u,a,f.width,f.height),i.stroke&&s.strokeRect(u,a,f.width,f.height),e(r)?s.drawImage(r,parseInt(u+o,10),parseInt(a+o,10)):Flotr.drawText(s,r,u+o,a+o,{textBaseline:"top",textAlign:"left",size:i.fontSize,color:i.color})}})}(),function(){var e=Flotr._;Flotr.defaultPieLabelFormatter=function(e,t){return(100*t/e).toFixed(2)+"%"},Flotr.addType("pie",{options:{show:!1,lineWidth:1,fill:!0,fillColor:null,fillOpacity:.6,explode:6,sizeRatio:.6,startAngle:Math.PI/4,labelFormatter:Flotr.defaultPieLabelFormatter,pie3D:!1,pie3DviewAngle:Math.PI/2*.8,pie3DspliceThickness:20,epsilon:.1},draw:function(e){var t=e.data,n=e.context,r=n.canvas,i=e.lineWidth,s=e.shadowSize,o=e.sizeRatio,u=e.height,a=e.width,f=e.explode,l=e.color,c=e.fill,h=e.fillStyle,p=Math.min(r.width,r.height)*o/2,d=t[0][1],v=[],m=1,g=Math.PI*2*d/this.total,y=this.startAngle||2*Math.PI*e.startAngle,b=y+g,w=y+g/2,E=e.labelFormatter(this.total,d),S=f+p+4,x=Math.cos(w)*S,T=Math.sin(w)*S,N=x<0?"right":"left",C=T>0?"top":"bottom",k,L,A;n.save(),n.translate(a/2,u/2),n.scale(1,m),L=Math.cos(w)*f,A=Math.sin(w)*f,s>0&&(this.plotSlice(L+s,A+s,p,y,b,n),c&&(n.fillStyle="rgba(0,0,0,0.1)",n.fill())),this.plotSlice(L,A,p,y,b,n),c&&(n.fillStyle=h,n.fill()),n.lineWidth=i,n.strokeStyle=l,n.stroke(),k={size:e.fontSize*1.2,color:e.fontColor,weight:1.5},E&&(e.htmlText||!e.textEnabled?(divStyle="position:absolute;"+C+":"+(u/2+(C==="top"?T:-T))+"px;",divStyle+=N+":"+(a/2+(N==="right"?-x:x))+"px;",v.push('<div style="',divStyle,'" class="flotr-grid-label">',E,"</div>")):(k.textAlign=N,k.textBaseline=C,Flotr.drawText(n,E,x,T,k)));if(e.htmlText||!e.textEnabled){var O=Flotr.DOM.node('<div style="color:'+e.fontColor+'" class="flotr-labels"></div>');Flotr.DOM.insert(O,v.join("")),Flotr.DOM.insert(e.element,O)}n.restore(),this.startAngle=b,this.slices=this.slices||[],this.slices.push({radius:Math.min(r.width,r.height)*o/2,x:L,y:A,explode:f,start:y,end:b})},plotSlice:function(e,t,n,r,i,s){s.beginPath(),s.moveTo(e,t),s.arc(e,t,n,r,i,!1),s.lineTo(e,t),s.closePath()},hit:function(e){var t=e.data[0],n=e.args,r=e.index,i=n[0],s=n[1],o=this.slices[r],u=i.relX-e.width/2,a=i.relY-e.height/2,f=Math.sqrt(u*u+a*a),l=Math.atan(a/u),c=Math.PI*2,h=o.explode||e.explode,p=o.start%c,d=o.end%c,v=e.epsilon;u<0?l+=Math.PI:u>0&&a<0&&(l+=c),f<o.radius+h&&f>h&&(l>p&&l<d||p>d&&(l<d||l>p)||p===d&&(o.start===o.end&&Math.abs(l-p)<v||o.start!==o.end&&Math.abs(l-p)>v))&&(s.x=t[0],s.y=t[1],s.sAngle=p,s.eAngle=d,s.index=0,s.seriesIndex=r,s.fraction=t[1]/this.total)},drawHit:function(e){var t=e.context,n=this.slices[e.args.seriesIndex];t.save(),t.translate(e.width/2,e.height/2),this.plotSlice(n.x,n.y,n.radius,n.start,n.end,t),t.stroke(),t.restore()},clearHit:function(e){var t=e.context,n=this.slices[e.args.seriesIndex],r=2*e.lineWidth,i=n.radius+r;t.save(),t.translate(e.width/2,e.height/2),t.clearRect(n.x-i,n.y-i,2*i+r,2*i+r),t.restore()},extendYRange:function(e,t){this.total=(this.total||0)+t[0][1]}})}(),Flotr.addType("points",{options:{show:!1,radius:3,lineWidth:2,fill:!0,fillColor:"#FFFFFF",fillOpacity:1,hitRadius:null},draw:function(e){var t=e.context,n=e.lineWidth,r=e.shadowSize;t.save(),r>0&&(t.lineWidth=r/2,t.strokeStyle="rgba(0,0,0,0.1)",this.plot(e,r/2+t.lineWidth/2),t.strokeStyle="rgba(0,0,0,0.2)",this.plot(e,t.lineWidth/2)),t.lineWidth=e.lineWidth,t.strokeStyle=e.color,e.fill&&(t.fillStyle=e.fillStyle),this.plot(e),t.restore()},plot:function(e,t){var n=e.data,r=e.context,i=e.xScale,s=e.yScale,o,u,a;for(o=n.length-1;o>-1;--o){a=n[o][1];if(a===null)continue;u=i(n[o][0]),a=s(a);if(u<0||u>e.width||a<0||a>e.height)continue;r.beginPath(),t?r.arc(u,a+t,e.radius,0,Math.PI,!1):(r.arc(u,a,e.radius,0,2*Math.PI,!0),e.fill&&r.fill()),r.stroke(),r.closePath()}}}),Flotr.addType("radar",{options:{show:!1,lineWidth:2,fill:!0,fillOpacity:.4,radiusRatio:.9,sensibility:2},draw:function(e){var t=e.context,n=e.shadowSize;t.save(),t.translate(e.width/2,e.height/2),t.lineWidth=e.lineWidth,t.fillStyle="rgba(0,0,0,0.05)",t.strokeStyle="rgba(0,0,0,0.05)",this.plot(e,n/2),t.strokeStyle="rgba(0,0,0,0.1)",this.plot(e,n/4),t.strokeStyle=e.color,t.fillStyle=e.fillStyle,this.plot(e),t.restore()},plot:function(e,t){var n=e.data,r=e.context,i=Math.min(e.height,e.width)*e.radiusRatio/2,s=2*Math.PI/n.length,o=-Math.PI/2,u,a;t=t||0,r.beginPath();for(u=0;u<n.length;++u)a=n[u][1]/this.max,r[u===0?"moveTo":"lineTo"](Math.cos(u*s+o)*i*a+t,Math.sin(u*s+o)*i*a+t);r.closePath(),e.fill&&r.fill(),r.stroke()},getGeometry:function(e,t){var n=Math.min(t.height,t.width)*t.radiusRatio/2,r=2*Math.PI/t.data.length,i=-Math.PI/2,s=e[1]/this.max;return{x:Math.cos(e[0]*r+i)*n*s+t.width/2,y:Math.sin(e[0]*r+i)*n*s+t.height/2}},hit:function(e){var t=e.args,n=t[0],r=t[1],i=n.relX,s=n.relY,o,u,a,f;for(var l=0;l<r.series.length;l++){var c=r.series[l],h=c.data;for(var p=h.length;p--;){u=this.getGeometry(h[p],e),a=u.x-i,f=u.y-s,o=Math.sqrt(a*a+f*f);if(o<e.sensibility*2)return r.x=h[p][0],r.y=h[p][1],r.index=p,r.seriesIndex=l,r}}},drawHit:function(e){var t=2*Math.PI/e.data.length,n=-Math.PI/2,r=Math.min(e.height,e.width)*e.radiusRatio/2,i=e.args.series,s=i.points.hitRadius||i.points.radius||i.mouse.radius,o=e.context;o.translate(e.width/2,e.height/2);var u=e.args.index,a=e.data[u][1]/this.max,f=Math.cos(u*t+n)*r*a,l=Math.sin(u*t+n)*r*a;o.beginPath(),o.arc(f,l,s,0,2*Math.PI,!0),o.closePath(),o.stroke()},clearHit:function(e){var t=2*Math.PI/e.data.length,n=-Math.PI/2,r=Math.min(e.height,e.width)*e.radiusRatio/2,i=e.context,s=e.args.series,o=s.points?s.points.lineWidth:1;offset=(s.points.hitRadius||s.points.radius||s.mouse.radius)+o,i.translate(e.width/2,e.height/2);var u=e.args.index,a=e.data[u][1]/this.max,f=Math.cos(u*t+n)*r*a,l=Math.sin(u*t+n)*r*a;i.clearRect(f-offset,l-offset,offset*2,offset*2)},extendYRange:function(e,t){this.max=Math.max(e.max,this.max||-Number.MAX_VALUE)}}),function(){function e(e,t){return e.which?e.which===1:e.button===0||e.button===1}function t(e,t){return Math.min(Math.max(0,e),t.plotWidth-1)}function n(e,t){return Math.min(Math.max(0,e),t.plotHeight)}var r=Flotr.DOM,i=Flotr.EventAdapter,s=Flotr._;Flotr.addPlugin("selection",{options:{pinchOnly:null,mode:null,color:"#B6D9FF",fps:20},callbacks:{"flotr:mouseup":function(e){var t=this.options.selection,n=this.selection,r=this.getEventPosition(e);if(!t||!t.mode)return;n.interval&&clearInterval(n.interval),this.multitouches?n.updateSelection():t.pinchOnly||n.setSelectionPos(n.selection.second,r),n.clearSelection(),n.selecting&&n.selectionIsSane()&&(n.drawSelection(),n.fireSelectEvent(),this.ignoreClick=!0)},"flotr:mousedown":function(t){var n=this.options.selection,r=this.selection,i=this.getEventPosition(t);if(!n||!n.mode)return;if(!n.mode||!e(t)&&s.isUndefined(t.touches))return;n.pinchOnly||r.setSelectionPos(r.selection.first,i),r.interval&&clearInterval(r.interval),this.lastMousePos.pageX=null,r.selecting=!1,r.interval=setInterval(s.bind(r.updateSelection,this),1e3/n.fps)},"flotr:destroy":function(e){clearInterval(this.selection.interval)}},getArea:function(){var e=this.selection.selection,t=this.axes,n=e.first,r=e.second,i,s,o,u;return i=t.x.p2d(e.first.x),s=t.x.p2d(e.second.x),o=t.y.p2d(e.first.y),u=t.y.p2d(e.second.y),{x1:Math.min(i,s),y1:Math.min(o,u),x2:Math.max(i,s),y2:Math.max(o,u),xfirst:i,xsecond:s,yfirst:o,ysecond:u}},selection:{first:{x:-1,y:-1},second:{x:-1,y:-1}},prevSelection:null,interval:null,fireSelectEvent:function(e){var t=this.selection.getArea();e=e||"select",t.selection=this.selection.selection,i.fire(this.el,"flotr:"+e,[t,this])},setSelection:function(e,r){var i=this.options,s=this.axes.x,o=this.axes.y,u=o.scale,a=s.scale,f=i.selection.mode.indexOf("x")!=-1,l=i.selection.mode.indexOf("y")!=-1,c=this.selection.selection;this.selection.clearSelection(),c.first.y=n(f&&!l?0:(o.max-e.y1)*u,this),c.second.y=n(f&&!l?this.plotHeight-1:(o.max-e.y2)*u,this),c.first.x=t(l&&!f?0:(e.x1-s.min)*a,this),c.second.x=t(l&&!f?this.plotWidth:(e.x2-s.min)*a,this),this.selection.drawSelection(),r||this.selection.fireSelectEvent()},setSelectionPos:function(e,r){var i=this.options.selection.mode,s=this.selection.selection;i.indexOf("x")==-1?e.x=e==s.first?0:this.plotWidth:e.x=t(r.relX,this),i.indexOf("y")==-1?e.y=e==s.first?0:this.plotHeight-1:e.y=n(r.relY,this)},drawSelection:function(){this.selection.fireSelectEvent("selecting");var e=this.selection.selection,t=this.octx,n=this.options,r=this.plotOffset,i=this.selection.prevSelection;if(i&&e.first.x==i.first.x&&e.first.y==i.first.y&&e.second.x==i.second.x&&e.second.y==i.second.y)return;t.save(),t.strokeStyle=this.processColor(n.selection.color,{opacity:.8}),t.lineWidth=1,t.lineJoin="miter",t.fillStyle=this.processColor(n.selection.color,{opacity:.4}),this.selection.prevSelection={first:{x:e.first.x,y:e.first.y},second:{x:e.second.x,y:e.second.y}};var s=Math.min(e.first.x,e.second.x),o=Math.min(e.first.y,e.second.y),u=Math.abs(e.second.x-e.first.x),a=Math.abs(e.second.y-e.first.y);t.fillRect(s+r.left+.5,o+r.top+.5,u,a),t.strokeRect(s+r.left+.5,o+r.top+.5,u,a),t.restore()},updateSelection:function(){if(!this.lastMousePos.pageX)return;this.selection.selecting=!0;if(this.multitouches)this.selection.setSelectionPos(this.selection.selection.first,this.getEventPosition(this.multitouches[0])),this.selection.setSelectionPos(this.selection.selection.second,this.getEventPosition(this.multitouches[1]));else{if(this.options.selection.pinchOnly)return;this.selection.setSelectionPos(this.selection.selection.second,this.lastMousePos)}this.selection.clearSelection(),this.selection.selectionIsSane()&&this.selection.drawSelection()},clearSelection:function(){if(!this.selection.prevSelection)return;var e=this.selection.prevSelection,t=1,n=this.plotOffset,r=Math.min(e.first.x,e.second.x),i=Math.min(e.first.y,e.second.y),s=Math.abs(e.second.x-e.first.x),o=Math.abs(e.second.y-e.first.y);this.octx.clearRect(r+n.left-t+.5,i+n.top-t,s+2*t+.5,o+2*t+.5),this.selection.prevSelection=null},selectionIsSane:function(){var e=this.selection.selection;return Math.abs(e.second.x-e.first.x)>=5||Math.abs(e.second.y-e.first.y)>=5}})}(),function(){var e=Flotr.DOM,t=Flotr._;Flotr.addPlugin("legend",{options:{show:!0,noColumns:1,labelFormatter:function(e){return e},labelBoxBorderColor:"#CCCCCC",labelBoxWidth:14,labelBoxHeight:10,labelBoxMargin:5,container:null,position:"nw",margin:5,backgroundColor:"#F0F0F0",backgroundOpacity:.85},callbacks:{"flotr:afterinit":function(){this.legend.insertLegend()},"flotr:destroy":function(){var t=this.legend.markup;t&&(this.legend.markup=null,e.remove(t))}},insertLegend:function(){if(!this.options.legend.show)return;var n=this.series,r=this.plotOffset,i=this.options,s=i.legend,o=[],u=!1,a=this.ctx,f=t.filter(n,function(e){return e.label&&!e.hide}).length,l=s.position,c=s.margin,h=s.backgroundOpacity,p,d,v;if(f){var m=s.labelBoxWidth,g=s.labelBoxHeight,y=s.labelBoxMargin,b=r.left+c,w=r.top+c,E=0,S={size:i.fontSize*1.1,color:i.grid.color};for(p=n.length-1;p>-1;--p){if(!n[p].label||n[p].hide)continue;d=s.labelFormatter(n[p].label),E=Math.max(E,this._text.measureText(d,S).width)}var x=Math.round(m+y*3+E),T=Math.round(f*(y+g)+y);!h&&h!==0&&(h=.1);if(!i.HtmlText&&this.textEnabled&&!s.container){l.charAt(0)=="s"&&(w=r.top+this.plotHeight-(c+T)),l.charAt(0)=="c"&&(w=r.top+this.plotHeight/2-(c+T/2)),l.charAt(1)=="e"&&(b=r.left+this.plotWidth-(c+x)),v=this.processColor(s.backgroundColor,{opacity:h}),a.fillStyle=v,a.fillRect(b,w,x,T),a.strokeStyle=s.labelBoxBorderColor,a.strokeRect(Flotr.toPixel(b),Flotr.toPixel(w),x,T);var N=b+y,C=w+y;for(p=0;p<n.length;p++){if(!n[p].label||n[p].hide)continue;d=s.labelFormatter(n[p].label),a.fillStyle=n[p].color,a.fillRect(N,C,m-1,g-1),a.strokeStyle=s.labelBoxBorderColor,a.lineWidth=1,a.strokeRect(Math.ceil(N)-1.5,Math.ceil(C)-1.5,m+2,g+2),Flotr.drawText(a,d,N+m+y,C+g,S),C+=g+y}}else{for(p=0;p<n.length;++p){if(!n[p].label||n[p].hide)continue;p%s.noColumns===0&&(o.push(u?"</tr><tr>":"<tr>"),u=!0);var k=n[p],L=s.labelBoxWidth,A=s.labelBoxHeight;d=s.labelFormatter(k.label),v="background-color:"+(k.bars&&k.bars.show&&k.bars.fillColor&&k.bars.fill?k.bars.fillColor:k.color)+";",o.push('<td class="flotr-legend-color-box">','<div style="border:1px solid ',s.labelBoxBorderColor,';padding:1px">','<div style="width:',L-1,"px;height:",A-1,"px;border:1px solid ",n[p].color,'">','<div style="width:',L,"px;height:",A,"px;",v,'"></div>',"</div>","</div>","</td>",'<td class="flotr-legend-label">',d,"</td>")}u&&o.push("</tr>");if(o.length>0){var O='<table style="font-size:smaller;color:'+i.grid.color+'">'+o.join("")+"</table>";if(s.container)O=e.node(O),this.legend.markup=O,e.insert(s.container,O);else{var M={position:"absolute",zIndex:"2",border:"1px solid "+s.labelBoxBorderColor};l.charAt(0)=="n"?(M.top=c+r.top+"px",M.bottom="auto"):l.charAt(0)=="c"?(M.top=c+(this.plotHeight-T)/2+"px",M.bottom="auto"):l.charAt(0)=="s"&&(M.bottom=c+r.bottom+"px",M.top="auto"),l.charAt(1)=="e"?(M.right=c+r.right+"px",M.left="auto"):l.charAt(1)=="w"&&(M.left=c+r.left+"px",M.right="auto");var P=e.create("div"),H;P.className="flotr-legend",e.setStyles(P,M),e.insert(P,O),e.insert(this.el,P);if(!h)return;var B=s.backgroundColor||i.grid.backgroundColor||"#ffffff";t.extend(M,e.size(P),{backgroundColor:B,zIndex:"",border:""}),M.width+="px",M.height+="px",P=e.create("div"),P.className="flotr-legend-bg",e.setStyles(P,M),e.opacity(P,h),e.insert(P," "),e.insert(this.el,P)}}}}}})}(),function(){var e=Flotr.DOM,t=Flotr._,n=Flotr,r="opacity:0.7;background-color:#000;color:#fff;position:absolute;padding:2px 8px;-moz-border-radius:4px;border-radius:4px;white-space:nowrap;";Flotr.addPlugin("hit",{callbacks:{"flotr:mousemove":function(e,t){this.hit.track(t)},"flotr:click":function(e){var n=this.hit.track(e);n&&!t.isUndefined(n.index)&&(e.hit=n)},"flotr:mouseout":function(e){e.relatedTarget!==this.mouseTrack&&this.hit.clearHit()},"flotr:destroy":function(){this.options.mouse.container&&e.remove(this.mouseTrack),this.mouseTrack=null}},track:function(e){if(this.options.mouse.track||t.any(this.series,function(e){return e.mouse&&e.mouse.track}))return this.hit.hit(e)},executeOnType:function(e,r,i){function u(e,u){t.each(t.keys(n.graphTypes),function(t){e[t]&&e[t].show&&this[t][r]&&(o=this.getOptions(e,t),o.fill=!!e.mouse.fillColor,o.fillStyle=this.processColor(e.mouse.fillColor||"#ffffff",{opacity:e.mouse.fillOpacity}),o.color=e.mouse.lineColor,o.context=this.octx,o.index=u,i&&(o.args=i),this[t][r].call(this[t],o),s=!0)},this)}var s=!1,o;return t.isArray(e)||(e=[e]),t.each(e,u,this),s},drawHit:function(e){var t=this.octx,n=e.series;if(n.mouse.lineColor){t.save(),t.lineWidth=n.points?n.points.lineWidth:1,t.strokeStyle=n.mouse.lineColor,t.fillStyle=this.processColor(n.mouse.fillColor||"#ffffff",{opacity:n.mouse.fillOpacity}),t.translate(this.plotOffset.left,this.plotOffset.top);if(!this.hit.executeOnType(n,"drawHit",e)){var r=e.xaxis,i=e.yaxis;t.beginPath(),t.arc(r.d2p(e.x),i.d2p(e.y),n.points.hitRadius||n.points.radius||n.mouse.radius,0,2*Math.PI,!0),t.fill(),t.stroke(),t.closePath()}t.restore(),this.clip(t)}this.prevHit=e},clearHit:function(){var t=this.prevHit,n=this.octx,r=this.plotOffset;n.save(),n.translate(r.left,r.top);if(t){if(!this.hit.executeOnType(t.series,"clearHit",this.prevHit)){var i=t.series,s=i.points?i.points.lineWidth:1;offset=(i.points.hitRadius||i.points.radius||i.mouse.radius)+s,n.clearRect(t.xaxis.d2p(t.x)-offset,t.yaxis.d2p(t.y)-offset,offset*2,offset*2)}e.hide(this.mouseTrack),this.prevHit=null}n.restore()},hit:function(e){var n=this.options,r=this.prevHit,i,s,o,u,a,f,l,c,h;if(this.series.length===0)return;h={relX:e.relX,relY:e.relY,absX:e.absX,absY:e.absY,series:this.series};if(n.mouse.trackY&&!n.mouse.trackAll&&this.hit.executeOnType(this.series,"hit",[e,h])&&!t.isUndefined(h.seriesIndex))a=this.series[h.seriesIndex],h.series=a,h.mouse=a.mouse,h.xaxis=a.xaxis,h.yaxis=a.yaxis;else{i=this.hit.closest(e);if(i){i=n.mouse.trackY?i.point:i.x,u=i.seriesIndex,a=this.series[u],l=a.xaxis,c=a.yaxis,s=2*a.mouse.sensibility;if(n.mouse.trackAll||i.distanceX<s/l.scale&&(!n.mouse.trackY||i.distanceY<s/c.scale))h.series=a,h.xaxis=a.xaxis,h.yaxis=a.yaxis,h.mouse=a.mouse,h.x=i.x,h.y=i.y,h.dist=i.distance,h.index=i.dataIndex,h.seriesIndex=u}}if(!r||r.index!==h.index||r.seriesIndex!==h.seriesIndex)this.hit.clearHit(),h.series&&h.mouse&&h.mouse.track&&(this.hit.drawMouseTrack(h),this.hit.drawHit(h),Flotr.EventAdapter.fire(this.el,"flotr:hit",[h,this]));return h},closest:function(e){function E(e){e.distance=h,e.distanceX=p,e.distanceY=d,e.seriesIndex=b,e.dataIndex=w,e.x=g,e.y=y,f=!0}var t=this.series,n=this.options,r=e.relX,i=e.relY,s=Number.MAX_VALUE,o=Number.MAX_VALUE,u={},a={},f=!1,l,c,h,p,d,v,m,g,y,b,w;for(b=0;b<t.length;b++){l=t[b],c=l.data,v=l.xaxis.p2d(r),m=l.yaxis.p2d(i);for(w=c.length;w--;){g=c[w][0],y=c[w][1];if(g===null||y===null)continue;if(g<l.xaxis.min||g>l.xaxis.max)continue;p=Math.abs(g-v),d=Math.abs(y-m),h=p*p+d*d,h<s&&(s=h,E(u)),p<o&&(o=p,E(a))}}return f?{point:u,x:a}:!1},drawMouseTrack:function(n){var i="",s=n.series,o=n.mouse.position,u=n.mouse.margin,a=n.x,f=n.y,l=r,c=this.mouseTrack,h=this.plotOffset,p=h.left,d=h.right,v=h.bottom,m=h.top,g=n.mouse.trackDecimals,y=this.options,b=y.mouse.container,w=0,E=0,S,x,T;c||(c=e.node('<div class="flotr-mouse-value" style="'+l+'"></div>'),this.mouseTrack=c,e.insert(b||this.el,c));if(!g||g<0)g=0;a&&a.toFixed&&(a=a.toFixed(g)),f&&f.toFixed&&(f=f.toFixed(g)),T=n.mouse.trackFormatter({x:a,y:f,series:n.series,index:n.index,nearest:n,fraction:n.fraction});if(t.isNull(T)||t.isUndefined(T)){e.hide(c);return}c.innerHTML=T,e.show(c);if(b)return;x=e.size(c),b&&(S=e.position(this.el),w=S.top,E=S.left);if(!n.mouse.relative)i+="top:",o.charAt(0)=="n"?i+=w+u+m:o.charAt(0)=="s"&&(i+=w-u+m+this.plotHeight-x.height),i+="px;bottom:auto;left:",o.charAt(1)=="e"?i+=E-u+p+this.plotWidth-x.width:o.charAt(1)=="w"&&(i+=E+u+p),i+="px;right:auto;";else if(s.pie&&s.pie.show){var N={x:this.plotWidth/2,y:this.plotHeight/2},C=Math.min(this.canvasWidth,this.canvasHeight)*s.pie.sizeRatio/2,k=n.sAngle<n.eAngle?(n.sAngle+n.eAngle)/2:(n.sAngle+n.eAngle+2*Math.PI)/2;i+="bottom:"+(u-m-N.y-Math.sin(k)*C/2+this.canvasHeight)+"px;top:auto;",i+="left:"+(u+p+N.x+Math.cos(k)*C/2)+"px;right:auto;"}else i+="top:",/n/.test(o)?i+=w-u+m+n.yaxis.d2p(n.y)-x.height:i+=w+u+m+n.yaxis.d2p(n.y),i+="px;bottom:auto;left:",/w/.test(o)?i+=E-u+p+n.xaxis.d2p(n.x)-x.width:i+=E+u+p+n.xaxis.d2p(n.x),i+="px;right:auto;";c.style.cssText=l+i,n.mouse.relative&&(/[ew]/.test(o)?/[ns]/.test(o)||(c.style.top=w+m+n.yaxis.d2p(n.y)-e.size(c).height/2+"px"):c.style.left=E+p+n.xaxis.d2p(n.x)-e.size(c).width/2+"px")}})}(),function(){var e=Flotr.DOM;Flotr.addPlugin("labels",{callbacks:{"flotr:afterdraw":function(){this.labels.draw()}},draw:function(){function b(e,t,r){var i=r?t.minorTicks:t.ticks,s=t.orientation===1,u=t.n===1,l,h;l={color:t.options.color||d.grid.color,angle:Flotr.toRad(t.options.labelsAngle),textBaseline:"middle"};for(c=0;c<i.length&&(r?t.options.showMinorLabels:t.options.showLabels);++c){n=i[c],n.label+="";if(!n.label||!n.label.length)continue;x=Math.cos(c*a+f)*o,y=Math.sin(c*a+f)*o,l.textAlign=s?Math.abs(x)<.1?"center":x<0?"right":"left":"left",Flotr.drawText(v,n.label,s?x:3,s?y:-(t.ticks[c].v/t.max)*(o-d.fontSize),l)}}function w(e,t,r,i){function f(e){return e.options.showLabels&&e.used}function l(e,t,n,r){return e.plotOffset.left+(t?r:n?-d.grid.labelMargin:d.grid.labelMargin+e.plotWidth)}function h(e,t,n,r){return e.plotOffset.top+(t?d.grid.labelMargin:r)+(t&&n?e.plotHeight:0)}var s=t.orientation===1,o=t.n===1,u,a;u={color:t.options.color||d.grid.color,textAlign:r,textBaseline:i,angle:Flotr.toRad(t.options.labelsAngle)},u=Flotr.getBestTextAlign(u.angle,u);for(c=0;c<t.ticks.length&&f(t);++c){n=t.ticks[c];if(!n.label||!n.label.length)continue;a=t.d2p(n.v);if(a<0||a>(s?e.plotWidth:e.plotHeight))continue;Flotr.drawText(v,n.label,l(e,s,o,a),h(e,s,o,a),u),!s&&!o&&(v.save(),v.strokeStyle=u.color,v.beginPath(),v.moveTo(e.plotOffset.left+e.plotWidth-8,e.plotOffset.top+t.d2p(n.v)),v.lineTo(e.plotOffset.left+e.plotWidth,e.plotOffset.top+t.d2p(n.v)),v.stroke(),v.restore())}}function E(e,t){var r=t.orientation===1,i=t.n===1,o="",u,a,f,l=e.plotOffset;!r&&!i&&(v.save(),v.strokeStyle=t.options.color||d.grid.color,v.beginPath());if(t.options.showLabels&&(i?!0:t.used))for(c=0;c<t.ticks.length;++c){n=t.ticks[c];if(!n.label||!n.label.length||(r?l.left:l.top)+t.d2p(n.v)<0||(r?l.left:l.top)+t.d2p(n.v)>(r?e.canvasWidth:e.canvasHeight))continue;f=l.top+(r?(i?1:-1)*(e.plotHeight+d.grid.labelMargin):t.d2p(n.v)-t.maxLabel.height/2),u=r?l.left+t.d2p(n.v)-s/2:0,o="",c===0?o=" first":c===t.ticks.length-1&&(o=" last"),o+=r?" flotr-grid-label-x":" flotr-grid-label-y",h+=['<div style="position:absolute; text-align:'+(r?"center":"right")+"; ","top:"+f+"px; ",(!r&&!i?"right:":"left:")+u+"px; ","width:"+(r?s:(i?l.left:l.right)-d.grid.labelMargin)+"px; ",t.options.color?"color:"+t.options.color+"; ":" ",'" class="flotr-grid-label'+o+'">'+n.label+"</div>"].join(" "),!r&&!i&&(v.moveTo(l.left+e.plotWidth-8,l.top+t.d2p(n.v)),v.lineTo(l.left+e.plotWidth,l.top+t.d2p(n.v)))}}var t,n,r,i,s,o,u,a,f,l,c,h="",p=0,d=this.options,v=this.ctx,m=this.axes,g={size:d.fontSize};for(c=0;c<m.x.ticks.length;++c)m.x.ticks[c].label&&++p;s=this.plotWidth/p,d.grid.circular&&(v.save(),v.translate(this.plotOffset.left+this.plotWidth/2,this.plotOffset.top+this.plotHeight/2),o=this.plotHeight*d.radar.radiusRatio/2+d.fontSize,u=this.axes.x.ticks.length,a=2*(Math.PI/u),f=-Math.PI/2,b(this,m.x,!1),b(this,m.x,!0),b(this,m.y,!1),b(this,m.y,!0),v.restore()),!d.HtmlText&&this.textEnabled?(w(this,m.x,"center","top"),w(this,m.x2,"center","bottom"),w(this,m.y,"right","middle"),w(this,m.y2,"left","middle")):(m.x.options.showLabels||m.x2.options.showLabels||m.y.options.showLabels||m.y2.options.showLabels)&&!d.grid.circular&&(h="",E(this,m.x),E(this,m.x2),E(this,m.y),E(this,m.y2),v.stroke(),v.restore(),l=e.create("div"),e.setStyles(l,{fontSize:"smaller",color:d.grid.color}),l.className="flotr-labels",e.insert(this.el,l),e.insert(l,h))}})}(),function(){var e=Flotr.DOM,t=Flotr._;Flotr.addPlugin("legend",{options:{show:!0,noColumns:1,labelFormatter:function(e){return e},labelBoxBorderColor:"#CCCCCC",labelBoxWidth:14,labelBoxHeight:10,labelBoxMargin:5,container:null,position:"nw",margin:5,backgroundColor:"#F0F0F0",backgroundOpacity:.85},callbacks:{"flotr:afterinit":function(){this.legend.insertLegend()},"flotr:destroy":function(){var t=this.legend.markup;t&&(this.legend.markup=null,e.remove(t))}},insertLegend:function(){if(!this.options.legend.show)return;var n=this.series,r=this.plotOffset,i=this.options,s=i.legend,o=[],u=!1,a=this.ctx,f=t.filter(n,function(e){return e.label&&!e.hide}).length,l=s.position,c=s.margin,h=s.backgroundOpacity,p,d,v;if(f){var m=s.labelBoxWidth,g=s.labelBoxHeight,y=s.labelBoxMargin,b=r.left+c,w=r.top+c,E=0,S={size:i.fontSize*1.1,color:i.grid.color};for(p=n.length-1;p>-1;--p){if(!n[p].label||n[p].hide)continue;d=s.labelFormatter(n[p].label),E=Math.max(E,this._text.measureText(d,S).width)}var x=Math.round(m+y*3+E),T=Math.round(f*(y+g)+y);!h&&h!==0&&(h=.1);if(!i.HtmlText&&this.textEnabled&&!s.container){l.charAt(0)=="s"&&(w=r.top+this.plotHeight-(c+T)),l.charAt(0)=="c"&&(w=r.top+this.plotHeight/2-(c+T/2)),l.charAt(1)=="e"&&(b=r.left+this.plotWidth-(c+x)),v=this.processColor(s.backgroundColor,{opacity:h}),a.fillStyle=v,a.fillRect(b,w,x,T),a.strokeStyle=s.labelBoxBorderColor,a.strokeRect(Flotr.toPixel(b),Flotr.toPixel(w),x,T);var N=b+y,C=w+y;for(p=0;p<n.length;p++){if(!n[p].label||n[p].hide)continue;d=s.labelFormatter(n[p].label),a.fillStyle=n[p].color,a.fillRect(N,C,m-1,g-1),a.strokeStyle=s.labelBoxBorderColor,a.lineWidth=1,a.strokeRect(Math.ceil(N)-1.5,Math.ceil(C)-1.5,m+2,g+2),Flotr.drawText(a,d,N+m+y,C+g,S),C+=g+y}}else{for(p=0;p<n.length;++p){if(!n[p].label||n[p].hide)continue;p%s.noColumns===0&&(o.push(u?"</tr><tr>":"<tr>"),u=!0);var k=n[p],L=s.labelBoxWidth,A=s.labelBoxHeight;d=s.labelFormatter(k.label),v="background-color:"+(k.bars&&k.bars.show&&k.bars.fillColor&&k.bars.fill?k.bars.fillColor:k.color)+";",o.push('<td class="flotr-legend-color-box">','<div style="border:1px solid ',s.labelBoxBorderColor,';padding:1px">','<div style="width:',L-1,"px;height:",A-1,"px;border:1px solid ",n[p].color,'">','<div style="width:',L,"px;height:",A,"px;",v,'"></div>',"</div>","</div>","</td>",'<td class="flotr-legend-label">',d,"</td>")}u&&o.push("</tr>");if(o.length>0){var O='<table style="font-size:smaller;color:'+i.grid.color+'">'+o.join("")+"</table>";if(s.container)O=e.node(O),this.legend.markup=O,e.insert(s.container,O);else{var M={position:"absolute",zIndex:"2",border:"1px solid "+s.labelBoxBorderColor};l.charAt(0)=="n"?(M.top=c+r.top+"px",M.bottom="auto"):l.charAt(0)=="c"?(M.top=c+(this.plotHeight-T)/2+"px",M.bottom="auto"):l.charAt(0)=="s"&&(M.bottom=c+r.bottom+"px",M.top="auto"),l.charAt(1)=="e"?(M.right=c+r.right+"px",M.left="auto"):l.charAt(1)=="w"&&(M.left=c+r.left+"px",M.right="auto");var P=e.create("div"),H;P.className="flotr-legend",e.setStyles(P,M),e.insert(P,O),e.insert(this.el,P);if(!h)return;var B=s.backgroundColor||i.grid.backgroundColor||"#ffffff";t.extend(M,e.size(P),{backgroundColor:B,zIndex:"",border:""}),M.width+="px",M.height+="px",P=e.create("div"),P.className="flotr-legend-bg",e.setStyles(P,M),e.opacity(P,h),e.insert(P," "),e.insert(this.el,P)}}}}}})}(),function(){var e=Flotr.DOM;Flotr.addPlugin("titles",{callbacks:{"flotr:afterdraw":function(){this.titles.drawTitles()}},drawTitles:function(){var t,n=this.options,r=n.grid.labelMargin,i=this.ctx,s=this.axes;if(!n.HtmlText&&this.textEnabled){var o={size:n.fontSize,color:n.grid.color,textAlign:"center"};n.subtitle&&Flotr.drawText(i,n.subtitle,this.plotOffset.left+this.plotWidth/2,this.titleHeight+this.subtitleHeight-2,o),o.weight=1.5,o.size*=1.5,n.title&&Flotr.drawText(i,n.title,this.plotOffset.left+this.plotWidth/2,this.titleHeight-2,o),o.weight=1.8,o.size*=.8,s.x.options.title&&s.x.used&&(o.textAlign=s.x.options.titleAlign||"center",o.textBaseline="top",o.angle=Flotr.toRad(s.x.options.titleAngle),o=Flotr.getBestTextAlign(o.angle,o),Flotr.drawText(i,s.x.options.title,this.plotOffset.left+this.plotWidth/2,this.plotOffset.top+s.x.maxLabel.height+this.plotHeight+2*r,o)),s.x2.options.title&&s.x2.used&&(o.textAlign=s.x2.options.titleAlign||"center",o.textBaseline="bottom",o.angle=Flotr.toRad(s.x2.options.titleAngle),o=Flotr.getBestTextAlign(o.angle,o),Flotr.drawText(i,s.x2.options.title,this.plotOffset.left+this.plotWidth/2,this.plotOffset.top-s.x2.maxLabel.height-2*r,o)),s.y.options.title&&s.y.used&&(o.textAlign=s.y.options.titleAlign||"right",o.textBaseline="middle",o.angle=Flotr.toRad(s.y.options.titleAngle),o=Flotr.getBestTextAlign(o.angle,o),Flotr.drawText(i,s.y.options.title,this.plotOffset.left-s.y.maxLabel.width-2*r,this.plotOffset.top+this.plotHeight/2,o)),s.y2.options.title&&s.y2.used&&(o.textAlign=s.y2.options.titleAlign||"left",o.textBaseline="middle",o.angle=Flotr.toRad(s.y2.options.titleAngle),o=Flotr.getBestTextAlign(o.angle,o),Flotr.drawText(i,s.y2.options.title,this.plotOffset.left+this.plotWidth+s.y2.maxLabel.width+2*r,this.plotOffset.top+this.plotHeight/2,o))}else{t=[],n.title&&t.push('<div style="position:absolute;top:0;left:',this.plotOffset.left,"px;font-size:1em;font-weight:bold;text-align:center;width:",this.plotWidth,'px;" class="flotr-title">',n.title,"</div>"),n.subtitle&&t.push('<div style="position:absolute;top:',this.titleHeight,"px;left:",this.plotOffset.left,"px;font-size:smaller;text-align:center;width:",this.plotWidth,'px;" class="flotr-subtitle">',n.subtitle,"</div>"),t.push("</div>"),t.push('<div class="flotr-axis-title" style="font-weight:bold;">'),s.x.options.title&&s.x.used&&t.push('<div style="position:absolute;top:',this.plotOffset.top+this.plotHeight+n.grid.labelMargin+s.x.titleSize.height,"px;left:",this.plotOffset.left,"px;width:",this.plotWidth,"px;text-align:",s.x.options.titleAlign,';" class="flotr-axis-title flotr-axis-title-x1">',s.x.options.title,"</div>"),s.x2.options.title&&s.x2.used&&t.push('<div style="position:absolute;top:0;left:',this.plotOffset.left,"px;width:",this.plotWidth,"px;text-align:",s.x2.options.titleAlign,';" class="flotr-axis-title flotr-axis-title-x2">',s.x2.options.title,"</div>"),s.y.options.title&&s.y.used&&t.push('<div style="position:absolute;top:',this.plotOffset.top+this.plotHeight/2-s.y.titleSize.height/2,"px;left:0;text-align:",s.y.options.titleAlign,';" class="flotr-axis-title flotr-axis-title-y1">',s.y.options.title,"</div>"),s.y2.options.title&&s.y2.used&&t.push('<div style="position:absolute;top:',this.plotOffset.top+this.plotHeight/2-s.y.titleSize.height/2,"px;right:0;text-align:",s.y2.options.titleAlign,';" class="flotr-axis-title flotr-axis-title-y2">',s.y2.options.title,"</div>"),t=t.join("");var u=e.create("div");e.setStyles({color:n.grid.color}),u.className="flotr-titles",e.insert(this.el,u),e.insert(u,t)}}})}(),function(){function t(){var t=this.options,n=this.handles,r=this.el,i,s,o,u;if(!t.selection.mode||!t.handles.show||"ontouchstart"in r)return;n.initialized=!0,u=e.node('<div class="flotr-handles"></div>'),t=t.handles,t.drag&&(o=e.node('<div class="flotr-handles-handle flotr-handles-drag flotr-handles-right"></div>'),s=e.node('<div class="flotr-handles-handle flotr-handles-drag flotr-handles-left"></div>'),e.insert(u,o),e.insert(u,s),e.hide(s),e.hide(o),n.left=s,n.right=o,this.observe(s,"mousedown",function(
){n.moveHandler=a}),this.observe(o,"mousedown",function(){n.moveHandler=f})),t.scroll&&(i=e.node('<div class="flotr-handles-handle flotr-handles-scroll"></div>'),e.insert(u,i),e.hide(i),n.scroll=i,this.observe(i,"mousedown",function(){n.moveHandler=l})),this.observe(document,"mouseup",function(){n.moveHandler=null}),e.insert(r,u)}function n(e){if(!this.handles.initialized)return;var t=this.handles,n=this.options.handles,s=t.left,o=t.right,u=t.scroll;n&&(n.drag&&(r(this,s,e.x1),r(this,o,e.x2)),n.scroll&&i(this,u,e.x1,e.x2))}function r(t,n,r){e.show(n);var i=e.size(n),s=Math.round(t.axes.x.d2p(r)-i.width/2),o=(t.plotHeight-i.height)/2;e.setStyles(n,{left:s+"px",top:o+"px"})}function i(t,n,r,i){e.show(n);var s=e.size(n),o=Math.round(t.axes.x.d2p(r)),u=t.plotHeight-s.height/2,a=t.axes.x.d2p(i)-t.axes.x.d2p(r);e.setStyles(n,{left:o+"px",top:u+"px",width:a+"px"})}function s(){if(!this.handles.initialized)return;var t=this.handles;t&&(e.hide(t.left),e.hide(t.right),e.hide(t.scroll))}function o(e,t){if(!this.handles.initialized)return;if(!this.handles.moveHandler)return;var n=t.x-this.lastMousePos.x,r=this.selection.selection,i=this.selection.getArea(),s=this.handles;s.moveHandler(i,n),u(i,s),this.selection.setSelection(i)}function u(e,t){var n=t.moveHandler;e.x1>e.x2&&(n==a?n=f:n==f&&(n=a),t.moveHandler=n)}function a(e,t){e.x1+=t}function f(e,t){e.x2+=t}function l(e,t){e.x1+=t,e.x2+=t}var e=Flotr.DOM;Flotr.addPlugin("handles",{options:{show:!1,drag:!0,scroll:!0},callbacks:{"flotr:afterinit":t,"flotr:select":n,"flotr:mousedown":s,"flotr:mousemove":o}})}(),function(){var e=Flotr.EventAdapter,t=Flotr._;Flotr.addPlugin("graphGrid",{callbacks:{"flotr:beforedraw":function(){this.graphGrid.drawGrid()},"flotr:afterdraw":function(){this.graphGrid.drawOutline()}},drawGrid:function(){function v(e){for(p=0;p<e.length;++p){var t=e[p].v/c.max;for(d=0;d<=w;++d)n[d===0?"moveTo":"lineTo"](Math.cos(d*S+x)*b*t,Math.sin(d*S+x)*b*t)}}function m(e,r){t.each(t.pluck(e,"v"),function(e){if(e<=c.min||e>=c.max||(e==c.min||e==c.max)&&i.outlineWidth)return;r(Math.floor(c.d2p(e))+n.lineWidth/2)})}function g(e){n.moveTo(e,0),n.lineTo(e,f)}function y(e){n.moveTo(0,e),n.lineTo(l,e)}var n=this.ctx,r=this.options,i=r.grid,s=i.verticalLines,o=i.horizontalLines,u=i.minorVerticalLines,a=i.minorHorizontalLines,f=this.plotHeight,l=this.plotWidth,c,h,p,d;(s||u||o||a)&&e.fire(this.el,"flotr:beforegrid",[this.axes.x,this.axes.y,r,this]),n.save(),n.lineWidth=1,n.strokeStyle=i.tickColor;if(i.circular){n.translate(this.plotOffset.left+l/2,this.plotOffset.top+f/2);var b=Math.min(f,l)*r.radar.radiusRatio/2,w=this.axes.x.ticks.length,S=2*(Math.PI/w),x=-Math.PI/2;n.beginPath(),c=this.axes.y,o&&v(c.ticks),a&&v(c.minorTicks),s&&t.times(w,function(e){n.moveTo(0,0),n.lineTo(Math.cos(e*S+x)*b,Math.sin(e*S+x)*b)}),n.stroke()}else n.translate(this.plotOffset.left,this.plotOffset.top),i.backgroundColor&&(n.fillStyle=this.processColor(i.backgroundColor,{x1:0,y1:0,x2:l,y2:f}),n.fillRect(0,0,l,f)),n.beginPath(),c=this.axes.x,s&&m(c.ticks,g),u&&m(c.minorTicks,g),c=this.axes.y,o&&m(c.ticks,y),a&&m(c.minorTicks,y),n.stroke();n.restore(),(s||u||o||a)&&e.fire(this.el,"flotr:aftergrid",[this.axes.x,this.axes.y,r,this])},drawOutline:function(){var e=this,t=e.options,n=t.grid,r=n.outline,s=e.ctx,o=n.backgroundImage,u=e.plotOffset,a=u.left,f=u.top,l=e.plotWidth,c=e.plotHeight,h,p,d,v,m,g;if(!n.outlineWidth)return;s.save();if(n.circular){s.translate(a+l/2,f+c/2);var y=Math.min(c,l)*t.radar.radiusRatio/2,b=this.axes.x.ticks.length,w=2*(Math.PI/b),E=-Math.PI/2;s.beginPath(),s.lineWidth=n.outlineWidth,s.strokeStyle=n.color,s.lineJoin="round";for(i=0;i<=b;++i)s[i===0?"moveTo":"lineTo"](Math.cos(i*w+E)*y,Math.sin(i*w+E)*y);s.stroke()}else{s.translate(a,f);var S=n.outlineWidth,x=.5-S+(S+1)%2/2,T="lineTo",N="moveTo";s.lineWidth=S,s.strokeStyle=n.color,s.lineJoin="miter",s.beginPath(),s.moveTo(x,x),l-=S/2%1,c+=S/2,s[r.indexOf("n")!==-1?T:N](l,x),s[r.indexOf("e")!==-1?T:N](l,c),s[r.indexOf("s")!==-1?T:N](x,c),s[r.indexOf("w")!==-1?T:N](x,x),s.stroke(),s.closePath()}s.restore(),o&&(d=o.src||o,v=(parseInt(o.left,10)||0)+u.left,m=(parseInt(o.top,10)||0)+u.top,p=new Image,p.onload=function(){s.save(),o.alpha&&(s.globalAlpha=o.alpha),s.globalCompositeOperation="destination-over",s.drawImage(p,0,0,p.width,p.height,v,m,l,c),s.restore()},p.src=d)}})}(),!function(e,t){typeof define=="function"?define(t):typeof module!="undefined"?module.exports=t():this[e]=t()}("bonzo",function(){function e(e){return new RegExp("(^|\\s+)"+e+"(\\s+|$)")}function t(e,t,n){for(var r=0,i=e.length;r<i;r++)t.call(n||e[r],e[r],r,e);return e}function n(e){return e.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}function r(e){return e&&e.nodeName&&e.nodeType==1}function i(e,t,n,r){for(r=0,j=e.length;r<j;++r)if(t.call(n,e[r],r,e))return!0;return!1}function s(e,n,r){var i=0,s=n||this,o=[],u=E&&typeof e=="string"&&e.charAt(0)!="<"?function(t){return(t=E(e))&&(t.selected=1)&&t}():e;return t(c(u),function(e){t(s,function(t){var n=!t[w]||t[w]&&!t[w][w]?function(){var e=t.cloneNode(!0);return s.$&&s.cloneEvents&&s.$(e).cloneEvents(t),e}():t;r(e,n),o[i]=n,i++})},this),t(o,function(e,t){s[t]=e}),s.length=i,s}function o(e,t,n){var r=v(e),i=r.css("position"),s=r.offset(),o="relative",u=i==o,a=[parseInt(r.css("left"),10),parseInt(r.css("top"),10)];i=="static"&&(r.css("position",o),i=o),isNaN(a[0])&&(a[0]=u?0:e.offsetLeft),isNaN(a[1])&&(a[1]=u?0:e.offsetTop),t!=null&&(e.style.left=t-s.left+a[0]+M),n!=null&&(e.style.top=n-s.top+a[1]+M)}function u(t,n){return e(n).test(t.className)}function a(e,t){e.className=F(e.className+" "+t)}function f(t,n){t.className=F(t.className.replace(e(n)," "))}function l(e){this.length=0;if(e){e=typeof e!="string"&&!e.nodeType&&typeof e.length!="undefined"?e:[e],this.length=e.length;for(var t=0;t<e.length;t++)this[t]=e[t]}}function c(e){return typeof e=="string"?v.create(e):r(e)?[e]:e}function h(e,t,n){var r=this[0];return e==null&&t==null?(p(r)?d():{x:r.scrollLeft,y:r.scrollTop})[n]:(p(r)?g.scrollTo(e,t):(e!=null&&(r.scrollLeft=e),t!=null&&(r.scrollTop=t)),this)}function p(e){return e===g||/^(?:body|html)$/i.test(e.tagName)}function d(){return{x:g.pageXOffset||b.scrollLeft,y:g.pageYOffset||b.scrollTop}}function v(e,t){return new l(e,t)}var m=this,g=window,y=g.document,b=y.documentElement,w="parentNode",E=null,S=/^checked|value|selected$/,x=/select|fieldset|table|tbody|tfoot|td|tr|colgroup/i,T="table",N={thead:T,tbody:T,tfoot:T,tr:"tbody",th:"tr",td:"tr",fieldset:"form",option:"select"},C=/^checked|selected$/,k=/msie/i.test(navigator.userAgent),L=[],A=0,O=/^-?[\d\.]+$/,M="px",_="setAttribute",D="getAttribute",P=/(^\s*|\s*$)/g,H={lineHeight:1,zoom:1,zIndex:1,opacity:1},B=function(){var e=["webkitTransform","MozTransform","OTransform","msTransform","Transform"],t;for(t=0;t<e.length;t++)if(e[t]in y.createElement("a").style)return e[t]}(),F=String.prototype.trim?function(e){return e.trim()}:function(e){return e.replace(P,"")},I=y.defaultView&&y.defaultView.getComputedStyle?function(e,t){t=t=="transform"?B:t,t=t=="transform-origin"?B+"Origin":t;var r=null;t=="float"&&(t="cssFloat");var i=y.defaultView.getComputedStyle(e,"");return i&&(r=i[n(t)]),e.style[t]||r}:k&&b.currentStyle?function(e,t){t=n(t),t=t=="float"?"styleFloat":t;if(t=="opacity"){var r=100;try{r=e.filters["DXImageTransform.Microsoft.Alpha"].opacity}catch(i){try{r=e.filters("alpha").opacity}catch(s){}}return r/100}var o=e.currentStyle?e.currentStyle[t]:null;return e.style[t]||o}:function(e,t){return e.style[n(t)]};l.prototype={get:function(e){return this[e]},each:function(e,n){return t(this,e,n)},map:function(e,t){var n=[],r,i;for(i=0;i<this.length;i++)r=e.call(this,this[i],i),t?t(r)&&n.push(r):n.push(r);return n},first:function(){return v(this[0])},last:function(){return v(this[this.length-1])},html:function(e,n){function r(n){while(n.firstChild)n.removeChild(n.firstChild);t(c(e),function(e){n.appendChild(e)})}var i=n?b.textContent===null?"innerText":"textContent":"innerHTML",s;return typeof e!="undefined"?this.each(function(t){(s=t.tagName.match(x))?r(t,s[0]):t[i]=e}):this[0]?this[0][i]:""},text:function(e){return this.html(e,1)},addClass:function(e){return this.each(function(t){u(t,e)||a(t,e)})},removeClass:function(e){return this.each(function(t){u(t,e)&&f(t,e)})},hasClass:function(e){return i(this,function(t){return u(t,e)})},toggleClass:function(e,t){return this.each(function(n){typeof t!="undefined"?t?a(n,e):f(n,e):u(n,e)?f(n,e):a(n,e)})},show:function(e){return this.each(function(t){t.style.display=e||""})},hide:function(e){return this.each(function(e){e.style.display="none"})},append:function(e){return this.each(function(n){t(c(e),function(e){n.appendChild(e)})})},prepend:function(e){return this.each(function(n){var r=n.firstChild;t(c(e),function(e){n.insertBefore(e,r)})})},appendTo:function(e,t){return s.call(this,e,t,function(e,t){e.appendChild(t)})},prependTo:function(e,t){return s.call(this,e,t,function(e,t){e.insertBefore(t,e.firstChild)})},next:function(){return this.related("nextSibling")},previous:function(){return this.related("previousSibling")},related:function(e){return this.map(function(t){t=t[e];while(t&&t.nodeType!==1)t=t[e];return t||0},function(e){return e})},before:function(e){return this.each(function(n){t(v.create(e),function(e){n[w].insertBefore(e,n)})})},after:function(e){return this.each(function(n){t(v.create(e),function(e){n[w].insertBefore(e,n.nextSibling)})})},insertBefore:function(e,t){return s.call(this,e,t,function(e,t){e[w].insertBefore(t,e)})},insertAfter:function(e,t){return s.call(this,e,t,function(e,t){var n=e.nextSibling;n?e[w].insertBefore(t,n):e[w].appendChild(t)})},css:function(e,t,r){function i(e,t,r){for(var i in s)s.hasOwnProperty(i)&&(r=s[i],(t=n(i))&&O.test(r)&&!(t in H)&&(r+=M),t=t=="transform"?B:t,t=t=="transformOrigin"?B+"Origin":t,e.style[t]=r)}if(t===undefined&&typeof e=="string")return t=this[0],t?t==y||t==g?(r=t==y?v.doc():v.viewport(),e=="width"?r.width:e=="height"?r.height:""):I(t,e):null;var s=e;typeof e=="string"&&(s={},s[e]=t),k&&s.opacity&&(s.filter="alpha(opacity="+s.opacity*100+")",s.zoom=e.zoom||1,delete s.opacity);if(t=s["float"])k?s.styleFloat=t:s.cssFloat=t,delete s["float"];return this.each(i)},offset:function(e,t){if(typeof e=="number"||typeof t=="number")return this.each(function(n){o(n,e,t)});var n=this[0],r=n.offsetWidth,i=n.offsetHeight,s=n.offsetTop,u=n.offsetLeft;while(n=n.offsetParent)s+=n.offsetTop,u+=n.offsetLeft;return{top:s,left:u,height:i,width:r}},attr:function(e,t){var n=this[0];if(typeof e=="string"||e instanceof String)return typeof t=="undefined"?S.test(e)?C.test(e)&&typeof n[e]=="string"?!0:n[e]:n[D](e):this.each(function(n){S.test(e)?n[e]=t:n[_](e,t)});for(var r in e)e.hasOwnProperty(r)&&this.attr(r,e[r]);return this},val:function(e){return typeof e=="string"?this.attr("value",e):this[0].value},removeAttr:function(e){return this.each(function(t){C.test(e)?t[e]=!1:t.removeAttribute(e)})},data:function(e,t){var n=this[0];if(typeof t=="undefined"){n[D]("data-node-uid")||n[_]("data-node-uid",++A);var r=n[D]("data-node-uid");return L[r]||(L[r]={}),L[r][e]}return this.each(function(n){n[D]("data-node-uid")||n[_]("data-node-uid",++A);var r=n[D]("data-node-uid"),i=L[r]||(L[r]={});i[e]=t})},remove:function(){return this.each(function(e){e[w]&&e[w].removeChild(e)})},empty:function(){return this.each(function(e){while(e.firstChild)e.removeChild(e.firstChild)})},detach:function(){return this.map(function(e){return e[w].removeChild(e)})},scrollTop:function(e){return h.call(this,null,e,"y")},scrollLeft:function(e){return h.call(this,e,null,"x")},toggle:function(e){return this.each(function(e){e.style.display=e.offsetWidth||e.offsetHeight?"none":"block"}),e&&e(),this}},v.setQueryEngine=function(e){E=e,delete v.setQueryEngine},v.aug=function(e,t){for(var n in e)e.hasOwnProperty(n)&&((t||l.prototype)[n]=e[n])},v.create=function(e){return typeof e=="string"?function(){var t=/^<([^\s>]+)/.exec(e),n=y.createElement(t&&N[t[1].toLowerCase()]||"div"),r=[];n.innerHTML=e;var i=n.childNodes;n=n.firstChild,r.push(n);while(n=n.nextSibling)n.nodeType==1&&r.push(n);return r}():r(e)?[e.cloneNode(!0)]:[]},v.doc=function(){var e=this.viewport();return{width:Math.max(y.body.scrollWidth,b.scrollWidth,e.width),height:Math.max(y.body.scrollHeight,b.scrollHeight,e.height)}},v.firstChild=function(e){for(var t=e.childNodes,n=0,r=t&&t.length||0,i;n<r;n++)t[n].nodeType===1&&(i=t[r=n]);return i},v.viewport=function(){return{width:k?b.clientWidth:self.innerWidth,height:k?b.clientHeight:self.innerHeight}},v.isAncestor="compareDocumentPosition"in b?function(e,t){return(e.compareDocumentPosition(t)&16)==16}:"contains"in b?function(e,t){return e!==t&&e.contains(t)}:function(e,t){while(t=t[w])if(t===e)return!0;return!1};var q=m.bonzo;return v.noConflict=function(){return m.bonzo=q,this},v});var envision={_:Flotr._,bean:Flotr.bean,bonzo:bonzo,noConflict:function(e){var t=e.envision;return function(){return e.envision=t,this}}(this)};(function(){function r(e){this.options=e||{},this.components=[],this.node=null,this.rendered=!1}var e="envision-first",t="envision-last",n='<div class="envision-visualization"></div>';T_COMPONENT_CONTAINER='<div class="envision-component-container"></div>',r.prototype={render:function(e){var t=this.options;e=e||t.element;if(!e)throw"No element to render within.";return this.node=bonzo.create(n)[0],bonzo(this.node).addClass(t.name||""),this.container=e,bonzo(e).append(this.node),bonzo(e).data("envision",this),_.each(this.components,function(e){this._renderComponent(e)},this),this._updateClasses(),this.rendered=!0,this},add:function(e){return this.components.push(e),this.rendered&&(this._renderComponent(e),this._updateClasses()),this},remove:function(e){var t=this.components,n=this.indexOf(e);return n!==-1&&(t.splice(n,1),bonzo(e.container).remove(),this._updateClasses()),this},setPosition:function(e,t){var n=this.components;return t>=0&&t<n.length&&this.remove(e)&&(this.rendered&&(t===n.length?this.node.appendChild(e.container):this.node.insertBefore(e.container,n[t].container)),n.splice(t,0,e),this._updateClasses()),this},indexOf:function(e){return _.indexOf(this.components,e)},getComponent:function(e){var t=this.components;if(e<t.length)return t[e]},isFirst:function(e){return this.indexOf(e)===0?!0:!1},isLast:function(e){return this.indexOf(e)===this.components.length-1?!0:!1},destroy:function(){_.each(this.components,function(e){e.destroy()}),bonzo(this.container).empty()},_renderComponent:function(e){var t=bonzo.create(T_COMPONENT_CONTAINER)[0];bonzo(this.node).append(t),e.render(t)},_updateClasses:function(){var n=this.components,r=0,i=n.length-1,s;_.each(n,function(n,o){s=bonzo(n.container),o===r?s.addClass(e):s.removeClass(e),o===i?s.addClass(t):s.removeClass(t)})}},envision.Visualization=r})(),function(){function r(t){t=t||{};var r=bonzo.create(n)[0];this.options=t,this.node=r,t.adapter?this.api=t.adapter:t.adapterConstructor?this.api=new t.adapterConstructor(t.config):t.adapterCallback?this.api=t.adapterCallback.call(null,t.config):t.config&&(this.api=new e.adapters.flotr.Child(t.config||{})),this.preprocessors=[]}var e=envision,t="envision-component",n='<div class="'+t+'"></div>';r.prototype={render:function(e){var t=this.node,n=this.options;e=e||n.element;if(!e)throw"No element to render within.";bonzo(e).addClass(n.name||"").append(this.node),this._setDimension("width"),this._setDimension("height"),this.container=e,this.draw(n.data,n.config)},draw:function(t,n){var r=this.api,i=this.options,s=this.preprocessors,o;o=t=t||i.data,n=n||i.config,!i.skipPreprocess&&t&&(o=[],_.each(r.getDataArray(t),function(u,a){var f=s[a]||new e.Preprocessor,l=_.isArray(u),c=_.isFunction(u),h=l?u:c?u:u.data,p=i.processData,d=r.range(n),v=d.min,m=d.max,g=this.node.clientWidth,y=u,b,w;!c&&!l&&(y=u.data,w=_.extend({},u)),c?b=t(v,m,g):(y!==f.data?f.setData(y):f.reset(),p?(p.apply(this,[{preprocessor:f,min:v,max:m,resolution:g}]),b=f.getData()):b=f.bound(v,m).subsampleMinMax(g).getData()),r.transformData&&(b=r.transformData(b)),w?(w.data=b,o.push(w)):o.push(b)},this)),r&&r.draw(o,n,this.node)},trigger:function(){this.api.trigger.apply(this.api,Array.prototype.concat.apply([this],arguments))},attach:function(){this.api.attach.apply(this.api,Array.prototype.concat.apply([this],arguments))},detach:function(){this.api.detach.apply(this.api,Array.prototype.concat.apply([this],arguments))},destroy:function(){this.api&&this.api.destroy&&this.api.destroy(),bonzo(this.container).empty()},_setDimension:function(e){var t=this.node,n=this.options;n[e]?bonzo(t).css(e,n[e]):n[e]=t.clientWidth,this[e]=n[e]}},e.Component=r}(),function(){function t(e){this.options=e=e||{},this.actions=[],this.actionOptions=[],this.followers=[],this.leaders=[],this.prevent={},e.leader&&this.leader(e.leader)}var e=envision;t.prototype={leader:function(e){return this.leaders.push(e),_.each(this.actions,function(t,n){this._bindLeader(e,t,this.actionOptions[n])},this),this},follower:function(e){return this.followers.push(e),this},group:function(e){return _.isArray(e)||(e=[e]),_.each(e,function(e){this.leader(e),this.follower(e)},this),this},add:function(e,t){return this.actions.push(e),this.actionOptions.push(t),_.each(this.leaders,function(n){this._bindLeader(n,e,t)},this),this},_bindLeader:function(e,t,n){_.each(t.events,function(t){var r=t.handler||t,i=t.consumer||t;e.attach(r,_.bind(function(e,t){if(this.prevent[name])return;n&&n.callback&&n.callback.call(this,t),this.prevent[name]=!0;try{_.each(this.followers,function(n){if(e===n)return;n.trigger(i,t)},this)}catch(r){throw this.prevent[name]=!1,r}this.prevent[name]=!1},this))},this)}},e.Interaction=t}(),function(){function e(e){e=e||{},this.getData=function(){return this.bounded&&r(this),this.processing},this.reset=function(){return this.processing=this.data,this},this.setData=function(e){var t,n;if(!_.isArray(e))throw new Error("Array expected.");if(e.length<2)throw new Error("Data must contain at least two dimensions.");n=e[0].length;for(t=e.length;t--;){if(!_.isArray(e[t]))throw new Error("Data dimensions must be arrays.");if(e[t].length!==n)throw new Error("Data dimensions must contain the same number of points.")}return this.processing=e,this.data=e,this},e.data&&this.setData(e.data)}function t(e,t){var n=_.sortedIndex(e,t);return e[n]>t&&n>0&&n--,n}function n(e,t){return _.sortedIndex(e,t)}function r(e){delete e.bounded;var r=e.processing,i=e.length(),s=r[0],o=r[1],u=e.min||0,a=e.max||i,f=t(s,u),l=n(s,a);e.processing=[s.slice(f,l+1),o.slice(f,l+1)],e.start=f,e.end=l}function i(e,t,n,r,i,s,o,u,a){var f=(e-r)/(s-r),l=1-f,c=(1+2*f)*l*l,h=f*l*l,p=f*f*(3-2*f),d=f*f*(f-1),v=(o-i)/(2*(s-r))+(typeof n=="undefined"?0:(i-n)/(2*(r-t))),m=(typeof a=="undefined"?0:(a-o)/(2*(u-s)))+(o-i)/(2*(s-r)),g=c*i+h*(s-r)*v+p*o+d*(s-r)*m;return g}e.prototype={length:function(){return this.getData()[0].length},bound:function(e,t){return!_.isNumber(e)||!_.isNumber(t)?this:(this.min=e,this.max=t,this.bounded=!0,this)},subsampleMinMax:function(e){var r=this.bounded;delete this.bounded;var i=this.processing,s=this.length(),o=i[0],u=i[1],a=r?t(o,this.min):0,f=r?n(o,this.max):s-1,l=(e-2)/2,c=[],h=[],p=Number.MAX_VALUE,d=-Number.MAX_VALUE,v=1,m=1,g=(f-a)/l,y,b,w,E;if(f-a+1>e){c.push(o[a]),h.push(u[a]),y=a+g;for(w=a;w<f;w++)w===Math.round(y)?(y+=g,E=Math.min(m,v),c.push(o[E]),h.push(u[E]),E=Math.max(m,v),c.push(o[E]),h.push(u[E]),v=w,p=u[v],m=w,d=u[m]):(u[w]>d&&(d=u[w],m=w),u[w]<p&&(p=u[w],v=w));w<y&&(c.push(o[v]),h.push(p),c.push(o[m]),h.push(d)),c.push(o[f]),h.push(u[f]),this.processing=[c,h],this.start=a,this.end=f}else this.bounded=r;return this},subsample:function(e){var r=this.bounded;delete this.bounded;var i=this.processing,s=this.length(),o=i[0],u=i[1],a=r?t(o,this.min):0,f=r?n(o,this.max):s-1,l=(f-a+1)/e,c=[],h=[],p,d;if(f-a+1>e){c.push(o[a]),h.push(u[a]);for(p=1;p<e;p++){if(p*l>=f-l)break;d=Math.round(p*l)+a,c.push(o[d]),h.push(u[d])}c.push(o[f]),h.push(u[f]),this.processing=[c,h],this.start=a,this.end=f}else this.bounded=r;return this},interpolate:function(e){var r=this.bounded;delete this.bounded;var s=this.processing,o=this.length(),u=s[0],a=s[1],f=r?t(u,this.min):0,l=r?n(u,this.max):o-1,c=(u[l]-u[f])/e,h=[],p=[],d,v,m;h.push(u[f]),p.push(a[f]);if(l-f+1<e){for(d=f;d<l;d++){m=u[d+1]-u[d],h.push(u[d]),p.push(a[d]);for(v=u[d+0]+c;v<u[d+1];v+=c)h.push(v),p.push(i(v,u[d-1],a[d-1],u[d+0],a[d+0],u[d+1],a[d+1],u[d+2],a[d+2]))}this.processing=[h,p],this.start=f,this.end=l}return this}},envision.Preprocessor=e}(),envision.actions=envision.actions||{},envision.actions.hit={events:["hit","mouseout"]},envision.actions.selection={events:[{handler:"select",consumer:"zoom"},{handler:"click",consumer:"reset"}]},envision.actions.zoom={events:[{handler:"select",consumer:"zoom"},"zoom","reset"]},envision.adapters=envision.adapters||{},envision.adapters.flotr={},envision.adapters.defaultOptions={grid:{outlineWidth:0,labelMargin:0,horizontalLines:!1,verticalLines:!1},bars:{show:!1,barWidth:.5,fill:!0,lineWidth:1,fillOpacity:1},lines:{lineWidth:1},xaxis:{margin:!1,tickDecimals:0,showLabels:!1},yaxis:{margin:!1,showLabels:!1},shadowSize:!1},function(){function i(e){this.options=e||{},this.flotr=null,this._flotrDefaultOptions()}function s(e,t){var n=e.options.config.selection.mode,r=e.api.flotr.axes,i,s,o,u,a;return n.indexOf("x")!==-1&&(i={},i.min=t.x1,i.max=t.x2,o={},o.min=r.x.d2p(t.x1),o.max=r.x.d2p(t.x2)),n.indexOf("y")!==-1&&(s={},s.min=t.y1,s.max=t.y2,u={},u.min=r.y.d2p(t.y1),u.max=r.y.d2p(t.y2)),a={data:{x:i,y:s},x:o,y:u},a}var e=envision,t=envision.adapters,n=Flotr.EventAdapter,r=t.defaultOptions;i.prototype={destroy:function(){this.flotr.destroy()},draw:function(e,t,n){var r=this.options;e=this.getDataArray(e||r.data),t?t=Flotr.merge(t,Flotr.clone(r)):t=r,r.data=e;if(!t)throw"No graph submitted.";this.flotr=Flotr.draw(n,e,t)},range:function(e){var t=e.xaxis;return{min:t.min,max:t.max}},transformData:function(e){var t=e[0].length,n=e.length,r=[],i,s,o;for(s=0;s<t;s++){i=[];for(o=0;o<n;o++)i.push(e[o][s]);r.push(i)}return r},getDataArray:function(e){return e[0]&&(!_.isArray(e[0])||!e[0].length||e[0][0]&&_.isArray(e[0][0]))?e:[e]},_flotrDefaultOptions:function(e){var t=e||this.options,n;for(n in r)r.hasOwnProperty(n)&&(_.isUndefined(t[n])?t[n]=r[n]:_.defaults(t[n],r[n]))},attach:function(e,t,r){var i=this.events[t]||{},s=i.handler||!1;return t=i.name||!1,s?n.observe(e.node,t,function(){var t=[e].concat(Array.prototype.slice.call(arguments)),n=s.apply(this,t);return r.apply(null,[e,n])}):!1},detach:function(e,t,r){return n.stopObserve(e.node,t,handler)},trigger:function(e,t,n){var r=this.events[t],i=r.consumer||!1;return i?i.apply(this,[e,n]):!1},events:{hit:{name:"flotr:hit",handler:function(e,t){var n=t.x,r=t.y,i=e.api.flotr,s;return s={data:{index:t.index,x:n,y:r},x:i.axes.x.d2p(n),y:i.axes.y.d2p(r)},s},consumer:function(e,t){var n=e.api.flotr,r;r={x:t.data.x,y:t.data.y||1,relX:t.x,relY:t.y||1},n.hit.hit(r)}},select:{name:"flotr:selecting",handler:s,consumer:function(e,t){var n=e.api.flotr,r=n.axes,i=t.data||{},s={},o=t.x,u=t.y;!o&&i.x?(o=i.x,s.x1=o.min,s.x2=o.max):o&&(s.x1=r.x.p2d(o.min),s.x2=r.x.p2d(o.max)),!u&&i.y?(u=i.y,s.y1=u.min,s.y2=u.max):u&&(s.y1=r.y.d2p(u.min),s.y2=r.y.d2p(u.max)),n.selection.setSelection(s)}},zoom:{name:"flotr:select",handler:function(e,t){var n=s(e,t);return e.trigger("zoom",n),n},consumer:function(e,t){var n=t.data.x,r=t.data.y,i={};n&&(i.xaxis={min:n.min,max:n.max}),r&&(i.yaxis={min:r.min,max:r.max}),e.draw(null,i)}},mouseout:{name:"flotr:mouseout",handler:function(e){},consumer:function(e){e.api.flotr.hit.clearHit()}},reset:{name:"flotr:click",handler:function(e){e.draw()},consumer:function(e){e.draw()}},click:{name:"flotr:click",handler:function(e){var t=e.api.flotr.axes.x.min,n=e.api.flotr.axes.x.max;return{data:{x:{min:t,max:n}},x:{min:e.api.flotr.axes.x.d2p(t),max:e.api.flotr.axes.x.d2p(n)}}},consumer:function(e,t){var n=t.data.x,r=t.data.y,i={};n&&(i.xaxis={min:n.min,max:n.max}),r&&(i.yaxis={min:r.min,max:r.max}),e.draw(null,i)}}}},t.flotr.Child=i}(),Flotr.addType("lite-lines",{options:{show:!1,lineWidth:2,fill:!1,fillBorder:!1,fillColor:null,fillOpacity:.4},draw:function(e){var t=e.context,n=e.lineWidth,r=e.shadowSize,i;t.save(),t.lineCap="butt",t.lineWidth=n,t.strokeStyle=e.color,this.plot(e),t.restore()},plot:function(e){var t=e.context,n=e.xScale,r=e.yScale,s=e.data,o=s.length-1,u=r(0),a,f;if(o<1)return;a=n(s[0][0]),f=r(s[0][1]),t.beginPath(),t.moveTo(a,f);for(i=0;i<o;++i)t.lineTo(n(s[i+1][0]),r(s[i+1][1]));(!e.fill||e.fill&&!e.fillBorder)&&t.stroke(),e.fill&&(a=n(s[0][0]),t.fillStyle=e.fillStyle,t.lineTo(n(s[o][0]),u),t.lineTo(a,u),t.lineTo(a,r(s[0][1])),t.fill(),e.fillBorder&&t.stroke())},extendYRange:function(e,t,n,r){var i=e.options;if(!i.max&&i.max!==0||!i.min&&i.min!==0)e.max+=n.lineWidth*.01,e.min-=n.lineWidth*.01}}),Flotr.addType("whiskers",{options:{show:!1,lineWidth:2,barWidth:1,fill:!0,fillColor:null,fillOpacity:.4,horizontal:!1,stacked:!1,centered:!0},stack:{positive:[],negative:[],_positive:[],_negative:[]},draw:function(e){var t=e.context;t.save(),t.lineJoin="miter",t.lineCap="butt",t.lineWidth=e.lineWidth,t.strokeStyle=e.color,e.fill&&(t.fillStyle=e.fillStyle),this.plot(e),t.restore()},plot:function(e){var t=e.data,n=e.context,r=e.shadowSize,i=e.xScale,s=e.yScale,o=s(0),u,a;if(t.length<1)return;n.translate(-e.lineWidth,0),n.beginPath();for(u=0;u<t.length;u++)a=i(t[u][0]),n.moveTo(a,o),n.lineTo(a,s(t[u][1]));n.closePath(),n.stroke()},drawHit:function(e){var t=e.args,n=e.context,r=e.shadowSize,i=e.xScale,s=e.yScale,o=s(0),u=i(t.x),a=s(t.y);n.save(),n.translate(-e.lineWidth,0),n.beginPath(),n.moveTo(u,o),n.lineTo(u,a),n.closePath(),n.stroke(),n.restore()},clearHit:function(e){var t=e.args,n=e.context,r=e.shadowSize,i=e.xScale,s=e.yScale,o=e.lineWidth,u=s(0),a=i(t.x),f=s(t.y);n.save(),n.clearRect(a-2*o,f-o,4*o,u-f+o),n.restore()}}),envision.components=envision.components||{},function(){function e(e){this.options=e||{}}e.prototype={height:null,width:null,rendered:!1,render:function(e){var t=document.createElement("canvas"),n=bonzo(e).offset();this.height=n.height,this.width=n.width,bonzo(t).attr("height",n.height).attr("width",n.width).css({position:"absolute",top:"0px",left:"0px"}),e.appendChild(t),bonzo(e).css({position:"relative"}),typeof FlashCanvas!="undefined"&&FlashCanvas.initElement(t),this.context=t.getContext("2d"),this.rendered=!0},draw:function(e,t,n){this.rendered||this.render(n);var r=this.context,i=this.height,s=this.width,o=Math.round(i/2)-.5,u,a;t=t||{min:s/2,max:s/2},u=t.min+.5,a=t.max+.5,r.clearRect(0,0,s,i);if(u||a)r.save(),r.strokeStyle=this.options.strokeStyle||"#B6D9FF",r.fillStyle=this.options.fillStyle||"rgba(182, 217, 255, .4)",r.beginPath(),u<=1?(r.moveTo(0,i),r.lineTo(0,-0.5)):(r.moveTo(u,i),r.quadraticCurveTo(u,o,Math.max(u-o,u/2),o),r.lineTo(Math.min(o,u/2),o),r.quadraticCurveTo(0,o,.5,-0.5)),r.lineTo(s-.5,-0.5),a>=s-1?r.lineTo(a,i):(r.quadraticCurveTo(s,o,Math.max(s-o,s-(s-a)/2),o),r.lineTo(Math.min(a+o,s-(s-a)/2),o),r.quadraticCurveTo(a,o,a,i)),r.stroke(),r.closePath(),r.fill(),r.restore()},trigger:function(e,t,n){t==="zoom"?this.zoom(e,n):t==="reset"&&this.reset(e)},zoom:function(e,t){var n=t.x||{},r=n.min,i=n.max,s=e.api;e.draw(null,{min:r,max:i})},reset:function(e){e.draw(null,{min:e.width/2,max:e.width/2})}},envision.components.QuadraticDrawing=e}(),envision.templates=envision.templates||{},function(){function t(e){var t=e.resolution;e.preprocessor.bound(e.min,e.max).subsampleMinMax(t+Math.round(t/3))}function n(){return{price:{name:"envision-finance-price",config:{"lite-lines":{lineWidth:1,show:!0,fill:!0,fillOpacity:.2},mouse:{track:!0,trackY:!1,trackAll:!0,sensibility:1,trackDecimals:4,position:"ne"},yaxis:{autoscale:!0,autoscaleMargin:.05,noTicks:4,showLabels:!0,min:0}},processData:t},volume:{name:"envision-finance-volume",config:{whiskers:{show:!0,lineWidth:2},mouse:{track:!0,trackY:!1,trackAll:!0},yaxis:{autoscale:!0,autoscaleMargin:.5}},processData:t},summary:{name:"envision-finance-summary",config:{"lite-lines":{show:!0,lineWidth:1,fill:!0,fillOpacity:.2,fillBorder:!0},xaxis:{noTicks:5,showLabels:!0},yaxis:{autoscale:!0,autoscaleMargin:.1},handles:{show:!0},selection:{mode:"x"},grid:{verticalLines:!1}}},connection:{name:"envision-finance-connection",adapterConstructor:e.components.QuadraticDrawing}}}function r(t){var r=t.data,i=n(),s=new e.Visualization({name:"envision-finance"}),o=new e.Interaction,u=new e.Interaction,a,f,l,c;t.defaults&&(i=Flotr.merge(t.defaults,i)),i.price.data=r.price,i.volume.data=r.volume,i.summary.data=r.summary,i.price.config.mouse.trackFormatter=t.trackFormatter||function(e){var t=e.index,n;return a.api.preprocessor&&(t+=a.api.preprocessor.start),n="Price: $"+r.price[1][t]+", Vol: "+r.volume[1][t],n},t.xTickFormatter&&(i.summary.config.xaxis.tickFormatter=t.xTickFormatter),i.price.config.yaxis.tickFormatter=t.yTickFormatter||function(e){return"$"+e},a=new e.Component(i.price),f=new e.Component(i.volume),l=new e.Component(i.connection),c=new e.Component(i.summary),s.add(a).add(f).add(l).add(c).render(t.container),o.follower(a).follower(f).follower(l).leader(c).add(e.actions.selection,t.selectionCallback?{callback:t.selectionCallback}:null),u.group([a,f]).add(e.actions.hit),t.selection&&c.trigger("select",t.selection),this.vis=s,this.selection=o,this.hit=u,this.price=a,this.volume=f,this.summary=c}var e=envision;e.templates.Finance=r}(),function(){function t(){return{detail:{name:"envision-timeseries-detail",config:{"lite-lines":{lineWidth:1,show:!0}}},summary:{name:"envision-timeseries-summary",config:{"lite-lines":{lineWidth:1,show:!0},handles:{show:!0},selection:{mode:"x"},yaxis:{autoscale:!0,autoscaleMargin:.1}}},connection:{name:"envision-timeseries-connection",adapterConstructor:e.components.QuadraticDrawing}}}function n(n){var r=n.data,i=t(),s=new e.Visualization({name:"envision-timeseries"}),o=new e.Interaction,u,a,f;n.defaults&&(i=Flotr.merge(n.defaults,i)),i.detail.data=r.detail,i.summary.data=r.summary,u=new e.Component(i.detail),f=new e.Component(i.connection),a=new e.Component(i.summary),s.add(u).add(f).add(a).render(n.container),o.follower(u).follower(f).leader(a).add(e.actions.selection,n.selectionCallback?{callback:n.selectionCallback}:null),n.selection&&a.trigger("select",n.selection),this.vis=s,this.selection=o,this.detail=u,this.summary=a}var e=envision;e.templates.TimeSeries=n}(),function(){function n(){return{name:"zoom"}}function r(){return{name:"summary",config:{handles:{show:!0},selection:{mode:"x"}}}}function i(e,t){var n=_.defaults(e,t);return n.flotr=_.defaults(n.flotr,t.flotr),n}var e=envision,t;t=function(t){var s=new e.Visualization,o=new e.Component(i(t.zoom||{},n())),u=new e.Component(i(t.summary||{},r())),a=new e.Interaction({leader:u});s.add(o).add(u),a.add(e.actions.selection),a.follower(o),this.vis=s,this.interaction=a,t.container&&this.render(t.container)},t.prototype={render:function(e){this.vis.render(e)}},e.templates.Zoom=t}(),function(){function e(e){return e.target}function t(e){return e.source}function n(e,t){try{for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}catch(r){e.prototype=t}}function r(e){var t=-1,n=e.length,r=[];while(++t<n)r.push(e[t]);return r}function i(e){return Array.prototype.slice.call(e)}function s(){}function o(e){return e}function u(){return!0}function a(e){return typeof e=="function"?e:function(){return e}}function f(e,t,n){return function(){var r=n.apply(t,arguments);return arguments.length?e:r}}function l(e){return e!=null&&!isNaN(e)}function c(e){return e.length}function h(e){return e.trim().replace(/\s+/g," ")}function p(e){var t=1;while(e*t%1)t*=10;return t}function d(e){return e.length===1?function(t,n){e(t==null?n:null)}:e}function v(e){return e.responseText}function m(e){return JSON.parse(e.responseText)}function g(e){var t=document.createRange();return t.selectNode(document.body),t.createContextualFragment(e.responseText)}function y(e){return e.responseXML}function b(){}function w(e){function t(){var t=n,r=-1,i=t.length,s;while(++r<i)(s=t[r].on)&&s.apply(this,arguments);return e}var n=[],r=new s;return t.on=function(t,i){var s=r.get(t),o;return arguments.length<2?s&&s.on:(s&&(s.on=null,n=n.slice(0,o=n.indexOf(s)).concat(n.slice(o+1)),r.remove(t)),i&&n.push(r.set(t,{on:i})),e)},t}function E(e,t){return t-(e?1+Math.floor(Math.log(e+Math.pow(10,1+Math.floor(Math.log(e)/Math.LN10)-t))/Math.LN10):1)}function S(e){return e+""}function x(e,t){var n=Math.pow(10,Math.abs(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function T(e){return function(t){return t<=0?0:t>=1?1:e(t)}}function N(e){return function(t){return 1-e(1-t)}}function C(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*
t))}}function k(e){return e*e}function L(e){return e*e*e}function A(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function O(e){return function(t){return Math.pow(t,e)}}function M(e){return 1-Math.cos(e*cr/2)}function _(e){return Math.pow(2,10*(e-1))}function D(e){return 1-Math.sqrt(1-e*e)}function P(e,t){var n;return arguments.length<2&&(t=.45),arguments.length?n=t/(2*cr)*Math.asin(1/e):(e=1,n=t/4),function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*cr/t)}}function H(e){return e||(e=1.70158),function(t){return t*t*((e+1)*t-e)}}function B(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function j(){d3.event.stopPropagation(),d3.event.preventDefault()}function F(){var e=d3.event,t;while(t=e.sourceEvent)e=t;return e}function I(e){var t=new b,n=0,r=arguments.length;while(++n<r)t[arguments[n]]=w(t);return t.of=function(n,r){return function(i){try{var s=i.sourceEvent=d3.event;i.target=e,d3.event=i,t[i.type].apply(n,r)}finally{d3.event=s}}},t}function q(e){var t=[e.a,e.b],n=[e.c,e.d],r=U(t),i=R(t,n),s=U(z(n,t,-i))||0;t[0]*n[1]<n[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,i*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-n[0],n[1]))*dr,this.translate=[e.e,e.f],this.scale=[r,s],this.skew=s?Math.atan2(i,s)*dr:0}function R(e,t){return e[0]*t[0]+e[1]*t[1]}function U(e){var t=Math.sqrt(R(e,e));return t&&(e[0]/=t,e[1]/=t),t}function z(e,t,n){return e[0]+=n*t[0],e[1]+=n*t[1],e}function W(e){return e=="transform"?d3.interpolateTransform:d3.interpolate}function X(e,t){return t=t-(e=+e)?1/(t-e):0,function(n){return(n-e)*t}}function V(e,t){return t=t-(e=+e)?1/(t-e):0,function(n){return Math.max(0,Math.min(1,(n-e)*t))}}function $(){}function J(e,t,n){return new K(e,t,n)}function K(e,t,n){this.r=e,this.g=t,this.b=n}function Q(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function G(e,t,n){var r=0,i=0,s=0,o,u,a;o=/([a-z]+)\((.*)\)/i.exec(e);if(o){u=o[2].split(",");switch(o[1]){case"hsl":return n(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(tt(u[0]),tt(u[1]),tt(u[2]))}}return(a=Pr.get(e))?t(a.r,a.g,a.b):(e!=null&&e.charAt(0)==="#"&&(e.length===4?(r=e.charAt(1),r+=r,i=e.charAt(2),i+=i,s=e.charAt(3),s+=s):e.length===7&&(r=e.substring(1,3),i=e.substring(3,5),s=e.substring(5,7)),r=parseInt(r,16),i=parseInt(i,16),s=parseInt(s,16)),t(r,i,s))}function Y(e,t,n){var r=Math.min(e/=255,t/=255,n/=255),i=Math.max(e,t,n),s=i-r,o,u,a=(i+r)/2;return s?(u=a<.5?s/(i+r):s/(2-i-r),e==i?o=(t-n)/s+(t<n?6:0):t==i?o=(n-e)/s+2:o=(e-t)/s+4,o*=60):u=o=0,nt(o,u,a)}function Z(e,t,n){e=et(e),t=et(t),n=et(n);var r=pt((.4124564*e+.3575761*t+.1804375*n)/Fr),i=pt((.2126729*e+.7151522*t+.072175*n)/Ir),s=pt((.0193339*e+.119192*t+.9503041*n)/qr);return at(116*i-16,500*(r-i),200*(i-s))}function et(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function tt(e){var t=parseFloat(e);return e.charAt(e.length-1)==="%"?Math.round(t*2.55):t}function nt(e,t,n){return new rt(e,t,n)}function rt(e,t,n){this.h=e,this.s=t,this.l=n}function it(e,t,n){function r(e){return e>360?e-=360:e<0&&(e+=360),e<60?s+(o-s)*e/60:e<180?o:e<240?s+(o-s)*(240-e)/60:s}function i(e){return Math.round(r(e)*255)}var s,o;return e%=360,e<0&&(e+=360),t=t<0?0:t>1?1:t,n=n<0?0:n>1?1:n,o=n<=.5?n*(1+t):n+t-n*t,s=2*n-o,J(i(e+120),i(e),i(e-120))}function st(e,t,n){return new ot(e,t,n)}function ot(e,t,n){this.h=e,this.c=t,this.l=n}function ut(e,t,n){return at(n,Math.cos(e*=pr)*t,Math.sin(e)*t)}function at(e,t,n){return new ft(e,t,n)}function ft(e,t,n){this.l=e,this.a=t,this.b=n}function lt(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;return i=ht(i)*Fr,r=ht(r)*Ir,s=ht(s)*qr,J(dt(3.2404542*i-1.5371385*r-.4985314*s),dt(-0.969266*i+1.8760108*r+.041556*s),dt(.0556434*i-.2040259*r+1.0572252*s))}function ct(e,t,n){return st(Math.atan2(n,t)/cr*180,Math.sqrt(t*t+n*n),e)}function ht(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function pt(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function dt(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function vt(e){return gr(e,$r),e}function mt(e){return function(){return Ur(e,this)}}function gt(e){return function(){return zr(e,this)}}function yt(e,t){function n(){this.removeAttribute(e)}function r(){this.removeAttributeNS(e.space,e.local)}function i(){this.setAttribute(e,t)}function s(){this.setAttributeNS(e.space,e.local,t)}function o(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}function u(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}return e=d3.ns.qualify(e),t==null?e.local?r:n:typeof t=="function"?e.local?u:o:e.local?s:i}function bt(e){return new RegExp("(?:^|\\s+)"+d3.requote(e)+"(?:\\s+|$)","g")}function wt(e,t){function n(){var n=-1;while(++n<i)e[n](this,t)}function r(){var n=-1,r=t.apply(this,arguments);while(++n<i)e[n](this,r)}e=e.trim().split(/\s+/).map(Et);var i=e.length;return typeof t=="function"?r:n}function Et(e){var t=bt(e);return function(n,r){if(i=n.classList)return r?i.add(e):i.remove(e);var i=n.className,s=i.baseVal!=null,o=s?i.baseVal:i;r?(t.lastIndex=0,t.test(o)||(o=h(o+" "+e),s?i.baseVal=o:n.className=o)):o&&(o=h(o.replace(t," ")),s?i.baseVal=o:n.className=o)}}function St(e,t,n){function r(){this.style.removeProperty(e)}function i(){this.style.setProperty(e,t,n)}function s(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}return t==null?r:typeof t=="function"?s:i}function xt(e,t){function n(){delete this[e]}function r(){this[e]=t}function i(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}return t==null?n:typeof t=="function"?i:r}function Tt(e){return{__data__:e}}function Nt(e){return function(){return Vr(this,e)}}function Ct(e){return arguments.length||(e=d3.ascending),function(t,n){return e(t&&t.__data__,n&&n.__data__)}}function kt(e,t,n){function r(){var t=this[s];t&&(this.removeEventListener(e,t,t.$),delete this[s])}function i(){function i(e){var n=d3.event;d3.event=e,u[0]=o.__data__;try{t.apply(o,u)}finally{d3.event=n}}var o=this,u=vr(arguments);r.call(this),this.addEventListener(e,this[s]=i,i.$=n),i._=t}var s="__on"+e,o=e.indexOf(".");return o>0&&(e=e.substring(0,o)),t?i:r}function Lt(e,t){for(var n=0,r=e.length;n<r;n++)for(var i=e[n],s=0,o=i.length,u;s<o;s++)(u=i[s])&&t(u,s,n);return e}function At(e){return gr(e,Kr),e}function Ot(e,t){return gr(e,Qr),e.id=t,e}function Mt(e,t,n,r){var i=e.__transition__||(e.__transition__={active:0,count:0}),o=i[n];if(!o){var u=r.time;return o=i[n]={tween:new s,event:d3.dispatch("start","end"),time:u,ease:r.ease,delay:r.delay,duration:r.duration},++i.count,d3.timer(function(r){function s(r){return i.active>n?f():(i.active=n,h.start.call(e,l,t),o.tween.forEach(function(n,r){(r=r.call(e,l,t))&&v.push(r)}),a(r)||d3.timer(a,0,u),1)}function a(r){if(i.active!==n)return f();var s=(r-p)/d,o=c(s),u=v.length;while(u>0)v[--u].call(e,o);if(s>=1)return f(),h.end.call(e,l,t),1}function f(){return--i.count?delete i[n]:delete e.__transition__,1}var l=e.__data__,c=o.ease,h=o.event,p=o.delay,d=o.duration,v=[];return p<=r?s(r):d3.timer(s,p,u),1},0,u),o}}function _t(e){return e==null&&(e=""),function(){this.textContent=e}}function Dt(e,t,n,r){var i=e.id;return Lt(e,typeof n=="function"?function(e,s,o){e.__transition__[i].tween.set(t,r(n.call(e,e.__data__,s,o)))}:(n=r(n),function(e){e.__transition__[i].tween.set(t,n)}))}function Pt(){var e,t=Date.now(),n=ni;while(n)e=t-n.then,e>=n.delay&&(n.flush=n.callback(e)),n=n.next;var r=Ht()-t;r>24?(isFinite(r)&&(clearTimeout(ii),ii=setTimeout(Pt,r)),ri=0):(ri=1,si(Pt))}function Ht(){var e=null,t=ni,n=Infinity;while(t)t.flush?(delete ti[t.callback.id],t=e?e.next=t.next:ni=t.next):(n=Math.min(n,t.then+t.delay),t=(e=t).next);return n}function Bt(e,t){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();if(oi<0&&(window.scrollX||window.scrollY)){n=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var i=n[0][0].getScreenCTM();oi=!i.f&&!i.e,n.remove()}return oi?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}function jt(){}function Ft(e){var t=e[0],n=e[e.length-1];return t<n?[t,n]:[n,t]}function It(e){return e.rangeExtent?e.rangeExtent():Ft(e.range())}function qt(e,t){var n=0,r=e.length-1,i=e[n],s=e[r],o;s<i&&(o=n,n=r,r=o,o=i,i=s,s=o);if(t=t(s-i))e[n]=t.floor(i),e[r]=t.ceil(s);return e}function Rt(){return Math}function Ut(e,t,n,r){function i(){var i=Math.min(e.length,t.length)>2?Kt:Jt,a=r?V:X;return o=i(e,t,a,n),u=i(t,e,a,d3.interpolate),s}function s(e){return o(e)}var o,u;return s.invert=function(e){return u(e)},s.domain=function(t){return arguments.length?(e=t.map(Number),i()):e},s.range=function(e){return arguments.length?(t=e,i()):t},s.rangeRound=function(e){return s.range(e).interpolate(d3.interpolateRound)},s.clamp=function(e){return arguments.length?(r=e,i()):r},s.interpolate=function(e){return arguments.length?(n=e,i()):n},s.ticks=function(t){return Vt(e,t)},s.tickFormat=function(t){return $t(e,t)},s.nice=function(){return qt(e,Wt),i()},s.copy=function(){return Ut(e,t,n,r)},i()}function zt(e,t){return d3.rebind(e,t,"range","rangeRound","interpolate","clamp")}function Wt(e){return e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1),e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Xt(e,t){var n=Ft(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;return s<=.15?i*=10:s<=.35?i*=5:s<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+i*.5,n[2]=i,n}function Vt(e,t){return d3.range.apply(d3,Xt(e,t))}function $t(e,t){return d3.format(",."+Math.max(0,-Math.floor(Math.log(Xt(e,t)[2])/Math.LN10+.01))+"f")}function Jt(e,t,n,r){var i=n(e[0],e[1]),s=r(t[0],t[1]);return function(e){return s(i(e))}}function Kt(e,t,n,r){var i=[],s=[],o=0,u=Math.min(e.length,t.length)-1;e[u]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());while(++o<=u)i.push(n(e[o-1],e[o])),s.push(r(t[o-1],t[o]));return function(t){var n=d3.bisect(e,t,1,u)-1;return s[n](i[n](t))}}function Qt(e,t){function n(n){return e(t(n))}var r=t.pow;return n.invert=function(t){return r(e.invert(t))},n.domain=function(i){return arguments.length?(t=i[0]<0?Yt:Gt,r=t.pow,e.domain(i.map(t)),n):e.domain().map(r)},n.nice=function(){return e.domain(qt(e.domain(),Rt)),n},n.ticks=function(){var n=Ft(e.domain()),i=[];if(n.every(isFinite)){var s=Math.floor(n[0]),o=Math.ceil(n[1]),u=r(n[0]),a=r(n[1]);if(t===Yt){i.push(r(s));for(;s++<o;)for(var f=9;f>0;f--)i.push(r(s)*f)}else{for(;s<o;s++)for(var f=1;f<10;f++)i.push(r(s)*f);i.push(r(s))}for(s=0;i[s]<u;s++);for(o=i.length;i[o-1]>a;o--);i=i.slice(s,o)}return i},n.tickFormat=function(e,i){arguments.length<2&&(i=ui);if(!arguments.length)return i;var s=Math.max(.1,e/n.ticks().length),o=t===Yt?(u=-1e-12,Math.floor):(u=1e-12,Math.ceil),u;return function(e){return e/r(o(t(e)+u))<=s?i(e):""}},n.copy=function(){return Qt(e.copy(),t)},zt(n,e)}function Gt(e){return Math.log(e<0?0:e)/Math.LN10}function Yt(e){return-Math.log(e>0?0:-e)/Math.LN10}function Zt(e,t){function n(t){return e(r(t))}var r=en(t),i=en(1/t);return n.invert=function(t){return i(e.invert(t))},n.domain=function(t){return arguments.length?(e.domain(t.map(r)),n):e.domain().map(i)},n.ticks=function(e){return Vt(n.domain(),e)},n.tickFormat=function(e){return $t(n.domain(),e)},n.nice=function(){return n.domain(qt(n.domain(),Wt))},n.exponent=function(e){if(!arguments.length)return t;var s=n.domain();return r=en(t=e),i=en(1/t),n.domain(s)},n.copy=function(){return Zt(e.copy(),t)},zt(n,e)}function en(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function tn(e,t){function n(t){return o[((i.get(t)||i.set(t,e.push(t)))-1)%o.length]}function r(t,n){return d3.range(e.length).map(function(e){return t+n*e})}var i,o,u;return n.domain=function(r){if(!arguments.length)return e;e=[],i=new s;var o=-1,u=r.length,a;while(++o<u)i.has(a=r[o])||i.set(a,e.push(a));return n[t.t].apply(n,t.a)},n.range=function(e){return arguments.length?(o=e,u=0,t={t:"range",a:arguments},n):o},n.rangePoints=function(i,s){arguments.length<2&&(s=0);var a=i[0],f=i[1],l=(f-a)/(Math.max(1,e.length-1)+s);return o=r(e.length<2?(a+f)/2:a+l*s/2,l),u=0,t={t:"rangePoints",a:arguments},n},n.rangeBands=function(i,s,a){arguments.length<2&&(s=0),arguments.length<3&&(a=s);var f=i[1]<i[0],l=i[f-0],c=i[1-f],h=(c-l)/(e.length-s+2*a);return o=r(l+h*a,h),f&&o.reverse(),u=h*(1-s),t={t:"rangeBands",a:arguments},n},n.rangeRoundBands=function(i,s,a){arguments.length<2&&(s=0),arguments.length<3&&(a=s);var f=i[1]<i[0],l=i[f-0],c=i[1-f],h=Math.floor((c-l)/(e.length-s+2*a)),p=c-l-(e.length-s)*h;return o=r(l+Math.round(p/2),h),f&&o.reverse(),u=Math.round(h*(1-s)),t={t:"rangeRoundBands",a:arguments},n},n.rangeBand=function(){return u},n.rangeExtent=function(){return Ft(t.a[0])},n.copy=function(){return tn(e,t)},n.domain(e)}function nn(e,t){function n(){var n=0,s=t.length;i=[];while(++n<s)i[n-1]=d3.quantile(e,n/s);return r}function r(e){return isNaN(e=+e)?NaN:t[d3.bisect(i,e)]}var i;return r.domain=function(t){return arguments.length?(e=t.filter(function(e){return!isNaN(e)}).sort(d3.ascending),n()):e},r.range=function(e){return arguments.length?(t=e,n()):t},r.quantiles=function(){return i},r.copy=function(){return nn(e,t)},n()}function rn(e,t,n){function r(t){return n[Math.max(0,Math.min(o,Math.floor(s*(t-e))))]}function i(){return s=n.length/(t-e),o=n.length-1,r}var s,o;return r.domain=function(n){return arguments.length?(e=+n[0],t=+n[n.length-1],i()):[e,t]},r.range=function(e){return arguments.length?(n=e,i()):n},r.copy=function(){return rn(e,t,n)},i()}function sn(e,t){function n(n){return t[d3.bisect(e,n)]}return n.domain=function(t){return arguments.length?(e=t,n):e},n.range=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return sn(e,t)},n}function on(e){function t(e){return+e}return t.invert=t,t.domain=t.range=function(n){return arguments.length?(e=n.map(t),t):e},t.ticks=function(t){return Vt(e,t)},t.tickFormat=function(t){return $t(e,t)},t.copy=function(){return on(e)},t}function un(e){var t=e.source,n=e.target,r=fn(t,n),i=[t];while(t!==r)t=t.parent,i.push(t);var s=i.length;while(n!==r)i.splice(s,0,n),n=n.parent;return i}function an(e){var t=[],n=e.parent;while(n!=null)t.push(e),e=n,n=n.parent;return t.push(e),t}function fn(e,t){if(e===t)return e;var n=an(e),r=an(t),i=n.pop(),s=r.pop(),o=null;while(i===s)o=i,i=n.pop(),s=r.pop();return o}function ln(e){e.fixed|=2}function cn(e){e.fixed&=1}function hn(e){e.fixed|=4,e.px=e.x,e.py=e.y}function pn(e){e.fixed&=3}function dn(e,t,n){var r=0,i=0;e.charge=0;if(!e.leaf){var s=e.nodes,o=s.length,u=-1,a;while(++u<o){a=s[u];if(a==null)continue;dn(a,t,n),e.charge+=a.charge,r+=a.charge*a.cx,i+=a.charge*a.cy}}if(e.point){e.leaf||(e.point.x+=Math.random()-.5,e.point.y+=Math.random()-.5);var f=t*n[e.point.index];e.charge+=e.pointCharge=f,r+=f*e.point.x,i+=f*e.point.y}e.cx=r/e.charge,e.cy=i/e.charge}function vn(){return 20}function mn(){return 1}function gn(e){return e.x}function yn(e){return e.y}function bn(e,t,n){e.y0=t,e.y=n}function wn(e){return d3.range(e.length)}function En(e){var t=-1,n=e[0].length,r=[];while(++t<n)r[t]=0;return r}function Sn(e){var t=1,n=0,r=e[0][1],i,s=e.length;for(;t<s;++t)(i=e[t][1])>r&&(n=t,r=i);return n}function xn(e){return e.reduce(Tn,0)}function Tn(e,t){return e+t[1]}function Nn(e,t){return Cn(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Cn(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function kn(e){return[d3.min(e),d3.max(e)]}function Ln(e,t){return d3.rebind(e,t,"sort","children","value"),e.nodes=e,e.links=_n,e}function An(e){return e.children}function On(e){return e.value}function Mn(e,t){return t.value-e.value}function _n(e){return d3.merge(e.map(function(e){return(e.children||[]).map(function(t){return{source:e,target:t}})}))}function Dn(e,t){return e.value-t.value}function Pn(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function Hn(e,t){e._pack_next=t,t._pack_prev=e}function Bn(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function jn(e){function t(e){r=Math.min(e.x-e.r,r),i=Math.max(e.x+e.r,i),s=Math.min(e.y-e.r,s),o=Math.max(e.y+e.r,o)}if(!(n=e.children)||!(p=n.length))return;var n,r=Infinity,i=-Infinity,s=Infinity,o=-Infinity,u,a,f,l,c,h,p;n.forEach(Fn),u=n[0],u.x=-u.r,u.y=0,t(u);if(p>1){a=n[1],a.x=a.r,a.y=0,t(a);if(p>2){f=n[2],Rn(u,a,f),t(f),Pn(u,f),u._pack_prev=f,Pn(f,a),a=u._pack_next;for(l=3;l<p;l++){Rn(u,a,f=n[l]);var d=0,v=1,m=1;for(c=a._pack_next;c!==a;c=c._pack_next,v++)if(Bn(c,f)){d=1;break}if(d==1)for(h=u._pack_prev;h!==c._pack_prev;h=h._pack_prev,m++)if(Bn(h,f))break;d?(v<m||v==m&&a.r<u.r?Hn(u,a=c):Hn(u=h,a),l--):(Pn(u,f),a=f,t(f))}}}var g=(r+i)/2,y=(s+o)/2,b=0;for(l=0;l<p;l++)f=n[l],f.x-=g,f.y-=y,b=Math.max(b,f.r+Math.sqrt(f.x*f.x+f.y*f.y));e.r=b,n.forEach(In)}function Fn(e){e._pack_next=e._pack_prev=e}function In(e){delete e._pack_next,delete e._pack_prev}function qn(e,t,n,r){var i=e.children;e.x=t+=r*e.x,e.y=n+=r*e.y,e.r*=r;if(i){var s=-1,o=i.length;while(++s<o)qn(i[s],t,n,r)}}function Rn(e,t,n){var r=e.r+n.r,i=t.x-e.x,s=t.y-e.y;if(r&&(i||s)){var o=t.r+n.r,u=i*i+s*s;o*=o,r*=r;var a=.5+(r-o)/(2*u),f=Math.sqrt(Math.max(0,2*o*(r+u)-(r-=u)*r-o*o))/(2*u);n.x=e.x+a*i+f*s,n.y=e.y+a*s-f*i}else n.x=e.x+r,n.y=e.y}function Un(e){return 1+d3.max(e,function(e){return e.y})}function zn(e){return e.reduce(function(e,t){return e+t.x},0)/e.length}function Wn(e){var t=e.children;return t&&t.length?Wn(t[0]):e}function Xn(e){var t=e.children,n;return t&&(n=t.length)?Xn(t[n-1]):e}function Vn(e,t){return e.parent==t.parent?1:2}function $n(e){var t=e.children;return t&&t.length?t[0]:e._tree.thread}function Jn(e){var t=e.children,n;return t&&(n=t.length)?t[n-1]:e._tree.thread}function Kn(e,t){var n=e.children;if(n&&(i=n.length)){var r,i,s=-1;while(++s<i)t(r=Kn(n[s],t),e)>0&&(e=r)}return e}function Qn(e,t){return e.x-t.x}function Gn(e,t){return t.x-e.x}function Yn(e,t){return e.depth-t.depth}function Zn(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u<a)s=i[u],n(s,o),o=s}t(e,r)}n(e,null)}function er(e){var t=0,n=0,r=e.children,i=r.length,s;while(--i>=0)s=r[i]._tree,s.prelim+=t,s.mod+=t,t+=s.shift+(n+=s.change)}function tr(e,t,n){e=e._tree,t=t._tree;var r=n/(t.number-e.number);e.change+=r,t.change-=r,t.shift+=n,t.prelim+=n,t.mod+=n}function nr(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function rr(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function ir(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],s=e.dy-t[0]-t[2];return i<0&&(n+=i/2,i=0),s<0&&(r+=s/2,s=0),{x:n,y:r,dx:i,dy:s}}var sr=".",or=",",ur=[3,3];Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(ar){var fr=CSSStyleDeclaration.prototype,lr=fr.setProperty;fr.setProperty=function(e,t,n){lr.call(this,e,t+"",n)}}d3={version:"3.0.2"};var cr=Math.PI,hr=1e-6,pr=cr/180,dr=180/cr,vr=i;try{vr(document.documentElement.childNodes)[0].nodeType}catch(mr){vr=r}var gr=[].__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};d3.map=function(e){var t=new s;for(var n in e)t.set(n,e[n]);return t},n(s,{has:function(e){return yr+e in this},get:function(e){return this[yr+e]},set:function(e,t){return this[yr+e]=t},remove:function(e){return e=yr+e,e in this&&delete this[e]},keys:function(){var e=[];return this.forEach(function(t){e.push(t)}),e},values:function(){var e=[];return this.forEach(function(t,n){e.push(n)}),e},entries:function(){var e=[];return this.forEach(function(t,n){e.push({key:t,value:n})}),e},forEach:function(e){for(var t in this)t.charCodeAt(0)===br&&e.call(this,t.substring(1),this[t])}});var yr="\0",br=yr.charCodeAt(0);d3.functor=a,d3.rebind=function(e,t){var n=1,r=arguments.length,i;while(++n<r)e[i=arguments[n]]=f(e,t,t[i]);return e},d3.ascending=function(e,t){return e<t?-1:e>t?1:e>=t?0:NaN},d3.descending=function(e,t){return t<e?-1:t>e?1:t>=e?0:NaN},d3.mean=function(e,t){var n=e.length,r,i=0,s=-1,o=0;if(arguments.length===1)while(++s<n)l(r=e[s])&&(i+=(r-i)/++o);else while(++s<n)l(r=t.call(e,e[s],s))&&(i+=(r-i)/++o);return o?i:undefined},d3.median=function(e,t){return arguments.length>1&&(e=e.map(t)),e=e.filter(l),e.length?d3.quantile(e.sort(d3.ascending),.5):undefined},d3.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)(s=e[n])!=null&&i>s&&(i=s)}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)(s=t.call(e,e[n],n))!=null&&i>s&&(i=s)}return i},d3.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++n<r&&((i=e[n])==null||i!=i))i=undefined;while(++n<r)(s=e[n])!=null&&s>i&&(i=s)}else{while(++n<r&&((i=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)(s=t.call(e,e[n],n))!=null&&s>i&&(i=s)}return i},d3.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++n<r&&((i=o=e[n])==null||i!=i))i=o=undefined;while(++n<r)(s=e[n])!=null&&(i>s&&(i=s),o<s&&(o=s))}else{while(++n<r&&((i=o=t.call(e,e[n],n))==null||i!=i))i=undefined;while(++n<r)(s=t.call(e,e[n],n))!=null&&(i>s&&(i=s),o<s&&(o=s))}return[i,o]},d3.random={normal:function(e,t){var n=arguments.length;return n<2&&(t=1),n<1&&(e=0),function(){var n,r,i;do n=Math.random()*2-1,r=Math.random()*2-1,i=n*n+r*r;while(!i||i>1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(e,t){var n=arguments.length;n<2&&(t=1),n<1&&(e=0);var r=d3.random.normal();return function(){return Math.exp(e+t*r())}},irwinHall:function(e){return function(){for(var t=0,n=0;n<e;n++)t+=Math.random();return t/e}}},d3.sum=function(e,t){var n=0,r=e.length,i,s=-1;if(arguments.length===1)while(++s<r)isNaN(i=+e[s])||(n+=i);else while(++s<r)isNaN(i=+t.call(e,e[s],s))||(n+=i);return n},d3.quantile=function(e,t){var n=(e.length-1)*t+1,r=Math.floor(n),i=+e[r-1],s=n-r;return s?i+s*(e[r]-i):i},d3.shuffle=function(e){var t=e.length,n,r;while(t)r=Math.random()*t--|0,n=e[t],e[t]=e[r],e[r]=n;return e},d3.transpose=function(e){return d3.zip.apply(d3,e)},d3.zip=function(){if(!(i=arguments.length))return[];for(var e=-1,t=d3.min(arguments,c),n=new Array(t);++e<t;)for(var r=-1,i,s=n[e]=new Array(i);++r<i;)s[r]=arguments[r][e];return n},d3.bisector=function(e){return{left:function(t,n,r,i){arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);while(r<i){var s=r+i>>>1;e.call(t,t[s],s)<n?r=s+1:i=s}return r},right:function(t,n,r,i){arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);while(r<i){var s=r+i>>>1;n<e.call(t,t[s],s)?i=s:r=s+1}return r}}};var wr=d3.bisector(function(e){return e});d3.bisectLeft=wr.left,d3.bisect=d3.bisectRight=wr.right,d3.nest=function(){function e(t,i){if(i>=r.length)return u?u.call(n,t):o?t.sort(o):t;var a=-1,f=t.length,l=r[i++],c,h,p=new s,d,v={};while(++a<f)(d=p.get(c=l(h=t[a])))?d.push(h):p.set(c,[h]);return p.forEach(function(t,n){v[t]=e(n,i)}),v}function t(e,n){if(n>=r.length)return e;var s=[],o=i[n++],u;for(u in e)s.push({key:u,values:t(e[u],n)});return o&&s.sort(function(e,t){return o(e.key,t.key)}),s}var n={},r=[],i=[],o,u;return n.map=function(t){return e(t,0)},n.entries=function(n){return t(e(n,0),0)},n.key=function(e){return r.push(e),n},n.sortKeys=function(e){return i[r.length-1]=e,n},n.sortValues=function(e){return o=e,n},n.rollup=function(e){return u=e,n},n},d3.keys=function(e){var t=[];for(var n in e)t.push(n);return t},d3.values=function(e){var t=[];for(var n in e)t.push(e[n]);return t},d3.entries=function(e){var t=[];for(var n in e)t.push({key:n,value:e[n]});return t},d3.permute=function(e,t){var n=[],r=-1,i=t.length;while(++r<i)n[r]=e[t[r]];return n},d3.merge=function(e){return Array.prototype.concat.apply([],e)},d3.range=function(e,t,n){arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0));if((t-e)/n===Infinity)throw new Error("infinite range");var r=[],i=p(Math.abs(n)),s=-1,o;e*=i,t*=i,n*=i;if(n<0)while((o=e+n*++s)>t)r.push(o/i);else while((o=e+n*++s)<t)r.push(o/i);return r},d3.requote=function(e){return e.replace(Er,"\\$&")};var Er=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)},d3.xhr=function(e,t,n){function r(){var e=f.status;!e&&f.responseText||e>=200&&e<300||e===304?s.load.call(i,a.call(i,f)):s.error.call(i,f)}var i={},s=d3.dispatch("progress","load","error"),u={},a=o,f=new(window.XDomainRequest&&/^(http(s)?:)?\/\//.test(e)?XDomainRequest:XMLHttpRequest);return"onload"in f?f.onload=f.onerror=r:f.onreadystatechange=function(){f.readyState>3&&r()},f.onprogress=function(e){var t=d3.event;d3.event=e;try{s.progress.call(i,f)}finally{d3.event=t}},i.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?u[e]:(t==null?delete u[e]:u[e]=t+"",i)},i.mimeType=function(e){return arguments.length?(t=e==null?null:e+"",i):t},i.response=function(e){return a=e,i},["get","post"].forEach(function(e){i[e]=function(){return i.send.apply(i,[e].concat(vr(arguments)))}}),i.send=function(n,r,s){arguments.length===2&&typeof r=="function"&&(s=r,r=null),f.open(n,e,!0),t!=null&&!("accept"in u)&&(u.accept=t+",*/*");if(f.setRequestHeader)for(var o in u)f.setRequestHeader(o,u[o]);return t!=null&&f.overrideMimeType&&f.overrideMimeType(t),s!=null&&i.on("error",s).on("load",function(e){s(null,e)}),f.send(r==null?null:r),i},i.abort=function(){return f.abort(),i},d3.rebind(i,s,"on"),arguments.length===2&&typeof t=="function"&&(n=t,t=null),n==null?i:i.get(d(n))},d3.text=function(){return d3.xhr.apply(d3,arguments).response(v)},d3.json=function(e,t){return d3.xhr(e,"application/json",t).response(m)},d3.html=function(e,t){return d3.xhr(e,"text/html",t).response(g)},d3.xml=function(){return d3.xhr.apply(d3,arguments).response(y)};var Sr={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:Sr,qualify:function(e){var t=e.indexOf(":"),n=e;return t>=0&&(n=e.substring(0,t),e=e.substring(t+1)),Sr.hasOwnProperty(n)?{space:Sr[n],local:e}:e}},d3.dispatch=function(){var e=new b,t=-1,n=arguments.length;while(++t<n)e[arguments[t]]=w(e);return e},b.prototype.on=function(e,t){var n=e.indexOf("."),r="";return n>0&&(r=e.substring(n+1),e=e.substring(0,n)),arguments.length<2?this[e].on(r):this[e].on(r,t)},d3.format=function(e){var t=xr.exec(e),n=t[1]||" ",r=t[2]||">",i=t[3]||"",s=t[4]||"",o=t[5],u=+t[6],a=t[7],f=t[8],l=t[9],c=1,h="",p=!1;f&&(f=+f.substring(1));if(o||n==="0"&&r==="=")o=n="0",r="=",a&&(u-=Math.floor((u-1)/4));switch(l){case"n":a=!0,l="g";break;case"%":c=100,h="%",l="f";break;case"p":c=100,h="%",l="r";break;case"b":case"o":case"x":case"X":s&&(s="0"+l.toLowerCase());case"c":case"d":p=!0,f=0;break;case"s":c=-1,l="r"}s==="#"&&(s=""),l=="r"&&!f&&(l="g"),l=Tr.get(l)||S;var d=o&&a;return function(e){if(p&&e%1)return"";var t=e<0||e===0&&1/e<0?(e=-e,"-"):i;if(c<0){var v=d3.formatPrefix(e,f);e=v.scale(e),h=v.symbol}else e*=c;e=l(e,f),!o&&a&&(e=Nr(e));var m=s.length+e.length+(d?0:t.length),g=m<u?(new Array(m=u-m+1)).join(n):"";return d&&(e=Nr(g+e)),sr&&e.replace(".",sr),t+=s,(r==="<"?t+e+g:r===">"?g+t+e:r==="^"?g.substring(0,m>>=1)+t+e+g.substring(m):t+(d?e:g+e))+h}};var xr=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,Tr=d3.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return d3.round(e,t=E(e,t)).toFixed(Math.max(0,Math.min(20,t)))}}),Nr=o;if(ur){var Cr=ur.length;Nr=function(e){var t=e.lastIndexOf("."),n=t>=0?"."+e.substring(t+1):(t=e.length,""),r=[],i=0,s=ur[0];while(t>0&&s>0)r.push(e.substring(t-=s,t+s)),s=ur[i=(i+1)%Cr];return r.reverse().join(or||"")+n}}var kr=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(x);d3.formatPrefix=function(e,t){var n=0;return e&&(e<0&&(e*=-1),t&&(e=d3.round(e,E(e,t))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,Math.floor((n<=0?n+1:n-1)/3)*3))),kr[8+n/3]};var Lr=function(){return o},Ar=d3.map({linear:Lr,poly:O,quad:function(){return k},cubic:function(){return L},sin:function(){return M},exp:function(){return _},circle:function(){return D},elastic:P,back:H,bounce:function(){return B}}),Or=d3.map({"in":o,out:N,"in-out":C,"out-in":function(e){return C(N(e))}});d3.ease=function(e){var t=e.indexOf("-"),n=t>=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";return n=Ar.get(n)||Lr,r=Or.get(r)||o,T(r(n.apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.transform=function(e){var t=document.createElementNS(d3.ns.prefix.svg,"g");return(d3.transform=function(e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate();return new q(n?n.matrix:Mr)})(e)},q.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Mr={a:1,b:0,c:0,d:1,e:0,f:0};d3.interpolate=function(e,t){var n=d3.interpolators.length,r;while(--n>=0&&!(r=d3.interpolators[n](e,t)));return r},d3.interpolateNumber=function(e,t){return t-=e,function(n){return e+t*n}},d3.interpolateRound=function(e,t){return t-=e,function(n){return Math.round(e+t*n)}},d3.interpolateString=function(e,t){var n,r,i,s=0,o=0,u=[],a=[],f,l;_r.lastIndex=0;for(r=0;n=_r.exec(t);++r)n.index&&u.push(t.substring(s,o=n.index)),a.push({i:u.length,x:n[0]}),u.push(null),s=_r.lastIndex;s<t.length&&u.push(t.substring(s));for(r=0,f=a.length;(n=_r.exec(e))&&r<f;++r){l=a[r];if(l.x==n[0]){if(l.i)if(u[l.i+1]==null){u[l.i-1]+=l.x,u.splice(l.i,1);for(i=r+1;i<f;++i)a[i].i--}else{u[l.i-1]+=l.x+u[l.i+1],u.splice(l.i,2);for(i=r+1;i<f;++i)a[i].i-=2}else if(u[l.i+1]==null)u[l.i]=l.x;else{u[l.i]=l.x+u[l.i+1],u.splice(l.i+1,1);for(i=r+1;i<f;++i)a[i].i--}a.splice(r,1),f--,r--}else l.x=d3.interpolateNumber(parseFloat(n[0]),parseFloat(l.x))}while(r<f)l=a.pop(),u[l.i+1]==null?u[l.i]=l.x:(u[l.i]=l.x+u[l.i+1],u.splice(l.i+1,1)),f--;return u.length===1?u[0]==null?a[0].x:function(){return t}:function(e){for(r=0;r<f;++r)u[(l=a[r]).i]=l.x(e);return u.join("")}},d3.interpolateTransform=function(e,t){var n=[],r=[],i,s=d3.transform(e),o=d3.transform(t),u=s.translate,a=o.translate,f=s.rotate,l=o.rotate,c=s.skew,h=o.skew,p=s.scale,d=o.scale;return u[0]!=a[0]||u[1]!=a[1]?(n.push("translate(",null,",",null,")"),r.push({i:1,x:d3.interpolateNumber(u[0],a[0])},{i:3,x:d3.interpolateNumber(u[1],a[1])})):a[0]||a[1]?n.push("translate("+a+")"):n.push(""),f!=l?(f-l>180?l+=360:l-f>180&&(f+=360),r.push({i:n.push(n.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(f,l)})):l&&n.push(n.pop()+"rotate("+l+")"),c!=h?r.push({i:n.push(n.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(c,h)}):h&&n.push(n.pop()+"skewX("+h+")"),p[0]!=d[0]||p[1]!=d[1]?(i=n.push(n.pop()+"scale(",null,",",null,")"),r.push({i:i-4,x:d3.interpolateNumber(p[0],d[0])},{i:i-2,x:d3.interpolateNumber(p[1],d[1])})):(d[0]!=1||d[1]!=1)&&n.push(n.pop()+"scale("+d+")"),i=r.length,function(e){var t=-1,s;while(++t<i)n[(s=r[t]).i]=s.x(e);return n.join("")}},d3.interpolateRgb=function(e,t){e=d3.rgb(e),t=d3.rgb(t);var n=e.r,r=e.g,i=e.b,s=t.r-n,o=t.g-r,u=t.b-i;return function(e){return"#"+Q(Math.round(n+s*e))+Q(Math.round(r+o*e))+Q(Math.round(i+u*e))}},d3.interpolateHsl=function(e,t){e=d3.hsl(e),t=d3.hsl(t);var n=e.h,r=e.s,i=e.l,s=t.h-n,o=t.s-r,u=t.l-i;return s>180?s-=360:s<-180&&(s+=360),function(e){return it(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateLab=function(e,t){e=d3.lab(e),t=d3.lab(t);var n=e.l,r=e.a,i=e.b,s=t.l-n,o=t.a-r,u=t.b-i;return function(e){return lt(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateHcl=function(e,t){e=d3.hcl(e),t=d3.hcl(t);var n=e.h,r=e.c,i=e.l,s=t.h-n,o=t.c-r,u=t.l-i;return s>180?s-=360:s<-180&&(s+=360),function(e){return ut(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateArray=function(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u<o;++u)n.push(d3.interpolate(e[u],t[u]));for(;u<i;++u)r[u]=e[u];for(;u<s;++u)r[u]=t[u];return function(e){for(u=0;u<o;++u)r[u]=n[u](e);return r}},d3.interpolateObject=function(e,t){var n={},r={},i;for(i in e)i in t?n[i]=W(i)(e[i],t[i]):r[i]=e[i];for(i in t)i in e||(r[i]=t[i]);return function(e){for(i in n)r[i]=n[i](e);return r}};var _r=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g
;d3.interpolators=[d3.interpolateObject,function(e,t){return t instanceof Array&&d3.interpolateArray(e,t)},function(e,t){return(typeof e=="string"||typeof t=="string")&&d3.interpolateString(e+"",t+"")},function(e,t){return(typeof t=="string"?Pr.has(t)||/^(#|rgb\(|hsl\()/.test(t):t instanceof $)&&d3.interpolateRgb(e,t)},function(e,t){return!isNaN(e=+e)&&!isNaN(t=+t)&&d3.interpolateNumber(e,t)}],$.prototype.toString=function(){return this.rgb()+""},d3.rgb=function(e,t,n){return arguments.length===1?e instanceof K?J(e.r,e.g,e.b):G(""+e,J,it):J(~~e,~~t,~~n)};var Dr=K.prototype=new $;Dr.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,i=30;return!t&&!n&&!r?J(i,i,i):(t&&t<i&&(t=i),n&&n<i&&(n=i),r&&r<i&&(r=i),J(Math.min(255,Math.floor(t/e)),Math.min(255,Math.floor(n/e)),Math.min(255,Math.floor(r/e))))},Dr.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),J(Math.floor(e*this.r),Math.floor(e*this.g),Math.floor(e*this.b))},Dr.hsl=function(){return Y(this.r,this.g,this.b)},Dr.toString=function(){return"#"+Q(this.r)+Q(this.g)+Q(this.b)};var Pr=d3.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});Pr.forEach(function(e,t){Pr.set(e,G(t,J,it))}),d3.hsl=function(e,t,n){return arguments.length===1?e instanceof rt?nt(e.h,e.s,e.l):G(""+e,Y,nt):nt(+e,+t,+n)};var Hr=rt.prototype=new $;Hr.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),nt(this.h,this.s,this.l/e)},Hr.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),nt(this.h,this.s,e*this.l)},Hr.rgb=function(){return it(this.h,this.s,this.l)},d3.hcl=function(e,t,n){return arguments.length===1?e instanceof ot?st(e.h,e.c,e.l):e instanceof ft?ct(e.l,e.a,e.b):ct((e=Z((e=d3.rgb(e)).r,e.g,e.b)).l,e.a,e.b):st(+e,+t,+n)};var Br=ot.prototype=new $;Br.brighter=function(e){return st(this.h,this.c,Math.min(100,this.l+jr*(arguments.length?e:1)))},Br.darker=function(e){return st(this.h,this.c,Math.max(0,this.l-jr*(arguments.length?e:1)))},Br.rgb=function(){return ut(this.h,this.c,this.l).rgb()},d3.lab=function(e,t,n){return arguments.length===1?e instanceof ft?at(e.l,e.a,e.b):e instanceof ot?ut(e.l,e.c,e.h):Z((e=d3.rgb(e)).r,e.g,e.b):at(+e,+t,+n)};var jr=18,Fr=.95047,Ir=1,qr=1.08883,Rr=ft.prototype=new $;Rr.brighter=function(e){return at(Math.min(100,this.l+jr*(arguments.length?e:1)),this.a,this.b)},Rr.darker=function(e){return at(Math.max(0,this.l-jr*(arguments.length?e:1)),this.a,this.b)},Rr.rgb=function(){return lt(this.l,this.a,this.b)};var Ur=function(e,t){return t.querySelector(e)},zr=function(e,t){return t.querySelectorAll(e)},Wr=document.documentElement,Xr=Wr.matchesSelector||Wr.webkitMatchesSelector||Wr.mozMatchesSelector||Wr.msMatchesSelector||Wr.oMatchesSelector,Vr=function(e,t){return Xr.call(e,t)};typeof Sizzle=="function"&&(Ur=function(e,t){return Sizzle(e,t)[0]||null},zr=function(e,t){return Sizzle.uniqueSort(Sizzle(e,t))},Vr=Sizzle.matchesSelector);var $r=[];d3.selection=function(){return Jr},d3.selection.prototype=$r,$r.select=function(e){var t=[],n,r,i,s;typeof e!="function"&&(e=mt(e));for(var o=-1,u=this.length;++o<u;){t.push(n=[]),n.parentNode=(i=this[o]).parentNode;for(var a=-1,f=i.length;++a<f;)(s=i[a])?(n.push(r=e.call(s,s.__data__,a)),r&&"__data__"in s&&(r.__data__=s.__data__)):n.push(null)}return vt(t)},$r.selectAll=function(e){var t=[],n,r;typeof e!="function"&&(e=gt(e));for(var i=-1,s=this.length;++i<s;)for(var o=this[i],u=-1,a=o.length;++u<a;)if(r=o[u])t.push(n=vr(e.call(r,r.__data__,u))),n.parentNode=r;return vt(t)},$r.attr=function(e,t){if(arguments.length<2){if(typeof e=="string"){var n=this.node();return e=d3.ns.qualify(e),e.local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(t in e)this.each(yt(t,e[t]));return this}return this.each(yt(e,t))},$r.classed=function(e,t){if(arguments.length<2){if(typeof e=="string"){var n=this.node(),r=(e=e.trim().split(/^|\s+/g)).length,i=-1;if(t=n.classList){while(++i<r)if(!t.contains(e[i]))return!1}else{t=n.className,t.baseVal!=null&&(t=t.baseVal);while(++i<r)if(!bt(e[i]).test(t))return!1}return!0}for(t in e)this.each(wt(t,e[t]));return this}return this.each(wt(e,t))},$r.style=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t="");for(n in e)this.each(St(n,e[n],t));return this}if(r<2)return getComputedStyle(this.node(),null).getPropertyValue(e);n=""}return this.each(St(e,t,n))},$r.property=function(e,t){if(arguments.length<2){if(typeof e=="string")return this.node()[e];for(t in e)this.each(xt(t,e[t]));return this}return this.each(xt(e,t))},$r.text=function(e){return arguments.length?this.each(typeof e=="function"?function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}:e==null?function(){this.textContent=""}:function(){this.textContent=e}):this.node().textContent},$r.html=function(e){return arguments.length?this.each(typeof e=="function"?function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}:e==null?function(){this.innerHTML=""}:function(){this.innerHTML=e}):this.node().innerHTML},$r.append=function(e){function t(){return this.appendChild(document.createElementNS(this.namespaceURI,e))}function n(){return this.appendChild(document.createElementNS(e.space,e.local))}return e=d3.ns.qualify(e),this.select(e.local?n:t)},$r.insert=function(e,t){function n(){return this.insertBefore(document.createElementNS(this.namespaceURI,e),Ur(t,this))}function r(){return this.insertBefore(document.createElementNS(e.space,e.local),Ur(t,this))}return e=d3.ns.qualify(e),this.select(e.local?r:n)},$r.remove=function(){return this.each(function(){var e=this.parentNode;e&&e.removeChild(this)})},$r.data=function(e,t){function n(e,n){var r,i=e.length,o=n.length,u=Math.min(i,o),c=Math.max(i,o),h=[],p=[],d=[],v,m;if(t){var g=new s,y=[],b,w=n.length;for(r=-1;++r<i;)b=t.call(v=e[r],v.__data__,r),g.has(b)?d[w++]=v:g.set(b,v),y.push(b);for(r=-1;++r<o;)b=t.call(n,m=n[r],r),g.has(b)?(h[r]=v=g.get(b),v.__data__=m,p[r]=d[r]=null):(p[r]=Tt(m),h[r]=d[r]=null),g.remove(b);for(r=-1;++r<i;)g.has(y[r])&&(d[r]=e[r])}else{for(r=-1;++r<u;)v=e[r],m=n[r],v?(v.__data__=m,h[r]=v,p[r]=d[r]=null):(p[r]=Tt(m),h[r]=d[r]=null);for(;r<o;++r)p[r]=Tt(n[r]),h[r]=d[r]=null;for(;r<c;++r)d[r]=e[r],p[r]=h[r]=null}p.update=h,p.parentNode=h.parentNode=d.parentNode=e.parentNode,a.push(p),f.push(h),l.push(d)}var r=-1,i=this.length,o,u;if(!arguments.length){e=new Array(i=(o=this[0]).length);while(++r<i)if(u=o[r])e[r]=u.__data__;return e}var a=At([]),f=vt([]),l=vt([]);if(typeof e=="function")while(++r<i)n(o=this[r],e.call(o,o.parentNode.__data__,r));else while(++r<i)n(o=this[r],e);return f.enter=function(){return a},f.exit=function(){return l},f},$r.datum=function(e){return arguments.length?this.property("__data__",e):this.property("__data__")},$r.filter=function(e){var t=[],n,r,i;typeof e!="function"&&(e=Nt(e));for(var s=0,o=this.length;s<o;s++){t.push(n=[]),n.parentNode=(r=this[s]).parentNode;for(var u=0,a=r.length;u<a;u++)(i=r[u])&&e.call(i,i.__data__,u)&&n.push(i)}return vt(t)},$r.order=function(){for(var e=-1,t=this.length;++e<t;)for(var n=this[e],r=n.length-1,i=n[r],s;--r>=0;)if(s=n[r])i&&i!==s.nextSibling&&i.parentNode.insertBefore(s,i),i=s;return this},$r.sort=function(e){e=Ct.apply(this,arguments);for(var t=-1,n=this.length;++t<n;)this[t].sort(e);return this.order()},$r.on=function(e,t,n){var r=arguments.length;if(r<3){if(typeof e!="string"){r<2&&(t=!1);for(n in e)this.each(kt(n,e[n],t));return this}if(r<2)return(r=this.node()["__on"+e])&&r._;n=!1}return this.each(kt(e,t,n))},$r.each=function(e){return Lt(this,function(t,n,r){e.call(t,t.__data__,n,r)})},$r.call=function(e){var t=vr(arguments);return e.apply(t[0]=this,t),this},$r.empty=function(){return!this.node()},$r.node=function(){for(var e=0,t=this.length;e<t;e++)for(var n=this[e],r=0,i=n.length;r<i;r++){var s=n[r];if(s)return s}return null},$r.transition=function(){var e=Yr||++Gr,t=[],n,r,i=Object.create(Zr);i.time=Date.now();for(var s=-1,o=this.length;++s<o;){t.push(n=[]);for(var u=this[s],a=-1,f=u.length;++a<f;)(r=u[a])&&Mt(r,a,e,i),n.push(r)}return Ot(t,e)};var Jr=vt([[document]]);Jr[0].parentNode=Wr,d3.select=function(e){return typeof e=="string"?Jr.select(e):vt([[e]])},d3.selectAll=function(e){return typeof e=="string"?Jr.selectAll(e):vt([vr(e)])};var Kr=[];d3.selection.enter=At,d3.selection.enter.prototype=Kr,Kr.append=$r.append,Kr.insert=$r.insert,Kr.empty=$r.empty,Kr.node=$r.node,Kr.select=function(e){var t=[],n,r,i,s,o;for(var u=-1,a=this.length;++u<a;){i=(s=this[u]).update,t.push(n=[]),n.parentNode=s.parentNode;for(var f=-1,l=s.length;++f<l;)(o=s[f])?(n.push(i[f]=r=e.call(s.parentNode,o.__data__,f)),r.__data__=o.__data__):n.push(null)}return vt(t)};var Qr=[],Gr=0,Yr,Zr={ease:A,delay:0,duration:250};Qr.call=$r.call,Qr.empty=$r.empty,Qr.node=$r.node,d3.transition=function(e){return arguments.length?Yr?e.transition():e:Jr.transition()},d3.transition.prototype=Qr,Qr.select=function(e){var t=this.id,n=[],r,i,s;typeof e!="function"&&(e=mt(e));for(var o=-1,u=this.length;++o<u;){n.push(r=[]);for(var a=this[o],f=-1,l=a.length;++f<l;)(s=a[f])&&(i=e.call(s,s.__data__,f))?("__data__"in s&&(i.__data__=s.__data__),Mt(i,f,t,s.__transition__[t]),r.push(i)):r.push(null)}return Ot(n,t)},Qr.selectAll=function(e){var t=this.id,n=[],r,i,s,o,u;typeof e!="function"&&(e=gt(e));for(var a=-1,f=this.length;++a<f;)for(var l=this[a],c=-1,h=l.length;++c<h;)if(s=l[c]){u=s.__transition__[t],i=e.call(s,s.__data__,c),n.push(r=[]);for(var p=-1,d=i.length;++p<d;)Mt(o=i[p],p,t,u),r.push(o)}return Ot(n,t)},Qr.filter=function(e){var t=[],n,r,i;typeof e!="function"&&(e=Nt(e));for(var s=0,o=this.length;s<o;s++){t.push(n=[]);for(var r=this[s],u=0,a=r.length;u<a;u++)(i=r[u])&&e.call(i,i.__data__,u)&&n.push(i)}return Ot(t,this.id,this.time).ease(this.ease())},Qr.attr=function(e,t){function n(){this.removeAttribute(s)}function r(){this.removeAttributeNS(s.space,s.local)}if(arguments.length<2){for(t in e)this.attr(t,e[t]);return this}var i=W(e),s=d3.ns.qualify(e);return Dt(this,"attr."+e,t,function(e){function t(){var t=this.getAttribute(s),n;return t!==e&&(n=i(t,e),function(e){this.setAttribute(s,n(e))})}function o(){var t=this.getAttributeNS(s.space,s.local),n;return t!==e&&(n=i(t,e),function(e){this.setAttributeNS(s.space,s.local,n(e))})}return e==null?s.local?r:n:(e+="",s.local?o:t)})},Qr.attrTween=function(e,t){function n(e,n){var r=t.call(this,e,n,this.getAttribute(i));return r&&function(e){this.setAttribute(i,r(e))}}function r(e,n){var r=t.call(this,e,n,this.getAttributeNS(i.space,i.local));return r&&function(e){this.setAttributeNS(i.space,i.local,r(e))}}var i=d3.ns.qualify(e);return this.tween("attr."+e,i.local?r:n)},Qr.style=function(e,t,n){function r(){this.style.removeProperty(e)}var i=arguments.length;if(i<3){if(typeof e!="string"){i<2&&(t="");for(n in e)this.style(n,e[n],t);return this}n=""}var s=W(e);return Dt(this,"style."+e,t,function(t){function i(){var r=getComputedStyle(this,null).getPropertyValue(e),i;return r!==t&&(i=s(r,t),function(t){this.style.setProperty(e,i(t),n)})}return t==null?r:(t+="",i)})},Qr.styleTween=function(e,t,n){return arguments.length<3&&(n=""),this.tween("style."+e,function(r,i){var s=t.call(this,r,i,getComputedStyle(this,null).getPropertyValue(e));return s&&function(t){this.style.setProperty(e,s(t),n)}})},Qr.text=function(e){return Dt(this,"text",e,_t)},Qr.remove=function(){return this.each("end.transition",function(){var e;!this.__transition__&&(e=this.parentNode)&&e.removeChild(this)})},Qr.ease=function(e){var t=this.id;return arguments.length<1?this.node().__transition__[t].ease:(typeof e!="function"&&(e=d3.ease.apply(d3,arguments)),Lt(this,function(n){n.__transition__[t].ease=e}))},Qr.delay=function(e){var t=this.id;return Lt(this,typeof e=="function"?function(n,r,i){n.__transition__[t].delay=e.call(n,n.__data__,r,i)|0}:(e|=0,function(n){n.__transition__[t].delay=e}))},Qr.duration=function(e){var t=this.id;return Lt(this,typeof e=="function"?function(n,r,i){n.__transition__[t].duration=Math.max(1,e.call(n,n.__data__,r,i)|0)}:(e=Math.max(1,e|0),function(n){n.__transition__[t].duration=e}))},Qr.each=function(e,t){var n=this.id;if(arguments.length<2){var r=Zr,i=Yr;Yr=n,Lt(this,function(t,r,i){Zr=t.__transition__[n],e.call(t,t.__data__,r,i)}),Zr=r,Yr=i}else Lt(this,function(r){r.__transition__[n].event.on(e,t)});return this},Qr.transition=function(){var e=this.id,t=++Gr,n=[],r,i,s,o;for(var u=0,a=this.length;u<a;u++){n.push(r=[]);for(var i=this[u],f=0,l=i.length;f<l;f++){if(s=i[f])o=Object.create(s.__transition__[e]),o.delay+=o.duration,Mt(s,f,t,o);r.push(s)}}return Ot(n,t)},Qr.tween=function(e,t){var n=this.id;return arguments.length<2?this.node().__transition__[n].tween.get(e):Lt(this,t==null?function(t){t.__transition__[n].tween.remove(e)}:function(r){r.__transition__[n].tween.set(e,t)})};var ei=0,ti={},ni=null,ri,ii;d3.timer=function(e,t,n){if(arguments.length<3){if(arguments.length<2)t=0;else if(!isFinite(t))return;n=Date.now()}var r=ti[e.id];r&&r.callback===e?(r.then=n,r.delay=t):ti[e.id=++ei]=ni={callback:e,then:n,delay:t,next:ni},ri||(ii=clearTimeout(ii),ri=1,si(Pt))},d3.timer.flush=function(){var e,t=Date.now(),n=ni;while(n)e=t-n.then,n.delay||(n.flush=n.callback(e)),n=n.next;Ht()};var si=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,17)};d3.mouse=function(e){return Bt(e,F())};var oi=/WebKit/.test(navigator.userAgent)?-1:0;d3.touches=function(e,t){return arguments.length<2&&(t=F().touches),t?vr(t).map(function(t){var n=Bt(e,t);return n.identifier=t.identifier,n}):[]},d3.scale={},d3.scale.linear=function(){return Ut([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return Qt(d3.scale.linear(),Gt)};var ui=d3.format(".0e");Gt.pow=function(e){return Math.pow(10,e)},Yt.pow=function(e){return-Math.pow(10,-e)},d3.scale.pow=function(){return Zt(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return tn([],{t:"range",a:[[]]})},d3.scale.category10=function(){return d3.scale.ordinal().range(ai)},d3.scale.category20=function(){return d3.scale.ordinal().range(fi)},d3.scale.category20b=function(){return d3.scale.ordinal().range(li)},d3.scale.category20c=function(){return d3.scale.ordinal().range(ci)};var ai=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],fi=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],li=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],ci=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return nn([],[])},d3.scale.quantize=function(){return rn(0,1,[0,1])},d3.scale.threshold=function(){return sn([.5],[0,1])},d3.scale.identity=function(){return on([0,1])},d3.layout={},d3.layout.bundle=function(){return function(e){var t=[],n=-1,r=e.length;while(++n<r)t.push(un(e[n]));return t}},d3.layout.chord=function(){function e(){var e={},n=[],c=d3.range(o),h=[],p,d,v,m,g;r=[],i=[],p=0,m=-1;while(++m<o){d=0,g=-1;while(++g<o)d+=s[m][g];n.push(d),h.push(d3.range(o)),p+=d}a&&c.sort(function(e,t){return a(n[e],n[t])}),f&&h.forEach(function(e,t){e.sort(function(e,n){return f(s[t][e],s[t][n])})}),p=(2*cr-u*o)/p,d=0,m=-1;while(++m<o){v=d,g=-1;while(++g<o){var y=c[m],b=h[y][g],w=s[y][b],E=d,S=d+=w*p;e[y+"-"+b]={index:y,subindex:b,startAngle:E,endAngle:S,value:w}}i[y]={index:y,startAngle:v,endAngle:d,value:(d-v)/p},d+=u}m=-1;while(++m<o){g=m-1;while(++g<o){var x=e[m+"-"+g],T=e[g+"-"+m];(x.value||T.value)&&r.push(x.value<T.value?{source:T,target:x}:{source:x,target:T})}}l&&t()}function t(){r.sort(function(e,t){return l((e.source.value+e.target.value)/2,(t.source.value+t.target.value)/2)})}var n={},r,i,s,o,u=0,a,f,l;return n.matrix=function(e){return arguments.length?(o=(s=e)&&s.length,r=i=null,n):s},n.padding=function(e){return arguments.length?(u=e,r=i=null,n):u},n.sortGroups=function(e){return arguments.length?(a=e,r=i=null,n):a},n.sortSubgroups=function(e){return arguments.length?(f=e,r=null,n):f},n.sortChords=function(e){return arguments.length?(l=e,r&&t(),n):l},n.chords=function(){return r||e(),r},n.groups=function(){return i||e(),i},n},d3.layout.force=function(){function e(e){return function(t,n,r,i){if(t.point!==e){var s=t.cx-e.x,o=t.cy-e.y,u=1/Math.sqrt(s*s+o*o);if((i-n)*u<d){var a=t.charge*u*u;return e.px-=s*a,e.py-=o*a,!0}if(t.point&&isFinite(u)){var a=t.pointCharge*u*u;e.px-=s*a,e.py-=o*a}}return!t.charge}}function t(e){e.px=d3.event.x,e.py=d3.event.y,n.resume()}var n={},r=d3.dispatch("start","tick","end"),i=[1,1],s,u,f=.9,l=vn,c=mn,h=-30,p=.1,d=.8,v=[],m=[],g,y,b;return n.tick=function(){if((u*=.99)<.005)return r.end({type:"end",alpha:u=0}),!0;var t=v.length,n=m.length,s,o,a,l,c,d,w,E,S;for(o=0;o<n;++o){a=m[o],l=a.source,c=a.target,E=c.x-l.x,S=c.y-l.y;if(d=E*E+S*S)d=u*y[o]*((d=Math.sqrt(d))-g[o])/d,E*=d,S*=d,c.x-=E*(w=l.weight/(c.weight+l.weight)),c.y-=S*w,l.x+=E*(w=1-w),l.y+=S*w}if(w=u*p){E=i[0]/2,S=i[1]/2,o=-1;if(w)while(++o<t)a=v[o],a.x+=(E-a.x)*w,a.y+=(S-a.y)*w}if(h){dn(s=d3.geom.quadtree(v),u,b),o=-1;while(++o<t)(a=v[o]).fixed||s.visit(e(a))}o=-1;while(++o<t)a=v[o],a.fixed?(a.x=a.px,a.y=a.py):(a.x-=(a.px-(a.px=a.x))*f,a.y-=(a.py-(a.py=a.y))*f);r.tick({type:"tick",alpha:u})},n.nodes=function(e){return arguments.length?(v=e,n):v},n.links=function(e){return arguments.length?(m=e,n):m},n.size=function(e){return arguments.length?(i=e,n):i},n.linkDistance=function(e){return arguments.length?(l=a(e),n):l},n.distance=n.linkDistance,n.linkStrength=function(e){return arguments.length?(c=a(e),n):c},n.friction=function(e){return arguments.length?(f=e,n):f},n.charge=function(e){return arguments.length?(h=typeof e=="function"?e:+e,n):h},n.gravity=function(e){return arguments.length?(p=e,n):p},n.theta=function(e){return arguments.length?(d=e,n):d},n.alpha=function(e){return arguments.length?(u?e>0?u=e:u=0:e>0&&(r.start({type:"start",alpha:u=e}),d3.timer(n.tick)),n):u},n.start=function(){function e(e,n){var i=t(r),s=-1,o=i.length,u;while(++s<o)if(!isNaN(u=i[s][e]))return u;return Math.random()*n}function t(){if(!p){p=[];for(s=0;s<o;++s)p[s]=[];for(s=0;s<u;++s){var e=m[s];p[e.source.index].push(e.target),p[e.target.index].push(e.source)}}return p[r]}var r,s,o=v.length,u=m.length,a=i[0],f=i[1],p,d;for(r=0;r<o;++r)(d=v[r]).index=r,d.weight=0;g=[],y=[];for(r=0;r<u;++r)d=m[r],typeof d.source=="number"&&(d.source=v[d.source]),typeof d.target=="number"&&(d.target=v[d.target]),g[r]=l.call(this,d,r),y[r]=c.call(this,d,r),++d.source.weight,++d.target.weight;for(r=0;r<o;++r)d=v[r],isNaN(d.x)&&(d.x=e("x",a)),isNaN(d.y)&&(d.y=e("y",f)),isNaN(d.px)&&(d.px=d.x),isNaN(d.py)&&(d.py=d.y);b=[];if(typeof h=="function")for(r=0;r<o;++r)b[r]=+h.call(this,v[r],r);else for(r=0;r<o;++r)b[r]=h;return n.resume()},n.resume=function(){return n.alpha(.1)},n.stop=function(){return n.alpha(0)},n.drag=function(){s||(s=d3.behavior.drag().origin(o).on("dragstart",ln).on("drag",t).on("dragend",cn)),this.on("mouseover.force",hn).on("mouseout.force",pn).call(s)},d3.rebind(n,r,"on")},d3.layout.partition=function(){function e(t,n,r,i){var s=t.children;t.x=n,t.y=t.depth*i,t.dx=r,t.dy=i;if(s&&(u=s.length)){var o=-1,u,a,f;r=t.value?r/t.value:0;while(++o<u)e(a=s[o],n,f=a.value*r,i),n+=f}}function t(e){var n=e.children,r=0;if(n&&(s=n.length)){var i=-1,s;while(++i<s)r=Math.max(r,t(n[i]))}return 1+r}function n(n,s){var o=r.call(this,n,s);return e(o[0],0,i[0],i[1]/t(o[0])),o}var r=d3.layout.hierarchy(),i=[1,1];return n.size=function(e){return arguments.length?(i=e,n):i},Ln(n,r)},d3.layout.pie=function(){function e(s){var o=s.map(function(n,r){return+t.call(e,n,r)}),u=+(typeof r=="function"?r.apply(this,arguments):r),a=((typeof i=="function"?i.apply(this,arguments):i)-r)/d3.sum(o),f=d3.range(s.length);n!=null&&f.sort(n===hi?function(e,t){return o[t]-o[e]}:function(e,t){return n(s[e],s[t])});var l=[];return f.forEach(function(e){var t;l[e]={data:s[e],value:t=o[e],startAngle:u,endAngle:u+=t*a}}),l}var t=Number,n=hi,r=0,i=2*cr;return e.value=function(n){return arguments.length?(t=n,e):t},e.sort=function(t){return arguments.length?(n=t,e):n},e.startAngle=function(t){return arguments.length?(r=t,e):r},e.endAngle=function(t){return arguments.length?(i=t,e):i},e};var hi={};d3.layout.stack=function(){function e(o,a){var f=o.map(function(n,r){return t.call(e,n,r)}),l=f.map(function(t){return t.map(function(t,n){return[s.call(e,t,n),u.call(e,t,n)]})}),c=n.call(e,l,a);f=d3.permute(f,c),l=d3.permute(l,c);var h=r.call(e,l,a),p=f.length,d=f[0].length,v,m,g;for(m=0;m<d;++m){i.call(e,f[0][m],g=h[m],l[0][m][1]);for(v=1;v<p;++v)i.call(e,f[v][m],g+=l[v-1][m][1],l[v][m][1])}return o}var t=o,n=wn,r=En,i=bn,s=gn,u=yn;return e.values=function(n){return arguments.length?(t=n,e):t},e.order=function(t){return arguments.length?(n=typeof t=="function"?t:pi.get(t)||wn,e):n},e.offset=function(t){return arguments.length?(r=typeof t=="function"?t:di.get(t)||En,e):r},e.x=function(t){return arguments.length?(s=t,e):s},e.y=function(t){return arguments.length?(u=t,e):u},e.out=function(t){return arguments.length?(i=t,e):i},e};var pi=d3.map({"inside-out":function(e){var t=e.length,n,r,i=e.map(Sn),s=e.map(xn),o=d3.range(t).sort(function(e,t){return i[e]-i[t]}),u=0,a=0,f=[],l=[];for(n=0;n<t;++n)r=o[n],u<a?(u+=s[r],f.push(r)):(a+=s[r],l.push(r));return l.reverse().concat(f)},reverse:function(e){return d3.range(e.length).reverse()},"default":wn}),di=d3.map({silhouette:function(e){var t=e.length,n=e[0].length,r=[],i=0,s,o,u,a=[];for(o=0;o<n;++o){for(s=0,u=0;s<t;s++)u+=e[s][o][1];u>i&&(i=u),r.push(u)}for(o=0;o<n;++o)a[o]=(i-r[o])/2;return a},wiggle:function(e){var t=e.length,n=e[0],r=n.length,i,s,o,u,a,f,l,c,h,p=[];p[0]=c=h=0;for(s=1;s<r;++s){for(i=0,u=0;i<t;++i)u+=e[i][s][1];for(i=0,a=0,l=n[s][0]-n[s-1][0];i<t;++i){for(o=0,f=(e[i][s][1]-e[i][s-1][1])/(2*l);o<i;++o)f+=(e[o][s][1]-e[o][s-1][1])/l;a+=f*e[i][s][1]}p[s]=c-=u?a/u*l:0,c<h&&(h=c)}for(s=0;s<r;++s)p[s]-=h;return p},expand:function(e){var t=e.length,n=e[0].length,r=1/t,i,s,o,u=[];for(s=0;s<n;++s){for(i=0,o=0;i<t;i++)o+=e[i][s][1];if(o)for(i=0;i<t;i++)e[i][s][1]/=o;else for(i=0;i<t;i++)e[i][s][1]=r}for(s=0;s<n;++s)u[s]=0;return u},zero:En});d3.layout.histogram=function(){function e(e,s){var o=[],u=e.map(n,this),a=r.call(this,u,s),f=i.call(this,a,u,s),l,s=-1,c=u.length,h=f.length-1,p=t?1:1/c,d;while(++s<h)l=o[s]=[],l.dx=f[s+1]-(l.x=f[s]),l.y=0;if(h>0){s=-1;while(++s<c)d=u[s],d>=a[0]&&d<=a[1]&&(l=o[d3.bisect(f,d,1,h)-1],l.y+=p,l.push(e[s]))}return o}var t=!0,n=Number,r=kn,i=Nn;return e.value=function(t){return arguments.length?(n=t,e):n},e.range=function(t){return arguments.length?(r=a(t),e):r},e.bins=function(t){return arguments.length?(i=typeof t=="number"?function(e){return Cn(e,t)}:a(t),e):i},e.frequency=function(n){return arguments.length?(t=!!n,e):t},e},d3.layout.hierarchy=function(){function e(t,o,u){var a=i.call(n,t,o);t.depth=o,u.push(t);if(a&&(l=a.length)){var f=-1,l,c=t.children=[],h=0,p=o+1,d;while(++f<l)d=e(a[f],p,u),d.parent=t,c.push(d),h+=d.value;r&&c.sort(r),s&&(t.value=h)}else s&&(t.value=+s.call(n,t,o)||0);return t}function t(e,r){var i=e.children,o=0;if(i&&(a=i.length)){var u=-1,a,f=r+1;while(++u<a)o+=t(i[u],f)}else s&&(o=+s.call(n,e,r)||0);return s&&(e.value=o),o}function n(t){var n=[];return e(t,0,n),n}var r=Mn,i=An,s=On;return n.sort=function(e){return arguments.length?(r=e,n):r},n.children=function(e){return arguments.length?(i=e,n):i},n.value=function(e){return arguments.length?(s=e,n):s},n.revalue=function(e){return t(e,0),e},n},d3.layout.pack=function(){function e(e,i){var s=t.call(this,e,i),o=s[0];o.x=0,o.y=0,Zn(o,function(e){e.r=Math.sqrt(e.value)}),Zn(o,jn);var u=r[0],a=r[1],f=Math.max(2*o.r/u,2*o.r/a);if(n>0){var l=n*f/2;Zn(o,function(e){e.r+=l}),Zn(o,jn),Zn(o,function(e){e.r-=l}),f=Math.max(2*o.r/u,2*o.r/a)}return qn(o,u/2,a/2,1/f),s}var t=d3.layout.hierarchy().sort(Dn),n=0,r=[1,1];return e.size=function(t){return arguments.length?(r=t,e):r},e.padding=function(t){return arguments.length?(n=+t,e):n},Ln(e,t)},d3.layout.cluster=function(){function e(e,i){var s=t.call(this,e,i),o=s[0],u,a=0;Zn(o,function(e){var t=e.children;t&&t.length?(e.x=zn(t),e.y=Un(t)):(e.x=u?a+=n(e,u):0,e.y=0,u=e)});var f=Wn(o),l=Xn(o),c=f.x-n(f,l)/2,h=l.x+n(l,f)/2;return Zn(o,function(e){e.x=(e.x-c)/(h-c)*r[0],e.y=(1-(o.y?e.y/o.y:1))*r[1]}),s}var t=d3.layout.hierarchy().sort(null).value(null),n=Vn,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},Ln(e,t)},d3.layout.tree=function(){function e(e,i){function s(e,t){var r=e.children,i=e._tree;if(r&&(o=r.length)){var o,a=r[0],f,l=a,c,h=-1;while(++h<o)c=r[h],s(c,f),l=u(c,f,l),f=c;er(e);var p=.5*(a._tree.prelim+c._tree.prelim);t?(i.prelim=t._tree.prelim+n(e,t),i.mod=i.prelim-p):i.prelim=p}else t&&(i.prelim=t._tree.prelim+n(e,t))}function o(e,t){e.x=e._tree.prelim+t;var n=e.children;if(n&&(i=n.length)){var r=-1,i;t+=e._tree.mod;while(++r<i)o(n[r],t)}}function u(e,t,r){if(t){var i=e,s=e,o=t,u=e.parent.children[0],a=i._tree.mod,f=s._tree.mod,l=o._tree.mod,c=u._tree.mod,h;while(o=Jn(o),i=$n(i),o&&i)u=$n(u),s=Jn(s),s._tree.ancestor=e,h=o._tree.prelim+l-i._tree.prelim-a+n(o,i),h>0&&(tr(nr(o,e,r),e,h),a+=h,f+=h),l+=o._tree.mod,a+=i._tree.mod,c+=u._tree.mod,f+=s._tree.mod;o&&!Jn(s)&&(s._tree.thread=o,s._tree.mod+=l-f),i&&!$n(u)&&(u._tree.thread=i,u._tree.mod+=a-c,r=e)}return r}var a=t.call(this,e,i),f=a[0];Zn(f,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),s(f),o(f,-f._tree.prelim);var l=Kn(f,Gn),c=Kn(f,Qn),h=Kn(f,Yn),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;return Zn(f,function(e){e.x=(e.x-p)/(d-p)*r[0],e.y=e.depth/v*r[1],delete e._tree}),a}var t=d3.layout.hierarchy().sort(null).value(null),n=Vn,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},Ln(e,t)},d3.layout.treemap=function(){function e(e,t){var n=-1,r=e.length,i,s;while(++n<r)s=(i=e[n]).value*(t<0?0:t),i.area=isNaN(s)||s<=0?0:s}function t(n){var s=n.children;if(s&&s.length){var o=l(n),u=[],a=s.slice(),f,c=Infinity,h,d=p==="slice"?o.dx:p==="dice"?o.dy:p==="slice-dice"?n.depth&1?o.dy:o.dx:Math.min(o.dx,o.dy),v;e(a,o.dx*o.dy/n.value),u.area=0;while((v=a.length)>0)u.push(f=a[v-1]),u.area+=f.area,p!=="squarify"||(h=r(u,d))<=c?(a.pop(),c=h):(u.area-=u.pop().area,i(u,d,o,!1),d=Math.min(o.dx,o.dy),u.length=u.area=0,c=Infinity);u.length&&(i(u,d,o,!0),u.length=u.area=0),s.forEach(t)}}function n(t){var r=t.children;if(r&&r.length){var s=l(t),o=r.slice(),u,a=[];e(o,s.dx*s.dy/t.value),a.area=0;while(u=o.pop())a.push(u),a.area+=u.area,u.z!=null&&(i(a,u.z?s.dx:s.dy,s,!o.length),a.length=a.area=0);r.forEach(n)}}function r(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++o<u){if(!(r=e[o].area))continue;r<s&&(s=r),r>i&&(i=r)}return n*=n,t*=t,n?Math.max(t*i*d/n,n/(t*s*d)):Infinity}function i(e,t,n,r){var i=-1,s=e.length,o=n.x,a=n.y,f=t?u(e.area/t):0,l;if(t==n.dx){if(r||f>n.dy)f=n.dy;while(++i<s)l=e[i],l.x=o,l.y=a,l.dy=f,o+=l.dx=Math.min(n.x+n.dx-o,f?u(l.area/f):0);l.z=!0,l.dx+=n.x+n.dx-o,n.y+=f,n.dy-=f}else{if(r||f>n.dx)f=n.dx;while(++i<s)l=e[i],l.x=o,l.y=a,l.dx=f,a+=l.dy=Math.min(n.y+n.dy-a,f?u(l.area/f):0);l.z=!1,l.dy+=n.y+n.dy-a,n.x+=f,n.dx-=f}}function s(r){var i=h||o(r),s=i[0];return s.x=0,s.y=0,s.dx=a[0],s.dy=a[1],h&&o.revalue(s),e([s],s.dx*s.dy/s.value),(h?n:t)(s),c&&(h=i),i}var o=d3.layout.hierarchy(),u=Math.round,a=[1,1],f=null,l=rr,c=!1,h,p="squarify",d=.5*(1+Math.sqrt(5));return s.size=function(e){return arguments.length?(a=e,s):a},s.padding=function(e){function t(t){var n=e.call(s,t,t.depth);return n==null?rr(t):ir(t,typeof n=="number"?[n,n,n,n]:n)}function n(t){return ir(t,e)}if(!arguments.length)return f;var r;return l=(f=e)==null?rr:(r=typeof e)==="function"?t:r==="number"?(e=[e,e,e,e],n):n,s},s.round=function(e){return arguments.length?(u=e?Math.round:Number,s):u!=Number},s.sticky=function(e){return arguments.length?(c=e,h=null,s):c},s.ratio=function(e){return arguments.length?(d=e,s):d},s.mode=function(e){return arguments.length?(p=e+"",s):p},Ln(s,o)}}(),function(e,t,n,r){function i(t){return t[0]&&e.isPlainObject(t[0])?this.data=t[0]:this.el=t,this.isCoords=!0,this.coords={},this.init(),this}var s=i.prototype;s.init=function(){this.set(),this.original_coords=this.get()},s.set=function(e,t){var n=this.el;n&&!e&&(this.data=n.offset(),this.data.width=n.width(),this.data.height=n.height());if(n&&e&&!t){var r=n.offset();this.data.top=r.top,this.data.left=r.left}var i=this.data;return this.coords.x1=i.left,this.coords.y1=i.top,this.coords.x2=i.left+i.width,this.coords.y2=i.top+i.height,this.coords.cx=i.left+i.width/2,this.coords.cy=i.top+i.height/2,this.coords.width=i.width,this.coords.height=i.height,this.coords.el=n||!1,this},s.update=function(t){if(!t&&!this.el)return this;if(t){var n=e.extend({},this.data,t);return this.data=n,this.set(!0,!0)}return this.set(!0),this},s.get=function(){return this.coords},e.fn.coords=function(){if(this.data("coords"))return this.data("coords");var e=new i(this,arguments[0]);return this.data("coords",e),e}}(jQuery,window,document),function(e,t,n,r){function s(t,n,r){this.options=e.extend(i,r),this.$element=t,this.last_colliders=[],this.last_colliders_coords=[],typeof n=="string"||n instanceof jQuery?this.$colliders=e(n,this.options.colliders_context).not(this.$element):this.colliders=e(n),this.init()}var i={colliders_context:n.body},o=s.prototype;o.init=function(
){this.find_collisions()},o.overlaps=function(e,t){var n=!1,r=!1;if(t.x1>=e.x1&&t.x1<=e.x2||t.x2>=e.x1&&t.x2<=e.x2||e.x1>=t.x1&&e.x2<=t.x2)n=!0;if(t.y1>=e.y1&&t.y1<=e.y2||t.y2>=e.y1&&t.y2<=e.y2||e.y1>=t.y1&&e.y2<=t.y2)r=!0;return n&&r},o.detect_overlapping_region=function(e,t){var n="",r="";return e.y1>t.cy&&e.y1<t.y2&&(n="N"),e.y2>t.y1&&e.y2<t.cy&&(n="S"),e.x1>t.cx&&e.x1<t.x2&&(r="W"),e.x2>t.x1&&e.x2<t.cx&&(r="E"),n+r||"C"},o.calculate_overlapped_area_coords=function(t,n){var r=Math.max(t.x1,n.x1),i=Math.max(t.y1,n.y1),s=Math.min(t.x2,n.x2),o=Math.min(t.y2,n.y2);return e({left:r,top:i,width:s-r,height:o-i}).coords().get()},o.calculate_overlapped_area=function(e){return e.width*e.height},o.manage_colliders_start_stop=function(t,n,r){var i=this.last_colliders_coords;for(var s=0,o=i.length;s<o;s++)e.inArray(i[s],t)===-1&&n.call(this,i[s]);for(var u=0,a=t.length;u<a;u++)e.inArray(t[u],i)===-1&&r.call(this,t[u])},o.find_collisions=function(t){var n=this,r=[],i=[],s=this.colliders||this.$colliders,o=s.length,u=n.$element.coords().update(t||!1).get();while(o--){var a=n.$colliders?e(s[o]):s[o],f=a.isCoords?a:a.coords(),l=f.get(),c=n.overlaps(u,l);if(!c)continue;var h=n.detect_overlapping_region(u,l);if(h==="C"){var p=n.calculate_overlapped_area_coords(u,l),d=n.calculate_overlapped_area(p),v={area:d,area_coords:p,region:h,coords:l,player_coords:u,el:a};n.options.on_overlap&&n.options.on_overlap.call(this,v),r.push(f),i.push(v)}}return(n.options.on_overlap_stop||n.options.on_overlap_start)&&this.manage_colliders_start_stop(r,n.options.on_overlap_stop,n.options.on_overlap_start),this.last_colliders_coords=r,i},o.get_closest_colliders=function(e){var t=this.find_collisions(e);return t.sort(function(e,t){return e.region==="C"&&t.region==="C"?e.coords.y1<t.coords.y1||e.coords.x1<t.coords.x1?-1:1:e.area<t.area?1:1}),t},e.fn.collision=function(e,t){return new s(this,e,t)}}(jQuery,window,document),function(e,t){e.debounce=function(e,t,n){var r;return function(){var i=this,s=arguments,o=function(){r=null,n||e.apply(i,s)};n&&!r&&e.apply(i,s),clearTimeout(r),r=setTimeout(o,t)}},e.throttle=function(e,t){var n,r,i,s,o,u,a=debounce(function(){o=s=!1},t);return function(){n=this,r=arguments;var f=function(){i=null,o&&e.apply(n,r),a()};return i||(i=setTimeout(f,t)),s?o=!0:u=e.apply(n,r),a(),s=!0,u}}}(window),function(e,t,n,r){function a(t,r){this.options=e.extend({},i,r),this.$body=e(n.body),this.$container=e(t),this.$dragitems=e(this.options.items,this.$container),this.is_dragging=!1,this.player_min_left=0+this.options.offset_left,this.init()}var i={items:".gs_w",distance:1,limit:!0,offset_left:0,autoscroll:!0,ignore_dragging:["INPUT","TEXTAREA","SELECT","BUTTON"],handle:null},s=e(t),o="ontouchstart"in t,u={start:o?"touchstart":"mousedown.draggable",move:o?"touchmove":"mousemove.draggable",end:o?"touchend":"mouseup.draggable"},f=a.prototype;f.init=function(){this.calculate_positions(),this.$container.css("position","relative"),this.disabled=!1,this.events(),e(t).bind("resize",throttle(e.proxy(this.calculate_positions,this),200))},f.events=function(){this.$container.on("selectstart",e.proxy(this.on_select_start,this)),this.$container.on(u.start,this.options.items,e.proxy(this.drag_handler,this)),this.$body.on(u.end,e.proxy(function(e){this.is_dragging=!1;if(this.disabled)return;this.$body.off(u.move),this.drag_start&&this.on_dragstop(e)},this))},f.get_actual_pos=function(e){var t=e.position();return t},f.get_mouse_pos=function(e){if(o){var t=e.originalEvent;e=t.touches.length?t.touches[0]:t.changedTouches[0]}return{left:e.clientX,top:e.clientY}},f.get_offset=function(e){e.preventDefault();var t=this.get_mouse_pos(e),n=Math.round(t.left-this.mouse_init_pos.left),r=Math.round(t.top-this.mouse_init_pos.top),i=Math.round(this.el_init_offset.left+n-this.baseX),s=Math.round(this.el_init_offset.top+r-this.baseY+this.scrollOffset);return this.options.limit&&(i>this.player_max_left?i=this.player_max_left:i<this.player_min_left&&(i=this.player_min_left)),{left:i,top:s,mouse_left:t.left,mouse_top:t.top}},f.manage_scroll=function(e){var t,n=s.scrollTop(),r=n,i=r+this.window_height,o=i-50,u=r+50,a=e.mouse_left,f=r+e.mouse_top,l=this.doc_height-this.window_height+this.player_height;f>=o&&(t=n+30,t<l&&(s.scrollTop(t),this.scrollOffset=this.scrollOffset+30)),f<=u&&(t=n-30,t>0&&(s.scrollTop(t),this.scrollOffset=this.scrollOffset-30))},f.calculate_positions=function(e){this.window_height=s.height()},f.drag_handler=function(t){var n=t.target.nodeName;if(this.disabled||t.which!==1&&!o)return;if(this.ignore_drag(t))return;var r=this,i=!0;return this.$player=e(t.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(t),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,this.$body.on(u.move,function(e){var t=r.get_mouse_pos(e),n=Math.abs(t.left-r.mouse_init_pos.left),s=Math.abs(t.top-r.mouse_init_pos.top);return n>r.options.distance||s>r.options.distance?i?(i=!1,r.on_dragstart.call(r,e),!1):(r.is_dragging===!0&&r.on_dragmove.call(r,e),!1):!1}),!1},f.on_dragstart=function(t){t.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var r=this.$container.offset();return this.baseX=Math.round(r.left),this.baseY=Math.round(r.top),this.doc_height=e(n).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,t,{helper:this.helper?this.$helper:this.$player}),!1},f.on_dragmove=function(e){var t=this.get_offset(e);this.options.autoscroll&&this.manage_scroll(t),(this.helper?this.$helper:this.$player).css({position:"absolute",left:t.left,top:t.top});var n={position:{left:t.left,top:t.top}};return this.options.drag&&this.options.drag.call(this.$player,e,n),!1},f.on_dragstop=function(e){var t=this.get_offset(e);this.drag_start=!1;var n={position:{left:t.left,top:t.top}};return this.options.stop&&this.options.stop.call(this.$player,e,n),this.helper&&this.$helper.remove(),!1},f.on_select_start=function(e){if(this.disabled)return;if(this.ignore_drag(e))return;return!1},f.enable=function(){this.disabled=!1},f.disable=function(){this.disabled=!0},f.destroy=function(){this.disable(),e.removeData(this.$container,"drag")},f.ignore_drag=function(t){return this.options.handle?!e(t.target).is(this.options.handle):e.inArray(t.target.nodeName,this.options.ignore_dragging)>=0},e.fn.drag=function(t){return this.each(function(){e.data(this,"drag")||e.data(this,"drag",new a(this,t))})}}(jQuery,window,document),function(e,t,n,r){function s(t,n){this.options=e.extend(!0,i,n),this.$el=e(t),this.$wrapper=this.$el.parent(),this.$widgets=this.$el.children(this.options.widget_selector).addClass("gs_w"),this.widgets=[],this.$changed=e([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var i={namespace:"",widget_selector:"li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,max_size_x:6,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(e,t){return{col:t.col,row:t.row,size_x:t.size_x,size_y:t.size_y}},collision:{},draggable:{distance:4}};s.generated_stylesheets=[];var o=s.prototype;o.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),e(t).bind("resize",throttle(e.proxy(this.recalculate_faux_grid,this),200))},o.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},o.enable=function(){return this.drag_api.enable(),this},o.add_widget=function(t,n,r,i,s){var o;n||(n=1),r||(r=1),!i&!s?o=this.next_position(n,r):(o={col:i,row:s},this.empty_cells(i,s,n,r));var u=e(t).attr({"data-col":o.col,"data-row":o.row,"data-sizex":n,"data-sizey":r}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(u),this.register_widget(u),this.add_faux_rows(o.size_y),this.set_dom_grid_height(),u.fadeIn()},o.resize_widget=function(t,n,r){var i=t.coords().grid;n||(n=i.size_x),r||(r=i.size_y),n>this.cols&&(n=this.cols);var s=this.get_cells_occupied(i),o=i.size_x,u=i.size_y,a=i.col,f=a,l=n>o,c=r>u;if(a+n-1>this.cols){var h=a+(n-1)-this.cols,p=a-h;f=Math.max(1,p)}var d={col:f,row:i.row,size_x:n,size_y:r},v=this.get_cells_occupied(d),m=[];e.each(s.cols,function(t,n){e.inArray(n,v.cols)===-1&&m.push(n)});var g=[];e.each(v.cols,function(t,n){e.inArray(n,s.cols)===-1&&g.push(n)});var y=[];e.each(s.rows,function(t,n){e.inArray(n,v.rows)===-1&&y.push(n)});var b=[];e.each(v.rows,function(t,n){e.inArray(n,s.rows)===-1&&b.push(n)}),this.remove_from_gridmap(i);if(g.length){var w=[f,i.row,n,Math.min(u,r),t];this.empty_cells.apply(this,w)}if(b.length){var E=[f,i.row,n,r,t];this.empty_cells.apply(this,E)}i.col=f,i.size_x=n,i.size_y=r,this.add_to_gridmap(d,t),t.data("coords").update({width:n*this.options.widget_base_dimensions[0]+(n-1)*this.options.widget_margins[0]*2,height:r*this.options.widget_base_dimensions[1]+(r-1)*this.options.widget_margins[1]*2}),r>u&&this.add_faux_rows(r-u),n>o&&this.add_faux_cols(n-o),t.attr({"data-col":f,"data-sizex":n,"data-sizey":r});if(m.length){var S=[m[0],i.row,m.length,Math.min(u,r),t];this.remove_empty_cells.apply(this,S)}if(y.length){var x=[f,i.row,n,r,t];this.remove_empty_cells.apply(this,x)}return t},o.empty_cells=function(t,n,r,i,s){var o=this.widgets_below({col:t,row:n-i,size_x:r,size_y:i});return o.not(s).each(e.proxy(function(t,r){var s=e(r).coords().grid;if(!(s.row<=n+i-1))return;var o=n+i-s.row;this.move_widget_down(e(r),o)},this)),this.set_dom_grid_height(),this},o.remove_empty_cells=function(t,n,r,i,s){var o=this.widgets_below({col:t,row:n,size_x:r,size_y:i});return o.not(s).each(e.proxy(function(t,n){this.move_widget_up(e(n),i)},this)),this.set_dom_grid_height(),this},o.next_position=function(e,t){e||(e=1),t||(t=1);var n=this.gridmap,r=n.length,i=[],s;for(var o=1;o<r;o++){s=n[o].length;for(var u=1;u<=s;u++){var a=this.can_move_to({size_x:e,size_y:t},o,u);a&&i.push({col:o,row:u,size_y:t,size_x:e})}}return i.length?this.sort_by_row_and_col_asc(i)[0]:!1},o.remove_widget=function(t,n,r){var i=t instanceof jQuery?t:e(t),s=i.coords().grid;e.isFunction(n)&&(r=n,n=!1),this.cells_occupied_by_placeholder={},this.$widgets=this.$widgets.not(i);var o=this.widgets_below(i);this.remove_from_gridmap(s),i.fadeOut(e.proxy(function(){i.remove(),n||o.each(e.proxy(function(t,n){this.move_widget_up(e(n),s.size_y)},this)),this.set_dom_grid_height(),r&&r.call(this,t)},this))},o.remove_all_widgets=function(t){return this.$widgets.each(e.proxy(function(e,n){this.remove_widget(n,!0,t)},this)),this},o.serialize=function(t){t||(t=this.$widgets);var n=[];return t.each(e.proxy(function(t,r){n.push(this.options.serialize_params(e(r),e(r).coords().grid))},this)),n},o.serialize_changed=function(){return this.serialize(this.$changed)},o.register_widget=function(e){var t={col:parseInt(e.attr("data-col"),10),row:parseInt(e.attr("data-row"),10),size_x:parseInt(e.attr("data-sizex"),10),size_y:parseInt(e.attr("data-sizey"),10),el:e};return this.options.avoid_overlapped_widgets&&!this.can_move_to({size_x:t.size_x,size_y:t.size_y},t.col,t.row)&&(t=this.next_position(t.size_x,t.size_y),t.el=e,e.attr({"data-col":t.col,"data-row":t.row,"data-sizex":t.size_x,"data-sizey":t.size_y})),e.data("coords",e.coords()),e.data("coords").grid=t,this.add_to_gridmap(t,e),this},o.update_widget_position=function(e,t){return this.for_each_cell_occupied(e,function(e,n){if(!this.gridmap[e])return this;this.gridmap[e][n]=t}),this},o.remove_from_gridmap=function(e){return this.update_widget_position(e,!1)},o.add_to_gridmap=function(t,n){this.update_widget_position(t,n||t.el);if(t.el){var r=this.widgets_below(t.el);r.each(e.proxy(function(t,n){this.move_widget_up(e(n))},this))}},o.draggable=function(){var t=this,n=e.extend(!0,{},this.options.draggable,{offset_left:this.options.widget_margins[0],start:function(n,r){t.$widgets.filter(".player-revert").removeClass("player-revert"),t.$player=e(this),t.$helper=t.options.draggable.helper==="clone"?e(r.helper):t.$player,t.helper=!t.$helper.is(t.$player),t.on_start_drag.call(t,n,r),t.$el.trigger("gridster:dragstart")},stop:function(e,n){t.on_stop_drag.call(t,e,n),t.$el.trigger("gridster:dragstop")},drag:throttle(function(e,n){t.on_drag.call(t,e,n),t.$el.trigger("gridster:drag")},60)});return this.drag_api=this.$el.drag(n).data("drag"),this},o.on_start_drag=function(t,n){this.$helper.add(this.$player).add(this.$wrapper).addClass("dragging"),this.$player.addClass("player"),this.player_grid_data=this.$player.coords().grid,this.placeholder_grid_data=e.extend({},this.player_grid_data),this.$el.css("height",this.$el.height()+this.player_grid_data.size_y*this.min_widget_height);var r=this.faux_grid,i=this.$player.data("coords").coords;this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_data),this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.last_cols=[],this.last_rows=[],this.collision_api=this.$helper.collision(r,this.options.collision),this.$preview_holder=e("<li />",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:i.width,height:i.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,t,n)},o.on_drag=function(e,t){if(this.$player===null)return!1;var n={left:t.position.left+this.baseX,top:t.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(n),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:t.position.left,top:t.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,e,t)},o.on_stop_drag=function(e,t){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),t.position.left=t.position.left+this.baseX,t.position.top=t.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(t.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.options.draggable.stop&&this.options.draggable.stop.call(this,e,t),this.$preview_holder.remove(),this.$player=null,this.$helper=null,this.placeholder_grid_data={},this.player_grid_data={},this.cells_occupied_by_placeholder={},this.cells_occupied_by_player={},this.set_dom_grid_height()},o.on_overlapped_column_change=function(t,n){if(!this.colliders_data.length)return;var r=this.get_targeted_columns(this.colliders_data[0].el.data.col),i=this.last_cols.length,s=r.length,o;for(o=0;o<s;o++)e.inArray(r[o],this.last_cols)===-1&&(t||e.noop).call(this,r[o]);for(o=0;o<i;o++)e.inArray(this.last_cols[o],r)===-1&&(n||e.noop).call(this,this.last_cols[o]);return this.last_cols=r,this},o.on_overlapped_row_change=function(t,n){if(!this.colliders_data.length)return;var r=this.get_targeted_rows(this.colliders_data[0].el.data.row),i=this.last_rows.length,s=r.length,o;for(o=0;o<s;o++)e.inArray(r[o],this.last_rows)===-1&&(t||e.noop).call(this,r[o]);for(o=0;o<i;o++)e.inArray(this.last_rows[o],r)===-1&&(n||e.noop).call(this,this.last_rows[o]);this.last_rows=r},o.set_player=function(e,t,n){var r=this;n||this.empty_cells_player_occupies();var i=n?{col:e}:r.colliders_data[0].el.data,s=i.col,o=t||i.row;this.player_grid_data={col:s,row:o,size_y:this.player_grid_data.size_y,size_x:this.player_grid_data.size_x},this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_data);var u=this.get_widgets_overlapped(this.player_grid_data),a=this.widgets_constraints(u);this.manage_movements(a.can_go_up,s,o),this.manage_movements(a.can_not_go_up,s,o);if(!u.length){var f=this.can_go_player_up(this.player_grid_data);f!==!1&&(o=f),this.set_placeholder(s,o)}return{col:s,row:o}},o.widgets_constraints=function(t){var n=e([]),r,i=[],s=[];return t.each(e.proxy(function(t,r){var o=e(r),u=o.coords().grid;this.can_go_widget_up(u)?(n=n.add(o),i.push(u)):s.push(u)},this)),r=t.not(n),{can_go_up:this.sort_by_row_asc(i),can_not_go_up:this.sort_by_row_desc(s)}},o.sort_by_row_asc=function(t){return t=t.sort(function(t,n){return t.row||(t=e(t).coords().grid,n=e(n).coords().grid),t.row>n.row?1:-1}),t},o.sort_by_row_and_col_asc=function(e){return e=e.sort(function(e,t){return e.row>t.row||e.row===t.row&&e.col>t.col?1:-1}),e},o.sort_by_col_asc=function(e){return e=e.sort(function(e,t){return e.col>t.col?1:-1}),e},o.sort_by_row_desc=function(e){return e=e.sort(function(e,t){return e.row+e.size_y<t.row+t.size_y?1:-1}),e},o.manage_movements=function(t,n,r){return e.each(t,e.proxy(function(e,t){var i=t,s=i.el,o=this.can_go_widget_up(i);if(o)this.move_widget_to(s,o),this.set_placeholder(n,o+i.size_y);else{var u=this.can_go_player_up(this.player_grid_data);if(!u){var a=r+this.player_grid_data.size_y-i.row;this.move_widget_down(s,a),this.set_placeholder(n,r)}}},this)),this},o.is_player=function(e,t){if(t&&!this.gridmap[e])return!1;var n=t?this.gridmap[e][t]:e;return n&&(n.is(this.$player)||n.is(this.$helper))},o.is_player_in=function(t,n){var r=this.cells_occupied_by_player||{};return e.inArray(t,r.cols)>=0&&e.inArray(n,r.rows)>=0},o.is_placeholder_in=function(t,n){var r=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(t)&&e.inArray(n,r.rows)>=0},o.is_placeholder_in_col=function(t){var n=this.cells_occupied_by_placeholder||[];return e.inArray(t,n.cols)>=0},o.is_empty=function(e,t){return typeof this.gridmap[e]!="undefined"&&typeof this.gridmap[e][t]!="undefined"&&this.gridmap[e][t]===!1?!0:!1},o.is_occupied=function(e,t){return this.gridmap[e]?this.gridmap[e][t]?!0:!1:!1},o.is_widget=function(e,t){var n=this.gridmap[e];return n?(n=n[t],n?n:!1):!1},o.is_widget_under_player=function(e,t){return this.is_widget(e,t)?this.is_player_in(e,t):!1},o.get_widgets_under_player=function(t){t||(t=this.cells_occupied_by_player||{cols:[],rows:[]});var n=e([]);return e.each(t.cols,e.proxy(function(r,i){e.each(t.rows,e.proxy(function(e,t){this.is_widget(i,t)&&(n=n.add(this.gridmap[i][t]))},this))},this)),n},o.set_placeholder=function(t,n){var r=e.extend({},this.placeholder_grid_data),i=this.widgets_below({col:r.col,row:r.row,size_y:r.size_y,size_x:r.size_x}),s=t+r.size_x-1;s>this.cols&&(t-=s-t);var o=this.placeholder_grid_data.row<n,u=this.placeholder_grid_data.col!==t;this.placeholder_grid_data.col=t,this.placeholder_grid_data.row=n,this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.$preview_holder.attr({"data-row":n,"data-col":t}),(o||u)&&i.each(e.proxy(function(n,i){this.move_widget_up(e(i),this.placeholder_grid_data.col-t+r.size_y)},this));var a=this.get_widgets_under_player(this.cells_occupied_by_placeholder);a.length&&a.each(e.proxy(function(t,i){var s=e(i);this.move_widget_down(s,n+r.size_y-s.data("coords").grid.row)},this))},o.can_go_player_up=function(e){var t=e.row+e.size_y-1,n=!0,r=[],i=1e4,s=this.get_widgets_under_player();return this.for_each_column_occupied(e,function(e){var o=this.gridmap[e],u=t+1;r[e]=[];while(--u>0){if(!(this.is_empty(e,u)||this.is_player(e,u)||this.is_widget(e,u)&&o[u].is(s)))break;r[e].push(u),i=u<i?u:i}if(r[e].length===0)return n=!1,!0;r[e].sort()}),n?this.get_valid_rows(e,r,i):!1},o.can_go_widget_up=function(e){var t=e.row+e.size_y-1,n=!0,r=[],i=1e4;return this.for_each_column_occupied(e,function(s){var o=this.gridmap[s];r[s]=[];var u=t+1;while(--u>0){if(this.is_widget(s,u)&&!this.is_player_in(s,u)&&!o[u].is(e.el))break;!this.is_player(s,u)&&!this.is_placeholder_in(s,u)&&!this.is_player_in(s,u)&&r[s].push(u),u<i&&(i=u)}if(r[s].length===0)return n=!1,!0;r[s].sort()}),n?this.get_valid_rows(e,r,i):!1},o.get_valid_rows=function(t,n,r){var i=t.row,s=t.row+t.size_y-1,o=t.size_y,u=r-1,a=[];while(++u<=s){var f=!0;e.each(n,function(t,n){e.isArray(n)&&e.inArray(u,n)===-1&&(f=!1)});if(f===!0){a.push(u);if(a.length===o)break}}var l=!1;return o===1?a[0]!==i&&(l=a[0]||!1):a[0]!==i&&(l=this.get_consecutive_numbers_index(a,o)),l},o.get_consecutive_numbers_index=function(e,t){var n=e.length,r=[],i=!0,s=-1;for(var o=0;o<n;o++){if(i||e[o]===s+1){r.push(o);if(r.length===t)break;i=!1}else r=[],i=!0;s=e[o]}return r.length>=t?e[r[0]]:!1},o.get_widgets_overlapped=function(){var t,n=e([]),r=[],i=this.cells_occupied_by_player.rows.slice(0);return i.reverse(),e.each(this.cells_occupied_by_player.cols,e.proxy(function(t,s){e.each(i,e.proxy(function(t,i){if(!this.gridmap[s])return!0;var o=this.gridmap[s][i];this.is_occupied(s,i)&&!this.is_player(o)&&e.inArray(o,r)===-1&&(n=n.add(o),r.push(o))},this))},this)),n},o.on_start_overlapping_column=function(e){this.set_player(e,!1)},o.on_start_overlapping_row=function(e){this.set_player(!1,e)},o.on_stop_overlapping_column=function(e){this.set_player(e,!1);var t=this;this.for_each_widget_below(e,this.cells_occupied_by_player.rows[0],function(e,n){t.move_widget_up(this,t.player_grid_data.size_y)})},o.on_stop_overlapping_row=function(e){this.set_player(!1,e);var t=this,n=this.cells_occupied_by_player.cols;for(var r=0,i=n.length;r<i;r++)this.for_each_widget_below(n[r],e,function(e,n){t.move_widget_up(this,t.player_grid_data.size_y)})},o.move_widget_to=function(t,n){var r=this,i=t.coords().grid,s=n-i.row,o=this.widgets_below(t),u=this.can_move_to(i,i.col,n,t);return u===!1?!1:(this.remove_from_gridmap(i),i.row=n,this.add_to_gridmap(i),t.attr("data-row",n),this.$changed=this.$changed.add(t),o.each(function(t,n){var i=e(n),s=i.coords().grid,o=r.can_go_widget_up(s);o&&o!==s.row&&r.move_widget_to(i,o)}),this)},o.move_widget_up=function(t,n){var r=t.coords().grid,i=r.row,s=[],o=!0;n||(n=1);if(!this.can_go_up(t))return!1;this.for_each_column_occupied(r,function(r){if(e.inArray(t,s)===-1){var o=t.coords().grid,u=i-n;u=this.can_go_up_to_row(o,r,u);if(!u)return!0;var a=this.widgets_below(t);this.remove_from_gridmap(o),o.row=u,this.add_to_gridmap(o),t.attr("data-row",o.row),this.$changed=this.$changed.add(t),s.push(t),a.each(e.proxy(function(t,r){this.move_widget_up(e(r),n)},this))}})},o.move_widget_down=function(t,n){var r=t.coords().grid,i=r.row,s=[],o=n;if(!t)return!1;if(e.inArray(t,s)===-1){var u=t.coords().grid,a=i+n,f=this.widgets_below(t);this.remove_from_gridmap(u),f.each(e.proxy(function(t,n){var r=e(n),i=r.coords().grid,s=this.displacement_diff(i,u,o);s>0&&this.move_widget_down(r,s)},this)),u.row=a,this.update_widget_position(u,t),t.attr("data-row",u.row),this.$changed=this.$changed.add(t),s.push(t)}},o.can_go_up_to_row=function(t,n,r){var i=this.gridmap,s=!0,o=[],u=t.row,a;this.for_each_column_occupied(t,function(e){var t=i[e];o[e]=[],a=u;while(a--){if(!this.is_empty(e,a)||!!this.is_placeholder_in(e,a))break;o[e].push(a)}if(!o[e].length)return s=!1,!0});if(!s)return!1;a=r;for(a=1;a<u;a++){var f=!0;for(var l=0,c=o.length;l<c;l++)o[l]&&e.inArray(a,o[l])===-1&&(f=!1);if(f===!0){s=a;break}}return s},o.displacement_diff=function(e,t,n){var r=e.row,i=[],s=t.row+t.size_y;this.for_each_column_occupied(e,function(e){var t=0;for(var n=s;n<r;n++)this.is_empty(e,n)&&(t+=1);i.push(t)});var o=Math.max.apply(Math,i);return n-=o,n>0?n:0},o.widgets_below=function(t){var n=e.isPlainObject(t)?t:t.coords().grid,r=this,i=this.gridmap,s=n.row+n.size_y-1,o=e([]);return this.for_each_column_occupied(n,function(t){r.for_each_widget_below(t,s,function(t,n){if(!r.is_player(this)&&e.inArray(this,o)===-1)return o=o.add(this),!0})}),this.sort_by_row_asc(o)},o.set_cells_player_occupies=function(e,t){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=e,this.placeholder_grid_data.row=t,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},o.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},o.can_go_up=function(e){var t=e.coords().grid,n=t.row,r=n-1,i=this.gridmap,s=[],o=!0;return n===1?!1:(this.for_each_column_occupied(t,function(e){var t=this.is_widget(e,r);if(this.is_occupied(e,r)||this.is_player(e,r)||this.is_placeholder_in(e,r)||this.is_player_in(e,r))return o=!1,!0}),o)},o.can_move_to=function(e,t,n,r){var i=this.gridmap,s=e.el,o={size_y:e.size_y,size_x:e.size_x,col:t,row:n},u=!0,a=t+e.size_x-1;return a>this.cols?!1:r&&r<n+e.size_y-1?!1:(this.for_each_cell_occupied(o,function(t,n){var r=this.is_widget(t,n);r&&(!e.el||r.is(s))&&(u=!1)}),u)},o.get_targeted_columns=function(e){var t=(e||this.player_grid_data.col)+(this.player_grid_data.size_x-1),n=[];for(var r=e;r<=t;r++)n.push(r);return n},o.get_targeted_rows=function(e){var t=(e||this.player_grid_data.row)+(this.player_grid_data.size_y-1),n=[];for(var r=e;r<=t;r++)n.push(r);return n},o.get_cells_occupied=function(e){var t={cols:[],rows:[]},n;arguments[1]instanceof jQuery&&(e=arguments[1].coords().grid);for(n=0;n<e.size_x;n++){var r=e.col+n;t.cols.push(r)}for(n=0;n<e.size_y;n++){var i=e.row+n;t.rows.push(i)}return t},o.for_each_cell_occupied=function(e,t){return this.for_each_column_occupied(e,function(n){this.for_each_row_occupied(e,function(e){t.call(this,n,e)})}),this},o.for_each_column_occupied=function(e,t){for(var n=0;n<e.size_x;n++){var r=e.col+n;t.call(this,r,e)}},o.for_each_row_occupied=function(e,t){for(var n=0;n<e.size_y;n++){var r=e.row+n;t.call(this,r,e)}},o._traversing_widgets=function(t,n,r,i,s){var o=this.gridmap;if(!o[r])return;var u,a,f=t+"/"+n;if(arguments[2]instanceof jQuery){var l=arguments[2].coords().grid;r=l.col,i=l.row,s=arguments[3]}var c=[],h=i,p={"for_each/above":function(){while(h--)if(h>0&&this.is_widget(r,h)&&e.inArray(o[r][h],c)===-1){u=s.call(o[r][h],r,h),c.push(o[r][h]);if(u)break}},"for_each/below":function(){for(h=i+1,a=o[r].length;h<a;h++)if(this.is_widget(r,h)&&e.inArray(o[r][h],c)===-1){u=s.call(o[r][h],r,h),c.push(o[r][h]);if(u)break}}};p[f]&&p[f].call(this)},o.for_each_widget_above=function(e,t,n){return this._traversing_widgets("for_each","above",e,t,n),this},o.for_each_widget_below=function(e,t,n){return this._traversing_widgets("for_each","below",e,t,n),this},o.get_highest_occupied_cell=function(){var e,t=this.gridmap,n=[],r=[];for(var i=t.length-1;i>=1;i--)for(e=t[i].length-1;e>=1;e--)if(this.is_widget(i,e)){n.push(e),r[e]=i;break}var s=Math.max.apply(Math,n);return this.highest_occupied_cell={col:r[s],row:s},this.highest_occupied_cell},o.get_widgets_from=function(t,n){var r=this.gridmap,i=e();return t&&(i=i.add(this.$widgets.filter(function(){var n=e(this).attr("data-col");return n===t||n>t}))),n&&(i=i.add(this.$widgets.filter(function(){var t=e(this).attr("data-row");return t===n||t>n}))),i},o.set_dom_grid_height=function(){var e=this.get_highest_occupied_cell().row;return this.$el.css("height",e*this.min_widget_height),this},o.generate_stylesheet=function(t){var n="",r=this.options.max_size_x,i=0,o=0,u,a;t||(t={}),t.cols||(t.cols=this.cols),t.rows||(t.rows=this.rows),t.namespace||(t.namespace=this.options.namespace),t.widget_base_dimensions||(t.widget_base_dimensions=this.options.widget_base_dimensions),t.widget_margins||(t.widget_margins=this.options.widget_margins),t.min_widget_width=t.widget_margins[0]*2+t.widget_base_dimensions[0],t.min_widget_height=t.widget_margins[1]*2+t.widget_base_dimensions[1];var f=e.param(t);if(e.inArray(f,s.generated_stylesheets)>=0)return!1;s.generated_stylesheets.push(f);for(u=t.cols;u>=0;u--)n+=t.namespace+' [data-col="'+(u+1)+'"] { left:'+(u*t.widget_base_dimensions[0]+u*t.widget_margins[0]+(u+1)*t.widget_margins[0])+"px;} ";for(u=t.rows;u>=0;u--)n+=t.namespace+' [data-row="'+(u+1)+'"] { top:'+(u*t.widget_base_dimensions[1]+u*t.widget_margins[1]+(u+1)*t.widget_margins[1])+"px;} ";for(var l=1;l<=t.rows;l++)n+=t.namespace+' [data-sizey="'+l+'"] { height:'+(l*t.widget_base_dimensions[1]+(l-1)*t.widget_margins[1]*2)+"px;}";for(var c=1;c<=r;c++)n+=t.namespace+' [data-sizex="'+c+'"] { width:'+(c*t.widget_base_dimensions[0]+(c-1)*t.widget_margins[0]*2)+"px;}";return this.add_style_tag(n)},o.add_style_tag=function(e){var t=n,r=t.createElement("style");return t.getElementsByTagName("head")[0].appendChild(r),r.setAttribute("type","text/css"),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(n.createTextNode(e)),this},o.generate_faux_grid=function(e,t){this.faux_grid=[],this.gridmap=[];var n,r;for(n=t;n>0;n--){this.gridmap[n]=[];for(r=e;r>0;r--)this.add_faux_cell(r,n)}return this},o.add_faux_cell=function(t,n){var r=e({left:this.baseX+(n-1)*this.min_widget_width,top:this.baseY+(t-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:n,row:t,original_col:n,original_row:t}).coords();return e.isArray(this.gridmap[n])||(this.gridmap[n]=[]),this.gridmap[n][t]=!1,this.faux_grid.push(r),this},o.add_faux_rows=function(e){var t=this.rows,n=t+(e||1);for(var r=n;r>t;r--)for(var i=this.cols;i>=1;i--)this.add_faux_cell(r,i);return this.rows=n,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this},o.add_faux_cols=function(e){var t=this.cols,n=t+(e||1);for(var r=t;r<n;r++)for(var i=this.rows;i>=1;i--)this.add_faux_cell(i,r);return this.cols=n,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this},o.recalculate_faux_grid=function(){var n=this.$wrapper.width();return this.baseX=(e(t).width()-n)/2,this.baseY=this.$wrapper.offset().top,e.each(this.faux_grid,e.proxy(function(e,t){this.faux_grid[e]=t.update({left:this.baseX+(t.data.col-1)*this.min_widget_width,top:this.baseY+(t.data.row-1)*this.min_widget_height})},this)),this},o.get_widgets_from_DOM=function(){return this.$widgets.each(e.proxy(function(t,n){this.register_widget(e(n))},this)),this},o.generate_grid_and_stylesheet=function(){var n=this.$wrapper.width(),r=this.$wrapper.height(),i=Math.floor(n/this.min_widget_width)+this.options.extra_cols,s=this.$widgets.map(function(){return e(this).attr("data-col")});s=Array.prototype.slice.call(s,0),s.length||(s=[0]);var o=Math.max.apply(Math,s),u=this.options.extra_rows;return this.$widgets.each(function(t,n){u+=+e(n).attr("data-sizey")}),this.cols=Math.max(o,i,this.options.min_cols),this.rows=Math.max(u,this.options.min_rows),this.baseX=(e(t).width()-n)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},e.fn.gridster=function(t){return this.each(function(){e(this).data("gridster")||e(this).data("gridster",new s(this,t))})},e.Gridster=o}(jQuery,window,document),function(){function n(e,t,n){var r="";if(!t||t.length===0)return r;for(var i=0;i<t.date.length;i++)t.date[i]==n[e.index]&&(r=t.marks[i]);return r}function r(e,t){var r={name:e,config:{colors:t.colors,grid:{verticalLines:!1,horizontalLines:!1},mouse:{track:!0,trackY:!1,position:"ne"},yaxis:{min:0,autoscale:!0},legend:{show:!1,backgroundColor:"#FFFFFF",backgroundOpacity:0}}};return t.gtype==="whiskers"?r.config.whiskers={show:!0,lineWidth:2}:r.config["lite-lines"]={lineWidth:2,show:!0,fill:!1,fillOpacity:.5},t.y_labels&&(r.config.yaxis={showLabels:!0,min:0}),t.show_markers&&(r.config.markers={show:!0,position:"ct",labelFormatter:function(e){return n(e,t.markers,t.dates)}}),r}function i(e,n,i,s){var o=Report.getAllMetrics(),u=null;$.each(i,function(i,a){config=s,a.envision&&(config=DataProcess.mergeConfig(s,a.envision)),$.inArray(i,t.envision_hide)===-1&&(n[i]=r("report-"+e.getName()+"-"+i,config),u=i,o[i]&&(u=o[i].name),n[i].config.subtitle=u,e.getMainMetric()==i&&(n[i+"_relative"]=r("report-"+e.getName()+"-"+i+"_relative",config),n[i].config["lite-lines"]={show:!1},n[i].config.lines={lineWidth:1,show:!0,stacked:!0,fill:!0,fillOpacity:1}))})}function s(n){var s=["#ffa500","#00A8F0","#C0D800","#ffff00","#00ff00","#4DA74D","#9440ED"],o={colors:s,dates:t.dates,g_type:"",markers
:t.markers,y_labels:!1},u=Report.getDataSources(),a={},f={};return n?$.each(u,function(e,t){$.inArray(t.getName(),n)>-1&&(f=t.getMetrics(),i(t,a,f,o))}):$.each(u,function(e,t){f=t.getMetrics(),i(t,a,f,o)}),config=o,a.summary=r("report-summary",config),a.summary.config.xaxis={noTickets:10,showLabels:!0},a.summary.config.handles={show:!0},a.summary.config.selection={mode:"x"},a.summary.config.mouse={},a.connection={name:"report-connection",adapterConstructor:e.components.QuadraticDrawing},a}function o(e,t){var n=[],r=null;return $.each(e,function(e,n){if(n.getMetrics()[t])return r=n,!1}),n.push(r),$.each(e,function(e,t){if(t===r)return;n.push(t)}),n}function u(n,r){var i=n.data.main_metric;t=n.data,r||(r=Report.getDataSources()),r=o(r,i);var u=[];for(var a=0;a<r.length;a++){if(r[a].getData().length===0)continue;u.push(r[a].getName())}var f=n.data,l=s(u),c=new e.Visualization({name:"report-"+u.join(",")}),h=new e.Interaction,p=new e.Interaction,d={};$.each(r,function(e,t){if(t.getData().length===0)return;d=$.extend(d,t.getMetrics())}),$.each(d,function(e,t){if($.inArray(e,f.envision_hide)!==-1)return;if(f[e]===undefined)return;l[e].data=f[e],l[e].data.length<Report.getProjectsList().length&&(l[e].config.legend.show=!0),f[e+"_relative"]&&(l[e].data=f[e+"_relative"])}),l.summary.data=f.summary,l[i].config.legend.show=!0,n.legend_show===!1&&(l[i].config.legend.show=!1),l[i].config.mouse.trackFormatter=n.trackFormatter,n.xTickFormatter&&(l.summary.config.xaxis.tickFormatter=n.xTickFormatter),l[i].config.yaxis.tickFormatter=n.yTickFormatter||function(e){return"$"+e};var v={};$.each(d,function(t,n){if(f[t]===undefined)return;$.inArray(t,f.envision_hide)===-1&&(v[t]=new e.Component(l[t]))}),connection=new e.Component(l.connection),summary=new e.Component(l.summary),$.each(v,function(e,t){c.add(t)}),c.add(connection).add(summary).render(n.container),$.each(v,function(e,t){h.follower(t)}),h.follower(connection).leader(summary).add(e.actions.selection,n.selectionCallback?{callback:n.selectionCallback}:null);var m=[];$.each(v,function(e,t){m.push(t)}),p.group(m).add(e.actions.hit),n.selection&&summary.trigger("select",n.selection)}var e=envision,t={};e.templates.Envision_Report=u}();if(Loader===undefined)var Loader={};(function(){function u(e,t){e.project_name===undefined&&(e.project_name=t.replace("data/json","").replace(/\.\.\//g,""));var n=Report.getProjectsData();n[e.project_name]={dir:t,url:e.project_url}}function a(e,t,n){$.when($.getJSON(e)).done(function(e){t(e,n),O()}).fail(function(){t([],n),O()})}function f(){var e=["irc","mediawiki"],t=Report.getDataSources();$.each(t,function(t,n){$.inArray(n.getName(),e)>-1?n.setCompaniesData([]):a(n.getCompaniesDataFile(),n.setCompaniesData,n)})}function l(){var e=["mediawiki"],t=Report.getDataSources();$.each(t,function(t,n){$.inArray(n.getName(),e)>-1?n.setReposData([]):a(n.getReposDataFile(),n.setReposData,n)}),a(Report.getReposMapFile(),Report.setReposMap)}function c(){var e=["irc","mediawiki"],t=Report.getDataSources();$.each(t,function(t,n){$.inArray(n.getName(),e)>-1?n.setCountriesData([]):a(n.getCountriesDataFile(),n.setCountriesData,n)})}function h(){var e=["irc","mediawiki"],t=Report.getDataSources();$.each(t,function(t,n){$.inArray(n.getName(),e)>-1?n.setDomainsData([]):a(n.getDomainsDataFile(),n.setDomainsData,n)})}function p(){var e=Report.getDataSources();$.each(e,function(e,t){t.getName()==="its"&&a(t.getTimeToFixDataFile(),t.setTimeToFixData,t)})}function d(){var e=Report.getDataSources();$.each(e,function(e,t){t.getName()==="its"&&a(t.getMarkovTableDataFile(),t.setMarkovTableData,t)})}function v(){var e=Report.getDataSources();$.each(e,function(e,t){t.getName()==="mls"&&a(t.getTimeToAttentionDataFile(),t.setTimeToAttentionData,t)})}function m(){var e=Report.getDataSources();$.each(e,function(e,t){a(t.getDemographicsAgingFile(),t.setDemographicsAgingData,t),a(t.getDemographicsBirthFile(),t.setDemographicsBirthData,t)})}function g(e){var t=Report.getDataSources();$.each(t,function(e,t){var n=t.getTopDataFile();$.when($.getJSON(n)).done(function(e){t.setGlobalTopData(e),O()}).fail(function(){t.setGlobalTopData([],t),O()})})}function y(e,t){var n=null;return $.each(Report.getDataSources(),function(r,i){if(t=="repos"&&$.inArray(e,i.getReposData())>-1)return n=i,!1;if(t=="companies"&&$.inArray(e,i.getCompaniesData())>-1)return n=i,!1;if(t=="countries"&&$.inArray(e,i.getCountriesData())>-1)return n=i,!1;if(t=="domains"&&$.inArray(e,i.getDomainsData())>-1)return n=i,!1}),n}function b(e){var t="";return e==="repos"?t="rep":e==="companies"?t="com":e==="countries"?t="cou":e==="domains"&&(t="dom"),t}function w(){var e=Report.getDataSources();$.each(e,function(e,t){a(t.getDataFile(),t.setData,t),a(t.getGlobalDataFile(),t.setGlobalData,t),t instanceof MLS&&a(t.getListsFile(),t.setListsData,t)})}function E(){a("VizGrimoireJS/data/metrics.json",Report.setMetricsDefinition)}function S(){var e=Report.getDataSources();$.each(e,function(e,t){a(t.getPeopleDataFile(),t.setPeopleData,t)})}function x(){a(Report.getDataDir()+"/people.json",Report.setPeopleIdentities)}function T(e){return e.getCompaniesData()===null?!1:!0}function N(e){return e.getReposData()===null?!1:!0}function C(e){return e.getCountriesData()===null?!1:!0}function k(e){return e.getDomainsData()===null?!1:!0}function L(){var e=0,t=Report.getProjectsData(),n=Report.getProjectsDirs();for(var r in t)e++;return e<n.length?!1:!0}function A(){var e=!0;if(Report.getProjectData()===null||Report.getVizConfig()===null)return!1;if(Report.getConfig()===null&&Report.getMarkers()===null)return!1;if(Report.getReposMap()===null)return!1;if(Report.getConfig()===null&&!L())return!1;var t=Report.getDataSources();return $.each(t,function(t,n){if(n.getData()===null)return e=!1,!1;if(n.getGlobalData()===null)return e=!1,!1;if(n.getGlobalTopData()===null)return e=!1,!1;if(n.getDemographicsData().aging===undefined||n.getDemographicsData().birth===undefined)return e=!1,!1;if(n.getName()==="its"&&n.getTimeToFixData()===null)return e=!1,!1;if(n.getName()==="mls"&&n.getTimeToAttentionData()===null)return e=!1,!1}),e}function O(){if(A()){for(var n=0;n<t.length;n++)t[n]();t=[]}if(Loader.check_data_loaded())for(var r=0;r<e.length;r++)e[r].called!==!0&&e[r](),e[r].called=!0}var e=[],t=[],n=[],r=!1,i=!1,s=!1,o=["scr","irc","mediawiki"];Loader.data_ready=function(t){e.push(t)},Loader.data_ready_global=function(e){t.push(e)},Loader.data_load=function(){Report.getConfig()!==null&&Report.getConfig().project_info!==undefined?(Report.setProjectData(Report.getConfig().project_info),Report.getConfig().markers&&a(Report.getMarkersFile(),function(e,t){Report.setMarkers(e)})):(a(Report.getProjectFile(),function(e,t){Report.setProjectData(e)}),a(Report.getMarkersFile(),function(e,t){Report.setMarkers(e)}));var e=Report.getProjectsDirs();for(var t=0;t<e.length;t++){var n=e[t],r=Report.getDataDir()+"/project-info.json";a(r,u,n)}a(Report.getVizConfigFile(),function(e,t){Report.setVizConfig(e)}),E(),w(),g("authors"),p(),v(),m(),d();if(Report.getConfig()!==null&&Report.getConfig().reports!==undefined){var i=Report.getConfig().reports;$.inArray("companies",i)>-1&&f(),$.inArray("repositories",i)>-1&&l(),$.inArray("countries",i)>-1&&c(),$.inArray("domains",i)>-1&&h(),$.inArray("people",i)>-1&&(S(),x())}else f(),l(),c(),h(),S(),x()},Loader.get_file_data_div=function(e,t,n){$.when($.getJSON(e)).done(function(r){t(n,e,r)}).fail(function(){t(e,null)})},Loader.check_filters_page=function(e){var t=!0,n=["repos","companies","countries"];return $.each(n,function(n,r){if(!Loader.check_filter_page(e,r))return t=!1,!1}),t},Loader.check_filter_page=function(e,t){var n=!0;e===undefined&&(e=1);var r=Report.getPageSize()*(e-1),i=r+Report.getPageSize();return $.each(Report.getDataSources(),function(e,s){var o=0;t==="repos"&&(o=s.getReposData().length),t==="companies"&&(o=s.getCompaniesData().length),t==="countries"&&(o=s.getCountriesData().length),t==="domains"&&(o=s.getDomainsData().length),i>o&&(i=o);for(var u=r;u<i;u++){var a;if(t==="repos"){a=s.getReposData()[u];if(s.getReposGlobalData()[a]===undefined||s.getReposMetricsData()[a]===undefined)return n=!1,!1}if(t==="companies"){a=s.getCompaniesData()[u];if(s.getCompaniesGlobalData()[a]===undefined||s.getCompaniesMetricsData()[a]===undefined)return n=!1,!1}if(t==="countries"){a=s.getCountriesData()[u];if(s.getCountriesGlobalData()[a]===undefined||s.getCountriesMetricsData()[a]===undefined)return n=!1,!1}if(t==="domains"){a=s.getDomainsData()[u];if(s.getDomainsGlobalData()[a]===undefined||s.getDomainsMetricsData()[a]===undefined)return n=!1,!1}}i=r+Report.getPageSize()}),n},Loader.FilterItemCheck=function(e,t){var n=!0,r,i=Report.getReposMap();if(t==="repos"){if(Loader.check_item(e,t)===!1)return r=y(e,t),r===null?(Report.log("Can't find data source for "+e),!0):(Loader.data_load_item(e,r,null,Convert.convertFilterStudyItem,t,null),!1);if(i!==undefined&&i.length!==0){var s=[];$.each(Report.getDataSources(),function(n,r){var i=Convert.getRealItem(r,t,e);i!==undefined&&i!==null&&s.push(i)});if(Loader.check_items(s,t)===!1){for(var u=0;u<s.length;u++)if(Loader.check_item(s[u],t)===!1){r=y(s[u],t);if(r===null){Report.log("Can't find "+s[u]),Report.log("Check repos-map.json");continue}Loader.data_load_item(s[u],r,null,Convert.convertFilterStudyItem,t,s)}n=!1}}}else $.each(Report.getDataSources(),function(r,i){Loader.check_item(e,t)===!1&&(n=!1,Loader.data_load_item(e,i,null,Convert.convertFilterStudyItem,t,null),t==="companies"&&$.inArray(i.getName(),o)===-1&&Loader.data_load_item_top(e,i,null,Convert.convertFilterStudyItem,t))});return n},Loader.check_item=function(e,t){var n=!1;return $.each(Report.getDataSources(),function(r,i){if(t==="repos"&&i.getReposGlobalData()[e]!==undefined&&i.getReposMetricsData()[e]!==undefined)return n=!0,!1;if(t==="companies"){var s=i.getCompaniesData();if(s.length===0)n=!0;else if($.inArray(e,s)===-1)n=!0;else{if(i.getCompaniesGlobalData()[e]===undefined||i.getCompaniesMetricsData()[e]===undefined)return n=!1,!1;if($.inArray(i.getName(),o)===-1&&i.getCompaniesTopData()[e]===undefined)return n=!1,!1;n=!0}}if(t==="countries"){var u=i.getCountriesData();if(u.length===0)n=!0;else if($.inArray(e,u)===-1)n=!0;else{if(i.getCountriesGlobalData()[e]===undefined||i.getCountriesMetricsData()[e]===undefined)return n=!1,!1;n=!0}}if(t==="domains"){var a=i.getDomainsData();if(a.length===0)n=!0;else if($.inArray(e,a)===-1)n=!0;else{if(i.getDomainsGlobalData()[e]===undefined||i.getDomainsMetricsData()[e]===undefined)return n=!1,!1;n=!0}}}),n},Loader.check_items=function(e,t){var n=!0;return $.each(e,function(e,r){if(Loader.check_item(r,t)===!1)return n=!1,!1}),n},Loader.data_load_items_page=function(e,t,n,r){t===undefined&&(t=1);if(r==="repos"&&e.getReposData()===null)return!1;if(r==="companies"&&e.getCompaniesData()===null)return!1;if(r==="countries"&&e.getCountriesData()===null)return!1;if(r==="domains"&&e.getDomainsData()===null)return!1;var i=0;r==="repos"&&(i=e.getReposData().length),r==="companies"&&(i=e.getCompaniesData().length),r==="countries"&&(i=e.getCountriesData().length),r==="domains"&&(i=e.getDomainsData().length);if(i===0)return!0;var s=Report.getPageSize()*(t-1),o=s+Report.getPageSize();o>i&&(o=i);for(var u=s;u<o;u++)if(r==="repos"){var a=e.getReposData()[u];Loader.data_load_item(a,e,t,n,"repos")}else if(r==="companies"){var f=e.getCompaniesData()[u];Loader.data_load_item(f,e,t,n,"companies")}else if(r==="countries"){var l=e.getCountriesData()[u];Loader.data_load_item(l,e,t,n,"countries")}else if(r==="domains"){var c=e.getDomainsData()[u];Loader.data_load_item(c,e,t,n,"domains")}},Loader.check_people_item=function(e){var t=!0;return $.each(Report.getDataSources(),function(n,r){if(r.getPeopleGlobalData()[e]===undefined||r.getPeopleMetricsData()[e]===undefined)return t=!1,!1}),t},Loader.data_load_people_item=function(e,t,n){var r=t.getDataDir()+"/people-"+e+"-"+t.getName(),i=r+"-evolutionary.json",s=r+"-static.json";$.when($.getJSON(i),$.getJSON(s)).done(function(r,i){t.addPeopleMetricsData(e,r[0],t),t.addPeopleGlobalData(e,i[0],t),Loader.check_people_item(e)&&n(e)}).fail(function(){t.addPeopleMetricsData(e,[],t),t.addPeopleGlobalData(e,[],t),Loader.check_people_item(e)&&n(e)})},Loader.data_load_item_top=function(e,t,n,r,i){var s=t.getDataDir()+"/"+e+"-"+t.getName();s+="-"+b(i)+"-top-";if(t.getName()==="scm")s+="authors";else if(t.getName()==="its")s+="closers";else{if(t.getName()!=="mls")return;s+="senders"}s+=".json",$.when($.getJSON(s)).done(function(n){i==="companies"&&t.addCompanyTopData(e,n)}).fail(function(){i==="companies"&&t.addCompanyTopData(e,[])}).always(function(){Loader.check_item(e,i)&&(r.called_item||r(i),r.called_item=!0)})},Loader.data_load_item=function(e,t,n,r,i,s){var o=["irc","mediawiki"],u=["irc","mediawiki"],a=["irc","mediawiki"],f=["mediawiki"];if(i==="repos"){if($.inArray(t.getName(),f)>-1){t.addRepoMetricsData(e,[],t),t.addRepoGlobalData(e,[],t);return}}else if(i==="companies"){if($.inArray(t.getName(),u)>-1){t.addCompanyMetricsData(e,[],t),t.addCompanyGlobalData(e,[],t);return}}else if(i==="countries"){if($.inArray(t.getName(),o)>-1){t.addCountryMetricsData(e,[],t),t.addCountryGlobalData(e,[],t);return}}else{if(i!=="domains")return;if($.inArray(t.getName(),a)>-1){t.addDomainMetricsData(e,[],t),t.addDomainGlobalData(e,[],t);return}}var l=encodeURIComponent(e),c=t.getDataDir()+"/"+l+"-";c+=t.getName()+"-"+b(i);var h=c+"-evolutionary.json",p=c+"-static.json";$.when($.getJSON(h),$.getJSON(p)).done(function(n,r){i==="repos"?(t.addRepoMetricsData(e,n[0],t),t.addRepoGlobalData(e,r[0],t)):i==="companies"?(t.addCompanyMetricsData(e,n[0],t),t.addCompanyGlobalData(e,r[0],t)):i==="countries"?(t.addCountryMetricsData(e,n[0],t),t.addCountryGlobalData(e,r[0],t)):i==="domains"&&(t.addDomainMetricsData(e,n[0],t),t.addDomainGlobalData(e,r[0],t))}).always(function(){n!==null?Loader.check_filter_page(n,i)&&(r.called_page===undefined?(r.called_page={},r.called_page[i]=!0,r(i)):r.called_page[i]||(r(i),r.called_page[i]=!0)):s!==null?Loader.check_items(s,i)&&(r.called_map===undefined?(r.called_map={},r.called_map[i]=!0,r(i)):r.called_map[i]||(r(i),r.called_map[i]=!0)):Loader.check_item(e,i)&&(r.called_item===undefined?(r.called_item={},r.called_item[i]=!0,r(i,e)):r.called_item[i]||(r(i,e),r.called_item[i]=!0))})},Loader.check_data_loaded=function(){var e=!0;if(!A())return!1;var t=Report.getDataSources(),n=["companies","repositories","countries","domains"];return Report.getConfig()!==null&&Report.getConfig().reports!==undefined&&(n=Report.getConfig().reports),$.each(t,function(t,r){if(r.getPeopleData()===null)return e=!1,!1;if($.inArray("companies",n)>-1&&!T(r))return e=!1,!1;if($.inArray("repositories",n)>-1&&!N(r))return e=!1,!1;if($.inArray("countries",n)>-1&&!C(r))return e=!1,!1;if($.inArray("domains",n)>-1&&!k(r))return e=!1,!1;if(r instanceof MLS&&r.getListsData()===null)return e=!1,!1}),e}})();var DataProcess={};(function(){DataProcess.info=function(){},DataProcess.paginate=function(e,t){if(t===undefined||t===0||isNaN(t))return e;var n=[],r=Report.getPageSize(),i=(t-1)*r;for(var s=i;s<r*t;s++)e[s]&&n.push(e[s]);return n},DataProcess.convert=function(e,t,n){return t==="aggregate"?e=DataProcess.aggregate(e,n):t==="substract"?(e=DataProcess.substract(e,n[0],n[1]),n=["substract"]):t==="substract-aggregate"?(e=DataProcess.substract(e,n[0],n[1]),n=["substract"],e=DataProcess.aggregate(e,n)):t==="divide"&&(e=DataProcess.divide(e,n[0],n[1]),n=["divide"]),e},DataProcess.sortCompanies=function(e,t){return sortGlobal(e,t,"companies")},DataProcess.sortCountries=function(e,t){return sortGlobal(e,t,"countries")},DataProcess.sortRepos=function(e,t){return sortGlobal(e,t,"repos")},DataProcess.sortDomains=function(e,t){return sortGlobal(e,t,"domains")},sortGlobal=function(e,t,n){t===undefined&&(t="scm_commits");var r=[],i=[],s=[];n==="companies"?i=e.getCompaniesData():n==="repos"?i=e.getReposData():n==="countries"?i=e.getCountriesData():n==="domains"&&(i=e.getDomainsData());if(i===null)return[];if(n!=="repos")return i;metrics_data=e.getReposDataFull();if(metrics_data instanceof Array||t in metrics_data==0)return i;for(var o=0;o<metrics_data[t].length;o++){var u=metrics_data[t][o];u==="NA"&&(u=0),r.push([metrics_data.name[o],u])}return r.sort(function(e,t){return t[1]-e[1]}),$.each(r,function(e,t){s.push(t[0])}),s},DataProcess.orderItems=function(e){$.each($("[class^='FilterItems']"),function(t,n){order_by=$(this).data("order-by");if(order_by!==undefined){ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;var r=$(this).data("filter");if(r===undefined)return;if(r!==e)return;Report.log("Ordering with "+order_by+" "+ds+" for "+r);var i=sortGlobal(DS,order_by,r);r==="companies"&&DS.setCompaniesData(i),r==="repos"&&DS.setReposData(i),r==="countries"&&DS.setReposData(i),r==="domains"&&DS.setReposData(i)}})},DataProcess.mergeConfig=function(e,t){var n={};return $.each(e,function(e,t){n[e]=t}),$.each(t,function(e,t){n[e]=t}),n},DataProcess.hideEmail=function(e){var t=e;return typeof e=="string"&&e.indexOf("@")>-1&&(t=e.split("@")[0]),t},DataProcess.selectPersonName=function(e){var t="",n,r;for(var i=0;i<e.identity.length;i++)n=e.identity[i],r=e.type[i],r==="name"&&n.length>t.length&&(t=n);return t},DataProcess.selectPersonEmail=function(e){var t="",n,r;for(var i=0;i<e.identity.length;i++)n=e.identity[i],r=e.type[i],r==="email"&&(t=n);return t},DataProcess.frameTime=function(e,t){var n={},r=-1,i=-1,s=0;if(t.length===0)return e;var o=e[t[0]].length,u=0;$.each(t,function(t,n){s=0;for(u=0;u<e[n].length;u++){if(e[n][u]!==0){r===-1&&(r=s),s<r&&(r=s);break}s++}}),$.each(t,function(t,n){s=0;for(u=e[n].length-1;u>=0;u--){if(e[n][u]!==0){i===-1&&(i=s),s<i&&(i=s);break}s++}});for(var a in e){n[a]=[];for(u=0;u<e[a].length;u++){if(u<r)continue;if(u>=o-i)continue;n[a].push(e[a][u])}}return n},DataProcess.filterDates=function(e,t,n){var r={};return $.each(n,function(i,s){r[i]=[],$.each(s,function(s,o){var u=n.unixtime[s];u>e&&(!t||t&&u<=t)&&r[i].push(o)})}),r},DataProcess.filterYear=function(e,t){e=parseInt(e,null);var n=(new Date(e.toString())).getTime(),r=(new Date((e+1).toString())).getTime(),i=filterDates(n,r,t);return i},DataProcess.fillDates=function(e,t){if(e[0].length===0)return t;var n=[[],[]],r=0;if(e[0][0]>t[0][0])for(r=0;r<t[0].length;r++)n[0][r]=t[0][r],n[1][r]=t[1][r];for(r=0;r<e[0].length;r++)pos=n[0].indexOf(e[0][r]),pos===-1&&(n[0].push(e[0][r]),n[1].push(e[1][r]));if(e[0][e[0].length-1]<t[0][t[0].length-1])for(r=0;r<t[0].length;r++)pos=n[0].indexOf(t[0][r]),pos===-1&&(n[0].push(t[0][r]),n[1].push(t[1][r]));return n},DataProcess.fillHistory=function(e,t){var n=[[],[]];for(var r=0;r<e.length;r++)pos=t[0].indexOf(e[r]),n[0][r]=e[r],pos!=-1?n[1][r]=t[1][pos]:n[1][r]=0;return n},DataProcess.fillHistoryLines=function(e,t){var n=[[],[]],r=[[],[]],i=[];for(var s=0;s<t.length;s++)n[0].push(t[s][0]),n[1].push(t[s][1]);r=DataProcess.fillHistory(e,n);for(s=0;s<e.length;s++)i.push([r[0][s],r[1][s]]);return i},DataProcess.addRelativeValues=function(e,t){if(e[t]===undefined)return;e[t+"_relative"]=[];var n=[];$.each(e[t],function(e,t){var r=t.data[1];for(var i=0;i<r.length;i++)n[i]===undefined&&(n[i]=0),n[i]+=r[i]}),$.each(e[t],function(r,i){var s=[];for(var o=0;o<i.data[0].length;o++)if(n[o]===0)s[o]=0;else{var u=i.data[1][o]/n[o]*100;s[o]=u}e[t+"_relative"].push({label:i.label,data:[i.data[0],s]})})},DataProcess.aggregate=function(e,t){var n={};return t instanceof Array||(t=[t]),$.each(e,function(r,i){if($.inArray(r,t)>-1){var s=[];s[0]=e[r][0];for(var o=1;o<e[r].length;o++)s[o]=s[o-1]+e[r][o];n[r]=s}else n[r]=e[r]}),n},DataProcess.substract=function(e,t,n){var r={},i=[];for(var s=0;s<e[t].length;s++)i[s]=e[t][s]-e[n][s];return $.each(e,function(t,n){r[t]=e[t]}),r.substract=i,r},DataProcess.divide=function(e,t,n){var r={},i=[];for(var s=0;s<e[t].length;s++)e[t][s]===0||e[n][s]===0?i[s]=0:i[s]=parseInt(e[t][s]/e[n][s],null);return $.each(e,function(t,n){r[t]=e[t]}),r.divide=i,r},DataProcess.revomeLastPoint=function(e){var t={};return $.each(e,function(n,r){t[n]=[];for(var i=0;i<e[n].length-1;i++)t[n].push(e[n][i])}),t}})();var Convert={};(function(){function e(){data=Report.getProjectData(),document.title=data.project_name+" Report by Bitergia",data.title&&(document.title=data.title),$(".report_date").text(data.date),$(".report_name").text(data.project_name),str=data.blog_url,str&&str.length>0?($("#blogEntry").html("<br><a href='"+str+"'>Blog post with some more details</a>"),$(".blog_url").attr("href",data.blog_url)):$("#more_info").hide(),str=data.producer,str&&str.length>0?$("#producer").html(str):$("#producer").html("<a href='http://bitergia.com'>Bitergia</a>"),$(".project_name").text(data.project_name),$("#project_url").attr("href",data.project_url)}function t(){return Math.floor(Math.random()*1e3+1)}function n(){var e={};return e.show_desc=!1,e.show_title=!1,e.show_labels=!0,e.show_legend=!1,e}Convert.convertMicrodashText=function(){var e=$(".MicrodashText");e.length>0&&$.each(e,function(e,t){$(this).empty();var n=$(this).data("metric"),r=$(this).data("name"),i=Report.getMetricDS(n)[0];if(i===undefined)return;var s=i.getGlobalData()[n],o='<div class="row-fluid">';r&&(o+='<div class="span3">',o+='<span class="dayschange">'+i.basic_metrics[n].name+"</span>",o+="</div>"),$.each([365,30,7],function(e,t){var s=i.getMetrics()[n].column,u=i.getGlobalData()[n+"_"+t],a=i.getGlobalData()["diff_net"+s+"_"+t],f=i.getGlobalData()["percentage_"+s+"_"+t];f=Math.round(f*10)/10;if(u===undefined)return;var l="";a>0&&(l="+"+f),a<0&&(l="-"+Math.abs(f)),r?o+='<div class="span3">':o+='<div class="span4">',o+='<span class="dayschange">Last '+t+" days:</span>",o+=" "+Report.formatValue(u)+"<br>",a===0?o+='<i class="fa fa-arrow-circle-right"></i> <span class="zeropercent"> '+l+"%</span> ":a>0?o+='<i class="fa fa-arrow-circle-up"></i> <span class="pospercent"> '+l+"%</span> ":a<0&&(o+='<i class="fa fa-arrow-circle-down"></i> <span class="negpercent"> '+l+"%</span> "),o+="</div><!--span4-->"}),o+="</div><!--row-fluid-->",$(t).append(o)})},Convert.convertMicrodash=function(){var e=$(".Microdash");e.length>0&&$.each(e,function(e,t){$(this).empty();var n=$(this).data("metric"),r=$(this).data("text"),i=Report.getMetricDS(n)[0],s=i.getGlobalData()[n],o="<div>";o+='<div style="float:left">',o+='<span class="medium-fp-number">'+Report.formatValue(s),o+="</span> "+i.getMetrics()[n].name,o+="</div>",o+='<div id="Microdash" class="MetricsEvol" data-data-source="'+i.getName()+'" data-metrics="'+n+'" data-min=true style="margin-left:10px; float:left;width:100px; height:25px;"></div>',o+='<div style="clear:both"></div><div>',$.each([365,30,7],function(e,t){var r=i.getMetrics()[n].column,s=i.getGlobalData()["diff_net"+r+"_"+t],u=i.getGlobalData()["percentage_"+r+"_"+t],a=i.getGlobalData()[n+"_"+t];if(a===undefined)return;o+="<span class='dayschange'>"+t+" Days Change</span>:"+Report.formatValue(a)+" ",s===0?o+="":s>0?(o+='<i class="icon-circle-arrow-up"></i>',o+="<small>(+"+u+"%)</small> "):s<0&&(o+='<i class="icon-circle-arrow-down"></i>',o+="<small>(-"+Math.abs(u)+"%)</small> ")}),o+="</div>",o+="<div>",$(t).append(o)})},Convert.convertNavbar=function(){$.get(Report.getHtmlDir()+"navbar.html",function(t){$("#Navbar").html(t),e(),Report.displayActiveMenu();var n=Report.addDataDir();if(n){var r=$("#Navbar a");$.each(r,function(e,t){if(t.href.indexOf("data_dir")!==-1)return;t.href+="?"+n})}})},Convert.convertFooter=function(){$.get(Report.getHtmlDir()+"footer.html",function(e){$("#Footer").html(e),$("#vizjs-lib-version").append(vizjslib_git_tag)})},Convert.convertSummary=function(){div_param="Summary";var e=$("."+div_param);e.length>0&&$.each(e,function(e,t){$(this).empty();var n=$(this).data("data-source"),r=Report.getDataSourceByName(n);if(r===null)return;t.id=n+"-Summary",r.displayGlobalSummary(t.id)})},Convert.convertRefcard=function(){$.when($.get(Report.getHtmlDir()+"refcard.html"),$.get(Report.getHtmlDir()+"project-card.html")).done(function(t,n){refcard=t[0],projcard=n[0],$("#Refcard").html(refcard),e(),$.each(Report.getProjectsData(),function(e,t){var n="card-"+e.replace(".","").replace(" ","");$("#Refcard #projects_info").append(projcard),$("#Refcard #projects_info #new_card").attr("id",n),$.each(Report.getDataSources(),function(t,r){if(r.getProject()!==e){$("#"+n+" ."+r.getName()+"-info").hide();return}r.displayData(n)}),$("#"+n+" #project_name").text(e),Report.getProjectsDirs.length>1&&$("#"+n+" .project_info").append(' <a href="VizGrimoireJS/browser/index.html?data_dir=../../'+t.dir+'">Report</a>'),$("#"+n+" #project_url").attr("href",t.url)})})},Convert.convertGlobalData=function(){var e=$(".GlobalData");e.length>0&&$.each(e,function(e,t){ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;var n=DS.getGlobalData(),r=$(this).data("field");$(this).text(Report.formatValue(n[r],r))})},Convert.convertRadarActivity=function(){var e="RadarActivity",t=$("#"+e);t.length>0&&($.each(t,function(e,t){$(this).empty()}),Viz.displayRadarActivity(e))},Convert.convertRadarCommunity=function(){var e="RadarCommunity",t=$("#"+e);t.length>0&&($.each(t,function(e,t){$(this).empty()}),Viz.displayRadarCommunity("RadarCommunity"))},Convert.convertTreemap=function(){var e="Treemap",t=$("#"+e);if(t.length>0){$.each(t,function(e,t){$(this).empty()});var n=$("#Treemap").data("file");$("#Treemap").empty(),Viz.displayTreeMap("Treemap",n)}},Convert.convertBubbles=function(){div_param="Bubbles";var e=$("."+div_param);e.length>0&&$.each(e,function(e,t){$(this).empty();var n=$(this).data("data-source"),r=Report.getDataSourceByName(n);if(r===null)return;if(r.getData().length===0)return;var i=$(this).data("radius");t.id=n+"-Bubbles",r.displayBubbles(t.id,i)})},Convert.convertMetricsEvol=function(){var e={};e.show_desc=!1,e.show_title=!0,e.show_labels=!0;var t=Report.getVizConfig();t&&$.each(t,function(t,n){e[t]=n});var n="MetricsEvol",r=$("."+n);r.length>0&&$.each(r,function(t,n){var r={};$.each(e,function(e,t){r[e]=t}),$(this).empty();var i=$(this).data("metrics"),s=$(this).data("data-source"),o=Report.getDataSourceByName(s);if(o===null)return;r.help=!0;var u=$(this).data("help");u!==undefined&&(r.help=u),r.show_legend=!1,$(this).data("legend")&&(r.show_legend=!0),$(this).data("frame-time")&&(r.frame_time=!0),r.graph=$(this).data("graph"),$(this).data("min")&&(r.show_legend=!1,r.show_labels=!0,r.show_grid=!0,r.help=!1),r.ligth_style=!1,$(this).data("light-style")&&(r.light_style=!0),$(this).data("custom-title")&&(r.custom_title=$(this).data("custom-title")),r.help&&$(this).data("custom-help")?r.custom_help=$(this).data("custom-help"):r.custom_help="";var a=$(this).data("start");a&&(r.start_time=a);var f=$(this).data("end");f&&(r.end_time=f);var l=$(this).data("remove-last-point");l&&(r.remove_last_point=!0),n.id=i.replace(/,/g,"-")+"-"+s+"-metrics-evol-"+this.id,n.id=n.id.replace(/\n|\s/g,""),o.displayMetricsEvol(i.split(","),n.id,r,$(this).data("convert"))})},Convert.convertMetricsEvolSet=function(){div_param="MetricsEvolSet";var e=$("."+div_param);e.length>0&&$.each(e,function(e,t){$(this).empty();var n=$(this).data("all"),r=$(this).data("relative"),i=$(this).data("summary-graph"),s=$(this).data("legend-show");t.id=o+"-MetricsEvolSet-"+this.id;if(n===!0)return t.id=o+"-All",Viz.displayEnvisionAll(t.id,r,s,i),!1;var o=$(this).data("data-source"),u=Report.getDataSourceByName(o);if(u===null)return;u.displayEnvision(t.id,r,s,i)})},Convert.convertTimeTo=function(){var e="TimeTo";divs=$("."+e),divs.length>0&&$.each(divs,function(e,t){$(this).empty();var n=$(this).data("data-source"),r=Report.getDataSourceByName(n);if(r===null)return;var i=$(this).data("quantil"),s=$(this).data("type");t.id=n+"-time-to-"+s+"-"+i,s==="fix"&&r.displayTimeToFix(t.id,i),s==="attention"&&r.displayTimeToAttention(t.id,i)})},Convert.convertMarkovTable=function(){var e="MarkovTable",t=$("."+e),n,r;t.length>0&&$.each(t,function(e,t){$(this).empty(),r=$(this).data("data-source"),n=Report.getDataSourceByName(r);if(n===null)return;if(n.getData().length===0)return;var i=$(this).data("title");t.id=r+"-markov-table",n.displayMarkovTable(t.id,i)})},Convert.convertLastActivity=function(){function t(t,n,r){var i="<h4>Last "+r+"</h4>";$.each(Report.getDataSources(),function(t,s){var o=s.getGlobalData();$.each(o,function(t,s){var u="_"+n;if(t.indexOf(u,t.length-u.length)!==-1){var a=t.substring(0,t.length-u.length);r=a,e[a]&&(r=e[a].name),i+=r+":"+o[t]+"<br>"}})}),$(t).append(i)}var e=Report.getAllMetrics(),n=$(".LastActivity"),r=null,i={Week:7,Month:30,Quarter:90,Year:365};n.length>0&&$.each(n,function(e,n){r=$(n).data("period"),t(n,i[r],r)})},Convert.convertTop=function(){var e="Top",t=$("."+e),n,r;if(t.length>0){var i=0;$.each(t,function(t,s){$(this).empty(),r=$(this).data("data-source"),n=Report.getDataSourceByName(r);if(n===null)return;if(n.getData().length===0)return;var o=!1;$(this).data("show_all")&&(o=!0);var u=$(this).data("metric"),a=$(this).data("limit"),f=$(this).data("graph"),l=$(this).data("people_links"),c=$(this).data("threads_links"),h=$(this).data("period"),p=$(this).data("period_all");s.id=r+"-"+e+i++,f&&(s.id+="-"+f),n.displayTop(s.id,o,u,h,p,f,a,l,c)})}},Convert.convertPersonMetrics=function(e,t){var n={};n.show_desc=!1,n.show_title=!1,n.show_labels=!0,divs=$(".PersonMetrics"),divs.length&&$.each(divs,function(r,i){$(this).empty(),ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;var s=$(this).data("metrics");n.show_legend=!1,$(this).data("legend")&&(n.show_legend=!0),$(this).data("person_id")&&(e=$(this).data("person_id")),$(this).data("person_name")&&(t=$(this).data("person_name")),i.id=s.replace(/,/g,"-")+"-people-metrics",DS.displayMetricsPeople(e,t,s.split(","),i.id,n)})},Convert.convertPersonData=function(e,n){var r=$(".PersonData"),i,s;r.length>0&&$.each(r,function(r,o){$(this).empty(),$(this).data("person_id")&&(e=$(this).data("person_id")),o.id||(o.id="PersonData-"+e+"-"+t());var u=Report.getPeopleIdentities()[e];u?(i=DataProcess.selectPersonName(u),s=DataProcess.selectPersonEmail(u),s="("+DataProcess.hideEmail(s)+")"):(i=n,s=""),$("#"+o.id).append("<h1><small>"+i+" "+s+"</small></h1>")})},Convert.convertPersonSummary=function(e,t){var n=$(".PersonSummary");n.length>0&&$.each(n,function(n,r){$(this).empty(),ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;$(this).data("person_id")&&(e=$(this).data("person_id")),$(this).data("person_name")&&(t=$(this).data("person_name")),r.id=ds+"-refcard-people",DS.displayPeopleSummary(r.id,e,t,DS)})},Convert.convertPeople=function(e,t){e===undefined&&(e=Report.getParameterByName("id")),t===undefined&&(t=Report.getParameterByName("name"));if(e===undefined)return;if(Loader.check_people_item(e)===!1){$.each(Report.getDataSources(),function(t,n){Loader.data_load_people_item(e,n,Convert.convertPeople)});return}Convert.convertPersonData(e,t),Convert.convertPersonSummary(e,t),Convert.convertPersonMetrics(e,t),Convert.activateHelp()},Convert.convertDemographics=function(){var e=$(".Demographics");e.length>0&&$.each(e,function(e,t){$(this).empty(),ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;var n=$(this).data("period");t.id="Demographics-"+ds+"-"+"-"+n,DS.displayDemographics(t.id,n)})},Convert.getRealItem=function(e,t,n){var r=Report.getReposMap();if(r===undefined||r.length===0)return $.inArray(n,e.getReposData())>-1?n:null;var i=null;if(t==="repos"){var s=e.getReposMetricsData()[n];s===undefined?$.each(r,function(t,r){$.each(Report.getDataSources(),function(t,s){if(r[s.getName()]===n)return i=r[e.getName()],!1});if(i!==null)return!1}):i=n}else i=n;return i},Convert.convertFilterItemsSummary=function(e){var t="FilterItemsSummary";divs=$("."+t),divs.length>0&&$.each(divs,function(n,r){ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;e===undefined&&(e=$(this).data("filter"));if(e!==$(this).data("filter"))return;if(!e)return;r.id=ds+"-"+t,$(this).empty(),e==="repos"&&DS.displayReposSummary(r.id,DS),e==="countries"&&DS.displayCountriesSummary(r.id,DS),e==="companies"&&DS.displayCompaniesSummary(r.id,DS),e==="domains"&&DS.displayDomainsSummary(r.id,DS)})},Convert.convertFilterItemsGlobal=function(e){var t=n(),r="FilterItemsGlobal";divs=$("."+r),divs.length>0&&$.each(divs,function(n,i){ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;e===undefined&&(e=$(this).data("filter"));if(e!==$(this).data("filter"))return;if(!e)return;var s=$(this).data("metric"),o=$(this).data("show-others"),u=$(this).data("order-by");t.show_legend=$(this).data("legend"),$("#"+$(this).data("legend-div")).length>0?t.legend={container:$(this)
.data("legend-div")}:t.legend={container:null},t.graph=$(this).data("graph"),i.id=s+"-"+r,$(this).empty(),e==="repos"&&DS.displayMetricReposStatic(s,i.id,t,u,o),e==="countries"&&DS.displayMetricCountriesStatic(s,i.id,t,u,o),e==="companies"&&DS.displayMetricCompaniesStatic(s,i.id,t,u,o),e==="domains"&&DS.displayMetricDomainsStatic(s,i.id,t,u,o)})},Convert.convertFilterItemsNav=function(e,t){var n="FilterItemsNav";divs=$("."+n),divs.length>0&&$.each(divs,function(r,i){ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;e===undefined&&(e=$(this).data("filter"));if(e!==$(this).data("filter"))return;if(!e)return;$(this).data("page")&&(t=$(this).data("page")),order_by=$(this).data("order-by"),i.id=ds+"-"+n,$(this).empty(),e==="repos"?DS.displayItemsNav(i.id,e,t,order_by):e==="countries"?DS.displayItemsNav(i.id,e,t):e==="companies"?DS.displayItemsNav(i.id,e,t):e==="domains"&&DS.displayItemsNav(i.id,e,t)})},Convert.convertFilterItemsMetricsEvol=function(e){var t=n(),r="FilterItemsMetricsEvol";divs=$("."+r),divs.length>0&&$.each(divs,function(n,i){ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;e===undefined&&(e=$(this).data("filter"));if(e!==$(this).data("filter"))return;if(!e)return;var s=$(this).data("metric"),o=!1;$(this).data("stacked")&&(o=!0);var u=$(this).data("start"),a=$(this).data("end");t.lines={stacked:o},$("#"+$(this).data("legend-div")).length>0?t.legend={container:$(this).data("legend-div")}:t.legend={container:null},t.show_legend=$(this).data("legend");var f=$(this).data("remove-last-point");f&&(t.remove_last_point=!0),i.id=s+"-"+r,$(this).empty(),e==="companies"?DS.displayMetricCompanies(s,i.id,t,u,a):e==="repos"?DS.displayMetricRepos(s,i.id,t,u,a):e==="domains"&&DS.displayMetricDomains(s,i.id,t,u,a)})},Convert.convertFilterItemsMiniCharts=function(e,t){var r=n(),i="FilterItemsMiniCharts";divs=$("."+i),divs.length>0&&$.each(divs,function(n,s){ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;e===undefined&&(e=$(this).data("filter"));if(e!==$(this).data("filter"))return;if(!e)return;$(this).data("page")&&(t=$(this).data("page"));var o=$(this).data("metrics"),u=$(this).data("order-by"),a=!0;$(this).data("show_links")!==undefined&&(a=$(this).data("show_links"));var f=$(this).data("start"),l=$(this).data("end"),c=$(this).data("convert"),h=$(this).data("remove-last-point");h&&(r.remove_last_point=!0),s.id=o.replace(/,/g,"-")+"-"+e+"-"+i,$(this).empty(),e==="repos"?DS.displayReposList(o.split(","),s.id,r,u,t,a,f,l,c):e==="countries"?DS.displayCountriesList(o.split(","),s.id,r,u,t,a,f,l,c):e==="companies"?DS.displayCompaniesList(o.split(","),s.id,r,u,t,a,f,l,c):e==="domains"&&DS.displayDomainsList(o.split(","),s.id,r,u,t,a,f,l,c)})},Convert.convertFilterItemData=function(e,n){var r=$(".FilterItemData");r.length>0&&$.each(r,function(e,r){$(this).empty();var i=Report.cleanLabel(n);r.id||(r.id="FilterItemData"+t()),$("#"+r.id).append("<h1><small>"+i+"</small></h1>")})},Convert.convertFilterItemSummary=function(e,t){var n="FilterItemSummary";divs=$("."+n),t!==null&&divs.length>0&&$.each(divs,function(r,i){var s=t;ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;e===undefined&&(e=$(this).data("filter"));if(e!==$(this).data("filter"))return;if(!e)return;$(this).data("item")&&(s=$(this).data("item")),i.id=ds+"-"+e+"-"+n,$(this).empty(),e==="repos"?(s=Convert.getRealItem(DS,e,s),s&&DS.displayRepoSummary(i.id,s,DS)):e==="countries"?DS.displayCountrySummary(i.id,s,DS):e==="companies"?DS.displayCompanySummary(i.id,s,DS):e==="domains"&&DS.displayDomainSummary(i.id,s,DS)})},Convert.convertFilterItemMetricsEvol=function(e,t){var r=n(),i="FilterItemMetricsEvol";divs=$("."+i),t!==null&&divs.length>0&&$.each(divs,function(n,s){var o=t;ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;e===undefined&&(e=$(this).data("filter"));if(e!==$(this).data("filter"))return;if(!e)return;$(this).data("item")&&(o=$(this).data("item"));var u=$(this).data("metrics");r.show_legend=!1,r.frame_time=!1,$(this).data("legend")&&(r.show_legend=!0),$(this).data("frame-time")&&(r.frame_time=!0),s.id=Report.cleanLabel(t).replace(/ /g,"_")+"-",s.id+=u.replace(/,/g,"-")+"-"+ds+"-"+e+"-"+i,$(this).empty(),e==="repos"?(o=Convert.getRealItem(DS,e,o),o?DS.displayMetricsRepo(o,u.split(","),s.id,r):$(this).hide()):e==="countries"?DS.displayMetricsCountry(o,u.split(","),s.id,r):e==="companies"?DS.displayMetricsCompany(o,u.split(","),s.id,r):e==="domains"&&DS.displayMetricsDomain(o,u.split(","),s.id,r)})},Convert.convertFilterItemTop=function(e,n){var r="FilterItemTop";divs=$("."+r),divs.length>0&&$.each(divs,function(i,s){var o=n;$(this).empty(),ds=$(this).data("data-source"),DS=Report.getDataSourceByName(ds);if(DS===null)return;e===undefined&&(e=$(this).data("filter"));if(e!==$(this).data("filter"))return;if(!e)return;$(this).data("item")&&(o=$(this).data("item"));var u=$(this).data("metric"),a=$(this).data("period"),f=$(this).data("titles");s.id=u+"-"+ds+"-"+e+"-"+r+"-"+t(),$(this).empty(),s.className="",e==="companies"&&DS.displayTopCompany(o,s.id,u,a,f)})},Convert.convertFilterStudyItem=function(e,t){var n=Convert.convertFilterStudyItem;if(n.done===undefined)n.done={};else if(n.done[e]===!0)return;e==="repositories"&&(e="repos"),t===undefined&&(e==="repos"&&(t=Report.getParameterByName("repository")),e==="countries"&&(t=Report.getParameterByName("country")),e==="companies"&&(t=Report.getParameterByName("company")),e==="domains"&&(t=Report.getParameterByName("domain")));if(!t)return;if(Loader.FilterItemCheck(t,e)===!1)return;Convert.convertFilterItemData(e,t),Convert.convertFilterItemSummary(e,t),Convert.convertFilterItemMetricsEvol(e,t),Convert.convertFilterItemTop(e,t),Convert.activateHelp(),n.done[e]=!0},Convert.activateHelp=function(){$(".help").popover({html:!0,trigger:"manual"}).click(function(e){$(this).popover("toggle"),e.stopPropagation()})},Convert.convertFilterStudy=function(e){var t=Report.getCurrentPage();t===null&&(t=Report.getParameterByName("page"),t!==undefined&&Report.setCurrentPage(t));if(t===undefined){if(!($("[class^='FilterItems']").length>0))return;t=1,Report.setCurrentPage(t)}e==="repositories"&&(e="repos");if(Loader.check_filter_page(t,e)===!1){$.each(Report.getDataSources(),function(n,r){Loader.data_load_items_page(r,t,Convert.convertFilterStudy,e)});return}Convert.convertFilterItemsSummary(e),Convert.convertFilterItemsGlobal(e),Convert.convertFilterItemsNav(e,t),Convert.convertFilterItemsMetricsEvol(e),Convert.convertFilterItemsMiniCharts(e,t)},Convert.convertBasicDivs=function(){Convert.convertNavbar(),Convert.convertFooter(),Convert.convertRefcard(),Convert.convertGlobalData(),Convert.convertSummary()},Convert.convertBasicDivsMisc=function(){Convert.convertRadarActivity(),Convert.convertRadarCommunity(),Convert.convertTreemap(),Convert.convertBubbles()},Convert.convertBasicMetrics=function(e){Convert.convertMetricsEvol(),Convert.convertTimeTo(),Convert.convertMarkovTable()}})();if(Report===undefined)var Report={};(function(){function E(){return t}function S(){return n}function x(){return r}function T(e){r=e}function N(){return e}function C(){return c}function k(e){var t=e.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),t.join(".")}function L(e){var t=[];return $.each(Report.getDataSources(),function(n,r){r.getMetrics()[e]&&t.push(r)}),t}function A(){var e={};return $.each(Report.getDataSources(),function(t,n){e=$.extend({},e,n.getMetrics())}),e}function O(){function t(t){var n=t.split("&"),r=$.grep(n,function(e,t){return e.indexOf("data_dir=")===0});for(var i=0;i<r.length;i++){var s=r[i].split("=")[1];e.push(s),i===0&&Report.setDataDir(s)}}var e=[],n=window.location.search.substr(1);n&&n.indexOf("data_dir")>=0&&(t(n),e.length>0&&Report.setProjectsDirs(e))}function M(){O();var e=Report.getProjectsDirs(),t,n,r,i,s,o;return $.each(e,function(e,u){if(Report.getConfig()===null||Report.getConfig()["data-sources"]===undefined)n=new ITS,Report.registerDataSource(n),r=new MLS,Report.registerDataSource(r),t=new SCM,Report.registerDataSource(t),i=new SCR,Report.registerDataSource(i),s=new IRC,Report.registerDataSource(s),o=new MediaWiki,Report.registerDataSource(o),people=new People,Report.registerDataSource(people),downloads=new Downloads,Report.registerDataSource(downloads);else{var a=Report.getConfig()["data-sources"];$.each(a,function(e,u){u==="its"?(n=new ITS,Report.registerDataSource(n)):u==="mlstats"?(r=new MLS,Report.registerDataSource(r)):u==="scm"?(t=new SCM,Report.registerDataSource(t)):u==="gerrit"?(i=new SCR,Report.registerDataSource(i)):u==="irc"?(s=new IRC,Report.registerDataSource(s)):u==="mediawiki"?(o=new MediaWiki,Report.registerDataSource(o)):u==="people"?(people=new People,Report.registerDataSource(people)):u==="downloads"?(downloads=new Downloads,Report.registerDataSource(downloads)):Report.log("Not support data source "+u)})}n&&n.setDataDir(u),r&&r.setDataDir(u),t&&t.setDataDir(u),i&&i.setDataDir(u),s&&s.setDataDir(u),o&&o.setDataDir(u),people&&people.setDataDir(u),downloads&&downloads.setDataDir(u),t&&n&&t.setITS(n)}),!0}function _(){$.each(Report.getActiveStudies(),function(e,t){var n=t;t==="repositories"&&(n="repos"),DataProcess.orderItems(n),Convert.convertFilterStudy(t),Convert.convertFilterStudyItem(t)})}var e=null,t=null,n=null,r={},i=[],s=null,o="",u="data/json",a="data/json",f="",l=[a],c={},h={},p,d=u+"/project-info.json",v=u+"/viz_cfg.json",m=u+"/markers.json",g=u+"/repos-map.json",y=10,b=null,w={};Report.createDataSources=M,Report.getAllMetrics=A,Report.getMarkers=E,Report.getVizConfig=S,Report.getMetricDS=L,Report.getGridster=x,Report.setGridster=T,Report.getCurrentPage=function(){return b},Report.setCurrentPage=function(e){b=e},Report.getPageSize=function(){return y},Report.setPageSize=function(e){y=e},Report.getProjectData=N,Report.getProjectsData=C,Report.convertStudies=_,Report.getDataSources=function(){return i},Report.registerDataSource=function(e){i.push(e)},Report.setHtmlDir=function(e){o=e},Report.getHtmlDir=function(){return o},Report.getDataDir=function(){return u},Report.setDataDir=function(e){u=e,d=e+"/project-info.json",config_file=e+"/viz_cfg.json",m=e+"/markers.json",repos_mapping_file=u+"/repos-mapping.json"},Report.setMarkers=function(e){t=e},Report.getMarkersFile=function(){return m},Report.getReposMap=function(){return p},Report.setReposMap=function(e){p=e},Report.getReposMapFile=function(){return g},Report.setVizConfig=function(e){n=e},Report.getVizConfigFile=function(){return v},Report.setProjectData=function(t){e=t},Report.getProjectFile=function(){return d},Report.getProjectsDirs=function(){return l},Report.setProjectsDirs=function(e){l=e},Report.getProjectsList=function(){var e=[];return $.each(C(),function(t,n){e.push(t)}),e},Report.getProjectsDataSources=function(){return h},Report.setMetricsDefinition=function(e){$.each(Report.getDataSources(),function(t,n){n.setMetricsDefinition(e[n.getName()])})},Report.getPeopleIdentities=function(){return w},Report.setPeopleIdentities=function(e){w=e},Report.cleanLabel=function(e){var t=e,n=null;return e.split("___").length===2?(n=e.split(" "),t=n[0]):e.lastIndexOf("http")===0||e.split("_").length>3?(n=e.split("_"),t=n.pop(),t===""&&(t=n.pop()),t=t.replace("buglist.cgi?product=",""),t=t.replace("gmane.comp.sysutils.","")):e.lastIndexOf("<")===0&&(t=MLS.displayMLSListName(e)),t},Report.formatValue=function(e,t){if(e===undefined)return"-";var n=["last_date","first_date"],r=e;try{r=parseFloat(e).toFixed(1).toString().replace(/\.0$/,""),r=k(r);if(navigator.language==="es"){var i=r.split(".");i[0]=i[0].replace(/,/g,"."),r=i.join(",")}}catch(s){}return typeof r=="number"&&isNaN(r)&&(r=e.toString()),t!==undefined&&$.inArray(t,n)>-1&&(r=e.toString()),r},Report.escapeHtml=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},Report.getParameterByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)"),n=t.exec(location.search);return n===null?undefined:Report.escapeHtml(decodeURIComponent(n[1].replace(/\+/g," ")))},Report.getDataSourceByName=function(e){var t=null;return $.each(Report.getDataSources(),function(n,r){if(r.getName()===e)return t=r,!1}),t},Report.displayActiveMenu=function(){var e=window.location.href,t=e.substr(e.lastIndexOf("/")+1,e.length);t=t.split(".html")[0];if(t.indexOf("scm")===0)$(".scm-menu")[0].className=$(".scm-menu")[0].className+" active";else if(t.indexOf("its")===0)$(".its-menu")[0].className=$(".its-menu")[0].className+" active";else if(t.indexOf("mls")===0)$(".mls-menu")[0].className=$(".mls-menu")[0].className+" active";else if(t.indexOf("scr")===0)$(".scr-menu")[0].className=$(".scr-menu")[0].className+" active";else if(t.indexOf("index")===0||t===""){if($(".summary-menu").length===0)return;$(".summary-menu")[0].className=$(".summary-menu")[0].className+" active"}else $(".experimental-menu")[0]&&($(".experimental-menu")[0].className=$(".experimental-menu")[0].className+" active")},Report.addDataDir=function(){var e,t=window.location.search.substr(1);return t&&t.indexOf("data_dir")!==-1&&(e=window.location.search.substr(1)),e},Report.configDataSources=function(){var e=Report.getProjectsDataSources();$.each(Report.getDataSources(),function(t,n){if(n.getData()instanceof Array)return;$.each(c,function(t,r){if(r.dir===n.getDataDir())return e[t]===undefined&&(e[t]=[]),$.each(e[t],function(e,t){if(n.getName()===t.getName())return!1}),n.setProject(t),e[t].push(n),!1})})},Report.getConfig=function(){return s},Report.setConfig=function(e){s=e,e&&(Report.log("Global config file found"),e["global-html-dir"]&&Report.setHtmlDir(e["global-html-dir"]),e["global-data-dir"]&&(Report.setDataDir(e["global-data-dir"]),Report.setProjectsDirs([e["global-data-dir"]])),e["projects-data-dirs"]&&Report.setProjectsDirs(e["projects-data-dirs"]))},Report.convertGlobal=function(){Convert.convertMicrodash(),Convert.convertMicrodashText(),Convert.convertBasicDivs(),Convert.convertBasicDivsMisc(),Convert.convertBasicMetrics(),Convert.convertDemographics(),Convert.convertMetricsEvolSet(),Convert.convertLastActivity()},Report.getActiveStudies=function(){var e=[],t,n=["repositories","countries","companies","domains"];return Report.getConfig()!==null?t=Report.getConfig().reports:t=n,$.each(n,function(n,r){$.inArray(r,t)>-1&&e.push(r)}),e},Report.convertStudiesGlobal=function(){Convert.convertTop(),Convert.convertPeople()};var D=!0;Report.getLog=function(){return D},Report.setLog=function(e){D=e},Report.log=function(e){Report.getLog()===!0&&window.console&&console.log(e)}})(),Loader.data_ready_global(function(){Report.configDataSources(),Report.convertGlobal(),Report.convertStudiesGlobal()}),Loader.data_ready(function(){Report.convertStudies(),$("body").css("cursor","auto"),$("html").click(function(e){$(".help").popover("hide")}),Convert.activateHelp()}),$(document).ready(function(){var e="./config.json";$.getJSON(e,function(e){Report.setConfig(e)}).fail(function(){window.console&&Report.log("Can't read global config file "+e)}).always(function(e){Report.createDataSources(),Loader.data_load(),$("body").css("cursor","progress")})});var resized;$(window).resize(function(){clearTimeout(resized),resized=setTimeout(resizedw,100)});if(Viz===undefined)var Viz={};(function(){function t(e,t){var n="";return $.each(Report.getAllMetrics(),function(e,r){if(r.action===t)return n=r.column,!1}),n}function n(e,t,n){var r="<h4>"+n+"</h4>",i='<table id="itsmarkovtable" class="table table-striped">';i+="<thead><tr><th>Transition</th><th>Number</th><th>Percent</th></tr></thead><tbody>",$.each(t,function(e,n){subdata=t[e],old_value="old_value",new_value="new_value",percent="f",number="issue";for(var r=0;r<subdata[old_value].length;r++){var s=subdata[new_value][r],o=subdata[percent][r];o=Math.round(o*100)/100;var u=subdata[number][r];i+="<tr><td>"+e+" -> "+s+"</td>",i+="<td>"+u+"</td>",i+="<td>"+o+"</td></tr>"}}),i+="</tbody></table>",r+=i,div=$("#"+e),div.append(r);return}function r(e,t){return e.hasOwnProperty(t)?e[t]:t}function i(e,t,n,i,s,o){var u="length";i===undefined&&(i=!0),s===undefined&&(s=!0);if(e[u]===undefined)return;var a="Top",f='<table class="table table-striped"><tbody>';f+="<tr><th colspan=2> Top "+r(t,"name")+" "+o+"</th>",f+="<th>"+r(t,"initiator_name")+"</th>",f+="<th>"+r(t,"length")+"</th></tr>";for(var l=0;l<e[u].length;l++){if(n&&n<=l)break;f+="<tr>",f+="<td>#"+(l+1)+"</td>";if(s===!0){var c="http://www.google.com/search?output=search&q=X&btnI=1";c=c.replace(/X/g,e.subject[l]),f+="<td>",f+='<a href="'+c+'">',f+=e.subject[l]+"</a>",f+=' <i class="fa fa-external-link"></i></td>'}else f+="<td>"+e.subject[l]+"</td>";f+="<td>"+e.initiator_name[l]+"</td>",f+="<td>"+e.length[l]+"</td>",f+="</tr>"}return f+="</tbody></table>",f}function s(e,t,n,r,i,s){var o='<table class="table table-striped"><tbody>';o+="<tr><th colspan=2>"+s+"</th><th>"+t+"</th></tr>",i===undefined&&(i=!0);if(e[t]===undefined)return;e[t]instanceof Array||(e[t]=[e[t]],e[n]=[e[n]]);for(var u=0;u<e[t].length;u++){if(r&&r<=u)break;var a=e[t][u],f=e[n][u],l=null;e.id&&(l=e.id[u]),o+="<tr><td>#"+(u+1)+"</td><td>",l&&i&&(o+="<a href='people.html?id="+l+"&name="+f+"'>"),o+=DataProcess.hideEmail(f),l&&i&&(o+="</a>"),o+="</td><td>",o+=a+"</td></tr>"}return o+="</tbody></table>",o}function o(e){var t={};t.id="id";if(e==="senders")return t.name="senders",t.action="sent",t}function u(e,t,n,r,i){var s="",u="";s+='<ul id="myTab" class="nav nav-tabs">';var a=!0;$.each(t,function(e,t){var n=e.split("."),r=n[1];r===""&&(r="all");var i=r.replace(/\ /g,""),o="";a===!0&&(o=' class="active"',a=!1),s+="<li"+o+'><a href="#'+i+'"data-toogle="tab">',s+=r+"</a></li>"}),s+="</ul>",u+='<div class="tab-content">',a=!0;var f=o(n);$.each(t,function(e,s){var o=e.split("."),l=o[0],c=o[1];c===""&&(c="all");var h=c.replace(/\ /g,""),p="";a===!0&&(p=" active in",a=!1),u+='<div class="tab-pane fade'+p+'" id="'+h+'">',u+='<table class="table table-striped"><tbody>';var d="Top "+n+" "+c;u+="<tr><th colspan=2>"+d+"</th><th>"+f.action+"</th></tr>";for(var v=0;v<t[e][n].length;v++){if(r&&r<=v)break;var m=t[e][f.action][v];u+="<tr><td>#"+(v+1)+"</td>",u+="<td>",i?(u+='<a href="people.html?id='+t[e][f.id][v]+'">',u+=t[e][f.name][v]+"</a>"):u+=t[e][f.name][v],u+="</td>",u+="<td>"+m+"</td></tr>"}u+="</tbody></table>",u+="</div>"}),u+="</div>",div=$("#"+e),div.append(s),div.append(u),script="<script>$('#myTab a').click(function (e) {e.preventDefault();$(this).tab('show');});</script>",div.append(script)}function a(e,n,r,i,o,u,a,f){var l=n.name;if(!i||$.isEmptyObject(i))return;var c=n.action;a&&i[c].length<a&&(a=i[c].length,o=!1);var h=n.column;h===undefined&&(h=t(i,c));var p="Top "+l+" "+r,d=s(i,c,h,a,f,p),m=null;if(d===undefined)return;if(u===!1){m=$("#"+e),m.append(d);return}var g="",y="";o&&(g="top-"+o+"-"+h+"-",g+=c+"-"+r,y+="<div id='"+g+"' class='graph' style='float:right'></div>"),y+=d,m=$("#"+e),m.append(y);if(o){var b=i[h],w=i[c];if(a){b=[],w=[];for(var E=0;E<a;E++)b.push(i[h][E]),w.push(i[c][E])}v(g,b,w,o)}}function f(e,t,n,r,s,o,u,a){if(!s||$.isEmptyObject(s))return;var f=i(s,t,o,u,a,r),l=null;if(f===undefined)return;l=$("#"+e),l.append(f)}function l(e,t,n){var r=Report.getAllMetrics(),i='<a href="#" class="help"',s="";if(n===""){var o=function(e,n){if(t[u]===e)return s+="<strong>"+n.name+"</strong>: "+n.desc+"<br>",!1};for(var u=0;u<t.length;u++)$.each(r,o)}else s="<strong>Description</strong>: "+n;i+='data-content="'+s+'" data-html="true">',i+='<img src="qm_15.png"></a>';var a=$("#"+e).prev()[0];a&&a.className==="help"&&$("#"+e).prev().empty(),$("#"+e).before(i)}function c(e,t,n,r,i){(!i||i.help!==!1)&&l(e,t,i.custom_help);var s=[];i.remove_last_point&&(n=DataProcess.revomeLastPoint(n)),i.frame_time&&(n=DataProcess.frameTime(n,t)),i.start_time&&(n=DataProcess.filterDates(i.start_time,i.end_time,n)),$.each(t,function(e,t){if(!n[t])return;var r=[[],[]];$.each(n[t],function(e,i){r[e]=[n.id[e],n[t][e]]});var i=t;Report.getAllMetrics()[t]&&(i=Report.getAllMetrics()[t].name),s.push({label:i,data:r})}),d(e,n,s,r,i)}function h(e,t,n,r,i,s,o,u,a){var f=[],l={};$.each(n,function(e,n){if(n===undefined)return!1;if(n[t]===undefined)return!1;u&&(n=DataProcess.convert(n,u,t)),s&&(n=DataProcess.filterDates(s,o,n)),i.remove_last_point&&(n=DataProcess.revomeLastPoint(n));var r=[[],[]];for(var a=0;a<n.id.length;a++)r[a]=[n.id[a],n[t][a]];e=Report.cleanLabel(e),f.push({label:e,data:r}),l=n});if(f.length===0)return;if(a){var c=[];$.each(a,function(e,t){$.each(f,function(e,n){if(t===n.label)return c.push(n),!1})}),f=c}d(e,l,f,r,i)}function p(e){if(e.length===0)return e;if(e[0].data[0][0]!==0)return e;var t=e[0].data.length;if(e.length>1)for(var n=0;n<e.length;n++);else{var r=[];for(var i=0;i<t-1;i++)r.push([i,undefined]);r.push([t-1,e[0].data[t-1][1]]);var s={data:r};s.points={show:!0,radius:3,lineWidth:1,fillColor:null,shadowSize:0},e.push(s),e[0].data[t-1][1]=undefined}return e}function d(e,t,n,r,i){var s=document.getElementById(e),o=null;i&&i.legend&&i.legend.container&&(o=$("#"+i.legend.container));var u={subtitle:r,legend:{show:!0,container:o},xaxis:{minorTickFreq:4,tickFormatter:function(e){var n=null;for(var r=0;r<t.id.length;r++)if(parseInt(e,null)===t.id[r]){n=r;break}return t.date[n]}},yaxis:{min:0,noTicks:2,autoscale:!1},grid:{verticalLines:!1,color:"#000000",outlineWidth:1,outline:"s"},mouse:{container:o,track:!0,trackY:!1,trackFormatter:function(e){var r=t.date[parseInt(e.index,10)];r===undefined?r="":r+="<br>";for(var i=0;i<n.length;i++){var s=n[i].data[e.index][1];if(s===undefined)continue;n.length>1&&n[i].label!==undefined&&(r+=n[i].label+":"),r+=Report.formatValue(s)+"<br>"}return r}}};i&&(i.show_title||(u.title=""),"show_legend"in i&&(i.show_legend===!0?u.legend.show=!0:u.legend.show=!1),i.lines&&i.lines.stacked&&(u.lines={stacked:!0,fill:!0,fillOpacity:1,fillBorder:!0,lineWidth:.01}),i.show_labels||(u.xaxis.showLabels=!1,u.yaxis.showLabels=!1),i.show_grid===!1&&(u.grid.verticalLines=!1,u.grid.horizontalLines=!1,u.grid.outlineWidth=0),i.show_mouse===!1&&(u.mouse.track=!1),i.graph==="bars"&&(u.bars={show:!0}),i.light_style===!0&&(u.grid.color="#ccc",u.legend.show=!1),i.custom_title&&(u.subtitle=i.custom_title));var a=!1;i.graph!=="bars"&&n.length===1&&n[0].data[0][0]===0&&(a=!0);if(a){n=p(n);var f=t.id[t.id.length-1]+1;n[0].data.push([f,undefined]),n[1].data.push([f,undefined]),t.date.push(""),t.id.push(f)}graph=Flotr.draw(s,n,u),a&&(t.date&&t.date.pop(),t.id&&t.id.pop())}function v(e,t,n,r,i,s,o,u,a){var f=!1;o&&(f=!0);var l=document.getElementById(e),c=null;s&&s.legend&&s.legend.container&&(c=$("#"+s.legend.container));var h=[],p,d="";if(!f)for(p=0;p<n.length;p++)t&&(d=DataProcess.hideEmail(t[p])),h.push({data:[[p,n[p]]],label:d});else for(p=0;p<n.length;p++)t&&(d=DataProcess.hideEmail(t[p])),h.push({data:[[n[p],p]],label:d});var v={title:i,grid:{verticalLines:!1,horizontalLines:!1,outlineWidth:0},xaxis:{showLabels:!1,min:0},yaxis:{showLabels:!1,min:0},mouse:{container:c,track:!0,trackFormatter:function(e){var r="x";f&&(r="y");var i="";return t&&(i=DataProcess.hideEmail(t[parseInt(e[r],10)])+": "),i+n[parseInt(e[r],10)]}},legend:{show:!1,position:"se",backgroundColor:"#D2E8FF",container:c}};s&&(s.show_title||(v.title=""),s.show_legend&&(v.legend.show=!0)),r==="bars"&&(v.bars={show:!0,horizontal:f},u&&(v.bars.color=u,v.bars.fillColor=u),s&&s.show_legend!==!1&&(v.legend={show:!0,position:"ne",container:c}),v.grid.horizontalLines=!0,v.yaxis={showLabels:!0,min:0},s&&s.xaxis&&(v.xaxis={showLabels:s.xaxis,min:0}),a&&(v.yaxis={showLabels:!0,min:0,tickFormatter:a})),r==="pie"&&(v.pie={show:!0},v.mouse.position="ne"),r=Flotr.draw(l,h,v)}function m(e,t,n,r,i,s,o,u){var a=.4,f=n[0].length;n[1].length>f&&(f=n[1].length);var l=!1;s&&(l=!0);var c=document.getElementById(e),h=null;i&&i.legend&&i.legend.container&&(h=$("#"+i.legend.container));var p=[],d,v=[],m=[];for(d=0;d<f;d++){var g,y;n[0].length>d?g=n[0][d]:g=undefined,n[1].length>d?y=n[1][d]:y=undefined,l?(p.push([g,d-a/2]),v.push([y,d+a/2])):(p.push([d-a/2,g]),v.push([d+a/2,y]))}m=[{data:p,label:t[0]},{data:v,label:t[1]}];var b={title:r,bars:{show:!0,horizontal:l,barWidth:a},grid:{verticalLines:!1,horizontalLines:!1,outlineWidth:0},xaxis:{showLabels:!1,min:0},yaxis:{showLabels:!0,min:0},mouse:{container:h,track:!0,trackFormatter:function(e){var n,r="x";l&&(r="y");var i=parseFloat(e[r],1),s=Math.round((i-.2)*10)/10,o=Math.round((i+.2)*10)/10;s===parseInt(i,10)?n=s:n=o;var a=n;u&&(a=n*u);var f=a+" years: ",c,h;return p[n]===undefined?c=0:c=parseInt(p[n][0],10),isNaN(c)&&(c=0),v[n]===undefined?h=0:h=parseInt(v[n][0],10),isNaN(h)&&(h=0),f+=c+" "+t[0],f+=" , ",f+=h+" "+t[1],f+=" ("+parseInt(c/h*100,10)+"% )",f}},legend:{show:!0,position:"ne",backgroundColor:"#D2E8FF",container:h}};i&&(i.show_title||(b.title=""),i.show_legend&&(b.legend.show=!0)),i&&i.show_legend!==!1&&(b.legend={show:!0,position:"ne",container:h}),b.grid.horizontalLines=!0,b.yaxis={showLabels:!0,min:0},o&&(b.yaxis={showLabels:!0,min:0,tickFormatter:o}),i&&i.xaxis&&(b.xaxis={showLabels:i.xaxis,min:0}),graph=Flotr.draw(c,m,b)}function g(e,t,n,r){var i=document.getElementById(e),s=Report.getMetricDS(t)[0],o=Report.getMetricDS(n)[0],u=[];if(s!=o){Report.log("Metrics for bubbles have different data sources");return}var a=[],f=[];$.each(Report.getDataSources(),function(e,t){t.getName()===s.getName()&&(a.push(t.getData()),f.push(t.getProject()))});var l=[[],[]];l=[a[0].id,a[0].date];for(var c=0;c<a.length;c++){if(a[c]instanceof Array)return;l=DataProcess.fillDates(l,[a[c].id,a[c].date])}for(var h=0;h<a.length;h++){var p=[],d=a[h],v=DataProcess.fillHistory(l[0],[d.id,d[t]]),m=DataProcess.fillHistory(l[0],[d.id,d[n]]);for(c=0;c<l[0].length;c++)p.push([l[0][c],v[1][c],m[1][c]]);u.push({label:f[h],data:p})}var g={bubbles:{show:!0,baseRadius:5},mouse:{track:!0,trackFormatter:function(e){var r=a[0].date[e.index]+": ";return r+=e.series.label+" ",r+=e.series.data[e.index][1]+" "+t+",",r+=e.series.data[e.index][2]+" "+n,r}},xaxis:{tickFormatter:function(e){return a[0].date[parseInt(e,10)-a[0].id[0]]}}};s.getName()==="its"&&$.extend(g.bubbles,{baseRadius:1}),r&&$.extend(g.bubbles,{baseRadius:r}),Flotr.draw(i,u,g)}function y(e,t,n,r){if(!n)return;r?period=365*r:r=.25;var i=[],s=[],o=[],u,a={show_legend:!1,xaxis:!0},f,l;for(u=0;u<n.aging.persons.age.length;u++)f=n.aging.persons.age[u],l=parseInt(f/period,10),i[l]||(i[l]=0),i[l]+=1;for(u=0;u<n.birth.persons.age.length;u++)f=n.birth.persons.age[u],l=parseInt(f/period,10),s[l]||(s[l]=0),s[l]+=1;o=["Retained","Attracted"],yticks=function(e,t){var n=r,i="years";return e*=r,e+" "+i};var c=[i,s];n&&m(e,o,c,"",a,!0,yticks,r)}function b(e,t,n){var r=document.getElementById(e),i=$("#"+e).data("max"),s=.2;i||(i=0);for(var o=0;o<n.length;o++)for(var u=0;u<n[o].data.length;u++){var a=n[o].data[u][1];a>i&&(i=a,i=parseInt(i*(1+s),null))}(function(){var e=[n,t]})(),graph=Flotr.draw(r,n,{radar:{show:!0},mouse:{track:!0,trackFormatter:function(e){var r="";for(var i=0;i<n.length;i++)r+=n[i].label+" ",r+=n[i].data[e.index][1]+" ",r+=t[e.index][1]+"<br>";return r}},grid:{circular:!0,minorHorizontalLines:!0},yaxis:{min:0,max:i,minorTickFreq:1},xaxis:{ticks:t}})}function w(e,t){var n=[],r=[],i=[],s=[],o=0,u=0;for(o=0;o<t.length;o++){var a=Report.getMetricDS(t[o]);for(u=0;u<a.length;u++)n[u]||(n[u]=[],s[u]=a[u].getProject()),n[u].push([o,parseInt(a[u].getGlobalData()[t[o]],10)]);r.push([o,a[0].getMetrics()[t[o]].name])}for(u=0;u<n.length;u++)i.push({label:s[u],data:n[u]});b(e,r,i)}function E(e){var t=["scm_committers","scm_authors","its_openers","its_closers","its_changers","mls_senders"];w(e,t)}function S(e){var t=["scm_commits","scm_files","its_opened","its_closed","its_changed","mls_sent"];w(e,t)}function x(e,t,n,r,i){N(e,t,n,r,i)}function T(e,t,n,r,i){N(e,t,n,r,i)}function N(e,t,n,r,i){var s=n.split(","),o=t.data;if(!o[s[0]])return;var u={};u.date=o.date,$.each(o,function(e,t){if($.inArray(e,s)===-1)return;u[e]=[];for(var n=0;n<t.length;n++){var r=parseFloat((parseInt(t[n],null)/24).toFixed(2),null);u[e].push(r)}}),u.id=[];for(var a=0;a<o[s[0]].length;a++)u.id.push(a);var f={show_legend:!0,show_labels:!0};c(e,s,u,n,f)}function C(e,t,n,r,i,s,o,u,a){var l=t.getMetrics(),c=l.mls_threads,h=t.getGlobalTopData();$.each(h,function(t,n){var s=t.split("."),l=s[0],p=s[1];r==l&&l=="threads"&&i==p&&f(e,c,r,i,h[t],o,u,a)})}function k(e,t,n,r,i,s,o,f,l,c){var h=t.getMetrics();n===undefined&&(n=!0);var p=t.getGlobalTopData();if(s===!0){var d={};$.each(p,function(e,t){var n=e.split("."),i=n[0],s=n[1];if(r&&r!==i)return!0;r&&r===i&&(d[e]=p[e])}),u(e,d,r,l,c)}else $.each(p,function(t,s){var u=t.split("."),d=u[0];if(r&&r!==d)return!0;var v=u[1];for(var m in h){var g=h[m];if(g.column==d){if(i&&i!==v)return!0;a(e,g,v,p[t],o,f,l,c);if(!n)return!1;break}}})}function L(e,t,n,r,i,s){var o=null;a(n,r,i,t,o,s)}function A(e,t,n,r,i){var s=t.getProject(),o=t.getMetrics()[n],u=null;if(!t.getGlobalTopData()[n])return;data=t.getGlobalTopData()[n][r],a(e,s,o,r,data,u,i)}function O(e,t,n){if(n===undefined){if(t===undefined)return;Loader.get_file_data_div(t,Viz.displayTreeMap,e);return}if(n===null)return;var r=d3.scale.category20c(),i=d3.select("#"+e),s=$("#"+e).width(),o=$("#"+e).height(),u=d3.layout.treemap().size([s,o]).sticky(!0).value(function(e){return e.size}),a=function(){this.style("left",function(e){return e.x+"px"}).style("top",function(e){return e.y+"px"}).style("width",function(e){return Math.max(0,e.dx-1)+"px"}).style("height",function(e){return Math.max(0,e.dy-1)+"px"})},f=i.datum(n).selectAll(".node").data(u.nodes).enter().append("div").attr("class","treemap-node").call(a).style("background",function(e){return e.children?r(e.name):null}).text(function(e){return e.children?null:e.name});d3.selectAll("input").on("change",function(){var t=this.value==="count"?function(){return 1}:function(e){return e.size};f.data(u.value(t).nodes).transition().duration(1500).call(a)})}function M(e,t,n,r,i){var s=null,o="",u=[[],[]];n?$.each(Report.getDataSources(),function(e,t){if(t.getName()===n)return s=t.getMetrics(),!1}):s=Report.getAllMetrics(),$.each(Report.getDataSources(),function(e,t){o=t.getMainMetric();if(n===null&&t.getName()==="scm"||n&&t.getName()==n)return u=[t.getData().id,t.getData()[o]],i===!1&&(u=[t.getData().id,[]]),!1});var a=[[],[]];$.each(t,function(e,t){$.each(t,function(e,t){if(n&&n!==t.getName())return;a=DataProcess.fillDates(a,[t.getData().id,t.getData().date])})});var f=a[0][0],l=document.getElementById(e),c,h=Report.getMarkers();c={container:l,xTickFormatter:function(e){var t=a[1][e-f];return t==="0"&&(t=""),t},yTickFormatter:function(e){return e+""},selection:{data:{x:{min:a[0][0],max:a[0][a[0].length-1]}}}},c.data={summary:DataProcess.fillHistory(a[0],u),markers:h,dates:a[1],envision_hide:r,main_metric:o};var p=null,d=function(e,t){var n=t.getData();if(n[m]===undefined)return;c.data[m]===undefined&&(c.data[m]=[]);var r=DataProcess.fillHistory(a[0],[n.id,n[m]]);if(m===o){c.data[m].push({label:p,data:r});if(n[m+"_relative"]===undefined)return;c.data[m+"_relative"]===undefined&&(c.data[m+"_relative"]=[]),r=DataProcess.fillHistory(a[0],[n.id,n[m+"_relative"]]),c.data[m+"_relative"].push({label:p,data:r})}else c.data[m].push({label:p,data:r})},v=function(e,t){p=e,$.each(t,d)};for(var m in s)$.each(t,v);return c.trackFormatter=function(e){var t=e.series.data,n=t[e.index][0]-f,r={},i=Report.getProjectsList();for(var o=0;o<i.length;o++)r[i[o]]={};var u=a[1][n]+":<br>";for(var l in s){if(c.data[l]===undefined)continue;if($.inArray(l,c.data.envision_hide)>-1)continue;for(o=0;o<i.length;o++){if(c.data[l][o]===undefined)continue;var h=c.data[l][o].label,p=c.data[l][o].data;u=p[1][n],r[h][l]=u}}u="<table><tr><td align='right'>"+a[1][n]+"</td></tr>",u+="<tr>",i.length>1&&(u+="<td></td>");for(l in s){if(c.data[l]===undefined)continue;if($.inArray(l,c.data.envision_hide)>-1)continue;u+="<td>"+s[l].name+"</td>"}return u+="</tr>",$.each(r,function(e,t){var n="<tr>";for(var o in s){if(c.data[o]===undefined)continue;if($.inArray(o,c.data.envision_hide)>-1)continue;mvalue=r[e][o],mvalue===undefined&&(mvalue="n/a"),n+="<td>"+mvalue+"</td>"}i.length>1&&(n="<td>"+e+"</td>"+n),n+="</tr>",u+=n}),u+="</table>",u},c}function _(e){return e===undefined&&(e={}),e.show_desc===undefined&&(e.show_desc=!0),e.show_title===undefined&&(e.show_title=!0),e.show_labels===undefined&&(e.show_labels=!0),e}function D(e,t,n,r,i){i=_(i);var s=e.getMetrics(),o="";for(var u=0;u<t.length;u++)u!==0&&(o+=" vs. "),t[u]in s?o+=s[t[u]].name:o+=t[u];i.show_title||(o=""),c(r,t,n,o,i)}function P(e,t,n,r,i){i=_(i);var s=e;c(r,t,n,s,i)}function H(e,t,n,r,i){i=_(i);var s=e;
c(r,t,n,s,i)}function B(e,t,n,r,i){i=_(i);var s=e;c(r,t,n,s,i)}function j(e,t,n,r,i){i=_(i);var s=e;c(r,t,n,s,i)}function F(e,t,n,r,i,s){r=_(r),r.show_legend=!0;var o=e;h(n,e,t,o,r,i,s)}function I(e,t,n,r,i){i=_(i);var s=e;c(r,t,n,s,i)}function q(e,t,n,r,i,s,o){r=_(r),r.show_legend!==!1&&(r.show_legend=!0);var u=e;h(n,e,t,u,r,i,s,null,o)}function R(e,t,n,r,i,s){r=_(r),r.show_legend!==!1&&(r.show_legend=!0);var o=e;h(n,e,t,o,r,i,s)}function U(e,t,n,r,i){i=_(i);var s=e,o=[],u=[],a="bars";i.graph&&(a=i.graph),$.each(n,function(n,r){var i=Report.cleanLabel(r);u.push(i),o.push(t[r][e])}),v(r,u,o,a,s,i)}function z(e,t,n,r){var i=Report.getProjectsDataSources(),s=Report.getVizConfig(),o=Viz.getEnvisionOptions(e,i,null,s.summary_hide,r);o.legend_show=n,t&&($.each(i,function(e,t){$.each(t,function(e,t){main_metric=t.getMainMetric()})}),DataProcess.addRelativeValues(o.data,main_metric)),new envision.templates.Envision_Report(o)}var e="#ffa500";Viz.displayTop=k,Viz.displayTopCompany=L,Viz.displayTopGlobal=A,Viz.displayTopThreads=C,Viz.displayBasicChart=v,Viz.displayMetricCompanies=q,Viz.displayMetricSubReportStatic=U,Viz.displayMetricsCompany=P,Viz.displayMetricsDomain=B,Viz.displayMetricsPeople=j,Viz.displayMetricsRepo=H,Viz.displayMetricRepos=F,Viz.displayMetricsCountry=I,Viz.displayMetricDomains=R,Viz.displayMetricsEvol=D,Viz.displayBubbles=g,Viz.displayDemographicsChart=y,Viz.displayEnvisionAll=z,Viz.displayTimeToFix=T,Viz.displayTimeToAttention=x,Viz.displayMetricSubReportLines=h,Viz.displayRadarActivity=S,Viz.displayRadarCommunity=E,Viz.displayTreeMap=O,Viz.displayMarkovTable=n,Viz.getEnvisionOptions=M,Viz.checkBasicConfig=_,Viz.getEnvisionOptionsMin=function(e,t,n){var r=t.id[0],i=document.getElementById(e),s,o=Report.getMarkers(),u=Report.getAllMetrics();s={container:i,xTickFormatter:function(e){var n=t.date[e-r];return n==="0"&&(n=""),n},yTickFormatter:function(e){return e+""},selection:{data:{x:{min:t.id[0],max:t.id[t.id.length-1]}}}},s.data={summary:[t.id,t.sent],markers:o,dates:t.date,envision_hide:n,main_metric:"sent"};var a=Report.getAllMetrics(),f=null;for(var l in t)f=l,a[l]&&(f=a[l].name),s.data[l]=[{label:f,data:[t.id,t[l]]}];return s.trackFormatter=function(e){var n=e.series.data,i=n[e.index][0]-r,s=t.date[i]+":<br>";for(var o in u){if(t[o]===undefined)continue;s+=t[o][i]+" "+o+" , "}return s},s}})(),IRC.prototype=new DataSource("irc"),ITS.prototype=new DataSource("its"),MediaWiki.prototype=new DataSource("mediawiki"),MLS.prototype=new DataSource("mls"),SCM.prototype=new DataSource("scm"),SCR.prototype=new DataSource("scr"),People.prototype=new DataSource("people"),Downloads.prototype=new DataSource("downloads");var Identity={};(function(){function t(t,n,r){var i="";t===e?i="":i=e,$("#"+r).sortable({handle:".handle",connectWith:"#"+i,start:function(e,t){t.item.siblings(".ui-selected").appendTo(t.item)},stop:function(t,n){n.item.parent()[0].id===e&&n.item.find(".handle").remove(),n.item.parent().append(n.item.find("li")),n.item.parent().find("li").addClass("mjs-nestedSortable-leaf")}}).selectable().find("li").prepend("<div class='handle'></div>")}function n(e,t){$("#"+e.getName()+"filter").autocomplete({source:t,select:function(t,n){return $("#"+e.getName()+"filter").val(""),$("#"+e.getName()+"_people_"+n.item.value).addClass("ui-selected"),!1}})}var e="unique-sortable";Identity.showListNested=function(t,n){list="<ol id="+e+' class="nested_sortable" ',list+='style="padding: 5px; background: #eee;"></ol>',$("#"+t).append(list),$("#"+e).nestedSortable({forcePlaceholderSize:!0,handle:"div",helper:"clone",items:"li",tolerance:"pointer",toleranceElement:"> div",maxLevels:2,isTree:!0,expandOnHover:700,startCollapsed:!0}),$(".disclose").on("click",function(){$(this).closest("li").toggleClass("mjs-nestedSortable-collapsed").toggleClass("mjs-nestedSortable-expanded")})},Identity.showList=function(e,r){var i="",s=r.getPeopleData(),o=[];i='<ol id="'+r.getName()+'-sortable" class="sortable">';for(var u=0;u<s.id.length;u++){var a=s.id[u];typeof a=="string"&&(a=a.replace("@","_at_").replace(".","_")),o.push({value:a,label:s.name[u]}),i+='<li id="'+r.getName()+"_people_"+a+'" ',i+='class="ui-widget-content ui-selectee">',i+='<div><span class="disclose"><span></span></span>',i+=s.id[u]+" "+s.name[u],i+="</div></li>"}i+="</ol>",$("#"+e).append("<input id='"+r.getName()+"filter'>"),n(r,o),$("#"+e).append(i),t(e,i,r.getName()+"-sortable")}})(),vizjslib_git_revision="cad30bb4090daf674b2c7b57471fa938fc87c37d",vizjslib_git_tag="2.1-118-gcad30bb";