diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index ba2181f..15c8e3a 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,28 +1,20 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +name: pkgdown + on: push: branches: [develop] - pull_request: - branches: [develop] - #release: - #types: [published] workflow_dispatch: -name: pkgdown +permissions: + contents: write jobs: pkgdown: runs-on: ubuntu-latest - # Only restrict concurrency for non-PR jobs - concurrency: - group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - permissions: - contents: write steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 @@ -35,14 +27,8 @@ jobs: extra-packages: any::pkgdown, local::. needs: website - - name: Build site - run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) - shell: Rscript {0} - - - name: Deploy to GitHub pages 🚀 - if: github.event_name != 'pull_request' - uses: JamesIves/github-pages-deploy-action@v4.8.0 - with: - clean: false - branch: gh-pages - folder: docs + - name: Build and deploy to gh-pages + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' diff --git a/docs/articles/CybertownTraining.html b/docs/articles/CybertownTraining.html index 60c2500..f1cab48 100644 --- a/docs/articles/CybertownTraining.html +++ b/docs/articles/CybertownTraining.html @@ -53,13 +53,13 @@ - + - - + +
CybertownTraining.Rmd## Downloading GitHub repo USEPA/rExpertQuery@develop
-##
+## sf (1.1-0 -> 1.1-1 ) [CRAN]
+## cpp11 (0.5.4 -> 0.5.5 ) [CRAN]
+## roxygen2 (7.3.3 -> 8.0.0 ) [CRAN]
+## terra (1.9-11 -> 1.9-27) [CRAN]
+## data.table (1.18.2.1 -> 1.18.4) [CRAN]
+## Installing 5 packages: sf, cpp11, roxygen2, terra, data.table
+## Installing packages into 'C:/Users/hmarler/AppData/Local/Temp/RtmpcdnLOt/temp_libpath2fa83ceb49fe'
+## (as 'lib' is unspecified)
+## package 'sf' successfully unpacked and MD5 sums checked
+## package 'cpp11' successfully unpacked and MD5 sums checked
+## package 'roxygen2' successfully unpacked and MD5 sums checked
+## package 'terra' successfully unpacked and MD5 sums checked
+## package 'data.table' successfully unpacked and MD5 sums checked
+##
+## The downloaded binary packages are in
+## C:\Users\hmarler\AppData\Local\Temp\RtmpYnTxPW\downloaded_packages
## ── R CMD build ─────────────────────────────────────────────────────────────────
-## checking for file 'C:\Users\hmarler\AppData\Local\Temp\RtmpywqNsa\remotes2b947e5159e5\USEPA-rExpertQuery-ce1ba15/DESCRIPTION' ... checking for file 'C:\Users\hmarler\AppData\Local\Temp\RtmpywqNsa\remotes2b947e5159e5\USEPA-rExpertQuery-ce1ba15/DESCRIPTION' ... ✔ checking for file 'C:\Users\hmarler\AppData\Local\Temp\RtmpywqNsa\remotes2b947e5159e5\USEPA-rExpertQuery-ce1ba15/DESCRIPTION' (601ms)
-## ─ preparing 'rExpertQuery': (4.7s)
+## checking for file 'C:\Users\hmarler\AppData\Local\Temp\RtmpYnTxPW\remotes59643c4c4d50\USEPA-rExpertQuery-96f363b/DESCRIPTION' ... checking for file 'C:\Users\hmarler\AppData\Local\Temp\RtmpYnTxPW\remotes59643c4c4d50\USEPA-rExpertQuery-96f363b/DESCRIPTION' ... ✔ checking for file 'C:\Users\hmarler\AppData\Local\Temp\RtmpYnTxPW\remotes59643c4c4d50\USEPA-rExpertQuery-96f363b/DESCRIPTION' (753ms)
+## ─ preparing 'rExpertQuery': (33.7s)
## checking DESCRIPTION meta-information ... checking DESCRIPTION meta-information ... ✔ checking DESCRIPTION meta-information
-## ─ checking for LF line-endings in source and make files and shell scripts (430ms)
+## ─ checking for LF line-endings in source and make files and shell scripts (653ms)
## ─ checking for empty or unneeded directories
## Omitted 'LazyData' and 'LazyDataCompression' from DESCRIPTION
-## ─ building 'rExpertQuery_0.1.0.tar.gz'
+## ─ building 'rExpertQuery_0.1.0.tar.gz' (622ms)
##
##
-
+## Installing package into 'C:/Users/hmarler/AppData/Local/Temp/RtmpcdnLOt/temp_libpath2fa83ceb49fe'
+## (as 'lib' is unspecified)
+
This vignette also requires additional packages which can be
installed using the code chunk below:
-
+
# # list of additional required packages
# demo.pkgs <- c("datasets", "data.table", "dplyr", "DT", "ggplot2", "httr", "leaflet", "maps", "plotly", "sf", "usdata", "usmap", "stringi")
#
@@ -156,40 +173,21 @@ Installation# load additional packages for this vignette
library(datasets)
-library(data.table)
-## Warning: package 'data.table' was built under R version 4.4.3
-
-## Warning: package 'dplyr' was built under R version 4.4.3
-
-## Warning: package 'DT' was built under R version 4.4.3
-
-## Warning: package 'httr' was built under R version 4.4.3
-
-## Warning: package 'leaflet' was built under R version 4.4.3
-
-## Warning: package 'maps' was built under R version 4.4.3
-
-## Warning: package 'plotly' was built under R version 4.4.3
-
-## Warning: package 'usdata' was built under R version 4.4.3
-
-## Warning: package 'usmap' was built under R version 4.4.3
-
-## Warning: package 'stringi' was built under R version 4.4.3
+library(data.table)
+library(dplyr)
+library(DT)
+library(ggplot2)
+library(httr)
+library(leaflet)
+library(maps)
+library(plotly)
+library(sf)
+library(usdata)
+library(usmap)
+library(stringi)
As a final setup step, we will turn off scientific notation so that
any catchment id numbers from our queries are displayed correctly.
-
+
# turn off scientific notation (for catchment ids)
options(scipen = 999)
@@ -206,7 +204,7 @@ API Key
To run this vignette, we can use the following test key. Users should
obtain their own API key if they will be using rExpertQuery to develop
their own workflows.
-
+
# load test api key
testkey <- "53BVce47MQ3KXKibjx35g4ojaDQGh8qWfbdO8cE0"
@@ -311,11 +309,11 @@ EQ_NationalExtractdplyr (data manipulation) and DT (interface to DataTables
library).
-
+
# import natioanl assessments profile
assessments.nat <- rExpertQuery::EQ_NationalExtract("assessments")
-## [1] "EQ_NationalExtract: downloading Assessments Profile (Expert Query National Extract). It was last updated on November 07, 2025 at 08:50 PM EST."
-
+## [1] "EQ_NationalExtract: downloading Assessments Profile (Expert Query National Extract). It was last updated on May 09, 2026 at 12:08 AM EDT."
+
# filter for latest assessments
assessments.nat <- assessments.nat |>
dplyr::group_by(organizationId) |>
@@ -342,7 +340,7 @@ EQ_NationalExtract# create data table of impairment count results
DT::datatable(count.impair, options = list(pageLength = 10, scrollX = TRUE))
-
+
Which waters are impaired for SELENIUM nationally? Which
@@ -350,7 +348,7 @@ EQ_NationalExtractdplyr and DT.
-
+
# filter assessments data set for
param.nat <- assessments.nat |>
# filter for selenium and cause
@@ -360,7 +358,7 @@ EQ_NationalExtract# data table of selenium impairments
DT::datatable(param.nat, options = list(pageLength = 5, scrollX = TRUE))
-Then we can create a list of states that have at least one selenium
+
Then we can create a list of states that have at least one selenium
impairment listed. We can also visualize this information on a map, with
states containing selenium impairments filled in blue. To build this
map, we first create a data frame with all 50 states and a
@@ -371,7 +369,7 @@
EQ_NationalExtractdatasets
(collection of data sets for use in R), usmap (US choropleth plotting) and ggplot2 (creating
graphics).
-
+
# filter to create df of states that have at least one selenium impairment}
state.names.sel <- param.nat |>
# select state column from filtered df
@@ -394,7 +392,7 @@ EQ_NationalExtractdplyr::mutate(SeleniumImpairment = factor(ifelse(state %in% state.names.sel,
"yes", "no"
)))
-
+
# create map, specifying data and values
usmap::plot_usmap(
regions = "state", data = sel.map.data,
@@ -420,7 +418,7 @@ EQ_NationalExtractdplyr and DT, for data manipulation and
creating a data table, respectively.
-
+
# filter national assessments to includ only Fully Supporting w/ TMDL
tmdl.fs <- assessments.nat |>
dplyr::filter(
@@ -446,7 +444,7 @@ EQ_NationalExtract# fully supporting waters with tmdls data table
DT::datatable(tmdl.fs, options = list(pageLength = 5, scrollX = TRUE))
-
+
What are the impaired waters (cat 4 and 5
@@ -454,7 +452,7 @@ EQ_NationalExtractdplyr and DT. This time we are retaining
a few more columns for inclusion in the data table and are filtering by
epaIRCategory for category 4 and 5 waters.
-
+
# select subset of columns to include
imp.waters <- assessments.nat |>
dplyr::select(
@@ -466,11 +464,11 @@ EQ_NationalExtractdplyr::distinct() |>
# filter for category 4 and 5 waters
dplyr::filter(epaIrCategory %in% c("4", "5"))
-The resulting data frame is large, with 128,919 unique impaired
+
The resulting data frame is large, with 137,482 unique impaired
waters nationally. Due to its size, we’ll include a random subset of 250
results in a data table to review during the demo. You can view the full
results by viewing the imp.waters df.
-
+
# data table with random 250 impaired waters
DT::datatable(
imp.waters |>
@@ -478,7 +476,7 @@ EQ_NationalExtract= list(pageLength = 5, scrollX = TRUE)
)
-
+
Which states have included any information about
@@ -491,7 +489,7 @@ EQ_NationalExtractdplyr and DT. We’ll use some additional
options in DT to highlight
useful rows in the final data table.
-
+
# import national extract for assessment units/monitoring locations
nat.ausmls <- rExpertQuery::EQ_NationalExtract("au_mls")
The next step is to filter the data frame and retain only rows that
@@ -507,7 +505,7 @@
EQ_NationalExtract
+
# filter for rows that contain monitoringLocationIds and are from State orgs
filtered.mls <- nat.ausmls |>
dplyr::filter(
@@ -534,13 +532,13 @@ EQ_NationalExtractdplyr::select(organizationId, organizationName, organizationType) |>
# retain distinct rows
dplyr::distinct()
-There are 21 with monitoringLocationId data in ATTAINS. Of these
-states, 3 also contain monitoringLocationDataLinks. We can create a data
+
There are 22 with monitoringLocationId data in ATTAINS. Of these
+states, 4 also contain monitoringLocationDataLinks. We can create a data
table to display this information and apply some conditional formatting
to highlight the states with monitoringLocationIdentifiers in blue and
those with monitoringLocationIdentifiers and monitoringLocationDataLinks
in orange.
-
+
# create data frame summarizing which states have monitoringLocationIds and monitoringLocationDataLinks in ATTAINS
ml.table <- nat.ausmls |>
# create df of all orgs
@@ -573,7 +571,7 @@ EQ_NationalExtract= styleEqual(c("yes"), c("#f9b97d"))
)
-
+
@@ -597,7 +595,7 @@ EQ_Assessments
-
+
# set up query to search assessments for KS, primary contact recreation use, and stream, default behavior is to query latest report cycle
ks.imp.streams <- rExpertQuery::EQ_Assessments(
statecode = "KS",
@@ -628,7 +626,7 @@ EQ_AssessmentsWe start by querying for Montana assessments with zinc as a cause and
can use dplyr and plotly (graphing library) to summarize
the results by useName and create a bar plot of the results.
-
+
# query MT's latest assessments for zinc as a cause
MT.impair <- rExpertQuery::EQ_Assessments(
statecode = "MT",
@@ -640,7 +638,7 @@ EQ_AssessmentsNext we summarize the uses associated with zinc impairments and count
the number of unique assessmentUnitIdentifiers for each use to
facilitate creating a bar plot.
-
+
# summarize by useName
MT.impair.use <- MT.impair |>
dplyr::group_by(useName) |>
@@ -649,7 +647,7 @@ EQ_AssessmentsThere are 3 uses with zinc as a cause in Montana: Agricultural,
Aquatic Life, and Drinking Water . As our last step, we’ll create the
bar plot.
-
+
-
+
Fig 2. Zinc impairments by useName for Montana’s latest assessment
cycle.
@@ -673,7 +671,7 @@ EQ_Assessments
-
+
# get cat 5 waters from 2024 assessment cycle
IL.latest <- rExpertQuery::EQ_Assessments(
statecode = "IL",
@@ -700,7 +698,7 @@ EQ_Assessments
-
+
# filter previous cycle to include only cat 5 waters from 2024
IL.previous <- IL.previous |>
# retain only cat 5 waters from latest cycle
@@ -721,12 +719,12 @@ EQ_AssessmentsFinally, we can summarize by counting the categories the new category
5s were previously in and create a pie chart with a default color scheme
to visualize.
-
+
# summarize what cats the new cat 5s were in previously
IL.change.sum <- IL.changes |>
dplyr::group_by(epaIrCategory.previous) |>
dplyr::summarise(count = dplyr::n_distinct(assessmentUnitId))
-
+
# create plotly plot
plotly::plot_ly() |>
# add pipe based IL.change.sum
@@ -746,7 +744,7 @@ EQ_Assessments ))
-
+
Fig 3. New category 5 waters in Illinois in the 2024 cycle, summarized
by their 2022 categories.
@@ -770,19 +768,19 @@ EQ_AssessmentUnitsDT.
-
+
# search for retired assessment units in Florida
FL.ret.auids <- rExpertQuery::EQ_AssessmentUnits(
statecode = "FL",
au_status = "Retired",
api_key = testkey
)
-## [1] "EQ_AssessmentUnits: The current query will return 35 rows."
-
+## [1] "EQ_AssessmentUnits: The current query will return 0 rows."
+
-
+
@@ -799,7 +797,7 @@ EQ_TMDLsTo answer this question we’ll use dplyr and plotly. The EQ_TMDLs query is simple,
specifying only the state of Hawaii since we want to return all of
Hawaii’s TMDLs.
-
+
# query for Hawaii TMDLs
HI.tmdls <- rExpertQuery::EQ_TMDLs(
statecode = "HI",
@@ -815,7 +813,7 @@ EQ_TMDLs
-
+
# determine the number of tmdls
HI.count <- HI.tmdls |>
# select required columns
@@ -831,7 +829,7 @@ EQ_TMDLs dplyr::summarize(count = dplyr::n_distinct(assessmentUnitId)) |>
# if pollutantGroup is missing, assign to group named "NULL"
dplyr::mutate(pollutantGroup = ifelse(is.na(pollutantGroup), "NULL", pollutantGroup))
-
+
-
+
Fig 4. Number of TMDLs per pollutantGroup in Hawaii.
@@ -854,7 +852,7 @@ EQ_TMDLsdplyr function. The
2025 fiscal year began on October 1, 2024, so that will be set as the
tmdl_start_date parameter along with specifying 10 for the region.
-
+
# r10 query for FY 2025 TMDLs
tmdl.proj <- rExpertQuery::EQ_TMDLs(
region = 10,
@@ -872,7 +870,7 @@ EQ_TMDLsdplyr functions to
manipulate the data frame so that for example, multiple pollutants will
be listed together in the same row.
-
+
tmdl.sum <- tmdl.proj |>
# select columns
dplyr::select(
@@ -901,7 +899,7 @@ EQ_TMDLs options = list(pageLength = 2, scrollX = TRUE)
)
-
+
@@ -918,7 +916,7 @@ EQ_Actions
+
# query Actions from Delaware that are included in Measures
DE.meas <- rExpertQuery::EQ_Actions(
statecode = "DE",
@@ -926,13 +924,13 @@ EQ_Actions= testkey
)
## [1] "EQ_Actions: The current query will return 649 rows."
-
+
# count unique actionIds
DE.count <- dplyr::n_distinct(DE.meas$actionId)
There are 480 actionIds that should be included when calculating
measures for Delaware. In a similar process to the final TMDL example,
we can create a data table with one row per actionId.
-
+
# determine unique actionIds
DE.actids <- DE.meas |>
# select columns
@@ -953,7 +951,7 @@ EQ_Actionsdplyr::select(-parameter, -assessmentUnitId) |>
# retain unique rows
dplyr::distinct()
-
+
DT::datatable(
DE.actids |>
rExpertQuery::EQ_FormatPlanLinks(),
@@ -970,7 +968,7 @@ EQ_Actionsdplyr and DT to summarize and display
results as in the first EQ_Actions example.
-
+
# query for R3 FY2024 actions
act.fy.24 <- rExpertQuery::EQ_Actions(
region = 3,
@@ -981,9 +979,9 @@ EQ_Actions# count unique actionIds
n_act.fy.24 <- dplyr::n_distinct(act.fy.24$actionId)
-There were 7 unique actions by actionId established in R3 in FY 2024.
+
There were 6 unique actions by actionId established in R3 in FY 2024.
We can create data table with counts for each actionType.
-
+
act.fy.24.counts <- act.fy.24 |>
# select columns
dplyr::select(
@@ -999,7 +997,7 @@ EQ_ActionsDT::datatable(act.fy.24.counts)
-
+
@@ -1018,19 +1016,19 @@ EQ_ActionsDocuments
+
# Actions Documents containing "nutrient"
nutrient.doc <- rExpertQuery::EQ_ActionsDocuments(
doc_query = "nutrient",
api_key = testkey
)
-This query yields 17,989 results. As well as providing the actionId
+
This query yields 16,962 results. As well as providing the actionId
and documentName for all results, EQ_Actions() also returns the
column “actionDocumentUrl” containing the URL to link to the document.
Because the query yields so many results, we’ll take a look at the
highest ranking 50 matches in a DT data table to understand the
structure of the results.
-
+
-
+
How many actions documents that contain the keyword
@@ -1049,13 +1047,13 @@ EQ_ActionsDocumentsplotly bar
plot.
-
+
nutrient.doc.regions <- nutrient.doc |>
# group by region
dplyr::group_by(region) |>
# count action ids by region
dplyr::summarize(count = length(unique(actionId)))
-
+
# create bar plot
plotly::plot_ly(
data = nutrient.doc.regions,
@@ -1065,7 +1063,7 @@ EQ_ActionsDocuments)
-
+
Fig 5. Number of documents containing the keyword ‘nutrient’ by EPA
Region.
@@ -1088,7 +1086,7 @@ EQ_AUsMLs
+
# query for assessment units and monitoring locations from Alaska
ak.mls <- rExpertQuery::EQ_AUsMLs(
statecode = "AK",
@@ -1125,7 +1123,7 @@ EQ_AUsMLs
+
# filter Alaska data set for assessmentUnitIds without listed monitoringLocationIds
no.ml.ak <- ak.mls |>
dplyr::filter(!assessmentUnitId %in% filt.ak.mls$assessmentUnitId)
@@ -1147,7 +1145,7 @@ EQ_Sourcesdplyr and usdata to
manipulate the data and create a list of the region 6 states that list
probable sources for any assessments in their latest report cycle.
-
+
# query for probable sources in the latest assessment cycle in R6
r6.sources <- rExpertQuery::EQ_Sources(
region = 6,
@@ -1179,7 +1177,7 @@ EQ_SourcesDT data table of the
results.
-
+
# count the number of times a probable source is listed for each state
r6.sources.summarize <- r6.sources |>
dplyr::select(state, organizationId, assessmentUnitId, sourceName) |>
@@ -1193,7 +1191,7 @@ EQ_Sources# data table for max count
DT::datatable(r6.sources.summarize)
-
+
@@ -1215,7 +1213,7 @@ EQ_CatchCorrdplyr functions to retain the
unique rows make a a DT data
table.
-
+
# query for IL_N-99 catchment data
il.n99.catch <- rExpertQuery::EQ_CatchCorr(
statecode = "IL",
@@ -1250,7 +1248,7 @@ EQ_CatchCorr
+
# set up query params for ATTAINS geospatial web services
query.params <- list(
where = "assessmentunitidentifier IN ('IL_N-99')",
@@ -1290,7 +1288,7 @@ EQ_CatchCorr
+
# create leaflet map
leaflet::leaflet() |>
# add open street map layer
@@ -1332,16 +1330,14 @@ EQ_DomainValuesRunning the EQ_DomainValues function with no value provided for the
“domain” argument will return a list of the parameter names that it can
return domain values for.
-
+
# run EQ_DomainValues with no value provided for "domain" to return list of params
domain.vals <- EQ_DomainValues()
-## [1] "EQ_DomainValues: getting list of available domain names."
+## [1] "EQ_DomainValues: getting list of available domain names. Values in the eq_param column can be used as inputs in EQ_DomainValues."
+## EQ_DomainValues: domain list retrieved from ATTAINS web services.
EQ_DomainValues can provide values for the following query
-parameters: act_agency, act_status, act_type, ad_param, assess_basis,
-assess_methods, assess_types, au_status, cause, delist_reason, doc_type,
-file_type, loc_type, org_id, org_name, param_attain, param_group,
-param_name, param_state_ir_cat, param_status, source_scale, source_type,
-statecode, use_name, use_support and water_type .
+parameters:
+.
How many different values for “water_type” can be used in
@@ -1349,9 +1345,10 @@ EQ_DomainValuesTo find the allowable values for “water_type” in rExpertQuery
function, we can run EQ_DomainValues again, this time specifying
“water_type”.
-
+
water.types <- rExpertQuery::EQ_DomainValues("water_type")
-## [1] "EQ_DomainValues: For water_type the values in the name column of the function output are the allowable values for rExpert Query functions."
+## [1] "EQ_DomainValues: For water_type the values in the 'name' column of the function output are the allowable values for rExpert Query functions."
+## EQ_DomainValues: domain list retrieved from ATTAINS web services.
The printed message informs us that the “name” column contains the
values for use in water_type queries for rExpertQuery functions. For
water_type there are 66 unique values. They are: BAY; BAYOU; BEACH;
diff --git a/docs/articles/CybertownTraining.md b/docs/articles/CybertownTraining.md
index 78c428b..b72bb7c 100644
--- a/docs/articles/CybertownTraining.md
+++ b/docs/articles/CybertownTraining.md
@@ -59,18 +59,39 @@ remotes::install_github("USEPA/rExpertQuery", ref = "develop", dependencies = TR
## Downloading GitHub repo USEPA/rExpertQuery@develop
+ ## sf (1.1-0 -> 1.1-1 ) [CRAN]
+ ## cpp11 (0.5.4 -> 0.5.5 ) [CRAN]
+ ## roxygen2 (7.3.3 -> 8.0.0 ) [CRAN]
+ ## terra (1.9-11 -> 1.9-27) [CRAN]
+ ## data.table (1.18.2.1 -> 1.18.4) [CRAN]
+
+ ## Installing 5 packages: sf, cpp11, roxygen2, terra, data.table
+
+ ## Installing packages into 'C:/Users/hmarler/AppData/Local/Temp/RtmpcdnLOt/temp_libpath2fa83ceb49fe'
+ ## (as 'lib' is unspecified)
+
+ ## package 'sf' successfully unpacked and MD5 sums checked
+ ## package 'cpp11' successfully unpacked and MD5 sums checked
+ ## package 'roxygen2' successfully unpacked and MD5 sums checked
+ ## package 'terra' successfully unpacked and MD5 sums checked
+ ## package 'data.table' successfully unpacked and MD5 sums checked
##
+ ## The downloaded binary packages are in
+ ## C:\Users\hmarler\AppData\Local\Temp\RtmpYnTxPW\downloaded_packages
## ── R CMD build ─────────────────────────────────────────────────────────────────
- ## checking for file 'C:\Users\hmarler\AppData\Local\Temp\RtmpywqNsa\remotes2b947e5159e5\USEPA-rExpertQuery-ce1ba15/DESCRIPTION' ... checking for file 'C:\Users\hmarler\AppData\Local\Temp\RtmpywqNsa\remotes2b947e5159e5\USEPA-rExpertQuery-ce1ba15/DESCRIPTION' ... ✔ checking for file 'C:\Users\hmarler\AppData\Local\Temp\RtmpywqNsa\remotes2b947e5159e5\USEPA-rExpertQuery-ce1ba15/DESCRIPTION' (601ms)
- ## ─ preparing 'rExpertQuery': (4.7s)
+ ## checking for file 'C:\Users\hmarler\AppData\Local\Temp\RtmpYnTxPW\remotes59643c4c4d50\USEPA-rExpertQuery-96f363b/DESCRIPTION' ... checking for file 'C:\Users\hmarler\AppData\Local\Temp\RtmpYnTxPW\remotes59643c4c4d50\USEPA-rExpertQuery-96f363b/DESCRIPTION' ... ✔ checking for file 'C:\Users\hmarler\AppData\Local\Temp\RtmpYnTxPW\remotes59643c4c4d50\USEPA-rExpertQuery-96f363b/DESCRIPTION' (753ms)
+ ## ─ preparing 'rExpertQuery': (33.7s)
## checking DESCRIPTION meta-information ... checking DESCRIPTION meta-information ... ✔ checking DESCRIPTION meta-information
- ## ─ checking for LF line-endings in source and make files and shell scripts (430ms)
+ ## ─ checking for LF line-endings in source and make files and shell scripts (653ms)
## ─ checking for empty or unneeded directories
## Omitted 'LazyData' and 'LazyDataCompression' from DESCRIPTION
- ## ─ building 'rExpertQuery_0.1.0.tar.gz'
+ ## ─ building 'rExpertQuery_0.1.0.tar.gz' (622ms)
##
##
+ ## Installing package into 'C:/Users/hmarler/AppData/Local/Temp/RtmpcdnLOt/temp_libpath2fa83ceb49fe'
+ ## (as 'lib' is unspecified)
+
``` r
library(rExpertQuery)
```
@@ -92,66 +113,19 @@ using the code chunk below:
# load additional packages for this vignette
library(datasets)
library(data.table)
-```
-
- ## Warning: package 'data.table' was built under R version 4.4.3
-
-``` r
library(dplyr)
-```
-
- ## Warning: package 'dplyr' was built under R version 4.4.3
-
-``` r
library(DT)
-```
-
- ## Warning: package 'DT' was built under R version 4.4.3
-
-``` r
library(ggplot2)
library(httr)
-```
-
- ## Warning: package 'httr' was built under R version 4.4.3
-
-``` r
library(leaflet)
-```
-
- ## Warning: package 'leaflet' was built under R version 4.4.3
-
-``` r
library(maps)
-```
-
- ## Warning: package 'maps' was built under R version 4.4.3
-
-``` r
library(plotly)
-```
-
- ## Warning: package 'plotly' was built under R version 4.4.3
-
-``` r
library(sf)
library(usdata)
-```
-
- ## Warning: package 'usdata' was built under R version 4.4.3
-
-``` r
library(usmap)
-```
-
- ## Warning: package 'usmap' was built under R version 4.4.3
-
-``` r
library(stringi)
```
- ## Warning: package 'stringi' was built under R version 4.4.3
-
As a final setup step, we will turn off scientific notation so that any
catchment id numbers from our queries are displayed correctly.
@@ -282,7 +256,7 @@ A screenshot of the Expert Query National Downloads web page
assessments.nat <- rExpertQuery::EQ_NationalExtract("assessments")
```
- ## [1] "EQ_NationalExtract: downloading Assessments Profile (Expert Query National Extract). It was last updated on November 07, 2025 at 08:50 PM EST."
+ ## [1] "EQ_NationalExtract: downloading Assessments Profile (Expert Query National Extract). It was last updated on May 09, 2026 at 12:08 AM EDT."
``` r
# filter for latest assessments
@@ -452,7 +426,7 @@ A screenshot of the Expert Query National Downloads web page
dplyr::filter(epaIrCategory %in% c("4", "5"))
```
- The resulting data frame is large, with 128,919 unique impaired
+ The resulting data frame is large, with 137,482 unique impaired
waters nationally. Due to its size, we’ll include a random subset of
250 results in a data table to review during the demo. You can view
the full results by viewing the imp.waters df.
@@ -531,8 +505,8 @@ A screenshot of the Expert Query National Downloads web page
dplyr::distinct()
```
- There are 21 with monitoringLocationId data in ATTAINS. Of these
- states, 3 also contain monitoringLocationDataLinks. We can create a
+ There are 22 with monitoringLocationId data in ATTAINS. Of these
+ states, 4 also contain monitoringLocationDataLinks. We can create a
data table to display this information and apply some conditional
formatting to highlight the states with
monitoringLocationIdentifiers in blue and those with
@@ -789,7 +763,7 @@ queries ATTAINS Assessment Units data. The default is to only return
)
```
- ## [1] "EQ_AssessmentUnits: The current query will return 35 rows."
+ ## [1] "EQ_AssessmentUnits: The current query will return 0 rows."
``` r
# create data table
@@ -1011,7 +985,7 @@ ATTAINS Actions data by a variety of user supplied parameters.
n_act.fy.24 <- dplyr::n_distinct(act.fy.24$actionId)
```
- There were 7 unique actions by actionId established in R3 in
+ There were 6 unique actions by actionId established in R3 in
FY 2024. We can create data table with counts for each actionType.
``` r
@@ -1053,7 +1027,7 @@ keyword.
)
```
- This query yields 17,989 results. As well as providing the actionId
+ This query yields 16,962 results. As well as providing the actionId
and documentName for all results, *EQ_Actions()* also returns the
column “actionDocumentUrl” containing the URL to link to the
document. Because the query yields so many results, we’ll take a
@@ -1369,15 +1343,14 @@ value that should be used in queries.
domain.vals <- EQ_DomainValues()
```
- ## [1] "EQ_DomainValues: getting list of available domain names."
+ ## [1] "EQ_DomainValues: getting list of available domain names. Values in the eq_param column can be used as inputs in EQ_DomainValues."
+
+ ## EQ_DomainValues: domain list retrieved from ATTAINS web services.
EQ_DomainValues can provide values for the following query
- parameters: act_agency, act_status, act_type, ad_param,
- assess_basis, assess_methods, assess_types, au_status, cause,
- delist_reason, doc_type, file_type, loc_type, org_id, org_name,
- param_attain, param_group, param_name, param_state_ir_cat,
- param_status, source_scale, source_type, statecode, use_name,
- use_support and water_type .
+ parameters:
+
+ .
2. **How many different values for “water_type” can be used in
rExpertQuery functions?**
@@ -1390,7 +1363,9 @@ value that should be used in queries.
water.types <- rExpertQuery::EQ_DomainValues("water_type")
```
- ## [1] "EQ_DomainValues: For water_type the values in the name column of the function output are the allowable values for rExpert Query functions."
+ ## [1] "EQ_DomainValues: For water_type the values in the 'name' column of the function output are the allowable values for rExpert Query functions."
+
+ ## EQ_DomainValues: domain list retrieved from ATTAINS web services.
The printed message informs us that the “name” column contains the
values for use in water_type queries for rExpertQuery functions. For
diff --git a/docs/articles/CybertownTraining_files/htmltools-fill-0.5.8.1/fill.css b/docs/articles/CybertownTraining_files/htmltools-fill-0.5.9/fill.css
similarity index 100%
rename from docs/articles/CybertownTraining_files/htmltools-fill-0.5.8.1/fill.css
rename to docs/articles/CybertownTraining_files/htmltools-fill-0.5.9/fill.css
diff --git a/docs/articles/CybertownTraining_files/plotly-binding-4.11.0/plotly.js b/docs/articles/CybertownTraining_files/plotly-binding-4.12.0/plotly.js
similarity index 100%
rename from docs/articles/CybertownTraining_files/plotly-binding-4.11.0/plotly.js
rename to docs/articles/CybertownTraining_files/plotly-binding-4.12.0/plotly.js
diff --git a/docs/articles/CybertownTraining_files/plotly-htmlwidgets-css-2.11.1/plotly-htmlwidgets.css b/docs/articles/CybertownTraining_files/plotly-htmlwidgets-css-2.25.2/plotly-htmlwidgets.css
similarity index 100%
rename from docs/articles/CybertownTraining_files/plotly-htmlwidgets-css-2.11.1/plotly-htmlwidgets.css
rename to docs/articles/CybertownTraining_files/plotly-htmlwidgets-css-2.25.2/plotly-htmlwidgets.css
diff --git a/docs/articles/CybertownTraining_files/plotly-main-2.11.1/plotly-latest.min.js b/docs/articles/CybertownTraining_files/plotly-main-2.11.1/plotly-latest.min.js
deleted file mode 100644
index 27bfdaa..0000000
--- a/docs/articles/CybertownTraining_files/plotly-main-2.11.1/plotly-latest.min.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
-* plotly.js v2.11.1
-* Copyright 2012-2022, Plotly, Inc.
-* All rights reserved.
-* Licensed under the MIT license
-*/
-!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=t()}}((function(){return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};e[o][0].call(u.exports,(function(t){return i(e[o][1][t]||t)}),u,u.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o:not(.watermark)":"opacity:0;-webkit-transition:opacity .3s ease 0s;-moz-transition:opacity .3s ease 0s;-ms-transition:opacity .3s ease 0s;-o-transition:opacity .3s ease 0s;transition:opacity .3s ease 0s;","X:hover .modebar--hover .modebar-group":"opacity:1;","X .modebar-group":"float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;","X .modebar-btn":"position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;","X .modebar-btn svg":"position:relative;top:2px;","X .modebar.vertical":"display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;","X .modebar.vertical svg":"top:-1px;","X .modebar.vertical .modebar-group":"display:block;float:none;padding-left:0px;padding-bottom:8px;","X .modebar.vertical .modebar-group .modebar-btn":"display:block;text-align:center;","X [data-title]:before,X [data-title]:after":"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;","X [data-title]:hover:before,X [data-title]:hover:after":"display:block;opacity:1;","X [data-title]:before":'content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;',"X [data-title]:after":"content:attr(data-title);background:#69738a;color:#fff;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;margin-right:-18px;border-radius:2px;","X .vertical [data-title]:before,X .vertical [data-title]:after":"top:0%;right:200%;","X .vertical [data-title]:before":"border:6px solid transparent;border-left-color:#69738a;margin-top:8px;margin-right:-30px;","X .select-outline":"fill:none;stroke-width:1;shape-rendering:crispEdges;","X .select-outline-1":"stroke:#fff;","X .select-outline-2":"stroke:#000;stroke-dasharray:2px 2px;",Y:'font-family:"Open Sans",verdana,arial,sans-serif;position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;',"Y p":"margin:0;","Y .notifier-note":"min-width:180px;max-width:250px;border:1px solid #fff;z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,.9);color:#fff;padding:10px;overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;","Y .notifier-close":"color:#fff;opacity:.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;","Y .notifier-close:hover":"color:#444;text-decoration:none;cursor:pointer;"};for(var a in i){var o=a.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,i[a])}},{"../src/lib":498}],2:[function(t,e,r){"use strict";e.exports=t("../src/transforms/aggregate")},{"../src/transforms/aggregate":1113}],3:[function(t,e,r){"use strict";e.exports=t("../src/traces/bar")},{"../src/traces/bar":651}],4:[function(t,e,r){"use strict";e.exports=t("../src/traces/barpolar")},{"../src/traces/barpolar":664}],5:[function(t,e,r){"use strict";e.exports=t("../src/traces/box")},{"../src/traces/box":674}],6:[function(t,e,r){"use strict";e.exports=t("../src/components/calendars")},{"../src/components/calendars":359}],7:[function(t,e,r){"use strict";e.exports=t("../src/traces/candlestick")},{"../src/traces/candlestick":683}],8:[function(t,e,r){"use strict";e.exports=t("../src/traces/carpet")},{"../src/traces/carpet":702}],9:[function(t,e,r){"use strict";e.exports=t("../src/traces/choropleth")},{"../src/traces/choropleth":716}],10:[function(t,e,r){"use strict";e.exports=t("../src/traces/choroplethmapbox")},{"../src/traces/choroplethmapbox":723}],11:[function(t,e,r){"use strict";e.exports=t("../src/traces/cone")},{"../src/traces/cone":729}],12:[function(t,e,r){"use strict";e.exports=t("../src/traces/contour")},{"../src/traces/contour":744}],13:[function(t,e,r){"use strict";e.exports=t("../src/traces/contourcarpet")},{"../src/traces/contourcarpet":755}],14:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":476}],15:[function(t,e,r){"use strict";e.exports=t("../src/traces/densitymapbox")},{"../src/traces/densitymapbox":763}],16:[function(t,e,r){"use strict";e.exports=t("../src/transforms/filter")},{"../src/transforms/filter":1114}],17:[function(t,e,r){"use strict";e.exports=t("../src/traces/funnel")},{"../src/traces/funnel":773}],18:[function(t,e,r){"use strict";e.exports=t("../src/traces/funnelarea")},{"../src/traces/funnelarea":782}],19:[function(t,e,r){"use strict";e.exports=t("../src/transforms/groupby")},{"../src/transforms/groupby":1115}],20:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmap")},{"../src/traces/heatmap":795}],21:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmapgl")},{"../src/traces/heatmapgl":806}],22:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram")},{"../src/traces/histogram":818}],23:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2d")},{"../src/traces/histogram2d":824}],24:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2dcontour")},{"../src/traces/histogram2dcontour":828}],25:[function(t,e,r){"use strict";e.exports=t("../src/traces/icicle")},{"../src/traces/icicle":834}],26:[function(t,e,r){"use strict";e.exports=t("../src/traces/image")},{"../src/traces/image":847}],27:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./bar"),t("./box"),t("./heatmap"),t("./histogram"),t("./histogram2d"),t("./histogram2dcontour"),t("./contour"),t("./scatterternary"),t("./violin"),t("./funnel"),t("./waterfall"),t("./image"),t("./pie"),t("./sunburst"),t("./treemap"),t("./icicle"),t("./funnelarea"),t("./scatter3d"),t("./surface"),t("./isosurface"),t("./volume"),t("./mesh3d"),t("./cone"),t("./streamtube"),t("./scattergeo"),t("./choropleth"),t("./scattergl"),t("./splom"),t("./pointcloud"),t("./heatmapgl"),t("./parcoords"),t("./parcats"),t("./scattermapbox"),t("./choroplethmapbox"),t("./densitymapbox"),t("./sankey"),t("./indicator"),t("./table"),t("./carpet"),t("./scattercarpet"),t("./contourcarpet"),t("./ohlc"),t("./candlestick"),t("./scatterpolar"),t("./scatterpolargl"),t("./barpolar"),t("./scattersmith"),t("./aggregate"),t("./filter"),t("./groupby"),t("./sort"),t("./calendars")]),e.exports=n},{"./aggregate":2,"./bar":3,"./barpolar":4,"./box":5,"./calendars":6,"./candlestick":7,"./carpet":8,"./choropleth":9,"./choroplethmapbox":10,"./cone":11,"./contour":12,"./contourcarpet":13,"./core":14,"./densitymapbox":15,"./filter":16,"./funnel":17,"./funnelarea":18,"./groupby":19,"./heatmap":20,"./heatmapgl":21,"./histogram":22,"./histogram2d":23,"./histogram2dcontour":24,"./icicle":25,"./image":26,"./indicator":28,"./isosurface":29,"./mesh3d":30,"./ohlc":31,"./parcats":32,"./parcoords":33,"./pie":34,"./pointcloud":35,"./sankey":36,"./scatter3d":37,"./scattercarpet":38,"./scattergeo":39,"./scattergl":40,"./scattermapbox":41,"./scatterpolar":42,"./scatterpolargl":43,"./scattersmith":44,"./scatterternary":45,"./sort":46,"./splom":47,"./streamtube":48,"./sunburst":49,"./surface":50,"./table":51,"./treemap":52,"./violin":53,"./volume":54,"./waterfall":55}],28:[function(t,e,r){"use strict";e.exports=t("../src/traces/indicator")},{"../src/traces/indicator":855}],29:[function(t,e,r){"use strict";e.exports=t("../src/traces/isosurface")},{"../src/traces/isosurface":861}],30:[function(t,e,r){"use strict";e.exports=t("../src/traces/mesh3d")},{"../src/traces/mesh3d":866}],31:[function(t,e,r){"use strict";e.exports=t("../src/traces/ohlc")},{"../src/traces/ohlc":871}],32:[function(t,e,r){"use strict";e.exports=t("../src/traces/parcats")},{"../src/traces/parcats":880}],33:[function(t,e,r){"use strict";e.exports=t("../src/traces/parcoords")},{"../src/traces/parcoords":891}],34:[function(t,e,r){"use strict";e.exports=t("../src/traces/pie")},{"../src/traces/pie":902}],35:[function(t,e,r){"use strict";e.exports=t("../src/traces/pointcloud")},{"../src/traces/pointcloud":911}],36:[function(t,e,r){"use strict";e.exports=t("../src/traces/sankey")},{"../src/traces/sankey":917}],37:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatter3d")},{"../src/traces/scatter3d":955}],38:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattercarpet")},{"../src/traces/scattercarpet":962}],39:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattergeo")},{"../src/traces/scattergeo":970}],40:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattergl")},{"../src/traces/scattergl":984}],41:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattermapbox")},{"../src/traces/scattermapbox":994}],42:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterpolar")},{"../src/traces/scatterpolar":1002}],43:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterpolargl")},{"../src/traces/scatterpolargl":1010}],44:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattersmith")},{"../src/traces/scattersmith":1017}],45:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterternary")},{"../src/traces/scatterternary":1025}],46:[function(t,e,r){"use strict";e.exports=t("../src/transforms/sort")},{"../src/transforms/sort":1117}],47:[function(t,e,r){"use strict";e.exports=t("../src/traces/splom")},{"../src/traces/splom":1035}],48:[function(t,e,r){"use strict";e.exports=t("../src/traces/streamtube")},{"../src/traces/streamtube":1043}],49:[function(t,e,r){"use strict";e.exports=t("../src/traces/sunburst")},{"../src/traces/sunburst":1051}],50:[function(t,e,r){"use strict";e.exports=t("../src/traces/surface")},{"../src/traces/surface":1060}],51:[function(t,e,r){"use strict";e.exports=t("../src/traces/table")},{"../src/traces/table":1068}],52:[function(t,e,r){"use strict";e.exports=t("../src/traces/treemap")},{"../src/traces/treemap":1079}],53:[function(t,e,r){"use strict";e.exports=t("../src/traces/violin")},{"../src/traces/violin":1092}],54:[function(t,e,r){"use strict";e.exports=t("../src/traces/volume")},{"../src/traces/volume":1100}],55:[function(t,e,r){"use strict";e.exports=t("../src/traces/waterfall")},{"../src/traces/waterfall":1108}],56:[function(t,e,r){!function(n,i){"object"==typeof r&&void 0!==e?i(r,t("d3-array"),t("d3-collection"),t("d3-shape"),t("elementary-circuits-directed-graph")):i(n.d3=n.d3||{},n.d3,n.d3,n.d3,null)}(this,(function(t,e,r,n,i){"use strict";function a(t){return t.target.depth}function o(t,e){return t.sourceLinks.length?t.depth:e-1}function s(t){return function(){return t}}i=i&&i.hasOwnProperty("default")?i.default:i;var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function c(t,e){return f(t.source,e.source)||t.index-e.index}function u(t,e){return f(t.target,e.target)||t.index-e.index}function f(t,e){return t.partOfCycle===e.partOfCycle?t.y0-e.y0:"top"===t.circularLinkType||"bottom"===e.circularLinkType?-1:1}function h(t){return t.value}function p(t){return(t.y0+t.y1)/2}function d(t){return p(t.source)}function m(t){return p(t.target)}function g(t){return t.index}function v(t){return t.nodes}function y(t){return t.links}function x(t,e){var r=t.get(e);if(!r)throw new Error("missing: "+e);return r}function b(t,e){return e(t)}function _(t,e,r){var n=0;if(null===r){for(var a=[],o=0;o1||i>1)}function M(t,e,r){return t.sort(E),t.forEach((function(n,i){var a,o,s=0;if(q(n,r)&&A(n))n.circularPathData.verticalBuffer=s+n.width/2;else{for(var l=0;lo.source.column)){var c=t[l].circularPathData.verticalBuffer+t[l].width/2+e;s=c>s?c:s}n.circularPathData.verticalBuffer=s+n.width/2}})),t}function S(t,r,i,a){var o=e.min(t.links,(function(t){return t.source.y0}));t.links.forEach((function(t){t.circular&&(t.circularPathData={})})),M(t.links.filter((function(t){return"top"==t.circularLinkType})),r,a),M(t.links.filter((function(t){return"bottom"==t.circularLinkType})),r,a),t.links.forEach((function(e){if(e.circular){if(e.circularPathData.arcRadius=e.width+10,e.circularPathData.leftNodeBuffer=5,e.circularPathData.rightNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,q(e,a)&&A(e))e.circularPathData.leftSmallArcRadius=10+e.width/2,e.circularPathData.leftLargeArcRadius=10+e.width/2,e.circularPathData.rightSmallArcRadius=10+e.width/2,e.circularPathData.rightLargeArcRadius=10+e.width/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+25+e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-25-e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=t.links.filter((function(t){return t.source.column==s&&t.circularLinkType==l}));"bottom"==e.circularLinkType?c.sort(C):c.sort(L);var u=0;c.forEach((function(t,n){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=10+e.width/2+u,e.circularPathData.leftLargeArcRadius=10+e.width/2+n*r+u),u+=t.width})),s=e.target.column,c=t.links.filter((function(t){return t.target.column==s&&t.circularLinkType==l})),"bottom"==e.circularLinkType?c.sort(I):c.sort(P),u=0,c.forEach((function(t,n){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=10+e.width/2+u,e.circularPathData.rightLargeArcRadius=10+e.width/2+n*r+u),u+=t.width})),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i,e.source.y1,e.target.y1)+25+e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius):(e.circularPathData.verticalFullExtent=o-25-e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius)}e.circularPathData.leftInnerExtent=e.circularPathData.sourceX+e.circularPathData.leftNodeBuffer,e.circularPathData.rightInnerExtent=e.circularPathData.targetX-e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.sourceX+e.circularPathData.leftLargeArcRadius+e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.targetX-e.circularPathData.rightLargeArcRadius-e.circularPathData.rightNodeBuffer}if(e.circular)e.path=function(t){var e="";e="top"==t.circularLinkType?"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 0 "+t.circularPathData.leftFullExtent+" "+(t.circularPathData.sourceY-t.circularPathData.leftSmallArcRadius)+" L"+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 0 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 0 "+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" L"+t.circularPathData.rightFullExtent+" "+(t.circularPathData.targetY-t.circularPathData.rightSmallArcRadius)+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 0 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY:"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 1 "+t.circularPathData.leftFullExtent+" "+(t.circularPathData.sourceY+t.circularPathData.leftSmallArcRadius)+" L"+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 1 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 1 "+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" L"+t.circularPathData.rightFullExtent+" "+(t.circularPathData.targetY+t.circularPathData.rightSmallArcRadius)+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 1 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY;return e}(e);else{var f=n.linkHorizontal().source((function(t){return[t.source.x0+(t.source.x1-t.source.x0),t.y0]})).target((function(t){return[t.target.x0,t.y1]}));e.path=f(e)}}))}function E(t,e){return O(t)==O(e)?"bottom"==t.circularLinkType?C(t,e):L(t,e):O(e)-O(t)}function L(t,e){return t.y0-e.y0}function C(t,e){return e.y0-t.y0}function P(t,e){return t.y1-e.y1}function I(t,e){return e.y1-t.y1}function O(t){return t.target.column-t.source.column}function z(t){return t.target.x0-t.source.x1}function D(t,e){var r=T(t),n=z(e)/Math.tan(r);return"up"==H(t)?t.y1+n:t.y1-n}function R(t,e){var r=T(t),n=z(e)/Math.tan(r);return"up"==H(t)?t.y1-n:t.y1+n}function F(t,e,r,n){t.links.forEach((function(i){if(!i.circular&&i.target.column-i.source.column>1){var a=i.source.column+1,o=i.target.column-1,s=1,l=o-a+1;for(s=1;a<=o;a++,s++)t.nodes.forEach((function(o){if(o.column==a){var c,u=s/(l+1),f=Math.pow(1-u,3),h=3*u*Math.pow(1-u,2),p=3*Math.pow(u,2)*(1-u),d=Math.pow(u,3),m=f*i.y0+h*i.y0+p*i.y1+d*i.y1,g=m-i.width/2,v=m+i.width/2;g>o.y0&&go.y0&&vo.y1)&&(c=v-o.y0+10,o=N(o,c,e,r),t.nodes.forEach((function(t){b(t,n)!=b(o,n)&&t.column==o.column&&t.y0o.y1&&N(t,c,e,r)})))}}))}}))}function B(t,e){return t.y0>e.y0&&t.y0e.y0&&t.y1e.y1)}function N(t,e,r,n){return t.y0+e>=r&&t.y1+e<=n&&(t.y0=t.y0+e,t.y1=t.y1+e,t.targetLinks.forEach((function(t){t.y1=t.y1+e})),t.sourceLinks.forEach((function(t){t.y0=t.y0+e}))),t}function j(t,e,r,n){t.nodes.forEach((function(i){n&&i.y+(i.y1-i.y0)>e&&(i.y=i.y-(i.y+(i.y1-i.y0)-e));var a=t.links.filter((function(t){return b(t.source,r)==b(i,r)})),o=a.length;o>1&&a.sort((function(t,e){if(!t.circular&&!e.circular){if(t.target.column==e.target.column)return t.y1-e.y1;if(!V(t,e))return t.y1-e.y1;if(t.target.column>e.target.column){var r=R(e,t);return t.y1-r}if(e.target.column>t.target.column)return R(t,e)-e.y1}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.target.column===e.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===e.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:"top"==t.circularLinkType?-1:1:void 0}));var s=i.y0;a.forEach((function(t){t.y0=s+t.width/2,s+=t.width})),a.forEach((function(t,e){if("bottom"==t.circularLinkType){for(var r=e+1,n=0;r1&&n.sort((function(t,e){if(!t.circular&&!e.circular){if(t.source.column==e.source.column)return t.y0-e.y0;if(!V(t,e))return t.y0-e.y0;if(e.source.column0?"up":"down"}function q(t,e){return b(t.source,e)==b(t.target,e)}function G(t,r,n){var i=t.nodes,a=t.links,o=!1,s=!1;if(a.forEach((function(t){"top"==t.circularLinkType?o=!0:"bottom"==t.circularLinkType&&(s=!0)})),0==o||0==s){var l=e.min(i,(function(t){return t.y0})),c=(n-r)/(e.max(i,(function(t){return t.y1}))-l);i.forEach((function(t){var e=(t.y1-t.y0)*c;t.y0=(t.y0-l)*c,t.y1=t.y0+e})),a.forEach((function(t){t.y0=(t.y0-l)*c,t.y1=(t.y1-l)*c,t.width=t.width*c}))}}t.sankeyCircular=function(){var t,n,i=0,a=0,b=1,T=1,A=24,M=g,E=o,L=v,C=y,P=32,I=2,O=null;function z(){var t={nodes:L.apply(null,arguments),links:C.apply(null,arguments)};D(t),_(t,M,O),R(t),B(t),w(t,M),N(t,P,M),V(t);for(var e=4,r=0;r0?r+25+10:r,bottom:n=n>0?n+25+10:n,left:a=a>0?a+25+10:a,right:i=i>0?i+25+10:i}}(o),f=function(t,r){var n=e.max(t.nodes,(function(t){return t.column})),o=b-i,s=T-a,l=o/(o+r.right+r.left),c=s/(s+r.top+r.bottom);return i=i*l+r.left,b=0==r.right?b:b*l,a=a*c+r.top,T*=c,t.nodes.forEach((function(t){t.x0=i+t.column*((b-i-A)/n),t.x1=t.x0+A})),c}(o,u);l*=f,o.links.forEach((function(t){t.width=t.value*l})),c.forEach((function(t){var e=t.length;t.forEach((function(t,n){t.depth==c.length-1&&1==e||0==t.depth&&1==e?(t.y0=T/2-t.value*l,t.y1=t.y0+t.value*l):t.partOfCycle?0==k(t,r)?(t.y0=T/2+n,t.y1=t.y0+t.value*l):"top"==t.circularLinkType?(t.y0=a+n,t.y1=t.y0+t.value*l):(t.y0=T-t.value*l-n,t.y1=t.y0+t.value*l):0==u.top||0==u.bottom?(t.y0=(T-a)/e*n,t.y1=t.y0+t.value*l):(t.y0=(T-a)/2-e/2+n,t.y1=t.y0+t.value*l)}))}))}(l),y();for(var u=1,g=s;g>0;--g)v(u*=.99,l),y();function v(t,r){var n=c.length;c.forEach((function(i){var a=i.length,o=i[0].depth;i.forEach((function(i){var s;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&k(i,r)>0);else if(0==o&&1==a)s=i.y1-i.y0,i.y0=T/2-s/2,i.y1=T/2+s/2;else if(o==n-1&&1==a)s=i.y1-i.y0,i.y0=T/2-s/2,i.y1=T/2+s/2;else{var l=e.mean(i.sourceLinks,m),c=e.mean(i.targetLinks,d),u=((l&&c?(l+c)/2:l||c)-p(i))*t;i.y0+=u,i.y1+=u}}))}))}function y(){c.forEach((function(e){var r,n,i,o=a,s=e.length;for(e.sort(f),i=0;i0&&(r.y0+=n,r.y1+=n),o=r.y1+t;if((n=o-t-T)>0)for(o=r.y0-=n,r.y1-=n,i=s-2;i>=0;--i)(n=(r=e[i]).y1+t-o)>0&&(r.y0-=n,r.y1-=n),o=r.y0}))}}function V(t){t.nodes.forEach((function(t){t.sourceLinks.sort(u),t.targetLinks.sort(c)})),t.nodes.forEach((function(t){var e=t.y0,r=e,n=t.y1,i=n;t.sourceLinks.forEach((function(t){t.circular?(t.y0=n-t.width/2,n-=t.width):(t.y0=e+t.width/2,e+=t.width)})),t.targetLinks.forEach((function(t){t.circular?(t.y1=i-t.width/2,i-=t.width):(t.y1=r+t.width/2,r+=t.width)}))}))}return z.nodeId=function(t){return arguments.length?(M="function"==typeof t?t:s(t),z):M},z.nodeAlign=function(t){return arguments.length?(E="function"==typeof t?t:s(t),z):E},z.nodeWidth=function(t){return arguments.length?(A=+t,z):A},z.nodePadding=function(e){return arguments.length?(t=+e,z):t},z.nodes=function(t){return arguments.length?(L="function"==typeof t?t:s(t),z):L},z.links=function(t){return arguments.length?(C="function"==typeof t?t:s(t),z):C},z.size=function(t){return arguments.length?(i=a=0,b=+t[0],T=+t[1],z):[b-i,T-a]},z.extent=function(t){return arguments.length?(i=+t[0][0],b=+t[1][0],a=+t[0][1],T=+t[1][1],z):[[i,a],[b,T]]},z.iterations=function(t){return arguments.length?(P=+t,z):P},z.circularLinkGap=function(t){return arguments.length?(I=+t,z):I},z.nodePaddingRatio=function(t){return arguments.length?(n=+t,z):n},z.sortNodes=function(t){return arguments.length?(O=t,z):O},z.update=function(t){return w(t,M),V(t),t.links.forEach((function(t){t.circular&&(t.circularLinkType=t.y0+t.y1a&&(b=a);var o=e.min(i,(function(t){return(y-n-(t.length-1)*b)/e.sum(t,u)}));i.forEach((function(t){t.forEach((function(t,e){t.y1=(t.y0=e)+t.value*o}))})),t.links.forEach((function(t){t.width=t.value*o}))}(),d();for(var a=1,o=A;o>0;--o)l(a*=.99),d(),s(a),d();function s(t){i.forEach((function(r){r.forEach((function(r){if(r.targetLinks.length){var n=(e.sum(r.targetLinks,h)/e.sum(r.targetLinks,u)-f(r))*t;r.y0+=n,r.y1+=n}}))}))}function l(t){i.slice().reverse().forEach((function(r){r.forEach((function(r){if(r.sourceLinks.length){var n=(e.sum(r.sourceLinks,p)/e.sum(r.sourceLinks,u)-f(r))*t;r.y0+=n,r.y1+=n}}))}))}function d(){i.forEach((function(t){var e,r,i,a=n,o=t.length;for(t.sort(c),i=0;i0&&(e.y0+=r,e.y1+=r),a=e.y1+b;if((r=a-b-y)>0)for(a=e.y0-=r,e.y1-=r,i=o-2;i>=0;--i)(r=(e=t[i]).y1+b-a)>0&&(e.y0-=r,e.y1-=r),a=e.y0}))}}function P(t){t.nodes.forEach((function(t){t.sourceLinks.sort(l),t.targetLinks.sort(s)})),t.nodes.forEach((function(t){var e=t.y0,r=e;t.sourceLinks.forEach((function(t){t.y0=e+t.width/2,e+=t.width})),t.targetLinks.forEach((function(t){t.y1=r+t.width/2,r+=t.width}))}))}return M.update=function(t){return P(t),t},M.nodeId=function(t){return arguments.length?(_="function"==typeof t?t:o(t),M):_},M.nodeAlign=function(t){return arguments.length?(w="function"==typeof t?t:o(t),M):w},M.nodeWidth=function(t){return arguments.length?(x=+t,M):x},M.nodePadding=function(t){return arguments.length?(b=+t,M):b},M.nodes=function(t){return arguments.length?(T="function"==typeof t?t:o(t),M):T},M.links=function(t){return arguments.length?(k="function"==typeof t?t:o(t),M):k},M.size=function(e){return arguments.length?(t=n=0,i=+e[0],y=+e[1],M):[i-t,y-n]},M.extent=function(e){return arguments.length?(t=+e[0][0],i=+e[1][0],n=+e[0][1],y=+e[1][1],M):[[t,n],[i,y]]},M.iterations=function(t){return arguments.length?(A=+t,M):A},M},t.sankeyCenter=function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?e.min(t.sourceLinks,i)-1:0},t.sankeyLeft=function(t){return t.depth},t.sankeyRight=function(t,e){return e-1-t.height},t.sankeyJustify=a,t.sankeyLinkHorizontal=function(){return n.linkHorizontal().source(y).target(x)},Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-array":102,"d3-collection":103,"d3-shape":114}],58:[function(t,e,r){(function(){var t={version:"3.8.0"},r=[].slice,n=function(t){return r.call(t)},i=self.document;function a(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(i)try{n(i.documentElement.childNodes)[0].nodeType}catch(t){n=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),i)try{i.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var s=this.Element.prototype,l=s.setAttribute,c=s.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;s.setAttribute=function(t,e){l.call(this,t,e+"")},s.setAttributeNS=function(t,e,r){c.call(this,t,e,r+"")},u.setProperty=function(t,e,r){f.call(this,t,e+"",r)}}function h(t,e){return te?1:t>=e?0:NaN}function p(t){return null===t?NaN:+t}function d(t){return!isNaN(t)}function m(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}}t.ascending=h,t.descending=function(t,e){return et?1:e>=t?0:NaN},t.min=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++in&&(r=n)}else{for(;++i=n){r=n;break}for(;++in&&(r=n)}return r},t.max=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++ir&&(r=n)}else{for(;++i=n){r=n;break}for(;++ir&&(r=n)}return r},t.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=i=n;break}for(;++an&&(r=n),i=n){r=i=n;break}for(;++an&&(r=n),i1)return o/(l-1)},t.deviation=function(){var e=t.variance.apply(this,arguments);return e?Math.sqrt(e):e};var g=m(h);function v(t){return t.length}t.bisectLeft=g.left,t.bisect=t.bisectRight=g.right,t.bisector=function(t){return m(1===t.length?function(e,r){return h(t(e),r)}:t)},t.shuffle=function(t,e,r){(a=arguments.length)<3&&(r=t.length,a<2&&(e=0));for(var n,i,a=r-e;a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},t.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},t.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r};var y=Math.abs;function x(t){for(var e=1;t*e%1;)e*=10;return e}function b(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function _(){this._=Object.create(null)}t.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r==1/0)throw new Error("infinite range");var n,i=[],a=x(y(r)),o=-1;if(t*=a,e*=a,(r*=a)<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=i.length)return r?r.call(n,a):e?a.sort(e):a;for(var l,c,u,f,h=-1,p=a.length,d=i[s++],m=new _;++h=i.length)return e;var n=[],o=a[r++];return e.forEach((function(e,i){n.push({key:e,values:t(i,r)})})),o?n.sort((function(t,e){return o(t.key,e.key)})):n}(o(t.map,e,0),0)},n.key=function(t){return i.push(t),n},n.sortKeys=function(t){return a[i.length-1]=t,n},n.sortValues=function(t){return e=t,n},n.rollup=function(t){return r=t,n},n},t.set=function(t){var e=new L;if(t)for(var r=0,n=t.length;r=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},t.event=null,t.requote=function(t){return t.replace(j,"\\$&")};var j=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,U={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function V(t){return U(t,Y),t}var H=function(t,e){return e.querySelector(t)},q=function(t,e){return e.querySelectorAll(t)},G=function(t,e){var r=t.matches||t[I(t,"matchesSelector")];return(G=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(H=function(t,e){return Sizzle(t,e)[0]||null},q=Sizzle,G=Sizzle.matchesSelector),t.selection=function(){return t.select(i.documentElement)};var Y=t.selection.prototype=[];function W(t){return"function"==typeof t?t:function(){return H(t,this)}}function X(t){return"function"==typeof t?t:function(){return q(t,this)}}Y.select=function(t){var e,r,n,i,a=[];t=W(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),J.hasOwnProperty(r)?{space:J[r],local:t}:t}},Y.attr=function(e,r){if(arguments.length<2){if("string"==typeof e){var n=this.node();return(e=t.ns.qualify(e)).local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(r in e)this.each(K(r,e[r]));return this}return this.each(K(e,r))},Y.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=tt(t)).length,i=-1;if(e=r.classList){for(;++i=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},Y.sort=function(t){t=ct.apply(this,arguments);for(var e=-1,r=this.length;++e=e&&(e=i+1);!(o=s[e])&&++e0&&(e=e.slice(0,o));var l=mt.get(e);function c(){var t=this[a];t&&(this.removeEventListener(e,t,t.$),delete this[a])}return l&&(e=l,s=vt),o?r?function(){var t=s(r,n(arguments));c.call(this),this.addEventListener(e,this[a]=t,t.$=i),t._=r}:c:r?z:function(){var r,n=new RegExp("^__on([^.]+)"+t.requote(e)+"$");for(var i in this)if(r=i.match(n)){var a=this[i];this.removeEventListener(r[1],a,a.$),delete this[i]}}}t.selection.enter=ft,t.selection.enter.prototype=ht,ht.append=Y.append,ht.empty=Y.empty,ht.node=Y.node,ht.call=Y.call,ht.size=Y.size,ht.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s1?Et:t<-1?-Et:Math.asin(t)}function It(t){return((t=Math.exp(t))+1/t)/2}var Ot=Math.SQRT2;t.interpolateZoom=function(t,e){var r,n,i=t[0],a=t[1],o=t[2],s=e[0],l=e[1],c=e[2],u=s-i,f=l-a,h=u*u+f*f;if(h<1e-12)n=Math.log(c/o)/Ot,r=function(t){return[i+t*u,a+t*f,o*Math.exp(Ot*t*n)]};else{var p=Math.sqrt(h),d=(c*c-o*o+4*h)/(2*o*2*p),m=(c*c-o*o-4*h)/(2*c*2*p),g=Math.log(Math.sqrt(d*d+1)-d),v=Math.log(Math.sqrt(m*m+1)-m);n=(v-g)/Ot,r=function(t){var e,r=t*n,s=It(g),l=o/(2*p)*(s*(e=Ot*r+g,((e=Math.exp(2*e))-1)/(e+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+l*u,a+l*f,o*s/It(Ot*r+g)]}}return r.duration=1e3*n,r},t.behavior.zoom=function(){var e,r,n,a,s,l,c,u,f,h={x:0,y:0,k:1},p=[960,500],d=Rt,m=250,g=0,v="mousedown.zoom",y="mousemove.zoom",x="mouseup.zoom",b="touchstart.zoom",_=N(w,"zoomstart","zoom","zoomend");function w(t){t.on(v,P).on(Dt+".zoom",O).on("dblclick.zoom",z).on(b,I)}function T(t){return[(t[0]-h.x)/h.k,(t[1]-h.y)/h.k]}function k(t){h.k=Math.max(d[0],Math.min(d[1],t))}function A(t,e){e=function(t){return[t[0]*h.k+h.x,t[1]*h.k+h.y]}(e),h.x+=t[0]-e[0],h.y+=t[1]-e[1]}function M(e,n,i,a){e.__chart__={x:h.x,y:h.y,k:h.k},k(Math.pow(2,a)),A(r=n,i),e=t.select(e),m>0&&(e=e.transition().duration(m)),e.call(w.event)}function S(){c&&c.domain(l.range().map((function(t){return(t-h.x)/h.k})).map(l.invert)),f&&f.domain(u.range().map((function(t){return(t-h.y)/h.k})).map(u.invert))}function E(t){g++||t({type:"zoomstart"})}function L(t){S(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function C(t){--g||(t({type:"zoomend"}),r=null)}function P(){var e=this,r=_.of(e,arguments),n=0,i=t.select(o(e)).on(y,l).on(x,c),a=T(t.mouse(e)),s=bt(e);function l(){n=1,A(t.mouse(e),a),L(r)}function c(){i.on(y,null).on(x,null),s(n),C(r)}Di.call(e),E(r)}function I(){var e,r=this,n=_.of(r,arguments),i={},a=0,o=".zoom-"+t.event.changedTouches[0].identifier,l="touchmove"+o,c="touchend"+o,u=[],f=t.select(r),p=bt(r);function d(){var n=t.touches(r);return e=h.k,n.forEach((function(t){t.identifier in i&&(i[t.identifier]=T(t))})),n}function m(){var e=t.event.target;t.select(e).on(l,g).on(c,y),u.push(e);for(var n=t.event.changedTouches,o=0,f=n.length;o1){v=p[0];var x=p[1],b=v[0]-x[0],_=v[1]-x[1];a=b*b+_*_}}function g(){var o,l,c,u,f=t.touches(r);Di.call(r);for(var h=0,p=f.length;h360?t-=360:t<0&&(t+=360),t<60?n+(i-n)*t/60:t<180?i:t<240?n+(i-n)*(240-t)/60:n}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)||e<0?0:e>1?1:e,n=2*(r=r<0?0:r>1?1:r)-(i=r<=.5?r*(1+e):r+e-r*e),new Qt(a(t+120),a(t),a(t-120))}function Ut(e,r,n){return this instanceof Ut?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Ut?new Ut(e.h,e.c,e.l):Xt(e instanceof qt?e.l:(e=ae((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Ut(e,r,n)}Nt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Bt(this.h,this.s,this.l/t)},Nt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Bt(this.h,this.s,t*this.l)},Nt.rgb=function(){return jt(this.h,this.s,this.l)},t.hcl=Ut;var Vt=Ut.prototype=new Ft;function Ht(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new qt(r,Math.cos(t*=Lt)*e,Math.sin(t)*e)}function qt(t,e,r){return this instanceof qt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof qt?new qt(t.l,t.a,t.b):t instanceof Ut?Ht(t.h,t.c,t.l):ae((t=Qt(t)).r,t.g,t.b):new qt(t,e,r)}Vt.brighter=function(t){return new Ut(this.h,this.c,Math.min(100,this.l+Gt*(arguments.length?t:1)))},Vt.darker=function(t){return new Ut(this.h,this.c,Math.max(0,this.l-Gt*(arguments.length?t:1)))},Vt.rgb=function(){return Ht(this.h,this.c,this.l).rgb()},t.lab=qt;var Gt=18,Yt=qt.prototype=new Ft;function Wt(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return new Qt(Kt(3.2404542*(i=.95047*Zt(i))-1.5371385*(n=1*Zt(n))-.4985314*(a=1.08883*Zt(a))),Kt(-.969266*i+1.8760108*n+.041556*a),Kt(.0556434*i-.2040259*n+1.0572252*a))}function Xt(t,e,r){return t>0?new Ut(Math.atan2(r,e)*Ct,Math.sqrt(e*e+r*r),t):new Ut(NaN,NaN,t)}function Zt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function Jt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function Kt(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function Qt(t,e,r){return this instanceof Qt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof Qt?new Qt(t.r,t.g,t.b):ne(""+t,Qt,jt):new Qt(t,e,r)}function $t(t){return new Qt(t>>16,t>>8&255,255&t)}function te(t){return $t(t)+""}Yt.brighter=function(t){return new qt(Math.min(100,this.l+Gt*(arguments.length?t:1)),this.a,this.b)},Yt.darker=function(t){return new qt(Math.max(0,this.l-Gt*(arguments.length?t:1)),this.a,this.b)},Yt.rgb=function(){return Wt(this.l,this.a,this.b)},t.rgb=Qt;var ee=Qt.prototype=new Ft;function re(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function ne(t,e,r){var n,i,a,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(se(i[0]),se(i[1]),se(i[2]))}return(a=le.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function ie(t,e,r){var n,i,a=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),n=t==o?(e-r)/s+(e0&&l<1?0:n),new Bt(n,i,l)}function ae(t,e,r){var n=Jt((.4124564*(t=oe(t))+.3575761*(e=oe(e))+.1804375*(r=oe(r)))/.95047),i=Jt((.2126729*t+.7151522*e+.072175*r)/1);return qt(116*i-16,500*(n-i),200*(i-Jt((.0193339*t+.119192*e+.9503041*r)/1.08883)))}function oe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function se(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}ee.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,i=30;return e||r||n?(e&&e=200&&e<300||304===e){try{t=i.call(o,c)}catch(t){return void s.error.call(o,t)}s.load.call(o,t)}else s.error.call(o,c)}return self.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(e)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(e){var r=t.event;t.event=e;try{s.progress.call(o,c)}finally{t.event=r}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?l[t]:(null==e?delete l[t]:l[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(r=null==t?null:t+"",o):r},o.responseType=function(t){return arguments.length?(u=t,o):u},o.response=function(t){return i=t,o},["get","post"].forEach((function(t){o[t]=function(){return o.send.apply(o,[t].concat(n(arguments)))}})),o.send=function(t,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),c.open(t,e,!0),null==r||"accept"in l||(l.accept=r+",*/*"),c.setRequestHeader)for(var a in l)c.setRequestHeader(a,l[a]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=i&&o.on("error",i).on("load",(function(t){i(null,t)})),s.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},t.rebind(o,s,"on"),null==a?o:o.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(a))}le.forEach((function(t,e){le.set(t,$t(e))})),t.functor=ce,t.xhr=ue(C),t.dsv=function(t,e){var r=new RegExp('["'+t+"\n]"),n=t.charCodeAt(0);function i(t,r,n){arguments.length<3&&(n=r,r=null);var i=fe(t,e,null==r?a:o(r),n);return i.row=function(t){return arguments.length?i.response(null==(r=t)?a:o(t)):r},i}function a(t){return i.parse(t.responseText)}function o(t){return function(e){return i.parse(e.responseText,t)}}function s(e){return e.map(l).join(t)}function l(t){return r.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return i.parse=function(t,e){var r;return i.parseRows(t,(function(t,n){if(r)return r(t,n-1);var i=function(e){for(var r={},n=t.length,i=0;i=l)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++24?(isFinite(e)&&(clearTimeout(me),me=setTimeout(ye,e)),de=0):(de=1,ge(ye))}function xe(){for(var t=Date.now(),e=he;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function be(){for(var t,e=he,r=1/0;e;)e.c?(e.t1&&(e=t[a[o-2]],r=t[a[o-1]],n=t[s],(r[0]-e[0])*(n[1]-e[1])-(r[1]-e[1])*(n[0]-e[0])<=0);)--o;a[o++]=s}return a.slice(0,o)}function ke(t,e){return t[0]-e[0]||t[1]-e[1]}t.timer=function(){ve.apply(this,arguments)},t.timer.flush=function(){xe(),be()},t.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)},t.geom={},t.geom.hull=function(t){var e=_e,r=we;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,i=ce(e),a=ce(r),o=t.length,s=[],l=[];for(n=0;n=0;--n)p.push(t[s[c[n]][2]]);for(n=+f;nkt)s=s.L;else{if(!((i=a-Ve(s,o))>kt)){n>-kt?(e=s.P,r=s):i>-kt?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=Fe(t);if(Pe.insert(e,l),e||r){if(e===r)return We(e),r=Fe(e.site),Pe.insert(l,r),l.edge=r.edge=Je(e.site,l.site),Ye(e),void Ye(r);if(r){We(e),We(r);var c=e.site,u=c.x,f=c.y,h=t.x-u,p=t.y-f,d=r.site,m=d.x-u,g=d.y-f,v=2*(h*g-p*m),y=h*h+p*p,x=m*m+g*g,b={x:(g*y-p*x)/v+u,y:(h*x-m*y)/v+f};Qe(r.edge,c,d,b),l.edge=Je(c,t,null,b),r.edge=Je(t,d,null,b),Ye(e),Ye(r)}else l.edge=Je(e.site,l.site)}}function Ue(t,e){var r=t.site,n=r.x,i=r.y,a=i-e;if(!a)return n;var o=t.P;if(!o)return-1/0;var s=(r=o.site).x,l=r.y,c=l-e;if(!c)return s;var u=s-n,f=1/a-1/c,h=u/c;return f?(-h+Math.sqrt(h*h-2*f*(u*u/(-2*c)-l+c/2+i-a/2)))/f+n:(n+s)/2}function Ve(t,e){var r=t.N;if(r)return Ue(r,e);var n=t.site;return n.y===e?n.x:1/0}function He(t){this.site=t,this.edges=[]}function qe(t,e){return e.angle-t.angle}function Ge(){er(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ye(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,i=t.site,a=r.site;if(n!==a){var o=i.x,s=i.y,l=n.x-o,c=n.y-s,u=a.x-o,f=2*(l*(g=a.y-s)-c*u);if(!(f>=-1e-12)){var h=l*l+c*c,p=u*u+g*g,d=(g*h-c*p)/f,m=(l*p-u*h)/f,g=m+s,v=De.pop()||new Ge;v.arc=t,v.site=i,v.x=d+o,v.y=g+Math.sqrt(d*d+m*m),v.cy=g,t.circle=v;for(var y=null,x=Oe._;x;)if(v.y=s)return;if(h>d){if(a){if(a.y>=c)return}else a={x:g,y:l};r={x:g,y:c}}else{if(a){if(a.y1)if(h>d){if(a){if(a.y>=c)return}else a={x:(l-i)/n,y:l};r={x:(c-i)/n,y:c}}else{if(a){if(a.y=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.x0)){if(e/=h,h<0){if(e0){if(e>f)return;e>u&&(u=e)}if(e=i-l,h||!(e<0)){if(e/=h,h<0){if(e>f)return;e>u&&(u=e)}else if(h>0){if(e0)){if(e/=p,p<0){if(e0){if(e>f)return;e>u&&(u=e)}if(e=a-c,p||!(e<0)){if(e/=p,p<0){if(e>f)return;e>u&&(u=e)}else if(p>0){if(e0&&(t.a={x:l+u*h,y:c+u*p}),f<1&&(t.b={x:l+f*h,y:c+f*p}),t}}}}}),l=o.length;l--;)(!Xe(e=o[l],t)||!s(e)||y(e.a.x-e.b.x)kt||y(i-r)>kt)&&(s.splice(o,0,new $e(Ke(a.site,u,y(n-f)kt?{x:f,y:y(e-f)kt?{x:y(r-d)kt?{x:h,y:y(e-h)kt?{x:y(r-p)=r&&c.x<=i&&c.y>=n&&c.y<=o?[[r,o],[i,o],[i,n],[r,n]]:[]).point=t[s]})),e}function s(t){return t.map((function(t,e){return{x:Math.round(n(t,e)/kt)*kt,y:Math.round(i(t,e)/kt)*kt,i:e}}))}return o.links=function(t){return ar(s(t)).edges.filter((function(t){return t.l&&t.r})).map((function(e){return{source:t[e.l.i],target:t[e.r.i]}}))},o.triangles=function(t){var e=[];return ar(s(t)).cells.forEach((function(r,n){for(var i,a,o,s,l=r.site,c=r.edges.sort(qe),u=-1,f=c.length,h=c[f-1].edge,p=h.l===l?h.r:h.l;++ua||f>o||h=_)<<1|e>=b,T=w+4;wa&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:dr(r,n)})),a=vr.lastIndex;return am&&(m=l.x),l.y>g&&(g=l.y),c.push(l.x),u.push(l.y);else for(f=0;fm&&(m=b),_>g&&(g=_),c.push(b),u.push(_)}var w=m-p,T=g-d;function k(t,e,r,n,i,a,o,s){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var l=t.x,c=t.y;if(null!=l)if(y(l-r)+y(c-n)<.01)A(t,e,r,n,i,a,o,s);else{var u=t.point;t.x=t.y=t.point=null,A(t,u,l,c,i,a,o,s),A(t,e,r,n,i,a,o,s)}else t.x=r,t.y=n,t.point=e}else A(t,e,r,n,i,a,o,s)}function A(t,e,r,n,i,a,o,s){var l=.5*(i+o),c=.5*(a+s),u=r>=l,f=n>=c,h=f<<1|u;t.leaf=!1,u?i=l:o=l,f?a=c:s=c,k(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),e,r,n,i,a,o,s)}w>T?g=d+w:m=p+T;var M={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(M,t,+v(t,++f),+x(t,f),p,d,m,g)},visit:function(t){ur(t,M,p,d,m,g)},find:function(t){return fr(M,t[0],t[1],p,d,m,g)}};if(f=-1,null==e){for(;++f=0&&!(n=t.interpolators[i](e,r)););return n}function xr(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function kr(t){return function(e){return 1-t(1-e)}}function Ar(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Mr(t){return t*t}function Sr(t){return t*t*t}function Er(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Lr(t){return 1-Math.cos(t*Et)}function Cr(t){return Math.pow(2,10*(t-1))}function Pr(t){return 1-Math.sqrt(1-t*t)}function Ir(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function Or(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function zr(t){var e,r,n,i=[t.a,t.b],a=[t.c,t.d],o=Rr(i),s=Dr(i,a),l=Rr(((e=a)[0]+=(n=-s)*(r=i)[0],e[1]+=n*r[1],e))||0;i[0]*a[1]=0?t.slice(0,e):t,i=e>=0?t.slice(e+1):"in";return n=_r.get(n)||br,Tr((i=wr.get(i)||C)(n.apply(null,r.call(arguments,1))))},t.interpolateHcl=function(e,r){e=t.hcl(e),r=t.hcl(r);var n=e.h,i=e.c,a=e.l,o=r.h-n,s=r.c-i,l=r.l-a;isNaN(s)&&(s=0,i=isNaN(i)?r.c:i);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Ht(n+o*t,i+s*t,a+l*t)+""}},t.interpolateHsl=function(e,r){e=t.hsl(e),r=t.hsl(r);var n=e.h,i=e.s,a=e.l,o=r.h-n,s=r.s-i,l=r.l-a;isNaN(s)&&(s=0,i=isNaN(i)?r.s:i);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return jt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateLab=function(e,r){e=t.lab(e),r=t.lab(r);var n=e.l,i=e.a,a=e.b,o=r.l-n,s=r.a-i,l=r.b-a;return function(t){return Wt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateRound=Or,t.transform=function(e){var r=i.createElementNS(t.ns.prefix.svg,"g");return(t.transform=function(t){if(null!=t){r.setAttribute("transform",t);var e=r.transform.baseVal.consolidate()}return new zr(e?e.matrix:Fr)})(e)},zr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Fr={a:1,b:0,c:0,d:1,e:0,f:0};function Br(t){return t.length?t.pop()+",":""}function Nr(e,r){var n=[],i=[];return e=t.transform(e),r=t.transform(r),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push("translate(",null,",",null,")");n.push({i:i-4,x:dr(t[0],e[0])},{i:i-2,x:dr(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(e.translate,r.translate,n,i),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(Br(r)+"rotate(",null,")")-2,x:dr(t,e)})):e&&r.push(Br(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,i),function(t,e,r,n){t!==e?n.push({i:r.push(Br(r)+"skewX(",null,")")-2,x:dr(t,e)}):e&&r.push(Br(r)+"skewX("+e+")")}(e.skew,r.skew,n,i),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(Br(r)+"scale(",null,",",null,")");n.push({i:i-4,x:dr(t[0],e[0])},{i:i-2,x:dr(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(Br(r)+"scale("+e+")")}(e.scale,r.scale,n,i),e=r=null,function(t){for(var e,r=-1,a=i.length;++r0?n=t:(e.c=null,e.t=NaN,e=null,l.end({type:"end",alpha:n=0})):t>0&&(l.start({type:"start",alpha:n=t}),e=ve(s.tick)),s):n},s.start=function(){var t,e,r,n=v.length,l=y.length,u=c[0],d=c[1];for(t=0;t=0;)r.push(i[n])}function $r(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++o=0;)o.push(u=c[l]),u.parent=a,u.depth=a.depth+1;r&&(a.value=0),a.children=c}else r&&(a.value=+r.call(n,a,a.depth)||0),delete a.children;return $r(i,(function(e){var n,i;t&&(n=e.children)&&n.sort(t),r&&(i=e.parent)&&(i.value+=e.value)})),s}return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(Qr(t,(function(t){t.children&&(t.value=0)})),$r(t,(function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)}))),t},n},t.layout.partition=function(){var e=t.layout.hierarchy(),r=[1,1];function n(t,n){var i=e.call(this,t,n);return function t(e,r,n,i){var a=e.children;if(e.x=r,e.y=e.depth*i,e.dx=n,e.dy=i,a&&(o=a.length)){var o,s,l,c=-1;for(n=e.value?n/e.value:0;++cs&&(s=n),o.push(n)}for(r=0;ri&&(n=r,i=e);return n}function dn(t){return t.reduce(mn,0)}function mn(t,e){return t+e[1]}function gn(t,e){return vn(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function vn(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function yn(e){return[t.min(e),t.max(e)]}function xn(t,e){return t.value-e.value}function bn(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function _n(t,e){t._pack_next=e,e._pack_prev=t}function wn(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Tn(t){if((e=t.children)&&(l=e.length)){var e,r,n,i,a,o,s,l,c=1/0,u=-1/0,f=1/0,h=-1/0;if(e.forEach(kn),(r=e[0]).x=-r.r,r.y=0,x(r),l>1&&((n=e[1]).x=n.r,n.y=0,x(n),l>2))for(Mn(r,n,i=e[2]),x(i),bn(r,i),r._pack_prev=i,bn(i,n),n=r._pack_next,a=3;a0)for(o=-1;++o=f[0]&&l<=f[1]&&((s=c[t.bisect(h,l,1,d)-1]).y+=m,s.push(a[o]));return c}return a.value=function(t){return arguments.length?(r=t,a):r},a.range=function(t){return arguments.length?(n=ce(t),a):n},a.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return vn(e,t)}:ce(t),a):i},a.frequency=function(t){return arguments.length?(e=!!t,a):e},a},t.layout.pack=function(){var e,r=t.layout.hierarchy().sort(xn),n=0,i=[1,1];function a(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],c=i[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,$r(s,(function(t){t.r=+u(t.value)})),$r(s,Tn),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/c))/2;$r(s,(function(t){t.r+=f})),$r(s,Tn),$r(s,(function(t){t.r-=f}))}return function t(e,r,n,i){var a=e.children;if(e.x=r+=i*e.x,e.y=n+=i*e.y,e.r*=i,a)for(var o=-1,s=a.length;++op.x&&(p=t),t.depth>d.depth&&(d=t)}));var m=r(h,p)/2-h.x,g=n[0]/(p.x+r(p,h)/2+m),v=n[1]/(d.depth||1);Qr(u,(function(t){t.x=(t.x+m)*g,t.y=t.depth*v}))}return c}function o(t){var e=t.children,n=t.parent.children,i=t.i?n[t.i-1]:null;if(e.length){!function(t){var e,r=0,n=0,i=t.children,a=i.length;for(;--a>=0;)(e=i[a]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(t);var a=(e[0].z+e[e.length-1].z)/2;i?(t.z=i.z+r(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+r(t._,i._));t.parent.A=function(t,e,n){if(e){for(var i,a=t,o=t,s=e,l=a.parent.children[0],c=a.m,u=o.m,f=s.m,h=l.m;s=Ln(s),a=En(a),s&&a;)l=En(l),(o=Ln(o)).a=t,(i=s.z+f-a.z-c+r(s._,a._))>0&&(Cn(Pn(s,t,n),t,i),c+=i,u+=i),f+=s.m,c+=a.m,h+=l.m,u+=o.m;s&&!Ln(o)&&(o.t=s,o.m+=f-u),a&&!En(l)&&(l.t=a,l.m+=c-h,n=t)}return n}(t,i,t.parent.A||n[0])}function s(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function l(t){t.x*=n[0],t.y=t.depth*n[1]}return a.separation=function(t){return arguments.length?(r=t,a):r},a.size=function(t){return arguments.length?(i=null==(n=t)?l:null,a):i?null:n},a.nodeSize=function(t){return arguments.length?(i=null==(n=t)?null:l,a):i?n:null},Kr(a,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=Sn,n=[1,1],i=!1;function a(a,o){var s,l=e.call(this,a,o),c=l[0],u=0;$r(c,(function(e){var n=e.children;n&&n.length?(e.x=function(t){return t.reduce((function(t,e){return t+e.x}),0)/t.length}(n),e.y=function(e){return 1+t.max(e,(function(t){return t.y}))}(n)):(e.x=s?u+=r(e,s):0,e.y=0,s=e)}));var f=function t(e){var r=e.children;return r&&r.length?t(r[0]):e}(c),h=function t(e){var r,n=e.children;return n&&(r=n.length)?t(n[r-1]):e}(c),p=f.x-r(f,h)/2,d=h.x+r(h,f)/2;return $r(c,i?function(t){t.x=(t.x-c.x)*n[0],t.y=(c.y-t.y)*n[1]}:function(t){t.x=(t.x-p)/(d-p)*n[0],t.y=(1-(c.y?t.y/c.y:1))*n[1]}),l}return a.separation=function(t){return arguments.length?(r=t,a):r},a.size=function(t){return arguments.length?(i=null==(n=t),a):i?null:n},a.nodeSize=function(t){return arguments.length?(i=null!=(n=t),a):i?n:null},Kr(a,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,i=[1,1],a=null,o=In,s=!1,l="squarify",c=.5*(1+Math.sqrt(5));function u(t,e){for(var r,n,i=-1,a=t.length;++i0;)s.push(r=c[i-1]),s.area+=r.area,"squarify"!==l||(n=p(s,m))<=h?(c.pop(),h=n):(s.area-=s.pop().area,d(s,m,a,!1),m=Math.min(a.dx,a.dy),s.length=s.area=0,h=1/0);s.length&&(d(s,m,a,!0),s.length=s.area=0),e.forEach(f)}}function h(t){var e=t.children;if(e&&e.length){var r,n=o(t),i=e.slice(),a=[];for(u(i,n.dx*n.dy/t.value),a.area=0;r=i.pop();)a.push(r),a.area+=r.area,null!=r.z&&(d(a,r.z?n.dx:n.dy,n,!i.length),a.length=a.area=0);e.forEach(h)}}function p(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=r));return e*=e,(n*=n)?Math.max(e*i*c/n,n/(e*a*c)):1/0}function d(t,e,r,i){var a,o=-1,s=t.length,l=r.x,c=r.y,u=e?n(t.area/e):0;if(e==r.dx){for((i||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var e=t.random.normal.apply(t,arguments);return function(){return Math.exp(e())}},bates:function(e){var r=t.random.irwinHall(e);return function(){return r()/e}},irwinHall:function(t){return function(){for(var e=0,r=0;r2?jn:Rn,s=i?Ur:jr;return a=t(e,r,s,n),o=t(r,e,s,yr),l}function l(t){return a(t)}return l.invert=function(t){return o(t)},l.domain=function(t){return arguments.length?(e=t.map(Number),s()):e},l.range=function(t){return arguments.length?(r=t,s()):r},l.rangeRound=function(t){return l.range(t).interpolate(Or)},l.clamp=function(t){return arguments.length?(i=t,s()):i},l.interpolate=function(t){return arguments.length?(n=t,s()):n},l.ticks=function(t){return qn(e,t)},l.tickFormat=function(t,r){return d3_scale_linearTickFormat(e,t,r)},l.nice=function(t){return Vn(e,t),s()},l.copy=function(){return t(e,r,n,i)},s()}([0,1],[0,1],yr,!1)};t.scale.log=function(){return function t(e,r,n,i){function a(t){return(n?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(r)}function o(t){return n?Math.pow(r,t):-Math.pow(r,-t)}function s(t){return e(a(t))}return s.invert=function(t){return o(e.invert(t))},s.domain=function(t){return arguments.length?(n=t[0]>=0,e.domain((i=t.map(Number)).map(a)),s):i},s.base=function(t){return arguments.length?(r=+t,e.domain(i.map(a)),s):r},s.nice=function(){var t=Fn(i.map(a),n?Math:Gn);return e.domain(t),i=t.map(o),s},s.ticks=function(){var t=zn(i),e=[],s=t[0],l=t[1],c=Math.floor(a(s)),u=Math.ceil(a(l)),f=r%1?2:r;if(isFinite(u-c)){if(n){for(;c0;h--)e.push(o(c)*h);for(c=0;e[c]l;u--);e=e.slice(c,u)}return e},s.copy=function(){return t(e.copy(),r,n,i)},Un(s,e)}(t.scale.linear().domain([0,1]),10,!0,[1,10])};var Gn={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};function Yn(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}t.scale.pow=function(){return function t(e,r,n){var i=Yn(r),a=Yn(1/r);function o(t){return e(i(t))}return o.invert=function(t){return a(e.invert(t))},o.domain=function(t){return arguments.length?(e.domain((n=t.map(Number)).map(i)),o):n},o.ticks=function(t){return qn(n,t)},o.tickFormat=function(t,e){return d3_scale_linearTickFormat(n,t,e)},o.nice=function(t){return o.domain(Vn(n,t))},o.exponent=function(t){return arguments.length?(i=Yn(r=t),a=Yn(1/r),e.domain(n.map(i)),o):r},o.copy=function(){return t(e.copy(),r,n)},Un(o,e)}(t.scale.linear(),1,[0,1])},t.scale.sqrt=function(){return t.scale.pow().exponent(.5)},t.scale.ordinal=function(){return function e(r,n){var i,a,o;function s(t){return a[((i.get(t)||("range"===n.t?i.set(t,r.push(t)):NaN))-1)%a.length]}function l(e,n){return t.range(r.length).map((function(t){return e+n*t}))}return s.domain=function(t){if(!arguments.length)return r;r=[],i=new _;for(var e,a=-1,o=t.length;++a0?i[t-1]:r[0],tf?0:1;if(c=St)return l(c,p)+(s?l(s,1-p):"")+"Z";var d,m,g,v,y,x,b,_,w,T,k,A,M=0,S=0,E=[];if((v=(+o.apply(this,arguments)||0)/2)&&(g=n===Qn?Math.sqrt(s*s+c*c):+n.apply(this,arguments),p||(S*=-1),c&&(S=Pt(g/c*Math.sin(v))),s&&(M=Pt(g/s*Math.sin(v)))),c){y=c*Math.cos(u+S),x=c*Math.sin(u+S),b=c*Math.cos(f-S),_=c*Math.sin(f-S);var L=Math.abs(f-u-2*S)<=At?0:1;if(S&&ii(y,x,b,_)===p^L){var C=(u+f)/2;y=c*Math.cos(C),x=c*Math.sin(C),b=_=null}}else y=x=0;if(s){w=s*Math.cos(f-M),T=s*Math.sin(f-M),k=s*Math.cos(u+M),A=s*Math.sin(u+M);var P=Math.abs(u-f+2*M)<=At?0:1;if(M&&ii(w,T,k,A)===1-p^P){var I=(u+f)/2;w=s*Math.cos(I),T=s*Math.sin(I),k=A=null}}else w=T=0;if(h>kt&&(d=Math.min(Math.abs(c-s)/2,+r.apply(this,arguments)))>.001){m=s0?0:1}function ai(t,e,r,n,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?n:-n)/Math.sqrt(a*a+o*o),l=s*o,c=-s*a,u=t[0]+l,f=t[1]+c,h=e[0]+l,p=e[1]+c,d=(u+h)/2,m=(f+p)/2,g=h-u,v=p-f,y=g*g+v*v,x=r-n,b=u*p-h*f,_=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*v-g*_)/y,T=(-b*g-v*_)/y,k=(b*v+g*_)/y,A=(-b*g+v*_)/y,M=w-d,S=T-m,E=k-d,L=A-m;return M*M+S*S>E*E+L*L&&(w=k,T=A),[[w-l,T-c],[w*r/x,T*r/x]]}function oi(){return!0}function si(t){var e=_e,r=we,n=oi,i=ci,a=i.key,o=.7;function s(a){var s,l=[],c=[],u=-1,f=a.length,h=ce(e),p=ce(r);function d(){l.push("M",i(t(c),o))}for(;++u1&&i.push("H",n[0]);return i.join("")},"step-before":fi,"step-after":hi,basis:mi,"basis-open":function(t){if(t.length<4)return ci(t);var e,r=[],n=-1,i=t.length,a=[0],o=[0];for(;++n<3;)e=t[n],a.push(e[0]),o.push(e[1]);r.push(gi(xi,a)+","+gi(xi,o)),--n;for(;++n9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n));s=-1;for(;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}(t))}});function ci(t){return t.length>1?t.join("L"):t+"Z"}function ui(t){return t.join("L")+"Z"}function fi(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1){s=e[1],a=t[l],l++,n+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var c=2;c